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

Annotations API In Android #1716

Closed
Closed

Description

@bleege

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

Activity

  1. added
    Android
    on Jun 12, 2015
  2. added this to the milestone on Jun 12, 2015
  3. added
    GL JS parity
    on Jun 15, 2015
  4. hallahan commented on Jun 29, 2015

    @hallahan
    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.

  5. hallahan commented on Jul 1, 2015

    @hallahan
    Contributor

    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?

  6. hallahan commented on Jul 13, 2015

    @hallahan
    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

  7. tmpsantos commented on Jul 13, 2015

    @tmpsantos
    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").

  8. hallahan commented on Jul 13, 2015

    @hallahan
    Contributor

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

    marker-poc

  9. 32 remaining items

  10. ljbade commented on Oct 24, 2015

    @ljbade
    Contributor

    Done!

  11. bleege commented on Oct 26, 2015

    @bleege
    ContributorAuthor

    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!

  12. ljbade commented on Oct 26, 2015

    @ljbade
    Contributor

    @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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    AndroidGL JS parity

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions