MapLibre Native Core
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
style.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <mbgl/map/camera.hpp>
4 #include <mbgl/style/image.hpp>
6 #include <mbgl/util/geo.hpp>
8 
9 #include <string>
10 #include <vector>
11 #include <memory>
12 
13 namespace mbgl {
14 
15 class FileSource;
16 
17 namespace style {
18 
19 class Light;
20 class Source;
21 class Layer;
22 
23 class Style {
24 public:
25  Style(std::shared_ptr<FileSource>, float pixelRatio);
26  ~Style();
27 
28  void loadJSON(const std::string&);
29  void loadURL(const std::string&);
30 
33 
34  // Defaults
37 
38  // TransitionOptions
41 
42  // Light
44  const Light* getLight() const;
45 
46  void setLight(std::unique_ptr<Light>);
47 
48  // Images
49  std::optional<Image> getImage(const std::string&) const;
50  void addImage(std::unique_ptr<Image>);
51  void removeImage(const std::string&);
52 
53  // Sources
54  std::vector< Source*> getSources();
55  std::vector<const Source*> getSources() const;
56 
58  const Source* getSource(const std::string&) const;
59 
60  void addSource(std::unique_ptr<Source>);
61  std::unique_ptr<Source> removeSource(const std::string& sourceID);
62 
63  // Layers
64  std::vector< Layer*> getLayers();
65  std::vector<const Layer*> getLayers() const;
66 
67  Layer* getLayer(const std::string&);
68  const Layer* getLayer(const std::string&) const;
69 
70  void addLayer(std::unique_ptr<Layer>, const std::optional<std::string>& beforeLayerID = std::nullopt);
71  std::unique_ptr<Layer> removeLayer(const std::string& layerID);
72 
73  // Private implementation
74  class Impl;
75  const std::unique_ptr<Impl> impl;
76 };
77 
78 } // namespace style
79 } // namespace mbgl
std::string getURL() const
const Source * getSource(const std::string &) const
Style(std::shared_ptr< FileSource >, float pixelRatio)
std::unique_ptr< Source > removeSource(const std::string &sourceID)
Source * getSource(const std::string &)
std::vector< Source * > getSources()
std::string getJSON() const
CameraOptions getDefaultCamera() const
const Light * getLight() const
std::string getName() const
Layer * getLayer(const std::string &)
void removeImage(const std::string &)
void loadURL(const std::string &)
const std::unique_ptr< Impl > impl
Definition: style.hpp:74
void addSource(std::unique_ptr< Source >)
std::vector< Layer * > getLayers()
void loadJSON(const std::string &)
std::vector< const Layer * > getLayers() const
void setTransitionOptions(const TransitionOptions &)
TransitionOptions getTransitionOptions() const
void setLight(std::unique_ptr< Light >)
std::vector< const Source * > getSources() const
std::unique_ptr< Layer > removeLayer(const std::string &layerID)
const Layer * getLayer(const std::string &) const
std::optional< Image > getImage(const std::string &) const
void addImage(std::unique_ptr< Image >)
void addLayer(std::unique_ptr< Layer >, const std::optional< std::string > &beforeLayerID=std::nullopt)
std::unique_ptr< Expression > string(std::unique_ptr< Expression >, std::unique_ptr< Expression > def=nullptr)
Definition: actor.hpp:15