// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`. #include #include #include #include #include #include #include #include #include #include #include namespace mbgl { namespace style { // static const LayerTypeInfo* RasterLayer::Impl::staticTypeInfo() noexcept { const static LayerTypeInfo typeInfo{"raster", LayerTypeInfo::Source::Required, LayerTypeInfo::Pass3D::NotRequired, LayerTypeInfo::Layout::NotRequired, LayerTypeInfo::FadingTiles::NotRequired, LayerTypeInfo::CrossTileIndex::NotRequired, LayerTypeInfo::TileKind::Raster}; return &typeInfo; } RasterLayer::RasterLayer(const std::string& layerID, const std::string& sourceID) : Layer(makeMutable(layerID, sourceID)) { } RasterLayer::RasterLayer(Immutable impl_) : Layer(std::move(impl_)) { } RasterLayer::~RasterLayer() = default; const RasterLayer::Impl& RasterLayer::impl() const { return static_cast(*baseImpl); } Mutable RasterLayer::mutableImpl() const { return makeMutable(impl()); } std::unique_ptr RasterLayer::cloneRef(const std::string& id_) const { auto impl_ = mutableImpl(); impl_->id = id_; impl_->paint = RasterPaintProperties::Transitionable(); return std::make_unique(std::move(impl_)); } void RasterLayer::Impl::stringifyLayout(rapidjson::Writer&) const { } // Layout properties // Paint properties PropertyValue RasterLayer::getDefaultRasterBrightnessMax() { return { 1 }; } const PropertyValue& RasterLayer::getRasterBrightnessMax() const { return impl().paint.template get().value; } void RasterLayer::setRasterBrightnessMax(const PropertyValue& value) { if (value == getRasterBrightnessMax()) return; auto impl_ = mutableImpl(); impl_->paint.template get().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } void RasterLayer::setRasterBrightnessMaxTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); impl_->paint.template get().options = options; baseImpl = std::move(impl_); } TransitionOptions RasterLayer::getRasterBrightnessMaxTransition() const { return impl().paint.template get().options; } PropertyValue RasterLayer::getDefaultRasterBrightnessMin() { return { 0 }; } const PropertyValue& RasterLayer::getRasterBrightnessMin() const { return impl().paint.template get().value; } void RasterLayer::setRasterBrightnessMin(const PropertyValue& value) { if (value == getRasterBrightnessMin()) return; auto impl_ = mutableImpl(); impl_->paint.template get().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } void RasterLayer::setRasterBrightnessMinTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); impl_->paint.template get().options = options; baseImpl = std::move(impl_); } TransitionOptions RasterLayer::getRasterBrightnessMinTransition() const { return impl().paint.template get().options; } PropertyValue RasterLayer::getDefaultRasterContrast() { return { 0 }; } const PropertyValue& RasterLayer::getRasterContrast() const { return impl().paint.template get().value; } void RasterLayer::setRasterContrast(const PropertyValue& value) { if (value == getRasterContrast()) return; auto impl_ = mutableImpl(); impl_->paint.template get().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } void RasterLayer::setRasterContrastTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); impl_->paint.template get().options = options; baseImpl = std::move(impl_); } TransitionOptions RasterLayer::getRasterContrastTransition() const { return impl().paint.template get().options; } PropertyValue RasterLayer::getDefaultRasterFadeDuration() { return { 300 }; } const PropertyValue& RasterLayer::getRasterFadeDuration() const { return impl().paint.template get().value; } void RasterLayer::setRasterFadeDuration(const PropertyValue& value) { if (value == getRasterFadeDuration()) return; auto impl_ = mutableImpl(); impl_->paint.template get().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } void RasterLayer::setRasterFadeDurationTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); impl_->paint.template get().options = options; baseImpl = std::move(impl_); } TransitionOptions RasterLayer::getRasterFadeDurationTransition() const { return impl().paint.template get().options; } PropertyValue RasterLayer::getDefaultRasterHueRotate() { return { 0 }; } const PropertyValue& RasterLayer::getRasterHueRotate() const { return impl().paint.template get().value; } void RasterLayer::setRasterHueRotate(const PropertyValue& value) { if (value == getRasterHueRotate()) return; auto impl_ = mutableImpl(); impl_->paint.template get().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } void RasterLayer::setRasterHueRotateTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); impl_->paint.template get().options = options; baseImpl = std::move(impl_); } TransitionOptions RasterLayer::getRasterHueRotateTransition() const { return impl().paint.template get().options; } PropertyValue RasterLayer::getDefaultRasterOpacity() { return { 1 }; } const PropertyValue& RasterLayer::getRasterOpacity() const { return impl().paint.template get().value; } void RasterLayer::setRasterOpacity(const PropertyValue& value) { if (value == getRasterOpacity()) return; auto impl_ = mutableImpl(); impl_->paint.template get().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } void RasterLayer::setRasterOpacityTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); impl_->paint.template get().options = options; baseImpl = std::move(impl_); } TransitionOptions RasterLayer::getRasterOpacityTransition() const { return impl().paint.template get().options; } PropertyValue RasterLayer::getDefaultRasterResampling() { return { RasterResamplingType::Linear }; } const PropertyValue& RasterLayer::getRasterResampling() const { return impl().paint.template get().value; } void RasterLayer::setRasterResampling(const PropertyValue& value) { if (value == getRasterResampling()) return; auto impl_ = mutableImpl(); impl_->paint.template get().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } void RasterLayer::setRasterResamplingTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); impl_->paint.template get().options = options; baseImpl = std::move(impl_); } TransitionOptions RasterLayer::getRasterResamplingTransition() const { return impl().paint.template get().options; } PropertyValue RasterLayer::getDefaultRasterSaturation() { return { 0 }; } const PropertyValue& RasterLayer::getRasterSaturation() const { return impl().paint.template get().value; } void RasterLayer::setRasterSaturation(const PropertyValue& value) { if (value == getRasterSaturation()) return; auto impl_ = mutableImpl(); impl_->paint.template get().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } void RasterLayer::setRasterSaturationTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); impl_->paint.template get().options = options; baseImpl = std::move(impl_); } TransitionOptions RasterLayer::getRasterSaturationTransition() const { return impl().paint.template get().options; } using namespace conversion; optional RasterLayer::setPaintProperty(const std::string& name, const Convertible& value) { enum class Property { RasterBrightnessMax, RasterBrightnessMin, RasterContrast, RasterFadeDuration, RasterHueRotate, RasterOpacity, RasterResampling, RasterSaturation, RasterBrightnessMaxTransition, RasterBrightnessMinTransition, RasterContrastTransition, RasterFadeDurationTransition, RasterHueRotateTransition, RasterOpacityTransition, RasterResamplingTransition, RasterSaturationTransition, }; MAPBOX_ETERNAL_CONSTEXPR const auto properties = mapbox::eternal::hash_map({ { "raster-brightness-max", mbgl::underlying_type(Property::RasterBrightnessMax) }, { "raster-brightness-min", mbgl::underlying_type(Property::RasterBrightnessMin) }, { "raster-contrast", mbgl::underlying_type(Property::RasterContrast) }, { "raster-fade-duration", mbgl::underlying_type(Property::RasterFadeDuration) }, { "raster-hue-rotate", mbgl::underlying_type(Property::RasterHueRotate) }, { "raster-opacity", mbgl::underlying_type(Property::RasterOpacity) }, { "raster-resampling", mbgl::underlying_type(Property::RasterResampling) }, { "raster-saturation", mbgl::underlying_type(Property::RasterSaturation) }, { "raster-brightness-max-transition", mbgl::underlying_type(Property::RasterBrightnessMaxTransition) }, { "raster-brightness-min-transition", mbgl::underlying_type(Property::RasterBrightnessMinTransition) }, { "raster-contrast-transition", mbgl::underlying_type(Property::RasterContrastTransition) }, { "raster-fade-duration-transition", mbgl::underlying_type(Property::RasterFadeDurationTransition) }, { "raster-hue-rotate-transition", mbgl::underlying_type(Property::RasterHueRotateTransition) }, { "raster-opacity-transition", mbgl::underlying_type(Property::RasterOpacityTransition) }, { "raster-resampling-transition", mbgl::underlying_type(Property::RasterResamplingTransition) }, { "raster-saturation-transition", mbgl::underlying_type(Property::RasterSaturationTransition) } }); const auto it = properties.find(name.c_str()); if (it == properties.end()) { return Error { "layer doesn't support this property" }; } auto property = static_cast(it->second); if (property == Property::RasterBrightnessMax || property == Property::RasterBrightnessMin || property == Property::RasterContrast || property == Property::RasterFadeDuration || property == Property::RasterHueRotate || property == Property::RasterOpacity || property == Property::RasterSaturation) { Error error; optional> typedValue = convert>(value, error, false, false); if (!typedValue) { return error; } if (property == Property::RasterBrightnessMax) { setRasterBrightnessMax(*typedValue); return nullopt; } if (property == Property::RasterBrightnessMin) { setRasterBrightnessMin(*typedValue); return nullopt; } if (property == Property::RasterContrast) { setRasterContrast(*typedValue); return nullopt; } if (property == Property::RasterFadeDuration) { setRasterFadeDuration(*typedValue); return nullopt; } if (property == Property::RasterHueRotate) { setRasterHueRotate(*typedValue); return nullopt; } if (property == Property::RasterOpacity) { setRasterOpacity(*typedValue); return nullopt; } if (property == Property::RasterSaturation) { setRasterSaturation(*typedValue); return nullopt; } } if (property == Property::RasterResampling) { Error error; optional> typedValue = convert>(value, error, false, false); if (!typedValue) { return error; } setRasterResampling(*typedValue); return nullopt; } Error error; optional transition = convert(value, error); if (!transition) { return error; } if (property == Property::RasterBrightnessMaxTransition) { setRasterBrightnessMaxTransition(*transition); return nullopt; } if (property == Property::RasterBrightnessMinTransition) { setRasterBrightnessMinTransition(*transition); return nullopt; } if (property == Property::RasterContrastTransition) { setRasterContrastTransition(*transition); return nullopt; } if (property == Property::RasterFadeDurationTransition) { setRasterFadeDurationTransition(*transition); return nullopt; } if (property == Property::RasterHueRotateTransition) { setRasterHueRotateTransition(*transition); return nullopt; } if (property == Property::RasterOpacityTransition) { setRasterOpacityTransition(*transition); return nullopt; } if (property == Property::RasterResamplingTransition) { setRasterResamplingTransition(*transition); return nullopt; } if (property == Property::RasterSaturationTransition) { setRasterSaturationTransition(*transition); return nullopt; } return Error { "layer doesn't support this property" }; } optional RasterLayer::setLayoutProperty(const std::string& name, const Convertible& value) { if (name == "visibility") { return Layer::setVisibility(value); } return Error { "layer doesn't support this property" }; } Mutable RasterLayer::mutableBaseImpl() const { return staticMutableCast(mutableImpl()); } } // namespace style } // namespace mbgl