diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2016-10-28 16:39:50 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2017-02-02 09:44:42 -0800 |
commit | 141e995806576364d185626176c1b993fc519291 (patch) | |
tree | ecdc41fc7699f2a1a9e9456157348451ebe99597 /src/mbgl/style/layers/layer.cpp.ejs | |
parent | 6a6bddb4537004cc1bfc506e76772de74d33f3f7 (diff) | |
download | qtlocation-mapboxgl-141e995806576364d185626176c1b993fc519291.tar.gz |
[core] Add support for data-driven styling
Diffstat (limited to 'src/mbgl/style/layers/layer.cpp.ejs')
-rw-r--r-- | src/mbgl/style/layers/layer.cpp.ejs | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/mbgl/style/layers/layer.cpp.ejs b/src/mbgl/style/layers/layer.cpp.ejs index e730e3a29b..4a91a5c7e3 100644 --- a/src/mbgl/style/layers/layer.cpp.ejs +++ b/src/mbgl/style/layers/layer.cpp.ejs @@ -86,15 +86,15 @@ const Filter& <%- camelize(type) %>Layer::getFilter() const { // Layout properties <% for (const property of layoutProperties) { -%> -PropertyValue<<%- propertyType(property) %>> <%- camelize(type) %>Layer::getDefault<%- camelize(property.name) %>() { +<%- propertyValueType(property) %> <%- camelize(type) %>Layer::getDefault<%- camelize(property.name) %>() { return <%- camelize(property.name) %>::defaultValue(); } -PropertyValue<<%- propertyType(property) %>> <%- camelize(type) %>Layer::get<%- camelize(property.name) %>() const { +<%- propertyValueType(property) %> <%- camelize(type) %>Layer::get<%- camelize(property.name) %>() const { return impl->layout.unevaluated.get<<%- camelize(property.name) %>>(); } -void <%- camelize(type) %>Layer::set<%- camelize(property.name) %>(PropertyValue<<%- propertyType(property) %>> value) { +void <%- camelize(type) %>Layer::set<%- camelize(property.name) %>(<%- propertyValueType(property) %> value) { if (value == get<%- camelize(property.name) %>()) return; impl->layout.unevaluated.get<<%- camelize(property.name) %>>() = value; @@ -104,19 +104,27 @@ void <%- camelize(type) %>Layer::set<%- camelize(property.name) %>(PropertyValue // Paint properties <% for (const property of paintProperties) { %> -PropertyValue<<%- propertyType(property) %>> <%- camelize(type) %>Layer::getDefault<%- camelize(property.name) %>() { +<%- propertyValueType(property) %> <%- camelize(type) %>Layer::getDefault<%- camelize(property.name) %>() { return { <%- defaultValue(property) %> }; } -PropertyValue<<%- propertyType(property) %>> <%- camelize(type) %>Layer::get<%- camelize(property.name) %>(const optional<std::string>& klass) const { +<%- propertyValueType(property) %> <%- camelize(type) %>Layer::get<%- camelize(property.name) %>(const optional<std::string>& klass) const { return impl->paint.get<<%- camelize(property.name) %>>(klass); } -void <%- camelize(type) %>Layer::set<%- camelize(property.name) %>(PropertyValue<<%- propertyType(property) %>> value, const optional<std::string>& klass) { +void <%- camelize(type) %>Layer::set<%- camelize(property.name) %>(<%- propertyValueType(property) %> value, const optional<std::string>& klass) { if (value == get<%- camelize(property.name) %>(klass)) return; impl->paint.set<<%- camelize(property.name) %>>(value, klass); +<% if (isDataDriven(property)) { -%> + if (value.isDataDriven()) { + impl->observer->onLayerDataDrivenPaintPropertyChanged(*this); + } else { + impl->observer->onLayerPaintPropertyChanged(*this); + } +<% } else { -%> impl->observer->onLayerPaintPropertyChanged(*this); +<% } -%> } <% } -%> |