- return popup;
-}
-
-function closeMapPopup() {
- if (popup) {
- map.removePopup(popup);
- delete popup;
- }
-}
-
-function removeMarkerFromMap(marker){
- markers.removeMarker(marker);
-}
-
-function removeBoxFromMap(box){
- vectors.removeFeature(box);
-}
-
-function proj(x) {
- return x.clone().transform(epsg4326, map.getProjectionObject());
-}
-
-function unproj(x) {
- return x.clone().transform(map.getProjectionObject(), epsg4326);
-}
-
-function setMapCenter(center, zoom) {
- zoom = parseInt(zoom, 10);
- var numzoom = map.getNumZoomLevels();
- if (zoom >= numzoom) zoom = numzoom - 1;
- map.setCenter(proj(center), zoom);
-}
-
-function getEventPosition(event) {
- return map.getLonLatFromViewPortPx(event.xy).clone().transform(map.getProjectionObject(), epsg4326);
-}
-
-function getMapLayers() {
- var layerConfig = "";
-
- for (var i = 0; i < map.layers.length; i++) {
- if (map.layers[i].layerCode && map.layers[i].getVisibility()) {
- layerConfig += map.layers[i].layerCode;
- }
- }
-
- return layerConfig;
-}
-
-function setMapLayers(layerConfig) {
- if (layerConfig.charAt(0) == "B" || layerConfig.charAt(0) == "0") {
- var l = 0;
-
- for (var layers = map.getLayersBy("isBaseLayer", true), i = 0; i < layers.length; i++) {
- var c = layerConfig.charAt(l++);
-
- if (c == "B") {
- map.setBaseLayer(layers[i]);
- } else {
- map.layers[i].setVisibility(false);
- }
- }
- } else {
- for (var i = 0; i < map.layers.length; i++) {
- if (map.layers[i].layerCode) {
- if (layerConfig.indexOf(map.layers[i].layerCode) >= 0) {
- if (map.layers[i].isBaseLayer) {
- map.setBaseLayer(map.layers[i]);
- } else {
- map.layers[i].setVisibility(true);
- }
- } else if (!map.layers[i].isBaseLayer) {
- map.layers[i].setVisibility(false);
- }
- }
- }
- }