Skip to content

Commit

Permalink
优化编辑示例,处理国际化
Browse files Browse the repository at this point in the history
  • Loading branch information
xilanhuaweidapao committed Jan 24, 2024
1 parent fac0f89 commit badbe63
Show file tree
Hide file tree
Showing 9 changed files with 299 additions and 201 deletions.
3 changes: 3 additions & 0 deletions dist/mapboxgl/include-mapboxgl.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,9 @@
if (inArray(includes, 'vue-cesium')) {
inputScript(libsurl + '/vue-cesium/2.1.4/index.umd.min.js');
}
if (inArray(includes, 'snap')) {
inputScript(libsurl + '/mapboxglDrawSnap/0.2.0/mapboxglDrawSnap.js');
}
}

load({
Expand Down
3 changes: 3 additions & 0 deletions dist/maplibregl/include-maplibregl.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@
if (inArray(includes, 'turf')) {
inputScript(libsurl + '/turf/6.5.0/turf.min.js');
}
if (inArray(includes, 'snap')) {
inputScript(libsurl + '/mapboxglDrawSnap/0.2.0/mapboxglDrawSnap.js');
}
if (!inArray(excludes, 'iclient-maplibregl')) {
if (supportES6()) {
inputScript('../../dist/maplibregl/iclient-maplibregl-es6.min.js');
Expand Down
3 changes: 3 additions & 0 deletions dist/ol/include-ol.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@
if (inArray(includes, 'xlsx')) {
inputScript(libsurl + '/xlsx/0.19.3/xlsx.core.min.js');
}
if (inArray(includes, 'lodash')) {
inputScript(libsurl + '/lodash/4.17.21/lodash.min.js');
}

// dist
if (!inArray(excludes, 'iclient-ol')) {
Expand Down
4 changes: 4 additions & 0 deletions examples/js/include-web.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,10 @@
inputScript(libsurl + '/iclient8c/examples/js/plottingPanel/colorpicker/js/colorpicker.js');
inputCSS(libsurl + '/iclient8c/examples/js/plottingPanel/colorpicker/css/colorpicker.css');
}
if (inArray(includes, 'viewer')) {
inputScript(libsurl + '/viewerjs/viewer.js');
inputCSS(libsurl + '/viewerjs/css/viewer.css');
}
}

function datGuiI18N() {
Expand Down
68 changes: 33 additions & 35 deletions examples/leaflet/drawAndEditFeatures.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
<meta charset="UTF-8" />
<title data-i18n="resources.title_editFeatures"></title>
<script type="text/javascript" include="leaflet-geoman" src="../../dist/leaflet/include-leaflet.js"></script>
<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>
<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" />
<style>
.key-input,
.value-input {
Expand Down Expand Up @@ -190,11 +188,11 @@
<div id="map" style="width: 100%; height: 100%"></div>
<div class="video-modal">
<video controls width="960">
<source src="https://www.runoob.com/try/demo_source/mov_bbb.mp4" type="video/mp4">
<source src="" type="video/mp4">
</video>
</div>
<div id="popup">
<p>按Tab键开始输入坐标值,回车键确定</p>
<p><span data-i18n="resources.msg_pleaseSaveFirst"></span></p>
<div id="popup-content">
<h5>X</h5>
<input class="input-element coordX" type="number" tabindex="1">
Expand All @@ -210,98 +208,97 @@ <h5>Y</h5>
type="button"
class="btn btn-primary btn-group-xs"
>
<span class="glyphicon glyphicon-plus" aria-hidden="true">新增要素</span>
<span class="glyphicon glyphicon-plus" aria-hidden="true"><span data-i18n="resources.text_addFeature"></span></span>
</button>
<button
id="editFeature"
value="LineString"
type="button"
class="btn btn-primary btn-group-xs"
>
<span class="glyphicon glyphicon-edit" aria-hidden="true">编辑要素</span>
<span class="glyphicon glyphicon-edit" aria-hidden="true"><span data-i18n="resources.text_editFeature"></span></span>
</button>
<button
id="deleteFeature"
value="Polygon"
type="button"
class="btn btn-primary btn-group-xs"
>
<span class="glyphicon glyphicon-trash" aria-hidden="true">删除要素</span>
<span class="glyphicon glyphicon-trash" aria-hidden="true"><span data-i18n="resources.text_deleteFeature"></span></span>
</button>
</div>
<div class="info-panel">
<div class="add-feature-info">
<h4 class="into-title">新增要素</h4>
<h4 class="into-title"><span data-i18n="resources.text_addFeature"></span></h4>
<div>
<h5>目标数据集</h5>
<h5><span data-i18n="resources.text_targetDataset"></span></h5>
<select class="select-element addDatasetNameList" name="capital">
</select>
</div>
<h6><span class="line-element"></span>空间信息</h6>
<h6><span class="line-element"></span><span data-i18n="resources.text_spacialInfo"></span></h6>
<div class="space-info">
<input class="input-element" type="text">
<p class="desc-element">鼠标移动至地图绘制要素。</p>
<p class="desc-element"><span data-i18n="resources.msg_moveToMapDraw"></span></p>
</div>
<h6><span class="line-element"></span>属性信息</h6>
<h6><span class="line-element"></span><span data-i18n="resources.text_attributeInfo"></span></h6>
<div class="add-attribute-info">
</div>
<div class="info-bottom">
<button class="btn btn-default btn-group-xs cancel-add">取消</button>
<button class="btn btn-primary btn-group-xs addSave">保存</button>
<button class="btn btn-default btn-group-xs cancel-add" data-i18n="resources.btn_cancel"></button>
<button class="btn btn-primary btn-group-xs addSave" data-i18n="resources.btn_save"></button>
</div>
</div>
<div class="edit-feature-info">
<h4 class="into-title">编辑要素<span class="dataset-info">数据集:<span class="edit-dataset"></span></span></h4>
<h6>空间信息</h6>
<h4 class="into-title"><span data-i18n="resources.text_editFeature"></span><span class="dataset-info">数据集:<span class="edit-dataset"></span></span></h4>
<h6><span data-i18n="resources.text_spacialInfo"></span></h6>
<div class="space-info">
<input class="input-element" type="text">
</div>
<h6>属性信息</h6>
<h6><span data-i18n="resources.text_attributeInfo"></span></h6>
<div class="edit-attribute-info">
</div>
<div class="info-bottom">
<button class="btn btn-default btn-group-xs cancel-edit">取消</button>
<button disabled class="btn btn-primary btn-group-xs editSave">保存</button>
<button class="btn btn-default btn-group-xs cancel-edit" data-i18n="resources.btn_cancel"></button>
<button disabled class="btn btn-primary btn-group-xs editSave" data-i18n="resources.btn_save"></button>
</div>
</div>
<div class="delete-feature-info">
<h4 class="into-title">删除要素</h4>
<p class="desc-element">在地图上选择待删除的要素。</p>
<h4 class="into-title"><span data-i18n="resources.text_deleteFeature"></span></h4>
<p class="desc-element"><span data-i18n="resources.msg_selectDeleteFeature"></span></p>
<div style="border-top: 1px solid #baafaf">
<h5>待删除要素:</h5>
<h5><span data-i18n="resources.text_featureToDelete"></span>:</h5>
<div class="delete-feature-list">

</div>
</div>
<div class="info-bottom">
<button class="btn btn-default btn-group-xs cancel-delete">取消</button>
<button class="btn btn-default btn-group-xs cancel-delete" data-i18n="resources.btn_cancel"></button>
<div class="delete-modal">
<p>删除后要素将无法恢复,是否确认删除?</p>
<p><span data-i18n="resources.msg_confirmDelete"></span></p>
<div style="float: right;">
<button class="final-cancel-delete btn btn-default btn-group-xs">取消</button>
<button class="final-delete btn btn-danger btn-group-xs">删除</button>
<button class="final-cancel-delete btn btn-default btn-group-xs" data-i18n="resources.btn_cancel"></button>
<button class="final-delete btn btn-danger btn-group-xs" data-i18n="resources.text_input_value_delete"></button>
</div>
</div>
<button class="btn btn-danger btn-group-xs delete">删除</button>
<button class="btn btn-danger btn-group-xs delete" data-i18n="resources.text_input_value_delete"></button>
</div>
</div>
</div>
<div class="edit-tips">在地图上点击要素进行选择。</div>
<div class="edit-tips"><span data-i18n="resources.msg_clickToSelect"></span></div>
</div>
</div>
<script type="text/javascript" include="jquery,bootstrap,widgets.alert" src="../js/include-web.js"></script>
<script type="text/javascript" include="jquery,bootstrap,widgets.alert,viewer" src="../js/include-web.js"></script>
<script type="text/javascript">
var status = 'ADD';
var type = '';
var uniqueId = 0;
var currentDataset = 'buildings_R';
var map,
draw,
// url = (window.isLocal ? window.server : "https://iserver.supermap.io") + "/iserver/services/map-china400/rest/maps/China_4326";
url = "http://172.16.14.44:8090/iserver/services/map-china400/rest/maps/China_4326";
url = (window.isLocal ? window.server : "https://iserver.supermap.io") + "/iserver/services/map-china400/rest/maps/China_4326";
var isUpdate = false;
var dataUrl = 'http://172.16.14.44:8090/iserver/services/data-Buildings/rest/data';
var dataSourceName = 'NewBuildings';
var dataUrl = (window.isLocal ? window.server : "https://iserver.supermap.io") + "/iserver/services/data-building/rest/data";
var dataSourceName = 'building';
var editFeaturesService = new L.supermap.FeatureService(dataUrl);
var currentShowPanel = '';
var datasetNameList = [];
Expand Down Expand Up @@ -447,7 +444,7 @@ <h5>待删除要素:</h5>
datasetNameList = e.result.datasetNames;
currentFeature.dataset = datasetNameList[0];
currentDataset = datasetNameList[0];
// 获取所有数据集的类型
var count = 0;
datasetNameList.forEach(function(datasetName, index) {
filterFields[datasetName] = {};
datasetService.getDataset(dataSourceName, datasetName, function(e) {
Expand All @@ -456,11 +453,12 @@ <h5>待删除要素:</h5>
id: 0
}
typeMap[e.result.datasetInfo.type] && datasetTypeClassify[typeMap[e.result.datasetInfo.type]].push(datasetName);
count++;
if (index === 0) {
var editType = e.result.datasetInfo.type;
createOptions(datasetNameList, document.querySelector('.addDatasetNameList'), editType, datasetNameList[0]);
}
if (index === datasetNameList.length - 1) {
if (count === datasetNameList.length) {
initFeature();
}
});
Expand Down
16 changes: 15 additions & 1 deletion examples/locales/zh-CN/resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -1909,7 +1909,21 @@ window.examplesResources = {
"option_meterUnit": "米",
"option_mileUnit": "英里",
"option_degreeUnit": "度",
"text_print": "打印"
"text_print": "打印",
"text_addFeature": "新增要素",
"text_editFeature": "编辑要素",
"text_deleteFeature": "删除要素",
"text_targetDataset": "目标数据集",
"text_spacialInfo": "空间信息",
"msg_pleaseSaveFirst": "有未完成的更改,请先保存或取消更改",
"msg_inputCoordinates": "按Tab键开始输入坐标值,回车键确定",
"msg_moveToMapDraw": "鼠标移动至地图绘制要素",
"text_attributeInfo": "属性信息",
"msg_pleaseSave": "请先保存或取消更改",
"msg_selectDeleteFeature": "在地图上选择待删除的要素",
"msg_confirmDelete": "删除后要素将无法恢复,是否确认删除?",
"msg_clickToSelect": "在地图上点击要素进行选择",
"text_featureToDelete": "待删除要素"
}
};
window.resources = window.examplesResources.resources;
Loading

0 comments on commit badbe63

Please sign in to comment.