From 4c346f202a2f4431feb734da018af1b83571b8fb Mon Sep 17 00:00:00 2001
From: qinbo <qinbo@shsening.com>
Date: 星期三, 10 十一月 2021 11:57:07 +0800
Subject: [PATCH] 查询勾选显示
---
widgetsTS/widget_search/widget.js | 142 ++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 139 insertions(+), 3 deletions(-)
diff --git a/widgetsTS/widget_search/widget.js b/widgetsTS/widget_search/widget.js
index cc8cdd9..304268a 100644
--- a/widgetsTS/widget_search/widget.js
+++ b/widgetsTS/widget_search/widget.js
@@ -1,5 +1,38 @@
'use script' //寮�鍙戠幆澧冨缓璁紑鍚弗鏍兼ā寮�
- ;
+;
+
+
+function getPositionFromLonLat(in_json_string) {
+ let postion = [];
+ var points = in_json_string.split(",");
+ points.forEach(element => {
+ var tmplon_lat = element.split(" ");
+ postion[postion.length] = [tmplon_lat[0], tmplon_lat[1], 1];
+ });
+ return postion;
+}
+
+function getClass(o) { //鍒ゆ柇鏁版嵁绫诲瀷
+ return Object.prototype.toString.call(o).slice(8, -1);
+}
+
+function deepCopy(obj) {
+ var result, oClass = getClass(obj);
+
+ if (oClass == "Object") result = {}; //鍒ゆ柇浼犲叆鐨勫鏋滄槸瀵硅薄锛岀户缁亶鍘�
+ else if (oClass == "Array") result = []; //鍒ゆ柇浼犲叆鐨勫鏋滄槸鏁扮粍锛岀户缁亶鍘�
+ else return obj; //濡傛灉鏄熀鏈暟鎹被鍨嬪氨鐩存帴杩斿洖
+
+ for (var i in obj) {
+ var copy = obj[i];
+
+ if (getClass(copy) == "Object") result[i] = deepCopy(copy); //閫掑綊鏂规硶 锛屽鏋滃璞$户缁彉閲弌bj[i],涓嬩竴绾ц繕鏄璞★紝灏眔bj[i][i]
+ else if (getClass(copy) == "Array") result[i] = deepCopy(copy); //閫掑綊鏂规硶 锛屽鏋滃璞$户缁暟缁刼bj[i],涓嬩竴绾ц繕鏄暟缁勶紝灏眔bj[i][i]
+ else result[i] = copy; //鍩烘湰鏁版嵁绫诲瀷鍒欒祴鍊肩粰灞炴��
+ }
+
+ return result;
+}
(function (window, mars3d) {
//鍒涘缓widget绫伙紝闇�瑕佺户鎵緽aseWidget
class MyWidget extends mars3d.widget.BaseWidget {
@@ -10,9 +43,9 @@
windowOptions: {
width: 450,
position: {
- top: 150,
+ top: 140,
left: 5,
- bottom: 100
+ bottom: 80
},
},
}
@@ -35,6 +68,109 @@
this.map.flyToPoint(Cesium.Cartesian3.fromDegrees(lon, lat, 0.2));
}
+ HighlightMulti(layerid, qindex, selectedItem) {
+ mars3d.global_variables.tmpHighlightGraphicLayer.clear(true);
+
+ if (layerid == 1001 || layerid == 1002 || layerid == 1003 || layerid == 1004) {
+ selectedItem.forEach(element => {
+ this.addPointToMap(layerid, qindex, element);
+ });
+
+ } else if (layerid == 1005 || layerid == 100500) {
+ selectedItem.forEach(element => {
+ var path = element.shape;
+ if (path.substring(0, 1) == "M") {
+ var paths = (path.substring(17, path.length - 2)).split("),(");
+ paths.forEach(element_path => {
+ var positions = getPositionFromLonLat(element_path)
+ var tmpAttr = deepCopy(element);
+ delete tmpAttr['shape'];
+ this.addPathToMap(layerid, qindex, positions, tmpAttr);
+ });
+ } else {
+ var positions = getPositionFromLonLat(path.substring(11, path.length - 1))
+ var tmpAttr = deepCopy(element);
+ delete tmpAttr['shape'];
+ this.addPathToMap(layerid, qindex, positions, tmpAttr);
+ }
+ });
+ }else if (layerid == 1006) {
+ selectedItem.forEach(element => {
+ var path = element.shape;
+ if(path == null && path == "null" && path == undefined){
+ return;
+ }
+ if (path.substring(0, 1) == "M") {
+ var paths = (path.substring(15, path.length - 3)).split(")),((");
+ paths.forEach(element_path => {
+ var positions = getPositionFromLonLat(element_path)
+ var tmpAttr = deepCopy(element);
+ delete tmpAttr['shape'];
+ this.addPolygonToMap(layerid, qindex, positions, tmpAttr);
+ });
+ } else {
+ var positions = getPositionFromLonLat(path.substring(9, path.length - 2));
+ var tmpAttr = deepCopy(element);
+ delete tmpAttr['shape'];
+ this.addPolygonToMap(layerid, qindex, positions, tmpAttr);
+ }
+ });
+
+ }
+ }
+ addPolygonToMap(layerid, qindex, positions, attr) {
+ var primitive = new mars3d.graphic.PolygonEntity({
+ positions: positions,
+ style: {
+ height: 50,
+ diffHeight: 200,
+ materialType: mars3d.MaterialType.PolyGradient,
+ color: this.winPage.getLayerPointColorByQindexandValue(layerid, qindex, attr[qindex]),
+ alphaPower: 1.5,
+ //楂樹寒鏃剁殑鏍峰紡锛堥粯璁や负榧犳爣绉诲叆锛屼篃鍙互鎸囧畾type:'click'鍗曞嚮楂樹寒锛夛紝鏋勯�犲悗涔熷彲浠penHighlight銆乧loseHighlight鏂规硶鏉ユ墜鍔ㄨ皟鐢�
+ highlight: {
+ color: "#ff0000",
+ },
+ },
+ attr: attr
+ });
+ mars3d.global_variables.tmpHighlightGraphicLayer.addGraphic(primitive);
+ }
+
+ addPointToMap(layerid, qindex, attr) {
+ //绔嬩綋鍥村鎵╂暎鏁堟灉,鍦嗙姸
+ var circleDiffuseWallGlow = new mars3d.graphic.DiffuseWall({
+ position: Cesium.Cartesian3.fromDegrees(attr["lon"], attr["lat"], 20), //鍦嗕腑蹇冪偣
+ style: {
+ diffHeight: qindex == "co" ? 10 * attr[qindex] : attr[qindex], //楂樺害
+ radius: 200, //鍗婂緞
+ color: this.winPage.getLayerPointColorByQindexandValue(layerid, qindex, attr[qindex]),
+ speed: 10, //閫熷害
+ },
+ attr: attr
+ });
+ mars3d.global_variables.tmpHighlightGraphicLayer.addGraphic(circleDiffuseWallGlow);
+ }
+
+ addPathToMap(layerid, qindex, positions, attr) {
+ var road = new mars3d.graphic.WallPrimitive({
+ positions: positions,
+ style: {
+ closure: true,
+ diffHeight: qindex == "co" ? 10 * attr[qindex] : attr[qindex], //楂樺害
+ material: mars3d.MaterialUtil.createMaterial(mars3d.MaterialType.LineFlow, {
+ //鍔ㄧ敾绾挎潗璐�
+ image: "img/textures/fence.png",
+ axisY: true,
+ color: this.winPage.getLayerPointColorByQindexandValue(layerid, qindex, attr[qindex]),
+ speed: 10, //閫熷害锛屽缓璁彇鍊艰寖鍥�1-100
+ }),
+ },
+ attr: attr
+ });
+ mars3d.global_variables.tmpHighlightGraphicLayer.addGraphic(road);
+ }
+
showDetailedWindow(params) {
if (mars3d.widget.isActivate("widgetsTS/widget_detail/widget.js")) {
var detailWiget = mars3d.widget.getClass("widgetsTS/widget_detail/widget.js");
--
Gitblit v1.9.1