13 files modified
23 files added
| New file |
| | |
| | | <component name="ProjectCodeStyleConfiguration"> |
| | | <state> |
| | | <option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" /> |
| | | </state> |
| | | </component> |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project version="4"> |
| | | <component name="VcsDirectoryMappings"> |
| | | <mapping directory="$PROJECT_DIR$" vcs="Git" /> |
| | | </component> |
| | | </project> |
| | |
| | | } |
| | | }, |
| | | { |
| | | "name": "洪水淹没分析", |
| | | "uri": "widgets/FloodAnalysis/Widget", |
| | | "position": { |
| | | "left": 20, |
| | | "top": 90, |
| | | "width": "440px", |
| | | "height": "320px", |
| | | "relativeTo": "map" |
| | | } |
| | | }, |
| | | { |
| | | "name": "运维管理", |
| | | "uri": "widgets/BackStageManagement/Widget" |
| | | } |
| | |
| | | "maximumLevel": 17 |
| | | } |
| | | ] |
| | | }, |
| | | }, |
| | | { |
| | | "name": "离线影像", |
| | | "tooltip": "赣州市离线影像", |
| | |
| | | } |
| | | }, |
| | | "widgets": [ |
| | | |
| | | |
| | | |
| | | |
| | | { |
| | | "name": "监测预警", |
| | | "uri": "widgets/ComprehensiveSupervise/Widget", |
| | |
| | | } |
| | | }, |
| | | { |
| | | "name": "洪水淹没分析", |
| | | "uri": "widgets/FloodAnalysis/Widget", |
| | | "position": { |
| | | "left": 20, |
| | | "top": 90, |
| | | "width": "440px", |
| | | "height": "320px", |
| | | "relativeTo": "map" |
| | | } |
| | | }, |
| | | { |
| | | "name": "运维管理", |
| | | "uri": "widgets/BackStageManagement/Widget" |
| | | } |
| | |
| | | "rules": [] |
| | | }, |
| | | "logoLink": "" |
| | | } |
| | | } |
| | |
| | | position: absolute; |
| | | bottom: 0px; |
| | | top: 95px; |
| | | } |
| | | } |
| | | /**洪水淹没分析弹窗**/ |
| | | .flood-box{ |
| | | margin: 20px; |
| | | } |
| | | |
| | | .flood-box-top{ |
| | | display: flex; |
| | | width: 100%; |
| | | height: 350px; |
| | | border: 1px solid black; |
| | | } |
| | | |
| | | .flood-box-bottom{ |
| | | text-align: right; |
| | | margin-top: 15px; |
| | | } |
| | | |
| | | /**损失分析**/ |
| | | .evaluate-analysis{ |
| | | margin: 15px; |
| | | } |
| | | |
| | | .evaluate-box-top{ |
| | | width: 100%; |
| | | height: 60px; |
| | | } |
| | | |
| | | .evaluate-box-middle{ |
| | | width: 96%; |
| | | height: 350px; |
| | | border: 1px solid black; |
| | | padding: 0px 10px 0px 10px; |
| | | } |
| | | |
| | | .evaluate-box-top-left{ |
| | | display: flex; |
| | | font-size: 17px; |
| | | } |
| | | |
| | | .evaluate-box-top-right{ |
| | | margin-left: 70px; |
| | | } |
| | | |
| | | .evaluate-box-top{ |
| | | display: flex; |
| | | } |
| | | |
| | | .evaluate-table-thead caption{ |
| | | font-size: 20px; |
| | | margin: 15px 0 15px 0; |
| | | } |
| | | |
| | | .column-2{ |
| | | margin-left: 20px; |
| | | } |
| | | |
| | | .evaluate-echarts{ |
| | | width: 100%; |
| | | display: none; |
| | | } |
| New file |
| | |
| | | <!DOCTYPE html> |
| | | <html lang="en"> |
| | | <head> |
| | | <meta charset="UTF-8"> |
| | | <title>评估分析</title> |
| | | <link rel="stylesheet" href="./css/style.css"> |
| | | <link rel="stylesheet" href=""> |
| | | </head> |
| | | <body> |
| | | <div class="evaluate-analysis"> |
| | | <div class="evaluate-top"></div> |
| | | |
| | | <div class="evaluate-box"> |
| | | <div class="evaluate-box-top"> |
| | | <div class="evaluate-box-top-left"> |
| | | <div class="column-1"> |
| | | <div> |
| | | <span>受灾户数:</span><span>125</span> |
| | | </div> |
| | | <div> |
| | | <span>受灾面积:</span><span>47.999km²</span> |
| | | </div> |
| | | </div> |
| | | <div class="column-2"> |
| | | <div> |
| | | <span>受灾人口:</span><span>625人</span> |
| | | </div> |
| | | <div> |
| | | <span>房屋价值:</span><span>189.999万元</span> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="evaluate-box-top-right"> |
| | | <label > |
| | | <input id="list" type="radio" name="value" value="list" checked='checked'>列表 |
| | | </label> |
| | | |
| | | <label > |
| | | <input id="echarts" type="radio" name="value" value="echarts">图表 |
| | | </label> |
| | | </div> |
| | | </div> |
| | | <div class="evaluate-box-middle"> |
| | | <table class="evaluate-table-thead table-thead"> |
| | | <caption>人口财产淹没损失表</caption> |
| | | <thead> |
| | | <tr> |
| | | <th><div>编号</div></th> |
| | | <th><div>受淹户数(户)</div></th> |
| | | <th><div>受淹人口数量(人)</div></th> |
| | | <th><div>受淹居民地面积(km²)</div></th> |
| | | <th><div>受淹房屋价值(万元/人)</div></th> |
| | | </tr> |
| | | </thead> |
| | | </table> |
| | | <div class="evaluate-echarts" id="evaluate-echarts"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="evaluate-bottom"> |
| | | <button type="button">生成淹没图</button> |
| | | </div> |
| | | |
| | | </div> |
| | | |
| | | |
| | | <script src="../../../libs/jquery/jquery-3.3.1.min.js"></script> |
| | | <script src="../../../libs/layer/layer.js"></script> |
| | | <script src="../../../libs/echarts/v4/echarts.min.js"></script> |
| | | <script src="js/evaluateAnalysis.js"></script> |
| | | </body> |
| | | </html> |
| New file |
| | |
| | | <!DOCTYPE html> |
| | | <html lang="en"> |
| | | <head> |
| | | <meta charset="UTF-8"> |
| | | <title>洪水淹没分析</title> |
| | | <link rel="stylesheet" href="./css/style.css"> |
| | | <link rel="stylesheet" href=""> |
| | | </head> |
| | | <body> |
| | | <div class="flood-simulation-analysis"> |
| | | <div class="flood-top"> |
| | | |
| | | </div> |
| | | <div class="flood-box"> |
| | | <div class="flood-box-top"> |
| | | <div class="flood-box-left">11</div> |
| | | <div class="flood-box-right">22</div> |
| | | </div> |
| | | <div class="flood-box-bottom"> |
| | | <button type='button' id="start-analysis-btn"> 开始分析 </button> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | <script src="../../../libs/jquery/jquery-3.3.1.min.js"></script> |
| | | <script src="../../../libs/layer/layer.js"></script> |
| | | <script src="./js/floodAnalysis.js"></script> |
| | | </body> |
| | | </html> |
| New file |
| | |
| | | $(function () { |
| | | // change事件 |
| | | $('input[type=radio][name=value]').change(function () { |
| | | if (this.value == 'list'){ |
| | | $('.evaluate-echarts').hide() |
| | | $('.evaluate-box-top-left').css('visibility','visible') |
| | | $('.evaluate-table-thead').show() |
| | | }else { |
| | | $('.evaluate-table-thead').hide() |
| | | $('.evaluate-box-top-left').css('visibility','hidden') |
| | | |
| | | recharts_z() |
| | | loadEcharts() |
| | | $('.evaluate-echarts').show() |
| | | } |
| | | }); |
| | | |
| | | function loadEcharts(){ |
| | | var echartsOption = { |
| | | tooltip: { |
| | | trigger: 'item' |
| | | }, |
| | | legend: { |
| | | top: '5%', |
| | | left: 'center' |
| | | }, |
| | | series: [ |
| | | { |
| | | type: 'pie', |
| | | radius: ['40%', '70%'], |
| | | avoidLabelOverlap: false, |
| | | itemStyle: { |
| | | borderRadius: 10, |
| | | borderColor: '#fff', |
| | | borderWidth: 0 |
| | | }, |
| | | label: { |
| | | show: true, |
| | | position: 'left' |
| | | }, |
| | | emphasis: { |
| | | label: { |
| | | show: true, |
| | | fontSize: 20, |
| | | fontWeight: 'bold' |
| | | } |
| | | }, |
| | | labelLine: { |
| | | show: false |
| | | }, |
| | | data: [ |
| | | { value: 1048, name: '会昌县' }, |
| | | { value: 735, name: '石城县' }, |
| | | { value: 580, name: '宁都县' }, |
| | | ] |
| | | } |
| | | ] |
| | | } |
| | | |
| | | |
| | | |
| | | var chartDom = document.getElementById('evaluate-echarts'); |
| | | var myChart = echarts.init(chartDom); |
| | | echartsOption&&myChart.setOption(echartsOption,true); |
| | | } |
| | | |
| | | function recharts_z() { |
| | | console.log($(window).width(),$(window).height(),"777") |
| | | var width = $(window).width() * 0.8; |
| | | var height = ($(window).height() - 50) - 80; |
| | | $('#evaluate-echarts').empty(); |
| | | $('#evaluate-echarts').removeAttr("_echarts_instance_").empty(); |
| | | var chartPie = document.getElementById('evaluate-echarts'); |
| | | var myChartPie = echarts.init(chartPie); |
| | | var resize = { |
| | | width: width, |
| | | height: height |
| | | } |
| | | myChartPie.resize(resize); |
| | | } |
| | | }); |
| New file |
| | |
| | | $(function () { |
| | | $('#start-analysis-btn').click(function () { |
| | | evaluateAnalysisPopup() |
| | | }) |
| | | |
| | | //评估分析弹窗 |
| | | function evaluateAnalysisPopup(){ |
| | | var url = '../../common/popup/evaluateAnalysis.html'; |
| | | var top = ($(window).height() - 526) / 2; |
| | | var left = ($(window).width() - 1100 - 340) / 2 + 340; |
| | | layer.open({ |
| | | title:'评估分析', |
| | | type: 2, |
| | | maxmin: false, //开启最大化最小化按钮 |
| | | area: ['802px', '526px'], |
| | | skin: 'evaluateAnalysis', |
| | | offset: [top, left], |
| | | content: url, |
| | | id: "evaluateAnalysisLayer", |
| | | closeBtn: 1 |
| | | }); |
| | | } |
| | | |
| | | }); |
| | |
| | | flag: false, |
| | | flags: false, |
| | | megflag: false, |
| | | floodAnalysisFlag:false, |
| | | |
| | | postCreate: function () { |
| | | this.inherited(arguments); |
| | |
| | | } else { |
| | | iconUrl = iconConfig.icon; |
| | | } |
| | | if (iconConfig.name == "AnalysisOfBarrierLake" || iconConfig.name == 'ThematicDynamicRiver' || iconConfig.name == "MapSection") { |
| | | if (iconConfig.name == "AnalysisOfBarrierLake" || iconConfig.name == 'ThematicDynamicRiver' || iconConfig.name == "MapSection" || iconConfig.name == "FloodAnalysis") { |
| | | node = null; |
| | | return; |
| | | } else { |
| | |
| | | 'position': "absolute", |
| | | 'top': "45px", |
| | | 'left': "0px", |
| | | 'height': '135px', |
| | | 'height': '180px', |
| | | 'width': '126px', |
| | | 'background': 'rgb(0,23,54)', |
| | | 'z-index': '50' |
| | |
| | | var firstNode = null; |
| | | var middleNode = null; |
| | | var lastNode = null; |
| | | var finalNode = null; |
| | | for (var i = 0; i < iconNode.length; i++) { |
| | | if (iconNode[i].name == 'AnalysisOfBarrierLake') { |
| | | firstNode = html.create('li', { |
| | |
| | | if (!that.flags) { |
| | | $(event.target).parent().parent().siblings().toggleClass('click-icon-node'); |
| | | } |
| | | console.log(self.openedId,"8888") |
| | | if (self.openedId && self.openedId === firstNode.config.id) { |
| | | self._switchNodeToClose(self.openedId); |
| | | return; |
| | |
| | | } |
| | | that.flag = true; |
| | | that.megflag = true; |
| | | that.floodAnalysisFlag = true; |
| | | } |
| | | }) |
| | | firstNode.config = iconNode[i]; |
| | |
| | | this._createDropTriangle(firstNode); |
| | | } |
| | | } |
| | | |
| | | |
| | | if (iconNode[i].name == 'ThematicDynamicRiver') { |
| | | middleNode = html.create('li', { |
| | | 'class': 'icon-node jimu-float-trailing openli', |
| | |
| | | } |
| | | that.flags = true; |
| | | that.megflag = true; |
| | | that.floodAnalysisFlag = true |
| | | } |
| | | }) |
| | | middleNode.config = iconNode[i]; |
| | |
| | | } |
| | | that.flag = true; |
| | | that.flags = true; |
| | | that.floodAnalysisFlag = true; |
| | | } |
| | | }) |
| | | lastNode.config = iconNode[i]; |
| | |
| | | this._createDropTriangle(lastNode); |
| | | } |
| | | } |
| | | |
| | | if (iconNode[i].name == 'FloodAnalysis'){ |
| | | finalNode = html.create('li', { |
| | | 'class': 'icon-node jimu-float-trailing openli', |
| | | title: iconNode[i].label, |
| | | settingId: iconNode[i].id, |
| | | 'data-widget-name': iconNode[i].name, |
| | | innerHTML: iconNode[i].label |
| | | }, optionLi[0]); |
| | | var self = this; |
| | | $(node).on('click', finalNode, function (event) { |
| | | if (event.target.innerText == "洪水淹没分析") { |
| | | $(event.target).parent().parent().stop().hide(); |
| | | if (!finalNode.config.widgets || finalNode.config.widgets.length === 1 || |
| | | finalNode.config.openType === 'openAll') { |
| | | //widget or group with 'openAll' open type |
| | | if (!that.floodAnalysisFlag) { |
| | | $(event.target).parent().parent().siblings().toggleClass('click-icon-node'); |
| | | } |
| | | if (self.openedId && self.openedId === finalNode.config.id) { |
| | | self._switchNodeToClose(self.openedId); |
| | | return; |
| | | } else { |
| | | if (self.openedId) { |
| | | self._switchNodeToClose(self.openedId).then(lang.hitch(self, function () { |
| | | self._closeDropMenu(); |
| | | self._switchNodeToOpen(finalNode.config.id); |
| | | })); |
| | | } else { |
| | | self._switchNodeToOpen(finalNode.config.id); |
| | | } |
| | | } |
| | | } else { |
| | | if (self.dropMenuNode) { |
| | | self._closeDropMenu(); |
| | | |
| | | } else { |
| | | self._openDropMenu(finalNode); |
| | | } |
| | | } |
| | | that.flag = true; |
| | | that.flags = true; |
| | | that.megflag = true; |
| | | } |
| | | }) |
| | | finalNode.config = iconNode[i]; |
| | | if (finalNode.config.widgets && finalNode.config.widgets.length > 1 && |
| | | finalNode.config.openType === 'dropDown') { |
| | | this._createDropTriangle(finalNode); |
| | | } |
| | | } |
| | | |
| | | } |
| | | $(node).mouseover(function () { |
| | | $(dropDownDisplay).stop().show(); |
| | |
| | | this.flag = false; |
| | | this.flags = false; |
| | | this.megflag = false; |
| | | this.floodAnalysisFlag = false; |
| | | if (this.openedId && this.openedId === node.config.id) { |
| | | this._switchNodeToClose(this.openedId); |
| | | return; |
| | |
| | | for (i = this.headerIconCount; i < allIconConfigs.length; i++) { |
| | | // 做修改得地方 |
| | | iconConfig = allIconConfigs[i]; |
| | | if (iconConfig.name == "AnalysisOfBarrierLake" || iconConfig.name == "ThematicDynamicRiver" || iconConfig.name == "MapSection") { |
| | | if (iconConfig.name == "AnalysisOfBarrierLake" || iconConfig.name == "ThematicDynamicRiver" || iconConfig.name == "MapSection" || iconConfig.name == "FloodAnalysis") { |
| | | continue; |
| | | } else { |
| | | moreItems.push(iconConfig); |
| | |
| | | } |
| | | }); |
| | | return clazz; |
| | | }); |
| | | }); |
| | |
| | | |
| | | onOpen: function () { |
| | | //面板打开的时候触发 (when open this panel trigger) |
| | | window.open("http://localhost:82/#/login"); |
| | | window.open("http://localhost:82/#/login"); |
| | | this.onClose(); |
| | | }, |
| | | |
| | |
| | | $(divLi[i]).removeClass('jimu-state-selected'); |
| | | } |
| | | } |
| | | |
| | | |
| | | }, |
| | | |
| | | onMinimize: function () { |
| | |
| | | "longitude": 114.513911, |
| | | "latitude": 25.977936 |
| | | }, |
| | | |
| | | |
| | | { |
| | | "name": "信丰水文站", |
| | | "monitor": "http://10.36.162.20:803/new/sp_action.php?STCD=62304700&action=jpg", |
| | |
| | | "latitude": "" |
| | | } |
| | | ] |
| | | } |
| | | } |
| New file |
| | |
| | | var DrawDynamicClampGround = (function () { |
| | | var mouseHandlerDraw; |
| | | function GetNorthCartesain(cartesain0, cartesain1) { |
| | | var cartographic0 = Cesium.Cartographic.fromCartesian(cartesain0); |
| | | var cartographic1 = Cesium.Cartographic.fromCartesian(cartesain1); |
| | | var height = cartographic0.height > cartographic1.height ? cartographic0.height : cartographic1.height; |
| | | var length = Math.sqrt((cartographic0.longitude - cartographic1.longitude) * (cartographic0.longitude - cartographic1.longitude)+ |
| | | (cartographic0.latitude - cartographic1.latitude) * (cartographic0.latitude - cartographic1.latitude)); |
| | | var cartographicN = new Cesium.Cartographic(cartographic0.longitude, cartographic0.latitude + length, height); |
| | | var cartesainN = Cesium.Cartesian3.fromRadians(cartographicN.longitude, cartographicN.latitude, cartographicN.height); |
| | | return cartesainN; |
| | | } |
| | | |
| | | function _() { } |
| | | //绘制点 |
| | | _.startDrawPoint = function (viewer, callback) { |
| | | var scene = viewer.scene; |
| | | if (mouseHandlerDraw) { |
| | | mouseHandlerDraw.destroy(); |
| | | mouseHandlerDraw = null; |
| | | } else { |
| | | mouseHandlerDraw = new Cesium.ScreenSpaceEventHandler(scene.canvas); |
| | | } |
| | | |
| | | TooltipDiv.initTool(viewer.cesiumWidget.container); |
| | | |
| | | mouseHandlerDraw.setInputAction(function (movement) { |
| | | if (movement.position != null) { |
| | | var cartesian = viewer.scene.pickPosition(movement.position); |
| | | if (cartesian) { |
| | | var cartographic = Cesium.Cartographic.fromCartesian(cartesian); |
| | | if (cartographic) { |
| | | if (typeof callback == 'function') { |
| | | callback(cartographic); |
| | | } |
| | | |
| | | if (mouseHandlerDraw) { |
| | | mouseHandlerDraw.destroy(); |
| | | mouseHandlerDraw = null; |
| | | } |
| | | TooltipDiv.setVisible(false); |
| | | } |
| | | } |
| | | } |
| | | }, Cesium.ScreenSpaceEventType.LEFT_CLICK); |
| | | |
| | | mouseHandlerDraw.setInputAction(function (movement) { |
| | | var cartesian = viewer.scene.pickPosition(movement.endPosition); |
| | | if (cartesian) { |
| | | TooltipDiv.showAt(movement.endPosition, '点击添加点'); |
| | | } |
| | | }, Cesium.ScreenSpaceEventType.MOUSE_MOVE); |
| | | } |
| | | //绘制线段 |
| | | _.startDrawingLine = function (viewer, callback) { |
| | | var scene = viewer.scene; |
| | | if (mouseHandlerDraw) { |
| | | mouseHandlerDraw.destroy(); |
| | | mouseHandlerDraw = null; |
| | | } else { |
| | | mouseHandlerDraw = new Cesium.ScreenSpaceEventHandler(scene.canvas); |
| | | } |
| | | |
| | | TooltipDiv.initTool(viewer.cesiumWidget.container); |
| | | |
| | | var drawingPolyline = null; |
| | | var positions = []; |
| | | mouseHandlerDraw.setInputAction(function (movement) { |
| | | if (movement.position != null) { |
| | | var cartesian = viewer.scene.pickPosition(movement.position); |
| | | if (cartesian) { |
| | | if (positions.length == 0) { |
| | | positions.push(cartesian.clone()); |
| | | } else if (positions.length == 1) { |
| | | positions.push(cartesian.clone()); |
| | | if (typeof callback == 'function') { |
| | | callback(positions); |
| | | } |
| | | |
| | | if (mouseHandlerDraw) { |
| | | mouseHandlerDraw.destroy(); |
| | | mouseHandlerDraw = null; |
| | | } |
| | | TooltipDiv.setVisible(false); |
| | | //移除 |
| | | if (drawingPolyline != undefined) |
| | | viewer.entities.remove(drawingPolyline); |
| | | |
| | | } |
| | | } |
| | | } |
| | | }, Cesium.ScreenSpaceEventType.LEFT_CLICK); |
| | | |
| | | mouseHandlerDraw.setInputAction(function (movement) { |
| | | var cartesian = viewer.scene.pickPosition(movement.endPosition); |
| | | if (cartesian) { |
| | | if (positions.length == 0) { |
| | | TooltipDiv.showAt(movement.endPosition, '点击添加起点'); |
| | | } else if (positions.length == 1) { |
| | | //更新entity |
| | | var positionArr = []; |
| | | positionArr.push(positions[0]); |
| | | positionArr.push(cartesian); |
| | | if (drawingPolyline != undefined) |
| | | viewer.entities.remove(drawingPolyline); |
| | | var lineOpts = { |
| | | polyline: { |
| | | positions: positionArr, |
| | | clampToGround: true, // |
| | | width: 3, |
| | | material: Cesium.Color.BLUE.withAlpha(0.5), |
| | | } |
| | | }; |
| | | drawingPolyline = viewer.entities.add(lineOpts); |
| | | TooltipDiv.showAt(movement.endPosition, "点击添加终点"); |
| | | } |
| | | } |
| | | }, Cesium.ScreenSpaceEventType.MOUSE_MOVE); |
| | | |
| | | }; |
| | | //绘制多段线 |
| | | _.startDrawingPolyline = function (viewer, callback) { |
| | | var scene = viewer.scene; |
| | | if (mouseHandlerDraw) { |
| | | mouseHandlerDraw.destroy(); |
| | | mouseHandlerDraw = null; |
| | | } else { |
| | | mouseHandlerDraw = new Cesium.ScreenSpaceEventHandler(scene.canvas); |
| | | } |
| | | |
| | | TooltipDiv.initTool(viewer.cesiumWidget.container); |
| | | |
| | | var drawingPolyline = null; |
| | | var positions = []; |
| | | mouseHandlerDraw.setInputAction(function (movement) { |
| | | if (movement.position != null) { |
| | | var cartesian = viewer.scene.pickPosition(movement.position); |
| | | if (cartesian) { |
| | | positions.push(cartesian.clone()); |
| | | // var cartographic = Cesium.Cartographic.fromCartesian(cartesian);//当前点 |
| | | // if (cartographic) { |
| | | // if (cartesian) { |
| | | // var isIntersect = false; |
| | | // if (positions.length >= 3) { |
| | | // var cartographicArr = []; |
| | | // for (var i = 0; i < positions.length; i++) { |
| | | // cartographicArr.push(Cesium.Cartographic.fromCartesian(positions[i])); |
| | | // } |
| | | // var line1 = turf.lineString([[cartographic.longitude, cartographic.latitude], [cartographicArr[cartographicArr.length - 1].longitude, cartographicArr[cartographicArr.length - 1].latitude]]); |
| | | // for (var i = 2; i < positions.length; i++) { |
| | | // var line2 = turf.lineString([ |
| | | // [cartographicArr[i - 2].longitude, cartographicArr[i - 2].latitude], |
| | | // [cartographicArr[i - 1].longitude, cartographicArr[i - 1].latitude]]); |
| | | // var intersects = turf.lineIntersect(line1, line2); |
| | | // if (intersects && intersects.features && intersects.features.length > 0) { |
| | | // isIntersect = true; |
| | | |
| | | // alert('图形自相交!'); |
| | | // break; |
| | | // } |
| | | // } |
| | | // } |
| | | // if (isIntersect) { } else { |
| | | // positions.push(cartesian.clone()); |
| | | // } |
| | | // } |
| | | // } |
| | | } |
| | | } |
| | | }, Cesium.ScreenSpaceEventType.LEFT_CLICK); |
| | | |
| | | mouseHandlerDraw.setInputAction(function (movement) { |
| | | var cartesian = viewer.scene.pickPosition(movement.endPosition); |
| | | if (cartesian) { |
| | | if (positions.length == 0) { |
| | | TooltipDiv.showAt(movement.endPosition, '点击添加起点'); |
| | | } else { |
| | | var positionArr = []; |
| | | for (var i = 0; i < positions.length; i++) { |
| | | positionArr.push(positions[i]); |
| | | } |
| | | positionArr.push(cartesian); |
| | | |
| | | if (drawingPolyline != undefined) |
| | | viewer.entities.remove(drawingPolyline); |
| | | var lineOpts = { |
| | | polyline: { |
| | | positions: positionArr, |
| | | clampToGround: true, // |
| | | width: 3, |
| | | material: Cesium.Color.BLUE.withAlpha(0.5), |
| | | } |
| | | }; |
| | | drawingPolyline = viewer.entities.add(lineOpts); |
| | | TooltipDiv.showAt(movement.endPosition, "双击结束"); |
| | | } |
| | | } |
| | | }, Cesium.ScreenSpaceEventType.MOUSE_MOVE); |
| | | |
| | | mouseHandlerDraw.setInputAction(function (movement) { |
| | | if (movement.position != null) { |
| | | var cartesian = viewer.scene.pickPosition(movement.position); |
| | | if (cartesian) { |
| | | if (positions.length < 2) { |
| | | return; |
| | | } else { |
| | | |
| | | if (typeof callback == 'function') { |
| | | callback(positions); |
| | | } |
| | | |
| | | if (mouseHandlerDraw) { |
| | | mouseHandlerDraw.destroy(); |
| | | mouseHandlerDraw = null; |
| | | } |
| | | TooltipDiv.setVisible(false); |
| | | //移除entity |
| | | if (drawingPolyline != undefined) |
| | | viewer.entities.remove(drawingPolyline); |
| | | } |
| | | } |
| | | } |
| | | }, Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK); |
| | | }; |
| | | //绘制方位线 |
| | | _.startDrawingVLine = function (viewer, callback) { |
| | | var scene = viewer.scene; |
| | | if (mouseHandlerDraw) { |
| | | mouseHandlerDraw.destroy(); |
| | | mouseHandlerDraw = null; |
| | | } else { |
| | | mouseHandlerDraw = new Cesium.ScreenSpaceEventHandler(scene.canvas); |
| | | } |
| | | |
| | | TooltipDiv.initTool(viewer.cesiumWidget.container); |
| | | |
| | | var drawingPolylineN = null; |
| | | var drawingPolylineT = null; |
| | | var positions = []; |
| | | mouseHandlerDraw.setInputAction(function (movement) { |
| | | if (movement.position != null) { |
| | | var cartesian = viewer.scene.pickPosition(movement.position); |
| | | if (cartesian) { |
| | | if (positions.length == 0) { |
| | | positions.push(cartesian.clone()); |
| | | } else if (positions.length == 1) { |
| | | positions.push(cartesian.clone()); |
| | | if (typeof callback == 'function') { |
| | | callback(positions); |
| | | } |
| | | |
| | | if (mouseHandlerDraw) { |
| | | mouseHandlerDraw.destroy(); |
| | | mouseHandlerDraw = null; |
| | | } |
| | | TooltipDiv.setVisible(false); |
| | | //移除 |
| | | if (drawingPolylineN != undefined) |
| | | viewer.entities.remove(drawingPolylineN); |
| | | if (drawingPolylineT != undefined) |
| | | viewer.entities.remove(drawingPolylineT); |
| | | } |
| | | } |
| | | } |
| | | }, Cesium.ScreenSpaceEventType.LEFT_CLICK); |
| | | |
| | | mouseHandlerDraw.setInputAction(function (movement) { |
| | | var cartesian = viewer.scene.pickPosition(movement.endPosition); |
| | | if (cartesian) { |
| | | if (positions.length == 0) { |
| | | TooltipDiv.showAt(movement.endPosition, '点击添加起点'); |
| | | } else if (positions.length == 1) { |
| | | //更新entity |
| | | var positionArr = []; |
| | | positionArr.push(positions[0]); |
| | | positionArr.push(cartesian); |
| | | //实时 |
| | | if (drawingPolylineT != undefined) |
| | | viewer.entities.remove(drawingPolylineT); |
| | | var lineOptsT = { |
| | | polyline: { |
| | | positions: positionArr, |
| | | clampToGround: true, // |
| | | width: 3, |
| | | material: Cesium.Color.BLUE.withAlpha(0.5), |
| | | } |
| | | }; |
| | | drawingPolylineT = viewer.entities.add(lineOptsT); |
| | | //正北 |
| | | var positionN = []; |
| | | positionN.push(positions[0]); |
| | | positionN.push(GetNorthCartesain(positions[0], cartesian)); |
| | | if (drawingPolylineN != undefined) |
| | | viewer.entities.remove(drawingPolylineN); |
| | | var lineOptsN = { |
| | | polyline: { |
| | | positions: positionN, |
| | | clampToGround: true, // |
| | | width: 3, |
| | | material: Cesium.Color.RED.withAlpha(0.5), |
| | | } |
| | | }; |
| | | drawingPolylineN = viewer.entities.add(lineOptsN); |
| | | TooltipDiv.showAt(movement.endPosition, "点击结束"); |
| | | } |
| | | } |
| | | }, Cesium.ScreenSpaceEventType.MOUSE_MOVE); |
| | | |
| | | } |
| | | return _; |
| | | })(); |
| New file |
| | |
| | | var TooltipDiv = (function () { |
| | | var isInit = false; |
| | | |
| | | |
| | | function _() { }; |
| | | |
| | | _.initTool = function (frameDiv) { |
| | | if (isInit) { return; } |
| | | |
| | | var div = document.createElement('DIV'); |
| | | div.className = "tooltipdiv right";// |
| | | |
| | | var arrow = document.createElement('DIV'); |
| | | arrow.className = "tooltipdiv-arrow"; |
| | | div.appendChild(arrow); |
| | | |
| | | var title = document.createElement('DIV'); |
| | | title.className = "tooltipdiv-inner"; |
| | | div.appendChild(title); |
| | | |
| | | this._div = div; |
| | | this._title = title; |
| | | |
| | | frameDiv.appendChild(div); |
| | | |
| | | isInit = true; |
| | | } |
| | | |
| | | _.setVisible = function (visible) { |
| | | if (!isInit) { return; } |
| | | this._div.style.display = visible ? 'block' : 'none'; |
| | | }; |
| | | |
| | | /* |
| | | position屏幕坐标 |
| | | 显示在屏幕上 |
| | | */ |
| | | _.showAt = function (position, message) { |
| | | if (!isInit) { return; } |
| | | 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"; |
| | | } |
| | | }; |
| | | |
| | | return _; |
| | | })(); |
| New file |
| | |
| | | <div> |
| | | |
| | | <div class="dynamicriver-main"> |
| | | <div class="dynamicriver-header"> |
| | | <i></i> 水面线分析 |
| | | <div class="close-dynamicriver">×</div> |
| | | </div> |
| | | <!--<div> |
| | | <span>请选择水面线:</span><select id="flightRoute"></select> |
| | | </div>--> |
| | | <div class="water-analysis"> |
| | | <ul class="water-analysis-content"> |
| | | |
| | | </ul> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="dynamicriver-result"> |
| | | <div> |
| | | 数据信息 |
| | | <div class="close-dynamicriver-result">×</div> |
| | | </div> |
| | | <ul> |
| | | <li> |
| | | <span class="dynamicriver-result-name">录入人</span> |
| | | <span class="dynamicriver-result-sname"></span> |
| | | </li> |
| | | <li> |
| | | <span class="dynamicriver-result-name">采集时间</span> |
| | | <span class="dynamicriver-result-ctime"></span> |
| | | </li> |
| | | <li> |
| | | <span class="dynamicriver-result-name">录入时间</span> |
| | | <span class="dynamicriver-result-ltime"></span> |
| | | </li> |
| | | </ul> |
| | | </div> |
| | | <div id="aooaa"> |
| | | |
| | | </div> |
| | | |
| | | |
| | | </div> |
| New file |
| | |
| | | /////////////////////////////////////////////////////////////////////////// |
| | | // Copyright © 2020 zhongsong. All Rights Reserved. |
| | | // 模块描述:河流水面线分析 |
| | | /////////////////////////////////////////////////////////////////////////// |
| | | define([ |
| | | 'dojo/_base/declare', |
| | | 'dojo/_base/lang', |
| | | 'dojo/_base/array', |
| | | 'dojo/_base/html', |
| | | 'dojo/topic', |
| | | 'jimu/BaseWidget', |
| | | './Tooltip-div', |
| | | './DynamicDraw' |
| | | ], |
| | | function (declare, |
| | | lang, |
| | | array, |
| | | html, |
| | | topic, |
| | | BaseWidget |
| | | ) { |
| | | return declare([BaseWidget], { |
| | | baseClass: 'jimu-widget-DynamicRiver', |
| | | name: 'DynamicRiver', |
| | | riverWidth: 200, |
| | | riverHeight: 10, |
| | | speed: 10, |
| | | positions: [], |
| | | sideRes: null, |
| | | riverPrimitive: null, |
| | | material: null, |
| | | drawingPolyline: null, |
| | | // 增加waterData 用来存放列表数据 |
| | | waterData: null, |
| | | startup: function () { |
| | | this.inherited(arguments); |
| | | var self = this; |
| | | |
| | | this.map.scene.globe.depthTestAgainstTerrain = true; |
| | | //取消双击事件 |
| | | this.map.cesiumWidget.screenSpaceEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK); |
| | | |
| | | |
| | | // 点击地图上绘制水面线,并且显示水面线详细数据 |
| | | $('.water-analysis-content').on('click', '.content-right', function (e) { |
| | | |
| | | var dataIndex = $(e.target).parent().index(); |
| | | var cartesians = []; |
| | | |
| | | self.map.camera.flyTo({ |
| | | destination: Cesium.Cartesian3.fromDegrees(Number(self.waterData[dataIndex].zb[0].jd), Number(self.waterData[dataIndex].zb[0].wd), 5000), |
| | | easingFunction: Cesium.EasingFunction.QUADRACTIC_IN_OUT |
| | | }); |
| | | |
| | | $('.dynamicriver-result-sname').text(self.waterData[dataIndex].sname); |
| | | $('.dynamicriver-result-ctime').text(self.waterData[dataIndex].ctime.substring(0, 10)); |
| | | $('.dynamicriver-result-ltime').text(self.waterData[dataIndex].ltime.substring(0, 10)); |
| | | |
| | | if (e.target.nodeName == 'SPAN') { |
| | | $('.dynamicriver-result').stop().show(); |
| | | $('.dynamicriver-main').stop().hide(); |
| | | } |
| | | |
| | | |
| | | // $('.jimu-widget-DynamicRiver .dynamicriver-result').fadeIn(); |
| | | self.waterData[dataIndex].zb.forEach(function (item, index) { |
| | | cartesians.push(Cesium.Cartesian3.fromDegrees(item.jd, item.wd, item.elevation)) |
| | | }) |
| | | // self.drawLines(cartesians); |
| | | // DrawDynamicClampGround.startDrawingPolyline(self.map, function (cartesians) { |
| | | if (self.drawingPolyline != undefined) |
| | | self.map.entities.remove(self.drawingPolyline); |
| | | var lineOpts = { |
| | | polyline: { |
| | | positions: cartesians, |
| | | clampToGround: true, |
| | | width: 3, |
| | | color: "#279a9a" |
| | | } |
| | | }; |
| | | self.drawingPolyline = self.map.entities.add(lineOpts); |
| | | cartesians.splice(cartesians.length - 1, cartesians.length); |
| | | self.drawLines(cartesians); |
| | | // }); |
| | | |
| | | }) |
| | | |
| | | |
| | | $('.close-dynamicriver').click(function () { |
| | | $('.jimu-widget-DynamicRiver').stop().hide(); |
| | | }) |
| | | |
| | | // 关闭详细信息事件 |
| | | $('.close-dynamicriver-result').click(function () { |
| | | $('.dynamicriver-result').stop().hide(); |
| | | $('.dynamicriver-main').stop().show(); |
| | | |
| | | self.map.entities.remove(self.drawingPolyline); |
| | | self.map.scene.primitives.remove(self.riverPrimitive); |
| | | |
| | | self.map.camera.flyTo({ |
| | | destination: Cesium.Cartesian3.fromDegrees(115.257787, 25.885506, 549263.35), |
| | | easingFunction: Cesium.EasingFunction.QUADRACTIC_IN_OUT |
| | | }); |
| | | }) |
| | | |
| | | |
| | | |
| | | |
| | | /*for(var e = [ |
| | | [115.907543, 30.441563, 541.47], |
| | | [115.904337, 30.439412, 491.79], |
| | | [115.900612, 30.438483, 449.11], |
| | | [115.896375, 30.439377, 388.29], |
| | | [115.890586, 30.442215, 345.94], |
| | | [115.876946, 30.444641, 292.73] |
| | | ], r = [], i = 0; i < e.length; i++) r.push(Cesium.Cartesian3.fromDegrees(e[i][0], e[i][1], e[i][2])); |
| | | |
| | | this.positions = r; |
| | | |
| | | this.init();*/ |
| | | |
| | | }, |
| | | init: function () { |
| | | this.prepareVertex(); |
| | | if (this.sideRes) { |
| | | this.material = this.prepareMaterial(); |
| | | this.riverPrimitive && this.map.scene.primitives.remove(this.riverPrimitive); |
| | | this.riverPrimitive = this.createPrimitive(); |
| | | this.map.scene.primitives.add(this.riverPrimitive); |
| | | } |
| | | }, |
| | | prepareVertex: function () { |
| | | if (this.positions.length > 0) { |
| | | this.sideRes = this._lines2Plane(this.positions, this.riverWidth, this.riverHeight); |
| | | } |
| | | }, |
| | | setPositions: function (e) { |
| | | this.positions = e; |
| | | this.init(); |
| | | }, |
| | | resetPos: function () { |
| | | this.sideRes = this._lines2Plane(this.positions, this.riverWidth, this.riverHeight); |
| | | if (this.sideRes) { |
| | | this.material = this.prepareMaterial(); |
| | | this.riverPrimitive && this.map.scene.primitives.remove(this.riverPrimitive); |
| | | this.riverPrimitive = this.createPrimitive(); |
| | | this.map.scene.primitives.add(this.riverPrimitive); |
| | | } |
| | | }, |
| | | drawLines: function (r) { |
| | | this.setPositions(r); |
| | | }, |
| | | prepareMaterial: function () { |
| | | var e = new Cesium.Material({ |
| | | fabric: { |
| | | uniforms: { |
| | | image: "widgets/DynamicRiver/images/movingRiver.png", |
| | | alpha: 0.5, |
| | | moveVar: new Cesium.Cartesian3(50, 1, 100), |
| | | reflux: -1, |
| | | speed: this.speed, |
| | | move: true, |
| | | flipY: false |
| | | }, |
| | | source: "czm_material czm_getMaterial(czm_materialInput materialInput) { \n czm_material material = czm_getDefaultMaterial(materialInput); \n vec2 st = materialInput.st;\n if(move){\n float r = sqrt((st.x-0.8)*(st.x-0.8) + (st.y-0.8)*(st.y-0.8));\n float r2 = sqrt((st.x-0.2)*(st.x-0.2) + (st.y-0.2)*(st.y-0.2));\n float z = cos(moveVar.x*r + czm_frameNumber/100.0*moveVar.y)/moveVar.z;\n float z2 = cos(moveVar.x*r2 + czm_frameNumber/100.0*moveVar.y)/moveVar.z;\n st += sqrt(z*z+z2*z2);\n st.s += reflux * czm_frameNumber/1000.0 * speed;\n st.s = mod(st.s,1.0);\n }\n if(flipY){\n st = vec2(st.t,st.s);\n }\n vec4 colorImage = texture2D(image, st);\n material.alpha = alpha;\n material.diffuse = colorImage.rgb; \n return material; \n }" |
| | | } |
| | | }); |
| | | return e |
| | | }, |
| | | createPrimitive: function () { |
| | | var t = new Float64Array(this.sideRes.vertexs), |
| | | i = new Cesium.GeometryAttributes; |
| | | i.position = new Cesium.GeometryAttribute({ |
| | | componentDatatype: Cesium.ComponentDatatype.DOUBLE, |
| | | componentsPerAttribute: 3, |
| | | values: t |
| | | }), |
| | | i.st = new Cesium.GeometryAttribute({ |
| | | componentDatatype: Cesium.ComponentDatatype.FLOAT, |
| | | componentsPerAttribute: 2, |
| | | values: this.sideRes.uvs |
| | | }); |
| | | var r = new Cesium.Geometry({ |
| | | attributes: i, |
| | | indices: this.sideRes.indexs, |
| | | primitiveType: Cesium.PrimitiveType.TRIANGLES, |
| | | boundingSphere: Cesium.BoundingSphere.fromVertices(t) |
| | | }), |
| | | n = new Cesium.GeometryInstance({ |
| | | geometry: r |
| | | }), |
| | | o = new Cesium.RenderState; |
| | | return o.depthTest.enabled = !0, new Cesium.Primitive({ |
| | | geometryInstances: n, |
| | | appearance: new Cesium.Appearance({ |
| | | material: this.material, |
| | | renderState: o, |
| | | vertexShaderSource: "attribute vec3 position3DHigh;\n attribute vec3 position3DLow;\n attribute vec2 st;\n attribute float batchId;\n \n varying vec3 v_positionMC;\n varying vec3 v_positionEC;\n varying vec2 v_st;\n \n void main()\n {\n vec4 p = czm_computePosition();\n \n v_positionMC = position3DHigh + position3DLow; // position in model coordinates\n v_positionEC = (czm_modelViewRelativeToEye * p).xyz; // position in eye coordinates\n v_st = st;\n \n gl_Position = czm_modelViewProjectionRelativeToEye * p;\n }\n ", |
| | | fragmentShaderSource: "varying vec3 v_positionMC;\n varying vec3 v_positionEC;\n varying vec2 v_st;\n \n void main()\n {\n czm_materialInput materialInput;\n \n vec3 normalEC = normalize(czm_normal3D * czm_geodeticSurfaceNormal(v_positionMC, vec3(0.0), vec3(1.0)));\n #ifdef FACE_FORWARD\n normalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);\n #endif\n \n materialInput.s = v_st.s;\n materialInput.st = v_st;\n materialInput.str = vec3(v_st, 0.0);\n \n // Convert tangent space material normal to eye space\n materialInput.normalEC = normalEC;\n materialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(v_positionMC, materialInput.normalEC);\n \n // Convert view vector to world space\n vec3 positionToEyeEC = -v_positionEC;\n materialInput.positionToEyeEC = positionToEyeEC;\n \n czm_material material = czm_getMaterial(materialInput);\n \n #ifdef FLAT\n gl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n #else\n gl_FragColor = czm_phong(normalize(positionToEyeEC), material,czm_lightDirectionEC);\n #endif\n }\n " |
| | | }) |
| | | }) |
| | | }, |
| | | offsetHeight: function (height, time) { |
| | | this.startDH(height, time) |
| | | }, |
| | | startDH: function (height, time) { |
| | | if (height && time && this.riverPrimitive) { |
| | | for (var i = this, r = 0, n = height / (20 * time), o = this.sideRes.self, s = new Cesium.Cartesian3, l = 0, u = o.length; l < u; l++) { |
| | | var c = Cesium.Cartesian3.normalize(o[l], new Cesium.Cartesian3); |
| | | Cesium.Cartesian3.add(s, c, s) |
| | | } |
| | | Cesium.Cartesian3.normalize(s, s); |
| | | var h = Cesium.clone(this.riverPrimitive.modelMatrix); |
| | | this.dhEvent = function () { |
| | | if (Math.abs(r) <= Math.abs(height)) { |
| | | var t = Cesium.Cartesian3.multiplyByScalar(s, r, new Cesium.Cartesian3); |
| | | i.riverPrimitive.modelMatrix = Cesium.Matrix4.multiplyByTranslation(h, t, new Cesium.Matrix4) |
| | | } else i.map.clock.onTick.removeEventListener(i.dhEvent); |
| | | r += n |
| | | }, this.map.clock.onTick.addEventListener(this.dhEvent) |
| | | } |
| | | }, |
| | | //水面线转成水面 |
| | | _lines2Plane: function (positions, width, height) { |
| | | function n(point, height) { |
| | | if (!(point instanceof Cesium.Cartesian3)) return void console.log("请确认点是Cartesian3类型!"); |
| | | if (!height || 0 == height) return void console.log("请确认高度是非零数值!"); |
| | | var i = Cesium.Cartesian3.normalize(point, new Cesium.Cartesian3), |
| | | r = new Cesium.Ray(point, i);//射线 |
| | | return Cesium.Ray.getPoint(r, height) |
| | | } |
| | | |
| | | function o(point, point1, height) { |
| | | var r = Cesium.Cartesian3.normalize(Cesium.Cartesian3.subtract(point1, point, new Cesium.Cartesian3), new Cesium.Cartesian3), |
| | | n = Cesium.Cartesian3.normalize(point, new Cesium.Cartesian3), |
| | | o = Cesium.Cartesian3.cross(n, r, new Cesium.Cartesian3), |
| | | a = Cesium.Cartesian3.cross(r, n, new Cesium.Cartesian3), |
| | | l = new Cesium.Ray(point, o), |
| | | u = new Cesium.Ray(point, a); |
| | | return { |
| | | left: Cesium.Ray.getPoint(l, height), |
| | | right: Cesium.Ray.getPoint(u, height) |
| | | } |
| | | } |
| | | |
| | | if (!positions || positions.length <= 1 || !width || 0 == width) return void console.log("请确认参数符合规则:数组长度大于1,宽高不能为0!"); |
| | | for (var r = positions.length, a = [], l = [], u = width / 2, c = 0; c < r; c++) { |
| | | var h = void 0, |
| | | d = void 0, |
| | | f = void 0, |
| | | p = void 0, |
| | | m = void 0; |
| | | if (0 == c ? (h = positions[c], d = positions[c], f = positions[c + 1]) : c == r - 1 ? (h = positions[c - 1], d = positions[c], f = positions[c - 1]) : (h = positions[c - 1], d = positions[c], f = positions[c + 1]), 0 != height && (h = n(h, height), d = n(d, height), f = n(f, height)), h && d && f) { |
| | | var g = o(d, f, u); |
| | | if (p = g.left, m = g.right, 0 == c) { |
| | | a.push(p), l.push(m), a.push(p), l.push(m); |
| | | continue |
| | | } |
| | | if (!(c < r - 1)) { |
| | | a.push(m), l.push(p), a.push(m), l.push(p); |
| | | continue |
| | | } |
| | | a.push(p), l.push(m), g = o(d, h, u), p = g.left, m = g.right, a.push(m), l.push(p) |
| | | } |
| | | } |
| | | |
| | | var v = [], |
| | | y = []; |
| | | if (a.length != 2 * r) return void console.log("计算左右侧点出问题!"); |
| | | for (var _ = 0; _ < r; _++) { |
| | | var w = positions[_], |
| | | b = a[2 * _ + 0], |
| | | C = a[2 * _ + 1], |
| | | x = Cesium.Cartesian3.subtract(b, w, new Cesium.Cartesian3), |
| | | P = Cesium.Cartesian3.subtract(C, w, new Cesium.Cartesian3), |
| | | M = Cesium.Cartesian3.add(x, P, new Cesium.Cartesian3), |
| | | E = Cesium.Cartesian3.add(w, M, new Cesium.Cartesian3); |
| | | v.push(Cesium.clone(E)); |
| | | var T = l[2 * _ + 0], |
| | | S = l[2 * _ + 1]; |
| | | x = Cesium.Cartesian3.subtract(T, w, new Cesium.Cartesian3), P = Cesium.Cartesian3.subtract(S, w, new Cesium.Cartesian3), M = Cesium.Cartesian3.add(x, P, new Cesium.Cartesian3), E = Cesium.Cartesian3.add(w, M, new Cesium.Cartesian3), y.push(Cesium.clone(E)) |
| | | } |
| | | |
| | | for (var O = [], D = [], k = [], A = [], R = [], F = 0; F < r; F++) { |
| | | var L = Cesium.EncodedCartesian3.fromCartesian(y[F]); |
| | | D.push(y[F].x), D.push(y[F].y), D.push(y[F].z), k.push(L.high.x), k.push(L.high.y), k.push(L.high.z), A.push(L.low.x), A.push(L.low.y), A.push(L.low.z), O.push(1, 1), F < r - 1 && (R.push(F + 2 * r), R.push(F + 1), R.push(F + 1 + r), R.push(F + 2 * r), R.push(F + 1 + r), R.push(r + F + 2 * r)) |
| | | } |
| | | |
| | | for (var I = 0; I < r; I++) { |
| | | var N = Cesium.EncodedCartesian3.fromCartesian(v[I]); |
| | | D.push(v[I].x), D.push(v[I].y), D.push(v[I].z), k.push(N.high.x), k.push(N.high.y), k.push(N.high.z), A.push(N.low.x), A.push(N.low.y), A.push(N.low.z), O.push(1, 0) |
| | | } |
| | | |
| | | for (var V = 0; V < r; V++) { |
| | | var z = Cesium.EncodedCartesian3.fromCartesian(y[V]); |
| | | D.push(y[V].x), D.push(y[V].y), D.push(y[V].z), k.push(z.high.x), k.push(z.high.y), k.push(z.high.z), A.push(z.low.x), A.push(z.low.y), A.push(z.low.z), O.push(0, 1) |
| | | } |
| | | |
| | | for (var H = 0; H < r; H++) { |
| | | var B = Cesium.EncodedCartesian3.fromCartesian(v[H]); |
| | | D.push(v[H].x), D.push(v[H].y), D.push(v[H].z), k.push(B.high.x), k.push(B.high.y), k.push(B.high.z), A.push(B.low.x), A.push(B.low.y), A.push(B.low.z), O.push(0, 0) |
| | | } |
| | | |
| | | return { |
| | | left: v, |
| | | right: y, |
| | | self: positions, |
| | | vertexs: new Float32Array(D), |
| | | vertexsH: new Float32Array(k), |
| | | vertexsL: new Float32Array(A), |
| | | indexs: new Uint16Array(R), |
| | | uvs: new Float32Array(O) |
| | | } |
| | | }, |
| | | onOpen: function () { |
| | | //面板打开的时候触发 (when open this panel trigger) |
| | | |
| | | // 发送请求获得到水面线列表基本数据 |
| | | var self = this; |
| | | $.ajax({ |
| | | url: 'http://localhost:82/blade-ycreal/waterline/querylist', |
| | | dataType: 'json', |
| | | type: 'get', |
| | | success: function (data) { |
| | | self.waterData = data.data; |
| | | var lidom = null; |
| | | var contentLeft = null; |
| | | var contentRight = null; |
| | | for (var i = 0; i < data.data.length; i++) { |
| | | lidom = $('<li> </li>'); |
| | | contentLeft = $("<span class='content-left'></span>").text(data.data[i].sname); |
| | | contentRight = $("<span class='content-right'></span>"); |
| | | lidom.prepend(contentLeft); |
| | | lidom.append(contentRight); |
| | | $('.water-analysis-content').append(lidom); |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | onClose: function () { |
| | | //面板关闭的时候触发 (when this panel is closed trigger) |
| | | }, |
| | | |
| | | onMinimize: function () { |
| | | this.resize(); |
| | | }, |
| | | |
| | | onMaximize: function () { |
| | | this.resize(); |
| | | }, |
| | | |
| | | resize: function () { |
| | | |
| | | }, |
| | | |
| | | destroy: function () { |
| | | //销毁的时候触发 |
| | | //todo |
| | | //do something before this func |
| | | this.inherited(arguments); |
| | | } |
| | | |
| | | }); |
| | | }); |
| New file |
| | |
| | | <div> |
| | | <div class="flood-analysis-header"> |
| | | <i></i> 洪水淹没分析 |
| | | </div> |
| | | <!--<div> |
| | | <span>请选择水面线:</span><select id="flightRoute"></select> |
| | | </div>--> |
| | | <div class="flood-water-analysis"> |
| | | <ul> |
| | | <li><span>水位(m):</span><input id="flood_analysis_sw_headtab" type="text" value="200" /></li> |
| | | </ul> |
| | | <div class="flood-water-analysis-new"> |
| | | <div> |
| | | <input type="button" id="flood_hzsm_headtab" value="绘制水面线" /> |
| | | <input type="button" id='flood_qcsmx_headtab' value="清除"> |
| | | </div> |
| | | <!-- <div>--> |
| | | <!-- <input type="button" id="thematic_smsz_headtab" value="水面上涨" />--> |
| | | <!-- <input type="button" id="thematic_smxj_headtab" value="水面下降" />--> |
| | | <!-- </div>--> |
| | | </div> |
| | | </div> |
| | | </div> |
| New file |
| | |
| | | /////////////////////////////////////////////////////////////////////////// |
| | | // Copyright © 2022 guoshilong. All Rights Reserved. |
| | | // 模块描述:洪水淹没分析 |
| | | /////////////////////////////////////////////////////////////////////////// |
| | | define([ |
| | | 'dojo/_base/declare', |
| | | 'dojo/_base/lang', |
| | | 'dojo/_base/array', |
| | | 'dojo/_base/html', |
| | | 'dojo/topic', |
| | | 'jimu/BaseWidget', |
| | | './Tooltip-div', |
| | | './FloodAnalysis', |
| | | 'libs/layer/layer.js' |
| | | ], |
| | | function (declare, |
| | | lang, |
| | | array, |
| | | html, |
| | | topic, |
| | | BaseWidget, |
| | | tooltip, |
| | | flood, |
| | | layer |
| | | ) { |
| | | return declare([BaseWidget], { |
| | | baseClass: 'jimu-widget-FloodAnalysis', |
| | | name: 'FloodAnalysis', |
| | | riverWidth: 300, |
| | | riverHeight: 10, |
| | | speed: 10, |
| | | positions: [], |
| | | sideRes: null, |
| | | riverPrimitive: null, |
| | | material: null, |
| | | drawingPolyline: null, |
| | | polygonCartesianArray:[], |
| | | startup: function () { |
| | | this.inherited(arguments); |
| | | var self = this; |
| | | |
| | | this.map.scene.globe.depthTestAgainstTerrain = true; |
| | | //取消双击事件 |
| | | this.map.cesiumWidget.screenSpaceEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK); |
| | | |
| | | |
| | | $("#flood_hzsm_headtab").click(function () { |
| | | DrawDynamicClampGround.startDrawingPolyline(self.map, function (cartesians) { |
| | | if (self.drawingPolyline != undefined) |
| | | self.map.entities.remove(self.drawingPolyline); |
| | | var lineOpts = { |
| | | polyline: { |
| | | positions: cartesians, |
| | | clampToGround: true, |
| | | width: 3, |
| | | color: "#279a9a" |
| | | } |
| | | }; |
| | | self.drawingPolyline = self.map.entities.add(lineOpts); |
| | | cartesians.splice(cartesians.length - 1, cartesians.length); |
| | | self.drawLines(cartesians); |
| | | self.movehandLer() |
| | | self.canvasToImage() |
| | | }); |
| | | }); |
| | | |
| | | $('#flood_qcsmx_headtab').click(function () { |
| | | self.map.entities.remove(self.drawingPolyline); |
| | | self.map.scene.primitives.remove(self.riverPrimitive); |
| | | }) |
| | | |
| | | |
| | | // $("#thematic_hlkd_headtab").change(function (e) { |
| | | // self.riverWidth = Number($(this).val()); |
| | | // self.resetPos(); |
| | | // }); |
| | | $("#flood_analysis_sw_headtab").change(function (e) { |
| | | self.riverHeight = Number($(this).val()); |
| | | self.resetPos(); |
| | | }); |
| | | // $("#thematic_sls_headtab").change(function (e) { |
| | | // self.speed = Number($(this).val()); |
| | | // self.resetPos(); |
| | | // }); |
| | | // |
| | | // $("#thematic_smsz_headtab").click(function () { |
| | | // self.offsetHeight(Number($("#thematic_bhz_headtab").val()), 5); |
| | | // }); |
| | | // |
| | | // $("#thematic_smxj_headtab").click(function () { |
| | | // self.offsetHeight(-Number($("#thematic_bhz_headtab").val()), 5); |
| | | // }); |
| | | |
| | | |
| | | }, |
| | | init: function () { |
| | | this.prepareVertex(); |
| | | if (this.sideRes) { |
| | | this.material = this.prepareMaterial(); |
| | | this.riverPrimitive && this.map.scene.primitives.remove(this.riverPrimitive); |
| | | this.riverPrimitive = this.createPrimitive(); |
| | | this.map.scene.primitives.add(this.riverPrimitive); |
| | | } |
| | | }, |
| | | prepareVertex: function () { |
| | | if (this.positions.length > 0) { |
| | | this.sideRes = this._lines2Plane(this.positions, this.riverWidth, this.riverHeight); |
| | | console.log(this.sideRes,"----000----") |
| | | |
| | | } |
| | | }, |
| | | setPositions: function (e) { |
| | | this.positions = e; |
| | | this.init(); |
| | | }, |
| | | resetPos: function () { |
| | | this.sideRes = this._lines2Plane(this.positions, this.riverWidth, this.riverHeight); |
| | | if (this.sideRes) { |
| | | this.material = this.prepareMaterial(); |
| | | this.riverPrimitive && this.map.scene.primitives.remove(this.riverPrimitive); |
| | | this.riverPrimitive = this.createPrimitive(); |
| | | this.map.scene.primitives.add(this.riverPrimitive); |
| | | } |
| | | }, |
| | | drawLines: function (r) { |
| | | this.setPositions(r); |
| | | }, |
| | | prepareMaterial: function () { |
| | | var e = new Cesium.Material({ |
| | | fabric: { |
| | | uniforms: { |
| | | image: "widgets/ThematicDynamicRiver/images/movingRiver.png", |
| | | alpha: 0.5, |
| | | moveVar: new Cesium.Cartesian3(50, 1, 100), |
| | | reflux: -1, |
| | | speed: this.speed, |
| | | move: true, |
| | | flipY: false |
| | | }, |
| | | source: "czm_material czm_getMaterial(czm_materialInput materialInput) { \n czm_material material = czm_getDefaultMaterial(materialInput); \n vec2 st = materialInput.st;\n if(move){\n float r = sqrt((st.x-0.8)*(st.x-0.8) + (st.y-0.8)*(st.y-0.8));\n float r2 = sqrt((st.x-0.2)*(st.x-0.2) + (st.y-0.2)*(st.y-0.2));\n float z = cos(moveVar.x*r + czm_frameNumber/100.0*moveVar.y)/moveVar.z;\n float z2 = cos(moveVar.x*r2 + czm_frameNumber/100.0*moveVar.y)/moveVar.z;\n st += sqrt(z*z+z2*z2);\n st.s += reflux * czm_frameNumber/1000.0 * speed;\n st.s = mod(st.s,1.0);\n }\n if(flipY){\n st = vec2(st.t,st.s);\n }\n vec4 colorImage = texture2D(image, st);\n material.alpha = alpha;\n material.diffuse = colorImage.rgb; \n return material; \n }" |
| | | } |
| | | }); |
| | | return e |
| | | }, |
| | | createPrimitive: function () { |
| | | var t = new Float64Array(this.sideRes.vertexs), |
| | | i = new Cesium.GeometryAttributes; |
| | | i.position = new Cesium.GeometryAttribute({ |
| | | componentDatatype: Cesium.ComponentDatatype.DOUBLE, |
| | | componentsPerAttribute: 3, |
| | | values: t |
| | | }), |
| | | i.st = new Cesium.GeometryAttribute({ |
| | | componentDatatype: Cesium.ComponentDatatype.FLOAT, |
| | | componentsPerAttribute: 2, |
| | | values: this.sideRes.uvs |
| | | }); |
| | | var r = new Cesium.Geometry({ |
| | | attributes: i, |
| | | indices: this.sideRes.indexs, |
| | | primitiveType: Cesium.PrimitiveType.TRIANGLES, |
| | | boundingSphere: Cesium.BoundingSphere.fromVertices(t) |
| | | }), |
| | | n = new Cesium.GeometryInstance({ |
| | | geometry: r |
| | | }), |
| | | o = new Cesium.RenderState; |
| | | return o.depthTest.enabled = !0, new Cesium.Primitive({ |
| | | geometryInstances: n, |
| | | appearance: new Cesium.Appearance({ |
| | | material: this.material, |
| | | renderState: o, |
| | | vertexShaderSource: "attribute vec3 position3DHigh;\n attribute vec3 position3DLow;\n attribute vec2 st;\n attribute float batchId;\n \n varying vec3 v_positionMC;\n varying vec3 v_positionEC;\n varying vec2 v_st;\n \n void main()\n {\n vec4 p = czm_computePosition();\n \n v_positionMC = position3DHigh + position3DLow; // position in model coordinates\n v_positionEC = (czm_modelViewRelativeToEye * p).xyz; // position in eye coordinates\n v_st = st;\n \n gl_Position = czm_modelViewProjectionRelativeToEye * p;\n }\n ", |
| | | fragmentShaderSource: "varying vec3 v_positionMC;\n varying vec3 v_positionEC;\n varying vec2 v_st;\n \n void main()\n {\n czm_materialInput materialInput;\n \n vec3 normalEC = normalize(czm_normal3D * czm_geodeticSurfaceNormal(v_positionMC, vec3(0.0), vec3(1.0)));\n #ifdef FACE_FORWARD\n normalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);\n #endif\n \n materialInput.s = v_st.s;\n materialInput.st = v_st;\n materialInput.str = vec3(v_st, 0.0);\n \n // Convert tangent space material normal to eye space\n materialInput.normalEC = normalEC;\n materialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(v_positionMC, materialInput.normalEC);\n \n // Convert view vector to world space\n vec3 positionToEyeEC = -v_positionEC;\n materialInput.positionToEyeEC = positionToEyeEC;\n \n czm_material material = czm_getMaterial(materialInput);\n \n #ifdef FLAT\n gl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n #else\n gl_FragColor = czm_phong(normalize(positionToEyeEC), material,czm_lightDirectionEC);\n #endif\n }\n " |
| | | }) |
| | | }) |
| | | }, |
| | | offsetHeight: function (height, time) { |
| | | this.startDH(height, time) |
| | | }, |
| | | startDH: function (height, time) { |
| | | if (height && time && this.riverPrimitive) { |
| | | for (var i = this, r = 0, n = height / (20 * time), o = this.sideRes.self, s = new Cesium.Cartesian3, l = 0, u = o.length; l < u; l++) { |
| | | var c = Cesium.Cartesian3.normalize(o[l], new Cesium.Cartesian3); |
| | | Cesium.Cartesian3.add(s, c, s) |
| | | } |
| | | Cesium.Cartesian3.normalize(s, s); |
| | | var h = Cesium.clone(this.riverPrimitive.modelMatrix); |
| | | this.dhEvent = function () { |
| | | if (Math.abs(r) <= Math.abs(height)) { |
| | | var t = Cesium.Cartesian3.multiplyByScalar(s, r, new Cesium.Cartesian3); |
| | | i.riverPrimitive.modelMatrix = Cesium.Matrix4.multiplyByTranslation(h, t, new Cesium.Matrix4) |
| | | } else i.map.clock.onTick.removeEventListener(i.dhEvent); |
| | | r += n |
| | | }, this.map.clock.onTick.addEventListener(this.dhEvent) |
| | | } |
| | | }, |
| | | //水面线转成水面 |
| | | _lines2Plane: function (positions, width, height) { |
| | | function n(point, height) { |
| | | if (!(point instanceof Cesium.Cartesian3)) return void console.log("请确认点是Cartesian3类型!"); |
| | | if (!height || 0 == height) return void console.log("请确认高度是非零数值!"); |
| | | var i = Cesium.Cartesian3.normalize(point, new Cesium.Cartesian3), |
| | | r = new Cesium.Ray(point, i);//射线 |
| | | return Cesium.Ray.getPoint(r, height) |
| | | } |
| | | |
| | | function o(point, point1, height) { |
| | | var r = Cesium.Cartesian3.normalize(Cesium.Cartesian3.subtract(point1, point, new Cesium.Cartesian3), new Cesium.Cartesian3), |
| | | n = Cesium.Cartesian3.normalize(point, new Cesium.Cartesian3), |
| | | o = Cesium.Cartesian3.cross(n, r, new Cesium.Cartesian3), |
| | | a = Cesium.Cartesian3.cross(r, n, new Cesium.Cartesian3), |
| | | l = new Cesium.Ray(point, o), |
| | | u = new Cesium.Ray(point, a); |
| | | return { |
| | | left: Cesium.Ray.getPoint(l, height), |
| | | right: Cesium.Ray.getPoint(u, height) |
| | | } |
| | | } |
| | | |
| | | if (!positions || positions.length <= 1 || !width || 0 == width) return void console.log("请确认参数符合规则:数组长度大于1,宽高不能为0!"); |
| | | for (var r = positions.length, a = [], l = [], u = width / 2, c = 0; c < r; c++) { |
| | | var h = void 0, |
| | | d = void 0, |
| | | f = void 0, |
| | | p = void 0, |
| | | m = void 0; |
| | | if (0 == c ? (h = positions[c], d = positions[c], f = positions[c + 1]) : c == r - 1 ? (h = positions[c - 1], d = positions[c], f = positions[c - 1]) : (h = positions[c - 1], d = positions[c], f = positions[c + 1]), 0 != height && (h = n(h, height), d = n(d, height), f = n(f, height)), h && d && f) { |
| | | var g = o(d, f, u); |
| | | if (p = g.left, m = g.right, 0 == c) { |
| | | a.push(p), l.push(m), a.push(p), l.push(m); |
| | | continue |
| | | } |
| | | if (!(c < r - 1)) { |
| | | a.push(m), l.push(p), a.push(m), l.push(p); |
| | | continue |
| | | } |
| | | a.push(p), l.push(m), g = o(d, h, u), p = g.left, m = g.right, a.push(m), l.push(p) |
| | | } |
| | | } |
| | | |
| | | var v = [], |
| | | y = []; |
| | | if (a.length != 2 * r) return void console.log("计算左右侧点出问题!"); |
| | | for (var _ = 0; _ < r; _++) { |
| | | var w = positions[_], |
| | | b = a[2 * _ + 0], |
| | | C = a[2 * _ + 1], |
| | | x = Cesium.Cartesian3.subtract(b, w, new Cesium.Cartesian3), |
| | | P = Cesium.Cartesian3.subtract(C, w, new Cesium.Cartesian3), |
| | | M = Cesium.Cartesian3.add(x, P, new Cesium.Cartesian3), |
| | | E = Cesium.Cartesian3.add(w, M, new Cesium.Cartesian3); |
| | | v.push(Cesium.clone(E)); |
| | | var T = l[2 * _ + 0], |
| | | S = l[2 * _ + 1]; |
| | | x = Cesium.Cartesian3.subtract(T, w, new Cesium.Cartesian3), P = Cesium.Cartesian3.subtract(S, w, new Cesium.Cartesian3), M = Cesium.Cartesian3.add(x, P, new Cesium.Cartesian3), E = Cesium.Cartesian3.add(w, M, new Cesium.Cartesian3), y.push(Cesium.clone(E)) |
| | | } |
| | | |
| | | for (var O = [], D = [], k = [], A = [], R = [], F = 0; F < r; F++) { |
| | | var L = Cesium.EncodedCartesian3.fromCartesian(y[F]); |
| | | D.push(y[F].x), D.push(y[F].y), D.push(y[F].z), k.push(L.high.x), k.push(L.high.y), k.push(L.high.z), A.push(L.low.x), A.push(L.low.y), A.push(L.low.z), O.push(1, 1), F < r - 1 && (R.push(F + 2 * r), R.push(F + 1), R.push(F + 1 + r), R.push(F + 2 * r), R.push(F + 1 + r), R.push(r + F + 2 * r)) |
| | | } |
| | | |
| | | for (var I = 0; I < r; I++) { |
| | | var N = Cesium.EncodedCartesian3.fromCartesian(v[I]); |
| | | D.push(v[I].x), D.push(v[I].y), D.push(v[I].z), k.push(N.high.x), k.push(N.high.y), k.push(N.high.z), A.push(N.low.x), A.push(N.low.y), A.push(N.low.z), O.push(1, 0) |
| | | } |
| | | |
| | | for (var V = 0; V < r; V++) { |
| | | var z = Cesium.EncodedCartesian3.fromCartesian(y[V]); |
| | | D.push(y[V].x), D.push(y[V].y), D.push(y[V].z), k.push(z.high.x), k.push(z.high.y), k.push(z.high.z), A.push(z.low.x), A.push(z.low.y), A.push(z.low.z), O.push(0, 1) |
| | | } |
| | | |
| | | for (var H = 0; H < r; H++) { |
| | | var B = Cesium.EncodedCartesian3.fromCartesian(v[H]); |
| | | D.push(v[H].x), D.push(v[H].y), D.push(v[H].z), k.push(B.high.x), k.push(B.high.y), k.push(B.high.z), A.push(B.low.x), A.push(B.low.y), A.push(B.low.z), O.push(0, 0) |
| | | } |
| | | |
| | | this.polygonCartesianArray = [] |
| | | for (let i = 0; i < y.length; i++) { |
| | | this.polygonCartesianArray.push(y[i]) |
| | | } |
| | | for (let i = 0; i < v.length; i++) { |
| | | this.polygonCartesianArray.push(v[i]) |
| | | } |
| | | //计算polygon面积 |
| | | this.getPolygonArea(this.getPositionArray(this.polygonCartesianArray),this.polygonCartesianArray) |
| | | |
| | | |
| | | return { |
| | | left: v, |
| | | right: y, |
| | | self: positions, |
| | | vertexs: new Float32Array(D), |
| | | vertexsH: new Float32Array(k), |
| | | vertexsL: new Float32Array(A), |
| | | indexs: new Uint16Array(R), |
| | | uvs: new Float32Array(O) |
| | | } |
| | | }, |
| | | onOpen: function () { |
| | | //面板打开的时候触发 (when open this panel trigger) |
| | | this.map.scene.globe.baseColor = Cesium.Color.BLACK; |
| | | $($('div.cesium-viewer').find('.cesium-baseLayerPicker-choices')[0]).children('div:eq(3)').trigger('click'); |
| | | |
| | | |
| | | }, |
| | | |
| | | onClose: function () { |
| | | //面板关闭的时候触发 (when this panel is closed trigger) |
| | | this.map.entities.remove(this.drawingPolyline); |
| | | this.map.scene.primitives.remove(this.riverPrimitive); |
| | | |
| | | }, |
| | | |
| | | onMinimize: function () { |
| | | this.resize(); |
| | | }, |
| | | |
| | | onMaximize: function () { |
| | | this.resize(); |
| | | }, |
| | | |
| | | resize: function () { |
| | | |
| | | }, |
| | | |
| | | destroy: function () { |
| | | //销毁的时候触发 |
| | | //todo |
| | | //do something before this func |
| | | this.inherited(arguments); |
| | | }, |
| | | |
| | | //Cartesian3转换为经纬度 |
| | | getPositionArray:function (cartesiansArray){ |
| | | var positionArray = [] |
| | | |
| | | if (cartesiansArray.length>0){ |
| | | for (let i = 0; i < cartesiansArray.length; i++) { |
| | | //获取的对象中的经纬度为弧度 |
| | | let cartographic= Cesium.Cartographic.fromCartesian(cartesiansArray[i]) |
| | | //弧度转换 |
| | | let longitude = Cesium.Math.toDegrees(cartographic.longitude) |
| | | let latitude = Cesium.Math.toDegrees(cartographic.latitude) |
| | | let height = cartographic.height |
| | | positionArray.push({ |
| | | lon:longitude, |
| | | lat:latitude, |
| | | hei:height, |
| | | }) |
| | | } |
| | | } |
| | | return positionArray |
| | | }, |
| | | |
| | | //获取多边形面积 |
| | | getPolygonArea:function (points,positions){ |
| | | let radiansPerDegree = Math.PI / 180.0;//角度转化为弧度(rad) |
| | | let degreesPerRadian = 180.0 / Math.PI;//弧度转化为角度 |
| | | |
| | | //计算多边形面积 |
| | | function getArea(points) { |
| | | let res = 0; |
| | | //拆分三角曲面 |
| | | |
| | | for (let i = 0; i < points.length - 2; i++) { |
| | | let j = (i + 1) % points.length; |
| | | let k = (i + 2) % points.length; |
| | | let totalAngle = Angle(points[i], points[j], points[k]); |
| | | let dis_temp1 = distance(positions[i], positions[j]); |
| | | let dis_temp2 = distance(positions[j], positions[k]); |
| | | res += dis_temp1 * dis_temp2 * Math.abs(Math.sin(totalAngle)) ; |
| | | console.log(res); |
| | | } |
| | | |
| | | |
| | | return (res/1000000.0).toFixed(4); |
| | | } |
| | | |
| | | /*角度*/ |
| | | function Angle(p1, p2, p3) { |
| | | let bearing21 = Bearing(p2, p1); |
| | | let bearing23 = Bearing(p2, p3); |
| | | let angle = bearing21 - bearing23; |
| | | if (angle < 0) { |
| | | angle += 360; |
| | | } |
| | | return angle; |
| | | } |
| | | /*方向*/ |
| | | function Bearing(from, to) { |
| | | let lat1 = from.lat * radiansPerDegree; |
| | | let lon1 = from.lon * radiansPerDegree; |
| | | let lat2 = to.lat * radiansPerDegree; |
| | | let lon2 = to.lon * radiansPerDegree; |
| | | let angle = -Math.atan2(Math.sin(lon1 - lon2) * Math.cos(lat2), Math.cos(lat1) * Math.sin(lat2) - Math.sin(lat1) * Math.cos(lat2) * Math.cos(lon1 - lon2)); |
| | | if (angle < 0) { |
| | | angle += Math.PI * 2.0; |
| | | } |
| | | angle = angle * degreesPerRadian;//角度 |
| | | return angle; |
| | | } |
| | | |
| | | //计算距离 |
| | | function distance(point1,point2){ |
| | | let point1cartographic = Cesium.Cartographic.fromCartesian(point1); |
| | | let point2cartographic = Cesium.Cartographic.fromCartesian(point2); |
| | | /**根据经纬度计算出距离**/ |
| | | let geodesic = new Cesium.EllipsoidGeodesic(); |
| | | geodesic.setEndPoints(point1cartographic, point2cartographic); |
| | | let s = geodesic.surfaceDistance; |
| | | //console.log(Math.sqrt(Math.pow(distance, 2) + Math.pow(endheight, 2))); |
| | | //返回两点之间的距离 |
| | | s = Math.sqrt(Math.pow(s, 2) + Math.pow(point2cartographic.height - point1cartographic.height, 2)); |
| | | return s; |
| | | } |
| | | |
| | | console.log(getArea(points)+"平方公里","777") |
| | | |
| | | }, |
| | | |
| | | //鼠标事件 |
| | | movehandLer: function movehandLer() { |
| | | // 取消默认双击事件 |
| | | this.map.cesiumWidget.screenSpaceEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK); |
| | | // 获取鼠标事件 |
| | | this.mountainHandler = new Cesium.ScreenSpaceEventHandler(this.map.scene.canvas); |
| | | // 给鼠标左键添加事件函数 |
| | | this.mountainHandler.setInputAction(lang.hitch(this, this.clickHand), Cesium.ScreenSpaceEventType.LEFT_CLICK); |
| | | }, |
| | | |
| | | //点击事件 |
| | | clickHand:function (click){ |
| | | var pickedObjects = this.map.scene.pick(click.position); |
| | | if (pickedObjects.primitive instanceof Cesium.Primitive) { |
| | | this.floodAnalysisPopup() |
| | | } |
| | | }, |
| | | |
| | | //洪水分析弹窗 |
| | | floodAnalysisPopup:function (){ |
| | | var url = './corelib/common/popup/floodAnalysis.html'; |
| | | var top = ($(window).height() - 600) / 2; |
| | | var left = ($(window).width() - 900 - 340) / 2 + 340; |
| | | layer.open({ |
| | | title:'模拟分析', |
| | | type: 2, |
| | | maxmin: false, //开启最大化最小化按钮 |
| | | area: ['900px', '600px'], |
| | | skin: 'floodAnalysis', |
| | | offset: [top, left], |
| | | content: url, |
| | | id: "floodAnalysisLayer", |
| | | closeBtn: 1 |
| | | }); |
| | | }, |
| | | |
| | | //添加点 |
| | | addPoint:function (){ |
| | | |
| | | }, |
| | | |
| | | //canvas转换为image |
| | | canvasToImage(){ |
| | | var canvas = $('.cesium-widget canvas').get(0) |
| | | //cesium基于webgl,因此获取上下文需要用experimental-webgl而不是2d |
| | | var ctx = canvas.getContext('experimental-webgl'); |
| | | ctx.beginPath() |
| | | ctx.rect(0,0,ctx.width,ctx.height) |
| | | } |
| | | |
| | | |
| | | }); |
| | | }); |
| New file |
| | |
| | | /* |
| | | 提示框 |
| | | */ |
| | | .tooltipdiv { |
| | | display: block; |
| | | position: absolute; |
| | | visibility: visible; |
| | | max-width: 200px; |
| | | min-width: 100px; |
| | | padding: 1px 1px 1px 25px; |
| | | font-size: 11px; |
| | | z-index: 1000; |
| | | opacity: 0.8; |
| | | -khtml-opacity: 0.8; |
| | | -moz-opacity: 0.8; |
| | | filter: alpha(opacity=80); |
| | | } |
| | | .tooltipdiv.left .tooltipdiv-arrow { |
| | | top: 50%; |
| | | right: 0; |
| | | margin-top: -5px; |
| | | border-top: 5px solid transparent; |
| | | border-bottom: 5px solid transparent; |
| | | border-left: 25px solid #000000; |
| | | } |
| | | .tooltipdiv.right .tooltipdiv-arrow { |
| | | top: 50%; |
| | | left: 0; |
| | | margin-top: -5px; |
| | | border-top: 5px solid transparent; |
| | | border-bottom: 5px solid transparent; |
| | | border-right: 25px solid #000000; |
| | | } |
| | | .tooltipdiv-inner { |
| | | padding: 3px 8px; |
| | | background-color: #000000; |
| | | color: white; |
| | | text-align: center; |
| | | max-width: 200px; |
| | | text-decoration: none; |
| | | -webkit-border-radius: 4px; |
| | | -moz-border-radius: 4px; |
| | | border-radius: 4px; |
| | | } |
| | | .tooltipdiv-arrow { |
| | | position: absolute; |
| | | width: 0; |
| | | height: 0; |
| | | } |
| New file |
| | |
| | | @import "Tooltip-div.css"; |
| | | |
| | | .jimu-widget-DynamicRiver { |
| | | display: none; |
| | | width: 100%; |
| | | height: auto; |
| | | /* overflow-x: hidden; */ |
| | | font-size: 14px; |
| | | color: rgb(238, 235, 235); |
| | | background-color: rgba(48, 48, 48, 0.7); |
| | | } |
| | | |
| | | .jimu-widget-DynamicRiver .dynamicriver-main { |
| | | border: 1px solid rgb(69, 154, 251); |
| | | border-radius: 5px; |
| | | } |
| | | |
| | | .jimu-widget-DynamicRiver .dynamicriver-header { |
| | | position: relative; |
| | | width: 100%; |
| | | height: 40px; |
| | | line-height: 40px; |
| | | font-size: 20px; |
| | | border-bottom: 1px solid rgb(69, 154, 251); |
| | | } |
| | | |
| | | .jimu-widget-DynamicRiver .dynamicriver-header i { |
| | | display: inline-block; |
| | | margin-left: 6px; |
| | | vertical-align: middle; |
| | | width: 20px; |
| | | height: 20px; |
| | | background: url(../../../images/toolbox.png ) no-repeat 0 -20px; |
| | | background-size: 20px; |
| | | } |
| | | |
| | | .jimu-widget-DynamicRiver .dynamicriver-header .close-dynamicriver { |
| | | position: absolute; |
| | | top: 50%; |
| | | right: 8px; |
| | | font-size: 38px; |
| | | font-weight: 400; |
| | | height: 28px; |
| | | line-height: 28px; |
| | | cursor: pointer; |
| | | transform: translateY(-50%); |
| | | } |
| | | |
| | | .jimu-widget-DynamicRiver .water-analysis { |
| | | margin: 10px 8px; |
| | | } |
| | | |
| | | .jimu-widget-DynamicRiver .water-analysis ul, |
| | | .jimu-widget-DynamicRiver .water-analysis ul li { |
| | | margin: 0; |
| | | padding: 0; |
| | | } |
| | | |
| | | .jimu-widget-DynamicRiver .water-analysis ul { |
| | | border-right: 1px solid #fff; |
| | | border-bottom: 1px solid #fff; |
| | | } |
| | | |
| | | .jimu-widget-DynamicRiver .water-analysis ul li { |
| | | list-style: none; |
| | | height: 30px; |
| | | text-align: center; |
| | | line-height: 30px; |
| | | border-top: 1px solid #fff; |
| | | border-left: 1px solid #fff; |
| | | } |
| | | |
| | | .jimu-widget-DynamicRiver .water-analysis ul li span.content-left { |
| | | float: left; |
| | | padding-left: 10px; |
| | | height: 100%; |
| | | width: 80%; |
| | | text-align: left; |
| | | |
| | | } |
| | | |
| | | .jimu-widget-DynamicRiver .water-analysis ul li span.content-right { |
| | | float: left; |
| | | height: 100%; |
| | | width: 20%; |
| | | background: url(../../../images/dynamicRiver-see.png) no-repeat; |
| | | background-position: 50%; |
| | | background-size: 50%; |
| | | border-left: 1px solid #fff; |
| | | } |
| | | |
| | | |
| | | .jimu-widget-DynamicRiver .dynamicriver-result div, |
| | | .jimu-widget-DynamicRiver .dynamicriver-result ul, |
| | | .jimu-widget-DynamicRiver .dynamicriver-result li { |
| | | margin: 0; |
| | | padding: 0; |
| | | } |
| | | |
| | | |
| | | .jimu-widget-DynamicRiver .dynamicriver-result { |
| | | display: none; |
| | | position: absolute; |
| | | top: 260px; |
| | | right: 10px; |
| | | width: 220px; |
| | | height: auto; |
| | | background-color: rgba(48, 48, 48, 0.7); |
| | | border: 1px solid rgb(69, 154, 251); |
| | | border-radius: 6px; |
| | | } |
| | | |
| | | .jimu-widget-DynamicRiver .dynamicriver-result > div { |
| | | position: relative; |
| | | padding: 0 10px; |
| | | height: 40px; |
| | | line-height: 40px; |
| | | font-size: 16px; |
| | | text-align: left; |
| | | border-bottom: 1px solid rgb(69, 154, 251); |
| | | } |
| | | |
| | | .jimu-widget-DynamicRiver .dynamicriver-result div .close-dynamicriver-result { |
| | | position: absolute; |
| | | top: 50%; |
| | | right: 8px; |
| | | font-size: 30px; |
| | | font-weight: 400; |
| | | height: 28px; |
| | | line-height: 28px; |
| | | cursor: pointer; |
| | | transform: translateY(-50%); |
| | | } |
| | | |
| | | .jimu-widget-DynamicRiver .dynamicriver-result ul { |
| | | margin: 10px; |
| | | border-top: 1px solid #fff; |
| | | border-left: 1px solid #fff; |
| | | border-right: 1px solid #fff; |
| | | border-radius: 6px; |
| | | } |
| | | |
| | | .jimu-widget-DynamicRiver .dynamicriver-result ul li { |
| | | list-style: none; |
| | | display: flex; |
| | | height: 30px; |
| | | line-height: 30px; |
| | | border-bottom: 1px solid #fff; |
| | | } |
| | | |
| | | .jimu-widget-DynamicRiver .dynamicriver-result ul li:last-child { |
| | | border-radius: 6px; |
| | | } |
| | | |
| | | |
| | | .jimu-widget-DynamicRiver .dynamicriver-result ul li span:first-child { |
| | | flex: 1; |
| | | border-right: 1px solid #fff; |
| | | text-align: center; |
| | | } |
| | | |
| | | .jimu-widget-DynamicRiver .dynamicriver-result ul li span:last-child { |
| | | flex: 2; |
| | | padding-left: 8px; |
| | | } |
| New file |
| | |
| | | @import "Tooltip-div.css"; |
| | | |
| | | .jimu-widget-DynamicRiver { |
| | | display: none; |
| | | width: 100%; |
| | | height: auto; |
| | | /* overflow-x: hidden; */ |
| | | font-size: 14px; |
| | | color: rgb(238, 235, 235); |
| | | background-color: rgba(48, 48, 48, 0.7); |
| | | } |
| | | |
| | | .jimu-widget-DynamicRiver .dynamicriver-main { |
| | | border: 1px solid rgb(69, 154, 251); |
| | | border-radius: 5px; |
| | | } |
| | | |
| | | .jimu-widget-DynamicRiver .dynamicriver-header { |
| | | position: relative; |
| | | width: 100%; |
| | | height: 40px; |
| | | line-height: 40px; |
| | | font-size: 20px; |
| | | border-bottom: 1px solid rgb(69, 154, 251); |
| | | } |
| | | |
| | | .jimu-widget-DynamicRiver .dynamicriver-header i { |
| | | display: inline-block; |
| | | margin-left: 6px; |
| | | vertical-align: middle; |
| | | width: 20px; |
| | | height: 20px; |
| | | background: url(../../../images/toolbox.png ) no-repeat 0 -20px; |
| | | background-size: 20px; |
| | | } |
| | | |
| | | .jimu-widget-DynamicRiver .dynamicriver-header .close-dynamicriver { |
| | | position: absolute; |
| | | top: 50%; |
| | | right: 8px; |
| | | font-size: 38px; |
| | | font-weight: 400; |
| | | height: 28px; |
| | | line-height: 28px; |
| | | cursor: pointer; |
| | | transform: translateY(-50%); |
| | | } |
| | | |
| | | .jimu-widget-DynamicRiver .water-analysis { |
| | | margin: 10px 8px; |
| | | } |
| | | |
| | | .jimu-widget-DynamicRiver .water-analysis ul, |
| | | .jimu-widget-DynamicRiver .water-analysis ul li { |
| | | margin: 0; |
| | | padding: 0; |
| | | } |
| | | |
| | | .jimu-widget-DynamicRiver .water-analysis ul { |
| | | border-right: 1px solid #fff; |
| | | border-bottom: 1px solid #fff; |
| | | } |
| | | |
| | | .jimu-widget-DynamicRiver .water-analysis ul li { |
| | | list-style: none; |
| | | height: 30px; |
| | | text-align: center; |
| | | line-height: 30px; |
| | | border-top: 1px solid #fff; |
| | | border-left: 1px solid #fff; |
| | | } |
| | | |
| | | .jimu-widget-DynamicRiver .water-analysis ul li span.content-left { |
| | | float: left; |
| | | padding-left: 10px; |
| | | height: 100%; |
| | | width: 80%; |
| | | text-align: left; |
| | | |
| | | } |
| | | |
| | | .jimu-widget-DynamicRiver .water-analysis ul li span.content-right { |
| | | float: left; |
| | | height: 100%; |
| | | width: 20%; |
| | | background: url(../../../images/dynamicRiver-see.png) no-repeat; |
| | | background-position: 50%; |
| | | background-size: 50%; |
| | | border-left: 1px solid #fff; |
| | | } |
| | | |
| | | |
| | | .jimu-widget-DynamicRiver .dynamicriver-result div, |
| | | .jimu-widget-DynamicRiver .dynamicriver-result ul, |
| | | .jimu-widget-DynamicRiver .dynamicriver-result li { |
| | | margin: 0; |
| | | padding: 0; |
| | | } |
| | | |
| | | |
| | | .jimu-widget-DynamicRiver .dynamicriver-result { |
| | | display: none; |
| | | position: absolute; |
| | | top: 260px; |
| | | right: 10px; |
| | | width: 220px; |
| | | height: auto; |
| | | background-color: rgba(48, 48, 48, 0.7); |
| | | border: 1px solid rgb(69, 154, 251); |
| | | border-radius: 6px; |
| | | } |
| | | |
| | | .jimu-widget-DynamicRiver .dynamicriver-result > div { |
| | | position: relative; |
| | | padding: 0 10px; |
| | | height: 40px; |
| | | line-height: 40px; |
| | | font-size: 16px; |
| | | text-align: left; |
| | | border-bottom: 1px solid rgb(69, 154, 251); |
| | | } |
| | | |
| | | .jimu-widget-DynamicRiver .dynamicriver-result div .close-dynamicriver-result { |
| | | position: absolute; |
| | | top: 50%; |
| | | right: 8px; |
| | | font-size: 30px; |
| | | font-weight: 400; |
| | | height: 28px; |
| | | line-height: 28px; |
| | | cursor: pointer; |
| | | transform: translateY(-50%); |
| | | } |
| | | |
| | | .jimu-widget-DynamicRiver .dynamicriver-result ul { |
| | | margin: 10px; |
| | | border-top: 1px solid #fff; |
| | | border-left: 1px solid #fff; |
| | | border-right: 1px solid #fff; |
| | | border-radius: 6px; |
| | | } |
| | | |
| | | .jimu-widget-DynamicRiver .dynamicriver-result ul li { |
| | | list-style: none; |
| | | display: flex; |
| | | height: 30px; |
| | | line-height: 30px; |
| | | border-bottom: 1px solid #fff; |
| | | } |
| | | |
| | | .jimu-widget-DynamicRiver .dynamicriver-result ul li:last-child { |
| | | border-radius: 6px; |
| | | } |
| | | |
| | | |
| | | .jimu-widget-DynamicRiver .dynamicriver-result ul li span:first-child { |
| | | flex: 1; |
| | | border-right: 1px solid #fff; |
| | | text-align: center; |
| | | } |
| | | |
| | | .jimu-widget-DynamicRiver .dynamicriver-result ul li span:last-child { |
| | | flex: 2; |
| | | padding-left: 8px; |
| | | } |
| New file |
| | |
| | | @import "Tooltip-div.css"; |
| | | .jimu-widget-FloodAnalysis{ |
| | | width: 100%; |
| | | height: 100%; |
| | | position: fixed !important; |
| | | left: 30px !important; |
| | | top: 75px !important; |
| | | overflow-x: hidden; |
| | | background: rgba(31, 39, 48, .7); |
| | | font-size: 14px; |
| | | border: 1px solid rgb(69, 154, 251); |
| | | border-radius: 5px; |
| | | color: rgb(255, 255, 255); |
| | | } |
| | | |
| | | .jimu-widget-FloodAnalysis .flood-analysis-header { |
| | | position: relative; |
| | | width: 100%; |
| | | height: 40px; |
| | | line-height: 40px; |
| | | font-size: 20px; |
| | | border-bottom: 1px solid rgb(69, 154, 251); |
| | | } |
| | | |
| | | .jimu-widget-FloodAnalysis .flood-analysis-header i { |
| | | display: inline-block; |
| | | margin-left: 6px; |
| | | vertical-align: middle; |
| | | width: 20px; |
| | | height: 20px; |
| | | background: url(../../../images/toolbox.png ) no-repeat 0 -20px; |
| | | background-size: 20px; |
| | | } |
| | | |
| | | .jimu-widget-FloodAnalysis .flood-water-analysis { |
| | | margin: 12px 17px 10px 17px; |
| | | } |
| | | |
| | | .jimu-widget-FloodAnalysis .flood-water-analysis ul , |
| | | .jimu-widget-FloodAnalysis .flood-water-analysis ul li , |
| | | .jimu-widget-FloodAnalysis .flood-water-analysis ul input { |
| | | padding: 0; |
| | | margin: 0; |
| | | } |
| | | |
| | | .jimu-widget-FloodAnalysis .flood-water-analysis ul li { |
| | | margin: 5px 0; |
| | | list-style: none; |
| | | height: 36px; |
| | | line-height: 36px; |
| | | font-size: 16px; |
| | | } |
| | | |
| | | .jimu-widget-FloodAnalysis .flood-water-analysis ul li input { |
| | | padding: 0 10px; |
| | | width: 48%; |
| | | height: 100%; |
| | | color: #fff; |
| | | border: none; |
| | | background: rgba(140, 151, 165, 0.5); |
| | | } |
| | | |
| | | .jimu-widget-FloodAnalysis .flood-water-analysis ul li span { |
| | | display: inline-block; |
| | | width: 52%; |
| | | } |
| | | |
| | | .jimu-widget-FloodAnalysis .flood-water-analysis .flood-water-analysis-new input { |
| | | margin: 5px 0; |
| | | width: 48%; |
| | | height: 36px; |
| | | color: #fff; |
| | | background: rgb(2,24,55); |
| | | border: 1px solid rgb(69, 154, 251); |
| | | border-radius: 4px; |
| | | } |
| | | |
| | | .jimu-widget-FloodAnalysis .flood-water-analysis .flood-water-analysis-new input:nth-child(odd) { |
| | | float:left; |
| | | } |
| | | |
| | | .jimu-widget-FloodAnalysis .flood-water-analysis .flood-water-analysis-new input:nth-child(even) { |
| | | float: right; |
| | | } |
| New file |
| | |
| | | { |
| | | "data": [ |
| | | { |
| | | "name": "龙山水库", |
| | | "LGTD": "116.074778", |
| | | "LTTD": "26.001260", |
| | | "house": "35", |
| | | "people": "175" |
| | | }, |
| | | { |
| | | "name": "金湾水库", |
| | | "LGTD": "114.978944", |
| | | "LTTD": "24.904194", |
| | | "house": "35", |
| | | "people": "175" |
| | | }, |
| | | { |
| | | "name": "雷公坝", |
| | | "LGTD": "115.672889", |
| | | "LTTD": "25.306611", |
| | | "house": "35", |
| | | "people": "175" |
| | | } |
| | | ] |
| | | } |
| New file |
| | |
| | | { |
| | | "name": "FloodAnalysis", |
| | | "2D": true, |
| | | "3D": true, |
| | | "platform": "HTML", |
| | | "version": "2.10", |
| | | "wabVersion": "2.10", |
| | | "author": "jxdnosng", |
| | | "description": "", |
| | | "copyright": "", |
| | | "license": "", |
| | | "properties": { |
| | | "hasConfig": false, |
| | | "inPanel": false, |
| | | "hasVersionManager": false |
| | | } |
| | | } |
| New file |
| | |
| | | define( |
| | | ({ |
| | | _widgetLabel: "GoFloodAnalysis" |
| | | }) |
| | | ); |
| New file |
| | |
| | | define({ |
| | | root: ({ |
| | | _widgetLabel: "FloodAnalysis" |
| | | }), |
| | | "es": 1, |
| | | "zh-cn": 1 |
| | | }); |
| New file |
| | |
| | | define( |
| | | ({ |
| | | _widgetLabel: "洪水淹没分析" |
| | | }) |
| | | ); |
| | |
| | | /** |
| | | * @billbo 对象,确定entities中billboard的值 |
| | | * @labble 对象,确定entities中lable的值 |
| | | * |
| | | * |
| | | */ |
| | | |
| | | var billbo, labble, colorBill; |
| | |
| | | // 点击弹出面板; |
| | | openWindow: function (item) { |
| | | //点击测站的弹出框的内容,面板,单独的widget 可传参数 |
| | | |
| | | |
| | | if(this.txt == "山洪风险区"){ |
| | | var shpanel = new GeologicalDisasterPanel({ data: item }); |
| | | new Popup({ |
| | |
| | | this.setVisible(vis); |
| | | }, |
| | | }); |
| | | }); |
| | | }); |
| | |
| | | tableObj.num = ind; |
| | | data.data.forEach(function (item, index) { |
| | | if (item.SiteList != '') { |
| | | |
| | | |
| | | if (item.list && item.list != {} && ((Date.parse(new Date()) - Date.parse(new Date(item.list.TM.substring(0, 11).replace(/-/g, '/') + item.list.TM.substring(11)))) < 86400000)) { |
| | | that.entitys({ |
| | | id: item.SiteList.site_code + "yl", |
| | |
| | | var colorSl; |
| | | data.data.forEach(function (item, index) { |
| | | if (item.SiteList != '') { |
| | | |
| | | |
| | | if (item.list && item.list != {} && Date.parse(new Date()) - Date.parse(new Date(item.list.TM.substring(0, 11).replace(/-/g, '/') + item.list.TM.substring(11))) < 86400000) { |
| | | if (item.list.Z > item.list.yjsw) { |
| | | colorSl = Cesium.Color.RED; |
| | |
| | | var colorSl; |
| | | data.data.forEach(function (item, index) { |
| | | if (item.SiteList != '') { |
| | | |
| | | |
| | | if (item.list && item.list != {} && Date.parse(new Date()) - Date.parse(new Date(item.list.TM.substring(0, 11).replace(/-/g, '/') + item.list.TM.substring(11))) < 86400000) { |
| | | if (item.list.Q > item.list.yjll) { |
| | | colorSl = Cesium.Color.RED; |
| | |
| | | tableObj.num = ind; |
| | | data.data.forEach(function (item, index) { |
| | | if (item.SiteList != '') { |
| | | |
| | | |
| | | if (item.list && item.list.sum_ev == undefined) { |
| | | item.list.sum_ev = '0'; |
| | | } |
| | |
| | | |
| | | data.data.forEach(function (item, index) { |
| | | if (item.SiteList != '') { |
| | | |
| | | |
| | | if (item.list && item.list != {} && Date.parse(new Date()) - Date.parse(new Date(item.list.TM.substring(0, 11).replace(/-/g, '/') + item.list.TM.substring(11))) < 86400000) { |
| | | that.entitys({ |
| | | id: item.SiteList.site_code + "sw", |
| | |
| | | |
| | | data.data.forEach(function (item, index) { |
| | | if (item.SiteList != '') { |
| | | |
| | | console.log(item) |
| | | that.entitys({ |
| | | id: item.SiteList.site_code + "sw", |
| | | name: item.SiteList.site_name, |
| | |
| | | that.flagone = false; |
| | | that.flagtwo = false; |
| | | that.flagthree = false; |
| | | if (ind == 0) { |
| | | if (ind == 0) {//危险区 |
| | | // 首次打开时,禁用实时预测选择 |
| | | // closeRealTime(0); |
| | | // $('.jimu-widget-RiskEarlyWarning .risk-early-warning-right-tab .early-warning-image .shzhtl').stop().show(); |
| | |
| | | that.excelFileName = '山洪灾害' + '.xlsx' |
| | | that.mountainFloodDisaster(timeAvailable.changeTime, timeAvailable.month) |
| | | that.childrenShowOne() |
| | | } else if (ind == 1) { |
| | | } else if (ind == 1) {//风景区 |
| | | that.btnInd = 1; |
| | | $('.jimu-widget-RiskEarlyWarning .risk-early-warning-right-tab .nav>li:eq(1) div button').prop('disabled', false); |
| | | $('.jimu-widget-RiskEarlyWarning .risk-early-warning-right-tab .nav>li:eq(1)>div>div>div').text('实时').stop().show().css('left', 0); |
| | |
| | | that.excelFileName = '风景区水位' + '.xlsx'; |
| | | that.scenicSpot(timeAvailable.month, timeAvailable.dateTime); |
| | | that.childrenShowOne(); |
| | | } else if (ind == 2) { |
| | | } else if (ind == 2) {//监测站 |
| | | // 首次打开时,禁用实时预测选择 |
| | | // closeRealTime(2); |
| | | $('.jimu-widget-RiskEarlyWarning .risk-early-warning-right-tab .nav>li:eq(2) div button').prop('disabled', false); |
| | |
| | | // 注册鼠标左键单击事件 |
| | | clickHand: function clickHand(click) { |
| | | var pickedObjects = this.map.scene.drillPick(click.position); |
| | | console.log(pickedObjects,click,"5555") |
| | | if (Cesium.defined(pickedObjects)) { |
| | | for (var i = 0; i < pickedObjects.length; ++i) { |
| | | var obj = pickedObjects[i].id; |
| | |
| | | mouseHandlerDraw = null; |
| | | } |
| | | TooltipDiv.setVisible(false); |
| | | //移除 |
| | | //移除 |
| | | if (drawingPolyline != undefined) |
| | | viewer.entities.remove(drawingPolyline); |
| | | |
| | |
| | | var lineOpts = { |
| | | polyline: { |
| | | positions: positionArr, |
| | | clampToGround: true, // |
| | | clampToGround: true, // |
| | | width: 3, |
| | | material: Cesium.Color.BLUE.withAlpha(0.5), |
| | | } |
| | |
| | | if (cartesian) { |
| | | positions.push(cartesian.clone()); |
| | | // var cartographic = Cesium.Cartographic.fromCartesian(cartesian);//当前点 |
| | | // if (cartographic) { |
| | | // if (cartographic) { |
| | | // if (cartesian) { |
| | | // var isIntersect = false; |
| | | // if (positions.length >= 3) { |
| | |
| | | // var intersects = turf.lineIntersect(line1, line2); |
| | | // if (intersects && intersects.features && intersects.features.length > 0) { |
| | | // isIntersect = true; |
| | | |
| | | |
| | | // alert('图形自相交!'); |
| | | // break; |
| | | // } |
| | |
| | | positionArr.push(positions[i]); |
| | | } |
| | | positionArr.push(cartesian); |
| | | |
| | | if (drawingPolyline != undefined) |
| | | viewer.entities.remove(drawingPolyline); |
| | | var lineOpts = { |
| | | polyline: { |
| | | positions: positionArr, |
| | | clampToGround: true, // |
| | | clampToGround: true, // |
| | | width: 3, |
| | | material: Cesium.Color.BLUE.withAlpha(0.5), |
| | | } |
| | |
| | | mouseHandlerDraw = null; |
| | | } |
| | | TooltipDiv.setVisible(false); |
| | | //移除 |
| | | //移除 |
| | | if (drawingPolylineN != undefined) |
| | | viewer.entities.remove(drawingPolylineN); |
| | | if (drawingPolylineT != undefined) |
| | |
| | | var positionArr = []; |
| | | positionArr.push(positions[0]); |
| | | positionArr.push(cartesian); |
| | | //实时 |
| | | //实时 |
| | | if (drawingPolylineT != undefined) |
| | | viewer.entities.remove(drawingPolylineT); |
| | | var lineOptsT = { |
| | | polyline: { |
| | | positions: positionArr, |
| | | clampToGround: true, // |
| | | clampToGround: true, // |
| | | width: 3, |
| | | material: Cesium.Color.BLUE.withAlpha(0.5), |
| | | } |
| | |
| | | var lineOptsN = { |
| | | polyline: { |
| | | positions: positionN, |
| | | clampToGround: true, // |
| | | clampToGround: true, // |
| | | width: 3, |
| | | material: Cesium.Color.RED.withAlpha(0.5), |
| | | } |
| | |
| | | |
| | | } |
| | | return _; |
| | | })(); |
| | | })(); |
| | |
| | | this.inherited(arguments); |
| | | var self = this; |
| | | |
| | | |
| | | |
| | | this.map.scene.globe.depthTestAgainstTerrain = true; |
| | | //取消双击事件 |
| | | this.map.cesiumWidget.screenSpaceEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK); |
| | | |
| | | |
| | | $("#thematic_hzsm_headtab").click(function () { |
| | | DrawDynamicClampGround.startDrawingPolyline(self.map, function (cartesians) { |
| | | if (self.drawingPolyline != undefined) |
| | |
| | | |
| | | |
| | | }, |
| | | |
| | | |
| | | onClose: function () { |
| | | //面板关闭的时候触发 (when this panel is closed trigger) |
| | | this.map.entities.remove(this.drawingPolyline); |
| | |
| | | } |
| | | |
| | | }); |
| | | }); |
| | | }); |
| | |
| | | |
| | | //面板关闭的时候触发 (when this panel is closed trigger) |
| | | this.layer ? this.layer.setVis(false) : ''; |
| | | |
| | | |
| | | }, |
| | | |
| | | resize: function () { |
| | |
| | | cellNavigation: false // for Keyboard; allow only row-level keyboard navigation |
| | | }, tab); |
| | | grid.startup(); |
| | | |
| | | |
| | | grid.on('dgrid-select', function (event) { |
| | | topic.publish("gis/map/setCenter", { |
| | | 'lgtd': event.rows[0].data.LGTD, |
| | |
| | | function recharts_z() { |
| | | var width = $(window).width() * 0.53; |
| | | var height = ($(window).height() - 50) - 80; |
| | | |
| | | $("#eigthRiverWeater").empty(); |
| | | $("#eigthRiverWeater").removeAttr("_echarts_instance_").empty(); |
| | | var chartPie = document.getElementById('eigthRiverWeater'); |
| | |
| | | 'dateEnd': endTime |
| | | }, |
| | | success: function (result) { |
| | | debugger |
| | | var result = result.data; |
| | | |
| | | var maxY = Number(result.maxWater); |