diff src/java/de/intevation/mxd/reader/HashLineSymbolReader.java @ 82:4d6fae53956a

Use the wrapper to read hash line symbols.
author Raimund Renkert <rrenkert@intevation.de>
date Fri, 27 May 2011 13:52:41 +0200
parents 83932f18dddc
children 59e06c405a9a
line wrap: on
line diff
--- a/src/java/de/intevation/mxd/reader/HashLineSymbolReader.java	Fri May 27 13:25:58 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/HashLineSymbolReader.java	Fri May 27 13:52:41 2011 +0200
@@ -71,7 +71,7 @@
      * @return The XML node.
      */
     public Element read()
-    throws IOException {
+    throws Exception {
         logger.debug("read()");
         Element symbolElement = util.addSymbol(parent);
 
@@ -129,47 +129,15 @@
         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!");
-            }
+    private void readHashSymbol(ILineSymbol ls, Element parent) 
+    throws Exception {
+        LineSymbolReader lsr = new LineSymbolReader ();
+        if (lsr.canRead(ls)) {
+            lsr.setSymbol(ls);
+            lsr.setParent(parent);
+            lsr.setUtil(util);
+            lsr.read();
         }
-        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)