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