Class DefaultConcatenatedOperation

All Implemented Interfaces:
Serializable, Formattable, Deprecable, LenientComparable, org.opengis.referencing.IdentifiedObject, org.opengis.referencing.operation.ConcatenatedOperation, org.opengis.referencing.operation.CoordinateOperation

final class DefaultConcatenatedOperation extends AbstractCoordinateOperation implements org.opengis.referencing.operation.ConcatenatedOperation
An ordered sequence of two or more single coordinate operations. The sequence of operations is constrained by the requirement that the source coordinate reference system of step (n+1) must be the same as the target coordinate reference system of step (n). The source coordinate reference system of the first step and the target coordinate reference system of the last step are the source and target coordinate reference system associated with the concatenated operation.
Since:
0.6
Version:
1.2
  • Field Details

    • serialVersionUID

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

      private List<org.opengis.referencing.operation.SingleOperation> operations
      The sequence of operations.

      Consider this field as final! This field is modified only at unmarshalling time by setSteps(CoordinateOperation[])

  • Constructor Details

    • DefaultConcatenatedOperation

      public DefaultConcatenatedOperation(Map<String,?> properties, org.opengis.referencing.operation.CoordinateOperation[] operations, org.opengis.referencing.operation.MathTransformFactory mtFactory) throws org.opengis.util.FactoryException
      Constructs a concatenated operation from a set of properties and a math transform factory. The properties given in argument follow the same rules than for the super-class constructor. The following table is a reminder of main (not all) properties:
      Recognized properties (non exhaustive list)
      Property name Value type Returned by
      "name" Identifier or String AbstractIdentifiedObject.getName()
      "identifiers" Identifier (optionally as array) AbstractIdentifiedObject.getIdentifiers()
      Parameters:
      properties - the properties to be given to the identified object.
      operations - the sequence of operations. Shall contain at least two operations.
      mtFactory - the math transform factory to use for math transforms concatenation.
      Throws:
      org.opengis.util.FactoryException - if the factory cannot concatenate the math transforms.
    • DefaultConcatenatedOperation

      protected DefaultConcatenatedOperation(org.opengis.referencing.operation.ConcatenatedOperation operation)
      Creates a new coordinate operation 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:
      operation - the coordinate operation to copy.
      See Also:
    • DefaultConcatenatedOperation

      private DefaultConcatenatedOperation()
      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

    • initialize

      private void initialize(Map<String,?> properties, org.opengis.referencing.operation.CoordinateOperation[] operations, org.opengis.referencing.operation.MathTransformFactory mtFactory) throws org.opengis.util.FactoryException
      Initializes the AbstractCoordinateOperation.sourceCRS, AbstractCoordinateOperation.targetCRS and operations fields. If the source or target CRS is already non-null (which may happen on JAXB unmarshalling), leaves that CRS unchanged.
      Parameters:
      properties - the properties specified at construction time, or null if unknown.
      operations - the operations to concatenate.
      mtFactory - the math transform factory to use, or null for not performing concatenation.
      Throws:
      org.opengis.util.FactoryException - if the factory cannot concatenate the math transforms.
    • initialize

      private org.opengis.referencing.crs.CoordinateReferenceSystem initialize(Map<String,?> properties, org.opengis.referencing.operation.CoordinateOperation[] operations, List<org.opengis.referencing.operation.CoordinateOperation> flattened, org.opengis.referencing.operation.MathTransformFactory mtFactory, boolean setSource, boolean setAccuracy, boolean setDomain) throws org.opengis.util.FactoryException
      Performs the part of DefaultConcatenatedOperations construction that requires an iteration over the sequence of coordinate operations. This method performs the following processing: This method invokes itself recursively if there is nested ConcatenatedOperation instances in the given list. This should not happen according ISO 19111 standard, but we try to be safe.

      How coordinate operation accuracy is determined

      If setAccuracy is true, then this method copies accuracy information found in the single Transformation instance. This method ignores instances of other kinds for the following reason: some Conversion instances declare an accuracy, which is typically close to zero. If a concatenated operation contains such conversion together with a transformation with unknown accuracy, then we do not want to declare "0 meter" as the concatenated operation accuracy; it would be a false information. Another reason is that a concatenated operation typically contains an arbitrary number of conversions, but only one transformation. So considering only transformations usually means to pickup only one operation in the given operations list, which make things clearer.
      Note: according ISO 19111, the accuracy attribute is allowed only for transformations. However, this restriction is not enforced everywhere. For example, the EPSG database declares an accuracy of 0 meter for conversions, which is conceptually exact. In this class we are departing from strict interpretation of the specification since we are adding accuracy information to a concatenated operation. This departure should be considered as a convenience feature only; accuracies are really relevant in transformations only.
      Parameters:
      properties - the properties specified at construction time, or null if unknown.
      operations - the operations to concatenate.
      flattened - the destination list in which to add the SingleOperation instances.
      mtFactory - the math transform factory to use, or null for not performing concatenation.
      setSource - true for setting the AbstractCoordinateOperation.sourceCRS on the very first CRS (regardless if null or not).
      setAccuracy - true for setting the AbstractCoordinateOperation.coordinateOperationAccuracy field.
      setDomain - true for setting the AbstractCoordinateOperation.domainOfValidity field.
      Returns:
      the last target CRS, regardless if null or not.
      Throws:
      org.opengis.util.FactoryException - if the factory cannot concatenate the math transforms.
    • castOrCopy

      public static DefaultConcatenatedOperation castOrCopy(org.opengis.referencing.operation.ConcatenatedOperation object)
      Returns a SIS coordinate operation implementation with the values of the given arbitrary implementation. If the given object is already an instance of DefaultConcatenatedOperation, then it is returned unchanged. Otherwise a new DefaultConcatenatedOperation instance is created using the copy constructor and returned. Note that this is a shallow copy operation, since the other properties contained in the given object are not recursively copied.
      Parameters:
      object - the object to get as a SIS implementation, or null if none.
      Returns:
      a SIS implementation containing the values of the given object (may be the given object itself), or null if the argument was null.
    • getInterface

      public Class<? extends org.opengis.referencing.operation.ConcatenatedOperation> getInterface()
      Returns the GeoAPI interface implemented by this class. The SIS implementation returns ConcatenatedOperation.class.
      Note for implementers: Subclasses usually do not need to override this method since GeoAPI does not define ConcatenatedOperation sub-interface. Overriding possibility is left mostly for implementers who wish to extend GeoAPI with their own set of interfaces.
      Overrides:
      getInterface in class AbstractCoordinateOperation
      Returns:
      ConcatenatedOperation.class or a user-defined sub-interface.
    • getOperations

      public List<org.opengis.referencing.operation.SingleOperation> getOperations()
      Returns the sequence of operations.
      Upcoming API change
      This method is conformant to ISO 19111:2003. But the ISO 19111:2007 revision changed the element type from SingleOperation to CoordinateOperation. This change may be applied in GeoAPI 4.0. This is necessary for supporting usage of PassThroughOperation with ConcatenatedOperation.
      Specified by:
      getOperations in interface org.opengis.referencing.operation.ConcatenatedOperation
      Returns:
      the sequence of operations.
    • equals

      public boolean equals(Object object, ComparisonMode mode)
      Compares this concatenated operation with the specified object for equality. If the mode argument is ComparisonMode.STRICT or BY_CONTRACT, then all available properties are compared including the domain of validity and the scope.
      Specified by:
      equals in interface LenientComparable
      Overrides:
      equals in class AbstractCoordinateOperation
      Parameters:
      object - the object to compare to this.
      mode - STRICT for performing a strict comparison, or IGNORE_METADATA for ignoring properties that do not make a difference in the numerical results of coordinate operations.
      Returns:
      true if both objects are equal for the given comparison mode.
      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 AbstractCoordinateOperation
      Returns:
      the hash code value. This value may change in any future Apache SIS version.
    • formatTo

      protected String formatTo(Formatter formatter)
      Formats this coordinate operation in pseudo-WKT. This is specific to Apache SIS since there is no concatenated operation in the Well Known Text (WKT) version 2 format.
      Overrides:
      formatTo in class AbstractCoordinateOperation
      Parameters:
      formatter - the formatter to use.
      Returns:
      "ConcatenatedOperation".
      See Also:
    • getSteps

      private org.opengis.referencing.operation.CoordinateOperation[] getSteps()
      Returns the operations to marshal. We use this private methods instead of annotating getOperations() in order to force JAXB to invoke the setter method on unmarshalling.
    • setSteps

      private void setSteps(org.opengis.referencing.operation.CoordinateOperation[] steps) throws org.opengis.util.FactoryException
      Invoked by JAXB for setting the operations.
      Throws:
      org.opengis.util.FactoryException