From 25ce610f6ecca7325e7a743dc032c4a76559c63d Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Fri, 02 Jul 2021 09:10:26 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.105:10010/r/pyhmap
---
widgets/spatialAnalysis/Widget.js | 320 ++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 232 insertions(+), 88 deletions(-)
diff --git a/widgets/spatialAnalysis/Widget.js b/widgets/spatialAnalysis/Widget.js
index 62e479c..c8e0e3d 100644
--- a/widgets/spatialAnalysis/Widget.js
+++ b/widgets/spatialAnalysis/Widget.js
@@ -45,11 +45,11 @@
classs: 'profileAnalysis-tool',
img: './images/addL/剖面分析.png'
}
- // , {//做好静态,
- // name: '建造实体',
- // classs: 'modelDiagram-tool',
- // img: './images/addL/pdpx.png'
- // }
+ , {//做好静态,
+ name: '建造实体',
+ classs: 'modelDiagram-tool',
+ img: './images/addL/实体.png'
+ }
// , {//https://blog.csdn.net/supermapsupport/article/details/100134590
// //需要iServer发布成三维服务
// name: '坡度分析',
@@ -64,13 +64,34 @@
, {//地形开挖,//做好
name: '地形开挖',
classs: 'digTheEarth-tool',
- img: './images/addL/pdpx.png'
+ img: './images/addL/地形开挖.png'
}
- // , {//方量分析//做好
- // name: '方量分析',
- // classs: 'volumeAnalysis-tool',
- // img: './images/addL/pdpx.png'
- // }
+ , {//方量分析//做好
+ name: '方量分析',
+ classs: 'volumeAnalysis-tool',
+ img: './images/addL/方量分析.png'
+ },
+ {//通视分析
+ name: '通视分析',
+ classs: 'throughSee-tool',
+ img: './images/addL/通视分析.png'
+ },
+ {//平面裁剪
+ name: '平面裁剪',
+ classs: 'clippingPlanes-tool',
+ img: './images/addL/pingmian.png'
+ },
+ {//BOX裁剪
+ name: 'BOX裁剪',
+ classs: 'BOXTailoring-tool',
+ img: './images/addL/BOX裁剪.png'
+ }
+ ,
+ {//Cross裁剪
+ name: 'Cross裁剪',
+ classs: 'crossTailoring-tool',
+ img: './images/addL/BOX裁剪.png'
+ }
];
that.beginSpatialAnalysis(domHtmls);
@@ -121,6 +142,26 @@
classs: 'spatialQuery-tool',
img: './images/addL/pdpx.png'
}
+ , {//多边形裁剪
+ name: '多边形裁剪',
+ classs: 'polygonClipping-tool',
+ img: './images/addL/pdpx.png'
+ },
+ {//通视分析
+ name: '通视分析',
+ classs: 'throughSee-tool',
+ img: './images/addL/pdpx.png'
+ },
+ {//平面裁剪
+ name: '平面裁剪',
+ classs: 'clippingPlanes-tool',
+ img: './images/addL/pdpx.png'
+ },
+ {//BOX裁剪
+ name: 'BOX裁剪',
+ classs: 'BOXTailoring-tool',
+ img: './images/addL/BOX裁剪.png'
+ }
,
{//建造模型
name: '建造模型',
@@ -158,6 +199,7 @@
})
},
+ promise: 'NODATA',
beginSpatialAnalysis: function (domHtmls) {
var that = this;
var domHtmls = domHtmls;
@@ -235,23 +277,61 @@
topic.publish('beginSpatialQuery', 'beginSpatialQuery');
})
- // var datas = [//layui舍弃
- // {
- // title: '默认:天地图影像'
- // // , child: [
- // // {
- // // title: 'menu item 3-2-1'
- // // , id: 105
- // // }
- // // ]
- // }
- // ]
- // // that.beginRool(datas);
- // that.datas = datas;
- // // 注册添加工具事件--规定操作图层
- // topic.subscribe("addSelectLayerTool", lang.hitch(this, this.addSelectLayerTool));
- // // 注册删除工具事件--规定操作图层
- // topic.subscribe("removeSelectLayerTool", lang.hitch(this, this.removeSelectLayerTool));
+ //多边形裁剪
+ $('.polygonClipping-tool').click(function () {
+ that.closeOnceUse();
+ $(".jimu-widget-polygonClipping").show();
+ topic.publish('beginpolygonClipping', 'beginpolygonClipping');
+ })
+
+ //通视分析
+ $('.throughSee-tool').click(function () {
+ that.closeOnceUse();
+ $(".jimu-widget-throughSee").show();
+ topic.publish('beginthroughSee', 'beginthroughSee');
+ })
+
+ //平面裁剪
+ $('.clippingPlanes-tool').click(function () {
+ that.closeOnceUse();
+ // console.log(that.promise, 22222222222)
+ if (that.promise == 'NODATA') {
+ layer.tips('请选择三维倾斜数据中的图层支持!', '.SelectLayerTool', {
+ tips: [3, 'red']
+ });
+ } else {
+ $(".jimu-widget-clippingPlanes").show();
+ topic.publish('beginclippingPlanes', that.promise);
+ }
+ })
+
+ //BOX裁剪
+ $('.BOXTailoring-tool').click(function () {
+ that.closeOnceUse();
+
+ if (that.promise == 'NODATA') {
+ layer.tips('请选择三维倾斜数据中的图层支持!', '.SelectLayerTool', {
+ tips: [3, 'red']
+ });
+ } else {
+ $(".jimu-widget-BOXTailoring").show();
+ topic.publish('beginBOXTailoring', that.promise);
+ }
+ })
+
+ //Cross裁剪
+ $('.crossTailoring-tool').click(function () {
+ that.closeOnceUse();
+
+ if (that.promise == 'NODATA') {
+ layer.tips('请选择三维倾斜数据中的图层支持!', '.SelectLayerTool', {
+ tips: [3, 'red']
+ });
+ } else {
+ $(".jimu-widget-crossTailoring").show();
+ topic.publish('begincrossTailoring', that.promise);
+ }
+ })
$('.SelectLayerTool').click(() => {
$('#SelectLayerToolItem').toggle();
@@ -265,7 +345,37 @@
this.liClick('默认:天地图影像', '默认:天地图影像');
},
- liClick: function (itemid, name) {//点击事件
+ morenliClick: function (itemid, name) {
+ var dom = $('.SelectLayerTool');
+ dom.empty();
+ var str = `${name} <i class="layui-icon layui-icon-down layui-font-12"></i>`
+ dom.append(str);
+ // console.log('数据错误默认')
+ this.promise = 'NODATA';
+ this.SelectClose();//关闭需要三维数据的窗口
+
+ },
+ SelectClose: function () {
+ //关闭平面裁剪
+ if ($(".jimu-widget-clippingPlanes").is(":visible")) {//判断是否隐藏
+ $(".jimu-widget-clippingPlanes").hide();
+ topic.publish('closesclippingPlanes');
+ }
+
+ //关闭BOX裁剪
+ if ($(".jimu-widget-BOXTailoring").is(":visible")) {//判断是否隐藏
+ $(".jimu-widget-BOXTailoring").hide();
+ topic.publish('closesBOXTailoring');
+ }
+
+ //关闭Cross裁剪
+ if ($(".jimu-widget-crossTailoring").is(":visible")) {//判断是否隐藏
+ $(".jimu-widget-crossTailoring").hide();
+ topic.publish('closescrossTailoring');
+ }
+ },
+ liClick: function (itemid, name, ourdata = 1) {//点击事件
+ var that = this;
var liList = $(`[itemid='${itemid}s']`);
// console.log(liList);
liList.click(() => {
@@ -277,6 +387,56 @@
dom.append(str);
dom.attr("title", name);
$('#SelectLayerToolItem').hide();
+ // console.log(ourdata);
+ // 定位
+ // console.log(name)
+ if (ourdata != 1) {
+ // console.log('data')
+ if (ourdata.lon) {
+ //设置相机位置、视角,便于观察场景
+ that.map.scene.camera.setView({
+ destination: new Cesium.Cartesian3.fromDegrees(Number(ourdata.lon), Number(ourdata.lat), Number(ourdata.height)),
+ orientation: {
+ heading: Cesium.Math.toRadians(Number(ourdata.yawAngle)),
+ pitch: Cesium.Math.toRadians(Number(ourdata.pitchAngle)),
+ roll: Cesium.Math.toRadians(Number(ourdata.rollAngle))
+ }
+ });
+ // console.log(ourdata.lon)
+ // console.log(ourdata.lat)
+ // console.log(ourdata.height)
+ // console.log(ourdata.yawAngle)
+ // console.log(ourdata.pitchAngle)
+ // console.log(ourdata.rollAngle)
+ //115.996858
+ //29.170348
+ //232.99
+ //84.10
+ //-22.98
+ //360.00
+ }
+ if (ourdata.src.indexOf('.openrealspace') != -1) {
+ // console.log('数据正确');
+ this.SelectClose();//关闭需要三维数据的窗口
+ that.promise = {
+ src: ourdata.src,
+ ZName: ourdata.title,
+ name: ourdata.serviceName,
+ id: ourdata.id
+ };
+
+ } else {
+ // console.log('数据错误');
+ that.promise = 'NODATA';
+ this.SelectClose();//关闭需要三维数据的窗口
+ }
+ } else {
+ // console.log('数据错误没有data');
+ that.promise = 'NODATA';
+ //关闭平面裁剪
+ this.SelectClose();//关闭需要三维数据的窗口
+ }
+
})
},
appendItemS: function (item, obj, layer) {
@@ -306,16 +466,23 @@
$("#SelectLayerToolItemTitle").append(liItem);
}
- that.liClick(obj.id, obj.title);
+ that.liClick(obj.id, obj.title, obj);
}
},
removeItemS: function (item, obj) {
- // console.log('r1')
+ // console.log(obj, 'r1')
+ var that = this;
if (item == this.name) {
var liList = $("#SelectLayerToolItemTitle li");
for (var i = 0; i < liList.length; i++) {
if ($(liList[i]).attr('itemid') && $(liList[i]).attr('itemid') == obj.id + 's') {
$(liList[i]).remove();
+ var dom = $('.SelectLayerTool').attr("title");
+ // console.log(dom == obj.title, this.liClick)
+ if (dom == obj.title) {
+ that.morenliClick('默认:天地图影像', '默认:天地图影像');
+ that.promise = 'NODATA';
+ }
}
}
@@ -355,16 +522,23 @@
$("#SelectLayerToolItemTitle").append(liItem);
}
- that.liClick(obj.id, obj.title);
+ that.liClick(obj.id, obj.title, obj);
}
},
removeTiltS: function (item, obj) {
+ // console.log(obj, 'r2')
// console.log('r2')
+ var that = this;
if (item == this.name) {
var liList = $("#SelectLayerToolItemTitle li");
for (var i = 0; i < liList.length; i++) {
if ($(liList[i]).attr('itemid') && $(liList[i]).attr('itemid') == obj.id + 's') {
$(liList[i]).remove();
+ var dom = $('.SelectLayerTool').attr("title");
+ if (dom == obj.title) {
+ that.morenliClick('默认:天地图影像', '默认:天地图影像');
+ that.promise = 'NODATA';
+ }
}
}
@@ -373,43 +547,6 @@
// $(".jimu-widget-spatialAnalysis .tree-layer-opcity").stop().hide();
}
}
- },
-
- // datas: [],//layui舍弃
- // addSelectLayerTool: function (num, val) {
- // console.log(num, val);
- // var that = this
- // , d = that.datas;
- // //三维数据处理 添加全部 9 添加时删除 10 删除全部 6 //添加单个 9 添加时删除 10 删除全部 6
- // // var sanwei = {};
- // // if (num == 9) {
- // // sanwei.title = '三维倾斜数据'
- // // }
- // // d.push({
- // // title: val.title
- // // })
- // // that.beginRool(that.datas);
- // },
- // removeSelectLayerTool: function (num, val) {
- // console.log(num, val)
- // },
- beginRool: function (data) {
- //选择图层Layui
- layui.use(['dropdown', 'util', 'layer', 'table'], function () {
- var dropdown = layui.dropdown
- , layer = layui.layer;
- dropdown.render({
- elem: '.SelectLayerTool'
- , data: data
- , click: function (obj) {
- layer.tips('选择了:' + obj.title, this.elem, { tips: [1, '#5FB878'] });
- var dom = $('.SelectLayerTool');
- dom.empty();
- var str = `${obj.title} <i class="layui-icon layui-icon-down layui-font-12"></i>`
- dom.append(str);
- }
- });
- });
},
closeToolBox: function (item) {
if (item != this.name) {
@@ -464,29 +601,36 @@
$(".jimu-widget-spatialQuery").hide();
topic.publish('closesSpatialQuery');
}
+ //关闭多边形裁剪
+ if ($(".jimu-widget-polygonClipping").is(":visible")) {//判断是否隐藏
+ $(".jimu-widget-polygonClipping").hide();
+ topic.publish('closespolygonClipping');
+ }
+ //关闭通视分析
+ if ($(".jimu-widget-throughSee").is(":visible")) {//判断是否隐藏
+ $(".jimu-widget-throughSee").hide();
+ topic.publish('closesthroughSee');
+ }
+ //关闭平面裁剪
+ if ($(".jimu-widget-clippingPlanes").is(":visible")) {//判断是否隐藏
+ $(".jimu-widget-clippingPlanes").hide();
+ topic.publish('closesclippingPlanes');
+ }
+ //关闭BOX裁剪
+ if ($(".jimu-widget-BOXTailoring").is(":visible")) {//判断是否隐藏
+ $(".jimu-widget-BOXTailoring").hide();
+ topic.publish('closesBOXTailoring');
+ }
+
+ //关闭Cross裁剪
+ if ($(".jimu-widget-crossTailoring").is(":visible")) {//判断是否隐藏
+ $(".jimu-widget-crossTailoring").hide();
+ topic.publish('closescrossTailoring');
+ }
},
onOpen: function () {
- //面板打开的时候触发 (when open this panel trigger)
- // var domHtmls = [
- // {
- // name: '可视分析',
- // classs: 'visibleArea-tool'
- // }, {
- // name: '剖面分析',
- // classs: 'profileAnalysis-tool'
- // }, {
- // name: '坡度分析',
- // classs: 'slope-tool'
- // },
- // ];
- // var dom = $('#spatialAnalysis-main');
- // var str = '';
- // for (var k in domHtmls) {
- // str += `<li class="${domHtmls[k].classs}"><i></i> <span>${domHtmls[k].name}</span></li>`
- // }
- // dom.replaceWith(str);
},
onClose: function () {
--
Gitblit v1.9.3