comparison src/java/de/intevation/mxd/reader/FeatureLayerReader.java @ 309:e8021f3e411a

Add support for FgdbFeatureClass
author Andre Heinecke <aheinecke@intevation.de>
date Fri, 14 Sep 2012 11:48:52 +0200
parents f9e53dcc7424
children 5e3a40a84539
comparison
equal deleted inserted replaced
308:1c949a309940 309:e8021f3e411a
25 import com.esri.arcgis.carto.FeatureLayer; 25 import com.esri.arcgis.carto.FeatureLayer;
26 import com.esri.arcgis.carto.AnnotateLayerPropertiesCollection; 26 import com.esri.arcgis.carto.AnnotateLayerPropertiesCollection;
27 import com.esri.arcgis.carto.IAnnotateLayerProperties; 27 import com.esri.arcgis.carto.IAnnotateLayerProperties;
28 import com.esri.arcgis.carto.LabelEngineLayerProperties; 28 import com.esri.arcgis.carto.LabelEngineLayerProperties;
29 import com.esri.arcgis.geodatabase.FeatureClassName; 29 import com.esri.arcgis.geodatabase.FeatureClassName;
30 import com.esri.arcgis.datasourcesGDB.FgdbFeatureClassName;
30 import com.esri.arcgis.system.IName; 31 import com.esri.arcgis.system.IName;
31 import com.esri.arcgis.system.IPropertySet; 32 import com.esri.arcgis.system.IPropertySet;
32 import com.esri.arcgis.geometry.Envelope; 33 import com.esri.arcgis.geometry.Envelope;
33 import com.esri.arcgis.geometry.ISpatialReference; 34 import com.esri.arcgis.geometry.ISpatialReference;
34 import com.esri.arcgis.geometry.ProjectedCoordinateSystem; 35 import com.esri.arcgis.geometry.ProjectedCoordinateSystem;
198 try { 199 try {
199 IName fcn = layer.getDataSourceName(); 200 IName fcn = layer.getDataSourceName();
200 if(fcn instanceof FeatureClassName) { 201 if(fcn instanceof FeatureClassName) {
201 FeatureClassName name = (FeatureClassName)fcn; 202 FeatureClassName name = (FeatureClassName)fcn;
202 layerElement.setAttribute("data_source", name.getName()); 203 layerElement.setAttribute("data_source", name.getName());
204 } else if (fcn instanceof FgdbFeatureClassName) {
205 FgdbFeatureClassName name = (FgdbFeatureClassName)fcn;
206 layerElement.setAttribute("data_source", name.getName());
203 } 207 }
204 else { 208 else {
205 logger.debug ( 209 logger.debug (
206 "Unknown FeatureClass name:" + 210 "Unknown FeatureClass name:" +
207 fcn.getClass().toString()); 211 fcn.getClass().toString());
267 catch(IOException ioe) { 271 catch(IOException ioe) {
268 logger.warn("Could not read layer projection."); 272 logger.warn("Could not read layer projection.");
269 } 273 }
270 274
271 try { 275 try {
272 String datatype = layer.getDataSourceType(); 276 if (layer.getDataSourceName() instanceof FgdbFeatureClassName) {
273 if(layer.getWorkspace().getType() == 0) { 277 FgdbFeatureClassName name = (FgdbFeatureClassName)layer.getDataSourceName();
278 layerElement.setAttribute("connection_type", "ogr");
279 layerElement.setAttribute("data", name.getName());
280 layerElement.setAttribute("connection", name.getWorkspaceName().getPathName());
281 }
282 else if(layer.getWorkspace().getType() == 0) {
274 layerElement.setAttribute("connection_type", "local"); 283 layerElement.setAttribute("connection_type", "local");
275 layerElement.setAttribute( 284 layerElement.setAttribute(
276 "workspace", 285 "workspace",
277 layer.getWorkspace().getPathName()); 286 layer.getWorkspace().getPathName());
278 } 287 }
329 //Do nothing, cause no jointable defined. 338 //Do nothing, cause no jointable defined.
330 } 339 }
331 } 340 }
332 } 341 }
333 catch(Exception e) { 342 catch(Exception e) {
343 logger.debug(e);
334 logger.error( 344 logger.error(
335 "Could not read layer datasource." + 345 "Could not read layer datasource." +
336 " Stopped reading layer " + layer.getName() + "."); 346 " Stopped reading layer " + layer.getName() + ".");
337 util.removeLayer(layerElement); 347 util.removeLayer(layerElement);
338 return null; 348 return null;
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)