Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.franz.agbase
Class Polygon

    java.lang.Object
      com.franz.agbase.Polygon

    public class Polygon

extends java.lang.Object

This class is used to represent a collection of point coordinates that form a polygon in 2-dimensional space.

A Polygon is represented in a triple store as a collection of triples, all with the same subject. The predicates are generated by the implementation and identify the point coordinates. The objects of the triples are encoded vertex coordinates.

Constructor Summary
`Polygon(int vertices)` Create an empty Polygon instance with room for a given number of vertices.

Method Summary
`UPI` | `add(AllegroGraph ag)` Add the polygon to a triple store.
`void` | `addVertex(double x, double y)` Add one pair of vertex coordinates to the Polygon.
`void` | `get(AllegroGraph ag)` Retrieve the coordinates of this polygon from the triple store.
`boolean` | `getModified()` Query the state of a Polygon instance.
`double[]` | `getPoints()` Get the array of coordinates for the points in the Polygon.
`UPI` | `getSubject()` Query the subject that identifies the triples in a polygon.
`GeospatialSubtype` | `getSubtype()` Get the GeospatialSubtype associated with all the points in the Polygon instance.
`boolean` | `pointInside(double x, double y)` Query whether a point is inside a polygon.
`boolean[]` | `pointsInside(double[] xy)` Query whether some points are inside a polygon.
`boolean[]` | `pointsInside(double[] x, double[] y)` Query whether some points are inside a polygon.
`void` | `setSubject(UPI subject)` Set the subject that identifies the triples in a polygon.
`void` | `setSubtype(GeospatialSubtype subtype2)` Set the GeospatialSubtype associated with all the points in the Polygon instance.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Polygon

    public Polygon(int vertices)

  Create an empty Polygon instance with room for a given number of vertices.

  Parameters:
    `vertices` - the number of vertices in the Polygon.

Method Detail

### getSubtype

    public GeospatialSubtype getSubtype()

  Get the GeospatialSubtype associated with all the points in the Polygon instance.

  Returns:
    the GeospatialSubtype

### setSubtype

    public void setSubtype(GeospatialSubtype subtype2)

  Set the GeospatialSubtype associated with all the points in the Polygon instance.

  Parameters:
    `subtype2` - the GeospatialSubtype

### getPoints

    public double[] getPoints()

  Get the array of coordinates for the points in the Polygon.

  Returns:
    an array of alternating x and y coordinates

### getModified

    public boolean getModified()

  Query the state of a Polygon instance.

  Returns:
    true if the Polygon contains changes not transmitted to the server.

### getSubject

    public UPI getSubject()

  Query the subject that identifies the triples in a polygon.

  Returns:
    the subject

### setSubject

    public void setSubject(UPI subject)

  Set the subject that identifies the triples in a polygon. If the subject is null, a new blank node will be assigned to the Polugon when it is added to a triple store.

  Parameters:
    `subject` - the subject to set

### addVertex

    public void addVertex(double x,
                          double y)

  Add one pair of vertex coordinates to the Polygon.

  Parameters:
    `x` -
    `y` -

### add

    public UPI add(AllegroGraph ag)
            throws AllegroGraphException

  Add the polygon to a triple store.

  Parameters:
    `ag` - The triple store.
  Returns:
    the UPI that identifies the triples in the polygon.
  Throws:
    `AllegroGraphException`

### get

    public void get(AllegroGraph ag)
             throws AllegroGraphException

  Retrieve the coordinates of this polygon from the triple store.

  Parameters:
    `ag` - the triple store
  Throws:
    `AllegroGraphException`

### pointInside

    public boolean pointInside(double x,
                               double y)
                        throws AllegroGraphException

  Query whether a point is inside a polygon.

  Parameters:
    `x` -
    `y` -
  Returns:
    true if the point is inside
  Throws:
    `AllegroGraphException`

### pointsInside

    public boolean[] pointsInside(double[] xy)
                           throws AllegroGraphException

  Query whether some points are inside a polygon.

  Parameters:
    `xy` - An array of alternating x and y coordinates
  Returns:
    an array of boolean values. The length of the array is half the length of the xy array. Each boolean value is true or false if the corresponding point is inside or outside the Polygon.
  Throws:
    `AllegroGraphException`

### pointsInside

    public boolean[] pointsInside(double[] x,
                                  double[] y)
                           throws AllegroGraphException

  Query whether some points are inside a polygon.

  Parameters:
    `x` - An array of x coordinates
    `y` - An array of y coordinates The two arrays must of the same length.
  Returns:
    an array of boolean values. The length of the array is equal to the length of the argument array. Each boolean value is true or false if the corresponding point is inside or outside the Polygon.
  Throws:
    `AllegroGraphException`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD