Skip to content

Commit dabc93b

Browse files
committed
更新标绘demo
1 parent 847a6a3 commit dabc93b

File tree

4 files changed

+123
-19
lines changed

4 files changed

+123
-19
lines changed

dist/leaflet/include-leaflet.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,11 @@
142142
inputCSS('../../dist/leaflet/iclient-leaflet.min.css');
143143
}
144144
if (inArray(includes, 'iclient-plot-leaflet')) {
145-
inputCSS('https://iclient.supermap.io/web/libs/plotting/leaflet/10.2.1/iclient-plot-leaflet.css');
145+
inputCSS('https://iclient.supermap.io/web/libs/plotting/leaflet/11.0.0/iclient-plot-leaflet.css');
146146
if (supportES6()) {
147-
inputScript('https://iclient.supermap.io/web/libs/plotting/leaflet/10.2.1/iclient-plot-leaflet-es6.min.js');
147+
inputScript('https://iclient.supermap.io/web/libs/plotting/leaflet/11.0.0/iclient-plot-leaflet-es6.min.js');
148148
} else {
149-
inputScript('https://iclient.supermap.io/web/libs/plotting/leaflet/10.2.1/iclient-plot-leaflet.min.js');
149+
inputScript('https://iclient.supermap.io/web/libs/plotting/leaflet/11.0.0/iclient-plot-leaflet.min.js');
150150
}
151151
}
152152
if (inArray(includes, 'ant-design-vue')) {

examples/leaflet/plot_operatePlottingLayer.html

Lines changed: 106 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,59 +10,146 @@
1010
<body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;">
1111
<div id="toolbar" class="panel panel-primary" style=" position: absolute;top: 10px;right: 10px;text-align: center;z-index: 9999;border-radius: 4px;">
1212
<div class='panel-heading' id="panelheading">
13-
<h5 class='panel-title text-center' data-i18n="resources.title_operatePlottingLayer"></h5></div>
14-
<div class='panel-body content' id="panelbodycontent">
13+
<h5 class='panel-title text-center' data-i18n="resources.title_operatePlottingLayer"></h5>
14+
</div>
15+
<div class='input-group' style=" margin-bottom: 10px;top:10px;left:5px;right:5px;width: 340px;">
1516
<input type="button" class="btn btn-default" data-i18n="[value]resources.btn_createLayer" onclick="createPlottingLayer()"/>
1617
<input type="button" class="btn btn-default" data-i18n="[value]resources.btn_deleteLayer" onclick="removePlottingLayer()"/>
1718
<input type="button" class="btn btn-default" data-i18n="[value]resources.btn_drawMarker" onclick="plotSymbol()"/>
1819
<input type="button" class="btn btn-default" data-i18n="[value]resources.btn_cancelMarker" onclick="plottingDrawCancel()"/>
1920
</div>
21+
<div class='input-group' style=" margin-bottom: 12px;left:30px;width: 240px;">
22+
<input type="button" class="btn btn-default" data-i18n="[value]resources.btn_createChildLayer" onclick="createChildPlotLayer()"/>
23+
<input type="button" class="btn btn-default" data-i18n="[value]resources.btn_deleteChildLayer" onclick="removeChildPlotLayer()"/>
24+
</div>
25+
<div class='input-group' style=" margin-bottom: 10px;top:10px;left:5px;right:5px;width: 340px;">
26+
<input type="button" class="btn btn-default" data-i18n="[value]resources.btn_setPlottingLayerMinScale" onclick="setPlottingLayerMinScale()"/>
27+
</div>
28+
<div class='input-group' style=" margin-bottom: 10px;top:10px;left:5px;right:15px;width: 340px;">
29+
<input type="button" class="btn btn-default" data-i18n="[value]resources.btn_setPlottingLayerMaxScale" onclick="setPlottingLayerMaxScale()"/>
30+
</div>
31+
<div class='input-group' style=" margin-bottom: 10px;top:10px;left:5px;right:15px;width: 340px;">
32+
<input type="button" class="btn btn-default" data-i18n="[value]resources.btn_clearScale" onclick="clearScale()"/>
33+
</div>
34+
<div class='input-group' style=" margin-bottom: 10px;top:10px;left:5px;right:5px;width: 340px;">
35+
<input type="button" class="btn btn-default" data-i18n="[value]resources.btn_setSymScaleDefinition" onclick="setSymScaleDefinition()"/>
36+
</div>
37+
<div class='input-group' style=" margin-bottom: 10px;top:10px;left:5px;right:15px;width: 340px;">
38+
<div class='input-group' style=" margin-bottom: 10px;left:10px;width: 300px;">
39+
<span class='input-group-addon' data-i18n="resources.btn_plotSize"></span>
40+
<select class='form-control' id='plotSize'>
41+
<option value='0'>false</option>
42+
<option value='1' selected>true</option>
43+
</select>
44+
</div>
45+
</div>
46+
</div>
47+
<div id="map" style="margin:0 auto;width: 100%;height: 100%">
2048
</div>
21-
<div id="map" style="margin:0 auto;width: 100%;height: 100%"></div>
22-
<script type="text/javascript" include="bootstrap,widgets.alert,jquery" src="../js/include-web.js"></script>
23-
<script type="text/javascript" include="iclient-leaflet-css,iclient-plot-leaflet" src="../../dist/leaflet/include-leaflet.js"></script>
49+
<script type="text/javascript" include="bootstrap,widgets.alert,plottingPanel" src="../js/include-web.js"></script>
50+
<script type="text/javascript" include="leaflet,iclient-leaflet,iclient-leaflet-css,iclient-plot-leaflet" src="../../dist/leaflet/include-leaflet.js"></script>
51+
<script type="text/javascript" include="PlotPanel,StylePanel,PlotMapPanel" src="../js/plottingPanel/PlottingPanel.Include.js"></script>
52+
<script type="text/javascript" src="../../node_modules/pako/dist/pako_inflate.js"></script>
53+
<script type="text/javascript" src="../../node_modules/pako/dist/pako.min.js"></script>
2454
<script type="text/javascript">
55+
2556
var host = window.isLocal ? window.server : "https://iserver.supermap.io";
2657
var url = host + "/iserver/services/map-china400/rest/maps/China_4326";
2758
var serverUrl = host + "/iserver/services/plot-jingyong/rest/plot/";
28-
var map,plottingLayer,plottingLayers=[],drawControl;
59+
var map,plottingLayer,drawControl,childPlotLayer,visibleFlag;
2960
map = L.map('map', {
3061
preferCanvas: true,
3162
crs: L.CRS.EPSG4326,
3263
center: [35,104],
3364
maxZoom: 18,
3465
zoom: 3
3566
});
36-
new L.supermap.TiledMapLayer(url).addTo(map);
67+
68+
L.supermap.tiledMapLayer(url).addTo(map);
3769
drawControl = L.supermap.plotting.drawControl();
3870
drawControl.addTo(map);
3971
var editControl = L.supermap.plotting.editControl();
4072
editControl.addTo(map);
73+
var plotting = L.supermap.plotting.getControl(map, serverUrl);
74+
var plotMapManager = plotting.getPlotMapManager();
75+
4176
function createPlottingLayer(){
4277
widgets.alert.clearAlert();
43-
var plottingLayerName = "plottingLayer_" + Math.ceil(Math.random() * 1000);
78+
79+
var plottingLayerName = "图元层";
4480
plottingLayer = L.supermap.plotting.plottingLayer(plottingLayerName, serverUrl);
45-
drawControl.setDrawingLayer(plottingLayer);
4681
plottingLayer.addTo(map);
47-
plottingLayers.push(plottingLayer);
82+
plotMapManager.setActivePlottingLayer(plottingLayer);
4883
var successMessage = "图层 " + plottingLayer.name + " 创建成功";
4984
widgets.alert.showAlert(successMessage,true);
5085
}
86+
5187
function removePlottingLayer(){
5288
widgets.alert.clearAlert();
53-
if (plottingLayers.length !== 0) {
54-
var tempPlottingLayer = plottingLayers[plottingLayers.length - 1];
89+
if (plotMapManager.getPlottingLayers().length !== 0) {
90+
var tempPlottingLayer = plotMapManager.getActivePlottingLayer();
5591
map.removeLayer(tempPlottingLayer);
5692
var successMessage = "图层 " + tempPlottingLayer.name + " 删除成功";
57-
plottingLayers.splice(plottingLayers.length - 1, 1);
58-
if(plottingLayers.length > 0){
59-
drawControl.setDrawingLayer(plottingLayers[plottingLayers.length-1]);
93+
if(plotMapManager.getPlottingLayers().length > 0){
94+
plotMapManager.setActivePlottingLayer(plotMapManager.getPlottingLayers()[plotMapManager.getPlottingLayers().length-1]);
6095
}
6196
widgets.alert.showAlert(successMessage,true);
6297
} else {
6398
widgets.alert.showAlert("当前地图无标绘图层",false);
6499
}
65100
}
101+
102+
function createChildPlotLayer() {
103+
widgets.alert.clearAlert();
104+
if(plotMapManager.getActivePlottingLayer() !== undefined){
105+
var plottingLayerName = "子图层";
106+
var plottingLayerCaption = plottingLayerName;
107+
childPlotLayer = L.supermap.plotting.childPlotLayer(plottingLayerName,plottingLayerCaption);
108+
plottingLayer.addChildPlotLayer(childPlotLayer);
109+
plottingLayer.setActiveChildPlotLayer(childPlotLayer);
110+
}else{
111+
widgets.alert.showAlert("请先添加标绘图层!",true);
112+
}
113+
var successMessage = "子图层 " + childPlotLayer.name + " 创建成功";
114+
widgets.alert.showAlert(successMessage,true);
115+
}
116+
117+
function removeChildPlotLayer(){
118+
widgets.alert.clearAlert();
119+
var childPlotLayer = plotMapManager.getActiveChildPlotLayer();
120+
if (childPlotLayer != null && childPlotLayer.getParent() != null) {
121+
childPlotLayer.getParent().removeChildPlotLayer(childPlotLayer);
122+
if(childPlotLayer.getParent().getChildPlotLayers().length > 0){
123+
plotMapManager.setActiveChildPlotLayer(childPlotLayer.getParent().getChildPlotLayers()[childPlotLayer.getParent().getChildPlotLayers().length-1]);
124+
}
125+
126+
var successMessage = "子图层 " + childPlotLayer.name + " 删除成功";
127+
widgets.alert.showAlert(successMessage,true);
128+
} else {
129+
widgets.alert.showAlert("当前地图无标绘图层或子图层",false);
130+
}
131+
}
132+
133+
function setPlottingLayerMinScale() {
134+
plotMapManager.getActivePlottingLayer().setMinVisibleScale(map._layers[27].getScale());
135+
}
136+
137+
function setPlottingLayerMaxScale() {
138+
plotMapManager.getActivePlottingLayer().setMaxVisibleScale(map._layers[27].getScale());
139+
}
140+
141+
function clearScale() {
142+
plotMapManager.getActivePlottingLayer().clearVisibleScale();
143+
}
144+
145+
function setSymScaleDefinition() {
146+
if(document.getElementById("plotSize").selectedIndex === 0) {
147+
plotMapManager.getActivePlottingLayer().setSymScaleDefinition(map._layers[27].getScale(),false);
148+
}else{
149+
plotMapManager.getActivePlottingLayer().setSymScaleDefinition(map._layers[27].getScale(),true);
150+
}
151+
}
152+
66153
function plotSymbol(){
67154
widgets.alert.clearAlert();
68155
if(drawControl.drawingLayer !== undefined){
@@ -74,15 +161,18 @@ <h5 class='panel-title text-center' data-i18n="resources.title_operatePlottingLa
74161
widgets.alert.showAlert("请先添加标绘图层!",true);
75162
}
76163
}
164+
77165
function plottingDrawCancel(){
78166
widgets.alert.clearAlert();
79167
drawControl.handler.disable();
80168
}
169+
81170
$(document).ready(function(){
82171
$('#panelheading').click(function(){
83172
$('#panelbodycontent').toggle();
173+
$('#popupWin').toggle();
84174
});
85175
});
86176
</script>
87177
</body>
88-
</html>
178+
</html>

examples/locales/en-US/resources.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1538,6 +1538,13 @@ window.examplesResources = {
15381538
"btn_clear": "Clear",
15391539
"btn_createLayer": "Create layer",
15401540
"btn_deleteLayer": "Delete layer",
1541+
"btn_setPlottingLayerMinScale": "Set the current map scale as the layer's minimum visible scale",
1542+
"btn_setPlottingLayerMaxScale": "Set the current map scale as the layer's maximum visible scale",
1543+
"btn_clearScale": "Clear layer visible range settings",
1544+
"btn_setSymScaleDefinition": "Set the current map scale as the base for layer scaling",
1545+
"btn_plotSize":"Maintain the absolute size of the symbol and the display size change",
1546+
"btn_createChildLayer": "Create child layer",
1547+
"btn_deleteChildLayer": "Delete child layer",
15411548
"btn_createAnimation": "Create animation",
15421549
"btn_play": "Play",
15431550
"btn_stop": "Stop",

examples/locales/zh-CN/resources.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1485,6 +1485,13 @@ window.examplesResources = {
14851485
"btn_clear": "清空",
14861486
"btn_createLayer": "创建图层",
14871487
"btn_deleteLayer": "删除图层",
1488+
"btn_setPlottingLayerMinScale": "将当前地图比例尺设为图层最小可见比例尺",
1489+
"btn_setPlottingLayerMaxScale": "将当前地图比例尺设为图层最大可见比例尺",
1490+
"btn_clearScale": "清除图层可见范围设置",
1491+
"btn_setSymScaleDefinition": "将当前地图比例尺设为图层缩放基准",
1492+
"btn_plotSize":"保持标号绝对尺寸,显示尺寸变化",
1493+
"btn_createChildLayer": "创建子图层",
1494+
"btn_deleteChildLayer": "删除子图层",
14881495
"btn_createAnimation": "创建动画",
14891496
"btn_play": "播放",
14901497
"btn_stop": "停止",

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy