0

我在 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 插件不支持此功能,如天空层?某处是否存在一些好的例子?

4

1 回答 1

1

The Qt Location MapboxGL plugin is based on the https://github.com/mapbox/mapbox-gl-native project, and supports all the features that are supported by that project, which stopped getting new features in the beginning of 2020. So the answer is no, the plugin does not support 3d terrain.

于 2022-01-28T12:52:58.300 回答