diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..db2eb92e7 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "plugin-annotation/gl-js"] + path = plugin-annotation/gl-js + url = https://github.com/mapbox/mapbox-gl-js diff --git a/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/annotation/SymbolManagerTest.java b/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/annotation/SymbolManagerTest.java index b5e702dbe..5d33fa5f2 100644 --- a/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/annotation/SymbolManagerTest.java +++ b/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/annotation/SymbolManagerTest.java @@ -233,6 +233,19 @@ public void testTextLineHeightAsConstant() { }); } + @Test + public void testTextVariableAnchorAsConstant() { + validateTestSetup(); + setupSymbolManager(); + Timber.i("text-variable-anchor"); + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(symbolManager); + + symbolManager.setTextVariableAnchor(new String[]{TEXT_ANCHOR_RIGHT, TEXT_ANCHOR_TOP}); + assertEquals((String[]) symbolManager.getTextVariableAnchor(), (String[]) new String[]{TEXT_ANCHOR_RIGHT, TEXT_ANCHOR_TOP}); + }); + } + @Test public void testTextMaxAngleAsConstant() { validateTestSetup(); diff --git a/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/annotation/SymbolTest.java b/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/annotation/SymbolTest.java index 115a42c71..9ff42415b 100644 --- a/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/annotation/SymbolTest.java +++ b/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/annotation/SymbolTest.java @@ -44,6 +44,19 @@ private void setupAnnotation() { }); } + @Test + public void testSymbolSortKey() { + validateTestSetup(); + setupAnnotation(); + Timber.i("symbol-sort-key"); + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(symbol); + + symbol.setSymbolSortKey(0.3f); + assertEquals((Float) symbol.getSymbolSortKey(), (Float) 0.3f); + }); + } + @Test public void testIconSize() { validateTestSetup(); @@ -182,8 +195,21 @@ public void testTextJustify() { invoke(mapboxMap, (uiController, mapboxMap) -> { assertNotNull(symbol); - symbol.setTextJustify(TEXT_JUSTIFY_LEFT); - assertEquals((String) symbol.getTextJustify(), (String) TEXT_JUSTIFY_LEFT); + symbol.setTextJustify(TEXT_JUSTIFY_AUTO); + assertEquals((String) symbol.getTextJustify(), (String) TEXT_JUSTIFY_AUTO); + }); + } + + @Test + public void testTextRadialOffset() { + validateTestSetup(); + setupAnnotation(); + Timber.i("text-radial-offset"); + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(symbol); + + symbol.setTextRadialOffset(0.3f); + assertEquals((Float) symbol.getTextRadialOffset(), (Float) 0.3f); }); } diff --git a/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/annotation/SymbolActivity.java b/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/annotation/SymbolActivity.java index 631eb615b..4d6e44a57 100644 --- a/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/annotation/SymbolActivity.java +++ b/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/annotation/SymbolActivity.java @@ -98,7 +98,7 @@ protected void onCreate(Bundle savedInstanceState) { .withLatLng(new LatLng(6.687337, 0.381457)) .withIconImage(ID_ICON_AIRPORT) .withIconSize(1.3f) - .withZIndex(10) + .withSymbolSortKey(10.0f) .withDraggable(true); symbol = symbolManager.create(symbolOptions); Timber.e(symbol.toString()); @@ -109,7 +109,7 @@ protected void onCreate(Bundle savedInstanceState) { .withIconImage(MAKI_ICON_CIRCLE) .withIconColor(ColorUtils.colorToRgbaString(Color.YELLOW)) .withIconSize(2.5f) - .withZIndex(5) + .withSymbolSortKey(5.0f) .withDraggable(true); symbolManager.create(nearbyOptions); @@ -196,7 +196,7 @@ public boolean onOptionsItemSelected(MenuItem item) { } else if (item.getItemId() == R.id.menu_action_text_size) { symbol.setTextSize(22f); } else if (item.getItemId() == R.id.menu_action_z_index) { - symbol.setZIndex(0); + symbol.setSymbolSortKey(0.0f); } else if (item.getItemId() == R.id.menu_action_halo) { symbol.setIconHaloWidth(5.0f); symbol.setIconHaloColor(Color.RED); diff --git a/circle.yml b/circle.yml index 327a5f047..d84849ce0 100644 --- a/circle.yml +++ b/circle.yml @@ -22,6 +22,9 @@ jobs: - run: name: Download Dependencies command: ./gradlew androidDependencies + - run: + name: Init submodules + command: git submodule update --init --recursive - save_cache: paths: - ~/.gradle @@ -85,6 +88,9 @@ jobs: IS_LOCAL_DEVELOPMENT: false steps: - checkout + - run: + name: Init submodules + command: git submodule update --init --recursive - run: name: Generate Maven credentials shell: /bin/bash -euo pipefail diff --git a/plugin-annotation/gl-js b/plugin-annotation/gl-js new file mode 160000 index 000000000..429633d69 --- /dev/null +++ b/plugin-annotation/gl-js @@ -0,0 +1 @@ +Subproject commit 429633d6971b7ce7faa88bbb1f237e4087ce7a19 diff --git a/plugin-annotation/scripts/annotation.java.ejs b/plugin-annotation/scripts/annotation.java.ejs index 095068a41..5606638cd 100644 --- a/plugin-annotation/scripts/annotation.java.ejs +++ b/plugin-annotation/scripts/annotation.java.ejs @@ -54,11 +54,6 @@ public class <%- camelize(type) %> extends Annotation<<%- geometryType(type) %>> annotationManager.enableDataDrivenProperty(<%- camelize(type) %>Options.PROPERTY_<%- snakeCaseUpper(property.name) %>); } <% } -%> -<% } -%> -<% if (type === "symbol") { -%> - if (!(jsonObject.get(<%- camelize(type) %>Options.PROPERTY_Z_INDEX) instanceof JsonNull)) { - annotationManager.enableDataDrivenProperty(<%- camelize(type) %>Options.PROPERTY_Z_INDEX); - } <% } -%> } <% if (type === "circle" || type === "symbol") { -%> @@ -160,32 +155,6 @@ public class <%- camelize(type) %> extends Annotation<<%- geometryType(type) %>> return latLngs; } <% } -%> -<% if (type === "symbol") { -%> - - /** - * Set the z-index of a symbol. - *
- * If a symbol z-index is higher as another symbol it will be rendered above it. - *
- *- * Default value is 0. - *
- * - * @param index the z-index value - */ - public void setZIndex(int index) { - jsonObject.addProperty(<%- camelize(type) %>Options.PROPERTY_Z_INDEX, index); - } - - /** - * Get the z-index of a symbol. - * - * @return the z-index value, 0 if not set - */ - public int getZIndex() { - return jsonObject.get(<%- camelize(type) %>Options.PROPERTY_Z_INDEX).getAsInt(); - } -<% } -%> // Property accessors <% for (const property of properties) { -%> diff --git a/plugin-annotation/scripts/annotation_manager.java.ejs b/plugin-annotation/scripts/annotation_manager.java.ejs index 64a241701..821eced3b 100644 --- a/plugin-annotation/scripts/annotation_manager.java.ejs +++ b/plugin-annotation/scripts/annotation_manager.java.ejs @@ -79,11 +79,7 @@ public class <%- camelize(type) %>Manager extends AnnotationManager<<%- camelize @VisibleForTesting <%- camelize(type) %>Manager(@NonNull MapView mapView, @NonNull MapboxMap mapboxMap, @NonNull Style style, @NonNull CoreElementProvider<<%- camelize(type) %>Layer> coreElementProvider, @Nullable String belowLayerId, @Nullable GeoJsonOptions geoJsonOptions, DraggableAnnotationController<<%- camelize(type) %>, On<%- camelize(type) %>DragListener> draggableAnnotationController) { -<% if (type === "symbol") { -%> - super(mapView, mapboxMap, style, coreElementProvider, new SymbolComparator(), draggableAnnotationController, belowLayerId, geoJsonOptions); -<% } else { -%> - super(mapView, mapboxMap, style, coreElementProvider, null, draggableAnnotationController, belowLayerId, geoJsonOptions); -<% } -%> + super(mapView, mapboxMap, style, coreElementProvider, draggableAnnotationController, belowLayerId, geoJsonOptions); } @Override @@ -92,9 +88,6 @@ public class <%- camelize(type) %>Manager extends AnnotationManager<<%- camelize <% if (supportsPropertyFunction(property)) { -%> dataDrivenPropertyUsageMap.put(<%- camelize(type) %>Options.PROPERTY_<%- snakeCaseUpper(property.name) %>, false); <% } -%> -<% } -%> -<% if (type === "symbol") { -%> - dataDrivenPropertyUsageMap.put(<%- camelize(type) %>Options.PROPERTY_Z_INDEX, false); <% } -%> } @@ -107,11 +100,6 @@ public class <%- camelize(type) %>Manager extends AnnotationManager<<%- camelize layer.setProperties(<%- camelizeWithLeadingLowercase(property.name) %>(get(<%- camelize(type) %>Options.PROPERTY_<%- snakeCaseUpper(property.name) %>))); break; <% } -%> -<% } -%> -<% if (type === "symbol") { -%> - case <%- camelize(type) %>Options.PROPERTY_Z_INDEX: - layer.setProperties(symbolZOrder(Property.SYMBOL_Z_ORDER_SOURCE)); - break; <% } -%> } } @@ -130,9 +118,6 @@ public class <%- camelize(type) %>Manager extends AnnotationManager<<%- camelize * Learn more about above properties in the Style specification. *
* Out of spec properties:
-<% if (type === "symbol") { -%>
- * "z-index" - Integer, z-index of the feature within the manager
-<% } -%>
* "is-draggable" - Boolean, true if the <%- type %> should be draggable, false otherwise
*
* @param json the GeoJSON defining the list of <%- type %>s to build
@@ -157,9 +142,6 @@ public class <%- camelize(type) %>Manager extends AnnotationManager<<%- camelize
* Learn more about above properties in the Style specification.
*
* Out of spec properties:
-<% if (type === "symbol") { -%>
- * "z-index" - Integer, z-index of the feature within the manager
-<% } -%>
* "is-draggable" - Boolean, true if the <%- type %> should be draggable, false otherwise
*
* @param featureCollection the featureCollection defining the list of <%- type %>s to build
diff --git a/plugin-annotation/scripts/annotation_manager_unit_test.junit.ejs b/plugin-annotation/scripts/annotation_manager_unit_test.junit.ejs
index 638289bc4..5b7f6ee24 100644
--- a/plugin-annotation/scripts/annotation_manager_unit_test.junit.ejs
+++ b/plugin-annotation/scripts/annotation_manager_unit_test.junit.ejs
@@ -208,9 +208,6 @@ public class <%- camelize(type) %>ManagerTest {
feature.add<%- propertyType(property) -%>Property("<%- property.name %>", <%- defaultValueJava(property) %>);
<% } -%>
<% } -%>
-<% } -%>
-<% if (type === "symbol") { -%>
- feature.addNumberProperty("z-index", 2);
<% } -%>
feature.addBooleanProperty("is-draggable", true);
@@ -234,9 +231,6 @@ public class <%- camelize(type) %>ManagerTest {
assertEquals(<%- type %>.get<%- camelize(property.name) %>(), <%- defaultValueJava(property) %>);
<% } -%>
<% } -%>
-<% } -%>
-<% if (type === "symbol") { -%>
- assertEquals(<%- type %>.getZIndex(), 2);
<% } -%>
assertTrue(<%- type %>.isDraggable());
}
@@ -465,21 +459,6 @@ public class <%- camelize(type) %>ManagerTest {
<% } -%>
<% } -%>
-<% if (type === "symbol") { -%>
- @Test
- public void testSymbolZOrderLayerProperty() {
- <%- type %>Manager = new <%- camelize(type) %>Manager(mapView, mapboxMap, style, coreElementProvider, null, null, draggableAnnotationController);
- verify(<%- type %>Layer, times(0)).setProperties(argThat(new PropertyValueMatcher(symbolZOrder(Property.SYMBOL_Z_ORDER_SOURCE))));
-
- <%- camelize(type) %>Options options = new <%- camelize(type) %>Options().withLatLng(new LatLng());
- <%- type %>Manager.create(options);
- verify(<%- type %>Layer, times(1)).setProperties(argThat(new PropertyValueMatcher(symbolZOrder(Property.SYMBOL_Z_ORDER_SOURCE))));
-
- <%- type %>Manager.create(options);
- verify(<%- type %>Layer, times(1)).setProperties(argThat(new PropertyValueMatcher(symbolZOrder(Property.SYMBOL_Z_ORDER_SOURCE))));
- }
-<% } -%>
-
@Test
public void test<%- camelize(type) %>LayerFilter() {
<%- type %>Manager = new <%- camelize(type) %>Manager(mapView, mapboxMap, style, coreElementProvider, null, null, draggableAnnotationController);
diff --git a/plugin-annotation/scripts/annotation_options.java.ejs b/plugin-annotation/scripts/annotation_options.java.ejs
index 704fd758e..0b25329d4 100644
--- a/plugin-annotation/scripts/annotation_options.java.ejs
+++ b/plugin-annotation/scripts/annotation_options.java.ejs
@@ -38,17 +38,11 @@ public class <%- camelize(type) %>Options extends Options<<%- camelize(type) %>>
private <%- propertyType(property) %> <%- camelizeWithLeadingLowercase(property.name) %>;
<% } -%>
<% } -%>
-<% if (type === "symbol") { -%>
- private int zIndex;
-<% } -%>
<% for (const property of properties) { -%>
<% if (supportsPropertyFunction(property)) { -%>
static final String PROPERTY_<%- snakeCaseUpper(property.name) %> = "<%- property.name %>";
<% } -%>
-<% } -%>
-<% if (type === "symbol") { -%>
- static final String PROPERTY_Z_INDEX = "z-index";
<% } -%>
private static final String PROPERTY_IS_DRAGGABLE = "is-draggable";
<% for (const property of properties) { -%>
@@ -234,31 +228,6 @@ public class <%- camelize(type) %>Options extends Options<<%- camelize(type) %>>
return geometry;
}
<% } -%>
-<% if (type === "symbol") { -%>
-
- /**
- * Set the zIndex of the symbol, which represents the place of the symbol on the map inside a layer.
- *
- * A higher value brings the symbol to the front. - *
- * - * @param zIndex the z index - * @return this - */ - public SymbolOptions withZIndex(int zIndex) { - this.zIndex = zIndex; - return this; - } - - /** - * Get the zIndex of the symbol, which represents the place of the symbol on the map inside a layer. - * - * @return the z index - */ - public int getZIndex() { - return zIndex; - } -<% } -%> /** * Returns whether this <%- type %> is draggable, meaning it can be dragged across the screen when touched and moved. @@ -314,9 +283,6 @@ public class <%- camelize(type) %>Options extends Options<<%- camelize(type) %>> jsonObject.addProperty(PROPERTY_<%- snakeCaseUpper(property.name) %>, <%- camelizeWithLeadingLowercase(property.name) %>); <% } -%> <% } -%> -<% } -%> -<% if (type === "symbol") { -%> - jsonObject.addProperty(PROPERTY_Z_INDEX, zIndex); <% } -%> <%- camelize(type) %> <%- type %> = new <%- camelize(type) %>(id, annotationManager, jsonObject, geometry); <%- type %>.setDraggable(isDraggable); @@ -357,11 +323,6 @@ public class <%- camelize(type) %>Options extends Options<<%- camelize(type) %>> } <% } -%> <% } -%> -<% } -%> -<% if (type === "symbol") { -%> - if (feature.hasProperty(PROPERTY_Z_INDEX)) { - options.zIndex = feature.getProperty(PROPERTY_Z_INDEX).getAsInt(); - } <% } -%> if (feature.hasProperty(PROPERTY_IS_DRAGGABLE)) { options.isDraggable = feature.getProperty(PROPERTY_IS_DRAGGABLE).getAsBoolean(); diff --git a/plugin-annotation/scripts/code-gen.js b/plugin-annotation/scripts/code-gen.js index 4fa3ae30f..13b447273 100644 --- a/plugin-annotation/scripts/code-gen.js +++ b/plugin-annotation/scripts/code-gen.js @@ -3,7 +3,7 @@ const fs = require('fs'); const ejs = require('ejs'); -const spec = require('./v8'); +const spec = require('./../gl-js/src/style-spec/reference/v8'); const _ = require('lodash'); const path = require('path'); @@ -227,6 +227,9 @@ global.defaultValueJava = function(property) { } if(property.name.endsWith("-font")) { return 'new String[]{"Open Sans Regular", "Arial Unicode MS Regular"}'; + } + if(property.name.endsWith("text-variable-anchor")){ + return 'new String[]{TEXT_ANCHOR_RIGHT, TEXT_ANCHOR_TOP}' } switch (property.type) { case 'boolean': diff --git a/plugin-annotation/scripts/v8.json b/plugin-annotation/scripts/v8.json deleted file mode 100644 index 8ca049c85..000000000 --- a/plugin-annotation/scripts/v8.json +++ /dev/null @@ -1,5527 +0,0 @@ -{ - "$version": 8, - "$root": { - "version": { - "required": true, - "type": "enum", - "values": [ - 8 - ], - "doc": "Style specification version number. Must be 8.", - "example": 8 - }, - "name": { - "type": "string", - "doc": "A human-readable name for the style.", - "example": "Bright" - }, - "metadata": { - "type": "*", - "doc": "Arbitrary properties useful to track with the stylesheet, but do not influence rendering. Properties should be prefixed to avoid collisions, like 'mapbox:'." - }, - "center": { - "type": "array", - "value": "number", - "doc": "Default map center in longitude and latitude. The style center will be used only if the map has not been positioned by other means (e.g. map options or user interaction).", - "example": [ - -73.9749, - 40.7736 - ] - }, - "zoom": { - "type": "number", - "doc": "Default zoom level. The style zoom will be used only if the map has not been positioned by other means (e.g. map options or user interaction).", - "example": 12.5 - }, - "bearing": { - "type": "number", - "default": 0, - "period": 360, - "units": "degrees", - "doc": "Default bearing, in degrees. The bearing is the compass direction that is \"up\"; for example, a bearing of 90° orients the map so that east is up. This value will be used only if the map has not been positioned by other means (e.g. map options or user interaction).", - "example": 29 - }, - "pitch": { - "type": "number", - "default": 0, - "units": "degrees", - "doc": "Default pitch, in degrees. Zero is perpendicular to the surface, for a look straight down at the map, while a greater value like 60 looks ahead towards the horizon. The style pitch will be used only if the map has not been positioned by other means (e.g. map options or user interaction).", - "example": 50 - }, - "light": { - "type": "light", - "doc": "The global light source.", - "example": { - "anchor": "viewport", - "color": "white", - "intensity": 0.4 - } - }, - "sources": { - "required": true, - "type": "sources", - "doc": "Data source specifications.", - "example": { - "mapbox-streets": { - "type": "vector", - "url": "mapbox://mapbox.mapbox-streets-v6" - } - } - }, - "sprite": { - "type": "string", - "doc": "A base URL for retrieving the sprite image and metadata. The extensions `.png`, `.json` and scale factor `@2x.png` will be automatically appended. This property is required if any layer uses the `background-pattern`, `fill-pattern`, `line-pattern`, `fill-extrusion-pattern`, or `icon-image` properties. The URL must be absolute, containing the [scheme, authority and path components](https://en.wikipedia.org/wiki/URL#Syntax).", - "example": "mapbox://sprites/mapbox/bright-v8" - }, - "glyphs": { - "type": "string", - "doc": "A URL template for loading signed-distance-field glyph sets in PBF format. The URL must include `{fontstack}` and `{range}` tokens. This property is required if any layer uses the `text-field` layout property. The URL must be absolute, containing the [scheme, authority and path components](https://en.wikipedia.org/wiki/URL#Syntax).", - "example": "mapbox://fonts/mapbox/{fontstack}/{range}.pbf" - }, - "transition": { - "type": "transition", - "doc": "A global transition definition to use as a default across properties, to be used for timing transitions between one value and the next when no property-specific transition is set. Collision-based symbol fading is controlled independently of the style's `transition` property.", - "example": { - "duration": 300, - "delay": 0 - } - }, - "layers": { - "required": true, - "type": "array", - "value": "layer", - "doc": "Layers will be drawn in the order of this array.", - "example": [ - { - "id": "water", - "source": "mapbox-streets", - "source-layer": "water", - "type": "fill", - "paint": { - "fill-color": "#00ffff" - } - } - ] - } - }, - "sources": { - "*": { - "type": "source", - "doc": "Specification of a data source. For vector and raster sources, either TileJSON or a URL to a TileJSON must be provided. For image and video sources, a URL must be provided. For GeoJSON sources, a URL or inline GeoJSON must be provided." - } - }, - "source": [ - "source_vector", - "source_raster", - "source_raster_dem", - "source_geojson", - "source_video", - "source_image" - ], - "source_vector": { - "type": { - "required": true, - "type": "enum", - "values": { - "vector": { - "doc": "A vector tile source." - } - }, - "doc": "The type of the source." - }, - "url": { - "type": "string", - "doc": "A URL to a TileJSON resource. Supported protocols are `http:`, `https:`, and `mapbox://- * If a symbol z-index is higher as another symbol it will be rendered above it. - *
- *- * Default value is 0. + * Sorts features in ascending order based on this value. Features with a higher sort key will appear above features with a lower sort key when they overlap. Features with a lower sort key will have priority over other features when doing placement. *
* - * @param index the z-index value + * @return property wrapper value around Float */ - public void setZIndex(int index) { - jsonObject.addProperty(SymbolOptions.PROPERTY_Z_INDEX, index); + public Float getSymbolSortKey() { + return jsonObject.get(SymbolOptions.PROPERTY_SYMBOL_SORT_KEY).getAsFloat(); } /** - * Get the z-index of a symbol. + * Set the SymbolSortKey property + *+ * Sorts features in ascending order based on this value. Features with a higher sort key will appear above features with a lower sort key when they overlap. Features with a lower sort key will have priority over other features when doing placement. + *
+ *+ * To update the symbol on the map use {@link SymbolManager#update(Annotation)}. + *
* - * @return the z-index value, 0 if not set + * @param value constant property value for Float */ - public int getZIndex() { - return jsonObject.get(SymbolOptions.PROPERTY_Z_INDEX).getAsInt(); + public void setSymbolSortKey(Float value) { + jsonObject.addProperty(SymbolOptions.PROPERTY_SYMBOL_SORT_KEY, value); } - // Property accessors - /** * Get the IconSize property *
@@ -481,6 +487,33 @@ public void setTextJustify(@Property.TEXT_JUSTIFY String value) { jsonObject.addProperty(SymbolOptions.PROPERTY_TEXT_JUSTIFY, value); } + /** + * Get the TextRadialOffset property + *
+ * Radial offset of text, in the direction of the symbol's anchor. Useful in combination with {@link PropertyFactory#textVariableAnchor}, which doesn't support the two-dimensional {@link PropertyFactory#textOffset}. + *
+ * + * @return property wrapper value around Float + */ + public Float getTextRadialOffset() { + return jsonObject.get(SymbolOptions.PROPERTY_TEXT_RADIAL_OFFSET).getAsFloat(); + } + + /** + * Set the TextRadialOffset property + *+ * Radial offset of text, in the direction of the symbol's anchor. Useful in combination with {@link PropertyFactory#textVariableAnchor}, which doesn't support the two-dimensional {@link PropertyFactory#textOffset}. + *
+ *+ * To update the symbol on the map use {@link SymbolManager#update(Annotation)}. + *
+ * + * @param value constant property value for Float + */ + public void setTextRadialOffset(Float value) { + jsonObject.addProperty(SymbolOptions.PROPERTY_TEXT_RADIAL_OFFSET, value); + } + /** * Get the TextAnchor property *
diff --git a/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/SymbolComparator.java b/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/SymbolComparator.java
deleted file mode 100644
index 1f09536a8..000000000
--- a/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/SymbolComparator.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.mapbox.mapboxsdk.plugins.annotation;
-
-import com.mapbox.geojson.Feature;
-
-import java.util.Comparator;
-
-public class SymbolComparator implements Comparator
* All supported properties are:
* Out of spec properties:
* All supported properties are:
* Out of spec properties:
+ * To increase the chance of placing high-priority labels on the map, you can provide an array of {@link Property.TEXT_ANCHOR} locations: the render will attempt to place the label at each location, in order, before moving onto the next label. Use `text-justify: auto` to choose justification based on anchor position. To apply an offset, use the {@link PropertyFactory#textRadialOffset} instead of the two-dimensional {@link PropertyFactory#textOffset}.
+ *
+ * To increase the chance of placing high-priority labels on the map, you can provide an array of {@link Property.TEXT_ANCHOR} locations: the render will attempt to place the label at each location, in order, before moving onto the next label. Use `text-justify: auto` to choose justification based on anchor position. To apply an offset, use the {@link PropertyFactory#textRadialOffset} instead of the two-dimensional {@link PropertyFactory#textOffset}.
+ *
diff --git a/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/SymbolOptions.java b/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/SymbolOptions.java
index 3ee39bb5d..9e48a4cdd 100644
--- a/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/SymbolOptions.java
+++ b/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/SymbolOptions.java
@@ -28,6 +28,7 @@ public class SymbolOptions extends Options
+ * Sorts features in ascending order based on this value. Features with a higher sort key will appear above features with a lower sort key when they overlap. Features with a lower sort key will have priority over other features when doing placement.
+ *
+ * Sorts features in ascending order based on this value. Features with a higher sort key will appear above features with a lower sort key when they overlap. Features with a lower sort key will have priority over other features when doing placement.
+ *
@@ -347,6 +373,30 @@ public String getTextJustify() {
return textJustify;
}
+ /**
+ * Set text-radial-offset to initialise the symbol with.
+ *
+ * Radial offset of text, in the direction of the symbol's anchor. Useful in combination with {@link PropertyFactory#textVariableAnchor}, which doesn't support the two-dimensional {@link PropertyFactory#textOffset}.
+ *
+ * Radial offset of text, in the direction of the symbol's anchor. Useful in combination with {@link PropertyFactory#textVariableAnchor}, which doesn't support the two-dimensional {@link PropertyFactory#textOffset}.
+ *
@@ -726,29 +776,6 @@ public Point getGeometry() {
return geometry;
}
- /**
- * Set the zIndex of the symbol, which represents the place of the symbol on the map inside a layer.
- *
- * A higher value brings the symbol to the front.
- *
+ * SymbolOptions.PROPERTY_SYMBOL_SORT_KEY - Float
* SymbolOptions.PROPERTY_ICON_SIZE - Float
* SymbolOptions.PROPERTY_ICON_IMAGE - String
* SymbolOptions.PROPERTY_ICON_ROTATE - Float
@@ -228,6 +234,7 @@ protected void setDataDrivenPropertyIsUsed(@NonNull String property) {
* SymbolOptions.PROPERTY_TEXT_MAX_WIDTH - Float
* SymbolOptions.PROPERTY_TEXT_LETTER_SPACING - Float
* SymbolOptions.PROPERTY_TEXT_JUSTIFY - String
+ * SymbolOptions.PROPERTY_TEXT_RADIAL_OFFSET - Float
* SymbolOptions.PROPERTY_TEXT_ANCHOR - String
* SymbolOptions.PROPERTY_TEXT_ROTATE - Float
* SymbolOptions.PROPERTY_TEXT_TRANSFORM - String
@@ -245,7 +252,6 @@ protected void setDataDrivenPropertyIsUsed(@NonNull String property) {
* Learn more about above properties in the Style specification.
*
- * "z-index" - Integer, z-index of the feature within the manager
* "is-draggable" - Boolean, true if the symbol should be draggable, false otherwise
*
* @param json the GeoJSON defining the list of symbols to build
@@ -262,6 +268,7 @@ public List
+ * SymbolOptions.PROPERTY_SYMBOL_SORT_KEY - Float
* SymbolOptions.PROPERTY_ICON_SIZE - Float
* SymbolOptions.PROPERTY_ICON_IMAGE - String
* SymbolOptions.PROPERTY_ICON_ROTATE - Float
@@ -273,6 +280,7 @@ public List
* SymbolOptions.PROPERTY_TEXT_LETTER_SPACING - Float
* SymbolOptions.PROPERTY_TEXT_JUSTIFY - String
+ * SymbolOptions.PROPERTY_TEXT_RADIAL_OFFSET - Float
* SymbolOptions.PROPERTY_TEXT_ANCHOR - String
* SymbolOptions.PROPERTY_TEXT_ROTATE - Float
* SymbolOptions.PROPERTY_TEXT_TRANSFORM - String
@@ -290,7 +298,6 @@ public List
- * "z-index" - Integer, z-index of the feature within the manager
* "is-draggable" - Boolean, true if the symbol should be draggable, false otherwise
*
* @param featureCollection the featureCollection defining the list of symbols to build
@@ -712,6 +719,32 @@ public void setTextLineHeight( Float value) {
layer.setProperties(propertyValue);
}
+ /**
+ * Get the TextVariableAnchor property
+ *