<!DOCTYPE html>
|
<html>
|
|
<head>
|
<meta charset="UTF-8">
|
<title>地形控制绘制</title>
|
<link href="../../libs/layui/css/layui.css" rel="stylesheet">
|
<script type="text/javascript" src="../../libs/jquery/jquery-3.5.1.min.js"></script>
|
<script type="text/javascript" src="../../libs/layui/layui.js"></script>
|
<script type="text/javascript" src="../../assets/js/common.js"></script>
|
<style>
|
.terraindiv {
|
overflow-x: hidden;
|
overflow-y: hidden;
|
padding: 0;
|
}
|
|
.mt-table-content {
|
/* margin-top: 10px; */
|
height: 185px;
|
color: white;
|
width: 300px;
|
border: 1px white solid;
|
border-radius: 15px;
|
/* width: 250px; */
|
float: left;
|
overflow: hidden;
|
/* margin-left: 10px; */
|
}
|
|
.mt-table-row {
|
height: 30px;
|
width: 300px;
|
/* margin-top: 15px; */
|
border-bottom: solid 1px white;
|
}
|
|
.mt-table-row:last-child {
|
height: 30px;
|
width: 300px;
|
/* margin-top: 15px; */
|
border-bottom: none;
|
}
|
|
|
.mt-table-row-left {
|
margin: 0px;
|
padding-left: 5px;
|
width: 25px;
|
float: left;
|
display: inline;
|
border-right: solid 1px white;
|
}
|
|
.mt-table-row-right {
|
margin: 0px;
|
padding-left: 5px;
|
float: left;
|
display: inline;
|
width: 253px;
|
overflow: hidden;
|
text-overflow: ellipsis;
|
white-space: nowrap;
|
/* border-bottom: solid 1px white; */
|
}
|
|
.mt-table-row-label {
|
color: white;
|
line-height: 30px;
|
font-size: 12px;
|
}
|
|
.form-control {
|
/* display: block; */
|
width: 110px;
|
height: 30px;
|
font-size: 12px;
|
line-height: 1.6;
|
background-color: #2c3238;
|
opacity: 0.8;
|
color: #fff;
|
background-image: none;
|
border: 0px solid #e4eaec;
|
border-radius: 3px;
|
-webkit-box-shadow: inset 0 1px 1px rgb(0 0 0 / 8%);
|
box-shadow: inset 0 1px 1px rgb(0 0 0 / 8%);
|
-webkit-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
|
-webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;
|
-o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
|
transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;
|
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
|
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;
|
}
|
|
.mt-content-btn {
|
width: 100%;
|
height: 30px;
|
line-height: 30px;
|
text-align: center;
|
}
|
|
.mybtn {
|
color: #fff;
|
background-color: rgba(32, 160, 255, .2);
|
border-color: #4db3ff;
|
}
|
|
.mytip {
|
margin-top: 10px;
|
margin-bottom: 10px;
|
margin-left: 15px;
|
margin-right: 10px;
|
color: #fff;
|
/* overflow-y:hidden; */
|
}
|
</style>
|
</head>
|
|
<body>
|
<!-- 让IE8/9支持媒体查询,从而兼容栅格 -->
|
<!--[if lt IE 9]>
|
<script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
|
<script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
|
<![endif]-->
|
<div class="terraindiv" action="">
|
<div class="mt-table-content">
|
<div class="mt-table-row">
|
<div class="mt-table-row-left mt-table-row-label">点序</div>
|
<div class="mt-table-row-right mt-table-row-label">坐标</div>
|
</div>
|
<div id="view" style="height: 154px;width: 300px;position: relative;overflow: hidden;"></div>
|
</div>
|
<div class="mt-row">
|
<div class="mytip">绘制路径单击鼠标左键确定节点,单击鼠标右键确定撤销节点,双击鼠标左键结束绘制。</div>
|
<div class="mt-content-btn">
|
<button type="button" class="layui-btn mybtn layui-btn-sm" onclick="confirm()">确认</button>
|
<button type="button" class="layui-btn mybtn layui-btn-sm" onclick="redraw()">重绘</button>
|
</div>
|
</div>
|
<script id="demo" type="text/html">
|
<div style="height: 154px;overflow-y: auto;">
|
{{# layui.each(d, function(index, item){ }}
|
<div class="mt-table-row">
|
<div class="mt-table-row-left mt-table-row-label">{{index+1}}</div>
|
<div class="mt-table-row-right mt-table-row-label ">
|
({{item.x}},{{item.y}})
|
</div>
|
</div>
|
{{# }); }}
|
{{# if(d.length === 0){ }}
|
无数据
|
{{# } }}
|
</div>
|
</script>
|
</div>
|
|
|
<script>
|
var layerIndex = null;
|
var options = null;
|
var data = [];
|
function confirm() {
|
parent.clip2(options);
|
}
|
refreshTPL();
|
function refreshTPL() {
|
layui.use('laytpl', function () {
|
var laytpl = layui.laytpl;
|
var getTpl = demo.innerHTML
|
, view = document.getElementById('view');
|
laytpl(getTpl).render(data, function (html) {
|
view.innerHTML = html;
|
});
|
});
|
}
|
function update() {
|
data = [];
|
var position = options.drawPositions.split(";");
|
for (let i = 0; i < position.length; i++) {
|
var onep = position[i].split(",");
|
// console.log(options.drawPositions);
|
if (onep.length == 3) {
|
let p = {
|
'x': onep[0],
|
'y': onep[1],
|
'z': onep[2]
|
};
|
data.push(p);
|
}
|
}
|
refreshTPL();
|
}
|
function redraw() {
|
console.log(options);
|
options.drawPositions = "";
|
parent.terrainDraw(options);
|
data=[];
|
refreshTPL();
|
}
|
|
</script>
|
</body>
|
|
</html>
|