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