Revision d8e5f1be
Added by Andreas Kohlbecker over 3 years ago
modules/cdm_dataportal/js/map/openlayers_map.js | ||
---|---|---|
37 | 37 |
defaultBaseLayerName: 'open_topomap', |
38 | 38 |
maxZoom: 15, |
39 | 39 |
minZoom: 0, |
40 |
// hide the map when the data layer has no features |
|
41 |
hideEmptyMap: true, |
|
40 | 42 |
debug: true, |
41 | 43 |
/** |
42 | 44 |
* allows the map to display parts of the layers which are outside |
... | ... | |
268 | 270 |
}); |
269 | 271 |
} |
270 | 272 |
|
273 |
/** |
|
274 |
* Removes the map and the parent container from the |
|
275 |
* DOM and destroys the OpenLayers map object |
|
276 |
*/ |
|
277 |
function removeMap() { |
|
278 |
// if you are using an application which removes a container |
|
279 |
// of the map from the DOM, you need to ensure that you destroy the map before this happens; |
|
280 |
map.destroy; |
|
281 |
jQuery(map.div).parent().remove(); |
|
282 |
} |
|
283 |
|
|
271 | 284 |
/** |
272 | 285 |
* |
273 | 286 |
*/ |
... | ... | |
379 | 392 |
"featureselected": onKmlFeatureSelect, |
380 | 393 |
"featureunselected": onKmlFeatureUnselect, |
381 | 394 |
'loadend': function(event) { |
382 |
applyLayerZoomBounds(event); |
|
383 |
disablePolygonFeatureClick(event); |
|
395 |
if(opts.hideEmptyMap && kmlLayer.features.length == 0){ |
|
396 |
log("No feature in KML layer, removing map ...") |
|
397 |
removeMap(); |
|
398 |
} else { |
|
399 |
applyLayerZoomBounds(event); |
|
400 |
disablePolygonFeatureClick(event); |
|
401 |
} |
|
384 | 402 |
} |
385 | 403 |
}); |
386 | 404 |
map.addControl(kmlSelectControl); |
Also available in: Unified diff
fix #9175 map detects empty kml layer and removes itself