Object
CoordinateOperationContext
- All Implemented Interfaces:
Serializable
,Cloneable
Optional information about the context in which a coordinate operation will be used.
When given to
Proj.createCoordinateOperation(…)
method,
CoordinateOperationContext
can modify the criterion by which PROJ will select the "best"
coordinate operation. Some criterion are:
- The area of interest.
- The desired accuracy.
Limitations
CoordinateOperationContext
is not thread-safe.
It is only a temporary object for creating coordinate operations
and rarely needs to be shared between different threads.- Since:
- 1.0
- See Also:
-
Constructor Summary
ConstructorDescriptionCreates a new context initialized to default value. -
Method Summary
Modifier and TypeMethodDescriptionclone()
Returns a shallow copy of this context.boolean
Compares this context with the given object for equality.Return whether an intermediate pivot CRS can be used for researching coordinate operations between a source and target CRS.Returns the desired area of interest, or null if none.Returns the authority to use for searching coordinate operations.double
Returns the desired accuracy (in metres).boolean
Returns whether transformations that are superseded (but not deprecated) should be discarded.Return how grid availability is used.Returns how source and target CRS extents should be used when considering if a transformation can be used.Returns the spatial criterion to use when comparing the area of validity of coordinate operations with the area of interest / area of validity of source and target CRS.int
hashCode()
Returns a hash code value for this context.void
Set whether an intermediate pivot CRS can be used for researching coordinate operations between a source and target CRS.void
setAreaOfInterest
(double westBoundLongitude, double eastBoundLongitude, double southBoundLatitude, double northBoundLatitude) Sets the desired area of interest from the given latitude and longitude bounds.void
setAreaOfInterest
(Extent extent) Sets the desired area of interest.void
setAuthority
(String name) Sets the authority to use for searching coordinate operations.void
setDesiredAccuracy
(double accuracy) Sets the desired accuracy (in metres).void
setDiscardSuperseded
(boolean discard) Sets whether transformations that are superseded (but not deprecated) should be discarded.void
Sets how grid availability is used.void
Sets how source and target CRS extents should be used when considering if a transformation can be used.void
setSpatialCriterion
(SpatialCriterion criterion) Sets the spatial criterion to use when comparing the area of validity of coordinate operations with the area of interest / area of validity of source and target CRS.
-
Constructor Details
-
CoordinateOperationContext
public CoordinateOperationContext()Creates a new context initialized to default value.
-
-
Method Details
-
setAuthority
Sets the authority to use for searching coordinate operations. Special values:""
(empty string): coordinate operations from any authority will be searched, with the restrictions set in the"authority_to_authority_preference"
database table."any"
: coordinate operations from any authority will be searched.
"default"
.- Parameters:
name
- name of the new authority.- Throws:
NullPointerException
- ifname
isnull
.
-
getAuthority
Returns the authority to use for searching coordinate operations. This is the value given in last call to the setter, or the default value (""
) if no value has been explicitly set.- Returns:
- name of the current authority.
-
setAreaOfInterest
public void setAreaOfInterest(double westBoundLongitude, double eastBoundLongitude, double southBoundLatitude, double northBoundLatitude) Sets the desired area of interest from the given latitude and longitude bounds. This convenience method creates anExtent
from the given argument values, then delegates tosetAreaOfInterest(Extent)
.Caution: Arguments are expected in the same order than they appear in the ISO 19115 specification. This is different than the order commonly found in Java world, which is rather (xmin, ymin, xmax, ymax).
- Parameters:
westBoundLongitude
- the minimal x value.eastBoundLongitude
- the maximal x value.southBoundLatitude
- the minimal y value.northBoundLatitude
- the maximal y value.- Throws:
IllegalArgumentException
- if (west bound > east bound) or (south bound > north bound). Note that NaN values are allowed.
-
setAreaOfInterest
Sets the desired area of interest. The default value isnull
.- Parameters:
extent
- the new area of interest, ornull
if unknown.
-
getAreaOfInterest
Returns the desired area of interest, or null if none. This is the value given in last call to the setter, or the default value (null
) if no value has been explicitly set. That value is not cloned.- Returns:
- the desired area of interest, or
null
if unknown.
-
setDesiredAccuracy
public void setDesiredAccuracy(double accuracy) Sets the desired accuracy (in metres). A value of 0 stands for the best accuracy available. The default value is 0.- Parameters:
accuracy
- the desired accuracy (in metres), or 0 for the best accuracy available.- Throws:
IllegalArgumentException
- if the given value is not finite and positive.
-
getDesiredAccuracy
public double getDesiredAccuracy()Returns the desired accuracy (in metres). This is the value given in last call to the setter, or the default value (zero) if no value has been explicitly set.- Returns:
- the desired accuracy (in metres), or 0 for the best accuracy available.
-
setSourceAndTargetCRSExtentUse
Sets how source and target CRS extents should be used when considering if a transformation can be used. This parameter takes effect only if no area of interest is explicitly defined. The default isSourceTargetCRSExtentUse.DEFAULT
.- Parameters:
use
- the new policy about CRS extents use.
-
getSourceAndTargetCRSExtentUse
Returns how source and target CRS extents should be used when considering if a transformation can be used. This is the value given in last call to the setter, or the default value if no value has been explicitly set.- Returns:
- the current policy about CRS extents use.
-
setSpatialCriterion
Sets the spatial criterion to use when comparing the area of validity of coordinate operations with the area of interest / area of validity of source and target CRS. The default isSpatialCriterion.DEFAULT
.- Parameters:
criterion
- the new spatial criterion.
-
getSpatialCriterion
Returns the spatial criterion to use when comparing the area of validity of coordinate operations with the area of interest / area of validity of source and target CRS. This is the value given in last call to the setter, or the default value if no value has been explicitly set.- Returns:
- the current spatial criterion.
-
setGridAvailabilityUse
Sets how grid availability is used. The default isGridAvailabilityUse.DEFAULT
.- Parameters:
use
- the new policy about grid availability use.
-
getGridAvailabilityUse
Return how grid availability is used. This is the value given in last call to the setter, or the default value if no value has been explicitly set.- Returns:
- the current policy about grid availability use.
-
setAllowUseIntermediateCRS
Set whether an intermediate pivot CRS can be used for researching coordinate operations between a source and target CRS. Concretely if in the database there is an operation from A to C (or C to A), and another one from C to B (or B to C), but no direct operation between A and B, setting this parameter toALWAYS
orIF_NO_DIRECT_TRANSFORMATION
, allow chaining both operations.The PROJ 6.2 implementation is limited to researching one intermediate step. By default, with the
IF_NO_DIRECT_TRANSFORMATION
strategy, all potential C candidates will be used if there is no direct transformation.The default is
IntermediateCRSUse.DEFAULT
.- Parameters:
use
- the new policy about intermediate pivot CRS use.
-
getAllowUseIntermediateCRS
Return whether an intermediate pivot CRS can be used for researching coordinate operations between a source and target CRS. This is the value given in last call to the setter, or the default value if no value has been explicitly set.- Returns:
- the current policy about intermediate pivot CRS use.
-
setDiscardSuperseded
public void setDiscardSuperseded(boolean discard) Sets whether transformations that are superseded (but not deprecated) should be discarded. The default is true.- Parameters:
discard
- the new policy about superseded transformations.
-
getDiscardSuperseded
public boolean getDiscardSuperseded()Returns whether transformations that are superseded (but not deprecated) should be discarded. This is the value given in last call to the setter, or the default value (true
) if no value has been explicitly set.- Returns:
- the current policy about superseded transformations.
-
hashCode
public int hashCode()Returns a hash code value for this context. This value does not need to be stable between different versions of this class. -
equals
Compares this context with the given object for equality. -
clone
Returns a shallow copy of this context. The cloned context will share the same extent instance than this context.
-