diff 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
line wrap: on
line diff
--- a/src/java/de/intevation/mxd/reader/GdbRasterCatalogLayerReader.java	Fri Aug 12 16:08:57 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/GdbRasterCatalogLayerReader.java	Mon Aug 15 12:07:09 2011 +0200
@@ -23,6 +23,8 @@
 
 import com.esri.arcgis.carto.ILayer;
 import com.esri.arcgis.carto.GdbRasterCatalogLayer;
+import com.esri.arcgis.system.IPropertySet;
+import com.esri.arcgis.geodatabase.IWorkspace;
 
 import org.w3c.dom.Element;
 import java.io.IOException;
@@ -142,6 +144,38 @@
             logger.warn(
                 "Could not read layer definition query.");
         }
+
+        try {
+            layerElement.setAttribute("type", "raster");
+            IWorkspace rw = layer.getWorkspace();
+            layerElement.setAttribute(
+                "dataset",
+                rw.getDatasetNames(16).next().getName());
+            IPropertySet set = rw.getConnectionProperties();
+            Object names[] = new Object[set.getCount()];
+            Object prop[] = new Object[set.getCount()];
+            set.getAllProperties(names, prop);
+            layerElement.setAttribute("connection_type", "SDE");
+            for(int i = 0; i < names.length; i++) {
+                if(names[i] != null) {
+                    String[] prop_names = (String[])names[i];
+                    for(int j = 0; j < prop_names.length; j++) {
+                        layerElement.setAttribute(
+                            prop_names[j].toLowerCase(),
+                             set.getProperty(prop_names[j]).toString());
+                    }
+                }
+            }
+        }
+        catch(Exception e) {
+            e.printStackTrace();
+            logger.error(
+                "Could not read layer datasource." +
+                " Stopped reading layer " + layer.getName() + ".");
+            util.removeLayer(layerElement);
+            return null;
+        }
+
         return layerElement;
     }
 }
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)