Streamlined -[MGLMapView annotationTagForAnnotation:] to use the mapping added in #5987. Reverted an unsafe access into that mapping that was added in #5987; returning nil is preferable when no such annotation can be found. Return the user location annotation view when given the user location annotation.
Optimized lookup of annotation tags by annotation from O(n) to a simple map lookup, for better performance and consistency with the iOS implementation of MGLMapView.
A previous refactor neglected to remove the unused `layer` property.
This removes that property and uses the rawLayer property that actually
points to the mbgl layer.
`MGLStyleLayer` was updated to support a raw pointer to the mbgl object, which is always initialized, either to the value returned by `mbgl::Map getLayer`, or for independently created objects, to the pointer value held in `pendingLayer`. In the latter case, this raw pointer value stays even after ownership of the object is transferred via `mbgl::Map addLayer`.
Define NSErrorDomain before its first use. Define NSNotificationName as a typedef instead of a #define. Guard these shims on the existence of NS_STRING_ENUM rather than another macro that’s new to Xcode 8.
Fixes#6906.
When annotations are removed concurrently with being updated because
of a map redraw, it is possible that mbgl will still consider an
annotation to exist depending on what part of the map lifecycle the
call update annotations happens. However, the annotation context by
tag map in MGLMapView (on the main thread) will always be up to date.
This adds a guard that uses that map to avoid considering annotations
that have actually been removed as visible.
Another issue was that adding the same annotation object twice has
always been allowed and has worked, visually. However, a recent
refactor to make the reuse queue work correctly is not tolerant of the
a single view representing two annotation instances that are the same.
The effect is that a new UIView will be generated for each (clone)
annotation that is added and only the last view will move with the map.
The other views become detached and float around in the view as the
map is panned. This commit adds a guard to make adding an annotation
instance a no-op if it has already been added before.
* [ios] Store annotation tags for MGLMultiPoint annotations in the map
This fixes an issue where, if a multipoint annotation was added,
native annotation view update logic would crash. Adding the annotation
tag for multipoints, too, avoids the out of range exception.
This also adds a check for MGLMultiPoint for offscreen annotations
for consistency with the onscreen case.
Added the style layer tests to the test bundle target.
Set the access token to a bogus access token before running any tests. The macOS implementation of MGLMapView doesn’t even attempt to set a default style if the access token is missing, because in macosapp, the access token may be set asynchronously by the user when the preferences window appears.
Moved MGLGeoJSONSourceTests and MGLTileSetTests into platform/darwin/test/ and added them to the macOS project. Also added a private header needed to compile the tests to the macOS project.
Renamed MGLGeoJSONSourceOption and MGLOfflinePackUserInfoKey constants for clarity and to remove redundancy in the Swift-bridged names. Left the old MGLOfflinePackUserInfoKey constants in place as deprecated aliases.
Notification names and user info keys posted by MGLOfflineStorage, as well as MGLErrorDomain, are instances of string enumerations for ease of use in Swift. Added some shims for projects built with Xcode 7.x.
Fixes#6791.
Although functionality was not affected, a previous merge garbled
the language test with a temporary test done for annotation view
performance improvement.
Use queryPointAnnotations to drive annotation view updates
- Get sets of visible and offscreen annotations using the mbgl query
mechanism and updates and enqueues as required
- Query viewport adjusted if tilted (avoid apparent issue with
queryPointAnnotations when the query box is larger than the actual
viewport)
- Add a small debugging display in iOS app to see annotations going in
and out of the reuse queue
This also works around a performance issue that made getting an annotation
context expensive by implementing a map of annotations to tags. It works
around another issue with the underlying mbgl query so that even if it (rarely)
returns an incorrect result, the correct visual effect still occurs and the reuse
queue is added to and drained as expected.
Finally, this refactors MGLMapView viewForAnnotation: to use the maps to
access the requested annotation context and view. This avoids a more
expensive lookup done previously.
Along for the ride: sync up the ios and macos names (and types) for
MGLAnnotationTagContextMap
Add visibleAnnotations API to make it easier for clients of MGLMapView
to query for all visible annotations in the map or all visible annotations
in a subsection of the map.
Use common initialization logic to create an unique pointer to an mbgl
source object, up front, when a MGL source is created. Keep a raw
pointer to the unique pointer that is pointed at the mbgl source
instance when a MGL source is created or when a MGL source is
obtained by identifier from MGLStyle. Once the transfer of ownership of the
mbgl source takes place, the unique ptr is null. The raw pointer can be used
internally for future work that involves mutating the source.
This also changes the URL, features, and geoJSONData content
properties for MGLGeoJSON source to be writable. If they are set with
valid data after a source has been added to the map then the map will
update to reflect the new data.
MGLStyleConstantValue and MGLStyleFunction now inherit from MGLStyleValue with a generic argument matching the child class’s own generic argument.
Fixes#6823.
save state for recreating map view
fix review comments
unit test covering default value for fading and setting a new value
fixup setter, fix default value
To obtain precise results, we:
1. Round scale value to obtain same results from symbol shader.
2. Generate a boost geometry polygon to check if it intersects()
against all feature boxes.
3. Check if current scale is within each feature's minimum and maximum
placement scales.
4. De-scale feature boxes when intersecting to account for the
fractional zoom scaling.