diff src/java/de/intevation/mxd/reader/LineSymbolReader.java @ 71:260748e3d08f

Added wrapper for line symbol reader.
author Raimund Renkert <rrenkert@intevation.de>
date Thu, 26 May 2011 16:01:29 +0200
parents
children 2cbe423b1fda
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java/de/intevation/mxd/reader/LineSymbolReader.java	Thu May 26 16:01:29 2011 +0200
@@ -0,0 +1,135 @@
+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.ILineSymbol;
+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;
+
+/**
+ * Wrapper for line symbol reader.
+ *
+ * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a>
+ */
+public class LineSymbolReader
+extends AbstractSymbolReader {
+
+    /**
+     * The logger.
+     */
+    private static final Logger logger =
+        Logger.getLogger(LineSymbolReader.class);
+
+    private ISymbol symbol;
+    private ILineSymbol lineSymbol;
+
+    public LineSymbolReader() throws Exception{
+        logger.debug("contructor()");
+        this.symbol = null;
+        this.lineSymbol = null;
+    }
+
+    public LineSymbolReader(ISymbol symbol) throws Exception{
+        logger.debug("contructor(ISymbol)");
+        this.symbol = symbol;
+        this.lineSymbol = null;
+    }
+
+    public LineSymbolReader(ILineSymbol symbol) throws Exception{
+        logger.debug("contructor(ILineSymbol)");
+        this.lineSymbol = symbol;
+        this.symbol= null;
+    }
+
+    public Element read() throws Exception {
+        ISymbolReader sreader = null;
+        if(symbol != null) {
+            if(symbol instanceof SimpleLineSymbol) {
+                sreader = new SimpleLineSymbolReader(symbol);
+            }
+            else if(symbol instanceof MarkerLineSymbol) {
+                sreader = new MarkerLineSymbolReader(symbol);
+            }
+            else if(symbol instanceof PictureLineSymbol) {
+                sreader = new PictureLineSymbolReader(symbol);
+            }
+            else if(symbol instanceof MultiLayerLineSymbol) {
+                sreader = new MultiLayerLineSymbolReader(symbol);
+            }
+            else if(symbol instanceof CartographicLineSymbol) {
+                sreader = new CartoLineSymbolReader(symbol);
+            }
+            else if(symbol instanceof HashLineSymbol) {
+                sreader = new HashLineSymbolReader(symbol);
+            }
+            else {
+                logger.debug("The reader for type " + symbol.getClass().toString() +
+                             " is not implemented!");
+                return parent;
+            }
+        }
+        else if(lineSymbol != null) {
+            if(lineSymbol instanceof SimpleLineSymbol) {
+                sreader = new SimpleLineSymbolReader(lineSymbol);
+            }
+            else if(lineSymbol instanceof MarkerLineSymbol) {
+                sreader = new MarkerLineSymbolReader(lineSymbol);
+            }
+            else if(lineSymbol instanceof PictureLineSymbol) {
+                sreader = new PictureLineSymbolReader(lineSymbol);
+            }
+            else if(lineSymbol instanceof MultiLayerLineSymbol) {
+                sreader = new MultiLayerLineSymbolReader(lineSymbol);
+            }
+            else if(lineSymbol instanceof CartographicLineSymbol) {
+                sreader = new CartoLineSymbolReader(lineSymbol);
+            }
+            else if(lineSymbol instanceof HashLineSymbol) {
+                sreader = new HashLineSymbolReader(lineSymbol);
+            }
+            else {
+                logger.debug("The reader for type " +
+                             lineSymbol.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;
+    }
+
+    public boolean canRead(ISymbol 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 :
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)