From 76e9a5c525bcbbf05efdb2f0dc3be46ea52da4b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikl=C3=B3s=20Fazekas?= Date: Wed, 29 Nov 2023 21:21:28 +0100 Subject: [PATCH] feat: add model-layer on android --- .../java/com/rnmapbox/rnmbx/RNMBXPackage.kt | 4 + .../components/styles/RNMBXStyleFactory.kt | 1223 +++++++++++++++-- .../styles/layers/RNMBXModelLayer.kt | 33 + .../styles/layers/RNMBXModelLayerManager.kt | 85 ++ .../components/styles/model/RNMBXModels.kt | 33 + .../styles/model/RNMBXModelsManager.kt | 59 + .../rnmapbox/rnmbx/v11compat/StyleFactory.kt | 395 ++++++ .../rnmapbox/rnmbx/v11compat/StyleFactory.kt | 8 + .../FillRasterLayer/QuerySourceFeatures.tsx | 2 +- example/src/scenes/GroupAndItem.tsx | 1 - .../autogenHelpers/generateCodeWithEjs.mjs | 2 +- scripts/templates/RNMBXStyleFactoryv10.kt.ejs | 2 + src/components/AbstractLayer.tsx | 10 +- src/specs/RNMBXCircleLayerNativeComponent.ts | 27 +- src/specs/RNMBXFillLayerNativeComponent.ts | 27 +- src/specs/RNMBXHeatmapLayerNativeComponent.ts | 27 +- src/specs/RNMBXLineLayerNativeComponent.ts | 27 +- src/specs/RNMBXModelLayerNativeComponent.ts | 32 +- src/specs/RNMBXRasterLayerNativeComponent.ts | 27 +- src/specs/RNMBXSymbolLayerNativeComponent.ts | 27 +- ...mmonLayerNativeComponentsProps.codepart-ts | 21 +- 21 files changed, 1864 insertions(+), 208 deletions(-) create mode 100644 android/src/main/java/com/rnmapbox/rnmbx/components/styles/layers/RNMBXModelLayer.kt create mode 100644 android/src/main/java/com/rnmapbox/rnmbx/components/styles/layers/RNMBXModelLayerManager.kt create mode 100644 android/src/main/java/com/rnmapbox/rnmbx/components/styles/model/RNMBXModels.kt create mode 100644 android/src/main/java/com/rnmapbox/rnmbx/components/styles/model/RNMBXModelsManager.kt create mode 100644 android/src/main/mapbox-v11-compat/v10/com/rnmapbox/rnmbx/v11compat/StyleFactory.kt create mode 100644 android/src/main/mapbox-v11-compat/v11/com/rnmapbox/rnmbx/v11compat/StyleFactory.kt diff --git a/android/src/main/java/com/rnmapbox/rnmbx/RNMBXPackage.kt b/android/src/main/java/com/rnmapbox/rnmbx/RNMBXPackage.kt index 8715e7e7a1..32399249ca 100644 --- a/android/src/main/java/com/rnmapbox/rnmbx/RNMBXPackage.kt +++ b/android/src/main/java/com/rnmapbox/rnmbx/RNMBXPackage.kt @@ -30,10 +30,12 @@ import com.rnmapbox.rnmbx.components.styles.layers.RNMBXFillExtrusionLayerManage import com.rnmapbox.rnmbx.components.styles.layers.RNMBXFillLayerManager import com.rnmapbox.rnmbx.components.styles.layers.RNMBXHeatmapLayerManager import com.rnmapbox.rnmbx.components.styles.layers.RNMBXLineLayerManager +import com.rnmapbox.rnmbx.components.styles.layers.RNMBXModelLayerManager import com.rnmapbox.rnmbx.components.styles.layers.RNMBXRasterLayerManager import com.rnmapbox.rnmbx.components.styles.layers.RNMBXSkyLayerManager import com.rnmapbox.rnmbx.components.styles.layers.RNMBXSymbolLayerManager import com.rnmapbox.rnmbx.components.styles.light.RNMBXLightManager +import com.rnmapbox.rnmbx.components.styles.model.RNMBXModelsManager import com.rnmapbox.rnmbx.components.styles.sources.RNMBXImageSourceManager import com.rnmapbox.rnmbx.components.styles.sources.RNMBXRasterDemSourceManager import com.rnmapbox.rnmbx.components.styles.sources.RNMBXRasterSourceManager @@ -111,6 +113,7 @@ class RNMBXPackage : TurboReactPackage() { managers.add(RNMBXViewportManager(reactApplicationContext)) managers.add(RNMBXMapViewManager(reactApplicationContext, getViewTagResolver(reactApplicationContext, "RNMBXMapViewManager"))) managers.add(RNMBXStyleImportManager(reactApplicationContext)) + managers.add(RNMBXModelsManager(reactApplicationContext)) // annotations managers.add(RNMBXMarkerViewManager(reactApplicationContext)) @@ -146,6 +149,7 @@ class RNMBXPackage : TurboReactPackage() { managers.add(RNMBXAtmosphereManager()) managers.add(RNMBXBackgroundLayerManager()) managers.add(RNMBXLightManager()) + managers.add(RNMBXModelLayerManager()) return managers } diff --git a/android/src/main/java/com/rnmapbox/rnmbx/components/styles/RNMBXStyleFactory.kt b/android/src/main/java/com/rnmapbox/rnmbx/components/styles/RNMBXStyleFactory.kt index fbd3688e5f..14705bd506 100644 --- a/android/src/main/java/com/rnmapbox/rnmbx/components/styles/RNMBXStyleFactory.kt +++ b/android/src/main/java/com/rnmapbox/rnmbx/components/styles/RNMBXStyleFactory.kt @@ -17,6 +17,7 @@ import com.mapbox.maps.extension.style.layers.generated.HeatmapLayer import com.mapbox.maps.extension.style.layers.generated.HillshadeLayer import com.mapbox.maps.extension.style.atmosphere.generated.Atmosphere import com.mapbox.maps.extension.style.terrain.generated.Terrain +import com.mapbox.maps.extension.style.layers.generated.ModelLayer // import com.mapbox.maps.extension.style.layers.properties.generated.Visibility import com.mapbox.maps.extension.style.layers.properties.generated.* import com.mapbox.maps.extension.style.types.StyleTransition @@ -26,6 +27,7 @@ import com.rnmapbox.rnmbx.utils.DownloadMapImageTask.OnAllImagesLoaded import com.rnmapbox.rnmbx.utils.Logger.e import com.rnmapbox.rnmbx.v11compat.light.*; +import com.rnmapbox.rnmbx.v11compat.stylefactory.*; import java.util.List; @@ -78,6 +80,10 @@ object RNMBXStyleFactory { } } }) + "fillEmissiveStrength" -> + setFillEmissiveStrength(layer, styleValue) + "fillEmissiveStrengthTransition" -> + setFillEmissiveStrengthTransition(layer, styleValue) } } } @@ -150,6 +156,10 @@ object RNMBXStyleFactory { setLineGradient(layer, styleValue) "lineTrimOffset" -> setLineTrimOffset(layer, styleValue) + "lineEmissiveStrength" -> + setLineEmissiveStrength(layer, styleValue) + "lineEmissiveStrengthTransition" -> + setLineEmissiveStrengthTransition(layer, styleValue) } } } @@ -308,6 +318,28 @@ object RNMBXStyleFactory { setTextTranslateTransition(layer, styleValue) "textTranslateAnchor" -> setTextTranslateAnchor(layer, styleValue) + "symbolZElevate" -> + setSymbolZElevate(layer, styleValue) + "iconEmissiveStrength" -> + setIconEmissiveStrength(layer, styleValue) + "iconEmissiveStrengthTransition" -> + setIconEmissiveStrengthTransition(layer, styleValue) + "textEmissiveStrength" -> + setTextEmissiveStrength(layer, styleValue) + "textEmissiveStrengthTransition" -> + setTextEmissiveStrengthTransition(layer, styleValue) + "iconImageCrossFade" -> + style.addImage(styleValue!!, styleKey, object : OnAllImagesLoaded { + override fun onAllImagesLoaded() { + try { + setIconImageCrossFade(layer, styleValue) + } catch (exception: RuntimeException) { + e("RNMBXSymbol",String.format("Exception failed during setIconImageCrossFade: %s", exception.message)) + } + } + }) + "iconImageCrossFadeTransition" -> + setIconImageCrossFadeTransition(layer, styleValue) } } } @@ -364,6 +396,10 @@ object RNMBXStyleFactory { setCircleStrokeOpacity(layer, styleValue) "circleStrokeOpacityTransition" -> setCircleStrokeOpacityTransition(layer, styleValue) + "circleEmissiveStrength" -> + setCircleEmissiveStrength(layer, styleValue) + "circleEmissiveStrengthTransition" -> + setCircleEmissiveStrengthTransition(layer, styleValue) } } } @@ -448,6 +484,44 @@ object RNMBXStyleFactory { setFillExtrusionVerticalGradient(layer, styleValue) "fillExtrusionRoundedRoof" -> setFillExtrusionRoundedRoof(layer, styleValue) + "fillExtrusionAmbientOcclusionWallRadius" -> + setFillExtrusionAmbientOcclusionWallRadius(layer, styleValue) + "fillExtrusionAmbientOcclusionWallRadiusTransition" -> + setFillExtrusionAmbientOcclusionWallRadiusTransition(layer, styleValue) + "fillExtrusionAmbientOcclusionGroundRadius" -> + setFillExtrusionAmbientOcclusionGroundRadius(layer, styleValue) + "fillExtrusionAmbientOcclusionGroundRadiusTransition" -> + setFillExtrusionAmbientOcclusionGroundRadiusTransition(layer, styleValue) + "fillExtrusionAmbientOcclusionGroundAttenuation" -> + setFillExtrusionAmbientOcclusionGroundAttenuation(layer, styleValue) + "fillExtrusionAmbientOcclusionGroundAttenuationTransition" -> + setFillExtrusionAmbientOcclusionGroundAttenuationTransition(layer, styleValue) + "fillExtrusionFloodLightColor" -> + setFillExtrusionFloodLightColor(layer, styleValue) + "fillExtrusionFloodLightColorTransition" -> + setFillExtrusionFloodLightColorTransition(layer, styleValue) + "fillExtrusionFloodLightIntensity" -> + setFillExtrusionFloodLightIntensity(layer, styleValue) + "fillExtrusionFloodLightIntensityTransition" -> + setFillExtrusionFloodLightIntensityTransition(layer, styleValue) + "fillExtrusionFloodLightWallRadius" -> + setFillExtrusionFloodLightWallRadius(layer, styleValue) + "fillExtrusionFloodLightWallRadiusTransition" -> + setFillExtrusionFloodLightWallRadiusTransition(layer, styleValue) + "fillExtrusionFloodLightGroundRadius" -> + setFillExtrusionFloodLightGroundRadius(layer, styleValue) + "fillExtrusionFloodLightGroundRadiusTransition" -> + setFillExtrusionFloodLightGroundRadiusTransition(layer, styleValue) + "fillExtrusionFloodLightGroundAttenuation" -> + setFillExtrusionFloodLightGroundAttenuation(layer, styleValue) + "fillExtrusionFloodLightGroundAttenuationTransition" -> + setFillExtrusionFloodLightGroundAttenuationTransition(layer, styleValue) + "fillExtrusionVerticalScale" -> + setFillExtrusionVerticalScale(layer, styleValue) + "fillExtrusionVerticalScaleTransition" -> + setFillExtrusionVerticalScaleTransition(layer, styleValue) + "fillExtrusionCutoffFadeRange" -> + setFillExtrusionCutoffFadeRange(layer, styleValue) } } } @@ -492,6 +566,16 @@ object RNMBXStyleFactory { setRasterResampling(layer, styleValue) "rasterFadeDuration" -> setRasterFadeDuration(layer, styleValue) + "rasterColor" -> + setRasterColor(layer, styleValue) + "rasterColorMix" -> + setRasterColorMix(layer, styleValue) + "rasterColorMixTransition" -> + setRasterColorMixTransition(layer, styleValue) + "rasterColorRange" -> + setRasterColorRange(layer, styleValue) + "rasterColorRangeTransition" -> + setRasterColorRangeTransition(layer, styleValue) } } } @@ -542,6 +626,58 @@ object RNMBXStyleFactory { val styleValue = style.getStyleValueForKey(styleKey) when (styleKey) { + "visibility" -> + setVisibility(layer, styleValue) + "modelId" -> + setModelId(layer, styleValue) + "modelOpacity" -> + setModelOpacity(layer, styleValue) + "modelOpacityTransition" -> + setModelOpacityTransition(layer, styleValue) + "modelRotation" -> + setModelRotation(layer, styleValue) + "modelRotationTransition" -> + setModelRotationTransition(layer, styleValue) + "modelScale" -> + setModelScale(layer, styleValue) + "modelScaleTransition" -> + setModelScaleTransition(layer, styleValue) + "modelTranslation" -> + setModelTranslation(layer, styleValue) + "modelTranslationTransition" -> + setModelTranslationTransition(layer, styleValue) + "modelColor" -> + setModelColor(layer, styleValue) + "modelColorTransition" -> + setModelColorTransition(layer, styleValue) + "modelColorMixIntensity" -> + setModelColorMixIntensity(layer, styleValue) + "modelColorMixIntensityTransition" -> + setModelColorMixIntensityTransition(layer, styleValue) + "modelType" -> + setModelType(layer, styleValue) + "modelCastShadows" -> + setModelCastShadows(layer, styleValue) + "modelReceiveShadows" -> + setModelReceiveShadows(layer, styleValue) + "modelAmbientOcclusionIntensity" -> + setModelAmbientOcclusionIntensity(layer, styleValue) + "modelAmbientOcclusionIntensityTransition" -> + setModelAmbientOcclusionIntensityTransition(layer, styleValue) + "modelEmissiveStrength" -> + setModelEmissiveStrength(layer, styleValue) + "modelEmissiveStrengthTransition" -> + setModelEmissiveStrengthTransition(layer, styleValue) + "modelRoughness" -> + setModelRoughness(layer, styleValue) + "modelRoughnessTransition" -> + setModelRoughnessTransition(layer, styleValue) + "modelHeightBasedEmissiveStrengthMultiplier" -> + setModelHeightBasedEmissiveStrengthMultiplier(layer, styleValue) + "modelHeightBasedEmissiveStrengthMultiplierTransition" -> + setModelHeightBasedEmissiveStrengthMultiplierTransition(layer, styleValue) + "modelCutoffFadeRange" -> + setModelCutoffFadeRange(layer, styleValue) } } } @@ -576,6 +712,10 @@ object RNMBXStyleFactory { setBackgroundOpacity(layer, styleValue) "backgroundOpacityTransition" -> setBackgroundOpacityTransition(layer, styleValue) + "backgroundEmissiveStrength" -> + setBackgroundEmissiveStrength(layer, styleValue) + "backgroundEmissiveStrengthTransition" -> + setBackgroundEmissiveStrengthTransition(layer, styleValue) } } } @@ -886,6 +1026,32 @@ object RNMBXStyleFactory { } } + fun setFillEmissiveStrength(layer: FillLayer, styleValue: RNMBXStyleValue ) { + if (styleValue.isExpression()) { + val expression = styleValue.getExpression() + if (expression != null) { + layer.fillEmissiveStrength(expression) + } else { + e("RNMBXFill", "Expression for fillEmissiveStrength is null") + } + } else { + val value = styleValue.getDouble(VALUE_KEY) + if (value != null) { + layer.fillEmissiveStrength(value) + } else { + e("RNMBXFill", "value for fillEmissiveStrength is null") + } + } + } + + + fun setFillEmissiveStrengthTransition(layer: FillLayer, styleValue: RNMBXStyleValue) { + val transition = styleValue.transition + if (transition != null) { + layer.fillEmissiveStrengthTransition(transition); + } + } + fun setLineCap(layer: LineLayer, styleValue: RNMBXStyleValue ) { if (styleValue.isExpression()) { val expression = styleValue.getExpression() @@ -1241,6 +1407,32 @@ object RNMBXStyleFactory { } } + fun setLineEmissiveStrength(layer: LineLayer, styleValue: RNMBXStyleValue ) { + if (styleValue.isExpression()) { + val expression = styleValue.getExpression() + if (expression != null) { + layer.lineEmissiveStrength(expression) + } else { + e("RNMBXLine", "Expression for lineEmissiveStrength is null") + } + } else { + val value = styleValue.getDouble(VALUE_KEY) + if (value != null) { + layer.lineEmissiveStrength(value) + } else { + e("RNMBXLine", "value for lineEmissiveStrength is null") + } + } + } + + + fun setLineEmissiveStrengthTransition(layer: LineLayer, styleValue: RNMBXStyleValue) { + val transition = styleValue.transition + if (transition != null) { + layer.lineEmissiveStrengthTransition(transition); + } + } + fun setSymbolPlacement(layer: SymbolLayer, styleValue: RNMBXStyleValue ) { if (styleValue.isExpression()) { val expression = styleValue.getExpression() @@ -2275,6 +2467,102 @@ object RNMBXStyleFactory { } } + fun setSymbolZElevate(layer: SymbolLayer, styleValue: RNMBXStyleValue ) { + if (styleValue.isExpression()) { + val expression = styleValue.getExpression() + if (expression != null) { + layer.symbolZElevate(expression) + } else { + e("RNMBXSymbol", "Expression for symbolZElevate is null") + } + } else { + val value = styleValue.getBoolean(VALUE_KEY) + if (value != null) { + layer.symbolZElevate(value) + } else { + e("RNMBXSymbol", "value for symbolZElevate is null") + } + } + } + + fun setIconEmissiveStrength(layer: SymbolLayer, styleValue: RNMBXStyleValue ) { + if (styleValue.isExpression()) { + val expression = styleValue.getExpression() + if (expression != null) { + layer.iconEmissiveStrength(expression) + } else { + e("RNMBXSymbol", "Expression for iconEmissiveStrength is null") + } + } else { + val value = styleValue.getDouble(VALUE_KEY) + if (value != null) { + layer.iconEmissiveStrength(value) + } else { + e("RNMBXSymbol", "value for iconEmissiveStrength is null") + } + } + } + + + fun setIconEmissiveStrengthTransition(layer: SymbolLayer, styleValue: RNMBXStyleValue) { + val transition = styleValue.transition + if (transition != null) { + layer.iconEmissiveStrengthTransition(transition); + } + } + + fun setTextEmissiveStrength(layer: SymbolLayer, styleValue: RNMBXStyleValue ) { + if (styleValue.isExpression()) { + val expression = styleValue.getExpression() + if (expression != null) { + layer.textEmissiveStrength(expression) + } else { + e("RNMBXSymbol", "Expression for textEmissiveStrength is null") + } + } else { + val value = styleValue.getDouble(VALUE_KEY) + if (value != null) { + layer.textEmissiveStrength(value) + } else { + e("RNMBXSymbol", "value for textEmissiveStrength is null") + } + } + } + + + fun setTextEmissiveStrengthTransition(layer: SymbolLayer, styleValue: RNMBXStyleValue) { + val transition = styleValue.transition + if (transition != null) { + layer.textEmissiveStrengthTransition(transition); + } + } + + fun setIconImageCrossFade(layer: SymbolLayer, styleValue: RNMBXStyleValue ) { + if (styleValue.isExpression()) { + val expression = styleValue.getExpression() + if (expression != null) { + layer.iconImageCrossFade(expression) + } else { + e("RNMBXSymbol", "Expression for iconImageCrossFade is null") + } + } else { + val value = styleValue.getDouble(VALUE_KEY) + if (value != null) { + layer.iconImageCrossFade(value) + } else { + e("RNMBXSymbol", "value for iconImageCrossFade is null") + } + } + } + + + fun setIconImageCrossFadeTransition(layer: SymbolLayer, styleValue: RNMBXStyleValue) { + val transition = styleValue.transition + if (transition != null) { + layer.iconImageCrossFadeTransition(transition); + } + } + fun setCircleSortKey(layer: CircleLayer, styleValue: RNMBXStyleValue ) { if (styleValue.isExpression()) { val expression = styleValue.getExpression() @@ -2544,6 +2832,32 @@ object RNMBXStyleFactory { } } + fun setCircleEmissiveStrength(layer: CircleLayer, styleValue: RNMBXStyleValue ) { + if (styleValue.isExpression()) { + val expression = styleValue.getExpression() + if (expression != null) { + layer.circleEmissiveStrength(expression) + } else { + e("RNMBXCircle", "Expression for circleEmissiveStrength is null") + } + } else { + val value = styleValue.getDouble(VALUE_KEY) + if (value != null) { + layer.circleEmissiveStrength(value) + } else { + e("RNMBXCircle", "value for circleEmissiveStrength is null") + } + } + } + + + fun setCircleEmissiveStrengthTransition(layer: CircleLayer, styleValue: RNMBXStyleValue) { + val transition = styleValue.transition + if (transition != null) { + layer.circleEmissiveStrengthTransition(transition); + } + } + fun setVisibility(layer: HeatmapLayer, styleValue: RNMBXStyleValue ) { layer.visibility(Visibility.valueOf(styleValue.getEnumName())); } @@ -2867,281 +3181,603 @@ object RNMBXStyleFactory { } } - fun setVisibility(layer: RasterLayer, styleValue: RNMBXStyleValue ) { - layer.visibility(Visibility.valueOf(styleValue.getEnumName())); - } - - fun setRasterOpacity(layer: RasterLayer, styleValue: RNMBXStyleValue ) { + fun setFillExtrusionAmbientOcclusionWallRadius(layer: FillExtrusionLayer, styleValue: RNMBXStyleValue ) { if (styleValue.isExpression()) { val expression = styleValue.getExpression() if (expression != null) { - layer.rasterOpacity(expression) + layer.fillExtrusionAmbientOcclusionWallRadius(expression) } else { - e("RNMBXRaster", "Expression for rasterOpacity is null") + e("RNMBXFillExtrusion", "Expression for fillExtrusionAmbientOcclusionWallRadius is null") } } else { val value = styleValue.getDouble(VALUE_KEY) if (value != null) { - layer.rasterOpacity(value) + layer.fillExtrusionAmbientOcclusionWallRadius(value) } else { - e("RNMBXRaster", "value for rasterOpacity is null") + e("RNMBXFillExtrusion", "value for fillExtrusionAmbientOcclusionWallRadius is null") } } } - fun setRasterOpacityTransition(layer: RasterLayer, styleValue: RNMBXStyleValue) { + fun setFillExtrusionAmbientOcclusionWallRadiusTransition(layer: FillExtrusionLayer, styleValue: RNMBXStyleValue) { val transition = styleValue.transition if (transition != null) { - layer.rasterOpacityTransition(transition); + layer.fillExtrusionAmbientOcclusionWallRadiusTransition(transition); } } - fun setRasterHueRotate(layer: RasterLayer, styleValue: RNMBXStyleValue ) { + fun setFillExtrusionAmbientOcclusionGroundRadius(layer: FillExtrusionLayer, styleValue: RNMBXStyleValue ) { if (styleValue.isExpression()) { val expression = styleValue.getExpression() if (expression != null) { - layer.rasterHueRotate(expression) + layer.fillExtrusionAmbientOcclusionGroundRadius(expression) } else { - e("RNMBXRaster", "Expression for rasterHueRotate is null") + e("RNMBXFillExtrusion", "Expression for fillExtrusionAmbientOcclusionGroundRadius is null") } } else { val value = styleValue.getDouble(VALUE_KEY) if (value != null) { - layer.rasterHueRotate(value) + layer.fillExtrusionAmbientOcclusionGroundRadius(value) } else { - e("RNMBXRaster", "value for rasterHueRotate is null") + e("RNMBXFillExtrusion", "value for fillExtrusionAmbientOcclusionGroundRadius is null") } } } - fun setRasterHueRotateTransition(layer: RasterLayer, styleValue: RNMBXStyleValue) { + fun setFillExtrusionAmbientOcclusionGroundRadiusTransition(layer: FillExtrusionLayer, styleValue: RNMBXStyleValue) { val transition = styleValue.transition if (transition != null) { - layer.rasterHueRotateTransition(transition); + layer.fillExtrusionAmbientOcclusionGroundRadiusTransition(transition); } } - fun setRasterBrightnessMin(layer: RasterLayer, styleValue: RNMBXStyleValue ) { + fun setFillExtrusionAmbientOcclusionGroundAttenuation(layer: FillExtrusionLayer, styleValue: RNMBXStyleValue ) { if (styleValue.isExpression()) { val expression = styleValue.getExpression() if (expression != null) { - layer.rasterBrightnessMin(expression) + layer.fillExtrusionAmbientOcclusionGroundAttenuation(expression) } else { - e("RNMBXRaster", "Expression for rasterBrightnessMin is null") + e("RNMBXFillExtrusion", "Expression for fillExtrusionAmbientOcclusionGroundAttenuation is null") } } else { val value = styleValue.getDouble(VALUE_KEY) if (value != null) { - layer.rasterBrightnessMin(value) + layer.fillExtrusionAmbientOcclusionGroundAttenuation(value) } else { - e("RNMBXRaster", "value for rasterBrightnessMin is null") + e("RNMBXFillExtrusion", "value for fillExtrusionAmbientOcclusionGroundAttenuation is null") } } } - fun setRasterBrightnessMinTransition(layer: RasterLayer, styleValue: RNMBXStyleValue) { + fun setFillExtrusionAmbientOcclusionGroundAttenuationTransition(layer: FillExtrusionLayer, styleValue: RNMBXStyleValue) { val transition = styleValue.transition if (transition != null) { - layer.rasterBrightnessMinTransition(transition); + layer.fillExtrusionAmbientOcclusionGroundAttenuationTransition(transition); } } - fun setRasterBrightnessMax(layer: RasterLayer, styleValue: RNMBXStyleValue ) { + fun setFillExtrusionFloodLightColor(layer: FillExtrusionLayer, styleValue: RNMBXStyleValue ) { if (styleValue.isExpression()) { val expression = styleValue.getExpression() if (expression != null) { - layer.rasterBrightnessMax(expression) + layer.fillExtrusionFloodLightColor(expression) } else { - e("RNMBXRaster", "Expression for rasterBrightnessMax is null") + e("RNMBXFillExtrusion", "Expression for fillExtrusionFloodLightColor is null") } } else { - val value = styleValue.getDouble(VALUE_KEY) + val value = styleValue.getInt(VALUE_KEY) if (value != null) { - layer.rasterBrightnessMax(value) + layer.fillExtrusionFloodLightColor(value) } else { - e("RNMBXRaster", "value for rasterBrightnessMax is null") + e("RNMBXFillExtrusion", "value for fillExtrusionFloodLightColor is null") } } } - fun setRasterBrightnessMaxTransition(layer: RasterLayer, styleValue: RNMBXStyleValue) { + fun setFillExtrusionFloodLightColorTransition(layer: FillExtrusionLayer, styleValue: RNMBXStyleValue) { val transition = styleValue.transition if (transition != null) { - layer.rasterBrightnessMaxTransition(transition); + layer.fillExtrusionFloodLightColorTransition(transition); } } - fun setRasterSaturation(layer: RasterLayer, styleValue: RNMBXStyleValue ) { + fun setFillExtrusionFloodLightIntensity(layer: FillExtrusionLayer, styleValue: RNMBXStyleValue ) { if (styleValue.isExpression()) { val expression = styleValue.getExpression() if (expression != null) { - layer.rasterSaturation(expression) + layer.fillExtrusionFloodLightIntensity(expression) } else { - e("RNMBXRaster", "Expression for rasterSaturation is null") + e("RNMBXFillExtrusion", "Expression for fillExtrusionFloodLightIntensity is null") } } else { val value = styleValue.getDouble(VALUE_KEY) if (value != null) { - layer.rasterSaturation(value) + layer.fillExtrusionFloodLightIntensity(value) } else { - e("RNMBXRaster", "value for rasterSaturation is null") + e("RNMBXFillExtrusion", "value for fillExtrusionFloodLightIntensity is null") } } } - fun setRasterSaturationTransition(layer: RasterLayer, styleValue: RNMBXStyleValue) { + fun setFillExtrusionFloodLightIntensityTransition(layer: FillExtrusionLayer, styleValue: RNMBXStyleValue) { val transition = styleValue.transition if (transition != null) { - layer.rasterSaturationTransition(transition); + layer.fillExtrusionFloodLightIntensityTransition(transition); } } - fun setRasterContrast(layer: RasterLayer, styleValue: RNMBXStyleValue ) { + fun setFillExtrusionFloodLightWallRadius(layer: FillExtrusionLayer, styleValue: RNMBXStyleValue ) { if (styleValue.isExpression()) { val expression = styleValue.getExpression() if (expression != null) { - layer.rasterContrast(expression) + layer.fillExtrusionFloodLightWallRadius(expression) } else { - e("RNMBXRaster", "Expression for rasterContrast is null") + e("RNMBXFillExtrusion", "Expression for fillExtrusionFloodLightWallRadius is null") } } else { val value = styleValue.getDouble(VALUE_KEY) if (value != null) { - layer.rasterContrast(value) + layer.fillExtrusionFloodLightWallRadius(value) } else { - e("RNMBXRaster", "value for rasterContrast is null") + e("RNMBXFillExtrusion", "value for fillExtrusionFloodLightWallRadius is null") } } } - fun setRasterContrastTransition(layer: RasterLayer, styleValue: RNMBXStyleValue) { + fun setFillExtrusionFloodLightWallRadiusTransition(layer: FillExtrusionLayer, styleValue: RNMBXStyleValue) { val transition = styleValue.transition if (transition != null) { - layer.rasterContrastTransition(transition); + layer.fillExtrusionFloodLightWallRadiusTransition(transition); } } - fun setRasterResampling(layer: RasterLayer, styleValue: RNMBXStyleValue ) { + fun setFillExtrusionFloodLightGroundRadius(layer: FillExtrusionLayer, styleValue: RNMBXStyleValue ) { if (styleValue.isExpression()) { val expression = styleValue.getExpression() if (expression != null) { - layer.rasterResampling(expression) + layer.fillExtrusionFloodLightGroundRadius(expression) } else { - e("RNMBXRaster", "Expression for rasterResampling is null") + e("RNMBXFillExtrusion", "Expression for fillExtrusionFloodLightGroundRadius is null") } } else { - layer.rasterResampling(RasterResampling.valueOf(styleValue.getEnumName())) + val value = styleValue.getDouble(VALUE_KEY) + if (value != null) { + layer.fillExtrusionFloodLightGroundRadius(value) + } else { + e("RNMBXFillExtrusion", "value for fillExtrusionFloodLightGroundRadius is null") + } } } - fun setRasterFadeDuration(layer: RasterLayer, styleValue: RNMBXStyleValue ) { + + fun setFillExtrusionFloodLightGroundRadiusTransition(layer: FillExtrusionLayer, styleValue: RNMBXStyleValue) { + val transition = styleValue.transition + if (transition != null) { + layer.fillExtrusionFloodLightGroundRadiusTransition(transition); + } + } + + fun setFillExtrusionFloodLightGroundAttenuation(layer: FillExtrusionLayer, styleValue: RNMBXStyleValue ) { if (styleValue.isExpression()) { val expression = styleValue.getExpression() if (expression != null) { - layer.rasterFadeDuration(expression) + layer.fillExtrusionFloodLightGroundAttenuation(expression) } else { - e("RNMBXRaster", "Expression for rasterFadeDuration is null") + e("RNMBXFillExtrusion", "Expression for fillExtrusionFloodLightGroundAttenuation is null") } } else { val value = styleValue.getDouble(VALUE_KEY) if (value != null) { - layer.rasterFadeDuration(value) + layer.fillExtrusionFloodLightGroundAttenuation(value) } else { - e("RNMBXRaster", "value for rasterFadeDuration is null") + e("RNMBXFillExtrusion", "value for fillExtrusionFloodLightGroundAttenuation is null") } } } - fun setVisibility(layer: HillshadeLayer, styleValue: RNMBXStyleValue ) { - layer.visibility(Visibility.valueOf(styleValue.getEnumName())); + + fun setFillExtrusionFloodLightGroundAttenuationTransition(layer: FillExtrusionLayer, styleValue: RNMBXStyleValue) { + val transition = styleValue.transition + if (transition != null) { + layer.fillExtrusionFloodLightGroundAttenuationTransition(transition); + } } - fun setHillshadeIlluminationDirection(layer: HillshadeLayer, styleValue: RNMBXStyleValue ) { + fun setFillExtrusionVerticalScale(layer: FillExtrusionLayer, styleValue: RNMBXStyleValue ) { if (styleValue.isExpression()) { val expression = styleValue.getExpression() if (expression != null) { - layer.hillshadeIlluminationDirection(expression) + layer.fillExtrusionVerticalScale(expression) } else { - e("RNMBXHillshade", "Expression for hillshadeIlluminationDirection is null") + e("RNMBXFillExtrusion", "Expression for fillExtrusionVerticalScale is null") } } else { val value = styleValue.getDouble(VALUE_KEY) if (value != null) { - layer.hillshadeIlluminationDirection(value) + layer.fillExtrusionVerticalScale(value) } else { - e("RNMBXHillshade", "value for hillshadeIlluminationDirection is null") + e("RNMBXFillExtrusion", "value for fillExtrusionVerticalScale is null") } } } - fun setHillshadeIlluminationAnchor(layer: HillshadeLayer, styleValue: RNMBXStyleValue ) { - if (styleValue.isExpression()) { - val expression = styleValue.getExpression() - if (expression != null) { - layer.hillshadeIlluminationAnchor(expression) - } else { - e("RNMBXHillshade", "Expression for hillshadeIlluminationAnchor is null") - } - } else { - layer.hillshadeIlluminationAnchor(HillshadeIlluminationAnchor.valueOf(styleValue.getEnumName())) + + fun setFillExtrusionVerticalScaleTransition(layer: FillExtrusionLayer, styleValue: RNMBXStyleValue) { + val transition = styleValue.transition + if (transition != null) { + layer.fillExtrusionVerticalScaleTransition(transition); } } - fun setHillshadeExaggeration(layer: HillshadeLayer, styleValue: RNMBXStyleValue ) { + fun setFillExtrusionCutoffFadeRange(layer: FillExtrusionLayer, styleValue: RNMBXStyleValue ) { if (styleValue.isExpression()) { val expression = styleValue.getExpression() if (expression != null) { - layer.hillshadeExaggeration(expression) + layer.fillExtrusionCutoffFadeRange(expression) } else { - e("RNMBXHillshade", "Expression for hillshadeExaggeration is null") + e("RNMBXFillExtrusion", "Expression for fillExtrusionCutoffFadeRange is null") } } else { val value = styleValue.getDouble(VALUE_KEY) if (value != null) { - layer.hillshadeExaggeration(value) + layer.fillExtrusionCutoffFadeRange(value) } else { - e("RNMBXHillshade", "value for hillshadeExaggeration is null") + e("RNMBXFillExtrusion", "value for fillExtrusionCutoffFadeRange is null") } } } - - fun setHillshadeExaggerationTransition(layer: HillshadeLayer, styleValue: RNMBXStyleValue) { - val transition = styleValue.transition - if (transition != null) { - layer.hillshadeExaggerationTransition(transition); - } + fun setVisibility(layer: RasterLayer, styleValue: RNMBXStyleValue ) { + layer.visibility(Visibility.valueOf(styleValue.getEnumName())); } - fun setHillshadeShadowColor(layer: HillshadeLayer, styleValue: RNMBXStyleValue ) { + fun setRasterOpacity(layer: RasterLayer, styleValue: RNMBXStyleValue ) { if (styleValue.isExpression()) { val expression = styleValue.getExpression() if (expression != null) { - layer.hillshadeShadowColor(expression) + layer.rasterOpacity(expression) } else { - e("RNMBXHillshade", "Expression for hillshadeShadowColor is null") + e("RNMBXRaster", "Expression for rasterOpacity is null") } } else { - val value = styleValue.getInt(VALUE_KEY) + val value = styleValue.getDouble(VALUE_KEY) if (value != null) { - layer.hillshadeShadowColor(value) + layer.rasterOpacity(value) } else { - e("RNMBXHillshade", "value for hillshadeShadowColor is null") + e("RNMBXRaster", "value for rasterOpacity is null") } } } - fun setHillshadeShadowColorTransition(layer: HillshadeLayer, styleValue: RNMBXStyleValue) { + fun setRasterOpacityTransition(layer: RasterLayer, styleValue: RNMBXStyleValue) { val transition = styleValue.transition if (transition != null) { - layer.hillshadeShadowColorTransition(transition); + layer.rasterOpacityTransition(transition); + } + } + + fun setRasterHueRotate(layer: RasterLayer, styleValue: RNMBXStyleValue ) { + if (styleValue.isExpression()) { + val expression = styleValue.getExpression() + if (expression != null) { + layer.rasterHueRotate(expression) + } else { + e("RNMBXRaster", "Expression for rasterHueRotate is null") + } + } else { + val value = styleValue.getDouble(VALUE_KEY) + if (value != null) { + layer.rasterHueRotate(value) + } else { + e("RNMBXRaster", "value for rasterHueRotate is null") + } + } + } + + + fun setRasterHueRotateTransition(layer: RasterLayer, styleValue: RNMBXStyleValue) { + val transition = styleValue.transition + if (transition != null) { + layer.rasterHueRotateTransition(transition); + } + } + + fun setRasterBrightnessMin(layer: RasterLayer, styleValue: RNMBXStyleValue ) { + if (styleValue.isExpression()) { + val expression = styleValue.getExpression() + if (expression != null) { + layer.rasterBrightnessMin(expression) + } else { + e("RNMBXRaster", "Expression for rasterBrightnessMin is null") + } + } else { + val value = styleValue.getDouble(VALUE_KEY) + if (value != null) { + layer.rasterBrightnessMin(value) + } else { + e("RNMBXRaster", "value for rasterBrightnessMin is null") + } + } + } + + + fun setRasterBrightnessMinTransition(layer: RasterLayer, styleValue: RNMBXStyleValue) { + val transition = styleValue.transition + if (transition != null) { + layer.rasterBrightnessMinTransition(transition); + } + } + + fun setRasterBrightnessMax(layer: RasterLayer, styleValue: RNMBXStyleValue ) { + if (styleValue.isExpression()) { + val expression = styleValue.getExpression() + if (expression != null) { + layer.rasterBrightnessMax(expression) + } else { + e("RNMBXRaster", "Expression for rasterBrightnessMax is null") + } + } else { + val value = styleValue.getDouble(VALUE_KEY) + if (value != null) { + layer.rasterBrightnessMax(value) + } else { + e("RNMBXRaster", "value for rasterBrightnessMax is null") + } + } + } + + + fun setRasterBrightnessMaxTransition(layer: RasterLayer, styleValue: RNMBXStyleValue) { + val transition = styleValue.transition + if (transition != null) { + layer.rasterBrightnessMaxTransition(transition); + } + } + + fun setRasterSaturation(layer: RasterLayer, styleValue: RNMBXStyleValue ) { + if (styleValue.isExpression()) { + val expression = styleValue.getExpression() + if (expression != null) { + layer.rasterSaturation(expression) + } else { + e("RNMBXRaster", "Expression for rasterSaturation is null") + } + } else { + val value = styleValue.getDouble(VALUE_KEY) + if (value != null) { + layer.rasterSaturation(value) + } else { + e("RNMBXRaster", "value for rasterSaturation is null") + } + } + } + + + fun setRasterSaturationTransition(layer: RasterLayer, styleValue: RNMBXStyleValue) { + val transition = styleValue.transition + if (transition != null) { + layer.rasterSaturationTransition(transition); + } + } + + fun setRasterContrast(layer: RasterLayer, styleValue: RNMBXStyleValue ) { + if (styleValue.isExpression()) { + val expression = styleValue.getExpression() + if (expression != null) { + layer.rasterContrast(expression) + } else { + e("RNMBXRaster", "Expression for rasterContrast is null") + } + } else { + val value = styleValue.getDouble(VALUE_KEY) + if (value != null) { + layer.rasterContrast(value) + } else { + e("RNMBXRaster", "value for rasterContrast is null") + } + } + } + + + fun setRasterContrastTransition(layer: RasterLayer, styleValue: RNMBXStyleValue) { + val transition = styleValue.transition + if (transition != null) { + layer.rasterContrastTransition(transition); + } + } + + fun setRasterResampling(layer: RasterLayer, styleValue: RNMBXStyleValue ) { + if (styleValue.isExpression()) { + val expression = styleValue.getExpression() + if (expression != null) { + layer.rasterResampling(expression) + } else { + e("RNMBXRaster", "Expression for rasterResampling is null") + } + } else { + layer.rasterResampling(RasterResampling.valueOf(styleValue.getEnumName())) + } + } + + fun setRasterFadeDuration(layer: RasterLayer, styleValue: RNMBXStyleValue ) { + if (styleValue.isExpression()) { + val expression = styleValue.getExpression() + if (expression != null) { + layer.rasterFadeDuration(expression) + } else { + e("RNMBXRaster", "Expression for rasterFadeDuration is null") + } + } else { + val value = styleValue.getDouble(VALUE_KEY) + if (value != null) { + layer.rasterFadeDuration(value) + } else { + e("RNMBXRaster", "value for rasterFadeDuration is null") + } + } + } + + fun setRasterColor(layer: RasterLayer, styleValue: RNMBXStyleValue ) { + if (styleValue.isExpression()) { + val expression = styleValue.getExpression() + if (expression != null) { + layer.rasterColor(expression) + } else { + e("RNMBXRaster", "Expression for rasterColor is null") + } + } else { + val value = styleValue.getInt(VALUE_KEY) + if (value != null) { + layer.rasterColor(value) + } else { + e("RNMBXRaster", "value for rasterColor is null") + } + } + } + + fun setRasterColorMix(layer: RasterLayer, styleValue: RNMBXStyleValue ) { + if (styleValue.isExpression()) { + val expression = styleValue.getExpression() + if (expression != null) { + layer.rasterColorMix(expression) + } else { + e("RNMBXRaster", "Expression for rasterColorMix is null") + } + } else { + val value = styleValue.getFloatArray(VALUE_KEY) + if (value != null) { + layer.rasterColorMix(value) + } else { + e("RNMBXRaster", "value for rasterColorMix is null") + } + } + } + + + fun setRasterColorMixTransition(layer: RasterLayer, styleValue: RNMBXStyleValue) { + val transition = styleValue.transition + if (transition != null) { + layer.rasterColorMixTransition(transition); + } + } + + fun setRasterColorRange(layer: RasterLayer, styleValue: RNMBXStyleValue ) { + if (styleValue.isExpression()) { + val expression = styleValue.getExpression() + if (expression != null) { + layer.rasterColorRange(expression) + } else { + e("RNMBXRaster", "Expression for rasterColorRange is null") + } + } else { + val value = styleValue.getFloatArray(VALUE_KEY) + if (value != null) { + layer.rasterColorRange(value) + } else { + e("RNMBXRaster", "value for rasterColorRange is null") + } + } + } + + + fun setRasterColorRangeTransition(layer: RasterLayer, styleValue: RNMBXStyleValue) { + val transition = styleValue.transition + if (transition != null) { + layer.rasterColorRangeTransition(transition); + } + } + + fun setVisibility(layer: HillshadeLayer, styleValue: RNMBXStyleValue ) { + layer.visibility(Visibility.valueOf(styleValue.getEnumName())); + } + + fun setHillshadeIlluminationDirection(layer: HillshadeLayer, styleValue: RNMBXStyleValue ) { + if (styleValue.isExpression()) { + val expression = styleValue.getExpression() + if (expression != null) { + layer.hillshadeIlluminationDirection(expression) + } else { + e("RNMBXHillshade", "Expression for hillshadeIlluminationDirection is null") + } + } else { + val value = styleValue.getDouble(VALUE_KEY) + if (value != null) { + layer.hillshadeIlluminationDirection(value) + } else { + e("RNMBXHillshade", "value for hillshadeIlluminationDirection is null") + } + } + } + + fun setHillshadeIlluminationAnchor(layer: HillshadeLayer, styleValue: RNMBXStyleValue ) { + if (styleValue.isExpression()) { + val expression = styleValue.getExpression() + if (expression != null) { + layer.hillshadeIlluminationAnchor(expression) + } else { + e("RNMBXHillshade", "Expression for hillshadeIlluminationAnchor is null") + } + } else { + layer.hillshadeIlluminationAnchor(HillshadeIlluminationAnchor.valueOf(styleValue.getEnumName())) + } + } + + fun setHillshadeExaggeration(layer: HillshadeLayer, styleValue: RNMBXStyleValue ) { + if (styleValue.isExpression()) { + val expression = styleValue.getExpression() + if (expression != null) { + layer.hillshadeExaggeration(expression) + } else { + e("RNMBXHillshade", "Expression for hillshadeExaggeration is null") + } + } else { + val value = styleValue.getDouble(VALUE_KEY) + if (value != null) { + layer.hillshadeExaggeration(value) + } else { + e("RNMBXHillshade", "value for hillshadeExaggeration is null") + } + } + } + + + fun setHillshadeExaggerationTransition(layer: HillshadeLayer, styleValue: RNMBXStyleValue) { + val transition = styleValue.transition + if (transition != null) { + layer.hillshadeExaggerationTransition(transition); + } + } + + fun setHillshadeShadowColor(layer: HillshadeLayer, styleValue: RNMBXStyleValue ) { + if (styleValue.isExpression()) { + val expression = styleValue.getExpression() + if (expression != null) { + layer.hillshadeShadowColor(expression) + } else { + e("RNMBXHillshade", "Expression for hillshadeShadowColor is null") + } + } else { + val value = styleValue.getInt(VALUE_KEY) + if (value != null) { + layer.hillshadeShadowColor(value) + } else { + e("RNMBXHillshade", "value for hillshadeShadowColor is null") + } + } + } + + + fun setHillshadeShadowColorTransition(layer: HillshadeLayer, styleValue: RNMBXStyleValue) { + val transition = styleValue.transition + if (transition != null) { + layer.hillshadeShadowColorTransition(transition); } } @@ -3149,51 +3785,400 @@ object RNMBXStyleFactory { if (styleValue.isExpression()) { val expression = styleValue.getExpression() if (expression != null) { - layer.hillshadeHighlightColor(expression) + layer.hillshadeHighlightColor(expression) + } else { + e("RNMBXHillshade", "Expression for hillshadeHighlightColor is null") + } + } else { + val value = styleValue.getInt(VALUE_KEY) + if (value != null) { + layer.hillshadeHighlightColor(value) + } else { + e("RNMBXHillshade", "value for hillshadeHighlightColor is null") + } + } + } + + + fun setHillshadeHighlightColorTransition(layer: HillshadeLayer, styleValue: RNMBXStyleValue) { + val transition = styleValue.transition + if (transition != null) { + layer.hillshadeHighlightColorTransition(transition); + } + } + + fun setHillshadeAccentColor(layer: HillshadeLayer, styleValue: RNMBXStyleValue ) { + if (styleValue.isExpression()) { + val expression = styleValue.getExpression() + if (expression != null) { + layer.hillshadeAccentColor(expression) + } else { + e("RNMBXHillshade", "Expression for hillshadeAccentColor is null") + } + } else { + val value = styleValue.getInt(VALUE_KEY) + if (value != null) { + layer.hillshadeAccentColor(value) + } else { + e("RNMBXHillshade", "value for hillshadeAccentColor is null") + } + } + } + + + fun setHillshadeAccentColorTransition(layer: HillshadeLayer, styleValue: RNMBXStyleValue) { + val transition = styleValue.transition + if (transition != null) { + layer.hillshadeAccentColorTransition(transition); + } + } + + fun setVisibility(layer: ModelLayer, styleValue: RNMBXStyleValue ) { + layer.visibility(Visibility.valueOf(styleValue.getEnumName())); + } + + fun setModelId(layer: ModelLayer, styleValue: RNMBXStyleValue ) { + if (styleValue.isExpression()) { + val expression = styleValue.getExpression() + if (expression != null) { + layer.modelId(expression) } else { - e("RNMBXHillshade", "Expression for hillshadeHighlightColor is null") + e("RNMBXModel", "Expression for modelId is null") } } else { - val value = styleValue.getInt(VALUE_KEY) + val value = styleValue.getString(VALUE_KEY) if (value != null) { - layer.hillshadeHighlightColor(value) + layer.modelId(value) } else { - e("RNMBXHillshade", "value for hillshadeHighlightColor is null") + e("RNMBXModel", "value for modelId is null") + } + } + } + + fun setModelOpacity(layer: ModelLayer, styleValue: RNMBXStyleValue ) { + if (styleValue.isExpression()) { + val expression = styleValue.getExpression() + if (expression != null) { + layer.modelOpacity(expression) + } else { + e("RNMBXModel", "Expression for modelOpacity is null") + } + } else { + val value = styleValue.getDouble(VALUE_KEY) + if (value != null) { + layer.modelOpacity(value) + } else { + e("RNMBXModel", "value for modelOpacity is null") } } } - fun setHillshadeHighlightColorTransition(layer: HillshadeLayer, styleValue: RNMBXStyleValue) { + fun setModelOpacityTransition(layer: ModelLayer, styleValue: RNMBXStyleValue) { val transition = styleValue.transition if (transition != null) { - layer.hillshadeHighlightColorTransition(transition); + layer.modelOpacityTransition(transition); } } - fun setHillshadeAccentColor(layer: HillshadeLayer, styleValue: RNMBXStyleValue ) { + fun setModelRotation(layer: ModelLayer, styleValue: RNMBXStyleValue ) { if (styleValue.isExpression()) { val expression = styleValue.getExpression() if (expression != null) { - layer.hillshadeAccentColor(expression) + layer.modelRotation(expression) } else { - e("RNMBXHillshade", "Expression for hillshadeAccentColor is null") + e("RNMBXModel", "Expression for modelRotation is null") + } + } else { + val value = styleValue.getFloatArray(VALUE_KEY) + if (value != null) { + layer.modelRotation(value) + } else { + e("RNMBXModel", "value for modelRotation is null") + } + } + } + + + fun setModelRotationTransition(layer: ModelLayer, styleValue: RNMBXStyleValue) { + val transition = styleValue.transition + if (transition != null) { + layer.modelRotationTransition(transition); + } + } + + fun setModelScale(layer: ModelLayer, styleValue: RNMBXStyleValue ) { + if (styleValue.isExpression()) { + val expression = styleValue.getExpression() + if (expression != null) { + layer.modelScale(expression) + } else { + e("RNMBXModel", "Expression for modelScale is null") + } + } else { + val value = styleValue.getFloatArray(VALUE_KEY) + if (value != null) { + layer.modelScale(value) + } else { + e("RNMBXModel", "value for modelScale is null") + } + } + } + + + fun setModelScaleTransition(layer: ModelLayer, styleValue: RNMBXStyleValue) { + val transition = styleValue.transition + if (transition != null) { + layer.modelScaleTransition(transition); + } + } + + fun setModelTranslation(layer: ModelLayer, styleValue: RNMBXStyleValue ) { + if (styleValue.isExpression()) { + val expression = styleValue.getExpression() + if (expression != null) { + layer.modelTranslation(expression) + } else { + e("RNMBXModel", "Expression for modelTranslation is null") + } + } else { + val value = styleValue.getFloatArray(VALUE_KEY) + if (value != null) { + layer.modelTranslation(value) + } else { + e("RNMBXModel", "value for modelTranslation is null") + } + } + } + + + fun setModelTranslationTransition(layer: ModelLayer, styleValue: RNMBXStyleValue) { + val transition = styleValue.transition + if (transition != null) { + layer.modelTranslationTransition(transition); + } + } + + fun setModelColor(layer: ModelLayer, styleValue: RNMBXStyleValue ) { + if (styleValue.isExpression()) { + val expression = styleValue.getExpression() + if (expression != null) { + layer.modelColor(expression) + } else { + e("RNMBXModel", "Expression for modelColor is null") } } else { val value = styleValue.getInt(VALUE_KEY) if (value != null) { - layer.hillshadeAccentColor(value) + layer.modelColor(value) } else { - e("RNMBXHillshade", "value for hillshadeAccentColor is null") + e("RNMBXModel", "value for modelColor is null") } } } - fun setHillshadeAccentColorTransition(layer: HillshadeLayer, styleValue: RNMBXStyleValue) { + fun setModelColorTransition(layer: ModelLayer, styleValue: RNMBXStyleValue) { val transition = styleValue.transition if (transition != null) { - layer.hillshadeAccentColorTransition(transition); + layer.modelColorTransition(transition); + } + } + + fun setModelColorMixIntensity(layer: ModelLayer, styleValue: RNMBXStyleValue ) { + if (styleValue.isExpression()) { + val expression = styleValue.getExpression() + if (expression != null) { + layer.modelColorMixIntensity(expression) + } else { + e("RNMBXModel", "Expression for modelColorMixIntensity is null") + } + } else { + val value = styleValue.getDouble(VALUE_KEY) + if (value != null) { + layer.modelColorMixIntensity(value) + } else { + e("RNMBXModel", "value for modelColorMixIntensity is null") + } + } + } + + + fun setModelColorMixIntensityTransition(layer: ModelLayer, styleValue: RNMBXStyleValue) { + val transition = styleValue.transition + if (transition != null) { + layer.modelColorMixIntensityTransition(transition); + } + } + + fun setModelType(layer: ModelLayer, styleValue: RNMBXStyleValue ) { + if (styleValue.isExpression()) { + val expression = styleValue.getExpression() + if (expression != null) { + layer.modelType(expression) + } else { + e("RNMBXModel", "Expression for modelType is null") + } + } else { + layer.modelType(ModelType.valueOf(styleValue.getEnumName())) + } + } + + fun setModelCastShadows(layer: ModelLayer, styleValue: RNMBXStyleValue ) { + if (styleValue.isExpression()) { + val expression = styleValue.getExpression() + if (expression != null) { + layer.modelCastShadows(expression) + } else { + e("RNMBXModel", "Expression for modelCastShadows is null") + } + } else { + val value = styleValue.getBoolean(VALUE_KEY) + if (value != null) { + layer.modelCastShadows(value) + } else { + e("RNMBXModel", "value for modelCastShadows is null") + } + } + } + + fun setModelReceiveShadows(layer: ModelLayer, styleValue: RNMBXStyleValue ) { + if (styleValue.isExpression()) { + val expression = styleValue.getExpression() + if (expression != null) { + layer.modelReceiveShadows(expression) + } else { + e("RNMBXModel", "Expression for modelReceiveShadows is null") + } + } else { + val value = styleValue.getBoolean(VALUE_KEY) + if (value != null) { + layer.modelReceiveShadows(value) + } else { + e("RNMBXModel", "value for modelReceiveShadows is null") + } + } + } + + fun setModelAmbientOcclusionIntensity(layer: ModelLayer, styleValue: RNMBXStyleValue ) { + if (styleValue.isExpression()) { + val expression = styleValue.getExpression() + if (expression != null) { + layer.modelAmbientOcclusionIntensity(expression) + } else { + e("RNMBXModel", "Expression for modelAmbientOcclusionIntensity is null") + } + } else { + val value = styleValue.getDouble(VALUE_KEY) + if (value != null) { + layer.modelAmbientOcclusionIntensity(value) + } else { + e("RNMBXModel", "value for modelAmbientOcclusionIntensity is null") + } + } + } + + + fun setModelAmbientOcclusionIntensityTransition(layer: ModelLayer, styleValue: RNMBXStyleValue) { + val transition = styleValue.transition + if (transition != null) { + layer.modelAmbientOcclusionIntensityTransition(transition); + } + } + + fun setModelEmissiveStrength(layer: ModelLayer, styleValue: RNMBXStyleValue ) { + if (styleValue.isExpression()) { + val expression = styleValue.getExpression() + if (expression != null) { + layer.modelEmissiveStrength(expression) + } else { + e("RNMBXModel", "Expression for modelEmissiveStrength is null") + } + } else { + val value = styleValue.getDouble(VALUE_KEY) + if (value != null) { + layer.modelEmissiveStrength(value) + } else { + e("RNMBXModel", "value for modelEmissiveStrength is null") + } + } + } + + + fun setModelEmissiveStrengthTransition(layer: ModelLayer, styleValue: RNMBXStyleValue) { + val transition = styleValue.transition + if (transition != null) { + layer.modelEmissiveStrengthTransition(transition); + } + } + + fun setModelRoughness(layer: ModelLayer, styleValue: RNMBXStyleValue ) { + if (styleValue.isExpression()) { + val expression = styleValue.getExpression() + if (expression != null) { + layer.modelRoughness(expression) + } else { + e("RNMBXModel", "Expression for modelRoughness is null") + } + } else { + val value = styleValue.getDouble(VALUE_KEY) + if (value != null) { + layer.modelRoughness(value) + } else { + e("RNMBXModel", "value for modelRoughness is null") + } + } + } + + + fun setModelRoughnessTransition(layer: ModelLayer, styleValue: RNMBXStyleValue) { + val transition = styleValue.transition + if (transition != null) { + layer.modelRoughnessTransition(transition); + } + } + + fun setModelHeightBasedEmissiveStrengthMultiplier(layer: ModelLayer, styleValue: RNMBXStyleValue ) { + if (styleValue.isExpression()) { + val expression = styleValue.getExpression() + if (expression != null) { + layer.modelHeightBasedEmissiveStrengthMultiplier(expression) + } else { + e("RNMBXModel", "Expression for modelHeightBasedEmissiveStrengthMultiplier is null") + } + } else { + val value = styleValue.getFloatArray(VALUE_KEY) + if (value != null) { + layer.modelHeightBasedEmissiveStrengthMultiplier(value) + } else { + e("RNMBXModel", "value for modelHeightBasedEmissiveStrengthMultiplier is null") + } + } + } + + + fun setModelHeightBasedEmissiveStrengthMultiplierTransition(layer: ModelLayer, styleValue: RNMBXStyleValue) { + val transition = styleValue.transition + if (transition != null) { + layer.modelHeightBasedEmissiveStrengthMultiplierTransition(transition); + } + } + + fun setModelCutoffFadeRange(layer: ModelLayer, styleValue: RNMBXStyleValue ) { + if (styleValue.isExpression()) { + val expression = styleValue.getExpression() + if (expression != null) { + layer.modelCutoffFadeRange(expression) + } else { + e("RNMBXModel", "Expression for modelCutoffFadeRange is null") + } + } else { + val value = styleValue.getDouble(VALUE_KEY) + if (value != null) { + layer.modelCutoffFadeRange(value) + } else { + e("RNMBXModel", "value for modelCutoffFadeRange is null") + } } } @@ -3280,6 +4265,32 @@ object RNMBXStyleFactory { } } + fun setBackgroundEmissiveStrength(layer: BackgroundLayer, styleValue: RNMBXStyleValue ) { + if (styleValue.isExpression()) { + val expression = styleValue.getExpression() + if (expression != null) { + layer.backgroundEmissiveStrength(expression) + } else { + e("RNMBXBackground", "Expression for backgroundEmissiveStrength is null") + } + } else { + val value = styleValue.getDouble(VALUE_KEY) + if (value != null) { + layer.backgroundEmissiveStrength(value) + } else { + e("RNMBXBackground", "value for backgroundEmissiveStrength is null") + } + } + } + + + fun setBackgroundEmissiveStrengthTransition(layer: BackgroundLayer, styleValue: RNMBXStyleValue) { + val transition = styleValue.transition + if (transition != null) { + layer.backgroundEmissiveStrengthTransition(transition); + } + } + fun setVisibility(layer: SkyLayer, styleValue: RNMBXStyleValue ) { layer.visibility(Visibility.valueOf(styleValue.getEnumName())); } diff --git a/android/src/main/java/com/rnmapbox/rnmbx/components/styles/layers/RNMBXModelLayer.kt b/android/src/main/java/com/rnmapbox/rnmbx/components/styles/layers/RNMBXModelLayer.kt new file mode 100644 index 0000000000..68776813d6 --- /dev/null +++ b/android/src/main/java/com/rnmapbox/rnmbx/components/styles/layers/RNMBXModelLayer.kt @@ -0,0 +1,33 @@ +package com.rnmapbox.rnmbx.components.styles.layers + +import android.content.Context +import com.mapbox.maps.extension.style.layers.generated.ModelLayer +import com.rnmapbox.rnmbx.components.styles.RNMBXStyle +import com.rnmapbox.rnmbx.components.styles.RNMBXStyleFactory +import com.rnmapbox.rnmbx.utils.Logger + +class RNMBXModelLayer(context: Context?) : RNMBXLayer( + context!! +) { + private var mSourceLayerID: String? = null + + override fun makeLayer(): ModelLayer? { + val layer = ModelLayer(iD!!, mSourceID!!) + if (mSourceLayerID != null) { + layer.sourceLayer(mSourceLayerID!!) + } + return layer + } + + override fun addStyles() { + mLayer?.also { + RNMBXStyleFactory.setModelLayerStyle(it, RNMBXStyle(context, mReactStyle, mMap!!)) + } ?: run { + Logger.e("RNMBXLineLayer", "mLayer is null") + } + } + + fun setSourceLayerID(value: String) { + mSourceLayerID = value + } +} \ No newline at end of file diff --git a/android/src/main/java/com/rnmapbox/rnmbx/components/styles/layers/RNMBXModelLayerManager.kt b/android/src/main/java/com/rnmapbox/rnmbx/components/styles/layers/RNMBXModelLayerManager.kt new file mode 100644 index 0000000000..572fd41947 --- /dev/null +++ b/android/src/main/java/com/rnmapbox/rnmbx/components/styles/layers/RNMBXModelLayerManager.kt @@ -0,0 +1,85 @@ +package com.rnmapbox.rnmbx.components.styles.layers + +import com.facebook.react.bridge.Dynamic +import com.facebook.react.uimanager.ThemedReactContext +import com.facebook.react.uimanager.ViewGroupManager +import com.facebook.react.uimanager.annotations.ReactProp +import com.facebook.react.viewmanagers.RNMBXModelLayerManagerInterface + + +class RNMBXModelLayerManager : ViewGroupManager(), + RNMBXModelLayerManagerInterface { + override fun getName(): String { + return REACT_CLASS + } + + override fun createViewInstance(context: ThemedReactContext): RNMBXModelLayer { + return RNMBXModelLayer(context) + } + + // @{codepart-replace-start(LayerManagerCommonProps.codepart-kt.ejs,{layerType:"RNMBXModelLayer"})} + @ReactProp(name = "id") + override fun setId(layer: RNMBXModelLayer, id: Dynamic) { + layer.iD = id.asString() + } + + @ReactProp(name = "existing") + override fun setExisting(layer: RNMBXModelLayer, existing: Dynamic) { + layer.setExisting(existing.asBoolean()) + } + + @ReactProp(name = "sourceID") + override fun setSourceID(layer: RNMBXModelLayer, sourceID: Dynamic) { + layer.setSourceID(sourceID.asString()) + } + + @ReactProp(name = "aboveLayerID") + override fun setAboveLayerID(layer: RNMBXModelLayer, aboveLayerID: Dynamic) { + layer.setAboveLayerID(aboveLayerID.asString()) + } + + @ReactProp(name = "belowLayerID") + override fun setBelowLayerID(layer: RNMBXModelLayer, belowLayerID: Dynamic) { + layer.setBelowLayerID(belowLayerID.asString()) + } + + @ReactProp(name = "layerIndex") + override fun setLayerIndex(layer: RNMBXModelLayer, layerIndex: Dynamic) { + layer.setLayerIndex(layerIndex.asInt()) + } + + @ReactProp(name = "minZoomLevel") + override fun setMinZoomLevel(layer: RNMBXModelLayer, minZoomLevel: Dynamic) { + layer.setMinZoomLevel(minZoomLevel.asDouble()) + } + + @ReactProp(name = "maxZoomLevel") + override fun setMaxZoomLevel(layer: RNMBXModelLayer, maxZoomLevel: Dynamic) { + layer.setMaxZoomLevel(maxZoomLevel.asDouble()) + } + + @ReactProp(name = "reactStyle") + override fun setReactStyle(layer: RNMBXModelLayer, style: Dynamic) { + layer.setReactStyle(style.asMap()) + } + + @ReactProp(name = "sourceLayerID") + override fun setSourceLayerID(layer: RNMBXModelLayer, sourceLayerID: Dynamic) { + layer.setSourceLayerID(sourceLayerID.asString()) + } + + @ReactProp(name = "filter") + override fun setFilter(layer: RNMBXModelLayer, filterList: Dynamic) { + layer.setFilter(filterList.asArray()) + } + + @ReactProp(name = "slot") + override fun setSlot(layer: RNMBXModelLayer, slot: Dynamic) { + layer.setSlot(slot.asString()) + } + // @{codepart-replace-end} + + companion object { + const val REACT_CLASS = "RNMBXModelLayer" + } +} \ No newline at end of file diff --git a/android/src/main/java/com/rnmapbox/rnmbx/components/styles/model/RNMBXModels.kt b/android/src/main/java/com/rnmapbox/rnmbx/components/styles/model/RNMBXModels.kt new file mode 100644 index 0000000000..610b96219d --- /dev/null +++ b/android/src/main/java/com/rnmapbox/rnmbx/components/styles/model/RNMBXModels.kt @@ -0,0 +1,33 @@ +package com.rnmapbox.rnmbx.components.styles.model + +import android.content.Context +import com.facebook.react.bridge.Dynamic +import com.facebook.react.bridge.ReadableMap +import com.rnmapbox.rnmbx.components.AbstractMapFeature +import com.rnmapbox.rnmbx.components.mapview.RNMBXMapView +import java.net.URI + +class RNMBXModels(context: Context?) : AbstractMapFeature(context) { + private var models: Map? = null; + + fun setModels(value: Map) { + this.models = value; + applyModels() + } + + override fun addToMap(mapView: RNMBXMapView) { + super.addToMap(mapView) + applyModels() + } + + private fun applyModels(){ + mMapView?.mapView?.getMapboxMap()?.getStyle()?.let { style -> + models?.forEach { (modelId,modelUri) -> + val uri = URI.create(modelUri) + val modelUriWithoutQuery = URI(uri.scheme, uri.userInfo, uri.host, uri.port, uri.path, null, uri.fragment).toString() + + style.addStyleModel(modelId, modelUriWithoutQuery) + } + } + } +} \ No newline at end of file diff --git a/android/src/main/java/com/rnmapbox/rnmbx/components/styles/model/RNMBXModelsManager.kt b/android/src/main/java/com/rnmapbox/rnmbx/components/styles/model/RNMBXModelsManager.kt new file mode 100644 index 0000000000..a12dd20f97 --- /dev/null +++ b/android/src/main/java/com/rnmapbox/rnmbx/components/styles/model/RNMBXModelsManager.kt @@ -0,0 +1,59 @@ +package com.rnmapbox.rnmbx.components.styles.model + +import com.facebook.react.bridge.Dynamic +import com.facebook.react.bridge.ReactApplicationContext +import com.facebook.react.bridge.ReadableMap +import com.facebook.react.uimanager.ThemedReactContext +import com.facebook.react.uimanager.ViewGroupManager +import com.facebook.react.uimanager.annotations.ReactProp +import com.facebook.react.viewmanagers.RNMBXModelLayerManagerInterface +import com.facebook.react.viewmanagers.RNMBXModelsManagerInterface +import com.rnmapbox.rnmbx.components.styles.terrain.RNMBXTerrainManager +import com.rnmapbox.rnmbx.utils.Logger +import com.rnmapbox.rnmbx.utils.extensions.forEach + +class RNMBXModelsManager(private val mContext: ReactApplicationContext) : ViewGroupManager(), + RNMBXModelsManagerInterface { + override fun getName(): String { + return REACT_CLASS + } + + override fun createViewInstance(context: ThemedReactContext): RNMBXModels { + return RNMBXModels(context) + } + + @ReactProp(name = "models") + override fun setModels(view: RNMBXModels, value: Dynamic?) { + val map = hashMapOf() + value?.asMap()?.forEach { modelName, model -> + when (model) { + is ReadableMap -> { + model.getString("uri")?.also { + map.put(modelName, it) + } ?: model.getString("url")?.also { + map.put(modelName, it) + } ?: run { + Logger.e( + LOG_TAG, + "Invalid value for model key: ${modelName} => ${model} is not an uri/url" + ) + } + } + + else -> { + Logger.e( + LOG_TAG, + "Invalid value for model key: ${modelName} => ${model} is not an uri/url" + ) + + } + } + } + view.setModels(map) + } + + companion object { + const val REACT_CLASS = "RNMBXModels" + const val LOG_TAG = "RNMBXModels" + } +} \ No newline at end of file diff --git a/android/src/main/mapbox-v11-compat/v10/com/rnmapbox/rnmbx/v11compat/StyleFactory.kt b/android/src/main/mapbox-v11-compat/v10/com/rnmapbox/rnmbx/v11compat/StyleFactory.kt new file mode 100644 index 0000000000..555759d616 --- /dev/null +++ b/android/src/main/mapbox-v11-compat/v10/com/rnmapbox/rnmbx/v11compat/StyleFactory.kt @@ -0,0 +1,395 @@ +package com.rnmapbox.rnmbx.v11compat.stylefactory; + +import com.mapbox.maps.extension.style.atmosphere.generated.Atmosphere +import com.mapbox.maps.extension.style.expressions.generated.Expression +import com.mapbox.maps.extension.style.layers.generated.BackgroundLayer +import com.mapbox.maps.extension.style.layers.generated.CircleLayer +import com.mapbox.maps.extension.style.layers.generated.FillExtrusionLayer +import com.mapbox.maps.extension.style.layers.generated.FillLayer +import com.mapbox.maps.extension.style.layers.generated.LineLayer +import com.mapbox.maps.extension.style.layers.generated.ModelLayer +import com.mapbox.maps.extension.style.layers.generated.RasterLayer +import com.mapbox.maps.extension.style.layers.generated.SymbolLayer +import com.mapbox.maps.extension.style.types.StyleTransition + +internal fun RasterLayer.rasterColor(rasterColor: Int) { + this.rasterColor(Expression.color(rasterColor)) +} + +internal fun ModelLayer.modelOpacity(expression: Expression) { + TODO("v11 only") +} + +internal fun SymbolLayer.symbolZElevate(expression: Expression) { + TODO("v11 only") +} + +internal fun LineLayer.lineEmissiveStrengthTransition(transition: StyleTransition) { + TODO("v11 only") +} + +internal fun LineLayer.lineEmissiveStrength(expression: Expression) { + TODO("v11 only") +} + +internal fun Atmosphere.verticalRangeTransition(transition: StyleTransition) { + TODO("v11 only") +} + +internal fun FillLayer.fillEmissiveStrengthTransition(transition: StyleTransition) { + TODO("v11 only") +} + +internal fun FillLayer.fillEmissiveStrength(expression: Double) { + TODO("v11 only") +} + +internal fun FillLayer.fillEmissiveStrength(expression: Expression) { + TODO("v11 only") +} + +internal fun ModelLayer.modelHeightBasedEmissiveStrengthMultiplier(expression: Expression) { + TODO("v11 only") +} + +internal fun ModelLayer.modelCutoffFadeRange(value: Expression) { + TODO("v11 only") +} + +internal fun ModelLayer.modelCutoffFadeRange(value: Double) { + TODO("v11 only") +} + +internal fun BackgroundLayer.backgroundEmissiveStrengthTransition(transition: StyleTransition) { + TODO("v11 only") +} + +internal fun Atmosphere.verticalRange(value: Expression) { + TODO("v11 only") +} + +internal fun Atmosphere.verticalRange(value: kotlin.collections.List) { + TODO("v11 only") +} + +internal fun FillExtrusionLayer.fillExtrusionFloodLightIntensity(expression: Expression) { + TODO("v11 only") +} + +internal fun FillExtrusionLayer.fillExtrusionAmbientOcclusionWallRadius(expression: Expression) { + TODO("v11 only") +} + +internal fun FillExtrusionLayer.fillExtrusionRoundedRoof(value: Expression?) { + TODO("v11 only") +} + +internal fun SymbolLayer.iconImageCrossFade(expression: Expression) { + TODO("v11 only") +} + +internal fun SymbolLayer.textEmissiveStrengthTransition(transition: StyleTransition) { + TODO("v11 only") +} + +internal fun SymbolLayer.textEmissiveStrength(value: Double) { + TODO("v11 only") +} + +internal fun SymbolLayer.iconEmissiveStrength(expression: Expression) { + TODO("v11 only") +} + +internal fun SymbolLayer.symbolZElevate(expression: Boolean) { + TODO("v11 only") +} + +internal fun LineLayer.lineEmissiveStrength(expression: Double) { + TODO("v11 only") +} + +internal fun BackgroundLayer.backgroundEmissiveStrength(expression: Double) { + TODO("v11 only") +} + +internal fun BackgroundLayer.backgroundEmissiveStrength(expression: Expression) { + TODO("v11 only") +} + +internal fun ModelLayer.modelHeightBasedEmissiveStrengthMultiplierTransition(transition: StyleTransition) { + TODO("v11 only") +} + +internal fun ModelLayer.modelHeightBasedEmissiveStrengthMultiplier(expression: List) { + TODO("v11 only") +} + +internal fun ModelLayer.modelRoughnessTransition(transition: StyleTransition) { + TODO("v11 only") +} + +internal fun ModelLayer.modelRoughness(expression: Double) { + TODO("v11 only") +} + +internal fun ModelLayer.modelRoughness(expression: Expression) { + TODO("v11 only") +} + +internal fun ModelLayer.modelEmissiveStrengthTransition(transition: StyleTransition) { + TODO("v11 only") +} + +internal fun ModelLayer.modelEmissiveStrength(expression: Double) { + TODO("v11 only") +} + +internal fun ModelLayer.modelEmissiveStrength(expression: Expression) { + TODO("v11 only") +} + +internal fun ModelLayer.modelAmbientOcclusionIntensityTransition(transition: StyleTransition) { + TODO("v11 only") +} + +internal fun ModelLayer.modelAmbientOcclusionIntensity(expression: Double) { + TODO("v11 only") +} + +internal fun ModelLayer.modelAmbientOcclusionIntensity(expression: Expression) { + TODO("v11 only") +} + +internal fun ModelLayer.modelReceiveShadows(expression: Boolean) { + TODO("v11 only") +} + +internal fun ModelLayer.modelReceiveShadows(expression: Expression) { + TODO("v11 only") +} + +internal fun ModelLayer.modelCastShadows(expression: Boolean) { + TODO("v11 only") +} + +internal fun ModelLayer.modelCastShadows(expression: Expression) { + TODO("v11 only") +} + +internal fun ModelLayer.modelColorMixIntensityTransition(transition: StyleTransition) { + TODO("v11 only") +} + +internal fun ModelLayer.modelColorMixIntensity(expression: Double) { + TODO("v11 only") +} + +internal fun ModelLayer.modelColorMixIntensity(expression: Expression) { + TODO("v11 only") +} + +internal fun ModelLayer.modelColorTransition(transition: StyleTransition) { + TODO("v11 only") +} + +internal fun ModelLayer.modelColor(expression: Int) { + TODO("v11 only") +} + +internal fun ModelLayer.modelColor(expression: Expression) { + TODO("v11 only") +} + +internal fun ModelLayer.modelTranslationTransition(transition: StyleTransition) { + TODO("v11 only") +} + +internal fun ModelLayer.modelTranslation(expression: List) { + TODO("v11 only") +} + +internal fun ModelLayer.modelTranslation(expression: Expression) { + TODO("v11 only") +} + +internal fun ModelLayer.modelOpacityTransition(transition: StyleTransition) { + TODO("v11 only") +} + +internal fun ModelLayer.modelOpacity(expression: Double) { + TODO("v11 only") +} + +internal fun RasterLayer.rasterColorRangeTransition(transition: StyleTransition) { + TODO("v11 only") +} + +internal fun RasterLayer.rasterColorRange(expression: List) { + TODO("v11 only") +} + +internal fun RasterLayer.rasterColorRange(expression: Expression) { + TODO("v11 only") +} + +internal fun RasterLayer.rasterColorMixTransition(transition: StyleTransition) { + TODO("v11 only") +} + +internal fun RasterLayer.rasterColorMix(expression: List) { + TODO("v11 only") +} + +internal fun RasterLayer.rasterColorMix(expression: Expression) { + TODO("v11 only") +} + +internal fun RasterLayer.rasterColor(rasterColor: Expression) { + TODO("v11 only") +} + +internal fun FillExtrusionLayer.fillExtrusionCutoffFadeRange(expression: Double) { + TODO("v11 only") +} + +internal fun FillExtrusionLayer.fillExtrusionCutoffFadeRange(expression: Expression) { + TODO("v11 only") +} + +internal fun FillExtrusionLayer.fillExtrusionVerticalScaleTransition(transition: StyleTransition) { + TODO("v11 only") +} + +internal fun FillExtrusionLayer.fillExtrusionFloodLightIntensity(expression: Double) { + TODO("v11 only") +} + +internal fun FillExtrusionLayer.fillExtrusionFloodLightGroundAttenuation(expression: Double) { + TODO("v11 only") +} + +internal fun FillExtrusionLayer.fillExtrusionAmbientOcclusionGroundAttenuationTransition(transition: StyleTransition) { + TODO("v11 only") +} + +internal fun FillExtrusionLayer.fillExtrusionAmbientOcclusionWallRadius(expression: Double) { + TODO("v11 only") +} + +internal fun SymbolLayer.iconImageCrossFade(expression: Double) { + TODO("v11 only") +} + +internal fun SymbolLayer.iconEmissiveStrength(expression: Double) { + TODO("v11 only") +} + +internal fun FillExtrusionLayer.fillExtrusionVerticalScale(expression: Double) { + TODO("v11 only") +} + +internal fun FillExtrusionLayer.fillExtrusionVerticalScale(expression: Expression) { + TODO("v11 only") +} + +internal fun FillExtrusionLayer.fillExtrusionFloodLightGroundAttenuationTransition(transition: StyleTransition) { + TODO("v11 only") +} + +internal fun FillExtrusionLayer.fillExtrusionFloodLightGroundAttenuation(expression: Expression) { + TODO("v11 only") +} + +internal fun FillExtrusionLayer.fillExtrusionFloodLightGroundRadiusTransition(transition: StyleTransition) { + TODO("v11 only") +} + +internal fun FillExtrusionLayer.fillExtrusionFloodLightGroundRadius(expression: Double) { + TODO("v11 only") +} + +internal fun FillExtrusionLayer.fillExtrusionFloodLightGroundRadius(expression: Expression) { + TODO("v11 only") +} + +internal fun FillExtrusionLayer.fillExtrusionFloodLightWallRadiusTransition(transition: StyleTransition) { + TODO("v11 only") +} + +internal fun FillExtrusionLayer.fillExtrusionFloodLightWallRadius(expression: Double) { + TODO("v11 only") +} + +internal fun FillExtrusionLayer.fillExtrusionFloodLightWallRadius(expression: Expression) { + TODO("v11 only") +} + +internal fun FillExtrusionLayer.fillExtrusionFloodLightIntensityTransition(transition: StyleTransition) { + TODO("v11 only") +} + +internal fun FillExtrusionLayer.fillExtrusionFloodLightColorTransition(transition: StyleTransition) { + TODO("v11 only") +} + +internal fun FillExtrusionLayer.fillExtrusionFloodLightColor(expression: Int) { + TODO("v11 only") +} + +internal fun FillExtrusionLayer.fillExtrusionFloodLightColor(expression: Expression) { + TODO("v11 only") +} + +internal fun FillExtrusionLayer.fillExtrusionAmbientOcclusionGroundAttenuation(expression: Double) { + TODO("v11 only") +} + +internal fun FillExtrusionLayer.fillExtrusionAmbientOcclusionGroundAttenuation(expression: Expression) { + TODO("v11 only") +} + +internal fun FillExtrusionLayer.fillExtrusionAmbientOcclusionGroundRadiusTransition(transition: StyleTransition) { + TODO("v11 only") +} + +internal fun FillExtrusionLayer.fillExtrusionAmbientOcclusionGroundRadius(expression: Double) { + TODO("v11 only") +} + +internal fun FillExtrusionLayer.fillExtrusionAmbientOcclusionGroundRadius(expression: Expression) { + TODO("v11 only") +} + +internal fun FillExtrusionLayer.fillExtrusionAmbientOcclusionWallRadiusTransition(transition: StyleTransition) { + TODO("v11 only") +} + +internal fun FillExtrusionLayer.fillExtrusionRoundedRoof(value: Boolean) { + TODO("v11 only") +} + +internal fun CircleLayer.circleEmissiveStrengthTransition(transition: StyleTransition) { + TODO("v11 only") +} + +internal fun CircleLayer.circleEmissiveStrength(expression: Double) { + TODO("v11 only") +} + +internal fun CircleLayer.circleEmissiveStrength(expression: Expression) { + TODO("v11 only") +} + +internal fun SymbolLayer.iconImageCrossFadeTransition(transition: StyleTransition) { + TODO("v11 only") +} + +internal fun SymbolLayer.textEmissiveStrength(value: Expression) { + TODO("v11 only") +} + +internal fun SymbolLayer.iconEmissiveStrengthTransition(transition: StyleTransition) { + TODO("v11 only") +} + + diff --git a/android/src/main/mapbox-v11-compat/v11/com/rnmapbox/rnmbx/v11compat/StyleFactory.kt b/android/src/main/mapbox-v11-compat/v11/com/rnmapbox/rnmbx/v11compat/StyleFactory.kt new file mode 100644 index 0000000000..9021085ca4 --- /dev/null +++ b/android/src/main/mapbox-v11-compat/v11/com/rnmapbox/rnmbx/v11compat/StyleFactory.kt @@ -0,0 +1,8 @@ +package com.rnmapbox.rnmbx.v11compat.stylefactory; + +import com.mapbox.maps.extension.style.expressions.generated.Expression +import com.mapbox.maps.extension.style.layers.generated.RasterLayer + +fun RasterLayer.rasterColor(rasterColor: Int) { + this.rasterColor(Expression.color(rasterColor)) +} diff --git a/example/src/examples/FillRasterLayer/QuerySourceFeatures.tsx b/example/src/examples/FillRasterLayer/QuerySourceFeatures.tsx index e56e600804..97fcf16ccd 100755 --- a/example/src/examples/FillRasterLayer/QuerySourceFeatures.tsx +++ b/example/src/examples/FillRasterLayer/QuerySourceFeatures.tsx @@ -23,7 +23,7 @@ const countiesOfInterest = [ const styles = { matchParent: { flex: 1 }, -} +}; const QuerySourceFeatures = () => { const [ready, setReady] = useState(false); diff --git a/example/src/scenes/GroupAndItem.tsx b/example/src/scenes/GroupAndItem.tsx index 8d42411da8..b5ae4ab83c 100644 --- a/example/src/scenes/GroupAndItem.tsx +++ b/example/src/scenes/GroupAndItem.tsx @@ -293,7 +293,6 @@ const Examples = new ExampleGroup('React Native Mapbox', [ exampleGroup(Camera), exampleGroup(UserLocation), exampleGroup(SymbolCircleLayer), - // @ts-expect-error TODO: fix exampleGroup(FillRasterLayer), exampleGroup(LineLayer), exampleGroup(Annotations), diff --git a/scripts/autogenHelpers/generateCodeWithEjs.mjs b/scripts/autogenHelpers/generateCodeWithEjs.mjs index 8ce3c933c5..920ceba32f 100644 --- a/scripts/autogenHelpers/generateCodeWithEjs.mjs +++ b/scripts/autogenHelpers/generateCodeWithEjs.mjs @@ -471,7 +471,7 @@ export default function generateCodeWithEjs(layers) { { input: path.join(TMPL_PATH, 'RNMBXStyleFactoryv10.kt.ejs'), output: path.join(ANDROID_V10_OUTPUT_PATH, 'RNMBXStyleFactory.kt'), - only: ['v10'], + only: ['v10', 'v11'], }, { input: path.join(TMPL_PATH, 'styleMap.ts.ejs'), diff --git a/scripts/templates/RNMBXStyleFactoryv10.kt.ejs b/scripts/templates/RNMBXStyleFactoryv10.kt.ejs index 975c6c903a..0ad63dca4e 100644 --- a/scripts/templates/RNMBXStyleFactoryv10.kt.ejs +++ b/scripts/templates/RNMBXStyleFactoryv10.kt.ejs @@ -20,6 +20,7 @@ import com.mapbox.maps.extension.style.layers.generated.HeatmapLayer import com.mapbox.maps.extension.style.layers.generated.HillshadeLayer import com.mapbox.maps.extension.style.atmosphere.generated.Atmosphere import com.mapbox.maps.extension.style.terrain.generated.Terrain +import com.mapbox.maps.extension.style.layers.generated.ModelLayer // import com.mapbox.maps.extension.style.layers.properties.generated.Visibility import com.mapbox.maps.extension.style.layers.properties.generated.* import com.mapbox.maps.extension.style.types.StyleTransition @@ -29,6 +30,7 @@ import com.rnmapbox.rnmbx.utils.DownloadMapImageTask.OnAllImagesLoaded import com.rnmapbox.rnmbx.utils.Logger.e import com.rnmapbox.rnmbx.v11compat.light.*; +import com.rnmapbox.rnmbx.v11compat.stylefactory.*; import java.util.List; diff --git a/src/components/AbstractLayer.tsx b/src/components/AbstractLayer.tsx index 6e1147a882..e5fc94ce3e 100644 --- a/src/components/AbstractLayer.tsx +++ b/src/components/AbstractLayer.tsx @@ -3,7 +3,7 @@ import { NativeMethods, processColor } from 'react-native'; import { getFilter } from '../utils/filterUtils'; import { AllLayerStyleProps, FilterExpression } from '../utils/MapboxStyles'; -import { transformStyle } from '../utils/StyleValue'; +import { StyleValue, transformStyle } from '../utils/StyleValue'; import type { BaseProps } from '../types/BaseProps'; type PropsBase = BaseProps & { @@ -23,7 +23,9 @@ class AbstractLayer< PropsType extends PropsBase, NativePropsType, > extends React.PureComponent { - get baseProps(): PropsType { + get baseProps(): Omit & { + reactStyle?: { [key: string]: StyleValue }; + } { return { ...this.props, id: this.props.id, @@ -59,7 +61,9 @@ class AbstractLayer< return undefined; } - getStyle(style: AllLayerStyleProps | undefined) { + getStyle( + style: AllLayerStyleProps | undefined, + ): { [key: string]: StyleValue } | undefined { return transformStyle(style); } diff --git a/src/specs/RNMBXCircleLayerNativeComponent.ts b/src/specs/RNMBXCircleLayerNativeComponent.ts index 23180109c5..98846bcbcc 100644 --- a/src/specs/RNMBXCircleLayerNativeComponent.ts +++ b/src/specs/RNMBXCircleLayerNativeComponent.ts @@ -2,25 +2,28 @@ import type { HostComponent, ViewProps } from 'react-native'; import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; import { Double, Int32 } from 'react-native/Libraries/Types/CodegenTypes'; +import { FilterExpression } from '../utils/MapboxStyles'; + import type { UnsafeMixed } from './codegenUtils'; // @{codepart-replace-start(CommonLayerNativeComponentsProps.codepart-ts)} // see https://github.com/rnmapbox/maps/wiki/FabricOptionalProp type OptionalProp = UnsafeMixed; +type Slot = 'bottom' | 'middle' | 'top'; type CommonProps = { - sourceID: OptionalProp; - existing: OptionalProp; - filter: UnsafeMixed; - - aboveLayerID: OptionalProp; - belowLayerID: OptionalProp; - layerIndex: OptionalProp; - - maxZoomLevel: OptionalProp; - minZoomLevel: OptionalProp; - sourceLayerID: OptionalProp; - slot: OptionalProp; + sourceID?: OptionalProp; + existing?: OptionalProp; + filter?: UnsafeMixed; + + aboveLayerID?: OptionalProp; + belowLayerID?: OptionalProp; + layerIndex?: OptionalProp; + + maxZoomLevel?: OptionalProp; + minZoomLevel?: OptionalProp; + sourceLayerID?: OptionalProp; + slot?: OptionalProp; }; // @{codepart-replace-end} diff --git a/src/specs/RNMBXFillLayerNativeComponent.ts b/src/specs/RNMBXFillLayerNativeComponent.ts index a96c9f2dad..4b705901bb 100644 --- a/src/specs/RNMBXFillLayerNativeComponent.ts +++ b/src/specs/RNMBXFillLayerNativeComponent.ts @@ -2,25 +2,28 @@ import type { HostComponent, ViewProps } from 'react-native'; import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; import { Double, Int32 } from 'react-native/Libraries/Types/CodegenTypes'; +import { FilterExpression } from '../utils/MapboxStyles'; + import type { UnsafeMixed } from './codegenUtils'; // @{codepart-replace-start(CommonLayerNativeComponentsProps.codepart-ts)} // see https://github.com/rnmapbox/maps/wiki/FabricOptionalProp type OptionalProp = UnsafeMixed; +type Slot = 'bottom' | 'middle' | 'top'; type CommonProps = { - sourceID: OptionalProp; - existing: OptionalProp; - filter: UnsafeMixed; - - aboveLayerID: OptionalProp; - belowLayerID: OptionalProp; - layerIndex: OptionalProp; - - maxZoomLevel: OptionalProp; - minZoomLevel: OptionalProp; - sourceLayerID: OptionalProp; - slot: OptionalProp; + sourceID?: OptionalProp; + existing?: OptionalProp; + filter?: UnsafeMixed; + + aboveLayerID?: OptionalProp; + belowLayerID?: OptionalProp; + layerIndex?: OptionalProp; + + maxZoomLevel?: OptionalProp; + minZoomLevel?: OptionalProp; + sourceLayerID?: OptionalProp; + slot?: OptionalProp; }; // @{codepart-replace-end} diff --git a/src/specs/RNMBXHeatmapLayerNativeComponent.ts b/src/specs/RNMBXHeatmapLayerNativeComponent.ts index 574669ec33..08af671064 100644 --- a/src/specs/RNMBXHeatmapLayerNativeComponent.ts +++ b/src/specs/RNMBXHeatmapLayerNativeComponent.ts @@ -2,25 +2,28 @@ import type { HostComponent, ViewProps } from 'react-native'; import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; import { Double, Int32 } from 'react-native/Libraries/Types/CodegenTypes'; +import { FilterExpression } from '../utils/MapboxStyles'; + import type { UnsafeMixed } from './codegenUtils'; // @{codepart-replace-start(CommonLayerNativeComponentsProps.codepart-ts)} // see https://github.com/rnmapbox/maps/wiki/FabricOptionalProp type OptionalProp = UnsafeMixed; +type Slot = 'bottom' | 'middle' | 'top'; type CommonProps = { - sourceID: OptionalProp; - existing: OptionalProp; - filter: UnsafeMixed; - - aboveLayerID: OptionalProp; - belowLayerID: OptionalProp; - layerIndex: OptionalProp; - - maxZoomLevel: OptionalProp; - minZoomLevel: OptionalProp; - sourceLayerID: OptionalProp; - slot: OptionalProp; + sourceID?: OptionalProp; + existing?: OptionalProp; + filter?: UnsafeMixed; + + aboveLayerID?: OptionalProp; + belowLayerID?: OptionalProp; + layerIndex?: OptionalProp; + + maxZoomLevel?: OptionalProp; + minZoomLevel?: OptionalProp; + sourceLayerID?: OptionalProp; + slot?: OptionalProp; }; // @{codepart-replace-end} diff --git a/src/specs/RNMBXLineLayerNativeComponent.ts b/src/specs/RNMBXLineLayerNativeComponent.ts index 99cac9576b..acfd202676 100644 --- a/src/specs/RNMBXLineLayerNativeComponent.ts +++ b/src/specs/RNMBXLineLayerNativeComponent.ts @@ -2,25 +2,28 @@ import type { HostComponent, ViewProps } from 'react-native'; import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; import { Double, Int32 } from 'react-native/Libraries/Types/CodegenTypes'; +import { FilterExpression } from '../utils/MapboxStyles'; + import type { UnsafeMixed } from './codegenUtils'; // @{codepart-replace-start(CommonLayerNativeComponentsProps.codepart-ts)} // see https://github.com/rnmapbox/maps/wiki/FabricOptionalProp type OptionalProp = UnsafeMixed; +type Slot = 'bottom' | 'middle' | 'top'; type CommonProps = { - sourceID: OptionalProp; - existing: OptionalProp; - filter: UnsafeMixed; - - aboveLayerID: OptionalProp; - belowLayerID: OptionalProp; - layerIndex: OptionalProp; - - maxZoomLevel: OptionalProp; - minZoomLevel: OptionalProp; - sourceLayerID: OptionalProp; - slot: OptionalProp; + sourceID?: OptionalProp; + existing?: OptionalProp; + filter?: UnsafeMixed; + + aboveLayerID?: OptionalProp; + belowLayerID?: OptionalProp; + layerIndex?: OptionalProp; + + maxZoomLevel?: OptionalProp; + minZoomLevel?: OptionalProp; + sourceLayerID?: OptionalProp; + slot?: OptionalProp; }; // @{codepart-replace-end} diff --git a/src/specs/RNMBXModelLayerNativeComponent.ts b/src/specs/RNMBXModelLayerNativeComponent.ts index fa05142070..08db32af6c 100644 --- a/src/specs/RNMBXModelLayerNativeComponent.ts +++ b/src/specs/RNMBXModelLayerNativeComponent.ts @@ -2,31 +2,35 @@ import type { HostComponent, ViewProps } from 'react-native'; import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; import { Double, Int32 } from 'react-native/Libraries/Types/CodegenTypes'; +import { FilterExpression } from '../utils/MapboxStyles'; +import { StyleValue } from '../utils/StyleValue'; + import { UnsafeMixed } from './codegenUtils'; // @{codepart-replace-start(CommonLayerNativeComponentsProps.codepart-ts)} // see https://github.com/rnmapbox/maps/wiki/FabricOptionalProp type OptionalProp = UnsafeMixed; +type Slot = 'bottom' | 'middle' | 'top'; type CommonProps = { - sourceID: OptionalProp; - existing: OptionalProp; - filter: UnsafeMixed; - - aboveLayerID: OptionalProp; - belowLayerID: OptionalProp; - layerIndex: OptionalProp; - - maxZoomLevel: OptionalProp; - minZoomLevel: OptionalProp; - sourceLayerID: OptionalProp; - slot: OptionalProp; + sourceID?: OptionalProp; + existing?: OptionalProp; + filter?: UnsafeMixed; + + aboveLayerID?: OptionalProp; + belowLayerID?: OptionalProp; + layerIndex?: OptionalProp; + + maxZoomLevel?: OptionalProp; + minZoomLevel?: OptionalProp; + sourceLayerID?: OptionalProp; + slot?: OptionalProp; }; // @{codepart-replace-end} export interface NativeProps extends ViewProps, CommonProps { - id?: OptionalProp; - reactStyle: UnsafeMixed; + id: OptionalProp; + reactStyle?: UnsafeMixed<{ [key: string]: StyleValue }>; } export default codegenNativeComponent( diff --git a/src/specs/RNMBXRasterLayerNativeComponent.ts b/src/specs/RNMBXRasterLayerNativeComponent.ts index 7ea49a993c..1d71599427 100644 --- a/src/specs/RNMBXRasterLayerNativeComponent.ts +++ b/src/specs/RNMBXRasterLayerNativeComponent.ts @@ -2,25 +2,28 @@ import type { HostComponent, ViewProps } from 'react-native'; import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; import { Double, Int32 } from 'react-native/Libraries/Types/CodegenTypes'; +import { FilterExpression } from '../utils/MapboxStyles'; + import type { UnsafeMixed } from './codegenUtils'; // @{codepart-replace-start(CommonLayerNativeComponentsProps.codepart-ts)} // see https://github.com/rnmapbox/maps/wiki/FabricOptionalProp type OptionalProp = UnsafeMixed; +type Slot = 'bottom' | 'middle' | 'top'; type CommonProps = { - sourceID: OptionalProp; - existing: OptionalProp; - filter: UnsafeMixed; - - aboveLayerID: OptionalProp; - belowLayerID: OptionalProp; - layerIndex: OptionalProp; - - maxZoomLevel: OptionalProp; - minZoomLevel: OptionalProp; - sourceLayerID: OptionalProp; - slot: OptionalProp; + sourceID?: OptionalProp; + existing?: OptionalProp; + filter?: UnsafeMixed; + + aboveLayerID?: OptionalProp; + belowLayerID?: OptionalProp; + layerIndex?: OptionalProp; + + maxZoomLevel?: OptionalProp; + minZoomLevel?: OptionalProp; + sourceLayerID?: OptionalProp; + slot?: OptionalProp; }; // @{codepart-replace-end} diff --git a/src/specs/RNMBXSymbolLayerNativeComponent.ts b/src/specs/RNMBXSymbolLayerNativeComponent.ts index 4a811bb12b..b83654571a 100644 --- a/src/specs/RNMBXSymbolLayerNativeComponent.ts +++ b/src/specs/RNMBXSymbolLayerNativeComponent.ts @@ -2,25 +2,28 @@ import type { HostComponent, ViewProps } from 'react-native'; import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; import { Double, Int32 } from 'react-native/Libraries/Types/CodegenTypes'; +import { FilterExpression } from '../utils/MapboxStyles'; + import type { UnsafeMixed } from './codegenUtils'; // @{codepart-replace-start(CommonLayerNativeComponentsProps.codepart-ts)} // see https://github.com/rnmapbox/maps/wiki/FabricOptionalProp type OptionalProp = UnsafeMixed; +type Slot = 'bottom' | 'middle' | 'top'; type CommonProps = { - sourceID: OptionalProp; - existing: OptionalProp; - filter: UnsafeMixed; - - aboveLayerID: OptionalProp; - belowLayerID: OptionalProp; - layerIndex: OptionalProp; - - maxZoomLevel: OptionalProp; - minZoomLevel: OptionalProp; - sourceLayerID: OptionalProp; - slot: OptionalProp; + sourceID?: OptionalProp; + existing?: OptionalProp; + filter?: UnsafeMixed; + + aboveLayerID?: OptionalProp; + belowLayerID?: OptionalProp; + layerIndex?: OptionalProp; + + maxZoomLevel?: OptionalProp; + minZoomLevel?: OptionalProp; + sourceLayerID?: OptionalProp; + slot?: OptionalProp; }; // @{codepart-replace-end} diff --git a/src/specs/codeparts/CommonLayerNativeComponentsProps.codepart-ts b/src/specs/codeparts/CommonLayerNativeComponentsProps.codepart-ts index 8f03e3d159..7717d27578 100644 --- a/src/specs/codeparts/CommonLayerNativeComponentsProps.codepart-ts +++ b/src/specs/codeparts/CommonLayerNativeComponentsProps.codepart-ts @@ -1,17 +1,18 @@ // see https://github.com/rnmapbox/maps/wiki/FabricOptionalProp type OptionalProp = UnsafeMixed; +type Slot = 'bottom' | 'middle' | 'top'; type CommonProps = { - sourceID: OptionalProp; - existing: OptionalProp; - filter: UnsafeMixed; + sourceID?: OptionalProp; + existing?: OptionalProp; + filter?: UnsafeMixed; - aboveLayerID: OptionalProp; - belowLayerID: OptionalProp; - layerIndex: OptionalProp; + aboveLayerID?: OptionalProp; + belowLayerID?: OptionalProp; + layerIndex?: OptionalProp; - maxZoomLevel: OptionalProp; - minZoomLevel: OptionalProp; - sourceLayerID: OptionalProp; - slot: OptionalProp; + maxZoomLevel?: OptionalProp; + minZoomLevel?: OptionalProp; + sourceLayerID?: OptionalProp; + slot?: OptionalProp; };