Class GeometryWithCRS<G>

Type Parameters:
G - root class of geometry instances of the underlying library.
All Implemented Interfaces:
org.opengis.geometry.Geometry
Direct Known Subclasses:
PointWrapper, Wrapper, Wrapper

public abstract class GeometryWithCRS<G> extends GeometryWrapper<G>
A geometry wrapper with a field for CRS information. This base class is used when the geometry implementation to wrap does not store CRS information by itself. See GeometryWrapper for more information.
Since:
1.1
Version:
1.1
  • Field Details

    • crs

      private org.opengis.referencing.crs.CoordinateReferenceSystem crs
      The coordinate reference system, or null if unspecified.
  • Constructor Details

    • GeometryWithCRS

      protected GeometryWithCRS()
      Creates a new instance initialized with null CRS.
  • Method Details

    • getCoordinateReferenceSystem

      public final org.opengis.referencing.crs.CoordinateReferenceSystem getCoordinateReferenceSystem()
      Gets the Coordinate Reference System (CRS) of this geometry.
      Specified by:
      getCoordinateReferenceSystem in class GeometryWrapper<G>
      Returns:
      the geometry CRS, or null if unknown.
    • setCoordinateReferenceSystem

      public final void setCoordinateReferenceSystem(org.opengis.referencing.crs.CoordinateReferenceSystem crs)
      Sets the coordinate reference system, which shall be two-dimensional.
      Specified by:
      setCoordinateReferenceSystem in class GeometryWrapper<G>
      Parameters:
      crs - the coordinate reference system to set.
      See Also:
    • isSameCRS

      public final boolean isSameCRS(GeometryWrapper<G> other)
      Returns true if the given geometry use the same CRS than this geometry, or conservatively returns false in case of doubt. This method should perform only a cheap test; it is used as a way to filter rapidly if GeometryWrapper.transform(CoordinateReferenceSystem) needs to be invoked.
      Specified by:
      isSameCRS in class GeometryWrapper<G>
      Parameters:
      other - the second geometry.
      Returns:
      true if the two geometries use equivalent CRS or if the CRS is undefined on both side, or false in case of doubt.
    • createEnvelope

      protected final GeneralEnvelope createEnvelope()
      Creates an initially empty envelope with the CRS of this geometry. If this geometry has no CRS, then a two-dimensional envelope is created. This is a convenience method for GeometryWrapper.getEnvelope() implementations.
      Returns:
      an initially empty envelope.