surprise
2024-01-08 7e6b37afd1295c71bca1de595426330aff88420d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<!DOCTYPE html>
<html lang="en">
 
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport"
        content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
    <title>地形剖面分析</title>
    <style>
        html,
        body,
        #myChart {
            width: 100%;
            height: 100%;
            margin: 0;
            padding: 0;
            overflow: hidden;
        }
    </style>
</head>
 
<body>
    <div id="myChart"></div>
    <script src="../jquery-2.0.3.js"></script>
    <script src="./js/echarts.js"></script>
    <script>
        let analyseData = parent._AnalysisDXPM && parent._AnalysisDXPM.analyseData;
        if (analyseData) {
            showChar(analyseData);
        }
        function showChar(distance) {
            var distacnelist = [];
            var fristdistance = 0;
            var totaldistance = (parseFloat(distance.distance) / distance.cys).toFixed(1);
            var cs = parseInt(distance.cys);
            var allPoint = distance.allPoint;
            for (var i = 0; i < cs; i++) {
                if (i == 0) {
                    var nextdistance = fristdistance;
                    fristdistance = nextdistance;
                    distacnelist.push(parseFloat(nextdistance).toFixed(1));
                } else {
                    var nextdistance = fristdistance + parseFloat(totaldistance);
                    fristdistance = nextdistance;
                    distacnelist.push(parseFloat(nextdistance).toFixed(1));
                }
            }
            var myChart = echarts.init(document.getElementById('myChart'));
            option = {
                grid: {
                    left: '40px',
                    right: '40px',
                    bottom: '20px',
                    top: '20px',
                    containLabel: true
                },
                tooltip: {
                    trigger: 'axis',
                    formatter: function (a) {
                        var relVal = "";
                        relVal = "距起点:" + a[0].name + "米<br/>";
                        relVal += "海拔高度为:" + a[0].value + "米";
                        return relVal;
                    }
                },
                xAxis: {
                    type: 'category',
                    boundaryGap: false,
                    data: distacnelist,
                    axisLabel: {
                        show: true,
                        textStyle: {
                            color: '#ffffff',  //更改坐标轴文字颜色
                        }
                    }
                },
                yAxis: {
                    type: 'value',
                    axisLabel: {
                        show: true,
                        textStyle: {
                            color: '#ffffff',  //更改坐标轴文字颜色
                        }
                    }
                },
                series: [{
                    data: distance.gcs,
                    type: 'line',
                    areaStyle: {}
                }]
            };
            myChart.setOption(option);
            myChart.on('click', function (params) {
                let thisP = allPoint[params.dataIndex] && allPoint[params.dataIndex].clone();
                parent.addDXPMFlyPoint(parent.Cesium.Cartographic.toCartesian(thisP));
 
                thisP.height += 360;
                thisP = parent.Cesium.Cartographic.toCartesian(thisP);
            
                // parent._AnalysisDXPM.flyPoint
                var options = {
                    maximumHeight: 30,
                    offset: new parent.Cesium.HeadingPitchRange(
                        parent.sgworld.Viewer.camera.heading,
                        -90,
                        30
                    ),
                };
                parent.sgworld.Viewer.flyTo(parent._AnalysisDXPM.flyPoint, options);
                // parent.sgworld.Navigate.flyToPosition(thisP.x, thisP.y, thisP.z);
            });
        }
    </script>
</body>
 
</html>