AGSPolygon Class Reference


Description

Instances of this class represent a polygon object. A polygon is defined by a collection of rings and an optional spatial reference. Each ring is a bounded area represented by a collection of points. The first and last points of a ring must coincide so that the ring is closed. Each point constitutes a vertex of the polygon.

AGSPolygon represents an immutable polygon, it cannot be altered after being created. Use AGSMutablePolygon for a mutable polygon. You can get a mutable version from AGSPolygon by passing the mutableCopy message to an instance of AGSPolygon.

Defined in:
AGSPolygon.h ( ArcGIS library)
Since:
1.0
Inheritance diagram for AGSPolygon:
AGSGeometry <AGSCoding> AGSMutablePolygon

List of all members.

Public Member Functions

(BOOL) - containsPoint:
(void) - decodeWithJSON:
(NSDictionary *) - encodeToJSON
(id) - initWithJSON:
(id) - initWithJSON:spatialReference:
(id) - initWithSpatialReference:
(BOOL) - intersectsWithEnvelope:
(BOOL) - isEmpty
(BOOL) - isEqualToPolygon:
(BOOL) - isValid
(NSUInteger) - numPointsInRing:
(AGSPoint *) - pointOnRing:atIndex:

Static Public Member Functions

(id) + polygonWithJSON:

Properties

AGSEnvelopeenvelope
NSUInteger numRings
CGPathRef path
AGSSpatialReferencespatialReference

Protected Attributes

struct BORGPolygon * _borg

Member Function Documentation

- (BOOL) containsPoint: (AGSPoint *)  point  

Checks whether point is contained in the polygon. The point and the polygon must have the same spatial reference.

Parameters:
point The point to test containment.
Returns:
YES if point is contained within the polygon.
Since:
1.0
- (void) decodeWithJSON: (NSDictionary *)  json   [optional, inherited]

Decode object from JSON representation.

Parameters:
json The JSON representation of the object to be decoded.
Since:
1.0
- (NSDictionary *) encodeToJSON   [optional, inherited]

Encode and return JSON representation for object.

Returns:
JSON representation of object.
Since:
1.0
- (id) initWithJSON: (NSDictionary *)  json   [optional, inherited]

Initialize and return object from JSON representation.

Parameters:
json The JSON representation of the object to be created.
Returns:
Object decoded from JSON representation.
Since:
1.0
- (id) initWithJSON: (NSDictionary *)  json
spatialReference: (AGSSpatialReference*)  sr 

Initialize geometry object with json and a spatial reference.

Parameters:
json The JSON to initialize an AGSGeometry with.
sr The spatial reference of geometry represented in json.
Returns:
A new geometry object.
Since:
1.0
- (id) initWithSpatialReference: (AGSSpatialReference *)  spatialReference  

Initialize geometry object with spatial reference.

Parameters:
spatialReference The spatial referenc of geometry.
Returns:
A new geometry object.
Since:
1.0
- (BOOL) intersectsWithEnvelope: (AGSEnvelope *)  envelope  

Returns true if envelope intersects this geometry.

Parameters:
envelope The envelope to test intersection relation.
Returns:
True if envelopes intersects.
Since:
1.0

Reimplemented in AGSEnvelope.

- (BOOL) isEmpty  

Returns whether or not the geometry is empty.

Since:
1.8

Reimplemented in AGSEnvelope.

- (BOOL) isEqualToPolygon: (AGSPolygon*)  other  

Returns a value whether another polygon is equal to this polygon.

Parameters:
other The other polygon to compare to.
Returns:
Whether or not the other polygon is equal to this polygon.
Since:
1.8
- (BOOL) isValid  

Returns whether or not the geometry is valid.

Since:
1.8
- (NSUInteger) numPointsInRing: (NSUInteger)  ring  

Get number of points in the specified ring.

Parameters:
ring The index of desired ring in the polygon.
Returns:
Number of points in ring.
Since:
1.0
- (AGSPoint *) pointOnRing: (NSUInteger)  ring
atIndex: (NSUInteger)  index 

Get point from ring.

Parameters:
ring The index of desired ring.
index The index of the desired point.
Returns:
Point in ring at index.
Since:
1.0
+ (id) polygonWithJSON: (NSDictionary *)  json  

Initialize a new autoreleased polygon geometry.

Parameters:
json The JSON representation for polygon. See REST API documentation for JSON syntax.
Returns:
A new, autoreleased, polygon geometry object.
Since:
1.0

Property Documentation

- (NSUInteger) numRings [read, assign]

Number of rings in polygon.

Since:
1.0
- (AGSSpatialReference*) spatialReference [read, retain, inherited]

Geometry's spatial reference.

Since:
1.0

Reimplemented in AGSMutableEnvelope, AGSMutableMultipoint, AGSMutablePoint, AGSMutablePolygon, and AGSMutablePolyline.