summaryrefslogtreecommitdiff
path: root/src/mbgl/style/layers/heatmap_layer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mbgl/style/layers/heatmap_layer.cpp')
-rw-r--r--src/mbgl/style/layers/heatmap_layer.cpp38
1 files changed, 11 insertions, 27 deletions
diff --git a/src/mbgl/style/layers/heatmap_layer.cpp b/src/mbgl/style/layers/heatmap_layer.cpp
index 234dda6c73..ba645a4a18 100644
--- a/src/mbgl/style/layers/heatmap_layer.cpp
+++ b/src/mbgl/style/layers/heatmap_layer.cpp
@@ -233,69 +233,61 @@ MAPBOX_ETERNAL_CONSTEXPR const auto layerProperties = mapbox::eternal::hash_map<
{"heatmap-opacity-transition", toUint8(Property::HeatmapOpacityTransition)},
{"heatmap-radius-transition", toUint8(Property::HeatmapRadiusTransition)},
{"heatmap-weight-transition", toUint8(Property::HeatmapWeightTransition)}});
-
-constexpr uint8_t lastPaintPropertyIndex = toUint8(Property::HeatmapWeightTransition);
} // namespace
-optional<Error> HeatmapLayer::setPaintProperty(const std::string& name, const Convertible& value) {
+optional<Error> HeatmapLayer::setProperty(const std::string& name, const Convertible& value) {
const auto it = layerProperties.find(name.c_str());
- if (it == layerProperties.end() || it->second > lastPaintPropertyIndex) {
+ if (it == layerProperties.end()) {
+ if (name == "visibility") return setVisibility(value);
return Error{"layer doesn't support this property"};
}
auto property = static_cast<Property>(it->second);
-
if (property == Property::HeatmapColor) {
Error error;
- optional<ColorRampPropertyValue> typedValue = convert<ColorRampPropertyValue>(value, error, false, false);
+ const auto& typedValue = convert<ColorRampPropertyValue>(value, error, false, false);
if (!typedValue) {
return error;
}
-
+
setHeatmapColor(*typedValue);
return nullopt;
-
}
-
if (property == Property::HeatmapIntensity || property == Property::HeatmapOpacity) {
Error error;
- optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, false, false);
+ const auto& typedValue = convert<PropertyValue<float>>(value, error, false, false);
if (!typedValue) {
return error;
}
-
+
if (property == Property::HeatmapIntensity) {
setHeatmapIntensity(*typedValue);
return nullopt;
}
-
+
if (property == Property::HeatmapOpacity) {
setHeatmapOpacity(*typedValue);
return nullopt;
}
-
}
-
if (property == Property::HeatmapRadius || property == Property::HeatmapWeight) {
Error error;
- optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, true, false);
+ const auto& typedValue = convert<PropertyValue<float>>(value, error, true, false);
if (!typedValue) {
return error;
}
-
+
if (property == Property::HeatmapRadius) {
setHeatmapRadius(*typedValue);
return nullopt;
}
-
+
if (property == Property::HeatmapWeight) {
setHeatmapWeight(*typedValue);
return nullopt;
}
-
}
-
Error error;
optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
@@ -362,14 +354,6 @@ StyleProperty HeatmapLayer::getProperty(const std::string& name) const {
return {};
}
-optional<Error> HeatmapLayer::setLayoutProperty(const std::string& name, const Convertible& value) {
- if (name == "visibility") {
- return Layer::setVisibility(value);
- }
-
- return Error { "layer doesn't support this property" };
-}
-
Mutable<Layer::Impl> HeatmapLayer::mutableBaseImpl() const {
return staticMutableCast<Layer::Impl>(mutableImpl());
}