Class AbstractDerivedCRS<C extends org.opengis.referencing.operation.Conversion>

Type Parameters:
C - the conversion type, either Conversion or Projection.
All Implemented Interfaces:
Serializable, Formattable, Deprecable, LenientComparable, org.opengis.referencing.crs.CoordinateReferenceSystem, org.opengis.referencing.crs.GeneralDerivedCRS, org.opengis.referencing.crs.SingleCRS, org.opengis.referencing.IdentifiedObject, org.opengis.referencing.ReferenceSystem
Direct Known Subclasses:
DefaultDerivedCRS, DefaultProjectedCRS

abstract class AbstractDerivedCRS<C extends org.opengis.referencing.operation.Conversion> extends AbstractCRS implements org.opengis.referencing.crs.GeneralDerivedCRS
A coordinate reference system that is defined by its coordinate conversion from another CRS (not by a datum).
Since:
0.6
Version:
1.3
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      Serial number for inter-operability with different versions.
      See Also:
    • conversionFromBase

      private C extends org.opengis.referencing.operation.Conversion conversionFromBase
      The conversion from the base CRS to this CRS. The base CRS of this GeneralDerivedCRS is Conversion.getSourceCRS().

      Consider this field as final! This field is modified only at unmarshalling time by setConversionFromBase(Conversion)

      See Also:
  • Constructor Details

    • AbstractDerivedCRS

      AbstractDerivedCRS(Map<String,?> properties, org.opengis.referencing.crs.SingleCRS baseCRS, org.opengis.referencing.operation.Conversion conversion, org.opengis.referencing.cs.CoordinateSystem derivedCS) throws org.opengis.geometry.MismatchedDimensionException
      Creates a derived CRS from a defining conversion. The properties given in argument follow the same rules than for the super-class constructor.
      Parameters:
      properties - the properties to be given to the new derived CRS object.
      baseCRS - coordinate reference system to base the derived CRS on.
      conversion - the defining conversion from a normalized base to a normalized derived CRS.
      derivedCS - the coordinate system for the derived CRS. The number of axes must match the target dimension of the baseToDerived transform.
      Throws:
      org.opengis.geometry.MismatchedDimensionException - if the source and target dimensions of baseToDerived do not match the dimensions of base and derivedCS respectively.
    • AbstractDerivedCRS

      AbstractDerivedCRS(Map<String,?> properties, org.opengis.referencing.crs.SingleCRS baseCRS, org.opengis.referencing.crs.CoordinateReferenceSystem interpolationCRS, org.opengis.referencing.operation.OperationMethod method, org.opengis.referencing.operation.MathTransform baseToDerived, org.opengis.referencing.cs.CoordinateSystem derivedCS) throws org.opengis.geometry.MismatchedDimensionException
      Throws:
      org.opengis.geometry.MismatchedDimensionException
    • AbstractDerivedCRS

      AbstractDerivedCRS(org.opengis.referencing.crs.GeneralDerivedCRS crs)
      Constructs a new coordinate reference system with the same values than the specified one. This copy constructor provides a way to convert an arbitrary implementation into a SIS one or a user-defined one (as a subclass), usually in order to leverage some implementation-specific API.

      This constructor performs a shallow copy, i.e. the properties are not cloned.

      Parameters:
      crs - the coordinate reference system to copy.
    • AbstractDerivedCRS

      AbstractDerivedCRS()
      Constructs a new object in which every attributes are set to a null value. This is not a valid object. This constructor is strictly reserved to JAXB, which will assign values to the fields using reflection.
  • Method Details

    • createConversionFromBase

      private C createConversionFromBase(Map<String,?> properties, org.opengis.referencing.crs.SingleCRS baseCRS, org.opengis.referencing.operation.Conversion conversion)
      Creates the conversion instance to associate with this AbstractDerivedCRS.

      WARNING: this method is invoked at construction time and will invoke indirectly (through DefaultConversion) the AbstractCRS.getCoordinateSystem() method on this. Consequently, this method shall be invoked only after the construction of this AbstractDerivedCRS instance is advanced enough for allowing the getCoordinateSystem() method to execute. Subclasses may consider to make the getCoordinateSystem() method final for better guarantees.

    • getConversionType

      abstract Class<C> getConversionType()
      Returns the type of conversion associated to this AbstractDerivedCRS.

      WARNING: this method is invoked (indirectly) at construction time. Consequently, it shall return a constant value - this method is not allowed to depend on the object state.

    • getInterface

      public abstract Class<? extends org.opengis.referencing.crs.GeneralDerivedCRS> getInterface()
      Returns the GeoAPI interface implemented by this class.
      Overrides:
      getInterface in class AbstractCRS
      Returns:
      the coordinate reference system interface implemented by this class.
    • getDatum

      public abstract org.opengis.referencing.datum.Datum getDatum()
      Returns the datum of the base CRS.
      Specified by:
      getDatum in interface org.opengis.referencing.crs.SingleCRS
      Overrides:
      getDatum in class AbstractCRS
      Returns:
      the datum of the base CRS.
    • getConversionFromBase

      public C getConversionFromBase()
      Returns the conversion from the base CRS to this CRS.
      Specified by:
      getConversionFromBase in interface org.opengis.referencing.crs.GeneralDerivedCRS
      Returns:
      the conversion to this CRS.
    • equals

      public boolean equals(Object object, ComparisonMode mode)
      Compares this coordinate reference system with the specified object for equality.
      Specified by:
      equals in interface LenientComparable
      Overrides:
      equals in class AbstractCRS
      Parameters:
      object - the object to compare to this.
      mode - STRICT for performing a strict comparison, or IGNORE_METADATA for comparing only properties relevant to coordinate transformations.
      Returns:
      true if both objects are equal.
      See Also:
    • computeHashCode

      protected long computeHashCode()
      Invoked by hashCode() for computing the hash code when first needed. See AbstractIdentifiedObject.computeHashCode() for more information.
      Overrides:
      computeHashCode in class AbstractCRS
      Returns:
      the hash code value. This value may change in any future Apache SIS version.
    • setConversionFromBase

      private void setConversionFromBase(C conversion)
      Invoked by JAXB at unmarshalling time for setting the defining conversion. At this state, the given conversion has null sourceCRS and targetCRS. Those CRS will be set later, in afterUnmarshal(Unmarshaller, Object).
    • setBaseCRS

      final void setBaseCRS(String name, org.opengis.referencing.crs.SingleCRS baseCRS)
      Stores a temporary association to the given base CRS. This method shall be invoked only after the call to setConversionFromBase(Conversion), otherwise an exception will be thrown.

      The given base CRS will not be stored in this AbstractDerivedCRS instance now, but in another temporary location. The reason is that we need the coordinate system (CS) before we can set the baseCRS in its final location, but the CS is not yet known when this method is invoked.

      Parameters:
      name - the property name, used only in case of error message to format.
      Throws:
      IllegalStateException - if the base CRS cannot be set.
    • afterUnmarshal

      private void afterUnmarshal(Unmarshaller unmarshaller, Object parent)
      Invoked by JAXB after all elements have been unmarshalled. At this point we should have the coordinate system (CS). The CS information is required by createConversionFromBase(…) in order to create a MathTransform with correct axis swapping and unit conversions.