Skip to content

Commit 0cd5be0

Browse files
committed
修改标绘demo,解决控制台报错
1 parent cf39eaa commit 0cd5be0

File tree

2 files changed

+25
-7
lines changed

2 files changed

+25
-7
lines changed

examples/leaflet/plot_movingTarget.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
});
2727

2828
new L.supermap.TiledMapLayer(url).addTo(map);
29-
//L.supermap.plotting.editControl().addTo(map);
29+
L.supermap.plotting.editControl().addTo(map);
3030
var movingTargetLayer = L.supermap.plotting.movingTargetLayer("Moving-Target", serverUrl).addTo(map);
3131

3232
map.on("zoomstart", function(){

examples/leaflet/plot_operatePlottingLayer.html

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ <h5 class='panel-title text-center' data-i18n="resources.title_operatePlottingLa
6363
zoom: 3
6464
});
6565

66-
L.supermap.tiledMapLayer(url).addTo(map);
66+
var baseLayer = L.supermap.tiledMapLayer(url).addTo(map);
6767
drawControl = L.supermap.plotting.drawControl();
6868
drawControl.addTo(map);
6969
var editControl = L.supermap.plotting.editControl();
@@ -130,22 +130,40 @@ <h5 class='panel-title text-center' data-i18n="resources.title_operatePlottingLa
130130
}
131131

132132
function setPlottingLayerMinScale() {
133-
plotMapManager.getActivePlottingLayer().setMinVisibleScale(map._layers[27].getScale());
133+
widgets.alert.clearAlert();
134+
if (plotMapManager.getActivePlottingLayer() != null) {
135+
plotMapManager.getActivePlottingLayer().setMinVisibleScale(baseLayer.getScale());
136+
} else {
137+
widgets.alert.showAlert("当前地图无标绘图层",false);
138+
}
139+
//plotMapManager.getActivePlottingLayer().setMinVisibleScale(baseLayer.getScale());
134140
}
135141

136142
function setPlottingLayerMaxScale() {
137-
plotMapManager.getActivePlottingLayer().setMaxVisibleScale(map._layers[27].getScale());
143+
widgets.alert.clearAlert();
144+
if (plotMapManager.getActivePlottingLayer() != null) {
145+
plotMapManager.getActivePlottingLayer().setMaxVisibleScale(baseLayer.getScale());
146+
} else {
147+
widgets.alert.showAlert("当前地图无标绘图层",false);
148+
}
149+
//plotMapManager.getActivePlottingLayer().setMaxVisibleScale(baseLayer.getScale());
138150
}
139151

140152
function clearScale() {
141-
plotMapManager.getActivePlottingLayer().clearVisibleScale();
153+
widgets.alert.clearAlert();
154+
if (plotMapManager.getActivePlottingLayer() != null) {
155+
plotMapManager.getActivePlottingLayer().clearVisibleScale();
156+
} else {
157+
widgets.alert.showAlert("当前地图无标绘图层",false);
158+
}
159+
//plotMapManager.getActivePlottingLayer().clearVisibleScale();
142160
}
143161

144162
function setSymScaleDefinition() {
145163
if(document.getElementById("plotSize").selectedIndex === 0) {
146-
plotMapManager.getActivePlottingLayer().setSymScaleDefinition(map._layers[27].getScale(),false);
164+
plotMapManager.getActivePlottingLayer().setSymScaleDefinition(baseLayer.getScale(),false);
147165
}else{
148-
plotMapManager.getActivePlottingLayer().setSymScaleDefinition(map._layers[27].getScale(),true);
166+
plotMapManager.getActivePlottingLayer().setSymScaleDefinition(baseLayer.getScale(),true);
149167
}
150168
}
151169

0 commit comments

Comments
 (0)