Mercurial > mxd2map
comparison src/java/de/intevation/mxd/reader/MarkerLineSymbolReader.java @ 63:5c5ef5768893
Added MultiLayerLineSymbolReader.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Tue, 24 May 2011 16:51:01 +0200 |
parents | |
children | 5ed9e720b6cd |
comparison
equal
deleted
inserted
replaced
62:e468cf8701ea | 63:5c5ef5768893 |
---|---|
1 package de.intevation.mxd.reader; | |
2 | |
3 import java.io.IOException; | |
4 | |
5 import java.awt.Color; | |
6 | |
7 import org.apache.log4j.Logger; | |
8 | |
9 import com.esri.arcgis.display.ISymbol; | |
10 import com.esri.arcgis.display.IMarkerSymbol; | |
11 import com.esri.arcgis.display.MarkerLineSymbol; | |
12 import com.esri.arcgis.display.esriSimpleLineStyle; | |
13 import com.esri.arcgis.display.MultiLayerMarkerSymbol; | |
14 import com.esri.arcgis.display.IRgbColor; | |
15 import com.esri.arcgis.display.RgbColor; | |
16 | |
17 import org.w3c.dom.Element; | |
18 import de.intevation.mxd.utils.MapToXMLUtils; | |
19 | |
20 /** | |
21 * Reads marker line symbol information. | |
22 * | |
23 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> | |
24 */ | |
25 public class MarkerLineSymbolReader implements ISymbolReader{ | |
26 | |
27 /** | |
28 * The logger. | |
29 */ | |
30 private static final Logger logger = | |
31 Logger.getLogger(MarkerLineSymbolReader.class); | |
32 | |
33 /** | |
34 * Private member. | |
35 */ | |
36 private Element renderer; | |
37 private MarkerLineSymbol symbol; | |
38 private MapToXMLUtils util; | |
39 | |
40 | |
41 public MarkerLineSymbolReader(ISymbol symbol) | |
42 throws Exception { | |
43 logger.debug("contructor()"); | |
44 if(symbol instanceof MarkerLineSymbol) { | |
45 this.symbol = (MarkerLineSymbol)symbol; | |
46 } | |
47 else { | |
48 throw new Exception("Not a MarkerLineSymbol!"); | |
49 } | |
50 } | |
51 | |
52 /** | |
53 * Setter for the parent XML element. | |
54 * | |
55 * @param parent The XML parent node. | |
56 */ | |
57 public void setParent(Element parent) { | |
58 this.renderer = parent; | |
59 } | |
60 | |
61 /** | |
62 * Setter for XML document helper. | |
63 * | |
64 * @param util The helper class for storing map information. | |
65 */ | |
66 public void setUtil(MapToXMLUtils util) { | |
67 this.util = util; | |
68 } | |
69 | |
70 /** | |
71 * Reads the symbol attributes. | |
72 * | |
73 * @return The XML node. | |
74 */ | |
75 public Element read() | |
76 throws IOException { | |
77 logger.debug("read()"); | |
78 try { | |
79 IMarkerSymbol sym = symbol.getMarkerSymbol(); | |
80 if(sym instanceof MultiLayerMarkerSymbol) { | |
81 ISymbolReader sreader = new MultiLayerMarkerSymbolReader(sym); | |
82 sreader.setParent(renderer); | |
83 sreader.setUtil(util); | |
84 sreader.read(); | |
85 } | |
86 else { | |
87 logger.debug("The type of " + sym.getClass().toString() + | |
88 " is not implemented!"); | |
89 System.out.println( | |
90 "No known instance: " + sym.getClass().toString()); | |
91 } | |
92 } | |
93 catch (Exception e) { | |
94 e.printStackTrace(); | |
95 } | |
96 return renderer; | |
97 } | |
98 } | |
99 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |