comparison src/java/de/intevation/mxd/reader/GroupLayerReader.java @ 244:276f63c86f1c

Refactored group layer handling and "wms_title" metadata.
author raimund renkert <raimund.renkert@intevation.de>
date Tue, 09 Aug 2011 17:27:18 +0200
parents df4e0946ef02
children 2cb2f26d0d54
comparison
equal deleted inserted replaced
243:df4e0946ef02 244:276f63c86f1c
42 /** 42 /**
43 * Reads Layer information. 43 * Reads Layer information.
44 * 44 *
45 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> 45 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a>
46 */ 46 */
47 public class GroupLayerReader 47 public class GroupLayerReader {
48 implements ILayerReader {
49 48
50 /** 49 /**
51 * The logger. 50 * The logger.
52 */ 51 */
53 private static final Logger logger = 52 private static final Logger logger =
89 /** 88 /**
90 * Reads the Layer content. 89 * Reads the Layer content.
91 * 90 *
92 * @return The layer XML element. 91 * @return The layer XML element.
93 */ 92 */
94 public Element read() 93 public Element read(String group)
95 throws IOException{ 94 throws IOException{
96 logger.debug("read()"); 95 logger.debug("read()");
97 Element layerElement = null; 96 Element layerElement = null;
98 for(int i = 0; i < layer.getCount();i++) { 97 for(int i = 0; i < layer.getCount();i++) {
99 ILayer lay = layer.getLayer(i); 98 ILayer lay = layer.getLayer(i);
103 lr.setUtil(util); 102 lr.setUtil(util);
104 layerElement = lr.read(); 103 layerElement = lr.read();
105 if (layerElement == null) { 104 if (layerElement == null) {
106 continue; 105 continue;
107 } 106 }
108 layerElement.setAttribute("group", layer.getName()); 107 layerElement.setAttribute("group", group + "/" + layer.getName());
109 IFeatureRenderer renderer = 108 IFeatureRenderer renderer =
110 ((FeatureLayer)lay).getRenderer(); 109 ((FeatureLayer)lay).getRenderer();
111 IRendererReader rreader; 110 IRendererReader rreader;
112 if(renderer instanceof SimpleRenderer) { 111 if(renderer instanceof SimpleRenderer) {
113 rreader = new SimpleRendererReader(renderer); 112 rreader = new SimpleRendererReader(renderer);
162 else { 161 else {
163 logger.debug("Not a known renderer type " + 162 logger.debug("Not a known renderer type " +
164 renderer.getClass().toString()); 163 renderer.getClass().toString());
165 } 164 }
166 } 165 }
166 else if(lay instanceof GroupLayer) {
167 GroupLayerReader glr = new GroupLayerReader (lay);
168 glr.setUtil(this.util);
169 layerElement = glr.read("/" + layer.getName());
170 }
167 } 171 }
168 catch(Exception e) { 172 catch(Exception e) {
169 invalidLayerCount++; 173 invalidLayerCount++;
170 if(i == 0 && (i + 1) == layer.getCount() || 174 if(i == 0 && (i + 1) == layer.getCount() ||
171 invalidLayerCount == layer.getCount()) { 175 invalidLayerCount == layer.getCount()) {
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)