|
MorphAL 0.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfr.ign.cogit.alpage.morphal.geometry.PolygonUtil
public class PolygonUtil
Geometric methods to manipulate geometric features with Polygon
and MultiPolygon
types, and to compute indices.
Constructor Summary | |
---|---|
PolygonUtil()
|
Method Summary | |
---|---|
static MultiPolygon |
cleaningMultiPolygonShape(MultiPolygon multiPolygon,
double threshold)
Clean a MultiPolygon by removing the unuseful points (in regard to the
chosen threshold) of a MultiPolygon , i.e. the points which are in the
alignment between the previous point and the following one. |
static MultiPolygon |
cleaningMultiPolygonShapeAutomaticThreshold(MultiPolygon multiPolygon)
Clean a MultiPolygon by removing the unuseful points (in regard to the
chosen threshold) of a MultiPolygon , i.e. the points which are in the
alignment between the previous point and the following one. |
static Polygon |
cleaningPolygonShape(Polygon polygon,
double threshold)
Clean a Polygon by removing the unuseful points (in regard to the
chosen threshold) of a Polygon , i.e. the points which are in the
alignment between the previous point and the following one. |
static Polygon |
cleaningPolygonShapeAutomaticThreshold(Polygon polygon)
Clean a Polygon by removing the unuseful points (in regard to the
chosen threshold) of a Polygon , i.e. the points which are in the
alignment between the previous point and the following one. |
static double |
compactednessIndex(Polygon polygon)
Compute the compactedness index of a Polygon , i.e. |
static double |
elongation(Polygon rectangle)
(Input parameter: The Polygon must be a rectangle)
Compute the elongation of a rectangle, equals to the ratio length / width. |
static boolean |
isCircle(Polygon polygon,
double iMillerThreshold)
Compute if a Polygon has a circular shape or not, based on
the compactedness index or Miller's index (if Miller's index equals 1,
it means that the shape is a perfect circle). |
static double |
isRectangle(double sdConvexHull,
double sdConvexHullThreshold,
double sdMBR,
double sdMBRThreshold,
Polygon mbr)
Compute if a Polygon has a rectangular shape or not, based on the comparison
with two shapes: the shape of the minimum bounding rectangle of the Polygon ,
and the shape of the convex hull associated to the Polygon . |
static double |
isRectangle(Polygon polygon,
double sdConvexHullThreshold,
double sdMBRThreshold)
Compute if a Polygon has a rectangular shape or not, based on the comparison
with two shapes: the shape of the minimum bounding rectangle of the Polygon ,
and the shape of the convex hull associated to the Polygon . |
static Polygon |
MBR(Polygon polygon)
Compute the minimum bounding rectangle (MBR) of a Polygon . |
static double |
orientation(Polygon polygon)
Compute the orientation of a Polygon (in degrees) comparatively
to the cartographic East (axis X). |
static Polygon |
rotation(Polygon polygon,
Coordinate center,
double angle)
Compute the rotation of a Polygon . |
static double |
surfaceDistance(Geometry geometryA,
Geometry geometryB)
Compute the surface distance between two Geometry s. |
static double |
surfaceDistance(Polygon polygonA,
Polygon polygonB)
Compute the surface distance between two Polygon s. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PolygonUtil()
Method Detail |
---|
public static double compactednessIndex(Polygon polygon)
Polygon
, i.e. Miller's index,
4.Pi.area / perimeter^2.
polygon
- polygon to process
public static double surfaceDistance(Polygon polygonA, Polygon polygonB)
Polygon
s.
Surface distance is a number between 0 and 1, computed thanks to
the following formula: 1 - (area(intersection) / area(union)).
polygonA
- first polygon to processpolygonB
- second polygon to process
public static double surfaceDistance(Geometry geometryA, Geometry geometryB)
Geometry
s.
Surface distance is a number between 0 and 1, computed thanks to
the following formula: 1 - (area(intersection) / area(union)).
geometryA
- first geometry to processgeometryB
- second geometry to process
public static Polygon rotation(Polygon polygon, Coordinate center, double angle)
Polygon
.
polygon
- polygon to processcenter
- rotation centerangle
- rotation angle
public static Polygon MBR(Polygon polygon)
Polygon
.
polygon
- polygon to process
public static double elongation(Polygon rectangle)
Polygon
must be a rectangle)
Compute the elongation of a rectangle, equals to the ratio length / width.
If the Polygon
in parameter has a number of coordinates different from 5,
the value -1.0 is returned.
rectangle
- a polygon which must be a rectangle
public static double orientation(Polygon polygon)
Polygon
(in degrees) comparatively
to the cartographic East (axis X). The orientation is based on the
orientation of the associated minimum bounding rectangle. Its
value is between 0 et 180 degrees, except if the MBR can not
be defined. In that last case, the value -2.0 is returned.
polygon
- polygon to process
public static boolean isCircle(Polygon polygon, double iMillerThreshold)
Polygon
has a circular shape or not, based on
the compactedness index or Miller's index (if Miller's index equals 1,
it means that the shape is a perfect circle).
polygon
- polygon to processiMillerThreshold
- minimum threshold for Miller's index
public static double isRectangle(Polygon polygon, double sdConvexHullThreshold, double sdMBRThreshold)
Polygon
has a rectangular shape or not, based on the comparison
with two shapes: the shape of the minimum bounding rectangle of the Polygon
,
and the shape of the convex hull associated to the Polygon
. This comparison
is computed thanks to two thresholds (threshold of maximums), one for each associated
shape. If the shape is rectangular, the orientation (in degrees) based on the is returned;
otherwise, the value of -1.0 is returned. Finally, if the returned value equals -2.0,
it means that the MBR can not be computed.
polygon
- polygon to processsdConvexHullThreshold
- maximum threshold for surface distance between the polygon and its convex hullsdMBRThreshold
- maximum threshold for surface distance between the polygon and its associated minimum bounding rectangle
public static double isRectangle(double sdConvexHull, double sdConvexHullThreshold, double sdMBR, double sdMBRThreshold, Polygon mbr)
Polygon
has a rectangular shape or not, based on the comparison
with two shapes: the shape of the minimum bounding rectangle of the Polygon
,
and the shape of the convex hull associated to the Polygon
. This comparison
is computed thanks to two thresholds (threshold of maximums), one for each associated
shape.
If the shape is rectangular, the orientation (in degrees) based on the is returned;
otherwise, the value of -1.0 is returned. Finally, if the returned value equals -2.0,
it means that the MBR can not be computed.
sdConvexHull
- surface distance between the considered polygon and its convex hullsdConvexHullThreshold
- maximum threshold for surface distance between the considered polygon and its convex hullsdMBR
- surface distance between the considered polygon and its associated minimum bounding rectanglesdMBRThreshold
- maximum threshold for surface distance between the considered polygon and its associated minimum bounding rectanglembr
- minimum bounding rectangle associated to the considered polygon
public static Polygon cleaningPolygonShape(Polygon polygon, double threshold)
Polygon
by removing the unuseful points (in regard to the
chosen threshold) of a Polygon
, i.e. the points which are in the
alignment between the previous point and the following one. The alignment
is here defined thanks to a given threshold comparatively to Pi (or 180°).
The threshold has to be expressed in degrees.
polygon
- polygon to processthreshold
- threshold in degrees to remove points which are aligned
with an angle of 180 +/- threshold in the polygon
public static MultiPolygon cleaningMultiPolygonShape(MultiPolygon multiPolygon, double threshold)
MultiPolygon
by removing the unuseful points (in regard to the
chosen threshold) of a MultiPolygon
, i.e. the points which are in the
alignment between the previous point and the following one. The alignment
is here defined thanks to a given threshold comparatively to Pi (or 180°).
The threshold has to be expressed in degrees.
multiPolygon
- multipolygon to processthreshold
- threshold in degrees to remove points which are aligned
with an angle of 180 +/- threshold in the multipolygon
public static Polygon cleaningPolygonShapeAutomaticThreshold(Polygon polygon)
Polygon
by removing the unuseful points (in regard to the
chosen threshold) of a Polygon
, i.e. the points which are in the
alignment between the previous point and the following one. The alignment
is here defined thanks to a threshold comparatively to Pi (or 180°)
which is automatically computed (quasi optimal, considering a maximum
area variation of 1%, comparating area variations, not the global one).
The threshold has a maximum of 2 degrees.
TODO: Check if the threshold matches a reality
polygon
- polygon to clean
public static MultiPolygon cleaningMultiPolygonShapeAutomaticThreshold(MultiPolygon multiPolygon)
MultiPolygon
by removing the unuseful points (in regard to the
chosen threshold) of a MultiPolygon
, i.e. the points which are in the
alignment between the previous point and the following one. The alignment
is here defined thanks to a threshold comparatively to Pi (or 180°)
which is automatically computed (quasi optimal, considering a maximum
area variation of 1%, comparating area variations, not the global one).
The threshold has a maximum of 2 degrees.
TODO: Check if the threshold matches a reality
multiPolygon
- multipolygon to clean
|
MorphAL 0.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |