liuyg
2021-06-25 f26fde54fdc51424030eed8e9a0fc4c6529f1ac2
空间分析
9 files modified
15 files added
1240 ■■■■ changed files
config.json 8 ●●●●● patch | view | raw | blame | history
widgets/LeftNavigationBar/Widget.js 9 ●●●●● patch | view | raw | blame | history
widgets/digTheEarth/Widget.js 9 ●●●● patch | view | raw | blame | history
widgets/polygonClipping/Widget.html 45 ●●●●● patch | view | raw | blame | history
widgets/polygonClipping/Widget.js 253 ●●●●● patch | view | raw | blame | history
widgets/polygonClipping/css/style.css 42 ●●●●● patch | view | raw | blame | history
widgets/polygonClipping/manifest.json 17 ●●●●● patch | view | raw | blame | history
widgets/polygonClipping/nls/es/strings.js 5 ●●●●● patch | view | raw | blame | history
widgets/polygonClipping/nls/strings.js 7 ●●●●● patch | view | raw | blame | history
widgets/polygonClipping/nls/zh-cn/strings.js 5 ●●●●● patch | view | raw | blame | history
widgets/profileAnalysis/Widget.js 2 ●●●●● patch | view | raw | blame | history
widgets/searchL/Cesiumadd.js 162 ●●●●● patch | view | raw | blame | history
widgets/searchL/Widget.js 46 ●●●●● patch | view | raw | blame | history
widgets/slope/Widget.js 46 ●●●●● patch | view | raw | blame | history
widgets/spatialAnalysis/Widget.js 160 ●●●● patch | view | raw | blame | history
widgets/spatialAnalysis/css/style.css 2 ●●● patch | view | raw | blame | history
widgets/throughSee/Widget.html 10 ●●●●● patch | view | raw | blame | history
widgets/throughSee/Widget.js 330 ●●●●● patch | view | raw | blame | history
widgets/throughSee/css/style.css 45 ●●●●● patch | view | raw | blame | history
widgets/throughSee/manifest.json 17 ●●●●● patch | view | raw | blame | history
widgets/throughSee/nls/es/strings.js 5 ●●●●● patch | view | raw | blame | history
widgets/throughSee/nls/strings.js 7 ●●●●● patch | view | raw | blame | history
widgets/throughSee/nls/zh-cn/strings.js 5 ●●●●● patch | view | raw | blame | history
widgets/volumeAnalysis/Widget.js 3 ●●●●● patch | view | raw | blame | history
config.json
@@ -264,6 +264,14 @@
      {
        "name": "空间查询",
        "uri": "widgets/spatialQuery/Widget"
      },
      {
        "name": "多边形裁剪",
        "uri": "widgets/polygonClipping/Widget"
      },
      {
        "name": "通视分析",
        "uri": "widgets/throughSee/Widget"
      }
    ],
    "groups": [],
widgets/LeftNavigationBar/Widget.js
@@ -388,6 +388,7 @@
                                            that[item.id] = scene.open(host + partOfUrl, undefined, {
                                                autoSetView: false //不自动定位
                                            });
                                            console.log(222)
                                            topic.publish('appendTilt', 'Layermanagement', item);
                                            topic.publish('appendTiltS', 'spatialAnalysis', item);
                                            topic.publish('addLayersLegends', 'legends', item);
@@ -431,6 +432,7 @@
                                                        destination: rectangle
                                                    });
                                                });
                                                console.log(444)
                                                topic.publish('appendItem', 'Layermanagement', item, that[item.id]);
                                                topic.publish('appendItemS', 'spatialAnalysis', item, that[item.id]);
                                                topic.publish('addLayersLegends', 'legends', item);
@@ -441,7 +443,7 @@
                                                    dataType: 'JSON',
                                                    success: function (res) {
                                                        // console.log(111)
                                                        that[item.id] = that.map.imageryLayers.addImageryProvider(new Cesium.SuperMapImageryProvider({
                                                            url: res[0].path,
                                                        }));
@@ -461,9 +463,6 @@
                                    }
                                } else {
@@ -514,6 +513,7 @@
                                        that[obj.data.id] = scene.open(host + partOfUrl, undefined, {
                                            autoSetView: false //不自动定位
                                        });
                                        console.log(333)
                                        topic.publish('appendTilt', 'Layermanagement', obj.data);
                                        topic.publish('appendTiltS', 'spatialAnalysis', obj.data);
                                        topic.publish('addLayersLegends', 'legends', obj.data);
@@ -552,6 +552,7 @@
                                                    destination: rectangle
                                                });
                                            });
                                            console.log(555)
                                            topic.publish('appendItem', 'Layermanagement', obj.data, that[obj.data.id]);
                                            topic.publish('appendItemS', 'spatialAnalysis', obj.data, that[obj.data.id]);
                                            topic.publish('addLayersLegends', 'legends', obj.data);
widgets/digTheEarth/Widget.js
@@ -54,6 +54,7 @@
                // });
              
                var tooltip = window.MYcreateTooltip(viewer._element);
                // console.log(viewer._element, 534)
                //绘制多边形
                var handlerPolygon = new Cesium.DrawHandler(viewer, Cesium.DrawMode.Polygon, 0);
                handlerPolygon.activeEvt.addEventListener(function (isActive) {
@@ -68,6 +69,9 @@
                    }
                });
                handlerPolygon.movingEvt.addEventListener(function (windowPosition) {
                    // console.log(windowPosition,534)
                    // console.log(handlerPolygon.isDrawing,555)
                    // console.log(viewer._element, 534)
                    if (windowPosition.x < 200 && windowPosition.y < 150) {
                        tooltip.setVisible(false);
                        return;
@@ -126,6 +130,7 @@
                    // }
                    // handlerPolygon.polygon.show = false;
                    // handlerPolygon.polyline.show = false;
                    that.closesDigTheEarth();
                };
@@ -135,8 +140,10 @@
                $('#toolbardigTheEarth').show();
                $('#loadingbar').remove();
                that.handlerPolygon = handlerPolygon;
                that.tooltip = tooltip;
            },
            handlerPolygon: '',
            tooltip: '',
            closesDigTheEarth: function () {
                // console.log('gaunbi');
                var that = this;
@@ -148,7 +155,7 @@
                    that.handlerPolygon.polyline.show = false;
                }
                that.handlerPolygon.deactivate();
                that.tooltip.setVisible(false);
            },
            onOpen: function () {
widgets/polygonClipping/Widget.html
New file
@@ -0,0 +1,45 @@
<div>
    <div id='loadingbar' class="spinner">
        <div class="spinner-container container1">
            <div class="circle1"></div>
            <div class="circle2"></div>
            <div class="circle3"></div>
            <div class="circle4"></div>
        </div>
        <div class="spinner-container container2">
            <div class="circle1"></div>
            <div class="circle2"></div>
            <div class="circle3"></div>
            <div class="circle4"></div>
        </div>
        <div class="spinner-container container3">
            <div class="circle1"></div>
            <div class="circle2"></div>
            <div class="circle3"></div>
            <div class="circle4"></div>
        </div>
    </div>
    <div id="toolbarpolygonClipping" class="param-container tool-bar">
        <table>
            <tr>
                <td>
                    <button type="button" id="polygon" class="button black">绘制裁剪面</button>
                </td>
                <td>
                    <button type="button" id="clear" class="button black">清除</button>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <select id="clip-modepolygonClipping" class="cesium-button">
                        <option value="clip-outside">开挖外部</option>
                        <option value="clip-inside">开挖内部</option>
                    </select>
                </td>
            </tr>
        </table>
    </div>
    <i class="layui-icon closeOUR">
        &#x1006;
    </i></span>
</div>
widgets/polygonClipping/Widget.js
New file
@@ -0,0 +1,253 @@
define([
    'dojo/_base/declare',
    'dojo/_base/lang',
    'dojo/_base/array',
    'dojo/_base/html',
    'dojo/topic',
    'jimu/BaseWidget',
],
    function (declare,
        lang,
        array,
        html,
        topic,
        BaseWidget
    ) {
        return declare([BaseWidget], {
            baseClass: 'jimu-widget-polygonClipping',
            name: 'polygonClipping',
            flag: false,
            startup: function () {
                var that = this;
                topic.subscribe("beginpolygonClipping", lang.hitch(this, this.beginpolygonClipping));
                topic.subscribe("closespolygonClipping", lang.hitch(this, this.closespolygonClipping));
                // topic.publish('getbeginSlope', that.beginSlope);
                $(`.${that.baseClass}`).find('.closeOUR').click(() => {
                    $(`.${that.baseClass}`).hide();
                    that.closespolygonClipping();
                })
                // that.beginpolygonClipping();
            },
            beginpolygonClipping: function () {
                console.log(`${this.name}--kaishi`);
                var that = this;
                // 初始化viewer部件
                var viewer = this.map;
                // viewer.imageryLayers.addImageryProvider(new Cesium.BingMapsImageryProvider({
                //     url: 'https://dev.virtualearth.net',
                //     mapStyle: Cesium.BingMapsStyle.AERIAL,
                //     key: window.MYURL_CONFIG.BING_MAP_KEY
                // }));
                var scene = viewer.scene;
                var positions = [], regions = [], geometry = null, clipMode = Cesium.ModifyRegionMode.CLIP_OUTSIDE;
                console.log(Cesium.SpatialQuery3D);
                var spatialQuery = new Cesium.SpatialQuery3D(scene);
                // try {
                //场景添加S3M图层服务
                var promise = scene.open('http://www.supermapol.com/realspace/services/3D-BIMbuilding/rest/realspace');
                Cesium.when(promise, function (layers) {
                    // 精准定位
                    scene.camera.setView({
                        destination: new Cesium.Cartesian3(-2180753.065987198, 4379023.266141494, 4092583.575045952),
                        orientation: {
                            heading: 4.0392222751147955,
                            pitch: 0.010279641987852584,
                            roll: 1.240962888005015e-11
                        }
                    });
                    if (!scene.pickPositionSupported) {
                        alert('不支持深度纹理,无法拾取位置!');
                    }
                    for (var layer of layers) {
                        layer.selectEnabled = false;
                        // 设置被裁剪对象的颜色
                        layer.clipLineColor = new Cesium.Color(1, 1, 1, 0);
                    }
                    var tooltip = createTooltip(document.body);
                    var handlerPolygon = new Cesium.DrawHandler(viewer, Cesium.DrawMode.Polygon, 0);
                    handlerPolygon.activeEvt.addEventListener(function (isActive) {
                        if (isActive == true) {
                            viewer.enableCursorStyle = false;
                            viewer._element.style.cursor = '';
                            $('body').removeClass('drawCur').addClass('drawCur');
                        } else {
                            viewer.enableCursorStyle = true;
                            $('body').removeClass('drawCur');
                        }
                    });
                    handlerPolygon.movingEvt.addEventListener(function (windowPosition) {
                        if (handlerPolygon.isDrawing) {
                            tooltip.showAt(windowPosition, '<p>点击确定多边形顶点</p><p>右键单击结束绘制</p>');
                        } else {
                            tooltip.showAt(windowPosition, '<p>点击绘制第一个点</p>');
                        }
                    });
                    handlerPolygon.drawEvt.addEventListener(function (result) {
                        tooltip.setVisible(false);
                        handlerPolygon.polygon.show = false;
                        handlerPolygon.polyline.show = false;
                        if (clipMode === Cesium.ModifyRegionMode.CLIP_OUTSIDE) {
                            positions = [];
                            for (var pt of result.object.positions) {
                                var cartographic = Cesium.Cartographic.fromCartesian(pt);
                                var longitude = Cesium.Math.toDegrees(cartographic.longitude);
                                var latitude = Cesium.Math.toDegrees(cartographic.latitude);
                                var height = cartographic.height;
                                positions.push(longitude, latitude, height);
                            }
                            regions = [];
                            regions.push(positions);
                            geometry = regions;
                            for (var layer of layers) {
                                layer.setModifyRegions(regions, clipMode);
                            }
                        } else {
                            for (var layer of layers) {
                                var array = [].concat(result.object.positions);
                                var point3ds = new Cesium.Point3Ds();
                                regions = [];
                                for (var i = 0, len = array.length; i < len; i++) {
                                    var cartographic = Cesium.Cartographic.fromCartesian(array[i]);
                                    var longitude = Cesium.Math.toDegrees(cartographic.longitude);
                                    var latitude = Cesium.Math.toDegrees(cartographic.latitude);
                                    var h = cartographic.height;
                                    var pnt = new Cesium.Point3D(longitude, latitude, h);
                                    point3ds.add(pnt);
                                }
                                regions.push(point3ds);
                                geometry = null;
                                geometry = new Cesium.GeoRegion3D(regions);
                                geometry.extrudedHeight = -100;
                                geometry.isLatLon = false;
                                spatialQuery.build();
                                layer.setCustomClipGeometry({
                                    geometry: geometry,
                                    clippingType: Cesium.ClippingType.KeepOutside,
                                    spatialQuery: spatialQuery
                                });
                            }
                        }
                    });
                    $('#polygon').click(function () {
                        handlerPolygon.activate();
                    });
                    $('#clear').click(function () {
                        handlerPolygon.clear();
                        // 清除裁剪结果
                        if (clipMode === Cesium.ModifyRegionMode.CLIP_OUTSIDE) {
                            for (var layer of layers) {
                                layer.clearModifyRegions();
                            }
                        } else {
                            for (var layer of layers) {
                                layer.clearCustomClipGeometry();
                            }
                            geometry = null;
                        }
                        positions = [];
                        regions = [];
                    });
                    $('#clip-modepolygonClipping').on('propertychange input', function () {
                        clipMode = $(this).val() === 'clip-inside' ? Cesium.ModifyRegionMode.CLIP_INSIDE : Cesium.ModifyRegionMode.CLIP_OUTSIDE;
                        if (clipMode === Cesium.ModifyRegionMode.CLIP_OUTSIDE) {
                            for (var layer of layers) {
                                layer.clearModifyRegions();
                            }
                        } else {
                            for (var layer of layers) {
                                layer.clearCustomClipGeometry();
                            }
                        }
                        geometry = null;
                        positions = [];
                        regions = [];
                    });
                    $('#clip-modepolygonClipping').on('propertychange input', function () {
                        clipMode = $(this).val() === 'clip-inside' ? Cesium.ModifyRegionMode.CLIP_INSIDE : Cesium.ModifyRegionMode.CLIP_OUTSIDE;
                        if (clipMode === Cesium.ModifyRegionMode.CLIP_INSIDE) {
                            for (var layer of layers) {
                                if (geometry !== null) {
                                    layer.setCustomClipGeometry({
                                        geometry: geometry,
                                        clippingType: Cesium.ClippingType.KeepInside,
                                        spatialQuery: spatialQuery
                                    });
                                    geometry = null;
                                } else {
                                    alert("请点击绘制裁剪面");
                                }
                            }
                        } else {
                            if (geometry !== null) {
                                for (var layer of layers) {
                                    layer.setModifyRegions(regions, clipMode);
                                }
                                geometry = null;
                            } else {
                                alert("请点击绘制裁剪面");
                            }
                        }
                    });
                    $('#toolbarpolygonClipping').show();
                    $('#loadingbar').remove();
                }, function (e) {
                    if (widget._showRenderLoopErrors) {
                        var title = '加载SCP失败,请检查网络连接状态或者url地址是否正确?';
                        widget.showErrorPanel(title, undefined, e);
                    }
                });
                // }
                // catch (e) {
                //     if (widget._showRenderLoopErrors) {
                //         var title = '渲染时发生错误,已停止渲染。';
                //         widget.showErrorPanel(title, undefined, e);
                //     }
                // }
            },
            closespolygonClipping: function (froms) {
                console.log(`${this.name}--guanbi`);
            },
            onOpen: function () {
            },
            onClose: function () {
                //面板关闭的时候触发 (when this panel is closed trigger)
                console.log('jies')
            },
            onMinimize: function () {
                this.resize();
            },
            onMaximize: function () {
                this.resize();
            },
            resize: function () {
            },
            destroy: function () {
                //销毁的时候触发
                //todo
                //do something before this func
                this.inherited(arguments);
            }
        });
    });
widgets/polygonClipping/css/style.css
New file
@@ -0,0 +1,42 @@
.jimu-widget-polygonClipping {
  position: fixed !important;
  top: 72px !important;
  right: 388px !important;
  width: 200px !important;
  height: 40px !important;
  background-color: rgb(255, 255, 255);
  font-size: 14px;
  color: rgb(0, 0, 0);
  z-index: 12 !important;
  border-radius: 10px;
  display: none;
  box-shadow: 0 0 8px #fff;
  padding: 0px 5px !important;
}
.jimu-widget-polygonClipping .closeOUR {
  position: absolute;
  right: 5px;
  top: 5px;
  font-size: 18px;
  cursor: pointer;
}
.jimu-widget-polygonClipping .closeOUR:hover {
  color: red;
}
/* .jimu-widget-polygonClipping .but {
  line-height: 30px;
  width: 80px;
  height: 30px;
  font-size: 16px;
  border-radius: 5px;
  box-shadow: 2px 2px 15px -5px #378ef1;
   border: 1px solid transparent;
  background-color: #fff;
}
.jimu-widget-polygonClipping .but:hover {
  box-shadow: 2px 2px 25px -5px #1679eb;
} */
widgets/polygonClipping/manifest.json
New file
@@ -0,0 +1,17 @@
{
  "name": "polygonClipping",
  "2D": true,
  "3D": true,
  "platform": "HTML",
  "version": "2.10",
  "wabVersion": "2.10",
  "author": "liuyg",
  "description": "",
  "copyright": "",
  "license": "",
  "properties": {
    "hasConfig": false,
    "inPanel": false,
    "hasVersionManager": false
  }
}
widgets/polygonClipping/nls/es/strings.js
New file
@@ -0,0 +1,5 @@
define(
   ({
    _widgetLabel: "polygonClipping"
  })
);
widgets/polygonClipping/nls/strings.js
New file
@@ -0,0 +1,7 @@
define({
  root: ({
    _widgetLabel: "polygonClipping"
  }),
  "es": 1,
  "zh-cn": 1
});
widgets/polygonClipping/nls/zh-cn/strings.js
New file
@@ -0,0 +1,5 @@
define(
   ({
    _widgetLabel: "多边形裁剪"
  })
);
widgets/profileAnalysis/Widget.js
@@ -149,7 +149,6 @@
                }
                //创建剖面分析对象
                var profile = new Cesium.Profile(scene);
                function createTooltip(frameDiv) {//抄录createTooltip函数
                    var tooltip = function (frameDiv) {
@@ -190,7 +189,6 @@
                            this.message = message;
                        }
                    };
                    return new tooltip(frameDiv);
                }
widgets/searchL/Cesiumadd.js
New file
@@ -0,0 +1,162 @@
define([], function () {
  function createTooltip(frameDiv) {//抄录createTooltip函数
    var oldDiv = document.getElementsByClassName('mytwipsy');
    // console.log(oldDiv)
    if (oldDiv.length != 0) {
      oldDiv[0].remove();
    }
    var tooltip = function (frameDiv) {
      var div = document.createElement('DIV');
      div.className = "mytwipsy myright";
      div.style.position = 'absolute';
      div.style.backgroundColor = '#fff';
      div.style.borderRadius = '5px';
      div.style.boxShadow = '2px 2px 15px -5px #39A5FD';
      div.style.padding = '2px 5px 2px 5px';
      div.style.fontSize = '14px';
      var arrow = document.createElement('DIV');
      arrow.className = "twipsy-arrow";
      div.appendChild(arrow);
      var title = document.createElement('DIV');
      title.className = "twipsy-inner";
      div.appendChild(title);
      this._div = div;
      this._title = title;
      this.message = '';
      // add to frame div and display coordinates
      frameDiv.appendChild(div);
      var that = this;
      div.onmousemove = function (evt) {
        that.showAt({ x: evt.clientX, y: evt.clientY }, that.message);
      };
    }
    tooltip.prototype.setVisible = function (visible) {
      this._div.style.display = visible ? 'block' : 'none';
    };
    tooltip.prototype.showAt = function (position, message) {
      if (position && message) {
        this.setVisible(true);
        this._title.innerHTML = message;
        this._div.style.left = position.x + 40 + "px";
        this._div.style.top = (position.y - this._div.clientHeight / 2) + "px";
        this.message = message;
      }
    };
    return new tooltip(frameDiv);
  }
  window.MYcreateTooltip = createTooltip;//全局使用
  var URL_CONFIG = {
    BINGMAP: "//dev.virtualearth.net"
    , BING_MAP_KEY: "AkOyUpgDCoz063AWW1WfHnxp5222UBdxLOp1XvRv0tuebQnr2S7UcZkiLgME7gX0"
    , SCENE_BIMBUILDING: "http://www.supermapol.com/realspace/services/3D-BIMbuilding/rest/realspace"
    , SCENE_CBD: "http://www.supermapol.com/realspace/services/3D-CBDCache20200416/rest/realspace"
    , SCENE_CHONGQING_TX: "http://www.supermapol.com/realspace/services/3D-CQmodel_wireframe_2000/rest/realspace"
    , SCENE_CLIP: "http://www.supermapol.com/realspace/services/3D-clip_fengbian/rest/realspace"
    , SCENE_FEATUREVALUE: "http://www.supermapol.com/realspace/services/3D-featureValue_building9/rest/realspace/datas/%E4%B9%9D%E5%8F%B7@%E4%B9%9D%E5%8F%B7%E6%A5%BC/config"
    , SCENE_GTC_BUILDIBG: "http://www.supermapol.com/realspace/services/3D-data_all/rest/realspace/datas/building_udb@building/config"
    , SCENE_GTC_FLOOR9: "http://www.supermapol.com/realspace/services/3D-data_all/rest/realspace/datas/%E6%8B%89%E4%BD%8E%E6%A5%BC%E5%B1%82@%E4%B9%9D%E5%8F%B7%E6%A5%BC/config"
    , SCENE_GTC_GROUND: "http://www.supermapol.com/realspace/services/3D-data_all/rest/realspace/datas/%E5%9C%B0%E9%9D%A2/config"
    , SCENE_GTC_HILL: "http://www.supermapol.com/realspace/services/3D-data_all/rest/realspace/datas/%E5%B1%B1/config"
    , SCENE_GTC_LB9: "http://www.supermapol.com/realspace/services/3D-data_all/rest/realspace/datas/%E6%8B%89%E4%BD%8E%E6%A5%BC%E6%9D%BF@%E4%B9%9D%E5%8F%B7%E6%A5%BC/config"
    , SCENE_GTC_LWALL9: "http://www.supermapol.com/realspace/services/3D-data_all/rest/realspace/datas/%E6%8B%89%E4%BD%8E%E5%A2%99@%E4%B9%9D%E5%8F%B7%E6%A5%BC/config"
    , SCENE_GTC_LWINDOW9: "http://www.supermapol.com/realspace/services/3D-data_all/rest/realspace/datas/%E6%8B%89%E4%BD%8E%E7%AA%97@%E4%B9%9D%E5%8F%B7%E6%A5%BC/config"
    , SCENE_GTC_UINSIDE: "http://www.supermapol.com/realspace/services/3D-data_all/rest/realspace/datas/%E5%86%85%E9%83%A8%E7%BB%93%E6%9E%84@%E5%AE%A4%E5%86%85/config"
    , SCENE_GTC_UNIT9: "http://www.supermapol.com/realspace/services/3D-data_all/rest/realspace/datas/%E5%90%88%E5%B9%B6%E5%90%8E@%E4%B9%9D%E5%8F%B7%E6%A5%BC/config"
    , SCENE_GTC_UOUTSIDE: "http://www.supermapol.com/realspace/services/3D-data_all/rest/realspace/datas/%E5%A4%96%E9%83%A8%E7%BB%93%E6%9E%84@%E5%AE%A4%E5%86%85/config"
    , SCENE_GTC_UWINDOW: "http://www.supermapol.com/realspace/services/3D-data_all/rest/realspace/datas/U%E5%9E%8B%E5%BB%BA%E7%AD%91%E7%AA%97@%E5%AE%A4%E5%86%85/config"
    , SCENE_GTC_WALL9: "http://www.supermapol.com/realspace/services/3D-data_all/rest/realspace/datas/%E5%90%88%E5%B9%B6%E5%89%8D%E5%A2%99@%E4%B9%9D%E5%8F%B7%E6%A5%BC/config"
    , SCENE_GTC_WINDOW9: "http://www.supermapol.com/realspace/services/3D-data_all/rest/realspace/datas/%E5%90%88%E5%B9%B6%E5%89%8D%E6%A5%BC%E6%9D%BF@%E4%B9%9D%E5%8F%B7%E6%A5%BC/config"
    , SCENE_HISTOGRAM: "http://www.supermapol.com/realspace/services/3D-Histogram/rest/realspace"
    , SCENE_JINJIANG: "http://www.supermapol.com/realspace/services/3D-jinjiang/rest/realspace"
    , SCENE_MODELUPDATE: "http://www.supermapol.com/realspace/services/3D-MoXingGengXin/rest/realspace"
    , SCENE_MOVINGLIGHT: "http://www.supermapol.com/realspace/services/3D-BIMMoXing/rest/realspace"
    , SCENE_NIAOCHAO: "http://www.supermapol.com/realspace/services/3D-OlympicGreen20200416/rest/realspace"
    , SCENE_OLYMPIC: "http://www.supermapol.com/realspace/services/3D-Olympic/rest/realspace"
    , SCENE_OLYMPIC_GREEN: "http://www.supermapol.com/realspace/services/3D-SampleCodeForFan20200420/rest/realspace"
    , SCENE_OLYMPIC_NIGHT: "http://www.supermapol.com/realspace/services/3D-OlympicGreenNight/rest/realspace"
    , SCENE_POINTCLOUD: "http://www.supermapol.com/realspace/services/3D-cloud/rest/realspace"
    , SCENE_POLYLINEGROW_BUINDINGS: "http://www.supermapol.com/realspace/services/3D-buildings1122/rest/realspace"
    , SCENE_RECT: "http://www.supermapol.com/realspace/services/3D-Text01/rest/realspace"
    , SCENE_SGNS: "http://www.supermapol.com/realspace/services/3D-SGNS/rest/realspace"
    , SCENE_SICHUAN: "http://www.supermapol.com/realspace/services/3D-dixingyingxiang/rest/realspace"
    , SCENE_SRSB: "http://www.supermapol.com/realspace/services/3D-srsb/rest/realspace"
    , SCENE_SUOFEIYA: "http://www.supermapol.com/realspace/services/3D-suofeiya_church/rest/realspace"
    , SCENE_TISHUJU: "http://www.supermapol.com/realspace/services/3D-tishuju/rest/realspace"
    , SCENE_VOLUME_NEAREST: "http://www.supermapol.com/realspace/services/3D-compare/rest/realspace"
    , SCENE_WIREFRAME: "http://www.supermapol.com/realspace/services/3D-wireFrame/rest/realspace"
    , SCENE_WebGLCBD: "http://www.supermapol.com/realspace/services/3D-CBDCache20200416/rest/realspace"
    , SCENE_XGPARK: "http://www.supermapol.com/realspace/services/3D-yanmofenxi/rest/realspace"
    , SCP_BIM: "https://www.supermapol.com/realspace/services/3D-S3MData/rest/realspace/datas/T8H_NoLod/config"
    , SCP_CBD_BRIDGE: "http://www.supermapol.com/realspace/services/3D-CBDCache20200416/rest/realspace/datas/Ground_qiao@CBD/config"
    , SCP_CBD_BUILD: "http://www.supermapol.com/realspace/services/3D-CBD/rest/realspace/datas/Building@CBD/config"
    , SCP_CBD_GROUND1: "http://www.supermapol.com/realspace/services/3D-CBDCache20200416/rest/realspace/datas/Ground_1@CBD/config"
    , SCP_CBD_GROUND2: "http://www.supermapol.com/realspace/services/3D-WebGLCBD/rest/realspace/datas/Ground_2@%E6%96%B0CBD/config"
    , SCP_CBD_LAKE: "http://www.supermapol.com/realspace/services/3D-CBDCache20200416/rest/realspace/datas/Lake@CBD/config"
    , SCP_CBD_ROAD: "http://www.supermapol.com/realspace/services/3D-CBDCache20200416/rest/realspace/datas/Ground_Daolu@CBD/config"
    , SCP_CBD_TREE: "http://www.supermapol.com/realspace/services/3D-CBDCache20200416/rest/realspace/datas/Tree@CBD/config"
    , SCP_FCFH_DATA: "http://www.supermapol.com/realspace/services/data-FCFH_Shangdong/rest/data"
    , SCP_FCFH_QX: "http://www.supermapol.com/realspace/services/3D-FCFH_Shangdong/rest/realspace/datas/config/config"
    , SCP_FCFH_VECTOR_EXTRUDE: "http://www.supermapol.com/realspace/services/3D-individualHouse/rest/realspace/datas/%E4%B8%93%E9%A2%98%E6%88%B7%E5%9E%8B%E9%9D%A2_%E6%8B%89%E4%BC%B8/config"
    , SCP_HISTOGRAM1: "http://www.supermapol.com/realspace/services/3D-Histogram/rest/realspace/datas/Point2D_3000_5000/config"
    , SCP_HISTOGRAM2: "http://www.supermapol.com/realspace/services/3D-Histogram/rest/realspace/datas/Point2D_10000_max/config"
    , SCP_HISTOGRAM3: "http://www.supermapol.com/realspace/services/3D-Histogram/rest/realspace/datas/Point2D_min_1000/config"
    , SCP_HISTOGRAM4: "http://www.supermapol.com/realspace/services/3D-Histogram/rest/realspace/datas/Point2D_5000_10000/config"
    , SCP_HISTOGRAM5: "http://www.supermapol.com/realspace/services/3D-Histogram/rest/realspace/datas/Point2D_1000_3000/config"
    , SCP_JINJIANG: "http://www.supermapol.com/realspace/services/3D-jinjiang/rest/realspace/datas/jinjiang/config"
    , SCP_NIAOCHAO: "http://www.supermapol.com/realspace/services/3D-niaocao_water/rest/realspace/datas/%E9%B8%9F%E5%B7%A2%E4%BA%94%E6%9C%9F/config"
    , SCP_NIAOCHAO_WATER: "http://www.supermapol.com/realspace/services/3D-Olympic/rest/realspace/datas/NewDataset@water-caijian/config"
    , SCP_OLYMPIC_BILLBOARD: "http://www.supermapol.com/realspace/services/3D-WebGLOlympicGreen/rest/realspace/datas/BillBoard@OlympicGreen/config"
    , SCP_OLYMPIC_BUILD: "http://www.supermapol.com/realspace/services/3D-WebGLOlympicGreen/rest/realspace/datas/Building@OlympicGreen/config"
    , SCP_OLYMPIC_GROUND: "http://www.supermapol.com/realspace/services/3D-WebGLOlympicGreen/rest/realspace/datas/Ground@OlympicGreen/config"
    , SCP_OLYMPIC_TREE: "http://www.supermapol.com/realspace/services/3D-WebGLOlympicGreen/rest/realspace/datas/Tree@OlympicGreen/config"
    , SCP_OLYMPIC_WATER: "http://www.supermapol.com/realspace/services/3D-WebGLOlympicGreen/rest/realspace/datas/Waters@OlympicGreen/config"
    , SCP_PIPELINE: "https://www.supermapol.com/realspace/services/3D-pipeline_s3m/rest/realspace/datas/NetWork@Pipe3D/config"
    , SCP_POINTCLOUD: "http://www.supermapol.com/realspace/services/3D-cloud/rest/realspace/datas/POINTCLOUD23/config"
    , SCP_SGNS: "http://www.supermapol.com/realspace/services/3D-SGNS/rest/realspace/datas/siguniang/config"
    , SCP_SRSB: "http://www.supermapol.com/realspace/services/3D-srsb/rest/realspace/datas/srsb/config"
    , SCP_SRSB_WATER: "http://www.supermapol.com/realspace/services/3D-srsb/rest/realspace/datas/%E6%B0%B4%E9%9D%A2@vector/config"
    , SCP_SUOFEIYA: "http://www.supermapol.com/realspace/services/3D-suofeiya_church/rest/realspace/datas/Config/config"
    , SCP_VECTOR_LINE: "http://www.supermapol.com/realspace/services/3D-China/rest/realspace/datas/Line/config"
    , SCP_VECTOR_POLYGON: "http://www.supermapol.com/realspace/services/3D-China/rest/realspace/datas/%E4%B8%93%E9%A2%98%E5%9B%BE/config"
    , SCP_VECTOR_TEXT: "http://www.supermapol.com/realspace/services/3D-China/rest/realspace/datas/text/config"
    , SCP_WORLD_COUNTRY_VECTOR: "http://www.supermapol.com/realspace/services/3D-Countries-World2/rest/realspace/datas/Countries_1@World/config"
    , SCP_WORLD_COUNTRY_VECTOR2: " http://www.supermapol.com/realspace/services/3D-ShiJieGuoJiaBianJie/rest/realspace"
    , SCP_XGPARK: "http://www.supermapol.com/realspace/services/3D-yanmofenxi/rest/realspace/datas/sci_park/config"
    , STK: "https://www.supermapol.com/realspace/services/3D-stk_terrain/rest/realspace/datas/info/data/path"
    , SUPERMAP_IMG_MEC: "http://www.supermapol.com/realspace/services/map-China400/rest/maps/China400"
    , SUPERMAP_IMG_WGS: "http://www.supermapol.com/realspace/services/map-World/rest/maps/World_Google"
    , SiChuan_IMG: "http://www.supermapol.com/realspace/services/3D-dixingyingxiang/rest/realspace/datas/MosaicResult"
    , SiChuan_TERRAIN: "http://www.supermapol.com/realspace/services/3D-dixingyingxiang/rest/realspace/datas/DatasetDEM"
    , TDT_IMG: "https://[subdomain].tianditu.com/img_w/wmts"
    , TDT_LABEL: "https://[subdomain].tianditu.com/cia_w/wmts"
    , TENSE_IMG0: "http://www.supermapol.com/realspace/services/3D-HuanJingJianCe-2/rest/realspace/datas/rs0300@%E6%88%BF%E5%B1%B1"
    , TENSE_IMG1: "http://www.supermapol.com/realspace/services/3D-HuanJingJianCe-2/rest/realspace/datas/rs0310@%E6%88%BF%E5%B1%B1"
    , TENSE_IMG2: "http://www.supermapol.com/realspace/services/3D-HuanJingJianCe-2/rest/realspace/datas/rs0330@%E6%88%BF%E5%B1%B1"
    , TENSE_IMG3: "http://www.supermapol.com/realspace/services/3D-HuanJingJianCe-2/rest/realspace/datas/rs0340@%E6%88%BF%E5%B1%B1"
    , TENSE_IMG4: "http://www.supermapol.com/realspace/services/3D-HuanJingJianCe-2/rest/realspace/datas/rs0350@%E6%88%BF%E5%B1%B1"
    , TENSE_IMG5: "http://www.supermapol.com/realspace/services/3D-HuanJingJianCe-2/rest/realspace/datas/rs0400@%E6%88%BF%E5%B1%B1"
    , TENSE_IMG6: "http://www.supermapol.com/realspace/services/3D-HuanJingJianCe-2/rest/realspace/datas/rs0410@%E6%88%BF%E5%B1%B1"
    , TENSE_IMG7: "http://www.supermapol.com/realspace/services/3D-HuanJingJianCe-2/rest/realspace/datas/rs0420@%E6%88%BF%E5%B1%B1"
    , TENSE_IMG8: "http://www.supermapol.com/realspace/services/3D-HuanJingJianCe-2/rest/realspace/datas/rs0430@%E6%88%BF%E5%B1%B1"
    , TENSE_IMG9: "http://www.supermapol.com/realspace/services/3D-HuanJingJianCe-2/rest/realspace/datas/rs0440@%E6%88%BF%E5%B1%B1"
    , TENSE_IMG10: "http://www.supermapol.com/realspace/services/3D-HuanJingJianCe-2/rest/realspace/datas/rs0450@%E6%88%BF%E5%B1%B1"
    , TOKEN_TIANDITU: "4a00a1dc5387b8ed8adba3374bd87e5e"
    , ZF_IMG: "http://www.supermapol.com/realspace/services/3D-dxyx_ios2/rest/realspace/datas/MosaicResult_2@IMAGE_1"
    , ZF_IMG2: "http://www.supermapol.com/realspace/services/3D-ZF_normal/rest/realspace/datas/image"
    , ZF_TERRAIN: "http://www.supermapol.com/realspace/services/3D-dxyx_ios2/rest/realspace/datas/DatasetDEM_1@sichuanTer"
    , ZF_TERRAIN2: "http://www.supermapol.com/realspace/services/3D-ZF_normal/rest/realspace/datas/srtm_54_07@zhufeng"
  }
  window.MYURL_CONFIG = URL_CONFIG;//全局使用
});
widgets/searchL/Widget.js
@@ -11,7 +11,8 @@
    'jimu/BaseWidget',
    'jimu/utils',
    'jimu/css!libs/zTree_v3/css/zTreeStyle/zTreeStyle.css',
    'libs/zTree_v3/js/jquery.ztree.all'
    'libs/zTree_v3/js/jquery.ztree.all',
    './Cesiumadd'
],
    function (declare,
        lang,
@@ -33,50 +34,7 @@
            startup: function () {
                var that = this;
                function createTooltip(frameDiv) {//抄录createTooltip函数
                    var tooltip = function (frameDiv) {
                        var div = document.createElement('DIV');
                        div.className = "twipsy right";
                        var arrow = document.createElement('DIV');
                        arrow.className = "twipsy-arrow";
                        div.appendChild(arrow);
                        var title = document.createElement('DIV');
                        title.className = "twipsy-inner";
                        div.appendChild(title);
                        this._div = div;
                        this._title = title;
                        this.message = '';
                        // add to frame div and display coordinates
                        frameDiv.appendChild(div);
                        var that = this;
                        div.onmousemove = function (evt) {
                            that.showAt({ x: evt.clientX, y: evt.clientY }, that.message);
                        };
                    };
                    tooltip.prototype.setVisible = function (visible) {
                        this._div.style.display = visible ? 'block' : 'none';
                    };
                    tooltip.prototype.showAt = function (position, message) {
                        if (position && message) {
                            this.setVisible(true);
                            this._title.innerHTML = message;
                            this._div.style.left = position.x + 10 + "px";
                            this._div.style.top = (position.y - this._div.clientHeight / 2) + "px";
                            this.message = message;
                        }
                    };
                    return new tooltip(frameDiv);
                }
                window.MYcreateTooltip = createTooltip;//全局使用
                //关键词&&坐标
                $("#i-f-gjz").click(function () {
widgets/slope/Widget.js
@@ -59,51 +59,7 @@
                slope.ColorTable = colorTable;
                slope.Opacity = 1;
                function createTooltip(frameDiv) {//创建需要的函数
                    var tooltip = function (frameDiv) {
                        var div = document.createElement('DIV');
                        div.className = "twipsy right";
                        var arrow = document.createElement('DIV');
                        arrow.className = "twipsy-arrow";
                        div.appendChild(arrow);
                        var title = document.createElement('DIV');
                        title.className = "twipsy-inner";
                        div.appendChild(title);
                        this._div = div;
                        this._title = title;
                        this.message = '';
                        // add to frame div and display coordinates
                        frameDiv.appendChild(div);
                        var that = this;
                        div.onmousemove = function (evt) {
                            that.showAt({ x: evt.clientX, y: evt.clientY }, that.message);
                        };
                    };
                    tooltip.prototype.setVisible = function (visible) {
                        this._div.style.display = visible ? 'block' : 'none';
                    };
                    tooltip.prototype.showAt = function (position, message) {
                        if (position && message) {
                            this.setVisible(true);
                            this._title.innerHTML = message;
                            this._div.style.left = position.x + 10 + "px";
                            this._div.style.top = (position.y - this._div.clientHeight / 2) + "px";
                            this.message = message;
                        }
                    };
                    return new tooltip(frameDiv);
                }
                var tooltip = createTooltip(viewer._element);
                var tooltip = window.MYcreateTooltip(viewer._element);
                //绘制多边形
                var handlerPolygon = new Cesium.DrawHandler(viewer, Cesium.DrawMode.Polygon, 0);
                handlerPolygon.activeEvt.addEventListener(function (isActive) {
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/pdpx.png'
                    }
                    // , {//https://blog.csdn.net/supermapsupport/article/details/100134590
                    //     //需要iServer发布成三维服务
                    //     name: '坡度分析',
@@ -66,11 +66,16 @@
                        classs: 'digTheEarth-tool',
                        img: './images/addL/pdpx.png'
                    }
                    // , {//方量分析//做好
                    //     name: '方量分析',
                    //     classs: 'volumeAnalysis-tool',
                    //     img: './images/addL/pdpx.png'
                    // }
                    , {//方量分析//做好
                        name: '方量分析',
                        classs: 'volumeAnalysis-tool',
                        img: './images/addL/pdpx.png'
                    },
                    {//通视分析
                        name: '通视分析',
                        classs: 'throughSee-tool',
                        img: './images/addL/pdpx.png'
                    }
                ];
                that.beginSpatialAnalysis(domHtmls);
@@ -119,6 +124,16 @@
                            , {//空间查询
                                name: '空间查询',
                                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'
                            }
                            ,
@@ -235,23 +250,20 @@
                    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');
                })
                $('.SelectLayerTool').click(() => {
                    $('#SelectLayerToolItem').toggle();
@@ -310,12 +322,17 @@
                }
            },
            removeItemS: function (item, obj) {
                // console.log('r1')
                console.log(obj, 'r1')
                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) {
                                this.liClick('默认:天地图影像', '默认:天地图影像');
                            }
                        }
                    }
@@ -359,12 +376,17 @@
                }
            },
            removeTiltS: function (item, obj) {
                console.log(obj, 'r2')
                // console.log('r2')
                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) {
                                this.liClick('默认:天地图影像', '默认:天地图影像');
                            }
                        }
                    }
@@ -375,42 +397,24 @@
                }
            },
            // 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);
            // 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);
            //             }
            //         });
            //     });
            // },
            // 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) {
                    $('.tool-y-box').hide();
@@ -464,29 +468,19 @@
                    $(".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');
                }
            },
            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 () {
widgets/spatialAnalysis/css/style.css
@@ -44,7 +44,7 @@
  padding: 5px;
  text-align: center;
  overflow: hidden;
  height: calc(100% - 40px);
  height: calc(100% - 90px);
  width: 100%;
  margin: 0;
  overflow: auto;
widgets/throughSee/Widget.html
New file
@@ -0,0 +1,10 @@
<div>
    <div id='toolbarthroughSee' class="param-container tool-bar">
        <button type="button" id="addViewPointthroughSee" class="button black">添加观察点</button>
        <button type="button" id="addTargetPointthroughSee" class="button black">添加目标点</button>
        <button type="button" id="clearthroughSee" class="button black">清除</button>
    </div>
    <i class="layui-icon closeOUR">
        &#x1006;
    </i></span>
</div>
widgets/throughSee/Widget.js
New file
@@ -0,0 +1,330 @@
define([
    'dojo/_base/declare',
    'dojo/_base/lang',
    'dojo/_base/array',
    'dojo/_base/html',
    'dojo/topic',
    'jimu/BaseWidget',
],
    function (declare,
        lang,
        array,
        html,
        topic,
        BaseWidget
    ) {
        return declare([BaseWidget], {
            baseClass: 'jimu-widget-throughSee',
            name: 'throughSee',
            flag: false,
            startup: function () {
                var that = this;
                topic.subscribe("beginthroughSee", lang.hitch(this, this.beginthroughSee));
                topic.subscribe("closesthroughSee", lang.hitch(this, this.closesthroughSee));
                // topic.publish('getbeginSlope', that.beginSlope);
                $(`.${that.baseClass}`).find('.closeOUR').click(() => {
                    $(`.${that.baseClass}`).hide();
                    that.closesthroughSee();
                })
                // that.beginthroughSee();
            },
            beginthroughSee: function () {
                console.log(`${this.name}--kaishi`);
                var that = this;
                var viewer = that.map;
                if (!viewer.scene.pickPositionSupported) {
                    alert('不支持深度纹理,通视分析功能无法使用(无法添加观测点目标点)!');
                }
                $("#toolbarthroughSee").show();
                $('#loadingbar').remove();
                var scene = viewer.scene;
                scene.shadowMap.darkness = 1.275; //设置第二重烘焙纹理的效果(明暗程度)
                scene.skyAtmosphere.brightnessShift = 0.4;  //修改大气的亮度
                scene.debugShowFramesPerSecond = false;
                scene.hdrEnabled = false;
                scene.sun.show = false;
                // 01设置环境光的强度-新处理CBD场景
                scene.lightSource.ambientLightColor = new Cesium.Color(0.65, 0.65, 0.65, 1);
                // 添加光源
                var position1 = new Cesium.Cartesian3.fromDegrees(116.261209157595, 39.3042238956531, 480);
                //光源方向点
                var targetPosition1 = new Cesium.Cartesian3.fromDegrees(116.261209157595, 39.3042238956531, 430);
                var dirLightOptions = {
                    targetPosition: targetPosition1,
                    color: new Cesium.Color(1.0, 1.0, 1.0, 1),
                    intensity: 0.55
                };
                directionalLight_1 = new Cesium.DirectionalLight(position1, dirLightOptions);
                scene.addLightSource(directionalLight_1);
                var sightline = new Cesium.Sightline(scene);
                var widget = viewer.cesiumWidget;
                // try {
                var promise = scene.open(window.MYURL_CONFIG.SCENE_CBD);
                Cesium.when.all(promise, function (layer) {
                    scene.camera.setView({
                        destination: new Cesium.Cartesian3.fromDegrees(116.44621857300415, 39.899281526734555, 216.7793905027196),
                        orientation: {
                            heading: 0.41348036210986194,
                            pitch: -0.13636490404291735,
                            roll: 6.283185307179563
                        }
                    });
                    for (var i = 0; i < layer.length; i++) {
                        layer[i].selectEnabled = false;
                    }
                    sightline.build();
                }, function (e) {
                    if (widget._showRenderLoopErrors) {
                        var title = '加载SCP失败,请检查网络连接状态或者url地址是否正确?';
                        widget.showErrorPanel(title, undefined, e);
                    }
                });
                // } catch (e) {
                //     if (widget._showRenderLoopErrors) {
                //         var title = '渲染时发生错误,已停止渲染。';
                //         widget.showErrorPanel(title, undefined, e);
                //     }
                // }
                var addViewFlag = false;//当前点击状态是否是 添加观察点
                var addTargetFlag = false;//当前点击状态是否是 添加目标点
                var mv = false;//当前点击状态是否是 添加观察点
                var tf = false;//当前点击状态是否是 添加目标点
                var num = 0;//添加的目标点的点号
                var couldRemove = false;//是否能移除目标点
                var tooltip = window.MYcreateTooltip(viewer._element)
                var handlerPoint = new Cesium.DrawHandler(viewer, Cesium.DrawMode.Point);
                handlerPoint.drawEvt.addEventListener(function (result) {
                    //添加观察点
                    if (addViewFlag) {
                        var point = result.object;
                        // point.show = false;
                        var position = result.object.position;
                        //将获取的点的位置转化成经纬度
                        var cartographic = Cartesian2toDegrees(position);
                        //设置观察点
                        sightline.viewPosition = cartographic;
                        addViewFlag = false;
                    }
                    handlerPoint.deactivate();
                });
                var handler = new Cesium.ScreenSpaceEventHandler(scene.canvas);
                document.getElementById("addViewPointthroughSee").onclick = function () {
                    if (tf == false) {
                        addViewFlag = true;
                        if (handlerPoint.active) {
                            return;
                        }
                        viewer.entities.removeAll();
                        if (couldRemove) {
                            sightline.removeAllTargetPoint();
                        }
                        handlerPoint.activate();
                        handler.setInputAction(function (evt) {
                            //鼠标移动,更新最后一次添加的目标点的位置
                            var position = scene.pickPosition(evt.endPosition);
                        }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
                        if (addViewFlag || addTargetFlag) {
                            viewer.enableCursorStyle = false;
                            viewer._element.style.cursor = '';
                            $('body').removeClass('drawCur').addClass('drawCur');
                        }
                        //鼠标移动事件,更新点
                        handler.setInputAction(function (evt) {
                            tooltip.showAt(evt.endPosition, '<p>点击确定观察点</p>');
                        }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
                        //鼠标点击事件,添加点
                        handler.setInputAction(function (e) {
                            $('body').removeClass('drawCur');
                            mv = true;
                            tooltip.setVisible(false);
                            handler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_CLICK);
                            handler.removeInputAction(Cesium.ScreenSpaceEventType.MOUSE_MOVE);
                        }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
                    } else {
                        layer.tips('正在添加目标点,请先右键关闭', $('#addViewPointthroughSee'), { tips: [1, 'red'] });
                    }
                }
                document.getElementById("addTargetPointthroughSee").onclick = function () {
                    if (mv) {
                        addViewFlag = false;
                        addTargetFlag = true;
                        tf = true;
                        if (addViewFlag || addTargetFlag) {
                            viewer.enableCursorStyle = false;
                            viewer._element.style.cursor = '';
                            $('body').removeClass('drawCur').addClass('drawCur');
                        }
                        //鼠标点击事件,添加点
                        handler.setInputAction(function (e) {
                            var position = scene.pickPosition(e.position);
                            addTarget(position);
                        }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
                        //鼠标移动事件,更新点
                        handler.setInputAction(function (evt) {
                            //鼠标移动,更新最后一次添加的目标点的位置
                            var position = scene.pickPosition(evt.endPosition);
                            if (num > 0) {
                                sightline.removeTargetPoint("point0");
                                var cartographic = Cartesian2toDegrees(position);
                                var flag = sightline.addTargetPoint({
                                    position: cartographic,
                                    name: "point0"
                                });
                            }
                            tooltip.showAt(evt.endPosition, '<p>点击确定目标点右键结束</p>');
                        }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
                        //鼠标右键事件,结束
                        handler.setInputAction(function () {
                            viewer.enableCursorStyle = true;
                            $('body').removeClass('drawCur');
                            tooltip.setVisible(false);
                            handler.removeInputAction(Cesium.ScreenSpaceEventType.MOUSE_MOVE);
                            handler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_CLICK);
                            tf = false;
                        }, Cesium.ScreenSpaceEventType.RIGHT_CLICK);
                    } else {
                        layer.tips('未添加观察点', $('#addTargetPointthroughSee'), { tips: [1, 'red'] });
                    }
                };
                document.getElementById("clearthroughSee").onclick = function () {
                    if (tf == false) {
                        addViewFlag = false;
                        addTargetFlag = false;
                        mv = false;
                        tf = false;
                        handlerPoint.clear();
                        viewer.entities.removeAll();
                        if (couldRemove) {
                            sightline.removeAllTargetPoint();
                            couldRemove = false;
                        }
                        viewer.enableCursorStyle = true;
                        $('body').removeClass('drawCur');
                    } else {
                        layer.tips('正在添加目标点,请先右键关闭', $('#addViewPointthroughSee'), { tips: [1, 'red'] });
                    }
                }
                //添加通视点
                function addTarget(CartesianPosition) {
                    if (addViewFlag === false && addTargetFlag) {
                        num += 1;
                        //将获取的点的位置转化成经纬度
                        var cartographic = Cartesian2toDegrees(CartesianPosition);
                        //添加目标点
                        var name = "point" + num;
                        var flag = sightline.addTargetPoint({
                            position: cartographic,
                            name: name
                        });
                        couldRemove = true;
                    }
                }
                //笛卡尔转换为经纬度
                function Cartesian2toDegrees(position) {
                    var cartographic = Cesium.Cartographic.fromCartesian(position);
                    var longitude = Cesium.Math.toDegrees(cartographic.longitude);
                    var latitude = Cesium.Math.toDegrees(cartographic.latitude);
                    var height = cartographic.height;
                    return [longitude, latitude, height];
                }
                that.promise = promise;
                that.addViewFlag = addViewFlag;
                that.addTargetFlag = addTargetFlag;
                that.handlerPoint = handlerPoint;
            },
            promise: '',
            addViewFlag: '',
            addTargetFlag: '',
            handlerPoint: '',
            closesthroughSee: function (froms) {
                console.log(`${this.name}--guanbi`);
                that = this;
                Cesium.when.all(that.promise, function (layer) {
                    for (var i = 0; i < layer.length; i++) {
                        that.map.scene.layers.remove(layer[i].name)
                    }
                })
                that.addViewFlag = false;
                that.addTargetFlag = false;
                that.handlerPoint.clear();
                that.map.entities.removeAll();
                if (couldRemove) {
                    sightline.removeAllTargetPoint();
                    couldRemove = false;
                }
                that.map.enableCursorStyle = true;
                $('body').removeClass('drawCur');
            },
            onOpen: function () {
            },
            onClose: function () {
                //面板关闭的时候触发 (when this panel is closed trigger)
                console.log('jies')
            },
            onMinimize: function () {
                this.resize();
            },
            onMaximize: function () {
                this.resize();
            },
            resize: function () {
            },
            destroy: function () {
                //销毁的时候触发
                //todo
                //do something before this func
                this.inherited(arguments);
            }
        });
    });
widgets/throughSee/css/style.css
New file
@@ -0,0 +1,45 @@
.jimu-widget-throughSee {
  position: fixed !important;
  top: 72px !important;
  right: 388px !important;
  width: 230px !important;
  height: 40px !important;
  background-color: rgb(255, 255, 255);
  font-size: 14px;
  color: rgb(0, 0, 0);
  z-index: 12 !important;
  border-radius: 10px;
  /* display: none; */
  box-shadow: 0 0 8px #fff;
  padding: 0px 5px !important;
  line-height: 41px;
}
.jimu-widget-throughSee .closeOUR {
  position: absolute;
  right: 5px;
  top: -2.5px;
  font-size: 18px;
  cursor: pointer;
}
.jimu-widget-throughSee .closeOUR:hover {
  color: red;
}
.jimu-widget-throughSee button {
  line-height: 30px;
  /* width: 80px; */
  height: 30px;
  font-size: 14px;
  border-radius: 5px;
  box-shadow: 2px 2px 15px -5px #378ef1;
  border: 1px solid transparent;
  background-color: #fff;
  padding: 0 2px;
  margin-right: 2px;
}
.jimu-widget-throughSee button:hover {
  box-shadow: 2px 2px 25px -5px #1679eb;
}
widgets/throughSee/manifest.json
New file
@@ -0,0 +1,17 @@
{
  "name": "throughSee",
  "2D": true,
  "3D": true,
  "platform": "HTML",
  "version": "2.10",
  "wabVersion": "2.10",
  "author": "liuyg",
  "description": "",
  "copyright": "",
  "license": "",
  "properties": {
    "hasConfig": false,
    "inPanel": false,
    "hasVersionManager": false
  }
}
widgets/throughSee/nls/es/strings.js
New file
@@ -0,0 +1,5 @@
define(
   ({
    _widgetLabel: "throughSee"
  })
);
widgets/throughSee/nls/strings.js
New file
@@ -0,0 +1,7 @@
define({
  root: ({
    _widgetLabel: "throughSee"
  }),
  "es": 1,
  "zh-cn": 1
});
widgets/throughSee/nls/zh-cn/strings.js
New file
@@ -0,0 +1,5 @@
define(
   ({
    _widgetLabel: "通视分析"
  })
);
widgets/volumeAnalysis/Widget.js
@@ -175,9 +175,11 @@
                    }
                // })
                that.handlerPolygon = handlerPolygon;
                that.tooltip = tooltip;
            },
            handlerPolygon: '',
            tooltip: '',
            closesVolumeAnalysis: function (froms) {
                // console.log('guanbi');
                this.map.scene.globe.removeAllModifyRegion();
@@ -187,6 +189,7 @@
                document.getElementById("fillVolumeVolumeAnalysis").value = "";
                document.getElementById("remainderAreaVolumeAnalysis").value = "";
                this.handlerPolygon.clear();
                this.tooltip.setVisible(false);
            },
            onOpen: function () {