This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
squash of #1655: shape annotations support for core & iOS
- Loading branch information
Showing
43 changed files
with
17,075 additions
and
263 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#import <Foundation/Foundation.h> | ||
#import <CoreLocation/CoreLocation.h> | ||
|
||
#import "MGLShape.h" | ||
|
||
/** The `MGLMultiPoint` class is an abstract superclass used to define shapes composed of multiple points. You should not create instances of this class directly. Instead, you should create instances of the `MGLPolyline` or `MGLPolygon` classes. However, you can use the method and properties of this class to access information about the specific points associated with the line or polygon. */ | ||
@interface MGLMultiPoint : MGLShape | ||
|
||
/** The number of points associated with the shape. (read-only) */ | ||
@property (nonatomic, readonly) NSUInteger pointCount; | ||
|
||
/** Retrieves one or more coordinates associated with the shape. | ||
* @param coords On input, you must provide a C array of structures large enough to hold the desired number of coordinates. On output, this structure contains the requested coordinate data. | ||
* @param range The range of points you want. The `location` field indicates the first point you are requesting, with `0` being the first point, `1` being the second point, and so on. The `length` field indicates the number of points you want. The array in _`coords`_ must be large enough to accommodate the number of requested coordinates. */ | ||
- (void)getCoordinates:(CLLocationCoordinate2D *)coords range:(NSRange)range; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#import <Foundation/Foundation.h> | ||
#import <CoreLocation/CoreLocation.h> | ||
|
||
#import "MGLAnnotation.h" | ||
#import "MGLTypes.h" | ||
|
||
/** The `MGLOverlay` protocol defines a specific type of annotation that represents both a point and an area on a map. Overlay objects are essentially data objects that contain the geographic data needed to represent the map area. For example, overlays can take the form of common shapes such as rectangles and circles. They can also describe polygons and other complex shapes. | ||
* | ||
* You use overlays to layer more sophisticated content on top of a map view. For example, you could use an overlay to show the boundaries of a national park or trace a bus route along city streets. Mapbox GL defines several concrete classes that conform to this protocol and define standard shapes. | ||
* | ||
* Because overlays are also annotations, they have similar usage pattern to annotations. When added to a map view using the `addOverlay:` method, that view detects whenever the overlay’s defined region intersects the visible portion of the map. At that point, the map view asks its delegate to provide a special overlay view to draw the visual representation of the overlay. If you add an overlay to a map view as an annotation instead, it is treated as an annotation with a single point. */ | ||
@protocol MGLOverlay <MGLAnnotation> | ||
|
||
/* The approximate center point of the overlay area. (required) (read-only) | ||
* | ||
* This point is typically set to the center point of the map’s bounding rectangle. It is used as the anchor point for any callouts displayed for the annotation. */ | ||
@property (nonatomic, readonly) CLLocationCoordinate2D coordinate; | ||
|
||
/** The cooordinate rectangle that encompasses the overlay. (required) (read-only) | ||
* | ||
* This property contains the smallest rectangle that completely encompasses the overlay. Implementers of this protocol must set this area when implementing their overlay class, and after setting it, you must not change it. */ | ||
@property (nonatomic, readonly) MGLCoordinateBounds overlayBounds; | ||
|
||
/** Returns a Boolean indicating whether the specified rectangle intersects the receiver’s shape. | ||
* | ||
* You can implement this method to provide more specific bounds checking for an overlay. If you do not implement it, the bounding rectangle is used to detect intersections. | ||
* @param overlayBounds The rectangle to intersect with the receiver’s area. | ||
* @return `YES` if any part of the map rectangle intersects the receiver’s shape or `NO` if it does not. */ | ||
- (BOOL)intersectsOverlayBounds:(MGLCoordinateBounds)overlayBounds; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#import <Foundation/Foundation.h> | ||
#import <CoreLocation/CoreLocation.h> | ||
|
||
#import "MGLShape.h" | ||
|
||
/** The `MGLPointAnnotation` class defines a concrete annotation object located at a specified point. You can use this class, rather than define your own, in situations where all you want to do is associate a point on the map with a title. */ | ||
@interface MGLPointAnnotation : MGLShape | ||
|
||
/** The coordinate point of the annotation, specified as a latitude and longitude. */ | ||
@property (nonatomic, assign) CLLocationCoordinate2D coordinate; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#import <Foundation/Foundation.h> | ||
#import <CoreLocation/CoreLocation.h> | ||
|
||
#import "MGLMultiPoint.h" | ||
#import "MGLOverlay.h" | ||
|
||
/** 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#import <Foundation/Foundation.h> | ||
#import <CoreLocation/CoreLocation.h> | ||
|
||
#import "MGLMultiPoint.h" | ||
#import "MGLOverlay.h" | ||
|
||
/** The `MGLPolyline` class represents a shape consisting of one or more points that define connecting line segments. The points are connected end-to-end in the order they are provided. The first and last points are not connected to each other. */ | ||
@interface MGLPolyline : 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 polyline object. */ | ||
+ (instancetype)polylineWithCoordinates:(CLLocationCoordinate2D *)coords | ||
count:(NSUInteger)count; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#import <Foundation/Foundation.h> | ||
|
||
#import "MGLAnnotation.h" | ||
|
||
/** The `MGLShape` class is an abstract class that defines the basic properties for all shape-based annotation objects. This class must be subclassed and cannot be used as is. Subclasses are responsible for defining the geometry of the shape and providing an appropriate value for the coordinate property inherited from the `MGLAnnotation` protocol. */ | ||
@interface MGLShape : NSObject <MGLAnnotation> | ||
|
||
/** The title of the shape annotation. The default value of this property is `nil`. */ | ||
@property (nonatomic, copy) NSString *title; | ||
|
||
/** The subtitle of the shape annotation. The default value of this property is `nil`. */ | ||
@property (nonatomic, copy) NSString *subtitle; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
#import "MGLAccountManager.h" | ||
#import "MGLAnnotation.h" | ||
#import "MGLMapView.h" | ||
#import "MGLMultiPoint.h" | ||
#import "MGLOverlay.h" | ||
#import "MGLPointAnnotation.h" | ||
#import "MGLPolygon.h" | ||
#import "MGLPolyline.h" | ||
#import "MGLShape.h" | ||
#import "MGLTypes.h" | ||
#import "MGLUserLocation.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.