public final class MarchingSquaresVectorizer extends Object
It can deal with GridCoverage2D
instances, returning footprint in real world
coordinates, as well as with RenderedImage
instances, returning footprint in raster space
coordinates
Modifier and Type | Class and Description |
---|---|
static class |
MarchingSquaresVectorizer.FootprintCoordinates |
static class |
MarchingSquaresVectorizer.ImageAnalysisResultThdLocal |
static class |
MarchingSquaresVectorizer.ImageLoadingType |
Modifier and Type | Field and Description |
---|---|
static List<Range<Integer>> |
DEFAULT_RANGES |
static double |
DEFAULT_SIMPLIFIER_FACTOR |
static double |
DEFAULT_THRESHOLD_AREA |
Constructor and Description |
---|
MarchingSquaresVectorizer() |
MarchingSquaresVectorizer(GridCoverage2D inGeodata,
RenderingHints hints,
double thresholdArea,
double simplifierFactor,
MarchingSquaresVectorizer.ImageLoadingType imageLoadingType,
List<Range<Integer>> exclusionLuminanceRanges)
Main Constructor using
GridCoverage2D as input. |
MarchingSquaresVectorizer(RenderedImage ri,
RenderingHints hints,
double thresholdArea,
MarchingSquaresVectorizer.ImageLoadingType imageLoadingType,
List<Range<Integer>> exclusionLuminanceRanges)
Main Constructor using
RenderedImage as input. |
Modifier and Type | Method and Description |
---|---|
static boolean |
areEqual(double value,
double pValue)
Simple check returning where two double values are equal
|
static Polygon |
createSimplePolygon(Coordinate[] coords)
Create a simple polygon (no holes).
|
void |
dispose() |
Geometry |
getFootprint()
Return the precise footprint
|
MarchingSquaresVectorizer.ImageLoadingType |
getImageLoadingType() |
double |
getPolygonArea()
Return the area of the simplified footprint after computation
|
static double |
getPolygonArea(int[] x,
int[] y,
int N)
Calculates the area of a polygon from its vertices.
|
static double |
getPolygonArea(List<Coordinate> coordinateList)
Calculates the area of a polygon from the coordinates.
|
ROIShape |
getRoiShape()
Return the ROIShape version of the footprint after computation
|
Geometry |
getSimplifiedFootprint()
Return the simplified footprint
|
void |
process()
Executes the MarchingSquares algorithm to find the footprint.
|
void |
setComputeSimplifiedFootprint(boolean computeSimplifiedFootprint)
When set to
true , a simplified version of the footprint will be returned too |
void |
setForceValid(boolean forceValid)
When set to
true (the default) will perform extra checks on the output polygons to
make sure they are valid geometries |
void |
setImageLoadingType(MarchingSquaresVectorizer.ImageLoadingType imageLoadingType)
Specifies which type of imageLoading (
MarchingSquaresVectorizer.ImageLoadingType ) to be used, MarchingSquaresVectorizer.ImageLoadingType.DEFERRED vs MarchingSquaresVectorizer.ImageLoadingType.IMMEDIATE |
void |
setRemoveCollinear(boolean removeCollinear)
When set to
true (the default) will perform collinear vertices removal |
public static final double DEFAULT_SIMPLIFIER_FACTOR
public static final double DEFAULT_THRESHOLD_AREA
public MarchingSquaresVectorizer(GridCoverage2D inGeodata, RenderingHints hints, double thresholdArea, double simplifierFactor, MarchingSquaresVectorizer.ImageLoadingType imageLoadingType, List<Range<Integer>> exclusionLuminanceRanges)
GridCoverage2D
as input.inGeodata
- the input GridCoverage2D
hints
- hints to be used by inner processing, it usually contains tile caches,
schedulersthresholdArea
- the minimum area required by a polygon to be included in the resultsimplifierFactor
- the simplifier factor to be applied to compute the simplified version
of the biggest polygon.imageLoadingType
- the type of imageLoading (DEFERRED vs IMMEDIATE).exclusionLuminanceRanges
- the ranges of luminance values to be excluded by the
computation.public MarchingSquaresVectorizer(RenderedImage ri, RenderingHints hints, double thresholdArea, MarchingSquaresVectorizer.ImageLoadingType imageLoadingType, List<Range<Integer>> exclusionLuminanceRanges)
RenderedImage
as input. Returned footprint coordinates will be
in raster space.ri
- the input RenderedImage
hints
- hints to be used by inner processing, it usually contains tile caches,
schedulersthresholdArea
- the minimum area required by a polygon to be included in the resultimageLoadingType
- the type of imageLoading (DEFERRED vs IMMEDIATE).exclusionLuminanceRanges
- the range of luminance values to be excluded by the
computation.public MarchingSquaresVectorizer()
public ROIShape getRoiShape()
public double getPolygonArea()
public Geometry getSimplifiedFootprint()
public Geometry getFootprint()
public void setRemoveCollinear(boolean removeCollinear)
true
(the default) will perform collinear vertices removalpublic void setForceValid(boolean forceValid)
true
(the default) will perform extra checks on the output polygons to
make sure they are valid geometriespublic void setComputeSimplifiedFootprint(boolean computeSimplifiedFootprint)
true
, a simplified version of the footprint will be returned toopublic void setImageLoadingType(MarchingSquaresVectorizer.ImageLoadingType imageLoadingType)
MarchingSquaresVectorizer.ImageLoadingType
) to be used, MarchingSquaresVectorizer.ImageLoadingType.DEFERRED
vs MarchingSquaresVectorizer.ImageLoadingType.IMMEDIATE
public MarchingSquaresVectorizer.ImageLoadingType getImageLoadingType()
public void process() throws Exception
Exception
public static final boolean areEqual(double value, double pValue)
public void dispose()
public static double getPolygonArea(List<Coordinate> coordinateList)
public static double getPolygonArea(int[] x, int[] y, int N)
x
- the array of x coordinates.y
- the array of y coordinates.N
- the number of sides of the polygon.public static Polygon createSimplePolygon(Coordinate[] coords)
coords
- the coords of the polygon.Polygon
.Copyright © 1996–2023 Geotools. All rights reserved.