summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2018-10-29 14:29:16 +0200
committerMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2018-10-31 11:22:46 +0200
commit56808731b699d7750726cd88dd06516c63d7f2f0 (patch)
tree7839dffdd0eec33f6ebd2cfa9195f7408ac6c289
parent3f314682fa2f2701c0d1c7e863013ce254a23afd (diff)
downloadqtlocation-mapboxgl-56808731b699d7750726cd88dd06516c63d7f2f0.tar.gz
Remove style::Layer::is()/as()
-rw-r--r--include/mbgl/style/layer.hpp25
-rw-r--r--include/mbgl/style/layers/background_layer.hpp5
-rw-r--r--include/mbgl/style/layers/circle_layer.hpp5
-rw-r--r--include/mbgl/style/layers/fill_extrusion_layer.hpp5
-rw-r--r--include/mbgl/style/layers/fill_layer.hpp5
-rw-r--r--include/mbgl/style/layers/heatmap_layer.hpp5
-rw-r--r--include/mbgl/style/layers/hillshade_layer.hpp5
-rw-r--r--include/mbgl/style/layers/layer.hpp.ejs5
-rw-r--r--include/mbgl/style/layers/line_layer.hpp5
-rw-r--r--include/mbgl/style/layers/raster_layer.hpp5
-rw-r--r--include/mbgl/style/layers/symbol_layer.hpp5
-rw-r--r--platform/android/src/style/layers/background_layer.cpp22
-rw-r--r--platform/android/src/style/layers/circle_layer.cpp58
-rw-r--r--platform/android/src/style/layers/fill_extrusion_layer.cpp42
-rw-r--r--platform/android/src/style/layers/fill_layer.cpp38
-rw-r--r--platform/android/src/style/layers/heatmap_layer.cpp28
-rw-r--r--platform/android/src/style/layers/hillshade_layer.cpp32
-rw-r--r--platform/android/src/style/layers/layer.cpp.ejs14
-rw-r--r--platform/android/src/style/layers/layer.hpp3
-rw-r--r--platform/android/src/style/layers/layers.cpp4
-rw-r--r--platform/android/src/style/layers/line_layer.cpp70
-rw-r--r--platform/android/src/style/layers/raster_layer.cpp44
-rw-r--r--platform/android/src/style/layers/symbol_layer.cpp154
-rw-r--r--platform/darwin/src/MGLStyle.mm48
-rw-r--r--platform/darwin/test/MGLBackgroundStyleLayerTests.mm4
-rw-r--r--platform/darwin/test/MGLCircleStyleLayerTests.mm4
-rw-r--r--platform/darwin/test/MGLFillExtrusionStyleLayerTests.mm4
-rw-r--r--platform/darwin/test/MGLFillStyleLayerTests.mm4
-rw-r--r--platform/darwin/test/MGLHeatmapColorTests.mm2
-rw-r--r--platform/darwin/test/MGLHeatmapStyleLayerTests.mm4
-rw-r--r--platform/darwin/test/MGLHillshadeStyleLayerTests.mm4
-rw-r--r--platform/darwin/test/MGLLineStyleLayerTests.mm4
-rw-r--r--platform/darwin/test/MGLRasterStyleLayerTests.mm4
-rw-r--r--platform/darwin/test/MGLStyleLayerTests.mm.ejs4
-rw-r--r--platform/darwin/test/MGLSymbolStyleLayerTests.mm4
-rw-r--r--src/mbgl/annotation/fill_annotation_impl.cpp3
-rw-r--r--src/mbgl/annotation/line_annotation_impl.cpp3
-rw-r--r--src/mbgl/style/layers/custom_layer.cpp5
-rw-r--r--test/gl/context.test.cpp4
-rw-r--r--test/renderer/group_by_layout.test.cpp10
-rw-r--r--test/style/conversion/layer.test.cpp6
-rw-r--r--test/style/style_layer.test.cpp10
42 files changed, 341 insertions, 374 deletions
diff --git a/include/mbgl/style/layer.hpp b/include/mbgl/style/layer.hpp
index dd8f1a1e0e..5f12115f87 100644
--- a/include/mbgl/style/layer.hpp
+++ b/include/mbgl/style/layer.hpp
@@ -15,16 +15,6 @@
namespace mbgl {
namespace style {
-class FillLayer;
-class LineLayer;
-class CircleLayer;
-class SymbolLayer;
-class RasterLayer;
-class HillshadeLayer;
-class BackgroundLayer;
-class CustomLayer;
-class FillExtrusionLayer;
-class HeatmapLayer;
class LayerObserver;
class Filter;
@@ -51,21 +41,6 @@ public:
virtual ~Layer();
- // Check whether this layer is of the given subtype.
- template <class T>
- bool is() const;
-
- // Dynamically cast this layer to the given subtype.
- template <class T>
- T* as() {
- return is<T>() ? reinterpret_cast<T*>(this) : nullptr;
- }
-
- template <class T>
- const T* as() const {
- return is<T>() ? reinterpret_cast<const T*>(this) : nullptr;
- }
-
LayerType getType() const;
std::string getID() const;
// Source
diff --git a/include/mbgl/style/layers/background_layer.hpp b/include/mbgl/style/layers/background_layer.hpp
index 7d7753cbff..6739973e53 100644
--- a/include/mbgl/style/layers/background_layer.hpp
+++ b/include/mbgl/style/layers/background_layer.hpp
@@ -56,10 +56,5 @@ protected:
Mutable<Layer::Impl> mutableBaseImpl() const final;
};
-template <>
-inline bool Layer::is<BackgroundLayer>() const {
- return getType() == LayerType::Background;
-}
-
} // namespace style
} // namespace mbgl
diff --git a/include/mbgl/style/layers/circle_layer.hpp b/include/mbgl/style/layers/circle_layer.hpp
index 909412dbab..e0a121e2dc 100644
--- a/include/mbgl/style/layers/circle_layer.hpp
+++ b/include/mbgl/style/layers/circle_layer.hpp
@@ -104,10 +104,5 @@ protected:
Mutable<Layer::Impl> mutableBaseImpl() const final;
};
-template <>
-inline bool Layer::is<CircleLayer>() const {
- return getType() == LayerType::Circle;
-}
-
} // namespace style
} // namespace mbgl
diff --git a/include/mbgl/style/layers/fill_extrusion_layer.hpp b/include/mbgl/style/layers/fill_extrusion_layer.hpp
index 8798738d90..ed1cbb924b 100644
--- a/include/mbgl/style/layers/fill_extrusion_layer.hpp
+++ b/include/mbgl/style/layers/fill_extrusion_layer.hpp
@@ -80,10 +80,5 @@ protected:
Mutable<Layer::Impl> mutableBaseImpl() const final;
};
-template <>
-inline bool Layer::is<FillExtrusionLayer>() const {
- return getType() == LayerType::FillExtrusion;
-}
-
} // namespace style
} // namespace mbgl
diff --git a/include/mbgl/style/layers/fill_layer.hpp b/include/mbgl/style/layers/fill_layer.hpp
index 033b451abc..b265bf5d06 100644
--- a/include/mbgl/style/layers/fill_layer.hpp
+++ b/include/mbgl/style/layers/fill_layer.hpp
@@ -80,10 +80,5 @@ protected:
Mutable<Layer::Impl> mutableBaseImpl() const final;
};
-template <>
-inline bool Layer::is<FillLayer>() const {
- return getType() == LayerType::Fill;
-}
-
} // namespace style
} // namespace mbgl
diff --git a/include/mbgl/style/layers/heatmap_layer.hpp b/include/mbgl/style/layers/heatmap_layer.hpp
index 2315eac3f2..5069eef165 100644
--- a/include/mbgl/style/layers/heatmap_layer.hpp
+++ b/include/mbgl/style/layers/heatmap_layer.hpp
@@ -69,10 +69,5 @@ protected:
Mutable<Layer::Impl> mutableBaseImpl() const final;
};
-template <>
-inline bool Layer::is<HeatmapLayer>() const {
- return getType() == LayerType::Heatmap;
-}
-
} // namespace style
} // namespace mbgl
diff --git a/include/mbgl/style/layers/hillshade_layer.hpp b/include/mbgl/style/layers/hillshade_layer.hpp
index 4c18b5ed89..5c2b4276c3 100644
--- a/include/mbgl/style/layers/hillshade_layer.hpp
+++ b/include/mbgl/style/layers/hillshade_layer.hpp
@@ -74,10 +74,5 @@ protected:
Mutable<Layer::Impl> mutableBaseImpl() const final;
};
-template <>
-inline bool Layer::is<HillshadeLayer>() const {
- return getType() == LayerType::Hillshade;
-}
-
} // namespace style
} // namespace mbgl
diff --git a/include/mbgl/style/layers/layer.hpp.ejs b/include/mbgl/style/layers/layer.hpp.ejs
index f6dd08000a..a5d4be14e6 100644
--- a/include/mbgl/style/layers/layer.hpp.ejs
+++ b/include/mbgl/style/layers/layer.hpp.ejs
@@ -72,10 +72,5 @@ protected:
Mutable<Layer::Impl> mutableBaseImpl() const final;
};
-template <>
-inline bool Layer::is<<%- camelize(type) %>Layer>() const {
- return getType() == LayerType::<%- camelize(type) %>;
-}
-
} // namespace style
} // namespace mbgl
diff --git a/include/mbgl/style/layers/line_layer.hpp b/include/mbgl/style/layers/line_layer.hpp
index 0e1d026e74..487fef5837 100644
--- a/include/mbgl/style/layers/line_layer.hpp
+++ b/include/mbgl/style/layers/line_layer.hpp
@@ -125,10 +125,5 @@ protected:
Mutable<Layer::Impl> mutableBaseImpl() const final;
};
-template <>
-inline bool Layer::is<LineLayer>() const {
- return getType() == LayerType::Line;
-}
-
} // namespace style
} // namespace mbgl
diff --git a/include/mbgl/style/layers/raster_layer.hpp b/include/mbgl/style/layers/raster_layer.hpp
index 2d10d65914..a31a362f49 100644
--- a/include/mbgl/style/layers/raster_layer.hpp
+++ b/include/mbgl/style/layers/raster_layer.hpp
@@ -86,10 +86,5 @@ protected:
Mutable<Layer::Impl> mutableBaseImpl() const final;
};
-template <>
-inline bool Layer::is<RasterLayer>() const {
- return getType() == LayerType::Raster;
-}
-
} // namespace style
} // namespace mbgl
diff --git a/include/mbgl/style/layers/symbol_layer.hpp b/include/mbgl/style/layers/symbol_layer.hpp
index b75a943be0..39852aa715 100644
--- a/include/mbgl/style/layers/symbol_layer.hpp
+++ b/include/mbgl/style/layers/symbol_layer.hpp
@@ -274,10 +274,5 @@ protected:
Mutable<Layer::Impl> mutableBaseImpl() const final;
};
-template <>
-inline bool Layer::is<SymbolLayer>() const {
- return getType() == LayerType::Symbol;
-}
-
} // namespace style
} // namespace mbgl
diff --git a/platform/android/src/style/layers/background_layer.cpp b/platform/android/src/style/layers/background_layer.cpp
index c806e8471f..45ec9380d0 100644
--- a/platform/android/src/style/layers/background_layer.cpp
+++ b/platform/android/src/style/layers/background_layer.cpp
@@ -10,6 +10,10 @@
namespace mbgl {
namespace android {
+ inline mbgl::style::BackgroundLayer& toBackgroundLayer(mbgl::style::Layer& layer) {
+ return static_cast<mbgl::style::BackgroundLayer&>(layer);
+ }
+
/**
* Creates an owning peer object (for layers not attached to the map) from the JVM side
*/
@@ -37,12 +41,12 @@ namespace android {
jni::Local<jni::Object<>> BackgroundLayer::getBackgroundColor(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::BackgroundLayer>()->BackgroundLayer::getBackgroundColor()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toBackgroundLayer(layer).getBackgroundColor()));
}
jni::Local<jni::Object<TransitionOptions>> BackgroundLayer::getBackgroundColorTransition(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- mbgl::style::TransitionOptions options = layer.as<mbgl::style::BackgroundLayer>()->BackgroundLayer::getBackgroundColorTransition();
+ mbgl::style::TransitionOptions options = toBackgroundLayer(layer).getBackgroundColorTransition();
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, options));
}
@@ -50,17 +54,17 @@ namespace android {
mbgl::style::TransitionOptions options;
options.duration.emplace(mbgl::Milliseconds(duration));
options.delay.emplace(mbgl::Milliseconds(delay));
- layer.as<mbgl::style::BackgroundLayer>()->BackgroundLayer::setBackgroundColorTransition(options);
+ toBackgroundLayer(layer).setBackgroundColorTransition(options);
}
jni::Local<jni::Object<>> BackgroundLayer::getBackgroundPattern(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::BackgroundLayer>()->BackgroundLayer::getBackgroundPattern()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toBackgroundLayer(layer).getBackgroundPattern()));
}
jni::Local<jni::Object<TransitionOptions>> BackgroundLayer::getBackgroundPatternTransition(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- mbgl::style::TransitionOptions options = layer.as<mbgl::style::BackgroundLayer>()->BackgroundLayer::getBackgroundPatternTransition();
+ mbgl::style::TransitionOptions options = toBackgroundLayer(layer).getBackgroundPatternTransition();
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, options));
}
@@ -68,17 +72,17 @@ namespace android {
mbgl::style::TransitionOptions options;
options.duration.emplace(mbgl::Milliseconds(duration));
options.delay.emplace(mbgl::Milliseconds(delay));
- layer.as<mbgl::style::BackgroundLayer>()->BackgroundLayer::setBackgroundPatternTransition(options);
+ toBackgroundLayer(layer).setBackgroundPatternTransition(options);
}
jni::Local<jni::Object<>> BackgroundLayer::getBackgroundOpacity(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::BackgroundLayer>()->BackgroundLayer::getBackgroundOpacity()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toBackgroundLayer(layer).getBackgroundOpacity()));
}
jni::Local<jni::Object<TransitionOptions>> BackgroundLayer::getBackgroundOpacityTransition(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- mbgl::style::TransitionOptions options = layer.as<mbgl::style::BackgroundLayer>()->BackgroundLayer::getBackgroundOpacityTransition();
+ mbgl::style::TransitionOptions options = toBackgroundLayer(layer).getBackgroundOpacityTransition();
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, options));
}
@@ -86,7 +90,7 @@ namespace android {
mbgl::style::TransitionOptions options;
options.duration.emplace(mbgl::Milliseconds(duration));
options.delay.emplace(mbgl::Milliseconds(delay));
- layer.as<mbgl::style::BackgroundLayer>()->BackgroundLayer::setBackgroundOpacityTransition(options);
+ toBackgroundLayer(layer).setBackgroundOpacityTransition(options);
}
diff --git a/platform/android/src/style/layers/circle_layer.cpp b/platform/android/src/style/layers/circle_layer.cpp
index 9ec48d7b18..1b5b7649f0 100644
--- a/platform/android/src/style/layers/circle_layer.cpp
+++ b/platform/android/src/style/layers/circle_layer.cpp
@@ -10,6 +10,10 @@
namespace mbgl {
namespace android {
+ inline mbgl::style::CircleLayer& toCircleLayer(mbgl::style::Layer& layer) {
+ return static_cast<mbgl::style::CircleLayer&>(layer);
+ }
+
/**
* Creates an owning peer object (for layers not attached to the map) from the JVM side
*/
@@ -37,12 +41,12 @@ namespace android {
jni::Local<jni::Object<>> CircleLayer::getCircleRadius(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::CircleLayer>()->CircleLayer::getCircleRadius()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toCircleLayer(layer).getCircleRadius()));
}
jni::Local<jni::Object<TransitionOptions>> CircleLayer::getCircleRadiusTransition(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- mbgl::style::TransitionOptions options = layer.as<mbgl::style::CircleLayer>()->CircleLayer::getCircleRadiusTransition();
+ mbgl::style::TransitionOptions options = toCircleLayer(layer).getCircleRadiusTransition();
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, options));
}
@@ -50,17 +54,17 @@ namespace android {
mbgl::style::TransitionOptions options;
options.duration.emplace(mbgl::Milliseconds(duration));
options.delay.emplace(mbgl::Milliseconds(delay));
- layer.as<mbgl::style::CircleLayer>()->CircleLayer::setCircleRadiusTransition(options);
+ toCircleLayer(layer).setCircleRadiusTransition(options);
}
jni::Local<jni::Object<>> CircleLayer::getCircleColor(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::CircleLayer>()->CircleLayer::getCircleColor()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toCircleLayer(layer).getCircleColor()));
}
jni::Local<jni::Object<TransitionOptions>> CircleLayer::getCircleColorTransition(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- mbgl::style::TransitionOptions options = layer.as<mbgl::style::CircleLayer>()->CircleLayer::getCircleColorTransition();
+ mbgl::style::TransitionOptions options = toCircleLayer(layer).getCircleColorTransition();
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, options));
}
@@ -68,17 +72,17 @@ namespace android {
mbgl::style::TransitionOptions options;
options.duration.emplace(mbgl::Milliseconds(duration));
options.delay.emplace(mbgl::Milliseconds(delay));
- layer.as<mbgl::style::CircleLayer>()->CircleLayer::setCircleColorTransition(options);
+ toCircleLayer(layer).setCircleColorTransition(options);
}
jni::Local<jni::Object<>> CircleLayer::getCircleBlur(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::CircleLayer>()->CircleLayer::getCircleBlur()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toCircleLayer(layer).getCircleBlur()));
}
jni::Local<jni::Object<TransitionOptions>> CircleLayer::getCircleBlurTransition(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- mbgl::style::TransitionOptions options = layer.as<mbgl::style::CircleLayer>()->CircleLayer::getCircleBlurTransition();
+ mbgl::style::TransitionOptions options = toCircleLayer(layer).getCircleBlurTransition();
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, options));
}
@@ -86,17 +90,17 @@ namespace android {
mbgl::style::TransitionOptions options;
options.duration.emplace(mbgl::Milliseconds(duration));
options.delay.emplace(mbgl::Milliseconds(delay));
- layer.as<mbgl::style::CircleLayer>()->CircleLayer::setCircleBlurTransition(options);
+ toCircleLayer(layer).setCircleBlurTransition(options);
}
jni::Local<jni::Object<>> CircleLayer::getCircleOpacity(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::CircleLayer>()->CircleLayer::getCircleOpacity()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toCircleLayer(layer).getCircleOpacity()));
}
jni::Local<jni::Object<TransitionOptions>> CircleLayer::getCircleOpacityTransition(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- mbgl::style::TransitionOptions options = layer.as<mbgl::style::CircleLayer>()->CircleLayer::getCircleOpacityTransition();
+ mbgl::style::TransitionOptions options = toCircleLayer(layer).getCircleOpacityTransition();
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, options));
}
@@ -104,17 +108,17 @@ namespace android {
mbgl::style::TransitionOptions options;
options.duration.emplace(mbgl::Milliseconds(duration));
options.delay.emplace(mbgl::Milliseconds(delay));
- layer.as<mbgl::style::CircleLayer>()->CircleLayer::setCircleOpacityTransition(options);
+ toCircleLayer(layer).setCircleOpacityTransition(options);
}
jni::Local<jni::Object<>> CircleLayer::getCircleTranslate(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::CircleLayer>()->CircleLayer::getCircleTranslate()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toCircleLayer(layer).getCircleTranslate()));
}
jni::Local<jni::Object<TransitionOptions>> CircleLayer::getCircleTranslateTransition(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- mbgl::style::TransitionOptions options = layer.as<mbgl::style::CircleLayer>()->CircleLayer::getCircleTranslateTransition();
+ mbgl::style::TransitionOptions options = toCircleLayer(layer).getCircleTranslateTransition();
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, options));
}
@@ -122,32 +126,32 @@ namespace android {
mbgl::style::TransitionOptions options;
options.duration.emplace(mbgl::Milliseconds(duration));
options.delay.emplace(mbgl::Milliseconds(delay));
- layer.as<mbgl::style::CircleLayer>()->CircleLayer::setCircleTranslateTransition(options);
+ toCircleLayer(layer).setCircleTranslateTransition(options);
}
jni::Local<jni::Object<>> CircleLayer::getCircleTranslateAnchor(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::CircleLayer>()->CircleLayer::getCircleTranslateAnchor()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toCircleLayer(layer).getCircleTranslateAnchor()));
}
jni::Local<jni::Object<>> CircleLayer::getCirclePitchScale(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::CircleLayer>()->CircleLayer::getCirclePitchScale()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toCircleLayer(layer).getCirclePitchScale()));
}
jni::Local<jni::Object<>> CircleLayer::getCirclePitchAlignment(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::CircleLayer>()->CircleLayer::getCirclePitchAlignment()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toCircleLayer(layer).getCirclePitchAlignment()));
}
jni::Local<jni::Object<>> CircleLayer::getCircleStrokeWidth(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::CircleLayer>()->CircleLayer::getCircleStrokeWidth()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toCircleLayer(layer).getCircleStrokeWidth()));
}
jni::Local<jni::Object<TransitionOptions>> CircleLayer::getCircleStrokeWidthTransition(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- mbgl::style::TransitionOptions options = layer.as<mbgl::style::CircleLayer>()->CircleLayer::getCircleStrokeWidthTransition();
+ mbgl::style::TransitionOptions options = toCircleLayer(layer).getCircleStrokeWidthTransition();
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, options));
}
@@ -155,17 +159,17 @@ namespace android {
mbgl::style::TransitionOptions options;
options.duration.emplace(mbgl::Milliseconds(duration));
options.delay.emplace(mbgl::Milliseconds(delay));
- layer.as<mbgl::style::CircleLayer>()->CircleLayer::setCircleStrokeWidthTransition(options);
+ toCircleLayer(layer).setCircleStrokeWidthTransition(options);
}
jni::Local<jni::Object<>> CircleLayer::getCircleStrokeColor(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::CircleLayer>()->CircleLayer::getCircleStrokeColor()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toCircleLayer(layer).getCircleStrokeColor()));
}
jni::Local<jni::Object<TransitionOptions>> CircleLayer::getCircleStrokeColorTransition(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- mbgl::style::TransitionOptions options = layer.as<mbgl::style::CircleLayer>()->CircleLayer::getCircleStrokeColorTransition();
+ mbgl::style::TransitionOptions options = toCircleLayer(layer).getCircleStrokeColorTransition();
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, options));
}
@@ -173,17 +177,17 @@ namespace android {
mbgl::style::TransitionOptions options;
options.duration.emplace(mbgl::Milliseconds(duration));
options.delay.emplace(mbgl::Milliseconds(delay));
- layer.as<mbgl::style::CircleLayer>()->CircleLayer::setCircleStrokeColorTransition(options);
+ toCircleLayer(layer).setCircleStrokeColorTransition(options);
}
jni::Local<jni::Object<>> CircleLayer::getCircleStrokeOpacity(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::CircleLayer>()->CircleLayer::getCircleStrokeOpacity()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toCircleLayer(layer).getCircleStrokeOpacity()));
}
jni::Local<jni::Object<TransitionOptions>> CircleLayer::getCircleStrokeOpacityTransition(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- mbgl::style::TransitionOptions options = layer.as<mbgl::style::CircleLayer>()->CircleLayer::getCircleStrokeOpacityTransition();
+ mbgl::style::TransitionOptions options = toCircleLayer(layer).getCircleStrokeOpacityTransition();
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, options));
}
@@ -191,7 +195,7 @@ namespace android {
mbgl::style::TransitionOptions options;
options.duration.emplace(mbgl::Milliseconds(duration));
options.delay.emplace(mbgl::Milliseconds(delay));
- layer.as<mbgl::style::CircleLayer>()->CircleLayer::setCircleStrokeOpacityTransition(options);
+ toCircleLayer(layer).setCircleStrokeOpacityTransition(options);
}
diff --git a/platform/android/src/style/layers/fill_extrusion_layer.cpp b/platform/android/src/style/layers/fill_extrusion_layer.cpp
index cf53e774a5..b047f08dc0 100644
--- a/platform/android/src/style/layers/fill_extrusion_layer.cpp
+++ b/platform/android/src/style/layers/fill_extrusion_layer.cpp
@@ -10,6 +10,10 @@
namespace mbgl {
namespace android {
+ inline mbgl::style::FillExtrusionLayer& toFillExtrusionLayer(mbgl::style::Layer& layer) {
+ return static_cast<mbgl::style::FillExtrusionLayer&>(layer);
+ }
+
/**
* Creates an owning peer object (for layers not attached to the map) from the JVM side
*/
@@ -37,12 +41,12 @@ namespace android {
jni::Local<jni::Object<>> FillExtrusionLayer::getFillExtrusionOpacity(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::FillExtrusionLayer>()->FillExtrusionLayer::getFillExtrusionOpacity()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toFillExtrusionLayer(layer).getFillExtrusionOpacity()));
}
jni::Local<jni::Object<TransitionOptions>> FillExtrusionLayer::getFillExtrusionOpacityTransition(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- mbgl::style::TransitionOptions options = layer.as<mbgl::style::FillExtrusionLayer>()->FillExtrusionLayer::getFillExtrusionOpacityTransition();
+ mbgl::style::TransitionOptions options = toFillExtrusionLayer(layer).getFillExtrusionOpacityTransition();
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, options));
}
@@ -50,17 +54,17 @@ namespace android {
mbgl::style::TransitionOptions options;
options.duration.emplace(mbgl::Milliseconds(duration));
options.delay.emplace(mbgl::Milliseconds(delay));
- layer.as<mbgl::style::FillExtrusionLayer>()->FillExtrusionLayer::setFillExtrusionOpacityTransition(options);
+ toFillExtrusionLayer(layer).setFillExtrusionOpacityTransition(options);
}
jni::Local<jni::Object<>> FillExtrusionLayer::getFillExtrusionColor(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::FillExtrusionLayer>()->FillExtrusionLayer::getFillExtrusionColor()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toFillExtrusionLayer(layer).getFillExtrusionColor()));
}
jni::Local<jni::Object<TransitionOptions>> FillExtrusionLayer::getFillExtrusionColorTransition(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- mbgl::style::TransitionOptions options = layer.as<mbgl::style::FillExtrusionLayer>()->FillExtrusionLayer::getFillExtrusionColorTransition();
+ mbgl::style::TransitionOptions options = toFillExtrusionLayer(layer).getFillExtrusionColorTransition();
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, options));
}
@@ -68,17 +72,17 @@ namespace android {
mbgl::style::TransitionOptions options;
options.duration.emplace(mbgl::Milliseconds(duration));
options.delay.emplace(mbgl::Milliseconds(delay));
- layer.as<mbgl::style::FillExtrusionLayer>()->FillExtrusionLayer::setFillExtrusionColorTransition(options);
+ toFillExtrusionLayer(layer).setFillExtrusionColorTransition(options);
}
jni::Local<jni::Object<>> FillExtrusionLayer::getFillExtrusionTranslate(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::FillExtrusionLayer>()->FillExtrusionLayer::getFillExtrusionTranslate()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toFillExtrusionLayer(layer).getFillExtrusionTranslate()));
}
jni::Local<jni::Object<TransitionOptions>> FillExtrusionLayer::getFillExtrusionTranslateTransition(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- mbgl::style::TransitionOptions options = layer.as<mbgl::style::FillExtrusionLayer>()->FillExtrusionLayer::getFillExtrusionTranslateTransition();
+ mbgl::style::TransitionOptions options = toFillExtrusionLayer(layer).getFillExtrusionTranslateTransition();
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, options));
}
@@ -86,22 +90,22 @@ namespace android {
mbgl::style::TransitionOptions options;
options.duration.emplace(mbgl::Milliseconds(duration));
options.delay.emplace(mbgl::Milliseconds(delay));
- layer.as<mbgl::style::FillExtrusionLayer>()->FillExtrusionLayer::setFillExtrusionTranslateTransition(options);
+ toFillExtrusionLayer(layer).setFillExtrusionTranslateTransition(options);
}
jni::Local<jni::Object<>> FillExtrusionLayer::getFillExtrusionTranslateAnchor(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::FillExtrusionLayer>()->FillExtrusionLayer::getFillExtrusionTranslateAnchor()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toFillExtrusionLayer(layer).getFillExtrusionTranslateAnchor()));
}
jni::Local<jni::Object<>> FillExtrusionLayer::getFillExtrusionPattern(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::FillExtrusionLayer>()->FillExtrusionLayer::getFillExtrusionPattern()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toFillExtrusionLayer(layer).getFillExtrusionPattern()));
}
jni::Local<jni::Object<TransitionOptions>> FillExtrusionLayer::getFillExtrusionPatternTransition(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- mbgl::style::TransitionOptions options = layer.as<mbgl::style::FillExtrusionLayer>()->FillExtrusionLayer::getFillExtrusionPatternTransition();
+ mbgl::style::TransitionOptions options = toFillExtrusionLayer(layer).getFillExtrusionPatternTransition();
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, options));
}
@@ -109,17 +113,17 @@ namespace android {
mbgl::style::TransitionOptions options;
options.duration.emplace(mbgl::Milliseconds(duration));
options.delay.emplace(mbgl::Milliseconds(delay));
- layer.as<mbgl::style::FillExtrusionLayer>()->FillExtrusionLayer::setFillExtrusionPatternTransition(options);
+ toFillExtrusionLayer(layer).setFillExtrusionPatternTransition(options);
}
jni::Local<jni::Object<>> FillExtrusionLayer::getFillExtrusionHeight(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::FillExtrusionLayer>()->FillExtrusionLayer::getFillExtrusionHeight()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toFillExtrusionLayer(layer).getFillExtrusionHeight()));
}
jni::Local<jni::Object<TransitionOptions>> FillExtrusionLayer::getFillExtrusionHeightTransition(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- mbgl::style::TransitionOptions options = layer.as<mbgl::style::FillExtrusionLayer>()->FillExtrusionLayer::getFillExtrusionHeightTransition();
+ mbgl::style::TransitionOptions options = toFillExtrusionLayer(layer).getFillExtrusionHeightTransition();
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, options));
}
@@ -127,17 +131,17 @@ namespace android {
mbgl::style::TransitionOptions options;
options.duration.emplace(mbgl::Milliseconds(duration));
options.delay.emplace(mbgl::Milliseconds(delay));
- layer.as<mbgl::style::FillExtrusionLayer>()->FillExtrusionLayer::setFillExtrusionHeightTransition(options);
+ toFillExtrusionLayer(layer).setFillExtrusionHeightTransition(options);
}
jni::Local<jni::Object<>> FillExtrusionLayer::getFillExtrusionBase(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::FillExtrusionLayer>()->FillExtrusionLayer::getFillExtrusionBase()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toFillExtrusionLayer(layer).getFillExtrusionBase()));
}
jni::Local<jni::Object<TransitionOptions>> FillExtrusionLayer::getFillExtrusionBaseTransition(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- mbgl::style::TransitionOptions options = layer.as<mbgl::style::FillExtrusionLayer>()->FillExtrusionLayer::getFillExtrusionBaseTransition();
+ mbgl::style::TransitionOptions options = toFillExtrusionLayer(layer).getFillExtrusionBaseTransition();
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, options));
}
@@ -145,7 +149,7 @@ namespace android {
mbgl::style::TransitionOptions options;
options.duration.emplace(mbgl::Milliseconds(duration));
options.delay.emplace(mbgl::Milliseconds(delay));
- layer.as<mbgl::style::FillExtrusionLayer>()->FillExtrusionLayer::setFillExtrusionBaseTransition(options);
+ toFillExtrusionLayer(layer).setFillExtrusionBaseTransition(options);
}
diff --git a/platform/android/src/style/layers/fill_layer.cpp b/platform/android/src/style/layers/fill_layer.cpp
index 555f8eb3cd..411895488f 100644
--- a/platform/android/src/style/layers/fill_layer.cpp
+++ b/platform/android/src/style/layers/fill_layer.cpp
@@ -10,6 +10,10 @@
namespace mbgl {
namespace android {
+ inline mbgl::style::FillLayer& toFillLayer(mbgl::style::Layer& layer) {
+ return static_cast<mbgl::style::FillLayer&>(layer);
+ }
+
/**
* Creates an owning peer object (for layers not attached to the map) from the JVM side
*/
@@ -37,17 +41,17 @@ namespace android {
jni::Local<jni::Object<>> FillLayer::getFillAntialias(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::FillLayer>()->FillLayer::getFillAntialias()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toFillLayer(layer).getFillAntialias()));
}
jni::Local<jni::Object<>> FillLayer::getFillOpacity(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::FillLayer>()->FillLayer::getFillOpacity()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toFillLayer(layer).getFillOpacity()));
}
jni::Local<jni::Object<TransitionOptions>> FillLayer::getFillOpacityTransition(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- mbgl::style::TransitionOptions options = layer.as<mbgl::style::FillLayer>()->FillLayer::getFillOpacityTransition();
+ mbgl::style::TransitionOptions options = toFillLayer(layer).getFillOpacityTransition();
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, options));
}
@@ -55,17 +59,17 @@ namespace android {
mbgl::style::TransitionOptions options;
options.duration.emplace(mbgl::Milliseconds(duration));
options.delay.emplace(mbgl::Milliseconds(delay));
- layer.as<mbgl::style::FillLayer>()->FillLayer::setFillOpacityTransition(options);
+ toFillLayer(layer).setFillOpacityTransition(options);
}
jni::Local<jni::Object<>> FillLayer::getFillColor(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::FillLayer>()->FillLayer::getFillColor()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toFillLayer(layer).getFillColor()));
}
jni::Local<jni::Object<TransitionOptions>> FillLayer::getFillColorTransition(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- mbgl::style::TransitionOptions options = layer.as<mbgl::style::FillLayer>()->FillLayer::getFillColorTransition();
+ mbgl::style::TransitionOptions options = toFillLayer(layer).getFillColorTransition();
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, options));
}
@@ -73,17 +77,17 @@ namespace android {
mbgl::style::TransitionOptions options;
options.duration.emplace(mbgl::Milliseconds(duration));
options.delay.emplace(mbgl::Milliseconds(delay));
- layer.as<mbgl::style::FillLayer>()->FillLayer::setFillColorTransition(options);
+ toFillLayer(layer).setFillColorTransition(options);
}
jni::Local<jni::Object<>> FillLayer::getFillOutlineColor(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::FillLayer>()->FillLayer::getFillOutlineColor()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toFillLayer(layer).getFillOutlineColor()));
}
jni::Local<jni::Object<TransitionOptions>> FillLayer::getFillOutlineColorTransition(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- mbgl::style::TransitionOptions options = layer.as<mbgl::style::FillLayer>()->FillLayer::getFillOutlineColorTransition();
+ mbgl::style::TransitionOptions options = toFillLayer(layer).getFillOutlineColorTransition();
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, options));
}
@@ -91,17 +95,17 @@ namespace android {
mbgl::style::TransitionOptions options;
options.duration.emplace(mbgl::Milliseconds(duration));
options.delay.emplace(mbgl::Milliseconds(delay));
- layer.as<mbgl::style::FillLayer>()->FillLayer::setFillOutlineColorTransition(options);
+ toFillLayer(layer).setFillOutlineColorTransition(options);
}
jni::Local<jni::Object<>> FillLayer::getFillTranslate(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::FillLayer>()->FillLayer::getFillTranslate()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toFillLayer(layer).getFillTranslate()));
}
jni::Local<jni::Object<TransitionOptions>> FillLayer::getFillTranslateTransition(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- mbgl::style::TransitionOptions options = layer.as<mbgl::style::FillLayer>()->FillLayer::getFillTranslateTransition();
+ mbgl::style::TransitionOptions options = toFillLayer(layer).getFillTranslateTransition();
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, options));
}
@@ -109,22 +113,22 @@ namespace android {
mbgl::style::TransitionOptions options;
options.duration.emplace(mbgl::Milliseconds(duration));
options.delay.emplace(mbgl::Milliseconds(delay));
- layer.as<mbgl::style::FillLayer>()->FillLayer::setFillTranslateTransition(options);
+ toFillLayer(layer).setFillTranslateTransition(options);
}
jni::Local<jni::Object<>> FillLayer::getFillTranslateAnchor(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::FillLayer>()->FillLayer::getFillTranslateAnchor()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toFillLayer(layer).getFillTranslateAnchor()));
}
jni::Local<jni::Object<>> FillLayer::getFillPattern(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::FillLayer>()->FillLayer::getFillPattern()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toFillLayer(layer).getFillPattern()));
}
jni::Local<jni::Object<TransitionOptions>> FillLayer::getFillPatternTransition(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- mbgl::style::TransitionOptions options = layer.as<mbgl::style::FillLayer>()->FillLayer::getFillPatternTransition();
+ mbgl::style::TransitionOptions options = toFillLayer(layer).getFillPatternTransition();
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, options));
}
@@ -132,7 +136,7 @@ namespace android {
mbgl::style::TransitionOptions options;
options.duration.emplace(mbgl::Milliseconds(duration));
options.delay.emplace(mbgl::Milliseconds(delay));
- layer.as<mbgl::style::FillLayer>()->FillLayer::setFillPatternTransition(options);
+ toFillLayer(layer).setFillPatternTransition(options);
}
diff --git a/platform/android/src/style/layers/heatmap_layer.cpp b/platform/android/src/style/layers/heatmap_layer.cpp
index b72b372929..5a0114d52a 100644
--- a/platform/android/src/style/layers/heatmap_layer.cpp
+++ b/platform/android/src/style/layers/heatmap_layer.cpp
@@ -10,6 +10,10 @@
namespace mbgl {
namespace android {
+ inline mbgl::style::HeatmapLayer& toHeatmapLayer(mbgl::style::Layer& layer) {
+ return static_cast<mbgl::style::HeatmapLayer&>(layer);
+ }
+
/**
* Creates an owning peer object (for layers not attached to the map) from the JVM side
*/
@@ -37,12 +41,12 @@ namespace android {
jni::Local<jni::Object<>> HeatmapLayer::getHeatmapRadius(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::HeatmapLayer>()->HeatmapLayer::getHeatmapRadius()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toHeatmapLayer(layer).getHeatmapRadius()));
}
jni::Local<jni::Object<TransitionOptions>> HeatmapLayer::getHeatmapRadiusTransition(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- mbgl::style::TransitionOptions options = layer.as<mbgl::style::HeatmapLayer>()->HeatmapLayer::getHeatmapRadiusTransition();
+ mbgl::style::TransitionOptions options = toHeatmapLayer(layer).getHeatmapRadiusTransition();
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, options));
}
@@ -50,22 +54,22 @@ namespace android {
mbgl::style::TransitionOptions options;
options.duration.emplace(mbgl::Milliseconds(duration));
options.delay.emplace(mbgl::Milliseconds(delay));
- layer.as<mbgl::style::HeatmapLayer>()->HeatmapLayer::setHeatmapRadiusTransition(options);
+ toHeatmapLayer(layer).setHeatmapRadiusTransition(options);
}
jni::Local<jni::Object<>> HeatmapLayer::getHeatmapWeight(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::HeatmapLayer>()->HeatmapLayer::getHeatmapWeight()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toHeatmapLayer(layer).getHeatmapWeight()));
}
jni::Local<jni::Object<>> HeatmapLayer::getHeatmapIntensity(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::HeatmapLayer>()->HeatmapLayer::getHeatmapIntensity()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toHeatmapLayer(layer).getHeatmapIntensity()));
}
jni::Local<jni::Object<TransitionOptions>> HeatmapLayer::getHeatmapIntensityTransition(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- mbgl::style::TransitionOptions options = layer.as<mbgl::style::HeatmapLayer>()->HeatmapLayer::getHeatmapIntensityTransition();
+ mbgl::style::TransitionOptions options = toHeatmapLayer(layer).getHeatmapIntensityTransition();
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, options));
}
@@ -73,26 +77,26 @@ namespace android {
mbgl::style::TransitionOptions options;
options.duration.emplace(mbgl::Milliseconds(duration));
options.delay.emplace(mbgl::Milliseconds(delay));
- layer.as<mbgl::style::HeatmapLayer>()->HeatmapLayer::setHeatmapIntensityTransition(options);
+ toHeatmapLayer(layer).setHeatmapIntensityTransition(options);
}
jni::Local<jni::Object<>> HeatmapLayer::getHeatmapColor(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- auto propertyValue = layer.as<mbgl::style::HeatmapLayer>()->HeatmapLayer::getHeatmapColor();
+ auto propertyValue = toHeatmapLayer(layer).getHeatmapColor();
if (propertyValue.isUndefined()) {
- propertyValue = layer.as<mbgl::style::HeatmapLayer>()->HeatmapLayer::getDefaultHeatmapColor();
+ propertyValue = toHeatmapLayer(layer).getDefaultHeatmapColor();
}
return std::move(*convert<jni::Local<jni::Object<>>>(env, propertyValue));
}
jni::Local<jni::Object<>> HeatmapLayer::getHeatmapOpacity(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::HeatmapLayer>()->HeatmapLayer::getHeatmapOpacity()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toHeatmapLayer(layer).getHeatmapOpacity()));
}
jni::Local<jni::Object<TransitionOptions>> HeatmapLayer::getHeatmapOpacityTransition(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- mbgl::style::TransitionOptions options = layer.as<mbgl::style::HeatmapLayer>()->HeatmapLayer::getHeatmapOpacityTransition();
+ mbgl::style::TransitionOptions options = toHeatmapLayer(layer).getHeatmapOpacityTransition();
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, options));
}
@@ -100,7 +104,7 @@ namespace android {
mbgl::style::TransitionOptions options;
options.duration.emplace(mbgl::Milliseconds(duration));
options.delay.emplace(mbgl::Milliseconds(delay));
- layer.as<mbgl::style::HeatmapLayer>()->HeatmapLayer::setHeatmapOpacityTransition(options);
+ toHeatmapLayer(layer).setHeatmapOpacityTransition(options);
}
diff --git a/platform/android/src/style/layers/hillshade_layer.cpp b/platform/android/src/style/layers/hillshade_layer.cpp
index 5cd6162575..3f3c8e311a 100644
--- a/platform/android/src/style/layers/hillshade_layer.cpp
+++ b/platform/android/src/style/layers/hillshade_layer.cpp
@@ -10,6 +10,10 @@
namespace mbgl {
namespace android {
+ inline mbgl::style::HillshadeLayer& toHillshadeLayer(mbgl::style::Layer& layer) {
+ return static_cast<mbgl::style::HillshadeLayer&>(layer);
+ }
+
/**
* Creates an owning peer object (for layers not attached to the map) from the JVM side
*/
@@ -37,22 +41,22 @@ namespace android {
jni::Local<jni::Object<>> HillshadeLayer::getHillshadeIlluminationDirection(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::HillshadeLayer>()->HillshadeLayer::getHillshadeIlluminationDirection()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toHillshadeLayer(layer).getHillshadeIlluminationDirection()));
}
jni::Local<jni::Object<>> HillshadeLayer::getHillshadeIlluminationAnchor(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::HillshadeLayer>()->HillshadeLayer::getHillshadeIlluminationAnchor()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toHillshadeLayer(layer).getHillshadeIlluminationAnchor()));
}
jni::Local<jni::Object<>> HillshadeLayer::getHillshadeExaggeration(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::HillshadeLayer>()->HillshadeLayer::getHillshadeExaggeration()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toHillshadeLayer(layer).getHillshadeExaggeration()));
}
jni::Local<jni::Object<TransitionOptions>> HillshadeLayer::getHillshadeExaggerationTransition(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- mbgl::style::TransitionOptions options = layer.as<mbgl::style::HillshadeLayer>()->HillshadeLayer::getHillshadeExaggerationTransition();
+ mbgl::style::TransitionOptions options = toHillshadeLayer(layer).getHillshadeExaggerationTransition();
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, options));
}
@@ -60,17 +64,17 @@ namespace android {
mbgl::style::TransitionOptions options;
options.duration.emplace(mbgl::Milliseconds(duration));
options.delay.emplace(mbgl::Milliseconds(delay));
- layer.as<mbgl::style::HillshadeLayer>()->HillshadeLayer::setHillshadeExaggerationTransition(options);
+ toHillshadeLayer(layer).setHillshadeExaggerationTransition(options);
}
jni::Local<jni::Object<>> HillshadeLayer::getHillshadeShadowColor(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::HillshadeLayer>()->HillshadeLayer::getHillshadeShadowColor()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toHillshadeLayer(layer).getHillshadeShadowColor()));
}
jni::Local<jni::Object<TransitionOptions>> HillshadeLayer::getHillshadeShadowColorTransition(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- mbgl::style::TransitionOptions options = layer.as<mbgl::style::HillshadeLayer>()->HillshadeLayer::getHillshadeShadowColorTransition();
+ mbgl::style::TransitionOptions options = toHillshadeLayer(layer).getHillshadeShadowColorTransition();
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, options));
}
@@ -78,17 +82,17 @@ namespace android {
mbgl::style::TransitionOptions options;
options.duration.emplace(mbgl::Milliseconds(duration));
options.delay.emplace(mbgl::Milliseconds(delay));
- layer.as<mbgl::style::HillshadeLayer>()->HillshadeLayer::setHillshadeShadowColorTransition(options);
+ toHillshadeLayer(layer).setHillshadeShadowColorTransition(options);
}
jni::Local<jni::Object<>> HillshadeLayer::getHillshadeHighlightColor(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::HillshadeLayer>()->HillshadeLayer::getHillshadeHighlightColor()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toHillshadeLayer(layer).getHillshadeHighlightColor()));
}
jni::Local<jni::Object<TransitionOptions>> HillshadeLayer::getHillshadeHighlightColorTransition(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- mbgl::style::TransitionOptions options = layer.as<mbgl::style::HillshadeLayer>()->HillshadeLayer::getHillshadeHighlightColorTransition();
+ mbgl::style::TransitionOptions options = toHillshadeLayer(layer).getHillshadeHighlightColorTransition();
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, options));
}
@@ -96,17 +100,17 @@ namespace android {
mbgl::style::TransitionOptions options;
options.duration.emplace(mbgl::Milliseconds(duration));
options.delay.emplace(mbgl::Milliseconds(delay));
- layer.as<mbgl::style::HillshadeLayer>()->HillshadeLayer::setHillshadeHighlightColorTransition(options);
+ toHillshadeLayer(layer).setHillshadeHighlightColorTransition(options);
}
jni::Local<jni::Object<>> HillshadeLayer::getHillshadeAccentColor(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::HillshadeLayer>()->HillshadeLayer::getHillshadeAccentColor()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toHillshadeLayer(layer).getHillshadeAccentColor()));
}
jni::Local<jni::Object<TransitionOptions>> HillshadeLayer::getHillshadeAccentColorTransition(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- mbgl::style::TransitionOptions options = layer.as<mbgl::style::HillshadeLayer>()->HillshadeLayer::getHillshadeAccentColorTransition();
+ mbgl::style::TransitionOptions options = toHillshadeLayer(layer).getHillshadeAccentColorTransition();
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, options));
}
@@ -114,7 +118,7 @@ namespace android {
mbgl::style::TransitionOptions options;
options.duration.emplace(mbgl::Milliseconds(duration));
options.delay.emplace(mbgl::Milliseconds(delay));
- layer.as<mbgl::style::HillshadeLayer>()->HillshadeLayer::setHillshadeAccentColorTransition(options);
+ toHillshadeLayer(layer).setHillshadeAccentColorTransition(options);
}
diff --git a/platform/android/src/style/layers/layer.cpp.ejs b/platform/android/src/style/layers/layer.cpp.ejs
index 875bc88bc0..5fd8537c5a 100644
--- a/platform/android/src/style/layers/layer.cpp.ejs
+++ b/platform/android/src/style/layers/layer.cpp.ejs
@@ -14,6 +14,10 @@
namespace mbgl {
namespace android {
+ inline mbgl::style::<%- camelize(type) %>Layer& to<%- camelize(type) %>Layer(mbgl::style::Layer& layer) {
+ return static_cast<mbgl::style::<%- camelize(type) %>Layer&>(layer);
+ }
+
<% if (type === 'background') { -%>
/**
* Creates an owning peer object (for layers not attached to the map) from the JVM side
@@ -51,15 +55,15 @@ namespace android {
<% if (property.name != 'heatmap-color') { -%>
jni::Local<jni::Object<>> <%- camelize(type) %>Layer::get<%- camelize(property.name) %>(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::<%- camelize(type) %>Layer>()-><%- camelize(type) %>Layer::get<%- camelize(property.name) %>()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, to<%- camelize(type) %>Layer(layer).get<%- camelize(property.name) %>()));
}
<% } else { -%>
jni::Local<jni::Object<>> HeatmapLayer::getHeatmapColor(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- auto propertyValue = layer.as<mbgl::style::HeatmapLayer>()->HeatmapLayer::getHeatmapColor();
+ auto propertyValue = to<%- camelize(type) %>Layer(layer).getHeatmapColor();
if (propertyValue.isUndefined()) {
- propertyValue = layer.as<mbgl::style::HeatmapLayer>()->HeatmapLayer::getDefaultHeatmapColor();
+ propertyValue = to<%- camelize(type) %>Layer(layer).getDefaultHeatmapColor();
}
return std::move(*convert<jni::Local<jni::Object<>>>(env, propertyValue));
}
@@ -68,7 +72,7 @@ namespace android {
<% if (property.transition) { -%>
jni::Local<jni::Object<TransitionOptions>> <%- camelize(type) %>Layer::get<%- camelize(property.name) %>Transition(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- mbgl::style::TransitionOptions options = layer.as<mbgl::style::<%- camelize(type) %>Layer>()-><%- camelize(type) %>Layer::get<%- camelize(property.name) %>Transition();
+ mbgl::style::TransitionOptions options = to<%- camelize(type) %>Layer(layer).get<%- camelize(property.name) %>Transition();
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, options));
}
@@ -76,7 +80,7 @@ namespace android {
mbgl::style::TransitionOptions options;
options.duration.emplace(mbgl::Milliseconds(duration));
options.delay.emplace(mbgl::Milliseconds(delay));
- layer.as<mbgl::style::<%- camelize(type) %>Layer>()-><%- camelize(type) %>Layer::set<%- camelize(property.name) %>Transition(options);
+ to<%- camelize(type) %>Layer(layer).set<%- camelize(property.name) %>Transition(options);
}
<% } -%>
diff --git a/platform/android/src/style/layers/layer.hpp b/platform/android/src/style/layers/layer.hpp
index cee1b5a64e..ab3b1d339d 100644
--- a/platform/android/src/style/layers/layer.hpp
+++ b/platform/android/src/style/layers/layer.hpp
@@ -10,6 +10,8 @@
#include <jni/jni.hpp>
namespace mbgl {
+
+
namespace android {
class Layer : private mbgl::util::noncopyable {
@@ -91,7 +93,6 @@ protected:
// Map is set when the layer is retrieved or after adding to the map
mbgl::Map* map;
-
};
} // namespace android
diff --git a/platform/android/src/style/layers/layers.cpp b/platform/android/src/style/layers/layers.cpp
index c0a3acdf42..da870aa0e3 100644
--- a/platform/android/src/style/layers/layers.cpp
+++ b/platform/android/src/style/layers/layers.cpp
@@ -31,12 +31,12 @@ namespace android {
template <typename T>
inline std::unique_ptr<T> to(std::unique_ptr<style::Layer> layer) {
- return std::unique_ptr<T>(layer.release()->as<T>());
+ return std::unique_ptr<T>(static_cast<T*>(layer.release()));
}
template <typename T>
inline T& to(style::Layer& layer) {
- return *layer.as<T>();
+ return static_cast<T&>(layer);
}
template <typename T>
diff --git a/platform/android/src/style/layers/line_layer.cpp b/platform/android/src/style/layers/line_layer.cpp
index 376e4aafc0..28a6c54749 100644
--- a/platform/android/src/style/layers/line_layer.cpp
+++ b/platform/android/src/style/layers/line_layer.cpp
@@ -10,6 +10,10 @@
namespace mbgl {
namespace android {
+ inline mbgl::style::LineLayer& toLineLayer(mbgl::style::Layer& layer) {
+ return static_cast<mbgl::style::LineLayer&>(layer);
+ }
+
/**
* Creates an owning peer object (for layers not attached to the map) from the JVM side
*/
@@ -37,32 +41,32 @@ namespace android {
jni::Local<jni::Object<>> LineLayer::getLineCap(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::LineLayer>()->LineLayer::getLineCap()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toLineLayer(layer).getLineCap()));
}
jni::Local<jni::Object<>> LineLayer::getLineJoin(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::LineLayer>()->LineLayer::getLineJoin()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toLineLayer(layer).getLineJoin()));
}
jni::Local<jni::Object<>> LineLayer::getLineMiterLimit(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::LineLayer>()->LineLayer::getLineMiterLimit()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toLineLayer(layer).getLineMiterLimit()));
}
jni::Local<jni::Object<>> LineLayer::getLineRoundLimit(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::LineLayer>()->LineLayer::getLineRoundLimit()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toLineLayer(layer).getLineRoundLimit()));
}
jni::Local<jni::Object<>> LineLayer::getLineOpacity(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::LineLayer>()->LineLayer::getLineOpacity()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toLineLayer(layer).getLineOpacity()));
}
jni::Local<jni::Object<TransitionOptions>> LineLayer::getLineOpacityTransition(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- mbgl::style::TransitionOptions options = layer.as<mbgl::style::LineLayer>()->LineLayer::getLineOpacityTransition();
+ mbgl::style::TransitionOptions options = toLineLayer(layer).getLineOpacityTransition();
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, options));
}
@@ -70,17 +74,17 @@ namespace android {
mbgl::style::TransitionOptions options;
options.duration.emplace(mbgl::Milliseconds(duration));
options.delay.emplace(mbgl::Milliseconds(delay));
- layer.as<mbgl::style::LineLayer>()->LineLayer::setLineOpacityTransition(options);
+ toLineLayer(layer).setLineOpacityTransition(options);
}
jni::Local<jni::Object<>> LineLayer::getLineColor(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::LineLayer>()->LineLayer::getLineColor()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toLineLayer(layer).getLineColor()));
}
jni::Local<jni::Object<TransitionOptions>> LineLayer::getLineColorTransition(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- mbgl::style::TransitionOptions options = layer.as<mbgl::style::LineLayer>()->LineLayer::getLineColorTransition();
+ mbgl::style::TransitionOptions options = toLineLayer(layer).getLineColorTransition();
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, options));
}
@@ -88,17 +92,17 @@ namespace android {
mbgl::style::TransitionOptions options;
options.duration.emplace(mbgl::Milliseconds(duration));
options.delay.emplace(mbgl::Milliseconds(delay));
- layer.as<mbgl::style::LineLayer>()->LineLayer::setLineColorTransition(options);
+ toLineLayer(layer).setLineColorTransition(options);
}
jni::Local<jni::Object<>> LineLayer::getLineTranslate(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::LineLayer>()->LineLayer::getLineTranslate()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toLineLayer(layer).getLineTranslate()));
}
jni::Local<jni::Object<TransitionOptions>> LineLayer::getLineTranslateTransition(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- mbgl::style::TransitionOptions options = layer.as<mbgl::style::LineLayer>()->LineLayer::getLineTranslateTransition();
+ mbgl::style::TransitionOptions options = toLineLayer(layer).getLineTranslateTransition();
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, options));
}
@@ -106,22 +110,22 @@ namespace android {
mbgl::style::TransitionOptions options;
options.duration.emplace(mbgl::Milliseconds(duration));
options.delay.emplace(mbgl::Milliseconds(delay));
- layer.as<mbgl::style::LineLayer>()->LineLayer::setLineTranslateTransition(options);
+ toLineLayer(layer).setLineTranslateTransition(options);
}
jni::Local<jni::Object<>> LineLayer::getLineTranslateAnchor(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::LineLayer>()->LineLayer::getLineTranslateAnchor()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toLineLayer(layer).getLineTranslateAnchor()));
}
jni::Local<jni::Object<>> LineLayer::getLineWidth(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::LineLayer>()->LineLayer::getLineWidth()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toLineLayer(layer).getLineWidth()));
}
jni::Local<jni::Object<TransitionOptions>> LineLayer::getLineWidthTransition(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- mbgl::style::TransitionOptions options = layer.as<mbgl::style::LineLayer>()->LineLayer::getLineWidthTransition();
+ mbgl::style::TransitionOptions options = toLineLayer(layer).getLineWidthTransition();
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, options));
}
@@ -129,17 +133,17 @@ namespace android {
mbgl::style::TransitionOptions options;
options.duration.emplace(mbgl::Milliseconds(duration));
options.delay.emplace(mbgl::Milliseconds(delay));
- layer.as<mbgl::style::LineLayer>()->LineLayer::setLineWidthTransition(options);
+ toLineLayer(layer).setLineWidthTransition(options);
}
jni::Local<jni::Object<>> LineLayer::getLineGapWidth(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::LineLayer>()->LineLayer::getLineGapWidth()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toLineLayer(layer).getLineGapWidth()));
}
jni::Local<jni::Object<TransitionOptions>> LineLayer::getLineGapWidthTransition(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- mbgl::style::TransitionOptions options = layer.as<mbgl::style::LineLayer>()->LineLayer::getLineGapWidthTransition();
+ mbgl::style::TransitionOptions options = toLineLayer(layer).getLineGapWidthTransition();
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, options));
}
@@ -147,17 +151,17 @@ namespace android {
mbgl::style::TransitionOptions options;
options.duration.emplace(mbgl::Milliseconds(duration));
options.delay.emplace(mbgl::Milliseconds(delay));
- layer.as<mbgl::style::LineLayer>()->LineLayer::setLineGapWidthTransition(options);
+ toLineLayer(layer).setLineGapWidthTransition(options);
}
jni::Local<jni::Object<>> LineLayer::getLineOffset(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::LineLayer>()->LineLayer::getLineOffset()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toLineLayer(layer).getLineOffset()));
}
jni::Local<jni::Object<TransitionOptions>> LineLayer::getLineOffsetTransition(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- mbgl::style::TransitionOptions options = layer.as<mbgl::style::LineLayer>()->LineLayer::getLineOffsetTransition();
+ mbgl::style::TransitionOptions options = toLineLayer(layer).getLineOffsetTransition();
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, options));
}
@@ -165,17 +169,17 @@ namespace android {
mbgl::style::TransitionOptions options;
options.duration.emplace(mbgl::Milliseconds(duration));
options.delay.emplace(mbgl::Milliseconds(delay));
- layer.as<mbgl::style::LineLayer>()->LineLayer::setLineOffsetTransition(options);
+ toLineLayer(layer).setLineOffsetTransition(options);
}
jni::Local<jni::Object<>> LineLayer::getLineBlur(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::LineLayer>()->LineLayer::getLineBlur()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toLineLayer(layer).getLineBlur()));
}
jni::Local<jni::Object<TransitionOptions>> LineLayer::getLineBlurTransition(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- mbgl::style::TransitionOptions options = layer.as<mbgl::style::LineLayer>()->LineLayer::getLineBlurTransition();
+ mbgl::style::TransitionOptions options = toLineLayer(layer).getLineBlurTransition();
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, options));
}
@@ -183,17 +187,17 @@ namespace android {
mbgl::style::TransitionOptions options;
options.duration.emplace(mbgl::Milliseconds(duration));
options.delay.emplace(mbgl::Milliseconds(delay));
- layer.as<mbgl::style::LineLayer>()->LineLayer::setLineBlurTransition(options);
+ toLineLayer(layer).setLineBlurTransition(options);
}
jni::Local<jni::Object<>> LineLayer::getLineDasharray(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::LineLayer>()->LineLayer::getLineDasharray()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toLineLayer(layer).getLineDasharray()));
}
jni::Local<jni::Object<TransitionOptions>> LineLayer::getLineDasharrayTransition(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- mbgl::style::TransitionOptions options = layer.as<mbgl::style::LineLayer>()->LineLayer::getLineDasharrayTransition();
+ mbgl::style::TransitionOptions options = toLineLayer(layer).getLineDasharrayTransition();
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, options));
}
@@ -201,17 +205,17 @@ namespace android {
mbgl::style::TransitionOptions options;
options.duration.emplace(mbgl::Milliseconds(duration));
options.delay.emplace(mbgl::Milliseconds(delay));
- layer.as<mbgl::style::LineLayer>()->LineLayer::setLineDasharrayTransition(options);
+ toLineLayer(layer).setLineDasharrayTransition(options);
}
jni::Local<jni::Object<>> LineLayer::getLinePattern(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::LineLayer>()->LineLayer::getLinePattern()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toLineLayer(layer).getLinePattern()));
}
jni::Local<jni::Object<TransitionOptions>> LineLayer::getLinePatternTransition(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- mbgl::style::TransitionOptions options = layer.as<mbgl::style::LineLayer>()->LineLayer::getLinePatternTransition();
+ mbgl::style::TransitionOptions options = toLineLayer(layer).getLinePatternTransition();
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, options));
}
@@ -219,12 +223,12 @@ namespace android {
mbgl::style::TransitionOptions options;
options.duration.emplace(mbgl::Milliseconds(duration));
options.delay.emplace(mbgl::Milliseconds(delay));
- layer.as<mbgl::style::LineLayer>()->LineLayer::setLinePatternTransition(options);
+ toLineLayer(layer).setLinePatternTransition(options);
}
jni::Local<jni::Object<>> LineLayer::getLineGradient(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::LineLayer>()->LineLayer::getLineGradient()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toLineLayer(layer).getLineGradient()));
}
diff --git a/platform/android/src/style/layers/raster_layer.cpp b/platform/android/src/style/layers/raster_layer.cpp
index 5a3579bc37..5acbb8fe89 100644
--- a/platform/android/src/style/layers/raster_layer.cpp
+++ b/platform/android/src/style/layers/raster_layer.cpp
@@ -10,6 +10,10 @@
namespace mbgl {
namespace android {
+ inline mbgl::style::RasterLayer& toRasterLayer(mbgl::style::Layer& layer) {
+ return static_cast<mbgl::style::RasterLayer&>(layer);
+ }
+
/**
* Creates an owning peer object (for layers not attached to the map) from the JVM side
*/
@@ -37,12 +41,12 @@ namespace android {
jni::Local<jni::Object<>> RasterLayer::getRasterOpacity(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::RasterLayer>()->RasterLayer::getRasterOpacity()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toRasterLayer(layer).getRasterOpacity()));
}
jni::Local<jni::Object<TransitionOptions>> RasterLayer::getRasterOpacityTransition(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- mbgl::style::TransitionOptions options = layer.as<mbgl::style::RasterLayer>()->RasterLayer::getRasterOpacityTransition();
+ mbgl::style::TransitionOptions options = toRasterLayer(layer).getRasterOpacityTransition();
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, options));
}
@@ -50,17 +54,17 @@ namespace android {
mbgl::style::TransitionOptions options;
options.duration.emplace(mbgl::Milliseconds(duration));
options.delay.emplace(mbgl::Milliseconds(delay));
- layer.as<mbgl::style::RasterLayer>()->RasterLayer::setRasterOpacityTransition(options);
+ toRasterLayer(layer).setRasterOpacityTransition(options);
}
jni::Local<jni::Object<>> RasterLayer::getRasterHueRotate(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::RasterLayer>()->RasterLayer::getRasterHueRotate()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toRasterLayer(layer).getRasterHueRotate()));
}
jni::Local<jni::Object<TransitionOptions>> RasterLayer::getRasterHueRotateTransition(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- mbgl::style::TransitionOptions options = layer.as<mbgl::style::RasterLayer>()->RasterLayer::getRasterHueRotateTransition();
+ mbgl::style::TransitionOptions options = toRasterLayer(layer).getRasterHueRotateTransition();
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, options));
}
@@ -68,17 +72,17 @@ namespace android {
mbgl::style::TransitionOptions options;
options.duration.emplace(mbgl::Milliseconds(duration));
options.delay.emplace(mbgl::Milliseconds(delay));
- layer.as<mbgl::style::RasterLayer>()->RasterLayer::setRasterHueRotateTransition(options);
+ toRasterLayer(layer).setRasterHueRotateTransition(options);
}
jni::Local<jni::Object<>> RasterLayer::getRasterBrightnessMin(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::RasterLayer>()->RasterLayer::getRasterBrightnessMin()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toRasterLayer(layer).getRasterBrightnessMin()));
}
jni::Local<jni::Object<TransitionOptions>> RasterLayer::getRasterBrightnessMinTransition(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- mbgl::style::TransitionOptions options = layer.as<mbgl::style::RasterLayer>()->RasterLayer::getRasterBrightnessMinTransition();
+ mbgl::style::TransitionOptions options = toRasterLayer(layer).getRasterBrightnessMinTransition();
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, options));
}
@@ -86,17 +90,17 @@ namespace android {
mbgl::style::TransitionOptions options;
options.duration.emplace(mbgl::Milliseconds(duration));
options.delay.emplace(mbgl::Milliseconds(delay));
- layer.as<mbgl::style::RasterLayer>()->RasterLayer::setRasterBrightnessMinTransition(options);
+ toRasterLayer(layer).setRasterBrightnessMinTransition(options);
}
jni::Local<jni::Object<>> RasterLayer::getRasterBrightnessMax(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::RasterLayer>()->RasterLayer::getRasterBrightnessMax()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toRasterLayer(layer).getRasterBrightnessMax()));
}
jni::Local<jni::Object<TransitionOptions>> RasterLayer::getRasterBrightnessMaxTransition(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- mbgl::style::TransitionOptions options = layer.as<mbgl::style::RasterLayer>()->RasterLayer::getRasterBrightnessMaxTransition();
+ mbgl::style::TransitionOptions options = toRasterLayer(layer).getRasterBrightnessMaxTransition();
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, options));
}
@@ -104,17 +108,17 @@ namespace android {
mbgl::style::TransitionOptions options;
options.duration.emplace(mbgl::Milliseconds(duration));
options.delay.emplace(mbgl::Milliseconds(delay));
- layer.as<mbgl::style::RasterLayer>()->RasterLayer::setRasterBrightnessMaxTransition(options);
+ toRasterLayer(layer).setRasterBrightnessMaxTransition(options);
}
jni::Local<jni::Object<>> RasterLayer::getRasterSaturation(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::RasterLayer>()->RasterLayer::getRasterSaturation()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toRasterLayer(layer).getRasterSaturation()));
}
jni::Local<jni::Object<TransitionOptions>> RasterLayer::getRasterSaturationTransition(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- mbgl::style::TransitionOptions options = layer.as<mbgl::style::RasterLayer>()->RasterLayer::getRasterSaturationTransition();
+ mbgl::style::TransitionOptions options = toRasterLayer(layer).getRasterSaturationTransition();
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, options));
}
@@ -122,17 +126,17 @@ namespace android {
mbgl::style::TransitionOptions options;
options.duration.emplace(mbgl::Milliseconds(duration));
options.delay.emplace(mbgl::Milliseconds(delay));
- layer.as<mbgl::style::RasterLayer>()->RasterLayer::setRasterSaturationTransition(options);
+ toRasterLayer(layer).setRasterSaturationTransition(options);
}
jni::Local<jni::Object<>> RasterLayer::getRasterContrast(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::RasterLayer>()->RasterLayer::getRasterContrast()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toRasterLayer(layer).getRasterContrast()));
}
jni::Local<jni::Object<TransitionOptions>> RasterLayer::getRasterContrastTransition(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- mbgl::style::TransitionOptions options = layer.as<mbgl::style::RasterLayer>()->RasterLayer::getRasterContrastTransition();
+ mbgl::style::TransitionOptions options = toRasterLayer(layer).getRasterContrastTransition();
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, options));
}
@@ -140,17 +144,17 @@ namespace android {
mbgl::style::TransitionOptions options;
options.duration.emplace(mbgl::Milliseconds(duration));
options.delay.emplace(mbgl::Milliseconds(delay));
- layer.as<mbgl::style::RasterLayer>()->RasterLayer::setRasterContrastTransition(options);
+ toRasterLayer(layer).setRasterContrastTransition(options);
}
jni::Local<jni::Object<>> RasterLayer::getRasterResampling(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::RasterLayer>()->RasterLayer::getRasterResampling()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toRasterLayer(layer).getRasterResampling()));
}
jni::Local<jni::Object<>> RasterLayer::getRasterFadeDuration(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::RasterLayer>()->RasterLayer::getRasterFadeDuration()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toRasterLayer(layer).getRasterFadeDuration()));
}
diff --git a/platform/android/src/style/layers/symbol_layer.cpp b/platform/android/src/style/layers/symbol_layer.cpp
index f1c77c61a9..27896208a7 100644
--- a/platform/android/src/style/layers/symbol_layer.cpp
+++ b/platform/android/src/style/layers/symbol_layer.cpp
@@ -10,6 +10,10 @@
namespace mbgl {
namespace android {
+ inline mbgl::style::SymbolLayer& toSymbolLayer(mbgl::style::Layer& layer) {
+ return static_cast<mbgl::style::SymbolLayer&>(layer);
+ }
+
/**
* Creates an owning peer object (for layers not attached to the map) from the JVM side
*/
@@ -37,197 +41,197 @@ namespace android {
jni::Local<jni::Object<>> SymbolLayer::getSymbolPlacement(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getSymbolPlacement()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toSymbolLayer(layer).getSymbolPlacement()));
}
jni::Local<jni::Object<>> SymbolLayer::getSymbolSpacing(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getSymbolSpacing()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toSymbolLayer(layer).getSymbolSpacing()));
}
jni::Local<jni::Object<>> SymbolLayer::getSymbolAvoidEdges(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getSymbolAvoidEdges()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toSymbolLayer(layer).getSymbolAvoidEdges()));
}
jni::Local<jni::Object<>> SymbolLayer::getSymbolZOrder(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getSymbolZOrder()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toSymbolLayer(layer).getSymbolZOrder()));
}
jni::Local<jni::Object<>> SymbolLayer::getIconAllowOverlap(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getIconAllowOverlap()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toSymbolLayer(layer).getIconAllowOverlap()));
}
jni::Local<jni::Object<>> SymbolLayer::getIconIgnorePlacement(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getIconIgnorePlacement()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toSymbolLayer(layer).getIconIgnorePlacement()));
}
jni::Local<jni::Object<>> SymbolLayer::getIconOptional(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getIconOptional()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toSymbolLayer(layer).getIconOptional()));
}
jni::Local<jni::Object<>> SymbolLayer::getIconRotationAlignment(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getIconRotationAlignment()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toSymbolLayer(layer).getIconRotationAlignment()));
}
jni::Local<jni::Object<>> SymbolLayer::getIconSize(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getIconSize()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toSymbolLayer(layer).getIconSize()));
}
jni::Local<jni::Object<>> SymbolLayer::getIconTextFit(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getIconTextFit()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toSymbolLayer(layer).getIconTextFit()));
}
jni::Local<jni::Object<>> SymbolLayer::getIconTextFitPadding(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getIconTextFitPadding()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toSymbolLayer(layer).getIconTextFitPadding()));
}
jni::Local<jni::Object<>> SymbolLayer::getIconImage(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getIconImage()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toSymbolLayer(layer).getIconImage()));
}
jni::Local<jni::Object<>> SymbolLayer::getIconRotate(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getIconRotate()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toSymbolLayer(layer).getIconRotate()));
}
jni::Local<jni::Object<>> SymbolLayer::getIconPadding(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getIconPadding()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toSymbolLayer(layer).getIconPadding()));
}
jni::Local<jni::Object<>> SymbolLayer::getIconKeepUpright(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getIconKeepUpright()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toSymbolLayer(layer).getIconKeepUpright()));
}
jni::Local<jni::Object<>> SymbolLayer::getIconOffset(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getIconOffset()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toSymbolLayer(layer).getIconOffset()));
}
jni::Local<jni::Object<>> SymbolLayer::getIconAnchor(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getIconAnchor()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toSymbolLayer(layer).getIconAnchor()));
}
jni::Local<jni::Object<>> SymbolLayer::getIconPitchAlignment(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getIconPitchAlignment()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toSymbolLayer(layer).getIconPitchAlignment()));
}
jni::Local<jni::Object<>> SymbolLayer::getTextPitchAlignment(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getTextPitchAlignment()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toSymbolLayer(layer).getTextPitchAlignment()));
}
jni::Local<jni::Object<>> SymbolLayer::getTextRotationAlignment(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getTextRotationAlignment()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toSymbolLayer(layer).getTextRotationAlignment()));
}
jni::Local<jni::Object<>> SymbolLayer::getTextField(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getTextField()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toSymbolLayer(layer).getTextField()));
}
jni::Local<jni::Object<>> SymbolLayer::getTextFont(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getTextFont()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toSymbolLayer(layer).getTextFont()));
}
jni::Local<jni::Object<>> SymbolLayer::getTextSize(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getTextSize()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toSymbolLayer(layer).getTextSize()));
}
jni::Local<jni::Object<>> SymbolLayer::getTextMaxWidth(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getTextMaxWidth()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toSymbolLayer(layer).getTextMaxWidth()));
}
jni::Local<jni::Object<>> SymbolLayer::getTextLineHeight(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getTextLineHeight()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toSymbolLayer(layer).getTextLineHeight()));
}
jni::Local<jni::Object<>> SymbolLayer::getTextLetterSpacing(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getTextLetterSpacing()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toSymbolLayer(layer).getTextLetterSpacing()));
}
jni::Local<jni::Object<>> SymbolLayer::getTextJustify(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getTextJustify()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toSymbolLayer(layer).getTextJustify()));
}
jni::Local<jni::Object<>> SymbolLayer::getTextAnchor(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getTextAnchor()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toSymbolLayer(layer).getTextAnchor()));
}
jni::Local<jni::Object<>> SymbolLayer::getTextMaxAngle(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getTextMaxAngle()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toSymbolLayer(layer).getTextMaxAngle()));
}
jni::Local<jni::Object<>> SymbolLayer::getTextRotate(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getTextRotate()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toSymbolLayer(layer).getTextRotate()));
}
jni::Local<jni::Object<>> SymbolLayer::getTextPadding(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getTextPadding()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toSymbolLayer(layer).getTextPadding()));
}
jni::Local<jni::Object<>> SymbolLayer::getTextKeepUpright(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getTextKeepUpright()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toSymbolLayer(layer).getTextKeepUpright()));
}
jni::Local<jni::Object<>> SymbolLayer::getTextTransform(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getTextTransform()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toSymbolLayer(layer).getTextTransform()));
}
jni::Local<jni::Object<>> SymbolLayer::getTextOffset(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getTextOffset()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toSymbolLayer(layer).getTextOffset()));
}
jni::Local<jni::Object<>> SymbolLayer::getTextAllowOverlap(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getTextAllowOverlap()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toSymbolLayer(layer).getTextAllowOverlap()));
}
jni::Local<jni::Object<>> SymbolLayer::getTextIgnorePlacement(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getTextIgnorePlacement()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toSymbolLayer(layer).getTextIgnorePlacement()));
}
jni::Local<jni::Object<>> SymbolLayer::getTextOptional(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getTextOptional()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toSymbolLayer(layer).getTextOptional()));
}
jni::Local<jni::Object<>> SymbolLayer::getIconOpacity(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getIconOpacity()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toSymbolLayer(layer).getIconOpacity()));
}
jni::Local<jni::Object<TransitionOptions>> SymbolLayer::getIconOpacityTransition(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- mbgl::style::TransitionOptions options = layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getIconOpacityTransition();
+ mbgl::style::TransitionOptions options = toSymbolLayer(layer).getIconOpacityTransition();
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, options));
}
@@ -235,17 +239,17 @@ namespace android {
mbgl::style::TransitionOptions options;
options.duration.emplace(mbgl::Milliseconds(duration));
options.delay.emplace(mbgl::Milliseconds(delay));
- layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::setIconOpacityTransition(options);
+ toSymbolLayer(layer).setIconOpacityTransition(options);
}
jni::Local<jni::Object<>> SymbolLayer::getIconColor(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getIconColor()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toSymbolLayer(layer).getIconColor()));
}
jni::Local<jni::Object<TransitionOptions>> SymbolLayer::getIconColorTransition(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- mbgl::style::TransitionOptions options = layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getIconColorTransition();
+ mbgl::style::TransitionOptions options = toSymbolLayer(layer).getIconColorTransition();
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, options));
}
@@ -253,17 +257,17 @@ namespace android {
mbgl::style::TransitionOptions options;
options.duration.emplace(mbgl::Milliseconds(duration));
options.delay.emplace(mbgl::Milliseconds(delay));
- layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::setIconColorTransition(options);
+ toSymbolLayer(layer).setIconColorTransition(options);
}
jni::Local<jni::Object<>> SymbolLayer::getIconHaloColor(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getIconHaloColor()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toSymbolLayer(layer).getIconHaloColor()));
}
jni::Local<jni::Object<TransitionOptions>> SymbolLayer::getIconHaloColorTransition(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- mbgl::style::TransitionOptions options = layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getIconHaloColorTransition();
+ mbgl::style::TransitionOptions options = toSymbolLayer(layer).getIconHaloColorTransition();
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, options));
}
@@ -271,17 +275,17 @@ namespace android {
mbgl::style::TransitionOptions options;
options.duration.emplace(mbgl::Milliseconds(duration));
options.delay.emplace(mbgl::Milliseconds(delay));
- layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::setIconHaloColorTransition(options);
+ toSymbolLayer(layer).setIconHaloColorTransition(options);
}
jni::Local<jni::Object<>> SymbolLayer::getIconHaloWidth(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getIconHaloWidth()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toSymbolLayer(layer).getIconHaloWidth()));
}
jni::Local<jni::Object<TransitionOptions>> SymbolLayer::getIconHaloWidthTransition(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- mbgl::style::TransitionOptions options = layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getIconHaloWidthTransition();
+ mbgl::style::TransitionOptions options = toSymbolLayer(layer).getIconHaloWidthTransition();
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, options));
}
@@ -289,17 +293,17 @@ namespace android {
mbgl::style::TransitionOptions options;
options.duration.emplace(mbgl::Milliseconds(duration));
options.delay.emplace(mbgl::Milliseconds(delay));
- layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::setIconHaloWidthTransition(options);
+ toSymbolLayer(layer).setIconHaloWidthTransition(options);
}
jni::Local<jni::Object<>> SymbolLayer::getIconHaloBlur(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getIconHaloBlur()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toSymbolLayer(layer).getIconHaloBlur()));
}
jni::Local<jni::Object<TransitionOptions>> SymbolLayer::getIconHaloBlurTransition(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- mbgl::style::TransitionOptions options = layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getIconHaloBlurTransition();
+ mbgl::style::TransitionOptions options = toSymbolLayer(layer).getIconHaloBlurTransition();
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, options));
}
@@ -307,17 +311,17 @@ namespace android {
mbgl::style::TransitionOptions options;
options.duration.emplace(mbgl::Milliseconds(duration));
options.delay.emplace(mbgl::Milliseconds(delay));
- layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::setIconHaloBlurTransition(options);
+ toSymbolLayer(layer).setIconHaloBlurTransition(options);
}
jni::Local<jni::Object<>> SymbolLayer::getIconTranslate(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getIconTranslate()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toSymbolLayer(layer).getIconTranslate()));
}
jni::Local<jni::Object<TransitionOptions>> SymbolLayer::getIconTranslateTransition(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- mbgl::style::TransitionOptions options = layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getIconTranslateTransition();
+ mbgl::style::TransitionOptions options = toSymbolLayer(layer).getIconTranslateTransition();
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, options));
}
@@ -325,22 +329,22 @@ namespace android {
mbgl::style::TransitionOptions options;
options.duration.emplace(mbgl::Milliseconds(duration));
options.delay.emplace(mbgl::Milliseconds(delay));
- layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::setIconTranslateTransition(options);
+ toSymbolLayer(layer).setIconTranslateTransition(options);
}
jni::Local<jni::Object<>> SymbolLayer::getIconTranslateAnchor(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getIconTranslateAnchor()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toSymbolLayer(layer).getIconTranslateAnchor()));
}
jni::Local<jni::Object<>> SymbolLayer::getTextOpacity(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getTextOpacity()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toSymbolLayer(layer).getTextOpacity()));
}
jni::Local<jni::Object<TransitionOptions>> SymbolLayer::getTextOpacityTransition(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- mbgl::style::TransitionOptions options = layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getTextOpacityTransition();
+ mbgl::style::TransitionOptions options = toSymbolLayer(layer).getTextOpacityTransition();
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, options));
}
@@ -348,17 +352,17 @@ namespace android {
mbgl::style::TransitionOptions options;
options.duration.emplace(mbgl::Milliseconds(duration));
options.delay.emplace(mbgl::Milliseconds(delay));
- layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::setTextOpacityTransition(options);
+ toSymbolLayer(layer).setTextOpacityTransition(options);
}
jni::Local<jni::Object<>> SymbolLayer::getTextColor(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getTextColor()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toSymbolLayer(layer).getTextColor()));
}
jni::Local<jni::Object<TransitionOptions>> SymbolLayer::getTextColorTransition(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- mbgl::style::TransitionOptions options = layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getTextColorTransition();
+ mbgl::style::TransitionOptions options = toSymbolLayer(layer).getTextColorTransition();
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, options));
}
@@ -366,17 +370,17 @@ namespace android {
mbgl::style::TransitionOptions options;
options.duration.emplace(mbgl::Milliseconds(duration));
options.delay.emplace(mbgl::Milliseconds(delay));
- layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::setTextColorTransition(options);
+ toSymbolLayer(layer).setTextColorTransition(options);
}
jni::Local<jni::Object<>> SymbolLayer::getTextHaloColor(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getTextHaloColor()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toSymbolLayer(layer).getTextHaloColor()));
}
jni::Local<jni::Object<TransitionOptions>> SymbolLayer::getTextHaloColorTransition(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- mbgl::style::TransitionOptions options = layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getTextHaloColorTransition();
+ mbgl::style::TransitionOptions options = toSymbolLayer(layer).getTextHaloColorTransition();
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, options));
}
@@ -384,17 +388,17 @@ namespace android {
mbgl::style::TransitionOptions options;
options.duration.emplace(mbgl::Milliseconds(duration));
options.delay.emplace(mbgl::Milliseconds(delay));
- layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::setTextHaloColorTransition(options);
+ toSymbolLayer(layer).setTextHaloColorTransition(options);
}
jni::Local<jni::Object<>> SymbolLayer::getTextHaloWidth(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getTextHaloWidth()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toSymbolLayer(layer).getTextHaloWidth()));
}
jni::Local<jni::Object<TransitionOptions>> SymbolLayer::getTextHaloWidthTransition(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- mbgl::style::TransitionOptions options = layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getTextHaloWidthTransition();
+ mbgl::style::TransitionOptions options = toSymbolLayer(layer).getTextHaloWidthTransition();
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, options));
}
@@ -402,17 +406,17 @@ namespace android {
mbgl::style::TransitionOptions options;
options.duration.emplace(mbgl::Milliseconds(duration));
options.delay.emplace(mbgl::Milliseconds(delay));
- layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::setTextHaloWidthTransition(options);
+ toSymbolLayer(layer).setTextHaloWidthTransition(options);
}
jni::Local<jni::Object<>> SymbolLayer::getTextHaloBlur(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getTextHaloBlur()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toSymbolLayer(layer).getTextHaloBlur()));
}
jni::Local<jni::Object<TransitionOptions>> SymbolLayer::getTextHaloBlurTransition(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- mbgl::style::TransitionOptions options = layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getTextHaloBlurTransition();
+ mbgl::style::TransitionOptions options = toSymbolLayer(layer).getTextHaloBlurTransition();
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, options));
}
@@ -420,17 +424,17 @@ namespace android {
mbgl::style::TransitionOptions options;
options.duration.emplace(mbgl::Milliseconds(duration));
options.delay.emplace(mbgl::Milliseconds(delay));
- layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::setTextHaloBlurTransition(options);
+ toSymbolLayer(layer).setTextHaloBlurTransition(options);
}
jni::Local<jni::Object<>> SymbolLayer::getTextTranslate(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getTextTranslate()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toSymbolLayer(layer).getTextTranslate()));
}
jni::Local<jni::Object<TransitionOptions>> SymbolLayer::getTextTranslateTransition(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- mbgl::style::TransitionOptions options = layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getTextTranslateTransition();
+ mbgl::style::TransitionOptions options = toSymbolLayer(layer).getTextTranslateTransition();
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, options));
}
@@ -438,12 +442,12 @@ namespace android {
mbgl::style::TransitionOptions options;
options.duration.emplace(mbgl::Milliseconds(duration));
options.delay.emplace(mbgl::Milliseconds(delay));
- layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::setTextTranslateTransition(options);
+ toSymbolLayer(layer).setTextTranslateTransition(options);
}
jni::Local<jni::Object<>> SymbolLayer::getTextTranslateAnchor(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
- return std::move(*convert<jni::Local<jni::Object<>>>(env, layer.as<mbgl::style::SymbolLayer>()->SymbolLayer::getTextTranslateAnchor()));
+ return std::move(*convert<jni::Local<jni::Object<>>>(env, toSymbolLayer(layer).getTextTranslateAnchor()));
}
diff --git a/platform/darwin/src/MGLStyle.mm b/platform/darwin/src/MGLStyle.mm
index 88499cf9bb..7d79a06fb1 100644
--- a/platform/darwin/src/MGLStyle.mm
+++ b/platform/darwin/src/MGLStyle.mm
@@ -350,30 +350,30 @@ static_assert(6 == mbgl::util::default_styles::numOrderedStyles,
if (MGLStyleLayer *layer = rawLayer->peer.has_value() ? rawLayer->peer.get<LayerWrapper>().layer : nil) {
return layer;
}
-
- if (auto fillLayer = rawLayer->as<mbgl::style::FillLayer>()) {
- return [[MGLFillStyleLayer alloc] initWithRawLayer:fillLayer];
- } else if (auto fillExtrusionLayer = rawLayer->as<mbgl::style::FillExtrusionLayer>()) {
- return [[MGLFillExtrusionStyleLayer alloc] initWithRawLayer:fillExtrusionLayer];
- } else if (auto lineLayer = rawLayer->as<mbgl::style::LineLayer>()) {
- return [[MGLLineStyleLayer alloc] initWithRawLayer:lineLayer];
- } else if (auto symbolLayer = rawLayer->as<mbgl::style::SymbolLayer>()) {
- return [[MGLSymbolStyleLayer alloc] initWithRawLayer:symbolLayer];
- } else if (auto rasterLayer = rawLayer->as<mbgl::style::RasterLayer>()) {
- return [[MGLRasterStyleLayer alloc] initWithRawLayer:rasterLayer];
- } else if (auto heatmapLayer = rawLayer->as<mbgl::style::HeatmapLayer>()) {
- return [[MGLHeatmapStyleLayer alloc] initWithRawLayer:heatmapLayer];
- } else if (auto hillshadeLayer = rawLayer->as<mbgl::style::HillshadeLayer>()) {
- return [[MGLHillshadeStyleLayer alloc] initWithRawLayer:hillshadeLayer];
- } else if (auto circleLayer = rawLayer->as<mbgl::style::CircleLayer>()) {
- return [[MGLCircleStyleLayer alloc] initWithRawLayer:circleLayer];
- } else if (auto backgroundLayer = rawLayer->as<mbgl::style::BackgroundLayer>()) {
- return [[MGLBackgroundStyleLayer alloc] initWithRawLayer:backgroundLayer];
- } else if (auto customLayer = rawLayer->as<mbgl::style::CustomLayer>()) {
- return [[MGLOpenGLStyleLayer alloc] initWithRawLayer:customLayer];
- } else {
- NSAssert(NO, @"Unrecognized layer type");
- return nil;
+ switch (rawLayer->getType()) {
+ case mbgl::style::LayerType::Fill:
+ return [[MGLFillStyleLayer alloc] initWithRawLayer:static_cast<mbgl::style::FillLayer*>(rawLayer)];
+ case mbgl::style::LayerType::FillExtrusion:
+ return [[MGLFillStyleLayer alloc] initWithRawLayer:static_cast<mbgl::style::FillExtrusionLayer*>(rawLayer)];
+ case mbgl::style::LayerType::Line:
+ return [[MGLFillStyleLayer alloc] initWithRawLayer:static_cast<mbgl::style::LineLayer*>(rawLayer)];
+ case mbgl::style::LayerType::Symbol:
+ return [[MGLFillStyleLayer alloc] initWithRawLayer:static_cast<mbgl::style::SymbolLayer*>(rawLayer)];
+ case mbgl::style::LayerType::Raster:
+ return [[MGLFillStyleLayer alloc] initWithRawLayer:static_cast<mbgl::style::RasterLayer*>(rawLayer)];
+ case mbgl::style::LayerType::Heatmap:
+ return [[MGLFillStyleLayer alloc] initWithRawLayer:static_cast<mbgl::style::HeatmapLayer*>(rawLayer)];
+ case mbgl::style::LayerType::Hillshade:
+ return [[MGLFillStyleLayer alloc] initWithRawLayer:static_cast<mbgl::style::HillshadeLayer*>(rawLayer)];
+ case mbgl::style::LayerType::Circle:
+ return [[MGLFillStyleLayer alloc] initWithRawLayer:static_cast<mbgl::style::CircleLayer*>(rawLayer)];
+ case mbgl::style::LayerType::Background:
+ return [[MGLFillStyleLayer alloc] initWithRawLayer:static_cast<mbgl::style::BackgroundLayer*>(rawLayer)];
+ case mbgl::style::LayerType::Custom:
+ return [[MGLFillStyleLayer alloc] initWithRawLayer:static_cast<mbgl::style::CustomLayer*>(rawLayer)];
+ default:
+ NSAssert(NO, @"Unrecognized layer type");
+ return nil;;
}
}
diff --git a/platform/darwin/test/MGLBackgroundStyleLayerTests.mm b/platform/darwin/test/MGLBackgroundStyleLayerTests.mm
index afd066df82..d76cd8cd6d 100644
--- a/platform/darwin/test/MGLBackgroundStyleLayerTests.mm
+++ b/platform/darwin/test/MGLBackgroundStyleLayerTests.mm
@@ -22,8 +22,8 @@
- (void)testProperties {
MGLBackgroundStyleLayer *layer = [[MGLBackgroundStyleLayer alloc] initWithIdentifier:@"layerID"];
XCTAssertNotEqual(layer.rawLayer, nullptr);
- XCTAssertTrue(layer.rawLayer->is<mbgl::style::BackgroundLayer>());
- auto rawLayer = layer.rawLayer->as<mbgl::style::BackgroundLayer>();
+ XCTAssertEqual(layer.rawLayer->getType(), mbgl::style::LayerType::Background);
+ auto rawLayer = static_cast<mbgl::style::BackgroundLayer*>(layer.rawLayer);
MGLTransition transitionTest = MGLTransitionMake(5, 4);
diff --git a/platform/darwin/test/MGLCircleStyleLayerTests.mm b/platform/darwin/test/MGLCircleStyleLayerTests.mm
index 853ec67968..213416109c 100644
--- a/platform/darwin/test/MGLCircleStyleLayerTests.mm
+++ b/platform/darwin/test/MGLCircleStyleLayerTests.mm
@@ -43,8 +43,8 @@
MGLCircleStyleLayer *layer = [[MGLCircleStyleLayer alloc] initWithIdentifier:@"layerID" source:source];
XCTAssertNotEqual(layer.rawLayer, nullptr);
- XCTAssertTrue(layer.rawLayer->is<mbgl::style::CircleLayer>());
- auto rawLayer = layer.rawLayer->as<mbgl::style::CircleLayer>();
+ XCTAssertEqual(layer.rawLayer->getType(), mbgl::style::LayerType::Circle);
+ auto rawLayer = static_cast<mbgl::style::CircleLayer*>(layer.rawLayer);
MGLTransition transitionTest = MGLTransitionMake(5, 4);
diff --git a/platform/darwin/test/MGLFillExtrusionStyleLayerTests.mm b/platform/darwin/test/MGLFillExtrusionStyleLayerTests.mm
index eddf82eec8..7c4e147026 100644
--- a/platform/darwin/test/MGLFillExtrusionStyleLayerTests.mm
+++ b/platform/darwin/test/MGLFillExtrusionStyleLayerTests.mm
@@ -43,8 +43,8 @@
MGLFillExtrusionStyleLayer *layer = [[MGLFillExtrusionStyleLayer alloc] initWithIdentifier:@"layerID" source:source];
XCTAssertNotEqual(layer.rawLayer, nullptr);
- XCTAssertTrue(layer.rawLayer->is<mbgl::style::FillExtrusionLayer>());
- auto rawLayer = layer.rawLayer->as<mbgl::style::FillExtrusionLayer>();
+ XCTAssertEqual(layer.rawLayer->getType(), mbgl::style::LayerType::FillExtrusion);
+ auto rawLayer = static_cast<mbgl::style::FillExtrusionLayer*>(layer.rawLayer);
MGLTransition transitionTest = MGLTransitionMake(5, 4);
diff --git a/platform/darwin/test/MGLFillStyleLayerTests.mm b/platform/darwin/test/MGLFillStyleLayerTests.mm
index bae8779309..b8c39918c5 100644
--- a/platform/darwin/test/MGLFillStyleLayerTests.mm
+++ b/platform/darwin/test/MGLFillStyleLayerTests.mm
@@ -43,8 +43,8 @@
MGLFillStyleLayer *layer = [[MGLFillStyleLayer alloc] initWithIdentifier:@"layerID" source:source];
XCTAssertNotEqual(layer.rawLayer, nullptr);
- XCTAssertTrue(layer.rawLayer->is<mbgl::style::FillLayer>());
- auto rawLayer = layer.rawLayer->as<mbgl::style::FillLayer>();
+ XCTAssertEqual(layer.rawLayer->getType(), mbgl::style::LayerType::Fill);
+ auto rawLayer = static_cast<mbgl::style::FillLayer*>(layer.rawLayer);
MGLTransition transitionTest = MGLTransitionMake(5, 4);
diff --git a/platform/darwin/test/MGLHeatmapColorTests.mm b/platform/darwin/test/MGLHeatmapColorTests.mm
index bed777ae05..19f9b4e86e 100644
--- a/platform/darwin/test/MGLHeatmapColorTests.mm
+++ b/platform/darwin/test/MGLHeatmapColorTests.mm
@@ -15,7 +15,7 @@
MGLShapeSource *source = [[MGLShapeSource alloc] initWithIdentifier:@"sourceID" shape:feature options:nil];
MGLHeatmapStyleLayer *layer = [[MGLHeatmapStyleLayer alloc] initWithIdentifier:@"layerID" source:source];
- auto rawLayer = layer.rawLayer->as<mbgl::style::HeatmapLayer>();
+ auto rawLayer = static_cast<mbgl::style::HeatmapLayer*>(layer.rawLayer);
XCTAssertTrue(rawLayer->getHeatmapColor().isUndefined(),
@"heatmap-color should be unset initially.");
diff --git a/platform/darwin/test/MGLHeatmapStyleLayerTests.mm b/platform/darwin/test/MGLHeatmapStyleLayerTests.mm
index 76a2b0c87e..bde8a5b1c8 100644
--- a/platform/darwin/test/MGLHeatmapStyleLayerTests.mm
+++ b/platform/darwin/test/MGLHeatmapStyleLayerTests.mm
@@ -43,8 +43,8 @@
MGLHeatmapStyleLayer *layer = [[MGLHeatmapStyleLayer alloc] initWithIdentifier:@"layerID" source:source];
XCTAssertNotEqual(layer.rawLayer, nullptr);
- XCTAssertTrue(layer.rawLayer->is<mbgl::style::HeatmapLayer>());
- auto rawLayer = layer.rawLayer->as<mbgl::style::HeatmapLayer>();
+ XCTAssertEqual(layer.rawLayer->getType(), mbgl::style::LayerType::Heatmap);
+ auto rawLayer = static_cast<mbgl::style::HeatmapLayer*>(layer.rawLayer);
MGLTransition transitionTest = MGLTransitionMake(5, 4);
diff --git a/platform/darwin/test/MGLHillshadeStyleLayerTests.mm b/platform/darwin/test/MGLHillshadeStyleLayerTests.mm
index 2e8795759f..5c8a45beab 100644
--- a/platform/darwin/test/MGLHillshadeStyleLayerTests.mm
+++ b/platform/darwin/test/MGLHillshadeStyleLayerTests.mm
@@ -25,8 +25,8 @@
MGLHillshadeStyleLayer *layer = [[MGLHillshadeStyleLayer alloc] initWithIdentifier:@"layerID" source:source];
XCTAssertNotEqual(layer.rawLayer, nullptr);
- XCTAssertTrue(layer.rawLayer->is<mbgl::style::HillshadeLayer>());
- auto rawLayer = layer.rawLayer->as<mbgl::style::HillshadeLayer>();
+ XCTAssertEqual(layer.rawLayer->getType(), mbgl::style::LayerType::Hillshade);
+ auto rawLayer = static_cast<mbgl::style::HillshadeLayer*>(layer.rawLayer);
MGLTransition transitionTest = MGLTransitionMake(5, 4);
diff --git a/platform/darwin/test/MGLLineStyleLayerTests.mm b/platform/darwin/test/MGLLineStyleLayerTests.mm
index 7289debb94..c8868635ef 100644
--- a/platform/darwin/test/MGLLineStyleLayerTests.mm
+++ b/platform/darwin/test/MGLLineStyleLayerTests.mm
@@ -43,8 +43,8 @@
MGLLineStyleLayer *layer = [[MGLLineStyleLayer alloc] initWithIdentifier:@"layerID" source:source];
XCTAssertNotEqual(layer.rawLayer, nullptr);
- XCTAssertTrue(layer.rawLayer->is<mbgl::style::LineLayer>());
- auto rawLayer = layer.rawLayer->as<mbgl::style::LineLayer>();
+ XCTAssertEqual(layer.rawLayer->getType(), mbgl::style::LayerType::Line);
+ auto rawLayer = static_cast<mbgl::style::LineLayer*>(layer.rawLayer);
MGLTransition transitionTest = MGLTransitionMake(5, 4);
diff --git a/platform/darwin/test/MGLRasterStyleLayerTests.mm b/platform/darwin/test/MGLRasterStyleLayerTests.mm
index 9325bb48f5..f0ce055b3a 100644
--- a/platform/darwin/test/MGLRasterStyleLayerTests.mm
+++ b/platform/darwin/test/MGLRasterStyleLayerTests.mm
@@ -25,8 +25,8 @@
MGLRasterStyleLayer *layer = [[MGLRasterStyleLayer alloc] initWithIdentifier:@"layerID" source:source];
XCTAssertNotEqual(layer.rawLayer, nullptr);
- XCTAssertTrue(layer.rawLayer->is<mbgl::style::RasterLayer>());
- auto rawLayer = layer.rawLayer->as<mbgl::style::RasterLayer>();
+ XCTAssertEqual(layer.rawLayer->getType(), mbgl::style::LayerType::Raster);
+ auto rawLayer = static_cast<mbgl::style::RasterLayer*>(layer.rawLayer);
MGLTransition transitionTest = MGLTransitionMake(5, 4);
diff --git a/platform/darwin/test/MGLStyleLayerTests.mm.ejs b/platform/darwin/test/MGLStyleLayerTests.mm.ejs
index c97813eca2..68d61072f8 100644
--- a/platform/darwin/test/MGLStyleLayerTests.mm.ejs
+++ b/platform/darwin/test/MGLStyleLayerTests.mm.ejs
@@ -54,8 +54,8 @@
MGL<%- camelize(type) %>StyleLayer *layer = [[MGL<%- camelize(type) %>StyleLayer alloc] initWithIdentifier:@"layerID" source:source];
<% } -%>
XCTAssertNotEqual(layer.rawLayer, nullptr);
- XCTAssertTrue(layer.rawLayer->is<mbgl::style::<%- camelize(type) %>Layer>());
- auto rawLayer = layer.rawLayer->as<mbgl::style::<%- camelize(type) %>Layer>();
+ XCTAssertEqual(layer.rawLayer->getType(), mbgl::style::LayerType::<%- camelize(type) %>);
+ auto rawLayer = static_cast<mbgl::style::<%- camelize(type) %>Layer*>(layer.rawLayer);
MGLTransition transitionTest = MGLTransitionMake(5, 4);
diff --git a/platform/darwin/test/MGLSymbolStyleLayerTests.mm b/platform/darwin/test/MGLSymbolStyleLayerTests.mm
index 42430940cd..daf63355e6 100644
--- a/platform/darwin/test/MGLSymbolStyleLayerTests.mm
+++ b/platform/darwin/test/MGLSymbolStyleLayerTests.mm
@@ -43,8 +43,8 @@
MGLSymbolStyleLayer *layer = [[MGLSymbolStyleLayer alloc] initWithIdentifier:@"layerID" source:source];
XCTAssertNotEqual(layer.rawLayer, nullptr);
- XCTAssertTrue(layer.rawLayer->is<mbgl::style::SymbolLayer>());
- auto rawLayer = layer.rawLayer->as<mbgl::style::SymbolLayer>();
+ XCTAssertEqual(layer.rawLayer->getType(), mbgl::style::LayerType::Symbol);
+ auto rawLayer = static_cast<mbgl::style::SymbolLayer*>(layer.rawLayer);
MGLTransition transitionTest = MGLTransitionMake(5, 4);
diff --git a/src/mbgl/annotation/fill_annotation_impl.cpp b/src/mbgl/annotation/fill_annotation_impl.cpp
index 9d3e12e004..7ac1932f32 100644
--- a/src/mbgl/annotation/fill_annotation_impl.cpp
+++ b/src/mbgl/annotation/fill_annotation_impl.cpp
@@ -21,7 +21,8 @@ void FillAnnotationImpl::updateStyle(Style::Impl& style) const {
layer = style.addLayer(std::move(newLayer), AnnotationManager::PointLayerID);
}
- auto* fillLayer = layer->as<FillLayer>();
+ assert(layer->getType() == LayerType::Fill);
+ auto* fillLayer = static_cast<FillLayer*>(layer);
fillLayer->setFillOpacity(annotation.opacity);
fillLayer->setFillColor(annotation.color);
fillLayer->setFillOutlineColor(annotation.outlineColor);
diff --git a/src/mbgl/annotation/line_annotation_impl.cpp b/src/mbgl/annotation/line_annotation_impl.cpp
index 74fec49af8..b4dc10049f 100644
--- a/src/mbgl/annotation/line_annotation_impl.cpp
+++ b/src/mbgl/annotation/line_annotation_impl.cpp
@@ -22,7 +22,8 @@ void LineAnnotationImpl::updateStyle(Style::Impl& style) const {
layer = style.addLayer(std::move(newLayer), AnnotationManager::PointLayerID);
}
- auto* lineLayer = layer->as<LineLayer>();
+ assert(layer->getType() == LayerType::Line);
+ LineLayer* lineLayer = static_cast<LineLayer*>(layer);
lineLayer->setLineOpacity(annotation.opacity);
lineLayer->setLineWidth(annotation.width);
lineLayer->setLineColor(annotation.color);
diff --git a/src/mbgl/style/layers/custom_layer.cpp b/src/mbgl/style/layers/custom_layer.cpp
index a31586f708..90b97104a0 100644
--- a/src/mbgl/style/layers/custom_layer.cpp
+++ b/src/mbgl/style/layers/custom_layer.cpp
@@ -39,10 +39,5 @@ Mutable<Layer::Impl> CustomLayer::mutableBaseImpl() const {
return staticMutableCast<Layer::Impl>(mutableImpl());
}
-template <>
-bool Layer::is<CustomLayer>() const {
- return getType() == LayerType::Custom;
-}
-
} // namespace style
} // namespace mbgl
diff --git a/test/gl/context.test.cpp b/test/gl/context.test.cpp
index 179ce5de53..2561c84591 100644
--- a/test/gl/context.test.cpp
+++ b/test/gl/context.test.cpp
@@ -94,7 +94,9 @@ TEST(GLContextMode, Shared) {
map.setLatLngZoom({ 37.8, -122.5 }, 10);
// Set transparent background layer.
- map.getStyle().getLayer("background")->as<BackgroundLayer>()->setBackgroundColor( { { 1.0f, 0.0f, 0.0f, 0.5f } } );
+ auto layer = map.getStyle().getLayer("background");
+ ASSERT_EQ(LayerType::Background, layer->getType());
+ static_cast<BackgroundLayer*>(layer)->setBackgroundColor( { { 1.0f, 0.0f, 0.0f, 0.5f } } );
{
// Custom rendering outside of GL Native render loop.
diff --git a/test/renderer/group_by_layout.test.cpp b/test/renderer/group_by_layout.test.cpp
index 8d0b432481..a72ec43cb9 100644
--- a/test/renderer/group_by_layout.test.cpp
+++ b/test/renderer/group_by_layout.test.cpp
@@ -40,18 +40,20 @@ TEST(GroupByLayout, UnrelatedType) {
TEST(GroupByLayout, UnrelatedFilter) {
using namespace mbgl::style::expression::dsl;
std::vector<std::unique_ptr<Layer>> layers;
- layers.push_back(std::make_unique<LineLayer>("a", "source"));
+ auto lineLayer = std::make_unique<LineLayer>("a", "source");
+ lineLayer->setFilter(Filter(get("property")));
+ layers.push_back(std::move(lineLayer));
layers.push_back(std::make_unique<LineLayer>("b", "source"));
- layers[0]->as<LineLayer>()->setFilter(Filter(get("property")));
auto result = groupByLayout(toRenderLayers(layers));
ASSERT_EQ(2u, result.size());
}
TEST(GroupByLayout, UnrelatedLayout) {
std::vector<std::unique_ptr<Layer>> layers;
- layers.push_back(std::make_unique<LineLayer>("a", "source"));
+ auto lineLayer = std::make_unique<LineLayer>("a", "source");
+ lineLayer->setLineCap(LineCapType::Square);
+ layers.push_back(std::move(lineLayer));
layers.push_back(std::make_unique<LineLayer>("b", "source"));
- layers[0]->as<LineLayer>()->setLineCap(LineCapType::Square);
auto result = groupByLayout(toRenderLayers(layers));
ASSERT_EQ(2u, result.size());
}
diff --git a/test/style/conversion/layer.test.cpp b/test/style/conversion/layer.test.cpp
index 33cd329999..18754a09fb 100644
--- a/test/style/conversion/layer.test.cpp
+++ b/test/style/conversion/layer.test.cpp
@@ -25,9 +25,9 @@ TEST(StyleConversion, LayerTransition) {
}
}
})JSON");
-
- ASSERT_EQ(400ms, *layer->as<BackgroundLayer>()->impl().paint
+ ASSERT_EQ(LayerType::Background, layer->getType());
+ ASSERT_EQ(400ms, *static_cast<BackgroundLayer*>(layer.get())->impl().paint
.get<BackgroundColor>().options.duration);
- ASSERT_EQ(500ms, *layer->as<BackgroundLayer>()->impl().paint
+ ASSERT_EQ(500ms, *static_cast<BackgroundLayer*>(layer.get())->impl().paint
.get<BackgroundColor>().options.delay);
}
diff --git a/test/style/style_layer.test.cpp b/test/style/style_layer.test.cpp
index 61516a2de9..5ea16b7422 100644
--- a/test/style/style_layer.test.cpp
+++ b/test/style/style_layer.test.cpp
@@ -54,7 +54,7 @@ const auto duration = 1.0f;
TEST(Layer, BackgroundProperties) {
auto layer = std::make_unique<BackgroundLayer>("background");
- EXPECT_TRUE(layer->is<BackgroundLayer>());
+ ASSERT_EQ(LayerType::Background, layer->getType());
// Paint properties
@@ -70,7 +70,7 @@ TEST(Layer, BackgroundProperties) {
TEST(Layer, CircleProperties) {
auto layer = std::make_unique<CircleLayer>("circle", "source");
- EXPECT_TRUE(layer->is<CircleLayer>());
+ ASSERT_EQ(LayerType::Circle, layer->getType());
// Paint properties
@@ -95,7 +95,7 @@ TEST(Layer, CircleProperties) {
TEST(Layer, FillProperties) {
auto layer = std::make_unique<FillLayer>("fill", "source");
- EXPECT_TRUE(layer->is<FillLayer>());
+ ASSERT_EQ(LayerType::Fill, layer->getType());
// Paint properties
@@ -123,7 +123,7 @@ TEST(Layer, FillProperties) {
TEST(Layer, LineProperties) {
auto layer = std::make_unique<LineLayer>("line", "source");
- EXPECT_TRUE(layer->is<LineLayer>());
+ ASSERT_EQ(LayerType::Line, layer->getType());
// Layout properties
@@ -174,7 +174,7 @@ TEST(Layer, LineProperties) {
TEST(Layer, RasterProperties) {
auto layer = std::make_unique<RasterLayer>("raster", "source");
- EXPECT_TRUE(layer->is<RasterLayer>());
+ ASSERT_EQ(LayerType::Raster, layer->getType());
// Paint properties