diff src/java/de/intevation/mxd/reader/HashLineSymbolReader.java @ 67:5ed9e720b6cd

Read the hash symbol in the hash line symbol reader.
author Raimund Renkert <rrenkert@intevation.de>
date Wed, 25 May 2011 15:48:55 +0200
parents 6bfebb7eb1df
children b41fcf268827
line wrap: on
line diff
--- a/src/java/de/intevation/mxd/reader/HashLineSymbolReader.java	Wed May 25 14:44:46 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/HashLineSymbolReader.java	Wed May 25 15:48:55 2011 +0200
@@ -7,7 +7,13 @@
 import org.apache.log4j.Logger;
 
 import com.esri.arcgis.display.ISymbol;
+import com.esri.arcgis.display.ILineSymbol;
 import com.esri.arcgis.display.HashLineSymbol;
+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.MultiLayerLineSymbol;
 import com.esri.arcgis.display.esriSimpleLineStyle;
 import com.esri.arcgis.display.IRgbColor;
 import com.esri.arcgis.display.RgbColor;
@@ -50,6 +56,18 @@
         }
     }
 
+
+    public HashLineSymbolReader(ILineSymbol symbol)
+    throws Exception {
+        logger.debug("contructor()");
+        if(symbol instanceof HashLineSymbol) {
+            this.symbol = (HashLineSymbol)symbol;
+        }
+        else {
+            throw new Exception("Not a HashLineSymbol!");
+        }
+    }
+
     /**
      * Setter for the parent XML element.
      *
@@ -130,11 +148,58 @@
             "offset",
             String.valueOf(symbol.getOffset()));
         symbolElement.setAttribute("width", String.valueOf(symbol.getWidth()));
+        ILineSymbol ls = symbol.getHashSymbol();
+        readHashSymbol(ls, symbolElement);
 
         //TODO Read further HashLine specific attributes:
-        //     LineSymbol, LineDecoration, Template.
+        //     LineDecoration, Template.
 
         return symbolElement;
     }
+
+    private void readHashSymbol(ILineSymbol ls, Element parent) {
+        try {
+            if (ls instanceof MultiLayerLineSymbol) {
+                ISymbolReader sr = new MultiLayerLineSymbolReader(ls);
+                sr.setParent(parent);
+                sr.setUtil(util);
+                sr.read();
+            }
+            else if(ls instanceof MarkerLineSymbol) {
+                ISymbolReader sreader = new MarkerLineSymbolReader(ls);
+                sreader.setParent(parent);
+                sreader.setUtil(util);
+                sreader.read();
+            }
+            else if(ls instanceof PictureLineSymbol) {
+                ISymbolReader sreader = new PictureLineSymbolReader(ls);
+                sreader.setParent(parent);
+                sreader.setUtil(util);
+                sreader.read();
+            }
+            else if(ls instanceof CartographicLineSymbol) {
+                ISymbolReader sreader = new CartoLineSymbolReader(ls);
+                sreader.setParent(parent);
+                sreader.setUtil(util);
+                sreader.read();
+            }
+            else if(ls instanceof HashLineSymbol) {
+                ISymbolReader sreader = new HashLineSymbolReader(ls);
+                sreader.setParent(parent);
+                sreader.setUtil(util);
+                sreader.read();
+            }
+            else {
+                logger.debug("The type of " + ls.getClass().toString() +
+                             " is not implemented!");
+                System.out.println(
+                        "No known instance: " + ls.getClass().toString());
+            }
+        }
+        catch(Exception e) {
+            e.printStackTrace();
+        }
+
+    }
 }
 // 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)