From 3b2a4216a2e3929a557dbddd0d239758641c285f Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Thu, 8 Dec 2016 12:09:21 -0800 Subject: [PATCH] [core] Implement circle-stroke properties Also includes stubs for fill-extrusion layer, because most of the code was auto-generated. --- cmake/core-files.cmake | 6 + .../conversion/make_property_setters.hpp | 13 ++ .../conversion/make_property_setters.hpp.ejs | 2 +- include/mbgl/style/layer.hpp | 4 + include/mbgl/style/layers/circle_layer.hpp | 12 ++ .../style/layers/fill_extrusion_layer.hpp | 72 ++++++++ package.json | 6 +- .../android/src/style/layers/layer.cpp.ejs | 2 +- scripts/generate-style-code.js | 20 +- src/mbgl/programs/circle_program.hpp | 6 + src/mbgl/renderer/painter_circle.cpp | 3 + src/mbgl/style/layers/circle_layer.cpp | 45 +++++ .../style/layers/circle_layer_properties.hpp | 17 +- .../style/layers/fill_extrusion_layer.cpp | 171 ++++++++++++++++++ .../layers/fill_extrusion_layer_impl.cpp | 19 ++ .../layers/fill_extrusion_layer_impl.hpp | 24 +++ .../fill_extrusion_layer_properties.cpp | 9 + .../fill_extrusion_layer_properties.hpp | 51 ++++++ src/mbgl/style/layers/layer.cpp.ejs | 4 +- .../style/layers/layer_properties.cpp.ejs | 2 +- src/mbgl/style/style.cpp | 1 + 21 files changed, 471 insertions(+), 18 deletions(-) create mode 100644 include/mbgl/style/layers/fill_extrusion_layer.hpp create mode 100644 src/mbgl/style/layers/fill_extrusion_layer.cpp create mode 100644 src/mbgl/style/layers/fill_extrusion_layer_impl.cpp create mode 100644 src/mbgl/style/layers/fill_extrusion_layer_impl.hpp create mode 100644 src/mbgl/style/layers/fill_extrusion_layer_properties.cpp create mode 100644 src/mbgl/style/layers/fill_extrusion_layer_properties.hpp diff --git a/cmake/core-files.cmake b/cmake/core-files.cmake index 6a87be8b5fb..c9e581737fd 100644 --- a/cmake/core-files.cmake +++ b/cmake/core-files.cmake @@ -265,6 +265,7 @@ set(MBGL_CORE_FILES include/mbgl/style/layers/background_layer.hpp include/mbgl/style/layers/circle_layer.hpp include/mbgl/style/layers/custom_layer.hpp + include/mbgl/style/layers/fill_extrusion_layer.hpp include/mbgl/style/layers/fill_layer.hpp include/mbgl/style/layers/line_layer.hpp include/mbgl/style/layers/raster_layer.hpp @@ -282,6 +283,11 @@ set(MBGL_CORE_FILES src/mbgl/style/layers/custom_layer.cpp src/mbgl/style/layers/custom_layer_impl.cpp src/mbgl/style/layers/custom_layer_impl.hpp + src/mbgl/style/layers/fill_extrusion_layer.cpp + src/mbgl/style/layers/fill_extrusion_layer_impl.cpp + src/mbgl/style/layers/fill_extrusion_layer_impl.hpp + src/mbgl/style/layers/fill_extrusion_layer_properties.cpp + src/mbgl/style/layers/fill_extrusion_layer_properties.hpp src/mbgl/style/layers/fill_layer.cpp src/mbgl/style/layers/fill_layer_impl.cpp src/mbgl/style/layers/fill_layer_impl.hpp diff --git a/include/mbgl/style/conversion/make_property_setters.hpp b/include/mbgl/style/conversion/make_property_setters.hpp index a3ba5e5d5a6..e30359937e4 100644 --- a/include/mbgl/style/conversion/make_property_setters.hpp +++ b/include/mbgl/style/conversion/make_property_setters.hpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -67,6 +68,7 @@ auto makeLayoutPropertySetters() { + return result; } @@ -115,6 +117,17 @@ auto makePaintPropertySetters() { result["circle-translate"] = makePropertySetter(&CircleLayer::setCircleTranslate); result["circle-translate-anchor"] = makePropertySetter(&CircleLayer::setCircleTranslateAnchor); result["circle-pitch-scale"] = makePropertySetter(&CircleLayer::setCirclePitchScale); + result["circle-stroke-width"] = makePropertySetter(&CircleLayer::setCircleStrokeWidth); + result["circle-stroke-color"] = makePropertySetter(&CircleLayer::setCircleStrokeColor); + result["circle-stroke-opacity"] = makePropertySetter(&CircleLayer::setCircleStrokeOpacity); + + result["fill-extrusion-opacity"] = makePropertySetter(&FillExtrusionLayer::setFillExtrusionOpacity); + result["fill-extrusion-color"] = makePropertySetter(&FillExtrusionLayer::setFillExtrusionColor); + result["fill-extrusion-translate"] = makePropertySetter(&FillExtrusionLayer::setFillExtrusionTranslate); + result["fill-extrusion-translate-anchor"] = makePropertySetter(&FillExtrusionLayer::setFillExtrusionTranslateAnchor); + result["fill-extrusion-pattern"] = makePropertySetter(&FillExtrusionLayer::setFillExtrusionPattern); + result["fill-extrusion-height"] = makePropertySetter(&FillExtrusionLayer::setFillExtrusionHeight); + result["fill-extrusion-base"] = makePropertySetter(&FillExtrusionLayer::setFillExtrusionBase); result["raster-opacity"] = makePropertySetter(&RasterLayer::setRasterOpacity); result["raster-hue-rotate"] = makePropertySetter(&RasterLayer::setRasterHueRotate); diff --git a/include/mbgl/style/conversion/make_property_setters.hpp.ejs b/include/mbgl/style/conversion/make_property_setters.hpp.ejs index 54e39581801..ed8f6e891c4 100644 --- a/include/mbgl/style/conversion/make_property_setters.hpp.ejs +++ b/include/mbgl/style/conversion/make_property_setters.hpp.ejs @@ -5,7 +5,7 @@ #include <% for (const layer of locals.layers) { -%> -#include _layer.hpp> +#include _layer.hpp> <% } -%> #include diff --git a/include/mbgl/style/layer.hpp b/include/mbgl/style/layer.hpp index 925629a3495..dc02cb09b2e 100644 --- a/include/mbgl/style/layer.hpp +++ b/include/mbgl/style/layer.hpp @@ -15,6 +15,7 @@ class SymbolLayer; class RasterLayer; class BackgroundLayer; class CustomLayer; +class FillExtrusionLayer; /** * The runtime representation of a [layer](https://www.mapbox.com/mapbox-gl-style-spec/#layers) from the Mapbox Style @@ -42,6 +43,7 @@ class Layer : public mbgl::util::noncopyable { Raster, Background, Custom, + FillExtrusion, }; class Impl; @@ -95,6 +97,8 @@ class Layer : public mbgl::util::noncopyable { return visitor(*as()); case Type::Custom: return visitor(*as()); + case Type::FillExtrusion: + return visitor(*as()); } } diff --git a/include/mbgl/style/layers/circle_layer.hpp b/include/mbgl/style/layers/circle_layer.hpp index 587f0023e31..5562126c2f7 100644 --- a/include/mbgl/style/layers/circle_layer.hpp +++ b/include/mbgl/style/layers/circle_layer.hpp @@ -54,6 +54,18 @@ class CircleLayer : public Layer { PropertyValue getCirclePitchScale(const optional& klass = {}) const; void setCirclePitchScale(PropertyValue, const optional& klass = {}); + static PropertyValue getDefaultCircleStrokeWidth(); + PropertyValue getCircleStrokeWidth(const optional& klass = {}) const; + void setCircleStrokeWidth(PropertyValue, const optional& klass = {}); + + static PropertyValue getDefaultCircleStrokeColor(); + PropertyValue getCircleStrokeColor(const optional& klass = {}) const; + void setCircleStrokeColor(PropertyValue, const optional& klass = {}); + + static PropertyValue getDefaultCircleStrokeOpacity(); + PropertyValue getCircleStrokeOpacity(const optional& klass = {}) const; + void setCircleStrokeOpacity(PropertyValue, const optional& klass = {}); + // Private implementation class Impl; diff --git a/include/mbgl/style/layers/fill_extrusion_layer.hpp b/include/mbgl/style/layers/fill_extrusion_layer.hpp new file mode 100644 index 00000000000..08728af309d --- /dev/null +++ b/include/mbgl/style/layers/fill_extrusion_layer.hpp @@ -0,0 +1,72 @@ +// This file is generated. Do not edit. + +#pragma once + +#include +#include +#include + +#include + +namespace mbgl { +namespace style { + +class FillExtrusionLayer : public Layer { +public: + FillExtrusionLayer(const std::string& layerID, const std::string& sourceID); + ~FillExtrusionLayer() final; + + // Source + const std::string& getSourceID() const; + const std::string& getSourceLayer() const; + void setSourceLayer(const std::string& sourceLayer); + + void setFilter(const Filter&); + const Filter& getFilter() const; + + // Paint properties + + static PropertyValue getDefaultFillExtrusionOpacity(); + PropertyValue getFillExtrusionOpacity(const optional& klass = {}) const; + void setFillExtrusionOpacity(PropertyValue, const optional& klass = {}); + + static PropertyValue getDefaultFillExtrusionColor(); + PropertyValue getFillExtrusionColor(const optional& klass = {}) const; + void setFillExtrusionColor(PropertyValue, const optional& klass = {}); + + static PropertyValue> getDefaultFillExtrusionTranslate(); + PropertyValue> getFillExtrusionTranslate(const optional& klass = {}) const; + void setFillExtrusionTranslate(PropertyValue>, const optional& klass = {}); + + static PropertyValue getDefaultFillExtrusionTranslateAnchor(); + PropertyValue getFillExtrusionTranslateAnchor(const optional& klass = {}) const; + void setFillExtrusionTranslateAnchor(PropertyValue, const optional& klass = {}); + + static PropertyValue getDefaultFillExtrusionPattern(); + PropertyValue getFillExtrusionPattern(const optional& klass = {}) const; + void setFillExtrusionPattern(PropertyValue, const optional& klass = {}); + + static PropertyValue getDefaultFillExtrusionHeight(); + PropertyValue getFillExtrusionHeight(const optional& klass = {}) const; + void setFillExtrusionHeight(PropertyValue, const optional& klass = {}); + + static PropertyValue getDefaultFillExtrusionBase(); + PropertyValue getFillExtrusionBase(const optional& klass = {}) const; + void setFillExtrusionBase(PropertyValue, const optional& klass = {}); + + // Private implementation + + class Impl; + Impl* const impl; + + FillExtrusionLayer(const Impl&); + FillExtrusionLayer(const FillExtrusionLayer&) = delete; +}; + +template <> +inline bool Layer::is() const { + return type == Type::FillExtrusion; +} + +} // namespace style +} // namespace mbgl diff --git a/package.json b/package.json index 8c7700d3852..4037efe6316 100644 --- a/package.json +++ b/package.json @@ -22,9 +22,9 @@ "ejs": "^2.4.1", "express": "^4.11.1", "lodash": "^4.16.4", - "mapbox-gl-shaders": "mapbox/mapbox-gl-shaders#597115a1e1bd982944b068f8accde34eada74fc2", - "mapbox-gl-style-spec": "mapbox/mapbox-gl-style-spec#7f62a4fc9f21e619824d68abbc4b03cbc1685572", - "mapbox-gl-test-suite": "mapbox/mapbox-gl-test-suite#0c6f3e00193248474349cd730e232eb5ffcd9bf4", + "mapbox-gl-shaders": "mapbox/mapbox-gl-shaders#b51b85ffb8c512e228c36c5405293ce51d123519", + "mapbox-gl-style-spec": "mapbox/mapbox-gl-style-spec#deb30918f8637e7675a00731b799a5caec894b17", + "mapbox-gl-test-suite": "mapbox/mapbox-gl-test-suite#9252ffc5108131704b5acf52d78258ac05687871", "mkdirp": "^0.5.1", "node-cmake": "^1.2.1", "request": "^2.72.0", diff --git a/platform/android/src/style/layers/layer.cpp.ejs b/platform/android/src/style/layers/layer.cpp.ejs index e802fb6bd2a..500c76ea7a0 100644 --- a/platform/android/src/style/layers/layer.cpp.ejs +++ b/platform/android/src/style/layers/layer.cpp.ejs @@ -4,7 +4,7 @@ -%> // This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`. -#include "<%- type %>_layer.hpp" +#include "<%- type.replace('-', '_') %>_layer.hpp" #include diff --git a/scripts/generate-style-code.js b/scripts/generate-style-code.js index 005bc022df6..f2acb12a2a9 100644 --- a/scripts/generate-style-code.js +++ b/scripts/generate-style-code.js @@ -3,12 +3,12 @@ const fs = require('fs'); const ejs = require('ejs'); const spec = require('mapbox-gl-style-spec').latest; -var colorParser = require('csscolorparser'); +const colorParser = require('csscolorparser'); require('./style-code'); function parseCSSColor(str) { - var color = colorParser.parseCSSColor(str); + const color = colorParser.parseCSSColor(str); return [ color[0] / 255 * color[3], color[1] / 255 * color[3], color[2] / 255 * color[3], color[3] ]; @@ -40,7 +40,7 @@ global.propertyType = function (property) { } default: throw new Error(`unknown type for ${property.name}`) } -} +}; global.defaultValue = function (property) { // https://github.com/mapbox/mapbox-gl-native/issues/5258 @@ -64,7 +64,7 @@ global.defaultValue = function (property) { return `${propertyType(property)}::${camelize(property.default)}`; } case 'color': - var color = parseCSSColor(property.default).join(', '); + const color = parseCSSColor(property.default).join(', '); switch (color) { case '0, 0, 0, 0': return '{}'; @@ -85,7 +85,7 @@ global.defaultValue = function (property) { default: return property.default; } -} +}; const layerHpp = ejs.compile(fs.readFileSync('include/mbgl/style/layers/layer.hpp.ejs', 'utf8'), {strict: true}); const layerCpp = ejs.compile(fs.readFileSync('src/mbgl/style/layers/layer.cpp.ejs', 'utf8'), {strict: true}); @@ -118,11 +118,13 @@ const layers = Object.keys(spec.layer.type.values).map((type) => { }); for (const layer of layers) { - writeIfModified(`include/mbgl/style/layers/${layer.type}_layer.hpp`, layerHpp(layer)); - writeIfModified(`src/mbgl/style/layers/${layer.type}_layer.cpp`, layerCpp(layer)); + const layerFileName = layer.type.replace('-', '_'); + + writeIfModified(`include/mbgl/style/layers/${layerFileName}_layer.hpp`, layerHpp(layer)); + writeIfModified(`src/mbgl/style/layers/${layerFileName}_layer.cpp`, layerCpp(layer)); - writeIfModified(`src/mbgl/style/layers/${layer.type}_layer_properties.hpp`, propertiesHpp(layer)); - writeIfModified(`src/mbgl/style/layers/${layer.type}_layer_properties.cpp`, propertiesCpp(layer)); + writeIfModified(`src/mbgl/style/layers/${layerFileName}_layer_properties.hpp`, propertiesHpp(layer)); + writeIfModified(`src/mbgl/style/layers/${layerFileName}_layer_properties.cpp`, propertiesCpp(layer)); } const propertySettersHpp = ejs.compile(fs.readFileSync('include/mbgl/style/conversion/make_property_setters.hpp.ejs', 'utf8'), {strict: true}); diff --git a/src/mbgl/programs/circle_program.hpp b/src/mbgl/programs/circle_program.hpp index 6b713bb41c4..c9aea1d137e 100644 --- a/src/mbgl/programs/circle_program.hpp +++ b/src/mbgl/programs/circle_program.hpp @@ -10,6 +10,9 @@ namespace mbgl { namespace uniforms { MBGL_DEFINE_UNIFORM_SCALAR(float, u_radius); +MBGL_DEFINE_UNIFORM_SCALAR(Color, u_stroke_color); +MBGL_DEFINE_UNIFORM_SCALAR(float, u_stroke_width); +MBGL_DEFINE_UNIFORM_SCALAR(float, u_stroke_opacity); MBGL_DEFINE_UNIFORM_SCALAR(bool, u_scale_with_map); } // namespace uniforms @@ -26,6 +29,9 @@ class CircleProgram : public Program< uniforms::u_color, uniforms::u_radius, uniforms::u_blur, + uniforms::u_stroke_color, + uniforms::u_stroke_width, + uniforms::u_stroke_opacity, uniforms::u_scale_with_map, uniforms::u_extrude_scale>> { diff --git a/src/mbgl/renderer/painter_circle.cpp b/src/mbgl/renderer/painter_circle.cpp index 0767a509434..9385b7b1a3b 100644 --- a/src/mbgl/renderer/painter_circle.cpp +++ b/src/mbgl/renderer/painter_circle.cpp @@ -41,6 +41,9 @@ void Painter::renderCircle(PaintParameters& parameters, uniforms::u_color::Value{ properties.get() }, uniforms::u_radius::Value{ properties.get() }, uniforms::u_blur::Value{ properties.get() }, + uniforms::u_stroke_color::Value{ properties.get() }, + uniforms::u_stroke_width::Value{ properties.get() }, + uniforms::u_stroke_opacity::Value{ properties.get() }, uniforms::u_scale_with_map::Value{ scaleWithMap }, uniforms::u_extrude_scale::Value{ scaleWithMap ? std::array {{ diff --git a/src/mbgl/style/layers/circle_layer.cpp b/src/mbgl/style/layers/circle_layer.cpp index ce01a12ff20..e3a506e8956 100644 --- a/src/mbgl/style/layers/circle_layer.cpp +++ b/src/mbgl/style/layers/circle_layer.cpp @@ -167,5 +167,50 @@ void CircleLayer::setCirclePitchScale(PropertyValue value, impl->observer->onLayerPaintPropertyChanged(*this); } +PropertyValue CircleLayer::getDefaultCircleStrokeWidth() { + return { 0 }; +} + +PropertyValue CircleLayer::getCircleStrokeWidth(const optional& klass) const { + return impl->paint.get(klass); +} + +void CircleLayer::setCircleStrokeWidth(PropertyValue value, const optional& klass) { + if (value == getCircleStrokeWidth(klass)) + return; + impl->paint.set(value, klass); + impl->observer->onLayerPaintPropertyChanged(*this); +} + +PropertyValue CircleLayer::getDefaultCircleStrokeColor() { + return { Color::black() }; +} + +PropertyValue CircleLayer::getCircleStrokeColor(const optional& klass) const { + return impl->paint.get(klass); +} + +void CircleLayer::setCircleStrokeColor(PropertyValue value, const optional& klass) { + if (value == getCircleStrokeColor(klass)) + return; + impl->paint.set(value, klass); + impl->observer->onLayerPaintPropertyChanged(*this); +} + +PropertyValue CircleLayer::getDefaultCircleStrokeOpacity() { + return { 1 }; +} + +PropertyValue CircleLayer::getCircleStrokeOpacity(const optional& klass) const { + return impl->paint.get(klass); +} + +void CircleLayer::setCircleStrokeOpacity(PropertyValue value, const optional& klass) { + if (value == getCircleStrokeOpacity(klass)) + return; + impl->paint.set(value, klass); + impl->observer->onLayerPaintPropertyChanged(*this); +} + } // namespace style } // namespace mbgl diff --git a/src/mbgl/style/layers/circle_layer_properties.hpp b/src/mbgl/style/layers/circle_layer_properties.hpp index b7f279de4bd..ea36b31949b 100644 --- a/src/mbgl/style/layers/circle_layer_properties.hpp +++ b/src/mbgl/style/layers/circle_layer_properties.hpp @@ -37,6 +37,18 @@ struct CirclePitchScale : PaintProperty { static CirclePitchScaleType defaultValue() { return CirclePitchScaleType::Map; } }; +struct CircleStrokeWidth : PaintProperty { + static float defaultValue() { return 0; } +}; + +struct CircleStrokeColor : PaintProperty { + static Color defaultValue() { return Color::black(); } +}; + +struct CircleStrokeOpacity : PaintProperty { + static float defaultValue() { return 1; } +}; + class CirclePaintProperties : public PaintProperties< CircleRadius, CircleColor, @@ -44,7 +56,10 @@ class CirclePaintProperties : public PaintProperties< CircleOpacity, CircleTranslate, CircleTranslateAnchor, - CirclePitchScale + CirclePitchScale, + CircleStrokeWidth, + CircleStrokeColor, + CircleStrokeOpacity > {}; } // namespace style diff --git a/src/mbgl/style/layers/fill_extrusion_layer.cpp b/src/mbgl/style/layers/fill_extrusion_layer.cpp new file mode 100644 index 00000000000..64efb1dd6ae --- /dev/null +++ b/src/mbgl/style/layers/fill_extrusion_layer.cpp @@ -0,0 +1,171 @@ +// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. + +#include +#include + +namespace mbgl { +namespace style { + +FillExtrusionLayer::FillExtrusionLayer(const std::string& layerID, const std::string& sourceID) + : Layer(Type::FillExtrusion, std::make_unique()) + , impl(static_cast(baseImpl.get())) { + impl->id = layerID; + impl->source = sourceID; +} + +FillExtrusionLayer::FillExtrusionLayer(const Impl& other) + : Layer(Type::FillExtrusion, std::make_unique(other)) + , impl(static_cast(baseImpl.get())) { +} + +FillExtrusionLayer::~FillExtrusionLayer() = default; + +std::unique_ptr FillExtrusionLayer::Impl::clone() const { + return std::make_unique(*this); +} + +std::unique_ptr FillExtrusionLayer::Impl::cloneRef(const std::string& id_) const { + auto result = std::make_unique(*this); + result->impl->id = id_; + result->impl->ref = this->id; + result->impl->paint = FillExtrusionPaintProperties(); + return std::move(result); +} + +// Source + +const std::string& FillExtrusionLayer::getSourceID() const { + return impl->source; +} + +void FillExtrusionLayer::setSourceLayer(const std::string& sourceLayer) { + impl->sourceLayer = sourceLayer; +} + +const std::string& FillExtrusionLayer::getSourceLayer() const { + return impl->sourceLayer; +} + +// Filter + +void FillExtrusionLayer::setFilter(const Filter& filter) { + impl->filter = filter; + impl->observer->onLayerFilterChanged(*this); +} + +const Filter& FillExtrusionLayer::getFilter() const { + return impl->filter; +} + +// Layout properties + + +// Paint properties + +PropertyValue FillExtrusionLayer::getDefaultFillExtrusionOpacity() { + return { 1 }; +} + +PropertyValue FillExtrusionLayer::getFillExtrusionOpacity(const optional& klass) const { + return impl->paint.get(klass); +} + +void FillExtrusionLayer::setFillExtrusionOpacity(PropertyValue value, const optional& klass) { + if (value == getFillExtrusionOpacity(klass)) + return; + impl->paint.set(value, klass); + impl->observer->onLayerPaintPropertyChanged(*this); +} + +PropertyValue FillExtrusionLayer::getDefaultFillExtrusionColor() { + return { Color::black() }; +} + +PropertyValue FillExtrusionLayer::getFillExtrusionColor(const optional& klass) const { + return impl->paint.get(klass); +} + +void FillExtrusionLayer::setFillExtrusionColor(PropertyValue value, const optional& klass) { + if (value == getFillExtrusionColor(klass)) + return; + impl->paint.set(value, klass); + impl->observer->onLayerPaintPropertyChanged(*this); +} + +PropertyValue> FillExtrusionLayer::getDefaultFillExtrusionTranslate() { + return { {{ 0, 0 }} }; +} + +PropertyValue> FillExtrusionLayer::getFillExtrusionTranslate(const optional& klass) const { + return impl->paint.get(klass); +} + +void FillExtrusionLayer::setFillExtrusionTranslate(PropertyValue> value, const optional& klass) { + if (value == getFillExtrusionTranslate(klass)) + return; + impl->paint.set(value, klass); + impl->observer->onLayerPaintPropertyChanged(*this); +} + +PropertyValue FillExtrusionLayer::getDefaultFillExtrusionTranslateAnchor() { + return { TranslateAnchorType::Map }; +} + +PropertyValue FillExtrusionLayer::getFillExtrusionTranslateAnchor(const optional& klass) const { + return impl->paint.get(klass); +} + +void FillExtrusionLayer::setFillExtrusionTranslateAnchor(PropertyValue value, const optional& klass) { + if (value == getFillExtrusionTranslateAnchor(klass)) + return; + impl->paint.set(value, klass); + impl->observer->onLayerPaintPropertyChanged(*this); +} + +PropertyValue FillExtrusionLayer::getDefaultFillExtrusionPattern() { + return { "" }; +} + +PropertyValue FillExtrusionLayer::getFillExtrusionPattern(const optional& klass) const { + return impl->paint.get(klass); +} + +void FillExtrusionLayer::setFillExtrusionPattern(PropertyValue value, const optional& klass) { + if (value == getFillExtrusionPattern(klass)) + return; + impl->paint.set(value, klass); + impl->observer->onLayerPaintPropertyChanged(*this); +} + +PropertyValue FillExtrusionLayer::getDefaultFillExtrusionHeight() { + return { 0 }; +} + +PropertyValue FillExtrusionLayer::getFillExtrusionHeight(const optional& klass) const { + return impl->paint.get(klass); +} + +void FillExtrusionLayer::setFillExtrusionHeight(PropertyValue value, const optional& klass) { + if (value == getFillExtrusionHeight(klass)) + return; + impl->paint.set(value, klass); + impl->observer->onLayerPaintPropertyChanged(*this); +} + +PropertyValue FillExtrusionLayer::getDefaultFillExtrusionBase() { + return { 0 }; +} + +PropertyValue FillExtrusionLayer::getFillExtrusionBase(const optional& klass) const { + return impl->paint.get(klass); +} + +void FillExtrusionLayer::setFillExtrusionBase(PropertyValue value, const optional& klass) { + if (value == getFillExtrusionBase(klass)) + return; + impl->paint.set(value, klass); + impl->observer->onLayerPaintPropertyChanged(*this); +} + +} // namespace style +} // namespace mbgl diff --git a/src/mbgl/style/layers/fill_extrusion_layer_impl.cpp b/src/mbgl/style/layers/fill_extrusion_layer_impl.cpp new file mode 100644 index 00000000000..239f7754d00 --- /dev/null +++ b/src/mbgl/style/layers/fill_extrusion_layer_impl.cpp @@ -0,0 +1,19 @@ +#include +#include + +namespace mbgl { +namespace style { + +void FillExtrusionLayer::Impl::cascade(const CascadeParameters&) { +} + +bool FillExtrusionLayer::Impl::evaluate(const PropertyEvaluationParameters&) { + return false; +} + +std::unique_ptr FillExtrusionLayer::Impl::createBucket(BucketParameters&) const { + return nullptr; +} + +} // namespace style +} // namespace mbgl diff --git a/src/mbgl/style/layers/fill_extrusion_layer_impl.hpp b/src/mbgl/style/layers/fill_extrusion_layer_impl.hpp new file mode 100644 index 00000000000..79ae02dd5b7 --- /dev/null +++ b/src/mbgl/style/layers/fill_extrusion_layer_impl.hpp @@ -0,0 +1,24 @@ +#pragma once + +#include +#include +#include + +namespace mbgl { +namespace style { + +class FillExtrusionLayer::Impl : public Layer::Impl { +public: + std::unique_ptr clone() const override; + std::unique_ptr cloneRef(const std::string& id) const override; + + void cascade(const CascadeParameters&) override; + bool evaluate(const PropertyEvaluationParameters&) override; + + std::unique_ptr createBucket(BucketParameters&) const override; + + FillExtrusionPaintProperties paint; +}; + +} // namespace style +} // namespace mbgl diff --git a/src/mbgl/style/layers/fill_extrusion_layer_properties.cpp b/src/mbgl/style/layers/fill_extrusion_layer_properties.cpp new file mode 100644 index 00000000000..59572bd3aba --- /dev/null +++ b/src/mbgl/style/layers/fill_extrusion_layer_properties.cpp @@ -0,0 +1,9 @@ +// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. + +#include + +namespace mbgl { +namespace style { + +} // namespace style +} // namespace mbgl diff --git a/src/mbgl/style/layers/fill_extrusion_layer_properties.hpp b/src/mbgl/style/layers/fill_extrusion_layer_properties.hpp new file mode 100644 index 00000000000..a2d01199a56 --- /dev/null +++ b/src/mbgl/style/layers/fill_extrusion_layer_properties.hpp @@ -0,0 +1,51 @@ +// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. + +#pragma once + +#include +#include +#include + +namespace mbgl { +namespace style { + +struct FillExtrusionOpacity : PaintProperty { + static float defaultValue() { return 1; } +}; + +struct FillExtrusionColor : PaintProperty { + static Color defaultValue() { return Color::black(); } +}; + +struct FillExtrusionTranslate : PaintProperty> { + static std::array defaultValue() { return {{ 0, 0 }}; } +}; + +struct FillExtrusionTranslateAnchor : PaintProperty { + static TranslateAnchorType defaultValue() { return TranslateAnchorType::Map; } +}; + +struct FillExtrusionPattern : CrossFadedPaintProperty { + static std::string defaultValue() { return ""; } +}; + +struct FillExtrusionHeight : PaintProperty { + static float defaultValue() { return 0; } +}; + +struct FillExtrusionBase : PaintProperty { + static float defaultValue() { return 0; } +}; + +class FillExtrusionPaintProperties : public PaintProperties< + FillExtrusionOpacity, + FillExtrusionColor, + FillExtrusionTranslate, + FillExtrusionTranslateAnchor, + FillExtrusionPattern, + FillExtrusionHeight, + FillExtrusionBase +> {}; + +} // namespace style +} // namespace mbgl diff --git a/src/mbgl/style/layers/layer.cpp.ejs b/src/mbgl/style/layers/layer.cpp.ejs index dcc78bafe5e..5fe78519ec4 100644 --- a/src/mbgl/style/layers/layer.cpp.ejs +++ b/src/mbgl/style/layers/layer.cpp.ejs @@ -5,8 +5,8 @@ -%> // This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. -#include _layer.hpp> -#include _layer_impl.hpp> +#include _layer.hpp> +#include _layer_impl.hpp> namespace mbgl { namespace style { diff --git a/src/mbgl/style/layers/layer_properties.cpp.ejs b/src/mbgl/style/layers/layer_properties.cpp.ejs index 3b287decc08..e5523e54398 100644 --- a/src/mbgl/style/layers/layer_properties.cpp.ejs +++ b/src/mbgl/style/layers/layer_properties.cpp.ejs @@ -5,7 +5,7 @@ -%> // This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. -#include _layer_properties.hpp> +#include _layer_properties.hpp> namespace mbgl { namespace style { diff --git a/src/mbgl/style/style.cpp b/src/mbgl/style/style.cpp index f16e8f1856c..b1cf174bdb6 100644 --- a/src/mbgl/style/style.cpp +++ b/src/mbgl/style/style.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include