<!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 onload="test()">
|
<!-- <div style="position: absolute;top: 0;left: 0.3rem;color: white;font-size: 0.1rem;">高程</div>
|
<div style="position: absolute;bottom: 0;right: 0.27rem;color: white;font-size: 0.1rem;">距起点距离</div> -->
|
<div id="myChart"></div>
|
<script src="../jquery-2.0.3.js"></script>
|
<script src="./js/echarts.js"></script>
|
<script>
|
// onli();
|
function test() {
|
let htmlDom = document.getElementsByTagName('html')[0]
|
htmlDom.style.fontSize = window.screen.availWidth / 3.75 + 'px';
|
}
|
function onli() {
|
//获取sessionStorage
|
var distance = sessionStorage.getItem("distance");
|
var cay = sessionStorage.getItem("cay");
|
var gcs = sessionStorage.getItem("gcs");
|
//删除sessionStorage
|
sessionStorage.removeItem("distance");
|
sessionStorage.removeItem("cay");
|
sessionStorage.removeItem("gcs");
|
var Distance = {
|
cay: 0,
|
distance: 0,
|
gcs: []
|
};
|
Distance.distance = distance;
|
Distance.cay = cay;
|
Distance.gcs = gcs.split(',');
|
showChar(Distance);
|
var $title = $(parent.document).find('.layui-layer-title');
|
if ($title.length > 0 && $title.text() == '地形剖面分析') {
|
$(parent.document).find('.layui-layer').css("visibility", "visible");
|
}
|
}
|
|
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);
|
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);
|
});
|
// var distacnelist = [];
|
// var fristdistance = 0;
|
// var totaldistance = (parseFloat(distance.distance) / distance.cay).toFixed(1);
|
// var cs = parseInt(distance.cys);
|
// debugger
|
// var allPoint = distance.allPoint;
|
// for (var i = 0; i < cs; i++) {
|
// var nextdistance = fristdistance + parseFloat(totaldistance);
|
// fristdistance = nextdistance;
|
// distacnelist.push(parseFloat(nextdistance).toFixed(1));
|
// }
|
// var myChart = echarts.init(document.getElementById('myChart'));
|
// option = {
|
// grid: {
|
// left: '10px',
|
// right: '80px',
|
// bottom: '10px',
|
// top: '40px',
|
// 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,
|
// name: "距起点距离",
|
// nameLocation: 'end',
|
// nameTextStyle: {
|
// color: "rgba(255, 255, 255, 1)"
|
// },
|
// axisLabel: {
|
// textStyle: {
|
// color: '#fff',
|
// },
|
// },
|
// },
|
// yAxis: {
|
// type: 'value',
|
// name: "高程",
|
// nameTextStyle: {
|
// color: "rgba(255, 255, 255, 1)"
|
// },
|
// axisLabel: {
|
// textStyle: {
|
// color: '#fff',
|
// },
|
// },
|
// },
|
// series: [{
|
// data: distance.gcs,
|
// type: 'line',
|
// areaStyle: {}
|
// }]
|
// };
|
// myChart.setOption(option);
|
// myChart.on('click', function (params) {
|
// debugger
|
// // var options = {
|
// // maximumHeight: 30,
|
// // offset: new parent.Cesium.HeadingPitchRange(
|
// // parent.sgworld.Viewer.camera.heading,
|
// // -90,
|
// // 30
|
// // ),
|
// // };
|
// // parent.sgworld.Viewer.flyTo(parent._AnalysisDXPM.flyPoint, options);
|
// 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.sgworld.Navigate.flyToPosition(thisP.x, thisP.y, thisP.z);
|
// });
|
}
|
</script>
|
</body>
|
|
</html>
|