// clang-format off // 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* LocationIndicatorLayer::Impl::staticTypeInfo() noexcept { const static LayerTypeInfo typeInfo{"location-indicator", LayerTypeInfo::Source::NotRequired, LayerTypeInfo::Pass3D::NotRequired, LayerTypeInfo::Layout::NotRequired, LayerTypeInfo::FadingTiles::NotRequired, LayerTypeInfo::CrossTileIndex::NotRequired, LayerTypeInfo::TileKind::NotRequired}; return &typeInfo; } LocationIndicatorLayer::LocationIndicatorLayer(const std::string& layerID) : Layer(makeMutable(layerID, std::string())) { } LocationIndicatorLayer::LocationIndicatorLayer(Immutable impl_) : Layer(std::move(impl_)) { } LocationIndicatorLayer::~LocationIndicatorLayer() = default; const LocationIndicatorLayer::Impl& LocationIndicatorLayer::impl() const { return static_cast(*baseImpl); } Mutable LocationIndicatorLayer::mutableImpl() const { return makeMutable(impl()); } std::unique_ptr LocationIndicatorLayer::cloneRef(const std::string& id_) const { auto impl_ = mutableImpl(); impl_->id = id_; impl_->paint = LocationIndicatorPaintProperties::Transitionable(); return std::make_unique(std::move(impl_)); } void LocationIndicatorLayer::Impl::stringifyLayout(rapidjson::Writer& writer) const { layout.stringify(writer); } // Layout properties PropertyValue LocationIndicatorLayer::getDefaultBearingImage() { return BearingImage::defaultValue(); } const PropertyValue& LocationIndicatorLayer::getBearingImage() const { return impl().layout.get(); } void LocationIndicatorLayer::setBearingImage(const PropertyValue& value) { if (value == getBearingImage()) return; auto impl_ = mutableImpl(); impl_->layout.get() = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } PropertyValue LocationIndicatorLayer::getDefaultShadowImage() { return ShadowImage::defaultValue(); } const PropertyValue& LocationIndicatorLayer::getShadowImage() const { return impl().layout.get(); } void LocationIndicatorLayer::setShadowImage(const PropertyValue& value) { if (value == getShadowImage()) return; auto impl_ = mutableImpl(); impl_->layout.get() = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } PropertyValue LocationIndicatorLayer::getDefaultTopImage() { return TopImage::defaultValue(); } const PropertyValue& LocationIndicatorLayer::getTopImage() const { return impl().layout.get(); } void LocationIndicatorLayer::setTopImage(const PropertyValue& value) { if (value == getTopImage()) return; auto impl_ = mutableImpl(); impl_->layout.get() = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } // Paint properties PropertyValue LocationIndicatorLayer::getDefaultAccuracyRadius() { return {0}; } const PropertyValue& LocationIndicatorLayer::getAccuracyRadius() const { return impl().paint.template get().value; } void LocationIndicatorLayer::setAccuracyRadius(const PropertyValue& value) { if (value == getAccuracyRadius()) return; auto impl_ = mutableImpl(); impl_->paint.template get().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } void LocationIndicatorLayer::setAccuracyRadiusTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); impl_->paint.template get().options = options; baseImpl = std::move(impl_); } TransitionOptions LocationIndicatorLayer::getAccuracyRadiusTransition() const { return impl().paint.template get().options; } PropertyValue LocationIndicatorLayer::getDefaultAccuracyRadiusBorderColor() { return {Color::white()}; } const PropertyValue& LocationIndicatorLayer::getAccuracyRadiusBorderColor() const { return impl().paint.template get().value; } void LocationIndicatorLayer::setAccuracyRadiusBorderColor(const PropertyValue& value) { if (value == getAccuracyRadiusBorderColor()) return; auto impl_ = mutableImpl(); impl_->paint.template get().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } void LocationIndicatorLayer::setAccuracyRadiusBorderColorTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); impl_->paint.template get().options = options; baseImpl = std::move(impl_); } TransitionOptions LocationIndicatorLayer::getAccuracyRadiusBorderColorTransition() const { return impl().paint.template get().options; } PropertyValue LocationIndicatorLayer::getDefaultAccuracyRadiusColor() { return {Color::white()}; } const PropertyValue& LocationIndicatorLayer::getAccuracyRadiusColor() const { return impl().paint.template get().value; } void LocationIndicatorLayer::setAccuracyRadiusColor(const PropertyValue& value) { if (value == getAccuracyRadiusColor()) return; auto impl_ = mutableImpl(); impl_->paint.template get().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } void LocationIndicatorLayer::setAccuracyRadiusColorTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); impl_->paint.template get().options = options; baseImpl = std::move(impl_); } TransitionOptions LocationIndicatorLayer::getAccuracyRadiusColorTransition() const { return impl().paint.template get().options; } PropertyValue LocationIndicatorLayer::getDefaultBearing() { return {0}; } const PropertyValue& LocationIndicatorLayer::getBearing() const { return impl().paint.template get().value; } void LocationIndicatorLayer::setBearing(const PropertyValue& value) { if (value == getBearing()) return; auto impl_ = mutableImpl(); impl_->paint.template get().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } void LocationIndicatorLayer::setBearingTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); impl_->paint.template get().options = options; baseImpl = std::move(impl_); } TransitionOptions LocationIndicatorLayer::getBearingTransition() const { return impl().paint.template get().options; } PropertyValue LocationIndicatorLayer::getDefaultBearingImageSize() { return {1}; } const PropertyValue& LocationIndicatorLayer::getBearingImageSize() const { return impl().paint.template get().value; } void LocationIndicatorLayer::setBearingImageSize(const PropertyValue& value) { if (value == getBearingImageSize()) return; auto impl_ = mutableImpl(); impl_->paint.template get().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } void LocationIndicatorLayer::setBearingImageSizeTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); impl_->paint.template get().options = options; baseImpl = std::move(impl_); } TransitionOptions LocationIndicatorLayer::getBearingImageSizeTransition() const { return impl().paint.template get().options; } PropertyValue LocationIndicatorLayer::getDefaultImageTiltDisplacement() { return {0}; } const PropertyValue& LocationIndicatorLayer::getImageTiltDisplacement() const { return impl().paint.template get().value; } void LocationIndicatorLayer::setImageTiltDisplacement(const PropertyValue& value) { if (value == getImageTiltDisplacement()) return; auto impl_ = mutableImpl(); impl_->paint.template get().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } void LocationIndicatorLayer::setImageTiltDisplacementTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); impl_->paint.template get().options = options; baseImpl = std::move(impl_); } TransitionOptions LocationIndicatorLayer::getImageTiltDisplacementTransition() const { return impl().paint.template get().options; } PropertyValue> LocationIndicatorLayer::getDefaultLocation() { return {{{0, 0, 0}}}; } const PropertyValue>& LocationIndicatorLayer::getLocation() const { return impl().paint.template get().value; } void LocationIndicatorLayer::setLocation(const PropertyValue>& value) { if (value == getLocation()) return; auto impl_ = mutableImpl(); impl_->paint.template get().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } void LocationIndicatorLayer::setLocationTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); impl_->paint.template get().options = options; baseImpl = std::move(impl_); } TransitionOptions LocationIndicatorLayer::getLocationTransition() const { return impl().paint.template get().options; } PropertyValue LocationIndicatorLayer::getDefaultPerspectiveCompensation() { return {0.85}; } const PropertyValue& LocationIndicatorLayer::getPerspectiveCompensation() const { return impl().paint.template get().value; } void LocationIndicatorLayer::setPerspectiveCompensation(const PropertyValue& value) { if (value == getPerspectiveCompensation()) return; auto impl_ = mutableImpl(); impl_->paint.template get().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } void LocationIndicatorLayer::setPerspectiveCompensationTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); impl_->paint.template get().options = options; baseImpl = std::move(impl_); } TransitionOptions LocationIndicatorLayer::getPerspectiveCompensationTransition() const { return impl().paint.template get().options; } PropertyValue LocationIndicatorLayer::getDefaultShadowImageSize() { return {1}; } const PropertyValue& LocationIndicatorLayer::getShadowImageSize() const { return impl().paint.template get().value; } void LocationIndicatorLayer::setShadowImageSize(const PropertyValue& value) { if (value == getShadowImageSize()) return; auto impl_ = mutableImpl(); impl_->paint.template get().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } void LocationIndicatorLayer::setShadowImageSizeTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); impl_->paint.template get().options = options; baseImpl = std::move(impl_); } TransitionOptions LocationIndicatorLayer::getShadowImageSizeTransition() const { return impl().paint.template get().options; } PropertyValue LocationIndicatorLayer::getDefaultTopImageSize() { return {1}; } const PropertyValue& LocationIndicatorLayer::getTopImageSize() const { return impl().paint.template get().value; } void LocationIndicatorLayer::setTopImageSize(const PropertyValue& value) { if (value == getTopImageSize()) return; auto impl_ = mutableImpl(); impl_->paint.template get().value = value; baseImpl = std::move(impl_); observer->onLayerChanged(*this); } void LocationIndicatorLayer::setTopImageSizeTransition(const TransitionOptions& options) { auto impl_ = mutableImpl(); impl_->paint.template get().options = options; baseImpl = std::move(impl_); } TransitionOptions LocationIndicatorLayer::getTopImageSizeTransition() const { return impl().paint.template get().options; } using namespace conversion; namespace { constexpr uint8_t kPaintPropertyCount = 20u; enum class Property : uint8_t { AccuracyRadius, AccuracyRadiusBorderColor, AccuracyRadiusColor, Bearing, BearingImageSize, ImageTiltDisplacement, Location, PerspectiveCompensation, ShadowImageSize, TopImageSize, AccuracyRadiusTransition, AccuracyRadiusBorderColorTransition, AccuracyRadiusColorTransition, BearingTransition, BearingImageSizeTransition, ImageTiltDisplacementTransition, LocationTransition, PerspectiveCompensationTransition, ShadowImageSizeTransition, TopImageSizeTransition, BearingImage = kPaintPropertyCount, ShadowImage, TopImage, }; template constexpr uint8_t toUint8(T t) noexcept { return uint8_t(mbgl::underlying_type(t)); } MAPBOX_ETERNAL_CONSTEXPR const auto layerProperties = mapbox::eternal::hash_map( {{"accuracy-radius", toUint8(Property::AccuracyRadius)}, {"accuracy-radius-border-color", toUint8(Property::AccuracyRadiusBorderColor)}, {"accuracy-radius-color", toUint8(Property::AccuracyRadiusColor)}, {"bearing", toUint8(Property::Bearing)}, {"bearing-image-size", toUint8(Property::BearingImageSize)}, {"image-tilt-displacement", toUint8(Property::ImageTiltDisplacement)}, {"location", toUint8(Property::Location)}, {"perspective-compensation", toUint8(Property::PerspectiveCompensation)}, {"shadow-image-size", toUint8(Property::ShadowImageSize)}, {"top-image-size", toUint8(Property::TopImageSize)}, {"accuracy-radius-transition", toUint8(Property::AccuracyRadiusTransition)}, {"accuracy-radius-border-color-transition", toUint8(Property::AccuracyRadiusBorderColorTransition)}, {"accuracy-radius-color-transition", toUint8(Property::AccuracyRadiusColorTransition)}, {"bearing-transition", toUint8(Property::BearingTransition)}, {"bearing-image-size-transition", toUint8(Property::BearingImageSizeTransition)}, {"image-tilt-displacement-transition", toUint8(Property::ImageTiltDisplacementTransition)}, {"location-transition", toUint8(Property::LocationTransition)}, {"perspective-compensation-transition", toUint8(Property::PerspectiveCompensationTransition)}, {"shadow-image-size-transition", toUint8(Property::ShadowImageSizeTransition)}, {"top-image-size-transition", toUint8(Property::TopImageSizeTransition)}, {"bearing-image", toUint8(Property::BearingImage)}, {"shadow-image", toUint8(Property::ShadowImage)}, {"top-image", toUint8(Property::TopImage)}}); StyleProperty getLayerProperty(const LocationIndicatorLayer& layer, Property property) { switch (property) { case Property::AccuracyRadius: return makeStyleProperty(layer.getAccuracyRadius()); case Property::AccuracyRadiusBorderColor: return makeStyleProperty(layer.getAccuracyRadiusBorderColor()); case Property::AccuracyRadiusColor: return makeStyleProperty(layer.getAccuracyRadiusColor()); case Property::Bearing: return makeStyleProperty(layer.getBearing()); case Property::BearingImageSize: return makeStyleProperty(layer.getBearingImageSize()); case Property::ImageTiltDisplacement: return makeStyleProperty(layer.getImageTiltDisplacement()); case Property::Location: return makeStyleProperty(layer.getLocation()); case Property::PerspectiveCompensation: return makeStyleProperty(layer.getPerspectiveCompensation()); case Property::ShadowImageSize: return makeStyleProperty(layer.getShadowImageSize()); case Property::TopImageSize: return makeStyleProperty(layer.getTopImageSize()); case Property::AccuracyRadiusTransition: return makeStyleProperty(layer.getAccuracyRadiusTransition()); case Property::AccuracyRadiusBorderColorTransition: return makeStyleProperty(layer.getAccuracyRadiusBorderColorTransition()); case Property::AccuracyRadiusColorTransition: return makeStyleProperty(layer.getAccuracyRadiusColorTransition()); case Property::BearingTransition: return makeStyleProperty(layer.getBearingTransition()); case Property::BearingImageSizeTransition: return makeStyleProperty(layer.getBearingImageSizeTransition()); case Property::ImageTiltDisplacementTransition: return makeStyleProperty(layer.getImageTiltDisplacementTransition()); case Property::LocationTransition: return makeStyleProperty(layer.getLocationTransition()); case Property::PerspectiveCompensationTransition: return makeStyleProperty(layer.getPerspectiveCompensationTransition()); case Property::ShadowImageSizeTransition: return makeStyleProperty(layer.getShadowImageSizeTransition()); case Property::TopImageSizeTransition: return makeStyleProperty(layer.getTopImageSizeTransition()); case Property::BearingImage: return makeStyleProperty(layer.getBearingImage()); case Property::ShadowImage: return makeStyleProperty(layer.getShadowImage()); case Property::TopImage: return makeStyleProperty(layer.getTopImage()); } return {}; } StyleProperty getLayerProperty(const LocationIndicatorLayer& layer, const std::string& name) { const auto it = layerProperties.find(name.c_str()); if (it == layerProperties.end()) { return {}; } return getLayerProperty(layer, static_cast(it->second)); } } // namespace Value LocationIndicatorLayer::serialize() const { auto result = Layer::serialize(); assert(result.getObject()); for (const auto& property : layerProperties) { auto styleProperty = getLayerProperty(*this, static_cast(property.second)); if (styleProperty.getKind() == StyleProperty::Kind::Undefined) continue; serializeProperty(result, styleProperty, property.first.c_str(), property.second < kPaintPropertyCount); } return result; } optional LocationIndicatorLayer::setPropertyInternal(const std::string& name, const Convertible& value) { const auto it = layerProperties.find(name.c_str()); if (it == layerProperties.end()) return Error{"layer doesn't support this property"}; auto property = static_cast(it->second); if (property == Property::AccuracyRadius || property == Property::BearingImageSize || property == Property::ImageTiltDisplacement || property == Property::PerspectiveCompensation || property == Property::ShadowImageSize || property == Property::TopImageSize) { Error error; const auto& typedValue = convert>(value, error, false, false); if (!typedValue) { return error; } if (property == Property::AccuracyRadius) { setAccuracyRadius(*typedValue); return nullopt; } if (property == Property::BearingImageSize) { setBearingImageSize(*typedValue); return nullopt; } if (property == Property::ImageTiltDisplacement) { setImageTiltDisplacement(*typedValue); return nullopt; } if (property == Property::PerspectiveCompensation) { setPerspectiveCompensation(*typedValue); return nullopt; } if (property == Property::ShadowImageSize) { setShadowImageSize(*typedValue); return nullopt; } if (property == Property::TopImageSize) { setTopImageSize(*typedValue); return nullopt; } } if (property == Property::AccuracyRadiusBorderColor || property == Property::AccuracyRadiusColor) { Error error; const auto& typedValue = convert>(value, error, false, false); if (!typedValue) { return error; } if (property == Property::AccuracyRadiusBorderColor) { setAccuracyRadiusBorderColor(*typedValue); return nullopt; } if (property == Property::AccuracyRadiusColor) { setAccuracyRadiusColor(*typedValue); return nullopt; } } if (property == Property::Bearing) { Error error; const auto& typedValue = convert>(value, error, false, false); if (!typedValue) { return error; } setBearing(*typedValue); return nullopt; } if (property == Property::Location) { Error error; const auto& typedValue = convert>>(value, error, false, false); if (!typedValue) { return error; } setLocation(*typedValue); return nullopt; } if (property == Property::BearingImage || property == Property::ShadowImage || property == Property::TopImage) { Error error; const auto& typedValue = convert>(value, error, false, false); if (!typedValue) { return error; } if (property == Property::BearingImage) { setBearingImage(*typedValue); return nullopt; } if (property == Property::ShadowImage) { setShadowImage(*typedValue); return nullopt; } if (property == Property::TopImage) { setTopImage(*typedValue); return nullopt; } } Error error; optional transition = convert(value, error); if (!transition) { return error; } if (property == Property::AccuracyRadiusTransition) { setAccuracyRadiusTransition(*transition); return nullopt; } if (property == Property::AccuracyRadiusBorderColorTransition) { setAccuracyRadiusBorderColorTransition(*transition); return nullopt; } if (property == Property::AccuracyRadiusColorTransition) { setAccuracyRadiusColorTransition(*transition); return nullopt; } if (property == Property::BearingTransition) { setBearingTransition(*transition); return nullopt; } if (property == Property::BearingImageSizeTransition) { setBearingImageSizeTransition(*transition); return nullopt; } if (property == Property::ImageTiltDisplacementTransition) { setImageTiltDisplacementTransition(*transition); return nullopt; } if (property == Property::LocationTransition) { setLocationTransition(*transition); return nullopt; } if (property == Property::PerspectiveCompensationTransition) { setPerspectiveCompensationTransition(*transition); return nullopt; } if (property == Property::ShadowImageSizeTransition) { setShadowImageSizeTransition(*transition); return nullopt; } if (property == Property::TopImageSizeTransition) { setTopImageSizeTransition(*transition); return nullopt; } return Error{"layer doesn't support this property"}; } StyleProperty LocationIndicatorLayer::getProperty(const std::string& name) const { return getLayerProperty(*this, name); } Mutable LocationIndicatorLayer::mutableBaseImpl() const { return staticMutableCast(mutableImpl()); } } // namespace style } // namespace mbgl // clang-format on