[core] add raster-resampling property (#12176)
* update style-code for raster-resampling * implement user-defined raster-resampling * invert filter condition * raster-resampling -> raster-resampling-mode for darwin language conventions
This commit is contained in:
@@ -67,6 +67,12 @@ public:
|
||||
void setRasterContrastTransition(const TransitionOptions&);
|
||||
TransitionOptions getRasterContrastTransition() const;
|
||||
|
||||
static PropertyValue<RasterResamplingType> getDefaultRasterResampling();
|
||||
PropertyValue<RasterResamplingType> getRasterResampling() const;
|
||||
void setRasterResampling(PropertyValue<RasterResamplingType>);
|
||||
void setRasterResamplingTransition(const TransitionOptions&);
|
||||
TransitionOptions getRasterResamplingTransition() const;
|
||||
|
||||
static PropertyValue<float> getDefaultRasterFadeDuration();
|
||||
PropertyValue<float> getRasterFadeDuration() const;
|
||||
void setRasterFadeDuration(PropertyValue<float>);
|
||||
|
||||
@@ -38,6 +38,11 @@ enum class LineJoinType : uint8_t {
|
||||
FlipBevel
|
||||
};
|
||||
|
||||
enum class RasterResamplingType : bool {
|
||||
Linear,
|
||||
Nearest
|
||||
};
|
||||
|
||||
enum class HillshadeIlluminationAnchorType : bool {
|
||||
Map,
|
||||
Viewport
|
||||
|
||||
Submodule mapbox-gl-js updated: 45b0be007c...f546de26b9
@@ -570,6 +570,27 @@ public final class Property {
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface FILL_EXTRUSION_TRANSLATE_ANCHOR {}
|
||||
|
||||
// RASTER_RESAMPLING: The resampling/interpolation method to use for overscaling, also known as texture magnification filter
|
||||
|
||||
/**
|
||||
* (Bi)linear filtering interpolates pixel values using the weighted average of the four closest original source pixels creating a smooth but blurry look when overscaled
|
||||
*/
|
||||
public static final String RASTER_RESAMPLING_LINEAR = "linear";
|
||||
/**
|
||||
* Nearest neighbor filtering interpolates pixel values using the nearest original source pixel creating a sharp but pixelated look when overscaled
|
||||
*/
|
||||
public static final String RASTER_RESAMPLING_NEAREST = "nearest";
|
||||
|
||||
/**
|
||||
* The resampling/interpolation method to use for overscaling, also known as texture magnification filter
|
||||
*/
|
||||
@StringDef({
|
||||
RASTER_RESAMPLING_LINEAR,
|
||||
RASTER_RESAMPLING_NEAREST,
|
||||
})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface RASTER_RESAMPLING {}
|
||||
|
||||
// HILLSHADE_ILLUMINATION_ANCHOR: Direction of light source when map is rotated.
|
||||
|
||||
/**
|
||||
|
||||
@@ -1335,6 +1335,26 @@ public class PropertyFactory {
|
||||
return new PaintPropertyValue<>("raster-contrast", expression);
|
||||
}
|
||||
|
||||
/**
|
||||
* The resampling/interpolation method to use for overscaling, also known as texture magnification filter
|
||||
*
|
||||
* @param value a String value
|
||||
* @return property wrapper around String
|
||||
*/
|
||||
public static PropertyValue<String> rasterResampling(@Property.RASTER_RESAMPLING String value) {
|
||||
return new PaintPropertyValue<>("raster-resampling", value);
|
||||
}
|
||||
|
||||
/**
|
||||
* The resampling/interpolation method to use for overscaling, also known as texture magnification filter
|
||||
*
|
||||
* @param expression an expression statement
|
||||
* @return property wrapper around an expression statement
|
||||
*/
|
||||
public static PropertyValue<Expression> rasterResampling(Expression expression) {
|
||||
return new PaintPropertyValue<>("raster-resampling", expression);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fade duration when a new tile is added.
|
||||
*
|
||||
|
||||
@@ -263,6 +263,17 @@ public class RasterLayer extends Layer {
|
||||
nativeSetRasterContrastTransition(options.getDuration(), options.getDelay());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the RasterResampling property
|
||||
*
|
||||
* @return property wrapper value around String
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public PropertyValue<String> getRasterResampling() {
|
||||
checkThread();
|
||||
return (PropertyValue<String>) new PropertyValue("raster-resampling", nativeGetRasterResampling());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the RasterFadeDuration property
|
||||
*
|
||||
@@ -310,6 +321,8 @@ public class RasterLayer extends Layer {
|
||||
|
||||
private native void nativeSetRasterContrastTransition(long duration, long delay);
|
||||
|
||||
private native Object nativeGetRasterResampling();
|
||||
|
||||
private native Object nativeGetRasterFadeDuration();
|
||||
|
||||
@Override
|
||||
|
||||
@@ -241,6 +241,20 @@ public class RasterLayerTest extends BaseActivityTest {
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRasterResamplingAsConstant() {
|
||||
validateTestSetup();
|
||||
setupLayer();
|
||||
Timber.i("raster-resampling");
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
assertNotNull(layer);
|
||||
|
||||
// Set and Get
|
||||
layer.setProperties(rasterResampling(RASTER_RESAMPLING_LINEAR));
|
||||
assertEquals((String) layer.getRasterResampling().getValue(), (String) RASTER_RESAMPLING_LINEAR);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRasterFadeDurationAsConstant() {
|
||||
validateTestSetup();
|
||||
|
||||
@@ -92,6 +92,13 @@ struct Converter<jni::jobject*, mbgl::style::CirclePitchScaleType> {
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct Converter<jni::jobject*, mbgl::style::RasterResamplingType> {
|
||||
Result<jni::jobject*> operator()(jni::JNIEnv& env, const mbgl::style::RasterResamplingType& value) const {
|
||||
return convert<jni::jobject*, std::string>(env, toString(value));
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct Converter<jni::jobject*, mbgl::style::HillshadeIlluminationAnchorType> {
|
||||
Result<jni::jobject*> operator()(jni::JNIEnv& env, const mbgl::style::HillshadeIlluminationAnchorType& value) const {
|
||||
|
||||
@@ -206,6 +206,20 @@ namespace conversion {
|
||||
}
|
||||
}
|
||||
|
||||
// raster-resampling
|
||||
inline std::string toString(mbgl::style::RasterResamplingType value) {
|
||||
switch (value) {
|
||||
case mbgl::style::RasterResamplingType::Linear:
|
||||
return "linear";
|
||||
break;
|
||||
case mbgl::style::RasterResamplingType::Nearest:
|
||||
return "nearest";
|
||||
break;
|
||||
default:
|
||||
throw std::runtime_error("Not implemented");
|
||||
}
|
||||
}
|
||||
|
||||
// hillshade-illumination-anchor
|
||||
inline std::string toString(mbgl::style::HillshadeIlluminationAnchorType value) {
|
||||
switch (value) {
|
||||
|
||||
@@ -149,6 +149,12 @@ namespace android {
|
||||
layer.as<mbgl::style::RasterLayer>()->RasterLayer::setRasterContrastTransition(options);
|
||||
}
|
||||
|
||||
jni::Object<jni::ObjectTag> RasterLayer::getRasterResampling(jni::JNIEnv& env) {
|
||||
using namespace mbgl::android::conversion;
|
||||
Result<jni::jobject*> converted = convert<jni::jobject*>(env, layer.as<mbgl::style::RasterLayer>()->RasterLayer::getRasterResampling());
|
||||
return jni::Object<jni::ObjectTag>(*converted);
|
||||
}
|
||||
|
||||
jni::Object<jni::ObjectTag> RasterLayer::getRasterFadeDuration(jni::JNIEnv& env) {
|
||||
using namespace mbgl::android::conversion;
|
||||
Result<jni::jobject*> converted = convert<jni::jobject*>(env, layer.as<mbgl::style::RasterLayer>()->RasterLayer::getRasterFadeDuration());
|
||||
@@ -193,6 +199,7 @@ namespace android {
|
||||
METHOD(&RasterLayer::getRasterContrastTransition, "nativeGetRasterContrastTransition"),
|
||||
METHOD(&RasterLayer::setRasterContrastTransition, "nativeSetRasterContrastTransition"),
|
||||
METHOD(&RasterLayer::getRasterContrast, "nativeGetRasterContrast"),
|
||||
METHOD(&RasterLayer::getRasterResampling, "nativeGetRasterResampling"),
|
||||
METHOD(&RasterLayer::getRasterFadeDuration, "nativeGetRasterFadeDuration"));
|
||||
}
|
||||
|
||||
|
||||
@@ -53,6 +53,8 @@ public:
|
||||
void setRasterContrastTransition(jni::JNIEnv&, jlong duration, jlong delay);
|
||||
jni::Object<TransitionOptions> getRasterContrastTransition(jni::JNIEnv&);
|
||||
|
||||
jni::Object<jni::ObjectTag> getRasterResampling(jni::JNIEnv&);
|
||||
|
||||
jni::Object<jni::ObjectTag> getRasterFadeDuration(jni::JNIEnv&);
|
||||
jni::jobject* createJavaPeer(jni::JNIEnv&);
|
||||
|
||||
|
||||
@@ -37,7 +37,8 @@
|
||||
"paint_raster": {
|
||||
"raster-brightness-min": "minimum-raster-brightness",
|
||||
"raster-brightness-max": "maximum-raster-brightness",
|
||||
"raster-hue-rotate": "raster-hue-rotation"
|
||||
"raster-hue-rotate": "raster-hue-rotation",
|
||||
"raster-resampling": "raster-resampling-mode"
|
||||
},
|
||||
"paint_line": {
|
||||
"line-dasharray": "line-dash-pattern",
|
||||
|
||||
@@ -6,6 +6,27 @@
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
The resampling/interpolation method to use for overscaling, also known as
|
||||
texture magnification filter
|
||||
|
||||
Values of this type are used in the `MGLRasterStyleLayer.rasterResamplingMode`
|
||||
property.
|
||||
*/
|
||||
typedef NS_ENUM(NSUInteger, MGLRasterResamplingMode) {
|
||||
/**
|
||||
(Bi)linear filtering interpolates point values using the weighted average
|
||||
of the four closest original source points creating a smooth but blurry
|
||||
look when overscaled
|
||||
*/
|
||||
MGLRasterResamplingModeLinear,
|
||||
/**
|
||||
Nearest neighbor filtering interpolates point values using the nearest
|
||||
original source point creating a sharp but pointated look when overscaled
|
||||
*/
|
||||
MGLRasterResamplingModeNearest,
|
||||
};
|
||||
|
||||
/**
|
||||
An `MGLRasterStyleLayer` is a style layer that renders georeferenced raster
|
||||
imagery on the map, especially raster tiles.
|
||||
@@ -232,6 +253,40 @@ MGL_EXPORT
|
||||
*/
|
||||
@property (nonatomic) MGLTransition rasterOpacityTransition;
|
||||
|
||||
/**
|
||||
The resampling/interpolation method to use for overscaling, also known as
|
||||
texture magnification filter
|
||||
|
||||
The default value of this property is an expression that evaluates to `linear`.
|
||||
Set this property to `nil` to reset it to the default value.
|
||||
|
||||
This attribute corresponds to the <a
|
||||
href="https://www.mapbox.com/mapbox-gl-style-spec/#paint-raster-resampling"><code>raster-resampling</code></a>
|
||||
layout property in the Mapbox Style Specification.
|
||||
|
||||
You can set this property to an expression containing any of the following:
|
||||
|
||||
* Constant `MGLRasterResamplingMode` values
|
||||
* Any of the following constant string values:
|
||||
* `linear`: (Bi)linear filtering interpolates pixel values using the weighted
|
||||
average of the four closest original source pixels creating a smooth but blurry
|
||||
look when overscaled
|
||||
* `nearest`: Nearest neighbor filtering interpolates pixel values using the
|
||||
nearest original source pixel creating a sharp but pixelated look when
|
||||
overscaled
|
||||
* Predefined functions, including mathematical and string operators
|
||||
* Conditional expressions
|
||||
* Variable assignments and references to assigned variables
|
||||
* Step functions applied to the `$zoomLevel` variable
|
||||
|
||||
This property does not support applying interpolation functions to the
|
||||
`$zoomLevel` variable or applying interpolation or step functions to feature
|
||||
attributes.
|
||||
*/
|
||||
@property (nonatomic, null_resettable) NSExpression *rasterResamplingMode;
|
||||
|
||||
@property (nonatomic, null_resettable) NSExpression *rasterResampling __attribute__((unavailable("Use rasterResamplingMode instead.")));
|
||||
|
||||
/**
|
||||
Increase or reduce the saturation of the image.
|
||||
|
||||
@@ -260,4 +315,27 @@ MGL_EXPORT
|
||||
|
||||
@end
|
||||
|
||||
/**
|
||||
Methods for wrapping an enumeration value for a style layer attribute in an
|
||||
`MGLRasterStyleLayer` object and unwrapping its raw value.
|
||||
*/
|
||||
@interface NSValue (MGLRasterStyleLayerAdditions)
|
||||
|
||||
#pragma mark Working with Raster Style Layer Attribute Values
|
||||
|
||||
/**
|
||||
Creates a new value object containing the given `MGLRasterResamplingMode` enumeration.
|
||||
|
||||
@param rasterResamplingMode The value for the new object.
|
||||
@return A new value object that contains the enumeration value.
|
||||
*/
|
||||
+ (instancetype)valueWithMGLRasterResamplingMode:(MGLRasterResamplingMode)rasterResamplingMode;
|
||||
|
||||
/**
|
||||
The `MGLRasterResamplingMode` enumeration representation of the value.
|
||||
*/
|
||||
@property (readonly) MGLRasterResamplingMode MGLRasterResamplingModeValue;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
@@ -11,6 +11,15 @@
|
||||
#include <mbgl/style/transition_options.hpp>
|
||||
#include <mbgl/style/layers/raster_layer.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
MBGL_DEFINE_ENUM(MGLRasterResamplingMode, {
|
||||
{ MGLRasterResamplingModeLinear, "linear" },
|
||||
{ MGLRasterResamplingModeNearest, "nearest" },
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@interface MGLRasterStyleLayer ()
|
||||
|
||||
@property (nonatomic, readonly) mbgl::style::RasterLayer *rawLayer;
|
||||
@@ -252,6 +261,30 @@
|
||||
return transition;
|
||||
}
|
||||
|
||||
- (void)setRasterResamplingMode:(NSExpression *)rasterResamplingMode {
|
||||
MGLAssertStyleLayerIsValid();
|
||||
|
||||
auto mbglValue = MGLStyleValueTransformer<mbgl::style::RasterResamplingType, NSValue *, mbgl::style::RasterResamplingType, MGLRasterResamplingMode>().toPropertyValue<mbgl::style::PropertyValue<mbgl::style::RasterResamplingType>>(rasterResamplingMode);
|
||||
self.rawLayer->setRasterResampling(mbglValue);
|
||||
}
|
||||
|
||||
- (NSExpression *)rasterResamplingMode {
|
||||
MGLAssertStyleLayerIsValid();
|
||||
|
||||
auto propertyValue = self.rawLayer->getRasterResampling();
|
||||
if (propertyValue.isUndefined()) {
|
||||
propertyValue = self.rawLayer->getDefaultRasterResampling();
|
||||
}
|
||||
return MGLStyleValueTransformer<mbgl::style::RasterResamplingType, NSValue *, mbgl::style::RasterResamplingType, MGLRasterResamplingMode>().toExpression(propertyValue);
|
||||
}
|
||||
|
||||
- (void)setRasterResampling:(NSExpression *)rasterResampling {
|
||||
}
|
||||
|
||||
- (NSExpression *)rasterResampling {
|
||||
return self.rasterResamplingMode;
|
||||
}
|
||||
|
||||
- (void)setRasterSaturation:(NSExpression *)rasterSaturation {
|
||||
MGLAssertStyleLayerIsValid();
|
||||
|
||||
@@ -288,3 +321,17 @@
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation NSValue (MGLRasterStyleLayerAdditions)
|
||||
|
||||
+ (NSValue *)valueWithMGLRasterResamplingMode:(MGLRasterResamplingMode)rasterResamplingMode {
|
||||
return [NSValue value:&rasterResamplingMode withObjCType:@encode(MGLRasterResamplingMode)];
|
||||
}
|
||||
|
||||
- (MGLRasterResamplingMode)MGLRasterResamplingModeValue {
|
||||
MGLRasterResamplingMode rasterResamplingMode;
|
||||
[self getValue:&rasterResamplingMode];
|
||||
return rasterResamplingMode;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -306,6 +306,49 @@
|
||||
XCTAssertEqual(rasterOpacityTransition.duration, transitionTest.duration);
|
||||
}
|
||||
|
||||
// raster-resampling
|
||||
{
|
||||
XCTAssertTrue(rawLayer->getRasterResampling().isUndefined(),
|
||||
@"raster-resampling should be unset initially.");
|
||||
NSExpression *defaultExpression = layer.rasterResamplingMode;
|
||||
|
||||
NSExpression *constantExpression = [NSExpression expressionWithFormat:@"'nearest'"];
|
||||
layer.rasterResamplingMode = constantExpression;
|
||||
mbgl::style::PropertyValue<mbgl::style::RasterResamplingType> propertyValue = { mbgl::style::RasterResamplingType::Nearest };
|
||||
XCTAssertEqual(rawLayer->getRasterResampling(), propertyValue,
|
||||
@"Setting rasterResamplingMode to a constant value expression should update raster-resampling.");
|
||||
XCTAssertEqualObjects(layer.rasterResamplingMode, constantExpression,
|
||||
@"rasterResamplingMode should round-trip constant value expressions.");
|
||||
|
||||
constantExpression = [NSExpression expressionWithFormat:@"'nearest'"];
|
||||
NSExpression *functionExpression = [NSExpression expressionWithFormat:@"mgl_step:from:stops:($zoomLevel, %@, %@)", constantExpression, @{@18: constantExpression}];
|
||||
layer.rasterResamplingMode = functionExpression;
|
||||
|
||||
mbgl::style::IntervalStops<mbgl::style::RasterResamplingType> intervalStops = {{
|
||||
{ -INFINITY, mbgl::style::RasterResamplingType::Nearest },
|
||||
{ 18, mbgl::style::RasterResamplingType::Nearest },
|
||||
}};
|
||||
propertyValue = mbgl::style::CameraFunction<mbgl::style::RasterResamplingType> { intervalStops };
|
||||
|
||||
XCTAssertEqual(rawLayer->getRasterResampling(), propertyValue,
|
||||
@"Setting rasterResamplingMode to a camera expression should update raster-resampling.");
|
||||
XCTAssertEqualObjects(layer.rasterResamplingMode, functionExpression,
|
||||
@"rasterResamplingMode should round-trip camera expressions.");
|
||||
|
||||
|
||||
layer.rasterResamplingMode = nil;
|
||||
XCTAssertTrue(rawLayer->getRasterResampling().isUndefined(),
|
||||
@"Unsetting rasterResamplingMode should return raster-resampling to the default value.");
|
||||
XCTAssertEqualObjects(layer.rasterResamplingMode, defaultExpression,
|
||||
@"rasterResamplingMode should return the default value after being unset.");
|
||||
|
||||
functionExpression = [NSExpression expressionForKeyPath:@"bogus"];
|
||||
XCTAssertThrowsSpecificNamed(layer.rasterResamplingMode = functionExpression, NSException, NSInvalidArgumentException, @"MGLRasterLayer should raise an exception if a camera-data expression is applied to a property that does not support key paths to feature attributes.");
|
||||
functionExpression = [NSExpression expressionWithFormat:@"mgl_step:from:stops:(bogus, %@, %@)", constantExpression, @{@18: constantExpression}];
|
||||
functionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: functionExpression}];
|
||||
XCTAssertThrowsSpecificNamed(layer.rasterResamplingMode = functionExpression, NSException, NSInvalidArgumentException, @"MGLRasterLayer should raise an exception if a camera-data expression is applied to a property that does not support key paths to feature attributes.");
|
||||
}
|
||||
|
||||
// raster-saturation
|
||||
{
|
||||
XCTAssertTrue(rawLayer->getRasterSaturation().isUndefined(),
|
||||
@@ -366,7 +409,13 @@
|
||||
[self testPropertyName:@"raster-fade-duration" isBoolean:NO];
|
||||
[self testPropertyName:@"raster-hue-rotation" isBoolean:NO];
|
||||
[self testPropertyName:@"raster-opacity" isBoolean:NO];
|
||||
[self testPropertyName:@"raster-resampling-mode" isBoolean:NO];
|
||||
[self testPropertyName:@"raster-saturation" isBoolean:NO];
|
||||
}
|
||||
|
||||
- (void)testValueAdditions {
|
||||
XCTAssertEqual([NSValue valueWithMGLRasterResamplingMode:MGLRasterResamplingModeLinear].MGLRasterResamplingModeValue, MGLRasterResamplingModeLinear);
|
||||
XCTAssertEqual([NSValue valueWithMGLRasterResamplingMode:MGLRasterResamplingModeNearest].MGLRasterResamplingModeValue, MGLRasterResamplingModeNearest);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -243,6 +243,7 @@ In style JSON | In Objective-C | In Swift
|
||||
`raster-brightness-max` | `MGLRasterStyleLayer.maximumRasterBrightness` | `MGLRasterStyleLayer.maximumRasterBrightness`
|
||||
`raster-brightness-min` | `MGLRasterStyleLayer.minimumRasterBrightness` | `MGLRasterStyleLayer.minimumRasterBrightness`
|
||||
`raster-hue-rotate` | `MGLRasterStyleLayer.rasterHueRotation` | `MGLRasterStyleLayer.rasterHueRotation`
|
||||
`raster-resampling` | `MGLRasterStyleLayer.rasterResamplingMode` | `MGLRasterStyleLayer.rasterResamplingMode`
|
||||
|
||||
### Symbol style layers
|
||||
|
||||
|
||||
@@ -230,6 +230,7 @@ In style JSON | In Objective-C | In Swift
|
||||
`raster-brightness-max` | `MGLRasterStyleLayer.maximumRasterBrightness` | `MGLRasterStyleLayer.maximumRasterBrightness`
|
||||
`raster-brightness-min` | `MGLRasterStyleLayer.minimumRasterBrightness` | `MGLRasterStyleLayer.minimumRasterBrightness`
|
||||
`raster-hue-rotate` | `MGLRasterStyleLayer.rasterHueRotation` | `MGLRasterStyleLayer.rasterHueRotation`
|
||||
`raster-resampling` | `MGLRasterStyleLayer.rasterResamplingMode` | `MGLRasterStyleLayer.rasterResamplingMode`
|
||||
|
||||
### Symbol style layers
|
||||
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
"query-tests/feature-state/default": "skip - port https://github.com/mapbox/mapbox-gl-js/pull/6263 - needs issue",
|
||||
"query-tests/regressions/mapbox-gl-js#6555": "skip - no querySourceFeatures in mbgl-node; needs issue",
|
||||
"render-tests/background-color/transition": "https://github.com/mapbox/mapbox-gl-native/issues/10619",
|
||||
"render-tests/collator/resolved-locale": "Some test platforms don't resolve 'en' locale",
|
||||
"render-tests/collator/default": "Some test platforms don't resolve 'en' locale",
|
||||
"render-tests/debug/collision": "https://github.com/mapbox/mapbox-gl-native/issues/3841",
|
||||
"render-tests/debug/collision-lines": "https://github.com/mapbox/mapbox-gl-native/issues/10412",
|
||||
"render-tests/debug/collision-lines-overscaled": "https://github.com/mapbox/mapbox-gl-native/issues/10412",
|
||||
@@ -47,6 +49,7 @@
|
||||
"render-tests/geojson/inline-linestring-fill": "current behavior is arbitrary",
|
||||
"render-tests/geojson/inline-polygon-symbol": "behavior needs reconciliation with gl-js",
|
||||
"render-tests/icon-rotate/with-offset": "https://github.com/mapbox/mapbox-gl-native/issues/11872",
|
||||
"render-tests/icon-no-cross-source-collision/default": "skip - gl-js only",
|
||||
"render-tests/line-gradient/gradient": "https://github.com/mapbox/mapbox-gl-native/issues/11718",
|
||||
"render-tests/line-gradient/translucent": "https://github.com/mapbox/mapbox-gl-native/issues/11718",
|
||||
"render-tests/mixed-zoom/z10-z11": "https://github.com/mapbox/mapbox-gl-native/issues/10397",
|
||||
@@ -71,6 +74,7 @@
|
||||
"render-tests/runtime-styling/set-style-paint-property-fill-flat-to-extrude": "https://github.com/mapbox/mapbox-gl-native/issues/6745",
|
||||
"render-tests/symbol-placement/line-overscaled": "https://github.com/mapbox/mapbox-gl-js/issues/5654",
|
||||
"render-tests/symbol-visibility/visible": "https://github.com/mapbox/mapbox-gl-native/issues/10409",
|
||||
"render-tests/text-no-cross-source-collision/default": "skip - gl-js only",
|
||||
"render-tests/text-pitch-alignment/auto-text-rotation-alignment-map": "https://github.com/mapbox/mapbox-gl-native/issues/9732",
|
||||
"render-tests/text-pitch-alignment/map-text-rotation-alignment-map": "https://github.com/mapbox/mapbox-gl-native/issues/9732",
|
||||
"render-tests/text-pitch-alignment/viewport-text-rotation-alignment-map": "https://github.com/mapbox/mapbox-gl-native/issues/9732",
|
||||
|
||||
@@ -123,13 +123,15 @@ void RenderRasterLayer::render(PaintParameters& parameters, RenderSource* source
|
||||
);
|
||||
};
|
||||
|
||||
const gl::TextureFilter filter = evaluated.get<RasterResampling>() == RasterResamplingType::Nearest ? gl::TextureFilter::Nearest : gl::TextureFilter::Linear;
|
||||
|
||||
if (RenderImageSource* imageSource = source->as<RenderImageSource>()) {
|
||||
if (imageSource->isEnabled() && imageSource->isLoaded() && !imageSource->bucket->needsUpload()) {
|
||||
RasterBucket& bucket = *imageSource->bucket;
|
||||
|
||||
assert(bucket.texture);
|
||||
parameters.context.bindTexture(*bucket.texture, 0, gl::TextureFilter::Linear);
|
||||
parameters.context.bindTexture(*bucket.texture, 1, gl::TextureFilter::Linear);
|
||||
parameters.context.bindTexture(*bucket.texture, 0, filter);
|
||||
parameters.context.bindTexture(*bucket.texture, 1, filter);
|
||||
|
||||
for (auto matrix_ : imageSource->matrices) {
|
||||
draw(matrix_,
|
||||
@@ -147,8 +149,8 @@ void RenderRasterLayer::render(PaintParameters& parameters, RenderSource* source
|
||||
continue;
|
||||
|
||||
assert(bucket.texture);
|
||||
parameters.context.bindTexture(*bucket.texture, 0, gl::TextureFilter::Linear);
|
||||
parameters.context.bindTexture(*bucket.texture, 1, gl::TextureFilter::Linear);
|
||||
parameters.context.bindTexture(*bucket.texture, 0, filter);
|
||||
parameters.context.bindTexture(*bucket.texture, 1, filter);
|
||||
|
||||
if (bucket.vertexBuffer && bucket.indexBuffer && !bucket.segments.empty()) {
|
||||
// Draw only the parts of the tile that aren't drawn by another tile in the layer.
|
||||
|
||||
@@ -206,6 +206,8 @@ inline auto makePaintPropertySetters() {
|
||||
result["raster-saturation-transition"] = &setTransition<RasterLayer, &RasterLayer::setRasterSaturationTransition>;
|
||||
result["raster-contrast"] = &setProperty<RasterLayer, PropertyValue<float>, &RasterLayer::setRasterContrast>;
|
||||
result["raster-contrast-transition"] = &setTransition<RasterLayer, &RasterLayer::setRasterContrastTransition>;
|
||||
result["raster-resampling"] = &setProperty<RasterLayer, PropertyValue<RasterResamplingType>, &RasterLayer::setRasterResampling>;
|
||||
result["raster-resampling-transition"] = &setTransition<RasterLayer, &RasterLayer::setRasterResamplingTransition>;
|
||||
result["raster-fade-duration"] = &setProperty<RasterLayer, PropertyValue<float>, &RasterLayer::setRasterFadeDuration>;
|
||||
result["raster-fade-duration-transition"] = &setTransition<RasterLayer, &RasterLayer::setRasterFadeDurationTransition>;
|
||||
|
||||
|
||||
@@ -337,6 +337,10 @@ template type::Type valueTypeToExpressionType<TranslateAnchorType>();
|
||||
template optional<TranslateAnchorType> fromExpressionValue<TranslateAnchorType>(const Value&);
|
||||
template Value toExpressionValue(const TranslateAnchorType&);
|
||||
|
||||
template type::Type valueTypeToExpressionType<RasterResamplingType>();
|
||||
template optional<RasterResamplingType> fromExpressionValue<RasterResamplingType>(const Value&);
|
||||
template Value toExpressionValue(const RasterResamplingType&);
|
||||
|
||||
template type::Type valueTypeToExpressionType<HillshadeIlluminationAnchorType>();
|
||||
template optional<HillshadeIlluminationAnchorType> fromExpressionValue<HillshadeIlluminationAnchorType>(const Value&);
|
||||
template Value toExpressionValue(const HillshadeIlluminationAnchorType&);
|
||||
|
||||
@@ -236,6 +236,33 @@ TransitionOptions RasterLayer::getRasterContrastTransition() const {
|
||||
return impl().paint.template get<RasterContrast>().options;
|
||||
}
|
||||
|
||||
PropertyValue<RasterResamplingType> RasterLayer::getDefaultRasterResampling() {
|
||||
return { RasterResamplingType::Linear };
|
||||
}
|
||||
|
||||
PropertyValue<RasterResamplingType> RasterLayer::getRasterResampling() const {
|
||||
return impl().paint.template get<RasterResampling>().value;
|
||||
}
|
||||
|
||||
void RasterLayer::setRasterResampling(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 };
|
||||
}
|
||||
|
||||
@@ -36,6 +36,10 @@ 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; }
|
||||
};
|
||||
@@ -47,6 +51,7 @@ class RasterPaintProperties : public Properties<
|
||||
RasterBrightnessMax,
|
||||
RasterSaturation,
|
||||
RasterContrast,
|
||||
RasterResampling,
|
||||
RasterFadeDuration
|
||||
> {};
|
||||
|
||||
|
||||
@@ -25,6 +25,11 @@ MBGL_DEFINE_ENUM(TranslateAnchorType, {
|
||||
{ TranslateAnchorType::Viewport, "viewport" },
|
||||
});
|
||||
|
||||
MBGL_DEFINE_ENUM(RasterResamplingType, {
|
||||
{ RasterResamplingType::Linear, "linear" },
|
||||
{ RasterResamplingType::Nearest, "nearest" },
|
||||
});
|
||||
|
||||
MBGL_DEFINE_ENUM(HillshadeIlluminationAnchorType, {
|
||||
{ HillshadeIlluminationAnchorType::Map, "map" },
|
||||
{ HillshadeIlluminationAnchorType::Viewport, "viewport" },
|
||||
|
||||
Reference in New Issue
Block a user