diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2018-07-24 10:09:25 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2018-07-24 11:08:40 -0700 |
commit | f6659c729f29fe65789ee08d50d438cf05623f6f (patch) | |
tree | 8c13dfd5a61305911d775e58056d7f9d3ade724b /src/mbgl/renderer/buckets | |
parent | 2bbc79206073d260863c887a95ee4ba25bc45910 (diff) | |
download | qtlocation-mapboxgl-f6659c729f29fe65789ee08d50d438cf05623f6f.tar.gz |
[core] Use hand-rolled RTTI
Diffstat (limited to 'src/mbgl/renderer/buckets')
-rw-r--r-- | src/mbgl/renderer/buckets/circle_bucket.cpp | 3 | ||||
-rw-r--r-- | src/mbgl/renderer/buckets/circle_bucket.hpp | 5 | ||||
-rw-r--r-- | src/mbgl/renderer/buckets/fill_bucket.cpp | 3 | ||||
-rw-r--r-- | src/mbgl/renderer/buckets/fill_bucket.hpp | 5 | ||||
-rw-r--r-- | src/mbgl/renderer/buckets/fill_extrusion_bucket.cpp | 3 | ||||
-rw-r--r-- | src/mbgl/renderer/buckets/fill_extrusion_bucket.hpp | 5 | ||||
-rw-r--r-- | src/mbgl/renderer/buckets/heatmap_bucket.cpp | 3 | ||||
-rw-r--r-- | src/mbgl/renderer/buckets/heatmap_bucket.hpp | 5 | ||||
-rw-r--r-- | src/mbgl/renderer/buckets/hillshade_bucket.cpp | 8 | ||||
-rw-r--r-- | src/mbgl/renderer/buckets/hillshade_bucket.hpp | 5 | ||||
-rw-r--r-- | src/mbgl/renderer/buckets/line_bucket.cpp | 3 | ||||
-rw-r--r-- | src/mbgl/renderer/buckets/line_bucket.hpp | 5 | ||||
-rw-r--r-- | src/mbgl/renderer/buckets/raster_bucket.cpp | 10 | ||||
-rw-r--r-- | src/mbgl/renderer/buckets/raster_bucket.hpp | 5 | ||||
-rw-r--r-- | src/mbgl/renderer/buckets/symbol_bucket.cpp | 3 | ||||
-rw-r--r-- | src/mbgl/renderer/buckets/symbol_bucket.hpp | 5 |
16 files changed, 64 insertions, 12 deletions
diff --git a/src/mbgl/renderer/buckets/circle_bucket.cpp b/src/mbgl/renderer/buckets/circle_bucket.cpp index c442b661de..d07c1f8dbe 100644 --- a/src/mbgl/renderer/buckets/circle_bucket.cpp +++ b/src/mbgl/renderer/buckets/circle_bucket.cpp @@ -11,7 +11,8 @@ namespace mbgl { using namespace style; CircleBucket::CircleBucket(const BucketParameters& parameters, const std::vector<const RenderLayer*>& layers) - : mode(parameters.mode) { + : Bucket(LayerType::Circle), + mode(parameters.mode) { for (const auto& layer : layers) { paintPropertyBinders.emplace( std::piecewise_construct, diff --git a/src/mbgl/renderer/buckets/circle_bucket.hpp b/src/mbgl/renderer/buckets/circle_bucket.hpp index 78b6351bcb..3c5f96fb15 100644 --- a/src/mbgl/renderer/buckets/circle_bucket.hpp +++ b/src/mbgl/renderer/buckets/circle_bucket.hpp @@ -37,4 +37,9 @@ public: const MapMode mode; }; +template <> +inline bool Bucket::is<CircleBucket>() const { + return layerType == style::LayerType::Circle; +} + } // namespace mbgl diff --git a/src/mbgl/renderer/buckets/fill_bucket.cpp b/src/mbgl/renderer/buckets/fill_bucket.cpp index 110db887a1..14be98c3af 100644 --- a/src/mbgl/renderer/buckets/fill_bucket.cpp +++ b/src/mbgl/renderer/buckets/fill_bucket.cpp @@ -27,7 +27,8 @@ using namespace style; struct GeometryTooLongException : std::exception {}; -FillBucket::FillBucket(const BucketParameters& parameters, const std::vector<const RenderLayer*>& layers) { +FillBucket::FillBucket(const BucketParameters& parameters, const std::vector<const RenderLayer*>& layers) + : Bucket(LayerType::Fill) { for (const auto& layer : layers) { paintPropertyBinders.emplace( std::piecewise_construct, diff --git a/src/mbgl/renderer/buckets/fill_bucket.hpp b/src/mbgl/renderer/buckets/fill_bucket.hpp index a50e1971f5..20b65da39c 100644 --- a/src/mbgl/renderer/buckets/fill_bucket.hpp +++ b/src/mbgl/renderer/buckets/fill_bucket.hpp @@ -39,4 +39,9 @@ public: std::map<std::string, FillProgram::PaintPropertyBinders> paintPropertyBinders; }; +template <> +inline bool Bucket::is<FillBucket>() const { + return layerType == style::LayerType::Fill; +} + } // namespace mbgl diff --git a/src/mbgl/renderer/buckets/fill_extrusion_bucket.cpp b/src/mbgl/renderer/buckets/fill_extrusion_bucket.cpp index 4fcc761280..c6dba38db1 100644 --- a/src/mbgl/renderer/buckets/fill_extrusion_bucket.cpp +++ b/src/mbgl/renderer/buckets/fill_extrusion_bucket.cpp @@ -34,7 +34,8 @@ using namespace style; struct GeometryTooLongException : std::exception {}; -FillExtrusionBucket::FillExtrusionBucket(const BucketParameters& parameters, const std::vector<const RenderLayer*>& layers) { +FillExtrusionBucket::FillExtrusionBucket(const BucketParameters& parameters, const std::vector<const RenderLayer*>& layers) + : Bucket(LayerType::FillExtrusion) { for (const auto& layer : layers) { paintPropertyBinders.emplace(std::piecewise_construct, std::forward_as_tuple(layer->getID()), diff --git a/src/mbgl/renderer/buckets/fill_extrusion_bucket.hpp b/src/mbgl/renderer/buckets/fill_extrusion_bucket.hpp index d57265ab16..ed98e01292 100644 --- a/src/mbgl/renderer/buckets/fill_extrusion_bucket.hpp +++ b/src/mbgl/renderer/buckets/fill_extrusion_bucket.hpp @@ -34,4 +34,9 @@ public: std::unordered_map<std::string, FillExtrusionProgram::PaintPropertyBinders> paintPropertyBinders; }; +template <> +inline bool Bucket::is<FillExtrusionBucket>() const { + return layerType == style::LayerType::FillExtrusion; +} + } // namespace mbgl diff --git a/src/mbgl/renderer/buckets/heatmap_bucket.cpp b/src/mbgl/renderer/buckets/heatmap_bucket.cpp index a185e04ad2..eff0c60280 100644 --- a/src/mbgl/renderer/buckets/heatmap_bucket.cpp +++ b/src/mbgl/renderer/buckets/heatmap_bucket.cpp @@ -11,7 +11,8 @@ namespace mbgl { using namespace style; HeatmapBucket::HeatmapBucket(const BucketParameters& parameters, const std::vector<const RenderLayer*>& layers) - : mode(parameters.mode) { + : Bucket(LayerType::Heatmap), + mode(parameters.mode) { for (const auto& layer : layers) { paintPropertyBinders.emplace( std::piecewise_construct, diff --git a/src/mbgl/renderer/buckets/heatmap_bucket.hpp b/src/mbgl/renderer/buckets/heatmap_bucket.hpp index 3b9f1edb81..86b6f10296 100644 --- a/src/mbgl/renderer/buckets/heatmap_bucket.hpp +++ b/src/mbgl/renderer/buckets/heatmap_bucket.hpp @@ -37,4 +37,9 @@ public: const MapMode mode; }; +template <> +inline bool Bucket::is<HeatmapBucket>() const { + return layerType == style::LayerType::Heatmap; +} + } // namespace mbgl diff --git a/src/mbgl/renderer/buckets/hillshade_bucket.cpp b/src/mbgl/renderer/buckets/hillshade_bucket.cpp index 00b9536894..3ca217a840 100644 --- a/src/mbgl/renderer/buckets/hillshade_bucket.cpp +++ b/src/mbgl/renderer/buckets/hillshade_bucket.cpp @@ -8,10 +8,14 @@ namespace mbgl { using namespace style; -HillshadeBucket::HillshadeBucket(PremultipliedImage&& image_, Tileset::DEMEncoding encoding): demdata(image_, encoding) { +HillshadeBucket::HillshadeBucket(PremultipliedImage&& image_, Tileset::DEMEncoding encoding) + : Bucket(LayerType::Hillshade), + demdata(image_, encoding) { } -HillshadeBucket::HillshadeBucket(DEMData&& demdata_) : demdata(std::move(demdata_)) { +HillshadeBucket::HillshadeBucket(DEMData&& demdata_) + : Bucket(LayerType::Hillshade), + demdata(std::move(demdata_)) { } const DEMData& HillshadeBucket::getDEMData() const { diff --git a/src/mbgl/renderer/buckets/hillshade_bucket.hpp b/src/mbgl/renderer/buckets/hillshade_bucket.hpp index 5335f7ceda..c9e435c661 100644 --- a/src/mbgl/renderer/buckets/hillshade_bucket.hpp +++ b/src/mbgl/renderer/buckets/hillshade_bucket.hpp @@ -56,4 +56,9 @@ private: bool prepared = false; }; +template <> +inline bool Bucket::is<HillshadeBucket>() const { + return layerType == style::LayerType::Hillshade; +} + } // namespace mbgl diff --git a/src/mbgl/renderer/buckets/line_bucket.cpp b/src/mbgl/renderer/buckets/line_bucket.cpp index a96518df38..a10551a7d2 100644 --- a/src/mbgl/renderer/buckets/line_bucket.cpp +++ b/src/mbgl/renderer/buckets/line_bucket.cpp @@ -14,7 +14,8 @@ using namespace style; LineBucket::LineBucket(const BucketParameters& parameters, const std::vector<const RenderLayer*>& layers, const style::LineLayoutProperties::Unevaluated& layout_) - : layout(layout_.evaluate(PropertyEvaluationParameters(parameters.tileID.overscaledZ))), + : Bucket(LayerType::Line), + layout(layout_.evaluate(PropertyEvaluationParameters(parameters.tileID.overscaledZ))), overscaling(parameters.tileID.overscaleFactor()), zoom(parameters.tileID.overscaledZ) { for (const auto& layer : layers) { diff --git a/src/mbgl/renderer/buckets/line_bucket.hpp b/src/mbgl/renderer/buckets/line_bucket.hpp index 4fb77c377e..8fe7184941 100644 --- a/src/mbgl/renderer/buckets/line_bucket.hpp +++ b/src/mbgl/renderer/buckets/line_bucket.hpp @@ -64,4 +64,9 @@ private: float getLineWidth(const RenderLineLayer& layer) const; }; +template <> +inline bool Bucket::is<LineBucket>() const { + return layerType == style::LayerType::Line; +} + } // namespace mbgl diff --git a/src/mbgl/renderer/buckets/raster_bucket.cpp b/src/mbgl/renderer/buckets/raster_bucket.cpp index a66dd42d74..45cf351d8e 100644 --- a/src/mbgl/renderer/buckets/raster_bucket.cpp +++ b/src/mbgl/renderer/buckets/raster_bucket.cpp @@ -7,12 +7,14 @@ namespace mbgl { using namespace style; -RasterBucket::RasterBucket(PremultipliedImage&& image_) { - image = std::make_shared<PremultipliedImage>(std::move(image_)); +RasterBucket::RasterBucket(PremultipliedImage&& image_) + : Bucket(LayerType::Raster), + image(std::make_shared<PremultipliedImage>(std::move(image_))) { } -RasterBucket::RasterBucket(std::shared_ptr<PremultipliedImage> image_): image(image_) { - +RasterBucket::RasterBucket(std::shared_ptr<PremultipliedImage> image_) + : Bucket(LayerType::Raster), + image(image_) { } void RasterBucket::upload(gl::Context& context) { diff --git a/src/mbgl/renderer/buckets/raster_bucket.hpp b/src/mbgl/renderer/buckets/raster_bucket.hpp index 3800eadec8..84b618a83d 100644 --- a/src/mbgl/renderer/buckets/raster_bucket.hpp +++ b/src/mbgl/renderer/buckets/raster_bucket.hpp @@ -38,4 +38,9 @@ public: optional<gl::IndexBuffer<gl::Triangles>> indexBuffer; }; +template <> +inline bool Bucket::is<RasterBucket>() const { + return layerType == style::LayerType::Raster; +} + } // namespace mbgl diff --git a/src/mbgl/renderer/buckets/symbol_bucket.cpp b/src/mbgl/renderer/buckets/symbol_bucket.cpp index 51fcd2437c..0a1530ae74 100644 --- a/src/mbgl/renderer/buckets/symbol_bucket.cpp +++ b/src/mbgl/renderer/buckets/symbol_bucket.cpp @@ -20,7 +20,8 @@ SymbolBucket::SymbolBucket(style::SymbolLayoutProperties::PossiblyEvaluated layo bool sortFeaturesByY_, const std::string bucketName_, const std::vector<SymbolInstance>&& symbolInstances_) - : layout(std::move(layout_)), + : Bucket(LayerType::Symbol), + layout(std::move(layout_)), sdfIcons(sdfIcons_), iconsNeedLinear(iconsNeedLinear_ || iconSize.isDataDriven() || !iconSize.isZoomConstant()), sortFeaturesByY(sortFeaturesByY_), diff --git a/src/mbgl/renderer/buckets/symbol_bucket.hpp b/src/mbgl/renderer/buckets/symbol_bucket.hpp index e4aaf5ba30..4f01cf4e1c 100644 --- a/src/mbgl/renderer/buckets/symbol_bucket.hpp +++ b/src/mbgl/renderer/buckets/symbol_bucket.hpp @@ -138,4 +138,9 @@ public: std::shared_ptr<std::vector<size_t>> featureSortOrder; }; +template <> +inline bool Bucket::is<SymbolBucket>() const { + return layerType == style::LayerType::Symbol; +} + } // namespace mbgl |