Class GeoPolygon


  • public final class GeoPolygon
    extends GeoObject
    • Constructor Detail

      • GeoPolygon

        public GeoPolygon​(java.util.List<MapCoordinates> vertices)
        Creates a polygon from the specified vertices.
        Parameters:
        vertices - The vertices of the polygon.
      • GeoPolygon

        public GeoPolygon​(MapRectangle mapRectangle)
        Creates a polygon from the specified MapRectangle.
        Parameters:
        mapRectangle - The map rectangle.
    • Method Detail

      • getStrokeWidth

        public float getStrokeWidth()
        Returns:
        The stroke width in dp units.
      • setStrokeWidth

        public void setStrokeWidth​(float width)
        Parameters:
        width - The stroke width in dp units.
      • getStrokeColor

        public int getStrokeColor()
        Returns:
        The stroke color represented as a packed int (AARRGGBB).
      • setStrokeColor

        public void setStrokeColor​(int color)
        Parameters:
        color - The stroke color represented as a packed int (AARRGGBB).
      • getFillColor

        public int getFillColor()
        Returns:
        The fill color represented as a packed int (AARRGGBB).
      • setFillColor

        public void setFillColor​(int color)
        Parameters:
        color - The fill color represented as a packed int (AARRGGBB).
      • getVertices

        public java.util.List<MapCoordinates> getVertices()
        Returns a copy of the vertices of this polygon.
        Returns:
        A copy of the vertices.
      • setVertices

        public void setVertices​(java.util.List<MapCoordinates> vertices)
        Parameters:
        vertices - The new vertices for this polygon.
      • addVertex

        public void addVertex​(MapCoordinates vertex)
        Appends the specified vertex to the list of vertices.
        Parameters:
        vertex - The vertex to append.
      • addVertex

        public void addVertex​(int index,
                              MapCoordinates vertex)
        Inserts the specified vertex at the specified index.
        Parameters:
        index - The index.
        vertex - The vertex to insert.
      • setVertexPosition

        public void setVertexPosition​(int index,
                                      MapCoordinates vertex)
        Changes the position of the specified vertex.
        Parameters:
        index - The index.
        vertex - The new position.
      • removeVertex

        public void removeVertex​(int index)
        Removes the vertex at the specified index.
        Parameters:
        index - The index.
      • removeLastVertex

        public void removeLastVertex()
        Removes the last vertex from the list of vertices.
      • removeAllVertices

        public void removeAllVertices()
        Clears the list of vertices.
      • getVertexCount

        public int getVertexCount()
        Returns:
        The number of vertices.
      • addHole

        public void addHole​(java.util.List<MapCoordinates> hole)
        Adds a hole, as an array of coordinates, to the polygon.
        Parameters:
        hole - The list of vertices of the hole.
      • removeHole

        public void removeHole​(int index)
        Removes the hole at the specified index.

        Holes are indexed in the order they were added.
        Parameters:
        index - The index of the hole.
      • removeAllHoles

        public void removeAllHoles()
        Removes all holes added to the polygon.
      • setHoles

        public void setHoles​(java.util.List<java.util.List<MapCoordinates>> holes)
        Parameters:
        holes - The new holes for this polygon.
      • getHoles

        public java.util.List<java.util.List<MapCoordinates>> getHoles()
        Returns a copy of the holes of this polygon.
        Returns:
        A copy of the holes.
      • getHoleCount

        public int getHoleCount()
        Returns:
        The number of holes.