diff --git a/include/llmr/style/property_key.hpp b/include/llmr/style/property_key.hpp index 47d0d2b78..e52c33ad1 100644 --- a/include/llmr/style/property_key.hpp +++ b/include/llmr/style/property_key.hpp @@ -4,7 +4,6 @@ namespace llmr { enum class PropertyKey { - FillEnabled, FillAntialias, FillOpacity, FillColor, @@ -15,7 +14,6 @@ enum class PropertyKey { FillTranslateAnchor, FillImage, - LineEnabled, LineOpacity, LineColor, LineTranslate, // for transitions only @@ -30,12 +28,10 @@ enum class PropertyKey { LineDashGap, LineImage, - IconEnabled, IconOpacity, IconRotate, IconRotateAnchor, - TextEnabled, TextOpacity, TextSize, TextColor, @@ -43,10 +39,8 @@ enum class PropertyKey { TextHaloWidth, TextHaloBlur, - CompositeEnabled, CompositeOpacity, - RasterEnabled, RasterOpacity, RasterSpin, RasterBrightnessLow, diff --git a/include/llmr/style/style_properties.hpp b/include/llmr/style/style_properties.hpp index 71758563a..bc46e2d85 100644 --- a/include/llmr/style/style_properties.hpp +++ b/include/llmr/style/style_properties.hpp @@ -14,7 +14,6 @@ namespace llmr { struct FillProperties { FillProperties() {} - bool enabled = true; bool antialias = true; float opacity = 1.0f; Color fill_color = {{ 0, 0, 0, 1 }}; @@ -24,13 +23,12 @@ struct FillProperties { std::string image; inline bool isVisible() const { - return enabled && opacity > 0 && (fill_color[3] > 0 || stroke_color[3] > 0); + return opacity > 0 && (fill_color[3] > 0 || stroke_color[3] > 0); } }; struct LineProperties { inline LineProperties() {} - bool enabled = true; float opacity = 1.0f; Color color = {{ 0, 0, 0, 1 }}; std::array translate = {{ 0, 0 }}; @@ -42,25 +40,23 @@ struct LineProperties { std::string image; inline bool isVisible() const { - return enabled && opacity > 0 && color[3] > 0 && width > 0; + return opacity > 0 && color[3] > 0 && width > 0; } }; struct IconProperties { inline IconProperties() {} - bool enabled = true; float opacity = 1.0f; float rotate = 0.0f; RotateAnchorType rotate_anchor = RotateAnchorType::Default; inline bool isVisible() const { - return enabled && opacity > 0; + return opacity > 0; } }; struct TextProperties { inline TextProperties() {} - bool enabled = true; float opacity = 1.0f; float size = 12.0f; Color color = {{ 0, 0, 0, 1 }}; @@ -69,23 +65,21 @@ struct TextProperties { float halo_blur = 1.0f; inline bool isVisible() const { - return enabled && opacity > 0 && (color[3] > 0 || halo_color[3] > 0) && size > 0; + return opacity > 0 && (color[3] > 0 || halo_color[3] > 0) && size > 0; } }; struct CompositeProperties { inline CompositeProperties() {} - bool enabled = true; float opacity = 1.0f; inline bool isVisible() const { - return enabled && opacity > 0; + return opacity > 0; } }; struct RasterProperties { inline RasterProperties() {} - bool enabled = true; float opacity = 1.0f; float spin = 0.0f; std::array brightness = {{ 0, 1 }}; @@ -94,7 +88,7 @@ struct RasterProperties { float fade = 0.0f; inline bool isVisible() const { - return enabled && opacity > 0; + return opacity > 0; } }; diff --git a/src/renderer/painter_fill.cpp b/src/renderer/painter_fill.cpp index f43ceed9f..18b370bc8 100644 --- a/src/renderer/painter_fill.cpp +++ b/src/renderer/painter_fill.cpp @@ -150,7 +150,6 @@ void Painter::renderFill(FillBucket& bucket, std::shared_ptr layer_d if (!bucket.hasData()) return; const FillProperties &properties = layer_desc->getProperties(); - if (!properties.enabled) return; if (layer_desc->rasterize && layer_desc->rasterize->isEnabled(id.z)) { if (pass == Translucent) { diff --git a/src/renderer/painter_icon.cpp b/src/renderer/painter_icon.cpp index 59ae67746..3a0192118 100644 --- a/src/renderer/painter_icon.cpp +++ b/src/renderer/painter_icon.cpp @@ -14,7 +14,6 @@ void Painter::renderIcon(IconBucket& bucket, std::shared_ptr layer_d if (pass == Opaque) return; const IconProperties &properties = layer_desc->getProperties(); - if (!properties.enabled) return; // TODO: when translating icon, are we doing this in the bucket already? // const mat4 &vtxMatrix = translatedMatrix(properties.translate, id, properties.translateAnchor); diff --git a/src/renderer/painter_line.cpp b/src/renderer/painter_line.cpp index 990c80b89..a5ed68cc0 100644 --- a/src/renderer/painter_line.cpp +++ b/src/renderer/painter_line.cpp @@ -11,7 +11,6 @@ void Painter::renderLine(LineBucket& bucket, std::shared_ptr layer_d if (!bucket.hasData()) return; const LineProperties &properties = layer_desc->getProperties(); - if (!properties.enabled) return; float width = properties.width; float offset = properties.offset / 2; diff --git a/src/renderer/painter_raster.cpp b/src/renderer/painter_raster.cpp index 8f330898d..bbd4c36d9 100644 --- a/src/renderer/painter_raster.cpp +++ b/src/renderer/painter_raster.cpp @@ -9,7 +9,6 @@ void Painter::renderRaster(RasterBucket& bucket, std::shared_ptr lay if (pass == Translucent) return; const RasterProperties &properties = layer_desc->getProperties(); - if (!properties.enabled) return; depthMask(false); diff --git a/src/renderer/painter_text.cpp b/src/renderer/painter_text.cpp index d9db72d66..1f6d76397 100644 --- a/src/renderer/painter_text.cpp +++ b/src/renderer/painter_text.cpp @@ -12,7 +12,6 @@ void Painter::renderText(TextBucket& bucket, std::shared_ptr layer_d if (!bucket.hasData()) return; const TextProperties &properties = layer_desc->getProperties(); - if (!properties.enabled) return; mat4 exMatrix; matrix::copy(exMatrix, projMatrix); diff --git a/src/style/property_fallback.cpp b/src/style/property_fallback.cpp index 0560ba299..38eae89c5 100644 --- a/src/style/property_fallback.cpp +++ b/src/style/property_fallback.cpp @@ -3,7 +3,6 @@ namespace llmr { const std::map PropertyFallbackValue::properties = { - { PropertyKey::FillEnabled, true }, { PropertyKey::FillAntialias, true }, { PropertyKey::FillOpacity, 1.0f }, { PropertyKey::FillColor, Color({{ 0, 0, 0, 1 }}) }, @@ -11,7 +10,6 @@ const std::map PropertyFallbackValue::properties = { { PropertyKey::FillTranslateY, 0.0f }, { PropertyKey::FillTranslateAnchor, TranslateAnchorType::Map }, - { PropertyKey::LineEnabled, true }, { PropertyKey::LineOpacity, 1.0f }, { PropertyKey::LineColor, Color({{ 0, 0, 0, 1 }}) }, { PropertyKey::LineTranslateX, 0.0f }, @@ -23,12 +21,10 @@ const std::map PropertyFallbackValue::properties = { { PropertyKey::LineDashLand, 1.0f }, { PropertyKey::LineDashGap, -1.0f }, - { PropertyKey::IconEnabled, true }, { PropertyKey::IconOpacity, 1.0f }, { PropertyKey::IconRotate, 0.0f }, { PropertyKey::IconRotateAnchor, RotateAnchorType::Viewport }, - { PropertyKey::TextEnabled, true }, { PropertyKey::TextOpacity, 1.0f }, { PropertyKey::TextSize, 16.0f }, { PropertyKey::TextColor, Color({{ 0, 0, 0, 1 }}) }, @@ -36,10 +32,8 @@ const std::map PropertyFallbackValue::properties = { { PropertyKey::TextHaloWidth, 0.25f }, { PropertyKey::TextHaloBlur, 1.0f }, - { PropertyKey::CompositeEnabled, true }, { PropertyKey::CompositeOpacity, 1.0f }, - { PropertyKey::RasterEnabled, true }, { PropertyKey::RasterOpacity, 1.0f }, { PropertyKey::RasterSpin, 0.0f }, { PropertyKey::RasterBrightnessLow, 0.0f }, diff --git a/src/style/style_layer.cpp b/src/style/style_layer.cpp index 4bbf1812d..8eedd0435 100644 --- a/src/style/style_layer.cpp +++ b/src/style/style_layer.cpp @@ -164,7 +164,6 @@ template <> void StyleLayer::applyStyleProperties(const float z, const timestamp now) { properties.set(); FillProperties &fill = properties.get(); - applyStyleProperty(PropertyKey::FillEnabled, fill.enabled, z, now); applyStyleProperty(PropertyKey::FillAntialias, fill.antialias, z, now); applyStyleProperty(PropertyKey::FillOpacity, fill.opacity, z, now); applyStyleProperty(PropertyKey::FillColor, fill.fill_color, z, now); @@ -179,7 +178,6 @@ template <> void StyleLayer::applyStyleProperties(const float z, const timestamp now) { properties.set(); LineProperties &line = properties.get(); - applyStyleProperty(PropertyKey::LineEnabled, line.enabled, z, now); applyStyleProperty(PropertyKey::LineOpacity, line.opacity, z, now); applyStyleProperty(PropertyKey::LineColor, line.color, z, now); applyStyleProperty(PropertyKey::LineTranslateX, line.translate[0], z, now); @@ -197,7 +195,6 @@ template <> void StyleLayer::applyStyleProperties(const float z, const timestamp now) { properties.set(); IconProperties &icon = properties.get(); - applyStyleProperty(PropertyKey::IconEnabled, icon.enabled, z, now); applyStyleProperty(PropertyKey::IconOpacity, icon.opacity, z, now); applyStyleProperty(PropertyKey::IconRotate, icon.rotate, z, now); applyStyleProperty(PropertyKey::IconRotateAnchor, icon.rotate_anchor, z, now); @@ -207,7 +204,6 @@ template <> void StyleLayer::applyStyleProperties(const float z, const timestamp now) { properties.set(); TextProperties &text = properties.get(); - applyStyleProperty(PropertyKey::TextEnabled, text.enabled, z, now); applyStyleProperty(PropertyKey::TextOpacity, text.opacity, z, now); applyStyleProperty(PropertyKey::TextSize, text.size, z, now); applyStyleProperty(PropertyKey::TextColor, text.color, z, now); @@ -220,7 +216,6 @@ template <> void StyleLayer::applyStyleProperties(const float z, const timestamp now) { properties.set(); CompositeProperties &composite = properties.get(); - applyStyleProperty(PropertyKey::CompositeEnabled, composite.enabled, z, now); applyStyleProperty(PropertyKey::CompositeOpacity, composite.opacity, z, now); } @@ -228,7 +223,6 @@ template <> void StyleLayer::applyStyleProperties(const float z, const timestamp now) { properties.set(); RasterProperties &raster = properties.get(); - applyStyleProperty(PropertyKey::RasterEnabled, raster.enabled, z, now); applyStyleProperty(PropertyKey::RasterOpacity, raster.opacity, z, now); applyStyleProperty(PropertyKey::RasterSpin, raster.spin, z, now); applyStyleProperty(PropertyKey::RasterBrightnessLow, raster.brightness[0], z, now); diff --git a/src/style/style_parser.cpp b/src/style/style_parser.cpp index 2b8339a53..539740c6c 100644 --- a/src/style/style_parser.cpp +++ b/src/style/style_parser.cpp @@ -600,8 +600,6 @@ void StyleParser::parseStyles(JSVal value, std::map &s void StyleParser::parseStyle(JSVal value, ClassProperties &klass) { using Key = PropertyKey; - parseOptionalProperty>("fill-enabled", Key::FillEnabled, klass, value); - parseOptionalProperty("transition-fill-enabled", Key::FillEnabled, klass, value); parseOptionalProperty>("fill-antialias", Key::FillAntialias, klass, value); parseOptionalProperty>("fill-opacity", Key::FillOpacity, klass, value); parseOptionalProperty("transition-fill-opacity", Key::FillOpacity, klass, value); @@ -614,8 +612,6 @@ void StyleParser::parseStyle(JSVal value, ClassProperties &klass) { parseOptionalProperty("fill-translate-anchor", Key::FillTranslateAnchor, klass, value); parseOptionalProperty("fill-image", Key::FillImage, klass, value); - parseOptionalProperty>("line-enabled", Key::LineEnabled, klass, value); - parseOptionalProperty("transition-line-enabled", Key::LineEnabled, klass, value); parseOptionalProperty>("line-opacity", Key::LineOpacity, klass, value); parseOptionalProperty("transition-line-opacity", Key::LineOpacity, klass, value); parseOptionalProperty>("line-color", Key::LineColor, klass, value); @@ -633,15 +629,11 @@ void StyleParser::parseStyle(JSVal value, ClassProperties &klass) { parseOptionalProperty("transition-line-dasharray", Key::LineDashArray, klass, value); parseOptionalProperty("line-image", Key::LineImage, klass, value); - parseOptionalProperty>("icon-enabled", Key::IconEnabled, klass, value); - parseOptionalProperty("transition-icon-enabled", Key::IconEnabled, klass, value); parseOptionalProperty>("icon-opacity", Key::IconOpacity, klass, value); parseOptionalProperty("transition-icon-opacity", Key::IconOpacity, klass, value); parseOptionalProperty>("icon-rotate", Key::IconRotate, klass, value); parseOptionalProperty("icon-rotate-anchor", Key::IconRotateAnchor, klass, value); - parseOptionalProperty>("text-enabled", Key::TextEnabled, klass, value); - parseOptionalProperty("transition-text-enabled", Key::TextEnabled, klass, value); parseOptionalProperty>("text-opacity", Key::TextOpacity, klass, value); parseOptionalProperty("transition-text-opacity", Key::TextOpacity, klass, value); parseOptionalProperty>("text-size", Key::TextSize, klass, value); @@ -655,13 +647,9 @@ void StyleParser::parseStyle(JSVal value, ClassProperties &klass) { parseOptionalProperty>("text-halo-blur", Key::TextHaloBlur, klass, value); parseOptionalProperty("transition-text-halo-blur", Key::TextHaloBlur, klass, value); - parseOptionalProperty>("composite-enabled", Key::CompositeEnabled, klass, value); - parseOptionalProperty("transition-composite-enabled", Key::CompositeEnabled, klass, value); parseOptionalProperty>("composite-opacity", Key::CompositeOpacity, klass, value); parseOptionalProperty("transition-composite-opacity", Key::CompositeOpacity, klass, value); - parseOptionalProperty>("raster-enabled", Key::RasterEnabled, klass, value); - parseOptionalProperty("transition-raster-enabled", Key::RasterEnabled, klass, value); parseOptionalProperty>("raster-opacity", Key::RasterOpacity, klass, value); parseOptionalProperty("transition-raster-opacity", Key::RasterOpacity, klass, value); parseOptionalProperty>("raster-spin", Key::RasterSpin, klass, value);