Mercurial > mxd2map
comparison src/java/de/intevation/mxd/reader/HashLineSymbolReader.java @ 80:83932f18dddc
All symbol reader now extend the abstract symbol reader.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Fri, 27 May 2011 13:15:15 +0200 |
parents | 7eba97e8201b |
children | 4d6fae53956a |
comparison
equal
deleted
inserted
replaced
76:3087c89a5bb8 | 80:83932f18dddc |
---|---|
27 /** | 27 /** |
28 * Reads cartoline symbol information. | 28 * Reads cartoline symbol information. |
29 * | 29 * |
30 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> | 30 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> |
31 */ | 31 */ |
32 public class HashLineSymbolReader implements ISymbolReader{ | 32 public class HashLineSymbolReader |
33 extends AbstractSymbolReader { | |
33 | 34 |
34 /** | 35 /** |
35 * The logger. | 36 * The logger. |
36 */ | 37 */ |
37 private static final Logger logger = | 38 private static final Logger logger = |
38 Logger.getLogger(HashLineSymbolReader.class); | 39 Logger.getLogger(HashLineSymbolReader.class); |
39 | 40 |
40 /** | 41 /** |
41 * Private member. | 42 * Private member. |
42 */ | 43 */ |
43 private Element renderer; | |
44 private HashLineSymbol symbol; | 44 private HashLineSymbol symbol; |
45 private MapToXMLUtils util; | |
46 | |
47 | 45 |
48 public HashLineSymbolReader(ISymbol symbol) | 46 public HashLineSymbolReader(ISymbol symbol) |
49 throws Exception { | 47 throws Exception { |
50 logger.debug("contructor()"); | 48 logger.debug("contructor()"); |
51 if(symbol instanceof HashLineSymbol) { | 49 if(symbol instanceof HashLineSymbol) { |
53 } | 51 } |
54 else { | 52 else { |
55 throw new Exception("Not a HashLineSymbol!"); | 53 throw new Exception("Not a HashLineSymbol!"); |
56 } | 54 } |
57 } | 55 } |
58 | |
59 | 56 |
60 public HashLineSymbolReader(ILineSymbol symbol) | 57 public HashLineSymbolReader(ILineSymbol symbol) |
61 throws Exception { | 58 throws Exception { |
62 logger.debug("contructor()"); | 59 logger.debug("contructor()"); |
63 if(symbol instanceof HashLineSymbol) { | 60 if(symbol instanceof HashLineSymbol) { |
67 throw new Exception("Not a HashLineSymbol!"); | 64 throw new Exception("Not a HashLineSymbol!"); |
68 } | 65 } |
69 } | 66 } |
70 | 67 |
71 /** | 68 /** |
72 * Setter for the parent XML element. | |
73 * | |
74 * @param parent The XML parent node. | |
75 */ | |
76 public void setParent(Element parent) { | |
77 this.renderer = parent; | |
78 } | |
79 | |
80 /** | |
81 * Setter for XML document helper. | |
82 * | |
83 * @param util The helper class for storing map information. | |
84 */ | |
85 public void setUtil(MapToXMLUtils util) { | |
86 this.util = util; | |
87 } | |
88 | |
89 /** | |
90 * Reads the symbol attributes. | 69 * Reads the symbol attributes. |
91 * | 70 * |
92 * @return The XML node. | 71 * @return The XML node. |
93 */ | 72 */ |
94 public Element read() | 73 public Element read() |
95 throws IOException { | 74 throws IOException { |
96 logger.debug("read()"); | 75 logger.debug("read()"); |
97 Element symbolElement = util.addSymbol(renderer); | 76 Element symbolElement = util.addSymbol(parent); |
98 | 77 |
99 symbolElement.setAttribute("name", symbol.getNameString()); | 78 symbolElement.setAttribute("name", symbol.getNameString()); |
100 symbolElement.setAttribute("style", "line"); | 79 symbolElement.setAttribute("style", "line"); |
101 if(symbol.getColor() instanceof IRgbColor) { | 80 if(symbol.getColor() instanceof IRgbColor) { |
102 IRgbColor color = (IRgbColor)symbol.getColor(); | 81 IRgbColor color = (IRgbColor)symbol.getColor(); |