diff src/java/de/intevation/mxd/utils/MapToXMLUtils.java @ 133:6b80d2c7536e

Improved broken layer handling.
author vc11884admin@VC11884.win.bsh.de
date Tue, 21 Jun 2011 15:22:06 +0200
parents ef7ca23c4233
children cd55975ba0c4
line wrap: on
line diff
--- a/src/java/de/intevation/mxd/utils/MapToXMLUtils.java	Mon Jun 20 17:54:09 2011 +0200
+++ b/src/java/de/intevation/mxd/utils/MapToXMLUtils.java	Tue Jun 21 15:22:06 2011 +0200
@@ -12,6 +12,7 @@
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.NodeList;
+import org.w3c.dom.DOMException;
 
 /**
  * Utility class to store map information in a XML structure.
@@ -96,6 +97,28 @@
     }
 
     /**
+     * Remove a layer element from map.
+     * @param name The layer name.
+     */
+    public void removeLayer(Element layerElement) {
+        NodeList list = root.getElementsByTagName("map");
+        if(list == null || list.getLength() == 0){
+            return;
+        }
+        else if(list.getLength() > 1) {
+	    return;
+        }
+        else {
+	    try {
+                list.item(0).removeChild(layerElement);
+	    }
+	    catch(DOMException de) {
+	    	return;
+	    }
+        }
+    }
+
+    /**
      * Add a renderer element to the map.
      * @param layer The parent layer element.
      * @return The renderer element.
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)