summaryrefslogtreecommitdiff
path: root/platform/darwin/src/MGLPolygon.h
blob: a12e62b1066f911749579ccffa2fb56254abcd0f (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
#import <Foundation/Foundation.h>
#import <CoreLocation/CoreLocation.h>

#import "MGLMultiPoint.h"
#import "MGLOverlay.h"

#import "MGLTypes.h"

NS_ASSUME_NONNULL_BEGIN

/**
 The `MGLPolygon` class represents a shape consisting of one or more points that
 define a closed polygon. The points are connected end-to-end in the order they
 are provided. The first and last points are connected to each other to create
 the closed shape.
 */
@interface MGLPolygon : MGLMultiPoint <MGLOverlay>

/**
 Creates and returns an `MGLPolygon` object from the specified set of
 coordinates.
 
 @param coords The array of coordinates defining the shape. The data in this
    array is copied to the new object.
 @param count The number of items in the `coords` array.
 @return A new polygon object.
 */
+ (instancetype)polygonWithCoordinates:(CLLocationCoordinate2D *)coords
                                 count:(NSUInteger)count;

@end

/**
 The `MGLMultiPolygon` class represents a shape consisting of one or more
 polygons that do not overlap. For example, you would use an `MGLMultiPolygon`
 object to represent an atoll together with an island in the atoll’s lagoon:
 the atoll itself would be one `MGLPolygon` object, while the inner island would
 be another.
 */
@interface MGLMultiPolygon : MGLShape <MGLOverlay>

/**
 An array of polygons forming the multipolygon.
 */
@property (nonatomic, copy, readonly) NS_ARRAY_OF(MGLPolygon *) *polygons;

/**
 Creates and returns a multipolygon object consisting of the given polygons.
 
 @param polygons The array of polygons defining the shape.
 @return A new multipolygon object.
 */
+ (instancetype)multiPolygonWithPolygons:(NS_ARRAY_OF(MGLPolygon *) *)polygons;

@end

NS_ASSUME_NONNULL_END