core: Update Hillshade Algorithms and add Color-Relief Layer support (#3965)
This commit is contained in:
@@ -147,6 +147,8 @@ add_library(maplibre SHARED
|
||||
${PROJECT_SOURCE_DIR}/style/layers/background_layer.hpp
|
||||
${PROJECT_SOURCE_DIR}/style/layers/circle_layer.cpp
|
||||
${PROJECT_SOURCE_DIR}/style/layers/circle_layer.hpp
|
||||
${PROJECT_SOURCE_DIR}/style/layers/color_relief_layer.cpp
|
||||
${PROJECT_SOURCE_DIR}/style/layers/color_relief_layer.hpp
|
||||
${PROJECT_SOURCE_DIR}/style/layers/custom_layer.cpp
|
||||
${PROJECT_SOURCE_DIR}/style/layers/custom_layer.hpp
|
||||
${PROJECT_SOURCE_DIR}/style/layers/fill_extrusion_layer.cpp
|
||||
|
||||
@@ -101,6 +101,17 @@ Result<jni::Local<jni::Object<>>> Converter<jni::Local<jni::Object<>>, std::vect
|
||||
return result;
|
||||
}
|
||||
|
||||
Result<jni::Local<jni::Object<>>> Converter<jni::Local<jni::Object<>>, std::vector<Color>>::operator()(
|
||||
jni::JNIEnv& env, const std::vector<Color>& value) const {
|
||||
auto result = jni::Array<jni::String>::New(env, value.size());
|
||||
|
||||
for (std::size_t i = 0; i < value.size(); i++) {
|
||||
result.Set(env, i, jni::Make<jni::String>(env, value.at(i).stringify()));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Result<jni::Local<jni::Object<>>> Converter<jni::Local<jni::Object<>>, style::expression::Image>::operator()(
|
||||
jni::JNIEnv& env, const style::expression::Image& value) const {
|
||||
return jni::Make<jni::String>(env, value.id());
|
||||
|
||||
@@ -111,6 +111,11 @@ struct Converter<jni::Local<jni::Object<>>, std::vector<double>> {
|
||||
Result<jni::Local<jni::Object<>>> operator()(jni::JNIEnv& env, const std::vector<double>& value) const;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct Converter<jni::Local<jni::Object<>>, std::vector<Color>> {
|
||||
Result<jni::Local<jni::Object<>>> operator()(jni::JNIEnv& env, const std::vector<Color>& value) const;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct Converter<jni::Local<jni::Object<>>, T, typename std::enable_if_t<std::is_enum<T>::value>> {
|
||||
Result<jni::Local<jni::Object<>>> operator()(jni::JNIEnv& env, const T& value) const {
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`.
|
||||
|
||||
#include "color_relief_layer.hpp"
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "../conversion/property_value.hpp"
|
||||
#include "../conversion/transition_options.hpp"
|
||||
|
||||
#include <mbgl/style/layer_impl.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace android {
|
||||
|
||||
inline mbgl::style::ColorReliefLayer& toColorReliefLayer(mbgl::style::Layer& layer) {
|
||||
return static_cast<mbgl::style::ColorReliefLayer&>(layer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an owning peer object (for layers not attached to the map) from the JVM side
|
||||
*/
|
||||
ColorReliefLayer::ColorReliefLayer(jni::JNIEnv& env, jni::String& layerId, jni::String& sourceId)
|
||||
: Layer(std::make_unique<mbgl::style::ColorReliefLayer>(jni::Make<std::string>(env, layerId),
|
||||
jni::Make<std::string>(env, sourceId))) {}
|
||||
|
||||
/**
|
||||
* Creates a non-owning peer object (for layers currently attached to the map)
|
||||
*/
|
||||
ColorReliefLayer::ColorReliefLayer(mbgl::style::ColorReliefLayer& coreLayer)
|
||||
: Layer(coreLayer) {}
|
||||
|
||||
/**
|
||||
* Creates an owning peer object (for layers not attached to the map)
|
||||
*/
|
||||
ColorReliefLayer::ColorReliefLayer(std::unique_ptr<mbgl::style::ColorReliefLayer> coreLayer)
|
||||
: Layer(std::move(coreLayer)) {}
|
||||
|
||||
ColorReliefLayer::~ColorReliefLayer() = default;
|
||||
|
||||
// Property getters
|
||||
|
||||
jni::Local<jni::Object<>> ColorReliefLayer::getColorReliefOpacity(jni::JNIEnv& env) {
|
||||
using namespace mbgl::android::conversion;
|
||||
auto layer = layerPtr.get();
|
||||
if (!layer) {
|
||||
return std::move(
|
||||
*convert<jni::Local<jni::Object<>>>(env, style::ColorReliefLayer::getDefaultColorReliefOpacity()));
|
||||
}
|
||||
return std::move(*convert<jni::Local<jni::Object<>>>(env, toColorReliefLayer(*layer).getColorReliefOpacity()));
|
||||
}
|
||||
|
||||
jni::Local<jni::Object<TransitionOptions>> ColorReliefLayer::getColorReliefOpacityTransition(jni::JNIEnv& env) {
|
||||
using namespace mbgl::android::conversion;
|
||||
auto layer = layerPtr.get();
|
||||
if (!layer) {
|
||||
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, mbgl::style::TransitionOptions()));
|
||||
}
|
||||
mbgl::style::TransitionOptions options = toColorReliefLayer(*layer).getColorReliefOpacityTransition();
|
||||
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, options));
|
||||
}
|
||||
|
||||
void ColorReliefLayer::setColorReliefOpacityTransition(jni::JNIEnv&, jlong duration, jlong delay) {
|
||||
auto layer = layerPtr.get();
|
||||
if (!layer) {
|
||||
return;
|
||||
}
|
||||
mbgl::style::TransitionOptions options;
|
||||
options.duration.emplace(mbgl::Milliseconds(duration));
|
||||
options.delay.emplace(mbgl::Milliseconds(delay));
|
||||
toColorReliefLayer(*layer).setColorReliefOpacityTransition(options);
|
||||
}
|
||||
|
||||
jni::Local<jni::Object<>> ColorReliefLayer::getColorReliefColor(jni::JNIEnv& env) {
|
||||
using namespace mbgl::android::conversion;
|
||||
auto layer = layerPtr.get();
|
||||
if (!layer) {
|
||||
return std::move(
|
||||
*convert<jni::Local<jni::Object<>>>(env, style::ColorReliefLayer::getDefaultColorReliefColor()));
|
||||
}
|
||||
return std::move(*convert<jni::Local<jni::Object<>>>(env, toColorReliefLayer(*layer).getColorReliefColor()));
|
||||
}
|
||||
|
||||
// ColorReliefJavaLayerPeerFactory
|
||||
|
||||
ColorReliefJavaLayerPeerFactory::~ColorReliefJavaLayerPeerFactory() = default;
|
||||
|
||||
namespace {
|
||||
jni::Local<jni::Object<Layer>> createJavaPeer(jni::JNIEnv& env, Layer* layer) {
|
||||
static auto& javaClass = jni::Class<ColorReliefLayer>::Singleton(env);
|
||||
static auto constructor = javaClass.GetConstructor<jni::jlong>(env);
|
||||
return javaClass.New(env, constructor, reinterpret_cast<jni::jlong>(layer));
|
||||
}
|
||||
} // namespace
|
||||
|
||||
jni::Local<jni::Object<Layer>> ColorReliefJavaLayerPeerFactory::createJavaLayerPeer(jni::JNIEnv& env,
|
||||
mbgl::style::Layer& layer) {
|
||||
assert(layer.baseImpl->getTypeInfo() == getTypeInfo());
|
||||
return createJavaPeer(env, new ColorReliefLayer(toColorReliefLayer(layer)));
|
||||
}
|
||||
|
||||
jni::Local<jni::Object<Layer>> ColorReliefJavaLayerPeerFactory::createJavaLayerPeer(
|
||||
jni::JNIEnv& env, std::unique_ptr<mbgl::style::Layer> layer) {
|
||||
assert(layer->baseImpl->getTypeInfo() == getTypeInfo());
|
||||
return createJavaPeer(env,
|
||||
new ColorReliefLayer(std::unique_ptr<mbgl::style::ColorReliefLayer>(
|
||||
static_cast<mbgl::style::ColorReliefLayer*>(layer.release()))));
|
||||
}
|
||||
|
||||
void ColorReliefJavaLayerPeerFactory::registerNative(jni::JNIEnv& env) {
|
||||
// Lookup the class
|
||||
static auto& javaClass = jni::Class<ColorReliefLayer>::Singleton(env);
|
||||
|
||||
#define METHOD(MethodPtr, name) jni::MakeNativePeerMethod<decltype(MethodPtr), (MethodPtr)>(name)
|
||||
|
||||
// Register the peer
|
||||
jni::RegisterNativePeer<ColorReliefLayer>(
|
||||
env,
|
||||
javaClass,
|
||||
"nativePtr",
|
||||
jni::MakePeer<ColorReliefLayer, jni::String&, jni::String&>,
|
||||
"initialize",
|
||||
"finalize",
|
||||
METHOD(&ColorReliefLayer::getColorReliefOpacityTransition, "nativeGetColorReliefOpacityTransition"),
|
||||
METHOD(&ColorReliefLayer::setColorReliefOpacityTransition, "nativeSetColorReliefOpacityTransition"),
|
||||
METHOD(&ColorReliefLayer::getColorReliefOpacity, "nativeGetColorReliefOpacity"),
|
||||
METHOD(&ColorReliefLayer::getColorReliefColor, "nativeGetColorReliefColor"));
|
||||
}
|
||||
|
||||
} // namespace android
|
||||
} // namespace mbgl
|
||||
@@ -0,0 +1,52 @@
|
||||
// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "layer.hpp"
|
||||
#include "../transition_options.hpp"
|
||||
#include <mbgl/layermanager/color_relief_layer_factory.hpp>
|
||||
#include <mbgl/style/layers/color_relief_layer.hpp>
|
||||
#include <jni/jni.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace android {
|
||||
|
||||
class ColorReliefLayer : public Layer {
|
||||
public:
|
||||
using SuperTag = Layer;
|
||||
static constexpr auto Name() { return "org/maplibre/android/style/layers/ColorReliefLayer"; };
|
||||
|
||||
ColorReliefLayer(jni::JNIEnv&, jni::String&, jni::String&);
|
||||
|
||||
ColorReliefLayer(mbgl::style::ColorReliefLayer&);
|
||||
|
||||
ColorReliefLayer(std::unique_ptr<mbgl::style::ColorReliefLayer>);
|
||||
|
||||
~ColorReliefLayer();
|
||||
|
||||
// Properties
|
||||
|
||||
jni::Local<jni::Object<jni::ObjectTag>> getColorReliefOpacity(jni::JNIEnv&);
|
||||
void setColorReliefOpacityTransition(jni::JNIEnv&, jlong duration, jlong delay);
|
||||
jni::Local<jni::Object<TransitionOptions>> getColorReliefOpacityTransition(jni::JNIEnv&);
|
||||
|
||||
jni::Local<jni::Object<jni::ObjectTag>> getColorReliefColor(jni::JNIEnv&);
|
||||
|
||||
}; // class ColorReliefLayer
|
||||
|
||||
class ColorReliefJavaLayerPeerFactory final : public JavaLayerPeerFactory, public mbgl::ColorReliefLayerFactory {
|
||||
public:
|
||||
~ColorReliefJavaLayerPeerFactory() override;
|
||||
|
||||
// JavaLayerPeerFactory overrides.
|
||||
jni::Local<jni::Object<Layer>> createJavaLayerPeer(jni::JNIEnv&, mbgl::style::Layer&) final;
|
||||
jni::Local<jni::Object<Layer>> createJavaLayerPeer(jni::JNIEnv& env, std::unique_ptr<mbgl::style::Layer>) final;
|
||||
|
||||
void registerNative(jni::JNIEnv&) final;
|
||||
|
||||
LayerFactory* getLayerFactory() final { return this; }
|
||||
|
||||
}; // class ColorReliefJavaLayerPeerFactory
|
||||
|
||||
} // namespace android
|
||||
} // namespace mbgl
|
||||
@@ -50,6 +50,17 @@ jni::Local<jni::Object<>> HillshadeLayer::getHillshadeIlluminationDirection(jni:
|
||||
*convert<jni::Local<jni::Object<>>>(env, toHillshadeLayer(*layer).getHillshadeIlluminationDirection()));
|
||||
}
|
||||
|
||||
jni::Local<jni::Object<>> HillshadeLayer::getHillshadeIlluminationAltitude(jni::JNIEnv& env) {
|
||||
using namespace mbgl::android::conversion;
|
||||
auto layer = layerPtr.get();
|
||||
if (!layer) {
|
||||
return std::move(
|
||||
*convert<jni::Local<jni::Object<>>>(env, style::HillshadeLayer::getDefaultHillshadeIlluminationAltitude()));
|
||||
}
|
||||
return std::move(
|
||||
*convert<jni::Local<jni::Object<>>>(env, toHillshadeLayer(*layer).getHillshadeIlluminationAltitude()));
|
||||
}
|
||||
|
||||
jni::Local<jni::Object<>> HillshadeLayer::getHillshadeIlluminationAnchor(jni::JNIEnv& env) {
|
||||
using namespace mbgl::android::conversion;
|
||||
auto layer = layerPtr.get();
|
||||
@@ -185,6 +196,15 @@ void HillshadeLayer::setHillshadeAccentColorTransition(jni::JNIEnv&, jlong durat
|
||||
toHillshadeLayer(*layer).setHillshadeAccentColorTransition(options);
|
||||
}
|
||||
|
||||
jni::Local<jni::Object<>> HillshadeLayer::getHillshadeMethod(jni::JNIEnv& env) {
|
||||
using namespace mbgl::android::conversion;
|
||||
auto layer = layerPtr.get();
|
||||
if (!layer) {
|
||||
return std::move(*convert<jni::Local<jni::Object<>>>(env, style::HillshadeLayer::getDefaultHillshadeMethod()));
|
||||
}
|
||||
return std::move(*convert<jni::Local<jni::Object<>>>(env, toHillshadeLayer(*layer).getHillshadeMethod()));
|
||||
}
|
||||
|
||||
// HillshadeJavaLayerPeerFactory
|
||||
|
||||
HillshadeJavaLayerPeerFactory::~HillshadeJavaLayerPeerFactory() = default;
|
||||
@@ -226,6 +246,7 @@ void HillshadeJavaLayerPeerFactory::registerNative(jni::JNIEnv& env) {
|
||||
"initialize",
|
||||
"finalize",
|
||||
METHOD(&HillshadeLayer::getHillshadeIlluminationDirection, "nativeGetHillshadeIlluminationDirection"),
|
||||
METHOD(&HillshadeLayer::getHillshadeIlluminationAltitude, "nativeGetHillshadeIlluminationAltitude"),
|
||||
METHOD(&HillshadeLayer::getHillshadeIlluminationAnchor, "nativeGetHillshadeIlluminationAnchor"),
|
||||
METHOD(&HillshadeLayer::getHillshadeExaggerationTransition, "nativeGetHillshadeExaggerationTransition"),
|
||||
METHOD(&HillshadeLayer::setHillshadeExaggerationTransition, "nativeSetHillshadeExaggerationTransition"),
|
||||
@@ -238,7 +259,8 @@ void HillshadeJavaLayerPeerFactory::registerNative(jni::JNIEnv& env) {
|
||||
METHOD(&HillshadeLayer::getHillshadeHighlightColor, "nativeGetHillshadeHighlightColor"),
|
||||
METHOD(&HillshadeLayer::getHillshadeAccentColorTransition, "nativeGetHillshadeAccentColorTransition"),
|
||||
METHOD(&HillshadeLayer::setHillshadeAccentColorTransition, "nativeSetHillshadeAccentColorTransition"),
|
||||
METHOD(&HillshadeLayer::getHillshadeAccentColor, "nativeGetHillshadeAccentColor"));
|
||||
METHOD(&HillshadeLayer::getHillshadeAccentColor, "nativeGetHillshadeAccentColor"),
|
||||
METHOD(&HillshadeLayer::getHillshadeMethod, "nativeGetHillshadeMethod"));
|
||||
}
|
||||
|
||||
} // namespace android
|
||||
|
||||
@@ -28,6 +28,8 @@ public:
|
||||
|
||||
jni::Local<jni::Object<jni::ObjectTag>> getHillshadeIlluminationDirection(jni::JNIEnv&);
|
||||
|
||||
jni::Local<jni::Object<jni::ObjectTag>> getHillshadeIlluminationAltitude(jni::JNIEnv&);
|
||||
|
||||
jni::Local<jni::Object<jni::ObjectTag>> getHillshadeIlluminationAnchor(jni::JNIEnv&);
|
||||
|
||||
jni::Local<jni::Object<jni::ObjectTag>> getHillshadeExaggeration(jni::JNIEnv&);
|
||||
@@ -46,6 +48,8 @@ public:
|
||||
void setHillshadeAccentColorTransition(jni::JNIEnv&, jlong duration, jlong delay);
|
||||
jni::Local<jni::Object<TransitionOptions>> getHillshadeAccentColorTransition(jni::JNIEnv&);
|
||||
|
||||
jni::Local<jni::Object<jni::ObjectTag>> getHillshadeMethod(jni::JNIEnv&);
|
||||
|
||||
}; // class HillshadeLayer
|
||||
|
||||
class HillshadeJavaLayerPeerFactory final : public JavaLayerPeerFactory, public mbgl::HillshadeLayerFactory {
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include "background_layer.hpp"
|
||||
#include "circle_layer.hpp"
|
||||
#include "color_relief_layer.hpp"
|
||||
#include "custom_layer.hpp"
|
||||
#include "fill_extrusion_layer.hpp"
|
||||
#include "fill_layer.hpp"
|
||||
@@ -59,6 +60,11 @@ LayerManagerAndroid::LayerManagerAndroid() {
|
||||
#elif !defined(MBGL_LAYER_HILLSHADE_DISABLE_ALL)
|
||||
addLayerType(std::make_unique<HillshadeJavaLayerPeerFactory>());
|
||||
#endif
|
||||
#if defined(MBGL_LAYER_COLOR_RELIEF_DISABLE_RUNTIME)
|
||||
addLayerTypeCoreOnly(std::make_unique<ColorReliefLayerFactory>());
|
||||
#elif !defined(MBGL_LAYER_COLOR_RELIEF_DISABLE_ALL)
|
||||
addLayerType(std::make_unique<ColorReliefJavaLayerPeerFactory>());
|
||||
#endif
|
||||
#if defined(MBGL_LAYER_FILL_EXTRUSION_DISABLE_RUNTIME)
|
||||
addLayerTypeCoreOnly(std::make_unique<FillExtrusionLayerFactory>());
|
||||
#elif !defined(MBGL_LAYER_FILL_EXTRUSION_DISABLE_ALL)
|
||||
|
||||
@@ -0,0 +1,227 @@
|
||||
// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`.
|
||||
|
||||
package org.maplibre.android.style.layers;
|
||||
|
||||
import androidx.annotation.ColorInt;
|
||||
import androidx.annotation.Keep;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.UiThread;
|
||||
|
||||
import static org.maplibre.android.utils.ColorUtils.rgbaToColor;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import org.maplibre.android.style.expressions.Expression;
|
||||
import org.maplibre.android.style.layers.TransitionOptions;
|
||||
|
||||
/**
|
||||
* Client-side elevation coloring based on DEM data. The implementation supports Mapbox Terrain RGB, Mapzen Terrarium tiles and custom encodings.
|
||||
*
|
||||
* @see <a href="https://maplibre.org/maplibre-style-spec/#layers-color-relief">The online documentation</a>
|
||||
*/
|
||||
@UiThread
|
||||
public class ColorReliefLayer extends Layer {
|
||||
|
||||
/**
|
||||
* Creates a ColorReliefLayer.
|
||||
*
|
||||
* @param nativePtr pointer used by core
|
||||
*/
|
||||
@Keep
|
||||
ColorReliefLayer(long nativePtr) {
|
||||
super(nativePtr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a ColorReliefLayer.
|
||||
*
|
||||
* @param layerId the id of the layer
|
||||
* @param sourceId the id of the source
|
||||
*/
|
||||
public ColorReliefLayer(String layerId, String sourceId) {
|
||||
super();
|
||||
initialize(layerId, sourceId);
|
||||
}
|
||||
|
||||
@Keep
|
||||
protected native void initialize(String layerId, String sourceId);
|
||||
|
||||
/**
|
||||
* Set the source layer.
|
||||
*
|
||||
* @param sourceLayer the source layer to set
|
||||
*/
|
||||
public void setSourceLayer(String sourceLayer) {
|
||||
checkThread();
|
||||
nativeSetSourceLayer(sourceLayer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the source Layer.
|
||||
*
|
||||
* @param sourceLayer the source layer to set
|
||||
* @return This
|
||||
*/
|
||||
@NonNull
|
||||
public ColorReliefLayer withSourceLayer(String sourceLayer) {
|
||||
setSourceLayer(sourceLayer);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the source id.
|
||||
*
|
||||
* @return id of the source
|
||||
*/
|
||||
@NonNull
|
||||
public String getSourceId() {
|
||||
checkThread();
|
||||
return nativeGetSourceId();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the source layer.
|
||||
*
|
||||
* @return sourceLayer the source layer to get
|
||||
*/
|
||||
@NonNull
|
||||
public String getSourceLayer() {
|
||||
checkThread();
|
||||
return nativeGetSourceLayer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a single expression filter.
|
||||
*
|
||||
* @param filter the expression filter to set
|
||||
*/
|
||||
public void setFilter(@NonNull Expression filter) {
|
||||
checkThread();
|
||||
nativeSetFilter(filter.toArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a single expression filter.
|
||||
*
|
||||
* @param filter the expression filter to set
|
||||
* @return This
|
||||
*/
|
||||
@NonNull
|
||||
public ColorReliefLayer withFilter(@NonNull Expression filter) {
|
||||
setFilter(filter);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a single expression filter.
|
||||
*
|
||||
* @return the expression filter to get
|
||||
*/
|
||||
@Nullable
|
||||
public Expression getFilter() {
|
||||
checkThread();
|
||||
JsonElement jsonElement = nativeGetFilter();
|
||||
if (jsonElement != null) {
|
||||
return Expression.Converter.convert(jsonElement);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a property or properties.
|
||||
*
|
||||
* @param properties the var-args properties
|
||||
* @return This
|
||||
*/
|
||||
@NonNull
|
||||
public ColorReliefLayer withProperties(@NonNull PropertyValue<?>... properties) {
|
||||
setProperties(properties);
|
||||
return this;
|
||||
}
|
||||
|
||||
// Property getters
|
||||
|
||||
/**
|
||||
* Get the ColorReliefOpacity property
|
||||
*
|
||||
* @return property wrapper value around Float
|
||||
*/
|
||||
@NonNull
|
||||
@SuppressWarnings("unchecked")
|
||||
public PropertyValue<Float> getColorReliefOpacity() {
|
||||
checkThread();
|
||||
return (PropertyValue<Float>) new PropertyValue("color-relief-opacity", nativeGetColorReliefOpacity());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ColorReliefOpacity property transition options
|
||||
*
|
||||
* @return transition options for Float
|
||||
*/
|
||||
@NonNull
|
||||
public TransitionOptions getColorReliefOpacityTransition() {
|
||||
checkThread();
|
||||
return nativeGetColorReliefOpacityTransition();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the ColorReliefOpacity property transition options
|
||||
*
|
||||
* @param options transition options for Float
|
||||
*/
|
||||
public void setColorReliefOpacityTransition(@NonNull TransitionOptions options) {
|
||||
checkThread();
|
||||
nativeSetColorReliefOpacityTransition(options.getDuration(), options.getDelay());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ColorReliefColor property
|
||||
*
|
||||
* @return property wrapper value around String
|
||||
*/
|
||||
@NonNull
|
||||
@SuppressWarnings("unchecked")
|
||||
public PropertyValue<String> getColorReliefColor() {
|
||||
checkThread();
|
||||
return (PropertyValue<String>) new PropertyValue("color-relief-color", nativeGetColorReliefColor());
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the color of each pixel based on its elevation. Should be an expression that uses `["elevation"]` as input.
|
||||
*
|
||||
* @return int representation of a rgba string color
|
||||
* @throws RuntimeException thrown if property isn't a value
|
||||
*/
|
||||
@ColorInt
|
||||
public int getColorReliefColorAsInt() {
|
||||
checkThread();
|
||||
PropertyValue<String> value = getColorReliefColor();
|
||||
if (value.isValue()) {
|
||||
return rgbaToColor(value.getValue());
|
||||
} else {
|
||||
throw new RuntimeException("color-relief-color was set as a Function");
|
||||
}
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Keep
|
||||
private native Object nativeGetColorReliefOpacity();
|
||||
|
||||
@NonNull
|
||||
@Keep
|
||||
private native TransitionOptions nativeGetColorReliefOpacityTransition();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetColorReliefOpacityTransition(long duration, long delay);
|
||||
|
||||
@NonNull
|
||||
@Keep
|
||||
private native Object nativeGetColorReliefColor();
|
||||
|
||||
@Override
|
||||
@Keep
|
||||
protected native void finalize() throws Throwable;
|
||||
|
||||
}
|
||||
@@ -97,13 +97,25 @@ public class HillshadeLayer extends Layer {
|
||||
/**
|
||||
* Get the HillshadeIlluminationDirection property
|
||||
*
|
||||
* @return property wrapper value around Float
|
||||
* @return property wrapper value around Float[]
|
||||
*/
|
||||
@NonNull
|
||||
@SuppressWarnings("unchecked")
|
||||
public PropertyValue<Float> getHillshadeIlluminationDirection() {
|
||||
public PropertyValue<Float[]> getHillshadeIlluminationDirection() {
|
||||
checkThread();
|
||||
return (PropertyValue<Float>) new PropertyValue("hillshade-illumination-direction", nativeGetHillshadeIlluminationDirection());
|
||||
return (PropertyValue<Float[]>) new PropertyValue("hillshade-illumination-direction", nativeGetHillshadeIlluminationDirection());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the HillshadeIlluminationAltitude property
|
||||
*
|
||||
* @return property wrapper value around Float[]
|
||||
*/
|
||||
@NonNull
|
||||
@SuppressWarnings("unchecked")
|
||||
public PropertyValue<Float[]> getHillshadeIlluminationAltitude() {
|
||||
checkThread();
|
||||
return (PropertyValue<Float[]>) new PropertyValue("hillshade-illumination-altitude", nativeGetHillshadeIlluminationAltitude());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -154,36 +166,19 @@ public class HillshadeLayer extends Layer {
|
||||
/**
|
||||
* Get the HillshadeShadowColor property
|
||||
*
|
||||
* @return property wrapper value around String
|
||||
* @return property wrapper value around String[]
|
||||
*/
|
||||
@NonNull
|
||||
@SuppressWarnings("unchecked")
|
||||
public PropertyValue<String> getHillshadeShadowColor() {
|
||||
public PropertyValue<String[]> getHillshadeShadowColor() {
|
||||
checkThread();
|
||||
return (PropertyValue<String>) new PropertyValue("hillshade-shadow-color", nativeGetHillshadeShadowColor());
|
||||
}
|
||||
|
||||
/**
|
||||
* The shading color of areas that face away from the light source.
|
||||
*
|
||||
* @return int representation of a rgba string color
|
||||
* @throws RuntimeException thrown if property isn't a value
|
||||
*/
|
||||
@ColorInt
|
||||
public int getHillshadeShadowColorAsInt() {
|
||||
checkThread();
|
||||
PropertyValue<String> value = getHillshadeShadowColor();
|
||||
if (value.isValue()) {
|
||||
return rgbaToColor(value.getValue());
|
||||
} else {
|
||||
throw new RuntimeException("hillshade-shadow-color was set as a Function");
|
||||
}
|
||||
return (PropertyValue<String[]>) new PropertyValue("hillshade-shadow-color", nativeGetHillshadeShadowColor());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the HillshadeShadowColor property transition options
|
||||
*
|
||||
* @return transition options for String
|
||||
* @return transition options for String[]
|
||||
*/
|
||||
@NonNull
|
||||
public TransitionOptions getHillshadeShadowColorTransition() {
|
||||
@@ -194,7 +189,7 @@ public class HillshadeLayer extends Layer {
|
||||
/**
|
||||
* Set the HillshadeShadowColor property transition options
|
||||
*
|
||||
* @param options transition options for String
|
||||
* @param options transition options for String[]
|
||||
*/
|
||||
public void setHillshadeShadowColorTransition(@NonNull TransitionOptions options) {
|
||||
checkThread();
|
||||
@@ -204,36 +199,19 @@ public class HillshadeLayer extends Layer {
|
||||
/**
|
||||
* Get the HillshadeHighlightColor property
|
||||
*
|
||||
* @return property wrapper value around String
|
||||
* @return property wrapper value around String[]
|
||||
*/
|
||||
@NonNull
|
||||
@SuppressWarnings("unchecked")
|
||||
public PropertyValue<String> getHillshadeHighlightColor() {
|
||||
public PropertyValue<String[]> getHillshadeHighlightColor() {
|
||||
checkThread();
|
||||
return (PropertyValue<String>) new PropertyValue("hillshade-highlight-color", nativeGetHillshadeHighlightColor());
|
||||
}
|
||||
|
||||
/**
|
||||
* The shading color of areas that faces towards the light source.
|
||||
*
|
||||
* @return int representation of a rgba string color
|
||||
* @throws RuntimeException thrown if property isn't a value
|
||||
*/
|
||||
@ColorInt
|
||||
public int getHillshadeHighlightColorAsInt() {
|
||||
checkThread();
|
||||
PropertyValue<String> value = getHillshadeHighlightColor();
|
||||
if (value.isValue()) {
|
||||
return rgbaToColor(value.getValue());
|
||||
} else {
|
||||
throw new RuntimeException("hillshade-highlight-color was set as a Function");
|
||||
}
|
||||
return (PropertyValue<String[]>) new PropertyValue("hillshade-highlight-color", nativeGetHillshadeHighlightColor());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the HillshadeHighlightColor property transition options
|
||||
*
|
||||
* @return transition options for String
|
||||
* @return transition options for String[]
|
||||
*/
|
||||
@NonNull
|
||||
public TransitionOptions getHillshadeHighlightColorTransition() {
|
||||
@@ -244,7 +222,7 @@ public class HillshadeLayer extends Layer {
|
||||
/**
|
||||
* Set the HillshadeHighlightColor property transition options
|
||||
*
|
||||
* @param options transition options for String
|
||||
* @param options transition options for String[]
|
||||
*/
|
||||
public void setHillshadeHighlightColorTransition(@NonNull TransitionOptions options) {
|
||||
checkThread();
|
||||
@@ -301,10 +279,26 @@ public class HillshadeLayer extends Layer {
|
||||
nativeSetHillshadeAccentColorTransition(options.getDuration(), options.getDelay());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the HillshadeMethod property
|
||||
*
|
||||
* @return property wrapper value around String
|
||||
*/
|
||||
@NonNull
|
||||
@SuppressWarnings("unchecked")
|
||||
public PropertyValue<String> getHillshadeMethod() {
|
||||
checkThread();
|
||||
return (PropertyValue<String>) new PropertyValue("hillshade-method", nativeGetHillshadeMethod());
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Keep
|
||||
private native Object nativeGetHillshadeIlluminationDirection();
|
||||
|
||||
@NonNull
|
||||
@Keep
|
||||
private native Object nativeGetHillshadeIlluminationAltitude();
|
||||
|
||||
@NonNull
|
||||
@Keep
|
||||
private native Object nativeGetHillshadeIlluminationAnchor();
|
||||
@@ -353,6 +347,10 @@ public class HillshadeLayer extends Layer {
|
||||
@Keep
|
||||
private native void nativeSetHillshadeAccentColorTransition(long duration, long delay);
|
||||
|
||||
@NonNull
|
||||
@Keep
|
||||
private native Object nativeGetHillshadeMethod();
|
||||
|
||||
@Override
|
||||
@Keep
|
||||
protected native void finalize() throws Throwable;
|
||||
|
||||
@@ -648,6 +648,42 @@ public final class Property {
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface HILLSHADE_ILLUMINATION_ANCHOR {}
|
||||
|
||||
// HILLSHADE_METHOD: The hillshade algorithm to use, one of `standard`, `basic`, `combined`, `igor`, or `multidirectional`. 
|
||||
|
||||
/**
|
||||
* The legacy hillshade method.
|
||||
*/
|
||||
public static final String HILLSHADE_METHOD_STANDARD = "standard";
|
||||
/**
|
||||
* Basic hillshade. Uses a simple physics model where the reflected light intensity is proportional to the cosine of the angle between the incident light and the surface normal. Similar to GDAL's {@link GDALDEM} default algorithm.
|
||||
*/
|
||||
public static final String HILLSHADE_METHOD_BASIC = "basic";
|
||||
/**
|
||||
* Hillshade algorithm whose intensity scales with slope. Similar to GDAL's {@link GDALDEM} with -combined option.
|
||||
*/
|
||||
public static final String HILLSHADE_METHOD_COMBINED = "combined";
|
||||
/**
|
||||
* Hillshade algorithm which tries to minimize effects on other map features beneath. Similar to GDAL's {@link GDALDEM} with -igor option.
|
||||
*/
|
||||
public static final String HILLSHADE_METHOD_IGOR = "igor";
|
||||
/**
|
||||
* Hillshade with multiple illumination directions. Uses the basic hillshade model with multiple independent light sources.
|
||||
*/
|
||||
public static final String HILLSHADE_METHOD_MULTIDIRECTIONAL = "multidirectional";
|
||||
|
||||
/**
|
||||
* The hillshade algorithm to use, one of `standard`, `basic`, `combined`, `igor`, or `multidirectional`. 
|
||||
*/
|
||||
@StringDef({
|
||||
HILLSHADE_METHOD_STANDARD,
|
||||
HILLSHADE_METHOD_BASIC,
|
||||
HILLSHADE_METHOD_COMBINED,
|
||||
HILLSHADE_METHOD_IGOR,
|
||||
HILLSHADE_METHOD_MULTIDIRECTIONAL,
|
||||
})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface HILLSHADE_METHOD {}
|
||||
|
||||
// ANCHOR: Whether extruded geometries are lit relative to the map or viewport.
|
||||
|
||||
/**
|
||||
|
||||
@@ -507,6 +507,7 @@ public class PropertyFactory {
|
||||
|
||||
/**
|
||||
* Distance of halo to the icon outline.
|
||||
|
||||
The unit is in density-independent pixels only for SDF sprites that were created with a blur radius of 8, multiplied by the display density. I.e., the radius needs to be 16 for `@2x` sprites, etc.
|
||||
*
|
||||
* @param value a Float value
|
||||
@@ -518,6 +519,7 @@ The unit is in density-independent pixels only for SDF sprites that were created
|
||||
|
||||
/**
|
||||
* Distance of halo to the icon outline.
|
||||
|
||||
The unit is in density-independent pixels only for SDF sprites that were created with a blur radius of 8, multiplied by the display density. I.e., the radius needs to be 16 for `@2x` sprites, etc.
|
||||
*
|
||||
* @param expression an expression statement
|
||||
@@ -1428,17 +1430,17 @@ The unit is in density-independent pixels only for SDF sprites that were created
|
||||
}
|
||||
|
||||
/**
|
||||
* The direction of the light source used to generate the hillshading with 0 as the top of the viewport if {@link Property.HILLSHADE_ILLUMINATION_ANCHOR} is set to `viewport` and due north if {@link Property.HILLSHADE_ILLUMINATION_ANCHOR} is set to `map`.
|
||||
* The direction of the light source(s) used to generate the hillshading with 0 as the top of the viewport if {@link Property.HILLSHADE_ILLUMINATION_ANCHOR} is set to `viewport` and due north if {@link Property.HILLSHADE_ILLUMINATION_ANCHOR} is set to `map`. Only when {@link Property.HILLSHADE_METHOD} is set to `multidirectional` can you specify multiple light sources.
|
||||
*
|
||||
* @param value a Float value
|
||||
* @return property wrapper around Float
|
||||
* @param value a Float[] value
|
||||
* @return property wrapper around Float[]
|
||||
*/
|
||||
public static PropertyValue<Float> hillshadeIlluminationDirection(Float value) {
|
||||
public static PropertyValue<Float[]> hillshadeIlluminationDirection(Float[] value) {
|
||||
return new PaintPropertyValue<>("hillshade-illumination-direction", value);
|
||||
}
|
||||
|
||||
/**
|
||||
* The direction of the light source used to generate the hillshading with 0 as the top of the viewport if {@link Property.HILLSHADE_ILLUMINATION_ANCHOR} is set to `viewport` and due north if {@link Property.HILLSHADE_ILLUMINATION_ANCHOR} is set to `map`.
|
||||
* The direction of the light source(s) used to generate the hillshading with 0 as the top of the viewport if {@link Property.HILLSHADE_ILLUMINATION_ANCHOR} is set to `viewport` and due north if {@link Property.HILLSHADE_ILLUMINATION_ANCHOR} is set to `map`. Only when {@link Property.HILLSHADE_METHOD} is set to `multidirectional` can you specify multiple light sources.
|
||||
*
|
||||
* @param expression an expression statement
|
||||
* @return property wrapper around an expression statement
|
||||
@@ -1447,6 +1449,26 @@ The unit is in density-independent pixels only for SDF sprites that were created
|
||||
return new PaintPropertyValue<>("hillshade-illumination-direction", expression);
|
||||
}
|
||||
|
||||
/**
|
||||
* The altitude of the light source(s) used to generate the hillshading with 0 as sunset and 90 as noon. Only when {@link Property.HILLSHADE_METHOD} is set to `multidirectional` can you specify multiple light sources.
|
||||
*
|
||||
* @param value a Float[] value
|
||||
* @return property wrapper around Float[]
|
||||
*/
|
||||
public static PropertyValue<Float[]> hillshadeIlluminationAltitude(Float[] value) {
|
||||
return new PaintPropertyValue<>("hillshade-illumination-altitude", value);
|
||||
}
|
||||
|
||||
/**
|
||||
* The altitude of the light source(s) used to generate the hillshading with 0 as sunset and 90 as noon. Only when {@link Property.HILLSHADE_METHOD} is set to `multidirectional` can you specify multiple light sources.
|
||||
*
|
||||
* @param expression an expression statement
|
||||
* @return property wrapper around an expression statement
|
||||
*/
|
||||
public static PropertyValue<Expression> hillshadeIlluminationAltitude(Expression expression) {
|
||||
return new PaintPropertyValue<>("hillshade-illumination-altitude", expression);
|
||||
}
|
||||
|
||||
/**
|
||||
* Direction of light source when map is rotated.
|
||||
*
|
||||
@@ -1488,27 +1510,17 @@ The unit is in density-independent pixels only for SDF sprites that were created
|
||||
}
|
||||
|
||||
/**
|
||||
* The shading color of areas that face away from the light source.
|
||||
* The shading color of areas that face away from the light source(s). Only when {@link Property.HILLSHADE_METHOD} is set to `multidirectional` can you specify multiple light sources.
|
||||
*
|
||||
* @param value a int color value
|
||||
* @return property wrapper around String color
|
||||
* @param value a String[] value
|
||||
* @return property wrapper around String[]
|
||||
*/
|
||||
public static PropertyValue<String> hillshadeShadowColor(@ColorInt int value) {
|
||||
return new PaintPropertyValue<>("hillshade-shadow-color", colorToRgbaString(value));
|
||||
}
|
||||
|
||||
/**
|
||||
* The shading color of areas that face away from the light source.
|
||||
*
|
||||
* @param value a String value
|
||||
* @return property wrapper around String
|
||||
*/
|
||||
public static PropertyValue<String> hillshadeShadowColor(String value) {
|
||||
public static PropertyValue<String[]> hillshadeShadowColor(String[] value) {
|
||||
return new PaintPropertyValue<>("hillshade-shadow-color", value);
|
||||
}
|
||||
|
||||
/**
|
||||
* The shading color of areas that face away from the light source.
|
||||
* The shading color of areas that face away from the light source(s). Only when {@link Property.HILLSHADE_METHOD} is set to `multidirectional` can you specify multiple light sources.
|
||||
*
|
||||
* @param expression an expression statement
|
||||
* @return property wrapper around an expression statement
|
||||
@@ -1518,27 +1530,17 @@ The unit is in density-independent pixels only for SDF sprites that were created
|
||||
}
|
||||
|
||||
/**
|
||||
* The shading color of areas that faces towards the light source.
|
||||
* The shading color of areas that faces towards the light source(s). Only when {@link Property.HILLSHADE_METHOD} is set to `multidirectional` can you specify multiple light sources.
|
||||
*
|
||||
* @param value a int color value
|
||||
* @return property wrapper around String color
|
||||
* @param value a String[] value
|
||||
* @return property wrapper around String[]
|
||||
*/
|
||||
public static PropertyValue<String> hillshadeHighlightColor(@ColorInt int value) {
|
||||
return new PaintPropertyValue<>("hillshade-highlight-color", colorToRgbaString(value));
|
||||
}
|
||||
|
||||
/**
|
||||
* The shading color of areas that faces towards the light source.
|
||||
*
|
||||
* @param value a String value
|
||||
* @return property wrapper around String
|
||||
*/
|
||||
public static PropertyValue<String> hillshadeHighlightColor(String value) {
|
||||
public static PropertyValue<String[]> hillshadeHighlightColor(String[] value) {
|
||||
return new PaintPropertyValue<>("hillshade-highlight-color", value);
|
||||
}
|
||||
|
||||
/**
|
||||
* The shading color of areas that faces towards the light source.
|
||||
* The shading color of areas that faces towards the light source(s). Only when {@link Property.HILLSHADE_METHOD} is set to `multidirectional` can you specify multiple light sources.
|
||||
*
|
||||
* @param expression an expression statement
|
||||
* @return property wrapper around an expression statement
|
||||
@@ -1577,6 +1579,76 @@ The unit is in density-independent pixels only for SDF sprites that were created
|
||||
return new PaintPropertyValue<>("hillshade-accent-color", expression);
|
||||
}
|
||||
|
||||
/**
|
||||
* The hillshade algorithm to use, one of `standard`, `basic`, `combined`, `igor`, or `multidirectional`. 
|
||||
*
|
||||
* @param value a String value
|
||||
* @return property wrapper around String
|
||||
*/
|
||||
public static PropertyValue<String> hillshadeMethod(@Property.HILLSHADE_METHOD String value) {
|
||||
return new PaintPropertyValue<>("hillshade-method", value);
|
||||
}
|
||||
|
||||
/**
|
||||
* The hillshade algorithm to use, one of `standard`, `basic`, `combined`, `igor`, or `multidirectional`. 
|
||||
*
|
||||
* @param expression an expression statement
|
||||
* @return property wrapper around an expression statement
|
||||
*/
|
||||
public static PropertyValue<Expression> hillshadeMethod(Expression expression) {
|
||||
return new PaintPropertyValue<>("hillshade-method", expression);
|
||||
}
|
||||
|
||||
/**
|
||||
* The opacity at which the color-relief will be drawn.
|
||||
*
|
||||
* @param value a Float value
|
||||
* @return property wrapper around Float
|
||||
*/
|
||||
public static PropertyValue<Float> colorReliefOpacity(Float value) {
|
||||
return new PaintPropertyValue<>("color-relief-opacity", value);
|
||||
}
|
||||
|
||||
/**
|
||||
* The opacity at which the color-relief will be drawn.
|
||||
*
|
||||
* @param expression an expression statement
|
||||
* @return property wrapper around an expression statement
|
||||
*/
|
||||
public static PropertyValue<Expression> colorReliefOpacity(Expression expression) {
|
||||
return new PaintPropertyValue<>("color-relief-opacity", expression);
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the color of each pixel based on its elevation. Should be an expression that uses `["elevation"]` as input.
|
||||
*
|
||||
* @param value a int color value
|
||||
* @return property wrapper around String color
|
||||
*/
|
||||
public static PropertyValue<String> colorReliefColor(@ColorInt int value) {
|
||||
return new PaintPropertyValue<>("color-relief-color", colorToRgbaString(value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the color of each pixel based on its elevation. Should be an expression that uses `["elevation"]` as input.
|
||||
*
|
||||
* @param value a String value
|
||||
* @return property wrapper around String
|
||||
*/
|
||||
public static PropertyValue<String> colorReliefColor(String value) {
|
||||
return new PaintPropertyValue<>("color-relief-color", value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the color of each pixel based on its elevation. Should be an expression that uses `["elevation"]` as input.
|
||||
*
|
||||
* @param expression an expression statement
|
||||
* @return property wrapper around an expression statement
|
||||
*/
|
||||
public static PropertyValue<Expression> colorReliefColor(Expression expression) {
|
||||
return new PaintPropertyValue<>("color-relief-color", expression);
|
||||
}
|
||||
|
||||
/**
|
||||
* The color with which the background will be drawn.
|
||||
*
|
||||
@@ -2228,7 +2300,7 @@ The unit is in density-independent pixels only for SDF sprites that were created
|
||||
}
|
||||
|
||||
/**
|
||||
* Font stack to use for displaying text.
|
||||
* Fonts to use for displaying text. If the `glyphs` root property is specified, this array is joined together and interpreted as a font stack name. Otherwise, it is interpreted as a cascading fallback list of local font names.
|
||||
*
|
||||
* @param value a String[] value
|
||||
* @return property wrapper around String[]
|
||||
@@ -2238,7 +2310,7 @@ The unit is in density-independent pixels only for SDF sprites that were created
|
||||
}
|
||||
|
||||
/**
|
||||
* Font stack to use for displaying text.
|
||||
* Fonts to use for displaying text. If the `glyphs` root property is specified, this array is joined together and interpreted as a font stack name. Otherwise, it is interpreted as a cascading fallback list of local font names.
|
||||
*
|
||||
* @param value a String[] value
|
||||
* @return property wrapper around String[]
|
||||
@@ -2395,7 +2467,9 @@ The unit is in density-independent pixels only for SDF sprites that were created
|
||||
When present, this property takes precedence over {@link Property.TEXT_ANCHOR}, {@link PropertyFactory#textVariableAnchor}, {@link PropertyFactory#textOffset}, and {@link PropertyFactory#textRadialOffset}.
|
||||
|
||||
```json
|
||||
|
||||
{ "text-variable-anchor-offset": ["top", [0, 4], "left", [3,0], "bottom", [1, 1]] }
|
||||
|
||||
```
|
||||
|
||||
When the renderer chooses the `top` anchor, `[0, 4]` will be used for {@link PropertyFactory#textOffset}; the text will be shifted down by 4 ems.
|
||||
@@ -2417,7 +2491,9 @@ The unit is in density-independent pixels only for SDF sprites that were created
|
||||
When present, this property takes precedence over {@link Property.TEXT_ANCHOR}, {@link PropertyFactory#textVariableAnchor}, {@link PropertyFactory#textOffset}, and {@link PropertyFactory#textRadialOffset}.
|
||||
|
||||
```json
|
||||
|
||||
{ "text-variable-anchor-offset": ["top", [0, 4], "left", [3,0], "bottom", [1, 1]] }
|
||||
|
||||
```
|
||||
|
||||
When the renderer chooses the `top` anchor, `[0, 4]` will be used for {@link PropertyFactory#textOffset}; the text will be shifted down by 4 ems.
|
||||
|
||||
Reference in New Issue
Block a user