com.askgeo.dbl.base
Class PolygonData

java.lang.Object
  extended by com.askgeo.dbl.base.PolygonData

public class PolygonData
extends java.lang.Object

Represents the raw polygonal data of a geographic shape on a map. The PolygonData is the only form of geographic data that can be queried from the subclasses of GeneralMap, so if you are wanting to work with the raw shapes, this is the class that you will be interfacing with.

Geographic shapes in AskGeo are described as complex polygons. By this, we mean the union of multiple closed polygonal chains of latitude and longitude vertexes. Counter-clockwise polygonal chains count as positive area, adding to the shape. Clockwise polygonal chains count as negative area, subtracting from positive areas to create cut-outs.

PolygonData objects are not intended to be created by the user. Rather, they are created by a Multigon as an internal operation in constructing a subclass of ResultBase. So to access a PolygonData object, you should query a map with findResult(), which will return a subclass of ResultBase, which has an accessor getPolygonData that will return the corresponding shape's PolygonData.

The subclasses of GeneralMap also expose the method getAllResults(), which returns a Vector of all the possible results. If you wish to iterate over the shapes in a map, that is the method you will want to use.


Constructor Summary
PolygonData(double[][] shapeLatsArr, double[][] shapeLonsArr, double[] bbox)
          Constructs a new PolygonData object from latitude and longitude arrays, the shape's bounding box, and the shapes area.
 
Method Summary
 double computeAreaSqKm()
          Computes the area in square kilometers.
 double getMaxLatitudeDeg()
          Returns the upper bound latitude in degrees from the bounding box.
 double getMaxLongitudeDeg()
          Returns the upper bound longitude in degrees from the bounding box.
 double getMinLatitudeDeg()
          Returns the lower bound latitude in degrees from the bounding box.
 double getMinLongitudeDeg()
          Returns the lower bound longitude in degrees from the bounding box.
 int getNumNodes()
          Returns a count of the total number of nodes (vertexes) in this shape.
 int getNumParts()
          Returns the number of parts in the polygon data.
 int getNumVertexes(int partIndex)
          Returns the number of vertexes in the given part.
 double getVertexLatitudeDeg(int partIndex, int vertexIndex)
          Returns the latitude in degrees of the given vertex.
 double getVertexLongitudeDeg(int partIndex, int vertexIndex)
          Returns the longitude in degrees of the given vertex.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PolygonData

public PolygonData(double[][] shapeLatsArr,
                   double[][] shapeLonsArr,
                   double[] bbox)
Constructs a new PolygonData object from latitude and longitude arrays, the shape's bounding box, and the shapes area. Even though the last two are computable from the first two, they are passed in because the object that uses this constructor already has that information on hand.

Parameters:
shapeLatsArr - the array of latitude values, in radians.
shapeLonsArr - the array of longitude values, in radians.
bbox - the bounding box of the shape.
Method Detail

getNumNodes

public int getNumNodes()
Returns a count of the total number of nodes (vertexes) in this shape.

Returns:
the number of nodes (vertexes) in this shape.

getMinLatitudeDeg

public double getMinLatitudeDeg()
Returns the lower bound latitude in degrees from the bounding box.

Returns:
the lower bound latitude in degrees from the bounding box.

getMaxLatitudeDeg

public double getMaxLatitudeDeg()
Returns the upper bound latitude in degrees from the bounding box.

Returns:
the upper bound latitude in degrees from the bounding box.

getMinLongitudeDeg

public double getMinLongitudeDeg()
Returns the lower bound longitude in degrees from the bounding box.

Returns:
the lower bound longitude in degrees from the bounding box.

getMaxLongitudeDeg

public double getMaxLongitudeDeg()
Returns the upper bound longitude in degrees from the bounding box.

Returns:
the upper bound longitude in degrees from the bounding box.

getNumParts

public int getNumParts()
Returns the number of parts in the polygon data. Each part is one of the closed polygonal chains that define the shape.

Returns:
the number of rings in the shape.

getNumVertexes

public int getNumVertexes(int partIndex)
Returns the number of vertexes in the given part.

Parameters:
partIndex - the index of the part.
Returns:
the number of vertexes in the given part.

getVertexLatitudeDeg

public double getVertexLatitudeDeg(int partIndex,
                                   int vertexIndex)
Returns the latitude in degrees of the given vertex.

Parameters:
partIndex - the part index.
vertexIndex - the vertex index within that part.
Returns:
the latitude in degrees of the given vertex.

getVertexLongitudeDeg

public double getVertexLongitudeDeg(int partIndex,
                                    int vertexIndex)
Returns the longitude in degrees of the given vertex.

Parameters:
partIndex - the part index.
vertexIndex - the vertex index within that part.
Returns:
the longitude in degrees of the given vertex.

computeAreaSqKm

public double computeAreaSqKm()
Computes the area in square kilometers.



Copyright © 2012 Vector Magic, Inc.