赣州市洪水风险预警系统三维版本
水文水环境分析-洪水淹没:表格添加分页,修正小数相加,结果数据有误差的问题
5 files modified
1791 ■■■■ changed files
corelib/common/popup/css/style.css 173 ●●●● patch | view | raw | blame | history
corelib/common/popup/evaluateAnalysis.html 116 ●●●●● patch | view | raw | blame | history
corelib/common/popup/js/evaluateAnalysis.js 132 ●●●●● patch | view | raw | blame | history
widgets/FloodAnalysis/Widget.js 1368 ●●●●● patch | view | raw | blame | history
widgets/YuShuiQing/css/style.css 2 ●●● patch | view | raw | blame | history
corelib/common/popup/css/style.css
@@ -116,12 +116,12 @@
    height: 420px;
}
.rain-box{
.rain-box {
    width: 100%;
    height: 420px;
}
.reser-box{
.reser-box {
    width: 100%;
    height: 420px;
}
@@ -151,6 +151,7 @@
    width: 666px;
    height: 220px;
}
.river-course .reser-box .river-fou .river-fou-box {
    position: absolute;
    top: 0;
@@ -169,6 +170,7 @@
    width: 666px;
    height: 220px;
}
.river-course .rain-box .river-fou .river-fou-box {
    position: absolute;
    top: 0;
@@ -187,7 +189,6 @@
    width: 666px;
    height: 220px;
}
.river-one,
@@ -307,7 +308,7 @@
    padding-left: 3px;
}
.river-thead tr th{
.river-thead tr th {
    text-align: center;
}
@@ -368,9 +369,6 @@
}
/*降雨*/
.rain-pei {
    width: 53%;
@@ -384,7 +382,7 @@
    float: left;
}
.rain-thead tr th{
.rain-thead tr th {
    text-align: center;
}
@@ -403,7 +401,8 @@
.rain-thead tr th:nth-child(4) div {
    width: 14px;
}
.rain-thead tr th:nth-child(4){
.rain-thead tr th:nth-child(4) {
    width: 17px;
}
@@ -532,7 +531,7 @@
    width: 14px;
}
.rser-thead tr th:nth-child(4){
.rser-thead tr th:nth-child(4) {
    width: 17px;
}
@@ -586,8 +585,7 @@
    cursor: pointer;
    padding-left: 10px;
    color: #6d6d6d;
    background: url("../img/sel.png")
        no-repeat 175px;
    background: url("../img/sel.png") no-repeat 175px;
}
.selectsd .input_insd input {
@@ -598,8 +596,7 @@
    cursor: pointer;
    padding-left: 10px;
    color: #6d6d6d;
    background: url("../img/sel.png")
    no-repeat 40px;
    background: url("../img/sel.png") no-repeat 40px;
}
.select .city {
@@ -676,13 +673,11 @@
}
.wicon {
    background: url("../img/data.png")
        no-repeat 120px;
    background: url("../img/data.png") no-repeat 120px;
}
.time-icon {
    background: url("../img/sel.png")
        no-repeat 128px;
    background: url("../img/sel.png") no-repeat 128px;
}
.river-btn {
@@ -694,6 +689,7 @@
    color: #6d6d6d;
    float: left;
}
.loc-btn {
    width: 80px;
    height: 30px;
@@ -780,100 +776,203 @@
    bottom: 0px;
    top: 95px;
}
/**洪水淹没分析弹窗**/
.flood-box{
.flood-box {
    margin: 20px;
}
.flood-box-left{
.flood-box-left {
    width: 80%;
}
.flood-box-left img{
.flood-box-left img {
    width: 100%;
    height: 100%;
}
.flood-box-top{
.flood-box-top {
    display: flex;
    width: 100%;
    height: 475px;
    border: 1px solid black;
}
.flood-box-bottom{
.flood-box-bottom {
    text-align: right;
    margin-top: 15px;
}
/**损失分析**/
.evaluate-analysis{
.evaluate-analysis {
    margin: 15px;
}
.evaluate-box-top{
.evaluate-box-top {
    width: 100%;
    height: 60px;
}
.evaluate-box-middle{
.evaluate-box-middle {
    width: 96%;
    height: 650px;
    border: 1px solid black;
    padding: 0px 10px 0px 10px;
}
.evaluate-box-top-left{
.evaluate-box-top-left {
    display: flex;
    font-size: 17px;
}
.evaluate-box-top-right{
.evaluate-box-top-right {
    margin-left: 70px;
}
.evaluate-box-top{
.evaluate-box-top {
    display: flex;
}
.evaluate-box-middle table{
.evaluate-box-middle table {
    width: 100%;
}
.evaluate-table-caption{
.evaluate-table-caption {
    font-size: 20px;
    margin: 15px 0 15px 0;
}
.evaluate-table-thead tr th{
.evaluate-table-thead tr th {
    text-align: center;
    border-right: 1px solid #CFCFCF;
    border-bottom: 1px solid #CFCFCF;
    color: #404040;
}
.evaluate-tbody tr td{
.evaluate-tbody tr td {
    text-align: center;
    border-right: 1px solid #CFCFCF;
    border-bottom: 1px solid #CFCFCF;
    color: #404040;
}
.column-2{
/**分页器**/
.flood-analysis-pagination {
    position: relative;
    text-align: center;
    zoom: 1;
    display: flex;
    width: 92%;
    justify-content: flex-end;
}
.flood-analysis-pagination:before,
.flood-analysis-pagination:after {
    content: "";
    display: table;
}
.flood-analysis-pagination:after {
    clear: both;
    overflow: hidden;
}
.flood-analysis-pagination span {
    float: left;
    margin: 0 5px;
    width: 25px;
    height: 25px;
    line-height: 25px;
    color: #bdbdbd;
    font-size: 14px;
}
.flood-analysis-pagination .active {
    float: left;
    margin: 3px 5px;
    width: 25px;
    height: 25px;
    line-height: 25px !important;
    background: #e91e63;
    color: #fff;
    font-size: 14px;
    border: 1px solid #e91e63;
}
.flood-analysis-pagination a {
    float: left;
    margin: 3px 5px;
    width: 25px;
    height: 25px;
    line-height: 25px !important;
    background: #fff;
    border: 1px solid #ebebeb;
    color: #bdbdbd;
    font-size: 14px;
}
.flood-analysis-pagination a:hover {
    color: #fff;
    background: #e91e63;
}
.flood-analysis-pagination .next,
.flood-analysis-pagination .prev {
    font-family: "Simsun";
    font-size: 16px;
    font-weight: bold;
}
.now,
.count {
    padding: 0 5px;
    color: #f00;
}
.eg img {
    max-width: 800px;
    min-height: 500px;
}
.flood-analysis-pagination input {
    float: left;
    margin: 3px 5px;
    width: 25px;
    height: 25px;
    line-height: 25px !important;
    text-align: center;
    background: #fff;
    border: 1px solid #ebebeb;
    outline: none;
    color: #bdbdbd;
    font-size: 14px;
}
#pagination {
    position: absolute;
    margin-top: 5px;
}
.flood-analysis-pagination .jump-btn {
    width: 38px !important;
}
.column-2 {
    margin-left: 20px;
}
.evaluate-echarts{
.evaluate-echarts {
    width: 100%;
    display: none;
}
/**淹没图**/
.flood-image-top img{
.flood-image-top img {
    width: 100%;
}
.flood-image-bottom{
.flood-image-bottom {
    width: 96%;
    text-align: right;
}
corelib/common/popup/evaluateAnalysis.html
@@ -7,69 +7,81 @@
    <link rel="stylesheet" href="">
</head>
<body>
    <div class="evaluate-analysis">
        <div class="evaluate-top"></div>
<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 class="house">暂无数据</span>
                        </div>
                        <div>
                            <span>受灾面积:</span><span class="area">暂无数据</span>
                        </div>
    <div class="evaluate-box">
        <div class="evaluate-box-top">
            <div class="evaluate-box-top-left">
                <div class="column-1">
                    <div>
                        <span>受灾户数:</span><span class="house">暂无数据</span>
                    </div>
                    <div class="column-2">
                        <div>
                            <span>受灾人口:</span><span class="people">暂无数据</span>
                        </div>
                        <div>
                            <span>房屋价值:</span><span class="money">暂无数据</span>
                        </div>
                    <div>
                        <span>受灾面积:</span><span class="area">暂无数据</span>
                    </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 class="column-2">
                    <div>
                        <span>受灾人口:</span><span class="people">暂无数据</span>
                    </div>
                    <div>
                        <span>房屋价值:</span><span class="money">暂无数据</span>
                    </div>
                </div>
            </div>
            <div class="evaluate-box-middle">
                <div class="evaluate-table">
                    <table>
                        <caption class="evaluate-table-caption table-caption">人口财产淹没损失表</caption>
                        <thead class="evaluate-table-thead table-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>
                        <tbody id="evaluate-tbody" class="table-tbody evaluate-tbody"></tbody>
                    </table>
                </div>
                <div class="evaluate-echarts" id="evaluate-echarts"></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-bottom">
            <button id="create-flood-image" type="button">生成淹没图</button>
        <div class="evaluate-box-middle">
            <div class="evaluate-table">
                <table>
                    <caption class="evaluate-table-caption table-caption">人口财产淹没损失表</caption>
                    <thead class="evaluate-table-thead table-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>
                    <tbody id="evaluate-tbody" class="table-tbody evaluate-tbody"></tbody>
                </table>
            </div>
            <div class="flood-analysis-pagination Pagination" id="pagination"></div>
            <div class="evaluate-echarts" id="evaluate-echarts"></div>
        </div>
    </div>
    <div class="evaluate-bottom">
        <button id="create-flood-image" type="button">生成淹没图</button>
    </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>
</div>
<script src="../../../libs/jquery/jquery-3.3.1.min.js"></script>
<script src="../../../libs/jquery.pagination.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>
corelib/common/popup/js/evaluateAnalysis.js
@@ -2,13 +2,13 @@
    //获取父窗口传来的数据
    var data = JSON.parse(GetQueryString("data"))
    //配置数据
    var nameData=[]
    var nameData = []
    var houseData = []
    var peopleData = []
    var areaData = []
    var moneyData = []
    if (data.length>0){
        data.forEach(e=>{
    if (data.length > 0) {
        data.forEach(e => {
            nameData.push(e.name)
            houseData.push(e.house)
            peopleData.push(e.people)
@@ -16,15 +16,19 @@
            moneyData.push(e.money)
        })
    }
    //初始化
    init()
    // change事件
    $('input[type=radio][name=value]').change(function () {
        if (this.value == 'list'){
        if (this.value == 'list') {
            $('.evaluate-echarts').hide()
            $('.evaluate-box-top-left').css('visibility','visible')
            $('.evaluate-box-top-left').css('visibility', 'visible')
            $('.evaluate-table').show()
        }else {
        } else {
            $('.evaluate-table').hide()
            $('.evaluate-box-top-left').css('visibility','hidden')
            $('.evaluate-box-top-left').css('visibility', 'hidden')
            recharts_z()
            loadEcharts()
@@ -33,12 +37,12 @@
    });
    //淹没图弹窗事件
    $('#create-flood-image').click(function (){
    $('#create-flood-image').click(function () {
        imagePopup()
    })
    //加载柱状图
    function loadEcharts(){
    function loadEcharts() {
        var chartDom = document.getElementById('evaluate-echarts');
        var myChart = echarts.init(chartDom);
        var app = {}
@@ -98,7 +102,7 @@
            xAxis: [
                {
                    type: 'value',
                    axisTick: { show: false },
                    axisTick: {show: false},
                }
            ],
            yAxis: [
@@ -148,7 +152,7 @@
            ]
        };
        echartsOption&&myChart.setOption(echartsOption,true);
        echartsOption && myChart.setOption(echartsOption, true);
    }
    function recharts_z() {
@@ -174,12 +178,12 @@
    }
    //淹没图弹窗
    function imagePopup(){
    function imagePopup() {
        var url = './corelib/common/popup/floodImage.html';
        var top = ($(window).height() - 526) / 2;
        var left = ($(window).width() - 500 - 340) / 2 + 340;
        parent.layer.open({
            title:'影响分析',
            title: '影响分析',
            type: 2,
            maxmin: false, //开启最大化最小化按钮
            area: ['1000px', '800px'],
@@ -190,4 +194,106 @@
            closeBtn: 1
        });
    }
    function init() {
        loadSumData()
        loadPagination()
    }
    function loadTable(listData) {
        // $('#evaluate-tbody').remove()
        var table = ""
        var house = 0
        var people = 0
        var area = 0
        var money = 0
        for (let i = 0; i < listData.length; i++) {
            table += '<tr>' +
                '<td><div>' + listData[i].name + '</div></td>' +
                '<td><div>' + listData[i].house + '</div></td>' +
                '<td><div>' + listData[i].people + '</div></td>' +
                '<td><div>' + listData[i].area + '</div></td>' +
                '<td><div>' + listData[i].money + '</div></td>' +
                '</tr>'
            house += data[i].house
            people += data[i].people
            area += data[i].area
            money += data[i].money
        }
        $('#evaluate-tbody').html(table)
    }
    function loadSumData() {
        var house = 0
        var people = 0
        var area = 0
        var money = 0
        for (let i = 0; i < data.length; i++) {
            house = floatAdd(house, data[i].house)
            people = floatAdd(people, data[i].people)
            area = floatAdd(area, data[i].area)
            money = floatAdd(money, data[i].money)
        }
        $(".house").html(house + '户')
        $(".people").html(people + '人')
        $(".area").html(area + 'km²')
        $(".money").html(money + '万元')
    }
    function loadPagination() {
        if (data.length < 0) return
        var count = Math.ceil(data.length / 10);
        $('.Pagination').pagination({
            mode: 'fixed',
            jump: true,
            coping: false,
            pageCount: count,
            callback: function (index) {
                var listdata = [];
                //显示页数
                var index = (index.getCurrent() - 1) * 10;
                for (var i = index; i < index + 10; i++) {
                    listdata.push(data[i]);
                    if (i == data.length - 1) {
                        break;
                    }
                }
                loadTable(listdata)
            }
        });
        //首次加载前10条数据
        var startData = [];
        if (data.length > 10) {
            for (var i = 0; i < 10; i++) {
                startData.push(data[i]);
            }
        } else {
            for (var i = 0; i < data.length; i++) {
                startData.push(data[i]);
            }
        }
        loadTable(startData)
    }
    //防止出现两个小数相加出现很多0的情况
    function floatAdd(arg1, arg2) {
        var r1, r2, m;
        try {
            r1 = arg1.toString().split(".")[1].length;
        } catch (e) {
            r1 = 0;
        }
        try {
            r2 = arg2.toString().split(".")[1].length;
        } catch (e) {
            r2 = 0;
        }
        m = Math.pow(10, Math.max(r1, r2));
        return (arg1 * m + arg2 * m) / m;
    }
});
widgets/FloodAnalysis/Widget.js
@@ -2,875 +2,619 @@
// Copyright © 2022 guoshilong. All Rights Reserved.
// 模块描述:洪水淹没分析
///////////////////////////////////////////////////////////////////////////
define(['dojo/_base/declare', 'dojo/_base/lang', 'dojo/_base/array', 'dojo/_base/html', "dojo/topic", 'jimu/BaseWidget', 'dojo/on', 'dstore/Memory', 'dstore/Trackable', 'dgrid/Grid', 'dgrid/Keyboard', 'dgrid/Selection', 'dstore/RequestMemory', 'dgrid/test/data/createSyncStore', "libs/echarts/v4/echarts.min", 'libs/layer/layer.js','libs/turf/turf.min.js'], function (declare, lang, array, html, topic, BaseWidget, on, Memory, Trackable, Grid, Keyboard, Selection, RequestMemory, createSyncStore, echarts, layer,turf) {
    return declare([BaseWidget], {
        baseClass: 'jimu-widget-FloodAnalysis',
        name: 'FloodAnalysis',
        //人员数据点位
        peoplePositionArray:[],
        //绘制多边形的顶点经纬度
        polygonPositionArray:[],
        startup: function startup() {
            // 数组用于存放添加点的Id删除实体点的时候会用到
            var pointId = [];
define(['dojo/_base/declare', 'dojo/_base/lang', 'dojo/_base/array', 'dojo/_base/html', "dojo/topic", 'jimu/BaseWidget', 'dojo/on', 'dstore/Memory', 'dstore/Trackable', 'dgrid/Grid', 'dgrid/Keyboard', 'dgrid/Selection', 'dstore/RequestMemory', 'dgrid/test/data/createSyncStore', "libs/echarts/v4/echarts.min", 'libs/layer/layer.js', 'libs/turf/turf.min.js'], function (declare, lang, array, html, topic, BaseWidget, on, Memory, Trackable, Grid, Keyboard, Selection, RequestMemory, createSyncStore, echarts, layer, turf) {
    return declare([BaseWidget], {
        baseClass: 'jimu-widget-FloodAnalysis',
        name: 'FloodAnalysis',
        //人员数据点位
        peoplePositionArray: [],
        //绘制多边形的顶点经纬度
        polygonPositionArray: [],
        startup: function startup() {
            // 数组用于存放添加点的Id删除实体点的时候会用到
            var pointId = [];
            // 鼠标事件
            var waterEntity;
            // 点击绘制按钮开始绘制
            var that = this;
            var yanmo;
            var flag = false;
            var flagScend = false;
            // 海拔
            var altitude = [];
            var drawingMode = 'polygon';
            var activeShape;
            var boildOne = null;
            var boildTwo = null;
            var boildThree = null;
            // 向三维场景中添加的点的集合
            var tempPoints = [];
            // 鼠标事件
            var waterEntity;
            // 点击绘制按钮开始绘制
            var that = this;
            var yanmo;
            var flag = false;
            var flagScend = false;
            // 海拔
            var altitude = [];
            var drawingMode = 'polygon';
            var activeShape;
            var boildOne = null;
            var boildTwo = null;
            var boildThree = null;
            // 向三维场景中添加的点的集合
            var tempPoints = [];
            var positions = [];
            var handler = new Cesium.ScreenSpaceEventHandler(that.map.scene.canvas);
            var positions = [];
            var handler = new Cesium.ScreenSpaceEventHandler(that.map.scene.canvas);
            var shape;
            var shape;
            //隐藏详情框
            this.showDetail(false)
            $('#dong_draw').click(function () {
                that.deleteEntitys(that, pointId, shape, boildOne, boildTwo, boildThree, waterEntity);
                //隐藏详情框
                that.showDetail(false)
                $('#dong_time').val(0.5);
                $('.dong-progress .container #progress_bar').width(0);
                $('.dong-progress').stop().hide();
                $('#dong_echarts').stop().hide();
                $('.jimu-widget-AnalysisOfBarrierLake p').stop().hide();
                //if (handler != null) handler.destroy();
                handler = new Cesium.ScreenSpaceEventHandler(that.map.scene.canvas);
                function drawShape(positionData) {
                    if (drawingMode == 'polygon') {
                        shape = that.map.entities.add({
                            polygon: {
                                hierarchy: positionData,
                                material: Cesium.Color.fromBytes(252, 193, 10, 130)
                            }
                        });
                    }
                    that.fixedShape = shape;
            $('#dong_draw').click(function () {
                that.deleteEntitys(that, pointId, shape, boildOne, boildTwo, boildThree, waterEntity);
                //隐藏详情框
                that.showDetail(false)
                $('#dong_time').val(0.5);
                $('.dong-progress .container #progress_bar').width(0);
                $('.dong-progress').stop().hide();
                $('#dong_echarts').stop().hide();
                $('.jimu-widget-AnalysisOfBarrierLake p').stop().hide();
                //if (handler != null) handler.destroy();
                handler = new Cesium.ScreenSpaceEventHandler(that.map.scene.canvas);
                    return shape;
                }
                clearInterval(yanmo);
                yanmo = null;
                positions = [];
                var polygon = null;
                var cartesian = null;
                var floatingPoint; //浮动点
                var activeShapePoints = [];
                var active = null;
                tempPoints = [];
                altitude = [];
                that.map.scene.globe.depthTestAgainstTerrain = false;
                function drawShape(positionData) {
                    if (drawingMode == 'polygon') {
                        shape = that.map.entities.add({
                            polygon: {
                                hierarchy: positionData,
                                material: Cesium.Color.fromBytes(252, 193, 10, 130)
                            }
                        });
                    }
                    that.fixedShape = shape;
                // handler = new Cesium.ScreenSpaceEventHandler(that.map.scene.canvas);
                // 取消双击事件-追踪该位置
                that.map.cesiumWidget.screenSpaceEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
                    return shape;
                }
                // 鼠标左键点击事件
                handler.setInputAction(function (movement) {
                    // 给鼠标点击增加的点添加随机的ID便于删除
                    var randomId = Math.random() * 100 + 8 + (Math.random() * 500 + 102);
                clearInterval(yanmo);
                yanmo = null;
                positions = [];
                var polygon = null;
                var cartesian = null;
                var floatingPoint; //浮动点
                var activeShapePoints = [];
                var active = null;
                tempPoints = [];
                altitude = [];
                that.map.scene.globe.depthTestAgainstTerrain = false;
                    var ray = that.map.camera.getPickRay(movement.position);
                    cartesian = that.map.scene.globe.pick(ray, that.map.scene);
                    if (positions.length == 0) {
                        positions.push(cartesian.clone());
                        flagScend = true;
                    }
                    // positions.pop();
                    positions.push(cartesian);
                    // 向三维场景中添加点
                    var cartographic = Cesium.Cartographic.fromCartesian(positions[positions.length - 1]);
                    var longitudeString = Cesium.Math.toDegrees(cartographic.longitude);
                    var latitudeString = Cesium.Math.toDegrees(cartographic.latitude);
                    var heightString = cartographic.height;
                    tempPoints.push({
                        lon: longitudeString,
                        lat: latitudeString,
                        hei: heightString
                    });
                    altitude.push(Math.round(cartographic.height));
                    if (Cesium.defined(cartesian)) {
                        if (activeShapePoints.length === 0) {
                            floatingPoint = that.map.entities.add({
                                // 给实体点添加ID
                                id: '1a-2b-3c',
                                name: '多边形面积',
                                position: positions[positions.length - 1],
                                point: {
                                    pixelSize: 6,
                                    color: Cesium.Color.RED,
                                    heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
                                }
                            });
                            pointId.push('1a-2b-3c');
                // handler = new Cesium.ScreenSpaceEventHandler(that.map.scene.canvas);
                // 取消双击事件-追踪该位置
                that.map.cesiumWidget.screenSpaceEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
                            activeShapePoints.push(cartesian);
                            var dynamicPositions = new Cesium.CallbackProperty(function () {
                                if (drawingMode === 'polygon') {
                                    return new Cesium.PolygonHierarchy(activeShapePoints);
                                }
                                return activeShapePoints;
                            }, false);
                            active = drawShape(dynamicPositions); //绘制动态图
                        }
                        activeShapePoints.push(cartesian);
                        floatingPoint = that.map.entities.add({
                            // 给实体点添加ID
                            id: randomId,
                            name: '多边形面积',
                            position: positions[positions.length - 1],
                            point: {
                                pixelSize: 6,
                                color: Cesium.Color.RED,
                                heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
                            }
                        });
                // 鼠标左键点击事件
                handler.setInputAction(function (movement) {
                    // 给鼠标点击增加的点添加随机的ID便于删除
                    var randomId = Math.random() * 100 + 8 + (Math.random() * 500 + 102);
                        pointId.push(randomId);
                    }
                }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
                    var ray = that.map.camera.getPickRay(movement.position);
                    cartesian = that.map.scene.globe.pick(ray, that.map.scene);
                    if (positions.length == 0) {
                        positions.push(cartesian.clone());
                        flagScend = true;
                    }
                    // positions.pop();
                    positions.push(cartesian);
                    // 向三维场景中添加点
                    var cartographic = Cesium.Cartographic.fromCartesian(positions[positions.length - 1]);
                    var longitudeString = Cesium.Math.toDegrees(cartographic.longitude);
                    var latitudeString = Cesium.Math.toDegrees(cartographic.latitude);
                    var heightString = cartographic.height;
                    tempPoints.push({
                        lon: longitudeString,
                        lat: latitudeString,
                        hei: heightString
                    });
                    altitude.push(Math.round(cartographic.height));
                    if (Cesium.defined(cartesian)) {
                        if (activeShapePoints.length === 0) {
                            floatingPoint = that.map.entities.add({
                                // 给实体点添加ID
                                id: '1a-2b-3c',
                                name: '多边形面积',
                                position: positions[positions.length - 1],
                                point: {
                                    pixelSize: 6,
                                    color: Cesium.Color.RED,
                                    heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
                                }
                            });
                            pointId.push('1a-2b-3c');
                // 鼠标移动事件
                handler.setInputAction(function (event) {
                    if (positions.length == 0) {
                        that.map.entities.remove(boildOne);
                        var pick1 = new Cesium.Cartesian2(event.endPosition.x, event.endPosition.y);
                        var newPosition = that.map.scene.globe.pick(viewer.camera.getPickRay(pick1), that.map.scene);
                        boildOne = that.map.entities.add({
                            position: newPosition,
                            label: {
                                show: true,
                                text: '单击开始绘制',
                                font: '16px',
                                pixelOffset: new Cesium.Cartesian2(80, 0),
                                showBackground: true,
                                backgroundColor: Cesium.Color.fromBytes(126, 126, 126, 210)
                            }
                        });
                    }
                    if (positions.length == 2) {
                        that.map.entities.remove(boildOne);
                        that.map.entities.remove(boildTwo);
                        var pick1 = new Cesium.Cartesian2(event.endPosition.x, event.endPosition.y);
                        var newPosition = that.map.scene.globe.pick(viewer.camera.getPickRay(pick1), that.map.scene);
                        boildTwo = that.map.entities.add({
                            position: newPosition,
                            label: {
                                show: true,
                                text: '单击增加点',
                                font: '16px',
                                pixelOffset: new Cesium.Cartesian2(80, 0),
                                showBackground: true,
                                backgroundColor: Cesium.Color.fromBytes(126, 126, 126, 210)
                            }
                        });
                    }
                    if (positions.length > 2) {
                        that.map.entities.remove(boildOne);
                        that.map.entities.remove(boildTwo);
                        that.map.entities.remove(boildThree);
                        var pick1 = new Cesium.Cartesian2(event.endPosition.x, event.endPosition.y);
                        var newPosition = that.map.scene.globe.pick(viewer.camera.getPickRay(pick1), that.map.scene);
                        boildThree = that.map.entities.add({
                            position: newPosition,
                            label: {
                                show: true,
                                text: '单击增加点,右键点击完成绘制',
                                font: '16px',
                                pixelOffset: new Cesium.Cartesian2(120, 0),
                                showBackground: true,
                                backgroundColor: Cesium.Color.fromBytes(126, 126, 126, 210)
                            }
                        });
                    }
                            activeShapePoints.push(cartesian);
                            var dynamicPositions = new Cesium.CallbackProperty(function () {
                                if (drawingMode === 'polygon') {
                                    return new Cesium.PolygonHierarchy(activeShapePoints);
                                }
                                return activeShapePoints;
                            }, false);
                            active = drawShape(dynamicPositions); //绘制动态图
                        }
                        activeShapePoints.push(cartesian);
                        floatingPoint = that.map.entities.add({
                            // 给实体点添加ID
                            id: randomId,
                            name: '多边形面积',
                            position: positions[positions.length - 1],
                            point: {
                                pixelSize: 6,
                                color: Cesium.Color.RED,
                                heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
                            }
                        });
                    if (Cesium.defined(floatingPoint)) {
                        var pick1 = new Cesium.Cartesian2(event.endPosition.x, event.endPosition.y);
                        var newPosition = that.map.scene.globe.pick(viewer.camera.getPickRay(pick1), that.map.scene);
                        if (Cesium.defined(newPosition)) {
                            floatingPoint.position.setValue(newPosition);
                            activeShapePoints.pop();
                            activeShapePoints.push(newPosition);
                        }
                    }
                }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
                        pointId.push(randomId);
                    }
                }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
                // 鼠标右键点击事件
                handler.setInputAction(function (movement) {
                    var cartographic = Cesium.Cartographic.fromCartesian(that.map.scene.globe.pick(that.map.camera.getPickRay(movement.position), that.map.scene));
                    // 向三维场景中添加点
                    var longitudeString = Cesium.Math.toDegrees(cartographic.longitude);
                    var latitudeString = Cesium.Math.toDegrees(cartographic.latitude);
                    var heightString = cartographic.height;
                    tempPoints.push({
                        lon: longitudeString,
                        lat: latitudeString,
                        hei: heightString
                    });
                    that.polygonPositionArray = tempPoints
                    positions.push(activeShapePoints[activeShapePoints.length - 1]);
                    if (positions.length >= 2) {
                        if (!Cesium.defined(polygon)) {
                            polygon = new PolygonPrimitive(positions);
                        } else {
                            positions.pop();
                            positions.push(cartesian);
                        }
                    }
                    if (activeShapePoints.length) {
                        activeShape = drawShape(activeShapePoints); //绘制最终图
                    }
                    // that.map.entities.remove(floatingPoint);
                    that.map.entities.remove(active);
                    that.map.entities.remove(boildOne);
                    that.map.entities.remove(boildTwo);
                    that.map.entities.remove(boildThree);
                    if (!flagScend) return;
                    flagScend = false;
                    altitude.push(Math.round(cartographic.height));
                    altitude.sort(function (a, b) {
                        if (a > b) return 1;else if (a < b) return -1;else return 0;
                    });
                    $('#dong_max_height').val(altitude[altitude.length - 1]);
                    $('#dong_min_height').val(altitude[0]);
                    handler.destroy();
                    flag = true;
                    return;
                }, Cesium.ScreenSpaceEventType.RIGHT_CLICK);
                // 鼠标移动事件
                handler.setInputAction(function (event) {
                    if (positions.length == 0) {
                        that.map.entities.remove(boildOne);
                        var pick1 = new Cesium.Cartesian2(event.endPosition.x, event.endPosition.y);
                        var newPosition = that.map.scene.globe.pick(viewer.camera.getPickRay(pick1), that.map.scene);
                        boildOne = that.map.entities.add({
                            position: newPosition,
                            label: {
                                show: true,
                                text: '单击开始绘制',
                                font: '16px',
                                pixelOffset: new Cesium.Cartesian2(80, 0),
                                showBackground: true,
                                backgroundColor: Cesium.Color.fromBytes(126, 126, 126, 210)
                            }
                        });
                    }
                    if (positions.length == 2) {
                        that.map.entities.remove(boildOne);
                        that.map.entities.remove(boildTwo);
                        var pick1 = new Cesium.Cartesian2(event.endPosition.x, event.endPosition.y);
                        var newPosition = that.map.scene.globe.pick(viewer.camera.getPickRay(pick1), that.map.scene);
                        boildTwo = that.map.entities.add({
                            position: newPosition,
                            label: {
                                show: true,
                                text: '单击增加点',
                                font: '16px',
                                pixelOffset: new Cesium.Cartesian2(80, 0),
                                showBackground: true,
                                backgroundColor: Cesium.Color.fromBytes(126, 126, 126, 210)
                            }
                        });
                    }
                    if (positions.length > 2) {
                        that.map.entities.remove(boildOne);
                        that.map.entities.remove(boildTwo);
                        that.map.entities.remove(boildThree);
                        var pick1 = new Cesium.Cartesian2(event.endPosition.x, event.endPosition.y);
                        var newPosition = that.map.scene.globe.pick(viewer.camera.getPickRay(pick1), that.map.scene);
                        boildThree = that.map.entities.add({
                            position: newPosition,
                            label: {
                                show: true,
                                text: '单击增加点,右键点击完成绘制',
                                font: '16px',
                                pixelOffset: new Cesium.Cartesian2(120, 0),
                                showBackground: true,
                                backgroundColor: Cesium.Color.fromBytes(126, 126, 126, 210)
                            }
                        });
                    }
                var PolygonPrimitive = function () {
                    function _(positions) {
                        this.options = {
                            name: '多边形',
                            polygon: {
                                hierarchy: [],
                                material: Cesium.Color.WHITE.withAlpha(0)
                            }
                        };
                    if (Cesium.defined(floatingPoint)) {
                        var pick1 = new Cesium.Cartesian2(event.endPosition.x, event.endPosition.y);
                        var newPosition = that.map.scene.globe.pick(viewer.camera.getPickRay(pick1), that.map.scene);
                        if (Cesium.defined(newPosition)) {
                            floatingPoint.position.setValue(newPosition);
                            activeShapePoints.pop();
                            activeShapePoints.push(newPosition);
                        }
                    }
                }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
                        this.positions = positions;
                        this._init();
                    }
                    _.prototype._init = function () {
                        var _self = this;
                        //实时更新polygon.hierarchy
                        this.options.polygon.hierarchy = new Cesium.CallbackProperty(function () {
                            return new Cesium.PolygonHierarchy(positions);
                        }, false);
                        waterEntity = that.map.entities.add(this.options);
                        that.fixedWaterEntity = waterEntity;
                    };
                    return _;
                }();
            });
                // 鼠标右键点击事件
                handler.setInputAction(function (movement) {
                    var cartographic = Cesium.Cartographic.fromCartesian(that.map.scene.globe.pick(that.map.camera.getPickRay(movement.position), that.map.scene));
                    // 向三维场景中添加点
                    var longitudeString = Cesium.Math.toDegrees(cartographic.longitude);
                    var latitudeString = Cesium.Math.toDegrees(cartographic.latitude);
                    var heightString = cartographic.height;
                    tempPoints.push({
                        lon: longitudeString,
                        lat: latitudeString,
                        hei: heightString
                    });
                    that.polygonPositionArray = tempPoints
                    positions.push(activeShapePoints[activeShapePoints.length - 1]);
                    if (positions.length >= 2) {
                        if (!Cesium.defined(polygon)) {
                            polygon = new PolygonPrimitive(positions);
                        } else {
                            positions.pop();
                            positions.push(cartesian);
                        }
                    }
                    if (activeShapePoints.length) {
                        activeShape = drawShape(activeShapePoints); //绘制最终图
                    }
                    // that.map.entities.remove(floatingPoint);
                    that.map.entities.remove(active);
                    that.map.entities.remove(boildOne);
                    that.map.entities.remove(boildTwo);
                    that.map.entities.remove(boildThree);
                    if (!flagScend) return;
                    flagScend = false;
                    altitude.push(Math.round(cartographic.height));
                    altitude.sort(function (a, b) {
                        if (a > b) return 1; else if (a < b) return -1; else return 0;
                    });
                    $('#dong_max_height').val(altitude[altitude.length - 1]);
                    $('#dong_min_height').val(altitude[0]);
                    handler.destroy();
                    flag = true;
                    return;
                }, Cesium.ScreenSpaceEventType.RIGHT_CLICK);
            // 点击开始分析按钮,开始分析
            $('#dong_start').click(function () {
                //宽度设置为0 隐藏进度条
                $('.dong-progress .container #progress_bar').width(0);
                //隐藏div
                $('.dong-progress').stop().hide();
                $('#dong_echarts').stop().hide();
                $('.jimu-widget-AnalysisOfBarrierLake p').stop().hide();
                if (flag != true) {
                    if (yanmo != null) {
                        layer.msg('请等待绘制完成', {
                var PolygonPrimitive = function () {
                    function _(positions) {
                        this.options = {
                            name: '多边形',
                            polygon: {
                                hierarchy: [],
                                material: Cesium.Color.WHITE.withAlpha(0)
                            }
                        };
                            time: 1000
                        });
                        return;
                    }
                    layer.msg('请先选择绘制区域', {
                        this.positions = positions;
                        this._init();
                    }
                        time: 1000
                    });
                    return;
                };
                // 提取坐标信息
                var list = waterEntity.polygon.hierarchy.getValue().positions;
                // 存放坐标信息,做请求数据使用
                var echartRings = [[]];
                    _.prototype._init = function () {
                        var _self = this;
                        //实时更新polygon.hierarchy
                        this.options.polygon.hierarchy = new Cesium.CallbackProperty(function () {
                            return new Cesium.PolygonHierarchy(positions);
                        }, false);
                        waterEntity = that.map.entities.add(this.options);
                        that.fixedWaterEntity = waterEntity;
                    };
                    return _;
                }();
            });
                // 处理坐标信息,将世界坐标转换成经纬度
                for (var i = 1; i < list.length; i++) {
                    var cartographic = Cesium.Cartographic.fromCartesian(list[i]);
                    var lat = Cesium.Math.toDegrees(cartographic.latitude);
                    var lng = Cesium.Math.toDegrees(cartographic.longitude);
                    echartRings[0].push([lng, lat]);
                }
            // 点击开始分析按钮,开始分析
            $('#dong_start').click(function () {
                //宽度设置为0 隐藏进度条
                $('.dong-progress .container #progress_bar').width(0);
                //隐藏div
                $('.dong-progress').stop().hide();
                $('#dong_echarts').stop().hide();
                $('.jimu-widget-AnalysisOfBarrierLake p').stop().hide();
                if (flag != true) {
                    if (yanmo != null) {
                        layer.msg('请等待绘制完成', {
                // // 发请求数据
                // var enenen = {
                //     "displayFieldName": "",
                //     "geometryType": "esriGeometryPolygon",
                //     "spatialReference": {
                //         "wkid": 4490,
                //         "latestWkid": 4490
                //     },
                //     "fields": [{
                //         "name": "OBJECTID",
                //         "type": "esriFieldTypeOID",
                //         "alias": "OBJECTID"
                //     }, {
                //         "name": "SHAPE_Length",
                //         "type": "esriFieldTypeDouble",
                //         "alias": "SHAPE_Length"
                //     }, {
                //         "name": "SHAPE_Area",
                //         "type": "esriFieldTypeDouble",
                //         "alias": "SHAPE_Area"
                //     }],
                //     "features": [{
                //         "geometry": {
                //             "rings": echartRings,
                //             "spatialReference": {
                //                 "wkid": 4490,
                //                 "latestWkid": 4490
                //             }
                //         },
                //         "symbol": null,
                //         "attributes": {
                //             "OBJECTID": 1163
                //         }
                //     }],
                //     "exceededTransferLimit": false
                //     // 数据转换格式
                // };enenen = JSON.stringify(enenen);
                            time: 1000
                        });
                        return;
                    }
                    layer.msg('请先选择绘制区域', {
                that.map.entities.remove(activeShape);
                // 最高海拔
                var maxHet = Number($('#dong_max_height').val());
                // 最低海拔
                var minHet = Number($('#dong_min_height').val());
                // 每秒上升海拔
                var time = Number($('#dong_time').val());
                // 动态获取最低海拔
                $('#dong_min_height').change(function () {
                    minHet = $(this).val();
                });
                        time: 1000
                    });
                    return;
                }
                ;
                // 提取坐标信息
                var list = waterEntity.polygon.hierarchy.getValue().positions;
                // 存放坐标信息,做请求数据使用
                var echartRings = [[]];
                // 总淹没体积
                var textArea = parseInt(getArea(tempPoints) * (maxHet - minHet) / 100000);
                var seriesData = [];
                var altitude = (maxHet - minHet) / 20;
                var altitudeHet = 0;
                // 处理坐标信息,将世界坐标转换成经纬度
                for (var i = 1; i < list.length; i++) {
                    var cartographic = Cesium.Cartographic.fromCartesian(list[i]);
                    var lat = Cesium.Math.toDegrees(cartographic.latitude);
                    var lng = Cesium.Math.toDegrees(cartographic.longitude);
                    echartRings[0].push([lng, lat]);
                }
                // 1秒后开始进入淹没分析
                setTimeout(function () {
                    flag = false;
                    if (waterEntity) {
                        that.map.scene.globe.depthTestAgainstTerrain = true;
                        waterEntity.polygon.perPositionHeight = true, waterEntity.polygon.material = Cesium.Color.fromBytes(33, 122, 193, 220);
                        var h = minHet - 50 || altitude[0] - 50;
                        waterEntity.polygon.extrudedHeight = minHet - 50 || altitude[0] - 50; //需要提前设置 不然会全部出现
                        yanmo = setInterval(function () {
                            h = h + time || 1;
                            if (h >= (maxHet || altitude[altitude.length - 1])) {
                                h = maxHet || altitude[altitude.length - 1]; //给个最大值
                                waterEntity.polygon.extrudedHeight = h;
                                clearTimeout(yanmo);
                                flag = true;
                that.map.entities.remove(activeShape);
                // 最高海拔
                var maxHet = Number($('#dong_max_height').val());
                // 最低海拔
                var minHet = Number($('#dong_min_height').val());
                // 每秒上升海拔
                var time = Number($('#dong_time').val());
                // 动态获取最低海拔
                $('#dong_min_height').change(function () {
                    minHet = $(this).val();
                });
                // 总淹没体积
                var textArea = parseInt(getArea(tempPoints) * (maxHet - minHet) / 100000);
                var seriesData = [];
                var altitude = (maxHet - minHet) / 20;
                var altitudeHet = 0;
                                // //显示div
                                // $('.dong-progress').stop().show();
                                // // 总长度
                                // var totalWidth = $('.dong-progress .container').width();
                                // // 过度长度
                                // var excessiveWidth = totalWidth / 100;
                                // var watchWidth = 0;
                                // // 进度条的定时器
                                // var proTime = setInterval(function () {
                                //     watchWidth += excessiveWidth;
                                //     if (watchWidth > totalWidth) {
                                //         watchWidth = totalWidth;
                                //     }
                                //     $('.dong-progress .container #progress_bar').width(watchWidth);
                                // }, 22);
                // 1秒后开始进入淹没分析
                setTimeout(function () {
                    flag = false;
                    if (waterEntity) {
                        that.map.scene.globe.depthTestAgainstTerrain = true;
                        waterEntity.polygon.perPositionHeight = true, waterEntity.polygon.material = Cesium.Color.fromBytes(33, 122, 193, 220);
                        var h = minHet - 50 || altitude[0] - 50;
                        waterEntity.polygon.extrudedHeight = minHet - 50 || altitude[0] - 50; //需要提前设置 不然会全部出现
                        yanmo = setInterval(function () {
                            h = h + time || 1;
                            if (h >= (maxHet || altitude[altitude.length - 1])) {
                                h = maxHet || altitude[altitude.length - 1]; //给个最大值
                                waterEntity.polygon.extrudedHeight = h;
                                clearTimeout(yanmo);
                                flag = true;
                                // $.ajax({
                                //     url: 'http://171.35.109.175:18080/arcgis/rest/services/GZSW/%E5%8F%A0%E5%8A%A0%E5%88%86%E6%9E%90/GPServer/%E5%8F%A0%E5%8A%A0%E5%88%86%E6%9E%90/submitJob',
                                //     type: 'post',
                                //     dataType: 'json',
                                //     data: {
                                //         f: 'pjson',
                                //         fxfw: enenen
                                //     },
                                //     success: function success(result) {
                                //         troubleshooting(0);
                                //
                                //         function troubleshooting(i) {
                                //             $.ajax({
                                //                 url: 'http://171.35.109.175:18080/arcgis/rest/services/GZSW/%E5%8F%A0%E5%8A%A0%E5%88%86%E6%9E%90/GPServer/%E5%8F%A0%E5%8A%A0%E5%88%86%E6%9E%90/jobs/' + result.jobId + '?f=pjson',
                                //                 type: 'get',
                                //                 dataType: 'json',
                                //                 data: {},
                                //                 success: function success(data) {
                                //                     if (data.jobStatus == 'esriJobSucceeded') {
                                //                         var perurl = data.results.fxfw_Intersect_Statistics.paramUrl;
                                //                         $.ajax({
                                //                             url: 'http://171.35.109.175:18080/arcgis/rest/services/GZSW/%E5%8F%A0%E5%8A%A0%E5%88%86%E6%9E%90/GPServer/%E5%8F%A0%E5%8A%A0%E5%88%86%E6%9E%90/jobs/' + result.jobId + '/' + perurl,
                                //                             type: 'post',
                                //                             dataType: 'json',
                                //                             data: {
                                //                                 f: 'pjson'
                                //                             },
                                //                             success: function success(message) {
                                //                                 if (watchWidth < totalWidth) {
                                //                                     watchWidth = totalWidth;
                                //                                 }
                                //                                 clearInterval(proTime);
                                //                                 // 在此处创建库容曲线
                                //                                 var storageLine = echarts.init(document.getElementById('storage_echarts'));
                                //                                 var storageOptions = {
                                //                                     title: {
                                //                                         text: '库容曲线'
                                //                                     },
                                //                                     tooltip: {
                                //                                         trigger: 'axis'
                                //                                     },
                                //                                     gird: {
                                //                                         top: '20px'
                                //                                     },
                                //                                     legend: {
                                //                                         data: ['最大淹没体积']
                                //                                     },
                                //                                     xAxis: {
                                //                                         type: 'value',
                                //                                         min: 0,
                                //                                         max: textArea,
                                //                                         splitNumber: 10
                                //                                     },
                                //                                     yAxis: {
                                //                                         name: '水位(m)',
                                //                                         nameTextStyle: {
                                //                                             color: 'rgba(40, 37, 161, 0.849)'
                                //                                         },
                                //                                         type: 'value',
                                //                                         min: 0,
                                //                                         max: maxHet,
                                //                                         splitNumber: 10,
                                //                                         axisLabel: {
                                //                                             formatter: '{value}'
                                //                                         }
                                //                                     },
                                //                                     series: [{
                                //                                         name: '最大淹没体积',
                                //                                         type: 'line',
                                //                                         data: [],
                                //                                         smooth: true
                                //                                     }]
                                //                                 };
                                //                                 storageOptions.series[0].data = seriesData;
                                //                                 storageLine.setOption(storageOptions);
                                //
                                //                                 var features = message.value.features;
                                //                                 if (features == false) {
                                //                                     layer.msg('此处不在可分析范围内', {
                                //
                                //                                         time: 1000
                                //                                     });
                                //                                     $('.dong-progress .container #progress_bar').width(0);
                                //                                     $('.dong-progress').stop().hide();
                                //                                     return;
                                //                                 }
                                //                                 $('.dong-progress .container #progress_bar').width(totalWidth);
                                //                                 var echartsResult = [];
                                //                                 var subTitle = '';
                                //                                 // 淹没总面积
                                //                                 var shapeAreas = 0;
                                //                                 var echartsName = null;
                                //                                 var echartsColor = null;
                                //                                 for (var j = 0; j < features.length; j++) {
                                //                                     shapeAreas += features[j].attributes.SUM_Shape_Area;
                                //                                 }
                                //                                 for (var i = 0; i < features.length; i++) {
                                //                                     if (features[i].attributes.gridcode == 1) {
                                //                                         echartsName = '城镇';
                                //                                         echartsColor = '#B56DD1';
                                //                                     } else if (features[i].attributes.gridcode == 2) {
                                //                                         echartsName = '植被';
                                //                                         echartsColor = '#5F8812';
                                //                                     } else if (features[i].attributes.gridcode == 3) {
                                //                                         echartsName = '水域';
                                //                                         echartsColor = '#0B6FC5';
                                //                                     } else if (features[i].attributes.gridcode == 4) {
                                //                                         echartsName = '裸地';
                                //                                         echartsColor = '#CE8B44';
                                //                                     } else if (features[i].attributes.gridcode == 5) {
                                //                                         echartsName = '农业用地';
                                //                                         echartsColor = '#B5D874';
                                //                                     }
                                //                                     echartsResult.push({
                                //                                         value: (features[i].attributes.SUM_Shape_Area / 1000000).toFixed(2),
                                //                                         name: echartsName,
                                //                                         itemStyle: {
                                //                                             color: echartsColor
                                //                                         }
                                //                                     });
                                //                                     subTitle += echartsName + '淹没面积为' + (features[i].attributes.SUM_Shape_Area / 1000000).toFixed(2) + 'km²,占比为' + (features[i].attributes.SUM_Shape_Area / shapeAreas * 100).toFixed(2) + '%;';
                                //                                 }
                                //                                 var textSub = '\u6DF9\u6CA1\u6D77\u62D4\u9AD8\u5EA6\u4E3A' + maxHet + 'm\uFF0C\u6DF9\u6CA1\u603B\u9762\u79EF\u4E3A' + (shapeAreas / 1000000).toFixed(2) + 'km\xB2\u3002\u5176\u4E2D';
                                //                                 textSub += subTitle;
                                //                                 $('.jimu-widget-AnalysisOfBarrierLake p').text(textSub);
                                //                                 var echartsData = echarts.init(document.getElementById('dong_echarts'));
                                //                                 var options = {
                                //                                     title: {
                                //                                         text: '淹没分析结果',
                                //                                         left: '41%',
                                //                                         textStyle: {
                                //                                             color: '#5DBFFF',
                                //                                             fontSize: 26
                                //                                         },
                                //                                         top: 14
                                //                                     },
                                //                                     tooltip: {
                                //                                         trigger: 'item',
                                //                                         formatter: '{b} <br/>面积 : {c} km² ({d}%)',
                                //                                         position: 'right'
                                //                                     },
                                //                                     legend: {
                                //                                         orient: 'vertical',
                                //                                         // top: 'middle',
                                //                                         right: 4,
                                //                                         bottom: 2,
                                //                                         textStyle: { //图例文字的样式
                                //                                             color: '#fff',
                                //                                             fontSize: 14
                                //                                         },
                                //                                         data: ['城镇', '植被', '水域', '裸地', '农业用地']
                                //                                     },
                                //                                     series: [{
                                //                                         type: 'pie',
                                //                                         radius: '80%',
                                //                                         center: ['55%', '56%'],
                                //                                         selectedMode: 'single',
                                //                                         label: {
                                //                                             normal: {
                                //                                                 position: 'inner',
                                //                                                 show: false
                                //                                             }
                                //                                         },
                                //                                         data: echartsResult,
                                //                                         emphasis: {
                                //                                             itemStyle: {
                                //                                                 shadowBlur: 10,
                                //                                                 shadowOffsetX: 0,
                                //                                                 shadowColor: 'rgba(0, 0, 0, 0.5)'
                                //                                             }
                                //                                         }
                                //                                     }]
                                //                                 };
                                //                                 echartsData.setOption(options);
                                //                                 $('.dong-progress .container #progress_bar').width(0);
                                //                                 $('.dong-progress').stop().hide();
                                //                                 $('#dong_echarts').stop().show();
                                //                                 $('.jimu-widget-AnalysisOfBarrierLake p').stop().show();
                                //                             }
                                //                         });
                                //                         return;
                                //                     } else {
                                //                         troubleshooting(i + 1);
                                //                     }
                                //                 }
                                //             });
                                //         }
                                //     }
                                // });
                                // //显示div
                                // $('.dong-progress').stop().show();
                                // // 总长度
                                // var totalWidth = $('.dong-progress .container').width();
                                // // 过度长度
                                // var excessiveWidth = totalWidth / 100;
                                // var watchWidth = 0;
                                // // 进度条的定时器
                                // var proTime = setInterval(function () {
                                //     watchWidth += excessiveWidth;
                                //     if (watchWidth > totalWidth) {
                                //         watchWidth = totalWidth;
                                //     }
                                //     $('.dong-progress .container #progress_bar').width(watchWidth);
                                // }, 22);
                                return;
                            }
                            waterEntity.polygon.extrudedHeight = h;
                                return;
                            }
                            waterEntity.polygon.extrudedHeight = h;
                            that.showDetail(true)
                        }, 100);
                    }
                }, 1000);
                            that.showDetail(true)
                        }, 100);
                    }
                }, 1000);
            });
            });
            $('#dong_delet').click(function () {
                that.showDetail(false)
                that.deleteEntitys(that, pointId, shape, boildOne, boildTwo, boildThree, waterEntity);
            $('#dong_delet').click(function () {
                that.showDetail(false)
                that.deleteEntitys(that, pointId, shape, boildOne, boildTwo, boildThree, waterEntity);
                handler.destroy();
                $('.dong-progress .container #progress_bar').width(0);
                $('.dong-progress').stop().hide();
                $('#dong_echarts').stop().hide();
                $('.jimu-widget-AnalysisOfBarrierLake p').stop().hide();
                clearInterval(yanmo);
                yanmo = null;
            });
                handler.destroy();
                $('.dong-progress .container #progress_bar').width(0);
                $('.dong-progress').stop().hide();
                $('#dong_echarts').stop().hide();
                $('.jimu-widget-AnalysisOfBarrierLake p').stop().hide();
                clearInterval(yanmo);
                yanmo = null;
            });
            $('#flood-detail-ksfx').click(function () {
                that.floodAnalysisPopup()
            })
            $('#flood-detail-ksfx').click(function () {
                that.floodAnalysisPopup()
            })
            var radiansPerDegree = Math.PI / 180.0; //角度转化为弧度(rad)
            var degreesPerRadian = 180.0 / Math.PI; //弧度转化为角度
            function getArea(points) {
                var res = 0;
                //拆分三角曲面
                for (var i = 0; i < points.length - 2; i++) {
                    var j = (i + 1) % points.length;
                    var k = (i + 2) % points.length;
                    var totalAngle = Angle(points[i], points[j], points[k]);
            var radiansPerDegree = Math.PI / 180.0; //角度转化为弧度(rad)
            var degreesPerRadian = 180.0 / Math.PI; //弧度转化为角度
            function getArea(points) {
                var res = 0;
                //拆分三角曲面
                for (var i = 0; i < points.length - 2; i++) {
                    var j = (i + 1) % points.length;
                    var k = (i + 2) % points.length;
                    var totalAngle = Angle(points[i], points[j], points[k]);
                    var dis_temp1 = distance(positions[i], positions[j]);
                    var dis_temp2 = distance(positions[j], positions[k]);
                    res += dis_temp1 * dis_temp2 * Math.abs(Math.sin(totalAngle));
                }
                    var dis_temp1 = distance(positions[i], positions[j]);
                    var dis_temp2 = distance(positions[j], positions[k]);
                    res += dis_temp1 * dis_temp2 * Math.abs(Math.sin(totalAngle));
                }
                return (res / 1000000.0).toFixed(4);
            }
                return (res / 1000000.0).toFixed(4);
            }
            /*角度*/
            function Angle(p1, p2, p3) {
                var bearing21 = Bearing(p2, p1);
                var bearing23 = Bearing(p2, p3);
                var angle = bearing21 - bearing23;
                if (angle < 0) {
                    angle += 360;
                }
                return angle;
            }
            /*方向*/
            function Bearing(from, to) {
                var lat1 = from.lat * radiansPerDegree;
                var lon1 = from.lon * radiansPerDegree;
                var lat2 = to.lat * radiansPerDegree;
                var lon2 = to.lon * radiansPerDegree;
                var 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) {
                var point1cartographic = Cesium.Cartographic.fromCartesian(point1);
                var point2cartographic = Cesium.Cartographic.fromCartesian(point2);
                /**根据经纬度计算出距离**/
                var geodesic = new Cesium.EllipsoidGeodesic();
                geodesic.setEndPoints(point1cartographic, point2cartographic);
                var s = geodesic.surfaceDistance;
                //返回两点之间的距离
                s = Math.sqrt(Math.pow(s, 2) + Math.pow(point2cartographic.height - point1cartographic.height, 2));
                return s;
            }
            /*角度*/
            function Angle(p1, p2, p3) {
                var bearing21 = Bearing(p2, p1);
                var bearing23 = Bearing(p2, p3);
                var angle = bearing21 - bearing23;
                if (angle < 0) {
                    angle += 360;
                }
                return angle;
            }
            this.closeDeleteEntity = function () {
                handler.destroy();
                that.deleteEntitys(that, pointId, shape, boildOne, boildTwo, boildThree, waterEntity);
            };
        },
            /*方向*/
            function Bearing(from, to) {
                var lat1 = from.lat * radiansPerDegree;
                var lon1 = from.lon * radiansPerDegree;
                var lat2 = to.lat * radiansPerDegree;
                var lon2 = to.lon * radiansPerDegree;
                var 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;
            }
        onOpen: function onOpen() {
            //面板打开的时候触发 (when open this panel trigger)
            this.map.scene.globe.baseColor = Cesium.Color.BLACK;
            //计算距离
            function distance(point1, point2) {
                var point1cartographic = Cesium.Cartographic.fromCartesian(point1);
                var point2cartographic = Cesium.Cartographic.fromCartesian(point2);
                /**根据经纬度计算出距离**/
                var geodesic = new Cesium.EllipsoidGeodesic();
                geodesic.setEndPoints(point1cartographic, point2cartographic);
                var s = geodesic.surfaceDistance;
                //返回两点之间的距离
                s = Math.sqrt(Math.pow(s, 2) + Math.pow(point2cartographic.height - point1cartographic.height, 2));
                return s;
            }
            //初始化点
            this.addPoint()
            //切换底图
            $($('div.cesium-viewer').find('.cesium-baseLayerPicker-choices')[0]).children('div:eq(0)').trigger('click');
            $($('div.cesium-viewer').find('.cesium-baseLayerPicker-choices')[1]).children('div:eq(2)').trigger('click');
            this.closeDeleteEntity = function () {
                handler.destroy();
                that.deleteEntitys(that, pointId, shape, boildOne, boildTwo, boildThree, waterEntity);
            };
        },
            //设置地图初始位置
            this.map.camera.setView({
                destination: Cesium.Cartesian3.fromDegrees(116.016905,25.884684, 10000),
            });
        onOpen: function onOpen() {
            //面板打开的时候触发 (when open this panel trigger)
            this.map.scene.globe.baseColor = Cesium.Color.BLACK;
            //隐藏详情框
            this.showDetail(false)
        },
            //初始化点
            this.addPoint()
            //切换底图
            $($('div.cesium-viewer').find('.cesium-baseLayerPicker-choices')[0]).children('div:eq(0)').trigger('click');
            $($('div.cesium-viewer').find('.cesium-baseLayerPicker-choices')[1]).children('div:eq(2)').trigger('click');
        onClose: function onClose() {
            this.closeDeleteEntity();
            //面板关闭的时候触发 (when this panel is closed trigger)
            //设置地图初始位置
            this.map.camera.setView({
                destination: Cesium.Cartesian3.fromDegrees(116.016905, 25.884684, 10000),
            });
            $('.dong-progress .container #progress_bar').width(0);
            $('.dong-progress').stop().hide();
            $('#dong_echarts').stop().hide();
            $('.jimu-widget-AnalysisOfBarrierLake p').stop().hide();
            //隐藏详情框
            this.showDetail(false)
        },
            this.map.scene.globe.baseColor = Cesium.Color.WHITE;
        },
        onClose: function onClose() {
            this.closeDeleteEntity();
            //面板关闭的时候触发 (when this panel is closed trigger)
        onMinimize: function onMinimize() {
            this.resize();
        },
            $('.dong-progress .container #progress_bar').width(0);
            $('.dong-progress').stop().hide();
            $('#dong_echarts').stop().hide();
            $('.jimu-widget-AnalysisOfBarrierLake p').stop().hide();
        onMaximize: function onMaximize() {
            this.resize();
        },
            this.map.scene.globe.baseColor = Cesium.Color.WHITE;
        },
        resize: function resize() {},
        onMinimize: function onMinimize() {
            this.resize();
        },
        destroy: function destroy() {
            //销毁的时候触发
            //todo
            //do something before this func
            this.inherited(arguments);
        },
        onMaximize: function onMaximize() {
            this.resize();
        },
        deleteEntitys: function deleteEntitys(that, pointId, shape, boildOne, boildTwo, boildThree, waterEntity) {
            if (pointId !== []) {
                for (var i = 0; i < pointId.length; i++) {
                    that.map.entities.removeById(pointId[i]);
                }
        resize: function resize() {
        },
                pointId = [];
            }
            that.map.entities.remove(shape);
            that.map.entities.remove(boildOne);
            that.map.entities.remove(boildTwo);
            that.map.entities.remove(boildThree);
            if (waterEntity != null) {
                that.map.entities.removeById(waterEntity._id);
            }
        },
        destroy: function destroy() {
            //销毁的时候触发
            //todo
            //do something before this func
            this.inherited(arguments);
        },
        //添加点
        addPoint:function (){
            const url = './widgets/FloodAnalysis/data.json'
            this.getJsonUrl(url)
        },
        deleteEntitys: function deleteEntitys(that, pointId, shape, boildOne, boildTwo, boildThree, waterEntity) {
            if (pointId !== []) {
                for (var i = 0; i < pointId.length; i++) {
                    that.map.entities.removeById(pointId[i]);
                }
        //获取json对象,测试用
        getJsonUrl: function getJsonUrl(url) {
            var self = this;
            $.ajax({
                url: url,
                dataType: 'json',
                type: 'get',
                success: function success(data) {
                    const viewer = self.map
                    var dataArray = data.data
                    dataArray.forEach(e=>{
                        e.house = Number(e.house)
                        e.people = Number(e.people)
                        e.area = Number(e.area)
                        e.money = Number(e.money)
                    })
                    self.peoplePositionArray = []
                    self.peoplePositionArray = dataArray
                    for (let i = 0; i < dataArray.length; i++) {
                        var temp = viewer.entities.add({
                            position: Cesium.Cartesian3.fromDegrees(dataArray[i].LGTD, dataArray[i].LTTD),
                            point: {
                                color: Cesium.Color.RED,
                                pixelSize: 16,
                                //防止地形遮挡住点
                                disableDepthTestDistance: Number.POSITIVE_INFINITY
                            },
                        });
                    }
                }
            });
        },
                pointId = [];
            }
            that.map.entities.remove(shape);
            that.map.entities.remove(boildOne);
            that.map.entities.remove(boildTwo);
            that.map.entities.remove(boildThree);
            if (waterEntity != null) {
                that.map.entities.removeById(waterEntity._id);
            }
        },
        //是否显示详情框
        showDetail:function(show){
            //显示详情
            if (show){
                $('.flood-detail').show()
            }else {
                $('.flood-detail').hide()
            }
        },
        //添加点
        addPoint: function () {
            const url = './widgets/FloodAnalysis/data.json'
            this.getJsonUrl(url)
        },
        //洪水分析弹窗
        floodAnalysisPopup:function (){
            var self = this
            var inPolygon = []
            for (let i = 0; i < this.peoplePositionArray.length; i++) {
                let isIn = this.isPointInPolygon(this.peoplePositionArray[i])
                if (isIn){
                    inPolygon.push(this.peoplePositionArray[i])
                }
            }
            var jsonStr = JSON.stringify(inPolygon)
        //获取json对象,测试用
        getJsonUrl: function getJsonUrl(url) {
            var self = this;
            $.ajax({
                url: url,
                dataType: 'json',
                type: 'get',
                success: function success(data) {
                    const viewer = self.map
                    var dataArray = data.data
                    dataArray.forEach(e => {
                        e.house = Number(e.house)
                        e.people = Number(e.people)
                        e.area = Number(e.area)
                        e.money = Number(e.money)
                    })
                    self.peoplePositionArray = []
                    self.peoplePositionArray = dataArray
                    for (let i = 0; i < dataArray.length; i++) {
                        var temp = viewer.entities.add({
                            position: Cesium.Cartesian3.fromDegrees(dataArray[i].LGTD, dataArray[i].LTTD),
                            point: {
                                color: Cesium.Color.RED,
                                pixelSize: 16,
                                //防止地形遮挡住点
                                disableDepthTestDistance: Number.POSITIVE_INFINITY
                            },
                        });
                    }
                }
            });
        },
            var url = './corelib/common/popup/floodAnalysis.html';
            var urlEvaluate = './corelib/common/popup/evaluateAnalysis.html'
            var top = ($(window).height() - 800) / 2;
            var left = ($(window).width() - 1300 - 340) / 2 + 340;
            layer.open({
                title:'评估分析',
                type: 2,
                maxmin: false, //开启最大化最小化按钮
                area: ['1100px', '800px'],
                skin: 'floodAnalysis',
                offset: [top, left],
                content: urlEvaluate + "?data=" + encodeURIComponent(jsonStr),//使用encodeURIComponent转码,避免中文字符乱码,避免url截取错误
                id: "floodAnalysisLayer",
                closeBtn: 1,
                //把父页面数据传递给子弹窗并渲染
                success: function(layero, index) {
                    //绑定父子之间的关系,用于数据传递,缺少则无法传递
                    var body = layer.getChildFrame("body",index);
                    //得到iframe页的窗口对象
                    var iframeWin = window[layero.find('iframe')[0]['name']];
                    // //渲染子页面中的img
                    // iframeWin.$('#canvasImage')[0].src = self.canvasImage;
                    var table = ""
                    var house = 0
                    var people = 0
                    var area = 0
                    var money = 0
                    for (let i = 0; i < inPolygon.length; i++) {
                        table += '<tr>'+
                            '<td><div>' + inPolygon[i].name + '</div></td>' +
                            '<td><div>' + inPolygon[i].house + '</div></td>' +
                            '<td><div>' + inPolygon[i].people + '</div></td>' +
                            '<td><div>' + inPolygon[i].area + '</div></td>' +
                            '<td><div>' + inPolygon[i].money + '</div></td>' +
                            '</tr>'
        //是否显示详情框
        showDetail: function (show) {
            //显示详情
            if (show) {
                $('.flood-detail').show()
            } else {
                $('.flood-detail').hide()
            }
        },
                        house += inPolygon[i].house
                        people += inPolygon[i].people
                        area += inPolygon[i].area
                        money += inPolygon[i].money
                    }
        //洪水分析弹窗
        floodAnalysisPopup: function () {
            var self = this
            var inPolygon = []
            for (let i = 0; i < this.peoplePositionArray.length; i++) {
                let isIn = this.isPointInPolygon(this.peoplePositionArray[i])
                if (isIn) {
                    inPolygon.push(this.peoplePositionArray[i])
                }
            }
            var inPolygonStr = JSON.stringify(inPolygon)
                    iframeWin.$('#evaluate-tbody').html(table)
            var url = './corelib/common/popup/floodAnalysis.html';
            var urlEvaluate = './corelib/common/popup/evaluateAnalysis.html'
            var top = ($(window).height() - 750) / 2;
            var left = ($(window).width() - 1300 - 340) / 2 + 340;
            layer.open({
                title: '评估分析',
                type: 2,
                maxmin: false, //开启最大化最小化按钮
                area: ['1100px', '800px'],
                skin: 'floodAnalysis',
                offset: [top, left],
                content: urlEvaluate + "?data=" + encodeURIComponent(inPolygonStr),//使用encodeURIComponent转码,避免中文字符乱码,避免url截取错误
                id: "floodAnalysisLayer",
                closeBtn: 1,
            });
        },
                    iframeWin.$(".house").html(house + '户')
                    iframeWin.$(".people").html(people + '人')
                    iframeWin.$(".area").html(area + 'km²')
                    iframeWin.$(".money").html(money + '万元')
        //判断点是否在多边形内部
        isPointInPolygon: function (point) {
            //获取经纬度
            var polygonPosition = this.polygonPositionArray
            //turf要求首尾闭合
            var turfPolygon = []
            polygonPosition.forEach(e => {
                var temp = [e.lon, e.lat]
                turfPolygon.push(temp)
            })
            turfPolygon.push([polygonPosition[0].lon, polygonPosition[0].lat])
                },
            });
        },
        //判断点是否在多边形内部
        isPointInPolygon : function (point){
            //获取经纬度
            var polygonPosition = this.polygonPositionArray
            //turf要求首尾闭合
            var turfPolygon = []
            polygonPosition.forEach(e=>{
                var temp = [e.lon,e.lat]
                turfPolygon.push(temp)
            })
            turfPolygon.push([polygonPosition[0].lon,polygonPosition[0].lat])
            var poly= turf.polygon([turfPolygon])
            var pt = turf.point([point.LGTD,point.LTTD])
            return turf.booleanPointInPolygon(pt,poly)
        },
    });
            var poly = turf.polygon([turfPolygon])
            var pt = turf.point([point.LGTD, point.LTTD])
            return turf.booleanPointInPolygon(pt, poly)
        },
    });
});
widgets/YuShuiQing/css/style.css
@@ -486,4 +486,4 @@
.ysq-m-style .jump-btn{
  width: 38px !important;
}
}