changeset 73:acbe36fb45e0

Use the wrapper in the renderer reader to read symbols.
author Raimund Renkert <rrenkert@intevation.de>
date Thu, 26 May 2011 17:29:09 +0200
parents 2cbe423b1fda
children 7eba97e8201b
files ChangeLog src/java/de/intevation/mxd/reader/ClassBreakRendererReader.java src/java/de/intevation/mxd/reader/UniqueValueRendererReader.java
diffstat 3 files changed, 53 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu May 26 16:49:03 2011 +0200
+++ b/ChangeLog	Thu May 26 17:29:09 2011 +0200
@@ -1,3 +1,9 @@
+2011-05-26  Raimund Renkert  <raimund.renkert@intevation.de>
+
+	* src/java/de/intevation/mxd/reader/ClassBreakRendererReader.java,
+	  src/java/de/intevation/mxd/reader/UniqueValueRendererReader.java:
+	  Use the wrapper to read symbols.
+
 2011-05-26  Raimund Renkert  <raimund.renkert@intevation.de>
 
 	Added wrapper for fill symbol reader.
--- a/src/java/de/intevation/mxd/reader/ClassBreakRendererReader.java	Thu May 26 16:49:03 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/ClassBreakRendererReader.java	Thu May 26 17:29:09 2011 +0200
@@ -91,19 +91,28 @@
                     "min_value",
                     String.valueOf(renderer.getMinimumBreak()));
                 rendererElement.setAttribute("expression_operator", "<=");
+
                 ISymbol sym = renderer.getSymbol(i);
-                ISymbolReader symReader;
-                if(sym instanceof SimpleFillSymbol) {
-                    symReader = new SimpleFillSymbolReader(renderer.getSymbol(i));
-                    symReader.setUtil(util);
-                    symReader.setParent(rendererElement);
-                    symReader.read();
+                MarkerSymbolReader markerReader = new MarkerSymbolReader();
+                LineSymbolReader lineReader = new LineSymbolReader();
+                FillSymbolReader fillReader = new FillSymbolReader();
+                if(markerReader.canRead(sym)) {
+                    markerReader.setSymbol(sym);
+                    markerReader.setUtil(util);
+                    markerReader.setParent(rendererElement);
+                    markerReader.read();
                 }
-                else if(sym instanceof SimpleMarkerSymbol) {
-                    symReader = new SimpleMarkerSymbolReader(renderer.getSymbol(i));
-                    symReader.setUtil(util);
-                    symReader.setParent(rendererElement);
-                    symReader.read();
+                else if(lineReader.canRead(sym)) {
+                    lineReader.setSymbol(sym);
+                    lineReader.setUtil(util);
+                    lineReader.setParent(rendererElement);
+                    lineReader.read();
+                }
+                else if(fillReader.canRead(sym)) {
+                    fillReader.setSymbol(sym);
+                    fillReader.setUtil(util);
+                    fillReader.setParent(rendererElement);
+                    fillReader.read();
                 }
                 else {
                     logger.debug("Not a known symbol type: " +
--- a/src/java/de/intevation/mxd/reader/UniqueValueRendererReader.java	Thu May 26 16:49:03 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/UniqueValueRendererReader.java	Thu May 26 17:29:09 2011 +0200
@@ -91,11 +91,33 @@
                         renderer.getField(j));
                 }
                 rendererElement.setAttribute("expression_operator", "=");
-                ISymbol symbol = renderer.getSymbol(value);
-                ISymbolReader symbolReader = new MarkerSymbolReader(symbol);
-                symbolReader.setUtil(util);
-                symbolReader.setParent(rendererElement);
-                symbolReader.read ();
+
+                ISymbol sym = renderer.getSymbol(value);
+                MarkerSymbolReader markerReader = new MarkerSymbolReader();
+                LineSymbolReader lineReader = new LineSymbolReader();
+                FillSymbolReader fillReader = new FillSymbolReader();
+                if(markerReader.canRead(sym)) {
+                    markerReader.setSymbol(sym);
+                    markerReader.setUtil(util);
+                    markerReader.setParent(rendererElement);
+                    markerReader.read();
+                }
+                else if(lineReader.canRead(sym)) {
+                    lineReader.setSymbol(sym);
+                    lineReader.setUtil(util);
+                    lineReader.setParent(rendererElement);
+                    lineReader.read();
+                }
+                else if(fillReader.canRead(sym)) {
+                    fillReader.setSymbol(sym);
+                    fillReader.setUtil(util);
+                    fillReader.setParent(rendererElement);
+                    fillReader.read();
+                }
+                else {
+                    logger.debug("Not a known symbol type: " +
+                                 sym.getClass().toString());
+                }
             }
             catch(Exception e) {
                 e.printStackTrace();
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)