AGSGeometryEngine Class Reference


Description

Instances of this class represents engines that can perform geometric operations locally on the device. AGSGeometryEngine is functionally similar to AGSGeometryServiceTask except that it does not rely on a remote ArcGIS Server Geometry Service. You can use the engine even when the device does not have any network connectivity.

Since:
1.8

List of all members.

Public Member Functions

(double) - areaOfGeometry:
(AGSMutablePolygon *) - bufferGeometries:byDistance:
(AGSMutablePolygon *) - bufferGeometry:byDistance:
(AGSGeometry *) - clipGeometry:withEnvelope:
(NSArray *) - cutGeometry:withCutter:
(AGSGeometry *) - densifyGeometry:withMaxSegmentLength:
(AGSGeometry *) - differenceOfGeometry:andGeometry:
(double) - distanceFromGeometry:toGeometry:
(AGSGeometry *) - geodesicDensifyGeometry:withMaxSegmentLength:inUnit:
(double) - geodesicLengthOfGeometry:inUnit:
(BOOL) - geometry:containsGeometry:
(BOOL) - geometry:crossesGeometry:
(BOOL) - geometry:disjointToGeometry:
(BOOL) - geometry:intersectsGeometry:
(BOOL) - geometry:overlapsGeometry:
(BOOL) - geometry:touchesGeometry:
(BOOL) - geometry:withinGeometry:
(AGSGeometry *) - intersectionOfGeometry:andGeometry:
(AGSMutablePoint *) - labelPointForPolygon:
(double) - lengthOfGeometry:
(NSString *) - mgrsFromPoint:numDigits:rounding:addSpaces:
(AGSProximityResult *) - nearestCoordinateInGeometry:toPoint:
(AGSProximityResult *) - nearestVertexInGeometry:toPoint:
(AGSGeometry *) - normalizeCentralMeridianOfGeometry:
(AGSGeometry *) - offsetGeometry:byDistance:withJointType:bevelRatio:flattenError:
(AGSPoint *) - pointFromMGRS:
(AGSGeometry *) - projectGeometry:toSpatialReference:
(double) - shapePreservingAreaOfGeometry:inUnit:
(double) - shapePreservingLengthOfGeometry:inUnit:
(AGSGeometry *) - simplifyGeometry:
(AGSGeometry *) - symmetricDifferenceOfGeometry:andGeometry:
(AGSGeometry *) - unionGeometries:

Static Public Member Functions

(AGSGeometryEngine *) + defaultGeometryEngine

Member Function Documentation

- (double) areaOfGeometry: (AGSGeometry*)  geometry  

Gets the simple area for the AGSGeometry passed in. This is a planar measurement using 2D Cartesian mathematics to compute the area.

The geometry must be topologically correct to get its accurate legth. Geometries returned by ArcGIS Server services are always correct. If you construct geometries programmatically or using the sketch layer, or if you modify geometries returned by ArcGIS Server, you should simplify them using simplifyGeometry:

Parameters:
geometry The geometry to calculate the area for.
Returns:
The computed area in the same units as the geometry's spatial reference unit.
Since:
1.8
See also:
- shapePreservingAreaOfGeometry:inUnit:
- (AGSMutablePolygon *) bufferGeometries: (NSArray*)  geometries
byDistance: (double)  distance 

Creates buffers at the specified distance around the given geometries. Will union the results of all buffers.

Parameters:
geometries Specifies the input geometries.
distance The distance in the unit of the geometry's spatial reference for which to buffer the geometries.
Returns:
The polygon that represents the buffered area.
Since:
1.8
- (AGSMutablePolygon *) bufferGeometry: (AGSGeometry*)  geometry
byDistance: (double)  distance 

Creates a buffer polygon at the specified distance around the given geometry.

Parameters:
geometry Specifies the input geometry.
distance The distance in the unit of the geometry's spatial reference for which to buffer the geometry.
Returns:
The polygon that represents the buffered area.
Since:
1.8
- (AGSGeometry *) clipGeometry: (AGSGeometry*)  geometry
withEnvelope: (AGSEnvelope*)  envelope 

Constructs the polygon created by clipping geometry by envelope.

Parameters:
geometry The geometry to be clipped by the given envelope.
envelope The envelope in which to use in order to clip geometry.
Returns:
A geometry that represents the area of geometry clipped by envelope.
Since:
2.2
- (NSArray *) cutGeometry: (AGSGeometry*)  geometry
withCutter: (AGSPolyline*)  cutter 

Splits the input polyline or polygon where it crosses a cutting polyline.

Parameters:
geometry The geometry to be cut.
cutter The polyline that will be used to divide the target into pieces where it crosses the target.
Returns:
Array of cut results.
Since:
1.8
+ (AGSGeometryEngine *) defaultGeometryEngine  

A singleton geometry engine that can be used. Since an instance of a geometry engine caches state, like the last projection transformation used, it may be beneficial to create one for each spatial reference that you are dealing with, instead of using this.

Returns:
A new, autoreleased geometry engine.
Since:
1.8
- (AGSGeometry *) densifyGeometry: (AGSGeometry*)  geometry
withMaxSegmentLength: (double)  maxSegmentLength 

Densifies the input geometry by plotting points between existing vertices.

Parameters:
geometry The input geometry
maxSegmentLength The maximum distance between points after densification. This distance should be in the same unit as the geometry's spatial reference.
Returns:
The densified geometry.
Since:
1.8
- (AGSGeometry *) differenceOfGeometry: (AGSGeometry*)  geometry1
andGeometry: (AGSGeometry*)  geometry2 

Constructs the set-theoretic difference between two geometries.

Parameters:
geometry1 The first geometry.
geometry2 The second geometry of dimension equal to or greater than the elements of the first geometry.
Returns:
A geometry that represents the difference of the two input geometries.
Since:
1.8
- (double) distanceFromGeometry: (AGSGeometry*)  geometry1
toGeometry: (AGSGeometry*)  geometry2 

Measures the simple planar distance between two geometries.

Parameters:
geometry1 The first geometry.
geometry2 The second geometry.
Returns:
The distance between the two input geometries in the same unit as the spatial reference of the input geometries.
Since:
1.8
- (AGSGeometry *) geodesicDensifyGeometry: (AGSGeometry*)  geometry
withMaxSegmentLength: (double)  maxSegmentLength
inUnit: (AGSSRUnit lengthUnit 

Densifies the input geometry by plotting points between existing vertices.

Parameters:
geometry The input geometry
maxSegmentLength The maximum distance between points after densification.
lengthUnit The unit that the max segment length parameter is in.
Returns:
The geodesically densified geometry.
Since:
1.8
- (double) geodesicLengthOfGeometry: (AGSGeometry*)  geometry
inUnit: (AGSSRUnit lengthUnit 

Gets the geodesic length for the AGSGeometry passed in. Geodesic length is calculated using only the vertices of the polygon and define the lines between the points as geodesic segments independent of the actual shape of the polygon. A geodesic segment is the shortest path between two points on an ellipsoid. Thus, if you have a line that spans the width of the world, with only two vertices, each on the edges of the map, the geodesic lenght would be zero (shortest distance between the two vertices).

Will return NAN if the calculation results in a linear to angular conversion (for instance, Decimal Degrees to Meters)

Parameters:
geometry The geometry to calculate the geodesic length for.
lengthUnit The unit at which the area is calculated.
Returns:
The calculated geodesic length in the specified unit.
Since:
1.8
See also:
- shapePreservingLengthOfGeometry:inUnit:
- (BOOL) geometry: (AGSGeometry*)  geometry1
containsGeometry: (AGSGeometry*)  geometry2 

Returns YES if geometry1 contains geometry2.

Since:
1.8
- (BOOL) geometry: (AGSGeometry*)  geometry1
crossesGeometry: (AGSGeometry*)  geometry2 

Returns YES if geometry1 crosses geometry2.

Since:
1.8
- (BOOL) geometry: (AGSGeometry*)  geometry1
disjointToGeometry: (AGSGeometry*)  geometry2 

Returns YES if geometry1 is disjoint to geometry2.

Since:
1.8
- (BOOL) geometry: (AGSGeometry*)  geometry1
intersectsGeometry: (AGSGeometry*)  geometry2 

Returns YES if geometry1 intersects geometry2.

Since:
1.8
- (BOOL) geometry: (AGSGeometry*)  geometry1
overlapsGeometry: (AGSGeometry*)  geometry2 

Performs relational operation Overlaps. It compares two geometries of the same dimension and returns TRUE if their intersection results in a geometry different from both but of the same dimension.

Since:
2.2
- (BOOL) geometry: (AGSGeometry*)  geometry1
touchesGeometry: (AGSGeometry*)  geometry2 

Returns YES if geometry1 touches geometry2.

Since:
1.8
- (BOOL) geometry: (AGSGeometry*)  geometry1
withinGeometry: (AGSGeometry*)  geometry2 

Returns YES if geometry1 is within geometry2.

Since:
1.8
- (AGSGeometry *) intersectionOfGeometry: (AGSGeometry*)  geometry1
andGeometry: (AGSGeometry*)  geometry2 

Constructs the set-theoretic intersection between two geometries.

Parameters:
geometry1 The first geometry.
geometry2 The second geometry of dimension equal to or greater than the elements of the first geometry.
Returns:
A geometry that represents the intersection of the two input geometries.
Since:
1.8
- (AGSMutablePoint *) labelPointForPolygon: (AGSPolygon*)  polygon  

Calculates an interior point for a specified polygon. This interior point can be used by clients to place a label for the polygon.

Parameters:
polygon The polygon to get label points for.
Returns:
The label point.
Since:
1.8
- (double) lengthOfGeometry: (AGSGeometry*)  geometry  

Gets the length for a specified AGSGeometry. This is a planar measurement using 2D Cartesian mathematics to compute the length.

The geometry must be topologically correct to get its accurate legth. Geometries returned by ArcGIS Server services are always correct. If you construct geometries programmatically or using the sketch layer, or if you modify geometries returned by ArcGIS Server, you should simplify them using simplifyGeometry:

Parameters:
geometry The geometry to calculate the length for.
Returns:
The calculated length in the same units as the geometry's spatial reference unit.
Since:
1.8
See also:
- shapePreservingLengthOfGeometry:inUnit:
- (NSString *) mgrsFromPoint: (AGSPoint*)  pt
numDigits: (int)  digits
rounding: (BOOL)  rounding
addSpaces: (BOOL)  addSpaces 

Returns a Military Grid Reference System (MGRS) coordinate for the given point. For example : 4Q 612341 2356781

Parameters:
pt The point for which MGRS coordinate is needed
digits The number of digits to be included in the MGRS coordinate
rounding Whether the numeric value should be rounded
addSpaces Whether the MGRS coordinate string should include spaces
Returns:
The MGRS coordinate string
Since:
2.2
- (AGSProximityResult *) nearestCoordinateInGeometry: (AGSGeometry*)  geometry
toPoint: (AGSPoint*)  point 

Finds the nearest coordinate in a specified geometry to a specified point.

Parameters:
geometry The geometry in which the nearest coordinate to a specified point is to be found.
point The point which to find the nearest coordinate to.
Returns:
The proximity result.
Since:
1.8
- (AGSProximityResult *) nearestVertexInGeometry: (AGSGeometry*)  geometry
toPoint: (AGSPoint*)  point 

Finds the nearest vertex in a specified geometry to a specified point.

Parameters:
geometry The geometry in which the nearest vertex to a specified point is to be found.
point The point which to find the nearest vertex to.
Returns:
The proximity result.
Since:
1.8
- (AGSGeometry *) normalizeCentralMeridianOfGeometry: (AGSGeometry*)  geometry  

Folds the geometry into a range of 360 degrees. This may be necessary when wrap around is enabled on the map.

Parameters:
geometry The geometry that you want folded.
Returns:
The folded geometry
Since:
1.8
- (AGSGeometry *) offsetGeometry: (AGSGeometry*)  geometry
byDistance: (double)  distance
withJointType: (AGSGeometryOffsetType joinType
bevelRatio: (double)  bevelRatio
flattenError: (double)  flattenError 

Creates offset version of the input geometries.

The offset operation creates a geometry that is a constant distance from an input polyline or polygon. It is similar to buffering, but produces a one sided result. If offsetDistance > 0, then the offset geometry is constructed to the right of the oriented input geometry, otherwise it is constructed to the left. For a simple polygon, the orientation of outer rings is clockwise and for inner rings it is counter clockwise. So the “right side” of a simple polygon is always its inside. The bevelRatio is multiplied by the offset distance and the result determines how far a mitered offset intersection can be from the input curve before it is beveled.

Parameters:
geometry The geometry to calculate offset for. Point and MultiPoint are not supported.
distance The offset distance for the Geometries.
joinType The join type of the offset geometry.
bevelRatio The ratio used to produce a bevel join instead of a miter join (used only when joins is Miter)
flattenError The maximum distance of the resulting segments compared to the true circular arc (used only when joins is Round). If flattenError is 0, tolerance value is used. Also, the algorithm never produces more than around 180 vetices for each round join.
Returns:
Returns the result of the offset operation.
Since:
1.8
- (AGSPoint *) pointFromMGRS: (NSString*)  mgrs  

Returns a point for a given MGRS coordinate string

Parameters:
mgrs The MGRS coordinate string. Can contain spaces.
Returns:
A point from the MGRS coordinate
Since:
2.2
- (AGSGeometry *) projectGeometry: (AGSGeometry*)  geometry
toSpatialReference: (AGSSpatialReference*)  spatialReference 

Projects the given geometry into a new spatial reference.

Parameters:
geometry The geometry to be projected.
spatialReference The spatial reference to which geometry need to be projected.
Returns:
The projected geometry
Since:
1.8
- (double) shapePreservingAreaOfGeometry: (AGSGeometry*)  geometry
inUnit: (AGSAreaUnits areaUnit 

Calculates the area of the geometry on the surface of the Earth ellipsoid. This method preserves the shape of the geometry in its coordinate system. This means the true area will be calculated for the geometry you see in the map.

Parameters:
geometry whose area needs to be computed
lengthUnit The unit in which length needs to be computed
Returns:
The area of the geometry
Since:
2.2
- (double) shapePreservingLengthOfGeometry: (AGSGeometry*)  geometry
inUnit: (AGSSRUnit lengthUnit 

Calculates the length of the geometry on the surface of the Earth ellipsoid. This method preserves the shape of the geometry in its coordinate system. This means the true length will be calculated for the geometry you see in the map. Thus, if you have a line that spans the width of the world, with only two vertices, each on edges of the map, the length returned would be comparable to the distance on earth.

Parameters:
geometry whose length needs to be computed
lengthUnit The unit in which length needs to be computed
Returns:
The length of the geometry
Since:
2.2
- (AGSGeometry *) simplifyGeometry: (AGSGeometry*)  geometry  

Simplifies the given geometry to make it topologically consistent according to their geometry type. For instance, it rectifies polygons that may be self-intersecting, or contain incorrect ring orientations.

Parameters:
geometry The geometry to be simplified.
Returns:
The simplified geometry.
Since:
1.8
- (AGSGeometry *) symmetricDifferenceOfGeometry: (AGSGeometry*)  geometry1
andGeometry: (AGSGeometry*)  geometry2 
Since:
2.2
- (AGSGeometry *) unionGeometries: (NSArray*)  geometries  

The union operation constructs the set-theoretic union of the geometries in the input array.

Parameters:
geometries The array of geometries to be unioned.
Returns:
The union of all the input geometries.
Since:
1.8