Mercurial > mxd2map
comparison src/java/de/intevation/mxd/reader/GdbRasterCatalogLayerReader.java @ 252:eae3fe89e669
Added raster layer support.
author | raimund renkert <raimund.renkert@intevation.de> |
---|---|
date | Mon, 15 Aug 2011 12:07:09 +0200 |
parents | df4e0946ef02 |
children |
comparison
equal
deleted
inserted
replaced
251:6b80e46b8f38 | 252:eae3fe89e669 |
---|---|
21 | 21 |
22 import org.apache.log4j.Logger; | 22 import org.apache.log4j.Logger; |
23 | 23 |
24 import com.esri.arcgis.carto.ILayer; | 24 import com.esri.arcgis.carto.ILayer; |
25 import com.esri.arcgis.carto.GdbRasterCatalogLayer; | 25 import com.esri.arcgis.carto.GdbRasterCatalogLayer; |
26 import com.esri.arcgis.system.IPropertySet; | |
27 import com.esri.arcgis.geodatabase.IWorkspace; | |
26 | 28 |
27 import org.w3c.dom.Element; | 29 import org.w3c.dom.Element; |
28 import java.io.IOException; | 30 import java.io.IOException; |
29 import de.intevation.mxd.utils.MapToXMLUtils; | 31 import de.intevation.mxd.utils.MapToXMLUtils; |
30 | 32 |
140 } | 142 } |
141 catch(IOException ioe) { | 143 catch(IOException ioe) { |
142 logger.warn( | 144 logger.warn( |
143 "Could not read layer definition query."); | 145 "Could not read layer definition query."); |
144 } | 146 } |
147 | |
148 try { | |
149 layerElement.setAttribute("type", "raster"); | |
150 IWorkspace rw = layer.getWorkspace(); | |
151 layerElement.setAttribute( | |
152 "dataset", | |
153 rw.getDatasetNames(16).next().getName()); | |
154 IPropertySet set = rw.getConnectionProperties(); | |
155 Object names[] = new Object[set.getCount()]; | |
156 Object prop[] = new Object[set.getCount()]; | |
157 set.getAllProperties(names, prop); | |
158 layerElement.setAttribute("connection_type", "SDE"); | |
159 for(int i = 0; i < names.length; i++) { | |
160 if(names[i] != null) { | |
161 String[] prop_names = (String[])names[i]; | |
162 for(int j = 0; j < prop_names.length; j++) { | |
163 layerElement.setAttribute( | |
164 prop_names[j].toLowerCase(), | |
165 set.getProperty(prop_names[j]).toString()); | |
166 } | |
167 } | |
168 } | |
169 } | |
170 catch(Exception e) { | |
171 e.printStackTrace(); | |
172 logger.error( | |
173 "Could not read layer datasource." + | |
174 " Stopped reading layer " + layer.getName() + "."); | |
175 util.removeLayer(layerElement); | |
176 return null; | |
177 } | |
178 | |
145 return layerElement; | 179 return layerElement; |
146 } | 180 } |
147 } | 181 } |
148 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : | 182 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |