Skip to content

Commit 0064b23

Browse files
优化编辑示例,处理国际化
1 parent 51689d2 commit 0064b23

File tree

9 files changed

+299
-201
lines changed

9 files changed

+299
-201
lines changed

dist/mapboxgl/include-mapboxgl.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,9 @@
201201
if (inArray(includes, 'vue-cesium')) {
202202
inputScript(libsurl + '/vue-cesium/2.1.4/index.umd.min.js');
203203
}
204+
if (inArray(includes, 'snap')) {
205+
inputScript(libsurl + '/mapboxglDrawSnap/0.2.0/mapboxglDrawSnap.js');
206+
}
204207
}
205208

206209
load({

dist/maplibregl/include-maplibregl.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,9 @@
174174
if (inArray(includes, 'turf')) {
175175
inputScript(libsurl + '/turf/6.5.0/turf.min.js');
176176
}
177+
if (inArray(includes, 'snap')) {
178+
inputScript(libsurl + '/mapboxglDrawSnap/0.2.0/mapboxglDrawSnap.js');
179+
}
177180
if (!inArray(excludes, 'iclient-maplibregl')) {
178181
if (supportES6()) {
179182
inputScript('../../dist/maplibregl/iclient-maplibregl-es6.min.js');

dist/ol/include-ol.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,9 @@
119119
if (inArray(includes, 'xlsx')) {
120120
inputScript(libsurl + '/xlsx/0.19.3/xlsx.core.min.js');
121121
}
122+
if (inArray(includes, 'lodash')) {
123+
inputScript(libsurl + '/lodash/4.17.21/lodash.min.js');
124+
}
122125

123126
// dist
124127
if (!inArray(excludes, 'iclient-ol')) {

examples/js/include-web.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,10 @@
211211
inputScript(libsurl + '/iclient8c/examples/js/plottingPanel/colorpicker/js/colorpicker.js');
212212
inputCSS(libsurl + '/iclient8c/examples/js/plottingPanel/colorpicker/css/colorpicker.css');
213213
}
214+
if (inArray(includes, 'viewer')) {
215+
inputScript(libsurl + '/viewerjs/viewer.js');
216+
inputCSS(libsurl + '/viewerjs/css/viewer.css');
217+
}
214218
}
215219

216220
function datGuiI18N() {

examples/leaflet/drawAndEditFeatures.html

Lines changed: 33 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
<meta charset="UTF-8" />
88
<title data-i18n="resources.title_editFeatures"></title>
99
<script type="text/javascript" include="leaflet-geoman" src="../../dist/leaflet/include-leaflet.js"></script>
10-
<script src="https://cdnjs.cloudflare.com/ajax/libs/viewerjs/1.11.6/viewer.min.js" integrity="sha512-EC3CQ+2OkM+ZKsM1dbFAB6OGEPKRxi6EDRnZW9ys8LghQRAq6cXPUgXCCujmDrXdodGXX9bqaaCRtwj4h4wgSQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
11-
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/viewerjs/1.11.6/viewer.min.css" integrity="sha512-za6IYQz7tR0pzniM/EAkgjV1gf1kWMlVJHBHavKIvsNoUMKWU99ZHzvL6lIobjiE2yKDAKMDSSmcMAxoiWgoWA==" crossorigin="anonymous" referrerpolicy="no-referrer" />
1210
<style>
1311
.key-input,
1412
.value-input {
@@ -190,11 +188,11 @@
190188
<div id="map" style="width: 100%; height: 100%"></div>
191189
<div class="video-modal">
192190
<video controls width="960">
193-
<source src="https://www.runoob.com/try/demo_source/mov_bbb.mp4" type="video/mp4">
191+
<source src="" type="video/mp4">
194192
</video>
195193
</div>
196194
<div id="popup">
197-
<p>按Tab键开始输入坐标值,回车键确定</p>
195+
<p><span data-i18n="resources.msg_pleaseSaveFirst"></span></p>
198196
<div id="popup-content">
199197
<h5>X</h5>
200198
<input class="input-element coordX" type="number" tabindex="1">
@@ -210,98 +208,97 @@ <h5>Y</h5>
210208
type="button"
211209
class="btn btn-primary btn-group-xs"
212210
>
213-
<span class="glyphicon glyphicon-plus" aria-hidden="true">新增要素</span>
211+
<span class="glyphicon glyphicon-plus" aria-hidden="true"><span data-i18n="resources.text_addFeature"></span></span>
214212
</button>
215213
<button
216214
id="editFeature"
217215
value="LineString"
218216
type="button"
219217
class="btn btn-primary btn-group-xs"
220218
>
221-
<span class="glyphicon glyphicon-edit" aria-hidden="true">编辑要素</span>
219+
<span class="glyphicon glyphicon-edit" aria-hidden="true"><span data-i18n="resources.text_editFeature"></span></span>
222220
</button>
223221
<button
224222
id="deleteFeature"
225223
value="Polygon"
226224
type="button"
227225
class="btn btn-primary btn-group-xs"
228226
>
229-
<span class="glyphicon glyphicon-trash" aria-hidden="true">删除要素</span>
227+
<span class="glyphicon glyphicon-trash" aria-hidden="true"><span data-i18n="resources.text_deleteFeature"></span></span>
230228
</button>
231229
</div>
232230
<div class="info-panel">
233231
<div class="add-feature-info">
234-
<h4 class="into-title">新增要素</h4>
232+
<h4 class="into-title"><span data-i18n="resources.text_addFeature"></span></h4>
235233
<div>
236-
<h5>目标数据集</h5>
234+
<h5><span data-i18n="resources.text_targetDataset"></span></h5>
237235
<select class="select-element addDatasetNameList" name="capital">
238236
</select>
239237
</div>
240-
<h6><span class="line-element"></span>空间信息</h6>
238+
<h6><span class="line-element"></span><span data-i18n="resources.text_spacialInfo"></span></h6>
241239
<div class="space-info">
242240
<input class="input-element" type="text">
243-
<p class="desc-element">鼠标移动至地图绘制要素。</p>
241+
<p class="desc-element"><span data-i18n="resources.msg_moveToMapDraw"></span></p>
244242
</div>
245-
<h6><span class="line-element"></span>属性信息</h6>
243+
<h6><span class="line-element"></span><span data-i18n="resources.text_attributeInfo"></span></h6>
246244
<div class="add-attribute-info">
247245
</div>
248246
<div class="info-bottom">
249-
<button class="btn btn-default btn-group-xs cancel-add">取消</button>
250-
<button class="btn btn-primary btn-group-xs addSave">保存</button>
247+
<button class="btn btn-default btn-group-xs cancel-add" data-i18n="resources.btn_cancel"></button>
248+
<button class="btn btn-primary btn-group-xs addSave" data-i18n="resources.btn_save"></button>
251249
</div>
252250
</div>
253251
<div class="edit-feature-info">
254-
<h4 class="into-title">编辑要素<span class="dataset-info">数据集:<span class="edit-dataset"></span></span></h4>
255-
<h6>空间信息</h6>
252+
<h4 class="into-title"><span data-i18n="resources.text_editFeature"></span><span class="dataset-info">数据集:<span class="edit-dataset"></span></span></h4>
253+
<h6><span data-i18n="resources.text_spacialInfo"></span></h6>
256254
<div class="space-info">
257255
<input class="input-element" type="text">
258256
</div>
259-
<h6>属性信息</h6>
257+
<h6><span data-i18n="resources.text_attributeInfo"></span></h6>
260258
<div class="edit-attribute-info">
261259
</div>
262260
<div class="info-bottom">
263-
<button class="btn btn-default btn-group-xs cancel-edit">取消</button>
264-
<button disabled class="btn btn-primary btn-group-xs editSave">保存</button>
261+
<button class="btn btn-default btn-group-xs cancel-edit" data-i18n="resources.btn_cancel"></button>
262+
<button disabled class="btn btn-primary btn-group-xs editSave" data-i18n="resources.btn_save"></button>
265263
</div>
266264
</div>
267265
<div class="delete-feature-info">
268-
<h4 class="into-title">删除要素</h4>
269-
<p class="desc-element">在地图上选择待删除的要素。</p>
266+
<h4 class="into-title"><span data-i18n="resources.text_deleteFeature"></span></h4>
267+
<p class="desc-element"><span data-i18n="resources.msg_selectDeleteFeature"></span></p>
270268
<div style="border-top: 1px solid #baafaf">
271-
<h5>待删除要素:</h5>
269+
<h5><span data-i18n="resources.text_featureToDelete"></span>:</h5>
272270
<div class="delete-feature-list">
273271

274272
</div>
275273
</div>
276274
<div class="info-bottom">
277-
<button class="btn btn-default btn-group-xs cancel-delete">取消</button>
275+
<button class="btn btn-default btn-group-xs cancel-delete" data-i18n="resources.btn_cancel"></button>
278276
<div class="delete-modal">
279-
<p>删除后要素将无法恢复,是否确认删除?</p>
277+
<p><span data-i18n="resources.msg_confirmDelete"></span></p>
280278
<div style="float: right;">
281-
<button class="final-cancel-delete btn btn-default btn-group-xs">取消</button>
282-
<button class="final-delete btn btn-danger btn-group-xs">删除</button>
279+
<button class="final-cancel-delete btn btn-default btn-group-xs" data-i18n="resources.btn_cancel"></button>
280+
<button class="final-delete btn btn-danger btn-group-xs" data-i18n="resources.text_input_value_delete"></button>
283281
</div>
284282
</div>
285-
<button class="btn btn-danger btn-group-xs delete">删除</button>
283+
<button class="btn btn-danger btn-group-xs delete" data-i18n="resources.text_input_value_delete"></button>
286284
</div>
287285
</div>
288286
</div>
289-
<div class="edit-tips">在地图上点击要素进行选择。</div>
287+
<div class="edit-tips"><span data-i18n="resources.msg_clickToSelect"></span></div>
290288
</div>
291289
</div>
292-
<script type="text/javascript" include="jquery,bootstrap,widgets.alert" src="../js/include-web.js"></script>
290+
<script type="text/javascript" include="jquery,bootstrap,widgets.alert,viewer" src="../js/include-web.js"></script>
293291
<script type="text/javascript">
294292
var status = 'ADD';
295293
var type = '';
296294
var uniqueId = 0;
297295
var currentDataset = 'buildings_R';
298296
var map,
299297
draw,
300-
// url = (window.isLocal ? window.server : "https://iserver.supermap.io") + "/iserver/services/map-china400/rest/maps/China_4326";
301-
url = "http://172.16.14.44:8090/iserver/services/map-china400/rest/maps/China_4326";
298+
url = (window.isLocal ? window.server : "https://iserver.supermap.io") + "/iserver/services/map-china400/rest/maps/China_4326";
302299
var isUpdate = false;
303-
var dataUrl = 'http://172.16.14.44:8090/iserver/services/data-Buildings/rest/data';
304-
var dataSourceName = 'NewBuildings';
300+
var dataUrl = (window.isLocal ? window.server : "https://iserver.supermap.io") + "/iserver/services/data-building/rest/data";
301+
var dataSourceName = 'building';
305302
var editFeaturesService = new L.supermap.FeatureService(dataUrl);
306303
var currentShowPanel = '';
307304
var datasetNameList = [];
@@ -447,7 +444,7 @@ <h5>待删除要素:</h5>
447444
datasetNameList = e.result.datasetNames;
448445
currentFeature.dataset = datasetNameList[0];
449446
currentDataset = datasetNameList[0];
450-
// 获取所有数据集的类型
447+
var count = 0;
451448
datasetNameList.forEach(function(datasetName, index) {
452449
filterFields[datasetName] = {};
453450
datasetService.getDataset(dataSourceName, datasetName, function(e) {
@@ -456,11 +453,12 @@ <h5>待删除要素:</h5>
456453
id: 0
457454
}
458455
typeMap[e.result.datasetInfo.type] && datasetTypeClassify[typeMap[e.result.datasetInfo.type]].push(datasetName);
456+
count++;
459457
if (index === 0) {
460458
var editType = e.result.datasetInfo.type;
461459
createOptions(datasetNameList, document.querySelector('.addDatasetNameList'), editType, datasetNameList[0]);
462460
}
463-
if (index === datasetNameList.length - 1) {
461+
if (count === datasetNameList.length) {
464462
initFeature();
465463
}
466464
});

examples/locales/zh-CN/resources.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1918,7 +1918,21 @@ window.examplesResources = {
19181918
"option_meterUnit": "米",
19191919
"option_mileUnit": "英里",
19201920
"option_degreeUnit": "度",
1921-
"text_print": "打印"
1921+
"text_print": "打印",
1922+
"text_addFeature": "新增要素",
1923+
"text_editFeature": "编辑要素",
1924+
"text_deleteFeature": "删除要素",
1925+
"text_targetDataset": "目标数据集",
1926+
"text_spacialInfo": "空间信息",
1927+
"msg_pleaseSaveFirst": "有未完成的更改,请先保存或取消更改",
1928+
"msg_inputCoordinates": "按Tab键开始输入坐标值,回车键确定",
1929+
"msg_moveToMapDraw": "鼠标移动至地图绘制要素",
1930+
"text_attributeInfo": "属性信息",
1931+
"msg_pleaseSave": "请先保存或取消更改",
1932+
"msg_selectDeleteFeature": "在地图上选择待删除的要素",
1933+
"msg_confirmDelete": "删除后要素将无法恢复,是否确认删除?",
1934+
"msg_clickToSelect": "在地图上点击要素进行选择",
1935+
"text_featureToDelete": "待删除要素"
19221936
}
19231937
};
19241938
window.resources = window.examplesResources.resources;

0 commit comments

Comments
 (0)