|
@@ -109,31 +109,44 @@ export default {
|
|
|
// "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiIwYTQwNDk3MC05YTZkLTQ2ZTEtODc0MS1lZTFkYjFlOTFmNmQiLCJpZCI6MTcyNDQ1LCJpYXQiOjE3NTQ4ODA4MzF9.KnhENYiHxNwTkhTWRA-lHqG59coLVT2FsIyOru2TV3E";
|
|
|
const box = document.getElementById("cesiumContainer");
|
|
|
const viewer = new Cesium.Viewer(box, {
|
|
|
- animation: false, //是否创建动画小器件,左下角仪表
|
|
|
- baseLayerPicker: false, //是否显示图层选择器,右上角图层选择按钮
|
|
|
- baseLayer: false, // 不显示默认图层
|
|
|
- fullscreenButton: false, //是否显示全屏按钮,右下角全屏选择按钮
|
|
|
- timeline: false, //是否显示时间轴
|
|
|
- infoBox: false, //是否显示信息框
|
|
|
- sceneModePicker: false, //是否显示场景模式切换按钮
|
|
|
+ // animation: false, //是否创建动画小器件,左下角仪表
|
|
|
+ // baseLayerPicker: false, //是否显示图层选择器,右上角图层选择按钮
|
|
|
+ // baseLayer: false, // 不显示默认图层
|
|
|
+ // fullscreenButton: false, //是否显示全屏按钮,右下角全屏选择按钮
|
|
|
+ // timeline: false, //是否显示时间轴
|
|
|
+ // infoBox: false, //是否显示信息框
|
|
|
+ // sceneModePicker: false, //是否显示场景模式切换按钮
|
|
|
+ // vrButton: false,
|
|
|
+ // geocoder: false, //是否显示地理编码按钮
|
|
|
+ // homeButton: false, //是否显示地图导航按钮
|
|
|
+ // selectionIndicator: false,
|
|
|
+ // navigationHelpButton: false,
|
|
|
+ // shouldAnimate: true,
|
|
|
+ // imageryProvider: false, //控制默认底图的显示
|
|
|
+ // showGroundAtmosphere: false,
|
|
|
+ // depthTestAgainstTerrain: true,
|
|
|
+ // dynamicAtmosphereLightingFromSun: false,
|
|
|
+ geocoder: false, // 地址搜索控件
|
|
|
+ homeButton: false, // 返回地图初始位置控件
|
|
|
+ infoBox: false, // 地图默认的信息控件
|
|
|
+ sceneModePicker: false, // 场景模式切换控件
|
|
|
+ baseLayerPicker: false, // 底图切换控件
|
|
|
+ navigationHelpButton: false, // 帮助控件
|
|
|
+ animation: false, // 动画控制控件
|
|
|
+ timeline: false, // 时间线控件
|
|
|
+ fullscreenButton: false, // 全屏按钮控件
|
|
|
+ // imageryProvider: true, // 是否显示 Cesium 默认地图的底图
|
|
|
vrButton: false,
|
|
|
- geocoder: false, //是否显示地理编码按钮
|
|
|
- homeButton: false, //是否显示地图导航按钮
|
|
|
selectionIndicator: false,
|
|
|
- navigationHelpButton: false,
|
|
|
shouldAnimate: true,
|
|
|
- imageryProvider: false, //控制默认底图的显示
|
|
|
- showGroundAtmosphere: false,
|
|
|
- depthTestAgainstTerrain: true,
|
|
|
- dynamicAtmosphereLightingFromSun: false,
|
|
|
});
|
|
|
|
|
|
- const url =
|
|
|
- "https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer";
|
|
|
- const layer = Cesium.ImageryLayer.fromProviderAsync(
|
|
|
- Cesium.ArcGisMapServerImageryProvider.fromUrl(url)
|
|
|
- );
|
|
|
- viewer.imageryLayers.add(layer);
|
|
|
+ // const url =
|
|
|
+ // "https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer";
|
|
|
+ // const layer = Cesium.ImageryLayer.fromProviderAsync(
|
|
|
+ // Cesium.ArcGisMapServerImageryProvider.fromUrl(url)
|
|
|
+ // );
|
|
|
+ // viewer.imageryLayers.add(layer);
|
|
|
|
|
|
viewer._cesiumWidget._creditContainer.style.display = "none";
|
|
|
viewer.scene.globe.enableLighting = false;
|
|
@@ -195,6 +208,8 @@ export default {
|
|
|
viewer.scene.light = directionalLight;
|
|
|
|
|
|
this.viewer = viewer;
|
|
|
+ this.cityModel();
|
|
|
+
|
|
|
},
|
|
|
|
|
|
// 生成随机数
|
|
@@ -209,6 +224,22 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
|
|
|
+ async cityModel() {
|
|
|
+ // 添加OSM建筑 3D 模型
|
|
|
+ try {
|
|
|
+ Cesium.createOsmBuildingsAsync().then((buildings) => {
|
|
|
+ this.viewer.scene.primitives.add(buildings);
|
|
|
+ });
|
|
|
+
|
|
|
+ this.viewer.terrainProvider = await Cesium.createWorldTerrainAsync({
|
|
|
+ requestVertexNormals: true,
|
|
|
+ requestWaterMask: true,
|
|
|
+ });
|
|
|
+ } catch (e) {
|
|
|
+ console.log("error", e);
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
getWtStatue(code) {
|
|
|
if (code === 1) {
|
|
|
return "#fff";
|