From ebc4c778854c8d2666b1bbaf3dcba2ba00f08453 Mon Sep 17 00:00:00 2001 From: ansel0926 <ansel0926@gmail.com> Date: 星期日, 15 五月 2022 18:42:46 +0800 Subject: [PATCH] 编辑线、面,文字标记和图片标记点 --- view/project/layerAnalysis.html | 66 ++++++++++++++++++++++++++++++--- 1 files changed, 60 insertions(+), 6 deletions(-) diff --git a/view/project/layerAnalysis.html b/view/project/layerAnalysis.html index ad121b3..1d3716f 100644 --- a/view/project/layerAnalysis.html +++ b/view/project/layerAnalysis.html @@ -56,6 +56,11 @@ border-radius: 6px; background-color: #999; } + + .layui-tree-btnGroup .layui-icon { + display: inline-block; + color: white + } </style> <script> @@ -64,9 +69,10 @@ layui.use(['tree'], function () { var tree = layui.tree isloading = true; - tree.render({ + var modelTree = tree.render({ elem: '#model-tree-list' , data: layerMenu + , edit: ["del"] , showCheckbox: true //鏄惁鏄剧ず澶嶉�夋 , id: 'model-tree-list' , isJump: false //鏄惁鍏佽鐐瑰嚮鑺傜偣鏃跺脊鍑烘柊绐楀彛璺宠浆 @@ -86,7 +92,7 @@ var data = obj.data.ext; //鑾峰彇褰撳墠鐐瑰嚮鐨勮妭鐐规暟鎹� var viewer = parent.viewer; var Cesium = parent.Cesium; - if (type != 'BaseMap' && type != 'Terrain' && type != 'Plotting') { + if (type != 'BaseMap' && type != 'Terrain' && type != 'Plotting' && type != 'DDE') { var model = undefined; switch (obj.data.field) { case "Primitive": { @@ -112,12 +118,12 @@ let shpArray = JSON.parse(path); var shpPromises = []; for (let i = 0; i < shpArray.length; i++) { - shpPromises.push( Cesium.loadBlob(parent.httpConfig.nginxUrl + shpArray[i])); - } - + shpPromises.push(Cesium.loadBlob(parent.httpConfig.nginxUrl + shpArray[i])); + } + var layer = null; parent.Cesium.when.all(shpPromises, function (files) { - for(let i=0;i<shpArray.length;i++){ + for (let i = 0; i < shpArray.length; i++) { files[i].name = shpArray[i]; } @@ -178,6 +184,22 @@ }); } + } + else if (type == 'DDE') { + var lon, lat, alt; + lon = obj.data.lon; + lat = obj.data.lat; + alt = obj.data.altitude; + console.log(lon,lat,alt); + let flyPromise = viewer.camera.flyTo({ + duration: 3, + destination: Cesium.Cartesian3.fromDegrees(Number(lon), Number(lat), alt), + orientation: { + heading: Cesium.Math.toRadians(0), //缁曞瀭鐩翠簬鍦板績鐨勮酱鏃嬭浆 + pitch: Cesium.Math.toRadians(-90), //缁曠含搴︾嚎鏃嬭浆 + roll: Cesium.Math.toRadians(0) //缁曠粡搴︾嚎鏃嬭浆 + }, + }); } } , oncheck: function (obj) { @@ -256,6 +278,7 @@ let result = modelType == 'Primitive' ? parent.delprimitiveModel(modelId) : parent.delentityModel(modelId); } parent.delNodeById(modelId, layerMenu); + delDrawEntity(modelId); } } }); @@ -312,6 +335,37 @@ changeParentChecked(ischeck, parentOfData); } } + //zzf:闅愯棌闄ょ粯鍥捐彍鍗曚互澶栫殑鍒犻櫎鎸夐挳 + $(modelTree.config.elem[0].children[0].childNodes).each(function () { + let parentDiv = $(this)[0].childNodes[0]; + $(parentDiv).find("div .layui-icon-delete").remove(); + if ($(this)[0].dataset.id != "4") { + let childrenDiv = $(this)[0].childNodes[1]; + $(childrenDiv).find("div .layui-icon-delete").remove(); + } + }) + function delDrawEntity(modelId) { + let updateData = { + "ids": modelId, + } + let token = window.localStorage.getItem("token"); + $.ajax({ + type: "post", + async: false, + url: parent.httpConfig.webApiUrl + "landstamp/front/removeDrawEntity", + data: updateData, + contentType: "application/x-www-form-urlencoded", + beforeSend: function (request) { + request.setRequestHeader("token", token); + }, + success: function (data) { + console.log(data) + }, + error: function (XMLHttpRequest, textStatus, errorThrown) { + console.log("ajax璇锋眰澶辫触锛�"); + } + }); + } }); </script> -- Gitblit v1.9.1