Class PolygonHandler
- java.lang.Object
-
- org.h2gis.functions.io.shp.internal.PolygonHandler
-
- All Implemented Interfaces:
ShapeHandler
public class PolygonHandler extends Object implements ShapeHandler
Wrapper for a Shapefile polygon.- Version:
- $Id: PolygonHandler.java 22264 2006-10-19 10:10:35Z acuster $
- Author:
- aaime, Ian Schneider
- See Also:
- "http://svn.geotools.org/geotools/tags/2.3.1/plugin/shapefile/src/org/geotools/data/shapefile/shp/PolygonHandler.java"
-
-
Constructor Summary
Constructors Constructor Description PolygonHandler()PolygonHandler(ShapeType type)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static intcomputeOrientation(org.locationtech.jts.geom.CoordinateSequence cs, int p1, int p2, int q)intgetLength(org.locationtech.jts.geom.Geometry geometry)Get the length of the given geometry Object in bytes not 16-bit words.ShapeTypegetShapeType()Get the ShapeType of this handler.static booleanisCCW(org.locationtech.jts.geom.CoordinateSequence ring)Computes whether a ring defined by an array ofCoordinates is oriented counter-clockwise.org.locationtech.jts.geom.Geometryread(ReadBufferManager buffer, ShapeType type)Read a geometry from the ByteBuffer.The buffer's position, byteOrder, and limit are set to that which is needed.voidwrite(WriteBufferManager buffer, org.locationtech.jts.geom.Geometry geometry)Write the geometry into the ByteBuffer.
-
-
-
Constructor Detail
-
PolygonHandler
public PolygonHandler()
-
PolygonHandler
public PolygonHandler(ShapeType type) throws ShapefileException
- Throws:
ShapefileException
-
-
Method Detail
-
getShapeType
public ShapeType getShapeType()
Description copied from interface:ShapeHandlerGet the ShapeType of this handler.- Specified by:
getShapeTypein interfaceShapeHandler- Returns:
- The ShapeType.
-
getLength
public int getLength(org.locationtech.jts.geom.Geometry geometry)
Description copied from interface:ShapeHandlerGet the length of the given geometry Object in bytes not 16-bit words. This is easier to keep track of, since the ByteBuffer deals with bytes. Do not include the 8 bytes of record.- Specified by:
getLengthin interfaceShapeHandler- Parameters:
geometry- The geometry to analyze.- Returns:
- The number of bytes the shape will take up.
-
read
public org.locationtech.jts.geom.Geometry read(ReadBufferManager buffer, ShapeType type) throws IOException
Description copied from interface:ShapeHandlerRead a geometry from the ByteBuffer.The buffer's position, byteOrder, and limit are set to that which is needed. The record has been read as well as the shape type integer. The handler need not worry about reading unused information as the ShapefileReader will correctly adjust the buffer position after this call.- Specified by:
readin interfaceShapeHandler- Parameters:
buffer- The ByteBuffer to read from.type- The shape type- Returns:
- A geometry object.
- Throws:
IOException
-
isCCW
public static boolean isCCW(org.locationtech.jts.geom.CoordinateSequence ring)
Computes whether a ring defined by an array ofCoordinates is oriented counter-clockwise.- The list of points is assumed to have the first and last points equal.
- This will handle coordinate lists which contain repeated points.
- Parameters:
ring- an array of Coordinates forming a ring- Returns:
- true if the ring is oriented counter-clockwise.
-
computeOrientation
public static int computeOrientation(org.locationtech.jts.geom.CoordinateSequence cs, int p1, int p2, int q)
-
write
public void write(WriteBufferManager buffer, org.locationtech.jts.geom.Geometry geometry) throws IOException
Description copied from interface:ShapeHandlerWrite the geometry into the ByteBuffer. The position, byteOrder, and limit are all set. The handler is not responsible for writing the record or shape type integer.- Specified by:
writein interfaceShapeHandler- Parameters:
buffer- The ByteBuffer to write to.geometry- The geometry to write.- Throws:
IOException
-
-