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
shape annotations #1655
Closed
Closed
shape annotations #1655
Changes from 80 commits
Commits
Show all changes
91 commits
Select commit
Hold shift + click to select a range
a2c7e00
refactor annotation adding for shapes; move to some unordered_maps
incanus b977a57
basic roughing out of shape paints & feature creation
incanus ed50422
split out multiple layers in live tiles
incanus fb65df2
abstract tile(s) feature creation to handle built-up shapes; move to …
incanus 450d4b3
abstract zoom
incanus 6a82560
reserve sizes; fix line accumulation
incanus 4a06861
better-looking line width
incanus c54e00d
move to fill for now
incanus 1d1eb84
expose & carry along shape annotation style properties
incanus 1ae97a4
basic working runtime shape styling
incanus 9722c92
sample point & shape annotation adds at startup
incanus e5db77b
add missing include for find_if
incanus 94f7e2f
track stale annotation tile pre-style load
incanus c47f629
apply round line join for annotations
incanus b023d8d
support adding multiple shapes at once
incanus 1297656
fix annotation removal
incanus b63b436
proper deletion cleanup
incanus 15ea397
partial fix to tile-spanning features
incanus 53b558b
roughing out basic Cocoa types
incanus 1847681
add shape styling delegate callbacks
incanus 129159b
tighten up shape delegate methods
incanus 20a489b
add shape includes to umbrella header
incanus f7b7afe
add concrete MGLPointAnnotation
incanus a3f32ea
clean up MGLMultiPoint & descendents
incanus 1c23ac8
flesh out Cocoa shapes API & use in demo app
incanus 5c3448a
remove todo comment
incanus bf6be3c
fix annotations bounds search for >+/-85 latitude
incanus 8626f91
avoid dupes in annotations bounds queries
incanus b51f5e8
fix problems with multiple point annotations
incanus da01318
allow annotation bounds filtering by type
incanus 376ad5e
extend annotation bounds querying for shapes
incanus 2a0d31c
implement MGLOverlay & bounds intersection
incanus e25a561
comment out API docs gen for now to try tests
incanus 2862ee4
update GYP for .m -> .mm
incanus 93521b8
fix temp OS X shape add
incanus 9506583
flesh out some basic Cocoa shape API docs
incanus c3656fd
Revert "comment out API docs gen for now to try tests"
incanus d135461
Merge remote-tracking branch 'origin/master' into shape-annotations
incanus b7e26f3
only notify delegate on actual annotation deselection
incanus 820d2da
don't allow Cocoa selection of non-point annotations
incanus d6ced9e
more proper feature type
incanus e9eb7dc
add comment about polygon closure
incanus c6fee9a
add former, untouched GeoJSONVT lib
incanus 3696718
GeoJSONVT: split out GeoJSON parsing to allow direct feature passing
incanus 7e0c53a
GeoJSONVT: expose conversion/projection functions for callers
incanus 1ba430a
GeoJSONVT: temporarily(?) get rid of mutex
incanus 9ba634f
GeoJSONVT: fix rounding bug
incanus 9f25e6f
split out shape handling to GeoJSONVT shape tilers
incanus 3239b84
build up annotation render tiles at point of need
incanus eefd44c
invalidate all annotation for now
incanus 386567c
add test shapes in iOS demo app
incanus 68e412d
we handle this at the core level
incanus 60ff8e4
add default case to appease pedantic compilers
incanus f9a1c60
APPARENTLY NOT PEDANTIC ENOUGH
incanus 6d90a8a
cast for more pedantic warnings on Linux
incanus 395a5db
differentiate shapes
incanus a590995
sort points above shapes
incanus 56b89c5
clean up shape tilers on deletion
incanus 9b86c21
properly query annotation bounds
incanus d1797dc
fix tile invalidation for shapes addition & deletion
incanus 62f40a1
adjustments to shape tiler structure & locking
incanus 9290460
properly constrain latitude for shape points
incanus 3ce8045
add note about no holes
incanus f3eb68c
clean up point/shape-only routines
incanus e9fcb6e
fix polyline parsing error
incanus 0e574c6
spacing
incanus e92d1ff
remove bad check
incanus 715be6f
preserve detail to max zoom
incanus 9d864ce
simplify constructor
incanus 8161621
use nicer operator overloading
incanus ee9ab21
properly iterate all shape geometries
incanus 6345fcf
tile points can be (slightly, up to buffer distance) negative
incanus 0d0527e
fix bug with min/max point validity
incanus 43ccb9b
turn off debug logging for GeoJSONVT
incanus 9383dac
Merge remote-tracking branch 'origin/master' into shape-annotations
incanus fe2d84c
remove OS X test annotations
incanus 333e11a
Merge remote-tracking branch 'origin/master' into shape-annotations
incanus c638825
rename method
incanus 38927c7
MGLBounds -> MGLCoordinateBounds
incanus 2c9a886
move to annotation style value type getter
incanus 74db485
properly use max zoom
incanus c39de8a
move to split GeoJSONVT
incanus a6da538
remove debug log line
incanus 9ed12f4
move to external, submodule geojsonvt
incanus 0d14311
Merge branch 'master' into shape-annotations
1ec5 e99661f
patch up GeoJSONVT setup
incanus 58661c4
Merge branch 'shape-annotations' of github.com:mapbox/mapbox-gl-nativ…
incanus 77c99f3
add geojsonvt submodule for Android Linux
incanus 82ee46e
Merge remote-tracking branch 'origin/master' into shape-annotations
incanus e45bacf
move to shared private header
incanus effd91c
fix missing GYP include
incanus File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,19 @@ | ||
#import <Foundation/Foundation.h> | ||
#import <CoreLocation/CoreLocation.h> | ||
|
||
extern NSString * const MGLErrorDomain; | ||
|
||
/** The mode used to track the user location on the map. */ | ||
typedef NS_ENUM(NSUInteger, MGLUserTrackingMode) | ||
{ | ||
typedef NS_ENUM(NSUInteger, MGLUserTrackingMode) { | ||
/** The map does not follow the user location. */ | ||
MGLUserTrackingModeNone = 0, | ||
/** The map follows the user location. */ | ||
MGLUserTrackingModeFollow, | ||
/** The map follows the user location and rotates when the heading changes. */ | ||
MGLUserTrackingModeFollowWithHeading | ||
}; | ||
|
||
typedef struct { | ||
CLLocationCoordinate2D sw; | ||
CLLocationCoordinate2D ne; | ||
} MGLCoordinateBounds; |
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.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This property should be
nonnull
when we ultimately merge in #1578. It looks like theMKAnnotation
protocol has been audited for nullability but the concrete implementations have not. So-[MKAnnotation title]
comes with this note, which impliesnonnull
:while corresponding properties in
MKShape
and other subclasses lack this note.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 We can do another once-over to land #1578 in b3?