com.thinkaurelius.titan.core.attribute

## Class Geoshape

- java.lang.Object
- - com.thinkaurelius.titan.core.attribute.Geoshape

-     public class Geoshape
      extends Object

  A generic representation of a geographic shape, which can either be a single point, circle, box, or polygon. Use `getType()` to determine the type of shape of a particular Geoshape object. Use the static constructor methods to create the desired geoshape. Note, polygons are not yet supported.
  Author:
    Matthias Broecheler (me@matthiasb.com)

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `Geoshape.GeoshapeSerializer`
    `static class` | `Geoshape.Point` A single point representation.
    `static class` | `Geoshape.Type` The Type of a shape: a point, box, circle, or polygon

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static Geoshape` | `box(double southWestLatitude, double southWestLongitude, double northEastLatitude, double northEastLongitude)` Constructs a new box shape which is identified by its south-west and north-east corner points
    `static Geoshape` | `box(float southWestLatitude, float southWestLongitude, float northEastLatitude, float northEastLongitude)` Constructs a new box shape which is identified by its south-west and north-east corner points
    `static Geoshape` | `circle(double latitude, double longitude, double radiusInKM)` Constructs a circle from a given center point and a radius in kilometer
    `static Geoshape` | `circle(float latitude, float longitude, float radiusInKM)` Constructs a circle from a given center point and a radius in kilometer
    `com.spatial4j.core.shape.Shape` | `convert2Spatial4j()` Converts this shape into its equivalent Spatial4j `Shape`.
    `boolean` | `disjoint(Geoshape other)`
    `boolean` | `equals(Object other)`
    `Geoshape.Point` | `getPoint()` Returns the singleton point of this shape.
    `Geoshape.Point` | `getPoint(int position)` Returns the point at the given position.
    `float` | `getRadius()` Returns the radius in kilometers of this circle.
    `Geoshape.Type` | `getType()` Returns the `Geoshape.Type` of this geoshape.
    `int` | `hashCode()`
    `boolean` | `intersect(Geoshape other)`
    `static boolean` | `isValidCoordinate(float latitude, float longitude)` Whether the given coordinates mark a point on earth.
    `static Geoshape` | `point(double latitude, double longitude)` Constructs a point from its latitude and longitude information
    `static Geoshape` | `point(float latitude, float longitude)` Constructs a point from its latitude and longitude information
    `int` | `size()` Returns the number of points comprising this geoshape.
    `String` | `toString()`
    `boolean` | `within(Geoshape outer)`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Method Detail

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### equals

          public boolean equals(Object other)

      Overrides:
        `equals` in class `Object`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### getType

          public Geoshape.Type getType()

      Returns the `Geoshape.Type` of this geoshape.
      Returns:

    - #### size

          public int size()

      Returns the number of points comprising this geoshape. A point and circle have only one point (center of cricle), a box has two points (the south-west and north-east corners) and a polygon has a variable number of points (>=3).
      Returns:

    - #### getPoint

          public Geoshape.Point getPoint(int position)

      Returns the point at the given position. The position must be smaller than `size()`.
      Parameters:
        `position` -
      Returns:

    - #### getPoint

          public Geoshape.Point getPoint()

      Returns the singleton point of this shape. Only applicable for point and circle shapes.
      Returns:

    - #### getRadius

          public float getRadius()

      Returns the radius in kilometers of this circle. Only applicable to circle shapes.
      Returns:

    - #### intersect

          public boolean intersect(Geoshape other)

    - #### within

          public boolean within(Geoshape outer)

    - #### disjoint

          public boolean disjoint(Geoshape other)

    - #### convert2Spatial4j

          public com.spatial4j.core.shape.Shape convert2Spatial4j()

      Converts this shape into its equivalent Spatial4j `Shape`.
      Returns:

    - #### point

          public static final Geoshape point(float latitude,
                       float longitude)

      Constructs a point from its latitude and longitude information
      Parameters:
        `latitude` -
        `longitude` -
      Returns:

    - #### point

          public static final Geoshape point(double latitude,
                       double longitude)

      Constructs a point from its latitude and longitude information
      Parameters:
        `latitude` -
        `longitude` -
      Returns:

    - #### circle

          public static final Geoshape circle(float latitude,
                        float longitude,
                        float radiusInKM)

      Constructs a circle from a given center point and a radius in kilometer
      Parameters:
        `latitude` -
        `longitude` -
        `radiusInKM` -
      Returns:

    - #### circle

          public static final Geoshape circle(double latitude,
                        double longitude,
                        double radiusInKM)

      Constructs a circle from a given center point and a radius in kilometer
      Parameters:
        `latitude` -
        `longitude` -
        `radiusInKM` -
      Returns:

    - #### box

          public static final Geoshape box(float southWestLatitude,
                     float southWestLongitude,
                     float northEastLatitude,
                     float northEastLongitude)

      Constructs a new box shape which is identified by its south-west and north-east corner points
      Parameters:
        `southWestLatitude` -
        `southWestLongitude` -
        `northEastLatitude` -
        `northEastLongitude` -
      Returns:

    - #### box

          public static final Geoshape box(double southWestLatitude,
                     double southWestLongitude,
                     double northEastLatitude,
                     double northEastLongitude)

      Constructs a new box shape which is identified by its south-west and north-east corner points
      Parameters:
        `southWestLatitude` -
        `southWestLongitude` -
        `northEastLatitude` -
        `northEastLongitude` -
      Returns:

    - #### isValidCoordinate

          public static final boolean isValidCoordinate(float latitude,
                                  float longitude)

      Whether the given coordinates mark a point on earth.
      Parameters:
        `latitude` -
        `longitude` -
      Returns:

Copyright © 2012–2014. All rights reserved.