Mercurial > mxd2map
comparison 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 |
comparison
equal
deleted
inserted
replaced
43:ef7ca23c4233 | 44:9b5fb5e5914d |
---|---|
4 | 4 |
5 import org.apache.log4j.Logger; | 5 import org.apache.log4j.Logger; |
6 | 6 |
7 import com.esri.arcgis.carto.IFeatureRenderer; | 7 import com.esri.arcgis.carto.IFeatureRenderer; |
8 import com.esri.arcgis.carto.ClassBreaksRenderer; | 8 import com.esri.arcgis.carto.ClassBreaksRenderer; |
9 import com.esri.arcgis.display.ISymbol; | |
9 | 10 |
10 import org.w3c.dom.Element; | 11 import org.w3c.dom.Element; |
11 | 12 |
12 import de.intevation.mxd.utils.MapToXMLUtils; | 13 import de.intevation.mxd.utils.MapToXMLUtils; |
13 | 14 |
66 * @return The XML node. | 67 * @return The XML node. |
67 */ | 68 */ |
68 public Element read() | 69 public Element read() |
69 throws IOException { | 70 throws IOException { |
70 logger.debug("read()"); | 71 logger.debug("read()"); |
71 Element rendererElement; | 72 |
72 try { | 73 for(int i = 0; i < renderer.getBreakCount(); i++){ |
73 rendererElement = util.addRenderer(layer); | 74 Element rendererElement; |
75 try { | |
76 rendererElement = util.addRenderer(layer); | |
77 rendererElement.setAttribute("break", | |
78 String.valueOf(renderer.getBreak(i))); | |
79 rendererElement.setAttribute( | |
80 "field_count", | |
81 String.valueOf(renderer.getFieldCount())); | |
82 for(int j = 0; j < renderer.getFieldCount(); j++) { | |
83 rendererElement.setAttribute( | |
84 "expression_field_" + j, | |
85 renderer.getField(j)); | |
86 | |
87 } | |
88 rendererElement.setAttribute( | |
89 "min_value", | |
90 String.valueOf(renderer.getMinimumBreak())); | |
91 rendererElement.setAttribute("expression_operator", "<="); | |
92 ISymbol sym = renderer.getSymbol(i); | |
93 ISymbolReader symReader; | |
94 symReader = new SimpleFillSymbolReader(renderer.getSymbol(i)); | |
95 symReader.setUtil(util); | |
96 symReader.setParent(rendererElement); | |
97 symReader.read(); | |
98 } | |
99 catch(Exception e) { | |
100 e.printStackTrace(); | |
101 return null; | |
102 } | |
74 } | 103 } |
75 catch(Exception e) { | 104 return layer; |
76 e.printStackTrace(); | |
77 return null; | |
78 } | |
79 | |
80 rendererElement.setAttribute("class_count", | |
81 String.valueOf(renderer.getClassCount())); | |
82 for(int i = 0; i < renderer.getClassCount(); i++){ | |
83 rendererElement.setAttribute("class_" + i, | |
84 renderer.esri_getClass(i)); | |
85 } | |
86 | |
87 rendererElement.setAttribute("break_count", | |
88 String.valueOf(renderer.getBreakCount())); | |
89 for(int i = 0; i < renderer.getBreakCount(); i++){ | |
90 rendererElement.setAttribute("break_" + i, | |
91 String.valueOf(renderer.getBreak(i))); | |
92 } | |
93 | |
94 rendererElement.setAttribute("color_ramp", renderer.getColorRamp()); | |
95 return rendererElement; | |
96 } | 105 } |
97 } | 106 } |
98 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : | 107 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |