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 booleancontainsKey(Object key) Returnstrueif the given value is one of the source coordinates.final booleancontainsValue(Object value) Returnstrueif the given value is one of the target coordinates.(package private) intdomain()Returns the number of points to consider when searching inLinearTransformBuilder.sourcesorLinearTransformBuilder.targetsarrays.protected AbstractMap.EntryIterator<org.opengis.geometry.DirectPosition,org.opengis.geometry.DirectPosition> Returns an iterator over the entries.(package private) intflatIndex(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.DirectPositionReturns the target point for the given source point.(package private) final org.opengis.geometry.DirectPositionposition(double[][] data, int offset) Creates a point from the given data at the given offset.(package private) final intsearch(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, valuesMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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.sourcesorLinearTransformBuilder.targetsarrays. For gridded data we cannot rely onLinearTransformBuilder.numPointsbecause 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.targetsas 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
setControlPointmethods do not allow NaN values.- See Also:
-
containsValue
Returnstrueif the given value is one of the target coordinates. This method requires a linear scan of the data.- Specified by:
containsValuein interfaceMap<org.opengis.geometry.DirectPosition,org.opengis.geometry.DirectPosition> - Overrides:
containsValuein classAbstractMap<org.opengis.geometry.DirectPosition,org.opengis.geometry.DirectPosition> - Parameters:
value- the value for which to test the presence.- Returns:
trueif the map contains the given value.
-
containsKey
Returnstrueif 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:
containsKeyin interfaceMap<org.opengis.geometry.DirectPosition,org.opengis.geometry.DirectPosition> - Overrides:
containsKeyin classAbstractMap<org.opengis.geometry.DirectPosition,org.opengis.geometry.DirectPosition> - Parameters:
key- the key for which to test the presence of a value.- Returns:
trueif 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. -
entryIterator
protected AbstractMap.EntryIterator<org.opengis.geometry.DirectPosition,org.opengis.geometry.DirectPosition> entryIterator()Returns an iterator over the entries.DirectPositioninstances are created on-the-fly during the iteration.The default implementation assumes a grid. This method must be overridden by
LinearTransformBuilder.Ungridded.- Specified by:
entryIteratorin classAbstractMap<org.opengis.geometry.DirectPosition,org.opengis.geometry.DirectPosition> - Returns:
- an iterator over the entries in this map, or
null.
-