Object
WraparoundAdjustment
An envelope or position converter making them more compatible with a given domain of validity.
For each axes having
RangeMeaning.WRAPAROUND
,
this class can add or subtract an integer amount of periods (typically 360° of longitude)
in attempt to move positions or envelopes inside a domain of validity specified at construction time.
WraparoundAdjustment
instances are not thread-safe.
- Since:
- 1.2
-
Constructor Summary
ConstructorDescriptionWraparoundAdjustment
(Envelope domain, CoordinateReferenceSystem target) Creates a new instance for adjusting Area Of Interest (AOI) or Point Of Interest (POI) to the given domain.WraparoundAdjustment
(Envelope domain, MathTransform domainToInput, MathTransform inputToResult) Creates a new instance with specified transforms from domain to the CRS of inputs, then to the CRS of outputs. -
Method Summary
Modifier and TypeMethodDescriptionshift
(DirectPosition pointOfInterest) Computes a position with coordinates equivalent to the givenpointOfInterest
, but potentially shifted to interior of the domain of validity specified at construction time.Computes an envelope with coordinates equivalent to the givenareaOfInterest
, but potentially shifted for intersecting the domain of validity specified at construction time.
-
Constructor Details
-
WraparoundAdjustment
Creates a new instance for adjusting Area Of Interest (AOI) or Point Of Interest (POI) to the given domain. The results ofshift(…)
methods will be transformed (if needed) to the specified CRS.- Parameters:
domain
- the region where a given area or point of interest should be located.target
- the coordinate reference system of objects returned byshift(…)
methods, ornull
for the same CRS than thedomain
CRS..
-
WraparoundAdjustment
public WraparoundAdjustment(Envelope domain, MathTransform domainToInput, MathTransform inputToResult) Creates a new instance with specified transforms from domain to the CRS of inputs, then to the CRS of outputs. This constructor can be used when those transforms are known in advance; it avoids the cost of inferring them. With this constructor,WraparoundAdjustment
does not verify if a coordinate operation is needed for a pair of CRS; it is caller's responsibility to ensure that input objects use the expected CRS.Example
In the context ofGridGeometry
, thedomain
argument may be the geospatial envelope of the grid and theinputToResult
argument may be the "CRS to grid" transform. This configuration allows to compute grid coordinates having more chances to be inside the grid.- Parameters:
domain
- the region where a given area (AOI) or point of interest (POI) should be located.domainToInput
- if the AOI or POI will use a different CRS thandomain
, the transform fromdomain
to the input CRS. Otherwisenull
for same CRS as the domain.inputToResult
- a transform from thedomain
CRS to any user space at caller choice. Ifnull
, the results will be expressed in same CRS than the inputs.
-
-
Method Details
-
shift
Computes an envelope with coordinates equivalent to the givenareaOfInterest
, but potentially shifted for intersecting the domain of validity specified at construction time. The dimensions that may be shifted are the ones having an axis with wraparound meaning. In order to perform this operation, the envelope may be temporarily converted to a geographic CRS and converted back to its original CRS.The coordinate reference system should be specified in the
areaOfInterest
. If not, then the CRS is assumed same as the CRS of the domain specified at construction time.This method does not intersect the area of interest with the domain of validity. It is up to the caller to compute that intersection after this method call, if desired.
- Parameters:
areaOfInterest
- the envelope to potentially shift toward domain of validity. If a shift is needed, then given envelope will be replaced by a new envelope; the given envelope will not be modified.- Returns:
- envelope potentially expanded or shifted toward the domain of validity.
- Throws:
TransformException
- if a coordinate conversion failed.- See Also:
-
shift
Computes a position with coordinates equivalent to the givenpointOfInterest
, but potentially shifted to interior of the domain of validity specified at construction time. The dimensions that may be shifted are the ones having an axis with wraparound meaning. In order to perform this operation, the position may be temporarily converted to a geographic CRS and converted back to its original CRS.The coordinate reference system should be specified in the
pointOfInterest
. If not, then the CRS is assumed same as the CRS of the domain specified at construction time.- Parameters:
pointOfInterest
- the position to potentially shift to domain of validity interior. If a shift is needed, then the given position will be replaced by a new position; the given position will not be modified.- Returns:
- position potentially shifted to the domain of validity interior.
- Throws:
TransformException
- if a coordinate conversion failed.
-