Skip to content

Commit

Permalink
Expose fill-extrusion-line-width (#2294)
Browse files Browse the repository at this point in the history
  • Loading branch information
evil159 committed Sep 10, 2024
1 parent 0ce96e6 commit e68d2e7
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,18 +98,24 @@ final class BuildingExtrusionsExample: UIViewController, ExampleProtocol {

// See https://docs.mapbox.com/mapbox-gl-js/example/3d-buildings/ for equivalent gl-js example
internal func addBuildingExtrusions() {
let wallOnlyThreshold = 20
let extrudeFilter = Exp(.eq) {
Exp(.get) { "extrude" }
"true"
}
var layer = FillExtrusionLayer(id: "3d-buildings", source: "composite")

layer.minZoom = 15
layer.sourceLayer = "building"
layer.fillExtrusionColor = .constant(StyleColor(.lightGray))
layer.fillExtrusionOpacity = .constant(0.6)

layer.filter = Exp(.eq) {
Exp(.get) {
"extrude"
layer.filter = Exp(.all) {
extrudeFilter
Exp(.gt) {
Exp(.get) { "height" }
wallOnlyThreshold
}
"true"
}

layer.fillExtrusionHeight = .expression(
Expand Down Expand Up @@ -140,6 +146,20 @@ final class BuildingExtrusionsExample: UIViewController, ExampleProtocol {
layer.fillExtrusionAmbientOcclusionRadius = .constant(3.0)

try! mapView.mapboxMap.addLayer(layer)

var wallsOnlyExtrusionLayer = layer
wallsOnlyExtrusionLayer.id = "3d-buildings-wall"
wallsOnlyExtrusionLayer.filter = Exp(.all) {
extrudeFilter
Exp(.lte) {
Exp(.get) { "height" }
wallOnlyThreshold
}
}

wallsOnlyExtrusionLayer.fillExtrusionLineWidth = .constant(2)

try! mapView.mapboxMap.addLayer(wallsOnlyExtrusionLayer)
}

// MARK: - Actions
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

Mapbox welcomes participation and contributions from everyone.

## main

* Add experimental `FillExtrusionLayer.fillExtrusionLineWidth` that can switches fill extrusion rendering into wall rendering mode. Use this property to render the feature with the given width over the outlines of the geometry.

## 11.7.0-beta.1 - 30 August, 2024

* Expose data-driven properties on annotation managers. Now it's possible to set data-driven properties globally on annotation manager and specify per-annotation overrides.
Expand Down
38 changes: 38 additions & 0 deletions Sources/MapboxMaps/Style/Generated/Layers/FillExtrusionLayer.swift

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e68d2e7

Please sign in to comment.