Mercurial > mxd2map
comparison src/java/de/intevation/mxd/reader/ClassBreakRendererReader.java @ 45:90d4de478f15
Added support for SimpleMarkerSymbol and SimpleFillSymbol in
ClassBreaksRendererReader.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Mon, 18 Apr 2011 16:03:07 +0200 |
parents | 9b5fb5e5914d |
children | b41fcf268827 |
comparison
equal
deleted
inserted
replaced
44:9b5fb5e5914d | 45:90d4de478f15 |
---|---|
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 import com.esri.arcgis.display.ISymbol; |
10 import com.esri.arcgis.display.SimpleMarkerSymbol; | |
11 import com.esri.arcgis.display.SimpleFillSymbol; | |
10 | 12 |
11 import org.w3c.dom.Element; | 13 import org.w3c.dom.Element; |
12 | 14 |
13 import de.intevation.mxd.utils.MapToXMLUtils; | 15 import de.intevation.mxd.utils.MapToXMLUtils; |
14 | 16 |
72 | 74 |
73 for(int i = 0; i < renderer.getBreakCount(); i++){ | 75 for(int i = 0; i < renderer.getBreakCount(); i++){ |
74 Element rendererElement; | 76 Element rendererElement; |
75 try { | 77 try { |
76 rendererElement = util.addRenderer(layer); | 78 rendererElement = util.addRenderer(layer); |
77 rendererElement.setAttribute("break", | 79 rendererElement.setAttribute("value", |
78 String.valueOf(renderer.getBreak(i))); | 80 String.valueOf(renderer.getBreak(i))); |
79 rendererElement.setAttribute( | 81 rendererElement.setAttribute( |
80 "field_count", | 82 "field_count", |
81 String.valueOf(renderer.getFieldCount())); | 83 String.valueOf(renderer.getFieldCount())); |
82 for(int j = 0; j < renderer.getFieldCount(); j++) { | 84 for(int j = 0; j < renderer.getFieldCount(); j++) { |
89 "min_value", | 91 "min_value", |
90 String.valueOf(renderer.getMinimumBreak())); | 92 String.valueOf(renderer.getMinimumBreak())); |
91 rendererElement.setAttribute("expression_operator", "<="); | 93 rendererElement.setAttribute("expression_operator", "<="); |
92 ISymbol sym = renderer.getSymbol(i); | 94 ISymbol sym = renderer.getSymbol(i); |
93 ISymbolReader symReader; | 95 ISymbolReader symReader; |
94 symReader = new SimpleFillSymbolReader(renderer.getSymbol(i)); | 96 if(sym instanceof SimpleFillSymbol) { |
95 symReader.setUtil(util); | 97 symReader = new SimpleFillSymbolReader(renderer.getSymbol(i)); |
96 symReader.setParent(rendererElement); | 98 symReader.setUtil(util); |
97 symReader.read(); | 99 symReader.setParent(rendererElement); |
100 symReader.read(); | |
101 } | |
102 else if(sym instanceof SimpleMarkerSymbol) { | |
103 symReader = new SimpleMarkerSymbolReader(renderer.getSymbol(i)); | |
104 symReader.setUtil(util); | |
105 symReader.setParent(rendererElement); | |
106 symReader.read(); | |
107 } | |
108 else { | |
109 System.out.println("No known class type: " + sym.getClass().toString()); | |
110 } | |
98 } | 111 } |
99 catch(Exception e) { | 112 catch(Exception e) { |
100 e.printStackTrace(); | 113 e.printStackTrace(); |
101 return null; | 114 return null; |
102 } | 115 } |