|
@@ -115,47 +115,62 @@
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
flyto(num) {
|
|
flyto(num) {
|
|
|
|
+ return
|
|
let terrainProvider = jt3d._viewer.terrainProvider;
|
|
let terrainProvider = jt3d._viewer.terrainProvider;
|
|
//异步函数
|
|
//异步函数
|
|
let lon = 116.30
|
|
let lon = 116.30
|
|
let lat = 36.88
|
|
let lat = 36.88
|
|
let that = this
|
|
let that = this
|
|
- return new Promise((resolve, reject) => {
|
|
|
|
- let promise = new Cesium.sampleTerrainMostDetailed(terrainProvider, [Cesium
|
|
|
|
- .Cartographic.fromDegrees(lon, lat)
|
|
|
|
- ]);
|
|
|
|
- promise.then(function(updatedPositions) {
|
|
|
|
- if (that.entity) {
|
|
|
|
- jt3d._viewer.entities.remove(that.entity)
|
|
|
|
- }
|
|
|
|
- // if that.entity && jt3d._viewer.entities.remove(that.entity)
|
|
|
|
- console.log('高度', updatedPositions)
|
|
|
|
- let height = 1000
|
|
|
|
|
|
+ if (that.entity) {
|
|
|
|
+ jt3d._viewer.entities.remove(that.entity)
|
|
|
|
+ }
|
|
|
|
+ // if that.entity && jt3d._viewer.entities.remove(that.entity)
|
|
|
|
+ // console.log('高度', updatedPositions)
|
|
|
|
+ let height = 1000
|
|
|
|
|
|
- that.entity = new Cesium.Entity({
|
|
|
|
- name: "add billboard",
|
|
|
|
- //位置
|
|
|
|
- position: Cesium.Cartesian3.fromDegrees(lon, lat, height),
|
|
|
|
- //图片标签
|
|
|
|
- billboard: {
|
|
|
|
- image: 'jt3dSDK/imgs/point/point.png',
|
|
|
|
- horizontalOrigin: Cesium.HorizontalOrigin.CENTER, //水平
|
|
|
|
- verticalOrigin: Cesium.VerticalOrigin.BOTTOM, //垂直位置
|
|
|
|
- // scale: billboard.scale, //尺寸
|
|
|
|
- // pixelOffset: new Cesium.Cartesian2(0, billboard.pixelOffset),
|
|
|
|
- disableDepthTestDistance: Number.POSITIVE_INFINITY,
|
|
|
|
- scale: 1,
|
|
|
|
- scaleByDistance: new Cesium.NearFarScalar(1.5e2, 1, 2400,
|
|
|
|
- 0) //按距离缩放,即距离大于180米时,图标不显示 Cesium.NearFarScalar(near, nearValue, far, farValue)相机范围的下界。相机范围下界的值。相机范围的上限。该值位于摄像机范围的上界。
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- jt3d._viewer.entities.add(that.entity, {
|
|
|
|
- range: 1000
|
|
|
|
- });
|
|
|
|
- jt3d.LocateUtil.flyToEntity(that.entity)
|
|
|
|
|
|
+ that.entity1 = new Cesium.Entity({
|
|
|
|
+ name: "add billboard",
|
|
|
|
+ //位置
|
|
|
|
+ position: Cesium.Cartesian3.fromDegrees(120.623, 36.9157, 100),
|
|
|
|
+ //图片标签
|
|
|
|
+ billboard: {
|
|
|
|
+ image: 'jt3dSDK/imgs/point/point.png',
|
|
|
|
+ horizontalOrigin: Cesium.HorizontalOrigin.CENTER, //水平
|
|
|
|
+ verticalOrigin: Cesium.VerticalOrigin.BOTTOM, //垂直位置
|
|
|
|
+ // scale: billboard.scale, //尺寸
|
|
|
|
+ // pixelOffset: new Cesium.Cartesian2(0, billboard.pixelOffset),
|
|
|
|
+ disableDepthTestDistance: Number.POSITIVE_INFINITY,
|
|
|
|
+ scale: 1,
|
|
|
|
+ // scaleByDistance: new Cesium.NearFarScalar(1.5e2, 1, 2400,
|
|
|
|
+ // 0
|
|
|
|
+ // ) //按距离缩放,即距离大于180米时,图标不显示 Cesium.NearFarScalar(near, nearValue, far, farValue)相机范围的下界。相机范围下界的值。相机范围的上限。该值位于摄像机范围的上界。
|
|
|
|
+ }
|
|
|
|
+ // point:{
|
|
|
|
+ // pixelSize:20,
|
|
|
|
+ // color:Cesium.Color.RED,
|
|
|
|
+ // }
|
|
|
|
+ });
|
|
|
|
+ var entity = jt3d._viewer.entities.add(that.entity1, {
|
|
|
|
+ // range: 1000
|
|
|
|
+ });
|
|
|
|
+ jt3d.LocateUtil.flyToEntity(that.entity)
|
|
|
|
+ setTimeout(res=>{
|
|
|
|
+ console.log('定位')
|
|
|
|
+ console.log('实体', entity)
|
|
|
|
+ jt3d.LocateUtil.flyToEntity(that.entity)
|
|
|
|
+ jt3d._viewer.flyTo(entity,{
|
|
|
|
+ duration:5.0,
|
|
|
|
+ maximumHeight:1500
|
|
|
|
+ }).then(res=>{
|
|
|
|
+ console.log('定位结束' + res)
|
|
|
|
+ }).catch(err=>{
|
|
|
|
+ console.log("err" + err);
|
|
})
|
|
})
|
|
- resolve(true)
|
|
|
|
- })
|
|
|
|
|
|
+ // jt3d._viewer.camera.flyTo({
|
|
|
|
+ // destination : Cesium.Cartesian3.fromDegrees(120.623, 36.9157, 1500)
|
|
|
|
+ // });
|
|
|
|
+ },2000)
|
|
|
|
+
|
|
// let lng = Number(114.22) + Number(num)
|
|
// let lng = Number(114.22) + Number(num)
|
|
// this.entity = new Cesium.Entity({
|
|
// this.entity = new Cesium.Entity({
|
|
// name: "add billboard",
|
|
// name: "add billboard",
|
|
@@ -173,11 +188,11 @@
|
|
// scaleByDistance: new Cesium.NearFarScalar(1.5e2, 1, 2400, 0) //按距离缩放,即距离大于180米时,图标不显示 Cesium.NearFarScalar(near, nearValue, far, farValue)相机范围的下界。相机范围下界的值。相机范围的上限。该值位于摄像机范围的上界。
|
|
// scaleByDistance: new Cesium.NearFarScalar(1.5e2, 1, 2400, 0) //按距离缩放,即距离大于180米时,图标不显示 Cesium.NearFarScalar(near, nearValue, far, farValue)相机范围的下界。相机范围下界的值。相机范围的上限。该值位于摄像机范围的上界。
|
|
// }
|
|
// }
|
|
// });
|
|
// });
|
|
- console.log('实体', this.entity)
|
|
|
|
|
|
+
|
|
// jt3d._viewer.entities.add(this.entity, {
|
|
// jt3d._viewer.entities.add(this.entity, {
|
|
// range: 1000
|
|
// range: 1000
|
|
// });
|
|
// });
|
|
-
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
},
|
|
},
|
|
mounted() {
|
|
mounted() {
|