Class DefaultConcatenatedOperation
java.lang.Object
org.apache.sis.io.wkt.FormattableObject
org.apache.sis.referencing.AbstractIdentifiedObject
org.apache.sis.referencing.operation.AbstractCoordinateOperation
org.apache.sis.referencing.operation.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 Summary
FieldsModifier and TypeFieldDescriptionprivate List<org.opengis.referencing.operation.SingleOperation>The sequence of operations.private static final longSerial number for inter-operability with different versions.Fields inherited from class org.apache.sis.referencing.operation.AbstractCoordinateOperation
coordinateOperationAccuracy, domainOfValidity, sourceCRS, targetCRS, transformFields inherited from class org.apache.sis.referencing.AbstractIdentifiedObject
DEPRECATED_KEY, LOCALE_KEYFields inherited from interface org.opengis.referencing.operation.CoordinateOperation
COORDINATE_OPERATION_ACCURACY_KEY, DOMAIN_OF_VALIDITY_KEY, OPERATION_VERSION_KEY, SCOPE_KEYFields inherited from interface org.opengis.referencing.IdentifiedObject
ALIAS_KEY, IDENTIFIERS_KEY, NAME_KEY, REMARKS_KEY -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateConstructs a new object in which every attributes are set to a null value.DefaultConcatenatedOperation(Map<String, ?> properties, org.opengis.referencing.operation.CoordinateOperation[] operations, org.opengis.referencing.operation.MathTransformFactory mtFactory) Constructs a concatenated operation from a set of properties and a math transform factory.protectedDefaultConcatenatedOperation(org.opengis.referencing.operation.ConcatenatedOperation operation) Creates a new coordinate operation with the same values than the specified one. -
Method Summary
Modifier and TypeMethodDescriptionstatic DefaultConcatenatedOperationcastOrCopy(org.opengis.referencing.operation.ConcatenatedOperation object) Returns a SIS coordinate operation implementation with the values of the given arbitrary implementation.protected longInvoked byhashCode()for computing the hash code when first needed.booleanequals(Object object, ComparisonMode mode) Compares this concatenated operation with the specified object for equality.protected StringFormats this coordinate operation in pseudo-WKT.Class<? extends org.opengis.referencing.operation.ConcatenatedOperation>Returns the GeoAPI interface implemented by this class.List<org.opengis.referencing.operation.SingleOperation>Returns the sequence of operations.private org.opengis.referencing.operation.CoordinateOperation[]getSteps()Returns the operations to marshal.private org.opengis.referencing.crs.CoordinateReferenceSysteminitialize(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) Performs the part ofDefaultConcatenatedOperationsconstruction that requires an iteration over the sequence of coordinate operations.private voidinitialize(Map<String, ?> properties, org.opengis.referencing.operation.CoordinateOperation[] operations, org.opengis.referencing.operation.MathTransformFactory mtFactory) Initializes theAbstractCoordinateOperation.sourceCRS,AbstractCoordinateOperation.targetCRSandoperationsfields.private voidsetSteps(org.opengis.referencing.operation.CoordinateOperation[] steps) Invoked by JAXB for setting the operations.Methods inherited from class org.apache.sis.referencing.operation.AbstractCoordinateOperation
afterUnmarshal, castOrCopy, checkDimensions, computeTransientFields, getCoordinateOperationAccuracy, getDomainOfValidity, getInterpolationCRS, getInterpolationCRS, getLinearAccuracy, getMathTransform, getMethod, getOperationVersion, getParameterDescriptors, getParameterDescriptors, getParameterValues, getScope, getSourceCRS, getTargetCRS, getWrapAroundChanges, isDefiningConversionMethods inherited from class org.apache.sis.referencing.AbstractIdentifiedObject
castOrCopy, equals, formatTo, getAlias, getDescription, getIdentifiers, getName, getRemarks, hashCode, isDeprecated, isHeuristicMatchForNameMethods inherited from class org.apache.sis.io.wkt.FormattableObject
print, toString, toString, toWKTMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.opengis.referencing.operation.CoordinateOperation
getCoordinateOperationAccuracy, getDomainOfValidity, getMathTransform, getOperationVersion, getScope, getSourceCRS, getTargetCRSMethods inherited from interface org.opengis.referencing.IdentifiedObject
getAlias, getIdentifiers, getName, getRemarks, toWKT
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDSerial number for inter-operability with different versions.- See Also:
-
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.FactoryExceptionConstructs 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" IdentifierorStringAbstractIdentifiedObject.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.FactoryExceptionInitializes theAbstractCoordinateOperation.sourceCRS,AbstractCoordinateOperation.targetCRSandoperationsfields. 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, ornullif unknown.operations- the operations to concatenate.mtFactory- the math transform factory to use, ornullfor 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.FactoryExceptionPerforms the part ofDefaultConcatenatedOperationsconstruction that requires an iteration over the sequence of coordinate operations. This method performs the following processing:- Verify the validity of the
operationsargument. - Add the single operations in the
flattenedarray. - Set the
AbstractCoordinateOperation.transformfield to the concatenated transform. - Set the
AbstractCoordinateOperation.coordinateOperationAccuracyfield, but only ifsetAccuracyistrue.
ConcatenatedOperationinstances in the given list. This should not happen according ISO 19111 standard, but we try to be safe.How coordinate operation accuracy is determined
IfsetAccuracyistrue, then this method copies accuracy information found in the singleTransformationinstance. This method ignores instances of other kinds for the following reason: someConversioninstances 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 givenoperationslist, 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, ornullif unknown.operations- the operations to concatenate.flattened- the destination list in which to add theSingleOperationinstances.mtFactory- the math transform factory to use, ornullfor not performing concatenation.setSource-truefor setting theAbstractCoordinateOperation.sourceCRSon the very first CRS (regardless if null or not).setAccuracy-truefor setting theAbstractCoordinateOperation.coordinateOperationAccuracyfield.setDomain-truefor setting theAbstractCoordinateOperation.domainOfValidityfield.- Returns:
- the last target CRS, regardless if null or not.
- Throws:
org.opengis.util.FactoryException- if the factory cannot concatenate the math transforms.
- Verify the validity of the
-
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 ofDefaultConcatenatedOperation, then it is returned unchanged. Otherwise a newDefaultConcatenatedOperationinstance 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, ornullif none.- Returns:
- a SIS implementation containing the values of the given object (may be the
given object itself), or
nullif the argument was null.
-
getInterface
Returns the GeoAPI interface implemented by this class. The SIS implementation returnsConcatenatedOperation.class.Note for implementers: Subclasses usually do not need to override this method since GeoAPI does not defineConcatenatedOperationsub-interface. Overriding possibility is left mostly for implementers who wish to extend GeoAPI with their own set of interfaces.- Overrides:
getInterfacein classAbstractCoordinateOperation- Returns:
ConcatenatedOperation.classor a user-defined sub-interface.
-
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 fromSingleOperationtoCoordinateOperation. This change may be applied in GeoAPI 4.0. This is necessary for supporting usage ofPassThroughOperationwithConcatenatedOperation.- Specified by:
getOperationsin interfaceorg.opengis.referencing.operation.ConcatenatedOperation- Returns:
- the sequence of operations.
-
equals
Compares this concatenated operation with the specified object for equality. If themodeargument isComparisonMode.STRICTorBY_CONTRACT, then all available properties are compared including the domain of validity and the scope.- Specified by:
equalsin interfaceLenientComparable- Overrides:
equalsin classAbstractCoordinateOperation- Parameters:
object- the object to compare tothis.mode-STRICTfor performing a strict comparison, orIGNORE_METADATAfor ignoring properties that do not make a difference in the numerical results of coordinate operations.- Returns:
trueif both objects are equal for the given comparison mode.- See Also:
-
computeHashCode
protected long computeHashCode()Invoked byhashCode()for computing the hash code when first needed. SeeAbstractIdentifiedObject.computeHashCode()for more information.- Overrides:
computeHashCodein classAbstractCoordinateOperation- Returns:
- the hash code value. This value may change in any future Apache SIS version.
-
formatTo
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:
formatToin classAbstractCoordinateOperation- 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 annotatinggetOperations()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
-