-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Conversation
* {@link MapboxMap#addImage(String, Bitmap)} and link the id of the image with | ||
* {@link com.mapbox.mapboxsdk.style.layers.PropertyFactory#iconImage(String)} when setting properties to a SymbolLayer | ||
* with {@link com.mapbox.mapboxsdk.style.layers.SymbolLayer#setProperties(PropertyValue[])} or | ||
* {@link com.mapbox.mapboxsdk.style.layers.SymbolLayer#withProperties(PropertyValue[])}. |
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.
Could we add a link to an example using the new proposed approach? Explaining the general approach is great but I think that some working code would make the transition easier.
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.
Maybe CustomSymbolLayerActivity
or SymbolGeneratorActivity
if they're reference implementations for the new approach?
@@ -50,7 +50,8 @@ | |||
<string name="activity_query_rendered_features_box_highlight">Highlight features in box</string> | |||
<string name="activity_query_source_features">Query source features</string> | |||
<string name="activity_symbol_layer">Symbols</string> | |||
<string name="activity_add_sprite">Add Custom Sprite</string> | |||
<string name="activity_add_symbol">Add Custom Symbol</string> |
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.
Maybe add a note saying "replaces MarkerView approach"?
Can you speak to the performance of SymbolGenerator compared to MarkerViews with 100, 500, 1,000 markers on the map? |
MarkerViews are Android SDK views synchronized above our rendering surface (currently SurfaceView, optional to switch to TextureView for increased view synchronization performance). What happens for a MarkerView is that the user inflates a View and we will synchronize its position to a LatLng every time the map changes. This synchronization will result in measure and layout phases with every change. With SymbolGenerator we measure the view once and create a bitmap of it, no performance hit while using the map. One difference though is that MarkerView are inflated on the fly but with SymbolGenerator you will be creating your views/bitmaps up front. I'm not really seeing this as an issue as this is the same ux as with SymbolLayer. I will look into creating a more complete example to identify any possible issues with SymbolGenerator initialization when measuring a lot of views. Note that while using the map, the performance will boil down to performance of SymbolLayer which will always outscore MarkerView. |
Did another test with this geojson. This resembles ports in the world and consists out of 1081 points. You can see this is not acceptable in terms of performance (tested on low end device) though the same use-case implemented with |
Thanks for the analysis. So would this be a good characterization of the tradeoff? MarkerViews:
SymbolGenerator:
What about some of the other behaviors listed in #6181?
|
Capturing from internal conversations that we are planning to put the SymbolGenerator code inside a utils plugin instead of the SDK. I'm going to rework this PR to only deprecate MarkerView and point the deprecation notices to use SymbolLayer instead. |
b73b361
to
ed2ae27
Compare
with ed2ae27 the suggestion from #9782 (comment) has been applied. cc @zugaldia |
@@ -14,7 +14,10 @@ | |||
* | |||
* @param <U> Type of the marker view to be composed. | |||
* @param <T> Type of the builder to be used for composing. | |||
* @deprecated Use a {@link com.mapbox.mapboxsdk.style.layers.SymbolLayer} instead. An example of converting Android | |||
* SDK views to be used as a symbol see https://gist.github.com/tobrun/349777a6ef0dfb55245a544344ee197a. |
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.
How about we instead include this approach as an activity in the TestApp while we work on making it available as a plugin?
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.
I added SymbolGeneratorActivity to the testapp, replaced all references to the gist with a permalink to an Activity in the testapp.
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.
@tobrun 👍
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.
If you are on-board with this change, could you re-review?
ec6ecaf
to
7965438
Compare
f31b667
to
68f32bc
Compare
updated the example to use 1 layer for all different used symbols in |
68f32bc
to
2a9bae5
Compare
This PR deprecates the usage of MarkerView and replaces those use-cases with using a
SymbolLayer
+SymbolGenerator
. This allows to benefit from the options that symbolLayer exposes while using any Android SDK View asiconImage
.cc @mapbox/android