From dbaad6312bb2ec178a14a4acf919b52baf74d603 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Paczos?= Date: Tue, 14 Apr 2020 13:15:24 +0200 Subject: [PATCH] hide the LocationIndicatorLayer impl --- .../src/cpp/style/layers/background_layer.cpp | 2 +- .../src/cpp/style/layers/background_layer.hpp | 2 +- .../src/cpp/style/layers/circle_layer.cpp | 2 +- .../src/cpp/style/layers/circle_layer.hpp | 2 +- .../cpp/style/layers/fill_extrusion_layer.cpp | 2 +- .../cpp/style/layers/fill_extrusion_layer.hpp | 2 +- .../src/cpp/style/layers/fill_layer.cpp | 2 +- .../src/cpp/style/layers/fill_layer.hpp | 2 +- .../src/cpp/style/layers/heatmap_layer.cpp | 2 +- .../src/cpp/style/layers/heatmap_layer.hpp | 2 +- .../src/cpp/style/layers/hillshade_layer.cpp | 2 +- .../src/cpp/style/layers/hillshade_layer.hpp | 2 +- .../src/cpp/style/layers/layer.cpp.ejs | 2 +- .../src/cpp/style/layers/layer.hpp.ejs | 6 +- .../src/cpp/style/layers/line_layer.cpp | 2 +- .../src/cpp/style/layers/line_layer.hpp | 2 +- .../style/layers/location_indicator_layer.cpp | 2 +- .../style/layers/location_indicator_layer.hpp | 4 +- .../src/cpp/style/layers/raster_layer.cpp | 2 +- .../src/cpp/style/layers/raster_layer.hpp | 2 +- .../src/cpp/style/layers/symbol_layer.cpp | 2 +- .../src/cpp/style/layers/symbol_layer.hpp | 2 +- .../IndicatorLocationLayerRenderer.java | 27 +- .../location/LayerSourceProvider.java | 6 +- .../LocationIndicatorLayer.java | 68 +--- .../location/LocationPropertyFactory.java | 312 ++++++++++++++++++ .../style/layers/BackgroundLayer.java | 2 +- .../mapboxsdk/style/layers/CircleLayer.java | 2 +- .../style/layers/FillExtrusionLayer.java | 2 +- .../mapboxsdk/style/layers/FillLayer.java | 2 +- .../mapboxsdk/style/layers/HeatmapLayer.java | 2 +- .../style/layers/HillshadeLayer.java | 2 +- .../style/layers/LayoutPropertyValue.java | 4 +- .../mapboxsdk/style/layers/LineLayer.java | 2 +- .../style/layers/PaintPropertyValue.java | 4 +- .../mapboxsdk/style/layers/Property.java | 2 +- .../style/layers/PropertyFactory.java | 282 +--------------- .../mapboxsdk/style/layers/RasterLayer.java | 2 +- .../mapboxsdk/style/layers/SymbolLayer.java | 2 +- .../mapboxsdk/style/layers/layer.java.ejs | 18 +- .../mapboxsdk/style/layers/property.java.ejs | 2 +- .../style/layers/property_factory.java.ejs | 17 +- .../mapbox/mapboxsdk/style/light/Light.java | 2 +- .../mapboxsdk/style/light/light.java.ejs | 2 +- .../LocationIndicatorLayerTest.java | 7 +- .../testapp/style/BackgroundLayerTest.java | 2 +- .../testapp/style/CircleLayerTest.java | 2 +- .../testapp/style/FillExtrusionLayerTest.java | 2 +- .../testapp/style/FillLayerTest.java | 2 +- .../testapp/style/HeatmapLayerTest.java | 2 +- .../testapp/style/HillshadeLayerTest.java | 2 +- .../testapp/style/LineLayerTest.java | 2 +- .../testapp/style/RasterLayerTest.java | 2 +- .../testapp/style/SymbolLayerTest.java | 2 +- .../mapboxsdk/testapp/style/layer.junit.ejs | 12 +- scripts/generate-style-code.js | 55 ++- 56 files changed, 476 insertions(+), 430 deletions(-) rename MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/{style/layers => location}/LocationIndicatorLayer.java (90%) create mode 100644 MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationPropertyFactory.java rename MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/{testapp/style => location}/LocationIndicatorLayerTest.java (96%) diff --git a/MapboxGLAndroidSDK/src/cpp/style/layers/background_layer.cpp b/MapboxGLAndroidSDK/src/cpp/style/layers/background_layer.cpp index d0084dc2d..99fb75cc0 100644 --- a/MapboxGLAndroidSDK/src/cpp/style/layers/background_layer.cpp +++ b/MapboxGLAndroidSDK/src/cpp/style/layers/background_layer.cpp @@ -1,4 +1,4 @@ -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. +// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. #include "background_layer.hpp" diff --git a/MapboxGLAndroidSDK/src/cpp/style/layers/background_layer.hpp b/MapboxGLAndroidSDK/src/cpp/style/layers/background_layer.hpp index e402dc021..8958c929e 100644 --- a/MapboxGLAndroidSDK/src/cpp/style/layers/background_layer.hpp +++ b/MapboxGLAndroidSDK/src/cpp/style/layers/background_layer.hpp @@ -1,4 +1,4 @@ -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. +// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. #pragma once diff --git a/MapboxGLAndroidSDK/src/cpp/style/layers/circle_layer.cpp b/MapboxGLAndroidSDK/src/cpp/style/layers/circle_layer.cpp index 705bb9136..f51e2dae9 100644 --- a/MapboxGLAndroidSDK/src/cpp/style/layers/circle_layer.cpp +++ b/MapboxGLAndroidSDK/src/cpp/style/layers/circle_layer.cpp @@ -1,4 +1,4 @@ -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. +// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. #include "circle_layer.hpp" diff --git a/MapboxGLAndroidSDK/src/cpp/style/layers/circle_layer.hpp b/MapboxGLAndroidSDK/src/cpp/style/layers/circle_layer.hpp index daa28571b..ee95656d6 100644 --- a/MapboxGLAndroidSDK/src/cpp/style/layers/circle_layer.hpp +++ b/MapboxGLAndroidSDK/src/cpp/style/layers/circle_layer.hpp @@ -1,4 +1,4 @@ -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. +// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. #pragma once diff --git a/MapboxGLAndroidSDK/src/cpp/style/layers/fill_extrusion_layer.cpp b/MapboxGLAndroidSDK/src/cpp/style/layers/fill_extrusion_layer.cpp index 9b7c66a0a..0d1d107b1 100644 --- a/MapboxGLAndroidSDK/src/cpp/style/layers/fill_extrusion_layer.cpp +++ b/MapboxGLAndroidSDK/src/cpp/style/layers/fill_extrusion_layer.cpp @@ -1,4 +1,4 @@ -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. +// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. #include "fill_extrusion_layer.hpp" diff --git a/MapboxGLAndroidSDK/src/cpp/style/layers/fill_extrusion_layer.hpp b/MapboxGLAndroidSDK/src/cpp/style/layers/fill_extrusion_layer.hpp index 6f0a24131..aa478e422 100644 --- a/MapboxGLAndroidSDK/src/cpp/style/layers/fill_extrusion_layer.hpp +++ b/MapboxGLAndroidSDK/src/cpp/style/layers/fill_extrusion_layer.hpp @@ -1,4 +1,4 @@ -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. +// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. #pragma once diff --git a/MapboxGLAndroidSDK/src/cpp/style/layers/fill_layer.cpp b/MapboxGLAndroidSDK/src/cpp/style/layers/fill_layer.cpp index ba6ed2179..8b33c8077 100644 --- a/MapboxGLAndroidSDK/src/cpp/style/layers/fill_layer.cpp +++ b/MapboxGLAndroidSDK/src/cpp/style/layers/fill_layer.cpp @@ -1,4 +1,4 @@ -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. +// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. #include "fill_layer.hpp" diff --git a/MapboxGLAndroidSDK/src/cpp/style/layers/fill_layer.hpp b/MapboxGLAndroidSDK/src/cpp/style/layers/fill_layer.hpp index 807b939a7..592d951f2 100644 --- a/MapboxGLAndroidSDK/src/cpp/style/layers/fill_layer.hpp +++ b/MapboxGLAndroidSDK/src/cpp/style/layers/fill_layer.hpp @@ -1,4 +1,4 @@ -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. +// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. #pragma once diff --git a/MapboxGLAndroidSDK/src/cpp/style/layers/heatmap_layer.cpp b/MapboxGLAndroidSDK/src/cpp/style/layers/heatmap_layer.cpp index dfb8bbb4b..686e44c3a 100644 --- a/MapboxGLAndroidSDK/src/cpp/style/layers/heatmap_layer.cpp +++ b/MapboxGLAndroidSDK/src/cpp/style/layers/heatmap_layer.cpp @@ -1,4 +1,4 @@ -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. +// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. #include "heatmap_layer.hpp" diff --git a/MapboxGLAndroidSDK/src/cpp/style/layers/heatmap_layer.hpp b/MapboxGLAndroidSDK/src/cpp/style/layers/heatmap_layer.hpp index f56e3eb4a..15b24b147 100644 --- a/MapboxGLAndroidSDK/src/cpp/style/layers/heatmap_layer.hpp +++ b/MapboxGLAndroidSDK/src/cpp/style/layers/heatmap_layer.hpp @@ -1,4 +1,4 @@ -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. +// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. #pragma once diff --git a/MapboxGLAndroidSDK/src/cpp/style/layers/hillshade_layer.cpp b/MapboxGLAndroidSDK/src/cpp/style/layers/hillshade_layer.cpp index 3c72b503b..fa094f9ae 100644 --- a/MapboxGLAndroidSDK/src/cpp/style/layers/hillshade_layer.cpp +++ b/MapboxGLAndroidSDK/src/cpp/style/layers/hillshade_layer.cpp @@ -1,4 +1,4 @@ -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. +// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. #include "hillshade_layer.hpp" diff --git a/MapboxGLAndroidSDK/src/cpp/style/layers/hillshade_layer.hpp b/MapboxGLAndroidSDK/src/cpp/style/layers/hillshade_layer.hpp index bc210a998..0c5d489ee 100644 --- a/MapboxGLAndroidSDK/src/cpp/style/layers/hillshade_layer.hpp +++ b/MapboxGLAndroidSDK/src/cpp/style/layers/hillshade_layer.hpp @@ -1,4 +1,4 @@ -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. +// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. #pragma once diff --git a/MapboxGLAndroidSDK/src/cpp/style/layers/layer.cpp.ejs b/MapboxGLAndroidSDK/src/cpp/style/layers/layer.cpp.ejs index 79df91791..d72fbc2c9 100644 --- a/MapboxGLAndroidSDK/src/cpp/style/layers/layer.cpp.ejs +++ b/MapboxGLAndroidSDK/src/cpp/style/layers/layer.cpp.ejs @@ -2,7 +2,7 @@ const type = locals.type; const properties = locals.properties; -%> -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. +// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. #include "<%- type.replace('-', '_') %>_layer.hpp" diff --git a/MapboxGLAndroidSDK/src/cpp/style/layers/layer.hpp.ejs b/MapboxGLAndroidSDK/src/cpp/style/layers/layer.hpp.ejs index 05fe925c8..771ffd664 100644 --- a/MapboxGLAndroidSDK/src/cpp/style/layers/layer.hpp.ejs +++ b/MapboxGLAndroidSDK/src/cpp/style/layers/layer.hpp.ejs @@ -2,7 +2,7 @@ const type = locals.type; const properties = locals.properties; -%> -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. +// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. #pragma once @@ -18,7 +18,11 @@ namespace android { class <%- camelize(type) %>Layer : public Layer { public: using SuperTag = Layer; +<% if (type === 'location-indicator') { -%> + static constexpr auto Name() { return "com/mapbox/mapboxsdk/location/<%- camelize(type) %>Layer"; }; +<% } else { -%> static constexpr auto Name() { return "com/mapbox/mapboxsdk/style/layers/<%- camelize(type) %>Layer"; }; +<% } -%> <% if (type === 'background' || type === 'location-indicator') { -%> <%- camelize(type) %>Layer(jni::JNIEnv&, jni::String&); diff --git a/MapboxGLAndroidSDK/src/cpp/style/layers/line_layer.cpp b/MapboxGLAndroidSDK/src/cpp/style/layers/line_layer.cpp index bf3a403b6..bc05c41a1 100644 --- a/MapboxGLAndroidSDK/src/cpp/style/layers/line_layer.cpp +++ b/MapboxGLAndroidSDK/src/cpp/style/layers/line_layer.cpp @@ -1,4 +1,4 @@ -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. +// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. #include "line_layer.hpp" diff --git a/MapboxGLAndroidSDK/src/cpp/style/layers/line_layer.hpp b/MapboxGLAndroidSDK/src/cpp/style/layers/line_layer.hpp index 25b270fbc..1a53b9e32 100644 --- a/MapboxGLAndroidSDK/src/cpp/style/layers/line_layer.hpp +++ b/MapboxGLAndroidSDK/src/cpp/style/layers/line_layer.hpp @@ -1,4 +1,4 @@ -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. +// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. #pragma once diff --git a/MapboxGLAndroidSDK/src/cpp/style/layers/location_indicator_layer.cpp b/MapboxGLAndroidSDK/src/cpp/style/layers/location_indicator_layer.cpp index 7b2f36b4f..9e6429792 100644 --- a/MapboxGLAndroidSDK/src/cpp/style/layers/location_indicator_layer.cpp +++ b/MapboxGLAndroidSDK/src/cpp/style/layers/location_indicator_layer.cpp @@ -1,4 +1,4 @@ -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. +// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. #include "location_indicator_layer.hpp" diff --git a/MapboxGLAndroidSDK/src/cpp/style/layers/location_indicator_layer.hpp b/MapboxGLAndroidSDK/src/cpp/style/layers/location_indicator_layer.hpp index 6b7621efd..81a20d793 100644 --- a/MapboxGLAndroidSDK/src/cpp/style/layers/location_indicator_layer.hpp +++ b/MapboxGLAndroidSDK/src/cpp/style/layers/location_indicator_layer.hpp @@ -1,4 +1,4 @@ -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. +// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. #pragma once @@ -14,7 +14,7 @@ namespace android { class LocationIndicatorLayer : public Layer { public: using SuperTag = Layer; - static constexpr auto Name() { return "com/mapbox/mapboxsdk/style/layers/LocationIndicatorLayer"; }; + static constexpr auto Name() { return "com/mapbox/mapboxsdk/location/LocationIndicatorLayer"; }; LocationIndicatorLayer(jni::JNIEnv&, jni::String&); diff --git a/MapboxGLAndroidSDK/src/cpp/style/layers/raster_layer.cpp b/MapboxGLAndroidSDK/src/cpp/style/layers/raster_layer.cpp index 53442c0a9..759161aeb 100644 --- a/MapboxGLAndroidSDK/src/cpp/style/layers/raster_layer.cpp +++ b/MapboxGLAndroidSDK/src/cpp/style/layers/raster_layer.cpp @@ -1,4 +1,4 @@ -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. +// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. #include "raster_layer.hpp" diff --git a/MapboxGLAndroidSDK/src/cpp/style/layers/raster_layer.hpp b/MapboxGLAndroidSDK/src/cpp/style/layers/raster_layer.hpp index bbda2e0c5..4c3d6b19c 100644 --- a/MapboxGLAndroidSDK/src/cpp/style/layers/raster_layer.hpp +++ b/MapboxGLAndroidSDK/src/cpp/style/layers/raster_layer.hpp @@ -1,4 +1,4 @@ -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. +// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. #pragma once diff --git a/MapboxGLAndroidSDK/src/cpp/style/layers/symbol_layer.cpp b/MapboxGLAndroidSDK/src/cpp/style/layers/symbol_layer.cpp index 198dbe635..6abf5fd73 100644 --- a/MapboxGLAndroidSDK/src/cpp/style/layers/symbol_layer.cpp +++ b/MapboxGLAndroidSDK/src/cpp/style/layers/symbol_layer.cpp @@ -1,4 +1,4 @@ -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. +// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. #include "symbol_layer.hpp" diff --git a/MapboxGLAndroidSDK/src/cpp/style/layers/symbol_layer.hpp b/MapboxGLAndroidSDK/src/cpp/style/layers/symbol_layer.hpp index 4898c830d..f51cdb4e3 100644 --- a/MapboxGLAndroidSDK/src/cpp/style/layers/symbol_layer.hpp +++ b/MapboxGLAndroidSDK/src/cpp/style/layers/symbol_layer.hpp @@ -1,4 +1,4 @@ -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. +// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. #pragma once diff --git a/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/IndicatorLocationLayerRenderer.java b/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/IndicatorLocationLayerRenderer.java index 6f4f0080d..d9ae215dd 100644 --- a/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/IndicatorLocationLayerRenderer.java +++ b/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/IndicatorLocationLayerRenderer.java @@ -8,8 +8,6 @@ import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.location.modes.RenderMode; import com.mapbox.mapboxsdk.maps.Style; import com.mapbox.mapboxsdk.style.expressions.Expression; -import com.mapbox.mapboxsdk.style.layers.LocationIndicatorLayer; -import com.mapbox.mapboxsdk.style.layers.PropertyFactory; import com.mapbox.mapboxsdk.utils.BitmapUtils; import com.mapbox.mapboxsdk.utils.ColorUtils; @@ -23,7 +21,6 @@ import static com.mapbox.mapboxsdk.location.LocationComponentConstants.SHADOW_IC import static com.mapbox.mapboxsdk.style.expressions.Expression.rgba; import static com.mapbox.mapboxsdk.style.layers.Property.NONE; import static com.mapbox.mapboxsdk.style.layers.Property.VISIBLE; -import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.visibility; class IndicatorLocationLayerRenderer implements LocationLayerRenderer { @@ -84,8 +81,8 @@ class IndicatorLocationLayerRenderer implements LocationLayerRenderer { colorArray[3] = accuracyAlpha; Expression rgbaExpression = rgba(colorArray[0], colorArray[1], colorArray[2], colorArray[3]); layer.setProperties( - PropertyFactory.accuracyRadiusColor(rgbaExpression), - PropertyFactory.accuracyRadiusBorderColor(rgbaExpression) + LocationPropertyFactory.accuracyRadiusColor(rgbaExpression), + LocationPropertyFactory.accuracyRadiusBorderColor(rgbaExpression) ); } @@ -107,16 +104,16 @@ class IndicatorLocationLayerRenderer implements LocationLayerRenderer { @Override public void setAccuracyRadius(Float accuracy) { layer.setProperties( - PropertyFactory.accuracyRadius(accuracy) + LocationPropertyFactory.accuracyRadius(accuracy) ); } @Override public void styleScaling(Expression scaleExpression) { layer.setProperties( - PropertyFactory.shadowImageSize(scaleExpression), - PropertyFactory.bearingImageSize(scaleExpression), - PropertyFactory.topImageSize(scaleExpression) + LocationPropertyFactory.shadowImageSize(scaleExpression), + LocationPropertyFactory.bearingImageSize(scaleExpression), + LocationPropertyFactory.topImageSize(scaleExpression) ); } @@ -160,7 +157,7 @@ class IndicatorLocationLayerRenderer implements LocationLayerRenderer { } private void setLayerVisibility(boolean visible) { - layer.setProperties(visibility(visible ? VISIBLE : NONE)); + layer.setProperties(LocationPropertyFactory.visibility(visible ? VISIBLE : NONE)); } private void setLayerLocation(@Nullable LatLng latLng) { @@ -168,14 +165,14 @@ class IndicatorLocationLayerRenderer implements LocationLayerRenderer { if (latLng != null) { Double[] values = new Double[] {latLng.getLatitude(), latLng.getLongitude(), 0d}; layer.setProperties( - PropertyFactory.location(values) + LocationPropertyFactory.location(values) ); } } private void setLayerBearing(double bearing) { layer.setProperties( - PropertyFactory.bearing(bearing) + LocationPropertyFactory.bearing(bearing) ); } @@ -203,9 +200,9 @@ class IndicatorLocationLayerRenderer implements LocationLayerRenderer { break; } layer.setProperties( - PropertyFactory.topImage(topImage), - PropertyFactory.bearingImage(bearingImage), - PropertyFactory.shadowImage(shadowImage) + LocationPropertyFactory.topImage(topImage), + LocationPropertyFactory.bearingImage(bearingImage), + LocationPropertyFactory.shadowImage(shadowImage) ); } } diff --git a/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LayerSourceProvider.java b/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LayerSourceProvider.java index 2d3e969ec..d33206f10 100644 --- a/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LayerSourceProvider.java +++ b/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LayerSourceProvider.java @@ -5,9 +5,7 @@ import androidx.annotation.NonNull; import com.mapbox.geojson.Feature; import com.mapbox.mapboxsdk.style.layers.CircleLayer; import com.mapbox.mapboxsdk.style.layers.Layer; -import com.mapbox.mapboxsdk.style.layers.LocationIndicatorLayer; import com.mapbox.mapboxsdk.style.layers.Property; -import com.mapbox.mapboxsdk.style.layers.PropertyFactory; import com.mapbox.mapboxsdk.style.layers.SymbolLayer; import com.mapbox.mapboxsdk.style.sources.GeoJsonOptions; import com.mapbox.mapboxsdk.style.sources.GeoJsonSource; @@ -122,8 +120,8 @@ class LayerSourceProvider { LocationIndicatorLayer generateLocationComponentLayer() { LocationIndicatorLayer layer = new LocationIndicatorLayer(FOREGROUND_LAYER); layer.setProperties( - PropertyFactory.perspectiveCompensation(0.9f), - PropertyFactory.imageTiltDisplacement(4f) + LocationPropertyFactory.perspectiveCompensation(0.9f), + LocationPropertyFactory.imageTiltDisplacement(4f) ); return layer; } diff --git a/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/LocationIndicatorLayer.java b/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationIndicatorLayer.java similarity index 90% rename from MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/LocationIndicatorLayer.java rename to MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationIndicatorLayer.java index eefd65924..9399c8fa3 100644 --- a/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/LocationIndicatorLayer.java +++ b/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationIndicatorLayer.java @@ -1,6 +1,6 @@ -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. +// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. -package com.mapbox.mapboxsdk.style.layers; +package com.mapbox.mapboxsdk.location; import androidx.annotation.ColorInt; import androidx.annotation.Keep; @@ -14,6 +14,8 @@ import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.mapbox.mapboxsdk.style.expressions.Expression; import com.mapbox.mapboxsdk.style.layers.TransitionOptions; +import com.mapbox.mapboxsdk.style.layers.Layer; +import com.mapbox.mapboxsdk.style.layers.PropertyValue; /** * @@ -21,7 +23,7 @@ import com.mapbox.mapboxsdk.style.layers.TransitionOptions; * @see The online documentation */ @UiThread -public class LocationIndicatorLayer extends Layer { +class LocationIndicatorLayer extends Layer { /** * Creates a LocationIndicatorLayer. @@ -46,66 +48,6 @@ public class LocationIndicatorLayer extends Layer { @Keep protected native void initialize(String layerId); - /** - * Get the source id. - * - * @return id of the source - */ - @NonNull - public String getSourceId() { - checkThread(); - return nativeGetSourceId(); - } - - /** - * Get the source layer. - * - * @return sourceLayer the source layer to get - */ - @NonNull - public String getSourceLayer() { - checkThread(); - return nativeGetSourceLayer(); - } - - /** - * Set a single expression filter. - * - * @param filter the expression filter to set - */ - public void setFilter(@NonNull Expression filter) { - checkThread(); - nativeSetFilter(filter.toArray()); - } - - /** - * Set a single expression filter. - * - * @param filter the expression filter to set - * @return This - */ - @NonNull - public LocationIndicatorLayer withFilter(@NonNull Expression filter) { - setFilter(filter); - return this; - } - - /** - * Get a single expression filter. - * - * @return the expression filter to get - */ - @Nullable - public Expression getFilter() { - checkThread(); - JsonElement jsonElement = nativeGetFilter(); - if (jsonElement != null) { - return Expression.Converter.convert(jsonElement); - } else { - return null; - } - } - /** * Set a property or properties. * diff --git a/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationPropertyFactory.java b/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationPropertyFactory.java new file mode 100644 index 000000000..367c47091 --- /dev/null +++ b/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationPropertyFactory.java @@ -0,0 +1,312 @@ +// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. + +package com.mapbox.mapboxsdk.location; + +import androidx.annotation.ColorInt; + +import com.mapbox.mapboxsdk.style.expressions.Expression; +import com.mapbox.mapboxsdk.style.types.Formatted; +import static com.mapbox.mapboxsdk.utils.ColorUtils.colorToRgbaString; +import com.mapbox.mapboxsdk.style.layers.LayoutPropertyValue; +import com.mapbox.mapboxsdk.style.layers.PaintPropertyValue; +import com.mapbox.mapboxsdk.style.layers.Property; +import com.mapbox.mapboxsdk.style.layers.PropertyValue; + +/** + * Constructs paint/layout properties for Layers + * + * @see Layer style documentation + */ +class LocationPropertyFactory { + + /** + * Set the property visibility. + * + * @param value the visibility value + * @return property wrapper around visibility + */ + public static PropertyValue visibility(@Property.VISIBILITY String value) { + return new LayoutPropertyValue<>("visibility", value); + } + + /** + * The amount of the perspective compensation, between 0 and 1. A value of 1 produces a location indicator of constant width across the screen. A value of 0 makes it scale naturally according to the viewing projection. + * + * @param value a Float value + * @return property wrapper around Float + */ + public static PropertyValue perspectiveCompensation(Float value) { + return new PaintPropertyValue<>("perspective-compensation", value); + } + + /** + * The amount of the perspective compensation, between 0 and 1. A value of 1 produces a location indicator of constant width across the screen. A value of 0 makes it scale naturally according to the viewing projection. + * + * @param expression an expression statement + * @return property wrapper around an expression statement + */ + public static PropertyValue perspectiveCompensation(Expression expression) { + return new PaintPropertyValue<>("perspective-compensation", expression); + } + + /** + * The displacement off the center of the top image and the shadow image when the pitch of the map is greater than 0. This helps producing a three-dimensional appearence. + * + * @param value a Float value + * @return property wrapper around Float + */ + public static PropertyValue imageTiltDisplacement(Float value) { + return new PaintPropertyValue<>("image-tilt-displacement", value); + } + + /** + * The displacement off the center of the top image and the shadow image when the pitch of the map is greater than 0. This helps producing a three-dimensional appearence. + * + * @param expression an expression statement + * @return property wrapper around an expression statement + */ + public static PropertyValue imageTiltDisplacement(Expression expression) { + return new PaintPropertyValue<>("image-tilt-displacement", expression); + } + + /** + * The bearing of the location indicator. + * + * @param value a Double value + * @return property wrapper around Double + */ + public static PropertyValue bearing(Double value) { + return new PaintPropertyValue<>("bearing", value); + } + + /** + * The bearing of the location indicator. + * + * @param expression an expression statement + * @return property wrapper around an expression statement + */ + public static PropertyValue bearing(Expression expression) { + return new PaintPropertyValue<>("bearing", expression); + } + + /** + * An array of [latitude, longitude, altitude] position of the location indicator. + * + * @param value a Double[] value + * @return property wrapper around Double[] + */ + public static PropertyValue location(Double[] value) { + return new PaintPropertyValue<>("location", value); + } + + /** + * An array of [latitude, longitude, altitude] position of the location indicator. + * + * @param expression an expression statement + * @return property wrapper around an expression statement + */ + public static PropertyValue location(Expression expression) { + return new PaintPropertyValue<>("location", expression); + } + + /** + * The accuracy, in meters, of the position source used to retrieve the position of the location indicator. + * + * @param value a Float value + * @return property wrapper around Float + */ + public static PropertyValue accuracyRadius(Float value) { + return new PaintPropertyValue<>("accuracy-radius", value); + } + + /** + * The accuracy, in meters, of the position source used to retrieve the position of the location indicator. + * + * @param expression an expression statement + * @return property wrapper around an expression statement + */ + public static PropertyValue accuracyRadius(Expression expression) { + return new PaintPropertyValue<>("accuracy-radius", expression); + } + + /** + * The size of the top image, as a scale factor applied to the size of the specified image. + * + * @param value a Float value + * @return property wrapper around Float + */ + public static PropertyValue topImageSize(Float value) { + return new PaintPropertyValue<>("top-image-size", value); + } + + /** + * The size of the top image, as a scale factor applied to the size of the specified image. + * + * @param expression an expression statement + * @return property wrapper around an expression statement + */ + public static PropertyValue topImageSize(Expression expression) { + return new PaintPropertyValue<>("top-image-size", expression); + } + + /** + * The size of the bearing image, as a scale factor applied to the size of the specified image. + * + * @param value a Float value + * @return property wrapper around Float + */ + public static PropertyValue bearingImageSize(Float value) { + return new PaintPropertyValue<>("bearing-image-size", value); + } + + /** + * The size of the bearing image, as a scale factor applied to the size of the specified image. + * + * @param expression an expression statement + * @return property wrapper around an expression statement + */ + public static PropertyValue bearingImageSize(Expression expression) { + return new PaintPropertyValue<>("bearing-image-size", expression); + } + + /** + * The size of the shadow image, as a scale factor applied to the size of the specified image. + * + * @param value a Float value + * @return property wrapper around Float + */ + public static PropertyValue shadowImageSize(Float value) { + return new PaintPropertyValue<>("shadow-image-size", value); + } + + /** + * The size of the shadow image, as a scale factor applied to the size of the specified image. + * + * @param expression an expression statement + * @return property wrapper around an expression statement + */ + public static PropertyValue shadowImageSize(Expression expression) { + return new PaintPropertyValue<>("shadow-image-size", expression); + } + + /** + * The color for drawing the accuracy radius, as a circle. To adjust transparency, set the alpha component of the color accordingly. + * + * @param value a int color value + * @return property wrapper around String color + */ + public static PropertyValue accuracyRadiusColor(@ColorInt int value) { + return new PaintPropertyValue<>("accuracy-radius-color", colorToRgbaString(value)); + } + + /** + * The color for drawing the accuracy radius, as a circle. To adjust transparency, set the alpha component of the color accordingly. + * + * @param value a String value + * @return property wrapper around String + */ + public static PropertyValue accuracyRadiusColor(String value) { + return new PaintPropertyValue<>("accuracy-radius-color", value); + } + + /** + * The color for drawing the accuracy radius, as a circle. To adjust transparency, set the alpha component of the color accordingly. + * + * @param expression an expression statement + * @return property wrapper around an expression statement + */ + public static PropertyValue accuracyRadiusColor(Expression expression) { + return new PaintPropertyValue<>("accuracy-radius-color", expression); + } + + /** + * The color for drawing the accuracy radius border. To adjust transparency, set the alpha component of the color accordingly. + * + * @param value a int color value + * @return property wrapper around String color + */ + public static PropertyValue accuracyRadiusBorderColor(@ColorInt int value) { + return new PaintPropertyValue<>("accuracy-radius-border-color", colorToRgbaString(value)); + } + + /** + * The color for drawing the accuracy radius border. To adjust transparency, set the alpha component of the color accordingly. + * + * @param value a String value + * @return property wrapper around String + */ + public static PropertyValue accuracyRadiusBorderColor(String value) { + return new PaintPropertyValue<>("accuracy-radius-border-color", value); + } + + /** + * The color for drawing the accuracy radius border. To adjust transparency, set the alpha component of the color accordingly. + * + * @param expression an expression statement + * @return property wrapper around an expression statement + */ + public static PropertyValue accuracyRadiusBorderColor(Expression expression) { + return new PaintPropertyValue<>("accuracy-radius-border-color", expression); + } + + /** + * Name of image in sprite to use as the top of the location indicator. + * + * @param value a String value + * @return property wrapper around String + */ + public static PropertyValue topImage(String value) { + return new LayoutPropertyValue<>("top-image", value); + } + + /** + * Name of image in sprite to use as the top of the location indicator. + * + * @param value a String value + * @return property wrapper around String + */ + public static PropertyValue topImage(Expression value) { + return new LayoutPropertyValue<>("top-image", value); + } + + /** + * Name of image in sprite to use as the middle of the location indicator. + * + * @param value a String value + * @return property wrapper around String + */ + public static PropertyValue bearingImage(String value) { + return new LayoutPropertyValue<>("bearing-image", value); + } + + /** + * Name of image in sprite to use as the middle of the location indicator. + * + * @param value a String value + * @return property wrapper around String + */ + public static PropertyValue bearingImage(Expression value) { + return new LayoutPropertyValue<>("bearing-image", value); + } + + /** + * Name of image in sprite to use as the background of the location indicator. + * + * @param value a String value + * @return property wrapper around String + */ + public static PropertyValue shadowImage(String value) { + return new LayoutPropertyValue<>("shadow-image", value); + } + + /** + * Name of image in sprite to use as the background of the location indicator. + * + * @param value a String value + * @return property wrapper around String + */ + public static PropertyValue shadowImage(Expression value) { + return new LayoutPropertyValue<>("shadow-image", value); + } + +} diff --git a/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/BackgroundLayer.java b/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/BackgroundLayer.java index 3197b1a5b..6870e6537 100644 --- a/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/BackgroundLayer.java +++ b/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/BackgroundLayer.java @@ -1,4 +1,4 @@ -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. +// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. package com.mapbox.mapboxsdk.style.layers; diff --git a/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/CircleLayer.java b/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/CircleLayer.java index d9845634c..2f2d8325f 100644 --- a/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/CircleLayer.java +++ b/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/CircleLayer.java @@ -1,4 +1,4 @@ -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. +// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. package com.mapbox.mapboxsdk.style.layers; diff --git a/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/FillExtrusionLayer.java b/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/FillExtrusionLayer.java index 28d125565..841a4b35d 100644 --- a/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/FillExtrusionLayer.java +++ b/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/FillExtrusionLayer.java @@ -1,4 +1,4 @@ -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. +// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. package com.mapbox.mapboxsdk.style.layers; diff --git a/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/FillLayer.java b/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/FillLayer.java index 98b5f8feb..38de5d56a 100644 --- a/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/FillLayer.java +++ b/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/FillLayer.java @@ -1,4 +1,4 @@ -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. +// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. package com.mapbox.mapboxsdk.style.layers; diff --git a/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/HeatmapLayer.java b/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/HeatmapLayer.java index 5e5faed33..fce946ffe 100644 --- a/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/HeatmapLayer.java +++ b/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/HeatmapLayer.java @@ -1,4 +1,4 @@ -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. +// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. package com.mapbox.mapboxsdk.style.layers; diff --git a/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/HillshadeLayer.java b/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/HillshadeLayer.java index dae70ae36..0342a35cf 100644 --- a/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/HillshadeLayer.java +++ b/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/HillshadeLayer.java @@ -1,4 +1,4 @@ -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. +// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. package com.mapbox.mapboxsdk.style.layers; diff --git a/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/LayoutPropertyValue.java b/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/LayoutPropertyValue.java index 5417e814e..630a4239a 100644 --- a/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/LayoutPropertyValue.java +++ b/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/LayoutPropertyValue.java @@ -2,9 +2,9 @@ package com.mapbox.mapboxsdk.style.layers; import androidx.annotation.NonNull; -class LayoutPropertyValue extends PropertyValue { +public class LayoutPropertyValue extends PropertyValue { - LayoutPropertyValue(@NonNull String name, T value) { + public LayoutPropertyValue(@NonNull String name, T value) { super(name, value); } diff --git a/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/LineLayer.java b/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/LineLayer.java index cf1335269..00b07f792 100644 --- a/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/LineLayer.java +++ b/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/LineLayer.java @@ -1,4 +1,4 @@ -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. +// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. package com.mapbox.mapboxsdk.style.layers; diff --git a/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PaintPropertyValue.java b/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PaintPropertyValue.java index 394258834..bd5eaa81a 100644 --- a/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PaintPropertyValue.java +++ b/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PaintPropertyValue.java @@ -2,9 +2,9 @@ package com.mapbox.mapboxsdk.style.layers; import androidx.annotation.NonNull; -class PaintPropertyValue extends PropertyValue { +public class PaintPropertyValue extends PropertyValue { - PaintPropertyValue(@NonNull String name, T value) { + public PaintPropertyValue(@NonNull String name, T value) { super(name, value); } diff --git a/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/Property.java b/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/Property.java index f2c0c7898..d5f1daa82 100644 --- a/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/Property.java +++ b/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/Property.java @@ -1,4 +1,4 @@ -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. +// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. package com.mapbox.mapboxsdk.style.layers; diff --git a/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyFactory.java b/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyFactory.java index 907867707..cb9aa5805 100644 --- a/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyFactory.java +++ b/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyFactory.java @@ -1,4 +1,4 @@ -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. +// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. package com.mapbox.mapboxsdk.style.layers; @@ -1645,226 +1645,6 @@ public class PropertyFactory { return new PaintPropertyValue<>("background-opacity", expression); } - /** - * The amount of the perspective compensation, between 0 and 1. A value of 1 produces a location indicator of constant width across the screen. A value of 0 makes it scale naturally according to the viewing projection. - * - * @param value a Float value - * @return property wrapper around Float - */ - public static PropertyValue perspectiveCompensation(Float value) { - return new PaintPropertyValue<>("perspective-compensation", value); - } - - /** - * The amount of the perspective compensation, between 0 and 1. A value of 1 produces a location indicator of constant width across the screen. A value of 0 makes it scale naturally according to the viewing projection. - * - * @param expression an expression statement - * @return property wrapper around an expression statement - */ - public static PropertyValue perspectiveCompensation(Expression expression) { - return new PaintPropertyValue<>("perspective-compensation", expression); - } - - /** - * The displacement off the center of the top image and the shadow image when the pitch of the map is greater than 0. This helps producing a three-dimensional appearence. - * - * @param value a Float value - * @return property wrapper around Float - */ - public static PropertyValue imageTiltDisplacement(Float value) { - return new PaintPropertyValue<>("image-tilt-displacement", value); - } - - /** - * The displacement off the center of the top image and the shadow image when the pitch of the map is greater than 0. This helps producing a three-dimensional appearence. - * - * @param expression an expression statement - * @return property wrapper around an expression statement - */ - public static PropertyValue imageTiltDisplacement(Expression expression) { - return new PaintPropertyValue<>("image-tilt-displacement", expression); - } - - /** - * The bearing of the location indicator. - * - * @param value a Double value - * @return property wrapper around Double - */ - public static PropertyValue bearing(Double value) { - return new PaintPropertyValue<>("bearing", value); - } - - /** - * The bearing of the location indicator. - * - * @param expression an expression statement - * @return property wrapper around an expression statement - */ - public static PropertyValue bearing(Expression expression) { - return new PaintPropertyValue<>("bearing", expression); - } - - /** - * An array of [latitude, longitude, altitude] position of the location indicator. - * - * @param value a Double[] value - * @return property wrapper around Double[] - */ - public static PropertyValue location(Double[] value) { - return new PaintPropertyValue<>("location", value); - } - - /** - * An array of [latitude, longitude, altitude] position of the location indicator. - * - * @param expression an expression statement - * @return property wrapper around an expression statement - */ - public static PropertyValue location(Expression expression) { - return new PaintPropertyValue<>("location", expression); - } - - /** - * The accuracy, in meters, of the position source used to retrieve the position of the location indicator. - * - * @param value a Float value - * @return property wrapper around Float - */ - public static PropertyValue accuracyRadius(Float value) { - return new PaintPropertyValue<>("accuracy-radius", value); - } - - /** - * The accuracy, in meters, of the position source used to retrieve the position of the location indicator. - * - * @param expression an expression statement - * @return property wrapper around an expression statement - */ - public static PropertyValue accuracyRadius(Expression expression) { - return new PaintPropertyValue<>("accuracy-radius", expression); - } - - /** - * The size of the top image, as a scale factor applied to the size of the specified image. - * - * @param value a Float value - * @return property wrapper around Float - */ - public static PropertyValue topImageSize(Float value) { - return new PaintPropertyValue<>("top-image-size", value); - } - - /** - * The size of the top image, as a scale factor applied to the size of the specified image. - * - * @param expression an expression statement - * @return property wrapper around an expression statement - */ - public static PropertyValue topImageSize(Expression expression) { - return new PaintPropertyValue<>("top-image-size", expression); - } - - /** - * The size of the bearing image, as a scale factor applied to the size of the specified image. - * - * @param value a Float value - * @return property wrapper around Float - */ - public static PropertyValue bearingImageSize(Float value) { - return new PaintPropertyValue<>("bearing-image-size", value); - } - - /** - * The size of the bearing image, as a scale factor applied to the size of the specified image. - * - * @param expression an expression statement - * @return property wrapper around an expression statement - */ - public static PropertyValue bearingImageSize(Expression expression) { - return new PaintPropertyValue<>("bearing-image-size", expression); - } - - /** - * The size of the shadow image, as a scale factor applied to the size of the specified image. - * - * @param value a Float value - * @return property wrapper around Float - */ - public static PropertyValue shadowImageSize(Float value) { - return new PaintPropertyValue<>("shadow-image-size", value); - } - - /** - * The size of the shadow image, as a scale factor applied to the size of the specified image. - * - * @param expression an expression statement - * @return property wrapper around an expression statement - */ - public static PropertyValue shadowImageSize(Expression expression) { - return new PaintPropertyValue<>("shadow-image-size", expression); - } - - /** - * The color for drawing the accuracy radius, as a circle. To adjust transparency, set the alpha component of the color accordingly. - * - * @param value a int color value - * @return property wrapper around String color - */ - public static PropertyValue accuracyRadiusColor(@ColorInt int value) { - return new PaintPropertyValue<>("accuracy-radius-color", colorToRgbaString(value)); - } - - /** - * The color for drawing the accuracy radius, as a circle. To adjust transparency, set the alpha component of the color accordingly. - * - * @param value a String value - * @return property wrapper around String - */ - public static PropertyValue accuracyRadiusColor(String value) { - return new PaintPropertyValue<>("accuracy-radius-color", value); - } - - /** - * The color for drawing the accuracy radius, as a circle. To adjust transparency, set the alpha component of the color accordingly. - * - * @param expression an expression statement - * @return property wrapper around an expression statement - */ - public static PropertyValue accuracyRadiusColor(Expression expression) { - return new PaintPropertyValue<>("accuracy-radius-color", expression); - } - - /** - * The color for drawing the accuracy radius border. To adjust transparency, set the alpha component of the color accordingly. - * - * @param value a int color value - * @return property wrapper around String color - */ - public static PropertyValue accuracyRadiusBorderColor(@ColorInt int value) { - return new PaintPropertyValue<>("accuracy-radius-border-color", colorToRgbaString(value)); - } - - /** - * The color for drawing the accuracy radius border. To adjust transparency, set the alpha component of the color accordingly. - * - * @param value a String value - * @return property wrapper around String - */ - public static PropertyValue accuracyRadiusBorderColor(String value) { - return new PaintPropertyValue<>("accuracy-radius-border-color", value); - } - - /** - * The color for drawing the accuracy radius border. To adjust transparency, set the alpha component of the color accordingly. - * - * @param expression an expression statement - * @return property wrapper around an expression statement - */ - public static PropertyValue accuracyRadiusBorderColor(Expression expression) { - return new PaintPropertyValue<>("accuracy-radius-border-color", expression); - } - /** * Sorts features in ascending order based on this value. Features with a higher sort key will appear above features with a lower sort key. * @@ -2835,64 +2615,4 @@ public class PropertyFactory { return new LayoutPropertyValue<>("circle-sort-key", value); } - /** - * Name of image in sprite to use as the top of the location indicator. - * - * @param value a String value - * @return property wrapper around String - */ - public static PropertyValue topImage(String value) { - return new LayoutPropertyValue<>("top-image", value); - } - - /** - * Name of image in sprite to use as the top of the location indicator. - * - * @param value a String value - * @return property wrapper around String - */ - public static PropertyValue topImage(Expression value) { - return new LayoutPropertyValue<>("top-image", value); - } - - /** - * Name of image in sprite to use as the middle of the location indicator. - * - * @param value a String value - * @return property wrapper around String - */ - public static PropertyValue bearingImage(String value) { - return new LayoutPropertyValue<>("bearing-image", value); - } - - /** - * Name of image in sprite to use as the middle of the location indicator. - * - * @param value a String value - * @return property wrapper around String - */ - public static PropertyValue bearingImage(Expression value) { - return new LayoutPropertyValue<>("bearing-image", value); - } - - /** - * Name of image in sprite to use as the background of the location indicator. - * - * @param value a String value - * @return property wrapper around String - */ - public static PropertyValue shadowImage(String value) { - return new LayoutPropertyValue<>("shadow-image", value); - } - - /** - * Name of image in sprite to use as the background of the location indicator. - * - * @param value a String value - * @return property wrapper around String - */ - public static PropertyValue shadowImage(Expression value) { - return new LayoutPropertyValue<>("shadow-image", value); - } - } diff --git a/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/RasterLayer.java b/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/RasterLayer.java index 9c0c73327..82f1a0771 100644 --- a/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/RasterLayer.java +++ b/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/RasterLayer.java @@ -1,4 +1,4 @@ -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. +// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. package com.mapbox.mapboxsdk.style.layers; diff --git a/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/SymbolLayer.java b/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/SymbolLayer.java index 06d488d6e..1355458b7 100644 --- a/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/SymbolLayer.java +++ b/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/SymbolLayer.java @@ -1,4 +1,4 @@ -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. +// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. package com.mapbox.mapboxsdk.style.layers; diff --git a/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/layer.java.ejs b/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/layer.java.ejs index db1510aab..987316768 100644 --- a/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/layer.java.ejs +++ b/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/layer.java.ejs @@ -3,9 +3,13 @@ const properties = locals.properties; const doc = locals.doc; -%> -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. +// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. +<% if (type === 'location-indicator') { -%> +package com.mapbox.mapboxsdk.location; +<% } else { -%> package com.mapbox.mapboxsdk.style.layers; +<% } -%> import androidx.annotation.ColorInt; import androidx.annotation.Keep; @@ -23,6 +27,10 @@ import com.mapbox.mapboxsdk.style.layers.TransitionOptions; import com.mapbox.mapboxsdk.style.types.Formatted; import com.mapbox.mapboxsdk.style.types.FormattedSection; <% } -%> +<% if (type === 'location-indicator') { -%> +import com.mapbox.mapboxsdk.style.layers.Layer; +import com.mapbox.mapboxsdk.style.layers.PropertyValue; +<% } -%> /** * <%- doc %> @@ -30,7 +38,11 @@ import com.mapbox.mapboxsdk.style.types.FormattedSection; * @see The online documentation */ @UiThread +<% if (type === 'location-indicator') { -%> +class <%- camelize(type) %>Layer extends Layer { +<% } else { -%> public class <%- camelize(type) %>Layer extends Layer { +<% } -%> /** * Creates a <%- camelize(type) %>Layer. @@ -94,7 +106,7 @@ public class <%- camelize(type) %>Layer extends Layer { } <% } -%> -<% if (type !== 'background' && type !== 'custom') { -%> +<% if (type !== 'background' && type !== 'location-indicator' && type !== 'custom') { -%> /** * Get the source id. * @@ -107,7 +119,7 @@ public class <%- camelize(type) %>Layer extends Layer { } <% } -%> -<% if (type !== 'background' && type !== 'raster' && type !== 'hillshade') { -%> +<% if (type !== 'background' && type !== 'location-indicator' && type !== 'raster' && type !== 'hillshade') { -%> /** * Get the source layer. * diff --git a/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/property.java.ejs b/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/property.java.ejs index 7d859893b..06481fa4d 100644 --- a/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/property.java.ejs +++ b/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/property.java.ejs @@ -1,7 +1,7 @@ <% const properties = locals.properties; -%> -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. +// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. package com.mapbox.mapboxsdk.style.layers; diff --git a/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/property_factory.java.ejs b/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/property_factory.java.ejs index 0a8d5c3b2..18bf39bcd 100644 --- a/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/property_factory.java.ejs +++ b/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/property_factory.java.ejs @@ -1,23 +1,38 @@ <% const paintProperties = locals.paintProperties; const layoutProperties = locals.layoutProperties; + const locationIndicator = locals.locationIndicator; -%> -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. +// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. +<% if (locationIndicator) { -%> +package com.mapbox.mapboxsdk.location; +<% } else { -%> package com.mapbox.mapboxsdk.style.layers; +<% } -%> import androidx.annotation.ColorInt; import com.mapbox.mapboxsdk.style.expressions.Expression; import com.mapbox.mapboxsdk.style.types.Formatted; import static com.mapbox.mapboxsdk.utils.ColorUtils.colorToRgbaString; +<% if (locationIndicator) { -%> +import com.mapbox.mapboxsdk.style.layers.LayoutPropertyValue; +import com.mapbox.mapboxsdk.style.layers.PaintPropertyValue; +import com.mapbox.mapboxsdk.style.layers.Property; +import com.mapbox.mapboxsdk.style.layers.PropertyValue; +<% } -%> /** * Constructs paint/layout properties for Layers * * @see Layer style documentation */ +<% if (locationIndicator) { -%> +class LocationPropertyFactory { +<% } else { -%> public class PropertyFactory { +<% } -%> /** * Set the property visibility. diff --git a/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/light/Light.java b/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/light/Light.java index 24105bb0c..75cd89128 100644 --- a/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/light/Light.java +++ b/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/light/Light.java @@ -1,4 +1,4 @@ -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. +// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. package com.mapbox.mapboxsdk.style.light; diff --git a/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/light/light.java.ejs b/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/light/light.java.ejs index 30a021195..8074fa0df 100644 --- a/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/light/light.java.ejs +++ b/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/light/light.java.ejs @@ -2,7 +2,7 @@ const properties = locals.properties; const doc = locals.doc; -%> -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. +// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. package com.mapbox.mapboxsdk.style.light; diff --git a/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/LocationIndicatorLayerTest.java b/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationIndicatorLayerTest.java similarity index 96% rename from MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/LocationIndicatorLayerTest.java rename to MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationIndicatorLayerTest.java index 1a14d242f..1ecc78d5a 100644 --- a/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/LocationIndicatorLayerTest.java +++ b/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationIndicatorLayerTest.java @@ -1,6 +1,6 @@ -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. +// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. -package com.mapbox.mapboxsdk.testapp.style; +package com.mapbox.mapboxsdk.location; import android.graphics.Color; import androidx.test.annotation.UiThreadTest; @@ -11,7 +11,6 @@ import org.junit.Before; import timber.log.Timber; import com.mapbox.mapboxsdk.style.expressions.Expression; -import com.mapbox.mapboxsdk.style.layers.LocationIndicatorLayer; import org.junit.Test; import org.junit.runner.RunWith; @@ -19,7 +18,7 @@ import org.junit.runner.RunWith; import static com.mapbox.mapboxsdk.style.expressions.Expression.*; import static org.junit.Assert.*; import static com.mapbox.mapboxsdk.style.layers.Property.*; -import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.*; +import static com.mapbox.mapboxsdk.location.LocationPropertyFactory.*; import com.mapbox.mapboxsdk.style.layers.TransitionOptions; diff --git a/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/BackgroundLayerTest.java b/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/BackgroundLayerTest.java index c6fe2d62d..e7226327c 100644 --- a/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/BackgroundLayerTest.java +++ b/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/BackgroundLayerTest.java @@ -1,4 +1,4 @@ -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. +// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. package com.mapbox.mapboxsdk.testapp.style; diff --git a/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/CircleLayerTest.java b/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/CircleLayerTest.java index 1430f304c..cba1bad81 100644 --- a/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/CircleLayerTest.java +++ b/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/CircleLayerTest.java @@ -1,4 +1,4 @@ -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. +// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. package com.mapbox.mapboxsdk.testapp.style; diff --git a/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillExtrusionLayerTest.java b/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillExtrusionLayerTest.java index ecbae353c..4d57b38fa 100644 --- a/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillExtrusionLayerTest.java +++ b/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillExtrusionLayerTest.java @@ -1,4 +1,4 @@ -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. +// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. package com.mapbox.mapboxsdk.testapp.style; diff --git a/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillLayerTest.java b/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillLayerTest.java index ef75a5e64..2e01ec4f2 100644 --- a/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillLayerTest.java +++ b/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillLayerTest.java @@ -1,4 +1,4 @@ -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. +// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. package com.mapbox.mapboxsdk.testapp.style; diff --git a/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/HeatmapLayerTest.java b/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/HeatmapLayerTest.java index 79c244c45..0c8f7d25d 100644 --- a/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/HeatmapLayerTest.java +++ b/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/HeatmapLayerTest.java @@ -1,4 +1,4 @@ -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. +// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. package com.mapbox.mapboxsdk.testapp.style; diff --git a/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/HillshadeLayerTest.java b/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/HillshadeLayerTest.java index 68943d19a..6e74654e9 100644 --- a/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/HillshadeLayerTest.java +++ b/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/HillshadeLayerTest.java @@ -1,4 +1,4 @@ -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. +// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. package com.mapbox.mapboxsdk.testapp.style; diff --git a/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/LineLayerTest.java b/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/LineLayerTest.java index daeb41c1c..0a95b83f2 100644 --- a/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/LineLayerTest.java +++ b/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/LineLayerTest.java @@ -1,4 +1,4 @@ -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. +// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. package com.mapbox.mapboxsdk.testapp.style; diff --git a/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RasterLayerTest.java b/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RasterLayerTest.java index 56cf1e845..cf16175ec 100644 --- a/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RasterLayerTest.java +++ b/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RasterLayerTest.java @@ -1,4 +1,4 @@ -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. +// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. package com.mapbox.mapboxsdk.testapp.style; diff --git a/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/SymbolLayerTest.java b/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/SymbolLayerTest.java index 207d346f4..504bd39e5 100644 --- a/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/SymbolLayerTest.java +++ b/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/SymbolLayerTest.java @@ -1,4 +1,4 @@ -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. +// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. package com.mapbox.mapboxsdk.testapp.style; diff --git a/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/layer.junit.ejs b/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/layer.junit.ejs index c5515a396..46a46063c 100644 --- a/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/layer.junit.ejs +++ b/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/layer.junit.ejs @@ -2,9 +2,13 @@ const type = locals.type; const properties = locals.properties; -%> -// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. +// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. +<% if (type === 'location-indicator') { -%> +package com.mapbox.mapboxsdk.location; +<% } else { -%> package com.mapbox.mapboxsdk.testapp.style; +<% } -%> import android.graphics.Color; import androidx.test.annotation.UiThreadTest; @@ -15,7 +19,9 @@ import org.junit.Before; import timber.log.Timber; import com.mapbox.mapboxsdk.style.expressions.Expression; +<% if (type !== 'location-indicator') { -%> import com.mapbox.mapboxsdk.style.layers.<%- camelize(type) %>Layer; +<% } -%> <% if (type === 'symbol') { -%> import com.mapbox.mapboxsdk.style.types.Formatted; import com.mapbox.mapboxsdk.style.types.FormattedSection; @@ -27,7 +33,11 @@ import org.junit.runner.RunWith; import static com.mapbox.mapboxsdk.style.expressions.Expression.*; import static org.junit.Assert.*; import static com.mapbox.mapboxsdk.style.layers.Property.*; +<% if (type === 'location-indicator') { -%> +import static com.mapbox.mapboxsdk.location.LocationPropertyFactory.*; +<% } else { -%> import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.*; +<% } -%> import com.mapbox.mapboxsdk.style.layers.TransitionOptions; diff --git a/scripts/generate-style-code.js b/scripts/generate-style-code.js index 821f03666..cab7bca0d 100755 --- a/scripts/generate-style-code.js +++ b/scripts/generate-style-code.js @@ -26,7 +26,7 @@ const lightProperties = Object.keys(spec[`light`]).reduce((memo, name) => { // Collect layer types from spec var layers = Object.keys(spec.layer.type.values).map((type) => { const layoutProperties = Object.keys(spec[`layout_${type}`]).reduce((memo, name) => { - if (name !== 'visibility') { + if (name !== 'visibility' && type !== 'location-indicator') { spec[`layout_${type}`][name].name = name; memo.push(spec[`layout_${type}`][name]); } @@ -34,8 +34,26 @@ var layers = Object.keys(spec.layer.type.values).map((type) => { }, []); const paintProperties = Object.keys(spec[`paint_${type}`]).reduce((memo, name) => { - spec[`paint_${type}`][name].name = name; - memo.push(spec[`paint_${type}`][name]); + if (type !== 'location-indicator') { + spec[`paint_${type}`][name].name = name; + memo.push(spec[`paint_${type}`][name]); + } + return memo; + }, []); + + const locationLayoutProperties = Object.keys(spec[`layout_${type}`]).reduce((memo, name) => { + if (name !== 'visibility' && type === 'location-indicator') { + spec[`layout_${type}`][name].name = name; + memo.push(spec[`layout_${type}`][name]); + } + return memo; + }, []); + + const locationPaintProperties = Object.keys(spec[`paint_${type}`]).reduce((memo, name) => { + if (type === 'location-indicator') { + spec[`paint_${type}`][name].name = name; + memo.push(spec[`paint_${type}`][name]); + } return memo; }, []); @@ -44,7 +62,9 @@ var layers = Object.keys(spec.layer.type.values).map((type) => { doc: spec.layer.type.values[type].doc, layoutProperties: layoutProperties, paintProperties: paintProperties, - properties: layoutProperties.concat(paintProperties) + locationLayoutProperties: locationLayoutProperties, + locationPaintProperties: locationPaintProperties, + properties: layoutProperties.concat(paintProperties).concat(locationLayoutProperties).concat(locationPaintProperties) }; }); @@ -57,6 +77,8 @@ const uniqueArrayEnum = (prop, enums) => { const layoutProperties = _(layers).map('layoutProperties').flatten().value(); const paintProperties = _(layers).map('paintProperties').flatten().value(); +const locationLayoutProperties = _(layers).map('locationLayoutProperties').flatten().value(); +const locationPaintProperties = _(layers).map('locationPaintProperties').flatten().value(); const allProperties = _(layoutProperties).union(paintProperties).union(lightProperties).value(); let allEnumProperties = _(allProperties).filter({'type': 'enum'}).value(); const uniqueArrayEnumProperties = _(allProperties).filter({'type': 'array'}).filter(prop => uniqueArrayEnum(prop, allEnumProperties)).value(); @@ -391,8 +413,15 @@ const layerJava = ejs.compile(fs.readFileSync('MapboxGLAndroidSDK/src/main/java/ const layerJavaUnitTests = ejs.compile(fs.readFileSync('MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/layer.junit.ejs', 'utf8'), {strict: true}); for (const layer of layers) { - writeIfModified(`MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/${camelize(layer.type)}Layer.java`, layerJava(layer)); - writeIfModified(`MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/${camelize(layer.type)}LayerTest.java`, layerJavaUnitTests(layer)); + var srcDir = 'MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/' + var testDir = 'MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/' + if (layer.type === 'location-indicator') { + srcDir = 'MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/' + testDir = 'MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/' + } + + writeIfModified(srcDir + `${camelize(layer.type)}Layer.java`, layerJava(layer)); + writeIfModified(testDir + `${camelize(layer.type)}LayerTest.java`, layerJavaUnitTests(layer)); } // Jni @@ -407,10 +436,18 @@ for (const layer of layers) { } // Java PropertyFactory -const propertiesTemplate = ejs.compile(fs.readFileSync('MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/property_factory.java.ejs', 'utf8'), {strict: true}); +const propertyFactoryTemplate = ejs.compile(fs.readFileSync('MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/property_factory.java.ejs', 'utf8'), {strict: true}); + +var propertyFactorySrcDir = 'MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyFactory.java' writeIfModified( - `MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyFactory.java`, - propertiesTemplate({layoutProperties: layoutProperties, paintProperties: paintProperties}) + propertyFactorySrcDir, + propertyFactoryTemplate({layoutProperties: layoutProperties, paintProperties: paintProperties, locationIndicator: false}) +); + +var locationPropertyFactorySrcDir = 'MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationPropertyFactory.java' +writeIfModified( + locationPropertyFactorySrcDir, + propertyFactoryTemplate({layoutProperties: locationLayoutProperties, paintProperties: locationPaintProperties, locationIndicator: true}) ); // Java Property