diff options
author | Thiago Marcos P. Santos <thiago@mapbox.com> | 2017-04-28 21:53:25 +0300 |
---|---|---|
committer | Thiago Marcos P. Santos <tmpsantos@gmail.com> | 2017-05-02 10:07:02 +0300 |
commit | 18c52ab5e406e2d22cd99d0bbb09d67d51ba0e65 (patch) | |
tree | 6080b5d9c7ea6e001bd48afb6b1d89ffcb635768 /platform | |
parent | 184a4389e16b1ba43cf130a0859b87708ed8630f (diff) | |
download | qtlocation-mapboxgl-18c52ab5e406e2d22cd99d0bbb09d67d51ba0e65.tar.gz |
[Qt] Add extrusion example to the Qt app
Diffstat (limited to 'platform')
-rw-r--r-- | platform/qt/app/mapwindow.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/platform/qt/app/mapwindow.cpp b/platform/qt/app/mapwindow.cpp index 345c5196ba..a72faf005e 100644 --- a/platform/qt/app/mapwindow.cpp +++ b/platform/qt/app/mapwindow.cpp @@ -201,6 +201,40 @@ void MapWindow::keyPressEvent(QKeyEvent *ev) m_map->setLayoutProperty("road-label-small", "text-pitch-alignment", "viewport"); m_map->setLayoutProperty("road-label-small", "text-size", 30.0); + + // Buildings extrusion + QVariantMap buildings; + buildings["id"] = "3d-buildings"; + buildings["source"] = "composite"; + buildings["source-layer"] = "building"; + buildings["type"] = "fill-extrusion"; + buildings["minzoom"] = 15.0; + m_map->addLayer(buildings); + + QVariantList buildingsFilterExpression; + buildingsFilterExpression.append("=="); + buildingsFilterExpression.append("extrude"); + buildingsFilterExpression.append("true"); + + QVariantList buildingsFilter; + buildingsFilter.append(buildingsFilterExpression); + + m_map->setFilter("3d-buildings", buildingsFilterExpression); + + m_map->setPaintProperty("3d-buildings", "fill-extrusion-color", "#aaa"); + m_map->setPaintProperty("3d-buildings", "fill-extrusion-opacity", .6); + + QVariantMap extrusionHeight; + extrusionHeight["type"] = "identity"; + extrusionHeight["property"] = "height"; + + m_map->setPaintProperty("3d-buildings", "fill-extrusion-height", extrusionHeight); + + QVariantMap extrusionBase; + extrusionBase["type"] = "identity"; + extrusionBase["property"] = "min_height"; + + m_map->setPaintProperty("3d-buildings", "fill-extrusion-base", extrusionBase); } break; case Qt::Key_1: { |