From 7d63a3584b3d5acebb69906a0568679815193a5d Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Sat, 05 Jun 2021 17:26:07 +0800
Subject: [PATCH] 对接左侧树状接口

---
 widgets/plotting/Widget.js |   79 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 79 insertions(+), 0 deletions(-)

diff --git a/widgets/plotting/Widget.js b/widgets/plotting/Widget.js
new file mode 100644
index 0000000..e1a3214
--- /dev/null
+++ b/widgets/plotting/Widget.js
@@ -0,0 +1,79 @@
+///////////////////////////////////////////////////////////////////////////
+// Copyright © 2020 zhongsong. All Rights Reserved.
+// 模块描述:河流水面线分析
+///////////////////////////////////////////////////////////////////////////
+define([
+    'dojo/_base/declare',
+    'dojo/_base/lang',
+    'dojo/_base/array',
+    'dojo/_base/html',
+    'dojo/topic',
+    'jimu/BaseWidget',
+    './mars3d-src'
+],
+    function (declare,
+        lang,
+        array,
+        html,
+        topic,
+        BaseWidget
+    ) {
+        return declare([BaseWidget], {
+            baseClass: 'jimu-widget-plotting',
+            name: 'plotting',
+            type: '',
+            startup: function () {
+                var cesium, scene, viewer, serverUrl, plotting;
+                var plottingLayer;
+                var plotEditControl;
+                var plotDrawControl;
+                var plotPanel;
+
+                var begin = (Cesium) => {
+                    cesium = Cesium;
+                    var host = 'http://support.supermap.com.cn:8090';
+                    viewer = new Cesium.Viewer('cesiumContainer');
+                    scene = viewer.scene;
+                    scene.globe.depthTestAgainstTerrain = false;
+                    serverUrl = host + '/iserver/services/plot-jingyong/rest/plot';
+                    InitPlot(viewer, serverUrl);
+                };
+                var InitPlot = (viewer, serverUrl) => {
+                    // console.log(viewer, serverUrl)
+                    if (!viewer) {
+                        return;
+                    }
+                    plottingLayer = new cesium.PlottingLayer(scene, "plottingLayer");
+                    scene.plotLayers.add(plottingLayer);
+
+                    plotEditControl = new cesium.PlotEditControl(scene, plottingLayer);//编辑控件
+                    plotDrawControl = new cesium.PlotDrawControl(scene, plottingLayer);//绘制控件
+                    plotDrawControl.drawControlEndEvent.addEventListener(function () {//标绘结束,激活编辑控件
+                        plotEditControl.activate();
+                    });
+
+                    plotting = cesium.Plotting.getInstance(serverUrl, scene);
+                    //标绘面板
+                    initPlotPanel("plotPanel", serverUrl, plotDrawControl, plotEditControl, plotting);
+                    stylePanel = new StylePanel('stylePanel', plotEditControl, plotting);
+                }
+
+                //删除指定标号
+                function deleteSeleGeo() {
+                    plottingLayer.removeGeoGraphicObject(plottingLayer.selectedFeature);
+                }
+                //“Delete”按键删除选中标号
+                $(document).keydown(function (event) {
+                    if (event.keyCode === 46) {
+                        deleteSeleGeo();
+                    }
+                });
+
+                if (typeof Cesium !== 'undefined') {
+                    window.startupCalled = true;
+                    begin(Cesium);
+                }
+            }
+
+        });
+    });
\ No newline at end of file

--
Gitblit v1.9.3