summaryrefslogtreecommitdiff
path: root/platform/darwin/src/MGLMultiPoint.h
blob: 429bbdb22d786af3e1f3e141b7b6ca51eb62e238 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
#import <Foundation/Foundation.h>
#import <CoreLocation/CoreLocation.h>

#import "MGLFoundation.h"
#import "MGLShape.h"

NS_ASSUME_NONNULL_BEGIN

/**
 The `MGLMultiPoint` class is an abstract superclass used to define shapes
 composed of multiple vertices.

 You do not create instances of this class directly. Instead, you create
 instances of the `MGLPolyline` or `MGLPolygon` classes. However, you can use
 the method and properties of this class to access information about the
 vertices of the line or polygon.

 Do not confuse `MGLMultiPoint` with `MGLPointCollection`, which represents a
 collection of related but disconnected points.
 */
MGL_EXPORT
@interface MGLMultiPoint : MGLShape

/**
 The array of vertices associated with the shape.

 This C array is a pointer to a structure inside the multipoint object, which
 may have a lifetime shorter than the multipoint object and will certainly not
 have a longer lifetime. Therefore, you should copy the C array if it needs to
 be stored outside of the memory context in which you use this property.
 */
@property (nonatomic, readonly) CLLocationCoordinate2D *coordinates NS_RETURNS_INNER_POINTER;

/** The number of vertices in the shape. */
@property (nonatomic, readonly) NSUInteger pointCount;

/**
 Retrieves the vertices of part of the shape.

 @param coords On input, you must provide a C array of `CLLocationCoordinate2D`
    structures large enough to hold the desired number of coordinates. On
    output, this structure contains the requested coordinate data.
 @param range The range of vertices you want. The `location` field indicates
    the first vertex you are requesting, with `0` being the first vertex, `1`
    being the second vertex, and so on. The `length` field indicates the number
    of vertices you want. The array in `coords` must be large enough to
    accommodate the number of requested coordinates.
 */
- (void)getCoordinates:(CLLocationCoordinate2D *)coords range:(NSRange)range;

/**
 Sets the shape’s vertices to the given C array of vertices.

 @param coords The array of coordinates defining the shape. The data in this
    array is copied to the shape’s `coordinates` property.
 @param count The number of coordinates from the `coords` array.
 */
- (void)setCoordinates:(CLLocationCoordinate2D *)coords count:(NSUInteger)count;

/**
 Inserts the given vertices into the shape.
 
 If the shape is currently visible on the map as an annotation, it is redrawn
 immediately. If the shape is part of an `MGLShapeSource` object, you must
 explicitly set the `MGLShapeSource.shape` property in order for any style
 layers that use the source to be redrawn.

 @param coords The array of coordinates to insert into the shape. The data in
    this array is copied to the shape’s `coordinates` property.
 @param count The number of items in the `coords` array.
 @param index The zero-based index at which the first coordinate in `coords`
    will appear in the `coordinates` property.
 */
- (void)insertCoordinates:(const CLLocationCoordinate2D *)coords count:(NSUInteger)count atIndex:(NSUInteger)index;

/**
 Appends the given vertices to the shape.
 
 If the shape is currently visible on the map as an annotation, it is redrawn
 immediately. If the shape is part of an `MGLShapeSource` object, you must
 explicitly set the `MGLShapeSource.shape` property in order for any style
 layers that use the source to be redrawn.

 @param coords The array of coordinates to add to the shape. The data in this
    array is copied to the shape’s `coordinates` property.
 @param count The number of items in the `coords` array.
 */
- (void)appendCoordinates:(const CLLocationCoordinate2D *)coords count:(NSUInteger)count;

/**
 Replaces the vertices at the given range in the shape with the same number of
 vertices from a given C array.
 
 If the shape is currently visible on the map as an annotation, it is redrawn
 immediately. If the shape is part of an `MGLShapeSource` object, you must
 explicitly set the `MGLShapeSource.shape` property in order for any style
 layers that use the source to be redrawn.

 The number of coordinates in `coords` must be equal to the length of `range`.
 If you want to insert or delete one or more vertices, use the
 `-replaceCoordinatesInRange:withCoordinates:count:` method.

 If `range` extends beyond the shape’s `coordinates` property, an
 `NSRangeException` is raised. If you want to append new vertices to the shape,
 use the `-appendCoordinates:count:` method.

 @param range The range of vertices to replace. The `location` field indicates
    the first vertex you are replacing, with `0` being the first vertex, `1`
    being the second vertex, and so on. The `length` field indicates the number
    of vertices to replace.
 @param coords The array of coordinates defining part of the shape. The data in
    this array is copied to the shape’s `coordinates` property.
 */
- (void)replaceCoordinatesInRange:(NSRange)range withCoordinates:(const CLLocationCoordinate2D *)coords;

/**
 Replaces the vertices at the given range in the shape with the specified number
 of vertices from a given C array.
 
 If the shape is currently visible on the map as an annotation, it is redrawn
 immediately. If the shape is part of an `MGLShapeSource` object, you must
 explicitly set the `MGLShapeSource.shape` property in order for any style
 layers that use the source to be redrawn.

 If `count` is greater than the `length` field of `range`, some vertices will
 effectively be inserted into the shape. On the other hand, if `count` is less
 than the `length` field of `range`, some vertices will effectively be removed.

 If `range` extends beyond the shape’s `coordinates` property, an
 `NSRangeException` is raised. If you want to append new vertices to the shape,
 use the `-appendCoordinates:count:` method.

 @param range The range of vertices to replace. The `location` field indicates
    the first vertex you are replacing, with `0` being the first vertex, `1`
    being the second vertex, and so on. The `length` field indicates the number
    of vertices to replace.
 @param coords The array of coordinates defining part of the shape. The data in
    this array is copied to the shape’s `coordinates` property.
 @param count The number of coordinates from the `coords` array to insert in
    place of the coordinates in `range`. The sum of `range`’s length and this
    count must not exceed the number of items currently in the `coordinates`
    property.
 */
- (void)replaceCoordinatesInRange:(NSRange)range withCoordinates:(const CLLocationCoordinate2D *)coords count:(NSUInteger)count;

/**
 Removes the vertices at the given range from the shape.
 
 If the shape is currently visible on the map as an annotation, it is redrawn
 immediately. If the shape is part of an `MGLShapeSource` object, you must
 explicitly set the `MGLShapeSource.shape` property in order for any style
 layers that use the source to be redrawn.

 If `range` extends beyond the shape’s `coordinates` property, an
 `NSRangeException` is raised.

 @param range The range of vertices to remove. The `location` field indicates
    the first vertex you are removing, with `0` being the first vertex, `1`
    being the second vertex, and so on. The `length` field indicates the number
    of vertices to remove.
 */
- (void)removeCoordinatesInRange:(NSRange)range;

@end

NS_ASSUME_NONNULL_END