Class 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 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 used
        srid - 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:
        setValue in class org.postgresql.util.PGobject
        Throws:
        SQLException
      • toString

        public String toString()
        Overrides:
        toString in class org.postgresql.util.PGobject
      • getValue

        public String getValue()
        We currently have read-only support, so this method returns null
        Overrides:
        getValue in class org.postgresql.util.PGobject
      • equals

        public boolean equals​(Object obj)
        Overrides:
        equals in class org.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)
        Specified by:
        contains in interface Shape
      • contains

        public boolean contains​(double x,
                                double y,
                                double w,
                                double h)
        Specified by:
        contains in interface Shape
      • intersects

        public boolean intersects​(double x,
                                  double y,
                                  double w,
                                  double h)
        Specified by:
        intersects in interface Shape