1 // This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`.
2 
3 #include <mbgl/style/layers/heatmap_layer.hpp>
4 #include <mbgl/style/layers/heatmap_layer_impl.hpp>
5 #include <mbgl/style/layer_observer.hpp>
6 // for constructing default heatmap-color ramp expression from style JSON
7 #include <mbgl/style/conversion.hpp>
8 #include <mbgl/style/conversion/color_ramp_property_value.hpp>
9 #include <mbgl/style/conversion/json.hpp>
10 
11 namespace mbgl {
12 namespace style {
13 
HeatmapLayer(const std::string & layerID,const std::string & sourceID)14 HeatmapLayer::HeatmapLayer(const std::string& layerID, const std::string& sourceID)
15     : Layer(makeMutable<Impl>(LayerType::Heatmap, layerID, sourceID)) {
16 }
17 
HeatmapLayer(Immutable<Impl> impl_)18 HeatmapLayer::HeatmapLayer(Immutable<Impl> impl_)
19     : Layer(std::move(impl_)) {
20 }
21 
22 HeatmapLayer::~HeatmapLayer() = default;
23 
impl() const24 const HeatmapLayer::Impl& HeatmapLayer::impl() const {
25     return static_cast<const Impl&>(*baseImpl);
26 }
27 
mutableImpl() const28 Mutable<HeatmapLayer::Impl> HeatmapLayer::mutableImpl() const {
29     return makeMutable<Impl>(impl());
30 }
31 
cloneRef(const std::string & id_) const32 std::unique_ptr<Layer> HeatmapLayer::cloneRef(const std::string& id_) const {
33     auto impl_ = mutableImpl();
34     impl_->id = id_;
35     impl_->paint = HeatmapPaintProperties::Transitionable();
36     return std::make_unique<HeatmapLayer>(std::move(impl_));
37 }
38 
stringifyLayout(rapidjson::Writer<rapidjson::StringBuffer> &) const39 void HeatmapLayer::Impl::stringifyLayout(rapidjson::Writer<rapidjson::StringBuffer>&) const {
40 }
41 
42 // Source
43 
getSourceID() const44 const std::string& HeatmapLayer::getSourceID() const {
45     return impl().source;
46 }
47 
setSourceLayer(const std::string & sourceLayer)48 void HeatmapLayer::setSourceLayer(const std::string& sourceLayer) {
49     auto impl_ = mutableImpl();
50     impl_->sourceLayer = sourceLayer;
51     baseImpl = std::move(impl_);
52 }
53 
getSourceLayer() const54 const std::string& HeatmapLayer::getSourceLayer() const {
55     return impl().sourceLayer;
56 }
57 
58 // Filter
59 
setFilter(const Filter & filter)60 void HeatmapLayer::setFilter(const Filter& filter) {
61     auto impl_ = mutableImpl();
62     impl_->filter = filter;
63     baseImpl = std::move(impl_);
64     observer->onLayerChanged(*this);
65 }
66 
getFilter() const67 const Filter& HeatmapLayer::getFilter() const {
68     return impl().filter;
69 }
70 
71 // Visibility
72 
setVisibility(VisibilityType value)73 void HeatmapLayer::setVisibility(VisibilityType value) {
74     if (value == getVisibility())
75         return;
76     auto impl_ = mutableImpl();
77     impl_->visibility = value;
78     baseImpl = std::move(impl_);
79     observer->onLayerChanged(*this);
80 }
81 
82 // Zoom range
83 
setMinZoom(float minZoom)84 void HeatmapLayer::setMinZoom(float minZoom) {
85     auto impl_ = mutableImpl();
86     impl_->minZoom = minZoom;
87     baseImpl = std::move(impl_);
88     observer->onLayerChanged(*this);
89 }
90 
setMaxZoom(float maxZoom)91 void HeatmapLayer::setMaxZoom(float maxZoom) {
92     auto impl_ = mutableImpl();
93     impl_->maxZoom = maxZoom;
94     baseImpl = std::move(impl_);
95     observer->onLayerChanged(*this);
96 }
97 
98 // Layout properties
99 
100 
101 // Paint properties
102 
getDefaultHeatmapRadius()103 DataDrivenPropertyValue<float> HeatmapLayer::getDefaultHeatmapRadius() {
104     return { 30 };
105 }
106 
getHeatmapRadius() const107 DataDrivenPropertyValue<float> HeatmapLayer::getHeatmapRadius() const {
108     return impl().paint.template get<HeatmapRadius>().value;
109 }
110 
setHeatmapRadius(DataDrivenPropertyValue<float> value)111 void HeatmapLayer::setHeatmapRadius(DataDrivenPropertyValue<float> value) {
112     if (value == getHeatmapRadius())
113         return;
114     auto impl_ = mutableImpl();
115     impl_->paint.template get<HeatmapRadius>().value = value;
116     baseImpl = std::move(impl_);
117     observer->onLayerChanged(*this);
118 }
119 
setHeatmapRadiusTransition(const TransitionOptions & options)120 void HeatmapLayer::setHeatmapRadiusTransition(const TransitionOptions& options) {
121     auto impl_ = mutableImpl();
122     impl_->paint.template get<HeatmapRadius>().options = options;
123     baseImpl = std::move(impl_);
124 }
125 
getHeatmapRadiusTransition() const126 TransitionOptions HeatmapLayer::getHeatmapRadiusTransition() const {
127     return impl().paint.template get<HeatmapRadius>().options;
128 }
129 
getDefaultHeatmapWeight()130 DataDrivenPropertyValue<float> HeatmapLayer::getDefaultHeatmapWeight() {
131     return { 1 };
132 }
133 
getHeatmapWeight() const134 DataDrivenPropertyValue<float> HeatmapLayer::getHeatmapWeight() const {
135     return impl().paint.template get<HeatmapWeight>().value;
136 }
137 
setHeatmapWeight(DataDrivenPropertyValue<float> value)138 void HeatmapLayer::setHeatmapWeight(DataDrivenPropertyValue<float> value) {
139     if (value == getHeatmapWeight())
140         return;
141     auto impl_ = mutableImpl();
142     impl_->paint.template get<HeatmapWeight>().value = value;
143     baseImpl = std::move(impl_);
144     observer->onLayerChanged(*this);
145 }
146 
setHeatmapWeightTransition(const TransitionOptions & options)147 void HeatmapLayer::setHeatmapWeightTransition(const TransitionOptions& options) {
148     auto impl_ = mutableImpl();
149     impl_->paint.template get<HeatmapWeight>().options = options;
150     baseImpl = std::move(impl_);
151 }
152 
getHeatmapWeightTransition() const153 TransitionOptions HeatmapLayer::getHeatmapWeightTransition() const {
154     return impl().paint.template get<HeatmapWeight>().options;
155 }
156 
getDefaultHeatmapIntensity()157 PropertyValue<float> HeatmapLayer::getDefaultHeatmapIntensity() {
158     return { 1 };
159 }
160 
getHeatmapIntensity() const161 PropertyValue<float> HeatmapLayer::getHeatmapIntensity() const {
162     return impl().paint.template get<HeatmapIntensity>().value;
163 }
164 
setHeatmapIntensity(PropertyValue<float> value)165 void HeatmapLayer::setHeatmapIntensity(PropertyValue<float> value) {
166     if (value == getHeatmapIntensity())
167         return;
168     auto impl_ = mutableImpl();
169     impl_->paint.template get<HeatmapIntensity>().value = value;
170     baseImpl = std::move(impl_);
171     observer->onLayerChanged(*this);
172 }
173 
setHeatmapIntensityTransition(const TransitionOptions & options)174 void HeatmapLayer::setHeatmapIntensityTransition(const TransitionOptions& options) {
175     auto impl_ = mutableImpl();
176     impl_->paint.template get<HeatmapIntensity>().options = options;
177     baseImpl = std::move(impl_);
178 }
179 
getHeatmapIntensityTransition() const180 TransitionOptions HeatmapLayer::getHeatmapIntensityTransition() const {
181     return impl().paint.template get<HeatmapIntensity>().options;
182 }
183 
getDefaultHeatmapColor()184 ColorRampPropertyValue HeatmapLayer::getDefaultHeatmapColor() {
185     conversion::Error error;
186     std::string rawValue = R"JSON(["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"])JSON";
187     return *conversion::convertJSON<ColorRampPropertyValue>(rawValue, error);
188 }
189 
getHeatmapColor() const190 ColorRampPropertyValue HeatmapLayer::getHeatmapColor() const {
191     return impl().paint.template get<HeatmapColor>().value;
192 }
193 
setHeatmapColor(ColorRampPropertyValue value)194 void HeatmapLayer::setHeatmapColor(ColorRampPropertyValue value) {
195     if (value == getHeatmapColor())
196         return;
197     auto impl_ = mutableImpl();
198     impl_->paint.template get<HeatmapColor>().value = value;
199     baseImpl = std::move(impl_);
200     observer->onLayerChanged(*this);
201 }
202 
setHeatmapColorTransition(const TransitionOptions & options)203 void HeatmapLayer::setHeatmapColorTransition(const TransitionOptions& options) {
204     auto impl_ = mutableImpl();
205     impl_->paint.template get<HeatmapColor>().options = options;
206     baseImpl = std::move(impl_);
207 }
208 
getHeatmapColorTransition() const209 TransitionOptions HeatmapLayer::getHeatmapColorTransition() const {
210     return impl().paint.template get<HeatmapColor>().options;
211 }
212 
getDefaultHeatmapOpacity()213 PropertyValue<float> HeatmapLayer::getDefaultHeatmapOpacity() {
214     return { 1 };
215 }
216 
getHeatmapOpacity() const217 PropertyValue<float> HeatmapLayer::getHeatmapOpacity() const {
218     return impl().paint.template get<HeatmapOpacity>().value;
219 }
220 
setHeatmapOpacity(PropertyValue<float> value)221 void HeatmapLayer::setHeatmapOpacity(PropertyValue<float> value) {
222     if (value == getHeatmapOpacity())
223         return;
224     auto impl_ = mutableImpl();
225     impl_->paint.template get<HeatmapOpacity>().value = value;
226     baseImpl = std::move(impl_);
227     observer->onLayerChanged(*this);
228 }
229 
setHeatmapOpacityTransition(const TransitionOptions & options)230 void HeatmapLayer::setHeatmapOpacityTransition(const TransitionOptions& options) {
231     auto impl_ = mutableImpl();
232     impl_->paint.template get<HeatmapOpacity>().options = options;
233     baseImpl = std::move(impl_);
234 }
235 
getHeatmapOpacityTransition() const236 TransitionOptions HeatmapLayer::getHeatmapOpacityTransition() const {
237     return impl().paint.template get<HeatmapOpacity>().options;
238 }
239 
240 } // namespace style
241 } // namespace mbgl
242