diff src/java/de/intevation/mxd/reader/MXDReader.java @ 31:40c0b4e5f91a

Added utility class to store map attributes.
author Raimund Renkert <rrenkert@intevation.de>
date Mon, 11 Apr 2011 16:04:03 +0200
parents c34c450edb06
children c51376f8e24c
line wrap: on
line diff
--- a/src/java/de/intevation/mxd/reader/MXDReader.java	Fri Apr 08 17:58:37 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/MXDReader.java	Mon Apr 11 16:04:03 2011 +0200
@@ -36,7 +36,6 @@
     private String filename = "";
     private ArcGISInitializer initializer = null;
     private IMap map;
-    private Document mapInfo;
 
     private static final Logger logger = Logger.getLogger(MXDReader.class);
 
@@ -44,7 +43,6 @@
     public MXDReader() throws IOException{
         logger.debug("constructor()");
         initializer = new ArcGISInitializer();
-        mapInfo = XMLUtils.newDocument();
     }
 
 
@@ -102,31 +100,35 @@
         else{
             openMapDocument();
             MapReader mreader = new MapReader (map);
-            mreader.setDocument(mapInfo);
+            MapToXMLUtils util = new MapToXMLUtils();
+            mreader.setUtil(util);
             mreader.read();
 
             for(int i = 0; i < map.getLayerCount();i++){
                 ILayer layer = map.getLayer(i);
                 try{
                     FeatureLayerReader lr = new FeatureLayerReader(layer);
-                    lr.setDocument(mapInfo);
-                    lr.read();
+                    lr.setUtil(util);
+                    Element layerElement = lr.read();
                     if (layer instanceof FeatureLayer){
-                        IFeatureClass fc = ((FeatureLayer)layer).getFeatureClass();
-                        IClassReader creader = new FeatureClassReader(fc);
-
                         IFeatureRenderer renderer = ((FeatureLayer)layer).getRenderer();
                         IRendererReader rreader;
                         if(renderer instanceof SimpleRenderer){
                             rreader = new SimpleRendererReader(renderer);
+                            rreader.setParent(layerElement);
+                            rreader.setUtil(util);
                             rreader.read();
                         }
                         else if(renderer instanceof ClassBreaksRenderer){
                             rreader = new ClassBreakRendererReader(renderer);
+                            rreader.setParent(layerElement);
+                            rreader.setUtil(util);
                             rreader.read();
                         }
                         else if(renderer instanceof UniqueValueRenderer){
                             rreader = new UniqueValueRendererReader(renderer);
+                            rreader.setParent(layerElement);
+                            rreader.setUtil(util);
                             rreader.read();
                         }
                         else{
@@ -140,18 +142,15 @@
                     e.printStackTrace();
                 }
             }
-            XMLUtils.toStream(mapInfo, System.out);
+            util.print();
         }
         return true;
     }
 
 
-    /**
-     * Get the mapinformation as DOM document. TODO: implement me!
-     */
     public Document getMapDocument(){
         logger.debug("getMapDocument()");
-        return mapInfo;
+        return null;
     }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)