Class Geometry
- java.lang.Object
-
- org.openstreetmap.josm.data.imagery.vectortile.mapbox.Geometry
-
-
Field Summary
Fields Modifier and Type Field Description (package private) Collection<Shape>
shapes
-
Constructor Summary
Constructors Constructor Description Geometry(GeometryTypes geometryType, List<CommandInteger> commands)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) static double
calculateSurveyorsArea(int[] xArray, int[] yArray)
This is also known as the "shoelace formula".Collection<Shape>
getShapes()
Get the shapes to draw this geometry with
-
-
-
Field Detail
-
shapes
final Collection<Shape> shapes
-
-
Constructor Detail
-
Geometry
public Geometry(GeometryTypes geometryType, List<CommandInteger> commands)
- Parameters:
geometryType
- The type of geometrycommands
- The commands used to create the geometry- Throws:
IllegalArgumentException
- if arguments are not understood or if the shoelace formula returns 0 for a polygon ring.
-
-
Method Detail
-
calculateSurveyorsArea
static double calculateSurveyorsArea(int[] xArray, int[] yArray)
This is also known as the "shoelace formula".- Parameters:
xArray
- The array of x coordinatesyArray
- The array of y coordinates- Returns:
- The area of the object
- Throws:
IllegalArgumentException
- if the array lengths are not equal
-
getShapes
public Collection<Shape> getShapes()
Get the shapes to draw this geometry with- Returns:
- A collection of shapes
-
-