diff options
author | Ivo van Dongen <info@ivovandongen.nl> | 2017-04-06 18:06:27 +0300 |
---|---|---|
committer | Ivo van Dongen <ivovandongen@users.noreply.github.com> | 2017-04-19 17:21:28 -0700 |
commit | 935cf531e43649b6374f7bd59976cf78ab69c522 (patch) | |
tree | 9e8df36920f1e6ef5023b4d4e2c3bce4a4f8d2da /src/mbgl/style/paint_property_binder.hpp | |
parent | 1ca8f4e2f324b34df229e4b47dd96db0018ea451 (diff) | |
download | qtlocation-mapboxgl-935cf531e43649b6374f7bd59976cf78ab69c522.tar.gz |
[core] property function statistics collection
Diffstat (limited to 'src/mbgl/style/paint_property_binder.hpp')
-rw-r--r-- | src/mbgl/style/paint_property_binder.hpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/mbgl/style/paint_property_binder.hpp b/src/mbgl/style/paint_property_binder.hpp index bf98e6ef9a..3915ee588b 100644 --- a/src/mbgl/style/paint_property_binder.hpp +++ b/src/mbgl/style/paint_property_binder.hpp @@ -4,6 +4,7 @@ #include <mbgl/gl/attribute.hpp> #include <mbgl/gl/uniform.hpp> #include <mbgl/util/type_list.hpp> +#include <mbgl/style/paint_property_statistics.hpp> namespace mbgl { namespace style { @@ -90,6 +91,8 @@ public: virtual float interpolationFactor(float currentZoom) const = 0; static std::unique_ptr<PaintPropertyBinder> create(const PossiblyEvaluatedPropertyValue<T>& value, float zoom, T defaultValue); + + PaintPropertyStatistics<T> statistics; }; template <class T, class A> @@ -136,7 +139,9 @@ public: } void populateVertexVector(const GeometryTileFeature& feature, std::size_t length) override { - auto value = attributeValue(function.evaluate(feature, defaultValue)); + auto evaluated = function.evaluate(feature, defaultValue); + this->statistics.add(evaluated); + auto value = attributeValue(evaluated); for (std::size_t i = vertexVector.vertexSize(); i < length; ++i) { vertexVector.emplace_back(BaseVertex { value }); } @@ -187,6 +192,8 @@ public: void populateVertexVector(const GeometryTileFeature& feature, std::size_t length) override { Range<T> range = function.evaluate(std::get<1>(coveringRanges), feature, defaultValue); + this->statistics.add(range.min); + this->statistics.add(range.max); AttributeValue value = zoomInterpolatedAttributeValue( attributeValue(range.min), attributeValue(range.max)); @@ -312,6 +319,11 @@ public: }; } + template <class P> + const auto& statistics() const { + return binders.template get<P>()->statistics; + } + private: Binders binders; }; |