From 89da62649161571834d3f8df7ce36f9967e6ba04 Mon Sep 17 00:00:00 2001
From: wangzhibo <wangzhibo@shsening.com>
Date: 星期二, 07 九月 2021 14:04:31 +0800
Subject: [PATCH] change cesium version
---
widgets/centerXY/widget.js | 217 +++++++++++++++++++++++++++++++++++++++++++----------
1 files changed, 175 insertions(+), 42 deletions(-)
diff --git a/widgets/centerXY/widget.js b/widgets/centerXY/widget.js
index a87549e..5e4e215 100644
--- a/widgets/centerXY/widget.js
+++ b/widgets/centerXY/widget.js
@@ -1,88 +1,221 @@
-;(function (window, mars3d) {
+(function (window, mars3d) {
+
+ //鍏ㄥ眬涓棿鍙橀噺
+ let currJD;
+ let currWD;
+ let currGD;
+
//鍒涘缓widget绫伙紝闇�瑕佺户鎵緽aseWidget
class MyWidget extends mars3d.widget.BaseWidget {
//澶栭儴璧勬簮閰嶇疆
- get resources() {
- return ['view.css']
+ get resources () {
+ return ["view.css"];
}
//寮圭獥閰嶇疆
- get view() {
+ get view () {
return {
- type: 'divwindow',
- url: 'view.html',
+ type: "divwindow",
+ url: "view.html",
windowOptions: {
- width: 210,
- height: 210,
+ width: 300,
+ height: 260,
},
- }
+ };
}
+
//姣忎釜绐楀彛鍒涘缓瀹屾垚鍚庤皟鐢�
- winCreateOK(opt, result) {
- var point = this.map.getCenter()
- this.showInputView(point)
+ winCreateOK (opt, result) {
- $('#btnCenterXY').click(() => {
- var jd = $('#point_jd').val()
- var wd = $('#point_wd').val()
- var height = $('#point_height').val()
+ var point = this.map.getCenter();
+ point.format();
+ currJD = point.lng;
+ currWD = point.lat;
+ currGD = point.alt;
- let point = new mars3d.LatLngPoint(Number(jd), Number(wd), Number(height))
- this.updateMarker(point, true)
- })
+ this.chooseEvent() //浜嬩欢澶勭悊
+ this.updateTen();
}
//婵�娲绘彃浠�
- activate() {
+ activate () {
//鍗曞嚮鍦板浘浜嬩欢
- this.map.on(mars3d.EventType.click, this.onMapClick, this)
+ $("#btnSelectPoint").click(() => {
+ this.map.once(mars3d.EventType.click, this.onMapClick, this);
+ })
+
}
//閲婃斁鎻掍欢
- disable() {
+ disable () {
//閲婃斁鍗曞嚮鍦板浘浜嬩欢
- this.map.off(mars3d.EventType.click, this.onMapClick, this)
+ this.map.off(mars3d.EventType.click, this.onMapClick, this);
if (this.graphic) {
- this.map.graphicLayer.removeGraphic(this.graphic, true)
- this.graphic = null
+ this.map.graphicLayer.removeGraphic(this.graphic, true);
+ this.graphic = null;
}
}
- onMapClick(event) {
- var cartesian = event.cartesian
+
+ onMapClick (event) {
+ var cartesian = event.cartesian;
if (cartesian) {
- var point = mars3d.LatLngPoint.fromCartesian(cartesian)
+ var point = mars3d.LatLngPoint.fromCartesian(cartesian);
- this.updateMarker(point)
- this.showInputView(point)
+ point.format();
+ currJD = point.lng;
+ currWD = point.lat;
+ currGD = point.alt;
+
+ this.updateMarker(point);
+
+ this.updateTen();
+
}
}
- updateMarker(position, iscenter) {
+ //鐐瑰嚮鍦板浘鍧愭爣鏇存柊
+ updateMarker (position, iscenter) {
if (this.graphic) {
- this.graphic.position = position
+ this.graphic.position = position;
} else {
this.graphic = new mars3d.graphic.BillboardEntity({
position: position,
style: {
- image: this.path + 'img/marker.png',
+ image: this.path + "img/marker.png",
horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
verticalOrigin: Cesium.VerticalOrigin.BOTTOM, // default: CENTER
scale: 0.6,
},
- })
- this.map.graphicLayer.addGraphic(this.graphic)
+ });
+ this.map.graphicLayer.addGraphic(this.graphic);
}
if (iscenter) {
- this.map.flyToGraphic(this.graphic, { radius: 2000 })
+ this.map.flyToGraphic(this.graphic, { radius: 2000 });
}
}
- showInputView(xy) {
- $('#point_jd').val(xy.lng.toFixed(6))
- $('#point_wd').val(xy.lat.toFixed(6))
- $('#point_height').val(xy.alt.toFixed(1))
+
+
+ //===============================================================================
+
+ chooseEvent () {
+ $("#txtLngTen,#txtLatTen,#txtLatAlt").change(() => {
+ this.changeTen()
+ })
+
+ $("#txtLngDegree,#txtDmsAlt,#txtLngMinute,#txtLngSecond,#txtLatDegree,#txtLatMinute,#txtLatSecond").change(() => {
+ this.changeDfm()
+ })
+
+ $("#txtGk3X,#txtGk3Y,#txtGk3Alt").change(() => {
+ this.change3GKZone()
+ })
+
+ $("#btnCenterXY").click(() => {
+ if (currJD > 180 || currJD < -180) {
+ haoutil.alert("璇疯緭鍏ユ湁鏁堢殑缁忓害鍊硷紒");
+ return;
+ }
+ if (currWD > 90 || currWD < -90) {
+ haoutil.alert("璇疯緭鍏ユ湁鏁堢殑绾害鍊硷紒");
+ return;
+ }
+ let point = new mars3d.LatLngPoint(Number(currJD), Number(currWD), Number(currGD));
+
+ this.updateMarker(point, true);
+ });
+
+ $('input:radio[name="rdoType"]').change(() => {
+ let selectType = $('input:radio[name="rdoType"]:checked').val()
+ switch (selectType) {
+ default:
+ //鍗佽繘鍒�
+ $(".viewTen").show();
+ $(".viewDms").hide();
+ $(".viewGk").hide();
+ this.updateTen();
+ break;
+ case "2": //搴﹀垎绉�
+ $(".viewDms").show();
+ $(".viewTen").hide();
+ $(".viewGk").hide();
+ this.updataDfm();
+ break;
+ case "3": //CGCS2000
+ $(".viewTen").hide();
+ $(".viewDms").hide();
+ $(".viewGk").show();
+ this.updata3GKZone();
+ break;
+ }
+ });
+
}
+
+ //鏇存柊锛氬崄杩涘埗
+ updateTen () {
+ $("#txtLngTen").val(currJD.toFixed(6));
+ $("#txtLatTen").val(currWD.toFixed(6));
+ $("#txtLatAlt").val(currGD.toFixed(1));
+ }
+ // 淇敼浜嗭細鍗佽繘鍒�
+ changeTen () {
+ currJD = Number($("#txtLngTen").val() || 0); //鑾峰彇缁忓害
+ currWD = Number($("#txtLatTen").val() || 0); //鑾峰彇绾害
+ currGD = Number($("#txtLatAlt").val() || 0); //楂樺害
+ }
+
+ //鏇存柊锛氬害鍒嗙
+ updataDfm () {
+ let tenJD = mars3d.PointTrans.degree2dms(currJD);
+ $("#txtLngDegree").val(tenJD.degree);
+ $("#txtLngMinute").val(tenJD.minute);
+ $("#txtLngSecond").val(tenJD.second);
+
+ let tenWD = mars3d.PointTrans.degree2dms(currWD);
+ $("#txtLatDegree").val(tenWD.degree);
+ $("#txtLatMinute").val(tenWD.minute);
+ $("#txtLatSecond").val(tenWD.second);
+
+ $("#txtDmsAlt").val(currGD);
+ }
+
+ //淇敼浜嗭細搴﹀垎绉�
+ changeDfm () {
+ let jd_du = Number($("#txtLngDegree").val() || 0); //鑾峰彇
+ let jd_fen = Number($("#txtLngMinute").val() || 0);
+ let jd_miao = Number($("#txtLngSecond").val() || 0);
+ currJD = mars3d.PointTrans.dms2degree(jd_du, jd_fen, jd_miao);
+
+ let wd_du = Number($("#txtLatDegree").val() || 0); //鑾峰彇
+ let wd_fen = Number($("#txtLatMinute").val() || 0);
+ let wd_miao = Number($("#txtLatSecond").val() || 0);
+ currWD = mars3d.PointTrans.dms2degree(wd_du, wd_fen, wd_miao);
+
+ currGD = Number($("#txtDmsAlt").val() || 0); //楂樺害
+ }
+
+ //鏇存柊锛�2000骞抽潰鍧愭爣涓夊垎搴�
+ updata3GKZone () {
+ var zone3 = mars3d.PointTrans.proj4Trans([currJD, currWD], mars3d.CRS.EPSG4326, mars3d.CRS.CGCS2000_GK_Zone_3); //鍗佽繘鍒惰浆2000骞抽潰涓夊垎搴�
+ $("#txtGk3X").val(mars3d.Util.formatNum(zone3[0], 1));
+ $("#txtGk3Y").val(mars3d.Util.formatNum(zone3[1], 1));
+ $("#txtGk3Alt").val(currGD);
+ }
+
+ //淇敼浜嗭細2000骞抽潰鍧愭爣涓夊垎搴�
+ change3GKZone () {
+ let jd = Number($("#txtGk3X").val()); //鑾峰彇
+ let wd = Number($("#txtGk3Y").val());
+ var gk3 = mars3d.PointTrans.proj4Trans([jd, wd], mars3d.CRS.CGCS2000_GK_Zone_3, mars3d.CRS.EPSG4326);
+ currJD = gk3[0];
+ currWD = gk3[1];
+ currGD = Number($("#txtGk3Alt").val() || 0); //楂樺害
+ }
+
+
+
}
//娉ㄥ唽鍒皐idget绠$悊鍣ㄤ腑銆�
- mars3d.widget.bindClass(MyWidget)
+ mars3d.widget.bindClass(MyWidget);
//姣忎釜widet涔嬮棿閮芥槸鐩存帴寮曞叆鍒癷ndex.html涓紝浼氬瓨鍦ㄥ郊姝ゅ懡鍚嶅啿绐侊紝鎵�浠ラ棴鍖呭鐞嗕笅銆�
-})(window, mars3d)
+})(window, mars3d);
--
Gitblit v1.9.1