summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2018-07-30 08:38:14 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2018-08-13 12:39:44 -0700
commitb2f60a4bf2fb95c107bb94543ba6345779970e98 (patch)
tree2fd85df5cf2121b9a55d24c9d6e331b9e1bb4aca
parent3c8acb228e0ff1124ce8ca6c710dc46cf99d87fc (diff)
downloadqtlocation-mapboxgl-b2f60a4bf2fb95c107bb94543ba6345779970e98.tar.gz
[core] Eliminate setProperty & co.
-rw-r--r--cmake/core-files.cmake2
-rw-r--r--include/mbgl/style/conversion/layer.hpp2
-rw-r--r--include/mbgl/style/layer.hpp6
-rw-r--r--include/mbgl/style/layers/background_layer.hpp4
-rw-r--r--include/mbgl/style/layers/circle_layer.hpp4
-rw-r--r--include/mbgl/style/layers/custom_layer.hpp4
-rw-r--r--include/mbgl/style/layers/fill_extrusion_layer.hpp4
-rw-r--r--include/mbgl/style/layers/fill_layer.hpp4
-rw-r--r--include/mbgl/style/layers/heatmap_layer.hpp4
-rw-r--r--include/mbgl/style/layers/hillshade_layer.hpp4
-rw-r--r--include/mbgl/style/layers/layer.hpp.ejs4
-rw-r--r--include/mbgl/style/layers/line_layer.hpp4
-rw-r--r--include/mbgl/style/layers/raster_layer.hpp4
-rw-r--r--include/mbgl/style/layers/symbol_layer.hpp4
-rw-r--r--platform/android/src/style/layers/layer.cpp4
-rw-r--r--platform/node/src/node_map.cpp4
-rw-r--r--platform/qt/src/qmapboxgl.cpp14
-rw-r--r--platform/qt/src/qmapboxgl_p.hpp2
-rwxr-xr-xscripts/generate-style-code.js3
-rw-r--r--src/mbgl/style/conversion/json.hpp2
-rw-r--r--src/mbgl/style/conversion/layer.cpp23
-rw-r--r--src/mbgl/style/conversion/make_property_setters.hpp239
-rw-r--r--src/mbgl/style/conversion/make_property_setters.hpp.ejs46
-rw-r--r--src/mbgl/style/conversion/property_setter.hpp71
-rw-r--r--src/mbgl/style/layers/background_layer.cpp97
-rw-r--r--src/mbgl/style/layers/circle_layer.cpp265
-rw-r--r--src/mbgl/style/layers/custom_layer.cpp10
-rw-r--r--src/mbgl/style/layers/fill_extrusion_layer.cpp181
-rw-r--r--src/mbgl/style/layers/fill_layer.cpp181
-rw-r--r--src/mbgl/style/layers/heatmap_layer.cpp137
-rw-r--r--src/mbgl/style/layers/hillshade_layer.cpp160
-rw-r--r--src/mbgl/style/layers/layer.cpp.ejs68
-rw-r--r--src/mbgl/style/layers/line_layer.cpp288
-rw-r--r--src/mbgl/style/layers/raster_layer.cpp202
-rw-r--r--src/mbgl/style/layers/symbol_layer.cpp724
35 files changed, 2374 insertions, 401 deletions
diff --git a/cmake/core-files.cmake b/cmake/core-files.cmake
index 2cfcb16771..d35e2c66ca 100644
--- a/cmake/core-files.cmake
+++ b/cmake/core-files.cmake
@@ -436,9 +436,7 @@ set(MBGL_CORE_FILES
src/mbgl/style/conversion/json.hpp
src/mbgl/style/conversion/layer.cpp
src/mbgl/style/conversion/light.cpp
- src/mbgl/style/conversion/make_property_setters.hpp
src/mbgl/style/conversion/position.cpp
- src/mbgl/style/conversion/property_setter.hpp
src/mbgl/style/conversion/source.cpp
src/mbgl/style/conversion/stringify.hpp
src/mbgl/style/conversion/tileset.cpp
diff --git a/include/mbgl/style/conversion/layer.hpp b/include/mbgl/style/conversion/layer.hpp
index 1c0e2e2f07..2df6c9e381 100644
--- a/include/mbgl/style/conversion/layer.hpp
+++ b/include/mbgl/style/conversion/layer.hpp
@@ -15,8 +15,6 @@ public:
optional<std::unique_ptr<Layer>> operator()(const Convertible& value, Error& error) const;
};
-optional<Error> setLayoutProperty(Layer& layer, const std::string& name, const Convertible& value);
-optional<Error> setPaintProperty(Layer& layer, const std::string& name, const Convertible& value);
optional<Error> setPaintProperties(Layer& layer, const Convertible& value);
} // namespace conversion
diff --git a/include/mbgl/style/layer.hpp b/include/mbgl/style/layer.hpp
index b5a4b63d2e..fee9f9121e 100644
--- a/include/mbgl/style/layer.hpp
+++ b/include/mbgl/style/layer.hpp
@@ -5,6 +5,7 @@
#include <mbgl/util/immutable.hpp>
#include <mbgl/style/layer_type.hpp>
#include <mbgl/style/types.hpp>
+#include <mbgl/style/conversion.hpp>
#include <cassert>
#include <memory>
@@ -98,7 +99,6 @@ public:
return std::forward<V>(visitor)(*as<HeatmapLayer>());
}
-
// Not reachable, but placate GCC.
assert(false);
throw new std::runtime_error("unknown layer type");
@@ -117,6 +117,10 @@ public:
virtual void setMinZoom(float) = 0;
virtual void setMaxZoom(float) = 0;
+ // Dynamic properties
+ virtual optional<conversion::Error> setLayoutProperty(const std::string& name, const conversion::Convertible& value) = 0;
+ virtual optional<conversion::Error> setPaintProperty(const std::string& name, const conversion::Convertible& value) = 0;
+
// Private implementation
class Impl;
Immutable<Impl> baseImpl;
diff --git a/include/mbgl/style/layers/background_layer.hpp b/include/mbgl/style/layers/background_layer.hpp
index eab2681fec..76230df12c 100644
--- a/include/mbgl/style/layers/background_layer.hpp
+++ b/include/mbgl/style/layers/background_layer.hpp
@@ -25,6 +25,10 @@ public:
void setMinZoom(float) final;
void setMaxZoom(float) final;
+ // Dynamic properties
+ optional<conversion::Error> setLayoutProperty(const std::string& name, const conversion::Convertible& value) final;
+ optional<conversion::Error> setPaintProperty(const std::string& name, const conversion::Convertible& value) final;
+
// Paint properties
static PropertyValue<Color> getDefaultBackgroundColor();
diff --git a/include/mbgl/style/layers/circle_layer.hpp b/include/mbgl/style/layers/circle_layer.hpp
index 89ef926221..cde691c893 100644
--- a/include/mbgl/style/layers/circle_layer.hpp
+++ b/include/mbgl/style/layers/circle_layer.hpp
@@ -33,6 +33,10 @@ public:
void setMinZoom(float) final;
void setMaxZoom(float) final;
+ // Dynamic properties
+ optional<conversion::Error> setLayoutProperty(const std::string& name, const conversion::Convertible& value) final;
+ optional<conversion::Error> setPaintProperty(const std::string& name, const conversion::Convertible& value) final;
+
// Paint properties
static PropertyValue<float> getDefaultCircleRadius();
diff --git a/include/mbgl/style/layers/custom_layer.hpp b/include/mbgl/style/layers/custom_layer.hpp
index fbe3a4a6c2..4b4c770489 100644
--- a/include/mbgl/style/layers/custom_layer.hpp
+++ b/include/mbgl/style/layers/custom_layer.hpp
@@ -75,6 +75,10 @@ public:
void setMinZoom(float) final;
void setMaxZoom(float) final;
+ // Dynamic properties
+ optional<conversion::Error> setLayoutProperty(const std::string& name, const conversion::Convertible& value) final;
+ optional<conversion::Error> setPaintProperty(const std::string& name, const conversion::Convertible& value) final;
+
// Private implementation
class Impl;
diff --git a/include/mbgl/style/layers/fill_extrusion_layer.hpp b/include/mbgl/style/layers/fill_extrusion_layer.hpp
index 742bac8c7e..e72fcade61 100644
--- a/include/mbgl/style/layers/fill_extrusion_layer.hpp
+++ b/include/mbgl/style/layers/fill_extrusion_layer.hpp
@@ -33,6 +33,10 @@ public:
void setMinZoom(float) final;
void setMaxZoom(float) final;
+ // Dynamic properties
+ optional<conversion::Error> setLayoutProperty(const std::string& name, const conversion::Convertible& value) final;
+ optional<conversion::Error> setPaintProperty(const std::string& name, const conversion::Convertible& value) final;
+
// Paint properties
static PropertyValue<float> getDefaultFillExtrusionOpacity();
diff --git a/include/mbgl/style/layers/fill_layer.hpp b/include/mbgl/style/layers/fill_layer.hpp
index d0b2a25bfe..430d7a011f 100644
--- a/include/mbgl/style/layers/fill_layer.hpp
+++ b/include/mbgl/style/layers/fill_layer.hpp
@@ -33,6 +33,10 @@ public:
void setMinZoom(float) final;
void setMaxZoom(float) final;
+ // Dynamic properties
+ optional<conversion::Error> setLayoutProperty(const std::string& name, const conversion::Convertible& value) final;
+ optional<conversion::Error> setPaintProperty(const std::string& name, const conversion::Convertible& value) final;
+
// Paint properties
static PropertyValue<bool> getDefaultFillAntialias();
diff --git a/include/mbgl/style/layers/heatmap_layer.hpp b/include/mbgl/style/layers/heatmap_layer.hpp
index 53fd24aa6c..fd0051f44c 100644
--- a/include/mbgl/style/layers/heatmap_layer.hpp
+++ b/include/mbgl/style/layers/heatmap_layer.hpp
@@ -34,6 +34,10 @@ public:
void setMinZoom(float) final;
void setMaxZoom(float) final;
+ // Dynamic properties
+ optional<conversion::Error> setLayoutProperty(const std::string& name, const conversion::Convertible& value) final;
+ optional<conversion::Error> setPaintProperty(const std::string& name, const conversion::Convertible& value) final;
+
// Paint properties
static PropertyValue<float> getDefaultHeatmapRadius();
diff --git a/include/mbgl/style/layers/hillshade_layer.hpp b/include/mbgl/style/layers/hillshade_layer.hpp
index 214576b120..89d0ae686f 100644
--- a/include/mbgl/style/layers/hillshade_layer.hpp
+++ b/include/mbgl/style/layers/hillshade_layer.hpp
@@ -28,6 +28,10 @@ public:
void setMinZoom(float) final;
void setMaxZoom(float) final;
+ // Dynamic properties
+ optional<conversion::Error> setLayoutProperty(const std::string& name, const conversion::Convertible& value) final;
+ optional<conversion::Error> setPaintProperty(const std::string& name, const conversion::Convertible& value) final;
+
// Paint properties
static PropertyValue<float> getDefaultHillshadeIlluminationDirection();
diff --git a/include/mbgl/style/layers/layer.hpp.ejs b/include/mbgl/style/layers/layer.hpp.ejs
index 9d52973af4..db7052387c 100644
--- a/include/mbgl/style/layers/layer.hpp.ejs
+++ b/include/mbgl/style/layers/layer.hpp.ejs
@@ -53,6 +53,10 @@ public:
void setMinZoom(float) final;
void setMaxZoom(float) final;
+ // Dynamic properties
+ optional<conversion::Error> setLayoutProperty(const std::string& name, const conversion::Convertible& value) final;
+ optional<conversion::Error> setPaintProperty(const std::string& name, const conversion::Convertible& value) final;
+
<% if (layoutProperties.length) { -%>
// Layout properties
diff --git a/include/mbgl/style/layers/line_layer.hpp b/include/mbgl/style/layers/line_layer.hpp
index 26e3b81fc9..fe4cd7c0d1 100644
--- a/include/mbgl/style/layers/line_layer.hpp
+++ b/include/mbgl/style/layers/line_layer.hpp
@@ -35,6 +35,10 @@ public:
void setMinZoom(float) final;
void setMaxZoom(float) final;
+ // Dynamic properties
+ optional<conversion::Error> setLayoutProperty(const std::string& name, const conversion::Convertible& value) final;
+ optional<conversion::Error> setPaintProperty(const std::string& name, const conversion::Convertible& value) final;
+
// Layout properties
static PropertyValue<LineCapType> getDefaultLineCap();
diff --git a/include/mbgl/style/layers/raster_layer.hpp b/include/mbgl/style/layers/raster_layer.hpp
index c133c23484..fcc35412a0 100644
--- a/include/mbgl/style/layers/raster_layer.hpp
+++ b/include/mbgl/style/layers/raster_layer.hpp
@@ -28,6 +28,10 @@ public:
void setMinZoom(float) final;
void setMaxZoom(float) final;
+ // Dynamic properties
+ optional<conversion::Error> setLayoutProperty(const std::string& name, const conversion::Convertible& value) final;
+ optional<conversion::Error> setPaintProperty(const std::string& name, const conversion::Convertible& value) final;
+
// Paint properties
static PropertyValue<float> getDefaultRasterOpacity();
diff --git a/include/mbgl/style/layers/symbol_layer.hpp b/include/mbgl/style/layers/symbol_layer.hpp
index 8c0b45d796..fa0b0c4e4e 100644
--- a/include/mbgl/style/layers/symbol_layer.hpp
+++ b/include/mbgl/style/layers/symbol_layer.hpp
@@ -35,6 +35,10 @@ public:
void setMinZoom(float) final;
void setMaxZoom(float) final;
+ // Dynamic properties
+ optional<conversion::Error> setLayoutProperty(const std::string& name, const conversion::Convertible& value) final;
+ optional<conversion::Error> setPaintProperty(const std::string& name, const conversion::Convertible& value) final;
+
// Layout properties
static PropertyValue<SymbolPlacementType> getDefaultSymbolPlacement();
diff --git a/platform/android/src/style/layers/layer.cpp b/platform/android/src/style/layers/layer.cpp
index c7a6bcd3a3..c3ae9e40cd 100644
--- a/platform/android/src/style/layers/layer.cpp
+++ b/platform/android/src/style/layers/layer.cpp
@@ -91,7 +91,7 @@ namespace android {
void Layer::setLayoutProperty(jni::JNIEnv& env, jni::String jname, jni::Object<> jvalue) {
// Convert and set property
- optional<mbgl::style::conversion::Error> error = mbgl::style::conversion::setLayoutProperty(layer, jni::Make<std::string>(env, jname), Value(env, jvalue));
+ optional<mbgl::style::conversion::Error> error = layer.setLayoutProperty(jni::Make<std::string>(env, jname), Value(env, jvalue));
if (error) {
mbgl::Log::Error(mbgl::Event::JNI, "Error setting property: " + jni::Make<std::string>(env, jname) + " " + error->message);
return;
@@ -100,7 +100,7 @@ namespace android {
void Layer::setPaintProperty(jni::JNIEnv& env, jni::String jname, jni::Object<> jvalue) {
// Convert and set property
- optional<mbgl::style::conversion::Error> error = mbgl::style::conversion::setPaintProperty(layer, jni::Make<std::string>(env, jname), Value(env, jvalue));
+ optional<mbgl::style::conversion::Error> error = layer.setPaintProperty(jni::Make<std::string>(env, jname), Value(env, jvalue));
if (error) {
mbgl::Log::Error(mbgl::Event::JNI, "Error setting property: " + jni::Make<std::string>(env, jname) + " " + error->message);
return;
diff --git a/platform/node/src/node_map.cpp b/platform/node/src/node_map.cpp
index 4bcd1d97bc..0cc93d7e95 100644
--- a/platform/node/src/node_map.cpp
+++ b/platform/node/src/node_map.cpp
@@ -822,7 +822,7 @@ void NodeMap::SetLayoutProperty(const Nan::FunctionCallbackInfo<v8::Value>& info
return Nan::ThrowTypeError("Second argument must be a string");
}
- mbgl::optional<Error> error = setLayoutProperty(*layer, *Nan::Utf8String(info[1]), Convertible(info[2]));
+ mbgl::optional<Error> error = layer->setLayoutProperty(*Nan::Utf8String(info[1]), Convertible(info[2]));
if (error) {
return Nan::ThrowTypeError(error->message.c_str());
}
@@ -854,7 +854,7 @@ void NodeMap::SetPaintProperty(const Nan::FunctionCallbackInfo<v8::Value>& info)
return Nan::ThrowTypeError("Second argument must be a string");
}
- mbgl::optional<Error> error = setPaintProperty(*layer, *Nan::Utf8String(info[1]), Convertible(info[2]));
+ mbgl::optional<Error> error = layer->setPaintProperty(*Nan::Utf8String(info[1]), Convertible(info[2]));
if (error) {
return Nan::ThrowTypeError(error->message.c_str());
}
diff --git a/platform/qt/src/qmapboxgl.cpp b/platform/qt/src/qmapboxgl.cpp
index 459eacba4b..480174810c 100644
--- a/platform/qt/src/qmapboxgl.cpp
+++ b/platform/qt/src/qmapboxgl.cpp
@@ -1017,7 +1017,7 @@ void QMapboxGL::removeAnnotation(QMapbox::AnnotationID id)
*/
bool QMapboxGL::setLayoutProperty(const QString& layer, const QString& propertyName, const QVariant& value)
{
- return d_ptr->setProperty(&mbgl::style::conversion::setLayoutProperty, layer, propertyName, value);
+ return d_ptr->setProperty(&mbgl::style::Layer::setLayoutProperty, layer, propertyName, value);
}
/*!
@@ -1077,7 +1077,7 @@ bool QMapboxGL::setLayoutProperty(const QString& layer, const QString& propertyN
bool QMapboxGL::setPaintProperty(const QString& layer, const QString& propertyName, const QVariant& value)
{
- return d_ptr->setProperty(&mbgl::style::conversion::setPaintProperty, layer, propertyName, value);
+ return d_ptr->setProperty(&mbgl::style::Layer::setPaintProperty, layer, propertyName, value);
}
/*!
@@ -1379,7 +1379,7 @@ void QMapboxGL::addCustomLayer(const QString &id,
}
void initialize() {
- ptr->initialize();
+ ptr->initialize();
}
void render(const mbgl::style::CustomLayerRenderParameters& params) {
@@ -1922,16 +1922,16 @@ bool QMapboxGLPrivate::setProperty(const PropertySetter& setter, const QString&
if (!document.HasParseError()) {
// Treat value as a valid JSON.
const mbgl::JSValue* jsonValue = &document;
- result = setter(*layerObject, propertyString, jsonValue);
+ result = (layerObject->*setter)(propertyString, jsonValue);
} else {
- result = setter(*layerObject, propertyString, value);
+ result = (layerObject->*setter)(propertyString, value);
}
} else {
- result = setter(*layerObject, propertyString, value);
+ result = (layerObject->*setter)(propertyString, value);
}
if (result) {
- qWarning() << "Error setting paint property" << name << "on layer" << layer << ":" << QString::fromStdString(result->message);
+ qWarning() << "Error setting property" << name << "on layer" << layer << ":" << QString::fromStdString(result->message);
return false;
}
diff --git a/platform/qt/src/qmapboxgl_p.hpp b/platform/qt/src/qmapboxgl_p.hpp
index 80789ac8f1..b94f4de194 100644
--- a/platform/qt/src/qmapboxgl_p.hpp
+++ b/platform/qt/src/qmapboxgl_p.hpp
@@ -37,7 +37,7 @@ public:
void render();
void setFramebufferObject(quint32 fbo, const QSize& size);
- using PropertySetter = std::function<mbgl::optional<mbgl::style::conversion::Error>(mbgl::style::Layer&, const std::string&, const mbgl::style::conversion::Convertible&)>;
+ using PropertySetter = mbgl::optional<mbgl::style::conversion::Error> (mbgl::style::Layer::*)(const std::string&, const mbgl::style::conversion::Convertible&);
bool setProperty(const PropertySetter& setter, const QString& layer, const QString& name, const QVariant& value);
mbgl::EdgeInsets margins;
diff --git a/scripts/generate-style-code.js b/scripts/generate-style-code.js
index db37a9b96f..9a7b2842f7 100755
--- a/scripts/generate-style-code.js
+++ b/scripts/generate-style-code.js
@@ -192,9 +192,6 @@ for (const layer of layers) {
writeIfModified(`src/mbgl/style/layers/${layerFileName}_layer_properties.cpp`, propertiesCpp(layer));
}
-const propertySettersHpp = ejs.compile(fs.readFileSync('src/mbgl/style/conversion/make_property_setters.hpp.ejs', 'utf8'), {strict: true});
-writeIfModified('src/mbgl/style/conversion/make_property_setters.hpp', propertySettersHpp({layers: layers}));
-
// Light
const lightProperties = Object.keys(spec[`light`]).reduce((memo, name) => {
var property = spec[`light`][name];
diff --git a/src/mbgl/style/conversion/json.hpp b/src/mbgl/style/conversion/json.hpp
index 7dd2378f6b..a823f6d383 100644
--- a/src/mbgl/style/conversion/json.hpp
+++ b/src/mbgl/style/conversion/json.hpp
@@ -1,3 +1,5 @@
+#pragma once
+
#include <mbgl/style/conversion.hpp>
#include <mbgl/style/rapidjson_conversion.hpp>
diff --git a/src/mbgl/style/conversion/layer.cpp b/src/mbgl/style/conversion/layer.cpp
index e18ad923f2..d36ca494da 100644
--- a/src/mbgl/style/conversion/layer.cpp
+++ b/src/mbgl/style/conversion/layer.cpp
@@ -1,7 +1,6 @@
#include <mbgl/style/conversion/layer.hpp>
#include <mbgl/style/conversion/constant.hpp>
#include <mbgl/style/conversion/filter.hpp>
-#include <mbgl/style/conversion/make_property_setters.hpp>
#include <mbgl/style/layers/background_layer.hpp>
#include <mbgl/style/layers/circle_layer.hpp>
#include <mbgl/style/layers/fill_layer.hpp>
@@ -16,24 +15,6 @@ namespace mbgl {
namespace style {
namespace conversion {
-optional<Error> setLayoutProperty(Layer& layer, const std::string& name, const Convertible& value) {
- static const auto setters = makeLayoutPropertySetters();
- auto it = setters.find(name);
- if (it == setters.end()) {
- return Error { "property not found" };
- }
- return it->second(layer, value);
-}
-
-optional<Error> setPaintProperty(Layer& layer, const std::string& name, const Convertible& value) {
- static const auto setters = makePaintPropertySetters();
- auto it = setters.find(name);
- if (it == setters.end()) {
- return Error { "property not found" };
- }
- return it->second(layer, value);
-}
-
optional<Error> setPaintProperties(Layer& layer, const Convertible& value) {
auto paintValue = objectMember(value, "paint");
if (!paintValue) {
@@ -43,7 +24,7 @@ optional<Error> setPaintProperties(Layer& layer, const Convertible& value) {
return { { "paint must be an object" } };
}
return eachMember(*paintValue, [&] (const std::string& k, const Convertible& v) {
- return setPaintProperty(layer, k, v);
+ return layer.setPaintProperty(k, v);
});
}
@@ -210,7 +191,7 @@ optional<std::unique_ptr<Layer>> Converter<std::unique_ptr<Layer>>::operator()(c
return nullopt;
}
optional<Error> error_ = eachMember(*layoutValue, [&] (const std::string& k, const Convertible& v) {
- return setLayoutProperty(*layer, k, v);
+ return layer->setLayoutProperty(k, v);
});
if (error_) {
error = *error_;
diff --git a/src/mbgl/style/conversion/make_property_setters.hpp b/src/mbgl/style/conversion/make_property_setters.hpp
deleted file mode 100644
index ada0d53002..0000000000
--- a/src/mbgl/style/conversion/make_property_setters.hpp
+++ /dev/null
@@ -1,239 +0,0 @@
-#pragma once
-
-// This file is generated. Edit make_property_setters.hpp.ejs, then run `make style-code`.
-
-#include <mbgl/style/conversion/property_setter.hpp>
-
-#include <mbgl/style/layers/fill_layer.hpp>
-#include <mbgl/style/layers/line_layer.hpp>
-#include <mbgl/style/layers/symbol_layer.hpp>
-#include <mbgl/style/layers/circle_layer.hpp>
-#include <mbgl/style/layers/heatmap_layer.hpp>
-#include <mbgl/style/layers/fill_extrusion_layer.hpp>
-#include <mbgl/style/layers/raster_layer.hpp>
-#include <mbgl/style/layers/hillshade_layer.hpp>
-#include <mbgl/style/layers/background_layer.hpp>
-
-#include <unordered_map>
-
-namespace mbgl {
-namespace style {
-namespace conversion {
-
-inline auto makeLayoutPropertySetters() {
- std::unordered_map<std::string, PropertySetter> result;
-
- result["visibility"] = &setVisibility;
-
-
- result["line-cap"] = &setProperty<LineLayer, PropertyValue<LineCapType>, &LineLayer::setLineCap, false, false>;
- result["line-join"] = &setProperty<LineLayer, PropertyValue<LineJoinType>, &LineLayer::setLineJoin, true, false>;
- result["line-miter-limit"] = &setProperty<LineLayer, PropertyValue<float>, &LineLayer::setLineMiterLimit, false, false>;
- result["line-round-limit"] = &setProperty<LineLayer, PropertyValue<float>, &LineLayer::setLineRoundLimit, false, false>;
-
- result["symbol-placement"] = &setProperty<SymbolLayer, PropertyValue<SymbolPlacementType>, &SymbolLayer::setSymbolPlacement, false, false>;
- result["symbol-spacing"] = &setProperty<SymbolLayer, PropertyValue<float>, &SymbolLayer::setSymbolSpacing, false, false>;
- result["symbol-avoid-edges"] = &setProperty<SymbolLayer, PropertyValue<bool>, &SymbolLayer::setSymbolAvoidEdges, false, false>;
- result["icon-allow-overlap"] = &setProperty<SymbolLayer, PropertyValue<bool>, &SymbolLayer::setIconAllowOverlap, false, false>;
- result["icon-ignore-placement"] = &setProperty<SymbolLayer, PropertyValue<bool>, &SymbolLayer::setIconIgnorePlacement, false, false>;
- result["icon-optional"] = &setProperty<SymbolLayer, PropertyValue<bool>, &SymbolLayer::setIconOptional, false, false>;
- result["icon-rotation-alignment"] = &setProperty<SymbolLayer, PropertyValue<AlignmentType>, &SymbolLayer::setIconRotationAlignment, false, false>;
- result["icon-size"] = &setProperty<SymbolLayer, PropertyValue<float>, &SymbolLayer::setIconSize, true, false>;
- result["icon-text-fit"] = &setProperty<SymbolLayer, PropertyValue<IconTextFitType>, &SymbolLayer::setIconTextFit, false, false>;
- result["icon-text-fit-padding"] = &setProperty<SymbolLayer, PropertyValue<std::array<float, 4>>, &SymbolLayer::setIconTextFitPadding, false, false>;
- result["icon-image"] = &setProperty<SymbolLayer, PropertyValue<std::string>, &SymbolLayer::setIconImage, true, true>;
- result["icon-rotate"] = &setProperty<SymbolLayer, PropertyValue<float>, &SymbolLayer::setIconRotate, true, false>;
- result["icon-padding"] = &setProperty<SymbolLayer, PropertyValue<float>, &SymbolLayer::setIconPadding, false, false>;
- result["icon-keep-upright"] = &setProperty<SymbolLayer, PropertyValue<bool>, &SymbolLayer::setIconKeepUpright, false, false>;
- result["icon-offset"] = &setProperty<SymbolLayer, PropertyValue<std::array<float, 2>>, &SymbolLayer::setIconOffset, true, false>;
- result["icon-anchor"] = &setProperty<SymbolLayer, PropertyValue<SymbolAnchorType>, &SymbolLayer::setIconAnchor, true, false>;
- result["icon-pitch-alignment"] = &setProperty<SymbolLayer, PropertyValue<AlignmentType>, &SymbolLayer::setIconPitchAlignment, false, false>;
- result["text-pitch-alignment"] = &setProperty<SymbolLayer, PropertyValue<AlignmentType>, &SymbolLayer::setTextPitchAlignment, false, false>;
- result["text-rotation-alignment"] = &setProperty<SymbolLayer, PropertyValue<AlignmentType>, &SymbolLayer::setTextRotationAlignment, false, false>;
- result["text-field"] = &setProperty<SymbolLayer, PropertyValue<std::string>, &SymbolLayer::setTextField, true, true>;
- result["text-font"] = &setProperty<SymbolLayer, PropertyValue<std::vector<std::string>>, &SymbolLayer::setTextFont, true, false>;
- result["text-size"] = &setProperty<SymbolLayer, PropertyValue<float>, &SymbolLayer::setTextSize, true, false>;
- result["text-max-width"] = &setProperty<SymbolLayer, PropertyValue<float>, &SymbolLayer::setTextMaxWidth, true, false>;
- result["text-line-height"] = &setProperty<SymbolLayer, PropertyValue<float>, &SymbolLayer::setTextLineHeight, false, false>;
- result["text-letter-spacing"] = &setProperty<SymbolLayer, PropertyValue<float>, &SymbolLayer::setTextLetterSpacing, true, false>;
- result["text-justify"] = &setProperty<SymbolLayer, PropertyValue<TextJustifyType>, &SymbolLayer::setTextJustify, true, false>;
- result["text-anchor"] = &setProperty<SymbolLayer, PropertyValue<SymbolAnchorType>, &SymbolLayer::setTextAnchor, true, false>;
- result["text-max-angle"] = &setProperty<SymbolLayer, PropertyValue<float>, &SymbolLayer::setTextMaxAngle, false, false>;
- result["text-rotate"] = &setProperty<SymbolLayer, PropertyValue<float>, &SymbolLayer::setTextRotate, true, false>;
- result["text-padding"] = &setProperty<SymbolLayer, PropertyValue<float>, &SymbolLayer::setTextPadding, false, false>;
- result["text-keep-upright"] = &setProperty<SymbolLayer, PropertyValue<bool>, &SymbolLayer::setTextKeepUpright, false, false>;
- result["text-transform"] = &setProperty<SymbolLayer, PropertyValue<TextTransformType>, &SymbolLayer::setTextTransform, true, false>;
- result["text-offset"] = &setProperty<SymbolLayer, PropertyValue<std::array<float, 2>>, &SymbolLayer::setTextOffset, true, false>;
- result["text-allow-overlap"] = &setProperty<SymbolLayer, PropertyValue<bool>, &SymbolLayer::setTextAllowOverlap, false, false>;
- result["text-ignore-placement"] = &setProperty<SymbolLayer, PropertyValue<bool>, &SymbolLayer::setTextIgnorePlacement, false, false>;
- result["text-optional"] = &setProperty<SymbolLayer, PropertyValue<bool>, &SymbolLayer::setTextOptional, false, false>;
-
-
-
-
-
-
-
- return result;
-}
-
-inline auto makePaintPropertySetters() {
- std::unordered_map<std::string, PropertySetter> result;
-
- result["fill-antialias"] = &setProperty<FillLayer, PropertyValue<bool>, &FillLayer::setFillAntialias, false, false>;
- result["fill-antialias-transition"] = &setTransition<FillLayer, &FillLayer::setFillAntialiasTransition>;
- result["fill-opacity"] = &setProperty<FillLayer, PropertyValue<float>, &FillLayer::setFillOpacity, true, false>;
- result["fill-opacity-transition"] = &setTransition<FillLayer, &FillLayer::setFillOpacityTransition>;
- result["fill-color"] = &setProperty<FillLayer, PropertyValue<Color>, &FillLayer::setFillColor, true, false>;
- result["fill-color-transition"] = &setTransition<FillLayer, &FillLayer::setFillColorTransition>;
- result["fill-outline-color"] = &setProperty<FillLayer, PropertyValue<Color>, &FillLayer::setFillOutlineColor, true, false>;
- result["fill-outline-color-transition"] = &setTransition<FillLayer, &FillLayer::setFillOutlineColorTransition>;
- result["fill-translate"] = &setProperty<FillLayer, PropertyValue<std::array<float, 2>>, &FillLayer::setFillTranslate, false, false>;
- result["fill-translate-transition"] = &setTransition<FillLayer, &FillLayer::setFillTranslateTransition>;
- result["fill-translate-anchor"] = &setProperty<FillLayer, PropertyValue<TranslateAnchorType>, &FillLayer::setFillTranslateAnchor, false, false>;
- result["fill-translate-anchor-transition"] = &setTransition<FillLayer, &FillLayer::setFillTranslateAnchorTransition>;
- result["fill-pattern"] = &setProperty<FillLayer, PropertyValue<std::string>, &FillLayer::setFillPattern, false, false>;
- result["fill-pattern-transition"] = &setTransition<FillLayer, &FillLayer::setFillPatternTransition>;
-
- result["line-opacity"] = &setProperty<LineLayer, PropertyValue<float>, &LineLayer::setLineOpacity, true, false>;
- result["line-opacity-transition"] = &setTransition<LineLayer, &LineLayer::setLineOpacityTransition>;
- result["line-color"] = &setProperty<LineLayer, PropertyValue<Color>, &LineLayer::setLineColor, true, false>;
- result["line-color-transition"] = &setTransition<LineLayer, &LineLayer::setLineColorTransition>;
- result["line-translate"] = &setProperty<LineLayer, PropertyValue<std::array<float, 2>>, &LineLayer::setLineTranslate, false, false>;
- result["line-translate-transition"] = &setTransition<LineLayer, &LineLayer::setLineTranslateTransition>;
- result["line-translate-anchor"] = &setProperty<LineLayer, PropertyValue<TranslateAnchorType>, &LineLayer::setLineTranslateAnchor, false, false>;
- result["line-translate-anchor-transition"] = &setTransition<LineLayer, &LineLayer::setLineTranslateAnchorTransition>;
- result["line-width"] = &setProperty<LineLayer, PropertyValue<float>, &LineLayer::setLineWidth, true, false>;
- result["line-width-transition"] = &setTransition<LineLayer, &LineLayer::setLineWidthTransition>;
- result["line-gap-width"] = &setProperty<LineLayer, PropertyValue<float>, &LineLayer::setLineGapWidth, true, false>;
- result["line-gap-width-transition"] = &setTransition<LineLayer, &LineLayer::setLineGapWidthTransition>;
- result["line-offset"] = &setProperty<LineLayer, PropertyValue<float>, &LineLayer::setLineOffset, true, false>;
- result["line-offset-transition"] = &setTransition<LineLayer, &LineLayer::setLineOffsetTransition>;
- result["line-blur"] = &setProperty<LineLayer, PropertyValue<float>, &LineLayer::setLineBlur, true, false>;
- result["line-blur-transition"] = &setTransition<LineLayer, &LineLayer::setLineBlurTransition>;
- result["line-dasharray"] = &setProperty<LineLayer, PropertyValue<std::vector<float>>, &LineLayer::setLineDasharray, false, false>;
- result["line-dasharray-transition"] = &setTransition<LineLayer, &LineLayer::setLineDasharrayTransition>;
- result["line-pattern"] = &setProperty<LineLayer, PropertyValue<std::string>, &LineLayer::setLinePattern, false, false>;
- result["line-pattern-transition"] = &setTransition<LineLayer, &LineLayer::setLinePatternTransition>;
-
- result["icon-opacity"] = &setProperty<SymbolLayer, PropertyValue<float>, &SymbolLayer::setIconOpacity, true, false>;
- result["icon-opacity-transition"] = &setTransition<SymbolLayer, &SymbolLayer::setIconOpacityTransition>;
- result["icon-color"] = &setProperty<SymbolLayer, PropertyValue<Color>, &SymbolLayer::setIconColor, true, false>;
- result["icon-color-transition"] = &setTransition<SymbolLayer, &SymbolLayer::setIconColorTransition>;
- result["icon-halo-color"] = &setProperty<SymbolLayer, PropertyValue<Color>, &SymbolLayer::setIconHaloColor, true, false>;
- result["icon-halo-color-transition"] = &setTransition<SymbolLayer, &SymbolLayer::setIconHaloColorTransition>;
- result["icon-halo-width"] = &setProperty<SymbolLayer, PropertyValue<float>, &SymbolLayer::setIconHaloWidth, true, false>;
- result["icon-halo-width-transition"] = &setTransition<SymbolLayer, &SymbolLayer::setIconHaloWidthTransition>;
- result["icon-halo-blur"] = &setProperty<SymbolLayer, PropertyValue<float>, &SymbolLayer::setIconHaloBlur, true, false>;
- result["icon-halo-blur-transition"] = &setTransition<SymbolLayer, &SymbolLayer::setIconHaloBlurTransition>;
- result["icon-translate"] = &setProperty<SymbolLayer, PropertyValue<std::array<float, 2>>, &SymbolLayer::setIconTranslate, false, false>;
- result["icon-translate-transition"] = &setTransition<SymbolLayer, &SymbolLayer::setIconTranslateTransition>;
- result["icon-translate-anchor"] = &setProperty<SymbolLayer, PropertyValue<TranslateAnchorType>, &SymbolLayer::setIconTranslateAnchor, false, false>;
- result["icon-translate-anchor-transition"] = &setTransition<SymbolLayer, &SymbolLayer::setIconTranslateAnchorTransition>;
- result["text-opacity"] = &setProperty<SymbolLayer, PropertyValue<float>, &SymbolLayer::setTextOpacity, true, false>;
- result["text-opacity-transition"] = &setTransition<SymbolLayer, &SymbolLayer::setTextOpacityTransition>;
- result["text-color"] = &setProperty<SymbolLayer, PropertyValue<Color>, &SymbolLayer::setTextColor, true, false>;
- result["text-color-transition"] = &setTransition<SymbolLayer, &SymbolLayer::setTextColorTransition>;
- result["text-halo-color"] = &setProperty<SymbolLayer, PropertyValue<Color>, &SymbolLayer::setTextHaloColor, true, false>;
- result["text-halo-color-transition"] = &setTransition<SymbolLayer, &SymbolLayer::setTextHaloColorTransition>;
- result["text-halo-width"] = &setProperty<SymbolLayer, PropertyValue<float>, &SymbolLayer::setTextHaloWidth, true, false>;
- result["text-halo-width-transition"] = &setTransition<SymbolLayer, &SymbolLayer::setTextHaloWidthTransition>;
- result["text-halo-blur"] = &setProperty<SymbolLayer, PropertyValue<float>, &SymbolLayer::setTextHaloBlur, true, false>;
- result["text-halo-blur-transition"] = &setTransition<SymbolLayer, &SymbolLayer::setTextHaloBlurTransition>;
- result["text-translate"] = &setProperty<SymbolLayer, PropertyValue<std::array<float, 2>>, &SymbolLayer::setTextTranslate, false, false>;
- result["text-translate-transition"] = &setTransition<SymbolLayer, &SymbolLayer::setTextTranslateTransition>;
- result["text-translate-anchor"] = &setProperty<SymbolLayer, PropertyValue<TranslateAnchorType>, &SymbolLayer::setTextTranslateAnchor, false, false>;
- result["text-translate-anchor-transition"] = &setTransition<SymbolLayer, &SymbolLayer::setTextTranslateAnchorTransition>;
-
- result["circle-radius"] = &setProperty<CircleLayer, PropertyValue<float>, &CircleLayer::setCircleRadius, true, false>;
- result["circle-radius-transition"] = &setTransition<CircleLayer, &CircleLayer::setCircleRadiusTransition>;
- result["circle-color"] = &setProperty<CircleLayer, PropertyValue<Color>, &CircleLayer::setCircleColor, true, false>;
- result["circle-color-transition"] = &setTransition<CircleLayer, &CircleLayer::setCircleColorTransition>;
- result["circle-blur"] = &setProperty<CircleLayer, PropertyValue<float>, &CircleLayer::setCircleBlur, true, false>;
- result["circle-blur-transition"] = &setTransition<CircleLayer, &CircleLayer::setCircleBlurTransition>;
- result["circle-opacity"] = &setProperty<CircleLayer, PropertyValue<float>, &CircleLayer::setCircleOpacity, true, false>;
- result["circle-opacity-transition"] = &setTransition<CircleLayer, &CircleLayer::setCircleOpacityTransition>;
- result["circle-translate"] = &setProperty<CircleLayer, PropertyValue<std::array<float, 2>>, &CircleLayer::setCircleTranslate, false, false>;
- result["circle-translate-transition"] = &setTransition<CircleLayer, &CircleLayer::setCircleTranslateTransition>;
- result["circle-translate-anchor"] = &setProperty<CircleLayer, PropertyValue<TranslateAnchorType>, &CircleLayer::setCircleTranslateAnchor, false, false>;
- result["circle-translate-anchor-transition"] = &setTransition<CircleLayer, &CircleLayer::setCircleTranslateAnchorTransition>;
- result["circle-pitch-scale"] = &setProperty<CircleLayer, PropertyValue<CirclePitchScaleType>, &CircleLayer::setCirclePitchScale, false, false>;
- result["circle-pitch-scale-transition"] = &setTransition<CircleLayer, &CircleLayer::setCirclePitchScaleTransition>;
- result["circle-pitch-alignment"] = &setProperty<CircleLayer, PropertyValue<AlignmentType>, &CircleLayer::setCirclePitchAlignment, false, false>;
- result["circle-pitch-alignment-transition"] = &setTransition<CircleLayer, &CircleLayer::setCirclePitchAlignmentTransition>;
- result["circle-stroke-width"] = &setProperty<CircleLayer, PropertyValue<float>, &CircleLayer::setCircleStrokeWidth, true, false>;
- result["circle-stroke-width-transition"] = &setTransition<CircleLayer, &CircleLayer::setCircleStrokeWidthTransition>;
- result["circle-stroke-color"] = &setProperty<CircleLayer, PropertyValue<Color>, &CircleLayer::setCircleStrokeColor, true, false>;
- result["circle-stroke-color-transition"] = &setTransition<CircleLayer, &CircleLayer::setCircleStrokeColorTransition>;
- result["circle-stroke-opacity"] = &setProperty<CircleLayer, PropertyValue<float>, &CircleLayer::setCircleStrokeOpacity, true, false>;
- result["circle-stroke-opacity-transition"] = &setTransition<CircleLayer, &CircleLayer::setCircleStrokeOpacityTransition>;
-
- result["heatmap-radius"] = &setProperty<HeatmapLayer, PropertyValue<float>, &HeatmapLayer::setHeatmapRadius, true, false>;
- result["heatmap-radius-transition"] = &setTransition<HeatmapLayer, &HeatmapLayer::setHeatmapRadiusTransition>;
- result["heatmap-weight"] = &setProperty<HeatmapLayer, PropertyValue<float>, &HeatmapLayer::setHeatmapWeight, true, false>;
- result["heatmap-weight-transition"] = &setTransition<HeatmapLayer, &HeatmapLayer::setHeatmapWeightTransition>;
- result["heatmap-intensity"] = &setProperty<HeatmapLayer, PropertyValue<float>, &HeatmapLayer::setHeatmapIntensity, false, false>;
- result["heatmap-intensity-transition"] = &setTransition<HeatmapLayer, &HeatmapLayer::setHeatmapIntensityTransition>;
- result["heatmap-color"] = &setProperty<HeatmapLayer, ColorRampPropertyValue, &HeatmapLayer::setHeatmapColor, false, false>;
- result["heatmap-color-transition"] = &setTransition<HeatmapLayer, &HeatmapLayer::setHeatmapColorTransition>;
- result["heatmap-opacity"] = &setProperty<HeatmapLayer, PropertyValue<float>, &HeatmapLayer::setHeatmapOpacity, false, false>;
- result["heatmap-opacity-transition"] = &setTransition<HeatmapLayer, &HeatmapLayer::setHeatmapOpacityTransition>;
-
- result["fill-extrusion-opacity"] = &setProperty<FillExtrusionLayer, PropertyValue<float>, &FillExtrusionLayer::setFillExtrusionOpacity, false, false>;
- result["fill-extrusion-opacity-transition"] = &setTransition<FillExtrusionLayer, &FillExtrusionLayer::setFillExtrusionOpacityTransition>;
- result["fill-extrusion-color"] = &setProperty<FillExtrusionLayer, PropertyValue<Color>, &FillExtrusionLayer::setFillExtrusionColor, true, false>;
- result["fill-extrusion-color-transition"] = &setTransition<FillExtrusionLayer, &FillExtrusionLayer::setFillExtrusionColorTransition>;
- result["fill-extrusion-translate"] = &setProperty<FillExtrusionLayer, PropertyValue<std::array<float, 2>>, &FillExtrusionLayer::setFillExtrusionTranslate, false, false>;
- result["fill-extrusion-translate-transition"] = &setTransition<FillExtrusionLayer, &FillExtrusionLayer::setFillExtrusionTranslateTransition>;
- result["fill-extrusion-translate-anchor"] = &setProperty<FillExtrusionLayer, PropertyValue<TranslateAnchorType>, &FillExtrusionLayer::setFillExtrusionTranslateAnchor, false, false>;
- result["fill-extrusion-translate-anchor-transition"] = &setTransition<FillExtrusionLayer, &FillExtrusionLayer::setFillExtrusionTranslateAnchorTransition>;
- result["fill-extrusion-pattern"] = &setProperty<FillExtrusionLayer, PropertyValue<std::string>, &FillExtrusionLayer::setFillExtrusionPattern, false, false>;
- result["fill-extrusion-pattern-transition"] = &setTransition<FillExtrusionLayer, &FillExtrusionLayer::setFillExtrusionPatternTransition>;
- result["fill-extrusion-height"] = &setProperty<FillExtrusionLayer, PropertyValue<float>, &FillExtrusionLayer::setFillExtrusionHeight, true, false>;
- result["fill-extrusion-height-transition"] = &setTransition<FillExtrusionLayer, &FillExtrusionLayer::setFillExtrusionHeightTransition>;
- result["fill-extrusion-base"] = &setProperty<FillExtrusionLayer, PropertyValue<float>, &FillExtrusionLayer::setFillExtrusionBase, true, false>;
- result["fill-extrusion-base-transition"] = &setTransition<FillExtrusionLayer, &FillExtrusionLayer::setFillExtrusionBaseTransition>;
-
- result["raster-opacity"] = &setProperty<RasterLayer, PropertyValue<float>, &RasterLayer::setRasterOpacity, false, false>;
- result["raster-opacity-transition"] = &setTransition<RasterLayer, &RasterLayer::setRasterOpacityTransition>;
- result["raster-hue-rotate"] = &setProperty<RasterLayer, PropertyValue<float>, &RasterLayer::setRasterHueRotate, false, false>;
- result["raster-hue-rotate-transition"] = &setTransition<RasterLayer, &RasterLayer::setRasterHueRotateTransition>;
- result["raster-brightness-min"] = &setProperty<RasterLayer, PropertyValue<float>, &RasterLayer::setRasterBrightnessMin, false, false>;
- result["raster-brightness-min-transition"] = &setTransition<RasterLayer, &RasterLayer::setRasterBrightnessMinTransition>;
- result["raster-brightness-max"] = &setProperty<RasterLayer, PropertyValue<float>, &RasterLayer::setRasterBrightnessMax, false, false>;
- result["raster-brightness-max-transition"] = &setTransition<RasterLayer, &RasterLayer::setRasterBrightnessMaxTransition>;
- result["raster-saturation"] = &setProperty<RasterLayer, PropertyValue<float>, &RasterLayer::setRasterSaturation, false, false>;
- result["raster-saturation-transition"] = &setTransition<RasterLayer, &RasterLayer::setRasterSaturationTransition>;
- result["raster-contrast"] = &setProperty<RasterLayer, PropertyValue<float>, &RasterLayer::setRasterContrast, false, false>;
- result["raster-contrast-transition"] = &setTransition<RasterLayer, &RasterLayer::setRasterContrastTransition>;
- result["raster-resampling"] = &setProperty<RasterLayer, PropertyValue<RasterResamplingType>, &RasterLayer::setRasterResampling, false, false>;
- result["raster-resampling-transition"] = &setTransition<RasterLayer, &RasterLayer::setRasterResamplingTransition>;
- result["raster-fade-duration"] = &setProperty<RasterLayer, PropertyValue<float>, &RasterLayer::setRasterFadeDuration, false, false>;
- result["raster-fade-duration-transition"] = &setTransition<RasterLayer, &RasterLayer::setRasterFadeDurationTransition>;
-
- result["hillshade-illumination-direction"] = &setProperty<HillshadeLayer, PropertyValue<float>, &HillshadeLayer::setHillshadeIlluminationDirection, false, false>;
- result["hillshade-illumination-direction-transition"] = &setTransition<HillshadeLayer, &HillshadeLayer::setHillshadeIlluminationDirectionTransition>;
- result["hillshade-illumination-anchor"] = &setProperty<HillshadeLayer, PropertyValue<HillshadeIlluminationAnchorType>, &HillshadeLayer::setHillshadeIlluminationAnchor, false, false>;
- result["hillshade-illumination-anchor-transition"] = &setTransition<HillshadeLayer, &HillshadeLayer::setHillshadeIlluminationAnchorTransition>;
- result["hillshade-exaggeration"] = &setProperty<HillshadeLayer, PropertyValue<float>, &HillshadeLayer::setHillshadeExaggeration, false, false>;
- result["hillshade-exaggeration-transition"] = &setTransition<HillshadeLayer, &HillshadeLayer::setHillshadeExaggerationTransition>;
- result["hillshade-shadow-color"] = &setProperty<HillshadeLayer, PropertyValue<Color>, &HillshadeLayer::setHillshadeShadowColor, false, false>;
- result["hillshade-shadow-color-transition"] = &setTransition<HillshadeLayer, &HillshadeLayer::setHillshadeShadowColorTransition>;
- result["hillshade-highlight-color"] = &setProperty<HillshadeLayer, PropertyValue<Color>, &HillshadeLayer::setHillshadeHighlightColor, false, false>;
- result["hillshade-highlight-color-transition"] = &setTransition<HillshadeLayer, &HillshadeLayer::setHillshadeHighlightColorTransition>;
- result["hillshade-accent-color"] = &setProperty<HillshadeLayer, PropertyValue<Color>, &HillshadeLayer::setHillshadeAccentColor, false, false>;
- result["hillshade-accent-color-transition"] = &setTransition<HillshadeLayer, &HillshadeLayer::setHillshadeAccentColorTransition>;
-
- result["background-color"] = &setProperty<BackgroundLayer, PropertyValue<Color>, &BackgroundLayer::setBackgroundColor, false, false>;
- result["background-color-transition"] = &setTransition<BackgroundLayer, &BackgroundLayer::setBackgroundColorTransition>;
- result["background-pattern"] = &setProperty<BackgroundLayer, PropertyValue<std::string>, &BackgroundLayer::setBackgroundPattern, false, false>;
- result["background-pattern-transition"] = &setTransition<BackgroundLayer, &BackgroundLayer::setBackgroundPatternTransition>;
- result["background-opacity"] = &setProperty<BackgroundLayer, PropertyValue<float>, &BackgroundLayer::setBackgroundOpacity, false, false>;
- result["background-opacity-transition"] = &setTransition<BackgroundLayer, &BackgroundLayer::setBackgroundOpacityTransition>;
-
- return result;
-}
-
-} // namespace conversion
-} // namespace style
-} // namespace mbgl
diff --git a/src/mbgl/style/conversion/make_property_setters.hpp.ejs b/src/mbgl/style/conversion/make_property_setters.hpp.ejs
deleted file mode 100644
index fbf2f93fd6..0000000000
--- a/src/mbgl/style/conversion/make_property_setters.hpp.ejs
+++ /dev/null
@@ -1,46 +0,0 @@
-#pragma once
-
-// This file is generated. Edit make_property_setters.hpp.ejs, then run `make style-code`.
-
-#include <mbgl/style/conversion/property_setter.hpp>
-
-<% for (const layer of locals.layers) { -%>
-#include <mbgl/style/layers/<%- layer.type.replace('-', '_') %>_layer.hpp>
-<% } -%>
-
-#include <unordered_map>
-
-namespace mbgl {
-namespace style {
-namespace conversion {
-
-inline auto makeLayoutPropertySetters() {
- std::unordered_map<std::string, PropertySetter> result;
-
- result["visibility"] = &setVisibility;
-
-<% for (const layer of locals.layers) { -%>
-<% for (const property of layer.layoutProperties) { -%>
- result["<%- property.name %>"] = &setProperty<<%- camelize(layer.type) %>Layer, <%- propertyValueType(property) %>, &<%- camelize(layer.type) %>Layer::set<%- camelize(property.name) %>, <%- property['property-type'] === 'data-driven' || property['property-type'] === 'cross-faded-data-driven' %>, <%- property.name === 'icon-image' || property.name === 'text-field' %>>;
-<% } -%>
-
-<% } -%>
- return result;
-}
-
-inline auto makePaintPropertySetters() {
- std::unordered_map<std::string, PropertySetter> result;
-
-<% for (const layer of locals.layers) { -%>
-<% for (const property of layer.paintProperties) { -%>
- result["<%- property.name %>"] = &setProperty<<%- camelize(layer.type) %>Layer, <%- propertyValueType(property) %>, &<%- camelize(layer.type) %>Layer::set<%- camelize(property.name) %>, <%- property['property-type'] === 'data-driven' || property['property-type'] === 'cross-faded-data-driven' %>, <%- property.name === 'icon-image' || property.name === 'text-field' %>>;
- result["<%- property.name %>-transition"] = &setTransition<<%- camelize(layer.type) %>Layer, &<%- camelize(layer.type) %>Layer::set<%- camelize(property.name) %>Transition>;
-<% } -%>
-
-<% } -%>
- return result;
-}
-
-} // namespace conversion
-} // namespace style
-} // namespace mbgl
diff --git a/src/mbgl/style/conversion/property_setter.hpp b/src/mbgl/style/conversion/property_setter.hpp
deleted file mode 100644
index 3c5c65f96a..0000000000
--- a/src/mbgl/style/conversion/property_setter.hpp
+++ /dev/null
@@ -1,71 +0,0 @@
-#pragma once
-
-#include <mbgl/style/layer.hpp>
-#include <mbgl/style/layers/symbol_layer.hpp>
-#include <mbgl/style/conversion.hpp>
-#include <mbgl/style/conversion/color_ramp_property_value.hpp>
-#include <mbgl/style/conversion/constant.hpp>
-#include <mbgl/style/conversion/property_value.hpp>
-#include <mbgl/style/conversion/transition_options.hpp>
-
-#include <string>
-
-namespace mbgl {
-namespace style {
-namespace conversion {
-
-using PropertySetter = optional<Error> (*) (Layer&, const Convertible&);
-
-template <class L, class PropertyValue, void (L::*setter)(PropertyValue), bool allowDataExpressions, bool convertTokens>
-optional<Error> setProperty(Layer& layer, const Convertible& value) {
- auto* typedLayer = layer.as<L>();
- if (!typedLayer) {
- return Error { "layer doesn't support this property" };
- }
-
- Error error;
- optional<PropertyValue> typedValue = convert<PropertyValue>(value, error, allowDataExpressions, convertTokens);
- if (!typedValue) {
- return error;
- }
-
- (typedLayer->*setter)(*typedValue);
- return nullopt;
-}
-
-template <class L, void (L::*setter)(const TransitionOptions&)>
-optional<Error> setTransition(Layer& layer, const Convertible& value) {
- auto* typedLayer = layer.as<L>();
- if (!typedLayer) {
- return Error { "layer doesn't support this property" };
- }
-
- Error error;
- optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
- if (!transition) {
- return error;
- }
-
- (typedLayer->*setter)(*transition);
- return nullopt;
-}
-
-inline optional<Error> setVisibility(Layer& layer, const Convertible& value) {
- if (isUndefined(value)) {
- layer.setVisibility(VisibilityType::Visible);
- return nullopt;
- }
-
- Error error;
- optional<VisibilityType> visibility = convert<VisibilityType>(value, error);
- if (!visibility) {
- return error;
- }
-
- layer.setVisibility(*visibility);
- return nullopt;
-}
-
-} // namespace conversion
-} // namespace style
-} // namespace mbgl
diff --git a/src/mbgl/style/layers/background_layer.cpp b/src/mbgl/style/layers/background_layer.cpp
index 66ab46c078..837d557722 100644
--- a/src/mbgl/style/layers/background_layer.cpp
+++ b/src/mbgl/style/layers/background_layer.cpp
@@ -3,6 +3,12 @@
#include <mbgl/style/layers/background_layer.hpp>
#include <mbgl/style/layers/background_layer_impl.hpp>
#include <mbgl/style/layer_observer.hpp>
+#include <mbgl/style/conversion.hpp>
+#include <mbgl/style/conversion/color_ramp_property_value.hpp>
+#include <mbgl/style/conversion/constant.hpp>
+#include <mbgl/style/conversion/property_value.hpp>
+#include <mbgl/style/conversion/transition_options.hpp>
+#include <mbgl/style/conversion/json.hpp>
namespace mbgl {
namespace style {
@@ -149,5 +155,96 @@ TransitionOptions BackgroundLayer::getBackgroundOpacityTransition() const {
return impl().paint.template get<BackgroundOpacity>().options;
}
+using namespace conversion;
+
+optional<Error> BackgroundLayer::setPaintProperty(const std::string& name, const Convertible& value) {
+
+ if (name == "background-color") {
+ Error error;
+ optional<PropertyValue<Color>> typedValue = convert<PropertyValue<Color>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setBackgroundColor(*typedValue);
+ return nullopt;
+ }
+ if (name == "background-color-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setBackgroundColorTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "background-pattern") {
+ Error error;
+ optional<PropertyValue<std::string>> typedValue = convert<PropertyValue<std::string>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setBackgroundPattern(*typedValue);
+ return nullopt;
+ }
+ if (name == "background-pattern-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setBackgroundPatternTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "background-opacity") {
+ Error error;
+ optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setBackgroundOpacity(*typedValue);
+ return nullopt;
+ }
+ if (name == "background-opacity-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setBackgroundOpacityTransition(*transition);
+ return nullopt;
+ }
+
+ return Error { "layer doesn't support this property" };
+}
+
+optional<Error> BackgroundLayer::setLayoutProperty(const std::string& name, const Convertible& value) {
+ if (name == "visibility") {
+ if (isUndefined(value)) {
+ setVisibility(VisibilityType::Visible);
+ return nullopt;
+ }
+
+ Error error;
+ optional<VisibilityType> visibility = convert<VisibilityType>(value, error);
+ if (!visibility) {
+ return error;
+ }
+
+ setVisibility(*visibility);
+ return nullopt;
+ }
+
+
+ return Error { "layer doesn't support this property" };
+}
+
} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/style/layers/circle_layer.cpp b/src/mbgl/style/layers/circle_layer.cpp
index d435ce89e1..3f769e935c 100644
--- a/src/mbgl/style/layers/circle_layer.cpp
+++ b/src/mbgl/style/layers/circle_layer.cpp
@@ -3,6 +3,12 @@
#include <mbgl/style/layers/circle_layer.hpp>
#include <mbgl/style/layers/circle_layer_impl.hpp>
#include <mbgl/style/layer_observer.hpp>
+#include <mbgl/style/conversion.hpp>
+#include <mbgl/style/conversion/color_ramp_property_value.hpp>
+#include <mbgl/style/conversion/constant.hpp>
+#include <mbgl/style/conversion/property_value.hpp>
+#include <mbgl/style/conversion/transition_options.hpp>
+#include <mbgl/style/conversion/json.hpp>
namespace mbgl {
namespace style {
@@ -393,5 +399,264 @@ TransitionOptions CircleLayer::getCircleStrokeOpacityTransition() const {
return impl().paint.template get<CircleStrokeOpacity>().options;
}
+using namespace conversion;
+
+optional<Error> CircleLayer::setPaintProperty(const std::string& name, const Convertible& value) {
+
+ if (name == "circle-radius") {
+ Error error;
+ optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, true, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setCircleRadius(*typedValue);
+ return nullopt;
+ }
+ if (name == "circle-radius-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setCircleRadiusTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "circle-color") {
+ Error error;
+ optional<PropertyValue<Color>> typedValue = convert<PropertyValue<Color>>(value, error, true, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setCircleColor(*typedValue);
+ return nullopt;
+ }
+ if (name == "circle-color-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setCircleColorTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "circle-blur") {
+ Error error;
+ optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, true, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setCircleBlur(*typedValue);
+ return nullopt;
+ }
+ if (name == "circle-blur-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setCircleBlurTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "circle-opacity") {
+ Error error;
+ optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, true, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setCircleOpacity(*typedValue);
+ return nullopt;
+ }
+ if (name == "circle-opacity-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setCircleOpacityTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "circle-translate") {
+ Error error;
+ optional<PropertyValue<std::array<float, 2>>> typedValue = convert<PropertyValue<std::array<float, 2>>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setCircleTranslate(*typedValue);
+ return nullopt;
+ }
+ if (name == "circle-translate-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setCircleTranslateTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "circle-translate-anchor") {
+ Error error;
+ optional<PropertyValue<TranslateAnchorType>> typedValue = convert<PropertyValue<TranslateAnchorType>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setCircleTranslateAnchor(*typedValue);
+ return nullopt;
+ }
+ if (name == "circle-translate-anchor-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setCircleTranslateAnchorTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "circle-pitch-scale") {
+ Error error;
+ optional<PropertyValue<CirclePitchScaleType>> typedValue = convert<PropertyValue<CirclePitchScaleType>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setCirclePitchScale(*typedValue);
+ return nullopt;
+ }
+ if (name == "circle-pitch-scale-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setCirclePitchScaleTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "circle-pitch-alignment") {
+ Error error;
+ optional<PropertyValue<AlignmentType>> typedValue = convert<PropertyValue<AlignmentType>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setCirclePitchAlignment(*typedValue);
+ return nullopt;
+ }
+ if (name == "circle-pitch-alignment-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setCirclePitchAlignmentTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "circle-stroke-width") {
+ Error error;
+ optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, true, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setCircleStrokeWidth(*typedValue);
+ return nullopt;
+ }
+ if (name == "circle-stroke-width-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setCircleStrokeWidthTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "circle-stroke-color") {
+ Error error;
+ optional<PropertyValue<Color>> typedValue = convert<PropertyValue<Color>>(value, error, true, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setCircleStrokeColor(*typedValue);
+ return nullopt;
+ }
+ if (name == "circle-stroke-color-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setCircleStrokeColorTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "circle-stroke-opacity") {
+ Error error;
+ optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, true, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setCircleStrokeOpacity(*typedValue);
+ return nullopt;
+ }
+ if (name == "circle-stroke-opacity-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setCircleStrokeOpacityTransition(*transition);
+ return nullopt;
+ }
+
+ return Error { "layer doesn't support this property" };
+}
+
+optional<Error> CircleLayer::setLayoutProperty(const std::string& name, const Convertible& value) {
+ if (name == "visibility") {
+ if (isUndefined(value)) {
+ setVisibility(VisibilityType::Visible);
+ return nullopt;
+ }
+
+ Error error;
+ optional<VisibilityType> visibility = convert<VisibilityType>(value, error);
+ if (!visibility) {
+ return error;
+ }
+
+ setVisibility(*visibility);
+ return nullopt;
+ }
+
+
+ return Error { "layer doesn't support this property" };
+}
+
} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/style/layers/custom_layer.cpp b/src/mbgl/style/layers/custom_layer.cpp
index 0e51a70e50..d1ac1a705c 100644
--- a/src/mbgl/style/layers/custom_layer.cpp
+++ b/src/mbgl/style/layers/custom_layer.cpp
@@ -50,6 +50,16 @@ void CustomLayer::setMaxZoom(float maxZoom) {
baseImpl = std::move(impl_);
}
+using namespace conversion;
+
+optional<Error> CustomLayer::setPaintProperty(const std::string&, const Convertible&) {
+ return Error { "layer doesn't support this property" };
+}
+
+optional<Error> CustomLayer::setLayoutProperty(const std::string&, const Convertible&) {
+ return Error { "layer doesn't support this property" };
+}
+
template <>
bool Layer::is<CustomLayer>() const {
return getType() == LayerType::Custom;
diff --git a/src/mbgl/style/layers/fill_extrusion_layer.cpp b/src/mbgl/style/layers/fill_extrusion_layer.cpp
index 829a24f354..b48e51c566 100644
--- a/src/mbgl/style/layers/fill_extrusion_layer.cpp
+++ b/src/mbgl/style/layers/fill_extrusion_layer.cpp
@@ -3,6 +3,12 @@
#include <mbgl/style/layers/fill_extrusion_layer.hpp>
#include <mbgl/style/layers/fill_extrusion_layer_impl.hpp>
#include <mbgl/style/layer_observer.hpp>
+#include <mbgl/style/conversion.hpp>
+#include <mbgl/style/conversion/color_ramp_property_value.hpp>
+#include <mbgl/style/conversion/constant.hpp>
+#include <mbgl/style/conversion/property_value.hpp>
+#include <mbgl/style/conversion/transition_options.hpp>
+#include <mbgl/style/conversion/json.hpp>
namespace mbgl {
namespace style {
@@ -285,5 +291,180 @@ TransitionOptions FillExtrusionLayer::getFillExtrusionBaseTransition() const {
return impl().paint.template get<FillExtrusionBase>().options;
}
+using namespace conversion;
+
+optional<Error> FillExtrusionLayer::setPaintProperty(const std::string& name, const Convertible& value) {
+
+ if (name == "fill-extrusion-opacity") {
+ Error error;
+ optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setFillExtrusionOpacity(*typedValue);
+ return nullopt;
+ }
+ if (name == "fill-extrusion-opacity-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setFillExtrusionOpacityTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "fill-extrusion-color") {
+ Error error;
+ optional<PropertyValue<Color>> typedValue = convert<PropertyValue<Color>>(value, error, true, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setFillExtrusionColor(*typedValue);
+ return nullopt;
+ }
+ if (name == "fill-extrusion-color-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setFillExtrusionColorTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "fill-extrusion-translate") {
+ Error error;
+ optional<PropertyValue<std::array<float, 2>>> typedValue = convert<PropertyValue<std::array<float, 2>>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setFillExtrusionTranslate(*typedValue);
+ return nullopt;
+ }
+ if (name == "fill-extrusion-translate-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setFillExtrusionTranslateTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "fill-extrusion-translate-anchor") {
+ Error error;
+ optional<PropertyValue<TranslateAnchorType>> typedValue = convert<PropertyValue<TranslateAnchorType>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setFillExtrusionTranslateAnchor(*typedValue);
+ return nullopt;
+ }
+ if (name == "fill-extrusion-translate-anchor-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setFillExtrusionTranslateAnchorTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "fill-extrusion-pattern") {
+ Error error;
+ optional<PropertyValue<std::string>> typedValue = convert<PropertyValue<std::string>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setFillExtrusionPattern(*typedValue);
+ return nullopt;
+ }
+ if (name == "fill-extrusion-pattern-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setFillExtrusionPatternTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "fill-extrusion-height") {
+ Error error;
+ optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, true, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setFillExtrusionHeight(*typedValue);
+ return nullopt;
+ }
+ if (name == "fill-extrusion-height-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setFillExtrusionHeightTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "fill-extrusion-base") {
+ Error error;
+ optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, true, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setFillExtrusionBase(*typedValue);
+ return nullopt;
+ }
+ if (name == "fill-extrusion-base-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setFillExtrusionBaseTransition(*transition);
+ return nullopt;
+ }
+
+ return Error { "layer doesn't support this property" };
+}
+
+optional<Error> FillExtrusionLayer::setLayoutProperty(const std::string& name, const Convertible& value) {
+ if (name == "visibility") {
+ if (isUndefined(value)) {
+ setVisibility(VisibilityType::Visible);
+ return nullopt;
+ }
+
+ Error error;
+ optional<VisibilityType> visibility = convert<VisibilityType>(value, error);
+ if (!visibility) {
+ return error;
+ }
+
+ setVisibility(*visibility);
+ return nullopt;
+ }
+
+
+ return Error { "layer doesn't support this property" };
+}
+
} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/style/layers/fill_layer.cpp b/src/mbgl/style/layers/fill_layer.cpp
index 8eebd54e3c..04c3bcef3f 100644
--- a/src/mbgl/style/layers/fill_layer.cpp
+++ b/src/mbgl/style/layers/fill_layer.cpp
@@ -3,6 +3,12 @@
#include <mbgl/style/layers/fill_layer.hpp>
#include <mbgl/style/layers/fill_layer_impl.hpp>
#include <mbgl/style/layer_observer.hpp>
+#include <mbgl/style/conversion.hpp>
+#include <mbgl/style/conversion/color_ramp_property_value.hpp>
+#include <mbgl/style/conversion/constant.hpp>
+#include <mbgl/style/conversion/property_value.hpp>
+#include <mbgl/style/conversion/transition_options.hpp>
+#include <mbgl/style/conversion/json.hpp>
namespace mbgl {
namespace style {
@@ -285,5 +291,180 @@ TransitionOptions FillLayer::getFillPatternTransition() const {
return impl().paint.template get<FillPattern>().options;
}
+using namespace conversion;
+
+optional<Error> FillLayer::setPaintProperty(const std::string& name, const Convertible& value) {
+
+ if (name == "fill-antialias") {
+ Error error;
+ optional<PropertyValue<bool>> typedValue = convert<PropertyValue<bool>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setFillAntialias(*typedValue);
+ return nullopt;
+ }
+ if (name == "fill-antialias-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setFillAntialiasTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "fill-opacity") {
+ Error error;
+ optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, true, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setFillOpacity(*typedValue);
+ return nullopt;
+ }
+ if (name == "fill-opacity-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setFillOpacityTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "fill-color") {
+ Error error;
+ optional<PropertyValue<Color>> typedValue = convert<PropertyValue<Color>>(value, error, true, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setFillColor(*typedValue);
+ return nullopt;
+ }
+ if (name == "fill-color-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setFillColorTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "fill-outline-color") {
+ Error error;
+ optional<PropertyValue<Color>> typedValue = convert<PropertyValue<Color>>(value, error, true, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setFillOutlineColor(*typedValue);
+ return nullopt;
+ }
+ if (name == "fill-outline-color-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setFillOutlineColorTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "fill-translate") {
+ Error error;
+ optional<PropertyValue<std::array<float, 2>>> typedValue = convert<PropertyValue<std::array<float, 2>>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setFillTranslate(*typedValue);
+ return nullopt;
+ }
+ if (name == "fill-translate-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setFillTranslateTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "fill-translate-anchor") {
+ Error error;
+ optional<PropertyValue<TranslateAnchorType>> typedValue = convert<PropertyValue<TranslateAnchorType>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setFillTranslateAnchor(*typedValue);
+ return nullopt;
+ }
+ if (name == "fill-translate-anchor-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setFillTranslateAnchorTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "fill-pattern") {
+ Error error;
+ optional<PropertyValue<std::string>> typedValue = convert<PropertyValue<std::string>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setFillPattern(*typedValue);
+ return nullopt;
+ }
+ if (name == "fill-pattern-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setFillPatternTransition(*transition);
+ return nullopt;
+ }
+
+ return Error { "layer doesn't support this property" };
+}
+
+optional<Error> FillLayer::setLayoutProperty(const std::string& name, const Convertible& value) {
+ if (name == "visibility") {
+ if (isUndefined(value)) {
+ setVisibility(VisibilityType::Visible);
+ return nullopt;
+ }
+
+ Error error;
+ optional<VisibilityType> visibility = convert<VisibilityType>(value, error);
+ if (!visibility) {
+ return error;
+ }
+
+ setVisibility(*visibility);
+ return nullopt;
+ }
+
+
+ return Error { "layer doesn't support this property" };
+}
+
} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/style/layers/heatmap_layer.cpp b/src/mbgl/style/layers/heatmap_layer.cpp
index 21016ee509..443b94c2ce 100644
--- a/src/mbgl/style/layers/heatmap_layer.cpp
+++ b/src/mbgl/style/layers/heatmap_layer.cpp
@@ -3,9 +3,11 @@
#include <mbgl/style/layers/heatmap_layer.hpp>
#include <mbgl/style/layers/heatmap_layer_impl.hpp>
#include <mbgl/style/layer_observer.hpp>
-// for constructing default heatmap-color ramp expression from style JSON
#include <mbgl/style/conversion.hpp>
#include <mbgl/style/conversion/color_ramp_property_value.hpp>
+#include <mbgl/style/conversion/constant.hpp>
+#include <mbgl/style/conversion/property_value.hpp>
+#include <mbgl/style/conversion/transition_options.hpp>
#include <mbgl/style/conversion/json.hpp>
namespace mbgl {
@@ -237,5 +239,138 @@ TransitionOptions HeatmapLayer::getHeatmapOpacityTransition() const {
return impl().paint.template get<HeatmapOpacity>().options;
}
+using namespace conversion;
+
+optional<Error> HeatmapLayer::setPaintProperty(const std::string& name, const Convertible& value) {
+
+ if (name == "heatmap-radius") {
+ Error error;
+ optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, true, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setHeatmapRadius(*typedValue);
+ return nullopt;
+ }
+ if (name == "heatmap-radius-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setHeatmapRadiusTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "heatmap-weight") {
+ Error error;
+ optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, true, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setHeatmapWeight(*typedValue);
+ return nullopt;
+ }
+ if (name == "heatmap-weight-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setHeatmapWeightTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "heatmap-intensity") {
+ Error error;
+ optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setHeatmapIntensity(*typedValue);
+ return nullopt;
+ }
+ if (name == "heatmap-intensity-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setHeatmapIntensityTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "heatmap-color") {
+ Error error;
+ optional<ColorRampPropertyValue> typedValue = convert<ColorRampPropertyValue>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setHeatmapColor(*typedValue);
+ return nullopt;
+ }
+ if (name == "heatmap-color-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setHeatmapColorTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "heatmap-opacity") {
+ Error error;
+ optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setHeatmapOpacity(*typedValue);
+ return nullopt;
+ }
+ if (name == "heatmap-opacity-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setHeatmapOpacityTransition(*transition);
+ return nullopt;
+ }
+
+ return Error { "layer doesn't support this property" };
+}
+
+optional<Error> HeatmapLayer::setLayoutProperty(const std::string& name, const Convertible& value) {
+ if (name == "visibility") {
+ if (isUndefined(value)) {
+ setVisibility(VisibilityType::Visible);
+ return nullopt;
+ }
+
+ Error error;
+ optional<VisibilityType> visibility = convert<VisibilityType>(value, error);
+ if (!visibility) {
+ return error;
+ }
+
+ setVisibility(*visibility);
+ return nullopt;
+ }
+
+
+ return Error { "layer doesn't support this property" };
+}
+
} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/style/layers/hillshade_layer.cpp b/src/mbgl/style/layers/hillshade_layer.cpp
index e352ae090c..2d8c837baa 100644
--- a/src/mbgl/style/layers/hillshade_layer.cpp
+++ b/src/mbgl/style/layers/hillshade_layer.cpp
@@ -3,6 +3,12 @@
#include <mbgl/style/layers/hillshade_layer.hpp>
#include <mbgl/style/layers/hillshade_layer_impl.hpp>
#include <mbgl/style/layer_observer.hpp>
+#include <mbgl/style/conversion.hpp>
+#include <mbgl/style/conversion/color_ramp_property_value.hpp>
+#include <mbgl/style/conversion/constant.hpp>
+#include <mbgl/style/conversion/property_value.hpp>
+#include <mbgl/style/conversion/transition_options.hpp>
+#include <mbgl/style/conversion/json.hpp>
namespace mbgl {
namespace style {
@@ -236,5 +242,159 @@ TransitionOptions HillshadeLayer::getHillshadeAccentColorTransition() const {
return impl().paint.template get<HillshadeAccentColor>().options;
}
+using namespace conversion;
+
+optional<Error> HillshadeLayer::setPaintProperty(const std::string& name, const Convertible& value) {
+
+ if (name == "hillshade-illumination-direction") {
+ Error error;
+ optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setHillshadeIlluminationDirection(*typedValue);
+ return nullopt;
+ }
+ if (name == "hillshade-illumination-direction-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setHillshadeIlluminationDirectionTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "hillshade-illumination-anchor") {
+ Error error;
+ optional<PropertyValue<HillshadeIlluminationAnchorType>> typedValue = convert<PropertyValue<HillshadeIlluminationAnchorType>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setHillshadeIlluminationAnchor(*typedValue);
+ return nullopt;
+ }
+ if (name == "hillshade-illumination-anchor-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setHillshadeIlluminationAnchorTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "hillshade-exaggeration") {
+ Error error;
+ optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setHillshadeExaggeration(*typedValue);
+ return nullopt;
+ }
+ if (name == "hillshade-exaggeration-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setHillshadeExaggerationTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "hillshade-shadow-color") {
+ Error error;
+ optional<PropertyValue<Color>> typedValue = convert<PropertyValue<Color>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setHillshadeShadowColor(*typedValue);
+ return nullopt;
+ }
+ if (name == "hillshade-shadow-color-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setHillshadeShadowColorTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "hillshade-highlight-color") {
+ Error error;
+ optional<PropertyValue<Color>> typedValue = convert<PropertyValue<Color>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setHillshadeHighlightColor(*typedValue);
+ return nullopt;
+ }
+ if (name == "hillshade-highlight-color-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setHillshadeHighlightColorTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "hillshade-accent-color") {
+ Error error;
+ optional<PropertyValue<Color>> typedValue = convert<PropertyValue<Color>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setHillshadeAccentColor(*typedValue);
+ return nullopt;
+ }
+ if (name == "hillshade-accent-color-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setHillshadeAccentColorTransition(*transition);
+ return nullopt;
+ }
+
+ return Error { "layer doesn't support this property" };
+}
+
+optional<Error> HillshadeLayer::setLayoutProperty(const std::string& name, const Convertible& value) {
+ if (name == "visibility") {
+ if (isUndefined(value)) {
+ setVisibility(VisibilityType::Visible);
+ return nullopt;
+ }
+
+ Error error;
+ optional<VisibilityType> visibility = convert<VisibilityType>(value, error);
+ if (!visibility) {
+ return error;
+ }
+
+ setVisibility(*visibility);
+ return nullopt;
+ }
+
+
+ return Error { "layer doesn't support this property" };
+}
+
} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/style/layers/layer.cpp.ejs b/src/mbgl/style/layers/layer.cpp.ejs
index a9b6d9d02d..7555054bdb 100644
--- a/src/mbgl/style/layers/layer.cpp.ejs
+++ b/src/mbgl/style/layers/layer.cpp.ejs
@@ -8,12 +8,12 @@
#include <mbgl/style/layers/<%- type.replace('-', '_') %>_layer.hpp>
#include <mbgl/style/layers/<%- type.replace('-', '_') %>_layer_impl.hpp>
#include <mbgl/style/layer_observer.hpp>
-<% if (type === 'heatmap') { -%>
-// for constructing default heatmap-color ramp expression from style JSON
#include <mbgl/style/conversion.hpp>
#include <mbgl/style/conversion/color_ramp_property_value.hpp>
+#include <mbgl/style/conversion/constant.hpp>
+#include <mbgl/style/conversion/property_value.hpp>
+#include <mbgl/style/conversion/transition_options.hpp>
#include <mbgl/style/conversion/json.hpp>
-<% } -%>
namespace mbgl {
namespace style {
@@ -175,5 +175,67 @@ TransitionOptions <%- camelize(type) %>Layer::get<%- camelize(property.name) %>T
}
<% } -%>
+using namespace conversion;
+
+optional<Error> <%- camelize(type) %>Layer::setPaintProperty(const std::string& name, const Convertible& value) {
+ <% for (const property of paintProperties) { %>
+ if (name == "<%- property.name %>") {
+ Error error;
+ optional<<%- propertyValueType(property) %>> typedValue = convert<<%- propertyValueType(property) %>>(value, error, <%- property['property-type'] === 'data-driven' || property['property-type'] === 'cross-faded-data-driven' %>, <%- property.name === 'icon-image' || property.name === 'text-field' %>);
+ if (!typedValue) {
+ return error;
+ }
+
+ set<%- camelize(property.name) %>(*typedValue);
+ return nullopt;
+ }
+ if (name == "<%- property.name %>-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ set<%- camelize(property.name) %>Transition(*transition);
+ return nullopt;
+ }
+ <% } -%>
+
+ return Error { "layer doesn't support this property" };
+}
+
+optional<Error> <%- camelize(type) %>Layer::setLayoutProperty(const std::string& name, const Convertible& value) {
+ if (name == "visibility") {
+ if (isUndefined(value)) {
+ setVisibility(VisibilityType::Visible);
+ return nullopt;
+ }
+
+ Error error;
+ optional<VisibilityType> visibility = convert<VisibilityType>(value, error);
+ if (!visibility) {
+ return error;
+ }
+
+ setVisibility(*visibility);
+ return nullopt;
+ }
+
+ <% for (const property of layoutProperties) { %>
+ if (name == "<%- property.name %>") {
+ Error error;
+ optional<<%- propertyValueType(property) %>> typedValue = convert<<%- propertyValueType(property) %>>(value, error, <%- property['property-type'] === 'data-driven' || property['property-type'] === 'cross-faded-data-driven' %>, <%- property.name === 'icon-image' || property.name === 'text-field' %>);
+ if (!typedValue) {
+ return error;
+ }
+
+ set<%- camelize(property.name) %>(*typedValue);
+ return nullopt;
+ }
+ <% } -%>
+
+ return Error { "layer doesn't support this property" };
+}
+
} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/style/layers/line_layer.cpp b/src/mbgl/style/layers/line_layer.cpp
index 0cda849c0f..c3203f84e4 100644
--- a/src/mbgl/style/layers/line_layer.cpp
+++ b/src/mbgl/style/layers/line_layer.cpp
@@ -3,6 +3,12 @@
#include <mbgl/style/layers/line_layer.hpp>
#include <mbgl/style/layers/line_layer_impl.hpp>
#include <mbgl/style/layer_observer.hpp>
+#include <mbgl/style/conversion.hpp>
+#include <mbgl/style/conversion/color_ramp_property_value.hpp>
+#include <mbgl/style/conversion/constant.hpp>
+#include <mbgl/style/conversion/property_value.hpp>
+#include <mbgl/style/conversion/transition_options.hpp>
+#include <mbgl/style/conversion/json.hpp>
namespace mbgl {
namespace style {
@@ -431,5 +437,287 @@ TransitionOptions LineLayer::getLinePatternTransition() const {
return impl().paint.template get<LinePattern>().options;
}
+using namespace conversion;
+
+optional<Error> LineLayer::setPaintProperty(const std::string& name, const Convertible& value) {
+
+ if (name == "line-opacity") {
+ Error error;
+ optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, true, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setLineOpacity(*typedValue);
+ return nullopt;
+ }
+ if (name == "line-opacity-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setLineOpacityTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "line-color") {
+ Error error;
+ optional<PropertyValue<Color>> typedValue = convert<PropertyValue<Color>>(value, error, true, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setLineColor(*typedValue);
+ return nullopt;
+ }
+ if (name == "line-color-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setLineColorTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "line-translate") {
+ Error error;
+ optional<PropertyValue<std::array<float, 2>>> typedValue = convert<PropertyValue<std::array<float, 2>>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setLineTranslate(*typedValue);
+ return nullopt;
+ }
+ if (name == "line-translate-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setLineTranslateTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "line-translate-anchor") {
+ Error error;
+ optional<PropertyValue<TranslateAnchorType>> typedValue = convert<PropertyValue<TranslateAnchorType>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setLineTranslateAnchor(*typedValue);
+ return nullopt;
+ }
+ if (name == "line-translate-anchor-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setLineTranslateAnchorTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "line-width") {
+ Error error;
+ optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, true, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setLineWidth(*typedValue);
+ return nullopt;
+ }
+ if (name == "line-width-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setLineWidthTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "line-gap-width") {
+ Error error;
+ optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, true, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setLineGapWidth(*typedValue);
+ return nullopt;
+ }
+ if (name == "line-gap-width-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setLineGapWidthTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "line-offset") {
+ Error error;
+ optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, true, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setLineOffset(*typedValue);
+ return nullopt;
+ }
+ if (name == "line-offset-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setLineOffsetTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "line-blur") {
+ Error error;
+ optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, true, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setLineBlur(*typedValue);
+ return nullopt;
+ }
+ if (name == "line-blur-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setLineBlurTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "line-dasharray") {
+ Error error;
+ optional<PropertyValue<std::vector<float>>> typedValue = convert<PropertyValue<std::vector<float>>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setLineDasharray(*typedValue);
+ return nullopt;
+ }
+ if (name == "line-dasharray-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setLineDasharrayTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "line-pattern") {
+ Error error;
+ optional<PropertyValue<std::string>> typedValue = convert<PropertyValue<std::string>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setLinePattern(*typedValue);
+ return nullopt;
+ }
+ if (name == "line-pattern-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setLinePatternTransition(*transition);
+ return nullopt;
+ }
+
+ return Error { "layer doesn't support this property" };
+}
+
+optional<Error> LineLayer::setLayoutProperty(const std::string& name, const Convertible& value) {
+ if (name == "visibility") {
+ if (isUndefined(value)) {
+ setVisibility(VisibilityType::Visible);
+ return nullopt;
+ }
+
+ Error error;
+ optional<VisibilityType> visibility = convert<VisibilityType>(value, error);
+ if (!visibility) {
+ return error;
+ }
+
+ setVisibility(*visibility);
+ return nullopt;
+ }
+
+
+ if (name == "line-cap") {
+ Error error;
+ optional<PropertyValue<LineCapType>> typedValue = convert<PropertyValue<LineCapType>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setLineCap(*typedValue);
+ return nullopt;
+ }
+
+ if (name == "line-join") {
+ Error error;
+ optional<PropertyValue<LineJoinType>> typedValue = convert<PropertyValue<LineJoinType>>(value, error, true, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setLineJoin(*typedValue);
+ return nullopt;
+ }
+
+ if (name == "line-miter-limit") {
+ Error error;
+ optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setLineMiterLimit(*typedValue);
+ return nullopt;
+ }
+
+ if (name == "line-round-limit") {
+ Error error;
+ optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setLineRoundLimit(*typedValue);
+ return nullopt;
+ }
+
+ return Error { "layer doesn't support this property" };
+}
+
} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/style/layers/raster_layer.cpp b/src/mbgl/style/layers/raster_layer.cpp
index e5b03df0f6..0eba8ef886 100644
--- a/src/mbgl/style/layers/raster_layer.cpp
+++ b/src/mbgl/style/layers/raster_layer.cpp
@@ -3,6 +3,12 @@
#include <mbgl/style/layers/raster_layer.hpp>
#include <mbgl/style/layers/raster_layer_impl.hpp>
#include <mbgl/style/layer_observer.hpp>
+#include <mbgl/style/conversion.hpp>
+#include <mbgl/style/conversion/color_ramp_property_value.hpp>
+#include <mbgl/style/conversion/constant.hpp>
+#include <mbgl/style/conversion/property_value.hpp>
+#include <mbgl/style/conversion/transition_options.hpp>
+#include <mbgl/style/conversion/json.hpp>
namespace mbgl {
namespace style {
@@ -290,5 +296,201 @@ TransitionOptions RasterLayer::getRasterFadeDurationTransition() const {
return impl().paint.template get<RasterFadeDuration>().options;
}
+using namespace conversion;
+
+optional<Error> RasterLayer::setPaintProperty(const std::string& name, const Convertible& value) {
+
+ if (name == "raster-opacity") {
+ Error error;
+ optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setRasterOpacity(*typedValue);
+ return nullopt;
+ }
+ if (name == "raster-opacity-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setRasterOpacityTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "raster-hue-rotate") {
+ Error error;
+ optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setRasterHueRotate(*typedValue);
+ return nullopt;
+ }
+ if (name == "raster-hue-rotate-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setRasterHueRotateTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "raster-brightness-min") {
+ Error error;
+ optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setRasterBrightnessMin(*typedValue);
+ return nullopt;
+ }
+ if (name == "raster-brightness-min-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setRasterBrightnessMinTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "raster-brightness-max") {
+ Error error;
+ optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setRasterBrightnessMax(*typedValue);
+ return nullopt;
+ }
+ if (name == "raster-brightness-max-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setRasterBrightnessMaxTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "raster-saturation") {
+ Error error;
+ optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setRasterSaturation(*typedValue);
+ return nullopt;
+ }
+ if (name == "raster-saturation-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setRasterSaturationTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "raster-contrast") {
+ Error error;
+ optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setRasterContrast(*typedValue);
+ return nullopt;
+ }
+ if (name == "raster-contrast-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setRasterContrastTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "raster-resampling") {
+ Error error;
+ optional<PropertyValue<RasterResamplingType>> typedValue = convert<PropertyValue<RasterResamplingType>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setRasterResampling(*typedValue);
+ return nullopt;
+ }
+ if (name == "raster-resampling-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setRasterResamplingTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "raster-fade-duration") {
+ Error error;
+ optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setRasterFadeDuration(*typedValue);
+ return nullopt;
+ }
+ if (name == "raster-fade-duration-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setRasterFadeDurationTransition(*transition);
+ return nullopt;
+ }
+
+ return Error { "layer doesn't support this property" };
+}
+
+optional<Error> RasterLayer::setLayoutProperty(const std::string& name, const Convertible& value) {
+ if (name == "visibility") {
+ if (isUndefined(value)) {
+ setVisibility(VisibilityType::Visible);
+ return nullopt;
+ }
+
+ Error error;
+ optional<VisibilityType> visibility = convert<VisibilityType>(value, error);
+ if (!visibility) {
+ return error;
+ }
+
+ setVisibility(*visibility);
+ return nullopt;
+ }
+
+
+ return Error { "layer doesn't support this property" };
+}
+
} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/style/layers/symbol_layer.cpp b/src/mbgl/style/layers/symbol_layer.cpp
index c416c6a6c5..bb5b317a38 100644
--- a/src/mbgl/style/layers/symbol_layer.cpp
+++ b/src/mbgl/style/layers/symbol_layer.cpp
@@ -3,6 +3,12 @@
#include <mbgl/style/layers/symbol_layer.hpp>
#include <mbgl/style/layers/symbol_layer_impl.hpp>
#include <mbgl/style/layer_observer.hpp>
+#include <mbgl/style/conversion.hpp>
+#include <mbgl/style/conversion/color_ramp_property_value.hpp>
+#include <mbgl/style/conversion/constant.hpp>
+#include <mbgl/style/conversion/property_value.hpp>
+#include <mbgl/style/conversion/transition_options.hpp>
+#include <mbgl/style/conversion/json.hpp>
namespace mbgl {
namespace style {
@@ -1051,5 +1057,723 @@ TransitionOptions SymbolLayer::getTextTranslateAnchorTransition() const {
return impl().paint.template get<TextTranslateAnchor>().options;
}
+using namespace conversion;
+
+optional<Error> SymbolLayer::setPaintProperty(const std::string& name, const Convertible& value) {
+
+ if (name == "icon-opacity") {
+ Error error;
+ optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, true, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setIconOpacity(*typedValue);
+ return nullopt;
+ }
+ if (name == "icon-opacity-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setIconOpacityTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "icon-color") {
+ Error error;
+ optional<PropertyValue<Color>> typedValue = convert<PropertyValue<Color>>(value, error, true, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setIconColor(*typedValue);
+ return nullopt;
+ }
+ if (name == "icon-color-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setIconColorTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "icon-halo-color") {
+ Error error;
+ optional<PropertyValue<Color>> typedValue = convert<PropertyValue<Color>>(value, error, true, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setIconHaloColor(*typedValue);
+ return nullopt;
+ }
+ if (name == "icon-halo-color-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setIconHaloColorTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "icon-halo-width") {
+ Error error;
+ optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, true, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setIconHaloWidth(*typedValue);
+ return nullopt;
+ }
+ if (name == "icon-halo-width-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setIconHaloWidthTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "icon-halo-blur") {
+ Error error;
+ optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, true, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setIconHaloBlur(*typedValue);
+ return nullopt;
+ }
+ if (name == "icon-halo-blur-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setIconHaloBlurTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "icon-translate") {
+ Error error;
+ optional<PropertyValue<std::array<float, 2>>> typedValue = convert<PropertyValue<std::array<float, 2>>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setIconTranslate(*typedValue);
+ return nullopt;
+ }
+ if (name == "icon-translate-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setIconTranslateTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "icon-translate-anchor") {
+ Error error;
+ optional<PropertyValue<TranslateAnchorType>> typedValue = convert<PropertyValue<TranslateAnchorType>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setIconTranslateAnchor(*typedValue);
+ return nullopt;
+ }
+ if (name == "icon-translate-anchor-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setIconTranslateAnchorTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "text-opacity") {
+ Error error;
+ optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, true, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setTextOpacity(*typedValue);
+ return nullopt;
+ }
+ if (name == "text-opacity-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setTextOpacityTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "text-color") {
+ Error error;
+ optional<PropertyValue<Color>> typedValue = convert<PropertyValue<Color>>(value, error, true, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setTextColor(*typedValue);
+ return nullopt;
+ }
+ if (name == "text-color-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setTextColorTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "text-halo-color") {
+ Error error;
+ optional<PropertyValue<Color>> typedValue = convert<PropertyValue<Color>>(value, error, true, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setTextHaloColor(*typedValue);
+ return nullopt;
+ }
+ if (name == "text-halo-color-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setTextHaloColorTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "text-halo-width") {
+ Error error;
+ optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, true, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setTextHaloWidth(*typedValue);
+ return nullopt;
+ }
+ if (name == "text-halo-width-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setTextHaloWidthTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "text-halo-blur") {
+ Error error;
+ optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, true, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setTextHaloBlur(*typedValue);
+ return nullopt;
+ }
+ if (name == "text-halo-blur-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setTextHaloBlurTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "text-translate") {
+ Error error;
+ optional<PropertyValue<std::array<float, 2>>> typedValue = convert<PropertyValue<std::array<float, 2>>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setTextTranslate(*typedValue);
+ return nullopt;
+ }
+ if (name == "text-translate-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setTextTranslateTransition(*transition);
+ return nullopt;
+ }
+
+ if (name == "text-translate-anchor") {
+ Error error;
+ optional<PropertyValue<TranslateAnchorType>> typedValue = convert<PropertyValue<TranslateAnchorType>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setTextTranslateAnchor(*typedValue);
+ return nullopt;
+ }
+ if (name == "text-translate-anchor-transition") {
+ Error error;
+ optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
+ if (!transition) {
+ return error;
+ }
+
+ setTextTranslateAnchorTransition(*transition);
+ return nullopt;
+ }
+
+ return Error { "layer doesn't support this property" };
+}
+
+optional<Error> SymbolLayer::setLayoutProperty(const std::string& name, const Convertible& value) {
+ if (name == "visibility") {
+ if (isUndefined(value)) {
+ setVisibility(VisibilityType::Visible);
+ return nullopt;
+ }
+
+ Error error;
+ optional<VisibilityType> visibility = convert<VisibilityType>(value, error);
+ if (!visibility) {
+ return error;
+ }
+
+ setVisibility(*visibility);
+ return nullopt;
+ }
+
+
+ if (name == "symbol-placement") {
+ Error error;
+ optional<PropertyValue<SymbolPlacementType>> typedValue = convert<PropertyValue<SymbolPlacementType>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setSymbolPlacement(*typedValue);
+ return nullopt;
+ }
+
+ if (name == "symbol-spacing") {
+ Error error;
+ optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setSymbolSpacing(*typedValue);
+ return nullopt;
+ }
+
+ if (name == "symbol-avoid-edges") {
+ Error error;
+ optional<PropertyValue<bool>> typedValue = convert<PropertyValue<bool>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setSymbolAvoidEdges(*typedValue);
+ return nullopt;
+ }
+
+ if (name == "icon-allow-overlap") {
+ Error error;
+ optional<PropertyValue<bool>> typedValue = convert<PropertyValue<bool>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setIconAllowOverlap(*typedValue);
+ return nullopt;
+ }
+
+ if (name == "icon-ignore-placement") {
+ Error error;
+ optional<PropertyValue<bool>> typedValue = convert<PropertyValue<bool>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setIconIgnorePlacement(*typedValue);
+ return nullopt;
+ }
+
+ if (name == "icon-optional") {
+ Error error;
+ optional<PropertyValue<bool>> typedValue = convert<PropertyValue<bool>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setIconOptional(*typedValue);
+ return nullopt;
+ }
+
+ if (name == "icon-rotation-alignment") {
+ Error error;
+ optional<PropertyValue<AlignmentType>> typedValue = convert<PropertyValue<AlignmentType>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setIconRotationAlignment(*typedValue);
+ return nullopt;
+ }
+
+ if (name == "icon-size") {
+ Error error;
+ optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, true, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setIconSize(*typedValue);
+ return nullopt;
+ }
+
+ if (name == "icon-text-fit") {
+ Error error;
+ optional<PropertyValue<IconTextFitType>> typedValue = convert<PropertyValue<IconTextFitType>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setIconTextFit(*typedValue);
+ return nullopt;
+ }
+
+ if (name == "icon-text-fit-padding") {
+ Error error;
+ optional<PropertyValue<std::array<float, 4>>> typedValue = convert<PropertyValue<std::array<float, 4>>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setIconTextFitPadding(*typedValue);
+ return nullopt;
+ }
+
+ if (name == "icon-image") {
+ Error error;
+ optional<PropertyValue<std::string>> typedValue = convert<PropertyValue<std::string>>(value, error, true, true);
+ if (!typedValue) {
+ return error;
+ }
+
+ setIconImage(*typedValue);
+ return nullopt;
+ }
+
+ if (name == "icon-rotate") {
+ Error error;
+ optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, true, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setIconRotate(*typedValue);
+ return nullopt;
+ }
+
+ if (name == "icon-padding") {
+ Error error;
+ optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setIconPadding(*typedValue);
+ return nullopt;
+ }
+
+ if (name == "icon-keep-upright") {
+ Error error;
+ optional<PropertyValue<bool>> typedValue = convert<PropertyValue<bool>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setIconKeepUpright(*typedValue);
+ return nullopt;
+ }
+
+ if (name == "icon-offset") {
+ Error error;
+ optional<PropertyValue<std::array<float, 2>>> typedValue = convert<PropertyValue<std::array<float, 2>>>(value, error, true, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setIconOffset(*typedValue);
+ return nullopt;
+ }
+
+ if (name == "icon-anchor") {
+ Error error;
+ optional<PropertyValue<SymbolAnchorType>> typedValue = convert<PropertyValue<SymbolAnchorType>>(value, error, true, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setIconAnchor(*typedValue);
+ return nullopt;
+ }
+
+ if (name == "icon-pitch-alignment") {
+ Error error;
+ optional<PropertyValue<AlignmentType>> typedValue = convert<PropertyValue<AlignmentType>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setIconPitchAlignment(*typedValue);
+ return nullopt;
+ }
+
+ if (name == "text-pitch-alignment") {
+ Error error;
+ optional<PropertyValue<AlignmentType>> typedValue = convert<PropertyValue<AlignmentType>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setTextPitchAlignment(*typedValue);
+ return nullopt;
+ }
+
+ if (name == "text-rotation-alignment") {
+ Error error;
+ optional<PropertyValue<AlignmentType>> typedValue = convert<PropertyValue<AlignmentType>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setTextRotationAlignment(*typedValue);
+ return nullopt;
+ }
+
+ if (name == "text-field") {
+ Error error;
+ optional<PropertyValue<std::string>> typedValue = convert<PropertyValue<std::string>>(value, error, true, true);
+ if (!typedValue) {
+ return error;
+ }
+
+ setTextField(*typedValue);
+ return nullopt;
+ }
+
+ if (name == "text-font") {
+ Error error;
+ optional<PropertyValue<std::vector<std::string>>> typedValue = convert<PropertyValue<std::vector<std::string>>>(value, error, true, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setTextFont(*typedValue);
+ return nullopt;
+ }
+
+ if (name == "text-size") {
+ Error error;
+ optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, true, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setTextSize(*typedValue);
+ return nullopt;
+ }
+
+ if (name == "text-max-width") {
+ Error error;
+ optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, true, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setTextMaxWidth(*typedValue);
+ return nullopt;
+ }
+
+ if (name == "text-line-height") {
+ Error error;
+ optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setTextLineHeight(*typedValue);
+ return nullopt;
+ }
+
+ if (name == "text-letter-spacing") {
+ Error error;
+ optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, true, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setTextLetterSpacing(*typedValue);
+ return nullopt;
+ }
+
+ if (name == "text-justify") {
+ Error error;
+ optional<PropertyValue<TextJustifyType>> typedValue = convert<PropertyValue<TextJustifyType>>(value, error, true, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setTextJustify(*typedValue);
+ return nullopt;
+ }
+
+ if (name == "text-anchor") {
+ Error error;
+ optional<PropertyValue<SymbolAnchorType>> typedValue = convert<PropertyValue<SymbolAnchorType>>(value, error, true, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setTextAnchor(*typedValue);
+ return nullopt;
+ }
+
+ if (name == "text-max-angle") {
+ Error error;
+ optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setTextMaxAngle(*typedValue);
+ return nullopt;
+ }
+
+ if (name == "text-rotate") {
+ Error error;
+ optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, true, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setTextRotate(*typedValue);
+ return nullopt;
+ }
+
+ if (name == "text-padding") {
+ Error error;
+ optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setTextPadding(*typedValue);
+ return nullopt;
+ }
+
+ if (name == "text-keep-upright") {
+ Error error;
+ optional<PropertyValue<bool>> typedValue = convert<PropertyValue<bool>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setTextKeepUpright(*typedValue);
+ return nullopt;
+ }
+
+ if (name == "text-transform") {
+ Error error;
+ optional<PropertyValue<TextTransformType>> typedValue = convert<PropertyValue<TextTransformType>>(value, error, true, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setTextTransform(*typedValue);
+ return nullopt;
+ }
+
+ if (name == "text-offset") {
+ Error error;
+ optional<PropertyValue<std::array<float, 2>>> typedValue = convert<PropertyValue<std::array<float, 2>>>(value, error, true, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setTextOffset(*typedValue);
+ return nullopt;
+ }
+
+ if (name == "text-allow-overlap") {
+ Error error;
+ optional<PropertyValue<bool>> typedValue = convert<PropertyValue<bool>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setTextAllowOverlap(*typedValue);
+ return nullopt;
+ }
+
+ if (name == "text-ignore-placement") {
+ Error error;
+ optional<PropertyValue<bool>> typedValue = convert<PropertyValue<bool>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setTextIgnorePlacement(*typedValue);
+ return nullopt;
+ }
+
+ if (name == "text-optional") {
+ Error error;
+ optional<PropertyValue<bool>> typedValue = convert<PropertyValue<bool>>(value, error, false, false);
+ if (!typedValue) {
+ return error;
+ }
+
+ setTextOptional(*typedValue);
+ return nullopt;
+ }
+
+ return Error { "layer doesn't support this property" };
+}
+
} // namespace style
} // namespace mbgl