|
@@ -109,112 +109,89 @@
|
|
|
},
|
|
|
methods: {
|
|
|
flyto(num) {
|
|
|
- store.isflyto = true
|
|
|
- console.log(store.isflyto)
|
|
|
+ let that = this
|
|
|
let PointObject = new this.jt3dSDK.PointObject(window.viewer);
|
|
|
- PointObject.addPoint([120.623, 36.9157,1800]).then(res1 => {
|
|
|
+ var LocateUtil = new this.jt3dSDK.LocateUtil(window["viewer"]);
|
|
|
+ let Drawtools = new this.jt3dSDK.DrawTools(window.viewer)
|
|
|
+ //_createCircle
|
|
|
+ PointObject.addBillboard([120.623, 36.9157, 0], {
|
|
|
+ billboard: {
|
|
|
+ imgUrl: 'jt3dSDK/imgs/jijing1.png',
|
|
|
+ scale: 0.2,
|
|
|
+ }
|
|
|
+ }).then(res1 => {
|
|
|
var LocateUtil = new this.jt3dSDK.LocateUtil(window["viewer"]);
|
|
|
LocateUtil.flyToEntity(res1).then(res2 => {
|
|
|
- console.log('定位成功')
|
|
|
+ let html = "";
|
|
|
+ html +=
|
|
|
+ "<div style='text-align: left;backfround-color:rgba(61, 198, 205, 0.6);width:300rem;height:150rem;font-family: TTTGB-Medium, sans-serif !important;'>";
|
|
|
+ html +=
|
|
|
+ "<div style='background-color: rgba(61, 198, 255, 0.4);line-height:30rem;height:30rem;margin:0;'>" +
|
|
|
+ "<span style='width:100rem'>设备名称:</span>" + "<span>机井</span>" +
|
|
|
+ "</div>";
|
|
|
+ html +=
|
|
|
+ "<div style='background-color: rgba(0, 37, 98, 0.4);line-height:30rem;height:30rem;margin:0'>" +
|
|
|
+ "<span style='width:100rem'>设备编号:</span>" + "<span>05</span>" +
|
|
|
+ "</div>";
|
|
|
+ html +=
|
|
|
+ "<div style='background-color: rgba(61, 198, 255, 0.4);line-height:30rem;height:30rem;margin:0'>" +
|
|
|
+ "<span style='width:100rem'>电流:</span>" + "<span>10A</span>" +
|
|
|
+ "</div>";
|
|
|
+ html +=
|
|
|
+ "<div style='background-color: rgba(0, 37, 98, 0.4);line-height:30rem;height:30rem;margin:0'>" +
|
|
|
+ "<span style='width:100rem'>压力:</span>" + "<span>20Kpa</span>" +
|
|
|
+ "</div>";
|
|
|
+ html +=
|
|
|
+ "<div style='background-color: rgba(61, 198, 255, 0.4);line-height:30rem;height:30rem;margin:0'>" +
|
|
|
+ "<span style='width:100rem'>流量:</span>" + "<span>80m³/h</span>" +
|
|
|
+ "</div>";
|
|
|
+ html += "</div>";
|
|
|
+ let popup = new that.jt3dSDK.PopupWindow.HtmlWindow(window["viewer"], [120.623,
|
|
|
+ 36.9157
|
|
|
+ ], "设备信息", html, 50);
|
|
|
+ // this.createCircle()
|
|
|
+ // Drawtools._createCircle( Cesium.Cartesian3.fromDegrees(120.623, 36.9157),'dynamicCircle')
|
|
|
})
|
|
|
})
|
|
|
- // let that = this
|
|
|
- // that.entity1 = new Cesium.Entity({
|
|
|
- // name: "add billboard",
|
|
|
- // //位置
|
|
|
- // position: Cesium.Cartesian3.fromDegrees(120.623, 36.9157, 100),
|
|
|
- // //图片标签
|
|
|
- // billboard: {
|
|
|
- // image: 'jt3dSDK/imgs/jijing1.png',
|
|
|
- // horizontalOrigin: Cesium.HorizontalOrigin.CENTER, //水平
|
|
|
- // verticalOrigin: Cesium.VerticalOrigin.BOTTOM, //垂直位置
|
|
|
- // // scale: billboard.scale, //尺寸
|
|
|
- // // pixelOffset: new Cesium.Cartesian2(0, billboard.pixelOffset),
|
|
|
- // disableDepthTestDistance: Number.POSITIVE_INFINITY,
|
|
|
- // scale: 0.2,
|
|
|
- // scaleByDistance: new Cesium.NearFarScalar(1.5e2, 1, 2400,
|
|
|
- // 1
|
|
|
- // ) //按距离缩放,即距离大于180米时,图标不显示 Cesium.NearFarScalar(near, nearValue, far, farValue)相机范围的下界。相机范围下界的值。相机范围的上限。该值位于摄像机范围的上界。
|
|
|
- // }
|
|
|
- // });
|
|
|
- // let flytopromise = window.viewer.flyTo(that.entity1, {
|
|
|
- // duration: 5.0,
|
|
|
- // maximumHeight: 1500
|
|
|
- // })
|
|
|
- // flytopromise.then(res => {
|
|
|
- // console.log('定位结束' + res)
|
|
|
- // })
|
|
|
- // var entity = jt3d._viewer.entities.add(that.entity1, {
|
|
|
- // // range: 1000
|
|
|
- // });
|
|
|
- // let terrainProvider = jt3d._viewer.terrainProvider;
|
|
|
- // //异步函数
|
|
|
- // let lon = 116.30
|
|
|
- // let lat = 36.88
|
|
|
- // let that = this
|
|
|
- // if (that.entity1) {
|
|
|
- // jt3d._viewer.entities.remove(that.entity1)
|
|
|
- // }
|
|
|
- // // if that.entity && jt3d._viewer.entities.remove(that.entity)
|
|
|
- // // console.log('高度', updatedPositions)
|
|
|
- // let height = 1000
|
|
|
|
|
|
- // 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)相机范围的下界。相机范围下界的值。相机范围的上限。该值位于摄像机范围的上界。
|
|
|
- // }
|
|
|
- // });
|
|
|
- // // var entity = jt3d._viewer.entities.add(that.entity1, {
|
|
|
- // // // range: 1000
|
|
|
- // // });
|
|
|
- // // jt3d.LocateUtil.flyToEntity(that.entity)
|
|
|
- // let flytopromise = jt3d._viewer.flyTo(that.entity1, {
|
|
|
- // duration: 5.0,
|
|
|
- // maximumHeight: 1500
|
|
|
- // })
|
|
|
- // flytopromise.then(res => {
|
|
|
- // console.log('定位结束' + res)
|
|
|
- // })
|
|
|
- // jt3d._viewer.camera.flyTo({
|
|
|
- // destination: Cesium.Cartesian3.fromDegrees(120.623, 36.9157, 1500)
|
|
|
- // });
|
|
|
+ //====实现
|
|
|
+ /* let PointObject = new this.jt3dSDK.PointObject(window.viewer);
|
|
|
+ var LocateUtil = new this.jt3dSDK.LocateUtil(window["viewer"]);
|
|
|
+ PointObject.addPoint([120.623, 36.9157, 1800]).then(res1 => {
|
|
|
+ console.log('res',res1)
|
|
|
+ LocateUtil.flyToEntity(res1).then(res2 => {
|
|
|
+ console.log('定位成功', res2)
|
|
|
+ })
|
|
|
+ }) */
|
|
|
+
|
|
|
+ },
|
|
|
+ //创建动态圆
|
|
|
+ createCircle() {
|
|
|
+
|
|
|
+ //定义中心和半径
|
|
|
+ let entity = jt3d._viewer.entities.add({
|
|
|
+ position: Cesium.Cartesian3.fromDegrees(120.623, 36.9157),
|
|
|
+ name: 'Dynamic Circle',
|
|
|
+ description: 'A dynamic circle.',
|
|
|
+ });
|
|
|
|
|
|
+ // // 添加动态圆形
|
|
|
+ // 添加静态圆形
|
|
|
+ var radius = 100;
|
|
|
+ var vertexFormat = Cesium.VertexFormat.POSITION_ONLY;
|
|
|
|
|
|
- // let lng = Number(114.22) + Number(num)
|
|
|
- // this.entity = new Cesium.Entity({
|
|
|
- // name: "add billboard",
|
|
|
- // //位置
|
|
|
- // position: Cesium.Cartesian3.fromDegrees(116.33, 37.66, 500),
|
|
|
- // //图片标签
|
|
|
- // 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)相机范围的下界。相机范围下界的值。相机范围的上限。该值位于摄像机范围的上界。
|
|
|
- // }
|
|
|
- // });
|
|
|
+ var circleGeometry = new Cesium.CircleGeometry({
|
|
|
+ center: entity.position.getValue(), // 圆心位置
|
|
|
+ radius: radius,
|
|
|
+ vertexFormat: vertexFormat
|
|
|
+ });
|
|
|
|
|
|
- // jt3d._viewer.entities.add(this.entity, {
|
|
|
- // range: 1000
|
|
|
- // });
|
|
|
+ var geometry = Cesium.CircleGeometry.createGeometry(circleGeometry);
|
|
|
|
|
|
+ entity.polygon = new Cesium.PolygonGraphics();
|
|
|
+ entity.polygon.hierarchy = new Cesium.PolygonHierarchy(geometry);
|
|
|
+ entity.polygon.material = Cesium.Material.fromType(Cesium.Material.ColorType);
|
|
|
+ entity.polygon.material.uniforms.color = new Cesium.Color(1.0, 0.0, 0.0, 0.5);
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|