Package org.postgis.java2d
Class PGShapeGeometry
- java.lang.Object
-
- org.postgresql.util.PGobject
-
- org.postgis.java2d.PGShapeGeometry
-
- All Implemented Interfaces:
Shape,Serializable,Cloneable
public class PGShapeGeometry extends org.postgresql.util.PGobject implements Shape
PostGIS Java2D geometry implementation (read-only). Supports PostGIS 1.x (lwgeom hexwkb). As the java.awt.Shape methods currently are implemented by using a java.awt.geom.GeneralPath object, they have the same semantics. NOTE: (Multi)Points are translated into a sequence of single MoveTo and LineTo commands, but WITHOUT a closePath command. When rendering with a stroke that is not solid, the points may not be rendered. (Multi)LineStrings are translated into a sequence of a single MoveTo and multiple LineTo vertices, and Polygon rings into a sequence of a single MoveTo, multiple LineTo and a closePath command. To allow correct Polygon filling, our PathIterators have GeneralPath.WIND_EVEN_ODD as winding rule.- Author:
- Markus Schaber
- See Also:
GeneralPath,Shape,PGobject, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description PGShapeGeometry()Constructor called by JDBC drivers.PGShapeGeometry(GeneralPath path, int srid)Construct directly from a General Path and SRID valuePGShapeGeometry(String value)Construct with HexWKB representation
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontains(double x, double y)booleancontains(double x, double y, double w, double h)booleancontains(Point2D p)booleancontains(Rectangle2D r)booleanequals(Object obj)RectanglegetBounds()Rectangle2DgetBounds2D()PathIteratorgetPathIterator(AffineTransform at)PathIteratorgetPathIterator(AffineTransform at, double flatness)intgetSRID()Return the SRID or Geometry.UNKNOWN_SRID if none was availableStringgetValue()We currently have read-only support, so this method returns nullbooleanintersects(double x, double y, double w, double h)booleanintersects(Rectangle2D r)voidsetValue(String value)Reads the HexWKB representation - to be called by the jdbc drivers.StringtoString()
-
-
-
Constructor Detail
-
PGShapeGeometry
public PGShapeGeometry()
Constructor called by JDBC drivers. call setValue afterwards to fill with Geometry data.
-
PGShapeGeometry
public PGShapeGeometry(GeneralPath path, int srid)
Construct directly from a General Path and SRID value- Parameters:
path- GeneralPath to be usedsrid- SRID value to be used
-
PGShapeGeometry
public PGShapeGeometry(String value) throws SQLException
Construct with HexWKB representation- Parameters:
value- String representation of the HexWKB data- Throws:
SQLException- when a SQLException occurs
-
-
Method Detail
-
setValue
public void setValue(String value) throws SQLException
Reads the HexWKB representation - to be called by the jdbc drivers. Be shure to call this only once and if you used the PGShapeGeometry() constructor without parameters. In all other cases, behaviour is undefined.- Overrides:
setValuein classorg.postgresql.util.PGobject- Throws:
SQLException
-
toString
public String toString()
- Overrides:
toStringin classorg.postgresql.util.PGobject
-
getValue
public String getValue()
We currently have read-only support, so this method returns null- Overrides:
getValuein classorg.postgresql.util.PGobject
-
equals
public boolean equals(Object obj)
- Overrides:
equalsin classorg.postgresql.util.PGobject
-
getSRID
public int getSRID()
Return the SRID or Geometry.UNKNOWN_SRID if none was available- Returns:
- the SRID value to be used
-
contains
public boolean contains(double x, double y, double w, double h)
-
intersects
public boolean intersects(double x, double y, double w, double h)- Specified by:
intersectsin interfaceShape
-
getBounds2D
public Rectangle2D getBounds2D()
- Specified by:
getBounds2Din interfaceShape
-
contains
public boolean contains(Rectangle2D r)
-
intersects
public boolean intersects(Rectangle2D r)
- Specified by:
intersectsin interfaceShape
-
getPathIterator
public PathIterator getPathIterator(AffineTransform at)
- Specified by:
getPathIteratorin interfaceShape
-
getPathIterator
public PathIterator getPathIterator(AffineTransform at, double flatness)
- Specified by:
getPathIteratorin interfaceShape
-
-