[build] change style code generator to sort properties alphabetically
JSON keys in our style specification don't have a defined order. This change sorts them alphabetically so that we can rely on the order remaining them same across code generation runs.
This commit is contained in:
@@ -90,33 +90,6 @@ TransitionOptions BackgroundLayer::getBackgroundColorTransition() const {
|
||||
return impl().paint.template get<BackgroundColor>().options;
|
||||
}
|
||||
|
||||
PropertyValue<std::string> BackgroundLayer::getDefaultBackgroundPattern() {
|
||||
return { "" };
|
||||
}
|
||||
|
||||
const PropertyValue<std::string>& BackgroundLayer::getBackgroundPattern() const {
|
||||
return impl().paint.template get<BackgroundPattern>().value;
|
||||
}
|
||||
|
||||
void BackgroundLayer::setBackgroundPattern(const PropertyValue<std::string>& value) {
|
||||
if (value == getBackgroundPattern())
|
||||
return;
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<BackgroundPattern>().value = value;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
void BackgroundLayer::setBackgroundPatternTransition(const TransitionOptions& options) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<BackgroundPattern>().options = options;
|
||||
baseImpl = std::move(impl_);
|
||||
}
|
||||
|
||||
TransitionOptions BackgroundLayer::getBackgroundPatternTransition() const {
|
||||
return impl().paint.template get<BackgroundPattern>().options;
|
||||
}
|
||||
|
||||
PropertyValue<float> BackgroundLayer::getDefaultBackgroundOpacity() {
|
||||
return { 1 };
|
||||
}
|
||||
@@ -144,25 +117,52 @@ TransitionOptions BackgroundLayer::getBackgroundOpacityTransition() const {
|
||||
return impl().paint.template get<BackgroundOpacity>().options;
|
||||
}
|
||||
|
||||
PropertyValue<std::string> BackgroundLayer::getDefaultBackgroundPattern() {
|
||||
return { "" };
|
||||
}
|
||||
|
||||
const PropertyValue<std::string>& BackgroundLayer::getBackgroundPattern() const {
|
||||
return impl().paint.template get<BackgroundPattern>().value;
|
||||
}
|
||||
|
||||
void BackgroundLayer::setBackgroundPattern(const PropertyValue<std::string>& value) {
|
||||
if (value == getBackgroundPattern())
|
||||
return;
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<BackgroundPattern>().value = value;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
void BackgroundLayer::setBackgroundPatternTransition(const TransitionOptions& options) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<BackgroundPattern>().options = options;
|
||||
baseImpl = std::move(impl_);
|
||||
}
|
||||
|
||||
TransitionOptions BackgroundLayer::getBackgroundPatternTransition() const {
|
||||
return impl().paint.template get<BackgroundPattern>().options;
|
||||
}
|
||||
|
||||
using namespace conversion;
|
||||
|
||||
optional<Error> BackgroundLayer::setPaintProperty(const std::string& name, const Convertible& value) {
|
||||
enum class Property : uint8_t {
|
||||
BackgroundColor,
|
||||
BackgroundPattern,
|
||||
BackgroundOpacity,
|
||||
BackgroundPattern,
|
||||
BackgroundColorTransition,
|
||||
BackgroundPatternTransition,
|
||||
BackgroundOpacityTransition,
|
||||
BackgroundPatternTransition,
|
||||
};
|
||||
|
||||
MAPBOX_ETERNAL_CONSTEXPR const auto properties = mapbox::eternal::hash_map<mapbox::eternal::string, uint8_t>({
|
||||
{ "background-color", static_cast<uint8_t>(Property::BackgroundColor) },
|
||||
{ "background-pattern", static_cast<uint8_t>(Property::BackgroundPattern) },
|
||||
{ "background-opacity", static_cast<uint8_t>(Property::BackgroundOpacity) },
|
||||
{ "background-pattern", static_cast<uint8_t>(Property::BackgroundPattern) },
|
||||
{ "background-color-transition", static_cast<uint8_t>(Property::BackgroundColorTransition) },
|
||||
{ "background-pattern-transition", static_cast<uint8_t>(Property::BackgroundPatternTransition) },
|
||||
{ "background-opacity-transition", static_cast<uint8_t>(Property::BackgroundOpacityTransition) }
|
||||
{ "background-opacity-transition", static_cast<uint8_t>(Property::BackgroundOpacityTransition) },
|
||||
{ "background-pattern-transition", static_cast<uint8_t>(Property::BackgroundPatternTransition) }
|
||||
});
|
||||
|
||||
const auto it = properties.find(name.c_str());
|
||||
@@ -185,18 +185,6 @@ optional<Error> BackgroundLayer::setPaintProperty(const std::string& name, const
|
||||
|
||||
}
|
||||
|
||||
if (property == Property::BackgroundPattern) {
|
||||
Error error;
|
||||
optional<PropertyValue<std::string>> typedValue = convert<PropertyValue<std::string>>(value, error, false, false);
|
||||
if (!typedValue) {
|
||||
return error;
|
||||
}
|
||||
|
||||
setBackgroundPattern(*typedValue);
|
||||
return nullopt;
|
||||
|
||||
}
|
||||
|
||||
if (property == Property::BackgroundOpacity) {
|
||||
Error error;
|
||||
optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, false, false);
|
||||
@@ -209,6 +197,18 @@ optional<Error> BackgroundLayer::setPaintProperty(const std::string& name, const
|
||||
|
||||
}
|
||||
|
||||
if (property == Property::BackgroundPattern) {
|
||||
Error error;
|
||||
optional<PropertyValue<std::string>> typedValue = convert<PropertyValue<std::string>>(value, error, false, false);
|
||||
if (!typedValue) {
|
||||
return error;
|
||||
}
|
||||
|
||||
setBackgroundPattern(*typedValue);
|
||||
return nullopt;
|
||||
|
||||
}
|
||||
|
||||
|
||||
Error error;
|
||||
optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
|
||||
@@ -221,13 +221,13 @@ optional<Error> BackgroundLayer::setPaintProperty(const std::string& name, const
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::BackgroundPatternTransition) {
|
||||
setBackgroundPatternTransition(*transition);
|
||||
if (property == Property::BackgroundOpacityTransition) {
|
||||
setBackgroundOpacityTransition(*transition);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::BackgroundOpacityTransition) {
|
||||
setBackgroundOpacityTransition(*transition);
|
||||
if (property == Property::BackgroundPatternTransition) {
|
||||
setBackgroundPatternTransition(*transition);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,18 +18,18 @@ struct BackgroundColor : PaintProperty<Color> {
|
||||
static Color defaultValue() { return Color::black(); }
|
||||
};
|
||||
|
||||
struct BackgroundPattern : CrossFadedPaintProperty<std::string> {
|
||||
static std::string defaultValue() { return ""; }
|
||||
};
|
||||
|
||||
struct BackgroundOpacity : PaintProperty<float> {
|
||||
static float defaultValue() { return 1; }
|
||||
};
|
||||
|
||||
struct BackgroundPattern : CrossFadedPaintProperty<std::string> {
|
||||
static std::string defaultValue() { return ""; }
|
||||
};
|
||||
|
||||
class BackgroundPaintProperties : public Properties<
|
||||
BackgroundColor,
|
||||
BackgroundPattern,
|
||||
BackgroundOpacity
|
||||
BackgroundOpacity,
|
||||
BackgroundPattern
|
||||
> {};
|
||||
|
||||
class BackgroundLayerProperties final : public LayerProperties {
|
||||
|
||||
@@ -63,31 +63,31 @@ void CircleLayer::Impl::stringifyLayout(rapidjson::Writer<rapidjson::StringBuffe
|
||||
|
||||
// Paint properties
|
||||
|
||||
PropertyValue<float> CircleLayer::getDefaultCircleRadius() {
|
||||
return { 5 };
|
||||
PropertyValue<float> CircleLayer::getDefaultCircleBlur() {
|
||||
return { 0 };
|
||||
}
|
||||
|
||||
const PropertyValue<float>& CircleLayer::getCircleRadius() const {
|
||||
return impl().paint.template get<CircleRadius>().value;
|
||||
const PropertyValue<float>& CircleLayer::getCircleBlur() const {
|
||||
return impl().paint.template get<CircleBlur>().value;
|
||||
}
|
||||
|
||||
void CircleLayer::setCircleRadius(const PropertyValue<float>& value) {
|
||||
if (value == getCircleRadius())
|
||||
void CircleLayer::setCircleBlur(const PropertyValue<float>& value) {
|
||||
if (value == getCircleBlur())
|
||||
return;
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<CircleRadius>().value = value;
|
||||
impl_->paint.template get<CircleBlur>().value = value;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
void CircleLayer::setCircleRadiusTransition(const TransitionOptions& options) {
|
||||
void CircleLayer::setCircleBlurTransition(const TransitionOptions& options) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<CircleRadius>().options = options;
|
||||
impl_->paint.template get<CircleBlur>().options = options;
|
||||
baseImpl = std::move(impl_);
|
||||
}
|
||||
|
||||
TransitionOptions CircleLayer::getCircleRadiusTransition() const {
|
||||
return impl().paint.template get<CircleRadius>().options;
|
||||
TransitionOptions CircleLayer::getCircleBlurTransition() const {
|
||||
return impl().paint.template get<CircleBlur>().options;
|
||||
}
|
||||
|
||||
PropertyValue<Color> CircleLayer::getDefaultCircleColor() {
|
||||
@@ -117,33 +117,6 @@ TransitionOptions CircleLayer::getCircleColorTransition() const {
|
||||
return impl().paint.template get<CircleColor>().options;
|
||||
}
|
||||
|
||||
PropertyValue<float> CircleLayer::getDefaultCircleBlur() {
|
||||
return { 0 };
|
||||
}
|
||||
|
||||
const PropertyValue<float>& CircleLayer::getCircleBlur() const {
|
||||
return impl().paint.template get<CircleBlur>().value;
|
||||
}
|
||||
|
||||
void CircleLayer::setCircleBlur(const PropertyValue<float>& value) {
|
||||
if (value == getCircleBlur())
|
||||
return;
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<CircleBlur>().value = value;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
void CircleLayer::setCircleBlurTransition(const TransitionOptions& options) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<CircleBlur>().options = options;
|
||||
baseImpl = std::move(impl_);
|
||||
}
|
||||
|
||||
TransitionOptions CircleLayer::getCircleBlurTransition() const {
|
||||
return impl().paint.template get<CircleBlur>().options;
|
||||
}
|
||||
|
||||
PropertyValue<float> CircleLayer::getDefaultCircleOpacity() {
|
||||
return { 1 };
|
||||
}
|
||||
@@ -171,87 +144,6 @@ TransitionOptions CircleLayer::getCircleOpacityTransition() const {
|
||||
return impl().paint.template get<CircleOpacity>().options;
|
||||
}
|
||||
|
||||
PropertyValue<std::array<float, 2>> CircleLayer::getDefaultCircleTranslate() {
|
||||
return { {{ 0, 0 }} };
|
||||
}
|
||||
|
||||
const PropertyValue<std::array<float, 2>>& CircleLayer::getCircleTranslate() const {
|
||||
return impl().paint.template get<CircleTranslate>().value;
|
||||
}
|
||||
|
||||
void CircleLayer::setCircleTranslate(const PropertyValue<std::array<float, 2>>& value) {
|
||||
if (value == getCircleTranslate())
|
||||
return;
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<CircleTranslate>().value = value;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
void CircleLayer::setCircleTranslateTransition(const TransitionOptions& options) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<CircleTranslate>().options = options;
|
||||
baseImpl = std::move(impl_);
|
||||
}
|
||||
|
||||
TransitionOptions CircleLayer::getCircleTranslateTransition() const {
|
||||
return impl().paint.template get<CircleTranslate>().options;
|
||||
}
|
||||
|
||||
PropertyValue<TranslateAnchorType> CircleLayer::getDefaultCircleTranslateAnchor() {
|
||||
return { TranslateAnchorType::Map };
|
||||
}
|
||||
|
||||
const PropertyValue<TranslateAnchorType>& CircleLayer::getCircleTranslateAnchor() const {
|
||||
return impl().paint.template get<CircleTranslateAnchor>().value;
|
||||
}
|
||||
|
||||
void CircleLayer::setCircleTranslateAnchor(const PropertyValue<TranslateAnchorType>& value) {
|
||||
if (value == getCircleTranslateAnchor())
|
||||
return;
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<CircleTranslateAnchor>().value = value;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
void CircleLayer::setCircleTranslateAnchorTransition(const TransitionOptions& options) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<CircleTranslateAnchor>().options = options;
|
||||
baseImpl = std::move(impl_);
|
||||
}
|
||||
|
||||
TransitionOptions CircleLayer::getCircleTranslateAnchorTransition() const {
|
||||
return impl().paint.template get<CircleTranslateAnchor>().options;
|
||||
}
|
||||
|
||||
PropertyValue<CirclePitchScaleType> CircleLayer::getDefaultCirclePitchScale() {
|
||||
return { CirclePitchScaleType::Map };
|
||||
}
|
||||
|
||||
const PropertyValue<CirclePitchScaleType>& CircleLayer::getCirclePitchScale() const {
|
||||
return impl().paint.template get<CirclePitchScale>().value;
|
||||
}
|
||||
|
||||
void CircleLayer::setCirclePitchScale(const PropertyValue<CirclePitchScaleType>& value) {
|
||||
if (value == getCirclePitchScale())
|
||||
return;
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<CirclePitchScale>().value = value;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
void CircleLayer::setCirclePitchScaleTransition(const TransitionOptions& options) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<CirclePitchScale>().options = options;
|
||||
baseImpl = std::move(impl_);
|
||||
}
|
||||
|
||||
TransitionOptions CircleLayer::getCirclePitchScaleTransition() const {
|
||||
return impl().paint.template get<CirclePitchScale>().options;
|
||||
}
|
||||
|
||||
PropertyValue<AlignmentType> CircleLayer::getDefaultCirclePitchAlignment() {
|
||||
return { AlignmentType::Viewport };
|
||||
}
|
||||
@@ -279,31 +171,58 @@ TransitionOptions CircleLayer::getCirclePitchAlignmentTransition() const {
|
||||
return impl().paint.template get<CirclePitchAlignment>().options;
|
||||
}
|
||||
|
||||
PropertyValue<float> CircleLayer::getDefaultCircleStrokeWidth() {
|
||||
return { 0 };
|
||||
PropertyValue<CirclePitchScaleType> CircleLayer::getDefaultCirclePitchScale() {
|
||||
return { CirclePitchScaleType::Map };
|
||||
}
|
||||
|
||||
const PropertyValue<float>& CircleLayer::getCircleStrokeWidth() const {
|
||||
return impl().paint.template get<CircleStrokeWidth>().value;
|
||||
const PropertyValue<CirclePitchScaleType>& CircleLayer::getCirclePitchScale() const {
|
||||
return impl().paint.template get<CirclePitchScale>().value;
|
||||
}
|
||||
|
||||
void CircleLayer::setCircleStrokeWidth(const PropertyValue<float>& value) {
|
||||
if (value == getCircleStrokeWidth())
|
||||
void CircleLayer::setCirclePitchScale(const PropertyValue<CirclePitchScaleType>& value) {
|
||||
if (value == getCirclePitchScale())
|
||||
return;
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<CircleStrokeWidth>().value = value;
|
||||
impl_->paint.template get<CirclePitchScale>().value = value;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
void CircleLayer::setCircleStrokeWidthTransition(const TransitionOptions& options) {
|
||||
void CircleLayer::setCirclePitchScaleTransition(const TransitionOptions& options) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<CircleStrokeWidth>().options = options;
|
||||
impl_->paint.template get<CirclePitchScale>().options = options;
|
||||
baseImpl = std::move(impl_);
|
||||
}
|
||||
|
||||
TransitionOptions CircleLayer::getCircleStrokeWidthTransition() const {
|
||||
return impl().paint.template get<CircleStrokeWidth>().options;
|
||||
TransitionOptions CircleLayer::getCirclePitchScaleTransition() const {
|
||||
return impl().paint.template get<CirclePitchScale>().options;
|
||||
}
|
||||
|
||||
PropertyValue<float> CircleLayer::getDefaultCircleRadius() {
|
||||
return { 5 };
|
||||
}
|
||||
|
||||
const PropertyValue<float>& CircleLayer::getCircleRadius() const {
|
||||
return impl().paint.template get<CircleRadius>().value;
|
||||
}
|
||||
|
||||
void CircleLayer::setCircleRadius(const PropertyValue<float>& value) {
|
||||
if (value == getCircleRadius())
|
||||
return;
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<CircleRadius>().value = value;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
void CircleLayer::setCircleRadiusTransition(const TransitionOptions& options) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<CircleRadius>().options = options;
|
||||
baseImpl = std::move(impl_);
|
||||
}
|
||||
|
||||
TransitionOptions CircleLayer::getCircleRadiusTransition() const {
|
||||
return impl().paint.template get<CircleRadius>().options;
|
||||
}
|
||||
|
||||
PropertyValue<Color> CircleLayer::getDefaultCircleStrokeColor() {
|
||||
@@ -360,57 +279,138 @@ TransitionOptions CircleLayer::getCircleStrokeOpacityTransition() const {
|
||||
return impl().paint.template get<CircleStrokeOpacity>().options;
|
||||
}
|
||||
|
||||
PropertyValue<float> CircleLayer::getDefaultCircleStrokeWidth() {
|
||||
return { 0 };
|
||||
}
|
||||
|
||||
const PropertyValue<float>& CircleLayer::getCircleStrokeWidth() const {
|
||||
return impl().paint.template get<CircleStrokeWidth>().value;
|
||||
}
|
||||
|
||||
void CircleLayer::setCircleStrokeWidth(const PropertyValue<float>& value) {
|
||||
if (value == getCircleStrokeWidth())
|
||||
return;
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<CircleStrokeWidth>().value = value;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
void CircleLayer::setCircleStrokeWidthTransition(const TransitionOptions& options) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<CircleStrokeWidth>().options = options;
|
||||
baseImpl = std::move(impl_);
|
||||
}
|
||||
|
||||
TransitionOptions CircleLayer::getCircleStrokeWidthTransition() const {
|
||||
return impl().paint.template get<CircleStrokeWidth>().options;
|
||||
}
|
||||
|
||||
PropertyValue<std::array<float, 2>> CircleLayer::getDefaultCircleTranslate() {
|
||||
return { {{ 0, 0 }} };
|
||||
}
|
||||
|
||||
const PropertyValue<std::array<float, 2>>& CircleLayer::getCircleTranslate() const {
|
||||
return impl().paint.template get<CircleTranslate>().value;
|
||||
}
|
||||
|
||||
void CircleLayer::setCircleTranslate(const PropertyValue<std::array<float, 2>>& value) {
|
||||
if (value == getCircleTranslate())
|
||||
return;
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<CircleTranslate>().value = value;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
void CircleLayer::setCircleTranslateTransition(const TransitionOptions& options) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<CircleTranslate>().options = options;
|
||||
baseImpl = std::move(impl_);
|
||||
}
|
||||
|
||||
TransitionOptions CircleLayer::getCircleTranslateTransition() const {
|
||||
return impl().paint.template get<CircleTranslate>().options;
|
||||
}
|
||||
|
||||
PropertyValue<TranslateAnchorType> CircleLayer::getDefaultCircleTranslateAnchor() {
|
||||
return { TranslateAnchorType::Map };
|
||||
}
|
||||
|
||||
const PropertyValue<TranslateAnchorType>& CircleLayer::getCircleTranslateAnchor() const {
|
||||
return impl().paint.template get<CircleTranslateAnchor>().value;
|
||||
}
|
||||
|
||||
void CircleLayer::setCircleTranslateAnchor(const PropertyValue<TranslateAnchorType>& value) {
|
||||
if (value == getCircleTranslateAnchor())
|
||||
return;
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<CircleTranslateAnchor>().value = value;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
void CircleLayer::setCircleTranslateAnchorTransition(const TransitionOptions& options) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<CircleTranslateAnchor>().options = options;
|
||||
baseImpl = std::move(impl_);
|
||||
}
|
||||
|
||||
TransitionOptions CircleLayer::getCircleTranslateAnchorTransition() const {
|
||||
return impl().paint.template get<CircleTranslateAnchor>().options;
|
||||
}
|
||||
|
||||
using namespace conversion;
|
||||
|
||||
optional<Error> CircleLayer::setPaintProperty(const std::string& name, const Convertible& value) {
|
||||
enum class Property : uint8_t {
|
||||
CircleRadius,
|
||||
CircleColor,
|
||||
CircleBlur,
|
||||
CircleColor,
|
||||
CircleOpacity,
|
||||
CircleTranslate,
|
||||
CircleTranslateAnchor,
|
||||
CirclePitchScale,
|
||||
CirclePitchAlignment,
|
||||
CircleStrokeWidth,
|
||||
CirclePitchScale,
|
||||
CircleRadius,
|
||||
CircleStrokeColor,
|
||||
CircleStrokeOpacity,
|
||||
CircleRadiusTransition,
|
||||
CircleColorTransition,
|
||||
CircleStrokeWidth,
|
||||
CircleTranslate,
|
||||
CircleTranslateAnchor,
|
||||
CircleBlurTransition,
|
||||
CircleColorTransition,
|
||||
CircleOpacityTransition,
|
||||
CircleTranslateTransition,
|
||||
CircleTranslateAnchorTransition,
|
||||
CirclePitchScaleTransition,
|
||||
CirclePitchAlignmentTransition,
|
||||
CircleStrokeWidthTransition,
|
||||
CirclePitchScaleTransition,
|
||||
CircleRadiusTransition,
|
||||
CircleStrokeColorTransition,
|
||||
CircleStrokeOpacityTransition,
|
||||
CircleStrokeWidthTransition,
|
||||
CircleTranslateTransition,
|
||||
CircleTranslateAnchorTransition,
|
||||
};
|
||||
|
||||
MAPBOX_ETERNAL_CONSTEXPR const auto properties = mapbox::eternal::hash_map<mapbox::eternal::string, uint8_t>({
|
||||
{ "circle-radius", static_cast<uint8_t>(Property::CircleRadius) },
|
||||
{ "circle-color", static_cast<uint8_t>(Property::CircleColor) },
|
||||
{ "circle-blur", static_cast<uint8_t>(Property::CircleBlur) },
|
||||
{ "circle-color", static_cast<uint8_t>(Property::CircleColor) },
|
||||
{ "circle-opacity", static_cast<uint8_t>(Property::CircleOpacity) },
|
||||
{ "circle-translate", static_cast<uint8_t>(Property::CircleTranslate) },
|
||||
{ "circle-translate-anchor", static_cast<uint8_t>(Property::CircleTranslateAnchor) },
|
||||
{ "circle-pitch-scale", static_cast<uint8_t>(Property::CirclePitchScale) },
|
||||
{ "circle-pitch-alignment", static_cast<uint8_t>(Property::CirclePitchAlignment) },
|
||||
{ "circle-stroke-width", static_cast<uint8_t>(Property::CircleStrokeWidth) },
|
||||
{ "circle-pitch-scale", static_cast<uint8_t>(Property::CirclePitchScale) },
|
||||
{ "circle-radius", static_cast<uint8_t>(Property::CircleRadius) },
|
||||
{ "circle-stroke-color", static_cast<uint8_t>(Property::CircleStrokeColor) },
|
||||
{ "circle-stroke-opacity", static_cast<uint8_t>(Property::CircleStrokeOpacity) },
|
||||
{ "circle-radius-transition", static_cast<uint8_t>(Property::CircleRadiusTransition) },
|
||||
{ "circle-color-transition", static_cast<uint8_t>(Property::CircleColorTransition) },
|
||||
{ "circle-stroke-width", static_cast<uint8_t>(Property::CircleStrokeWidth) },
|
||||
{ "circle-translate", static_cast<uint8_t>(Property::CircleTranslate) },
|
||||
{ "circle-translate-anchor", static_cast<uint8_t>(Property::CircleTranslateAnchor) },
|
||||
{ "circle-blur-transition", static_cast<uint8_t>(Property::CircleBlurTransition) },
|
||||
{ "circle-color-transition", static_cast<uint8_t>(Property::CircleColorTransition) },
|
||||
{ "circle-opacity-transition", static_cast<uint8_t>(Property::CircleOpacityTransition) },
|
||||
{ "circle-translate-transition", static_cast<uint8_t>(Property::CircleTranslateTransition) },
|
||||
{ "circle-translate-anchor-transition", static_cast<uint8_t>(Property::CircleTranslateAnchorTransition) },
|
||||
{ "circle-pitch-scale-transition", static_cast<uint8_t>(Property::CirclePitchScaleTransition) },
|
||||
{ "circle-pitch-alignment-transition", static_cast<uint8_t>(Property::CirclePitchAlignmentTransition) },
|
||||
{ "circle-stroke-width-transition", static_cast<uint8_t>(Property::CircleStrokeWidthTransition) },
|
||||
{ "circle-pitch-scale-transition", static_cast<uint8_t>(Property::CirclePitchScaleTransition) },
|
||||
{ "circle-radius-transition", static_cast<uint8_t>(Property::CircleRadiusTransition) },
|
||||
{ "circle-stroke-color-transition", static_cast<uint8_t>(Property::CircleStrokeColorTransition) },
|
||||
{ "circle-stroke-opacity-transition", static_cast<uint8_t>(Property::CircleStrokeOpacityTransition) }
|
||||
{ "circle-stroke-opacity-transition", static_cast<uint8_t>(Property::CircleStrokeOpacityTransition) },
|
||||
{ "circle-stroke-width-transition", static_cast<uint8_t>(Property::CircleStrokeWidthTransition) },
|
||||
{ "circle-translate-transition", static_cast<uint8_t>(Property::CircleTranslateTransition) },
|
||||
{ "circle-translate-anchor-transition", static_cast<uint8_t>(Property::CircleTranslateAnchorTransition) }
|
||||
});
|
||||
|
||||
const auto it = properties.find(name.c_str());
|
||||
@@ -421,18 +421,13 @@ optional<Error> CircleLayer::setPaintProperty(const std::string& name, const Con
|
||||
auto property = static_cast<Property>(it->second);
|
||||
|
||||
|
||||
if (property == Property::CircleRadius || property == Property::CircleBlur || property == Property::CircleOpacity || property == Property::CircleStrokeWidth || property == Property::CircleStrokeOpacity) {
|
||||
if (property == Property::CircleBlur || property == Property::CircleOpacity || property == Property::CircleRadius || property == Property::CircleStrokeOpacity || property == Property::CircleStrokeWidth) {
|
||||
Error error;
|
||||
optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, true, false);
|
||||
if (!typedValue) {
|
||||
return error;
|
||||
}
|
||||
|
||||
if (property == Property::CircleRadius) {
|
||||
setCircleRadius(*typedValue);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::CircleBlur) {
|
||||
setCircleBlur(*typedValue);
|
||||
return nullopt;
|
||||
@@ -443,8 +438,8 @@ optional<Error> CircleLayer::setPaintProperty(const std::string& name, const Con
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::CircleStrokeWidth) {
|
||||
setCircleStrokeWidth(*typedValue);
|
||||
if (property == Property::CircleRadius) {
|
||||
setCircleRadius(*typedValue);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
@@ -453,6 +448,11 @@ optional<Error> CircleLayer::setPaintProperty(const std::string& name, const Con
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::CircleStrokeWidth) {
|
||||
setCircleStrokeWidth(*typedValue);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (property == Property::CircleColor || property == Property::CircleStrokeColor) {
|
||||
@@ -474,6 +474,30 @@ optional<Error> CircleLayer::setPaintProperty(const std::string& name, const Con
|
||||
|
||||
}
|
||||
|
||||
if (property == Property::CirclePitchAlignment) {
|
||||
Error error;
|
||||
optional<PropertyValue<AlignmentType>> typedValue = convert<PropertyValue<AlignmentType>>(value, error, false, false);
|
||||
if (!typedValue) {
|
||||
return error;
|
||||
}
|
||||
|
||||
setCirclePitchAlignment(*typedValue);
|
||||
return nullopt;
|
||||
|
||||
}
|
||||
|
||||
if (property == Property::CirclePitchScale) {
|
||||
Error error;
|
||||
optional<PropertyValue<CirclePitchScaleType>> typedValue = convert<PropertyValue<CirclePitchScaleType>>(value, error, false, false);
|
||||
if (!typedValue) {
|
||||
return error;
|
||||
}
|
||||
|
||||
setCirclePitchScale(*typedValue);
|
||||
return nullopt;
|
||||
|
||||
}
|
||||
|
||||
if (property == Property::CircleTranslate) {
|
||||
Error error;
|
||||
optional<PropertyValue<std::array<float, 2>>> typedValue = convert<PropertyValue<std::array<float, 2>>>(value, error, false, false);
|
||||
@@ -498,30 +522,6 @@ optional<Error> CircleLayer::setPaintProperty(const std::string& name, const Con
|
||||
|
||||
}
|
||||
|
||||
if (property == Property::CirclePitchScale) {
|
||||
Error error;
|
||||
optional<PropertyValue<CirclePitchScaleType>> typedValue = convert<PropertyValue<CirclePitchScaleType>>(value, error, false, false);
|
||||
if (!typedValue) {
|
||||
return error;
|
||||
}
|
||||
|
||||
setCirclePitchScale(*typedValue);
|
||||
return nullopt;
|
||||
|
||||
}
|
||||
|
||||
if (property == Property::CirclePitchAlignment) {
|
||||
Error error;
|
||||
optional<PropertyValue<AlignmentType>> typedValue = convert<PropertyValue<AlignmentType>>(value, error, false, false);
|
||||
if (!typedValue) {
|
||||
return error;
|
||||
}
|
||||
|
||||
setCirclePitchAlignment(*typedValue);
|
||||
return nullopt;
|
||||
|
||||
}
|
||||
|
||||
|
||||
Error error;
|
||||
optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
|
||||
@@ -529,8 +529,8 @@ optional<Error> CircleLayer::setPaintProperty(const std::string& name, const Con
|
||||
return error;
|
||||
}
|
||||
|
||||
if (property == Property::CircleRadiusTransition) {
|
||||
setCircleRadiusTransition(*transition);
|
||||
if (property == Property::CircleBlurTransition) {
|
||||
setCircleBlurTransition(*transition);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
@@ -539,38 +539,23 @@ optional<Error> CircleLayer::setPaintProperty(const std::string& name, const Con
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::CircleBlurTransition) {
|
||||
setCircleBlurTransition(*transition);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::CircleOpacityTransition) {
|
||||
setCircleOpacityTransition(*transition);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::CircleTranslateTransition) {
|
||||
setCircleTranslateTransition(*transition);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::CircleTranslateAnchorTransition) {
|
||||
setCircleTranslateAnchorTransition(*transition);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::CirclePitchScaleTransition) {
|
||||
setCirclePitchScaleTransition(*transition);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::CirclePitchAlignmentTransition) {
|
||||
setCirclePitchAlignmentTransition(*transition);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::CircleStrokeWidthTransition) {
|
||||
setCircleStrokeWidthTransition(*transition);
|
||||
if (property == Property::CirclePitchScaleTransition) {
|
||||
setCirclePitchScaleTransition(*transition);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::CircleRadiusTransition) {
|
||||
setCircleRadiusTransition(*transition);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
@@ -584,6 +569,21 @@ optional<Error> CircleLayer::setPaintProperty(const std::string& name, const Con
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::CircleStrokeWidthTransition) {
|
||||
setCircleStrokeWidthTransition(*transition);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::CircleTranslateTransition) {
|
||||
setCircleTranslateTransition(*transition);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::CircleTranslateAnchorTransition) {
|
||||
setCircleTranslateAnchorTransition(*transition);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
|
||||
return Error { "layer doesn't support this property" };
|
||||
}
|
||||
|
||||
@@ -14,40 +14,28 @@
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
struct CircleRadius : DataDrivenPaintProperty<float, attributes::radius, uniforms::radius> {
|
||||
static float defaultValue() { return 5; }
|
||||
struct CircleBlur : DataDrivenPaintProperty<float, attributes::blur, uniforms::blur> {
|
||||
static float defaultValue() { return 0; }
|
||||
};
|
||||
|
||||
struct CircleColor : DataDrivenPaintProperty<Color, attributes::color, uniforms::color> {
|
||||
static Color defaultValue() { return Color::black(); }
|
||||
};
|
||||
|
||||
struct CircleBlur : DataDrivenPaintProperty<float, attributes::blur, uniforms::blur> {
|
||||
static float defaultValue() { return 0; }
|
||||
};
|
||||
|
||||
struct CircleOpacity : DataDrivenPaintProperty<float, attributes::opacity, uniforms::opacity> {
|
||||
static float defaultValue() { return 1; }
|
||||
};
|
||||
|
||||
struct CircleTranslate : PaintProperty<std::array<float, 2>> {
|
||||
static std::array<float, 2> defaultValue() { return {{ 0, 0 }}; }
|
||||
};
|
||||
|
||||
struct CircleTranslateAnchor : PaintProperty<TranslateAnchorType> {
|
||||
static TranslateAnchorType defaultValue() { return TranslateAnchorType::Map; }
|
||||
};
|
||||
|
||||
struct CirclePitchScale : PaintProperty<CirclePitchScaleType> {
|
||||
static CirclePitchScaleType defaultValue() { return CirclePitchScaleType::Map; }
|
||||
};
|
||||
|
||||
struct CirclePitchAlignment : PaintProperty<AlignmentType> {
|
||||
static AlignmentType defaultValue() { return AlignmentType::Viewport; }
|
||||
};
|
||||
|
||||
struct CircleStrokeWidth : DataDrivenPaintProperty<float, attributes::stroke_width, uniforms::stroke_width> {
|
||||
static float defaultValue() { return 0; }
|
||||
struct CirclePitchScale : PaintProperty<CirclePitchScaleType> {
|
||||
static CirclePitchScaleType defaultValue() { return CirclePitchScaleType::Map; }
|
||||
};
|
||||
|
||||
struct CircleRadius : DataDrivenPaintProperty<float, attributes::radius, uniforms::radius> {
|
||||
static float defaultValue() { return 5; }
|
||||
};
|
||||
|
||||
struct CircleStrokeColor : DataDrivenPaintProperty<Color, attributes::stroke_color, uniforms::stroke_color> {
|
||||
@@ -58,18 +46,30 @@ struct CircleStrokeOpacity : DataDrivenPaintProperty<float, attributes::stroke_o
|
||||
static float defaultValue() { return 1; }
|
||||
};
|
||||
|
||||
struct CircleStrokeWidth : DataDrivenPaintProperty<float, attributes::stroke_width, uniforms::stroke_width> {
|
||||
static float defaultValue() { return 0; }
|
||||
};
|
||||
|
||||
struct CircleTranslate : PaintProperty<std::array<float, 2>> {
|
||||
static std::array<float, 2> defaultValue() { return {{ 0, 0 }}; }
|
||||
};
|
||||
|
||||
struct CircleTranslateAnchor : PaintProperty<TranslateAnchorType> {
|
||||
static TranslateAnchorType defaultValue() { return TranslateAnchorType::Map; }
|
||||
};
|
||||
|
||||
class CirclePaintProperties : public Properties<
|
||||
CircleRadius,
|
||||
CircleColor,
|
||||
CircleBlur,
|
||||
CircleColor,
|
||||
CircleOpacity,
|
||||
CircleTranslate,
|
||||
CircleTranslateAnchor,
|
||||
CirclePitchScale,
|
||||
CirclePitchAlignment,
|
||||
CircleStrokeWidth,
|
||||
CirclePitchScale,
|
||||
CircleRadius,
|
||||
CircleStrokeColor,
|
||||
CircleStrokeOpacity
|
||||
CircleStrokeOpacity,
|
||||
CircleStrokeWidth,
|
||||
CircleTranslate,
|
||||
CircleTranslateAnchor
|
||||
> {};
|
||||
|
||||
class CircleLayerProperties final : public LayerProperties {
|
||||
|
||||
@@ -63,31 +63,31 @@ void FillExtrusionLayer::Impl::stringifyLayout(rapidjson::Writer<rapidjson::Stri
|
||||
|
||||
// Paint properties
|
||||
|
||||
PropertyValue<float> FillExtrusionLayer::getDefaultFillExtrusionOpacity() {
|
||||
return { 1 };
|
||||
PropertyValue<float> FillExtrusionLayer::getDefaultFillExtrusionBase() {
|
||||
return { 0 };
|
||||
}
|
||||
|
||||
const PropertyValue<float>& FillExtrusionLayer::getFillExtrusionOpacity() const {
|
||||
return impl().paint.template get<FillExtrusionOpacity>().value;
|
||||
const PropertyValue<float>& FillExtrusionLayer::getFillExtrusionBase() const {
|
||||
return impl().paint.template get<FillExtrusionBase>().value;
|
||||
}
|
||||
|
||||
void FillExtrusionLayer::setFillExtrusionOpacity(const PropertyValue<float>& value) {
|
||||
if (value == getFillExtrusionOpacity())
|
||||
void FillExtrusionLayer::setFillExtrusionBase(const PropertyValue<float>& value) {
|
||||
if (value == getFillExtrusionBase())
|
||||
return;
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<FillExtrusionOpacity>().value = value;
|
||||
impl_->paint.template get<FillExtrusionBase>().value = value;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
void FillExtrusionLayer::setFillExtrusionOpacityTransition(const TransitionOptions& options) {
|
||||
void FillExtrusionLayer::setFillExtrusionBaseTransition(const TransitionOptions& options) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<FillExtrusionOpacity>().options = options;
|
||||
impl_->paint.template get<FillExtrusionBase>().options = options;
|
||||
baseImpl = std::move(impl_);
|
||||
}
|
||||
|
||||
TransitionOptions FillExtrusionLayer::getFillExtrusionOpacityTransition() const {
|
||||
return impl().paint.template get<FillExtrusionOpacity>().options;
|
||||
TransitionOptions FillExtrusionLayer::getFillExtrusionBaseTransition() const {
|
||||
return impl().paint.template get<FillExtrusionBase>().options;
|
||||
}
|
||||
|
||||
PropertyValue<Color> FillExtrusionLayer::getDefaultFillExtrusionColor() {
|
||||
@@ -117,6 +117,87 @@ TransitionOptions FillExtrusionLayer::getFillExtrusionColorTransition() const {
|
||||
return impl().paint.template get<FillExtrusionColor>().options;
|
||||
}
|
||||
|
||||
PropertyValue<float> FillExtrusionLayer::getDefaultFillExtrusionHeight() {
|
||||
return { 0 };
|
||||
}
|
||||
|
||||
const PropertyValue<float>& FillExtrusionLayer::getFillExtrusionHeight() const {
|
||||
return impl().paint.template get<FillExtrusionHeight>().value;
|
||||
}
|
||||
|
||||
void FillExtrusionLayer::setFillExtrusionHeight(const PropertyValue<float>& value) {
|
||||
if (value == getFillExtrusionHeight())
|
||||
return;
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<FillExtrusionHeight>().value = value;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
void FillExtrusionLayer::setFillExtrusionHeightTransition(const TransitionOptions& options) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<FillExtrusionHeight>().options = options;
|
||||
baseImpl = std::move(impl_);
|
||||
}
|
||||
|
||||
TransitionOptions FillExtrusionLayer::getFillExtrusionHeightTransition() const {
|
||||
return impl().paint.template get<FillExtrusionHeight>().options;
|
||||
}
|
||||
|
||||
PropertyValue<float> FillExtrusionLayer::getDefaultFillExtrusionOpacity() {
|
||||
return { 1 };
|
||||
}
|
||||
|
||||
const PropertyValue<float>& FillExtrusionLayer::getFillExtrusionOpacity() const {
|
||||
return impl().paint.template get<FillExtrusionOpacity>().value;
|
||||
}
|
||||
|
||||
void FillExtrusionLayer::setFillExtrusionOpacity(const PropertyValue<float>& value) {
|
||||
if (value == getFillExtrusionOpacity())
|
||||
return;
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<FillExtrusionOpacity>().value = value;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
void FillExtrusionLayer::setFillExtrusionOpacityTransition(const TransitionOptions& options) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<FillExtrusionOpacity>().options = options;
|
||||
baseImpl = std::move(impl_);
|
||||
}
|
||||
|
||||
TransitionOptions FillExtrusionLayer::getFillExtrusionOpacityTransition() const {
|
||||
return impl().paint.template get<FillExtrusionOpacity>().options;
|
||||
}
|
||||
|
||||
PropertyValue<std::string> FillExtrusionLayer::getDefaultFillExtrusionPattern() {
|
||||
return { "" };
|
||||
}
|
||||
|
||||
const PropertyValue<std::string>& FillExtrusionLayer::getFillExtrusionPattern() const {
|
||||
return impl().paint.template get<FillExtrusionPattern>().value;
|
||||
}
|
||||
|
||||
void FillExtrusionLayer::setFillExtrusionPattern(const PropertyValue<std::string>& value) {
|
||||
if (value == getFillExtrusionPattern())
|
||||
return;
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<FillExtrusionPattern>().value = value;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
void FillExtrusionLayer::setFillExtrusionPatternTransition(const TransitionOptions& options) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<FillExtrusionPattern>().options = options;
|
||||
baseImpl = std::move(impl_);
|
||||
}
|
||||
|
||||
TransitionOptions FillExtrusionLayer::getFillExtrusionPatternTransition() const {
|
||||
return impl().paint.template get<FillExtrusionPattern>().options;
|
||||
}
|
||||
|
||||
PropertyValue<std::array<float, 2>> FillExtrusionLayer::getDefaultFillExtrusionTranslate() {
|
||||
return { {{ 0, 0 }} };
|
||||
}
|
||||
@@ -171,87 +252,6 @@ TransitionOptions FillExtrusionLayer::getFillExtrusionTranslateAnchorTransition(
|
||||
return impl().paint.template get<FillExtrusionTranslateAnchor>().options;
|
||||
}
|
||||
|
||||
PropertyValue<std::string> FillExtrusionLayer::getDefaultFillExtrusionPattern() {
|
||||
return { "" };
|
||||
}
|
||||
|
||||
const PropertyValue<std::string>& FillExtrusionLayer::getFillExtrusionPattern() const {
|
||||
return impl().paint.template get<FillExtrusionPattern>().value;
|
||||
}
|
||||
|
||||
void FillExtrusionLayer::setFillExtrusionPattern(const PropertyValue<std::string>& value) {
|
||||
if (value == getFillExtrusionPattern())
|
||||
return;
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<FillExtrusionPattern>().value = value;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
void FillExtrusionLayer::setFillExtrusionPatternTransition(const TransitionOptions& options) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<FillExtrusionPattern>().options = options;
|
||||
baseImpl = std::move(impl_);
|
||||
}
|
||||
|
||||
TransitionOptions FillExtrusionLayer::getFillExtrusionPatternTransition() const {
|
||||
return impl().paint.template get<FillExtrusionPattern>().options;
|
||||
}
|
||||
|
||||
PropertyValue<float> FillExtrusionLayer::getDefaultFillExtrusionHeight() {
|
||||
return { 0 };
|
||||
}
|
||||
|
||||
const PropertyValue<float>& FillExtrusionLayer::getFillExtrusionHeight() const {
|
||||
return impl().paint.template get<FillExtrusionHeight>().value;
|
||||
}
|
||||
|
||||
void FillExtrusionLayer::setFillExtrusionHeight(const PropertyValue<float>& value) {
|
||||
if (value == getFillExtrusionHeight())
|
||||
return;
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<FillExtrusionHeight>().value = value;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
void FillExtrusionLayer::setFillExtrusionHeightTransition(const TransitionOptions& options) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<FillExtrusionHeight>().options = options;
|
||||
baseImpl = std::move(impl_);
|
||||
}
|
||||
|
||||
TransitionOptions FillExtrusionLayer::getFillExtrusionHeightTransition() const {
|
||||
return impl().paint.template get<FillExtrusionHeight>().options;
|
||||
}
|
||||
|
||||
PropertyValue<float> FillExtrusionLayer::getDefaultFillExtrusionBase() {
|
||||
return { 0 };
|
||||
}
|
||||
|
||||
const PropertyValue<float>& FillExtrusionLayer::getFillExtrusionBase() const {
|
||||
return impl().paint.template get<FillExtrusionBase>().value;
|
||||
}
|
||||
|
||||
void FillExtrusionLayer::setFillExtrusionBase(const PropertyValue<float>& value) {
|
||||
if (value == getFillExtrusionBase())
|
||||
return;
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<FillExtrusionBase>().value = value;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
void FillExtrusionLayer::setFillExtrusionBaseTransition(const TransitionOptions& options) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<FillExtrusionBase>().options = options;
|
||||
baseImpl = std::move(impl_);
|
||||
}
|
||||
|
||||
TransitionOptions FillExtrusionLayer::getFillExtrusionBaseTransition() const {
|
||||
return impl().paint.template get<FillExtrusionBase>().options;
|
||||
}
|
||||
|
||||
PropertyValue<bool> FillExtrusionLayer::getDefaultFillExtrusionVerticalGradient() {
|
||||
return { true };
|
||||
}
|
||||
@@ -283,40 +283,40 @@ using namespace conversion;
|
||||
|
||||
optional<Error> FillExtrusionLayer::setPaintProperty(const std::string& name, const Convertible& value) {
|
||||
enum class Property : uint8_t {
|
||||
FillExtrusionOpacity,
|
||||
FillExtrusionBase,
|
||||
FillExtrusionColor,
|
||||
FillExtrusionHeight,
|
||||
FillExtrusionOpacity,
|
||||
FillExtrusionPattern,
|
||||
FillExtrusionTranslate,
|
||||
FillExtrusionTranslateAnchor,
|
||||
FillExtrusionPattern,
|
||||
FillExtrusionHeight,
|
||||
FillExtrusionBase,
|
||||
FillExtrusionVerticalGradient,
|
||||
FillExtrusionOpacityTransition,
|
||||
FillExtrusionBaseTransition,
|
||||
FillExtrusionColorTransition,
|
||||
FillExtrusionHeightTransition,
|
||||
FillExtrusionOpacityTransition,
|
||||
FillExtrusionPatternTransition,
|
||||
FillExtrusionTranslateTransition,
|
||||
FillExtrusionTranslateAnchorTransition,
|
||||
FillExtrusionPatternTransition,
|
||||
FillExtrusionHeightTransition,
|
||||
FillExtrusionBaseTransition,
|
||||
FillExtrusionVerticalGradientTransition,
|
||||
};
|
||||
|
||||
MAPBOX_ETERNAL_CONSTEXPR const auto properties = mapbox::eternal::hash_map<mapbox::eternal::string, uint8_t>({
|
||||
{ "fill-extrusion-opacity", static_cast<uint8_t>(Property::FillExtrusionOpacity) },
|
||||
{ "fill-extrusion-base", static_cast<uint8_t>(Property::FillExtrusionBase) },
|
||||
{ "fill-extrusion-color", static_cast<uint8_t>(Property::FillExtrusionColor) },
|
||||
{ "fill-extrusion-height", static_cast<uint8_t>(Property::FillExtrusionHeight) },
|
||||
{ "fill-extrusion-opacity", static_cast<uint8_t>(Property::FillExtrusionOpacity) },
|
||||
{ "fill-extrusion-pattern", static_cast<uint8_t>(Property::FillExtrusionPattern) },
|
||||
{ "fill-extrusion-translate", static_cast<uint8_t>(Property::FillExtrusionTranslate) },
|
||||
{ "fill-extrusion-translate-anchor", static_cast<uint8_t>(Property::FillExtrusionTranslateAnchor) },
|
||||
{ "fill-extrusion-pattern", static_cast<uint8_t>(Property::FillExtrusionPattern) },
|
||||
{ "fill-extrusion-height", static_cast<uint8_t>(Property::FillExtrusionHeight) },
|
||||
{ "fill-extrusion-base", static_cast<uint8_t>(Property::FillExtrusionBase) },
|
||||
{ "fill-extrusion-vertical-gradient", static_cast<uint8_t>(Property::FillExtrusionVerticalGradient) },
|
||||
{ "fill-extrusion-opacity-transition", static_cast<uint8_t>(Property::FillExtrusionOpacityTransition) },
|
||||
{ "fill-extrusion-base-transition", static_cast<uint8_t>(Property::FillExtrusionBaseTransition) },
|
||||
{ "fill-extrusion-color-transition", static_cast<uint8_t>(Property::FillExtrusionColorTransition) },
|
||||
{ "fill-extrusion-height-transition", static_cast<uint8_t>(Property::FillExtrusionHeightTransition) },
|
||||
{ "fill-extrusion-opacity-transition", static_cast<uint8_t>(Property::FillExtrusionOpacityTransition) },
|
||||
{ "fill-extrusion-pattern-transition", static_cast<uint8_t>(Property::FillExtrusionPatternTransition) },
|
||||
{ "fill-extrusion-translate-transition", static_cast<uint8_t>(Property::FillExtrusionTranslateTransition) },
|
||||
{ "fill-extrusion-translate-anchor-transition", static_cast<uint8_t>(Property::FillExtrusionTranslateAnchorTransition) },
|
||||
{ "fill-extrusion-pattern-transition", static_cast<uint8_t>(Property::FillExtrusionPatternTransition) },
|
||||
{ "fill-extrusion-height-transition", static_cast<uint8_t>(Property::FillExtrusionHeightTransition) },
|
||||
{ "fill-extrusion-base-transition", static_cast<uint8_t>(Property::FillExtrusionBaseTransition) },
|
||||
{ "fill-extrusion-vertical-gradient-transition", static_cast<uint8_t>(Property::FillExtrusionVerticalGradientTransition) }
|
||||
});
|
||||
|
||||
@@ -328,6 +328,37 @@ optional<Error> FillExtrusionLayer::setPaintProperty(const std::string& name, co
|
||||
auto property = static_cast<Property>(it->second);
|
||||
|
||||
|
||||
if (property == Property::FillExtrusionBase || property == Property::FillExtrusionHeight) {
|
||||
Error error;
|
||||
optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, true, false);
|
||||
if (!typedValue) {
|
||||
return error;
|
||||
}
|
||||
|
||||
if (property == Property::FillExtrusionBase) {
|
||||
setFillExtrusionBase(*typedValue);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::FillExtrusionHeight) {
|
||||
setFillExtrusionHeight(*typedValue);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (property == Property::FillExtrusionColor) {
|
||||
Error error;
|
||||
optional<PropertyValue<Color>> typedValue = convert<PropertyValue<Color>>(value, error, true, false);
|
||||
if (!typedValue) {
|
||||
return error;
|
||||
}
|
||||
|
||||
setFillExtrusionColor(*typedValue);
|
||||
return nullopt;
|
||||
|
||||
}
|
||||
|
||||
if (property == Property::FillExtrusionOpacity) {
|
||||
Error error;
|
||||
optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, false, false);
|
||||
@@ -340,14 +371,14 @@ optional<Error> FillExtrusionLayer::setPaintProperty(const std::string& name, co
|
||||
|
||||
}
|
||||
|
||||
if (property == Property::FillExtrusionColor) {
|
||||
if (property == Property::FillExtrusionPattern) {
|
||||
Error error;
|
||||
optional<PropertyValue<Color>> typedValue = convert<PropertyValue<Color>>(value, error, true, false);
|
||||
optional<PropertyValue<std::string>> typedValue = convert<PropertyValue<std::string>>(value, error, true, false);
|
||||
if (!typedValue) {
|
||||
return error;
|
||||
}
|
||||
|
||||
setFillExtrusionColor(*typedValue);
|
||||
setFillExtrusionPattern(*typedValue);
|
||||
return nullopt;
|
||||
|
||||
}
|
||||
@@ -376,37 +407,6 @@ optional<Error> FillExtrusionLayer::setPaintProperty(const std::string& name, co
|
||||
|
||||
}
|
||||
|
||||
if (property == Property::FillExtrusionPattern) {
|
||||
Error error;
|
||||
optional<PropertyValue<std::string>> typedValue = convert<PropertyValue<std::string>>(value, error, true, false);
|
||||
if (!typedValue) {
|
||||
return error;
|
||||
}
|
||||
|
||||
setFillExtrusionPattern(*typedValue);
|
||||
return nullopt;
|
||||
|
||||
}
|
||||
|
||||
if (property == Property::FillExtrusionHeight || property == Property::FillExtrusionBase) {
|
||||
Error error;
|
||||
optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, true, false);
|
||||
if (!typedValue) {
|
||||
return error;
|
||||
}
|
||||
|
||||
if (property == Property::FillExtrusionHeight) {
|
||||
setFillExtrusionHeight(*typedValue);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::FillExtrusionBase) {
|
||||
setFillExtrusionBase(*typedValue);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (property == Property::FillExtrusionVerticalGradient) {
|
||||
Error error;
|
||||
optional<PropertyValue<bool>> typedValue = convert<PropertyValue<bool>>(value, error, false, false);
|
||||
@@ -426,8 +426,8 @@ optional<Error> FillExtrusionLayer::setPaintProperty(const std::string& name, co
|
||||
return error;
|
||||
}
|
||||
|
||||
if (property == Property::FillExtrusionOpacityTransition) {
|
||||
setFillExtrusionOpacityTransition(*transition);
|
||||
if (property == Property::FillExtrusionBaseTransition) {
|
||||
setFillExtrusionBaseTransition(*transition);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
@@ -436,6 +436,21 @@ optional<Error> FillExtrusionLayer::setPaintProperty(const std::string& name, co
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::FillExtrusionHeightTransition) {
|
||||
setFillExtrusionHeightTransition(*transition);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::FillExtrusionOpacityTransition) {
|
||||
setFillExtrusionOpacityTransition(*transition);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::FillExtrusionPatternTransition) {
|
||||
setFillExtrusionPatternTransition(*transition);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::FillExtrusionTranslateTransition) {
|
||||
setFillExtrusionTranslateTransition(*transition);
|
||||
return nullopt;
|
||||
@@ -446,21 +461,6 @@ optional<Error> FillExtrusionLayer::setPaintProperty(const std::string& name, co
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::FillExtrusionPatternTransition) {
|
||||
setFillExtrusionPatternTransition(*transition);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::FillExtrusionHeightTransition) {
|
||||
setFillExtrusionHeightTransition(*transition);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::FillExtrusionBaseTransition) {
|
||||
setFillExtrusionBaseTransition(*transition);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::FillExtrusionVerticalGradientTransition) {
|
||||
setFillExtrusionVerticalGradientTransition(*transition);
|
||||
return nullopt;
|
||||
|
||||
@@ -14,14 +14,26 @@
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
struct FillExtrusionOpacity : PaintProperty<float> {
|
||||
static float defaultValue() { return 1; }
|
||||
struct FillExtrusionBase : DataDrivenPaintProperty<float, attributes::base, uniforms::base> {
|
||||
static float defaultValue() { return 0; }
|
||||
};
|
||||
|
||||
struct FillExtrusionColor : DataDrivenPaintProperty<Color, attributes::color, uniforms::color> {
|
||||
static Color defaultValue() { return Color::black(); }
|
||||
};
|
||||
|
||||
struct FillExtrusionHeight : DataDrivenPaintProperty<float, attributes::height, uniforms::height> {
|
||||
static float defaultValue() { return 0; }
|
||||
};
|
||||
|
||||
struct FillExtrusionOpacity : PaintProperty<float> {
|
||||
static float defaultValue() { return 1; }
|
||||
};
|
||||
|
||||
struct FillExtrusionPattern : CrossFadedDataDrivenPaintProperty<std::string, attributes::pattern_to, uniforms::pattern_to, attributes::pattern_from, uniforms::pattern_from> {
|
||||
static std::string defaultValue() { return ""; }
|
||||
};
|
||||
|
||||
struct FillExtrusionTranslate : PaintProperty<std::array<float, 2>> {
|
||||
static std::array<float, 2> defaultValue() { return {{ 0, 0 }}; }
|
||||
};
|
||||
@@ -30,30 +42,18 @@ struct FillExtrusionTranslateAnchor : PaintProperty<TranslateAnchorType> {
|
||||
static TranslateAnchorType defaultValue() { return TranslateAnchorType::Map; }
|
||||
};
|
||||
|
||||
struct FillExtrusionPattern : CrossFadedDataDrivenPaintProperty<std::string, attributes::pattern_to, uniforms::pattern_to, attributes::pattern_from, uniforms::pattern_from> {
|
||||
static std::string defaultValue() { return ""; }
|
||||
};
|
||||
|
||||
struct FillExtrusionHeight : DataDrivenPaintProperty<float, attributes::height, uniforms::height> {
|
||||
static float defaultValue() { return 0; }
|
||||
};
|
||||
|
||||
struct FillExtrusionBase : DataDrivenPaintProperty<float, attributes::base, uniforms::base> {
|
||||
static float defaultValue() { return 0; }
|
||||
};
|
||||
|
||||
struct FillExtrusionVerticalGradient : PaintProperty<bool> {
|
||||
static bool defaultValue() { return true; }
|
||||
};
|
||||
|
||||
class FillExtrusionPaintProperties : public Properties<
|
||||
FillExtrusionOpacity,
|
||||
FillExtrusionBase,
|
||||
FillExtrusionColor,
|
||||
FillExtrusionHeight,
|
||||
FillExtrusionOpacity,
|
||||
FillExtrusionPattern,
|
||||
FillExtrusionTranslate,
|
||||
FillExtrusionTranslateAnchor,
|
||||
FillExtrusionPattern,
|
||||
FillExtrusionHeight,
|
||||
FillExtrusionBase,
|
||||
FillExtrusionVerticalGradient
|
||||
> {};
|
||||
|
||||
|
||||
@@ -90,33 +90,6 @@ TransitionOptions FillLayer::getFillAntialiasTransition() const {
|
||||
return impl().paint.template get<FillAntialias>().options;
|
||||
}
|
||||
|
||||
PropertyValue<float> FillLayer::getDefaultFillOpacity() {
|
||||
return { 1 };
|
||||
}
|
||||
|
||||
const PropertyValue<float>& FillLayer::getFillOpacity() const {
|
||||
return impl().paint.template get<FillOpacity>().value;
|
||||
}
|
||||
|
||||
void FillLayer::setFillOpacity(const PropertyValue<float>& value) {
|
||||
if (value == getFillOpacity())
|
||||
return;
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<FillOpacity>().value = value;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
void FillLayer::setFillOpacityTransition(const TransitionOptions& options) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<FillOpacity>().options = options;
|
||||
baseImpl = std::move(impl_);
|
||||
}
|
||||
|
||||
TransitionOptions FillLayer::getFillOpacityTransition() const {
|
||||
return impl().paint.template get<FillOpacity>().options;
|
||||
}
|
||||
|
||||
PropertyValue<Color> FillLayer::getDefaultFillColor() {
|
||||
return { Color::black() };
|
||||
}
|
||||
@@ -144,6 +117,33 @@ TransitionOptions FillLayer::getFillColorTransition() const {
|
||||
return impl().paint.template get<FillColor>().options;
|
||||
}
|
||||
|
||||
PropertyValue<float> FillLayer::getDefaultFillOpacity() {
|
||||
return { 1 };
|
||||
}
|
||||
|
||||
const PropertyValue<float>& FillLayer::getFillOpacity() const {
|
||||
return impl().paint.template get<FillOpacity>().value;
|
||||
}
|
||||
|
||||
void FillLayer::setFillOpacity(const PropertyValue<float>& value) {
|
||||
if (value == getFillOpacity())
|
||||
return;
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<FillOpacity>().value = value;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
void FillLayer::setFillOpacityTransition(const TransitionOptions& options) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<FillOpacity>().options = options;
|
||||
baseImpl = std::move(impl_);
|
||||
}
|
||||
|
||||
TransitionOptions FillLayer::getFillOpacityTransition() const {
|
||||
return impl().paint.template get<FillOpacity>().options;
|
||||
}
|
||||
|
||||
PropertyValue<Color> FillLayer::getDefaultFillOutlineColor() {
|
||||
return { {} };
|
||||
}
|
||||
@@ -171,6 +171,33 @@ TransitionOptions FillLayer::getFillOutlineColorTransition() const {
|
||||
return impl().paint.template get<FillOutlineColor>().options;
|
||||
}
|
||||
|
||||
PropertyValue<std::string> FillLayer::getDefaultFillPattern() {
|
||||
return { "" };
|
||||
}
|
||||
|
||||
const PropertyValue<std::string>& FillLayer::getFillPattern() const {
|
||||
return impl().paint.template get<FillPattern>().value;
|
||||
}
|
||||
|
||||
void FillLayer::setFillPattern(const PropertyValue<std::string>& value) {
|
||||
if (value == getFillPattern())
|
||||
return;
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<FillPattern>().value = value;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
void FillLayer::setFillPatternTransition(const TransitionOptions& options) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<FillPattern>().options = options;
|
||||
baseImpl = std::move(impl_);
|
||||
}
|
||||
|
||||
TransitionOptions FillLayer::getFillPatternTransition() const {
|
||||
return impl().paint.template get<FillPattern>().options;
|
||||
}
|
||||
|
||||
PropertyValue<std::array<float, 2>> FillLayer::getDefaultFillTranslate() {
|
||||
return { {{ 0, 0 }} };
|
||||
}
|
||||
@@ -225,68 +252,41 @@ TransitionOptions FillLayer::getFillTranslateAnchorTransition() const {
|
||||
return impl().paint.template get<FillTranslateAnchor>().options;
|
||||
}
|
||||
|
||||
PropertyValue<std::string> FillLayer::getDefaultFillPattern() {
|
||||
return { "" };
|
||||
}
|
||||
|
||||
const PropertyValue<std::string>& FillLayer::getFillPattern() const {
|
||||
return impl().paint.template get<FillPattern>().value;
|
||||
}
|
||||
|
||||
void FillLayer::setFillPattern(const PropertyValue<std::string>& value) {
|
||||
if (value == getFillPattern())
|
||||
return;
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<FillPattern>().value = value;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
void FillLayer::setFillPatternTransition(const TransitionOptions& options) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<FillPattern>().options = options;
|
||||
baseImpl = std::move(impl_);
|
||||
}
|
||||
|
||||
TransitionOptions FillLayer::getFillPatternTransition() const {
|
||||
return impl().paint.template get<FillPattern>().options;
|
||||
}
|
||||
|
||||
using namespace conversion;
|
||||
|
||||
optional<Error> FillLayer::setPaintProperty(const std::string& name, const Convertible& value) {
|
||||
enum class Property : uint8_t {
|
||||
FillAntialias,
|
||||
FillOpacity,
|
||||
FillColor,
|
||||
FillOpacity,
|
||||
FillOutlineColor,
|
||||
FillPattern,
|
||||
FillTranslate,
|
||||
FillTranslateAnchor,
|
||||
FillPattern,
|
||||
FillAntialiasTransition,
|
||||
FillOpacityTransition,
|
||||
FillColorTransition,
|
||||
FillOpacityTransition,
|
||||
FillOutlineColorTransition,
|
||||
FillPatternTransition,
|
||||
FillTranslateTransition,
|
||||
FillTranslateAnchorTransition,
|
||||
FillPatternTransition,
|
||||
};
|
||||
|
||||
MAPBOX_ETERNAL_CONSTEXPR const auto properties = mapbox::eternal::hash_map<mapbox::eternal::string, uint8_t>({
|
||||
{ "fill-antialias", static_cast<uint8_t>(Property::FillAntialias) },
|
||||
{ "fill-opacity", static_cast<uint8_t>(Property::FillOpacity) },
|
||||
{ "fill-color", static_cast<uint8_t>(Property::FillColor) },
|
||||
{ "fill-opacity", static_cast<uint8_t>(Property::FillOpacity) },
|
||||
{ "fill-outline-color", static_cast<uint8_t>(Property::FillOutlineColor) },
|
||||
{ "fill-pattern", static_cast<uint8_t>(Property::FillPattern) },
|
||||
{ "fill-translate", static_cast<uint8_t>(Property::FillTranslate) },
|
||||
{ "fill-translate-anchor", static_cast<uint8_t>(Property::FillTranslateAnchor) },
|
||||
{ "fill-pattern", static_cast<uint8_t>(Property::FillPattern) },
|
||||
{ "fill-antialias-transition", static_cast<uint8_t>(Property::FillAntialiasTransition) },
|
||||
{ "fill-opacity-transition", static_cast<uint8_t>(Property::FillOpacityTransition) },
|
||||
{ "fill-color-transition", static_cast<uint8_t>(Property::FillColorTransition) },
|
||||
{ "fill-opacity-transition", static_cast<uint8_t>(Property::FillOpacityTransition) },
|
||||
{ "fill-outline-color-transition", static_cast<uint8_t>(Property::FillOutlineColorTransition) },
|
||||
{ "fill-pattern-transition", static_cast<uint8_t>(Property::FillPatternTransition) },
|
||||
{ "fill-translate-transition", static_cast<uint8_t>(Property::FillTranslateTransition) },
|
||||
{ "fill-translate-anchor-transition", static_cast<uint8_t>(Property::FillTranslateAnchorTransition) },
|
||||
{ "fill-pattern-transition", static_cast<uint8_t>(Property::FillPatternTransition) }
|
||||
{ "fill-translate-anchor-transition", static_cast<uint8_t>(Property::FillTranslateAnchorTransition) }
|
||||
});
|
||||
|
||||
const auto it = properties.find(name.c_str());
|
||||
@@ -309,18 +309,6 @@ optional<Error> FillLayer::setPaintProperty(const std::string& name, const Conve
|
||||
|
||||
}
|
||||
|
||||
if (property == Property::FillOpacity) {
|
||||
Error error;
|
||||
optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, true, false);
|
||||
if (!typedValue) {
|
||||
return error;
|
||||
}
|
||||
|
||||
setFillOpacity(*typedValue);
|
||||
return nullopt;
|
||||
|
||||
}
|
||||
|
||||
if (property == Property::FillColor || property == Property::FillOutlineColor) {
|
||||
Error error;
|
||||
optional<PropertyValue<Color>> typedValue = convert<PropertyValue<Color>>(value, error, true, false);
|
||||
@@ -340,6 +328,30 @@ optional<Error> FillLayer::setPaintProperty(const std::string& name, const Conve
|
||||
|
||||
}
|
||||
|
||||
if (property == Property::FillOpacity) {
|
||||
Error error;
|
||||
optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, true, false);
|
||||
if (!typedValue) {
|
||||
return error;
|
||||
}
|
||||
|
||||
setFillOpacity(*typedValue);
|
||||
return nullopt;
|
||||
|
||||
}
|
||||
|
||||
if (property == Property::FillPattern) {
|
||||
Error error;
|
||||
optional<PropertyValue<std::string>> typedValue = convert<PropertyValue<std::string>>(value, error, true, false);
|
||||
if (!typedValue) {
|
||||
return error;
|
||||
}
|
||||
|
||||
setFillPattern(*typedValue);
|
||||
return nullopt;
|
||||
|
||||
}
|
||||
|
||||
if (property == Property::FillTranslate) {
|
||||
Error error;
|
||||
optional<PropertyValue<std::array<float, 2>>> typedValue = convert<PropertyValue<std::array<float, 2>>>(value, error, false, false);
|
||||
@@ -364,18 +376,6 @@ optional<Error> FillLayer::setPaintProperty(const std::string& name, const Conve
|
||||
|
||||
}
|
||||
|
||||
if (property == Property::FillPattern) {
|
||||
Error error;
|
||||
optional<PropertyValue<std::string>> typedValue = convert<PropertyValue<std::string>>(value, error, true, false);
|
||||
if (!typedValue) {
|
||||
return error;
|
||||
}
|
||||
|
||||
setFillPattern(*typedValue);
|
||||
return nullopt;
|
||||
|
||||
}
|
||||
|
||||
|
||||
Error error;
|
||||
optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
|
||||
@@ -388,21 +388,26 @@ optional<Error> FillLayer::setPaintProperty(const std::string& name, const Conve
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::FillOpacityTransition) {
|
||||
setFillOpacityTransition(*transition);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::FillColorTransition) {
|
||||
setFillColorTransition(*transition);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::FillOpacityTransition) {
|
||||
setFillOpacityTransition(*transition);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::FillOutlineColorTransition) {
|
||||
setFillOutlineColorTransition(*transition);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::FillPatternTransition) {
|
||||
setFillPatternTransition(*transition);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::FillTranslateTransition) {
|
||||
setFillTranslateTransition(*transition);
|
||||
return nullopt;
|
||||
@@ -413,11 +418,6 @@ optional<Error> FillLayer::setPaintProperty(const std::string& name, const Conve
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::FillPatternTransition) {
|
||||
setFillPatternTransition(*transition);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
|
||||
return Error { "layer doesn't support this property" };
|
||||
}
|
||||
|
||||
@@ -18,18 +18,22 @@ struct FillAntialias : PaintProperty<bool> {
|
||||
static bool defaultValue() { return true; }
|
||||
};
|
||||
|
||||
struct FillOpacity : DataDrivenPaintProperty<float, attributes::opacity, uniforms::opacity> {
|
||||
static float defaultValue() { return 1; }
|
||||
};
|
||||
|
||||
struct FillColor : DataDrivenPaintProperty<Color, attributes::color, uniforms::color> {
|
||||
static Color defaultValue() { return Color::black(); }
|
||||
};
|
||||
|
||||
struct FillOpacity : DataDrivenPaintProperty<float, attributes::opacity, uniforms::opacity> {
|
||||
static float defaultValue() { return 1; }
|
||||
};
|
||||
|
||||
struct FillOutlineColor : DataDrivenPaintProperty<Color, attributes::outline_color, uniforms::outline_color> {
|
||||
static Color defaultValue() { return {}; }
|
||||
};
|
||||
|
||||
struct FillPattern : CrossFadedDataDrivenPaintProperty<std::string, attributes::pattern_to, uniforms::pattern_to, attributes::pattern_from, uniforms::pattern_from> {
|
||||
static std::string defaultValue() { return ""; }
|
||||
};
|
||||
|
||||
struct FillTranslate : PaintProperty<std::array<float, 2>> {
|
||||
static std::array<float, 2> defaultValue() { return {{ 0, 0 }}; }
|
||||
};
|
||||
@@ -38,18 +42,14 @@ struct FillTranslateAnchor : PaintProperty<TranslateAnchorType> {
|
||||
static TranslateAnchorType defaultValue() { return TranslateAnchorType::Map; }
|
||||
};
|
||||
|
||||
struct FillPattern : CrossFadedDataDrivenPaintProperty<std::string, attributes::pattern_to, uniforms::pattern_to, attributes::pattern_from, uniforms::pattern_from> {
|
||||
static std::string defaultValue() { return ""; }
|
||||
};
|
||||
|
||||
class FillPaintProperties : public Properties<
|
||||
FillAntialias,
|
||||
FillOpacity,
|
||||
FillColor,
|
||||
FillOpacity,
|
||||
FillOutlineColor,
|
||||
FillPattern,
|
||||
FillTranslate,
|
||||
FillTranslateAnchor,
|
||||
FillPattern
|
||||
FillTranslateAnchor
|
||||
> {};
|
||||
|
||||
class FillLayerProperties final : public LayerProperties {
|
||||
|
||||
@@ -63,6 +63,89 @@ void HeatmapLayer::Impl::stringifyLayout(rapidjson::Writer<rapidjson::StringBuff
|
||||
|
||||
// Paint properties
|
||||
|
||||
ColorRampPropertyValue HeatmapLayer::getDefaultHeatmapColor() {
|
||||
conversion::Error error;
|
||||
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";
|
||||
return *conversion::convertJSON<ColorRampPropertyValue>(rawValue, error);
|
||||
}
|
||||
|
||||
const ColorRampPropertyValue& HeatmapLayer::getHeatmapColor() const {
|
||||
return impl().paint.template get<HeatmapColor>().value;
|
||||
}
|
||||
|
||||
void HeatmapLayer::setHeatmapColor(const ColorRampPropertyValue& value) {
|
||||
if (value == getHeatmapColor())
|
||||
return;
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<HeatmapColor>().value = value;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
void HeatmapLayer::setHeatmapColorTransition(const TransitionOptions& options) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<HeatmapColor>().options = options;
|
||||
baseImpl = std::move(impl_);
|
||||
}
|
||||
|
||||
TransitionOptions HeatmapLayer::getHeatmapColorTransition() const {
|
||||
return impl().paint.template get<HeatmapColor>().options;
|
||||
}
|
||||
|
||||
PropertyValue<float> HeatmapLayer::getDefaultHeatmapIntensity() {
|
||||
return { 1 };
|
||||
}
|
||||
|
||||
const PropertyValue<float>& HeatmapLayer::getHeatmapIntensity() const {
|
||||
return impl().paint.template get<HeatmapIntensity>().value;
|
||||
}
|
||||
|
||||
void HeatmapLayer::setHeatmapIntensity(const PropertyValue<float>& value) {
|
||||
if (value == getHeatmapIntensity())
|
||||
return;
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<HeatmapIntensity>().value = value;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
void HeatmapLayer::setHeatmapIntensityTransition(const TransitionOptions& options) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<HeatmapIntensity>().options = options;
|
||||
baseImpl = std::move(impl_);
|
||||
}
|
||||
|
||||
TransitionOptions HeatmapLayer::getHeatmapIntensityTransition() const {
|
||||
return impl().paint.template get<HeatmapIntensity>().options;
|
||||
}
|
||||
|
||||
PropertyValue<float> HeatmapLayer::getDefaultHeatmapOpacity() {
|
||||
return { 1 };
|
||||
}
|
||||
|
||||
const PropertyValue<float>& HeatmapLayer::getHeatmapOpacity() const {
|
||||
return impl().paint.template get<HeatmapOpacity>().value;
|
||||
}
|
||||
|
||||
void HeatmapLayer::setHeatmapOpacity(const PropertyValue<float>& value) {
|
||||
if (value == getHeatmapOpacity())
|
||||
return;
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<HeatmapOpacity>().value = value;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
void HeatmapLayer::setHeatmapOpacityTransition(const TransitionOptions& options) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<HeatmapOpacity>().options = options;
|
||||
baseImpl = std::move(impl_);
|
||||
}
|
||||
|
||||
TransitionOptions HeatmapLayer::getHeatmapOpacityTransition() const {
|
||||
return impl().paint.template get<HeatmapOpacity>().options;
|
||||
}
|
||||
|
||||
PropertyValue<float> HeatmapLayer::getDefaultHeatmapRadius() {
|
||||
return { 30 };
|
||||
}
|
||||
@@ -117,116 +200,33 @@ TransitionOptions HeatmapLayer::getHeatmapWeightTransition() const {
|
||||
return impl().paint.template get<HeatmapWeight>().options;
|
||||
}
|
||||
|
||||
PropertyValue<float> HeatmapLayer::getDefaultHeatmapIntensity() {
|
||||
return { 1 };
|
||||
}
|
||||
|
||||
const PropertyValue<float>& HeatmapLayer::getHeatmapIntensity() const {
|
||||
return impl().paint.template get<HeatmapIntensity>().value;
|
||||
}
|
||||
|
||||
void HeatmapLayer::setHeatmapIntensity(const PropertyValue<float>& value) {
|
||||
if (value == getHeatmapIntensity())
|
||||
return;
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<HeatmapIntensity>().value = value;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
void HeatmapLayer::setHeatmapIntensityTransition(const TransitionOptions& options) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<HeatmapIntensity>().options = options;
|
||||
baseImpl = std::move(impl_);
|
||||
}
|
||||
|
||||
TransitionOptions HeatmapLayer::getHeatmapIntensityTransition() const {
|
||||
return impl().paint.template get<HeatmapIntensity>().options;
|
||||
}
|
||||
|
||||
ColorRampPropertyValue HeatmapLayer::getDefaultHeatmapColor() {
|
||||
conversion::Error error;
|
||||
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";
|
||||
return *conversion::convertJSON<ColorRampPropertyValue>(rawValue, error);
|
||||
}
|
||||
|
||||
const ColorRampPropertyValue& HeatmapLayer::getHeatmapColor() const {
|
||||
return impl().paint.template get<HeatmapColor>().value;
|
||||
}
|
||||
|
||||
void HeatmapLayer::setHeatmapColor(const ColorRampPropertyValue& value) {
|
||||
if (value == getHeatmapColor())
|
||||
return;
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<HeatmapColor>().value = value;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
void HeatmapLayer::setHeatmapColorTransition(const TransitionOptions& options) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<HeatmapColor>().options = options;
|
||||
baseImpl = std::move(impl_);
|
||||
}
|
||||
|
||||
TransitionOptions HeatmapLayer::getHeatmapColorTransition() const {
|
||||
return impl().paint.template get<HeatmapColor>().options;
|
||||
}
|
||||
|
||||
PropertyValue<float> HeatmapLayer::getDefaultHeatmapOpacity() {
|
||||
return { 1 };
|
||||
}
|
||||
|
||||
const PropertyValue<float>& HeatmapLayer::getHeatmapOpacity() const {
|
||||
return impl().paint.template get<HeatmapOpacity>().value;
|
||||
}
|
||||
|
||||
void HeatmapLayer::setHeatmapOpacity(const PropertyValue<float>& value) {
|
||||
if (value == getHeatmapOpacity())
|
||||
return;
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<HeatmapOpacity>().value = value;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
void HeatmapLayer::setHeatmapOpacityTransition(const TransitionOptions& options) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<HeatmapOpacity>().options = options;
|
||||
baseImpl = std::move(impl_);
|
||||
}
|
||||
|
||||
TransitionOptions HeatmapLayer::getHeatmapOpacityTransition() const {
|
||||
return impl().paint.template get<HeatmapOpacity>().options;
|
||||
}
|
||||
|
||||
using namespace conversion;
|
||||
|
||||
optional<Error> HeatmapLayer::setPaintProperty(const std::string& name, const Convertible& value) {
|
||||
enum class Property : uint8_t {
|
||||
HeatmapColor,
|
||||
HeatmapIntensity,
|
||||
HeatmapOpacity,
|
||||
HeatmapRadius,
|
||||
HeatmapWeight,
|
||||
HeatmapIntensity,
|
||||
HeatmapColor,
|
||||
HeatmapOpacity,
|
||||
HeatmapColorTransition,
|
||||
HeatmapIntensityTransition,
|
||||
HeatmapOpacityTransition,
|
||||
HeatmapRadiusTransition,
|
||||
HeatmapWeightTransition,
|
||||
HeatmapIntensityTransition,
|
||||
HeatmapColorTransition,
|
||||
HeatmapOpacityTransition,
|
||||
};
|
||||
|
||||
MAPBOX_ETERNAL_CONSTEXPR const auto properties = mapbox::eternal::hash_map<mapbox::eternal::string, uint8_t>({
|
||||
{ "heatmap-color", static_cast<uint8_t>(Property::HeatmapColor) },
|
||||
{ "heatmap-intensity", static_cast<uint8_t>(Property::HeatmapIntensity) },
|
||||
{ "heatmap-opacity", static_cast<uint8_t>(Property::HeatmapOpacity) },
|
||||
{ "heatmap-radius", static_cast<uint8_t>(Property::HeatmapRadius) },
|
||||
{ "heatmap-weight", static_cast<uint8_t>(Property::HeatmapWeight) },
|
||||
{ "heatmap-intensity", static_cast<uint8_t>(Property::HeatmapIntensity) },
|
||||
{ "heatmap-color", static_cast<uint8_t>(Property::HeatmapColor) },
|
||||
{ "heatmap-opacity", static_cast<uint8_t>(Property::HeatmapOpacity) },
|
||||
{ "heatmap-radius-transition", static_cast<uint8_t>(Property::HeatmapRadiusTransition) },
|
||||
{ "heatmap-weight-transition", static_cast<uint8_t>(Property::HeatmapWeightTransition) },
|
||||
{ "heatmap-intensity-transition", static_cast<uint8_t>(Property::HeatmapIntensityTransition) },
|
||||
{ "heatmap-color-transition", static_cast<uint8_t>(Property::HeatmapColorTransition) },
|
||||
{ "heatmap-opacity-transition", static_cast<uint8_t>(Property::HeatmapOpacityTransition) }
|
||||
{ "heatmap-intensity-transition", static_cast<uint8_t>(Property::HeatmapIntensityTransition) },
|
||||
{ "heatmap-opacity-transition", static_cast<uint8_t>(Property::HeatmapOpacityTransition) },
|
||||
{ "heatmap-radius-transition", static_cast<uint8_t>(Property::HeatmapRadiusTransition) },
|
||||
{ "heatmap-weight-transition", static_cast<uint8_t>(Property::HeatmapWeightTransition) }
|
||||
});
|
||||
|
||||
const auto it = properties.find(name.c_str());
|
||||
@@ -237,22 +237,15 @@ optional<Error> HeatmapLayer::setPaintProperty(const std::string& name, const Co
|
||||
auto property = static_cast<Property>(it->second);
|
||||
|
||||
|
||||
if (property == Property::HeatmapRadius || property == Property::HeatmapWeight) {
|
||||
if (property == Property::HeatmapColor) {
|
||||
Error error;
|
||||
optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, true, false);
|
||||
optional<ColorRampPropertyValue> typedValue = convert<ColorRampPropertyValue>(value, error, false, false);
|
||||
if (!typedValue) {
|
||||
return error;
|
||||
}
|
||||
|
||||
if (property == Property::HeatmapRadius) {
|
||||
setHeatmapRadius(*typedValue);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::HeatmapWeight) {
|
||||
setHeatmapWeight(*typedValue);
|
||||
return nullopt;
|
||||
}
|
||||
setHeatmapColor(*typedValue);
|
||||
return nullopt;
|
||||
|
||||
}
|
||||
|
||||
@@ -275,15 +268,22 @@ optional<Error> HeatmapLayer::setPaintProperty(const std::string& name, const Co
|
||||
|
||||
}
|
||||
|
||||
if (property == Property::HeatmapColor) {
|
||||
if (property == Property::HeatmapRadius || property == Property::HeatmapWeight) {
|
||||
Error error;
|
||||
optional<ColorRampPropertyValue> typedValue = convert<ColorRampPropertyValue>(value, error, false, false);
|
||||
optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, true, false);
|
||||
if (!typedValue) {
|
||||
return error;
|
||||
}
|
||||
|
||||
setHeatmapColor(*typedValue);
|
||||
return nullopt;
|
||||
if (property == Property::HeatmapRadius) {
|
||||
setHeatmapRadius(*typedValue);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::HeatmapWeight) {
|
||||
setHeatmapWeight(*typedValue);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -294,13 +294,8 @@ optional<Error> HeatmapLayer::setPaintProperty(const std::string& name, const Co
|
||||
return error;
|
||||
}
|
||||
|
||||
if (property == Property::HeatmapRadiusTransition) {
|
||||
setHeatmapRadiusTransition(*transition);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::HeatmapWeightTransition) {
|
||||
setHeatmapWeightTransition(*transition);
|
||||
if (property == Property::HeatmapColorTransition) {
|
||||
setHeatmapColorTransition(*transition);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
@@ -309,13 +304,18 @@ optional<Error> HeatmapLayer::setPaintProperty(const std::string& name, const Co
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::HeatmapColorTransition) {
|
||||
setHeatmapColorTransition(*transition);
|
||||
if (property == Property::HeatmapOpacityTransition) {
|
||||
setHeatmapOpacityTransition(*transition);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::HeatmapOpacityTransition) {
|
||||
setHeatmapOpacityTransition(*transition);
|
||||
if (property == Property::HeatmapRadiusTransition) {
|
||||
setHeatmapRadiusTransition(*transition);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::HeatmapWeightTransition) {
|
||||
setHeatmapWeightTransition(*transition);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,17 @@
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
struct HeatmapColor : ColorRampProperty {
|
||||
};
|
||||
|
||||
struct HeatmapIntensity : PaintProperty<float> {
|
||||
static float defaultValue() { return 1; }
|
||||
};
|
||||
|
||||
struct HeatmapOpacity : PaintProperty<float> {
|
||||
static float defaultValue() { return 1; }
|
||||
};
|
||||
|
||||
struct HeatmapRadius : DataDrivenPaintProperty<float, attributes::radius, uniforms::radius> {
|
||||
static float defaultValue() { return 30; }
|
||||
};
|
||||
@@ -22,23 +33,12 @@ struct HeatmapWeight : DataDrivenPaintProperty<float, attributes::weight, unifor
|
||||
static float defaultValue() { return 1; }
|
||||
};
|
||||
|
||||
struct HeatmapIntensity : PaintProperty<float> {
|
||||
static float defaultValue() { return 1; }
|
||||
};
|
||||
|
||||
struct HeatmapColor : ColorRampProperty {
|
||||
};
|
||||
|
||||
struct HeatmapOpacity : PaintProperty<float> {
|
||||
static float defaultValue() { return 1; }
|
||||
};
|
||||
|
||||
class HeatmapPaintProperties : public Properties<
|
||||
HeatmapRadius,
|
||||
HeatmapWeight,
|
||||
HeatmapIntensity,
|
||||
HeatmapColor,
|
||||
HeatmapOpacity
|
||||
HeatmapIntensity,
|
||||
HeatmapOpacity,
|
||||
HeatmapRadius,
|
||||
HeatmapWeight
|
||||
> {};
|
||||
|
||||
class HeatmapLayerProperties final : public LayerProperties {
|
||||
|
||||
@@ -63,58 +63,31 @@ void HillshadeLayer::Impl::stringifyLayout(rapidjson::Writer<rapidjson::StringBu
|
||||
|
||||
// Paint properties
|
||||
|
||||
PropertyValue<float> HillshadeLayer::getDefaultHillshadeIlluminationDirection() {
|
||||
return { 335 };
|
||||
PropertyValue<Color> HillshadeLayer::getDefaultHillshadeAccentColor() {
|
||||
return { Color::black() };
|
||||
}
|
||||
|
||||
const PropertyValue<float>& HillshadeLayer::getHillshadeIlluminationDirection() const {
|
||||
return impl().paint.template get<HillshadeIlluminationDirection>().value;
|
||||
const PropertyValue<Color>& HillshadeLayer::getHillshadeAccentColor() const {
|
||||
return impl().paint.template get<HillshadeAccentColor>().value;
|
||||
}
|
||||
|
||||
void HillshadeLayer::setHillshadeIlluminationDirection(const PropertyValue<float>& value) {
|
||||
if (value == getHillshadeIlluminationDirection())
|
||||
void HillshadeLayer::setHillshadeAccentColor(const PropertyValue<Color>& value) {
|
||||
if (value == getHillshadeAccentColor())
|
||||
return;
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<HillshadeIlluminationDirection>().value = value;
|
||||
impl_->paint.template get<HillshadeAccentColor>().value = value;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
void HillshadeLayer::setHillshadeIlluminationDirectionTransition(const TransitionOptions& options) {
|
||||
void HillshadeLayer::setHillshadeAccentColorTransition(const TransitionOptions& options) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<HillshadeIlluminationDirection>().options = options;
|
||||
impl_->paint.template get<HillshadeAccentColor>().options = options;
|
||||
baseImpl = std::move(impl_);
|
||||
}
|
||||
|
||||
TransitionOptions HillshadeLayer::getHillshadeIlluminationDirectionTransition() const {
|
||||
return impl().paint.template get<HillshadeIlluminationDirection>().options;
|
||||
}
|
||||
|
||||
PropertyValue<HillshadeIlluminationAnchorType> HillshadeLayer::getDefaultHillshadeIlluminationAnchor() {
|
||||
return { HillshadeIlluminationAnchorType::Viewport };
|
||||
}
|
||||
|
||||
const PropertyValue<HillshadeIlluminationAnchorType>& HillshadeLayer::getHillshadeIlluminationAnchor() const {
|
||||
return impl().paint.template get<HillshadeIlluminationAnchor>().value;
|
||||
}
|
||||
|
||||
void HillshadeLayer::setHillshadeIlluminationAnchor(const PropertyValue<HillshadeIlluminationAnchorType>& value) {
|
||||
if (value == getHillshadeIlluminationAnchor())
|
||||
return;
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<HillshadeIlluminationAnchor>().value = value;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
void HillshadeLayer::setHillshadeIlluminationAnchorTransition(const TransitionOptions& options) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<HillshadeIlluminationAnchor>().options = options;
|
||||
baseImpl = std::move(impl_);
|
||||
}
|
||||
|
||||
TransitionOptions HillshadeLayer::getHillshadeIlluminationAnchorTransition() const {
|
||||
return impl().paint.template get<HillshadeIlluminationAnchor>().options;
|
||||
TransitionOptions HillshadeLayer::getHillshadeAccentColorTransition() const {
|
||||
return impl().paint.template get<HillshadeAccentColor>().options;
|
||||
}
|
||||
|
||||
PropertyValue<float> HillshadeLayer::getDefaultHillshadeExaggeration() {
|
||||
@@ -144,33 +117,6 @@ TransitionOptions HillshadeLayer::getHillshadeExaggerationTransition() const {
|
||||
return impl().paint.template get<HillshadeExaggeration>().options;
|
||||
}
|
||||
|
||||
PropertyValue<Color> HillshadeLayer::getDefaultHillshadeShadowColor() {
|
||||
return { Color::black() };
|
||||
}
|
||||
|
||||
const PropertyValue<Color>& HillshadeLayer::getHillshadeShadowColor() const {
|
||||
return impl().paint.template get<HillshadeShadowColor>().value;
|
||||
}
|
||||
|
||||
void HillshadeLayer::setHillshadeShadowColor(const PropertyValue<Color>& value) {
|
||||
if (value == getHillshadeShadowColor())
|
||||
return;
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<HillshadeShadowColor>().value = value;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
void HillshadeLayer::setHillshadeShadowColorTransition(const TransitionOptions& options) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<HillshadeShadowColor>().options = options;
|
||||
baseImpl = std::move(impl_);
|
||||
}
|
||||
|
||||
TransitionOptions HillshadeLayer::getHillshadeShadowColorTransition() const {
|
||||
return impl().paint.template get<HillshadeShadowColor>().options;
|
||||
}
|
||||
|
||||
PropertyValue<Color> HillshadeLayer::getDefaultHillshadeHighlightColor() {
|
||||
return { Color::white() };
|
||||
}
|
||||
@@ -198,64 +144,118 @@ TransitionOptions HillshadeLayer::getHillshadeHighlightColorTransition() const {
|
||||
return impl().paint.template get<HillshadeHighlightColor>().options;
|
||||
}
|
||||
|
||||
PropertyValue<Color> HillshadeLayer::getDefaultHillshadeAccentColor() {
|
||||
return { Color::black() };
|
||||
PropertyValue<HillshadeIlluminationAnchorType> HillshadeLayer::getDefaultHillshadeIlluminationAnchor() {
|
||||
return { HillshadeIlluminationAnchorType::Viewport };
|
||||
}
|
||||
|
||||
const PropertyValue<Color>& HillshadeLayer::getHillshadeAccentColor() const {
|
||||
return impl().paint.template get<HillshadeAccentColor>().value;
|
||||
const PropertyValue<HillshadeIlluminationAnchorType>& HillshadeLayer::getHillshadeIlluminationAnchor() const {
|
||||
return impl().paint.template get<HillshadeIlluminationAnchor>().value;
|
||||
}
|
||||
|
||||
void HillshadeLayer::setHillshadeAccentColor(const PropertyValue<Color>& value) {
|
||||
if (value == getHillshadeAccentColor())
|
||||
void HillshadeLayer::setHillshadeIlluminationAnchor(const PropertyValue<HillshadeIlluminationAnchorType>& value) {
|
||||
if (value == getHillshadeIlluminationAnchor())
|
||||
return;
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<HillshadeAccentColor>().value = value;
|
||||
impl_->paint.template get<HillshadeIlluminationAnchor>().value = value;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
void HillshadeLayer::setHillshadeAccentColorTransition(const TransitionOptions& options) {
|
||||
void HillshadeLayer::setHillshadeIlluminationAnchorTransition(const TransitionOptions& options) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<HillshadeAccentColor>().options = options;
|
||||
impl_->paint.template get<HillshadeIlluminationAnchor>().options = options;
|
||||
baseImpl = std::move(impl_);
|
||||
}
|
||||
|
||||
TransitionOptions HillshadeLayer::getHillshadeAccentColorTransition() const {
|
||||
return impl().paint.template get<HillshadeAccentColor>().options;
|
||||
TransitionOptions HillshadeLayer::getHillshadeIlluminationAnchorTransition() const {
|
||||
return impl().paint.template get<HillshadeIlluminationAnchor>().options;
|
||||
}
|
||||
|
||||
PropertyValue<float> HillshadeLayer::getDefaultHillshadeIlluminationDirection() {
|
||||
return { 335 };
|
||||
}
|
||||
|
||||
const PropertyValue<float>& HillshadeLayer::getHillshadeIlluminationDirection() const {
|
||||
return impl().paint.template get<HillshadeIlluminationDirection>().value;
|
||||
}
|
||||
|
||||
void HillshadeLayer::setHillshadeIlluminationDirection(const PropertyValue<float>& value) {
|
||||
if (value == getHillshadeIlluminationDirection())
|
||||
return;
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<HillshadeIlluminationDirection>().value = value;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
void HillshadeLayer::setHillshadeIlluminationDirectionTransition(const TransitionOptions& options) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<HillshadeIlluminationDirection>().options = options;
|
||||
baseImpl = std::move(impl_);
|
||||
}
|
||||
|
||||
TransitionOptions HillshadeLayer::getHillshadeIlluminationDirectionTransition() const {
|
||||
return impl().paint.template get<HillshadeIlluminationDirection>().options;
|
||||
}
|
||||
|
||||
PropertyValue<Color> HillshadeLayer::getDefaultHillshadeShadowColor() {
|
||||
return { Color::black() };
|
||||
}
|
||||
|
||||
const PropertyValue<Color>& HillshadeLayer::getHillshadeShadowColor() const {
|
||||
return impl().paint.template get<HillshadeShadowColor>().value;
|
||||
}
|
||||
|
||||
void HillshadeLayer::setHillshadeShadowColor(const PropertyValue<Color>& value) {
|
||||
if (value == getHillshadeShadowColor())
|
||||
return;
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<HillshadeShadowColor>().value = value;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
void HillshadeLayer::setHillshadeShadowColorTransition(const TransitionOptions& options) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<HillshadeShadowColor>().options = options;
|
||||
baseImpl = std::move(impl_);
|
||||
}
|
||||
|
||||
TransitionOptions HillshadeLayer::getHillshadeShadowColorTransition() const {
|
||||
return impl().paint.template get<HillshadeShadowColor>().options;
|
||||
}
|
||||
|
||||
using namespace conversion;
|
||||
|
||||
optional<Error> HillshadeLayer::setPaintProperty(const std::string& name, const Convertible& value) {
|
||||
enum class Property : uint8_t {
|
||||
HillshadeIlluminationDirection,
|
||||
HillshadeIlluminationAnchor,
|
||||
HillshadeExaggeration,
|
||||
HillshadeShadowColor,
|
||||
HillshadeHighlightColor,
|
||||
HillshadeAccentColor,
|
||||
HillshadeIlluminationDirectionTransition,
|
||||
HillshadeIlluminationAnchorTransition,
|
||||
HillshadeExaggerationTransition,
|
||||
HillshadeShadowColorTransition,
|
||||
HillshadeHighlightColorTransition,
|
||||
HillshadeExaggeration,
|
||||
HillshadeHighlightColor,
|
||||
HillshadeIlluminationAnchor,
|
||||
HillshadeIlluminationDirection,
|
||||
HillshadeShadowColor,
|
||||
HillshadeAccentColorTransition,
|
||||
HillshadeExaggerationTransition,
|
||||
HillshadeHighlightColorTransition,
|
||||
HillshadeIlluminationAnchorTransition,
|
||||
HillshadeIlluminationDirectionTransition,
|
||||
HillshadeShadowColorTransition,
|
||||
};
|
||||
|
||||
MAPBOX_ETERNAL_CONSTEXPR const auto properties = mapbox::eternal::hash_map<mapbox::eternal::string, uint8_t>({
|
||||
{ "hillshade-illumination-direction", static_cast<uint8_t>(Property::HillshadeIlluminationDirection) },
|
||||
{ "hillshade-illumination-anchor", static_cast<uint8_t>(Property::HillshadeIlluminationAnchor) },
|
||||
{ "hillshade-exaggeration", static_cast<uint8_t>(Property::HillshadeExaggeration) },
|
||||
{ "hillshade-shadow-color", static_cast<uint8_t>(Property::HillshadeShadowColor) },
|
||||
{ "hillshade-highlight-color", static_cast<uint8_t>(Property::HillshadeHighlightColor) },
|
||||
{ "hillshade-accent-color", static_cast<uint8_t>(Property::HillshadeAccentColor) },
|
||||
{ "hillshade-illumination-direction-transition", static_cast<uint8_t>(Property::HillshadeIlluminationDirectionTransition) },
|
||||
{ "hillshade-illumination-anchor-transition", static_cast<uint8_t>(Property::HillshadeIlluminationAnchorTransition) },
|
||||
{ "hillshade-exaggeration", static_cast<uint8_t>(Property::HillshadeExaggeration) },
|
||||
{ "hillshade-highlight-color", static_cast<uint8_t>(Property::HillshadeHighlightColor) },
|
||||
{ "hillshade-illumination-anchor", static_cast<uint8_t>(Property::HillshadeIlluminationAnchor) },
|
||||
{ "hillshade-illumination-direction", static_cast<uint8_t>(Property::HillshadeIlluminationDirection) },
|
||||
{ "hillshade-shadow-color", static_cast<uint8_t>(Property::HillshadeShadowColor) },
|
||||
{ "hillshade-accent-color-transition", static_cast<uint8_t>(Property::HillshadeAccentColorTransition) },
|
||||
{ "hillshade-exaggeration-transition", static_cast<uint8_t>(Property::HillshadeExaggerationTransition) },
|
||||
{ "hillshade-shadow-color-transition", static_cast<uint8_t>(Property::HillshadeShadowColorTransition) },
|
||||
{ "hillshade-highlight-color-transition", static_cast<uint8_t>(Property::HillshadeHighlightColorTransition) },
|
||||
{ "hillshade-accent-color-transition", static_cast<uint8_t>(Property::HillshadeAccentColorTransition) }
|
||||
{ "hillshade-illumination-anchor-transition", static_cast<uint8_t>(Property::HillshadeIlluminationAnchorTransition) },
|
||||
{ "hillshade-illumination-direction-transition", static_cast<uint8_t>(Property::HillshadeIlluminationDirectionTransition) },
|
||||
{ "hillshade-shadow-color-transition", static_cast<uint8_t>(Property::HillshadeShadowColorTransition) }
|
||||
});
|
||||
|
||||
const auto it = properties.find(name.c_str());
|
||||
@@ -266,20 +266,44 @@ optional<Error> HillshadeLayer::setPaintProperty(const std::string& name, const
|
||||
auto property = static_cast<Property>(it->second);
|
||||
|
||||
|
||||
if (property == Property::HillshadeIlluminationDirection || property == Property::HillshadeExaggeration) {
|
||||
if (property == Property::HillshadeAccentColor || property == Property::HillshadeHighlightColor || property == Property::HillshadeShadowColor) {
|
||||
Error error;
|
||||
optional<PropertyValue<Color>> typedValue = convert<PropertyValue<Color>>(value, error, false, false);
|
||||
if (!typedValue) {
|
||||
return error;
|
||||
}
|
||||
|
||||
if (property == Property::HillshadeAccentColor) {
|
||||
setHillshadeAccentColor(*typedValue);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::HillshadeHighlightColor) {
|
||||
setHillshadeHighlightColor(*typedValue);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::HillshadeShadowColor) {
|
||||
setHillshadeShadowColor(*typedValue);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (property == Property::HillshadeExaggeration || property == Property::HillshadeIlluminationDirection) {
|
||||
Error error;
|
||||
optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, false, false);
|
||||
if (!typedValue) {
|
||||
return error;
|
||||
}
|
||||
|
||||
if (property == Property::HillshadeIlluminationDirection) {
|
||||
setHillshadeIlluminationDirection(*typedValue);
|
||||
if (property == Property::HillshadeExaggeration) {
|
||||
setHillshadeExaggeration(*typedValue);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::HillshadeExaggeration) {
|
||||
setHillshadeExaggeration(*typedValue);
|
||||
if (property == Property::HillshadeIlluminationDirection) {
|
||||
setHillshadeIlluminationDirection(*typedValue);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
@@ -297,30 +321,6 @@ optional<Error> HillshadeLayer::setPaintProperty(const std::string& name, const
|
||||
|
||||
}
|
||||
|
||||
if (property == Property::HillshadeShadowColor || property == Property::HillshadeHighlightColor || property == Property::HillshadeAccentColor) {
|
||||
Error error;
|
||||
optional<PropertyValue<Color>> typedValue = convert<PropertyValue<Color>>(value, error, false, false);
|
||||
if (!typedValue) {
|
||||
return error;
|
||||
}
|
||||
|
||||
if (property == Property::HillshadeShadowColor) {
|
||||
setHillshadeShadowColor(*typedValue);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::HillshadeHighlightColor) {
|
||||
setHillshadeHighlightColor(*typedValue);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::HillshadeAccentColor) {
|
||||
setHillshadeAccentColor(*typedValue);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Error error;
|
||||
optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
|
||||
@@ -328,13 +328,8 @@ optional<Error> HillshadeLayer::setPaintProperty(const std::string& name, const
|
||||
return error;
|
||||
}
|
||||
|
||||
if (property == Property::HillshadeIlluminationDirectionTransition) {
|
||||
setHillshadeIlluminationDirectionTransition(*transition);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::HillshadeIlluminationAnchorTransition) {
|
||||
setHillshadeIlluminationAnchorTransition(*transition);
|
||||
if (property == Property::HillshadeAccentColorTransition) {
|
||||
setHillshadeAccentColorTransition(*transition);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
@@ -343,18 +338,23 @@ optional<Error> HillshadeLayer::setPaintProperty(const std::string& name, const
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::HillshadeShadowColorTransition) {
|
||||
setHillshadeShadowColorTransition(*transition);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::HillshadeHighlightColorTransition) {
|
||||
setHillshadeHighlightColorTransition(*transition);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::HillshadeAccentColorTransition) {
|
||||
setHillshadeAccentColorTransition(*transition);
|
||||
if (property == Property::HillshadeIlluminationAnchorTransition) {
|
||||
setHillshadeIlluminationAnchorTransition(*transition);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::HillshadeIlluminationDirectionTransition) {
|
||||
setHillshadeIlluminationDirectionTransition(*transition);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::HillshadeShadowColorTransition) {
|
||||
setHillshadeShadowColorTransition(*transition);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,37 +14,37 @@
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
struct HillshadeIlluminationDirection : PaintProperty<float> {
|
||||
static float defaultValue() { return 335; }
|
||||
};
|
||||
|
||||
struct HillshadeIlluminationAnchor : PaintProperty<HillshadeIlluminationAnchorType> {
|
||||
static HillshadeIlluminationAnchorType defaultValue() { return HillshadeIlluminationAnchorType::Viewport; }
|
||||
struct HillshadeAccentColor : PaintProperty<Color> {
|
||||
static Color defaultValue() { return Color::black(); }
|
||||
};
|
||||
|
||||
struct HillshadeExaggeration : PaintProperty<float> {
|
||||
static float defaultValue() { return 0.5; }
|
||||
};
|
||||
|
||||
struct HillshadeShadowColor : PaintProperty<Color> {
|
||||
static Color defaultValue() { return Color::black(); }
|
||||
};
|
||||
|
||||
struct HillshadeHighlightColor : PaintProperty<Color> {
|
||||
static Color defaultValue() { return Color::white(); }
|
||||
};
|
||||
|
||||
struct HillshadeAccentColor : PaintProperty<Color> {
|
||||
struct HillshadeIlluminationAnchor : PaintProperty<HillshadeIlluminationAnchorType> {
|
||||
static HillshadeIlluminationAnchorType defaultValue() { return HillshadeIlluminationAnchorType::Viewport; }
|
||||
};
|
||||
|
||||
struct HillshadeIlluminationDirection : PaintProperty<float> {
|
||||
static float defaultValue() { return 335; }
|
||||
};
|
||||
|
||||
struct HillshadeShadowColor : PaintProperty<Color> {
|
||||
static Color defaultValue() { return Color::black(); }
|
||||
};
|
||||
|
||||
class HillshadePaintProperties : public Properties<
|
||||
HillshadeIlluminationDirection,
|
||||
HillshadeIlluminationAnchor,
|
||||
HillshadeAccentColor,
|
||||
HillshadeExaggeration,
|
||||
HillshadeShadowColor,
|
||||
HillshadeHighlightColor,
|
||||
HillshadeAccentColor
|
||||
HillshadeIlluminationAnchor,
|
||||
HillshadeIlluminationDirection,
|
||||
HillshadeShadowColor
|
||||
> {};
|
||||
|
||||
class HillshadeLayerProperties final : public LayerProperties {
|
||||
|
||||
@@ -128,31 +128,31 @@ void LineLayer::setLineRoundLimit(const PropertyValue<float>& value) {
|
||||
|
||||
// Paint properties
|
||||
|
||||
PropertyValue<float> LineLayer::getDefaultLineOpacity() {
|
||||
return { 1 };
|
||||
PropertyValue<float> LineLayer::getDefaultLineBlur() {
|
||||
return { 0 };
|
||||
}
|
||||
|
||||
const PropertyValue<float>& LineLayer::getLineOpacity() const {
|
||||
return impl().paint.template get<LineOpacity>().value;
|
||||
const PropertyValue<float>& LineLayer::getLineBlur() const {
|
||||
return impl().paint.template get<LineBlur>().value;
|
||||
}
|
||||
|
||||
void LineLayer::setLineOpacity(const PropertyValue<float>& value) {
|
||||
if (value == getLineOpacity())
|
||||
void LineLayer::setLineBlur(const PropertyValue<float>& value) {
|
||||
if (value == getLineBlur())
|
||||
return;
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<LineOpacity>().value = value;
|
||||
impl_->paint.template get<LineBlur>().value = value;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
void LineLayer::setLineOpacityTransition(const TransitionOptions& options) {
|
||||
void LineLayer::setLineBlurTransition(const TransitionOptions& options) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<LineOpacity>().options = options;
|
||||
impl_->paint.template get<LineBlur>().options = options;
|
||||
baseImpl = std::move(impl_);
|
||||
}
|
||||
|
||||
TransitionOptions LineLayer::getLineOpacityTransition() const {
|
||||
return impl().paint.template get<LineOpacity>().options;
|
||||
TransitionOptions LineLayer::getLineBlurTransition() const {
|
||||
return impl().paint.template get<LineBlur>().options;
|
||||
}
|
||||
|
||||
PropertyValue<Color> LineLayer::getDefaultLineColor() {
|
||||
@@ -182,6 +182,168 @@ TransitionOptions LineLayer::getLineColorTransition() const {
|
||||
return impl().paint.template get<LineColor>().options;
|
||||
}
|
||||
|
||||
PropertyValue<std::vector<float>> LineLayer::getDefaultLineDasharray() {
|
||||
return { { } };
|
||||
}
|
||||
|
||||
const PropertyValue<std::vector<float>>& LineLayer::getLineDasharray() const {
|
||||
return impl().paint.template get<LineDasharray>().value;
|
||||
}
|
||||
|
||||
void LineLayer::setLineDasharray(const PropertyValue<std::vector<float>>& value) {
|
||||
if (value == getLineDasharray())
|
||||
return;
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<LineDasharray>().value = value;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
void LineLayer::setLineDasharrayTransition(const TransitionOptions& options) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<LineDasharray>().options = options;
|
||||
baseImpl = std::move(impl_);
|
||||
}
|
||||
|
||||
TransitionOptions LineLayer::getLineDasharrayTransition() const {
|
||||
return impl().paint.template get<LineDasharray>().options;
|
||||
}
|
||||
|
||||
PropertyValue<float> LineLayer::getDefaultLineGapWidth() {
|
||||
return { 0 };
|
||||
}
|
||||
|
||||
const PropertyValue<float>& LineLayer::getLineGapWidth() const {
|
||||
return impl().paint.template get<LineGapWidth>().value;
|
||||
}
|
||||
|
||||
void LineLayer::setLineGapWidth(const PropertyValue<float>& value) {
|
||||
if (value == getLineGapWidth())
|
||||
return;
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<LineGapWidth>().value = value;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
void LineLayer::setLineGapWidthTransition(const TransitionOptions& options) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<LineGapWidth>().options = options;
|
||||
baseImpl = std::move(impl_);
|
||||
}
|
||||
|
||||
TransitionOptions LineLayer::getLineGapWidthTransition() const {
|
||||
return impl().paint.template get<LineGapWidth>().options;
|
||||
}
|
||||
|
||||
ColorRampPropertyValue LineLayer::getDefaultLineGradient() {
|
||||
return { {} };
|
||||
}
|
||||
|
||||
const ColorRampPropertyValue& LineLayer::getLineGradient() const {
|
||||
return impl().paint.template get<LineGradient>().value;
|
||||
}
|
||||
|
||||
void LineLayer::setLineGradient(const ColorRampPropertyValue& value) {
|
||||
if (value == getLineGradient())
|
||||
return;
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<LineGradient>().value = value;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
void LineLayer::setLineGradientTransition(const TransitionOptions& options) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<LineGradient>().options = options;
|
||||
baseImpl = std::move(impl_);
|
||||
}
|
||||
|
||||
TransitionOptions LineLayer::getLineGradientTransition() const {
|
||||
return impl().paint.template get<LineGradient>().options;
|
||||
}
|
||||
|
||||
PropertyValue<float> LineLayer::getDefaultLineOffset() {
|
||||
return { 0 };
|
||||
}
|
||||
|
||||
const PropertyValue<float>& LineLayer::getLineOffset() const {
|
||||
return impl().paint.template get<LineOffset>().value;
|
||||
}
|
||||
|
||||
void LineLayer::setLineOffset(const PropertyValue<float>& value) {
|
||||
if (value == getLineOffset())
|
||||
return;
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<LineOffset>().value = value;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
void LineLayer::setLineOffsetTransition(const TransitionOptions& options) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<LineOffset>().options = options;
|
||||
baseImpl = std::move(impl_);
|
||||
}
|
||||
|
||||
TransitionOptions LineLayer::getLineOffsetTransition() const {
|
||||
return impl().paint.template get<LineOffset>().options;
|
||||
}
|
||||
|
||||
PropertyValue<float> LineLayer::getDefaultLineOpacity() {
|
||||
return { 1 };
|
||||
}
|
||||
|
||||
const PropertyValue<float>& LineLayer::getLineOpacity() const {
|
||||
return impl().paint.template get<LineOpacity>().value;
|
||||
}
|
||||
|
||||
void LineLayer::setLineOpacity(const PropertyValue<float>& value) {
|
||||
if (value == getLineOpacity())
|
||||
return;
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<LineOpacity>().value = value;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
void LineLayer::setLineOpacityTransition(const TransitionOptions& options) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<LineOpacity>().options = options;
|
||||
baseImpl = std::move(impl_);
|
||||
}
|
||||
|
||||
TransitionOptions LineLayer::getLineOpacityTransition() const {
|
||||
return impl().paint.template get<LineOpacity>().options;
|
||||
}
|
||||
|
||||
PropertyValue<std::string> LineLayer::getDefaultLinePattern() {
|
||||
return { "" };
|
||||
}
|
||||
|
||||
const PropertyValue<std::string>& LineLayer::getLinePattern() const {
|
||||
return impl().paint.template get<LinePattern>().value;
|
||||
}
|
||||
|
||||
void LineLayer::setLinePattern(const PropertyValue<std::string>& value) {
|
||||
if (value == getLinePattern())
|
||||
return;
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<LinePattern>().value = value;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
void LineLayer::setLinePatternTransition(const TransitionOptions& options) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<LinePattern>().options = options;
|
||||
baseImpl = std::move(impl_);
|
||||
}
|
||||
|
||||
TransitionOptions LineLayer::getLinePatternTransition() const {
|
||||
return impl().paint.template get<LinePattern>().options;
|
||||
}
|
||||
|
||||
PropertyValue<std::array<float, 2>> LineLayer::getDefaultLineTranslate() {
|
||||
return { {{ 0, 0 }} };
|
||||
}
|
||||
@@ -264,219 +426,57 @@ TransitionOptions LineLayer::getLineWidthTransition() const {
|
||||
return impl().paint.template get<LineWidth>().options;
|
||||
}
|
||||
|
||||
PropertyValue<float> LineLayer::getDefaultLineGapWidth() {
|
||||
return { 0 };
|
||||
}
|
||||
|
||||
const PropertyValue<float>& LineLayer::getLineGapWidth() const {
|
||||
return impl().paint.template get<LineGapWidth>().value;
|
||||
}
|
||||
|
||||
void LineLayer::setLineGapWidth(const PropertyValue<float>& value) {
|
||||
if (value == getLineGapWidth())
|
||||
return;
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<LineGapWidth>().value = value;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
void LineLayer::setLineGapWidthTransition(const TransitionOptions& options) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<LineGapWidth>().options = options;
|
||||
baseImpl = std::move(impl_);
|
||||
}
|
||||
|
||||
TransitionOptions LineLayer::getLineGapWidthTransition() const {
|
||||
return impl().paint.template get<LineGapWidth>().options;
|
||||
}
|
||||
|
||||
PropertyValue<float> LineLayer::getDefaultLineOffset() {
|
||||
return { 0 };
|
||||
}
|
||||
|
||||
const PropertyValue<float>& LineLayer::getLineOffset() const {
|
||||
return impl().paint.template get<LineOffset>().value;
|
||||
}
|
||||
|
||||
void LineLayer::setLineOffset(const PropertyValue<float>& value) {
|
||||
if (value == getLineOffset())
|
||||
return;
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<LineOffset>().value = value;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
void LineLayer::setLineOffsetTransition(const TransitionOptions& options) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<LineOffset>().options = options;
|
||||
baseImpl = std::move(impl_);
|
||||
}
|
||||
|
||||
TransitionOptions LineLayer::getLineOffsetTransition() const {
|
||||
return impl().paint.template get<LineOffset>().options;
|
||||
}
|
||||
|
||||
PropertyValue<float> LineLayer::getDefaultLineBlur() {
|
||||
return { 0 };
|
||||
}
|
||||
|
||||
const PropertyValue<float>& LineLayer::getLineBlur() const {
|
||||
return impl().paint.template get<LineBlur>().value;
|
||||
}
|
||||
|
||||
void LineLayer::setLineBlur(const PropertyValue<float>& value) {
|
||||
if (value == getLineBlur())
|
||||
return;
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<LineBlur>().value = value;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
void LineLayer::setLineBlurTransition(const TransitionOptions& options) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<LineBlur>().options = options;
|
||||
baseImpl = std::move(impl_);
|
||||
}
|
||||
|
||||
TransitionOptions LineLayer::getLineBlurTransition() const {
|
||||
return impl().paint.template get<LineBlur>().options;
|
||||
}
|
||||
|
||||
PropertyValue<std::vector<float>> LineLayer::getDefaultLineDasharray() {
|
||||
return { { } };
|
||||
}
|
||||
|
||||
const PropertyValue<std::vector<float>>& LineLayer::getLineDasharray() const {
|
||||
return impl().paint.template get<LineDasharray>().value;
|
||||
}
|
||||
|
||||
void LineLayer::setLineDasharray(const PropertyValue<std::vector<float>>& value) {
|
||||
if (value == getLineDasharray())
|
||||
return;
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<LineDasharray>().value = value;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
void LineLayer::setLineDasharrayTransition(const TransitionOptions& options) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<LineDasharray>().options = options;
|
||||
baseImpl = std::move(impl_);
|
||||
}
|
||||
|
||||
TransitionOptions LineLayer::getLineDasharrayTransition() const {
|
||||
return impl().paint.template get<LineDasharray>().options;
|
||||
}
|
||||
|
||||
PropertyValue<std::string> LineLayer::getDefaultLinePattern() {
|
||||
return { "" };
|
||||
}
|
||||
|
||||
const PropertyValue<std::string>& LineLayer::getLinePattern() const {
|
||||
return impl().paint.template get<LinePattern>().value;
|
||||
}
|
||||
|
||||
void LineLayer::setLinePattern(const PropertyValue<std::string>& value) {
|
||||
if (value == getLinePattern())
|
||||
return;
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<LinePattern>().value = value;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
void LineLayer::setLinePatternTransition(const TransitionOptions& options) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<LinePattern>().options = options;
|
||||
baseImpl = std::move(impl_);
|
||||
}
|
||||
|
||||
TransitionOptions LineLayer::getLinePatternTransition() const {
|
||||
return impl().paint.template get<LinePattern>().options;
|
||||
}
|
||||
|
||||
ColorRampPropertyValue LineLayer::getDefaultLineGradient() {
|
||||
return { {} };
|
||||
}
|
||||
|
||||
const ColorRampPropertyValue& LineLayer::getLineGradient() const {
|
||||
return impl().paint.template get<LineGradient>().value;
|
||||
}
|
||||
|
||||
void LineLayer::setLineGradient(const ColorRampPropertyValue& value) {
|
||||
if (value == getLineGradient())
|
||||
return;
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<LineGradient>().value = value;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
void LineLayer::setLineGradientTransition(const TransitionOptions& options) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<LineGradient>().options = options;
|
||||
baseImpl = std::move(impl_);
|
||||
}
|
||||
|
||||
TransitionOptions LineLayer::getLineGradientTransition() const {
|
||||
return impl().paint.template get<LineGradient>().options;
|
||||
}
|
||||
|
||||
using namespace conversion;
|
||||
|
||||
optional<Error> LineLayer::setPaintProperty(const std::string& name, const Convertible& value) {
|
||||
enum class Property : uint8_t {
|
||||
LineOpacity,
|
||||
LineBlur,
|
||||
LineColor,
|
||||
LineDasharray,
|
||||
LineGapWidth,
|
||||
LineGradient,
|
||||
LineOffset,
|
||||
LineOpacity,
|
||||
LinePattern,
|
||||
LineTranslate,
|
||||
LineTranslateAnchor,
|
||||
LineWidth,
|
||||
LineGapWidth,
|
||||
LineOffset,
|
||||
LineBlur,
|
||||
LineDasharray,
|
||||
LinePattern,
|
||||
LineGradient,
|
||||
LineOpacityTransition,
|
||||
LineBlurTransition,
|
||||
LineColorTransition,
|
||||
LineDasharrayTransition,
|
||||
LineGapWidthTransition,
|
||||
LineGradientTransition,
|
||||
LineOffsetTransition,
|
||||
LineOpacityTransition,
|
||||
LinePatternTransition,
|
||||
LineTranslateTransition,
|
||||
LineTranslateAnchorTransition,
|
||||
LineWidthTransition,
|
||||
LineGapWidthTransition,
|
||||
LineOffsetTransition,
|
||||
LineBlurTransition,
|
||||
LineDasharrayTransition,
|
||||
LinePatternTransition,
|
||||
LineGradientTransition,
|
||||
};
|
||||
|
||||
MAPBOX_ETERNAL_CONSTEXPR const auto properties = mapbox::eternal::hash_map<mapbox::eternal::string, uint8_t>({
|
||||
{ "line-opacity", static_cast<uint8_t>(Property::LineOpacity) },
|
||||
{ "line-blur", static_cast<uint8_t>(Property::LineBlur) },
|
||||
{ "line-color", static_cast<uint8_t>(Property::LineColor) },
|
||||
{ "line-dasharray", static_cast<uint8_t>(Property::LineDasharray) },
|
||||
{ "line-gap-width", static_cast<uint8_t>(Property::LineGapWidth) },
|
||||
{ "line-gradient", static_cast<uint8_t>(Property::LineGradient) },
|
||||
{ "line-offset", static_cast<uint8_t>(Property::LineOffset) },
|
||||
{ "line-opacity", static_cast<uint8_t>(Property::LineOpacity) },
|
||||
{ "line-pattern", static_cast<uint8_t>(Property::LinePattern) },
|
||||
{ "line-translate", static_cast<uint8_t>(Property::LineTranslate) },
|
||||
{ "line-translate-anchor", static_cast<uint8_t>(Property::LineTranslateAnchor) },
|
||||
{ "line-width", static_cast<uint8_t>(Property::LineWidth) },
|
||||
{ "line-gap-width", static_cast<uint8_t>(Property::LineGapWidth) },
|
||||
{ "line-offset", static_cast<uint8_t>(Property::LineOffset) },
|
||||
{ "line-blur", static_cast<uint8_t>(Property::LineBlur) },
|
||||
{ "line-dasharray", static_cast<uint8_t>(Property::LineDasharray) },
|
||||
{ "line-pattern", static_cast<uint8_t>(Property::LinePattern) },
|
||||
{ "line-gradient", static_cast<uint8_t>(Property::LineGradient) },
|
||||
{ "line-opacity-transition", static_cast<uint8_t>(Property::LineOpacityTransition) },
|
||||
{ "line-blur-transition", static_cast<uint8_t>(Property::LineBlurTransition) },
|
||||
{ "line-color-transition", static_cast<uint8_t>(Property::LineColorTransition) },
|
||||
{ "line-dasharray-transition", static_cast<uint8_t>(Property::LineDasharrayTransition) },
|
||||
{ "line-gap-width-transition", static_cast<uint8_t>(Property::LineGapWidthTransition) },
|
||||
{ "line-gradient-transition", static_cast<uint8_t>(Property::LineGradientTransition) },
|
||||
{ "line-offset-transition", static_cast<uint8_t>(Property::LineOffsetTransition) },
|
||||
{ "line-opacity-transition", static_cast<uint8_t>(Property::LineOpacityTransition) },
|
||||
{ "line-pattern-transition", static_cast<uint8_t>(Property::LinePatternTransition) },
|
||||
{ "line-translate-transition", static_cast<uint8_t>(Property::LineTranslateTransition) },
|
||||
{ "line-translate-anchor-transition", static_cast<uint8_t>(Property::LineTranslateAnchorTransition) },
|
||||
{ "line-width-transition", static_cast<uint8_t>(Property::LineWidthTransition) },
|
||||
{ "line-gap-width-transition", static_cast<uint8_t>(Property::LineGapWidthTransition) },
|
||||
{ "line-offset-transition", static_cast<uint8_t>(Property::LineOffsetTransition) },
|
||||
{ "line-blur-transition", static_cast<uint8_t>(Property::LineBlurTransition) },
|
||||
{ "line-dasharray-transition", static_cast<uint8_t>(Property::LineDasharrayTransition) },
|
||||
{ "line-pattern-transition", static_cast<uint8_t>(Property::LinePatternTransition) },
|
||||
{ "line-gradient-transition", static_cast<uint8_t>(Property::LineGradientTransition) }
|
||||
{ "line-width-transition", static_cast<uint8_t>(Property::LineWidthTransition) }
|
||||
});
|
||||
|
||||
const auto it = properties.find(name.c_str());
|
||||
@@ -487,20 +487,15 @@ optional<Error> LineLayer::setPaintProperty(const std::string& name, const Conve
|
||||
auto property = static_cast<Property>(it->second);
|
||||
|
||||
|
||||
if (property == Property::LineOpacity || property == Property::LineWidth || property == Property::LineGapWidth || property == Property::LineOffset || property == Property::LineBlur) {
|
||||
if (property == Property::LineBlur || property == Property::LineGapWidth || property == Property::LineOffset || property == Property::LineOpacity || property == Property::LineWidth) {
|
||||
Error error;
|
||||
optional<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, true, false);
|
||||
if (!typedValue) {
|
||||
return error;
|
||||
}
|
||||
|
||||
if (property == Property::LineOpacity) {
|
||||
setLineOpacity(*typedValue);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::LineWidth) {
|
||||
setLineWidth(*typedValue);
|
||||
if (property == Property::LineBlur) {
|
||||
setLineBlur(*typedValue);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
@@ -514,8 +509,13 @@ optional<Error> LineLayer::setPaintProperty(const std::string& name, const Conve
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::LineBlur) {
|
||||
setLineBlur(*typedValue);
|
||||
if (property == Property::LineOpacity) {
|
||||
setLineOpacity(*typedValue);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::LineWidth) {
|
||||
setLineWidth(*typedValue);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
@@ -533,6 +533,42 @@ optional<Error> LineLayer::setPaintProperty(const std::string& name, const Conve
|
||||
|
||||
}
|
||||
|
||||
if (property == Property::LineDasharray) {
|
||||
Error error;
|
||||
optional<PropertyValue<std::vector<float>>> typedValue = convert<PropertyValue<std::vector<float>>>(value, error, false, false);
|
||||
if (!typedValue) {
|
||||
return error;
|
||||
}
|
||||
|
||||
setLineDasharray(*typedValue);
|
||||
return nullopt;
|
||||
|
||||
}
|
||||
|
||||
if (property == Property::LineGradient) {
|
||||
Error error;
|
||||
optional<ColorRampPropertyValue> typedValue = convert<ColorRampPropertyValue>(value, error, false, false);
|
||||
if (!typedValue) {
|
||||
return error;
|
||||
}
|
||||
|
||||
setLineGradient(*typedValue);
|
||||
return nullopt;
|
||||
|
||||
}
|
||||
|
||||
if (property == Property::LinePattern) {
|
||||
Error error;
|
||||
optional<PropertyValue<std::string>> typedValue = convert<PropertyValue<std::string>>(value, error, true, false);
|
||||
if (!typedValue) {
|
||||
return error;
|
||||
}
|
||||
|
||||
setLinePattern(*typedValue);
|
||||
return nullopt;
|
||||
|
||||
}
|
||||
|
||||
if (property == Property::LineTranslate) {
|
||||
Error error;
|
||||
optional<PropertyValue<std::array<float, 2>>> typedValue = convert<PropertyValue<std::array<float, 2>>>(value, error, false, false);
|
||||
@@ -557,42 +593,6 @@ optional<Error> LineLayer::setPaintProperty(const std::string& name, const Conve
|
||||
|
||||
}
|
||||
|
||||
if (property == Property::LineDasharray) {
|
||||
Error error;
|
||||
optional<PropertyValue<std::vector<float>>> typedValue = convert<PropertyValue<std::vector<float>>>(value, error, false, false);
|
||||
if (!typedValue) {
|
||||
return error;
|
||||
}
|
||||
|
||||
setLineDasharray(*typedValue);
|
||||
return nullopt;
|
||||
|
||||
}
|
||||
|
||||
if (property == Property::LinePattern) {
|
||||
Error error;
|
||||
optional<PropertyValue<std::string>> typedValue = convert<PropertyValue<std::string>>(value, error, true, false);
|
||||
if (!typedValue) {
|
||||
return error;
|
||||
}
|
||||
|
||||
setLinePattern(*typedValue);
|
||||
return nullopt;
|
||||
|
||||
}
|
||||
|
||||
if (property == Property::LineGradient) {
|
||||
Error error;
|
||||
optional<ColorRampPropertyValue> typedValue = convert<ColorRampPropertyValue>(value, error, false, false);
|
||||
if (!typedValue) {
|
||||
return error;
|
||||
}
|
||||
|
||||
setLineGradient(*typedValue);
|
||||
return nullopt;
|
||||
|
||||
}
|
||||
|
||||
|
||||
Error error;
|
||||
optional<TransitionOptions> transition = convert<TransitionOptions>(value, error);
|
||||
@@ -600,8 +600,8 @@ optional<Error> LineLayer::setPaintProperty(const std::string& name, const Conve
|
||||
return error;
|
||||
}
|
||||
|
||||
if (property == Property::LineOpacityTransition) {
|
||||
setLineOpacityTransition(*transition);
|
||||
if (property == Property::LineBlurTransition) {
|
||||
setLineBlurTransition(*transition);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
@@ -610,6 +610,36 @@ optional<Error> LineLayer::setPaintProperty(const std::string& name, const Conve
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::LineDasharrayTransition) {
|
||||
setLineDasharrayTransition(*transition);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::LineGapWidthTransition) {
|
||||
setLineGapWidthTransition(*transition);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::LineGradientTransition) {
|
||||
setLineGradientTransition(*transition);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::LineOffsetTransition) {
|
||||
setLineOffsetTransition(*transition);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::LineOpacityTransition) {
|
||||
setLineOpacityTransition(*transition);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::LinePatternTransition) {
|
||||
setLinePatternTransition(*transition);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::LineTranslateTransition) {
|
||||
setLineTranslateTransition(*transition);
|
||||
return nullopt;
|
||||
@@ -625,36 +655,6 @@ optional<Error> LineLayer::setPaintProperty(const std::string& name, const Conve
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::LineGapWidthTransition) {
|
||||
setLineGapWidthTransition(*transition);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::LineOffsetTransition) {
|
||||
setLineOffsetTransition(*transition);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::LineBlurTransition) {
|
||||
setLineBlurTransition(*transition);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::LineDasharrayTransition) {
|
||||
setLineDasharrayTransition(*transition);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::LinePatternTransition) {
|
||||
setLinePatternTransition(*transition);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::LineGradientTransition) {
|
||||
setLineGradientTransition(*transition);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
|
||||
return Error { "layer doesn't support this property" };
|
||||
}
|
||||
|
||||
@@ -34,14 +34,42 @@ struct LineRoundLimit : LayoutProperty<float> {
|
||||
static float defaultValue() { return 1; }
|
||||
};
|
||||
|
||||
struct LineOpacity : DataDrivenPaintProperty<float, attributes::opacity, uniforms::opacity> {
|
||||
static float defaultValue() { return 1; }
|
||||
struct LineBlur : DataDrivenPaintProperty<float, attributes::blur, uniforms::blur> {
|
||||
static float defaultValue() { return 0; }
|
||||
};
|
||||
|
||||
struct LineColor : DataDrivenPaintProperty<Color, attributes::color, uniforms::color> {
|
||||
static Color defaultValue() { return Color::black(); }
|
||||
};
|
||||
|
||||
struct LineDasharray : CrossFadedPaintProperty<std::vector<float>> {
|
||||
static std::vector<float> defaultValue() { return { }; }
|
||||
};
|
||||
|
||||
struct LineFloorWidth : DataDrivenPaintProperty<float, attributes::floorwidth, uniforms::floorwidth> {
|
||||
static float defaultValue() { return 1; }
|
||||
using EvaluatorType = DataDrivenPropertyEvaluator<float, true>;
|
||||
};
|
||||
|
||||
struct LineGapWidth : DataDrivenPaintProperty<float, attributes::gapwidth, uniforms::gapwidth> {
|
||||
static float defaultValue() { return 0; }
|
||||
};
|
||||
|
||||
struct LineGradient : ColorRampProperty {
|
||||
};
|
||||
|
||||
struct LineOffset : DataDrivenPaintProperty<float, attributes::offset, uniforms::offset> {
|
||||
static float defaultValue() { return 0; }
|
||||
};
|
||||
|
||||
struct LineOpacity : DataDrivenPaintProperty<float, attributes::opacity, uniforms::opacity> {
|
||||
static float defaultValue() { return 1; }
|
||||
};
|
||||
|
||||
struct LinePattern : CrossFadedDataDrivenPaintProperty<std::string, attributes::pattern_to, uniforms::pattern_to, attributes::pattern_from, uniforms::pattern_from> {
|
||||
static std::string defaultValue() { return ""; }
|
||||
};
|
||||
|
||||
struct LineTranslate : PaintProperty<std::array<float, 2>> {
|
||||
static std::array<float, 2> defaultValue() { return {{ 0, 0 }}; }
|
||||
};
|
||||
@@ -54,34 +82,6 @@ struct LineWidth : DataDrivenPaintProperty<float, attributes::width, uniforms::w
|
||||
static float defaultValue() { return 1; }
|
||||
};
|
||||
|
||||
struct LineGapWidth : DataDrivenPaintProperty<float, attributes::gapwidth, uniforms::gapwidth> {
|
||||
static float defaultValue() { return 0; }
|
||||
};
|
||||
|
||||
struct LineOffset : DataDrivenPaintProperty<float, attributes::offset, uniforms::offset> {
|
||||
static float defaultValue() { return 0; }
|
||||
};
|
||||
|
||||
struct LineBlur : DataDrivenPaintProperty<float, attributes::blur, uniforms::blur> {
|
||||
static float defaultValue() { return 0; }
|
||||
};
|
||||
|
||||
struct LineDasharray : CrossFadedPaintProperty<std::vector<float>> {
|
||||
static std::vector<float> defaultValue() { return { }; }
|
||||
};
|
||||
|
||||
struct LinePattern : CrossFadedDataDrivenPaintProperty<std::string, attributes::pattern_to, uniforms::pattern_to, attributes::pattern_from, uniforms::pattern_from> {
|
||||
static std::string defaultValue() { return ""; }
|
||||
};
|
||||
|
||||
struct LineGradient : ColorRampProperty {
|
||||
};
|
||||
|
||||
struct LineFloorWidth : DataDrivenPaintProperty<float, attributes::floorwidth, uniforms::floorwidth> {
|
||||
static float defaultValue() { return 1; }
|
||||
using EvaluatorType = DataDrivenPropertyEvaluator<float, true>;
|
||||
};
|
||||
|
||||
class LineLayoutProperties : public Properties<
|
||||
LineCap,
|
||||
LineJoin,
|
||||
@@ -90,18 +90,18 @@ class LineLayoutProperties : public Properties<
|
||||
> {};
|
||||
|
||||
class LinePaintProperties : public Properties<
|
||||
LineOpacity,
|
||||
LineBlur,
|
||||
LineColor,
|
||||
LineDasharray,
|
||||
LineFloorWidth,
|
||||
LineGapWidth,
|
||||
LineGradient,
|
||||
LineOffset,
|
||||
LineOpacity,
|
||||
LinePattern,
|
||||
LineTranslate,
|
||||
LineTranslateAnchor,
|
||||
LineWidth,
|
||||
LineGapWidth,
|
||||
LineOffset,
|
||||
LineBlur,
|
||||
LineDasharray,
|
||||
LinePattern,
|
||||
LineGradient,
|
||||
LineFloorWidth
|
||||
LineWidth
|
||||
> {};
|
||||
|
||||
class LineLayerProperties final : public LayerProperties {
|
||||
|
||||
@@ -63,58 +63,31 @@ void RasterLayer::Impl::stringifyLayout(rapidjson::Writer<rapidjson::StringBuffe
|
||||
|
||||
// Paint properties
|
||||
|
||||
PropertyValue<float> RasterLayer::getDefaultRasterOpacity() {
|
||||
PropertyValue<float> RasterLayer::getDefaultRasterBrightnessMax() {
|
||||
return { 1 };
|
||||
}
|
||||
|
||||
const PropertyValue<float>& RasterLayer::getRasterOpacity() const {
|
||||
return impl().paint.template get<RasterOpacity>().value;
|
||||
const PropertyValue<float>& RasterLayer::getRasterBrightnessMax() const {
|
||||
return impl().paint.template get<RasterBrightnessMax>().value;
|
||||
}
|
||||
|
||||
void RasterLayer::setRasterOpacity(const PropertyValue<float>& value) {
|
||||
if (value == getRasterOpacity())
|
||||
void RasterLayer::setRasterBrightnessMax(const PropertyValue<float>& value) {
|
||||
if (value == getRasterBrightnessMax())
|
||||
return;
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<RasterOpacity>().value = value;
|
||||
impl_->paint.template get<RasterBrightnessMax>().value = value;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
void RasterLayer::setRasterOpacityTransition(const TransitionOptions& options) {
|
||||
void RasterLayer::setRasterBrightnessMaxTransition(const TransitionOptions& options) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<RasterOpacity>().options = options;
|
||||
impl_->paint.template get<RasterBrightnessMax>().options = options;
|
||||
baseImpl = std::move(impl_);
|
||||
}
|
||||
|
||||
TransitionOptions RasterLayer::getRasterOpacityTransition() const {
|
||||
return impl().paint.template get<RasterOpacity>().options;
|
||||
}
|
||||
|
||||
PropertyValue<float> RasterLayer::getDefaultRasterHueRotate() {
|
||||
return { 0 };
|
||||
}
|
||||
|
||||
const PropertyValue<float>& RasterLayer::getRasterHueRotate() const {
|
||||
return impl().paint.template get<RasterHueRotate>().value;
|
||||
}
|
||||
|
||||
void RasterLayer::setRasterHueRotate(const PropertyValue<float>& value) {
|
||||
if (value == getRasterHueRotate())
|
||||
return;
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<RasterHueRotate>().value = value;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
void RasterLayer::setRasterHueRotateTransition(const TransitionOptions& options) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<RasterHueRotate>().options = options;
|
||||
baseImpl = std::move(impl_);
|
||||
}
|
||||
|
||||
TransitionOptions RasterLayer::getRasterHueRotateTransition() const {
|
||||
return impl().paint.template get<RasterHueRotate>().options;
|
||||
TransitionOptions RasterLayer::getRasterBrightnessMaxTransition() const {
|
||||
return impl().paint.template get<RasterBrightnessMax>().options;
|
||||
}
|
||||
|
||||
PropertyValue<float> RasterLayer::getDefaultRasterBrightnessMin() {
|
||||
@@ -144,60 +117,6 @@ TransitionOptions RasterLayer::getRasterBrightnessMinTransition() const {
|
||||
return impl().paint.template get<RasterBrightnessMin>().options;
|
||||
}
|
||||
|
||||
PropertyValue<float> RasterLayer::getDefaultRasterBrightnessMax() {
|
||||
return { 1 };
|
||||
}
|
||||
|
||||
const PropertyValue<float>& RasterLayer::getRasterBrightnessMax() const {
|
||||
return impl().paint.template get<RasterBrightnessMax>().value;
|
||||
}
|
||||
|
||||
void RasterLayer::setRasterBrightnessMax(const PropertyValue<float>& value) {
|
||||
if (value == getRasterBrightnessMax())
|
||||
return;
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<RasterBrightnessMax>().value = value;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
void RasterLayer::setRasterBrightnessMaxTransition(const TransitionOptions& options) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<RasterBrightnessMax>().options = options;
|
||||
baseImpl = std::move(impl_);
|
||||
}
|
||||
|
||||
TransitionOptions RasterLayer::getRasterBrightnessMaxTransition() const {
|
||||
return impl().paint.template get<RasterBrightnessMax>().options;
|
||||
}
|
||||
|
||||
PropertyValue<float> RasterLayer::getDefaultRasterSaturation() {
|
||||
return { 0 };
|
||||
}
|
||||
|
||||
const PropertyValue<float>& RasterLayer::getRasterSaturation() const {
|
||||
return impl().paint.template get<RasterSaturation>().value;
|
||||
}
|
||||
|
||||
void RasterLayer::setRasterSaturation(const PropertyValue<float>& value) {
|
||||
if (value == getRasterSaturation())
|
||||
return;
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<RasterSaturation>().value = value;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
void RasterLayer::setRasterSaturationTransition(const TransitionOptions& options) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<RasterSaturation>().options = options;
|
||||
baseImpl = std::move(impl_);
|
||||
}
|
||||
|
||||
TransitionOptions RasterLayer::getRasterSaturationTransition() const {
|
||||
return impl().paint.template get<RasterSaturation>().options;
|
||||
}
|
||||
|
||||
PropertyValue<float> RasterLayer::getDefaultRasterContrast() {
|
||||
return { 0 };
|
||||
}
|
||||
@@ -225,33 +144,6 @@ TransitionOptions RasterLayer::getRasterContrastTransition() const {
|
||||
return impl().paint.template get<RasterContrast>().options;
|
||||
}
|
||||
|
||||
PropertyValue<RasterResamplingType> RasterLayer::getDefaultRasterResampling() {
|
||||
return { RasterResamplingType::Linear };
|
||||
}
|
||||
|
||||
const PropertyValue<RasterResamplingType>& RasterLayer::getRasterResampling() const {
|
||||
return impl().paint.template get<RasterResampling>().value;
|
||||
}
|
||||
|
||||
void RasterLayer::setRasterResampling(const PropertyValue<RasterResamplingType>& value) {
|
||||
if (value == getRasterResampling())
|
||||
return;
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<RasterResampling>().value = value;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
void RasterLayer::setRasterResamplingTransition(const TransitionOptions& options) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<RasterResampling>().options = options;
|
||||
baseImpl = std::move(impl_);
|
||||
}
|
||||
|
||||
TransitionOptions RasterLayer::getRasterResamplingTransition() const {
|
||||
return impl().paint.template get<RasterResampling>().options;
|
||||
}
|
||||
|
||||
PropertyValue<float> RasterLayer::getDefaultRasterFadeDuration() {
|
||||
return { 300 };
|
||||
}
|
||||
@@ -279,45 +171,153 @@ TransitionOptions RasterLayer::getRasterFadeDurationTransition() const {
|
||||
return impl().paint.template get<RasterFadeDuration>().options;
|
||||
}
|
||||
|
||||
PropertyValue<float> RasterLayer::getDefaultRasterHueRotate() {
|
||||
return { 0 };
|
||||
}
|
||||
|
||||
const PropertyValue<float>& RasterLayer::getRasterHueRotate() const {
|
||||
return impl().paint.template get<RasterHueRotate>().value;
|
||||
}
|
||||
|
||||
void RasterLayer::setRasterHueRotate(const PropertyValue<float>& value) {
|
||||
if (value == getRasterHueRotate())
|
||||
return;
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<RasterHueRotate>().value = value;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
void RasterLayer::setRasterHueRotateTransition(const TransitionOptions& options) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<RasterHueRotate>().options = options;
|
||||
baseImpl = std::move(impl_);
|
||||
}
|
||||
|
||||
TransitionOptions RasterLayer::getRasterHueRotateTransition() const {
|
||||
return impl().paint.template get<RasterHueRotate>().options;
|
||||
}
|
||||
|
||||
PropertyValue<float> RasterLayer::getDefaultRasterOpacity() {
|
||||
return { 1 };
|
||||
}
|
||||
|
||||
const PropertyValue<float>& RasterLayer::getRasterOpacity() const {
|
||||
return impl().paint.template get<RasterOpacity>().value;
|
||||
}
|
||||
|
||||
void RasterLayer::setRasterOpacity(const PropertyValue<float>& value) {
|
||||
if (value == getRasterOpacity())
|
||||
return;
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<RasterOpacity>().value = value;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
void RasterLayer::setRasterOpacityTransition(const TransitionOptions& options) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<RasterOpacity>().options = options;
|
||||
baseImpl = std::move(impl_);
|
||||
}
|
||||
|
||||
TransitionOptions RasterLayer::getRasterOpacityTransition() const {
|
||||
return impl().paint.template get<RasterOpacity>().options;
|
||||
}
|
||||
|
||||
PropertyValue<RasterResamplingType> RasterLayer::getDefaultRasterResampling() {
|
||||
return { RasterResamplingType::Linear };
|
||||
}
|
||||
|
||||
const PropertyValue<RasterResamplingType>& RasterLayer::getRasterResampling() const {
|
||||
return impl().paint.template get<RasterResampling>().value;
|
||||
}
|
||||
|
||||
void RasterLayer::setRasterResampling(const PropertyValue<RasterResamplingType>& value) {
|
||||
if (value == getRasterResampling())
|
||||
return;
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<RasterResampling>().value = value;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
void RasterLayer::setRasterResamplingTransition(const TransitionOptions& options) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<RasterResampling>().options = options;
|
||||
baseImpl = std::move(impl_);
|
||||
}
|
||||
|
||||
TransitionOptions RasterLayer::getRasterResamplingTransition() const {
|
||||
return impl().paint.template get<RasterResampling>().options;
|
||||
}
|
||||
|
||||
PropertyValue<float> RasterLayer::getDefaultRasterSaturation() {
|
||||
return { 0 };
|
||||
}
|
||||
|
||||
const PropertyValue<float>& RasterLayer::getRasterSaturation() const {
|
||||
return impl().paint.template get<RasterSaturation>().value;
|
||||
}
|
||||
|
||||
void RasterLayer::setRasterSaturation(const PropertyValue<float>& value) {
|
||||
if (value == getRasterSaturation())
|
||||
return;
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<RasterSaturation>().value = value;
|
||||
baseImpl = std::move(impl_);
|
||||
observer->onLayerChanged(*this);
|
||||
}
|
||||
|
||||
void RasterLayer::setRasterSaturationTransition(const TransitionOptions& options) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->paint.template get<RasterSaturation>().options = options;
|
||||
baseImpl = std::move(impl_);
|
||||
}
|
||||
|
||||
TransitionOptions RasterLayer::getRasterSaturationTransition() const {
|
||||
return impl().paint.template get<RasterSaturation>().options;
|
||||
}
|
||||
|
||||
using namespace conversion;
|
||||
|
||||
optional<Error> RasterLayer::setPaintProperty(const std::string& name, const Convertible& value) {
|
||||
enum class Property : uint8_t {
|
||||
RasterOpacity,
|
||||
RasterHueRotate,
|
||||
RasterBrightnessMin,
|
||||
RasterBrightnessMax,
|
||||
RasterSaturation,
|
||||
RasterBrightnessMin,
|
||||
RasterContrast,
|
||||
RasterResampling,
|
||||
RasterFadeDuration,
|
||||
RasterOpacityTransition,
|
||||
RasterHueRotateTransition,
|
||||
RasterBrightnessMinTransition,
|
||||
RasterHueRotate,
|
||||
RasterOpacity,
|
||||
RasterResampling,
|
||||
RasterSaturation,
|
||||
RasterBrightnessMaxTransition,
|
||||
RasterSaturationTransition,
|
||||
RasterBrightnessMinTransition,
|
||||
RasterContrastTransition,
|
||||
RasterResamplingTransition,
|
||||
RasterFadeDurationTransition,
|
||||
RasterHueRotateTransition,
|
||||
RasterOpacityTransition,
|
||||
RasterResamplingTransition,
|
||||
RasterSaturationTransition,
|
||||
};
|
||||
|
||||
MAPBOX_ETERNAL_CONSTEXPR const auto properties = mapbox::eternal::hash_map<mapbox::eternal::string, uint8_t>({
|
||||
{ "raster-opacity", static_cast<uint8_t>(Property::RasterOpacity) },
|
||||
{ "raster-hue-rotate", static_cast<uint8_t>(Property::RasterHueRotate) },
|
||||
{ "raster-brightness-min", static_cast<uint8_t>(Property::RasterBrightnessMin) },
|
||||
{ "raster-brightness-max", static_cast<uint8_t>(Property::RasterBrightnessMax) },
|
||||
{ "raster-saturation", static_cast<uint8_t>(Property::RasterSaturation) },
|
||||
{ "raster-brightness-min", static_cast<uint8_t>(Property::RasterBrightnessMin) },
|
||||
{ "raster-contrast", static_cast<uint8_t>(Property::RasterContrast) },
|
||||
{ "raster-resampling", static_cast<uint8_t>(Property::RasterResampling) },
|
||||
{ "raster-fade-duration", static_cast<uint8_t>(Property::RasterFadeDuration) },
|
||||
{ "raster-opacity-transition", static_cast<uint8_t>(Property::RasterOpacityTransition) },
|
||||
{ "raster-hue-rotate-transition", static_cast<uint8_t>(Property::RasterHueRotateTransition) },
|
||||
{ "raster-brightness-min-transition", static_cast<uint8_t>(Property::RasterBrightnessMinTransition) },
|
||||
{ "raster-hue-rotate", static_cast<uint8_t>(Property::RasterHueRotate) },
|
||||
{ "raster-opacity", static_cast<uint8_t>(Property::RasterOpacity) },
|
||||
{ "raster-resampling", static_cast<uint8_t>(Property::RasterResampling) },
|
||||
{ "raster-saturation", static_cast<uint8_t>(Property::RasterSaturation) },
|
||||
{ "raster-brightness-max-transition", static_cast<uint8_t>(Property::RasterBrightnessMaxTransition) },
|
||||
{ "raster-saturation-transition", static_cast<uint8_t>(Property::RasterSaturationTransition) },
|
||||
{ "raster-brightness-min-transition", static_cast<uint8_t>(Property::RasterBrightnessMinTransition) },
|
||||
{ "raster-contrast-transition", static_cast<uint8_t>(Property::RasterContrastTransition) },
|
||||
{ "raster-fade-duration-transition", static_cast<uint8_t>(Property::RasterFadeDurationTransition) },
|
||||
{ "raster-hue-rotate-transition", static_cast<uint8_t>(Property::RasterHueRotateTransition) },
|
||||
{ "raster-opacity-transition", static_cast<uint8_t>(Property::RasterOpacityTransition) },
|
||||
{ "raster-resampling-transition", static_cast<uint8_t>(Property::RasterResamplingTransition) },
|
||||
{ "raster-fade-duration-transition", static_cast<uint8_t>(Property::RasterFadeDurationTransition) }
|
||||
{ "raster-saturation-transition", static_cast<uint8_t>(Property::RasterSaturationTransition) }
|
||||
});
|
||||
|
||||
const auto it = properties.find(name.c_str());
|
||||
@@ -328,35 +328,20 @@ optional<Error> RasterLayer::setPaintProperty(const std::string& name, const Con
|
||||
auto property = static_cast<Property>(it->second);
|
||||
|
||||
|
||||
if (property == Property::RasterOpacity || property == Property::RasterHueRotate || property == Property::RasterBrightnessMin || property == Property::RasterBrightnessMax || property == Property::RasterSaturation || property == Property::RasterContrast || property == Property::RasterFadeDuration) {
|
||||
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<PropertyValue<float>> typedValue = convert<PropertyValue<float>>(value, error, false, false);
|
||||
if (!typedValue) {
|
||||
return error;
|
||||
}
|
||||
|
||||
if (property == Property::RasterOpacity) {
|
||||
setRasterOpacity(*typedValue);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::RasterHueRotate) {
|
||||
setRasterHueRotate(*typedValue);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::RasterBrightnessMin) {
|
||||
setRasterBrightnessMin(*typedValue);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::RasterBrightnessMax) {
|
||||
setRasterBrightnessMax(*typedValue);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::RasterSaturation) {
|
||||
setRasterSaturation(*typedValue);
|
||||
if (property == Property::RasterBrightnessMin) {
|
||||
setRasterBrightnessMin(*typedValue);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
@@ -370,6 +355,21 @@ optional<Error> RasterLayer::setPaintProperty(const std::string& name, const Con
|
||||
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) {
|
||||
@@ -391,13 +391,8 @@ optional<Error> RasterLayer::setPaintProperty(const std::string& name, const Con
|
||||
return error;
|
||||
}
|
||||
|
||||
if (property == Property::RasterOpacityTransition) {
|
||||
setRasterOpacityTransition(*transition);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::RasterHueRotateTransition) {
|
||||
setRasterHueRotateTransition(*transition);
|
||||
if (property == Property::RasterBrightnessMaxTransition) {
|
||||
setRasterBrightnessMaxTransition(*transition);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
@@ -406,28 +401,33 @@ optional<Error> RasterLayer::setPaintProperty(const std::string& name, const Con
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::RasterBrightnessMaxTransition) {
|
||||
setRasterBrightnessMaxTransition(*transition);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
if (property == Property::RasterSaturationTransition) {
|
||||
setRasterSaturationTransition(*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::RasterFadeDurationTransition) {
|
||||
setRasterFadeDurationTransition(*transition);
|
||||
if (property == Property::RasterSaturationTransition) {
|
||||
setRasterSaturationTransition(*transition);
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,23 +14,11 @@
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
struct RasterOpacity : PaintProperty<float> {
|
||||
static float defaultValue() { return 1; }
|
||||
};
|
||||
|
||||
struct RasterHueRotate : PaintProperty<float> {
|
||||
static float defaultValue() { return 0; }
|
||||
};
|
||||
|
||||
struct RasterBrightnessMin : PaintProperty<float> {
|
||||
static float defaultValue() { return 0; }
|
||||
};
|
||||
|
||||
struct RasterBrightnessMax : PaintProperty<float> {
|
||||
static float defaultValue() { return 1; }
|
||||
};
|
||||
|
||||
struct RasterSaturation : PaintProperty<float> {
|
||||
struct RasterBrightnessMin : PaintProperty<float> {
|
||||
static float defaultValue() { return 0; }
|
||||
};
|
||||
|
||||
@@ -38,23 +26,35 @@ struct RasterContrast : PaintProperty<float> {
|
||||
static float defaultValue() { return 0; }
|
||||
};
|
||||
|
||||
struct RasterResampling : PaintProperty<RasterResamplingType> {
|
||||
static RasterResamplingType defaultValue() { return RasterResamplingType::Linear; }
|
||||
};
|
||||
|
||||
struct RasterFadeDuration : PaintProperty<float> {
|
||||
static float defaultValue() { return 300; }
|
||||
};
|
||||
|
||||
struct RasterHueRotate : PaintProperty<float> {
|
||||
static float defaultValue() { return 0; }
|
||||
};
|
||||
|
||||
struct RasterOpacity : PaintProperty<float> {
|
||||
static float defaultValue() { return 1; }
|
||||
};
|
||||
|
||||
struct RasterResampling : PaintProperty<RasterResamplingType> {
|
||||
static RasterResamplingType defaultValue() { return RasterResamplingType::Linear; }
|
||||
};
|
||||
|
||||
struct RasterSaturation : PaintProperty<float> {
|
||||
static float defaultValue() { return 0; }
|
||||
};
|
||||
|
||||
class RasterPaintProperties : public Properties<
|
||||
RasterOpacity,
|
||||
RasterHueRotate,
|
||||
RasterBrightnessMin,
|
||||
RasterBrightnessMax,
|
||||
RasterSaturation,
|
||||
RasterBrightnessMin,
|
||||
RasterContrast,
|
||||
RasterFadeDuration,
|
||||
RasterHueRotate,
|
||||
RasterOpacity,
|
||||
RasterResampling,
|
||||
RasterFadeDuration
|
||||
RasterSaturation
|
||||
> {};
|
||||
|
||||
class RasterLayerProperties final : public LayerProperties {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -14,46 +14,56 @@
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
struct SymbolPlacement : LayoutProperty<SymbolPlacementType> {
|
||||
static constexpr const char *name() { return "symbol-placement"; }
|
||||
static SymbolPlacementType defaultValue() { return SymbolPlacementType::Point; }
|
||||
};
|
||||
|
||||
struct SymbolSpacing : LayoutProperty<float> {
|
||||
static constexpr const char *name() { return "symbol-spacing"; }
|
||||
static float defaultValue() { return 250; }
|
||||
};
|
||||
|
||||
struct SymbolAvoidEdges : LayoutProperty<bool> {
|
||||
static constexpr const char *name() { return "symbol-avoid-edges"; }
|
||||
static bool defaultValue() { return false; }
|
||||
};
|
||||
|
||||
struct SymbolSortKey : DataDrivenLayoutProperty<float> {
|
||||
static constexpr const char *name() { return "symbol-sort-key"; }
|
||||
static float defaultValue() { return 0; }
|
||||
};
|
||||
|
||||
struct SymbolZOrder : LayoutProperty<SymbolZOrderType> {
|
||||
static constexpr const char *name() { return "symbol-z-order"; }
|
||||
static SymbolZOrderType defaultValue() { return SymbolZOrderType::Auto; }
|
||||
};
|
||||
|
||||
struct IconAllowOverlap : LayoutProperty<bool> {
|
||||
static constexpr const char *name() { return "icon-allow-overlap"; }
|
||||
static bool defaultValue() { return false; }
|
||||
};
|
||||
|
||||
struct IconAnchor : DataDrivenLayoutProperty<SymbolAnchorType> {
|
||||
static constexpr const char *name() { return "icon-anchor"; }
|
||||
static SymbolAnchorType defaultValue() { return SymbolAnchorType::Center; }
|
||||
};
|
||||
|
||||
struct IconIgnorePlacement : LayoutProperty<bool> {
|
||||
static constexpr const char *name() { return "icon-ignore-placement"; }
|
||||
static bool defaultValue() { return false; }
|
||||
};
|
||||
|
||||
struct IconImage : DataDrivenLayoutProperty<std::string> {
|
||||
static constexpr const char *name() { return "icon-image"; }
|
||||
static std::string defaultValue() { return ""; }
|
||||
};
|
||||
|
||||
struct IconKeepUpright : LayoutProperty<bool> {
|
||||
static constexpr const char *name() { return "icon-keep-upright"; }
|
||||
static bool defaultValue() { return false; }
|
||||
};
|
||||
|
||||
struct IconOffset : DataDrivenLayoutProperty<std::array<float, 2>> {
|
||||
static constexpr const char *name() { return "icon-offset"; }
|
||||
static std::array<float, 2> defaultValue() { return {{ 0, 0 }}; }
|
||||
};
|
||||
|
||||
struct IconOptional : LayoutProperty<bool> {
|
||||
static constexpr const char *name() { return "icon-optional"; }
|
||||
static bool defaultValue() { return false; }
|
||||
};
|
||||
|
||||
struct IconPadding : LayoutProperty<float> {
|
||||
static constexpr const char *name() { return "icon-padding"; }
|
||||
static float defaultValue() { return 2; }
|
||||
};
|
||||
|
||||
struct IconPitchAlignment : LayoutProperty<AlignmentType> {
|
||||
static constexpr const char *name() { return "icon-pitch-alignment"; }
|
||||
static AlignmentType defaultValue() { return AlignmentType::Auto; }
|
||||
};
|
||||
|
||||
struct IconRotate : DataDrivenLayoutProperty<float> {
|
||||
static constexpr const char *name() { return "icon-rotate"; }
|
||||
static float defaultValue() { return 0; }
|
||||
};
|
||||
|
||||
struct IconRotationAlignment : LayoutProperty<AlignmentType> {
|
||||
static constexpr const char *name() { return "icon-rotation-alignment"; }
|
||||
static AlignmentType defaultValue() { return AlignmentType::Auto; }
|
||||
@@ -74,51 +84,41 @@ struct IconTextFitPadding : LayoutProperty<std::array<float, 4>> {
|
||||
static std::array<float, 4> defaultValue() { return {{ 0, 0, 0, 0 }}; }
|
||||
};
|
||||
|
||||
struct IconImage : DataDrivenLayoutProperty<std::string> {
|
||||
static constexpr const char *name() { return "icon-image"; }
|
||||
static std::string defaultValue() { return ""; }
|
||||
};
|
||||
|
||||
struct IconRotate : DataDrivenLayoutProperty<float> {
|
||||
static constexpr const char *name() { return "icon-rotate"; }
|
||||
static float defaultValue() { return 0; }
|
||||
};
|
||||
|
||||
struct IconPadding : LayoutProperty<float> {
|
||||
static constexpr const char *name() { return "icon-padding"; }
|
||||
static float defaultValue() { return 2; }
|
||||
};
|
||||
|
||||
struct IconKeepUpright : LayoutProperty<bool> {
|
||||
static constexpr const char *name() { return "icon-keep-upright"; }
|
||||
struct SymbolAvoidEdges : LayoutProperty<bool> {
|
||||
static constexpr const char *name() { return "symbol-avoid-edges"; }
|
||||
static bool defaultValue() { return false; }
|
||||
};
|
||||
|
||||
struct IconOffset : DataDrivenLayoutProperty<std::array<float, 2>> {
|
||||
static constexpr const char *name() { return "icon-offset"; }
|
||||
static std::array<float, 2> defaultValue() { return {{ 0, 0 }}; }
|
||||
struct SymbolPlacement : LayoutProperty<SymbolPlacementType> {
|
||||
static constexpr const char *name() { return "symbol-placement"; }
|
||||
static SymbolPlacementType defaultValue() { return SymbolPlacementType::Point; }
|
||||
};
|
||||
|
||||
struct IconAnchor : DataDrivenLayoutProperty<SymbolAnchorType> {
|
||||
static constexpr const char *name() { return "icon-anchor"; }
|
||||
struct SymbolSortKey : DataDrivenLayoutProperty<float> {
|
||||
static constexpr const char *name() { return "symbol-sort-key"; }
|
||||
static float defaultValue() { return 0; }
|
||||
};
|
||||
|
||||
struct SymbolSpacing : LayoutProperty<float> {
|
||||
static constexpr const char *name() { return "symbol-spacing"; }
|
||||
static float defaultValue() { return 250; }
|
||||
};
|
||||
|
||||
struct SymbolZOrder : LayoutProperty<SymbolZOrderType> {
|
||||
static constexpr const char *name() { return "symbol-z-order"; }
|
||||
static SymbolZOrderType defaultValue() { return SymbolZOrderType::Auto; }
|
||||
};
|
||||
|
||||
struct TextAllowOverlap : LayoutProperty<bool> {
|
||||
static constexpr const char *name() { return "text-allow-overlap"; }
|
||||
static bool defaultValue() { return false; }
|
||||
};
|
||||
|
||||
struct TextAnchor : DataDrivenLayoutProperty<SymbolAnchorType> {
|
||||
static constexpr const char *name() { return "text-anchor"; }
|
||||
static SymbolAnchorType defaultValue() { return SymbolAnchorType::Center; }
|
||||
};
|
||||
|
||||
struct IconPitchAlignment : LayoutProperty<AlignmentType> {
|
||||
static constexpr const char *name() { return "icon-pitch-alignment"; }
|
||||
static AlignmentType defaultValue() { return AlignmentType::Auto; }
|
||||
};
|
||||
|
||||
struct TextPitchAlignment : LayoutProperty<AlignmentType> {
|
||||
static constexpr const char *name() { return "text-pitch-alignment"; }
|
||||
static AlignmentType defaultValue() { return AlignmentType::Auto; }
|
||||
};
|
||||
|
||||
struct TextRotationAlignment : LayoutProperty<AlignmentType> {
|
||||
static constexpr const char *name() { return "text-rotation-alignment"; }
|
||||
static AlignmentType defaultValue() { return AlignmentType::Auto; }
|
||||
};
|
||||
|
||||
struct TextField : DataDrivenLayoutProperty<expression::Formatted> {
|
||||
static constexpr const char *name() { return "text-field"; }
|
||||
static expression::Formatted defaultValue() { return ""; }
|
||||
@@ -129,24 +129,9 @@ struct TextFont : DataDrivenLayoutProperty<std::vector<std::string>> {
|
||||
static std::vector<std::string> defaultValue() { return { "Open Sans Regular", "Arial Unicode MS Regular" }; }
|
||||
};
|
||||
|
||||
struct TextSize : DataDrivenLayoutProperty<float> {
|
||||
static constexpr const char *name() { return "text-size"; }
|
||||
static float defaultValue() { return 16; }
|
||||
};
|
||||
|
||||
struct TextMaxWidth : DataDrivenLayoutProperty<float> {
|
||||
static constexpr const char *name() { return "text-max-width"; }
|
||||
static float defaultValue() { return 10; }
|
||||
};
|
||||
|
||||
struct TextLineHeight : LayoutProperty<float> {
|
||||
static constexpr const char *name() { return "text-line-height"; }
|
||||
static float defaultValue() { return 1.2; }
|
||||
};
|
||||
|
||||
struct TextLetterSpacing : DataDrivenLayoutProperty<float> {
|
||||
static constexpr const char *name() { return "text-letter-spacing"; }
|
||||
static float defaultValue() { return 0; }
|
||||
struct TextIgnorePlacement : LayoutProperty<bool> {
|
||||
static constexpr const char *name() { return "text-ignore-placement"; }
|
||||
static bool defaultValue() { return false; }
|
||||
};
|
||||
|
||||
struct TextJustify : DataDrivenLayoutProperty<TextJustifyType> {
|
||||
@@ -154,19 +139,19 @@ struct TextJustify : DataDrivenLayoutProperty<TextJustifyType> {
|
||||
static TextJustifyType defaultValue() { return TextJustifyType::Center; }
|
||||
};
|
||||
|
||||
struct TextRadialOffset : DataDrivenLayoutProperty<float> {
|
||||
static constexpr const char *name() { return "text-radial-offset"; }
|
||||
struct TextKeepUpright : LayoutProperty<bool> {
|
||||
static constexpr const char *name() { return "text-keep-upright"; }
|
||||
static bool defaultValue() { return true; }
|
||||
};
|
||||
|
||||
struct TextLetterSpacing : DataDrivenLayoutProperty<float> {
|
||||
static constexpr const char *name() { return "text-letter-spacing"; }
|
||||
static float defaultValue() { return 0; }
|
||||
};
|
||||
|
||||
struct TextVariableAnchor : LayoutProperty<std::vector<TextVariableAnchorType>> {
|
||||
static constexpr const char *name() { return "text-variable-anchor"; }
|
||||
static std::vector<TextVariableAnchorType> defaultValue() { return { }; }
|
||||
};
|
||||
|
||||
struct TextAnchor : DataDrivenLayoutProperty<SymbolAnchorType> {
|
||||
static constexpr const char *name() { return "text-anchor"; }
|
||||
static SymbolAnchorType defaultValue() { return SymbolAnchorType::Center; }
|
||||
struct TextLineHeight : LayoutProperty<float> {
|
||||
static constexpr const char *name() { return "text-line-height"; }
|
||||
static float defaultValue() { return 1.2; }
|
||||
};
|
||||
|
||||
struct TextMaxAngle : LayoutProperty<float> {
|
||||
@@ -174,24 +159,9 @@ struct TextMaxAngle : LayoutProperty<float> {
|
||||
static float defaultValue() { return 45; }
|
||||
};
|
||||
|
||||
struct TextRotate : DataDrivenLayoutProperty<float> {
|
||||
static constexpr const char *name() { return "text-rotate"; }
|
||||
static float defaultValue() { return 0; }
|
||||
};
|
||||
|
||||
struct TextPadding : LayoutProperty<float> {
|
||||
static constexpr const char *name() { return "text-padding"; }
|
||||
static float defaultValue() { return 2; }
|
||||
};
|
||||
|
||||
struct TextKeepUpright : LayoutProperty<bool> {
|
||||
static constexpr const char *name() { return "text-keep-upright"; }
|
||||
static bool defaultValue() { return true; }
|
||||
};
|
||||
|
||||
struct TextTransform : DataDrivenLayoutProperty<TextTransformType> {
|
||||
static constexpr const char *name() { return "text-transform"; }
|
||||
static TextTransformType defaultValue() { return TextTransformType::None; }
|
||||
struct TextMaxWidth : DataDrivenLayoutProperty<float> {
|
||||
static constexpr const char *name() { return "text-max-width"; }
|
||||
static float defaultValue() { return 10; }
|
||||
};
|
||||
|
||||
struct TextOffset : DataDrivenLayoutProperty<std::array<float, 2>> {
|
||||
@@ -199,29 +169,59 @@ struct TextOffset : DataDrivenLayoutProperty<std::array<float, 2>> {
|
||||
static std::array<float, 2> defaultValue() { return {{ 0, 0 }}; }
|
||||
};
|
||||
|
||||
struct TextAllowOverlap : LayoutProperty<bool> {
|
||||
static constexpr const char *name() { return "text-allow-overlap"; }
|
||||
static bool defaultValue() { return false; }
|
||||
};
|
||||
|
||||
struct TextIgnorePlacement : LayoutProperty<bool> {
|
||||
static constexpr const char *name() { return "text-ignore-placement"; }
|
||||
static bool defaultValue() { return false; }
|
||||
};
|
||||
|
||||
struct TextOptional : LayoutProperty<bool> {
|
||||
static constexpr const char *name() { return "text-optional"; }
|
||||
static bool defaultValue() { return false; }
|
||||
};
|
||||
|
||||
struct IconOpacity : DataDrivenPaintProperty<float, attributes::opacity, uniforms::opacity> {
|
||||
static float defaultValue() { return 1; }
|
||||
struct TextPadding : LayoutProperty<float> {
|
||||
static constexpr const char *name() { return "text-padding"; }
|
||||
static float defaultValue() { return 2; }
|
||||
};
|
||||
|
||||
struct TextPitchAlignment : LayoutProperty<AlignmentType> {
|
||||
static constexpr const char *name() { return "text-pitch-alignment"; }
|
||||
static AlignmentType defaultValue() { return AlignmentType::Auto; }
|
||||
};
|
||||
|
||||
struct TextRadialOffset : DataDrivenLayoutProperty<float> {
|
||||
static constexpr const char *name() { return "text-radial-offset"; }
|
||||
static float defaultValue() { return 0; }
|
||||
};
|
||||
|
||||
struct TextRotate : DataDrivenLayoutProperty<float> {
|
||||
static constexpr const char *name() { return "text-rotate"; }
|
||||
static float defaultValue() { return 0; }
|
||||
};
|
||||
|
||||
struct TextRotationAlignment : LayoutProperty<AlignmentType> {
|
||||
static constexpr const char *name() { return "text-rotation-alignment"; }
|
||||
static AlignmentType defaultValue() { return AlignmentType::Auto; }
|
||||
};
|
||||
|
||||
struct TextSize : DataDrivenLayoutProperty<float> {
|
||||
static constexpr const char *name() { return "text-size"; }
|
||||
static float defaultValue() { return 16; }
|
||||
};
|
||||
|
||||
struct TextTransform : DataDrivenLayoutProperty<TextTransformType> {
|
||||
static constexpr const char *name() { return "text-transform"; }
|
||||
static TextTransformType defaultValue() { return TextTransformType::None; }
|
||||
};
|
||||
|
||||
struct TextVariableAnchor : LayoutProperty<std::vector<TextVariableAnchorType>> {
|
||||
static constexpr const char *name() { return "text-variable-anchor"; }
|
||||
static std::vector<TextVariableAnchorType> defaultValue() { return { }; }
|
||||
};
|
||||
|
||||
struct IconColor : DataDrivenPaintProperty<Color, attributes::fill_color, uniforms::fill_color> {
|
||||
static Color defaultValue() { return Color::black(); }
|
||||
};
|
||||
|
||||
struct IconHaloBlur : DataDrivenPaintProperty<float, attributes::halo_blur, uniforms::halo_blur> {
|
||||
static float defaultValue() { return 0; }
|
||||
};
|
||||
|
||||
struct IconHaloColor : DataDrivenPaintProperty<Color, attributes::halo_color, uniforms::halo_color> {
|
||||
static Color defaultValue() { return {}; }
|
||||
};
|
||||
@@ -230,8 +230,8 @@ struct IconHaloWidth : DataDrivenPaintProperty<float, attributes::halo_width, un
|
||||
static float defaultValue() { return 0; }
|
||||
};
|
||||
|
||||
struct IconHaloBlur : DataDrivenPaintProperty<float, attributes::halo_blur, uniforms::halo_blur> {
|
||||
static float defaultValue() { return 0; }
|
||||
struct IconOpacity : DataDrivenPaintProperty<float, attributes::opacity, uniforms::opacity> {
|
||||
static float defaultValue() { return 1; }
|
||||
};
|
||||
|
||||
struct IconTranslate : PaintProperty<std::array<float, 2>> {
|
||||
@@ -242,10 +242,6 @@ struct IconTranslateAnchor : PaintProperty<TranslateAnchorType> {
|
||||
static TranslateAnchorType defaultValue() { return TranslateAnchorType::Map; }
|
||||
};
|
||||
|
||||
struct TextOpacity : DataDrivenPaintProperty<float, attributes::opacity, uniforms::opacity> {
|
||||
static float defaultValue() { return 1; }
|
||||
};
|
||||
|
||||
struct TextColor : DataDrivenPaintProperty<Color, attributes::fill_color, uniforms::fill_color, true> {
|
||||
static Color defaultValue() { return Color::black(); }
|
||||
static constexpr const char *name() { return "text-color"; }
|
||||
@@ -253,6 +249,10 @@ struct TextColor : DataDrivenPaintProperty<Color, attributes::fill_color, unifor
|
||||
template<typename T> static bool hasOverride(const T& t) { return !!t.textColor; };
|
||||
};
|
||||
|
||||
struct TextHaloBlur : DataDrivenPaintProperty<float, attributes::halo_blur, uniforms::halo_blur> {
|
||||
static float defaultValue() { return 0; }
|
||||
};
|
||||
|
||||
struct TextHaloColor : DataDrivenPaintProperty<Color, attributes::halo_color, uniforms::halo_color> {
|
||||
static Color defaultValue() { return {}; }
|
||||
};
|
||||
@@ -261,8 +261,8 @@ struct TextHaloWidth : DataDrivenPaintProperty<float, attributes::halo_width, un
|
||||
static float defaultValue() { return 0; }
|
||||
};
|
||||
|
||||
struct TextHaloBlur : DataDrivenPaintProperty<float, attributes::halo_blur, uniforms::halo_blur> {
|
||||
static float defaultValue() { return 0; }
|
||||
struct TextOpacity : DataDrivenPaintProperty<float, attributes::opacity, uniforms::opacity> {
|
||||
static float defaultValue() { return 1; }
|
||||
};
|
||||
|
||||
struct TextTranslate : PaintProperty<std::array<float, 2>> {
|
||||
@@ -274,61 +274,61 @@ struct TextTranslateAnchor : PaintProperty<TranslateAnchorType> {
|
||||
};
|
||||
|
||||
class SymbolLayoutProperties : public Properties<
|
||||
SymbolPlacement,
|
||||
SymbolSpacing,
|
||||
SymbolAvoidEdges,
|
||||
SymbolSortKey,
|
||||
SymbolZOrder,
|
||||
IconAllowOverlap,
|
||||
IconAnchor,
|
||||
IconIgnorePlacement,
|
||||
IconImage,
|
||||
IconKeepUpright,
|
||||
IconOffset,
|
||||
IconOptional,
|
||||
IconPadding,
|
||||
IconPitchAlignment,
|
||||
IconRotate,
|
||||
IconRotationAlignment,
|
||||
IconSize,
|
||||
IconTextFit,
|
||||
IconTextFitPadding,
|
||||
IconImage,
|
||||
IconRotate,
|
||||
IconPadding,
|
||||
IconKeepUpright,
|
||||
IconOffset,
|
||||
IconAnchor,
|
||||
IconPitchAlignment,
|
||||
TextPitchAlignment,
|
||||
TextRotationAlignment,
|
||||
SymbolAvoidEdges,
|
||||
SymbolPlacement,
|
||||
SymbolSortKey,
|
||||
SymbolSpacing,
|
||||
SymbolZOrder,
|
||||
TextAllowOverlap,
|
||||
TextAnchor,
|
||||
TextField,
|
||||
TextFont,
|
||||
TextSize,
|
||||
TextMaxWidth,
|
||||
TextLineHeight,
|
||||
TextLetterSpacing,
|
||||
TextJustify,
|
||||
TextRadialOffset,
|
||||
TextVariableAnchor,
|
||||
TextAnchor,
|
||||
TextMaxAngle,
|
||||
TextRotate,
|
||||
TextPadding,
|
||||
TextKeepUpright,
|
||||
TextTransform,
|
||||
TextOffset,
|
||||
TextAllowOverlap,
|
||||
TextIgnorePlacement,
|
||||
TextOptional
|
||||
TextJustify,
|
||||
TextKeepUpright,
|
||||
TextLetterSpacing,
|
||||
TextLineHeight,
|
||||
TextMaxAngle,
|
||||
TextMaxWidth,
|
||||
TextOffset,
|
||||
TextOptional,
|
||||
TextPadding,
|
||||
TextPitchAlignment,
|
||||
TextRadialOffset,
|
||||
TextRotate,
|
||||
TextRotationAlignment,
|
||||
TextSize,
|
||||
TextTransform,
|
||||
TextVariableAnchor
|
||||
> {};
|
||||
|
||||
class SymbolPaintProperties : public Properties<
|
||||
IconOpacity,
|
||||
IconColor,
|
||||
IconHaloBlur,
|
||||
IconHaloColor,
|
||||
IconHaloWidth,
|
||||
IconHaloBlur,
|
||||
IconOpacity,
|
||||
IconTranslate,
|
||||
IconTranslateAnchor,
|
||||
TextOpacity,
|
||||
TextColor,
|
||||
TextHaloBlur,
|
||||
TextHaloColor,
|
||||
TextHaloWidth,
|
||||
TextHaloBlur,
|
||||
TextOpacity,
|
||||
TextTranslate,
|
||||
TextTranslateAnchor
|
||||
> {};
|
||||
|
||||
@@ -50,32 +50,6 @@ TransitionOptions Light::getAnchorTransition() const {
|
||||
return impl->properties.template get<LightAnchor>().options;
|
||||
}
|
||||
|
||||
Position Light::getDefaultPosition() {
|
||||
return LightPosition::defaultValue();
|
||||
}
|
||||
|
||||
PropertyValue<Position> Light::getPosition() const {
|
||||
return impl->properties.template get<LightPosition>().value;
|
||||
}
|
||||
|
||||
void Light::setPosition(PropertyValue<Position> property) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->properties.template get<LightPosition>().value = property;
|
||||
impl = std::move(impl_);
|
||||
observer->onLightChanged(*this);
|
||||
}
|
||||
|
||||
void Light::setPositionTransition(const TransitionOptions& options) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->properties.template get<LightPosition>().options = options;
|
||||
impl = std::move(impl_);
|
||||
observer->onLightChanged(*this);
|
||||
}
|
||||
|
||||
TransitionOptions Light::getPositionTransition() const {
|
||||
return impl->properties.template get<LightPosition>().options;
|
||||
}
|
||||
|
||||
Color Light::getDefaultColor() {
|
||||
return LightColor::defaultValue();
|
||||
}
|
||||
@@ -128,6 +102,32 @@ TransitionOptions Light::getIntensityTransition() const {
|
||||
return impl->properties.template get<LightIntensity>().options;
|
||||
}
|
||||
|
||||
Position Light::getDefaultPosition() {
|
||||
return LightPosition::defaultValue();
|
||||
}
|
||||
|
||||
PropertyValue<Position> Light::getPosition() const {
|
||||
return impl->properties.template get<LightPosition>().value;
|
||||
}
|
||||
|
||||
void Light::setPosition(PropertyValue<Position> property) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->properties.template get<LightPosition>().value = property;
|
||||
impl = std::move(impl_);
|
||||
observer->onLightChanged(*this);
|
||||
}
|
||||
|
||||
void Light::setPositionTransition(const TransitionOptions& options) {
|
||||
auto impl_ = mutableImpl();
|
||||
impl_->properties.template get<LightPosition>().options = options;
|
||||
impl = std::move(impl_);
|
||||
observer->onLightChanged(*this);
|
||||
}
|
||||
|
||||
TransitionOptions Light::getPositionTransition() const {
|
||||
return impl->properties.template get<LightPosition>().options;
|
||||
}
|
||||
|
||||
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
|
||||
Reference in New Issue
Block a user