Class DataLocationConstraints

java.lang.Object
noaa.coastwatch.util.DataLocationConstraints

public class DataLocationConstraints extends Object
The DataLocationConstraints class holds a set of values used to specify the bounds and sparseness of a contiguous area of data locations. The main purpose is to pass to the DataLocationIteratorFactory to create various types of iterators over locations within the area. The class also has static methods useful with polygons shapes.
Since:
3.3.2
Author:
Peter Hollemans
  • Field Details

    • dims

      public int[] dims
      The full data location dimensions.
    • start

      public DataLocation start
      The data location start and end bounds. These can be specified as an alternative to using the full bounds specified in dims. If either start or end is not specified, the bounds are taken from dims.
    • end

      public DataLocation end
      The data location start and end bounds. These can be specified as an alternative to using the full bounds specified in dims. If either start or end is not specified, the bounds are taken from dims.
    • polygon

      public Shape polygon
      The polygon shape surrounding the locations. The polygon can be specified as an alternative to the start and end bounds. The (x,y) coordinate values of each point in the polygon are taken to be the data location (row, column) values.
    • fraction

      public double fraction
      The data coverage fraction in the range [0..1]. This is used to compute the stride if stride is not specified. If neither the data coverage fraction or the stride are specified, the start and end values are taken to be endpoints of a 1D line rather than an area.
    • minCount

      public int minCount
      The data coverage minimum number of data locations. This is used to compute the stride in combination with the fraction.
    • stride

      public int[] stride
      The data location stride in each data dimension. If specified, this stride overrides anything specified by the fraction and minCount.
  • Constructor Details

    • DataLocationConstraints

      public DataLocationConstraints()
  • Method Details

    • getShapeBounds

      public static DataLocation[] getShapeBounds(Shape shape)
      Gets the rectangular bounds of the specified shape in data location coordinates.
      Parameters:
      shape - the shape to get the bounds for.
      Returns:
      the bounds as [min, max] data locations or null if the shape has no area.
    • getShapeArea

      public static double getShapeArea(Shape shape)
      Gets the area of a shape.
      Parameters:
      shape - the shape to get the area for.
      Returns:
      the shape area as a fractional value in the range [0..1] where 1 means that the shape fills up the entire rectangle enclosed by its bounds.