## com.bbn.openmap.layer.shape
Class ESRIPolygonRecord

    java.lang.Object
      com.bbn.openmap.layer.shape.ShapeUtils
          com.bbn.openmap.layer.shape.ESRIRecord
              com.bbn.openmap.layer.shape.ESRIPolygonRecord

All Implemented Interfaces:
  ShapeConstants

Direct Known Subclasses:
  ESRILinkPolygonRecord

public class ESRIPolygonRecord
extends ESRIRecord

The Polygon record type. This class implements the ESRI Shapefile polygon AND arc/polyline record types.

Version:
  $Revision: 1.3.2.4 $ $Date: 2005/08/09 21:17:47 $
Author:
  Ray Tomlinson, Tom Mitchell <tmitchell@bbn.com>, HACK-author blame it on aculline

Field Summary
`ESRIBoundingBox` `bounds` The bounding box.
`ESRIPoly[]` `polygons` An array of polygons.
`protected int` `shapeType` Polygon or arc/polyline?.

Fields inherited from class com.bbn.openmap.layer.shape.ESRIRecord
`contentLength, recordNumber`

Fields inherited from interface com.bbn.openmap.dataAccess.shape.ShapeConstants

`DBF_ATTRIBUTE, DBF_CHARACTER, DBF_DATE, DBF_LOGICAL, DBF_MEMO, DBF_NUMERIC, DBF_TYPE_CHARACTER, DBF_TYPE_DATE, DBF_TYPE_LOGICAL, DBF_TYPE_MEMO, DBF_TYPE_NUMERIC, PARAM_DBF, PARAM_SHP, PARAM_SHX, SHAPE_BOUNDS_ATTRIBUTE, SHAPE_DBF_DASHPATTERN, SHAPE_DBF_DASHPHASE, SHAPE_DBF_DESCRIPTION, SHAPE_DBF_FILLCOLOR, SHAPE_DBF_INFO_ATTRIBUTE, SHAPE_DBF_LINECOLOR, SHAPE_DBF_LINEWIDTH, SHAPE_DBF_SELECTCOLOR, SHAPE_FILE_HEADER_LENGTH, SHAPE_FILE_RECORD_HEADER_LENGTH, SHAPE_INDEX_ATTRIBUTE, SHAPE_MAX_MEASURE_ATTRIBUTE, SHAPE_MAX_Z_ATTRIBUTE, SHAPE_MEASURE_ATTRIBUTE, SHAPE_MIN_MEASURE_ATTRIBUTE, SHAPE_MIN_Z_ATTRIBUTE, SHAPE_TYPE_ARC, SHAPE_TYPE_MULTIPATCH, SHAPE_TYPE_MULTIPOINT, SHAPE_TYPE_MULTIPOINTM, SHAPE_TYPE_MULTIPOINTZ, SHAPE_TYPE_NULL, SHAPE_TYPE_POINT, SHAPE_TYPE_POINTM, SHAPE_TYPE_POINTZ, SHAPE_TYPE_POLYGON, SHAPE_TYPE_POLYGONM, SHAPE_TYPE_POLYGONZ, SHAPE_TYPE_POLYLINE, SHAPE_TYPE_POLYLINEM, SHAPE_TYPE_POLYLINEZ, SHAPE_Z_ATTRIBUTE`

Constructor Summary
`ESRIPolygonRecord()`
`ESRIPolygonRecord(byte[] b, int off)` Initialize a polygon record from the given buffer.

Method Summary
`void` `add(float[] radians)` Add a poly to the record.
`OMGeometry` `addOMGeometry(OMGeometryList list)` Generates OMGeometry and adds them to the given list.
`void` `addOMGraphics(OMGraphicList list, DrawingAttributes drawingAttributes)` Generates 2D OMGraphics and adds them to the given list.
`ESRIBoundingBox` `getBoundingBox()` Gets this record's bounding box.
`int` `getRecordLength()` Yields the length of this record's data portion.
`int` `getShapeType()` Gets this record's shape type as an int.
`boolean` `isPolygon()` Is this a polygon or a arc/polyline?
`void` `setPolygon(boolean isPolygon)` Set the poly type (polygon or arc/polyline).
`int` `write(byte[] b, int off)` Writes this polygon to the given buffer at the given offset.

Methods inherited from class com.bbn.openmap.layer.shape.ESRIRecord
`getBinaryStoreSize, getContentLength, getRecordNumber`

Methods inherited from class com.bbn.openmap.layer.shape.ShapeUtils
`readBEInt, readBox, readLEDouble, readLEInt, readLEInt, readLELong, readPoint, writeBEInt, writeBox, writeLEDouble, writeLEInt, writeLELong, writePoint`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### shapeType

    protected int shapeType

  Polygon or arc/polyline?.

### bounds

    public ESRIBoundingBox bounds

  The bounding box.

### polygons

    public ESRIPoly[] polygons

  An array of polygons.

Constructor Detail

### ESRIPolygonRecord

    public ESRIPolygonRecord()

### ESRIPolygonRecord

    public ESRIPolygonRecord(byte[] b,
                             int off)
                      throws java.io.IOException

  Initialize a polygon record from the given buffer.

Parameters:
  `b` - the buffer
  `off` - the offset into the buffer where the data starts

Method Detail

### isPolygon

    public boolean isPolygon()

  Is this a polygon or a arc/polyline?

  Returns:
    boolean

### setPolygon

    public void setPolygon(boolean isPolygon)

  Set the poly type (polygon or arc/polyline).

### add

    public void add(float[] radians)

  Add a poly to the record.

  Parameters:
    `radians` - coordinates: y,x,y,x,... (lat,lon) order in RADIANS!

### addOMGraphics

    public void addOMGraphics(OMGraphicList list,
                              DrawingAttributes drawingAttributes)

  Generates 2D OMGraphics and adds them to the given list. If you are using jdk1.1.X, you'll have to comment out this method, because jdk1.1.X doesn't know about the java.awt.Stroke and java.awt.Paint interfaces.

  Specified by:
    `addOMGraphics` in class `ESRIRecord`
  Parameters:
    `list` - the graphics list
    `drawingAttributes` - the drawingAttributes to paint the poly.

### addOMGeometry

    public OMGeometry addOMGeometry(OMGeometryList list)

  Generates OMGeometry and adds them to the given list.

  Specified by:
    `addOMGeometry` in class `ESRIRecord`
  Parameters:
    `list` - the geometry list

### getBoundingBox

    public ESRIBoundingBox getBoundingBox()

  Gets this record's bounding box.

  Specified by:
    `getBoundingBox` in class `ESRIRecord`
  Returns:
    a bounding box

### getShapeType

    public int getShapeType()

  Gets this record's shape type as an int. Shape types are enumerated on the ShapeUtils class.

  Specified by:
    `getShapeType` in class `ESRIRecord`
  Returns:
    the shape type as an int (either SHAPE_TYPE_POLYGON or SHAPE_TYPE_ARC)

### getRecordLength

    public int getRecordLength()

  Yields the length of this record's data portion.

  (44 + (numParts * 4) + (numPoints * 16))
  3 Integers + 4 doubles == 3 * 4bytes + 4 * 8bytes == 12 + 32 == 44.

  Specified by:
    `getRecordLength` in class `ESRIRecord`
  Returns:
    number of bytes equal to the size of this record's data

### write

    public int write(byte[] b,
                     int off)

  Writes this polygon to the given buffer at the given offset.

  Overrides:
    `write` in class `ESRIRecord`
  Parameters:
    `b` - the buffer
    `off` - the offset
  Returns:
    the number of bytes written

Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details