From b9f68eadd170e469314430d7bbdb4246f65451cd Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Thu, 17 Jun 2021 11:31:31 +0800
Subject: [PATCH] 目录树调整添加图层管理等
---
widgets/ShowPosition/Widget.js | 141 ++++++++++++++++++++++++++---------------------
1 files changed, 78 insertions(+), 63 deletions(-)
diff --git a/widgets/ShowPosition/Widget.js b/widgets/ShowPosition/Widget.js
index f7740b5..460e997 100644
--- a/widgets/ShowPosition/Widget.js
+++ b/widgets/ShowPosition/Widget.js
@@ -10,7 +10,7 @@
'dojo/topic',
'jimu/BaseWidget'
],
- function(declare,
+ function (declare,
lang,
array,
html,
@@ -20,53 +20,56 @@
return declare([BaseWidget], {
baseClass: 'jimu-widget-ShowPosition',
name: 'ShowPosition',
- startup: function() {
+ startup: function () {
this.inherited(arguments);
//显示帧速(FPS)
//this.map.scene.debugShowFramesPerSecond = true;
-
+
// Mouse over the globe to see the cartographic position
- var handler = new Cesium.ScreenSpaceEventHandler(this.map.scene.canvas);
- handler.setInputAction(lang.hitch(this, function(movement) {
- /*if(this.map.scene.globe.depthTestAgainstTerrain==false){
- var ray=this.map.camera.getPickRay(movement.endPosition);
- var cartesian=this.map.scene.globe.pick(ray,this.map.scene);
- var cartographic=Cesium.Cartographic.fromCartesian(cartesian);
- var lng=Cesium.Math.toDegrees(cartographic.longitude);//经度值
- var lat=Cesium.Math.toDegrees(cartographic.latitude);//纬度值 //height结果与cartographic.height相差无几,注意:cartographic.height可以为0,也就是说,可以根据经纬度计算出高程。
- var height=this.map.scene.globe.getHeight(cartographic); //height的值为地形高度。
- //鼠标位置经纬度
- $("#positionSpan").html("鼠标(经度:"+lng.toFixed(6)+"° 纬度:"+lat.toFixed(6)+"° 高度:"+height.toFixed(2)+"m); ");
- }
- else{
- var cartesian = this.map.camera.pickEllipsoid(movement.position, this.map.scene.globe.ellipsoid);
- var posit = this.map.scene.pickPosition(movement.position);
- var cartographic = Cesium.Cartographic.fromCartesian(posit);
- var currentClickLon = Cesium.Math.toDegrees(cartographic.longitude);
- var currentClickLat = Cesium.Math.toDegrees(cartographic.latitude);
- var currentClickHei = cartographic.height;
- //鼠标位置经纬度
- $("#positionSpan").html("鼠标(经度:"+lng.toFixed(6)+"° 纬度:"+lat.toFixed(6)+"° 高度:"+height.toFixed(2)+"m); ");
- }*/
-
- var ray=this.map.camera.getPickRay(movement.endPosition);
- var cartesian=this.map.scene.globe.pick(ray,this.map.scene);
- var cartographic=Cesium.Cartographic.fromCartesian(cartesian);
- var lng=Cesium.Math.toDegrees(cartographic.longitude);//经度值
- var lat=Cesium.Math.toDegrees(cartographic.latitude);//纬度值 //height结果与cartographic.height相差无几,注意:cartographic.height可以为0,也就是说,可以根据经纬度计算出高程。
- var height=this.map.scene.globe.getHeight(cartographic); //height的值为地形高度。
- //鼠标位置经纬度
- $("#positionSpan").html("经度:"+lng.toFixed(6)+" 纬度:"+lat.toFixed(6)+" 高程:"+height.toFixed(2)+"m ");
-
- }), Cesium.ScreenSpaceEventType.MOUSE_MOVE);
-
-
- //相机改变事件
- this.map.camera.changed.addEventListener(lang.hitch(this, function() {
- var cartographic=Cesium.Cartographic.fromCartesian(this.map.camera._positionWC);//使用this.map.camera.position获取相机坐标,在飞行时候会导致实时显示坐标不对
- var lat=Cesium.Math.toDegrees(cartographic.latitude);
- var lng=Cesium.Math.toDegrees(cartographic.longitude);
- var height=cartographic.height;
+ // var handler = new Cesium.ScreenSpaceEventHandler(this.map.scene.canvas);
+ // handler.setInputAction(lang.hitch(this, function(movement) {
+ // // if(this.map.scene.globe.depthTestAgainstTerrain==false){
+ // // var ray=this.map.camera.getPickRay(movement.endPosition);
+ // // var cartesian=this.map.scene.globe.pick(ray,this.map.scene);
+ // // var cartographic=Cesium.Cartographic.fromCartesian(cartesian);
+ // // var lng=Cesium.Math.toDegrees(cartographic.longitude);//经度值
+ // // var lat=Cesium.Math.toDegrees(cartographic.latitude);//纬度值 //height结果与cartographic.height相差无几,注意:cartographic.height可以为0,也就是说,可以根据经纬度计算出高程。
+ // // var height=this.map.scene.globe.getHeight(cartographic); //height的值为地形高度。
+ // // //鼠标位置经纬度
+ // // $("#positionSpan").html("鼠标(经度:"+lng.toFixed(6)+"° 纬度:"+lat.toFixed(6)+"° 高度:"+height.toFixed(2)+"m); ");
+ // // }
+ // // else{
+ // // var cartesian = this.map.camera.pickEllipsoid(movement.position, this.map.scene.globe.ellipsoid);
+ // // var posit = this.map.scene.pickPosition(movement.position);
+ // // var cartographic = Cesium.Cartographic.fromCartesian(posit);
+ // // var currentClickLon = Cesium.Math.toDegrees(cartographic.longitude);
+ // // var currentClickLat = Cesium.Math.toDegrees(cartographic.latitude);
+ // // var currentClickHei = cartographic.height;
+ // // //鼠标位置经纬度
+ // // $("#positionSpan").html("鼠标(经度:"+lng.toFixed(6)+"° 纬度:"+lat.toFixed(6)+"° 高度:"+height.toFixed(2)+"m); ");
+ // // }
+
+ // var ray=this.map.camera.getPickRay(movement.endPosition);
+ // var cartesian=this.map.scene.globe.pick(ray,this.map.scene);
+ // var cartographic=Cesium.Cartographic.fromCartesian(cartesian);
+ // var lng=Cesium.Math.toDegrees(cartographic.longitude);//经度值
+ // var lat=Cesium.Math.toDegrees(cartographic.latitude);//纬度值 //height结果与cartographic.height相差无几,注意:cartographic.height可以为0,也就是说,可以根据经纬度计算出高程。
+ // var height=this.map.scene.globe.getHeight(cartographic); //height的值为地形高度。
+
+
+
+ // //鼠标位置经纬度
+ // // $("#positionSpan").html("经度:"+lng.toFixed(6)+" 纬度:"+lat.toFixed(6)+" 高程:"+height.toFixed(2)+"m ");
+
+ // }), Cesium.ScreenSpaceEventType.MOUSE_MOVE);
+
+
+ //相机改变事件
+ this.map.camera.changed.addEventListener(lang.hitch(this, function () {
+ var cartographic = Cesium.Cartographic.fromCartesian(this.map.camera._positionWC); //使用this.map.camera.position获取相机坐标,在飞行时候会导致实时显示坐标不对
+ var lat = Cesium.Math.toDegrees(cartographic.latitude);
+ var lng = Cesium.Math.toDegrees(cartographic.longitude);
+ var height = cartographic.height;
//var cartographic=Cesium.Cartographic.fromCartesian(this.map.camera.position);
//相机位置经纬度
$("#jd").html(lng.toFixed(6));
@@ -75,42 +78,54 @@
$("#phj").html(Cesium.Math.toDegrees(this.map.camera.heading).toFixed(2));
$("#fyj").html(Cesium.Math.toDegrees(this.map.camera.pitch).toFixed(2));
$("#fgj").html(Cesium.Math.toDegrees(this.map.camera.roll).toFixed(2));
- }));
-
-// handler.setInputAction(lang.hitch(this, function(movement) {
-//
-// var ray=this.map.camera.getPickRay(movement.position);
-// var cartesian=this.map.scene.globe.pick(ray,this.map.scene);
-// var cartographic=Cesium.Cartographic.fromCartesian(cartesian);
-// var lng=Cesium.Math.toDegrees(cartographic.longitude).toFixed(6);;//经度值
-// var lat=Cesium.Math.toDegrees(cartographic.latitude).toFixed(6);;//纬度值 //height结果与cartographic.height相差无几,注意:cartographic.height可以为0,也就是说,可以根据经纬度计算出高程。
-//
-// $("#positionDiv").append("["+lng+","+lat+"],");
-// }), Cesium.ScreenSpaceEventType.LEFT_CLICK);
-
+ }));
+
+ // handler.setInputAction(lang.hitch(this, function(movement) {
+ //
+ // var ray=this.map.camera.getPickRay(movement.position);
+ // var cartesian=this.map.scene.globe.pick(ray,this.map.scene);
+ // var cartographic=Cesium.Cartographic.fromCartesian(cartesian);
+ // var lng=Cesium.Math.toDegrees(cartographic.longitude).toFixed(6);;//经度值
+ // var lat=Cesium.Math.toDegrees(cartographic.latitude).toFixed(6);;//纬度值 //height结果与cartographic.height相差无几,注意:cartographic.height可以为0,也就是说,可以根据经纬度计算出高程。
+ //
+ // $("#positionDiv").append("["+lng+","+lat+"],");
+ // }), Cesium.ScreenSpaceEventType.LEFT_CLICK);
+
},
- onOpen: function() {
+ onOpen: function () {
//面板打开的时候触发 (when open this panel trigger)
+ var cartographic = Cesium.Cartographic.fromCartesian(this.map.camera._positionWC); //使用this.map.camera.position获取相机坐标,在飞行时候会导致实时显示坐标不对
+ var lat = Cesium.Math.toDegrees(cartographic.latitude);
+ var lng = Cesium.Math.toDegrees(cartographic.longitude);
+ var height = cartographic.height;
+ //var cartographic=Cesium.Cartographic.fromCartesian(this.map.camera.position);
+ //相机位置经纬度
+ $("#jd").html(lng.toFixed(6));
+ $("#wd").html(lat.toFixed(6));
+ $("#gd").html(height.toFixed(2));
+ $("#phj").html(Cesium.Math.toDegrees(this.map.camera.heading).toFixed(2));
+ $("#fyj").html(Cesium.Math.toDegrees(this.map.camera.pitch).toFixed(2));
+ $("#fgj").html(Cesium.Math.toDegrees(this.map.camera.roll).toFixed(2));
},
- onClose: function() {
+ onClose: function () {
//面板关闭的时候触发 (when this panel is closed trigger)
},
- onMinimize: function() {
+ onMinimize: function () {
this.resize();
},
- onMaximize: function() {
+ onMaximize: function () {
this.resize();
},
- resize: function() {
+ resize: function () {
},
- destroy: function() {
+ destroy: function () {
//销毁的时候触发
//todo
//do something before this func
--
Gitblit v1.9.3