comparison src/java/de/intevation/mxd/reader/HashLineSymbolReader.java @ 67:5ed9e720b6cd

Read the hash symbol in the hash line symbol reader.
author Raimund Renkert <rrenkert@intevation.de>
date Wed, 25 May 2011 15:48:55 +0200
parents 6bfebb7eb1df
children b41fcf268827
comparison
equal deleted inserted replaced
66:6bfebb7eb1df 67:5ed9e720b6cd
5 import java.awt.Color; 5 import java.awt.Color;
6 6
7 import org.apache.log4j.Logger; 7 import org.apache.log4j.Logger;
8 8
9 import com.esri.arcgis.display.ISymbol; 9 import com.esri.arcgis.display.ISymbol;
10 import com.esri.arcgis.display.ILineSymbol;
10 import com.esri.arcgis.display.HashLineSymbol; 11 import com.esri.arcgis.display.HashLineSymbol;
12 import com.esri.arcgis.display.SimpleLineSymbol;
13 import com.esri.arcgis.display.MarkerLineSymbol;
14 import com.esri.arcgis.display.PictureLineSymbol;
15 import com.esri.arcgis.display.CartographicLineSymbol;
16 import com.esri.arcgis.display.MultiLayerLineSymbol;
11 import com.esri.arcgis.display.esriSimpleLineStyle; 17 import com.esri.arcgis.display.esriSimpleLineStyle;
12 import com.esri.arcgis.display.IRgbColor; 18 import com.esri.arcgis.display.IRgbColor;
13 import com.esri.arcgis.display.RgbColor; 19 import com.esri.arcgis.display.RgbColor;
14 20
15 import com.esri.arcgis.display.esriLineCapStyle; 21 import com.esri.arcgis.display.esriLineCapStyle;
38 private HashLineSymbol symbol; 44 private HashLineSymbol symbol;
39 private MapToXMLUtils util; 45 private MapToXMLUtils util;
40 46
41 47
42 public HashLineSymbolReader(ISymbol symbol) 48 public HashLineSymbolReader(ISymbol symbol)
49 throws Exception {
50 logger.debug("contructor()");
51 if(symbol instanceof HashLineSymbol) {
52 this.symbol = (HashLineSymbol)symbol;
53 }
54 else {
55 throw new Exception("Not a HashLineSymbol!");
56 }
57 }
58
59
60 public HashLineSymbolReader(ILineSymbol symbol)
43 throws Exception { 61 throws Exception {
44 logger.debug("contructor()"); 62 logger.debug("contructor()");
45 if(symbol instanceof HashLineSymbol) { 63 if(symbol instanceof HashLineSymbol) {
46 this.symbol = (HashLineSymbol)symbol; 64 this.symbol = (HashLineSymbol)symbol;
47 } 65 }
128 String.valueOf(symbol.getMiterLimit())); 146 String.valueOf(symbol.getMiterLimit()));
129 symbolElement.setAttribute( 147 symbolElement.setAttribute(
130 "offset", 148 "offset",
131 String.valueOf(symbol.getOffset())); 149 String.valueOf(symbol.getOffset()));
132 symbolElement.setAttribute("width", String.valueOf(symbol.getWidth())); 150 symbolElement.setAttribute("width", String.valueOf(symbol.getWidth()));
151 ILineSymbol ls = symbol.getHashSymbol();
152 readHashSymbol(ls, symbolElement);
133 153
134 //TODO Read further HashLine specific attributes: 154 //TODO Read further HashLine specific attributes:
135 // LineSymbol, LineDecoration, Template. 155 // LineDecoration, Template.
136 156
137 return symbolElement; 157 return symbolElement;
158 }
159
160 private void readHashSymbol(ILineSymbol ls, Element parent) {
161 try {
162 if (ls instanceof MultiLayerLineSymbol) {
163 ISymbolReader sr = new MultiLayerLineSymbolReader(ls);
164 sr.setParent(parent);
165 sr.setUtil(util);
166 sr.read();
167 }
168 else if(ls instanceof MarkerLineSymbol) {
169 ISymbolReader sreader = new MarkerLineSymbolReader(ls);
170 sreader.setParent(parent);
171 sreader.setUtil(util);
172 sreader.read();
173 }
174 else if(ls instanceof PictureLineSymbol) {
175 ISymbolReader sreader = new PictureLineSymbolReader(ls);
176 sreader.setParent(parent);
177 sreader.setUtil(util);
178 sreader.read();
179 }
180 else if(ls instanceof CartographicLineSymbol) {
181 ISymbolReader sreader = new CartoLineSymbolReader(ls);
182 sreader.setParent(parent);
183 sreader.setUtil(util);
184 sreader.read();
185 }
186 else if(ls instanceof HashLineSymbol) {
187 ISymbolReader sreader = new HashLineSymbolReader(ls);
188 sreader.setParent(parent);
189 sreader.setUtil(util);
190 sreader.read();
191 }
192 else {
193 logger.debug("The type of " + ls.getClass().toString() +
194 " is not implemented!");
195 System.out.println(
196 "No known instance: " + ls.getClass().toString());
197 }
198 }
199 catch(Exception e) {
200 e.printStackTrace();
201 }
202
138 } 203 }
139 } 204 }
140 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : 205 // 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)