deegree 2.5 (2011/06/29 09:44 build-8-official)

org.deegree.io.shpapi.shape_new
Class ShapePolygon

java.lang.Object
  extended by org.deegree.io.shpapi.shape_new.ShapePolyline
      extended by org.deegree.io.shpapi.shape_new.ShapePolygon
All Implemented Interfaces:
Shape

public class ShapePolygon
extends ShapePolyline

ShapePolygon corresponds to the Polygon, PolygonM and PolygonZ shapes of the shapefile spec.

Version:
$Revision: 18195 $, $Date: 2009-06-18 17:55:39 +0200 (Do, 18 Jun 2009) $
Author:
Andreas Schmitz, last edited by: $Author: mschneider $

Field Summary
 
Fields inherited from class org.deegree.io.shpapi.shape_new.ShapePolyline
crs, isM, isZ, points
 
Constructor Summary
ShapePolygon(boolean z, boolean m)
          Creates a new Polygon/M/Z.
ShapePolygon(boolean z, boolean m, CoordinateSystem crs)
          Creates a new Polygon/M/Z.
ShapePolygon(java.util.List<Curve> curves)
          Creates a PolygonZ from deegree Curves.
 
Method Summary
 Geometry getGeometry()
          This creates a Surface object.
 int getType()
           
 void normalize()
          Normalizes the orientation etc. of this polygon as required by the shapefile spec.
 int read(byte[] bytes, int offset)
          Reads the object from a byte array.
 int write(byte[] bytes, int offset)
          Note that the normalize method will be called automatically, if it has not been called before.
 
Methods inherited from class org.deegree.io.shpapi.shape_new.ShapePolyline
getByteLength, getEnvelope, readPolyline, readPolylineM, readPolylineZ, toString, writePolyline, writePolylineM, writePolylineZ
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ShapePolygon

public ShapePolygon(boolean z,
                    boolean m)
Creates a new Polygon/M/Z.

Parameters:
z -
m -

ShapePolygon

public ShapePolygon(boolean z,
                    boolean m,
                    CoordinateSystem crs)
Creates a new Polygon/M/Z.

Parameters:
z -
m -
crs - CoordinateSystem of the shape

ShapePolygon

public ShapePolygon(java.util.List<Curve> curves)
Creates a PolygonZ from deegree Curves.

Parameters:
curves -
Method Detail

normalize

public void normalize()
Normalizes the orientation etc. of this polygon as required by the shapefile spec. This means (to my understanding), that the outer ring runs clockwise while the inner rings run counter-clockwise.


read

public int read(byte[] bytes,
                int offset)
Description copied from interface: Shape
Reads the object from a byte array.

Specified by:
read in interface Shape
Overrides:
read in class ShapePolyline
offset - where to start reading
Returns:
the new offset or -1, if the type was wrong.

write

public int write(byte[] bytes,
                 int offset)
Note that the normalize method will be called automatically, if it has not been called before.

Specified by:
write in interface Shape
Overrides:
write in class ShapePolyline
Returns:
the new offset.
See Also:
Shape.write(byte[], int)

getType

public int getType()
Specified by:
getType in interface Shape
Overrides:
getType in class ShapePolyline
Returns:
the type of the shape

getGeometry

public Geometry getGeometry()
                     throws ShapeGeometryException
This creates a Surface object.

Specified by:
getGeometry in interface Shape
Overrides:
getGeometry in class ShapePolyline
Returns:
the shape as deegree Geometry
Throws:
ShapeGeometryException - if the deegree geometry could not be constructed
See Also:
Shape.getGeometry()

deegree 2.5 (2011/06/29 09:44 build-8-official)

an open source project founded by lat/lon, Bonn, Germany.
For more information visit: http://www.deegree.org