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