Class TLcdComplexPolygonContourFinder

java.lang.Object
com.luciad.contour.TLcdComplexPolygonContourFinder
All Implemented Interfaces:
ILcdStatusSource

public class TLcdComplexPolygonContourFinder extends Object implements ILcdStatusSource
Contour finder that finds areas. The found contours should be rendered as complex polygons, when using TLcdLonLatComplexPolygonContourBuilder or TLcdXYComplexPolygonContourBuilder with this contour finder you already get them as complex polygons.

Depending on the interval mode given as parameter to findContours, the contour finder finds areas larger than the level values, smaller than the level values, or between two consecutive level values.

When the interval setting INTERVAL is used, then it will return N - 1 types of areas when N level values are given, because it only returns a type of area for each interval between two values. When the interval setting LOWER or HIGHER is used, it will return N types of areas when N level values are given, because it creates an area lower or higher than each given level value. The interval setting has no influence on the behaviour with special values.

This contour finder will call createContour on the given ILcdContourBuilder each time when it finds a closed contour. All contours of the same level can be added together as a complex polygon to form the complex polygon for that level. As complex polygons are defined, a smaller contour inside a larger contour of the same level represents a hole in that larger area.

This contour finder can find contours for two types of values: level values, and special values. Examples of level values are heights or other continuous data. Special values are values that cannot be sorted from low to high and have special meaning, e.g. "unknown", "visible" or "invisible". The contours of level values are interpolated, that is, contour borders are created between lower and higher values. For special values it creates a contour around each area with that exact value and the concept of lower and higher doesn't exist. Both level values and special values can be mixed. Special values can only be used if the isSpecialValue method of the contour finder is overridden, since its default implementation always returns false, and each value in the special values array should let this method return true.

Since:
10.1
  • Constructor Details

    • TLcdComplexPolygonContourFinder

      public TLcdComplexPolygonContourFinder()
      Constructs a new TLcdComplexPolygonContourFinder.
  • Method Details

    • isSpecialValue

      protected boolean isSpecialValue(double aValue)
      Check whether this value should be treated as a special value. Special values are not treated as height (or other physical) values, and are not interpolated. The default implementation treats nothing as special. To use special values, override this method to treat values lower or higher than a certain number as special. It is preferrable to use an efficient implementation for this method, that is, using a few compare operators, rather than finding if the value is in a list.
      Parameters:
      aValue - The value to check.
      Returns:
      Whether or not it's a special value.
    • isWrapAroundX

      public boolean isWrapAroundX()
      Returns whether the polar mode of the contour finder is enabled.
      Returns:
      whether the polar mode of the contour finder is enabled.
    • setWrapAroundX

      public void setWrapAroundX(boolean aWrapAroundX)
      Sets the contour finder to polar or cartesian. If true, then the contour finder is polar. If it's polar, the matrix is assumed to be a polar matrix where each column represents a certain angle and each row a certain distance. The first and last column are assumed to touch. When using the contour finder in cartesian mode on a polar matrix, the result will look fine at first sight but there will be an edge at the polygons at 0 degrees. In polar mode, the contour finder wraps around at 0 degrees to the other side, so that the polygons are stitched together at 0 degrees. Even when the polar mode is false, the result will still be a circle if the matrix is polar, because the coordinates of the created contours use the X and Y values returned by the matrix.
      Parameters:
      aWrapAroundX - true to make the contour finder polar, false to make it cartesian.
    • removeStatusListener

      public void removeStatusListener(ILcdStatusListener aStatusListener)
      Terminates notifying a listener of the progress of the contour computation.
      Specified by:
      removeStatusListener in interface ILcdStatusSource
      Parameters:
      aStatusListener - will no longer be notified of progress when running a contour computation.
      See Also:
    • addStatusListener

      public void addStatusListener(ILcdStatusListener aStatusListener)
      Starts notifying a listener about the progress of the contour computation.
      Specified by:
      addStatusListener in interface ILcdStatusSource
      Parameters:
      aStatusListener - will be notified of progress when running a contour computation.
      See Also:
    • getProgress

      public double getProgress()
      Returns the progress value of the calculation.
      Returns:
      the progress value of the calculation.
    • findContours

      public void findContours(ILcdContourBuilder aContourBuilder, ILcdMatrixView aMatrixView, TLcdComplexPolygonContourFinder.IntervalMode aIntervalMode, double[] aContourLevelValues, double[] aContourSpecialValues)

      Computes all contour lines for the specified aMatrixView at the given levels. The specified function (aFunction) is applied to each generated complex polygon (TLcdExtrudedShape).

      For each area, a complex polygon is returned. Areas are defined either by intervals, or by special values. When N interval levels are given, this defines N-1 intervals. When N special values are given, this defines N special values. Intervals are all values between two values. Special values define an area of sample points that have exactly that value. Intervals areas are interpolated, while special value areas are not. Each area is disjoint. There is exactly one complex polygon created per interval and special value: the complex polygon defines all holes and islands.

      Parameters:
      aContourBuilder - The function to apply on each generated contour line.
      aMatrixView - The input data, it should have more than one column and more than one row.
      aIntervalMode - This determines which complex polygons are created for the height levels given to this method.

      If the mode is INTERVAL, then a complex polygon around the area between each two consecutive values is created. Since two consecutive values are used per interval, there is one less area created than the number of level values. Each area is disjoint to all other areas.

      If it's LOWER, a complex polygon around each area smaller than the given value is created. There are as much areas created as given levels. The areas will overlap each other, but will still be disjoint to special value areas.

      If it's HIGHER, a complex polygon around each area higher than the given value is created. There are as much areas created as given levels. The areas will overlap each other, but will still be disjoint to special value areas.

      aContourLevelValues - Must be monotonously increasing values. Interval levels should not be special values. If getIntervalMode() == IntervalMode.INTERVAL, this defines contour levels for intervals. N intervals define N-1 areas. If getIntervalMode() == IntervalMode.LOWER or IntervalMode.HIGHER, this defines N areas, each lower or higher than the respective value.
      aContourSpecialValues - Contour levels for special values. N special values define N areas. These areas are around locations that have exactly this special value. Special values should be outside the range of the values given in the intervals. That is, the special values should either be smaller than aMinHeight, or larger than aMaxHeight.
      Throws:
      IllegalArgumentException - when a height level is in the special value range or a special level is outside the special value range. All special values should be true for #isSpecialValue(), while all height levels should be false for #isSpecialValue().