Class Tracer
java.lang.Object
org.apache.sis.internal.processing.isoline.Tracer
Iterator over contouring grid cells together with an interpolator and an assembler of polyline segments.
A single instance of this class is created by
Isolines.generate(…)
for all bands to process in a
given image. Tracer
is used for doing a single iteration over all image pixels.- Since:
- 1.1
- Version:
- 1.3
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) final class
Builder of polylines for a single level. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final org.opengis.referencing.operation.MathTransform
Final transform to apply on coordinates (integer source coordinates at pixel centers).(package private) static final int
Mask to apply onTracer.Level.isDataAbove
for telling that value in a corner is higher than the level value.(package private) static final int
Mask to apply onTracer.Level.isDataAbove
for telling that value in a corner is higher than the level value.private final int
Increment to the position for reading next sample value.private final double
Translation to apply on coordinates.private final double
Translation to apply on coordinates.(package private) static final int
Mask to apply onTracer.Level.isDataAbove
for telling that value in a corner is higher than the level value.(package private) static final int
Mask to apply onTracer.Level.isDataAbove
for telling that value in a corner is higher than the level value.private final double[]
The 2×2 window containing pixel values in the 4 corners of current contouring grid cell.(package private) int
Pixel coordinate on the left side of the cell where to interpolate.(package private) int
Pixel coordinate on the top side of the cell where to interpolate. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate Joiner
writeTo
(Joiner path, PolylineBuffer[] polylines, boolean close) Writes all given polylines to the specified path builder.
-
Field Details
-
UPPER_LEFT
static final int UPPER_LEFTMask to apply onTracer.Level.isDataAbove
for telling that value in a corner is higher than the level value. Values are defined inPixelIterator.Window
iteration order: from left to right, then top to bottom.Note: there is some hard-coded dependencies to those exact values. If values are changed, search for example for
log2(UPPER_RIGHT)
in comments.- See Also:
-
UPPER_RIGHT
static final int UPPER_RIGHTMask to apply onTracer.Level.isDataAbove
for telling that value in a corner is higher than the level value. Values are defined inPixelIterator.Window
iteration order: from left to right, then top to bottom.Note: there is some hard-coded dependencies to those exact values. If values are changed, search for example for
log2(UPPER_RIGHT)
in comments.- See Also:
-
LOWER_LEFT
static final int LOWER_LEFTMask to apply onTracer.Level.isDataAbove
for telling that value in a corner is higher than the level value. Values are defined inPixelIterator.Window
iteration order: from left to right, then top to bottom.Note: there is some hard-coded dependencies to those exact values. If values are changed, search for example for
log2(UPPER_RIGHT)
in comments.- See Also:
-
LOWER_RIGHT
static final int LOWER_RIGHTMask to apply onTracer.Level.isDataAbove
for telling that value in a corner is higher than the level value. Values are defined inPixelIterator.Window
iteration order: from left to right, then top to bottom.Note: there is some hard-coded dependencies to those exact values. If values are changed, search for example for
log2(UPPER_RIGHT)
in comments.- See Also:
-
window
private final double[] windowThe 2×2 window containing pixel values in the 4 corners of current contouring grid cell. Values are always stored with band index varying fastest, then column index, then row index. The length of this array is (number of bands) × 2 (width) × 2 (height). -
pixelStride
private final int pixelStrideIncrement to the position for reading next sample value. It corresponds to the number of bands inwindow
. -
x
int xPixel coordinate on the left side of the cell where to interpolate. The range is 0 inclusive todomain.width
exclusive. -
y
int yPixel coordinate on the top side of the cell where to interpolate. The range is 0 inclusive todomain.height
exclusive. -
translateX
private final double translateXTranslation to apply on coordinates. For isolines computed sequentially, this is the image origin (often 0,0 but not necessarily). For isolines computed in parallel, the translations are different for each computation tile. -
translateY
private final double translateYTranslation to apply on coordinates. For isolines computed sequentially, this is the image origin (often 0,0 but not necessarily). For isolines computed in parallel, the translations are different for each computation tile. -
gridToCRS
private final org.opengis.referencing.operation.MathTransform gridToCRSFinal transform to apply on coordinates (integer source coordinates at pixel centers). Can benull
if none.
-
-
Constructor Details
-
Tracer
Tracer(double[] window, int pixelStride, Rectangle domain, org.opengis.referencing.operation.MathTransform gridToCRS) Creates a new position for the given data window.- Parameters:
window
- the 2×2 window containing pixel values in the 4 corners of current contouring grid cell.pixelStride
- increment to the position inwindow
for reading next sample value.domain
- pixel coordinates where iteration will happen.gridToCRS
- final transform to apply on coordinates (integer source coordinates at pixel centers).
-
-
Method Details
-
writeTo
private Joiner writeTo(Joiner path, PolylineBuffer[] polylines, boolean close) throws org.opengis.referencing.operation.TransformException Writes all given polylines to the specified path builder. NullPolylineBuffer
instances are ignored.PolylineBuffer
instances at even index are written with their points in reverse order. All given polylines are cleared by this method.- Parameters:
path
- where to write the polylines, ornull
if not yet created.polylines
- the polylines to write.close
- whether to close the polygon.- Returns:
- the given path builder, or a newly created builder if the argument was null.
- Throws:
org.opengis.referencing.operation.TransformException
- if thegridToCRS
transform cannot be applied.
-