## org.opengis.go.display.primitive
Interface GraphicPolygon

All Superinterfaces:
  Graphic

    public interface GraphicPolygon

extends Graphic

Defines a common abstraction for graphic representation of polygons. A `GraphicPolygon` consists of a an exterior ring of vertices and a set of non-mutually-overlapping interior rings of vertices. The exterior and interior rings of a polygon are defined by a list of DirectPosition objects. Technically speaking, these rings are required to be closed (i.e. the first and last points must coincide). However, this interface allows the user to create lists where the first and last points are not coincident. In such a case, the implementation of this interface will assume that there is an additional segment between the first and last points, completing the ring. (This will take place without modifying the list of points.)

Since:
  GO 1.0

Field Summary

Fields inherited from interface Graphic
`DEFAULT_AUTO_EDIT, DEFAULT_BLINK_PATTERN, DEFAULT_BLINKING, DEFAULT_DRAG_SELECTABLE, DEFAULT_MAX_SCALE, DEFAULT_MIN_SCALE, DEFAULT_PICKABLE, DEFAULT_SELECTED, DEFAULT_VISIBLE, DEFAULT_Z_ORDER`

Method Summary
`void` `addExteriorPoint(DirectPosition position)` Adds a new point to the list of vertices in the exterior ring.
`void` `addInteriorPoint(int interiorRingIndex, DirectPosition position)` Adds a new point to the list of vertices of an interior ring.
`int` `addInteriorRing()` Creates a new interior ring (hole) for this polygon.
`int` `addInteriorRing(DirectPosition[] vertices)` Creates a new interior ring for this polygon and immediately sets its points to those in the given array.
`DirectPosition` `getExteriorPoint(int index)` Returns a live reference to the vertex at the given index.
`DirectPosition[]` `getExteriorRing()` Returns a new array containing references to all of the vertices in the exterior ring.
`DirectPosition` `getInteriorPoint(int index, int interiorRingIndex)` Returns a live reference to the vertex at the given index.
`DirectPosition[]` `getInteriorRing(int interiorRingIndex)` Returns a new array containing references to all of the vertices in the exterior ring.
`DirectPosition[][]` `getInteriorRings()` Returns a newly allocated two-dimensional array of points.
`int` `getNumExteriorPoints()` Returns the number of vertices in the exterior ring.
`int` `getNumInteriorPoints(int interiorRingIndex)` Returns the number of vertices in an interior ring.
`int` `getNumInteriorRings()` Returns the number of interior rings currently in this polygon.
`PathType` `getPathType()` Returns the parameter that indicates how the "in-between" points between vertices are to be drawn.
`PolygonSymbolizer` `getPolygonSymbolizer()` Returns the `GraphicStyle` for this `GraphicPolygon`, which is required to be a `PolygonSymbolizer`.
`void` `insertExteriorPoint(int index, DirectPosition position)` Inserts a new point into the list of vertices for the exterior ring.
`void` `insertInteriorPoint(int index, int interiorRingIndex, DirectPosition position)` Inserts a new point into the list of vertices for an interior ring.
`boolean` `isAllowingNewVertices()` Indicates whether clicking on an edge of this graphic linestring should insert a new vertex at that location when the object is in edit mode.
`DirectPosition` `removeExteriorPoint(int index)` Removes a position from the list of vertices for the exterior ring.
`DirectPosition` `removeInteriorPoint(int index, int interiorRingIndex)` Removes a position from the list of vertices for an interior ring.
`void` `removeInteriorRing(int interiorRingIndex)` Removes an interior ring.
`void` `setAllowingNewVertices(boolean newValue)` Sets the boolean that indicates whether clicking on an edge of this graphic linestring should insert a new vertex at that location.
`DirectPosition` `setExteriorPoint(int index, DirectPosition position)` Replaces a position in the list of vertices for the exterior ring.
`void` `setExteriorRing(DirectPosition[] newVertices)` Clears the list of vertices in the exterior ring and adds all of the vertices in the given array.
`DirectPosition` `setInteriorPoint(int index, int interiorRingIndex, DirectPosition position)` Replaces a position in the list of vertices for an interior ring.
`void` `setInteriorRing(int interiorRingIndex, DirectPosition[] newVertices)` Clears the list of vertices in an exterior ring and adds all of the vertices in the given array.
`void` `setInteriorRings(DirectPosition[][] interiorRingPoints)` Clears the lists of vertices of all the interior rings and adds all of the vertices in the given arrays.
`void` `setPathType(PathType pathType)` Sets the parameter that indicates how the "in-between" points between vertices should be drawn.

Methods inherited from interface Graphic

`addGraphicListener, cloneGraphic, dispose, fireGraphicEvent, getAutoEdit, getBlinking, getBlinkPattern, getClientProperty, getDragSelectable, getGraphicStyle, getMaxScale, getMinScale, getName, getParent, getPickable, getSelected, getSymbology, getVisible, getZOrderHint, isPassingEventsToParent, isShowingAnchorHandles, isShowingEditHandles, putClientProperty, refresh, removeGraphicListener, setAutoEdit, setBlinking, setBlinkPattern, setDragSelectable, setGraphicStyle, setMaxScale, setMinScale, setName, setParent, setPassingEventsToParent, setPickable, setSelected, setShowingAnchorHandles, setShowingEditHandles, setSymbology, setVisible, setZOrderHint`

Method Detail

### getExteriorPoint

    DirectPosition getExteriorPoint(int index)

  Returns a live reference to the vertex at the given index.

  Parameters:
    `index` - Index of the point to retrieve a reference to.
  Returns:
    Returns a reference to the index-th vertex.
  Throws:
    `IndexOutOfBoundsException` - Throws this if the given index is less than zero or greater than or equal to the number points in the exterior ring.

### addExteriorPoint

    void addExteriorPoint(DirectPosition position)

  Adds a new point to the list of vertices in the exterior ring.

  Parameters:
    `position` - The new position to add to the list.

### insertExteriorPoint

    void insertExteriorPoint(int index,
                             DirectPosition position)

  Inserts a new point into the list of vertices for the exterior ring.

  Parameters:
    `index` - The index that the new position will occupy after the insert. All other points have their index increased by one.
    `position` - The new position to add to the list.
  Throws:
    `IndexOutOfBoundsException` - Throws this if the given index is less than zero or greater than or equal to the number points in the exterior ring.

### setExteriorPoint

    DirectPosition setExteriorPoint(int index,
                                    DirectPosition position)

  Replaces a position in the list of vertices for the exterior ring.

  Parameters:
    `index` - The index of the point to replace.
    `position` - The point that will take the place of the existing one.
  Returns:
    Returns the position that was previously in the given position.
  Throws:
    `IndexOutOfBoundsException` - Throws this if the given index is less than zero or greater than or equal to the number points in the exterior ring.

### removeExteriorPoint

    DirectPosition removeExteriorPoint(int index)

  Removes a position from the list of vertices for the exterior ring.

  Parameters:
    `index` - Index of the position to remove. All positions after this index are moved forward in the list.
  Returns:
    Returns the DirectPosition previously at the given index.
  Throws:
    `IndexOutOfBoundsException` - Throws this if the given index is less than zero or greater than or equal to the number points in the exterior ring.

### getExteriorRing

    DirectPosition[] getExteriorRing()

  Returns a new array containing references to all of the vertices in the exterior ring.

  Returns:
    A newly allocated array containing references to the vertices.

### setExteriorRing

    void setExteriorRing(DirectPosition[] newVertices)

  Clears the list of vertices in the exterior ring and adds all of the vertices in the given array. This polygon will keep references to the DirectPositions in the array, but not the array object itself.

### getNumExteriorPoints

    int getNumExteriorPoints()

  Returns the number of vertices in the exterior ring.

### getInteriorPoint

    DirectPosition getInteriorPoint(int index,
                                    int interiorRingIndex)

  Returns a live reference to the vertex at the given index.

  Parameters:
    `index` - Index of the point to retrieve a reference to.
    `interiorRingIndex` - Index of the interior ring whose vertex is desired.
  Returns:
    Returns a reference to the index-th vertex.
  Throws:
    `IndexOutOfBoundsException` - Throws this if the vertex index is less than zero or greater than or equal to the number of vertices in the given interior ring. May also throw this if the interior ring index is less than zero or greater than or equal to the number of interior rings.

### addInteriorPoint

    void addInteriorPoint(int interiorRingIndex,
                          DirectPosition position)

  Adds a new point to the list of vertices of an interior ring.

  Parameters:
    `position` - The new position to add to the list.
    `interiorRingIndex` - Index of the interior ring whose vertex list is to be modified.
  Throws:
    `IndexOutOfBoundsException` - Throws this if the interior ring index is less than zero or greater than or equal to the number of interior rings.

### insertInteriorPoint

    void insertInteriorPoint(int index,
                             int interiorRingIndex,
                             DirectPosition position)

  Inserts a new point into the list of vertices for an interior ring.

  Parameters:
    `index` - The index that the new position will occupy after the insert. All other points have their index increased by one.
    `interiorRingIndex` - Index of the interior ring whose vertex list is to be modified.
    `position` - The new position to add to the list.
  Throws:
    `IndexOutOfBoundsException` - Throws this if the vertex index is less than zero or greater than or equal to the number of vertices in the given interior ring. May also throw this if the interior ring index is less than zero or greater than or equal to the number of interior rings.

### setInteriorPoint

    DirectPosition setInteriorPoint(int index,
                                    int interiorRingIndex,
                                    DirectPosition position)

  Replaces a position in the list of vertices for an interior ring.

  Parameters:
    `index` - The index of the point to replace.
    `interiorRingIndex` - Index of the interior ring whose vertex list is to be modified.
    `position` - The point that will take the place of the existing one.
  Returns:
    Returns the position that was previously in the given position.
  Throws:
    `IndexOutOfBoundsException` - Throws this if the vertex index is less than zero or greater than or equal to the number of vertices in the given interior ring. May also throw this if the interior ring index is less than zero or greater than or equal to the number of interior rings.

### removeInteriorPoint

    DirectPosition removeInteriorPoint(int index,
                                       int interiorRingIndex)

  Removes a position from the list of vertices for an interior ring.

  Parameters:
    `index` - Index of the position to remove. All positions after this index are moved forward in the list.
    `interiorRingIndex` - Index of the interior ring whose vertex list is to be modified.
  Returns:
    Returns the DirectPosition previously at the given index.
  Throws:
    `IndexOutOfBoundsException` - Throws this if the vertex index is less than zero or greater than or equal to the number of vertices in the given interior ring. May also throw this if the interior ring index is less than zero or greater than or equal to the number of interior rings.

### getInteriorRing

    DirectPosition[] getInteriorRing(int interiorRingIndex)

  Returns a new array containing references to all of the vertices in the exterior ring.

  Parameters:
    `interiorRingIndex` - Index of the interior ring whose vertex list is being requested.
  Returns:
    A newly allocated array containing references to the vertices.
  Throws:
    `IndexOutOfBoundsException` - Throws this if the interior ring index is less than zero or greater than or equal to the number of interior rings.

### addInteriorRing

    int addInteriorRing()

  Creates a new interior ring (hole) for this polygon.

  Returns:
    Returns the index of the newly created ring.

### addInteriorRing

    int addInteriorRing(DirectPosition[] vertices)

  Creates a new interior ring for this polygon and immediately sets its points to those in the given array.

  Returns:
    Returns the index of the newly created ring.

### setInteriorRing

    void setInteriorRing(int interiorRingIndex,
                         DirectPosition[] newVertices)

  Clears the list of vertices in an exterior ring and adds all of the vertices in the given array. This polygon will keep references to the DirectPositions in the array, but not the array object itself.

  Parameters:
    `interiorRingIndex` - Index of the interior ring whose vertex list is to be modified.
    `newVertices` - The list of vertices to replace the existing ring with.
  Throws:
    `IndexOutOfBoundsException` - Throws this if the interior ring index is less than zero or greater than or equal to the number of interior rings.

### getNumInteriorPoints

    int getNumInteriorPoints(int interiorRingIndex)

  Returns the number of vertices in an interior ring.

  Parameters:
    `interiorRingIndex` - Index of the interior ring to get a vertex count from.
  Throws:
    `IndexOutOfBoundsException` - Throws this if the interior ring index is less than zero or greater than or equal to the number of interior rings.

### removeInteriorRing

    void removeInteriorRing(int interiorRingIndex)

  Removes an interior ring.

  Parameters:
    `interiorRingIndex` - Index of the ring to remove.

### getNumInteriorRings

    int getNumInteriorRings()

  Returns the number of interior rings currently in this polygon.

### getInteriorRings

    DirectPosition[][] getInteriorRings()

  Returns a newly allocated two-dimensional array of points. The first index of the returned array chooses an interior ring. The second index runs over the vertices of that ring. The DirectPositions in the list are references to the same objects held by this polygon, but the array object is newly allocated.

### setInteriorRings

    void setInteriorRings(DirectPosition[][] interiorRingPoints)

  Clears the lists of vertices of all the interior rings and adds all of the vertices in the given arrays. This polygon will keep references to the DirectPositions in the arrays, but not the array objecst themselves.

### getPolygonSymbolizer

    PolygonSymbolizer getPolygonSymbolizer()

  Returns the `GraphicStyle` for this `GraphicPolygon`, which is required to be a `PolygonSymbolizer`.

  Returns:
    the GraphicPolygon's `GraphicStyle`.

### setPathType

    void setPathType(PathType pathType)

  Sets the parameter that indicates how the "in-between" points between vertices should be drawn.

  Parameters:
    `pathType` - One of the static constants indicating the method to use.

### getPathType

    PathType getPathType()

  Returns the parameter that indicates how the "in-between" points between vertices are to be drawn.

### isAllowingNewVertices

    boolean isAllowingNewVertices()

  Indicates whether clicking on an edge of this graphic linestring should insert a new vertex at that location when the object is in edit mode.

### setAllowingNewVertices

    void setAllowingNewVertices(boolean newValue)

  Sets the boolean that indicates whether clicking on an edge of this graphic linestring should insert a new vertex at that location.

Copyright © 1994-2008 Open Geospatial Consortium. All Rights Reserved.