Class Geometry
- java.lang.Object
-
- org.openstreetmap.josm.data.imagery.vectortile.mapbox.Geometry
-
public class Geometry extends java.lang.Object
A class to generate geometry for a vector tile- Since:
- 17862
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.util.Collection<java.awt.Shape>shapes
-
Constructor Summary
Constructors Constructor Description Geometry(GeometryTypes geometryType, java.util.List<CommandInteger> commands)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) static doublecalculateSurveyorsArea(int[] xArray, int[] yArray)This is also known as the "shoelace formula".java.util.Collection<java.awt.Shape>getShapes()Get the shapes to draw this geometry withprivate voidinitializePoints(GeometryTypes geometryType, java.util.List<CommandInteger> commands)Initialize point geometryprivate voidinitializeWayGeometry(GeometryTypes geometryType, java.util.List<CommandInteger> commands)Initialize way geometry
-
-
-
Field Detail
-
shapes
final java.util.Collection<java.awt.Shape> shapes
-
-
Constructor Detail
-
Geometry
public Geometry(GeometryTypes geometryType, java.util.List<CommandInteger> commands)
- Parameters:
geometryType- The type of geometrycommands- The commands used to create the geometry- Throws:
java.lang.IllegalArgumentException- if arguments are not understood or if the shoelace formula returns 0 for a polygon ring.
-
-
Method Detail
-
initializePoints
private void initializePoints(GeometryTypes geometryType, java.util.List<CommandInteger> commands)
Initialize point geometry- Parameters:
geometryType- The geometry type (used for logging)commands- The commands to use to create the geometry
-
initializeWayGeometry
private void initializeWayGeometry(GeometryTypes geometryType, java.util.List<CommandInteger> commands)
Initialize way geometry- Parameters:
geometryType- The geometry typecommands- The commands to use to create the geometry
-
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:
java.lang.IllegalArgumentException- if the array lengths are not equal
-
getShapes
public java.util.Collection<java.awt.Shape> getShapes()
Get the shapes to draw this geometry with- Returns:
- A collection of shapes
-
-