Class CoordinateOperations
java.lang.Object
org.apache.sis.internal.system.SystemListener
org.apache.sis.internal.referencing.CoordinateOperations
- All Implemented Interfaces:
EventListener
The default coordinate operation factory, provided in a separated class for deferring class loading
until first needed. Contains also utility methods related to coordinate operations.
- Since:
- 0.7
- Version:
- 1.1
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
TheDefaultGeodeticDatum.BURSA_WOLF_KEY
value.Cached values orwrapAroundChanges(…)
, created when first needed.static final ThreadLocal<Supplier<double[]>>
private static DefaultCoordinateOperationFactory
The system-wide default factory.static final String
The key for specifying the base type of the coordinate operation to create.static final String
The key for specifying explicitly the value to be returned byAbstractSingleOperation.getParameterValues()
. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static long
changes
(org.opengis.referencing.cs.CoordinateSystem source, org.opengis.referencing.cs.CoordinateSystem target) Returns the packed indices of target dimensions where coordinate values may need to be wrapped around.protected void
Invoked when the classpath changed.factory()
Returns the factory.static DefaultMathTransformFactory
Returns the SIS implementation ofMathTransformFactory
.static org.opengis.referencing.operation.CoordinateOperationFactory
getCoordinateOperationFactory
(Map<String, ?> properties, org.opengis.referencing.operation.MathTransformFactory mtFactory, org.opengis.referencing.crs.CRSFactory crsFactory, org.opengis.referencing.cs.CSFactory csFactory) Returns the coordinate operation factory to use for the given properties and math transform factory.static org.opengis.referencing.operation.OperationMethod
getOperationMethod
(Iterable<? extends org.opengis.referencing.operation.OperationMethod> methods, String identifier) Returns the operation method for the specified name or identifier.static boolean
isWrapAround
(org.opengis.referencing.cs.CoordinateSystemAxis axis) Returnstrue
if the given axis is of kind "Wrap Around".wrapAroundChanges
(org.opengis.referencing.crs.CoordinateReferenceSystem source, org.opengis.referencing.cs.CoordinateSystem target) Computes indices of target dimensions where "wrap around" may happen as a result of a coordinate operation.wrapAroundChanges
(org.opengis.referencing.operation.CoordinateOperation op) Returns indices of target dimensions where "wrap around" may happen as a result of a coordinate operation.Methods inherited from class org.apache.sis.internal.system.SystemListener
add, databaseChanged, fireClasspathChanged, remove
-
Field Details
-
BURSA_WOLF_KEY
TheDefaultGeodeticDatum.BURSA_WOLF_KEY
value.- See Also:
-
PARAMETERS_KEY
The key for specifying explicitly the value to be returned byAbstractSingleOperation.getParameterValues()
. It is usually not necessary to specify those parameters because they are inferred either from theMathTransform
, or specified explicitly in aDefiningConversion
. However, there is a few cases, for example the Molodenski transform, where none of the above can apply, because SIS implements those operations as a concatenation of math transforms, and such concatenations do not haveParameterValueGroup
.- See Also:
-
OPERATION_TYPE_KEY
The key for specifying the base type of the coordinate operation to create. This optional entry is used byDefaultCoordinateOperationFactory.createSingleOperation(…)
. Apache SIS tries to infer this value automatically, but this entry may help SIS to perform a better choice in some cases. For example, an "Affine" operation can be both a conversion or a transformation (the latter is used in datum shift in geocentric coordinates).- See Also:
-
CONSTANT_COORDINATES
Value ofCoordinateOperationContext.getConstantCoordinates()
. This thread-local is used as a workaround for the fact that we do not yet provide a public API for this functionality. This workaround should be deleted after a public API is defined. -
CACHE
Cached values orwrapAroundChanges(…)
, created when first needed. Indices are bit masks computed bychanges(…)
. Since the most common "wrap around" axes are longitude at dimension 0 or 1, and some measurement of time (in climatology) at dimension 2 or 3, then the most likely values are (binary digits): The last decimal value is 10 (binary1010
); we don't need to cache more. -
factory
The system-wide default factory.
-
-
Constructor Details
-
CoordinateOperations
private CoordinateOperations()For system listener only.
-
-
Method Details
-
classpathChanged
protected void classpathChanged()Invoked when the classpath changed.- Specified by:
classpathChanged
in classSystemListener
-
factory
Returns the factory.- Returns:
- the system-wide factory.
-
factoryMT
Returns the SIS implementation ofMathTransformFactory
.- Returns:
- SIS implementation of transform factory.
-
getCoordinateOperationFactory
public static org.opengis.referencing.operation.CoordinateOperationFactory getCoordinateOperationFactory(Map<String, ?> properties, org.opengis.referencing.operation.MathTransformFactory mtFactory, org.opengis.referencing.crs.CRSFactory crsFactory, org.opengis.referencing.cs.CSFactory csFactory) Returns the coordinate operation factory to use for the given properties and math transform factory. If the given properties are empty and themtFactory
is the system default, then this method returns the system defaultCoordinateOperationFactory
instead of creating a new one.It is okay to set all parameters to
null
in order to get the system default factory.- Parameters:
properties
- the default properties.mtFactory
- the math transform factory to use.crsFactory
- the factory to use if the operation factory needs to create CRS for intermediate steps.csFactory
- the factory to use if the operation factory needs to create CS for intermediate steps.- Returns:
- the coordinate operation factory to use.
-
getOperationMethod
public static org.opengis.referencing.operation.OperationMethod getOperationMethod(Iterable<? extends org.opengis.referencing.operation.OperationMethod> methods, String identifier) Returns the operation method for the specified name or identifier. The given argument shall be either a method name (e.g. "Transverse Mercator") or one of its identifiers (e.g."EPSG:9807"
).- Parameters:
methods
- the method candidates.identifier
- the name or identifier of the operation method to search.- Returns:
- the coordinate operation method for the given name or identifier, or
null
if none. - See Also:
-
isWrapAround
public static boolean isWrapAround(org.opengis.referencing.cs.CoordinateSystemAxis axis) Returnstrue
if the given axis is of kind "Wrap Around". Defined here because used together withwrapAroundChanges(…)
.- Parameters:
axis
- the axis to test.- Returns:
true
if the given axis has "wrap around" range meaning.
-
wrapAroundChanges
public static Set<Integer> wrapAroundChanges(org.opengis.referencing.operation.CoordinateOperation op) Returns indices of target dimensions where "wrap around" may happen as a result of a coordinate operation. This is usually the longitude axis when the source CRS uses the [-180 … +180]° range and the target CRS uses the [0 … 360]° range, or the converse.- Parameters:
op
- the coordinate operation for which to get "wrap around" target dimensions.- Returns:
- target dimensions where "wrap around" may happen, or an empty set if none.
- See Also:
-
wrapAroundChanges
public static Set<Integer> wrapAroundChanges(org.opengis.referencing.crs.CoordinateReferenceSystem source, org.opengis.referencing.cs.CoordinateSystem target) Computes indices of target dimensions where "wrap around" may happen as a result of a coordinate operation. This is usually the longitude axis when the source CRS uses the [-180 … +180]° range and the target CRS uses the [0 … 360]° range, or the converse.- Parameters:
source
- the source of the coordinate operation.target
- the target of the coordinate operation.- Returns:
- target dimensions where "wrap around" may happen, or an empty set if none.
-
changes
private static long changes(org.opengis.referencing.cs.CoordinateSystem source, org.opengis.referencing.cs.CoordinateSystem target) Returns the packed indices of target dimensions where coordinate values may need to be wrapped around. This method matches target coordinate system axes havingRangeMeaning.WRAPAROUND
with source axes, then verifies if the range of values changed (taking unit conversions in account). A target dimensioni
may need to "wrap around" the coordinate values if the1 << i
bit is set. If there is no change, then the value is zero.
-