Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,8 @@ object RNMBXStyleFactory {
val styleValue = style.getStyleValueForKey(styleKey)

when (styleKey) {
"modelAllowDensityReduction" ->
setModelAllowDensityReduction(layer, styleValue)
"visibility" ->
setVisibility(layer, styleValue)
"modelId" ->
Expand Down Expand Up @@ -847,6 +849,8 @@ object RNMBXStyleFactory {
setModelHeightBasedEmissiveStrengthMultiplierTransition(layer, styleValue)
"modelCutoffFadeRange" ->
setModelCutoffFadeRange(layer, styleValue)
"modelElevationReference" ->
setModelElevationReference(layer, styleValue)
}
} catch (e: MapboxStyleException) {
Logger.e(LOG_TAG, "Failed to update: $styleKey ${e.message}")
Expand Down Expand Up @@ -4673,6 +4677,24 @@ object RNMBXStyleFactory {
}
}

fun setModelAllowDensityReduction(layer: ModelLayer, styleValue: RNMBXStyleValue ) {
if (styleValue.isExpression()) {
val expression = styleValue.getExpression()
if (expression != null) {
layer.modelAllowDensityReduction(expression)
} else {
Logger.e("RNMBXModel", "Expression for modelAllowDensityReduction is null")
}
} else {
val value = styleValue.getBoolean(VALUE_KEY)
if (value != null) {
layer.modelAllowDensityReduction(value)
} else {
Logger.e("RNMBXModel", "value for modelAllowDensityReduction is null")
}
}
}

fun setVisibility(layer: ModelLayer, styleValue: RNMBXStyleValue ) {
layer.visibility(Visibility.valueOf(styleValue.getEnumName()));
}
Expand Down Expand Up @@ -5022,6 +5044,19 @@ object RNMBXStyleFactory {
}
}

fun setModelElevationReference(layer: ModelLayer, styleValue: RNMBXStyleValue ) {
if (styleValue.isExpression()) {
val expression = styleValue.getExpression()
if (expression != null) {
layer.modelElevationReference(expression)
} else {
Logger.e("RNMBXModel", "Expression for modelElevationReference is null")
}
} else {
layer.modelElevationReference(ModelElevationReference.valueOf(styleValue.getEnumName()))
}
}

fun setVisibility(layer: BackgroundLayer, styleValue: RNMBXStyleValue ) {
layer.visibility(Visibility.valueOf(styleValue.getEnumName()));
}
Expand Down
2 changes: 1 addition & 1 deletion docs/BackgroundLayer.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ The color with which the background will be drawn.

#### Expression

Parameters: `zoom`
Parameters: `zoom, measure-light`
___

### backgroundColorTransition
Expand Down
9 changes: 1 addition & 8 deletions docs/LineLayer.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,14 +282,7 @@ Name: `lineZOffset`
Mapbox spec: [line-z-offset](https://docs.mapbox.com/style-spec/reference/layers/#layout-line-line-z-offset)

#### Description
Vertical offset from ground, in meters. Defaults to 0. This is an experimental property with some known issues:
* Not supported for globe projection at the moment
* Elevated line discontinuity is possible on tile borders with terrain enabled
* Rendering artifacts can happen near line joins and line caps depending on the line styling
* Rendering artifacts relating to `lineOpacity` and `lineBlur`
* Elevated line visibility is determined by layer order
* ZFighting issues can happen with intersecting elevated lines
* Elevated lines don't cast shadows
Vertical offset from ground, in meters. Not supported for globe projection at the moment.

#### Type
`number`
Expand Down
44 changes: 44 additions & 0 deletions docs/ModelLayer.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ Customizable style attributes

* <a href="#visibility">visibility</a><br/>
* <a href="#modelid">modelId</a><br/>
* <a href="#modelallowdensityreduction">modelAllowDensityReduction</a><br/>
* <a href="#modelopacity">modelOpacity</a><br/>
* <a href="#modelrotation">modelRotation</a><br/>
* <a href="#modelscale">modelScale</a><br/>
Expand All @@ -152,6 +153,7 @@ Customizable style attributes
* <a href="#modelroughness">modelRoughness</a><br/>
* <a href="#modelheightbasedemissivestrengthmultiplier">modelHeightBasedEmissiveStrengthMultiplier</a><br/>
* <a href="#modelcutofffaderange">modelCutoffFadeRange</a><br/>
* <a href="#modelelevationreference">modelElevationReference</a><br/>

___

Expand Down Expand Up @@ -197,6 +199,23 @@ Model to render. It can be either a string referencing an element to the models

Parameters: `zoom, feature`

___

### modelAllowDensityReduction
Name: `modelAllowDensityReduction`

Mapbox spec: [model-allow-density-reduction](https://docs.mapbox.com/style-spec/reference/layers/#layout-model-model-allow-density-reduction)

#### Description
If true, the models will be reduced in density based on the zoom level. This is useful for large datasets that may be slow to render.

#### Type
`boolean`
#### Default Value
`true`



___

### modelOpacity
Expand Down Expand Up @@ -704,3 +723,28 @@ This parameter defines the range for the fadeOut effect before an automatic cont

Parameters: ``

___

### modelElevationReference
Name: `modelElevationReference`

Mapbox spec: [model-elevation-reference](https://docs.mapbox.com/style-spec/reference/layers/#paint-model-model-elevation-reference)

#### Description
Selects the base of the model. Some modes might require precomputed elevation data in the tileset. When using vector tiled source as the model layer source and hdRoadMarkup elevation reference, this property acts as layout property and elevation is evaluated only in tile loading time.

#### Type
`enum`
#### Default Value
`ground`

#### Supported Values
**sea** - Elevated rendering is enabled. Use this mode to elevate models relative to the sea level.<br />
**ground** - Elevated rendering is enabled. Use this mode to elevate models relative to the ground's height below them.<br />
**hd-road-markup** - Elevated rendering is enabled. Use this mode to describe additive and stackable features that should exist only on top of road polygons.<br />


#### Expression

Parameters: ``

2 changes: 1 addition & 1 deletion docs/RasterLayer.md
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ Name: `rasterElevation`
Mapbox spec: [raster-elevation](https://docs.mapbox.com/style-spec/reference/layers/#paint-raster-raster-elevation)

#### Description
Specifies an uniform elevation from the ground, in meters.
Defines an uniform elevation from the base specified in rasterElevationReference, in meters.

#### Type
`number`
Expand Down
55 changes: 52 additions & 3 deletions docs/docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,8 @@
"expression": {
"interpolated": true,
"parameters": [
"zoom"
"zoom",
"measure-light"
]
},
"transition": true,
Expand Down Expand Up @@ -3842,7 +3843,7 @@
"type": "number",
"values": [],
"default": 0,
"description": "Vertical offset from ground, in meters. Defaults to 0. This is an experimental property with some known issues:\n * Not supported for globe projection at the moment \n * Elevated line discontinuity is possible on tile borders with terrain enabled \n * Rendering artifacts can happen near line joins and line caps depending on the line styling \n * Rendering artifacts relating to `lineOpacity` and `lineBlur` \n * Elevated line visibility is determined by layer order \n * ZFighting issues can happen with intersecting elevated lines \n * Elevated lines don't cast shadows",
"description": "Vertical offset from ground, in meters. Not supported for globe projection at the moment.",
"requires": [
"lineElevationReference"
],
Expand Down Expand Up @@ -5822,6 +5823,22 @@
"namespace": "layout"
}
},
{
"name": "modelAllowDensityReduction",
"type": "boolean",
"values": [],
"default": true,
"description": "If true, the models will be reduced in density based on the zoom level. This is useful for large datasets that may be slow to render.",
"requires": [],
"disabledBy": [],
"allowedFunctionTypes": [],
"transition": false,
"mbx": {
"fullName": "layout-model-model-allow-density-reduction",
"name": "model-allow-density-reduction",
"namespace": "layout"
}
},
{
"name": "modelOpacity",
"type": "number",
Expand Down Expand Up @@ -6166,6 +6183,38 @@
"name": "model-cutoff-fade-range",
"namespace": "paint"
}
},
{
"name": "modelElevationReference",
"type": "enum",
"values": [
{
"value": "sea",
"doc": "Elevated rendering is enabled. Use this mode to elevate models relative to the sea level."
},
{
"value": "ground",
"doc": "Elevated rendering is enabled. Use this mode to elevate models relative to the ground's height below them."
},
{
"value": "hd-road-markup",
"doc": "Elevated rendering is enabled. Use this mode to describe additive and stackable features that should exist only on top of road polygons."
}
],
"default": "ground",
"description": "Selects the base of the model. Some modes might require precomputed elevation data in the tileset. When using vector tiled source as the model layer source and hdRoadMarkup elevation reference, this property acts as layout property and elevation is evaluated only in tile loading time.",
"requires": [],
"disabledBy": [],
"allowedFunctionTypes": [],
"expression": {
"interpolated": false
},
"transition": false,
"mbx": {
"fullName": "paint-model-model-elevation-reference",
"name": "model-elevation-reference",
"namespace": "paint"
}
}
]
},
Expand Down Expand Up @@ -6931,7 +6980,7 @@
"values": [],
"minimum": 0,
"default": 0,
"description": "Specifies an uniform elevation from the ground, in meters.",
"description": "Defines an uniform elevation from the base specified in rasterElevationReference, in meters.",
"requires": [],
"disabledBy": [],
"allowedFunctionTypes": [],
Expand Down
24 changes: 23 additions & 1 deletion ios/RNMBX/RNMBXStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -798,7 +798,9 @@ func modelLayer(layer: inout ModelLayer, reactStyle:Dictionary<String, Any>, old

let styleValue = RNMBXStyleValue.make(reactStyle[prop])

if (prop == "visibility") {
if (prop == "modelAllowDensityReduction") {
self.setModelAllowDensityReduction(&layer, styleValue:styleValue);
} else if (prop == "visibility") {
self.setModelStyleLayerVisibility(&layer, styleValue:styleValue);
} else if (prop == "modelId") {
self.setModelId(&layer, styleValue:styleValue);
Expand Down Expand Up @@ -850,6 +852,8 @@ func modelLayer(layer: inout ModelLayer, reactStyle:Dictionary<String, Any>, old
self.setModelHeightBasedEmissiveStrengthMultiplierTransition(&layer, styleValue:styleValue);
} else if (prop == "modelCutoffFadeRange") {
self.setModelCutoffFadeRange(&layer, styleValue:styleValue);
} else if (prop == "modelElevationReference") {
self.setModelElevationReference(&layer, styleValue:styleValue);
} else {
Logger.log(level:.error, message: "Unexpected property \(prop) for layer: model")
}
Expand Down Expand Up @@ -3057,6 +3061,15 @@ func setHillshadeAccentColorTransition(_ layer: inout HillshadeLayer, styleValue



func setModelAllowDensityReduction(_ layer: inout ModelLayer, styleValue: RNMBXStyleValue)
{


layer.modelAllowDensityReduction = styleValue.mglStyleValueBoolean();


}

func setModelStyleLayerVisibility(_ layer: inout ModelLayer, styleValue: RNMBXStyleValue)
{
layer.visibility = styleValue.isVisible();
Expand Down Expand Up @@ -3247,6 +3260,15 @@ func setModelCutoffFadeRange(_ layer: inout ModelLayer, styleValue: RNMBXStyleVa

}

func setModelElevationReference(_ layer: inout ModelLayer, styleValue: RNMBXStyleValue)
{


layer.modelElevationReference = styleValue.mglStyleValueEnum();


}



func setBackgroundStyleLayerVisibility(_ layer: inout BackgroundLayer, styleValue: RNMBXStyleValue)
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@
},
"homepage": "https://github.com/rnmapbox/maps#readme",
"mapbox": {
"ios": "~> 11.16.2",
"android": "11.16.2"
"ios": "~> 11.18.2",
"android": "11.18.2"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
Expand Down
4 changes: 2 additions & 2 deletions plugin/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ After installing this package, add the [config plugin](https://docs.expo.io/guid
[
"@rnmapbox/maps",
{
"RNMapboxMapsVersion": "11.13.4"
"RNMapboxMapsVersion": "11.18.2"
}
]
]
Expand Down Expand Up @@ -58,7 +58,7 @@ It's possible to overwrite the native SDK version with `RNMapboxMapsVersion`:
[
"@rnmapbox/maps",
{
"RNMapboxMapsVersion": "11.16.0"
"RNMapboxMapsVersion": "11.18.2"
}
]
]
Expand Down
Loading
Loading