summaryrefslogtreecommitdiff
path: root/platform/darwin/src/MGLRasterStyleLayer.mm
diff options
context:
space:
mode:
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