com.partnersoft.formats.shapefile
Class ShpPolygon

java.lang.Object
  extended by com.partnersoft.formats.shapefile.ShpPolygon
All Implemented Interfaces:
Immutable, ShpShape

public class ShpPolygon
extends java.lang.Object
implements ShpShape

ESRI's multiple part (ring) polygon in (x, y) space.

By our definitions, a shapefile Polygon entity is really a list of polygon objects. Each of these is stored as a series of connected vertices.

Copyright 2007 Partner Software, Inc.

Version:
$Id: ShpPolyLine.java 1247 2008-03-21 17:54:34Z paul $
Author:
Paul Reavis

Constructor Summary
ShpPolygon(ShapeByteReader reader)
          Creates a new ShpPolygon object from the given input.
 
Method Summary
 XyBounds getBounds()
          Return the bounds.
 int getNumParts()
          The number of polyline parts.
 int getNumPoints()
          The total number of points of all parts.
 java.util.List<java.util.List<ShpPoint>> getPoints()
          Returns the points as a list of lists.
 ShapeType getType()
          Returns the type for this shape.
 java.lang.String toString()
           
 java.util.List<XyPolygon> toXyPolygons()
          Converts the ShpPolyLine to a list of XyPolygon objects, one for each part (ring).
 java.util.List<XyPolyline> toXyPolylines()
          Converts the ShpPolyLine to a list of XyPolyline objects, one for each part (ring).
 void writeBytes(ShapeByteWriter writer)
          Writes this shape, in binary format, to the given output.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ShpPolygon

public ShpPolygon(ShapeByteReader reader)
Creates a new ShpPolygon object from the given input.

Method Detail

toXyPolylines

public java.util.List<XyPolyline> toXyPolylines()
Converts the ShpPolyLine to a list of XyPolyline objects, one for each part (ring).


toXyPolygons

public java.util.List<XyPolygon> toXyPolygons()
Converts the ShpPolyLine to a list of XyPolygon objects, one for each part (ring).


getType

public ShapeType getType()
Description copied from interface: ShpShape
Returns the type for this shape.

Specified by:
getType in interface ShpShape

writeBytes

public void writeBytes(ShapeByteWriter writer)
Description copied from interface: ShpShape
Writes this shape, in binary format, to the given output. Does not include the type code.

Specified by:
writeBytes in interface ShpShape

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getNumParts

public int getNumParts()
The number of polyline parts.


getNumPoints

public int getNumPoints()
The total number of points of all parts.

Returns:
number of points

getPoints

public java.util.List<java.util.List<ShpPoint>> getPoints()
Returns the points as a list of lists. Each sublist is one of the parts.


getBounds

public XyBounds getBounds()
Return the bounds.