public class TLcdComplexPolygonContourFinder extends Object implements ILcdStatusSource
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.Modifier and Type | Class and Description |
---|---|
static class |
TLcdComplexPolygonContourFinder.IntervalMode
The interval mode of the created contours.
|
Constructor and Description |
---|
TLcdComplexPolygonContourFinder()
Constructs a new TLcdComplexPolygonContourFinder.
|
Modifier and Type | Method and Description |
---|---|
void |
addStatusListener(ILcdStatusListener aStatusListener)
Starts notifying a listener about the progress of the contour computation.
|
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. |
double |
getProgress()
Returns the progress value of the calculation.
|
protected boolean |
isSpecialValue(double aValue)
Check whether this value should be treated as a special value.
|
boolean |
isWrapAroundX()
Returns whether the polar mode of the contour finder is enabled.
|
void |
removeStatusListener(ILcdStatusListener aStatusListener)
Terminates notifying a listener of the progress of the contour computation.
|
void |
setWrapAroundX(boolean aWrapAroundX)
Sets the contour finder to polar or cartesian.
|
public TLcdComplexPolygonContourFinder()
protected boolean isSpecialValue(double aValue)
aValue
- The value to check.public boolean isWrapAroundX()
public void setWrapAroundX(boolean aWrapAroundX)
aWrapAroundX
- true to make the contour finder polar, false to make it cartesian.public void removeStatusListener(ILcdStatusListener aStatusListener)
removeStatusListener
in interface ILcdStatusSource
aStatusListener
- will no longer be notified of progress when running a contour
computation.addStatusListener(com.luciad.util.ILcdStatusListener)
public void addStatusListener(ILcdStatusListener aStatusListener)
addStatusListener
in interface ILcdStatusSource
aStatusListener
- will be notified of progress when running a contour computation.removeStatusListener(com.luciad.util.ILcdStatusListener)
public double getProgress()
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.
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.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().