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.
  • 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 in LinearTransformBuilder.sources or LinearTransformBuilder.targets arrays. For gridded data we cannot rely on LinearTransformBuilder.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 of LinearTransformBuilder.search(int[]), but working on real values instead of integers and capable to work on LinearTransformBuilder.targets as well as LinearTransformBuilder.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

      public final boolean containsValue(Object value)
      Returns true if the given value is one of the target coordinates. This method requires a linear scan of the data.
      Specified by:
      containsValue in interface Map<org.opengis.geometry.DirectPosition,org.opengis.geometry.DirectPosition>
      Overrides:
      containsValue in class AbstractMap<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

      public final boolean containsKey(Object key)
      Returns true 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 interface Map<org.opengis.geometry.DirectPosition,org.opengis.geometry.DirectPosition>
      Overrides:
      containsKey in class AbstractMap<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

      public final org.opengis.geometry.DirectPosition get(Object key)
      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 as LinearTransformBuilder.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 class AbstractMap<org.opengis.geometry.DirectPosition,org.opengis.geometry.DirectPosition>
      Returns:
      an iterator over the entries in this map, or null.