MapLibre Native Core
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
custom_layer.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <mbgl/style/layer.hpp>
4 
5 #include <array>
6 
7 namespace mbgl {
8 namespace style {
9 
14  double width;
15  double height;
16  double latitude;
17  double longitude;
18  double zoom;
19  double bearing;
20  double pitch;
21  double fieldOfView;
22  std::array<double, 16> projectionMatrix;
23 };
24 
26 public:
27  virtual ~CustomLayerHost() = default;
35  virtual void initialize() = 0;
36 
45  virtual void render(const CustomLayerRenderParameters&) = 0;
46 
53  virtual void contextLost() = 0;
54 
61  virtual void deinitialize() = 0;
62 };
63 
64 class CustomLayer final : public Layer {
65 public:
67  std::unique_ptr<CustomLayerHost> host);
68 
69  CustomLayer(const CustomLayer&) = delete;
70  ~CustomLayer() final;
71  class Impl;
72  const Impl& impl() const;
73  Mutable<Impl> mutableImpl() const;
74 
75 private:
76  std::optional<conversion::Error> setPropertyInternal(const std::string& name,
77  const conversion::Convertible& value) final;
78  StyleProperty getProperty(const std::string&) const final;
79  std::unique_ptr<Layer> cloneRef(const std::string& id) const final;
80  Mutable<Layer::Impl> mutableBaseImpl() const final;
81 };
82 
83 } // namespace style
84 } // namespace mbgl
virtual void deinitialize()=0
virtual void initialize()=0
virtual void render(const CustomLayerRenderParameters &)=0
virtual void contextLost()=0
virtual ~CustomLayerHost()=default
const Impl & impl() const
Mutable< Impl > mutableImpl() const
CustomLayer(const CustomLayer &)=delete
CustomLayer(const std::string &id, std::unique_ptr< CustomLayerHost > host)
Generic representation of a style property.
std::unique_ptr< Expression > string(std::unique_ptr< Expression >, std::unique_ptr< Expression > def=nullptr)
Definition: actor.hpp:15
Definition: tile_id.hpp:256
std::array< double, 16 > projectionMatrix