我在 Mapbox Studio 中使用 3D 地形创建了自定义地图样式,它在 Studio 中看起来不错:
但是在 QML 应用程序中没有 3D 地形,地图仍然是平面和 2D:
我们唯一能做 3D 的就是3d-buildings
图层,见下面使用的代码:
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtLocation 5.15
import QtPositioning 5.15
import "../helper.js" as Helper
//! [top]
Map {
id: map
plugin: Plugin {
name: "mapboxgl"
PluginParameter {
name: "mapboxgl.access_token";
value: "pk.eyJ1IjoidGFudHJpZG8iLCJhIjoiY2tlYnB0YWo0MGFpczJzcnZubHRlNTAwbiJ9.6QG-4BeuCpUjaawDiyyfVg"
}
PluginParameter {
name: "mapboxgl.mapping.additional_style_urls";
value: "mapbox://styles/tantrido/ckyuch3ub001q16ofjwsxnlz6"
}
}
MapParameter {
type: "layer"
property var name: "3d-buildings"
property var source: "composite"
property var sourceLayer: "building"
property var layerType: "fill-extrusion"
property var minzoom: 15.0
}
MapParameter {
type: "filter"
property var layer: "3d-buildings"
property var filter: [ "==", "extrude", "true" ]
}
MapParameter {
type: "paint"
property var layer: "3d-buildings"
property var fillExtrusionColor: "#55aaff"
property var fillExtrusionOpacity: .6
property var fillExtrusionHeight: { return { type: "identity", property: "height" } }
property var fillExtrusionBase: { return { type: "identity", property: "min_height" } }
}
...
}
是否可以向 Qt 5.15 QML 应用程序添加一些MapParameter
(s)或PluginParameter
(s)以启用 3D 地形,或者 Qt Location Mapbox GL 插件不支持此功能,如天空层?某处是否存在一些好的例子?