changeset 79:5becdfe6ebae

merged with raimunds stuff
author Stephan Holl <stephan.holl@intevation.de>
date Fri, 27 May 2011 12:54:55 +0200
parents df17d4c2f9eb (current diff) 3087c89a5bb8 (diff)
children 18814ae6d92d
files
diffstat 27 files changed, 823 insertions(+), 326 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu May 26 16:13:50 2011 +0200
+++ b/ChangeLog	Fri May 27 12:54:55 2011 +0200
@@ -1,3 +1,72 @@
+2011-05-27  Raimund Renkert  <raimund.renkert@intevation.de>
+
+	Added line fill symbol reader.
+
+	* src/java/de/intevation/mxd/reader/FillSymbolReader.java:
+	  Use the new reader to get line fill symbol attributes.
+
+	* src/java/de/intevation/mxd/reader/LineFillSymbolReader.java:
+	  New.
+
+2011-05-27  Raimund Renkert  <raimund.renkert@intevation.de>
+
+	Added marker fill symbol reader.
+
+	* src/java/de/intevation/mxd/reader/FillSymbolReader.java,
+	  src/java/de/intevation/mxd/reader/MarkerSymbolReader.java,
+	  src/java/de/intevation/mxd/reader/MultiLayerFillSymbolReader.java,
+	  src/java/de/intevation/mxd/reader/SimpleMarkerSymbolReader.java:
+	  Use the new reader to get marker fill symbol attributes.
+
+	* src/java/de/intevation/mxd/reader/MarkerFillSymbolReader.java:
+	  New.
+
+2011-05-26  Raimund Renkert  <raimund.renkert@intevation.de>
+
+	* src/java/de/intevation/mxd/reader/ArrowMarkerSymbolReader.java,
+	  src/java/de/intevation/mxd/reader/CartoLineSymbolReader.java,
+	  src/java/de/intevation/mxd/reader/CharacterMarkerSymbolReader.java,
+	  src/java/de/intevation/mxd/reader/ClassBreakRendererReader.java,
+	  src/java/de/intevation/mxd/reader/FeatureLayerReader.java,
+	  src/java/de/intevation/mxd/reader/GdbRasterCatalogLayerReader.java,
+	  src/java/de/intevation/mxd/reader/HashLineSymbolReader.java,
+	  src/java/de/intevation/mxd/reader/ILayerReader.java,
+	  src/java/de/intevation/mxd/reader/IRendererReader.java,
+	  src/java/de/intevation/mxd/reader/MXDReader.java,
+	  src/java/de/intevation/mxd/reader/MarkerLineSymbolReader.java,
+	  src/java/de/intevation/mxd/reader/MarkerSymbolReader.java,
+	  src/java/de/intevation/mxd/reader/MultiLayerFillSymbolReader.java,
+	  src/java/de/intevation/mxd/reader/MultiLayerLineSymbolReader.java,
+	  src/java/de/intevation/mxd/reader/MultiLayerMarkerSymbolReader.java,
+	  src/java/de/intevation/mxd/reader/PictureLineSymbolReader.java,
+	  src/java/de/intevation/mxd/reader/PictureMarkerSymbolReader.java,
+	  src/java/de/intevation/mxd/reader/SimpleFillSymbolReader.java,
+	  src/java/de/intevation/mxd/reader/SimpleLineSymbolReader.java,
+	  src/java/de/intevation/mxd/reader/SimpleMarkerSymbolReader.java,
+	  src/java/de/intevation/mxd/reader/SimpleRendererReader.java,
+	  src/java/de/intevation/mxd/reader/UniqueValueRendererReader.java:
+	  Catch all exceptions in the MXDReader.
+
+2011-05-26  Raimund Renkert  <raimund.renkert@intevation.de>
+
+	* src/java/de/intevation/mxd/reader/ClassBreakRendererReader.java,
+	  src/java/de/intevation/mxd/reader/UniqueValueRendererReader.java:
+	  Use the wrapper to read symbols.
+
+2011-05-26  Raimund Renkert  <raimund.renkert@intevation.de>
+
+	Added wrapper for fill symbol reader.
+
+	* src/java/de/intevation/mxd/reader/SimpleFillSymbolReader.java,
+	  src/java/de/intevation/mxd/reader/SimpleRendererReader.java:
+	  Use the wrapper to read the fill symbols.
+
+	* src/java/de/intevation/mxd/reader/FillSymbolReader.java:
+	  New.
+
+	* src/java/de/intevation/mxd/reader/LineSymbolReader.java:
+	  Added methods for the ILineSymbol interface.
+
 2011-05-26  Raimund Renkert  <raimund.renkert@intevation.de>
 
 	Added wrapper for line symbol reader.
--- a/src/java/de/intevation/mxd/reader/ArrowMarkerSymbolReader.java	Thu May 26 16:13:50 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/ArrowMarkerSymbolReader.java	Fri May 27 12:54:55 2011 +0200
@@ -84,16 +84,9 @@
      * @return The XML node.
      */
     public Element read()
-    throws IOException {
+    throws Exception {
         logger.debug("read()");
-        Element symbolElement;
-        try {
-            symbolElement = util.addSymbol(renderer);
-        }
-        catch(Exception e) {
-            e.printStackTrace();
-            return null;
-        }
+        Element symbolElement = util.addSymbol(renderer);
 
         IColor c = symbol.getColor();
         symbolElement.setAttribute(
--- a/src/java/de/intevation/mxd/reader/CartoLineSymbolReader.java	Thu May 26 16:13:50 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/CartoLineSymbolReader.java	Fri May 27 12:54:55 2011 +0200
@@ -87,16 +87,9 @@
      * @return The XML node.
      */
     public Element read()
-    throws IOException {
+    throws Exception {
         logger.debug("read()");
-        Element symbolElement;
-        try {
-            symbolElement = util.addSymbol(renderer);
-        }
-        catch(Exception e) {
-            e.printStackTrace();
-            return null;
-        }
+        Element symbolElement = util.addSymbol(renderer);
 
         symbolElement.setAttribute("name", symbol.getNameString());
         symbolElement.setAttribute("style", "line");
--- a/src/java/de/intevation/mxd/reader/CharacterMarkerSymbolReader.java	Thu May 26 16:13:50 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/CharacterMarkerSymbolReader.java	Fri May 27 12:54:55 2011 +0200
@@ -83,16 +83,9 @@
      * @return The XML node.
      */
     public Element read()
-    throws IOException {
+    throws Exception {
         logger.debug("read()");
-        Element symbolElement;
-        try {
-            symbolElement = util.addSymbol(renderer);
-        }
-        catch(Exception e) {
-            e.printStackTrace();
-            return null;
-        }
+        Element symbolElement = util.addSymbol(renderer);
 
         IColor c = symbol.getColor();
         symbolElement.setAttribute(
--- a/src/java/de/intevation/mxd/reader/ClassBreakRendererReader.java	Thu May 26 16:13:50 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/ClassBreakRendererReader.java	Fri May 27 12:54:55 2011 +0200
@@ -1,6 +1,6 @@
 package de.intevation.mxd.reader;
 
-import java.io.IOException;
+import java.lang.Exception;
 
 import org.apache.log4j.Logger;
 
@@ -69,50 +69,52 @@
      * @return The XML node.
      */
     public Element read()
-    throws IOException {
+    throws Exception {
         logger.debug("read()");
 
         for(int i = 0; i < renderer.getBreakCount(); i++){
-            Element rendererElement;
-            try {
-                rendererElement = util.addRenderer(layer);
-                rendererElement.setAttribute("value",
-                    String.valueOf(renderer.getBreak(i)));
-                rendererElement.setAttribute(
-                    "field_count",
-                    String.valueOf(renderer.getFieldCount()));
-                for(int j = 0; j < renderer.getFieldCount(); j++) {
-                    rendererElement.setAttribute(
-                        "expression_field_" + j,
-                        renderer.getField(j));
-
-                }
+            Element rendererElement = util.addRenderer(layer);
+            rendererElement.setAttribute("value",
+                String.valueOf(renderer.getBreak(i)));
+            rendererElement.setAttribute(
+                "field_count",
+                String.valueOf(renderer.getFieldCount()));
+            for(int j = 0; j < renderer.getFieldCount(); j++) {
                 rendererElement.setAttribute(
-                    "min_value",
-                    String.valueOf(renderer.getMinimumBreak()));
-                rendererElement.setAttribute("expression_operator", "<=");
-                ISymbol sym = renderer.getSymbol(i);
-                ISymbolReader symReader;
-                if(sym instanceof SimpleFillSymbol) {
-                    symReader = new SimpleFillSymbolReader(renderer.getSymbol(i));
-                    symReader.setUtil(util);
-                    symReader.setParent(rendererElement);
-                    symReader.read();
-                }
-                else if(sym instanceof SimpleMarkerSymbol) {
-                    symReader = new SimpleMarkerSymbolReader(renderer.getSymbol(i));
-                    symReader.setUtil(util);
-                    symReader.setParent(rendererElement);
-                    symReader.read();
-                }
-                else {
-                    logger.debug("Not a known symbol type: " +
-                                 sym.getClass().toString());
-                }
+                    "expression_field_" + j,
+                    renderer.getField(j));
+
             }
-            catch(Exception e) {
-                e.printStackTrace();
-                return null;
+            rendererElement.setAttribute(
+                "min_value",
+                String.valueOf(renderer.getMinimumBreak()));
+            rendererElement.setAttribute("expression_operator", "<=");
+
+            ISymbol sym = renderer.getSymbol(i);
+            MarkerSymbolReader markerReader = new MarkerSymbolReader();
+            LineSymbolReader lineReader = new LineSymbolReader();
+            FillSymbolReader fillReader = new FillSymbolReader();
+            if(markerReader.canRead(sym)) {
+                markerReader.setSymbol(sym);
+                markerReader.setUtil(util);
+                markerReader.setParent(rendererElement);
+                markerReader.read();
+            }
+            else if(lineReader.canRead(sym)) {
+                lineReader.setSymbol(sym);
+                lineReader.setUtil(util);
+                lineReader.setParent(rendererElement);
+                lineReader.read();
+            }
+            else if(fillReader.canRead(sym)) {
+                fillReader.setSymbol(sym);
+                fillReader.setUtil(util);
+                fillReader.setParent(rendererElement);
+                fillReader.read();
+            }
+            else {
+                logger.debug("Not a known symbol type: " +
+                             sym.getClass().toString());
             }
         }
         return layer;
--- a/src/java/de/intevation/mxd/reader/FeatureLayerReader.java	Thu May 26 16:13:50 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/FeatureLayerReader.java	Fri May 27 12:54:55 2011 +0200
@@ -62,16 +62,9 @@
      * @return The layer XML element.
      */
     public Element read()
-    throws IOException {
+    throws Exception {
         logger.debug("read()");
-        Element layerElement;
-        try {
-            layerElement = util.addLayer();
-        }
-        catch(Exception e) {
-            e.printStackTrace();
-            return null;
-        }
+        Element layerElement = util.addLayer();
 
         layerElement.setAttribute("name", layer.getName());
         layerElement.setAttribute("min_scale",
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java/de/intevation/mxd/reader/FillSymbolReader.java	Fri May 27 12:54:55 2011 +0200
@@ -0,0 +1,138 @@
+package de.intevation.mxd.reader;
+
+import java.lang.Exception;
+
+import org.w3c.dom.Element;
+
+import org.apache.log4j.Logger;
+
+import com.esri.arcgis.display.ISymbol;
+import com.esri.arcgis.display.IFillSymbol;
+import com.esri.arcgis.display.MultiLayerFillSymbol;
+import com.esri.arcgis.display.SimpleFillSymbol;
+import com.esri.arcgis.display.MarkerFillSymbol;
+import com.esri.arcgis.display.LineFillSymbol;
+
+/**
+ * Wrapper for fill symbol reader.
+ *
+ * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a>
+ */
+public class FillSymbolReader
+extends AbstractSymbolReader {
+
+    /**
+     * The logger.
+     */
+    private static final Logger logger =
+        Logger.getLogger(FillSymbolReader.class);
+
+    private ISymbol symbol;
+    private IFillSymbol fillSymbol;
+
+    public FillSymbolReader() throws Exception{
+        logger.debug("contructor()");
+        this.symbol = null;
+        this.fillSymbol = null;
+    }
+
+    public FillSymbolReader(ISymbol symbol) throws Exception{
+        logger.debug("contructor(ISymbol)");
+        this.symbol = symbol;
+        this.fillSymbol = null;
+    }
+
+    public FillSymbolReader(IFillSymbol symbol) throws Exception{
+        logger.debug("contructor(ILineSymbol)");
+        this.fillSymbol = symbol;
+        this.symbol= null;
+    }
+
+    public Element read() throws Exception {
+        ISymbolReader sreader = null;
+        if(symbol != null) {
+            if(symbol instanceof SimpleFillSymbol) {
+                sreader = new SimpleFillSymbolReader(symbol);
+            }
+            else if(symbol instanceof MultiLayerFillSymbol) {
+                sreader = new MultiLayerFillSymbolReader(symbol);
+            }
+            else if(symbol instanceof MarkerFillSymbol) {
+                sreader = new MarkerFillSymbolReader(symbol);
+            }
+            else if(symbol instanceof LineFillSymbol) {
+                sreader = new LineFillSymbolReader(symbol);
+            }
+            else {
+                logger.debug("The reader for type " + symbol.getClass().toString() +
+                             " is not implemented!");
+                return parent;
+            }
+        }
+        else if(fillSymbol != null) {
+            if(fillSymbol instanceof SimpleFillSymbol) {
+                sreader = new SimpleFillSymbolReader(fillSymbol);
+            }
+            else if(fillSymbol instanceof MultiLayerFillSymbol) {
+                sreader = new MultiLayerFillSymbolReader(fillSymbol);
+            }
+            else if(fillSymbol instanceof MarkerFillSymbol) {
+                sreader = new MarkerFillSymbolReader(fillSymbol);
+            }
+            else if(fillSymbol instanceof LineFillSymbol) {
+                sreader = new LineFillSymbolReader(fillSymbol);
+            }
+            else {
+                logger.debug("The reader for type " +
+                             fillSymbol.getClass().toString() +
+                             " is not implemented!");
+                return parent;
+            }
+        }
+        else {
+            return parent;
+        }
+        if (sreader != null) {
+            sreader.setParent(parent);
+            sreader.setUtil(util);
+            sreader.read();
+        }
+        return parent;
+    }
+
+    public void setSymbol(ISymbol sym) {
+        this.symbol = sym;
+        this.fillSymbol = null;
+    }
+
+    public void setSymbol(IFillSymbol sym) {
+        this.symbol = null;
+        this.fillSymbol = sym;
+    }
+
+    public boolean canRead(ISymbol sym) {
+        if(sym instanceof SimpleFillSymbol ||
+           sym instanceof MarkerFillSymbol ||
+           sym instanceof MultiLayerFillSymbol ||
+           sym instanceof LineFillSymbol) {
+            return true;
+        }
+        else {
+            return false;
+        }
+    }
+
+    public boolean canRead(IFillSymbol sym) {
+        if(sym instanceof SimpleFillSymbol ||
+           sym instanceof MarkerFillSymbol ||
+           sym instanceof MultiLayerFillSymbol ||
+           sym instanceof LineFillSymbol) {
+            return true;
+        }
+        else {
+            return false;
+        }
+    }
+
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/src/java/de/intevation/mxd/reader/GdbRasterCatalogLayerReader.java	Thu May 26 16:13:50 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/GdbRasterCatalogLayerReader.java	Fri May 27 12:54:55 2011 +0200
@@ -58,16 +58,9 @@
      * @return The layer XML element.
      */
     public Element read()
-    throws IOException {
+    throws Exception {
         logger.debug("read()");
-        Element layerElement;
-        try {
-            layerElement = util.addLayer();
-        }
-        catch(Exception e) {
-            e.printStackTrace();
-            return null;
-        }
+        Element layerElement = util.addLayer();
 
         layerElement.setAttribute("name", layer.getName());
         layerElement.setAttribute("min_scale",
--- a/src/java/de/intevation/mxd/reader/HashLineSymbolReader.java	Thu May 26 16:13:50 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/HashLineSymbolReader.java	Fri May 27 12:54:55 2011 +0200
@@ -94,14 +94,7 @@
     public Element read()
     throws IOException {
         logger.debug("read()");
-        Element symbolElement;
-        try {
-            symbolElement = util.addSymbol(renderer);
-        }
-        catch(Exception e) {
-            e.printStackTrace();
-            return null;
-        }
+        Element symbolElement = util.addSymbol(renderer);
 
         symbolElement.setAttribute("name", symbol.getNameString());
         symbolElement.setAttribute("style", "line");
--- a/src/java/de/intevation/mxd/reader/ILayerReader.java	Thu May 26 16:13:50 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/ILayerReader.java	Fri May 27 12:54:55 2011 +0200
@@ -14,7 +14,7 @@
 public interface ILayerReader{
 
     void setUtil(MapToXMLUtils util);
-    Element read() throws IOException;
+    Element read() throws Exception;
 
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/src/java/de/intevation/mxd/reader/IRendererReader.java	Thu May 26 16:13:50 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/IRendererReader.java	Fri May 27 12:54:55 2011 +0200
@@ -1,6 +1,6 @@
 package de.intevation.mxd.reader;
 
-import java.io.IOException;
+import java.lang.Exception;
 
 import org.w3c.dom.Element;
 
@@ -13,7 +13,7 @@
  */
 public interface IRendererReader{
 
-    Element read() throws IOException;
+    Element read() throws Exception;
 
     void setParent(Element parent);
     void setUtil(MapToXMLUtils util);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java/de/intevation/mxd/reader/LineFillSymbolReader.java	Fri May 27 12:54:55 2011 +0200
@@ -0,0 +1,133 @@
+package de.intevation.mxd.reader;
+
+import java.io.IOException;
+
+import java.awt.Color;
+
+import org.apache.log4j.Logger;
+
+import com.esri.arcgis.display.ISymbol;
+import com.esri.arcgis.display.IFillSymbol;
+import com.esri.arcgis.display.ILineSymbol;
+import com.esri.arcgis.display.LineFillSymbol;
+import com.esri.arcgis.display.esriSimpleFillStyle;
+import com.esri.arcgis.display.MultiLayerMarkerSymbol;
+import com.esri.arcgis.display.IRgbColor;
+import com.esri.arcgis.display.RgbColor;
+
+import org.w3c.dom.Element;
+import de.intevation.mxd.utils.MapToXMLUtils;
+
+/**
+ * Reads marker line symbol information.
+ *
+ * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a>
+ */
+public class LineFillSymbolReader
+extends AbstractSymbolReader{
+
+    /**
+     * The logger.
+     */
+    private static final Logger logger =
+        Logger.getLogger(LineFillSymbolReader.class);
+
+    /**
+     * Private member.
+     */
+    private LineFillSymbol symbol;
+
+
+    public LineFillSymbolReader(ISymbol symbol)
+    throws Exception {
+        logger.debug("contructor()");
+        if(symbol instanceof LineFillSymbol) {
+            this.symbol = (LineFillSymbol)symbol;
+        }
+        else {
+            throw new Exception("Not a LineFillSymbol!");
+        }
+    }
+
+
+    public LineFillSymbolReader(IFillSymbol symbol)
+    throws Exception {
+        logger.debug("contructor()");
+        if(symbol instanceof LineFillSymbol) {
+            this.symbol = (LineFillSymbol)symbol;
+        }
+        else {
+            throw new Exception("Not a LineFillSymbol!");
+        }
+    }
+
+    /**
+     * Reads the symbol attributes.
+     *
+     * @return The XML node.
+     */
+    public Element read()
+    throws Exception {
+        logger.debug("read()");
+
+        Element symbolElement = util.addSymbol(parent);
+
+        symbolElement.setAttribute("name", symbol.getNameString());
+        symbolElement.setAttribute("style", "fill");
+        symbolElement.setAttribute(
+            "offset",
+            String.valueOf(symbol.getOffset()));
+        symbolElement.setAttribute(
+            "separation",
+            String.valueOf(symbol.getSeparation()));
+
+        if(symbol.getColor() instanceof IRgbColor) {
+            IRgbColor color = (IRgbColor)symbol.getColor();
+            Color c = new Color (
+                color.getRed(),
+                color.getGreen(),
+                color.getBlue());
+            symbolElement.setAttribute("color", String.valueOf(c.getRGB()));
+            symbolElement.setAttribute("transparency",
+                String.valueOf(color.getTransparency()));
+        }
+        else {
+            RgbColor col = new RgbColor();
+            col.setRGB(symbol.getColor().getRGB());
+            Color c = new Color (
+                col.getRed(),
+                col.getGreen(),
+                col.getBlue());
+            symbolElement.setAttribute("color", String.valueOf(c.getRGB()));
+            symbolElement.setAttribute("transparency",
+                String.valueOf(col.getTransparency()));
+        }
+
+        ILineSymbol ols = symbol.getOutline();
+        LineSymbolReader olsr = new LineSymbolReader();
+        if(olsr.canRead(ols)) {
+            olsr.setSymbol(ols);
+            olsr.setUtil(util);
+            olsr.setParent(symbolElement);
+            olsr.read();
+        }
+        else {
+            logger.debug("The type of " + ols.getClass().toString() +
+                         " is not implemented!");
+        }
+        ILineSymbol ls = symbol.getLineSymbol();
+        LineSymbolReader lsr = new LineSymbolReader();
+        if(lsr.canRead(ls)) {
+            lsr.setSymbol(ls);
+            lsr.setUtil(util);
+            lsr.setParent(symbolElement);
+            lsr.read();
+        }
+        else {
+            logger.debug("The type of " + ls.getClass().toString() +
+                         " is not implemented!");
+        }
+        return parent;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/src/java/de/intevation/mxd/reader/LineSymbolReader.java	Thu May 26 16:13:50 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/LineSymbolReader.java	Fri May 27 12:54:55 2011 +0200
@@ -116,6 +116,12 @@
 
     public void setSymbol(ISymbol sym) {
         this.symbol = sym;
+        this.lineSymbol = null;
+    }
+
+    public void setSymbol(ILineSymbol sym) {
+        this.lineSymbol = sym;
+        this.symbol = null;
     }
 
     public boolean canRead(ISymbol sym) {
@@ -131,5 +137,19 @@
             return false;
         }
     }
+
+    public boolean canRead(ILineSymbol sym) {
+        if(sym instanceof SimpleLineSymbol ||
+           sym instanceof MarkerLineSymbol ||
+           sym instanceof PictureLineSymbol ||
+           sym instanceof MultiLayerLineSymbol ||
+           sym instanceof CartographicLineSymbol ||
+           sym instanceof HashLineSymbol) {
+            return true;
+        }
+        else {
+            return false;
+        }
+    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/src/java/de/intevation/mxd/reader/MXDReader.java	Thu May 26 16:13:50 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/MXDReader.java	Fri May 27 12:54:55 2011 +0200
@@ -120,6 +120,7 @@
             for(int i = 0; i < map.getLayerCount();i++) {
                 ILayer layer = map.getLayer(i);
                 try {
+                    //TODO Implement wrapper for renderer reader
                     if (layer instanceof FeatureLayer) {
                         FeatureLayerReader lr = new FeatureLayerReader(layer);
                         lr.setUtil(util);
@@ -184,6 +185,7 @@
                 }
                 catch(Exception e) {
                     e.printStackTrace();
+                    return false;
                 }
             }
             util.print();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java/de/intevation/mxd/reader/MarkerFillSymbolReader.java	Fri May 27 12:54:55 2011 +0200
@@ -0,0 +1,180 @@
+package de.intevation.mxd.reader;
+
+import java.io.IOException;
+
+import java.awt.Color;
+
+import org.apache.log4j.Logger;
+
+import com.esri.arcgis.display.ISymbol;
+import com.esri.arcgis.display.IFillSymbol;
+import com.esri.arcgis.display.ILineSymbol;
+import com.esri.arcgis.display.IMarkerSymbol;
+import com.esri.arcgis.display.MarkerFillSymbol;
+import com.esri.arcgis.display.esriSimpleFillStyle;
+import com.esri.arcgis.display.MultiLayerMarkerSymbol;
+import com.esri.arcgis.display.IRgbColor;
+import com.esri.arcgis.display.RgbColor;
+
+import org.w3c.dom.Element;
+import de.intevation.mxd.utils.MapToXMLUtils;
+
+/**
+ * Reads marker line symbol information.
+ *
+ * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a>
+ */
+public class MarkerFillSymbolReader implements ISymbolReader{
+
+    /**
+     * The logger.
+     */
+    private static final Logger logger =
+        Logger.getLogger(MarkerFillSymbolReader.class);
+
+    /**
+     * Private member.
+     */
+    private Element renderer;
+    private MarkerFillSymbol symbol;
+    private MapToXMLUtils util;
+
+
+    public MarkerFillSymbolReader(ISymbol symbol)
+    throws Exception {
+        logger.debug("contructor()");
+        if(symbol instanceof MarkerFillSymbol) {
+            this.symbol = (MarkerFillSymbol)symbol;
+        }
+        else {
+            throw new Exception("Not a MarkerFillSymbol!");
+        }
+    }
+
+
+    public MarkerFillSymbolReader(IFillSymbol symbol)
+    throws Exception {
+        logger.debug("contructor()");
+        if(symbol instanceof MarkerFillSymbol) {
+            this.symbol = (MarkerFillSymbol)symbol;
+        }
+        else {
+            throw new Exception("Not a MarkerFillSymbol!");
+        }
+    }
+
+    /**
+     * Setter for the parent XML element.
+     *
+     * @param parent The XML parent node.
+     */
+    public void setParent(Element parent) {
+        this.renderer = parent;
+    }
+
+    /**
+     * Setter for XML document helper.
+     *
+     * @param util The helper class for storing map information.
+     */
+    public void setUtil(MapToXMLUtils util) {
+        this.util = util;
+    }
+
+    /**
+     * Reads the symbol attributes.
+     *
+     * @return The XML node.
+     */
+    public Element read()
+    throws Exception {
+        logger.debug("read()");
+
+        Element symbolElement = util.addSymbol(renderer);
+
+        symbolElement.setAttribute("name", symbol.getNameString());
+        symbolElement.setAttribute("style", "fill");
+        symbolElement.setAttribute(
+            "xoffset",
+            String.valueOf(symbol.getXOffset()));
+        symbolElement.setAttribute(
+            "yoffset",
+            String.valueOf(symbol.getYOffset()));
+        symbolElement.setAttribute(
+            "xseparation",
+            String.valueOf(symbol.getXSeparation()));
+        symbolElement.setAttribute(
+            "yseparation",
+            String.valueOf(symbol.getYSeparation()));
+
+        int style = symbol.getStyle();
+        switch(style) {
+            case esriSimpleFillStyle.esriSFSCross:
+                symbolElement.setAttribute("fillstyle", "cross"); break;
+            case esriSimpleFillStyle.esriSFSSolid:
+                symbolElement.setAttribute("fillstyle", "solid"); break;
+            case esriSimpleFillStyle.esriSFSVertical:
+                symbolElement.setAttribute("fillstyle", "vertical"); break;
+            case esriSimpleFillStyle.esriSFSHorizontal:
+                symbolElement.setAttribute("fillstyle", "horizontal"); break;
+            case esriSimpleFillStyle.esriSFSForwardDiagonal:
+                symbolElement.setAttribute("fillstyle", "fwdiagonal"); break;
+            case esriSimpleFillStyle.esriSFSBackwardDiagonal:
+                symbolElement.setAttribute("fillstyle", "bwdiagonal"); break;
+            case esriSimpleFillStyle.esriSFSDiagonalCross:
+                symbolElement.setAttribute("fillstyle", "diagonalcross");
+                break;
+            default: symbolElement.setAttribute("fillstyle", "empty");
+        }
+
+        if(symbol.getColor() instanceof IRgbColor) {
+            IRgbColor color = (IRgbColor)symbol.getColor();
+            Color c = new Color (
+                color.getRed(),
+                color.getGreen(),
+                color.getBlue());
+            symbolElement.setAttribute("color", String.valueOf(c.getRGB()));
+            symbolElement.setAttribute("transparency",
+                String.valueOf(color.getTransparency()));
+        }
+        else {
+            RgbColor col = new RgbColor();
+            col.setRGB(symbol.getColor().getRGB());
+            Color c = new Color (
+                col.getRed(),
+                col.getGreen(),
+                col.getBlue());
+            symbolElement.setAttribute("color", String.valueOf(c.getRGB()));
+            symbolElement.setAttribute("transparency",
+                String.valueOf(col.getTransparency()));
+        }
+
+        ILineSymbol ls = symbol.getOutline();
+        LineSymbolReader lsr = new LineSymbolReader();
+        if(lsr.canRead(ls)) {
+            lsr.setSymbol(ls);
+            lsr.setUtil(util);
+            lsr.setParent(symbolElement);
+            lsr.read();
+        }
+        else {
+            logger.debug("The type of " + ls.getClass().toString() +
+                         " is not implemented!");
+        }
+
+        IMarkerSymbol sym = symbol.getMarkerSymbol();
+        MarkerSymbolReader msr = new MarkerSymbolReader();
+        if(msr.canRead(sym)) {
+            msr.setSymbol(sym);
+            msr.setParent(symbolElement);
+            msr.setUtil(util);
+            msr.read();
+        }
+        else {
+            logger.debug("The type of " + sym.getClass().toString() +
+                         " is not implemented!");
+        }
+        return renderer;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/src/java/de/intevation/mxd/reader/MarkerLineSymbolReader.java	Thu May 26 16:13:50 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/MarkerLineSymbolReader.java	Fri May 27 12:54:55 2011 +0200
@@ -86,23 +86,18 @@
      * @return The XML node.
      */
     public Element read()
-    throws IOException {
+    throws Exception {
         logger.debug("read()");
-        try {
-            IMarkerSymbol sym = symbol.getMarkerSymbol();
-            if(sym instanceof MultiLayerMarkerSymbol) {
-                ISymbolReader sreader = new MultiLayerMarkerSymbolReader(sym);
-                sreader.setParent(renderer);
-                sreader.setUtil(util);
-                sreader.read();
-            }
-            else {
-                logger.debug("The type of " + sym.getClass().toString() +
-                             " is not implemented!");
-            }
+        IMarkerSymbol sym = symbol.getMarkerSymbol();
+        if(sym instanceof MultiLayerMarkerSymbol) {
+            ISymbolReader sreader = new MultiLayerMarkerSymbolReader(sym);
+            sreader.setParent(renderer);
+            sreader.setUtil(util);
+            sreader.read();
         }
-        catch (Exception e) {
-            e.printStackTrace();
+        else {
+            logger.debug("The type of " + sym.getClass().toString() +
+                         " is not implemented!");
         }
         return renderer;
     }
--- a/src/java/de/intevation/mxd/reader/MarkerSymbolReader.java	Thu May 26 16:13:50 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/MarkerSymbolReader.java	Fri May 27 12:54:55 2011 +0200
@@ -7,6 +7,7 @@
 import org.apache.log4j.Logger;
 
 import com.esri.arcgis.display.ISymbol;
+import com.esri.arcgis.display.IMarkerSymbol;
 import com.esri.arcgis.display.SimpleMarkerSymbol;
 import com.esri.arcgis.display.ArrowMarkerSymbol;
 import com.esri.arcgis.display.CharacterMarkerSymbol;
@@ -25,57 +26,96 @@
      * The logger.
      */
     private static final Logger logger =
-        Logger.getLogger(SimpleFillSymbolReader.class);
+        Logger.getLogger(MarkerSymbolReader.class);
 
     private ISymbol symbol;
+    private IMarkerSymbol markerSymbol;
 
     public MarkerSymbolReader(ISymbol symbol)
     throws Exception {
         logger.debug("contructor(ISymbol)");
         this.symbol = symbol;
+        this.markerSymbol = null;
+    }
+
+    public MarkerSymbolReader(IMarkerSymbol symbol)
+    throws Exception {
+        logger.debug("contructor(ISymbol)");
+        this.markerSymbol = symbol;
+        this.symbol = null;
     }
 
     public MarkerSymbolReader() {
         logger.debug("contructor()");
         this.symbol = null;
+        this.markerSymbol = null;
     }
 
-    public Element read() throws Exception {
-        if(symbol == null) {
-            return parent;
-        }
+    public Element read()
+    throws Exception {
+        logger.debug("read()");
+        ISymbolReader sreader = null;
 
-        ISymbolReader sreader = null;
-        if(symbol instanceof SimpleMarkerSymbol) {
-            sreader = new SimpleMarkerSymbolReader(symbol);
-        }
-        else if(symbol instanceof ArrowMarkerSymbol) {
-            sreader = new ArrowMarkerSymbolReader(symbol);
+        if(symbol != null) {
+            if(symbol instanceof SimpleMarkerSymbol) {
+                sreader = new SimpleMarkerSymbolReader(symbol);
+            }
+            else if(symbol instanceof ArrowMarkerSymbol) {
+                sreader = new ArrowMarkerSymbolReader(symbol);
+            }
+            else if(symbol instanceof CharacterMarkerSymbol) {
+                sreader = new CharacterMarkerSymbolReader(symbol);
+            }
+            else if(symbol instanceof PictureMarkerSymbol) {
+                sreader = new PictureMarkerSymbolReader(symbol);
+            }
+            else if(symbol instanceof MultiLayerMarkerSymbol) {
+                sreader = new MultiLayerMarkerSymbolReader(symbol);
+            }
+            else {
+                logger.debug("The reader for type " + symbol.getClass().toString() +
+                             " is not implemented!");
+                return parent;
+            }
         }
-        else if(symbol instanceof CharacterMarkerSymbol) {
-            sreader = new CharacterMarkerSymbolReader(symbol);
-        }
-        else if(symbol instanceof PictureMarkerSymbol) {
-            sreader = new PictureMarkerSymbolReader(symbol);
-        }
-        else if(symbol instanceof MultiLayerMarkerSymbol) {
-            sreader = new MultiLayerMarkerSymbolReader(symbol);
-        }
-        else {
-            logger.debug("The reader for type " + symbol.getClass().toString() +
-                         " is not implemented!");
-            return parent;
+        else if(markerSymbol != null) {
+            if(markerSymbol instanceof SimpleMarkerSymbol) {
+                sreader = new SimpleMarkerSymbolReader(markerSymbol);
+            }
+            else if(markerSymbol instanceof ArrowMarkerSymbol) {
+                sreader = new ArrowMarkerSymbolReader(markerSymbol);
+            }
+            else if(markerSymbol instanceof CharacterMarkerSymbol) {
+                sreader = new CharacterMarkerSymbolReader(markerSymbol);
+            }
+            else if(markerSymbol instanceof PictureMarkerSymbol) {
+                sreader = new PictureMarkerSymbolReader(markerSymbol);
+            }
+            else if(markerSymbol instanceof MultiLayerMarkerSymbol) {
+                sreader = new MultiLayerMarkerSymbolReader(markerSymbol);
+            }
+            else {
+                logger.debug("The reader for type " + symbol.getClass().toString() +
+                             " is not implemented!");
+                return parent;
+            }
         }
         if (sreader != null) {
             sreader.setParent(parent);
             sreader.setUtil(util);
-            return sreader.read();
+            sreader.read();
         }
         return parent;
     }
 
     public void setSymbol(ISymbol sym) {
         this.symbol = sym;
+        this.markerSymbol = null;
+    }
+
+    public void setSymbol(IMarkerSymbol sym) {
+        this.markerSymbol = sym;
+        this.symbol = null;
     }
 
     public boolean canRead(ISymbol sym) {
@@ -91,4 +131,17 @@
         }
     }
 
+    public boolean canRead(IMarkerSymbol sym) {
+        if(sym instanceof SimpleMarkerSymbol ||
+           sym instanceof ArrowMarkerSymbol ||
+           sym instanceof PictureMarkerSymbol ||
+           sym instanceof CharacterMarkerSymbol ||
+           sym instanceof MultiLayerMarkerSymbol) {
+            return true;
+        }
+        else {
+            return false;
+        }
+    }
+
 }
--- a/src/java/de/intevation/mxd/reader/MultiLayerFillSymbolReader.java	Thu May 26 16:13:50 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/MultiLayerFillSymbolReader.java	Fri May 27 12:54:55 2011 +0200
@@ -87,26 +87,21 @@
      * @return The XML node.
      */
     public Element read()
-    throws IOException {
+    throws Exception {
         logger.debug("read()");
         for(int i = 0; i < symbol.getLayerCount(); i++) {
-            try {
-                ISymbol sym = (ISymbol)symbol.getLayer(i);
+            ISymbol sym = (ISymbol)symbol.getLayer(i);
 
-                if(sym instanceof SimpleFillSymbol) {
-                    ISymbolReader sreader = new SimpleFillSymbolReader(sym);
-                    sreader.setParent(renderer);
-                    sreader.setUtil(util);
-                    sreader.read();
-                }
-                else {
-                    logger.debug("The type of " + sym.getClass().toString() +
-                                 " is not implemented!");
-                }
+            FillSymbolReader fsr = new FillSymbolReader();
+            if(fsr.canRead(sym)) {
+                fsr.setSymbol(sym);
+                fsr.setParent(renderer);
+                fsr.setUtil(util);
+                fsr.read();
             }
-            catch(Exception e) {
-                e.printStackTrace();
-                return null;
+            else {
+                logger.debug("The type of " + sym.getClass().toString() +
+                             " is not implemented!");
             }
         }
         return renderer;
--- a/src/java/de/intevation/mxd/reader/MultiLayerLineSymbolReader.java	Thu May 26 16:13:50 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/MultiLayerLineSymbolReader.java	Fri May 27 12:54:55 2011 +0200
@@ -89,20 +89,14 @@
      * @return The XML node.
      */
     public Element read()
-    throws IOException {
+    throws Exception {
         logger.debug("read()");
         for(int i = 0; i < symbol.getLayerCount(); i++) {
-            try {
-                ISymbol sym = (ISymbol)symbol.getLayer(i);
-                ISymbolReader sreader = new LineSymbolReader(sym);
-                sreader.setParent(renderer);
-                sreader.setUtil(util);
-                sreader.read();
-            }
-            catch(Exception e) {
-                e.printStackTrace();
-                return null;
-            }
+            ISymbol sym = (ISymbol)symbol.getLayer(i);
+            ISymbolReader sreader = new LineSymbolReader(sym);
+            sreader.setParent(renderer);
+            sreader.setUtil(util);
+            sreader.read();
         }
         return renderer;
     }
--- a/src/java/de/intevation/mxd/reader/MultiLayerMarkerSymbolReader.java	Thu May 26 16:13:50 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/MultiLayerMarkerSymbolReader.java	Fri May 27 12:54:55 2011 +0200
@@ -79,19 +79,14 @@
      * @return The XML node.
      */
     public Element read()
-    throws IOException {
+    throws Exception {
         logger.debug("read()");
         for(int i = 0; i < symbol.getLayerCount(); i++) {
-            try {
-                ISymbol sym = (ISymbol)symbol.getLayer(i);
-                ISymbolReader sreader = new MarkerSymbolReader(sym);
-                sreader.setParent(renderer);
-                sreader.setUtil(util);
-                sreader.read();
-            }
-            catch(Exception e) {
-                e.printStackTrace();
-            }
+            ISymbol sym = (ISymbol)symbol.getLayer(i);
+            ISymbolReader sreader = new MarkerSymbolReader(sym);
+            sreader.setParent(renderer);
+            sreader.setUtil(util);
+            sreader.read();
         }
         return renderer;
     }
--- a/src/java/de/intevation/mxd/reader/PictureLineSymbolReader.java	Thu May 26 16:13:50 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/PictureLineSymbolReader.java	Fri May 27 12:54:55 2011 +0200
@@ -86,16 +86,9 @@
      * @return The XML node.
      */
     public Element read()
-    throws IOException {
+    throws Exception {
         logger.debug("read()");
-        Element symbolElement;
-        try {
-            symbolElement = util.addSymbol(renderer);
-        }
-        catch(Exception e) {
-            e.printStackTrace();
-            return null;
-        }
+        Element symbolElement = util.addSymbol(renderer);
 
         symbolElement.setAttribute("name", symbol.getNameString());
         symbolElement.setAttribute("style", "picture");
--- a/src/java/de/intevation/mxd/reader/PictureMarkerSymbolReader.java	Thu May 26 16:13:50 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/PictureMarkerSymbolReader.java	Fri May 27 12:54:55 2011 +0200
@@ -82,16 +82,9 @@
      * @return The XML node.
      */
     public Element read()
-    throws IOException {
+    throws Exception {
         logger.debug("read()");
-        Element symbolElement;
-        try {
-            symbolElement = util.addSymbol(renderer);
-        }
-        catch(Exception e) {
-            e.printStackTrace();
-            return null;
-        }
+        Element symbolElement = util.addSymbol(renderer);
 
         symbolElement.setAttribute(
             "angle",
--- a/src/java/de/intevation/mxd/reader/SimpleFillSymbolReader.java	Thu May 26 16:13:50 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/SimpleFillSymbolReader.java	Fri May 27 12:54:55 2011 +0200
@@ -7,13 +7,8 @@
 
 import com.esri.arcgis.display.ISymbol;
 import com.esri.arcgis.display.ILineSymbol;
+import com.esri.arcgis.display.IFillSymbol;
 import com.esri.arcgis.display.SimpleFillSymbol;
-import com.esri.arcgis.display.MultiLayerLineSymbol;
-import com.esri.arcgis.display.SimpleLineSymbol;
-import com.esri.arcgis.display.MarkerLineSymbol;
-import com.esri.arcgis.display.PictureLineSymbol;
-import com.esri.arcgis.display.CartographicLineSymbol;
-import com.esri.arcgis.display.HashLineSymbol;
 import com.esri.arcgis.display.MultiLayerFillSymbol;
 import com.esri.arcgis.display.esriSimpleFillStyle;
 import com.esri.arcgis.display.IRgbColor;
@@ -46,7 +41,17 @@
 
 
     public SimpleFillSymbolReader(ISymbol symbol) throws Exception{
-        logger.debug("contructor()");
+        logger.debug("contructor(ISymbol)");
+        if(symbol instanceof SimpleFillSymbol) {
+            this.symbol = (SimpleFillSymbol)symbol;
+        }
+        else {
+            throw new Exception("Not a SimpleFillSymbol!");
+        }
+    }
+
+    public SimpleFillSymbolReader(IFillSymbol symbol) throws Exception{
+        logger.debug("contructor(IFillSymbol)");
         if(symbol instanceof SimpleFillSymbol) {
             this.symbol = (SimpleFillSymbol)symbol;
         }
@@ -79,16 +84,9 @@
      * @return The XML node.
      */
     public Element read()
-    throws IOException {
+    throws Exception {
         logger.debug("read()");
-        Element symbolElement;
-        try {
-            symbolElement = util.addSymbol(renderer);
-        }
-        catch(Exception e) {
-            e.printStackTrace();
-            return null;
-        }
+        Element symbolElement = util.addSymbol(renderer);
 
         symbolElement.setAttribute("name", symbol.getNameString());
         symbolElement.setAttribute("style", "fill");
@@ -134,51 +132,17 @@
                 String.valueOf(col.getTransparency()));
         }
 
-        try {
-            ILineSymbol ls = symbol.getOutline();
-            if(ls instanceof MultiLayerLineSymbol) {
-                ISymbolReader sreader = new MultiLayerLineSymbolReader(ls);
-                sreader.setParent(symbolElement);
-                sreader.setUtil(util);
-                sreader.read();
-            }
-            else if(ls instanceof SimpleLineSymbol) {
-                ISymbolReader sreader = new SimpleLineSymbolReader(ls);
-                sreader.setParent(symbolElement);
-                sreader.setUtil(util);
-                sreader.read();
-            }
-            else if(ls instanceof MarkerLineSymbol) {
-                ISymbolReader sreader = new MarkerLineSymbolReader(ls);
-                sreader.setParent(symbolElement);
-                sreader.setUtil(util);
-                sreader.read();
-            }
-            else if(ls instanceof PictureLineSymbol) {
-                ISymbolReader sreader = new PictureLineSymbolReader(ls);
-                sreader.setParent(symbolElement);
-                sreader.setUtil(util);
-                sreader.read();
-            }
-            else if(ls instanceof CartographicLineSymbol) {
-                ISymbolReader sreader = new CartoLineSymbolReader(ls);
-                sreader.setParent(symbolElement);
-                sreader.setUtil(util);
-                sreader.read();
-            }
-            else if(ls instanceof HashLineSymbol) {
-                ISymbolReader sreader = new HashLineSymbolReader(ls);
-                sreader.setParent(symbolElement);
-                sreader.setUtil(util);
-                sreader.read();
-            }
-            else {
-                logger.debug("The type of " + ls.getClass().toString() +
-                             " is not implemented!");
-            }
+        ILineSymbol ls = symbol.getOutline();
+        LineSymbolReader lsr = new LineSymbolReader();
+        if(lsr.canRead(ls)) {
+            lsr.setSymbol(ls);
+            lsr.setUtil(util);
+            lsr.setParent(symbolElement);
+            lsr.read();
         }
-        catch(Exception e) {
-            e.printStackTrace();
+        else {
+            logger.debug("The type of " + ls.getClass().toString() +
+                         " is not implemented!");
         }
 
         return symbolElement;
--- a/src/java/de/intevation/mxd/reader/SimpleLineSymbolReader.java	Thu May 26 16:13:50 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/SimpleLineSymbolReader.java	Fri May 27 12:54:55 2011 +0200
@@ -84,16 +84,9 @@
      * @return The XML node.
      */
     public Element read()
-    throws IOException {
+    throws Exception {
         logger.debug("read()");
-        Element symbolElement;
-        try {
-            symbolElement = util.addSymbol(renderer);
-        }
-        catch(Exception e) {
-            e.printStackTrace();
-            return null;
-        }
+        Element symbolElement = util.addSymbol(renderer);
 
         symbolElement.setAttribute("name", symbol.getNameString());
         symbolElement.setAttribute("style", "line");
--- a/src/java/de/intevation/mxd/reader/SimpleMarkerSymbolReader.java	Thu May 26 16:13:50 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/SimpleMarkerSymbolReader.java	Fri May 27 12:54:55 2011 +0200
@@ -7,6 +7,7 @@
 import org.apache.log4j.Logger;
 
 import com.esri.arcgis.display.ISymbol;
+import com.esri.arcgis.display.IMarkerSymbol;
 import com.esri.arcgis.display.SimpleMarkerSymbol;
 import com.esri.arcgis.display.esriSimpleMarkerStyle;
 import com.esri.arcgis.display.IRgbColor;
@@ -35,8 +36,18 @@
      */
     private SimpleMarkerSymbol symbol;
 
+    public SimpleMarkerSymbolReader(ISymbol symbol)
+    throws Exception {
+        logger.debug("contructor()");
+        if(symbol instanceof SimpleMarkerSymbol) {
+            this.symbol = (SimpleMarkerSymbol)symbol;
+        }
+        else {
+            throw new Exception("Not a SimpleMarkerSymbol!");
+        }
+    }
 
-    public SimpleMarkerSymbolReader(ISymbol symbol)
+    public SimpleMarkerSymbolReader(IMarkerSymbol symbol)
     throws Exception {
         logger.debug("contructor()");
         if(symbol instanceof SimpleMarkerSymbol) {
@@ -53,16 +64,9 @@
      * @return The XML node.
      */
     public Element read()
-    throws IOException {
+    throws Exception {
         logger.debug("read()");
-        Element symbolElement;
-        try {
-            symbolElement = util.addSymbol(parent);
-        }
-        catch(Exception e) {
-            e.printStackTrace();
-            return null;
-        }
+        Element symbolElement = util.addSymbol(parent);
 
         symbolElement.setAttribute("name", symbol.getNameString());
         if(symbol.getStyle() == esriSimpleMarkerStyle.esriSMSCircle)
--- a/src/java/de/intevation/mxd/reader/SimpleRendererReader.java	Thu May 26 16:13:50 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/SimpleRendererReader.java	Fri May 27 12:54:55 2011 +0200
@@ -75,39 +75,40 @@
      * @return The XML node.
      */
     public Element read()
-    throws IOException {
+    throws Exception {
         logger.debug("read()");
         Element rendererElement;
-        try {
-            rendererElement = util.addRenderer(layer);
-
-            rendererElement.setAttribute("label", renderer.getLabel());
-            rendererElement.setAttribute("description", renderer.getDescription());
-            symbol = renderer.getSymbol();
+        rendererElement = util.addRenderer(layer);
 
-            MarkerSymbolReader markerReader = new MarkerSymbolReader();
-            LineSymbolReader lineReader = new LineSymbolReader();
-            if(markerReader.canRead(symbol)) {
-                markerReader.setSymbol(symbol);
-                markerReader.setUtil(util);
-                markerReader.setParent(rendererElement);
-                markerReader.read();
-            }
-            else if(lineReader.canRead(symbol)) {
-                lineReader.setSymbol(symbol);
-                lineReader.setUtil(util);
-                lineReader.setParent(rendererElement);
-                lineReader.read();
-            }
-            else {
-                logger.debug("No known Symbol type: " + symbol.getClass().toString());
-            }
-            return layer;
+        rendererElement.setAttribute("label", renderer.getLabel());
+        rendererElement.setAttribute("description", renderer.getDescription());
+        symbol = renderer.getSymbol();
+
+        MarkerSymbolReader markerReader = new MarkerSymbolReader();
+        LineSymbolReader lineReader = new LineSymbolReader();
+        FillSymbolReader fillReader = new FillSymbolReader();
+        if(markerReader.canRead(symbol)) {
+            markerReader.setSymbol(symbol);
+            markerReader.setUtil(util);
+            markerReader.setParent(rendererElement);
+            markerReader.read();
         }
-        catch(Exception e) {
-            e.printStackTrace();
-            return null;
+        else if(lineReader.canRead(symbol)) {
+            lineReader.setSymbol(symbol);
+            lineReader.setUtil(util);
+            lineReader.setParent(rendererElement);
+            lineReader.read();
         }
+        else if(fillReader.canRead(symbol)) {
+            fillReader.setSymbol(symbol);
+            fillReader.setUtil(util);
+            fillReader.setParent(rendererElement);
+            fillReader.read();
+        }
+        else {
+            logger.debug("No known Symbol type: " + symbol.getClass().toString());
+        }
+        return layer;
     }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/src/java/de/intevation/mxd/reader/UniqueValueRendererReader.java	Thu May 26 16:13:50 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/UniqueValueRendererReader.java	Fri May 27 12:54:55 2011 +0200
@@ -69,37 +69,52 @@
      * @return The parent XML node.
      */
     public Element read()
-    throws IOException {
+    throws Exception {
         logger.debug("read()");
         for(int i = 0; i < renderer.getClassCount() - 1; i++) {
-            Element rendererElement;
-            try {
-                rendererElement = util.addRenderer(layer);
+            Element rendererElement = util.addRenderer(layer);
 
-                String value = renderer.getValue(i);
-                rendererElement.setAttribute("name", renderer.esri_getClass(i));
-                rendererElement.setAttribute("description",
-                renderer.getDescription(value));
-                rendererElement.setAttribute("value", value);
-                rendererElement.setAttribute("label", renderer.getLabel(value));
+            String value = renderer.getValue(i);
+            rendererElement.setAttribute("name", renderer.esri_getClass(i));
+            rendererElement.setAttribute("description",
+            renderer.getDescription(value));
+            rendererElement.setAttribute("value", value);
+            rendererElement.setAttribute("label", renderer.getLabel(value));
+            rendererElement.setAttribute(
+                "field_count",
+                String.valueOf(renderer.getFieldCount()));
+            for(int j = 0; j < renderer.getFieldCount(); j++) {
                 rendererElement.setAttribute(
-                    "field_count",
-                    String.valueOf(renderer.getFieldCount()));
-                for(int j = 0; j < renderer.getFieldCount(); j++) {
-                    rendererElement.setAttribute(
-                        "expression_field_" + j,
-                        renderer.getField(j));
-                }
-                rendererElement.setAttribute("expression_operator", "=");
-                ISymbol symbol = renderer.getSymbol(value);
-                ISymbolReader symbolReader = new MarkerSymbolReader(symbol);
-                symbolReader.setUtil(util);
-                symbolReader.setParent(rendererElement);
-                symbolReader.read ();
+                    "expression_field_" + j,
+                    renderer.getField(j));
             }
-            catch(Exception e) {
-                e.printStackTrace();
-                return null;
+            rendererElement.setAttribute("expression_operator", "=");
+
+            ISymbol sym = renderer.getSymbol(value);
+            MarkerSymbolReader markerReader = new MarkerSymbolReader();
+            LineSymbolReader lineReader = new LineSymbolReader();
+            FillSymbolReader fillReader = new FillSymbolReader();
+            if(markerReader.canRead(sym)) {
+                markerReader.setSymbol(sym);
+                markerReader.setUtil(util);
+                markerReader.setParent(rendererElement);
+                markerReader.read();
+            }
+            else if(lineReader.canRead(sym)) {
+                lineReader.setSymbol(sym);
+                lineReader.setUtil(util);
+                lineReader.setParent(rendererElement);
+                lineReader.read();
+            }
+            else if(fillReader.canRead(sym)) {
+                fillReader.setSymbol(sym);
+                fillReader.setUtil(util);
+                fillReader.setParent(rendererElement);
+                fillReader.read();
+            }
+            else {
+                logger.debug("Not a known symbol type: " +
+                             sym.getClass().toString());
             }
         }
         return layer;
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)