diff src/java/de/intevation/mxd/reader/SimpleFillSymbolReader.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 b41fcf268827
children 7eba97e8201b
line wrap: on
line diff
--- a/src/java/de/intevation/mxd/reader/SimpleFillSymbolReader.java	Thu May 26 16:01:29 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/SimpleFillSymbolReader.java	Thu May 26 16:49:03 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;
         }
@@ -136,41 +141,12 @@
 
         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();
+            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() +
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)