diff src/java/de/intevation/mxd/reader/FillSymbolReader.java @ 72:2cbe423b1fda

Added wrapper for fill symbol reader.
author Raimund Renkert <rrenkert@intevation.de>
date Thu, 26 May 2011 16:49:03 +0200
parents
children 9ea64427ac7e
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java/de/intevation/mxd/reader/FillSymbolReader.java	Thu May 26 16:49:03 2011 +0200
@@ -0,0 +1,120 @@
+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;
+
+/**
+ * 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 {
+                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 {
+                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 MultiLayerFillSymbol) {
+            return true;
+        }
+        else {
+            return false;
+        }
+    }
+
+    public boolean canRead(IFillSymbol sym) {
+        if(sym instanceof SimpleFillSymbol ||
+           sym instanceof MultiLayerFillSymbol) {
+            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)