|
|
@@ -7,7 +7,12 @@
|
|
|
<script>
|
|
|
import * as Cesium from "../../Cesium";
|
|
|
import "../../Cesium/Widgets/widgets.css";
|
|
|
+import nxGeoJson from "../../assets/geoJson/nxgeo.json";
|
|
|
export default {
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ }
|
|
|
+ },
|
|
|
mounted() {
|
|
|
this.initCesium();
|
|
|
},
|
|
|
@@ -54,20 +59,48 @@ export default {
|
|
|
requestVertexNormals: true,
|
|
|
});
|
|
|
viewer.camera.flyTo({
|
|
|
- destination: Cesium.Cartesian3.fromDegrees(106.231729, 38.485199, 1000),
|
|
|
+ destination: Cesium.Cartesian3.fromDegrees(106.53, 37.66, 2000),
|
|
|
orientation: {
|
|
|
heading: 4.399419347553678,
|
|
|
- pitch: 0.1699544300063054,
|
|
|
+ pitch: 0.0699544300063054,
|
|
|
roll: 6.28315827512673,
|
|
|
},
|
|
|
duration: 3,
|
|
|
});
|
|
|
|
|
|
+ // 添加一些3D模型
|
|
|
+ this.addModel(
|
|
|
+ viewer,
|
|
|
+ "./static/model/fjSolo/model.glb",
|
|
|
+ "风机",
|
|
|
+ 106.43,
|
|
|
+ 37.64
|
|
|
+ );
|
|
|
+
|
|
|
setTimeout(() => {
|
|
|
this.addLigh(viewer);
|
|
|
}, 3000);
|
|
|
|
|
|
},
|
|
|
+ addModel(viewer, uri, name, lon, lat) {
|
|
|
+ const hpRoll = new Cesium.HeadingPitchRoll(90.0, 0.0, 0.0);
|
|
|
+ const position = Cesium.Cartesian3.fromDegrees(lon, lat);
|
|
|
+ const orientation = Cesium.Transforms.headingPitchRollQuaternion(
|
|
|
+ position,
|
|
|
+ hpRoll
|
|
|
+ );
|
|
|
+ viewer.entities.add({
|
|
|
+ name, // 模型名称
|
|
|
+ position, // 模型位置
|
|
|
+ orientation, // 模型朝向
|
|
|
+ model: {
|
|
|
+ uri,
|
|
|
+ scale: 0.5,
|
|
|
+ // 模型贴地
|
|
|
+ heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
|
|
|
+ },
|
|
|
+ });
|
|
|
+ },
|
|
|
async addLigh(viewer) {
|
|
|
const fragmentShader = `
|
|
|
uniform sampler2D colorTexture;
|