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 long
Serial number for inter-operability with different versions.Fields inherited from class org.apache.sis.referencing.operation.AbstractCoordinateOperation
coordinateOperationAccuracy, domainOfValidity, sourceCRS, targetCRS, transform
Fields inherited from class org.apache.sis.referencing.AbstractIdentifiedObject
DEPRECATED_KEY, LOCALE_KEY
Fields inherited from interface org.opengis.referencing.operation.CoordinateOperation
COORDINATE_OPERATION_ACCURACY_KEY, DOMAIN_OF_VALIDITY_KEY, OPERATION_VERSION_KEY, SCOPE_KEY
Fields inherited from interface org.opengis.referencing.IdentifiedObject
ALIAS_KEY, IDENTIFIERS_KEY, NAME_KEY, REMARKS_KEY
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
Constructs 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.protected
DefaultConcatenatedOperation
(org.opengis.referencing.operation.ConcatenatedOperation operation) Creates a new coordinate operation with the same values than the specified one. -
Method Summary
Modifier and TypeMethodDescriptionstatic DefaultConcatenatedOperation
castOrCopy
(org.opengis.referencing.operation.ConcatenatedOperation object) Returns a SIS coordinate operation implementation with the values of the given arbitrary implementation.protected long
Invoked byhashCode()
for computing the hash code when first needed.boolean
equals
(Object object, ComparisonMode mode) Compares this concatenated operation with the specified object for equality.protected String
Formats 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.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) Performs the part ofDefaultConcatenatedOperations
construction that requires an iteration over the sequence of coordinate operations.private void
initialize
(Map<String, ?> properties, org.opengis.referencing.operation.CoordinateOperation[] operations, org.opengis.referencing.operation.MathTransformFactory mtFactory) Initializes theAbstractCoordinateOperation.sourceCRS
,AbstractCoordinateOperation.targetCRS
andoperations
fields.private void
setSteps
(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, isDefiningConversion
Methods inherited from class org.apache.sis.referencing.AbstractIdentifiedObject
castOrCopy, equals, formatTo, getAlias, getDescription, getIdentifiers, getName, getRemarks, hashCode, isDeprecated, isHeuristicMatchForName
Methods inherited from class org.apache.sis.io.wkt.FormattableObject
print, toString, toString, toWKT
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.opengis.referencing.operation.CoordinateOperation
getCoordinateOperationAccuracy, getDomainOfValidity, getMathTransform, getOperationVersion, getScope, getSourceCRS, getTargetCRS
Methods 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" Identifier
orString
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.FactoryExceptionInitializes theAbstractCoordinateOperation.sourceCRS
,AbstractCoordinateOperation.targetCRS
andoperations
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, ornull
if unknown.operations
- the operations to concatenate.mtFactory
- the math transform factory to use, ornull
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.FactoryExceptionPerforms the part ofDefaultConcatenatedOperations
construction that requires an iteration over the sequence of coordinate operations. This method performs the following processing:- Verify the validity of the
operations
argument. - Add the single operations in the
flattened
array. - Set the
AbstractCoordinateOperation.transform
field to the concatenated transform. - Set the
AbstractCoordinateOperation.coordinateOperationAccuracy
field, but only ifsetAccuracy
istrue
.
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
IfsetAccuracy
istrue
, then this method copies accuracy information found in the singleTransformation
instance. This method ignores instances of other kinds for the following reason: someConversion
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 givenoperations
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, ornull
if unknown.operations
- the operations to concatenate.flattened
- the destination list in which to add theSingleOperation
instances.mtFactory
- the math transform factory to use, ornull
for not performing concatenation.setSource
-true
for setting theAbstractCoordinateOperation.sourceCRS
on the very first CRS (regardless if null or not).setAccuracy
-true
for setting theAbstractCoordinateOperation.coordinateOperationAccuracy
field.setDomain
-true
for setting theAbstractCoordinateOperation.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.
- 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 newDefaultConcatenatedOperation
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, ornull
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
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 defineConcatenatedOperation
sub-interface. Overriding possibility is left mostly for implementers who wish to extend GeoAPI with their own set of interfaces.- Overrides:
getInterface
in classAbstractCoordinateOperation
- Returns:
ConcatenatedOperation.class
or 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 fromSingleOperation
toCoordinateOperation
. This change may be applied in GeoAPI 4.0. This is necessary for supporting usage ofPassThroughOperation
withConcatenatedOperation
.- Specified by:
getOperations
in interfaceorg.opengis.referencing.operation.ConcatenatedOperation
- Returns:
- the sequence of operations.
-
equals
Compares this concatenated operation with the specified object for equality. If themode
argument isComparisonMode.STRICT
orBY_CONTRACT
, then all available properties are compared including the domain of validity and the scope.- Specified by:
equals
in interfaceLenientComparable
- Overrides:
equals
in classAbstractCoordinateOperation
- Parameters:
object
- the object to compare tothis
.mode
-STRICT
for performing a strict comparison, orIGNORE_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 byhashCode()
for computing the hash code when first needed. SeeAbstractIdentifiedObject.computeHashCode()
for more information.- Overrides:
computeHashCode
in 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:
formatTo
in 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
-