BaoXs
2022-05-16 0edbadbfd1c973e83cc5ced6125a33d7417ca24d
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
<!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>