From f034a028be833aa7ba68f4996c35da6fe781238c Mon Sep 17 00:00:00 2001 From: Bruno de Oliveira Abinader Date: Tue, 14 Jul 2015 19:04:31 +0300 Subject: [PATCH] s/AppliedClassProperties/AppliedClassPropertyValues/ This class stores a list of property values which belongs to the same property. --- src/mbgl/style/applied_class_properties.cpp | 12 ++++++------ src/mbgl/style/applied_class_properties.hpp | 8 ++++---- src/mbgl/style/style_layer.cpp | 14 +++++++------- src/mbgl/style/style_layer.hpp | 2 +- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/mbgl/style/applied_class_properties.cpp b/src/mbgl/style/applied_class_properties.cpp index 6df075b20..9563250ba 100644 --- a/src/mbgl/style/applied_class_properties.cpp +++ b/src/mbgl/style/applied_class_properties.cpp @@ -2,28 +2,28 @@ namespace mbgl { -AppliedClassProperty::AppliedClassProperty(ClassID class_id, const TimePoint& begin_, const TimePoint& end_, const PropertyValue &value_) +AppliedClassPropertyValue::AppliedClassPropertyValue(ClassID class_id, const TimePoint& begin_, const TimePoint& end_, const PropertyValue &value_) : name(class_id), begin(begin_), end(end_), value(value_) {} // Returns the ID of the most recent -ClassID AppliedClassProperties::mostRecent() const { +ClassID AppliedClassPropertyValues::mostRecent() const { return propertyValues.empty() ? ClassID::Fallback : propertyValues.back().name; } -void AppliedClassProperties::add(ClassID class_id, const TimePoint& begin, const TimePoint& end, const PropertyValue &value) { +void AppliedClassPropertyValues::add(ClassID class_id, const TimePoint& begin, const TimePoint& end, const PropertyValue &value) { propertyValues.emplace_back(class_id, begin, end, value); } -bool AppliedClassProperties::hasTransitions() const { +bool AppliedClassPropertyValues::hasTransitions() const { return propertyValues.size() > 1; } // Erase all items in the property list that are before a completed transition. // Then, if the only remaining property is a Fallback value, remove it too. -void AppliedClassProperties::cleanup(const TimePoint& now) { +void AppliedClassPropertyValues::cleanup(const TimePoint& now) { // Iterate backwards, but without using the rbegin/rend interface since we need forward // iterators to use .erase(). for (auto it = propertyValues.end(), begin = propertyValues.begin(); it != begin;) { @@ -45,7 +45,7 @@ void AppliedClassProperties::cleanup(const TimePoint& now) { } } -bool AppliedClassProperties::empty() const { +bool AppliedClassPropertyValues::empty() const { return propertyValues.empty(); } diff --git a/src/mbgl/style/applied_class_properties.hpp b/src/mbgl/style/applied_class_properties.hpp index fbba96614..a33e2bd62 100644 --- a/src/mbgl/style/applied_class_properties.hpp +++ b/src/mbgl/style/applied_class_properties.hpp @@ -9,9 +9,9 @@ namespace mbgl { -class AppliedClassProperty { +class AppliedClassPropertyValue { public: - AppliedClassProperty(ClassID class_id, const TimePoint& begin, const TimePoint& end, const PropertyValue &value); + AppliedClassPropertyValue(ClassID class_id, const TimePoint& begin, const TimePoint& end, const PropertyValue &value); public: const ClassID name; @@ -21,9 +21,9 @@ public: }; -class AppliedClassProperties { +class AppliedClassPropertyValues { public: - std::list propertyValues; + std::list propertyValues; public: // Returns the ID of the most recent diff --git a/src/mbgl/style/style_layer.cpp b/src/mbgl/style/style_layer.cpp index ad96c38c3..5fc6af793 100644 --- a/src/mbgl/style/style_layer.cpp +++ b/src/mbgl/style/style_layer.cpp @@ -54,7 +54,7 @@ void StyleLayer::setClasses(const std::vector &class_names, const T continue; } - AppliedClassProperties &appliedProperties = property_pair.second; + AppliedClassPropertyValues &appliedProperties = property_pair.second; // Make sure that we don't do double transitions to the fallback value. if (appliedProperties.mostRecent() != ClassID::Fallback) { // This property key hasn't been set by a previous class, so we need to add a transition @@ -93,7 +93,7 @@ void StyleLayer::applyClassProperties(const ClassID class_id, // If the most recent transition is not the one with the highest priority, create // a transition. - AppliedClassProperties &appliedProperties = appliedStyle[key]; + AppliedClassPropertyValues &appliedProperties = appliedStyle[key]; if (appliedProperties.mostRecent() != class_id) { const PropertyTransition &transition = class_properties.getTransition(key, defaultTransition); @@ -137,7 +137,7 @@ template void StyleLayer::applyStyleProperty(PropertyKey key, T &target, const float z, const TimePoint& now, const ZoomHistory &zoomHistory) { auto it = appliedStyle.find(key); if (it != appliedStyle.end()) { - AppliedClassProperties &applied = it->second; + AppliedClassPropertyValues &applied = it->second; // Iterate through all properties that we need to apply in order. const PropertyEvaluator evaluator(z, zoomHistory); for (auto& property : applied.propertyValues) { @@ -155,7 +155,7 @@ template void StyleLayer::applyTransitionedStyleProperty(PropertyKey key, T &target, const float z, const TimePoint& now, const ZoomHistory &zoomHistory) { auto it = appliedStyle.find(key); if (it != appliedStyle.end()) { - AppliedClassProperties &applied = it->second; + AppliedClassPropertyValues &applied = it->second; // Iterate through all properties that we need to apply in order. const PropertyEvaluator evaluator(z, zoomHistory); for (auto& property : applied.propertyValues) { @@ -273,10 +273,10 @@ bool StyleLayer::hasTransitions() const { void StyleLayer::cleanupAppliedStyleProperties(const TimePoint& now) { for (auto it = appliedStyle.begin(); it != appliedStyle.end();) { - AppliedClassProperties& appliedPropertyValues = it->second; - appliedPropertyValues.cleanup(now); + AppliedClassPropertyValues& values = it->second; + values.cleanup(now); // If the current properties object is empty, remove it from the map entirely. - appliedPropertyValues.empty() ? appliedStyle.erase(it++) : ++it; + values.empty() ? appliedStyle.erase(it++) : ++it; } } diff --git a/src/mbgl/style/style_layer.hpp b/src/mbgl/style/style_layer.hpp index 97bd479b2..56b8cb8f1 100644 --- a/src/mbgl/style/style_layer.hpp +++ b/src/mbgl/style/style_layer.hpp @@ -78,7 +78,7 @@ public: private: // For every property, stores a list of applied property values, with // optional transition times. - std::map appliedStyle; + std::map appliedStyle; public: // Stores the evaluated, and cascaded styling information, specific to this