com.esri.core.geometry
Class GeometryEngine

java.lang.Object
  extended by com.esri.core.geometry.GeometryEngine

public class GeometryEngine
extends Object

Provides services that operate on Geometry instances


Constructor Summary
GeometryEngine()
           
 
Method Summary
static Polygon[] buffer(Geometry[] geometries, SpatialReference spatialReference, double[] distances, Unit unit, boolean toUnionResults)
          Calculates a buffer polygon for each geometry at each of the corresponding specified distances.
static Polygon buffer(Geometry geometry, SpatialReference spatialReference, double distance, Unit unit)
          Calculates buffer polygon of the geometry as specified by the distance input.
static Geometry clip(Geometry geometry, Envelope envelope, SpatialReference spatialReference)
          calculates the clipped geometry from an target geometry object by an envelope
static boolean contains(Geometry geometry1, Geometry geometry2, SpatialReference spatialReference)
          Test if one geometry (geometry1) contains another geometry object (geometry2)
static boolean crosses(Geometry geometry1, Geometry geometry2, SpatialReference spatialReference)
          Test if one geometry (geometry1) crosses another geometry object (geometry2)
static Geometry difference(Geometry geometry1, Geometry substractor, SpatialReference spatialReference)
          Constructs the difference between two geometries.
static double distance(Geometry geometry1, Geometry geometry2, SpatialReference spatialReference)
          calculates the distance between two geometries
static boolean equals(Geometry geometry1, Geometry geometry2, SpatialReference spatialReference)
          Test if two geometry objects are equal
static String geometryToJson(int wkid, Geometry geometry)
          Exports the specified Geometry instance to it's Json representation.
static Proximity2DResult getNearestCoordinate(Geometry geometry, Point inputPoint, boolean bTestPolygonInterior)
          Finds the coordinate on the geometry which is closest to the specified point
static Proximity2DResult getNearestVertex(Geometry geometry, Point inputPoint)
          Finds nearest vertex on the geometry which is closed to the specified point
static Proximity2DResult[] getNearestVertices(Geometry geometry, Point inputPoint, double searchRadius, int maxVertexCountToReturn)
          Finds all vertices in the given distance from the specified point, sorted from closest to furthest
static MapGeometry jsonToGeometry(org.codehaus.jackson.JsonParser json)
          Imports the MapGeometry from it's Json representation.
static Geometry project(Geometry geometry, SpatialReference inputSR, SpatialReference outputSR)
          Projects the given Geometry instance from the input Spatial Reference to the output Spatial Reference.
static Geometry simplify(Geometry geometry, SpatialReference spatialReference)
          Performs the simplify operation on the geometry.
static boolean touches(Geometry geometry1, Geometry geometry2, SpatialReference spatialReference)
          Test if one geometry (geometry1) touches another geometry object (geometry2)
static Geometry union(Geometry[] geometries, SpatialReference spatialReference)
          Constructs the union of the geometries in the input array.
static boolean within(Geometry geometry1, Geometry geometry2, SpatialReference spatialReference)
          Test if one geometry (geometry1) is within another geometry object (geometry2)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GeometryEngine

public GeometryEngine()
Method Detail

project

public static Geometry project(Geometry geometry,
                               SpatialReference inputSR,
                               SpatialReference outputSR)
Projects the given Geometry instance from the input Spatial Reference to the output Spatial Reference. Implementation Note: this implementation projects Point geometries.

Parameters:
geometry - the input Geometry to be projected
inputSR - spatial reference of the input geometry
outputSR - spatial reference to project the geometry to
Returns:
the projected Geometry

jsonToGeometry

public static MapGeometry jsonToGeometry(org.codehaus.jackson.JsonParser json)
Imports the MapGeometry from it's Json representation. A json representation of the geometry (with spatial reference) must be passed as input.

Parameters:
json - json representation of the geometry (with spaial reference)
Returns:
the MapGeometry instance containing the imported Geometry and it's SpatialReference

geometryToJson

public static String geometryToJson(int wkid,
                                    Geometry geometry)
Exports the specified Geometry instance to it's Json representation.

Parameters:
wkid - the spatial reference well known id to be used for the Json representation
geometry - the geometry to be exported to JSON
Returns:
the JSON representation of the specified Geometry

union

public static Geometry union(Geometry[] geometries,
                             SpatialReference spatialReference)
Constructs the union of the geometries in the input array. All inputs must be of the same type of geometries and share one spatiel reference.

Parameters:
geometries - the geometries to work on
spatialReference - the spatial reference of the geometries
Returns:
Geometry object representing the resultant union

difference

public static Geometry difference(Geometry geometry1,
                                  Geometry substractor,
                                  SpatialReference spatialReference)
Constructs the difference between two geometries. The dimension of geometry2 has to be equal to or greater than that of geometry1.

Parameters:
geometry1 - geometry object being subtracted
substractor - geometry object to subtract from
spatialReference - of geometries being differenced
Returns:
geometry object showing the difference

equals

public static boolean equals(Geometry geometry1,
                             Geometry geometry2,
                             SpatialReference spatialReference)
Test if two geometry objects are equal

Parameters:
geometry1 - geometry object
geometry2 - geometry object
spatialReference - the spatial reference of the two geometries
Returns:
boolean true if both geometry objects are equal; false if not

within

public static boolean within(Geometry geometry1,
                             Geometry geometry2,
                             SpatialReference spatialReference)
Test if one geometry (geometry1) is within another geometry object (geometry2)

Parameters:
geometry1 - geometry object which is within
geometry2 - geometry object which contains
spatialReference - the spatial reference of the geometries
Returns:
boolean true if geometry1 is within geometry2; false if not

contains

public static boolean contains(Geometry geometry1,
                               Geometry geometry2,
                               SpatialReference spatialReference)
Test if one geometry (geometry1) contains another geometry object (geometry2)

Parameters:
geometry1 - geometry object to be container
geometry2 - geometry object to be contained
spatialReference - the spatial reference of the two geometries
Returns:
boolean true if geometry1 contains geometry2; false if not

crosses

public static boolean crosses(Geometry geometry1,
                              Geometry geometry2,
                              SpatialReference spatialReference)
Test if one geometry (geometry1) crosses another geometry object (geometry2)

Parameters:
geometry1 - geometry object to cross
geometry2 - geometry object being crossed
spatialReference - the spatial reference of the geometries
Returns:
boolean true if geometry1 crosses geometry2; false if not

touches

public static boolean touches(Geometry geometry1,
                              Geometry geometry2,
                              SpatialReference spatialReference)
Test if one geometry (geometry1) touches another geometry object (geometry2)

Parameters:
geometry1 - geometry object to touch
geometry2 - geometry object to be touched
spatialReference - the spatial reference of geometries
Returns:
boolean true if geometry1 touches geometry2; false if not

distance

public static double distance(Geometry geometry1,
                              Geometry geometry2,
                              SpatialReference spatialReference)
calculates the distance between two geometries

Parameters:
geometry1 - geometry object
geometry2 - another geometry object
spatialReference - the spatial reference of the two geometries
Returns:
double the distance between two geometry objects

clip

public static Geometry clip(Geometry geometry,
                            Envelope envelope,
                            SpatialReference spatialReference)
calculates the clipped geometry from an target geometry object by an envelope

Parameters:
geometry - geometry object to be clipped
envelope - envelope object used to clip
spatialReference - the spatial reference of the geometries
Returns:
geometry object showing the clipped result

buffer

public static Polygon[] buffer(Geometry[] geometries,
                               SpatialReference spatialReference,
                               double[] distances,
                               Unit unit,
                               boolean toUnionResults)
Calculates a buffer polygon for each geometry at each of the corresponding specified distances. It is assumed all geometries have the same spatial reference. The unit variable defines the unit of all the distances. If unit == null then unit of distances is assumed to be that of the spatial reference. There is an option to union the returned geometries.

Parameters:
geometries - An array of geometry objects to be buffered
spatialReference - The spatial reference of the geometries
distances - The corresponding distances for the input geometries to be buffered
unit - The unit of the values in the distances array. Must be of the same Unit type as spatial reference, either both Linear or both Angular.
toUnionResults - True if all geometries buffered at a given distance are to be unioned into a single polygon.
Returns:
buffer polygons

buffer

public static Polygon buffer(Geometry geometry,
                             SpatialReference spatialReference,
                             double distance,
                             Unit unit)
Calculates buffer polygon of the geometry as specified by the distance input. If unit == null, then the distance is assumed to be in the unit of the spatial reference

Parameters:
geometry - Geometry object to be buffered
spatialReference - Spatial reference of the geometry
distance - Specified distance for buffer
unit - The unit of the values in the distances array. Must be of the same Unit type as spatial reference, either both Linear or both Angular.
Returns:
buffer polygon at the specified distances

getNearestCoordinate

public static Proximity2DResult getNearestCoordinate(Geometry geometry,
                                                     Point inputPoint,
                                                     boolean bTestPolygonInterior)
Finds the coordinate on the geometry which is closest to the specified point

Parameters:
inputPoint - input point.
bTestPolygonInterior - whether to take into the account that input point is within the polygon.
Returns:
ProximityResult containing the nearest coordinate.

getNearestVertex

public static Proximity2DResult getNearestVertex(Geometry geometry,
                                                 Point inputPoint)
Finds nearest vertex on the geometry which is closed to the specified point

Parameters:
inputPoint -
geometry -
Returns:
Proximity2DResult containing the nearest vertex

getNearestVertices

public static Proximity2DResult[] getNearestVertices(Geometry geometry,
                                                     Point inputPoint,
                                                     double searchRadius,
                                                     int maxVertexCountToReturn)
Finds all vertices in the given distance from the specified point, sorted from closest to furthest

Parameters:
inputPoint - the point to start from
geometry - the geometry to consider
searchRadius - search radius
maxVertexCountToReturn - max number of vertices to return.
Returns:
Proximity2DResult containing the array of nearest vertices

simplify

public static Geometry simplify(Geometry geometry,
                                SpatialReference spatialReference)
Performs the simplify operation on the geometry.

Parameters:
geometry - the geometry to be simplified.
spatialReference - the spatial reference of the geometry to be simplified.
Returns:
geometry


Copyright © 2010. All Rights Reserved.