summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/mbgl/style/layers/location_indicator_layer.hpp20
-rw-r--r--metrics/cache-metrics.dbbin401408 -> 475136 bytes
-rw-r--r--metrics/ignores/platform-ios.json5
-rw-r--r--metrics/ignores/platform-linux.json17
-rw-r--r--metrics/linux-gcc8-release/location_indicator/dateline/metrics.json4
-rw-r--r--metrics/linux-gcc8-release/location_indicator/default/metrics.json4
-rw-r--r--metrics/linux-gcc8-release/location_indicator/image_pixel_ratio/metrics.json47
-rw-r--r--metrics/linux-gcc8-release/location_indicator/no_radius_border/metrics.json4
-rw-r--r--metrics/linux-gcc8-release/location_indicator/no_radius_fill/metrics.json4
-rw-r--r--metrics/linux-gcc8-release/location_indicator/no_textures/metrics.json4
-rw-r--r--metrics/linux-gcc8-release/location_indicator/one_texture/metrics.json4
-rw-r--r--metrics/linux-gcc8-release/location_indicator/rotated/metrics.json4
-rw-r--r--metrics/linux-gcc8-release/location_indicator/tilted/metrics.json4
-rw-r--r--metrics/linux-gcc8-release/location_indicator/tilted_texture_shift/metrics.json4
-rw-r--r--metrics/linux-gcc8-release/location_indicator/tilted_texture_shift_bottom_left/metrics.json4
-rw-r--r--metrics/linux-gcc8-release/location_indicator/tilted_texture_shift_bottom_right/metrics.json4
-rw-r--r--metrics/linux-gcc8-release/location_indicator/tilted_texture_shift_top_left/metrics.json4
-rw-r--r--metrics/linux-gcc8-release/location_indicator/tilted_texture_shift_top_right/metrics.json4
-rw-r--r--metrics/linux-gcc8-release/location_indicator/two_textures/metrics.json4
-rw-r--r--metrics/tests/location_indicator/dateline/expected.pngbin9307 -> 10498 bytes
-rw-r--r--metrics/tests/location_indicator/dateline/style.json28
-rw-r--r--metrics/tests/location_indicator/default/expected.pngbin13669 -> 12436 bytes
-rw-r--r--metrics/tests/location_indicator/default/style.json22
-rw-r--r--metrics/tests/location_indicator/image_pixel_ratio/expected.pngbin0 -> 12536 bytes
-rw-r--r--metrics/tests/location_indicator/image_pixel_ratio/style.json98
-rw-r--r--metrics/tests/location_indicator/no_radius_border/expected.pngbin9301 -> 8866 bytes
-rw-r--r--metrics/tests/location_indicator/no_radius_border/style.json22
-rw-r--r--metrics/tests/location_indicator/no_radius_fill/expected.pngbin7625 -> 7349 bytes
-rw-r--r--metrics/tests/location_indicator/no_radius_fill/style.json23
-rw-r--r--metrics/tests/location_indicator/no_textures/style.json20
-rw-r--r--metrics/tests/location_indicator/one_texture/expected.pngbin3500 -> 3768 bytes
-rw-r--r--metrics/tests/location_indicator/one_texture/style.json22
-rw-r--r--metrics/tests/location_indicator/rotated/expected.pngbin9452 -> 8799 bytes
-rw-r--r--metrics/tests/location_indicator/rotated/style.json22
-rw-r--r--metrics/tests/location_indicator/tilted/expected.pngbin5958 -> 5603 bytes
-rw-r--r--metrics/tests/location_indicator/tilted/style.json22
-rw-r--r--metrics/tests/location_indicator/tilted_texture_shift/expected.pngbin6502 -> 6104 bytes
-rw-r--r--metrics/tests/location_indicator/tilted_texture_shift/style.json22
-rw-r--r--metrics/tests/location_indicator/tilted_texture_shift_bottom_left/expected.pngbin6396 -> 6323 bytes
-rw-r--r--metrics/tests/location_indicator/tilted_texture_shift_bottom_left/style.json22
-rw-r--r--metrics/tests/location_indicator/tilted_texture_shift_bottom_right/expected.pngbin5996 -> 6052 bytes
-rw-r--r--metrics/tests/location_indicator/tilted_texture_shift_bottom_right/style.json22
-rw-r--r--metrics/tests/location_indicator/tilted_texture_shift_top_left/expected.pngbin3327 -> 3340 bytes
-rw-r--r--metrics/tests/location_indicator/tilted_texture_shift_top_left/style.json22
-rw-r--r--metrics/tests/location_indicator/tilted_texture_shift_top_right/expected.pngbin3238 -> 3225 bytes
-rw-r--r--metrics/tests/location_indicator/tilted_texture_shift_top_right/style.json22
-rw-r--r--metrics/tests/location_indicator/two_textures/expected.pngbin8945 -> 8226 bytes
-rw-r--r--metrics/tests/location_indicator/two_textures/style.json22
-rw-r--r--platform/glfw/glfw_view.cpp8
-rw-r--r--scripts/style-spec.js30
-rw-r--r--src/mbgl/gl/defines.hpp2
-rw-r--r--src/mbgl/renderer/layers/render_location_indicator_layer.cpp74
-rw-r--r--src/mbgl/style/layers/location_indicator_layer.cpp146
-rw-r--r--src/mbgl/style/layers/location_indicator_layer_properties.hpp26
54 files changed, 488 insertions, 354 deletions
diff --git a/include/mbgl/style/layers/location_indicator_layer.hpp b/include/mbgl/style/layers/location_indicator_layer.hpp
index f112664dab..49720a2403 100644
--- a/include/mbgl/style/layers/location_indicator_layer.hpp
+++ b/include/mbgl/style/layers/location_indicator_layer.hpp
@@ -26,14 +26,6 @@ public:
const PropertyValue<expression::Image>& getBearingImage() const;
void setBearingImage(const PropertyValue<expression::Image>&);
- static PropertyValue<float> getDefaultImageTiltDisplacement();
- const PropertyValue<float>& getImageTiltDisplacement() const;
- void setImageTiltDisplacement(const PropertyValue<float>&);
-
- static PropertyValue<float> getDefaultPerspectiveCompensation();
- const PropertyValue<float>& getPerspectiveCompensation() const;
- void setPerspectiveCompensation(const PropertyValue<float>&);
-
static PropertyValue<expression::Image> getDefaultShadowImage();
const PropertyValue<expression::Image>& getShadowImage() const;
void setShadowImage(const PropertyValue<expression::Image>&);
@@ -74,12 +66,24 @@ public:
void setBearingImageSizeTransition(const TransitionOptions&);
TransitionOptions getBearingImageSizeTransition() const;
+ static PropertyValue<float> getDefaultImageTiltDisplacement();
+ const PropertyValue<float>& getImageTiltDisplacement() const;
+ void setImageTiltDisplacement(const PropertyValue<float>&);
+ void setImageTiltDisplacementTransition(const TransitionOptions&);
+ TransitionOptions getImageTiltDisplacementTransition() const;
+
static PropertyValue<std::array<double, 3>> getDefaultLocation();
const PropertyValue<std::array<double, 3>>& getLocation() const;
void setLocation(const PropertyValue<std::array<double, 3>>&);
void setLocationTransition(const TransitionOptions&);
TransitionOptions getLocationTransition() const;
+ static PropertyValue<float> getDefaultPerspectiveCompensation();
+ const PropertyValue<float>& getPerspectiveCompensation() const;
+ void setPerspectiveCompensation(const PropertyValue<float>&);
+ void setPerspectiveCompensationTransition(const TransitionOptions&);
+ TransitionOptions getPerspectiveCompensationTransition() const;
+
static PropertyValue<float> getDefaultShadowImageSize();
const PropertyValue<float>& getShadowImageSize() const;
void setShadowImageSize(const PropertyValue<float>&);
diff --git a/metrics/cache-metrics.db b/metrics/cache-metrics.db
index 53ddff9bf6..317bc0d22a 100644
--- a/metrics/cache-metrics.db
+++ b/metrics/cache-metrics.db
Binary files differ
diff --git a/metrics/ignores/platform-ios.json b/metrics/ignores/platform-ios.json
index 1dce0e9f79..45179e02c8 100644
--- a/metrics/ignores/platform-ios.json
+++ b/metrics/ignores/platform-ios.json
@@ -8,5 +8,6 @@
"render-tests/regressions/mapbox-gl-js#2305": "Needs to be investigated and fixed.",
"render-tests/regressions/mapbox-gl-js#5911a": "Needs to be investigated and fixed.",
"render-tests/text-field/formatted-images": "Needs to be investigated and fixed.",
- "render-tests/symbol-visibility/visible": "Needs to be investigated and fixed."
-} \ No newline at end of file
+ "render-tests/symbol-visibility/visible": "Needs to be investigated and fixed.",
+ "location_indicator/image_pixel_ratio": "Renders a black square when loading from spritesheet. Needs to be investigated and fixed."
+}
diff --git a/metrics/ignores/platform-linux.json b/metrics/ignores/platform-linux.json
index 0988aff5a2..29d06bfc3d 100644
--- a/metrics/ignores/platform-linux.json
+++ b/metrics/ignores/platform-linux.json
@@ -6,5 +6,20 @@
"render-tests/line-pattern/opacity": "Flaky on Linux: https://github.com/mapbox/mapbox-gl-native/issues/15320",
"render-tests/line-translate/literal": "Flaky on Linux: https://github.com/mapbox/mapbox-gl-native/issues/14859",
"render-tests/regressions/mapbox-gl-js#5642": "Failing with mbgl-render-test",
- "render-tests/regressions/mapbox-gl-js#7066": "Failing with mbgl-render-test"
+ "render-tests/regressions/mapbox-gl-js#7066": "Failing with mbgl-render-test",
+ "location_indicator/dateline": "Would need a different baseline when ran on llvmpipe not supporting anisotropic filtering",
+ "location_indicator/default": "Would need a different baseline when ran on llvmpipe not supporting anisotropic filtering",
+ "location_indicator/no_radius_border": "Would need a different baseline when ran on llvmpipe not supporting anisotropic filtering",
+ "location_indicator/no_radius_fill": "Would need a different baseline when ran on llvmpipe not supporting anisotropic filtering",
+ "location_indicator/no_textures": "Would need a different baseline when ran on llvmpipe not supporting anisotropic filtering",
+ "location_indicator/one_texture": "Would need a different baseline when ran on llvmpipe not supporting anisotropic filtering",
+ "location_indicator/rotated": "Would need a different baseline when ran on llvmpipe not supporting anisotropic filtering",
+ "location_indicator/tilted": "Would need a different baseline when ran on llvmpipe not supporting anisotropic filtering",
+ "location_indicator/tilted_texture_shift": "Would need a different baseline when ran on llvmpipe not supporting anisotropic filtering",
+ "location_indicator/tilted_texture_shift_bottom_left": "Would need a different baseline when ran on llvmpipe not supporting anisotropic filtering",
+ "location_indicator/tilted_texture_shift_bottom_right": "Would need a different baseline when ran on llvmpipe not supporting anisotropic filtering",
+ "location_indicator/tilted_texture_shift_top_left": "Would need a different baseline when ran on llvmpipe not supporting anisotropic filtering",
+ "location_indicator/tilted_texture_shift_top_right": "Would need a different baseline when ran on llvmpipe not supporting anisotropic filtering",
+ "location_indicator/two_textures": "Would need a different baseline when ran on llvmpipe not supporting anisotropic filtering",
+ "location_indicator/image_pixel_ratio": "Would need a different baseline when ran on llvmpipe not supporting anisotropic filtering"
}
diff --git a/metrics/linux-gcc8-release/location_indicator/dateline/metrics.json b/metrics/linux-gcc8-release/location_indicator/dateline/metrics.json
index 4a2be5e044..2f6c9155e9 100644
--- a/metrics/linux-gcc8-release/location_indicator/dateline/metrics.json
+++ b/metrics/linux-gcc8-release/location_indicator/dateline/metrics.json
@@ -2,8 +2,8 @@
"memory": [
[
"probeMemory - default - end",
- 2672223,
- 83215
+ 2027402,
+ 3196
],
[
"probeMemory - default - start",
diff --git a/metrics/linux-gcc8-release/location_indicator/default/metrics.json b/metrics/linux-gcc8-release/location_indicator/default/metrics.json
index 4e7c613e57..ac69157f10 100644
--- a/metrics/linux-gcc8-release/location_indicator/default/metrics.json
+++ b/metrics/linux-gcc8-release/location_indicator/default/metrics.json
@@ -2,8 +2,8 @@
"memory": [
[
"probeMemory - default - end",
- 2796203,
- 107023
+ 2234412,
+ 3784
],
[
"probeMemory - default - start",
diff --git a/metrics/linux-gcc8-release/location_indicator/image_pixel_ratio/metrics.json b/metrics/linux-gcc8-release/location_indicator/image_pixel_ratio/metrics.json
new file mode 100644
index 0000000000..4e2534707d
--- /dev/null
+++ b/metrics/linux-gcc8-release/location_indicator/image_pixel_ratio/metrics.json
@@ -0,0 +1,47 @@
+{
+ "memory": [
+ [
+ "probeMemory - default - end",
+ 3103973,
+ 6137
+ ],
+ [
+ "probeMemory - default - start",
+ 0,
+ 0
+ ]
+ ],
+ "network": [
+ [
+ "probeNetwork - default - end",
+ 5,
+ 117617
+ ],
+ [
+ "probeNetwork - default - start",
+ 0,
+ 0
+ ]
+ ],
+ "gfx": [
+ [
+ "probeGFX - default - end",
+ 4,
+ 9,
+ 13,
+ 1,
+ [
+ 131072,
+ 131072
+ ],
+ [
+ 70,
+ 70
+ ],
+ [
+ 128,
+ 128
+ ]
+ ]
+ ]
+} \ No newline at end of file
diff --git a/metrics/linux-gcc8-release/location_indicator/no_radius_border/metrics.json b/metrics/linux-gcc8-release/location_indicator/no_radius_border/metrics.json
index f5a86bed69..089757dbd2 100644
--- a/metrics/linux-gcc8-release/location_indicator/no_radius_border/metrics.json
+++ b/metrics/linux-gcc8-release/location_indicator/no_radius_border/metrics.json
@@ -2,8 +2,8 @@
"memory": [
[
"probeMemory - default - end",
- 2656163,
- 83134
+ 2005701,
+ 3122
],
[
"probeMemory - default - start",
diff --git a/metrics/linux-gcc8-release/location_indicator/no_radius_fill/metrics.json b/metrics/linux-gcc8-release/location_indicator/no_radius_fill/metrics.json
index 59f8c69068..98e4fcf8c8 100644
--- a/metrics/linux-gcc8-release/location_indicator/no_radius_fill/metrics.json
+++ b/metrics/linux-gcc8-release/location_indicator/no_radius_fill/metrics.json
@@ -2,8 +2,8 @@
"memory": [
[
"probeMemory - default - end",
- 2673019,
- 83236
+ 2022418,
+ 3216
],
[
"probeMemory - default - start",
diff --git a/metrics/linux-gcc8-release/location_indicator/no_textures/metrics.json b/metrics/linux-gcc8-release/location_indicator/no_textures/metrics.json
index 65004f1ea1..88ff6a5cec 100644
--- a/metrics/linux-gcc8-release/location_indicator/no_textures/metrics.json
+++ b/metrics/linux-gcc8-release/location_indicator/no_textures/metrics.json
@@ -2,8 +2,8 @@
"memory": [
[
"probeMemory - default - end",
- 2377735,
- 21656
+ 2034636,
+ 2864
],
[
"probeMemory - default - start",
diff --git a/metrics/linux-gcc8-release/location_indicator/one_texture/metrics.json b/metrics/linux-gcc8-release/location_indicator/one_texture/metrics.json
index a17b453ed1..67060da88c 100644
--- a/metrics/linux-gcc8-release/location_indicator/one_texture/metrics.json
+++ b/metrics/linux-gcc8-release/location_indicator/one_texture/metrics.json
@@ -2,8 +2,8 @@
"memory": [
[
"probeMemory - default - end",
- 2665727,
- 83226
+ 2020507,
+ 3166
],
[
"probeMemory - default - start",
diff --git a/metrics/linux-gcc8-release/location_indicator/rotated/metrics.json b/metrics/linux-gcc8-release/location_indicator/rotated/metrics.json
index 63f9083f54..75a417e01c 100644
--- a/metrics/linux-gcc8-release/location_indicator/rotated/metrics.json
+++ b/metrics/linux-gcc8-release/location_indicator/rotated/metrics.json
@@ -2,8 +2,8 @@
"memory": [
[
"probeMemory - default - end",
- 2660636,
- 83197
+ 2023574,
+ 3274
],
[
"probeMemory - default - start",
diff --git a/metrics/linux-gcc8-release/location_indicator/tilted/metrics.json b/metrics/linux-gcc8-release/location_indicator/tilted/metrics.json
index f8f7bbfeb7..0e0a349c67 100644
--- a/metrics/linux-gcc8-release/location_indicator/tilted/metrics.json
+++ b/metrics/linux-gcc8-release/location_indicator/tilted/metrics.json
@@ -2,8 +2,8 @@
"memory": [
[
"probeMemory - default - end",
- 2703062,
- 83350
+ 2057114,
+ 3257
],
[
"probeMemory - default - start",
diff --git a/metrics/linux-gcc8-release/location_indicator/tilted_texture_shift/metrics.json b/metrics/linux-gcc8-release/location_indicator/tilted_texture_shift/metrics.json
index e09448751f..5cb3be895c 100644
--- a/metrics/linux-gcc8-release/location_indicator/tilted_texture_shift/metrics.json
+++ b/metrics/linux-gcc8-release/location_indicator/tilted_texture_shift/metrics.json
@@ -2,8 +2,8 @@
"memory": [
[
"probeMemory - default - end",
- 2677760,
- 83330
+ 2046282,
+ 3307
],
[
"probeMemory - default - start",
diff --git a/metrics/linux-gcc8-release/location_indicator/tilted_texture_shift_bottom_left/metrics.json b/metrics/linux-gcc8-release/location_indicator/tilted_texture_shift_bottom_left/metrics.json
index 83ba4134d8..56203676a3 100644
--- a/metrics/linux-gcc8-release/location_indicator/tilted_texture_shift_bottom_left/metrics.json
+++ b/metrics/linux-gcc8-release/location_indicator/tilted_texture_shift_bottom_left/metrics.json
@@ -2,8 +2,8 @@
"memory": [
[
"probeMemory - default - end",
- 2735091,
- 83429
+ 2041058,
+ 3281
],
[
"probeMemory - default - start",
diff --git a/metrics/linux-gcc8-release/location_indicator/tilted_texture_shift_bottom_right/metrics.json b/metrics/linux-gcc8-release/location_indicator/tilted_texture_shift_bottom_right/metrics.json
index 72b8c8e81a..73727dc0b9 100644
--- a/metrics/linux-gcc8-release/location_indicator/tilted_texture_shift_bottom_right/metrics.json
+++ b/metrics/linux-gcc8-release/location_indicator/tilted_texture_shift_bottom_right/metrics.json
@@ -2,8 +2,8 @@
"memory": [
[
"probeMemory - default - end",
- 2714461,
- 83383
+ 2059723,
+ 3308
],
[
"probeMemory - default - start",
diff --git a/metrics/linux-gcc8-release/location_indicator/tilted_texture_shift_top_left/metrics.json b/metrics/linux-gcc8-release/location_indicator/tilted_texture_shift_top_left/metrics.json
index e315cad556..4d8c02fdf9 100644
--- a/metrics/linux-gcc8-release/location_indicator/tilted_texture_shift_top_left/metrics.json
+++ b/metrics/linux-gcc8-release/location_indicator/tilted_texture_shift_top_left/metrics.json
@@ -2,8 +2,8 @@
"memory": [
[
"probeMemory - default - end",
- 2717377,
- 83399
+ 2064963,
+ 3344
],
[
"probeMemory - default - start",
diff --git a/metrics/linux-gcc8-release/location_indicator/tilted_texture_shift_top_right/metrics.json b/metrics/linux-gcc8-release/location_indicator/tilted_texture_shift_top_right/metrics.json
index c6cdf715c2..1f8d87e778 100644
--- a/metrics/linux-gcc8-release/location_indicator/tilted_texture_shift_top_right/metrics.json
+++ b/metrics/linux-gcc8-release/location_indicator/tilted_texture_shift_top_right/metrics.json
@@ -2,8 +2,8 @@
"memory": [
[
"probeMemory - default - end",
- 2692872,
- 83405
+ 2055996,
+ 3285
],
[
"probeMemory - default - start",
diff --git a/metrics/linux-gcc8-release/location_indicator/two_textures/metrics.json b/metrics/linux-gcc8-release/location_indicator/two_textures/metrics.json
index 30d331e1c6..3399194e5a 100644
--- a/metrics/linux-gcc8-release/location_indicator/two_textures/metrics.json
+++ b/metrics/linux-gcc8-release/location_indicator/two_textures/metrics.json
@@ -2,8 +2,8 @@
"memory": [
[
"probeMemory - default - end",
- 2680943,
- 83221
+ 2019370,
+ 3117
],
[
"probeMemory - default - start",
diff --git a/metrics/tests/location_indicator/dateline/expected.png b/metrics/tests/location_indicator/dateline/expected.png
index 8e1e2e95e9..a188b219f4 100644
--- a/metrics/tests/location_indicator/dateline/expected.png
+++ b/metrics/tests/location_indicator/dateline/expected.png
Binary files differ
diff --git a/metrics/tests/location_indicator/dateline/style.json b/metrics/tests/location_indicator/dateline/style.json
index 410fc5c531..ff9bd5ea17 100644
--- a/metrics/tests/location_indicator/dateline/style.json
+++ b/metrics/tests/location_indicator/dateline/style.json
@@ -39,29 +39,23 @@
{
"id": "puck123",
"type": "location-indicator",
- "layout" : { "bearing" : 45,
+ "layout" : {
"bearing-image" : "puck",
"top-image" : "puck_hat",
- "shadow-image" : "puck_shadow",
- "perspective-compensation" : 1,
- "image-tilt-displacement" : 5
+ "shadow-image" : "puck_shadow"
},
"paint" : {
- "accuracy-radius-transition": { "duration": 0, "delay": 0 },
- "bearing-image-size-transition": { "duration": 0, "delay": 0 },
- "top-image-size-transition": { "duration": 0, "delay": 0 },
- "shadow-image-size-transition": { "duration": 0, "delay": 0 },
- "accuracy-radius-color-transition": { "duration": 0, "delay": 0 },
- "accuracy-radius-border-color-transition": { "duration": 0, "delay": 0 },
-
+ "bearing" : ["interpolate", ["linear"], ["zoom"], 8, 0, 24, 90],
+ "perspective-compensation" : ["interpolate", ["linear"], ["zoom"], 8, 0, 16, 1],
+ "image-tilt-displacement" : ["interpolate", ["linear"], ["zoom"], 8, 0, 16, 6.5],
"location" : [ 35.693055, 139.766707, 0],
- "accuracy-radius": 90.0,
- "bearing-image-size" : 48,
- "top-image-size" : 16,
- "shadow-image-size" : 112,
+ "accuracy-radius": ["interpolate", ["linear"], ["zoom"], 8, 0, 24, 180],
+ "bearing-image-size" : ["interpolate", ["linear"], ["zoom"], 8, 0, 24, 0.52],
+ "top-image-size" : ["interpolate", ["linear"], ["zoom"], 8, 0, 24, 0.36],
+ "shadow-image-size" : ["interpolate", ["linear"], ["zoom"], 8, 0, 24, 0.4],
- "accuracy-radius-color": "rgba(255,0,0,0.2)",
- "accuracy-radius-border-color": "rgba(255,0,255,0.6)"
+ "accuracy-radius-color": ["interpolate", ["linear"], ["zoom"], 8, "rgba(255,0,0,0.2)", 24, "rgba(255,255,0,0.4)"],
+ "accuracy-radius-border-color": ["interpolate", ["linear"], ["zoom"], 8, "rgba(255,0,255,0.2)", 24, "rgba(255,0,255,1)"]
}
}
]
diff --git a/metrics/tests/location_indicator/default/expected.png b/metrics/tests/location_indicator/default/expected.png
index 5823cce89e..f27cb64d98 100644
--- a/metrics/tests/location_indicator/default/expected.png
+++ b/metrics/tests/location_indicator/default/expected.png
Binary files differ
diff --git a/metrics/tests/location_indicator/default/style.json b/metrics/tests/location_indicator/default/style.json
index b0f58b4055..409b980c53 100644
--- a/metrics/tests/location_indicator/default/style.json
+++ b/metrics/tests/location_indicator/default/style.json
@@ -71,26 +71,20 @@
{
"id": "puck124",
"type": "location-indicator",
- "layout" : { "bearing" : 45,
+ "layout" : {
"bearing-image" : "puck",
"top-image" : "puck_hat",
- "shadow-image" : "puck_shadow",
- "perspective-compensation" : 1,
- "image-tilt-displacement" : 5
+ "shadow-image" : "puck_shadow"
},
"paint" : {
- "accuracy-radius-transition": { "duration": 0, "delay": 0 },
- "bearing-image-size-transition": { "duration": 0, "delay": 0 },
- "top-image-size-transition": { "duration": 0, "delay": 0 },
- "shadow-image-size-transition": { "duration": 0, "delay": 0 },
- "accuracy-radius-color-transition": { "duration": 0, "delay": 0 },
- "accuracy-radius-border-color-transition": { "duration": 0, "delay": 0 },
-
+ "bearing" : 45,
+ "perspective-compensation" : 1,
+ "image-tilt-displacement" : 6.5,
"location" : [ 35.693055, 139.766707, 0],
"accuracy-radius": 90.0,
- "bearing-image-size" : 48,
- "top-image-size" : 16,
- "shadow-image-size" : 112,
+ "bearing-image-size" : 0.26,
+ "top-image-size" : 0.18,
+ "shadow-image-size" : 0.2,
"accuracy-radius-color": "rgba(255,0,0,0.2)",
"accuracy-radius-border-color": "rgba(255,0,255,0.6)"
diff --git a/metrics/tests/location_indicator/image_pixel_ratio/expected.png b/metrics/tests/location_indicator/image_pixel_ratio/expected.png
new file mode 100644
index 0000000000..b48b9e1340
--- /dev/null
+++ b/metrics/tests/location_indicator/image_pixel_ratio/expected.png
Binary files differ
diff --git a/metrics/tests/location_indicator/image_pixel_ratio/style.json b/metrics/tests/location_indicator/image_pixel_ratio/style.json
new file mode 100644
index 0000000000..4c52ef1ee0
--- /dev/null
+++ b/metrics/tests/location_indicator/image_pixel_ratio/style.json
@@ -0,0 +1,98 @@
+{
+ "version": 8,
+ "metadata": {
+ "test": {
+ "width": 512,
+ "height": 256,
+ "operations": [
+ [
+ "addImage",
+ "puck_hat@2x",
+ "puck_hat.png",
+ {"pixelRatio": 2.0}
+ ],
+ [
+ "addImage",
+ "puck@2x",
+ "puck.png",
+ {"pixelRatio": 2.0}
+
+ ],
+ [
+ "addImage",
+ "puck_shadow@2x",
+ "puck_shadow.png",
+ {"pixelRatio": 2.0}
+ ]
+ ]
+ }
+ },
+ "sources": {
+ "geojson": {
+ "type": "geojson",
+ "data": {
+ "type": "FeatureCollection",
+ "features": [
+ {
+ "type": "Feature",
+ "properties": {
+ },
+ "geometry": {
+ "type": "Point",
+ "coordinates": [
+ 139.766707,
+ 35.693055
+
+ ]
+ }
+ }
+ ]
+ }
+ }
+ },
+ "center": [ 139.766707, 35.693055 ],
+ "zoom": 16,
+ "pitch" : 0,
+ "bearing" : 42,
+ "sprite" : "local://sprites/emerald@2x",
+ "layers": [
+ {
+ "id": "background",
+ "type": "background",
+ "paint": {
+ "background-color": "lightseagreen"
+ }
+ },
+ {
+ "id": "puck123",
+ "type": "circle",
+ "source": "geojson",
+ "paint": {
+ "circle-radius": 40,
+ "circle-color" : "rgba(255,0,0,0.1)"
+ }
+ },
+ {
+ "id": "puck124",
+ "type": "location-indicator",
+ "layout" : {
+ "bearing-image" : "puck@2x",
+ "top-image" : "marker_icon",
+ "shadow-image" : "puck_shadow@2x"
+ },
+ "paint" : {
+ "bearing" : 45,
+ "perspective-compensation" : 1,
+ "image-tilt-displacement" : 6.5,
+ "location" : [ 35.693055, 139.766707, 0],
+ "accuracy-radius": 90.0,
+ "bearing-image-size" : 0.52,
+ "top-image-size" : 1,
+ "shadow-image-size" : 0.4,
+
+ "accuracy-radius-color": "rgba(255,0,0,0.2)",
+ "accuracy-radius-border-color": "rgba(255,0,255,0.6)"
+ }
+ }
+ ]
+}
diff --git a/metrics/tests/location_indicator/no_radius_border/expected.png b/metrics/tests/location_indicator/no_radius_border/expected.png
index 436a27ed08..c457e027dc 100644
--- a/metrics/tests/location_indicator/no_radius_border/expected.png
+++ b/metrics/tests/location_indicator/no_radius_border/expected.png
Binary files differ
diff --git a/metrics/tests/location_indicator/no_radius_border/style.json b/metrics/tests/location_indicator/no_radius_border/style.json
index 922cd0c0f0..0037b35ac8 100644
--- a/metrics/tests/location_indicator/no_radius_border/style.json
+++ b/metrics/tests/location_indicator/no_radius_border/style.json
@@ -40,26 +40,20 @@
{
"id": "puck123",
"type": "location-indicator",
- "layout" : { "bearing" : 45,
+ "layout" : {
"bearing-image" : "puck",
"top-image" : "puck_hat",
- "shadow-image" : "puck_shadow",
- "perspective-compensation" : 1,
- "image-tilt-displacement" : 5
+ "shadow-image" : "puck_shadow"
},
"paint" : {
- "accuracy-radius-transition": { "duration": 0, "delay": 0 },
- "bearing-image-size-transition": { "duration": 0, "delay": 0 },
- "top-image-size-transition": { "duration": 0, "delay": 0 },
- "shadow-image-size-transition": { "duration": 0, "delay": 0 },
- "accuracy-radius-color-transition": { "duration": 0, "delay": 0 },
- "accuracy-radius-border-color-transition": { "duration": 0, "delay": 0 },
-
+ "bearing" : 45,
+ "perspective-compensation" : 1,
+ "image-tilt-displacement" : 6.5,
"location" : [ 35.693055, 139.766707, 0],
"accuracy-radius": 90.0,
- "bearing-image-size" : 48,
- "top-image-size" : 16,
- "shadow-image-size" : 112,
+ "bearing-image-size" : 0.26,
+ "top-image-size" : 0.18,
+ "shadow-image-size" : 0.2,
"accuracy-radius-color": "rgba(255,0,0,0.2)"
}
diff --git a/metrics/tests/location_indicator/no_radius_fill/expected.png b/metrics/tests/location_indicator/no_radius_fill/expected.png
index 447546c880..5563f33f25 100644
--- a/metrics/tests/location_indicator/no_radius_fill/expected.png
+++ b/metrics/tests/location_indicator/no_radius_fill/expected.png
Binary files differ
diff --git a/metrics/tests/location_indicator/no_radius_fill/style.json b/metrics/tests/location_indicator/no_radius_fill/style.json
index a01ee0c576..1848b28693 100644
--- a/metrics/tests/location_indicator/no_radius_fill/style.json
+++ b/metrics/tests/location_indicator/no_radius_fill/style.json
@@ -39,27 +39,20 @@
{
"id": "puck123",
"type": "location-indicator",
- "layout" : { "bearing" : 45,
+ "layout" : {
"bearing-image" : "puck",
"top-image" : "puck_hat",
- "shadow-image" : "puck_shadow",
- "perspective-compensation" : 1,
- "image-tilt-displacement" : 5
+ "shadow-image" : "puck_shadow"
},
"paint" : {
- "accuracy-radius-transition": { "duration": 0, "delay": 0 },
- "bearing-image-size-transition": { "duration": 0, "delay": 0 },
- "top-image-size-transition": { "duration": 0, "delay": 0 },
- "shadow-image-size-transition": { "duration": 0, "delay": 0 },
-
- "accuracy-radius-color-transition": { "duration": 0, "delay": 0 },
- "accuracy-radius-border-color-transition": { "duration": 0, "delay": 0 },
-
+ "bearing" : 45,
+ "perspective-compensation" : 1,
+ "image-tilt-displacement" : 6.5,
"location" : [ 35.693055, 139.766707, 0],
"accuracy-radius": 90.0,
- "bearing-image-size" : 48,
- "top-image-size" : 16,
- "shadow-image-size" : 112,
+ "bearing-image-size" : 0.26,
+ "top-image-size" : 0.18,
+ "shadow-image-size" : 0.2,
"accuracy-radius-border-color": "rgba(255,0,255,0.6)"
}
diff --git a/metrics/tests/location_indicator/no_textures/style.json b/metrics/tests/location_indicator/no_textures/style.json
index 1cae891f77..3864f748af 100644
--- a/metrics/tests/location_indicator/no_textures/style.json
+++ b/metrics/tests/location_indicator/no_textures/style.json
@@ -39,23 +39,17 @@
{
"id": "puck123",
"type": "location-indicator",
- "layout" : { "bearing" : 45,
- "perspective-compensation" : 1,
- "image-tilt-displacement" : 5
+ "layout" : {
},
"paint" : {
- "accuracy-radius-transition": { "duration": 0, "delay": 0 },
- "bearing-image-size-transition": { "duration": 0, "delay": 0 },
- "top-image-size-transition": { "duration": 0, "delay": 0 },
- "shadow-image-size-transition": { "duration": 0, "delay": 0 },
- "accuracy-radius-color-transition": { "duration": 0, "delay": 0 },
- "accuracy-radius-border-color-transition": { "duration": 0, "delay": 0 },
-
+ "bearing" : 45,
+ "perspective-compensation" : 1,
+ "image-tilt-displacement" : 6.5,
"location" : [ 35.693055, 139.766707, 0],
"accuracy-radius": 90.0,
- "bearing-image-size" : 48,
- "top-image-size" : 16,
- "shadow-image-size" : 112,
+ "bearing-image-size" : 0.26,
+ "top-image-size" : 0.18,
+ "shadow-image-size" : 0.2,
"accuracy-radius-color": "rgba(255,0,0,0.2)",
"accuracy-radius-border-color": "rgba(255,0,255,0.6)"
diff --git a/metrics/tests/location_indicator/one_texture/expected.png b/metrics/tests/location_indicator/one_texture/expected.png
index c0fb9ce580..b955f63993 100644
--- a/metrics/tests/location_indicator/one_texture/expected.png
+++ b/metrics/tests/location_indicator/one_texture/expected.png
Binary files differ
diff --git a/metrics/tests/location_indicator/one_texture/style.json b/metrics/tests/location_indicator/one_texture/style.json
index f44b698c05..f6a976f0f2 100644
--- a/metrics/tests/location_indicator/one_texture/style.json
+++ b/metrics/tests/location_indicator/one_texture/style.json
@@ -39,24 +39,18 @@
{
"id": "puck123",
"type": "location-indicator",
- "layout" : { "bearing" : 45,
- "bearing-image" : "puck",
- "perspective-compensation" : 1,
- "image-tilt-displacement" : 5
+ "layout" : {
+ "bearing-image" : "puck"
},
"paint" : {
- "accuracy-radius-transition": { "duration": 0, "delay": 0 },
- "bearing-image-size-transition": { "duration": 0, "delay": 0 },
- "top-image-size-transition": { "duration": 0, "delay": 0 },
- "shadow-image-size-transition": { "duration": 0, "delay": 0 },
- "accuracy-radius-color-transition": { "duration": 0, "delay": 0 },
- "accuracy-radius-border-color-transition": { "duration": 0, "delay": 0 },
-
+ "bearing" : 45,
+ "perspective-compensation" : 1,
+ "image-tilt-displacement" : 6.5,
"location" : [ 35.693055, 139.766707, 0],
"accuracy-radius": 90.0,
- "bearing-image-size" : 48,
- "top-image-size" : 16,
- "shadow-image-size" : 112,
+ "bearing-image-size" : 0.26,
+ "top-image-size" : 0.18,
+ "shadow-image-size" : 0.2,
"accuracy-radius-color": "rgba(255,0,0,0.2)",
"accuracy-radius-border-color": "rgba(255,0,255,0.6)"
diff --git a/metrics/tests/location_indicator/rotated/expected.png b/metrics/tests/location_indicator/rotated/expected.png
index 4b481b12d5..b3fcfc8201 100644
--- a/metrics/tests/location_indicator/rotated/expected.png
+++ b/metrics/tests/location_indicator/rotated/expected.png
Binary files differ
diff --git a/metrics/tests/location_indicator/rotated/style.json b/metrics/tests/location_indicator/rotated/style.json
index 5a75f56e22..e7e9d90cd4 100644
--- a/metrics/tests/location_indicator/rotated/style.json
+++ b/metrics/tests/location_indicator/rotated/style.json
@@ -39,26 +39,20 @@
{
"id": "puck123",
"type": "location-indicator",
- "layout" : { "bearing" : 0,
+ "layout" : {
"bearing-image" : "puck",
"top-image" : "puck_hat",
- "shadow-image" : "puck_shadow",
- "perspective-compensation" : 1,
- "image-tilt-displacement" : 5
+ "shadow-image" : "puck_shadow"
},
"paint" : {
- "accuracy-radius-transition": { "duration": 0, "delay": 0 },
- "bearing-image-size-transition": { "duration": 0, "delay": 0 },
- "top-image-size-transition": { "duration": 0, "delay": 0 },
- "shadow-image-size-transition": { "duration": 0, "delay": 0 },
- "accuracy-radius-color-transition": { "duration": 0, "delay": 0 },
- "accuracy-radius-border-color-transition": { "duration": 0, "delay": 0 },
-
+ "bearing" : 0,
+ "perspective-compensation" : 1,
+ "image-tilt-displacement" : 6.5,
"location" : [ 35.693055, 139.766707, 0],
"accuracy-radius": 90.0,
- "bearing-image-size" : 48,
- "top-image-size" : 16,
- "shadow-image-size" : 112,
+ "bearing-image-size" : 0.26,
+ "top-image-size" : 0.18,
+ "shadow-image-size" : 0.2,
"accuracy-radius-color": "rgba(255,0,0,0.2)",
"accuracy-radius-border-color": "rgba(255,0,255,0.6)"
diff --git a/metrics/tests/location_indicator/tilted/expected.png b/metrics/tests/location_indicator/tilted/expected.png
index 624be49df3..4408e2a4b4 100644
--- a/metrics/tests/location_indicator/tilted/expected.png
+++ b/metrics/tests/location_indicator/tilted/expected.png
Binary files differ
diff --git a/metrics/tests/location_indicator/tilted/style.json b/metrics/tests/location_indicator/tilted/style.json
index 9dfe1033ff..fb6b31be4d 100644
--- a/metrics/tests/location_indicator/tilted/style.json
+++ b/metrics/tests/location_indicator/tilted/style.json
@@ -39,26 +39,20 @@
{
"id": "puck123",
"type": "location-indicator",
- "layout" : { "bearing" : 45,
+ "layout" : {
"bearing-image" : "puck",
"top-image" : "puck_hat",
- "shadow-image" : "puck_shadow",
- "perspective-compensation" : 1,
- "image-tilt-displacement" : 0
+ "shadow-image" : "puck_shadow"
},
"paint" : {
- "accuracy-radius-transition": { "duration": 0, "delay": 0 },
- "bearing-image-size-transition": { "duration": 0, "delay": 0 },
- "top-image-size-transition": { "duration": 0, "delay": 0 },
- "shadow-image-size-transition": { "duration": 0, "delay": 0 },
- "accuracy-radius-color-transition": { "duration": 0, "delay": 0 },
- "accuracy-radius-border-color-transition": { "duration": 0, "delay": 0 },
-
+ "bearing" : 45,
+ "perspective-compensation" : 1,
+ "image-tilt-displacement" : 0,
"location" : [ 35.693055, 139.766707, 0],
"accuracy-radius": 90.0,
- "bearing-image-size" : 48,
- "top-image-size" : 16,
- "shadow-image-size" : 112,
+ "bearing-image-size" : 0.26,
+ "top-image-size" : 0.18,
+ "shadow-image-size" : 0.2,
"accuracy-radius-color": "rgba(255,0,0,0.2)",
"accuracy-radius-border-color": "rgba(255,0,255,0.6)"
diff --git a/metrics/tests/location_indicator/tilted_texture_shift/expected.png b/metrics/tests/location_indicator/tilted_texture_shift/expected.png
index 0a4baa1b58..8b533f7da7 100644
--- a/metrics/tests/location_indicator/tilted_texture_shift/expected.png
+++ b/metrics/tests/location_indicator/tilted_texture_shift/expected.png
Binary files differ
diff --git a/metrics/tests/location_indicator/tilted_texture_shift/style.json b/metrics/tests/location_indicator/tilted_texture_shift/style.json
index 6b6372ae1d..1ee6e3ab25 100644
--- a/metrics/tests/location_indicator/tilted_texture_shift/style.json
+++ b/metrics/tests/location_indicator/tilted_texture_shift/style.json
@@ -39,26 +39,20 @@
{
"id": "puck123",
"type": "location-indicator",
- "layout" : { "bearing" : 45,
+ "layout" : {
"bearing-image" : "puck",
"top-image" : "puck_hat",
- "shadow-image" : "puck_shadow",
- "perspective-compensation" : 1,
- "image-tilt-displacement" : 5
+ "shadow-image" : "puck_shadow"
},
"paint" : {
- "accuracy-radius-transition": { "duration": 0, "delay": 0 },
- "bearing-image-size-transition": { "duration": 0, "delay": 0 },
- "top-image-size-transition": { "duration": 0, "delay": 0 },
- "shadow-image-size-transition": { "duration": 0, "delay": 0 },
- "accuracy-radius-color-transition": { "duration": 0, "delay": 0 },
- "accuracy-radius-border-color-transition": { "duration": 0, "delay": 0 },
-
+ "perspective-compensation" : 1,
+ "image-tilt-displacement" : 6.5,
+ "bearing" : 45,
"location" : [ 35.693055, 139.766707, 0],
"accuracy-radius": 90.0,
- "bearing-image-size" : 48,
- "top-image-size" : 16,
- "shadow-image-size" : 112,
+ "bearing-image-size" : 0.26,
+ "top-image-size" : 0.18,
+ "shadow-image-size" : 0.2,
"accuracy-radius-color": "rgba(255,0,0,0.2)",
"accuracy-radius-border-color": "rgba(255,0,255,0.6)"
diff --git a/metrics/tests/location_indicator/tilted_texture_shift_bottom_left/expected.png b/metrics/tests/location_indicator/tilted_texture_shift_bottom_left/expected.png
index a651914b09..e1de70ede8 100644
--- a/metrics/tests/location_indicator/tilted_texture_shift_bottom_left/expected.png
+++ b/metrics/tests/location_indicator/tilted_texture_shift_bottom_left/expected.png
Binary files differ
diff --git a/metrics/tests/location_indicator/tilted_texture_shift_bottom_left/style.json b/metrics/tests/location_indicator/tilted_texture_shift_bottom_left/style.json
index 1d5bb8ae6f..dd7667bf23 100644
--- a/metrics/tests/location_indicator/tilted_texture_shift_bottom_left/style.json
+++ b/metrics/tests/location_indicator/tilted_texture_shift_bottom_left/style.json
@@ -40,26 +40,20 @@
{
"id": "puck123",
"type": "location-indicator",
- "layout" : { "bearing" : 45,
+ "layout" : {
"bearing-image" : "puck",
"top-image" : "puck_hat",
- "shadow-image" : "puck_shadow",
- "perspective-compensation" : 1,
- "image-tilt-displacement" : 5
+ "shadow-image" : "puck_shadow"
},
"paint" : {
- "accuracy-radius-transition": { "duration": 0, "delay": 0 },
- "bearing-image-size-transition": { "duration": 0, "delay": 0 },
- "top-image-size-transition": { "duration": 0, "delay": 0 },
- "shadow-image-size-transition": { "duration": 0, "delay": 0 },
- "accuracy-radius-color-transition": { "duration": 0, "delay": 0 },
- "accuracy-radius-border-color-transition": { "duration": 0, "delay": 0 },
-
+ "perspective-compensation" : 1,
+ "image-tilt-displacement" : 6.5,
+ "bearing" : 45,
"location" : [ 35.693055, 139.766707, 0],
"accuracy-radius": 90.0,
- "bearing-image-size" : 48,
- "top-image-size" : 16,
- "shadow-image-size" : 112,
+ "bearing-image-size" : 0.26,
+ "top-image-size" : 0.18,
+ "shadow-image-size" : 0.2,
"accuracy-radius-color": "rgba(255,0,0,0.2)",
"accuracy-radius-border-color": "rgba(255,0,255,0.6)"
diff --git a/metrics/tests/location_indicator/tilted_texture_shift_bottom_right/expected.png b/metrics/tests/location_indicator/tilted_texture_shift_bottom_right/expected.png
index d0839ea66f..d6b3c330a6 100644
--- a/metrics/tests/location_indicator/tilted_texture_shift_bottom_right/expected.png
+++ b/metrics/tests/location_indicator/tilted_texture_shift_bottom_right/expected.png
Binary files differ
diff --git a/metrics/tests/location_indicator/tilted_texture_shift_bottom_right/style.json b/metrics/tests/location_indicator/tilted_texture_shift_bottom_right/style.json
index 611bea2a98..53b80572b0 100644
--- a/metrics/tests/location_indicator/tilted_texture_shift_bottom_right/style.json
+++ b/metrics/tests/location_indicator/tilted_texture_shift_bottom_right/style.json
@@ -39,26 +39,20 @@
{
"id": "puck123",
"type": "location-indicator",
- "layout" : { "bearing" : 45,
+ "layout" : {
"bearing-image" : "puck",
"top-image" : "puck_hat",
- "shadow-image" : "puck_shadow",
- "perspective-compensation" : 1,
- "image-tilt-displacement" : 5
+ "shadow-image" : "puck_shadow"
},
"paint" : {
- "accuracy-radius-transition": { "duration": 0, "delay": 0 },
- "bearing-image-size-transition": { "duration": 0, "delay": 0 },
- "top-image-size-transition": { "duration": 0, "delay": 0 },
- "shadow-image-size-transition": { "duration": 0, "delay": 0 },
- "accuracy-radius-color-transition": { "duration": 0, "delay": 0 },
- "accuracy-radius-border-color-transition": { "duration": 0, "delay": 0 },
-
+ "perspective-compensation" : 1,
+ "image-tilt-displacement" : 6.5,
+ "bearing" : 45,
"location" : [ 35.693055, 139.766707, 0],
"accuracy-radius": 90.0,
- "bearing-image-size" : 48,
- "top-image-size" : 16,
- "shadow-image-size" : 112,
+ "bearing-image-size" : 0.26,
+ "top-image-size" : 0.18,
+ "shadow-image-size" : 0.2,
"accuracy-radius-color": "rgba(255,0,0,0.2)",
"accuracy-radius-border-color": "rgba(255,0,255,0.6)"
diff --git a/metrics/tests/location_indicator/tilted_texture_shift_top_left/expected.png b/metrics/tests/location_indicator/tilted_texture_shift_top_left/expected.png
index 48747eb194..9d31ed9a48 100644
--- a/metrics/tests/location_indicator/tilted_texture_shift_top_left/expected.png
+++ b/metrics/tests/location_indicator/tilted_texture_shift_top_left/expected.png
Binary files differ
diff --git a/metrics/tests/location_indicator/tilted_texture_shift_top_left/style.json b/metrics/tests/location_indicator/tilted_texture_shift_top_left/style.json
index 00899046d6..0becd051f5 100644
--- a/metrics/tests/location_indicator/tilted_texture_shift_top_left/style.json
+++ b/metrics/tests/location_indicator/tilted_texture_shift_top_left/style.json
@@ -39,26 +39,20 @@
{
"id": "puck123",
"type": "location-indicator",
- "layout" : { "bearing" : 45,
+ "layout" : {
"bearing-image" : "puck",
"top-image" : "puck_hat",
- "shadow-image" : "puck_shadow",
- "perspective-compensation" : 1,
- "image-tilt-displacement" : 5
+ "shadow-image" : "puck_shadow"
},
"paint" : {
- "accuracy-radius-transition": { "duration": 0, "delay": 0 },
- "bearing-image-size-transition": { "duration": 0, "delay": 0 },
- "top-image-size-transition": { "duration": 0, "delay": 0 },
- "shadow-image-size-transition": { "duration": 0, "delay": 0 },
- "accuracy-radius-color-transition": { "duration": 0, "delay": 0 },
- "accuracy-radius-border-color-transition": { "duration": 0, "delay": 0 },
-
+ "bearing" : 45,
+ "perspective-compensation" : 1,
+ "image-tilt-displacement" : 6.5,
"location" : [ 35.693055, 139.766707, 0],
"accuracy-radius": 90.0,
- "bearing-image-size" : 48,
- "top-image-size" : 16,
- "shadow-image-size" : 112,
+ "bearing-image-size" : 0.26,
+ "top-image-size" : 0.18,
+ "shadow-image-size" : 0.2,
"accuracy-radius-color": "rgba(255,0,0,0.2)",
"accuracy-radius-border-color": "rgba(255,0,255,0.6)"
diff --git a/metrics/tests/location_indicator/tilted_texture_shift_top_right/expected.png b/metrics/tests/location_indicator/tilted_texture_shift_top_right/expected.png
index 3b39556295..e0e59d4edc 100644
--- a/metrics/tests/location_indicator/tilted_texture_shift_top_right/expected.png
+++ b/metrics/tests/location_indicator/tilted_texture_shift_top_right/expected.png
Binary files differ
diff --git a/metrics/tests/location_indicator/tilted_texture_shift_top_right/style.json b/metrics/tests/location_indicator/tilted_texture_shift_top_right/style.json
index 71412339e6..dd9e17a493 100644
--- a/metrics/tests/location_indicator/tilted_texture_shift_top_right/style.json
+++ b/metrics/tests/location_indicator/tilted_texture_shift_top_right/style.json
@@ -39,26 +39,20 @@
{
"id": "puck123",
"type": "location-indicator",
- "layout" : { "bearing" : 0,
+ "layout" : {
"bearing-image" : "puck",
"top-image" : "puck_hat",
- "shadow-image" : "puck_shadow",
- "perspective-compensation" : 1,
- "image-tilt-displacement" : 5
+ "shadow-image" : "puck_shadow"
},
"paint" : {
- "accuracy-radius-transition": { "duration": 0, "delay": 0 },
- "bearing-image-size-transition": { "duration": 0, "delay": 0 },
- "top-image-size-transition": { "duration": 0, "delay": 0 },
- "shadow-image-size-transition": { "duration": 0, "delay": 0 },
- "accuracy-radius-color-transition": { "duration": 0, "delay": 0 },
- "accuracy-radius-border-color-transition": { "duration": 0, "delay": 0 },
-
+ "perspective-compensation" : 1,
+ "image-tilt-displacement" : 6.5,
+ "bearing" : 0,
"location" : [ 35.693055, 139.766707, 0],
"accuracy-radius": 90.0,
- "bearing-image-size" : 48,
- "top-image-size" : 16,
- "shadow-image-size" : 112,
+ "bearing-image-size" : 0.26,
+ "top-image-size" : 0.18,
+ "shadow-image-size" : 0.2,
"accuracy-radius-color": "rgba(255,0,0,0.2)",
"accuracy-radius-border-color": "rgba(255,0,255,0.6)"
diff --git a/metrics/tests/location_indicator/two_textures/expected.png b/metrics/tests/location_indicator/two_textures/expected.png
index f876aaddb7..28d6ec95b9 100644
--- a/metrics/tests/location_indicator/two_textures/expected.png
+++ b/metrics/tests/location_indicator/two_textures/expected.png
Binary files differ
diff --git a/metrics/tests/location_indicator/two_textures/style.json b/metrics/tests/location_indicator/two_textures/style.json
index 01c5405265..2d470d79d7 100644
--- a/metrics/tests/location_indicator/two_textures/style.json
+++ b/metrics/tests/location_indicator/two_textures/style.json
@@ -39,25 +39,19 @@
{
"id": "puck123",
"type": "location-indicator",
- "layout" : { "bearing" : 45,
+ "layout" : {
"bearing-image" : "puck",
- "shadow-image" : "puck_shadow",
- "perspective-compensation" : 1,
- "image-tilt-displacement" : 5
+ "shadow-image" : "puck_shadow"
},
"paint" : {
- "accuracy-radius-transition": { "duration": 0, "delay": 0 },
- "bearing-image-size-transition": { "duration": 0, "delay": 0 },
- "top-image-size-transition": { "duration": 0, "delay": 0 },
- "shadow-image-size-transition": { "duration": 0, "delay": 0 },
- "accuracy-radius-color-transition": { "duration": 0, "delay": 0 },
- "accuracy-radius-border-color-transition": { "duration": 0, "delay": 0 },
-
+ "bearing" : 45,
+ "perspective-compensation" : 1,
+ "image-tilt-displacement" : 6.5,
"location" : [ 35.693055, 139.766707, 0],
"accuracy-radius": 90.0,
- "bearing-image-size" : 48,
- "top-image-size" : 16,
- "shadow-image-size" : 112,
+ "bearing-image-size" : 0.26,
+ "top-image-size" : 0.18,
+ "shadow-image-size" : 0.2,
"accuracy-radius-color": "rgba(255,0,0,0.2)",
"accuracy-radius-border-color": "rgba(255,0,255,0.6)"
diff --git a/platform/glfw/glfw_view.cpp b/platform/glfw/glfw_view.cpp
index c65df4d1cb..aa320df831 100644
--- a/platform/glfw/glfw_view.cpp
+++ b/platform/glfw/glfw_view.cpp
@@ -991,10 +991,10 @@ void GLFWView::toggleLocationIndicatorLayer() {
puckLayer->setBearingTransition(mbgl::style::TransitionOptions(mbgl::Duration::zero(), mbgl::Duration::zero()));
puckLayer->setBearing(mbgl::style::Rotation(0.0));
puckLayer->setAccuracyRadiusBorderColor(premultiply(mbgl::Color{0.0, 1.0, 0.2, 0.4}));
- puckLayer->setTopImageSize(24);
- puckLayer->setBearingImageSize(72);
- puckLayer->setShadowImageSize(96);
- puckLayer->setImageTiltDisplacement(8.0f); // set to 0 for a "flat" puck
+ puckLayer->setTopImageSize(0.18);
+ puckLayer->setBearingImageSize(0.26);
+ puckLayer->setShadowImageSize(0.2);
+ puckLayer->setImageTiltDisplacement(7.0f); // set to 0 for a "flat" puck
puckLayer->setPerspectiveCompensation(0.9);
map->getStyle().addImage(std::make_unique<mbgl::style::Image>(
diff --git a/scripts/style-spec.js b/scripts/style-spec.js
index 15a4c7e0dc..fc16849de0 100644
--- a/scripts/style-spec.js
+++ b/scripts/style-spec.js
@@ -34,7 +34,10 @@ referenceSpec["layout_location-indicator"] = {
]
},
"doc": "Name of image in sprite to use as the background of the location indicator."
- },
+ }
+};
+
+referenceSpec["paint_location-indicator"] = {
"perspective-compensation": {
"type": "number",
"default": "0.85",
@@ -59,10 +62,7 @@ referenceSpec["layout_location-indicator"] = {
]
},
"doc": "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."
- }
-};
-
-referenceSpec["paint_location-indicator"] = {
+ },
"bearing": {
"type": "number",
"default": "0",
@@ -74,7 +74,7 @@ referenceSpec["paint_location-indicator"] = {
"interpolated": false,
"parameters": [ ]
},
- "transition": false,
+ "transition": true,
"doc": "The bearing of the location indicator."
},
"location": {
@@ -110,9 +110,9 @@ referenceSpec["paint_location-indicator"] = {
},
"top-image-size": {
"type": "number",
- "units": "pixels",
+ "units": "factor of the original icon size",
"property-type": "data-constant",
- "default": 0,
+ "default": 1,
"expression": {
"interpolated": true,
"parameters": [
@@ -120,13 +120,13 @@ referenceSpec["paint_location-indicator"] = {
]
},
"transition": true,
- "doc": "The size of the top image, in pixels."
+ "doc": "The size of the top image, as a scale factor applied to the size of the specified image."
},
"bearing-image-size": {
"type": "number",
- "units": "pixels",
+ "units": "factor of the original icon size",
"property-type": "data-constant",
- "default": 0,
+ "default": 1,
"expression": {
"interpolated": true,
"parameters": [
@@ -134,13 +134,13 @@ referenceSpec["paint_location-indicator"] = {
]
},
"transition": true,
- "doc": "The size of the bearing image, in pixels."
+ "doc": "The size of the bearing image, as a scale factor applied to the size of the specified image."
},
"shadow-image-size": {
"type": "number",
- "units": "pixels",
+ "units": "factor of the original icon size",
"property-type": "data-constant",
- "default": 0,
+ "default": 1,
"expression": {
"interpolated": true,
"parameters": [
@@ -148,7 +148,7 @@ referenceSpec["paint_location-indicator"] = {
]
},
"transition": true,
- "doc": "The size of the shadow image, in pixels."
+ "doc": "The size of the shadow image, as a scale factor applied to the size of the specified image."
},
"accuracy-radius-color": {
"type": "color",
diff --git a/src/mbgl/gl/defines.hpp b/src/mbgl/gl/defines.hpp
index 1d9177d069..52dc92d230 100644
--- a/src/mbgl/gl/defines.hpp
+++ b/src/mbgl/gl/defines.hpp
@@ -149,6 +149,7 @@
#define GL_TEXTURE_2D 0x0DE1
#define GL_TEXTURE_BINDING_2D 0x8069
#define GL_TEXTURE_MAG_FILTER 0x2800
+#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
#define GL_TEXTURE_MIN_FILTER 0x2801
#define GL_TEXTURE_WRAP_S 0x2802
#define GL_TEXTURE_WRAP_T 0x2803
@@ -163,7 +164,6 @@
#define GL_VERTEX_SHADER 0x8B31
#define GL_VIEWPORT 0x0BA2
#define GL_ZERO 0
-#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
#ifdef MBGL_USE_GLES2
#define GL_HALF_FLOAT 0x8D61
#else
diff --git a/src/mbgl/renderer/layers/render_location_indicator_layer.cpp b/src/mbgl/renderer/layers/render_location_indicator_layer.cpp
index 94ac46e216..f3d72f02d1 100644
--- a/src/mbgl/renderer/layers/render_location_indicator_layer.cpp
+++ b/src/mbgl/renderer/layers/render_location_indicator_layer.cpp
@@ -48,9 +48,9 @@ struct LocationIndicatorRenderParameters {
double errorRadiusMeters;
mbgl::Color errorRadiusColor{0, 0, 0, 0};
mbgl::Color errorRadiusBorderColor{0, 0, 0, 0};
- int puckSizePx = 0;
- int puckHatSizePx = 0;
- int puckShadowSizePx = 0;
+ float puckScale = 0;
+ float puckHatScale = 0;
+ float puckShadowScale = 0;
float puckLayersDisplacement = 0;
float perspectiveCompensation = 0;
std::string puckImagePath;
@@ -266,7 +266,6 @@ public:
~Texture() { release(); }
void release() {
MBGL_CHECK_ERROR(glDeleteTextures(1, &texId));
- texId = 0;
image = nullptr;
}
/*
@@ -276,10 +275,16 @@ public:
if ((img && &img->get()->image == image) || (!img && !image)) return;
imageDirty = true;
image = (img) ? &img->get()->image : nullptr;
- if (img)
+ width = height = 0;
+ pixelRatio = 1.0f;
+ if (img) {
sharedImage = *img; // keep reference until uploaded
- else
+ width = image->size.width;
+ height = image->size.height;
+ pixelRatio = img->get()->pixelRatio;
+ } else {
sharedImage = nullopt;
+ }
}
void upload() {
@@ -329,13 +334,21 @@ public:
const mbgl::PremultipliedImage* image = nullptr;
optional<Immutable<style::Image::Impl>> sharedImage;
bool imageDirty = false;
+ size_t width = 0;
+ size_t height = 0;
+ float pixelRatio = 1.0f;
};
RenderLocationIndicatorImpl() : ruler(0, mapbox::cheap_ruler::CheapRuler::Meters) {}
- static bool hasExtension(const std::string& ext) {
- if (const auto* extensions = reinterpret_cast<const char*>(MBGL_CHECK_ERROR(glGetString(GL_EXTENSIONS)))) {
- if (strstr(extensions, ext.c_str()) != nullptr) return true;
+ static bool hasAnisotropicFiltering() {
+ const auto* extensions = reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS));
+ GLenum error = glGetError();
+ if (error != GL_NO_ERROR) { // glGetString(GL_EXTENSIONS) is deprecated in OpenGL Desktop 3.0+. But OpenGL 3.0+
+ // has anisotropic filtering.
+ return true;
+ } else {
+ if (strstr(extensions, "GL_EXT_texture_filter_anisotropic") != nullptr) return true;
}
return false;
}
@@ -343,7 +356,7 @@ public:
// Check if anisotropic filtering is available
if (initialized) return;
initialized = true;
- if (hasExtension("GL_EXT_texture_filter_anisotropic")) anisotropicFilteringAvailable = true;
+ if (hasAnisotropicFiltering()) anisotropicFilteringAvailable = true;
simpleShader.initialize();
texturedShader.initialize();
texCoords = {{{0.0f, 1.0f},
@@ -363,7 +376,7 @@ public:
void release() {
if (!simpleShader.program) return;
- textures.clear();
+ for (const auto& t : textures) t.second->release();
buffer.release();
circleBuffer.release();
puckBuffer.release();
@@ -382,16 +395,13 @@ public:
} else if (params.puckBearing != oldParams.puckBearing ||
params.puckLayersDisplacement != oldParams.puckLayersDisplacement ||
params.perspectiveCompensation != oldParams.perspectiveCompensation ||
- params.puckSizePx != oldParams.puckSizePx || params.puckHatSizePx != oldParams.puckHatSizePx ||
- params.puckShadowSizePx != oldParams.puckShadowSizePx)
+ params.puckScale != oldParams.puckScale || params.puckHatScale != oldParams.puckHatScale ||
+ params.puckShadowScale != oldParams.puckShadowScale)
bearingChanged = true; // changes puck geometry but not necessarily the location
if (params.errorRadiusMeters != oldParams.errorRadiusMeters) radiusChanged = true;
- if (params.puckImagePath != oldParams.puckImagePath)
- setTextureFromImageID(params.puckImagePath, texPuck, params);
- if (params.puckShadowImagePath != oldParams.puckShadowImagePath)
- setTextureFromImageID(params.puckShadowImagePath, texShadow, params);
- if (params.puckHatImagePath != oldParams.puckHatImagePath)
- setTextureFromImageID(params.puckHatImagePath, texPuckHat, params);
+ setTextureFromImageID(params.puckImagePath, texPuck, params);
+ setTextureFromImageID(params.puckShadowImagePath, texShadow, params);
+ setTextureFromImageID(params.puckHatImagePath, texPuckHat, params);
projectionCircle = params.projectionMatrix;
const Point<double> positionMercator = project(params.puckPosition, *params.state);
@@ -539,10 +549,12 @@ protected:
params.perspectiveCompensation; // Compensation factor for the perspective deformation
// ^ clamping this to 0.8 to avoid growing the puck too much close to the camera.
const double shadowRadius =
- params.puckShadowSizePx * M_SQRT2 * 0.5 *
+ ((texShadow) ? texShadow->width / texShadow->pixelRatio : 0.0) * params.puckShadowScale * M_SQRT2 * 0.5 *
horizontalScaleFactor; // Technically it's not the radius, but the half diagonal of the quad.
- const double puckRadius = params.puckSizePx * M_SQRT2 * 0.5 * horizontalScaleFactor;
- const double hatRadius = params.puckHatSizePx * M_SQRT2 * 0.5 * horizontalScaleFactor;
+ const double puckRadius = ((texPuck) ? texPuck->width / texPuck->pixelRatio : 0.0) * params.puckScale *
+ M_SQRT2 * 0.5 * horizontalScaleFactor;
+ const double hatRadius = ((texPuckHat) ? texPuckHat->width / texPuckHat->pixelRatio : 0.0) *
+ params.puckHatScale * M_SQRT2 * 0.5 * horizontalScaleFactor;
for (unsigned long i = 0; i < 4; ++i) {
const auto b = util::wrap<float>(params.puckBearing + bearings[i], 0.0f, 360.0f);
@@ -634,6 +646,11 @@ protected:
else
tx->assign(nullptr);
textures[imagePath] = tx;
+ } else {
+ const Immutable<style::Image::Impl>* ima = params.imageManager->getSharedImage(imagePath);
+ const mbgl::PremultipliedImage* img = (ima) ? &ima->get()->image : nullptr;
+ if (textures.at(imagePath)->image != img) // image for the ID might have changed.
+ textures.at(imagePath)->assign(ima);
}
tex = textures.at(imagePath);
}
@@ -690,7 +707,6 @@ RenderLocationIndicatorLayer::RenderLocationIndicatorLayer(Immutable<style::Loca
}
RenderLocationIndicatorLayer::~RenderLocationIndicatorLayer() {
- assert(gfx::BackendScope::exists());
if (!contextDestroyed) MBGL_CHECK_ERROR(renderImpl->release());
}
@@ -711,10 +727,12 @@ void RenderLocationIndicatorLayer::evaluate(const PropertyEvaluationParameters&
renderImpl->parameters.errorRadiusColor = evaluated.get<style::AccuracyRadiusColor>();
renderImpl->parameters.errorRadiusBorderColor = evaluated.get<style::AccuracyRadiusBorderColor>();
renderImpl->parameters.errorRadiusMeters = evaluated.get<style::AccuracyRadius>();
- renderImpl->parameters.puckSizePx = evaluated.get<style::BearingImageSize>();
- renderImpl->parameters.puckHatSizePx = evaluated.get<style::TopImageSize>();
- renderImpl->parameters.puckShadowSizePx = evaluated.get<style::ShadowImageSize>();
+ renderImpl->parameters.puckScale = evaluated.get<style::BearingImageSize>();
+ renderImpl->parameters.puckHatScale = evaluated.get<style::TopImageSize>();
+ renderImpl->parameters.puckShadowScale = evaluated.get<style::ShadowImageSize>();
renderImpl->parameters.puckBearing = evaluated.get<style::Bearing>().getAngle();
+ renderImpl->parameters.puckLayersDisplacement = evaluated.get<style::ImageTiltDisplacement>();
+ renderImpl->parameters.perspectiveCompensation = evaluated.get<style::PerspectiveCompensation>();
const std::array<double, 3> pos = evaluated.get<style::Location>();
renderImpl->parameters.puckPosition = LatLng{pos[0], pos[1]};
@@ -726,10 +744,6 @@ void RenderLocationIndicatorLayer::evaluate(const PropertyEvaluationParameters&
renderImpl->parameters.puckShadowImagePath = layout.get<style::ShadowImage>().asConstant().id();
if (!layout.get<style::TopImage>().isUndefined())
renderImpl->parameters.puckHatImagePath = layout.get<style::TopImage>().asConstant().id();
- if (!layout.get<style::ImageTiltDisplacement>().isUndefined())
- renderImpl->parameters.puckLayersDisplacement = layout.get<style::ImageTiltDisplacement>().asConstant();
- if (!layout.get<style::PerspectiveCompensation>().isUndefined())
- renderImpl->parameters.perspectiveCompensation = layout.get<style::PerspectiveCompensation>().asConstant();
evaluatedProperties = std::move(properties);
}
diff --git a/src/mbgl/style/layers/location_indicator_layer.cpp b/src/mbgl/style/layers/location_indicator_layer.cpp
index 178fd104ad..b3590d78e4 100644
--- a/src/mbgl/style/layers/location_indicator_layer.cpp
+++ b/src/mbgl/style/layers/location_indicator_layer.cpp
@@ -78,36 +78,6 @@ void LocationIndicatorLayer::setBearingImage(const PropertyValue<expression::Ima
baseImpl = std::move(impl_);
observer->onLayerChanged(*this);
}
-PropertyValue<float> LocationIndicatorLayer::getDefaultImageTiltDisplacement() {
- return ImageTiltDisplacement::defaultValue();
-}
-
-const PropertyValue<float>& LocationIndicatorLayer::getImageTiltDisplacement() const {
- return impl().layout.get<ImageTiltDisplacement>();
-}
-
-void LocationIndicatorLayer::setImageTiltDisplacement(const PropertyValue<float>& value) {
- if (value == getImageTiltDisplacement()) return;
- auto impl_ = mutableImpl();
- impl_->layout.get<ImageTiltDisplacement>() = value;
- baseImpl = std::move(impl_);
- observer->onLayerChanged(*this);
-}
-PropertyValue<float> LocationIndicatorLayer::getDefaultPerspectiveCompensation() {
- return PerspectiveCompensation::defaultValue();
-}
-
-const PropertyValue<float>& LocationIndicatorLayer::getPerspectiveCompensation() const {
- return impl().layout.get<PerspectiveCompensation>();
-}
-
-void LocationIndicatorLayer::setPerspectiveCompensation(const PropertyValue<float>& value) {
- if (value == getPerspectiveCompensation()) return;
- auto impl_ = mutableImpl();
- impl_->layout.get<PerspectiveCompensation>() = value;
- baseImpl = std::move(impl_);
- observer->onLayerChanged(*this);
-}
PropertyValue<expression::Image> LocationIndicatorLayer::getDefaultShadowImage() {
return ShadowImage::defaultValue();
}
@@ -250,7 +220,7 @@ TransitionOptions LocationIndicatorLayer::getBearingTransition() const {
}
PropertyValue<float> LocationIndicatorLayer::getDefaultBearingImageSize() {
- return {0};
+ return {1};
}
const PropertyValue<float>& LocationIndicatorLayer::getBearingImageSize() const {
@@ -276,6 +246,33 @@ TransitionOptions LocationIndicatorLayer::getBearingImageSizeTransition() const
return impl().paint.template get<BearingImageSize>().options;
}
+PropertyValue<float> LocationIndicatorLayer::getDefaultImageTiltDisplacement() {
+ return {0};
+}
+
+const PropertyValue<float>& LocationIndicatorLayer::getImageTiltDisplacement() const {
+ return impl().paint.template get<ImageTiltDisplacement>().value;
+}
+
+void LocationIndicatorLayer::setImageTiltDisplacement(const PropertyValue<float>& value) {
+ if (value == getImageTiltDisplacement())
+ return;
+ auto impl_ = mutableImpl();
+ impl_->paint.template get<ImageTiltDisplacement>().value = value;
+ baseImpl = std::move(impl_);
+ observer->onLayerChanged(*this);
+}
+
+void LocationIndicatorLayer::setImageTiltDisplacementTransition(const TransitionOptions& options) {
+ auto impl_ = mutableImpl();
+ impl_->paint.template get<ImageTiltDisplacement>().options = options;
+ baseImpl = std::move(impl_);
+}
+
+TransitionOptions LocationIndicatorLayer::getImageTiltDisplacementTransition() const {
+ return impl().paint.template get<ImageTiltDisplacement>().options;
+}
+
PropertyValue<std::array<double, 3>> LocationIndicatorLayer::getDefaultLocation() {
return {{{0, 0, 0}}};
}
@@ -303,8 +300,35 @@ TransitionOptions LocationIndicatorLayer::getLocationTransition() const {
return impl().paint.template get<Location>().options;
}
+PropertyValue<float> LocationIndicatorLayer::getDefaultPerspectiveCompensation() {
+ return {0.85};
+}
+
+const PropertyValue<float>& LocationIndicatorLayer::getPerspectiveCompensation() const {
+ return impl().paint.template get<PerspectiveCompensation>().value;
+}
+
+void LocationIndicatorLayer::setPerspectiveCompensation(const PropertyValue<float>& value) {
+ if (value == getPerspectiveCompensation())
+ return;
+ auto impl_ = mutableImpl();
+ impl_->paint.template get<PerspectiveCompensation>().value = value;
+ baseImpl = std::move(impl_);
+ observer->onLayerChanged(*this);
+}
+
+void LocationIndicatorLayer::setPerspectiveCompensationTransition(const TransitionOptions& options) {
+ auto impl_ = mutableImpl();
+ impl_->paint.template get<PerspectiveCompensation>().options = options;
+ baseImpl = std::move(impl_);
+}
+
+TransitionOptions LocationIndicatorLayer::getPerspectiveCompensationTransition() const {
+ return impl().paint.template get<PerspectiveCompensation>().options;
+}
+
PropertyValue<float> LocationIndicatorLayer::getDefaultShadowImageSize() {
- return {0};
+ return {1};
}
const PropertyValue<float>& LocationIndicatorLayer::getShadowImageSize() const {
@@ -331,7 +355,7 @@ TransitionOptions LocationIndicatorLayer::getShadowImageSizeTransition() const {
}
PropertyValue<float> LocationIndicatorLayer::getDefaultTopImageSize() {
- return {0};
+ return {1};
}
const PropertyValue<float>& LocationIndicatorLayer::getTopImageSize() const {
@@ -361,7 +385,7 @@ using namespace conversion;
namespace {
-constexpr uint8_t kPaintPropertyCount = 16u;
+constexpr uint8_t kPaintPropertyCount = 20u;
enum class Property : uint8_t {
AccuracyRadius,
@@ -369,7 +393,9 @@ enum class Property : uint8_t {
AccuracyRadiusColor,
Bearing,
BearingImageSize,
+ ImageTiltDisplacement,
Location,
+ PerspectiveCompensation,
ShadowImageSize,
TopImageSize,
AccuracyRadiusTransition,
@@ -377,12 +403,12 @@ enum class Property : uint8_t {
AccuracyRadiusColorTransition,
BearingTransition,
BearingImageSizeTransition,
+ ImageTiltDisplacementTransition,
LocationTransition,
+ PerspectiveCompensationTransition,
ShadowImageSizeTransition,
TopImageSizeTransition,
BearingImage = kPaintPropertyCount,
- ImageTiltDisplacement,
- PerspectiveCompensation,
ShadowImage,
TopImage,
};
@@ -398,7 +424,9 @@ MAPBOX_ETERNAL_CONSTEXPR const auto layerProperties = mapbox::eternal::hash_map<
{"accuracy-radius-color", toUint8(Property::AccuracyRadiusColor)},
{"bearing", toUint8(Property::Bearing)},
{"bearing-image-size", toUint8(Property::BearingImageSize)},
+ {"image-tilt-displacement", toUint8(Property::ImageTiltDisplacement)},
{"location", toUint8(Property::Location)},
+ {"perspective-compensation", toUint8(Property::PerspectiveCompensation)},
{"shadow-image-size", toUint8(Property::ShadowImageSize)},
{"top-image-size", toUint8(Property::TopImageSize)},
{"accuracy-radius-transition", toUint8(Property::AccuracyRadiusTransition)},
@@ -406,12 +434,12 @@ MAPBOX_ETERNAL_CONSTEXPR const auto layerProperties = mapbox::eternal::hash_map<
{"accuracy-radius-color-transition", toUint8(Property::AccuracyRadiusColorTransition)},
{"bearing-transition", toUint8(Property::BearingTransition)},
{"bearing-image-size-transition", toUint8(Property::BearingImageSizeTransition)},
+ {"image-tilt-displacement-transition", toUint8(Property::ImageTiltDisplacementTransition)},
{"location-transition", toUint8(Property::LocationTransition)},
+ {"perspective-compensation-transition", toUint8(Property::PerspectiveCompensationTransition)},
{"shadow-image-size-transition", toUint8(Property::ShadowImageSizeTransition)},
{"top-image-size-transition", toUint8(Property::TopImageSizeTransition)},
{"bearing-image", toUint8(Property::BearingImage)},
- {"image-tilt-displacement", toUint8(Property::ImageTiltDisplacement)},
- {"perspective-compensation", toUint8(Property::PerspectiveCompensation)},
{"shadow-image", toUint8(Property::ShadowImage)},
{"top-image", toUint8(Property::TopImage)}});
@@ -427,8 +455,12 @@ StyleProperty getLayerProperty(const LocationIndicatorLayer& layer, Property pro
return makeStyleProperty(layer.getBearing());
case Property::BearingImageSize:
return makeStyleProperty(layer.getBearingImageSize());
+ case Property::ImageTiltDisplacement:
+ return makeStyleProperty(layer.getImageTiltDisplacement());
case Property::Location:
return makeStyleProperty(layer.getLocation());
+ case Property::PerspectiveCompensation:
+ return makeStyleProperty(layer.getPerspectiveCompensation());
case Property::ShadowImageSize:
return makeStyleProperty(layer.getShadowImageSize());
case Property::TopImageSize:
@@ -443,18 +475,18 @@ StyleProperty getLayerProperty(const LocationIndicatorLayer& layer, Property pro
return makeStyleProperty(layer.getBearingTransition());
case Property::BearingImageSizeTransition:
return makeStyleProperty(layer.getBearingImageSizeTransition());
+ case Property::ImageTiltDisplacementTransition:
+ return makeStyleProperty(layer.getImageTiltDisplacementTransition());
case Property::LocationTransition:
return makeStyleProperty(layer.getLocationTransition());
+ case Property::PerspectiveCompensationTransition:
+ return makeStyleProperty(layer.getPerspectiveCompensationTransition());
case Property::ShadowImageSizeTransition:
return makeStyleProperty(layer.getShadowImageSizeTransition());
case Property::TopImageSizeTransition:
return makeStyleProperty(layer.getTopImageSizeTransition());
case Property::BearingImage:
return makeStyleProperty(layer.getBearingImage());
- case Property::ImageTiltDisplacement:
- return makeStyleProperty(layer.getImageTiltDisplacement());
- case Property::PerspectiveCompensation:
- return makeStyleProperty(layer.getPerspectiveCompensation());
case Property::ShadowImage:
return makeStyleProperty(layer.getShadowImage());
case Property::TopImage:
@@ -491,8 +523,8 @@ optional<Error> LocationIndicatorLayer::setPropertyInternal(const std::string& n
auto property = static_cast<Property>(it->second);
if (property == Property::AccuracyRadius || property == Property::BearingImageSize ||
- property == Property::ShadowImageSize || property == Property::TopImageSize ||
- property == Property::ImageTiltDisplacement || property == Property::PerspectiveCompensation) {
+ property == Property::ImageTiltDisplacement || property == Property::PerspectiveCompensation ||
+ property == Property::ShadowImageSize || property == Property::TopImageSize) {
Error error;
const auto& typedValue = convert<PropertyValue<float>>(value, error, false, false);
if (!typedValue) {
@@ -509,23 +541,23 @@ optional<Error> LocationIndicatorLayer::setPropertyInternal(const std::string& n
return nullopt;
}
- if (property == Property::ShadowImageSize) {
- setShadowImageSize(*typedValue);
+ if (property == Property::ImageTiltDisplacement) {
+ setImageTiltDisplacement(*typedValue);
return nullopt;
}
- if (property == Property::TopImageSize) {
- setTopImageSize(*typedValue);
+ if (property == Property::PerspectiveCompensation) {
+ setPerspectiveCompensation(*typedValue);
return nullopt;
}
- if (property == Property::ImageTiltDisplacement) {
- setImageTiltDisplacement(*typedValue);
+ if (property == Property::ShadowImageSize) {
+ setShadowImageSize(*typedValue);
return nullopt;
}
- if (property == Property::PerspectiveCompensation) {
- setPerspectiveCompensation(*typedValue);
+ if (property == Property::TopImageSize) {
+ setTopImageSize(*typedValue);
return nullopt;
}
}
@@ -620,11 +652,21 @@ optional<Error> LocationIndicatorLayer::setPropertyInternal(const std::string& n
return nullopt;
}
+ if (property == Property::ImageTiltDisplacementTransition) {
+ setImageTiltDisplacementTransition(*transition);
+ return nullopt;
+ }
+
if (property == Property::LocationTransition) {
setLocationTransition(*transition);
return nullopt;
}
+ if (property == Property::PerspectiveCompensationTransition) {
+ setPerspectiveCompensationTransition(*transition);
+ return nullopt;
+ }
+
if (property == Property::ShadowImageSizeTransition) {
setShadowImageSizeTransition(*transition);
return nullopt;
diff --git a/src/mbgl/style/layers/location_indicator_layer_properties.hpp b/src/mbgl/style/layers/location_indicator_layer_properties.hpp
index d73ce33eb9..065cbe064a 100644
--- a/src/mbgl/style/layers/location_indicator_layer_properties.hpp
+++ b/src/mbgl/style/layers/location_indicator_layer_properties.hpp
@@ -21,16 +21,6 @@ struct BearingImage : LayoutProperty<expression::Image> {
static expression::Image defaultValue() { return {}; }
};
-struct ImageTiltDisplacement : LayoutProperty<float> {
- static constexpr const char *name() { return "image-tilt-displacement"; }
- static float defaultValue() { return 0; }
-};
-
-struct PerspectiveCompensation : LayoutProperty<float> {
- static constexpr const char *name() { return "perspective-compensation"; }
- static float defaultValue() { return 0.85; }
-};
-
struct ShadowImage : LayoutProperty<expression::Image> {
static constexpr const char *name() { return "shadow-image"; }
static expression::Image defaultValue() { return {}; }
@@ -58,6 +48,10 @@ struct Bearing : PaintProperty<Rotation> {
};
struct BearingImageSize : PaintProperty<float> {
+ static float defaultValue() { return 1; }
+};
+
+struct ImageTiltDisplacement : PaintProperty<float> {
static float defaultValue() { return 0; }
};
@@ -65,18 +59,20 @@ struct Location : PaintProperty<std::array<double, 3>> {
static std::array<double, 3> defaultValue() { return {{0, 0, 0}}; }
};
+struct PerspectiveCompensation : PaintProperty<float> {
+ static float defaultValue() { return 0.85; }
+};
+
struct ShadowImageSize : PaintProperty<float> {
- static float defaultValue() { return 0; }
+ static float defaultValue() { return 1; }
};
struct TopImageSize : PaintProperty<float> {
- static float defaultValue() { return 0; }
+ static float defaultValue() { return 1; }
};
class LocationIndicatorLayoutProperties : public Properties<
BearingImage,
- ImageTiltDisplacement,
- PerspectiveCompensation,
ShadowImage,
TopImage
> {};
@@ -87,7 +83,9 @@ class LocationIndicatorPaintProperties : public Properties<
AccuracyRadiusColor,
Bearing,
BearingImageSize,
+ ImageTiltDisplacement,
Location,
+ PerspectiveCompensation,
ShadowImageSize,
TopImageSize
> {};