Mercurial > mxd2map
comparison 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 |
comparison
equal
deleted
inserted
replaced
132:02df1dbc2166 | 133:6b80d2c7536e |
---|---|
10 import org.apache.log4j.Logger; | 10 import org.apache.log4j.Logger; |
11 | 11 |
12 import org.w3c.dom.Document; | 12 import org.w3c.dom.Document; |
13 import org.w3c.dom.Element; | 13 import org.w3c.dom.Element; |
14 import org.w3c.dom.NodeList; | 14 import org.w3c.dom.NodeList; |
15 import org.w3c.dom.DOMException; | |
15 | 16 |
16 /** | 17 /** |
17 * Utility class to store map information in a XML structure. | 18 * Utility class to store map information in a XML structure. |
18 * | 19 * |
19 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> | 20 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> |
94 return node; | 95 return node; |
95 } | 96 } |
96 } | 97 } |
97 | 98 |
98 /** | 99 /** |
100 * Remove a layer element from map. | |
101 * @param name The layer name. | |
102 */ | |
103 public void removeLayer(Element layerElement) { | |
104 NodeList list = root.getElementsByTagName("map"); | |
105 if(list == null || list.getLength() == 0){ | |
106 return; | |
107 } | |
108 else if(list.getLength() > 1) { | |
109 return; | |
110 } | |
111 else { | |
112 try { | |
113 list.item(0).removeChild(layerElement); | |
114 } | |
115 catch(DOMException de) { | |
116 return; | |
117 } | |
118 } | |
119 } | |
120 | |
121 /** | |
99 * Add a renderer element to the map. | 122 * Add a renderer element to the map. |
100 * @param layer The parent layer element. | 123 * @param layer The parent layer element. |
101 * @return The renderer element. | 124 * @return The renderer element. |
102 */ | 125 */ |
103 public Element addRenderer(Element layer) { | 126 public Element addRenderer(Element layer) { |