Mercurial > mxd2map
comparison src/java/de/intevation/mxd/reader/GroupLayerReader.java @ 180:f4eb506499f5
Done some code styling and removed TODOs.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Mon, 11 Jul 2011 12:11:08 +0200 |
parents | 2bf35f0babd0 |
children | 0bde090506f9 |
comparison
equal
deleted
inserted
replaced
179:f3a91cd7440b | 180:f4eb506499f5 |
---|---|
68 * @return The layer XML element. | 68 * @return The layer XML element. |
69 */ | 69 */ |
70 public Element read() | 70 public Element read() |
71 throws IOException{ | 71 throws IOException{ |
72 logger.debug("read()"); | 72 logger.debug("read()"); |
73 Element layerElement = null; | 73 Element layerElement = null; |
74 for(int i = 0; i < layer.getCount();i++) { | 74 for(int i = 0; i < layer.getCount();i++) { |
75 ILayer lay = layer.getLayer(i); | 75 ILayer lay = layer.getLayer(i); |
76 try { | 76 try { |
77 if (lay instanceof FeatureLayer) { | 77 if (lay instanceof FeatureLayer) { |
78 FeatureLayerReader lr = new FeatureLayerReader(lay); | 78 FeatureLayerReader lr = new FeatureLayerReader(lay); |
79 lr.setUtil(util); | 79 lr.setUtil(util); |
80 layerElement = lr.read(); | 80 layerElement = lr.read(); |
81 if (layerElement == null) { | 81 if (layerElement == null) { |
82 continue; | 82 continue; |
83 } | 83 } |
84 layerElement.setAttribute("group", layer.getName()); | 84 layerElement.setAttribute("group", layer.getName()); |
85 IFeatureRenderer renderer = | 85 IFeatureRenderer renderer = |
86 ((FeatureLayer)lay).getRenderer(); | 86 ((FeatureLayer)lay).getRenderer(); |
87 IRendererReader rreader; | 87 IRendererReader rreader; |
88 if(renderer instanceof SimpleRenderer) { | 88 if(renderer instanceof SimpleRenderer) { |
89 rreader = new SimpleRendererReader(renderer); | 89 rreader = new SimpleRendererReader(renderer); |
111 else if(lay instanceof GdbRasterCatalogLayer) { | 111 else if(lay instanceof GdbRasterCatalogLayer) { |
112 GdbRasterCatalogLayerReader gclr = | 112 GdbRasterCatalogLayerReader gclr = |
113 new GdbRasterCatalogLayerReader(lay); | 113 new GdbRasterCatalogLayerReader(lay); |
114 gclr.setUtil(util); | 114 gclr.setUtil(util); |
115 layerElement = gclr.read(); | 115 layerElement = gclr.read(); |
116 layerElement.setAttribute("group", layer.getName()); | 116 layerElement.setAttribute("group", layer.getName()); |
117 IFeatureRenderer renderer = | 117 IFeatureRenderer renderer = |
118 ((GdbRasterCatalogLayer)lay).getRenderer(); | 118 ((GdbRasterCatalogLayer)lay).getRenderer(); |
119 IRendererReader rreader; | 119 IRendererReader rreader; |
120 if(renderer instanceof SimpleRenderer) { | 120 if(renderer instanceof SimpleRenderer) { |
121 rreader = new SimpleRendererReader(renderer); | 121 rreader = new SimpleRendererReader(renderer); |
138 else { | 138 else { |
139 logger.debug("Not a known renderer type " + | 139 logger.debug("Not a known renderer type " + |
140 renderer.getClass().toString()); | 140 renderer.getClass().toString()); |
141 } | 141 } |
142 } | 142 } |
143 } | 143 } |
144 catch(Exception e) { | 144 catch(Exception e) { |
145 invalidLayerCount++; | 145 invalidLayerCount++; |
146 if(i == 0 && (i + 1) == layer.getCount() || | 146 if(i == 0 && (i + 1) == layer.getCount() || |
147 invalidLayerCount == layer.getCount()) { | 147 invalidLayerCount == layer.getCount()) { |
148 throw new IOException( | 148 throw new IOException( |
149 "No valid layer in MXD file." + | 149 "No valid layer in MXD file." + |
150 " Aborting."); | 150 " Aborting."); |
151 } | 151 } |
152 } | 152 } |
153 } | 153 } |
154 return layerElement; | 154 return layerElement; |
155 } | 155 } |
156 } | 156 } |
157 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : | 157 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |