diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2016-08-29 12:00:08 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2016-09-06 14:29:22 -0700 |
commit | fe2a26225f3746381b36ad8b6c6a3ce7727bf655 (patch) | |
tree | 62507ffd6a28654a377469d35e21719ff7a12fdc /src/mbgl/style/layers/layer.cpp.ejs | |
parent | 3a48c60813b18c092c8d8d75c80a318bdd8859bb (diff) | |
download | qtlocation-mapboxgl-fe2a26225f3746381b36ad8b6c6a3ce7727bf655.tar.gz |
[core, ios, android, qt] Observe style layer mutations rather than requiring SDKs to use Map::update
This paves the way for updates to filter and layout properties to trigger a source reload, without each SDK having to participate in the implementation.
Diffstat (limited to 'src/mbgl/style/layers/layer.cpp.ejs')
-rw-r--r-- | src/mbgl/style/layers/layer.cpp.ejs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/mbgl/style/layers/layer.cpp.ejs b/src/mbgl/style/layers/layer.cpp.ejs index 75a8de8e77..237a68aadf 100644 --- a/src/mbgl/style/layers/layer.cpp.ejs +++ b/src/mbgl/style/layers/layer.cpp.ejs @@ -65,6 +65,7 @@ const std::string& <%- camelize(type) %>Layer::getSourceLayer() const { void <%- camelize(type) %>Layer::setFilter(const Filter& filter) { impl->filter = filter; + impl->observer->onLayerFilterChanged(*this); } const Filter& <%- camelize(type) %>Layer::getFilter() const { @@ -85,7 +86,10 @@ PropertyValue<<%- propertyType(property) %>> <%- camelize(type) %>Layer::get<%- } void <%- camelize(type) %>Layer::set<%- camelize(property.name) %>(PropertyValue<<%- propertyType(property) %>> value) { + if (value == get<%- camelize(property.name) %>()) + return; impl->layout.<%- camelizeWithLeadingLowercase(property.name) %>.set(value); + impl->observer->onLayerLayoutPropertyChanged(*this); } <% } -%> @@ -100,7 +104,10 @@ PropertyValue<<%- propertyType(property) %>> <%- camelize(type) %>Layer::get<%- } void <%- camelize(type) %>Layer::set<%- camelize(property.name) %>(PropertyValue<<%- propertyType(property) %>> value, const optional<std::string>& klass) { + if (value == get<%- camelize(property.name) %>(klass)) + return; impl->paint.<%- camelizeWithLeadingLowercase(property.name) %>.set(value, klass); + impl->observer->onLayerPaintPropertyChanged(*this); } <% } -%> |