summaryrefslogtreecommitdiff
path: root/src/mbgl/renderer/bucket.hpp
diff options
context:
space:
mode:
authorMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2018-12-21 14:14:03 +0200
committerMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2019-01-04 11:51:33 +0200
commitc621b8100d8f75a77789371d8c33a7f5dff18651 (patch)
treec9b1290a8496d28f0f55f91ae79d58da0ed945e6 /src/mbgl/renderer/bucket.hpp
parent4e86bca5abecdaa6dcdc361421fe73655e7e1b69 (diff)
downloadqtlocation-mapboxgl-c621b8100d8f75a77789371d8c33a7f5dff18651.tar.gz
[core] Drop LayerType
Drop LayerType and its remaining usages. The generic code should be layer type agnostic.
Diffstat (limited to 'src/mbgl/renderer/bucket.hpp')
-rw-r--r--src/mbgl/renderer/bucket.hpp32
1 files changed, 10 insertions, 22 deletions
diff --git a/src/mbgl/renderer/bucket.hpp b/src/mbgl/renderer/bucket.hpp
index 7ccab8672d..6a7944a395 100644
--- a/src/mbgl/renderer/bucket.hpp
+++ b/src/mbgl/renderer/bucket.hpp
@@ -1,10 +1,9 @@
#pragma once
-#include <mbgl/util/noncopyable.hpp>
#include <mbgl/tile/geometry_tile_data.hpp>
-#include <mbgl/style/layer_type.hpp>
#include <mbgl/style/image_impl.hpp>
#include <mbgl/renderer/image_atlas.hpp>
+#include <mbgl/style/layer_impl.hpp>
#include <atomic>
namespace mbgl {
@@ -17,29 +16,13 @@ class RenderLayer;
class PatternDependency;
using PatternLayerMap = std::unordered_map<std::string, PatternDependency>;
-class Bucket : private util::noncopyable {
+class Bucket {
public:
- Bucket(style::LayerType layerType_)
- : layerType(layerType_) {
- }
+ Bucket(const Bucket&) = delete;
+ Bucket& operator=(const Bucket&) = delete;
virtual ~Bucket() = default;
- // Check whether this bucket is of the given subtype.
- template <class T>
- bool is() const;
-
- // Dynamically cast this bucket to the given subtype.
- template <class T>
- T* as() {
- return is<T>() ? reinterpret_cast<T*>(this) : nullptr;
- }
-
- template <class T>
- const T* as() const {
- return is<T>() ? reinterpret_cast<const T*>(this) : nullptr;
- }
-
// Feature geometries are also used to populate the feature index.
// Obtaining these is a costly operation, so we do it only once, and
// pass-by-const-ref the geometries as a second parameter.
@@ -64,9 +47,14 @@ public:
bool needsUpload() const {
return hasData() && !uploaded;
}
+ // Returns true if this bucket fits the given layer; returns false otherwise.
+ // Implementations of this class check at least that this bucket has
+ // the same layer type with the given layer, but extra checks are also
+ // possible.
+ virtual bool supportsLayer(const style::Layer::Impl&) const = 0;
protected:
- style::LayerType layerType;
+ Bucket() = default;
std::atomic<bool> uploaded { false };
};