Class LinearTransformBuilder.ControlPoints
java.lang.Object
org.apache.sis.internal.util.AbstractMap<org.opengis.geometry.DirectPosition,org.opengis.geometry.DirectPosition>
org.apache.sis.referencing.operation.builder.LinearTransformBuilder.ControlPoints
- All Implemented Interfaces:
Map<org.opengis.geometry.DirectPosition,
org.opengis.geometry.DirectPosition>
- Direct Known Subclasses:
LinearTransformBuilder.Ungridded
- Enclosing class:
LinearTransformBuilder
private class LinearTransformBuilder.ControlPoints
extends AbstractMap<org.opengis.geometry.DirectPosition,org.opengis.geometry.DirectPosition>
Implementation of the map returned by
LinearTransformBuilder.getControlPoints()
. The default implementation
is suitable for LinearTransformBuilder
backed by a grid. For non-gridded sources, the
LinearTransformBuilder.Ungridded
subclass shall be used instead.-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.sis.internal.util.AbstractMap
AbstractMap.EntryIterator<K,
V>, AbstractMap.IteratorAdapter<K, V>, AbstractMap.KeyIterator -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
containsKey
(Object key) Returnstrue
if the given value is one of the source coordinates.final boolean
containsValue
(Object value) Returnstrue
if the given value is one of the target coordinates.(package private) int
domain()
Returns the number of points to consider when searching inLinearTransformBuilder.sources
orLinearTransformBuilder.targets
arrays.protected AbstractMap.EntryIterator
<org.opengis.geometry.DirectPosition, org.opengis.geometry.DirectPosition> Returns an iterator over the entries.(package private) int
flatIndex
(org.opengis.geometry.DirectPosition source) Returns the index where to fetch a target position for the given source position in the flattened array.final org.opengis.geometry.DirectPosition
Returns the target point for the given source point.(package private) final org.opengis.geometry.DirectPosition
position
(double[][] data, int offset) Creates a point from the given data at the given offset.(package private) final int
search
(double[][] data, double[] coord) Returns the index of the given coordinates in the given data array (source or target coordinates).Methods inherited from class org.apache.sis.internal.util.AbstractMap
addKey, addValue, clear, entrySet, equals, getOrDefault, hashCode, isEmpty, keySet, put, putAll, remove, size, toString, values
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Constructor Details
-
ControlPoints
ControlPoints()Creates a new map view of control points.
-
-
Method Details
-
position
final org.opengis.geometry.DirectPosition position(double[][] data, int offset) Creates a point from the given data at the given offset. Before to invoke this method, caller should verify index validity and that the coordinate does not contain NaN values. -
domain
int domain()Returns the number of points to consider when searching inLinearTransformBuilder.sources
orLinearTransformBuilder.targets
arrays. For gridded data we cannot rely onLinearTransformBuilder.numPoints
because the coordinate values may be at any index, not necessarily at consecutive indices. -
search
final int search(double[][] data, double[] coord) Returns the index of the given coordinates in the given data array (source or target coordinates). This method is a copy ofLinearTransformBuilder.search(int[])
, but working on real values instead of integers and capable to work onLinearTransformBuilder.targets
as well asLinearTransformBuilder.sources
.If the given coordinates contain NaN values, then this method will always return -1 even if the given data contains the same NaN values. We want this behavior because NaN mean that the point has not been set. There is no confusion with NaN values that users could have set explicitly because
setControlPoint
methods do not allow NaN values.- See Also:
-
containsValue
Returnstrue
if the given value is one of the target coordinates. This method requires a linear scan of the data.- Specified by:
containsValue
in interfaceMap<org.opengis.geometry.DirectPosition,
org.opengis.geometry.DirectPosition> - Overrides:
containsValue
in classAbstractMap<org.opengis.geometry.DirectPosition,
org.opengis.geometry.DirectPosition> - Parameters:
value
- the value for which to test the presence.- Returns:
true
if the map contains the given value.
-
containsKey
Returnstrue
if the given value is one of the source coordinates. This method is fast on gridded data, but requires linear scan on non-gridded data.- Specified by:
containsKey
in interfaceMap<org.opengis.geometry.DirectPosition,
org.opengis.geometry.DirectPosition> - Overrides:
containsKey
in classAbstractMap<org.opengis.geometry.DirectPosition,
org.opengis.geometry.DirectPosition> - Parameters:
key
- the key for which to test the presence of a value.- Returns:
true
if the map contains a non-null value for the given key.
-
get
Returns the target point for the given source point. This method is fast on gridded data, but requires linear scan on non-gridded data. -
flatIndex
int flatIndex(org.opengis.geometry.DirectPosition source) Returns the index where to fetch a target position for the given source position in the flattened array. This is the same work asLinearTransformBuilder.flatIndex(DirectPosition)
, but without throwing exception if the position is invalid. Instead, -1 is returned as a sentinel value for invalid source (including mismatched number of dimensions).The default implementation assumes a grid. This method must be overridden by
LinearTransformBuilder.Ungridded
.- See Also:
-
entryIterator
protected AbstractMap.EntryIterator<org.opengis.geometry.DirectPosition,org.opengis.geometry.DirectPosition> entryIterator()Returns an iterator over the entries.DirectPosition
instances are created on-the-fly during the iteration.The default implementation assumes a grid. This method must be overridden by
LinearTransformBuilder.Ungridded
.- Specified by:
entryIterator
in classAbstractMap<org.opengis.geometry.DirectPosition,
org.opengis.geometry.DirectPosition> - Returns:
- an iterator over the entries in this map, or
null
.
-