diff src/java/de/intevation/mxd/reader/ClassBreakRendererReader.java @ 44:9b5fb5e5914d

Added expressions for mapserver classes.
author Raimund Renkert <rrenkert@intevation.de>
date Mon, 18 Apr 2011 14:50:49 +0200
parents 7a927921eb6c
children 90d4de478f15
line wrap: on
line diff
--- a/src/java/de/intevation/mxd/reader/ClassBreakRendererReader.java	Fri Apr 15 15:44:54 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/ClassBreakRendererReader.java	Mon Apr 18 14:50:49 2011 +0200
@@ -6,6 +6,7 @@
 
 import com.esri.arcgis.carto.IFeatureRenderer;
 import com.esri.arcgis.carto.ClassBreaksRenderer;
+import com.esri.arcgis.display.ISymbol;
 
 import org.w3c.dom.Element;
 
@@ -68,31 +69,39 @@
     public Element read()
     throws IOException {
         logger.debug("read()");
-        Element rendererElement;
-        try {
-            rendererElement = util.addRenderer(layer);
-        }
-        catch(Exception e) {
-            e.printStackTrace();
-            return null;
-        }
 
-        rendererElement.setAttribute("class_count",
-                String.valueOf(renderer.getClassCount()));
-        for(int i = 0; i < renderer.getClassCount(); i++){
-            rendererElement.setAttribute("class_" + i,
-                renderer.esri_getClass(i));
-        }
+        for(int i = 0; i < renderer.getBreakCount(); i++){
+            Element rendererElement;
+            try {
+                rendererElement = util.addRenderer(layer);
+                rendererElement.setAttribute("break",
+                    String.valueOf(renderer.getBreak(i)));
+                rendererElement.setAttribute(
+                    "field_count",
+                    String.valueOf(renderer.getFieldCount()));
+                for(int j = 0; j < renderer.getFieldCount(); j++) {
+                    rendererElement.setAttribute(
+                        "expression_field_" + j,
+                        renderer.getField(j));
 
-        rendererElement.setAttribute("break_count",
-            String.valueOf(renderer.getBreakCount()));
-        for(int i = 0; i < renderer.getBreakCount(); i++){
-            rendererElement.setAttribute("break_" + i,
-                String.valueOf(renderer.getBreak(i)));
+                }
+                rendererElement.setAttribute(
+                    "min_value",
+                    String.valueOf(renderer.getMinimumBreak()));
+                rendererElement.setAttribute("expression_operator", "<=");
+                ISymbol sym = renderer.getSymbol(i);
+                ISymbolReader symReader;
+                symReader = new SimpleFillSymbolReader(renderer.getSymbol(i));
+                symReader.setUtil(util);
+                symReader.setParent(rendererElement);
+                symReader.read();
+            }
+            catch(Exception e) {
+                e.printStackTrace();
+                return null;
+            }
         }
-
-        rendererElement.setAttribute("color_ramp", renderer.getColorRamp());
-        return rendererElement;
+        return layer;
     }
 }
 // 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)