summaryrefslogtreecommitdiff
path: root/platform/darwin/src/MGLRasterStyleLayer.mm
diff options
context:
space:
mode:
authorMolly Lloyd <mollymerp@users.noreply.github.com>2018-06-21 14:37:17 -0700
committerGitHub <noreply@github.com>2018-06-21 14:37:17 -0700
commite1af62e87dfd77d1c38802f082c4981dab1beeab (patch)
tree8371dccdcf8545fd50b2edddbdd3a622bb00b27a /platform/darwin/src/MGLRasterStyleLayer.mm
parenteb70b8984901d8113f3a29d26cc355d5b3ed46fd (diff)
downloadqtlocation-mapboxgl-e1af62e87dfd77d1c38802f082c4981dab1beeab.tar.gz
[core] add raster-resampling property (#12176)upstream/rclee
* update style-code for raster-resampling * implement user-defined raster-resampling * invert filter condition * raster-resampling -> raster-resampling-mode for darwin language conventions
Diffstat (limited to 'platform/darwin/src/MGLRasterStyleLayer.mm')
-rw-r--r--platform/darwin/src/MGLRasterStyleLayer.mm47
1 files changed, 47 insertions, 0 deletions
diff --git a/platform/darwin/src/MGLRasterStyleLayer.mm b/platform/darwin/src/MGLRasterStyleLayer.mm
index 0e31512491..96ed5ab513 100644
--- a/platform/darwin/src/MGLRasterStyleLayer.mm
+++ b/platform/darwin/src/MGLRasterStyleLayer.mm
@@ -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