From db45def58993c3ed79b47f1a0ec19740ec229211 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Fri, 11 Jun 2021 11:22:24 +0800
Subject: [PATCH] 工具下面做相关更改,及逻辑优化
---
widgets/Sign/Widget.js | 89 +++++++++++++++++++++++++++++++++++++-------
1 files changed, 75 insertions(+), 14 deletions(-)
diff --git a/widgets/Sign/Widget.js b/widgets/Sign/Widget.js
index 2b6d671..746319d 100644
--- a/widgets/Sign/Widget.js
+++ b/widgets/Sign/Widget.js
@@ -47,6 +47,8 @@
ind: '',
startup: function startup() {
topic.subscribe("openSign", lang.hitch(this, this.onOpenSign));
+ topic.subscribe("closeSign", lang.hitch(this, this.onCloseSign));
+
// var fileNames = '我的标记点';
var that = this;
var scene = that.map.scene;
@@ -58,7 +60,11 @@
// 监听鼠标移动
handlers.setInputAction(function (moveEvent) {
// 点击完成绘制
- $('.danji').css({ 'display': 'block', 'left': moveEvent.startPosition.x + 10 + 'px', 'top': moveEvent.startPosition.y + 10 + 'px' });
+ $('.danji').css({
+ 'display': 'block',
+ 'left': moveEvent.startPosition.x + 10 + 'px',
+ 'top': moveEvent.startPosition.y + 10 + 'px'
+ });
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
// 监听鼠标点击
handlers.setInputAction(function (clickEvent) {
@@ -78,7 +84,10 @@
$('.sign-tian-hang-textarea').val('');
$('.sign-tian').show();
- $('.sign-tian').css({ 'left': clickEvent.position.x - $('.sign-tian').innerWidth() / 2 + 'px', 'top': clickEvent.position.y - 300 + 'px' });
+ $('.sign-tian').css({
+ 'left': clickEvent.position.x - $('.sign-tian').innerWidth() / 2 + 'px',
+ 'top': clickEvent.position.y - 300 + 'px'
+ });
if (that.toggle && $('.sign-tian').css('display', 'block')) {
that.map.scene.postRender.addEventListener(moveDom);
that.toggle = false;
@@ -122,7 +131,11 @@
that.arrQsrbz.push(datas[i].describe);
that.Dzbx = datas[i].x;
that.Dzby = datas[i].y;
- that.fileArr.push({ x: datas[i].x, y: datas[i].y, z: datas[i].z });
+ that.fileArr.push({
+ x: datas[i].x,
+ y: datas[i].y,
+ z: datas[i].z
+ });
addPoint(that.fileArr[i], datas[i].shuzi + date);
window.localStorage.setItem('BJD', JSON.stringify(that.fileArr));
@@ -152,8 +165,16 @@
that.Dname.push(datas[i].name);
that.Dzbx = datas[i].x;
that.Dzby = datas[i].y;
- that.fileArr.push({ x: datas[i].x, y: datas[i].y, z: datas[i].z });
- addPoint({ x: datas[i].x, y: datas[i].y, z: datas[i].z }, datas[i].shuzi + date);
+ that.fileArr.push({
+ x: datas[i].x,
+ y: datas[i].y,
+ z: datas[i].z
+ });
+ addPoint({
+ x: datas[i].x,
+ y: datas[i].y,
+ z: datas[i].z
+ }, datas[i].shuzi + date);
window.localStorage.setItem('BJD', JSON.stringify(that.fileArr));
window.localStorage.setItem('BJDarr', JSON.stringify(that.arr));
@@ -179,7 +200,10 @@
var a = Cesium.Cartesian3.fromDegrees(lng, lat, 200);
var px_position = Cesium.SceneTransforms.wgs84ToWindowCoordinates(that.map.scene, a);
- $('.sign-tian').css({ 'left': px_position.x - $('.sign-tian').innerWidth() / 2 + 'px', 'top': px_position.y - 310 + 'px' });
+ $('.sign-tian').css({
+ 'left': px_position.x - $('.sign-tian').innerWidth() / 2 + 'px',
+ 'top': px_position.y - 310 + 'px'
+ });
}
}
@@ -233,7 +257,10 @@
that.map.scene.postRender.addEventListener(moveDom);
$('.sign-tian-hang-textarea').val('');
$('.sign-tian').show();
- $('.sign-tian').css({ 'left': movement.position.x - $('.sign-tian').innerWidth() / 2 + 'px', 'top': movement.position.y - 300 + 'px' });
+ $('.sign-tian').css({
+ 'left': movement.position.x - $('.sign-tian').innerWidth() / 2 + 'px',
+ 'top': movement.position.y - 300 + 'px'
+ });
$('.sign_im_text').val($($('.wdbj')[i]).find('input').val()).attr('entityid', pick.id.id);
$('.sign-tian-hang-textarea').val(that.arrQsrbz[i]);
// 拖动该定位图标
@@ -241,10 +268,12 @@
var leftDownFlag = false;
var pointDraged = null;
var viewer;
+
function ConstructMoveEntity(options) {
viewer = options.viewer;
Init();
}
+
function Init() {
// Select plane when mouse down 鼠标按下事件
that.entityAll = handler.setInputAction(function (movement) {
@@ -273,7 +302,10 @@
if (pick.id.id) {
if (pick.id.id == $($('.wdbj')[that.ind]).find('input').attr('entitydataid')) {
$('.dragEdit').stop().show();
- $('.dragEdit').css({ 'left': movement.endPosition.x + 10 + 'px', 'top': movement.endPosition.y + 10 + 'px' });
+ $('.dragEdit').css({
+ 'left': movement.endPosition.x + 10 + 'px',
+ 'top': movement.endPosition.y + 10 + 'px'
+ });
}
}
} else {
@@ -282,7 +314,10 @@
if (leftDownFlag === true && pointDraged != null) {
$('.dragEdit').stop().hide();
$('.modifyEdit').stop().show();
- $('.modifyEdit').css({ 'left': movement.endPosition.x + 10 + 'px', 'top': movement.endPosition.y + 10 + 'px' });
+ $('.modifyEdit').css({
+ 'left': movement.endPosition.x + 10 + 'px',
+ 'top': movement.endPosition.y + 10 + 'px'
+ });
for (var j = 0; j < that.arr.length; j++) {
if (pointDraged.id.id == $($('.wdbj')[j]).find('input').attr('entitydataid')) {
var _ray = viewer.camera.getPickRay(movement.endPosition);
@@ -298,7 +333,9 @@
};
return ConstructMoveEntity;
}();
- var moveTool = MoveEntity({ 'viewer': that.map });
+ var moveTool = MoveEntity({
+ 'viewer': that.map
+ });
}
}
}
@@ -313,7 +350,10 @@
if (pick && pick.id) {
if (pick.id.id) {
$('.actEdit').stop().show();
- $('.actEdit').css({ 'left': moveEvent.endPosition.x + 10 + 'px', 'top': moveEvent.endPosition.y + 10 + 'px' });
+ $('.actEdit').css({
+ 'left': moveEvent.endPosition.x + 10 + 'px',
+ 'top': moveEvent.endPosition.y + 10 + 'px'
+ });
}
} else {
$('.actEdit').stop().hide();
@@ -507,6 +547,28 @@
if (item == this.name) {
this.flag = true;
this.onOpen();
+ $('.jimu-widget-Sign').show();
+
+ }
+ },
+
+ onCloseSign: function (item) {
+ var that = this;
+ if (item == this.name && this.flag == true) {
+ this.flag = false;
+ $('.jimu-widget-Sign').hide();
+ for (var i = 0; i < that.arr.length; i++) {
+ // if ($(this).parent().parent().next().find('.wdbj-shanchu')[i].className == 'wdbj-shanchu') {
+ that.map.entities.removeById(that.arr[i]);
+ $(this).parents('.sign-head').next().find('.wdbj').remove();
+ that.arrDingWei = [];
+ $($(this).parent().parent().next().find('.wdbj-shanchu').parent()[i]).remove();
+ // }
+ }
+ if ($('.wdbj-shanchu').length == 0) {
+ $('.sign-content-my').show();
+ }
+ that.onClose();
}
},
@@ -576,8 +638,7 @@
window.localStorage.setItem('BJDarr', JSON.stringify(that.arr));
if ($('.wdbj').length > 0) {
$('.sign-content-my').hide();
- }
- ;
+ };
}
},
@@ -603,4 +664,4 @@
}
});
-});
+});
\ No newline at end of file
--
Gitblit v1.9.3