From 7d8b4dc6c0714aa43a85a56ea32fa5590dd843e6 Mon Sep 17 00:00:00 2001 From: Bruno de Oliveira Abinader Date: Mon, 13 Jul 2015 03:15:14 +0300 Subject: [PATCH] s/properties/propertyValues/ This list stores different values for the same property, but the property itself remains the same. --- src/mbgl/style/applied_class_properties.cpp | 14 +++++++------- src/mbgl/style/applied_class_properties.hpp | 4 ++-- src/mbgl/style/style_layer.cpp | 5 ++--- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/mbgl/style/applied_class_properties.cpp b/src/mbgl/style/applied_class_properties.cpp index d42102b2a..f0680dd0f 100644 --- a/src/mbgl/style/applied_class_properties.cpp +++ b/src/mbgl/style/applied_class_properties.cpp @@ -10,15 +10,15 @@ AppliedClassProperty::AppliedClassProperty(ClassID class_id, TimePoint begin_, T // Returns the ID of the most recent ClassID AppliedClassProperties::mostRecent() const { - return properties.size() ? properties.back().name : ClassID::Fallback; + return propertyValues.empty() ? ClassID::Fallback : propertyValues.back().name; } void AppliedClassProperties::add(ClassID class_id, TimePoint begin, TimePoint end, const PropertyValue &value) { - properties.emplace_back(class_id, begin, end, value); + propertyValues.emplace_back(class_id, begin, end, value); } bool AppliedClassProperties::hasTransitions() const { - return properties.size() > 1; + return propertyValues.size() > 1; } // Erase all items in the property list that are before a completed transition. @@ -26,19 +26,19 @@ bool AppliedClassProperties::hasTransitions() const { void AppliedClassProperties::cleanup(TimePoint now) { // Iterate backwards, but without using the rbegin/rend interface since we need forward // iterators to use .erase(). - for (auto it = properties.end(), begin = properties.begin(); it != begin;) { + for (auto it = propertyValues.end(), begin = propertyValues.begin(); it != begin;) { // If the property is finished, break iteration and delete all remaining items. if ((--it)->end <= now) { // Removes all items that precede the current iterator, but *not* the element currently // pointed to by the iterator. This preserves the last completed transition as the // first element in the property list. - properties.erase(begin, it); + propertyValues.erase(begin, it); // Also erase the pivot element if it's a fallback value. This means we can remove the // entire applied properties object as well, because we already have the fallback // value set as the default. if (it->name == ClassID::Fallback) { - properties.erase(it); + propertyValues.erase(it); } break; } @@ -46,7 +46,7 @@ void AppliedClassProperties::cleanup(TimePoint now) { } bool AppliedClassProperties::empty() const { - return properties.empty(); + return propertyValues.empty(); } } diff --git a/src/mbgl/style/applied_class_properties.hpp b/src/mbgl/style/applied_class_properties.hpp index 6a0d2a6fb..350bb846c 100644 --- a/src/mbgl/style/applied_class_properties.hpp +++ b/src/mbgl/style/applied_class_properties.hpp @@ -23,14 +23,14 @@ public: class AppliedClassProperties { public: - std::list properties; + std::list propertyValues; public: // Returns the ID of the most recent ClassID mostRecent() const; void add(ClassID class_id, TimePoint begin, TimePoint end, const PropertyValue &value); - bool hasTransitions() const; void cleanup(TimePoint now); + bool hasTransitions() const; bool empty() const; }; diff --git a/src/mbgl/style/style_layer.cpp b/src/mbgl/style/style_layer.cpp index c29c3ee28..7f9c7ecbf 100644 --- a/src/mbgl/style/style_layer.cpp +++ b/src/mbgl/style/style_layer.cpp @@ -140,7 +140,7 @@ void StyleLayer::applyStyleProperty(PropertyKey key, T &target, const float z, c AppliedClassProperties &applied = it->second; // Iterate through all properties that we need to apply in order. const PropertyEvaluator evaluator(z, zoomHistory); - for (auto& property : applied.properties) { + for (auto& property : applied.propertyValues) { if (now >= property.begin) { // We overwrite the current property with the new value. target = mapbox::util::apply_visitor(evaluator, property.value); @@ -158,7 +158,7 @@ void StyleLayer::applyTransitionedStyleProperty(PropertyKey key, T &target, cons AppliedClassProperties &applied = it->second; // Iterate through all properties that we need to apply in order. const PropertyEvaluator evaluator(z, zoomHistory); - for (auto& property : applied.properties) { + for (auto& property : applied.propertyValues) { if (now >= property.end) { // We overwrite the current property with the new value. target = mapbox::util::apply_visitor(evaluator, property.value); @@ -271,7 +271,6 @@ bool StyleLayer::hasTransitions() const { return false; } - void StyleLayer::cleanupAppliedStyleProperties(TimePoint now) { for (auto it = appliedStyle.begin(); it != appliedStyle.end();) { AppliedClassProperties& appliedPropertyValues = it->second;