ArcGIS Runtime SDK for iOS: AGSMutablePart Class Reference
ArcGIS Runtime SDK for iOS  100.12
AGSMutablePart Class Reference

Description

A mutable part of a multipart geometry.

Instances of this class represent an individual, modifiable, part of a multipart geometry such as polygon or polyline. A part is a collection of segments that define the shape of the part. As a convenience, you can work with points that represent the vertices of the part, instead of working with segments.

The part is mutable so it can be modified which is useful when constructing or modifying geometries using builders.

This class adopts NSFastEnumeration which permits the part's segments to be enumerated conveniently using a for-in loop. For example -

let part:AGSMutablePart = ... //A part containing segments
for segment in part {
//do something
}
A mutable part of a multipart geometry.
Definition: AGSMutablePart.h:67

This class also provides subscripting support. So you can access and set segments using the subscript syntax. For example -

let part:AGSMutablePart = ... //A part containing segments
let segment = part[0] //The segment at 0th index
let part[1] = newSegment //Set new segment at 1st index

Prior to v100.12, the only supported segment type was AGSLineSegment.

From v100.12, curve segments can be added to an AGSMutablePart and used to build polygon and polyline geometries. A part may contain a mix of linear and curve segments.

See also
AGSCubicBezierSegment, AGSEllipticArcSegment, AGSLineSegment
Since
100
Inheritance diagram for AGSMutablePart:
AGSObject

Instance Methods

(NSInteger) - addPoint:
 
(void) - addPoints:
 
(NSInteger) - addPointWithX:y:
 
(NSInteger) - addPointWithX:y:z:
 
(NSInteger) - addSegment:
 
(NSArray< AGSSegment * > *) - array
 
(NSInteger) - endPointIndexForSegmentIndex:
 
(instancetype) - initWithPoints:
 
(instancetype) - initWithSpatialReference:
 
(void) - insertPoint:atIndex:
 
(void) - insertPointWithX:y:atIndex:
 
(void) - insertPointWithX:y:z:atIndex:
 
(void) - insertSegment:atIndex:
 
(AGSPoint *) - pointAtIndex:
 
(AGSEnumerator *) - pointEnumerator
 
(void) - removeAllSegments
 
(void) - removePointAtIndex:
 
(void) - removeSegmentAtIndex:
 
(AGSSegment *) - segmentAtIndex:
 
(AGSEnumerator *) - segmentEnumerator
 
(NSInteger) - segmentIndexForEndPointIndex:
 
(void) - segmentIndexForPointIndex:outSegmentStartPointIndex:outSegmentEndPointIndex:
 
(NSInteger) - segmentIndexForStartPointIndex:
 
(void) - setObject:atIndexedSubscript:
 
(void) - setPoint:atIndex:
 
(void) - setPointWithX:y:atIndex:
 
(void) - setSegment:atIndex:
 
(NSInteger) - startPointIndexForSegmentIndex:
 

Class Methods

(instancetype) + partWithPoints:
 
(instancetype) + partWithSpatialReference:
 

Properties

BOOL empty
 
AGSPointendPoint
 
BOOL hasCurves
 
NSInteger pointCount
 
AGSPointCollectionpoints
 
NSInteger segmentCount
 
AGSSpatialReferencespatialReference
 
AGSPointstartPoint
 

Method Documentation

◆ addPoint:

- (NSInteger) addPoint: (AGSPoint *)  point

Add a vertex to the end of this part.

Parameters
pointvertex to add.
Returns
A position where the vertex was added.
Since
100

◆ addPoints:

- (void) addPoints: (NSArray< AGSPoint * > *)  points

Add points from the provided array to the end of this part.

Parameters
pointsto add.
Since
100

◆ addPointWithX:y:

- (NSInteger) addPointWithX: (double)  x
y: (double)  y 

Add a vertex to the end of this part.

Parameters
xcoordinate of the vertex.
ycoordinate of the vertex.
Returns
A position where the vertex was added.
Since
100

◆ addPointWithX:y:z:

- (NSInteger) addPointWithX: (double)  x
y: (double)  y
z: (double)  z 

Add a vertex to the end of this part.

Parameters
xcoordinate of the vertex.
ycoordinate of the vertex.
zcoordinate of the vertex.
Returns
A position where the vertex was added.
Since
100

◆ addSegment:

- (NSInteger) addSegment: (AGSSegment *)  segment

Add a segment to the end of this part.

Parameters
segmentto add.
Returns
A position where the segment was added.
Since
100

◆ array

- (NSArray<AGSSegment*>*) array

Returns an array of segments.

Since
100

◆ endPointIndexForSegmentIndex:

- (NSInteger) endPointIndexForSegmentIndex: (NSInteger)  segmentIndex

Position of ending vertex for the specified segment.

Parameters
segmentIndexrepresenting the position of the segment whose ending vertex is desired.
Returns
Position of the ending vertex. 0 is the first position.
Since
100

◆ initWithPoints:

- (instancetype) initWithPoints: (NSArray< AGSPoint * > *)  points

Initialize a part with points.

Parameters
pointsfor the part to be constructed.
Since
100

◆ initWithSpatialReference:

- (instancetype) initWithSpatialReference: (nullable AGSSpatialReference *)  spatialReference

Initialize a part with specified spatial reference. All segments and vertices that belong to this part must have the same spatial reference, or if they don't have a spatial reference, it will be assumed that they contain coordinates that match this spatial reference.

Parameters
spatialReferenceof the part.
Since
100
Note
Geometries that represent geographic locations should always have a spatial reference. Otherwise the coordinates of the geometry are meaningless.

◆ insertPoint:atIndex:

- (void) insertPoint: (AGSPoint *)  point
atIndex: (NSInteger)  index 

Insert a vertex at the specified position.

Parameters
pointvertext to add.
indexof desired position. 0 is the first position.
Since
100

◆ insertPointWithX:y:atIndex:

- (void) insertPointWithX: (double)  x
y: (double)  y
atIndex: (NSInteger)  index 

Insert a vertex at the specified position.

Parameters
xcoordinate of the vertex.
ycoordinate of the vertex.
indexof desired position. 0 is the first position.
Since
100

◆ insertPointWithX:y:z:atIndex:

- (void) insertPointWithX: (double)  x
y: (double)  y
z: (double)  z
atIndex: (NSInteger)  index 

Insert a vertex at the specified position.

Parameters
xcoordinate of the vertex.
ycoordinate of the vertex.
zcoordinate of the vertex.
indexof desired position. 0 is the first position.
Since
100

◆ insertSegment:atIndex:

- (void) insertSegment: (AGSSegment *)  segment
atIndex: (NSInteger)  index 

Insert a segment at the specified position.

Parameters
segmentto add.
indexof desired position. 0 is the first position.
Since
100

◆ partWithPoints:

+ (instancetype) partWithPoints: (NSArray< AGSPoint * > *)  points

Create a new part with points.

Parameters
pointsfor the part to be constructed.
Since
100

◆ partWithSpatialReference:

+ (instancetype) partWithSpatialReference: (nullable AGSSpatialReference *)  spatialReference

Create a new part with specified spatial reference. All segments and vertices that belong to this part must have the same spatial reference, or if they don't have a spatial reference, it will be assumed that they contain coordinates that match this spatial reference.

Parameters
spatialReferenceof the part.
Returns
A new part.
Since
100
Note
Geometries that represent geographic locations should always have a spatial reference. Otherwise the coordinates of the geometry are meaningless.

◆ pointAtIndex:

- (AGSPoint*) pointAtIndex: (NSInteger)  index

Vertex at specified position in the part.

Parameters
indexof desired position. 0 is the first position.
Returns
vertex at specified index.
Since
100

◆ pointEnumerator

- (AGSEnumerator*) pointEnumerator

Returns an enumerator object that lets you access each point in the segment collection.

Since
100

◆ removeAllSegments

- (void) removeAllSegments

Remove all segments (and thereby also vertices) from the part.

Since
100

◆ removePointAtIndex:

- (void) removePointAtIndex: (NSInteger)  index

Remove vertex at specified position.

Parameters
indexof desired position. 0 is the first position.
Since
100

◆ removeSegmentAtIndex:

- (void) removeSegmentAtIndex: (NSInteger)  index

Remove segment at specified position.

Parameters
indexof desired position. 0 is the first position.
Since
100

◆ segmentAtIndex:

- (AGSSegment*) segmentAtIndex: (NSInteger)  index

Segment at specified position in the part.

Parameters
indexof desired position. 0 is the first position.
Returns
segment at specified index.
Since
100

◆ segmentEnumerator

- (AGSEnumerator*) segmentEnumerator

Returns an enumerator object that lets you access each segment in the segment collection.

Since
100

◆ segmentIndexForEndPointIndex:

- (NSInteger) segmentIndexForEndPointIndex: (NSInteger)  pointIndex

Position of segment that contains the specified vertex as its ending point.

Parameters
pointIndexrepresenting the position of vertex which serves as the ending point for the segment.
Returns
Position of segment. 0 is the first position.
Since
100

◆ segmentIndexForPointIndex:outSegmentStartPointIndex:outSegmentEndPointIndex:

- (void) segmentIndexForPointIndex: (NSInteger)  pointIndex
outSegmentStartPointIndex: (NSInteger *)  outSegmentStartPointIndex
outSegmentEndPointIndex: (NSInteger *)  outSegmentEndPointIndex 

◆ segmentIndexForStartPointIndex:

- (NSInteger) segmentIndexForStartPointIndex: (NSInteger)  pointIndex

Position of segment that contains the specified vertex as its starting point.

Parameters
pointIndexrepresenting the position of vertex which serves as the starting point for the segment.
Returns
Position of segment. 0 is the first position.
Since
100

◆ setObject:atIndexedSubscript:

- (void) setObject: (AGSSegment *)  obj
atIndexedSubscript: (NSInteger)  idx 

Returns the segment at the specified index. Supports accessing an individual segment using array-style subscript expressions.

For example -

let part:AGSPart = ... //A part containing segments
let segment = part[0] //The segment at 0th index
Represents a single part of a multipart geometry (AGSPolygon or AGSPolyline).
Definition: AGSPart.h:67
Parameters
idxsubscript index
Returns
segment at subscript index
Since
100 */ -(AGSSegment*)objectAtIndexedSubscript:(NSInteger)idx;

/** Sets the segment at the specified index. Supports assigning an individual segment using array-style subscript expressions. For example -

let part:AGSPart = ... //A part containing segments
let segment:AGSSegment = ... //A new segment
let part[0] = segment //Set the new segment
A segment represents an edge of a multipart geometry, connecting a start to an end point.
Definition: AGSSegment.h:61
Parameters
objsegment to set
idxsubscript index
Since
100

◆ setPoint:atIndex:

- (void) setPoint: (AGSPoint *)  point
atIndex: (NSInteger)  index 

Replace a point in the part at the specified point index. Segments that use this point will be changed.

The points in the part are the start and end points of segments. Setting a new point will affect 1 or 2 segments using the point at the specified index. Affected segments will become line segments and reference the new point.

The points in the part correspond to start and end points of segments. Setting a new point will affect one or two segments using the point at the specified index. The type of affected segment(s) (AGSLineSegment, AGSCubicBezierSegment, or AGSEllipticArcSegment) will remain the same. For affected cubic bezier segments, the shape of the curve may change because the control points remain the same, as does the unchanged start or end point location. For elliptic arc segments, the arc parameters are adjusted enough to ensure the unchanged start or end point location remains the same.

Parameters
pointvertex to replace with.
indexof vertex to replace.
Since
100

◆ setPointWithX:y:atIndex:

- (void) setPointWithX: (double)  x
y: (double)  y
atIndex: (NSInteger)  index 

Replace existing vertex at the specified position.

Parameters
xcoordinate of the vertex.
ycoordinate of the vertex.
indexof desired position. 0 is the first position.
Since
100.5

◆ setSegment:atIndex:

- (void) setSegment: (AGSSegment *)  segment
atIndex: (NSInteger)  index 

Replace existing segment with the specified one.

Parameters
segmentto replace with.
indexof segment to replace.
Since
100

◆ startPointIndexForSegmentIndex:

- (NSInteger) startPointIndexForSegmentIndex: (NSInteger)  segmentIndex

Position of staring vertex for the specified segment.

Parameters
segmentIndexrepresenting the position of the segment whose starting vertex is desired.
Returns
Position of the starting vertex. 0 is the first position.
Since
100

Property Documentation

◆ empty

- (BOOL) empty
readnonatomicassign

Indicates whether the part contains any segments.

Since
100

◆ endPoint

- (AGSPoint*) endPoint
readnonatomiccopy

Ending vertex of the last segment in the part.

Since
100

◆ hasCurves

- (BOOL) hasCurves
readnonatomicassign

Indicates whether the part contains any curve segments.

Prior to v100.12, only AGSLineSegment linear segments were available to be added to mutable parts when building geometries.

From v100.12, geometry builders support curve segments. This property returns YES if any segments where AGSSegment::curve is YES have been added to the part.

See also
AGSGeometry::hasCurves, AGSGeometryBuilder::hasCurves, AGSSegment::curve
Since
100.12

◆ pointCount

- (NSInteger) pointCount
readnonatomicassign

Number of vertices in the part. Each segment contains 2 vertices (start and end). Connected segments can share a vertex.

Since
100

◆ points

- (AGSPointCollection*) points
readnonatomiccopy

All the vertices in this part.

Since
100

◆ segmentCount

- (NSInteger) segmentCount
readnonatomicassign

Number of segments in the part.

Since
100

◆ spatialReference

- (AGSSpatialReference*) spatialReference
readnonatomicstrong

The spatial reference associated with segments and vertices in this part. It specifies the coordinate system for each segment and vertex's x & y coordinate values. All segments and vertices that belong to this part must have the same spatial reference, or if they don't have a spatial reference, it will be assumed that they contain coordinates that match this spatial reference.

Since
100
Note
Geometries that represent geographic locations should always have a spatial reference. Otherwise the coordinates of the geometry are meaningless.

◆ startPoint

- (AGSPoint*) startPoint
readnonatomiccopy

Starting vertex of the first segment in the part.

Since
100