Skip to content

Commit d2693c8

Browse files
committed
[fix]修改一些示例中多次点击操作时报错的问题
1 parent a2a7a30 commit d2693c8

12 files changed

+26
-11
lines changed

examples/leaflet/01_layersLegend.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ <h5 class='panel-title text-center'>
5454
</div>
5555
<div class="panel-body" id="layersList"></div>
5656
<div class="panel-footer">
57-
<input class="btn btn-default" type="button" onclick="createLegend()" data-i18n="[value]resources.btn_getLegend"></input>
57+
<input class="btn btn-default" type="button" onclick="createLegend()" data-i18n="[value]resources.btn_getLegend"/>
5858
</div>
5959
</div>
6060
<div class="panel panel-primary legend" style="width:250px;margin-top: 50vh;position: absolute;float:right;">

examples/leaflet/iServerSecurity.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,16 +336,20 @@ <h4 data-i18n="resources.title_iServerSecurity"></h4>
336336
/*token访问服务 end*/
337337

338338
/*出图*/
339+
var onlineMap;
339340
function showMapWithToken() {
340341
var token = $('#mapToken_iserver').val();
341342
var mapUrl = $('#serviceUrlMap_iserver').val();
342343
if (!checkUrl(mapUrl)) {
343344
return;
344345
}
346+
if (onlineMap) {
347+
onlineMap.remove();
348+
}
345349
//使用前要先注册token,如果为该地址注册过则不用重复注册
346350
L.supermap.SecurityManager.registerToken(mapUrl, token);
347351

348-
var onlineMap = L.map('iserver_map', {
352+
onlineMap = L.map('iserver_map', {
349353
center: [30, 104],
350354
maxZoom: 18,
351355
zoom: 2

examples/leaflet/onlineSecurity.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,15 +175,19 @@ <h4 data-i18n="resources.title_onlineSecurity"></h4>
175175
/*注册key end*/
176176

177177
/*出图*/
178+
var onlineMap;
178179
function showMapWithOnlineKey() {
179180
var key = $('#mapKey_online').val();
180181
var mapUrl = $('#serviceUrlMap_online').val();
181182
if (!checkUrl(mapUrl)) {
182183
return;
183184
}
185+
if (onlineMap) {
186+
onlineMap.remove();
187+
}
184188
L.supermap.SecurityManager.registerKey(mapUrl, key);
185189

186-
var onlineMap = L.map('online_map', {
190+
onlineMap = L.map('online_map', {
187191
crs: L.CRS.EPSG4326,
188192
center: [30, 104],
189193
maxZoom: 18,

examples/mapboxgl/01_layersLegend.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ <h5 class='panel-title text-center'>
5454
</div>
5555
<div class="panel-body" id="layersList"></div>
5656
<div class="panel-footer">
57-
<input class="btn btn-default" type="button" onclick="createLegend()" data-i18n="[value]resources.btn_getLegend"></input>
57+
<input class="btn btn-default" type="button" onclick="createLegend()" data-i18n="[value]resources.btn_getLegend"/>
5858
</div>
5959
</div>
6060
<div class="panel panel-primary legend" style="width:250px;margin-top: 50vh;position: absolute;">

examples/mapboxgl/01_mapQueryBySQL_FGB.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ <h5 class='panel-title text-center' data-i18n="resources.title_queryBySQL"></h5>
9797
function clearFeatures() {
9898
if (map.getLayer('points')) {
9999
map.removeLayer('points');
100+
}
101+
if(map.getSource('pointsouter')){
100102
map.removeLayer('pointsouter');
101103
map.removeSource('pointsouter');
102104
}

examples/mapboxgl/02_getFeatureBySQL_FGB.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ <h5 class='panel-title text-center' data-i18n="resources.title_getFeatureBySQL">
129129
function clearFeatures() {
130130
if (map.getLayer('queryDatas')) {
131131
map.removeLayer('queryDatas');
132+
}
133+
if (map.getLayer('queryDatasouter')) {
132134
map.removeLayer('queryDatasouter');
133135
map.removeSource('queryDatasouter');
134136
}

examples/maplibregl/01_layersLegend.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ <h5 class='panel-title text-center'>
5555
</div>
5656
<div class="panel-body" id="layersList"></div>
5757
<div class="panel-footer">
58-
<input class="btn btn-default" type="button" onclick="createLegend()" data-i18n="[value]resources.btn_getLegend"></input>
58+
<input class="btn btn-default" type="button" onclick="createLegend()" data-i18n="[value]resources.btn_getLegend"/>
5959
</div>
6060
</div>
6161
<div class="panel panel-primary legend" style="width:250px;margin-top: 50vh;position: absolute;">

examples/maplibregl/01_mapQueryBySQL_FGB.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ <h5 class='panel-title text-center' data-i18n="resources.title_queryBySQL"></h5>
9898
function clearFeatures() {
9999
if (map.getLayer('points')) {
100100
map.removeLayer('points');
101+
}
102+
if(map.getSource('pointsouter')){
101103
map.removeLayer('pointsouter');
102104
map.removeSource('pointsouter');
103105
}

examples/maplibregl/02_getFeatureBySQL_FGB.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ <h5 class='panel-title text-center' data-i18n="resources.title_getFeatureBySQL">
129129
function clearFeatures() {
130130
if (map.getLayer('queryDatas')) {
131131
map.removeLayer('queryDatas');
132+
}
133+
if (map.getLayer('queryDatasouter')) {
132134
map.removeLayer('queryDatasouter');
133135
map.removeSource('queryDatasouter');
134136
}

examples/openlayers/01_layersLegend.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ <h5 class='panel-title text-center'>
5555
</div>
5656
<div class="panel-body" id="layersList"></div>
5757
<div class="panel-footer">
58-
<input class="btn btn-default" type="button" onclick="createLegend()" data-i18n="[value]resources.btn_getLegend"></input>
58+
<input class="btn btn-default" type="button" onclick="createLegend()" data-i18n="[value]resources.btn_getLegend"/>
5959
</div>
6060
</div>
6161
<div class="panel panel-primary legend" style="width:250px;margin-top: 50vh;position: absolute;">

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