Class TLcdPolylineContourFinder

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

public class TLcdPolylineContourFinder extends Object implements ILcdStatusSource
Contour finder that finds open or closed contour lines (isolines). An open contour line can occur if the contour goes through the edge of the map. The found contours should be rendered as polylines, when using TLcdLonLatPolylineContourBuilder or TLcdXYPolylineContourBuilder with this contour finder you already get them as polylines.

This contour finder can find contours for two types of values: level values, and special values. Level values are for example 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". For level values the contours are interpolated, that is, contour lines 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

    • TLcdPolylineContourFinder

      public TLcdPolylineContourFinder()
      Constructs a new TLcdPolylineContourFinder.
  • 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, double[] aContourLevelValues, double[] aContourSpecialValues)

      Computes all contour lines for the specified aMatrixView at the levels indicated by aContourLevels. The specified function (aFunction) is applied to each generated contour line (ILcdValuedPolygon). The method returns the number of computed contour lines.

      The orientation of the polygons gives you information about which side has a higher value. If the polygon is oriented clockwise then the exterior has a higher value than the interior. If the polygon is oriented counter-clockwise, then the exterior of the polygon has a lower value than the interior.

      Note that, when the current thread is interrupted, the method will return the intermediate result. This is the number of already computed contour lines.

      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.
      aContourLevelValues - Contour levels for intervals. N intervals define N-1 areas. Must be monotously increasing values. Iso levels should not be special values.
      aContourSpecialValues - Contour levels for special values. N special values define N areas. These areas are around locations that have exactly this special value.
      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().