Mercurial > mxd2map
comparison src/java/de/intevation/mxd/reader/MultiLayerMarkerSymbolReader.java @ 47:5fc813f40fa5
Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Tue, 19 Apr 2011 17:25:09 +0200 |
parents | 34a93dad7604 |
children | 4e0464c620f0 |
comparison
equal
deleted
inserted
replaced
46:34a93dad7604 | 47:5fc813f40fa5 |
---|---|
8 | 8 |
9 import com.esri.arcgis.display.ISymbol; | 9 import com.esri.arcgis.display.ISymbol; |
10 import com.esri.arcgis.display.IMarkerSymbol; | 10 import com.esri.arcgis.display.IMarkerSymbol; |
11 import com.esri.arcgis.display.MultiLayerMarkerSymbol; | 11 import com.esri.arcgis.display.MultiLayerMarkerSymbol; |
12 import com.esri.arcgis.display.ArrowMarkerSymbol; | 12 import com.esri.arcgis.display.ArrowMarkerSymbol; |
13 import com.esri.arcgis.display.CharacterMarkerSymbol; | |
13 import com.esri.arcgis.display.IColor; | 14 import com.esri.arcgis.display.IColor; |
14 import com.esri.arcgis.display.RgbColor; | 15 import com.esri.arcgis.display.RgbColor; |
15 | 16 |
16 import org.w3c.dom.Element; | 17 import org.w3c.dom.Element; |
17 import de.intevation.mxd.utils.MapToXMLUtils; | 18 import de.intevation.mxd.utils.MapToXMLUtils; |
72 * @return The XML node. | 73 * @return The XML node. |
73 */ | 74 */ |
74 public Element read() | 75 public Element read() |
75 throws IOException { | 76 throws IOException { |
76 logger.debug("read()"); | 77 logger.debug("read()"); |
77 Element symbolElement; | 78 for(int i = 0; i < symbol.getLayerCount(); i++) { |
78 try { | 79 try { |
79 symbolElement = util.addSymbol(renderer); | 80 ISymbol sym = (ISymbol)symbol.getLayer(i); |
80 } | |
81 catch(Exception e) { | |
82 e.printStackTrace(); | |
83 return null; | |
84 } | |
85 | 81 |
86 for(int i = 0; i < symbol.getLayerCount(); i++) { | 82 if(sym instanceof ArrowMarkerSymbol) { |
87 IMarkerSymbol sym = symbol.getLayer(i); | 83 ISymbolReader sreader = new ArrowMarkerSymbolReader(sym); |
88 if (sym instanceof ArrowMarkerSymbol) { | 84 sreader.setParent(renderer); |
89 ArrowMarkerSymbol arrow = (ArrowMarkerSymbol)sym; | 85 sreader.setUtil(util); |
90 IColor c = arrow.getColor(); | 86 sreader.read(); |
91 symbolElement.setAttribute( | 87 } |
92 "name", | 88 if(sym instanceof CharacterMarkerSymbol) { |
93 arrow.getNameString()); | 89 ISymbolReader sreader = new CharacterMarkerSymbolReader(sym); |
94 symbolElement.setAttribute( | 90 sreader.setParent(renderer); |
95 "length", | 91 sreader.setUtil(util); |
96 String.valueOf(arrow.getLength())); | 92 sreader.read(); |
97 symbolElement.setAttribute( | 93 } |
98 "width", | 94 else { |
99 String.valueOf(arrow.getWidth())); | 95 System.out.println( |
100 symbolElement.setAttribute( | 96 "No known instance: " + sym.getClass().toString()); |
101 "angle", | 97 } |
102 String.valueOf(arrow.getAngle())); | 98 } |
103 symbolElement.setAttribute( | 99 catch(Exception e) { |
104 "size", | 100 e.printStackTrace(); |
105 String.valueOf(arrow.getSize())); | |
106 symbolElement.setAttribute( | |
107 "x_offset", | |
108 String.valueOf(arrow.getXOffset())); | |
109 symbolElement.setAttribute( | |
110 "y_offset", | |
111 String.valueOf(arrow.getYOffset())); | |
112 symbolElement.setAttribute( | |
113 "color", | |
114 String.valueOf(c.getRGB())); | |
115 symbolElement.setAttribute( | |
116 "tranparency", | |
117 String.valueOf(c.getTransparency())); | |
118 symbolElement.setAttribute("style", "arrow"); | |
119 } | 101 } |
120 } | 102 } |
121 return symbolElement; | 103 return renderer; |
122 } | 104 } |
123 } | 105 } |
124 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : | 106 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |