Class Geometry


  • public class Geometry
    extends java.lang.Object
    A class to generate geometry for a vector tile
    Since:
    17862
    • Field Detail

      • shapes

        final java.util.Collection<java.awt.Shape> shapes
    • Constructor Detail

      • Geometry

        public Geometry​(GeometryTypes geometryType,
                        java.util.List<CommandInteger> commands)
        Create a Geometry for a Feature
        Parameters:
        geometryType - The type of geometry
        commands - 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 type
        commands - 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 coordinates
        yArray - 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