Class PGboxbase

  • All Implemented Interfaces:
    Serializable, Cloneable
    Direct Known Subclasses:
    PGbox2d, PGbox3d

    @NonNullByDefault({PARAMETER,RETURN_TYPE})
    public abstract class PGboxbase
    extends org.postgresql.util.PGobject
    Base class for bounding boxes.
    Author:
    Sebastian Baumhekel
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected Point llb
      The lower left bottom corner of the box.
      protected Point urt
      The upper right top corner of the box.
      • Fields inherited from class org.postgresql.util.PGobject

        type, value
    • Field Detail

      • llb

        protected Point llb
        The lower left bottom corner of the box.
      • urt

        protected Point urt
        The upper right top corner of the box.
    • Constructor Detail

      • PGboxbase

        protected PGboxbase​(String type)
        Constructs an instance.
        Parameters:
        type - type of this PGobject
      • PGboxbase

        protected PGboxbase​(String type,
                            Point llb,
                            Point urt)
        Constructs an instance.
        Parameters:
        type - type of this PGobject
        llb - lower left Point
        urt - upper right Point
      • PGboxbase

        protected PGboxbase​(String type,
                            String value)
                     throws SQLException
        Constructs an instance.
        Parameters:
        type - type of this PGobject
        value - WKT
        Throws:
        SQLException
    • Method Detail

      • equals

        public boolean equals​(@Nullable
                              Object obj)
        Overrides:
        equals in class org.postgresql.util.PGobject
      • getLLB

        public Point getLLB()
        Returns the lower left bottom corner of the box as a Point object
        Returns:
        lower left bottom corner of this box
      • getPrefix

        protected abstract String getPrefix()
        The Prefix we have in WKT rep. I use an abstract method here so we do not need to replicate the String object in every instance.
        Returns:
        the prefix, as a string
      • getSrid

        public int getSrid()
        The OGIS geometry type number of this geometry.
        Returns:
        the SRID of this geometry
      • getURT

        public Point getURT()
        Returns the upper right top corner of the box as a Point object
        Returns:
        upper right top corner of this box
      • getValue

        @Nonnull
        public String getValue()
        Overrides:
        getValue in class org.postgresql.util.PGobject
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class org.postgresql.util.PGobject
      • is3d

        public abstract boolean is3d()
        Checks if this box is 3d.
        Returns:
        true on success, else false
      • isEmpty

        public boolean isEmpty()
        Ist this box empty, so does it contain no coordinates?
        Returns:
        true on success, else false
      • setSrid

        public void setSrid​(int srid)
        Recursively sets the srid on this geometry and all contained subgeometries
        Parameters:
        srid - the SRID for this geometry
      • setValue

        public void setValue​(@Nonnull
                             String value)
                      throws SQLException
        Overrides:
        setValue in class org.postgresql.util.PGobject
        Throws:
        SQLException
      • toString

        public String toString()
        Unlike geometries, toString() does _not_ contain the srid, as server-side PostGIS cannot parse this.
        Overrides:
        toString in class org.postgresql.util.PGobject
        Returns:
        String representation of this box