相关api文档:
Global - V3.7.23 - Mars3D API文档
Global - V3.7.23 - Mars3D API文档
ArcGisWfsLayer - V3.7.23 - Mars3D API文档
实现代码:
export function onMounted(mapInstance) {
map = mapInstance // 记录首次创建的map
// 添加参考三维模型
const tiles3dLayer = new mars3d.layer.TilesetLayer({
name: "合肥国家大学科技园",
url: "//data.mars3d.cn/3dtiles/qx-hfdxy/tileset.json",
position: { alt: 80 },
maximumScreenSpaceError: 1
})
map.addLayer(tiles3dLayer)
const graphicLayer = new mars3d.layer.ArcGisWfsLayer({
name: "兴趣点",
url: "//server.mars3d.cn/arcgis/rest/services/mars/hefei/MapServer/1",
where: " NAME like '%大学%' ",
minimumLevel: 15,
symbol: {
type: "billboardP",
styleOptions: {
image: "img/marker/mark-blue.png",
verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
label: {
text: "{NAME}",
font_size: 15,
color: "#ffffff",
outline: true,
outlineColor: "#000000",
pixelOffsetY: -30
}
}
},
clustering: {
enabled: true,
pixelRange: 20,
},
popup: "名称:{NAME}<br />地址:{address}",
show: true
})
graphicLayer.on(mars3d.EventType.addGraphic, function (event) {
updateAutoSurfaceHeight(event.graphic)
})
map.on(mars3d.EventType.load, function (event) {
map.addLayer(graphicLayer)
})
}