1 // This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. 2 3 #include <mbgl/style/layers/background_layer.hpp> 4 #include <mbgl/style/layers/background_layer_impl.hpp> 5 #include <mbgl/style/layer_observer.hpp> 6 7 namespace mbgl { 8 namespace style { 9 BackgroundLayer(const std::string & layerID)10BackgroundLayer::BackgroundLayer(const std::string& layerID) 11 : Layer(makeMutable<Impl>(LayerType::Background, layerID, std::string())) { 12 } 13 BackgroundLayer(Immutable<Impl> impl_)14BackgroundLayer::BackgroundLayer(Immutable<Impl> impl_) 15 : Layer(std::move(impl_)) { 16 } 17 18 BackgroundLayer::~BackgroundLayer() = default; 19 impl() const20const BackgroundLayer::Impl& BackgroundLayer::impl() const { 21 return static_cast<const Impl&>(*baseImpl); 22 } 23 mutableImpl() const24Mutable<BackgroundLayer::Impl> BackgroundLayer::mutableImpl() const { 25 return makeMutable<Impl>(impl()); 26 } 27 cloneRef(const std::string & id_) const28std::unique_ptr<Layer> BackgroundLayer::cloneRef(const std::string& id_) const { 29 auto impl_ = mutableImpl(); 30 impl_->id = id_; 31 impl_->paint = BackgroundPaintProperties::Transitionable(); 32 return std::make_unique<BackgroundLayer>(std::move(impl_)); 33 } 34 stringifyLayout(rapidjson::Writer<rapidjson::StringBuffer> &) const35void BackgroundLayer::Impl::stringifyLayout(rapidjson::Writer<rapidjson::StringBuffer>&) const { 36 } 37 38 39 // Visibility 40 setVisibility(VisibilityType value)41void BackgroundLayer::setVisibility(VisibilityType value) { 42 if (value == getVisibility()) 43 return; 44 auto impl_ = mutableImpl(); 45 impl_->visibility = value; 46 baseImpl = std::move(impl_); 47 observer->onLayerChanged(*this); 48 } 49 50 // Zoom range 51 setMinZoom(float minZoom)52void BackgroundLayer::setMinZoom(float minZoom) { 53 auto impl_ = mutableImpl(); 54 impl_->minZoom = minZoom; 55 baseImpl = std::move(impl_); 56 observer->onLayerChanged(*this); 57 } 58 setMaxZoom(float maxZoom)59void BackgroundLayer::setMaxZoom(float maxZoom) { 60 auto impl_ = mutableImpl(); 61 impl_->maxZoom = maxZoom; 62 baseImpl = std::move(impl_); 63 observer->onLayerChanged(*this); 64 } 65 66 // Layout properties 67 68 69 // Paint properties 70 getDefaultBackgroundColor()71PropertyValue<Color> BackgroundLayer::getDefaultBackgroundColor() { 72 return { Color::black() }; 73 } 74 getBackgroundColor() const75PropertyValue<Color> BackgroundLayer::getBackgroundColor() const { 76 return impl().paint.template get<BackgroundColor>().value; 77 } 78 setBackgroundColor(PropertyValue<Color> value)79void BackgroundLayer::setBackgroundColor(PropertyValue<Color> value) { 80 if (value == getBackgroundColor()) 81 return; 82 auto impl_ = mutableImpl(); 83 impl_->paint.template get<BackgroundColor>().value = value; 84 baseImpl = std::move(impl_); 85 observer->onLayerChanged(*this); 86 } 87 setBackgroundColorTransition(const TransitionOptions & options)88void BackgroundLayer::setBackgroundColorTransition(const TransitionOptions& options) { 89 auto impl_ = mutableImpl(); 90 impl_->paint.template get<BackgroundColor>().options = options; 91 baseImpl = std::move(impl_); 92 } 93 getBackgroundColorTransition() const94TransitionOptions BackgroundLayer::getBackgroundColorTransition() const { 95 return impl().paint.template get<BackgroundColor>().options; 96 } 97 getDefaultBackgroundPattern()98PropertyValue<std::string> BackgroundLayer::getDefaultBackgroundPattern() { 99 return { "" }; 100 } 101 getBackgroundPattern() const102PropertyValue<std::string> BackgroundLayer::getBackgroundPattern() const { 103 return impl().paint.template get<BackgroundPattern>().value; 104 } 105 setBackgroundPattern(PropertyValue<std::string> value)106void BackgroundLayer::setBackgroundPattern(PropertyValue<std::string> value) { 107 if (value == getBackgroundPattern()) 108 return; 109 auto impl_ = mutableImpl(); 110 impl_->paint.template get<BackgroundPattern>().value = value; 111 baseImpl = std::move(impl_); 112 observer->onLayerChanged(*this); 113 } 114 setBackgroundPatternTransition(const TransitionOptions & options)115void BackgroundLayer::setBackgroundPatternTransition(const TransitionOptions& options) { 116 auto impl_ = mutableImpl(); 117 impl_->paint.template get<BackgroundPattern>().options = options; 118 baseImpl = std::move(impl_); 119 } 120 getBackgroundPatternTransition() const121TransitionOptions BackgroundLayer::getBackgroundPatternTransition() const { 122 return impl().paint.template get<BackgroundPattern>().options; 123 } 124 getDefaultBackgroundOpacity()125PropertyValue<float> BackgroundLayer::getDefaultBackgroundOpacity() { 126 return { 1 }; 127 } 128 getBackgroundOpacity() const129PropertyValue<float> BackgroundLayer::getBackgroundOpacity() const { 130 return impl().paint.template get<BackgroundOpacity>().value; 131 } 132 setBackgroundOpacity(PropertyValue<float> value)133void BackgroundLayer::setBackgroundOpacity(PropertyValue<float> value) { 134 if (value == getBackgroundOpacity()) 135 return; 136 auto impl_ = mutableImpl(); 137 impl_->paint.template get<BackgroundOpacity>().value = value; 138 baseImpl = std::move(impl_); 139 observer->onLayerChanged(*this); 140 } 141 setBackgroundOpacityTransition(const TransitionOptions & options)142void BackgroundLayer::setBackgroundOpacityTransition(const TransitionOptions& options) { 143 auto impl_ = mutableImpl(); 144 impl_->paint.template get<BackgroundOpacity>().options = options; 145 baseImpl = std::move(impl_); 146 } 147 getBackgroundOpacityTransition() const148TransitionOptions BackgroundLayer::getBackgroundOpacityTransition() const { 149 return impl().paint.template get<BackgroundOpacity>().options; 150 } 151 152 } // namespace style 153 } // namespace mbgl 154