liuyg
2021-07-02 25ce610f6ecca7325e7a743dc032c4a76559c63d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
///////////////////////////////////////////////////////////////////////////
// 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-plottingP',
            name: 'plottingP',
            type: '',
            startup: function () {
                // js: ../../Build/Cesium/ThirdParty/Workers/PlotAlgo/PlotAlgoInclude.js 重要    
                // css: ../../Build/Cesium/Widgets/widgets.css 地图样式 不影响
                // css:./css/sideBar.css  不影响
                // js: js/plotPanelControl/PlottingUI.Include.js 重要      
                // js: js/bootstrap.min.js 不影响
                // css: css/bootstrap-new.min.css 不影响
                // js: http://www.supermapol.com/earth/Build/Cesium/Cesium.js 地图js 不影响
                var cesium, scene, viewer, serverUrl, plotting;
                var plottingLayer;
                var plotEditControl;
                var plotDrawControl;
                var plotPanel;
                // var map = window.viewer;//加载地图数据
                viewer = window.viewer;
                cesium = Cesium;
                scene = viewer.scene;
                var begin = () => {
                    var host = 'http://support.supermap.com.cn:8090';
                    // var host = 'http://localhost:8090';
                    scene.globe.depthTestAgainstTerrain = false;
                    serverUrl = host + '/iserver/services/plot-jingyong/rest/plot';
                    InitPlot(viewer, serverUrl);
                };
                var InitPlot = (viewer, serverUrl) => {
                    if (!viewer) {
                        return;
                    }
                    plottingLayer = new cesium.PlottingLayer(scene, "plottingLayer");
                    // scene.plotLayers.add(plottingLayer);
                    scene.layers.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);
                }
            }
 
        });
    });