-
Notifications
You must be signed in to change notification settings - Fork 3
/
convert.html
89 lines (83 loc) · 3.63 KB
/
convert.html
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
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>轨迹文件格式转换</title>
<script src="js/uncompress.js" type="text/javascript"></script>
<script src="js/jquery-3.5.1.min.js" type="text/javascript"></script>
<link rel="stylesheet" href="index.css">
</head>
<body>
<div>
<div class="btn-container">
<span class="btn-spacer">
<input type="file" id="select-files" name="files[]" multiple accept=".kml,.gpx" />
</span>
</div>
<div class="btn-container">
<select id="select-convert-format">
<option value="kml">转为KML</option>
<option value="gpx">转为GPX</option>
</select>
<span class="btn-spacer">
<button id="convert" disabled="true">正在加载JS库,请稍候</button>
</span>
<span class="help-tip">
<p>仅支持本站导出的轨迹文件格式之间相互转换,不保证兼容其它工具</p>
</span>
</div>
<details>
<summary>其它参数</summary>
<div class="btn-container">
<label><input type="checkbox" id="enable-export-beautify"></input>美化缩进</label>
<span class="help-tip"><p>缩进:插入空白进行缩进对齐,牺牲文件尺寸,改善XML文件的可读性</p></span>
<label><input type="checkbox" id="force-convert-same-fmt"></input>若格式相同也转换</label>
<span class="help-tip"><p>若输入文件格式与输出一致,如kml转kml,也进行强制转换。若不设置强制转换,则对源文件不做任何修改</p></span>
</div>
<div class="btn-container">
<label>小地图长度</label>
<input type="number" id="canvas-width" min="40" max="1600" value="100" style="max-width: 5em;" />
<label>高度</label>
<input type="number" id="canvas-height" min="40" max="1600" value="70" style="max-width: 5em;" />
</div>
<div class="btn-container">
<label><input type="checkbox" id="use-trackfile-hook"></input>对TrackFile进行后处理</label>
<span class="help-tip"><p>构建TrackFile对象,对轨迹进行后处理,如将路径坐标偏移,或者移除高度信息,需要对本项目源码熟悉</p></span>
<a target="_blank" href="https://github.com/lixingcong/ddpai-mini5-web-client/blob/master/trackfile-hook-sample.js">参考源码</a>
</div>
<textarea id="trackfile-hook-func" rows="12" cols="0" style="display: none;">
import { TrackFile } from "./track.js";
window.trackFileHook = function(trackFile){
const offset = wp => {
const X = 0.1;
wp.lat += X;
wp.lon += X;
if (wp.altitude) wp.altitude += X;
}
trackFile.points.forEach(point => { offset(point.wayPoint); });
trackFile.lines.forEach(path => { path.wayPoints.forEach(offset); });
trackFile.tracks.forEach(path => { path.wayPoints.forEach(offset); });
return [trackFile]; // 若返回多个TrackFile对象,则分拆轨迹成多文件
}</textarea>
</details>
<div id="progressBarDiv" style="display: none;">
<label>处理进度 </label>
<progress id="progressBar" value="-1"></progress>
</div>
<div id="exportedTrackList"></div>
<div id="infoList"></div>
<div id="errorList">
<div id="errorListHeader" style="display: none;">
错误信息(<label id="errorCount">0</label>条)
</div>
<div id="errorListBody"></div>
</div>
</div>
<script src="convert.js" type="module" charset="UTF-8"></script>
<script nomodule>
alert('JS加载失败:浏览器不支持ES-Module,请更新');
</script>
</body>
</html>