Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Annotations API In Android #1716

Closed
bleege opened this issue Jun 12, 2015 · 14 comments
Closed

Annotations API In Android #1716

bleege opened this issue Jun 12, 2015 · 14 comments
Labels
Android Mapbox Maps SDK for Android GL JS parity For feature parity with Mapbox GL JS

Comments

@bleege
Copy link
Contributor

bleege commented Jun 12, 2015

Implement marker annotations in Android similar to how it was implemented in iOS in ecb8e28.

@bleege bleege added the Android Mapbox Maps SDK for Android label Jun 12, 2015
@bleege bleege added this to the Android Beta milestone Jun 12, 2015
@ljbade ljbade added the GL JS parity For feature parity with Mapbox GL JS label Jun 15, 2015
@hallahan
Copy link
Contributor

I forked the repo and am working on a branch that attempts to add a point annotation to the map via a call to the native Map::addPointAnnotation.

hallahan@ef31fc5

The JNI part of things is straightforward, and I have verified that addPointAnnotation in the C++ Map is indeed being called. However, my single point annotation is not successfully rendering on the map.

I'm studying how annotations work in the core library in this MapboxGL Native Annotations Walkthrough. @incanus, one conceptual question I have deals with that final conversion to the vector space of a tile for a given point:

const Coordinate coordinate(extent * (pp.x * z2 - x), extent * (pp.y * z2 - y));

We just computed x, which is a 32 bit unsigned int. We then do pp.x * z2 - x which just subtracts the truncated int from the complete double. How does that then relate to determine the correct coordinate in the vector space of the given tile?

I was able to follow the code through setting up the annotation vector tiles as well as telling the map what to update.

Where do I look to learn about how that actual sprite is rendered on the map? My guess is that the actual problem here is that somehow the sprite itself is not being rendered in Android. I don't think the problem at hand is involved with the cutting of the annotation vector tiles.

@hallahan
Copy link
Contributor

hallahan commented Jul 1, 2015

Note, stepping through all of the function calls mentioned in the point annotation walkthrough seem to execute fine when poking around my android device in gdb. My thought is that the annotation is actually added to the map just fine. Maybe the marker sprite is just not being rendered?

@hallahan
Copy link
Contributor

I am currently working on the annotation proof of concept of adding a single marker to the map via the Android MapView. I have my own fork/branch of MapboxGL where I have simply added a basic addAnnotation(LatLng latLng) as well as a simple MenuItem to toggle on and off a marker.

screenshot_2015-07-13-10-46-09

We then call the native addPointAnnotation via a JNI call.

Extending the Java API seems straightforward, however, there is a problem with actually rendering this marker on the map. Calling addPointAnnotation on the native map view appears to be behaving normally. Stepping through (in gdb) all of the calls of auto result = data->annotationManager.addPointAnnotations(points, properties, getMaxZoom()); appears to be behaving normally when comparing to what happens in the XCode debugger on iOS.

My suspicion is that there is a problem loading that default_marker glyph that we have in iOS for markers. It looks like this marker comes from somewhere other than the standard glyps in MapboxGL, specifically for annotations. Could someone help point out:

Where do glyphs get loaded, in specific, default_marker, and how is that loaded in the texture buffer for GL to render?

screenshot 2015-07-13 11 08 58

I will continue to trace through what happens in the MapContext::updateAnnotationTiles call on the map thread, however, I was hoping to get a bit of a tour of the architecture and code with this specific part of the rendering pipeline. In particular, how do marker annotations integrate?

cc @kkaefer @tmpsantos

@tmpsantos
Copy link
Contributor

We then call the native addPointAnnotation via a JNI call.

nativeMapView->getMap().addPointAnnotation(mbgl::LatLng(latitude, longitude), std::string(""));

Try using std::string("default_marker").

@hallahan
Copy link
Contributor

Thank you @tmpsantos. We now have our first marker annotation on MapboxGL Android!

marker-poc

hallahan added a commit to hallahan/mapbox-gl-native that referenced this issue Jul 13, 2015
hallahan added a commit to hallahan/mapbox-gl-native that referenced this issue Jul 14, 2015
hallahan added a commit to hallahan/mapbox-gl-native that referenced this issue Jul 15, 2015
hallahan added a commit to hallahan/mapbox-gl-native that referenced this issue Jul 15, 2015
hallahan added a commit to hallahan/mapbox-gl-native that referenced this issue Jul 15, 2015
hallahan added a commit to hallahan/mapbox-gl-native that referenced this issue Jul 15, 2015
hallahan added a commit to hallahan/mapbox-gl-native that referenced this issue Jul 15, 2015
hallahan added a commit to hallahan/mapbox-gl-native that referenced this issue Jul 16, 2015
hallahan added a commit to hallahan/mapbox-gl-native that referenced this issue Jul 16, 2015
hallahan added a commit to hallahan/mapbox-gl-native that referenced this issue Jul 16, 2015
hallahan added a commit to hallahan/mapbox-gl-native that referenced this issue Jul 16, 2015
hallahan added a commit to hallahan/mapbox-gl-native that referenced this issue Jul 16, 2015
hallahan added a commit to hallahan/mapbox-gl-native that referenced this issue Jul 16, 2015
hallahan added a commit to hallahan/mapbox-gl-native that referenced this issue Jul 16, 2015
hallahan added a commit to hallahan/mapbox-gl-native that referenced this issue Jul 16, 2015
@hallahan
Copy link
Contributor

screenshot_2015-07-16-10-23-19

hallahan added a commit to hallahan/mapbox-gl-native that referenced this issue Jul 16, 2015
hallahan added a commit to hallahan/mapbox-gl-native that referenced this issue Jul 16, 2015
hallahan added a commit to hallahan/mapbox-gl-native that referenced this issue Jul 16, 2015
hallahan added a commit to hallahan/mapbox-gl-native that referenced this issue Jul 16, 2015
hallahan added a commit to hallahan/mapbox-gl-native that referenced this issue Jul 16, 2015
hallahan added a commit to hallahan/mapbox-gl-native that referenced this issue Jul 17, 2015
@incanus
Copy link
Contributor

incanus commented Jul 30, 2015

Is this complete or do we still need to build out parity @bleege?

@bleege
Copy link
Contributor Author

bleege commented Jul 31, 2015

Overall, I think we're in good shape here as @hallahan did a great job laying the foundation. There are still a few a TODOs and higher level features like geodesic polylines that are still to be built out.

@bleege
Copy link
Contributor Author

bleege commented Aug 31, 2015

Bumping to 0.2.0 to finish the remaining features mentioned above.

Popups are being handled in #894

@ljbade
Copy link
Contributor

ljbade commented Oct 24, 2015

Done!

@ljbade ljbade closed this as completed Oct 24, 2015
@bleege
Copy link
Contributor Author

bleege commented Oct 26, 2015

Done!

@ljbade Could you comment a bit on why you believe this is "Done"? What changed since the 31-Aug-2015 comment? I see that #1726 has been ticketed out separately, but it's unclear what else was finished. Thanks!

@ljbade
Copy link
Contributor

ljbade commented Oct 26, 2015

@bleege Well we implemented all features of iOS SDK annotations since #2744 and #2726

Finally I have removed all annotation properties that are not supported in Core GL.

So the original aim of this ticket to reach parity with iOS has been achieved.

AndwareSsj pushed a commit to AndwareSsj/mapbox-gl-native that referenced this issue Nov 6, 2015
AndwareSsj pushed a commit to AndwareSsj/mapbox-gl-native that referenced this issue Nov 6, 2015
AndwareSsj pushed a commit to AndwareSsj/mapbox-gl-native that referenced this issue Nov 6, 2015
AndwareSsj pushed a commit to AndwareSsj/mapbox-gl-native that referenced this issue Nov 6, 2015
AndwareSsj pushed a commit to AndwareSsj/mapbox-gl-native that referenced this issue Nov 6, 2015
AndwareSsj pushed a commit to AndwareSsj/mapbox-gl-native that referenced this issue Nov 6, 2015
AndwareSsj pushed a commit to AndwareSsj/mapbox-gl-native that referenced this issue Nov 6, 2015
AndwareSsj pushed a commit to AndwareSsj/mapbox-gl-native that referenced this issue Nov 6, 2015
AndwareSsj pushed a commit to AndwareSsj/mapbox-gl-native that referenced this issue Nov 6, 2015
AndwareSsj pushed a commit to AndwareSsj/mapbox-gl-native that referenced this issue Nov 6, 2015
AndwareSsj pushed a commit to AndwareSsj/mapbox-gl-native that referenced this issue Nov 6, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android GL JS parity For feature parity with Mapbox GL JS
Projects
None yet
Development

No branches or pull requests

5 participants