1 #pragma once
2 
3 #include <mbgl/style/layer.hpp>
4 #include <mbgl/style/types.hpp>
5 #include <mbgl/style/filter.hpp>
6 
7 #include <rapidjson/writer.h>
8 #include <rapidjson/stringbuffer.h>
9 
10 #include <string>
11 #include <limits>
12 
13 namespace mbgl {
14 
15 class RenderLayer;
16 
17 namespace style {
18 
19 /**
20  * `Layer::Impl` contains the internal implementation of `Layer`: the details that need to be accessible to other parts
21  * of the code, but hidden from the public API. Like `Layer`, it is an abstract base class, with derived classes for
22  * each layer type.
23  *
24  * Members that are public in `Layer` are part of the public API for all layers.
25  * Members that are public in `FooLayer` are part of the public API for "foo" layers.
26  * Members that are public in `Layer::Impl` are part of the internal API for all layers.
27  * Members that are public in `FooLayer::Impl` are part of the internal API for "foo" layers.
28  * Members that are private in `FooLayer::Impl` are internal to "foo" layers.
29  */
30 class Layer::Impl {
31 public:
32     Impl(LayerType, std::string layerID, std::string sourceID);
33     virtual ~Impl() = default;
34 
35     Impl& operator=(const Impl&) = delete;
36 
37     // Returns true buckets if properties affecting layout have changed: i.e. filter,
38     // visibility, layout properties, or data-driven paint properties.
39     virtual bool hasLayoutDifference(const Layer::Impl&) const = 0;
40 
41     // Utility function for automatic layer grouping.
42     virtual void stringifyLayout(rapidjson::Writer<rapidjson::StringBuffer>&) const = 0;
43 
44     const LayerType type;
45     std::string id;
46     std::string source;
47     std::string sourceLayer;
48     Filter filter;
49     float minZoom = -std::numeric_limits<float>::infinity();
50     float maxZoom = std::numeric_limits<float>::infinity();
51     VisibilityType visibility = VisibilityType::Visible;
52 
53 protected:
54     Impl(const Impl&) = default;
55 };
56 
57 } // namespace style
58 } // namespace mbgl
59