-
Notifications
You must be signed in to change notification settings - Fork 1.3k
annotations plan #877
Comments
Conversion routines are in and API for mocking annotations atop the GL view is available. Next steps are @ljbade & @bleege checking out #756 on Android and I will start mocking markers (not spatially indexed, however, to start) to see how the FPS handles the compositing. |
@kkaefer Here's a small sample project that does animated point markers and animated polygon rendering as an example of what an iOS developer might expect. Video demo: https://dl.dropboxusercontent.com/u/575564/animatedannotations.mp4 MarkersThe PolylinesThe The point is less about flashiness and more about the fact that an iOS dev will expect to author views and renderers as first-class Cocoa objects for the control of animations, colors, strokes, patterns, opacities, and timing. |
Per voice with @1ec5, it might make sense to not necessarily adopt an either-or (core vs. per-platform) approach. For example, simple sprite-based markers (Maki or otherwise) could be done in the icon shader, but more complex views could be composited and tracked to the map per-platform. Of note in the simple use case is the fact that z-ordering matters; markers are ordered back-to-front ( |
And ideally the heuristic would be on our end, not something the dev has to think about. |
@incanus and @kkaefer Is it possible to share how you would synchronize between iOS UIView and GLViews. Otherwise there would always be a lag between overlay UIView (e.g. Bubble) and underlying MGLMapView. Specifically this is the problem I am referring it. http://stackoverflow.com/questions/12967340/how-to-synchronize-opengl-drawing-with-uikit-updates |
I've had good luck using https://github.com/incanus/FeaturesPlay http://www.mobypicture.com/user/incanus771/view/17359491 I'm trying this again now in this project currently. |
@1ec5 I pushed what I've been playing with at |
Per voice with @1ec5 @kkaefer, we decided the beta will not support full MapKit's delegate API, which we will model after, looks like this: - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation When an annotation view is requested, you would return an What we can do as a first step is to only support an
|
Is it possible to make the pins draggable for iOS? |
I'm not sure yet if we'll hit that for the beta, but eventually, yes. |
… methods that also send MapChangeRegion notifications
Finished building the MapRegionIsChanging notification hook on |
This is looking good. However, do you get multiple fires of the region changing across animation durations? I think we need that. For example: animate the map view center over the default iOS duration (300ms). With the old callback methods, you get a ping at the start and a ping 300ms later. It seems like the same thing would happen with this added notification, too. What we should get instead is a ping per draw frame through that 300ms (roughly |
As for how to do this... I think it will involve looking into how the |
Yeah we need per frame callbacks, currently my Android app does not update the marker position during animation. |
The 877-callout branch is all set with using delegate callbacks instead of The last couple days I thought we were seeing that markers in the 877-display-link and 877-callout branches were jumping ahead of the map while panning. But it looks like the marker sometimes gets offset up to 50 meters after a drag, pinch, or rotation. That may point at a bug in the marker positioning rather than a synchronization issue. |
But see also this comment here. |
@1ec5 |
Interesting idea @mb12. I'm pretty sure Apple doesn't provide such a callback because of the potential to slow down rendering, but I think we may at least want this privately for such things as annotation sync. Only thing with |
Note that |
Yes, that causes a really jarring jitter in the overlay view upon panning. This is what others seems to be doing on iOS. 1.) Image pins and Polylines in opengl view. Here is a link to the GMaps SDK for iOS. GMSMarker just shows the snippet in a static info window at the bottom instead of a pannable Apple Maps like Annotation View. https://developers.google.com/maps/documentation/ios/reference/index |
I'm curious if we've looked further into the per-animation-frame updates to the delegate callbacks? See #877 (comment) above. @1ec5 @bleege can one of you look into this? I can possibly start to look into it next week but I'm tied up with GL-side annotation rendering right now.
Agreed, and I would say to probably at least try blocking swap to see how this fares. |
… appear on the screen after a map move
The UI is MUCH more responsive now with the hide / visible functionality added for the pins. This is definitely getting closer to where things need to be. I'm curious as to how big an impact a few optimizations could have (namely creating an annotation class to avoid all the dictionary lookups and geo object creations). I'll try that next and see what happens. |
…and converting the MBXViewController to use it instead of NSDictionaries
This is sounding good @bleege. I'm curious what Instruments profiling turns up now? Might be an approach to check out. |
@incanus I just profiled with Activity Monitor, Allocations, and GPU Driver. Didn't turn up too much, although Allocations did hold pretty steady so I'm feeling pretty decent about that. All in all I'm not sure how much more we can get considering that the app is crossing UIKit and OpenGL. I'm curious how this behaves on actual iPhone / iPad compared to the emulator. |
Give the Time Profiler a whirl and see what methods are taking up the most time — that might shed some light. It should also be a lot different on device — the simulator isn't GPU accelerated IIRC. |
Right, my point more is that if you filter out these routines that are known to be heavy and just focus on the Cocoa stuff, something there will be the "new heaviest" and you can see what that is.
|
Yay! I just ran it on my iPhone 5s with iOS 8.1.3 and it's smoooooooth. I ❤️ Apple hardware. |
I'm going to pull the SampleLocation code out of Core GL codebase so that this branch can eventually be merged. |
Sweet! This is great. Runs well for me, too. What is there to merge just yet, though @bleege? The actual driver of where the annotations should track to is coming in #893 and we have yet to architect what the annotation view classes look like, though they likely will be |
Ew, I think exposing the |
Or when we build out our actual annotation-adding API in Cocoa, it creates the subviews and adds them to the |
Totally makes sense... I just had put it there more for expediency purposes when I was experimenting earlier today. Maybe the best thing to do is just leave this branch as is and just use it to guide #893 and #941? |
Yeah, that's kinda what I had in mind with the "what to merge" above. We figured out how we're going to do it technically, but let's get some other pieces into place first. I see next steps in this department as:
|
We've got a ticket for this over in JS in mapbox/mapbox-gl-js#470 but it seems to still be an issue: @kkaefer @ansis @jfirebaugh Any sense of how much work would be involved with this? We will likely also want the ability to temporarily bring a marker to the front upon selection. /cc @1ec5 |
Seem like it's time to unbundle this into separate followup tickets and close here. |
Yep, agree. I will ticket some off now. |
Thus far Cocoa API is meant to work like Apple's, but we may modify that as @1ec5 and I discuss integration steps. |
@incanus Is it possible to draw routes in the current version? We are using an RMAnnotation with an array of CLLocations at the moment (in mapbox-ios). |
No, routes are coming later. Just points for now. Watch #893. |
@incanus Any update on the work to support routes (polylines) now that Beta 1 is about wrapped up? This is our single biggest need right now and I would very much appreciate your thoughts on possible timing. |
@picciano Shape annotations are one of the major focuses for b2. We'll have better timelines shortly, but we are thinking on the order of weeks. |
"Annotations" is iOS-speak for points and polygons on the basemap with a high-level client-side API.
UIView
objects, or even c) animations of views. These can also all change / be provided at runtime. Markers always remain upright when the map rotates and order themselves in the z-axis from current top-to-bottom of screen, updating continuously as the map rotates. Lastly, marker annotations have callouts, which should be implemented specific to iOS (likely usingSMCalloutView
as our SDK does).MKMapView
,MKAnnotation
,MKAnnotationView
, andMKMapViewDelegate
.MKAnnotation
-derived data object is added (map.addAnnotation(foo)
) .MKMapViewDelegate
is set on a map (map.delegate = bar
).func mapView(map, viewForAnnotation: foo)
).func mapView(map, didSelectAnnotation:foo)
)Will kick off deeper tickets for each of these buildouts as we progress.
The text was updated successfully, but these errors were encountered: