Mercurial > mxd2map
comparison src/java/de/intevation/mxd/reader/LineSymbolReader.java @ 71:260748e3d08f
Added wrapper for line symbol reader.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Thu, 26 May 2011 16:01:29 +0200 |
parents | |
children | 2cbe423b1fda |
comparison
equal
deleted
inserted
replaced
70:6d181c02efce | 71:260748e3d08f |
---|---|
1 package de.intevation.mxd.reader; | |
2 | |
3 import java.lang.Exception; | |
4 | |
5 import org.w3c.dom.Element; | |
6 | |
7 import org.apache.log4j.Logger; | |
8 | |
9 import com.esri.arcgis.display.ISymbol; | |
10 import com.esri.arcgis.display.ILineSymbol; | |
11 import com.esri.arcgis.display.MultiLayerLineSymbol; | |
12 import com.esri.arcgis.display.SimpleLineSymbol; | |
13 import com.esri.arcgis.display.MarkerLineSymbol; | |
14 import com.esri.arcgis.display.PictureLineSymbol; | |
15 import com.esri.arcgis.display.CartographicLineSymbol; | |
16 import com.esri.arcgis.display.HashLineSymbol; | |
17 | |
18 /** | |
19 * Wrapper for line symbol reader. | |
20 * | |
21 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> | |
22 */ | |
23 public class LineSymbolReader | |
24 extends AbstractSymbolReader { | |
25 | |
26 /** | |
27 * The logger. | |
28 */ | |
29 private static final Logger logger = | |
30 Logger.getLogger(LineSymbolReader.class); | |
31 | |
32 private ISymbol symbol; | |
33 private ILineSymbol lineSymbol; | |
34 | |
35 public LineSymbolReader() throws Exception{ | |
36 logger.debug("contructor()"); | |
37 this.symbol = null; | |
38 this.lineSymbol = null; | |
39 } | |
40 | |
41 public LineSymbolReader(ISymbol symbol) throws Exception{ | |
42 logger.debug("contructor(ISymbol)"); | |
43 this.symbol = symbol; | |
44 this.lineSymbol = null; | |
45 } | |
46 | |
47 public LineSymbolReader(ILineSymbol symbol) throws Exception{ | |
48 logger.debug("contructor(ILineSymbol)"); | |
49 this.lineSymbol = symbol; | |
50 this.symbol= null; | |
51 } | |
52 | |
53 public Element read() throws Exception { | |
54 ISymbolReader sreader = null; | |
55 if(symbol != null) { | |
56 if(symbol instanceof SimpleLineSymbol) { | |
57 sreader = new SimpleLineSymbolReader(symbol); | |
58 } | |
59 else if(symbol instanceof MarkerLineSymbol) { | |
60 sreader = new MarkerLineSymbolReader(symbol); | |
61 } | |
62 else if(symbol instanceof PictureLineSymbol) { | |
63 sreader = new PictureLineSymbolReader(symbol); | |
64 } | |
65 else if(symbol instanceof MultiLayerLineSymbol) { | |
66 sreader = new MultiLayerLineSymbolReader(symbol); | |
67 } | |
68 else if(symbol instanceof CartographicLineSymbol) { | |
69 sreader = new CartoLineSymbolReader(symbol); | |
70 } | |
71 else if(symbol instanceof HashLineSymbol) { | |
72 sreader = new HashLineSymbolReader(symbol); | |
73 } | |
74 else { | |
75 logger.debug("The reader for type " + symbol.getClass().toString() + | |
76 " is not implemented!"); | |
77 return parent; | |
78 } | |
79 } | |
80 else if(lineSymbol != null) { | |
81 if(lineSymbol instanceof SimpleLineSymbol) { | |
82 sreader = new SimpleLineSymbolReader(lineSymbol); | |
83 } | |
84 else if(lineSymbol instanceof MarkerLineSymbol) { | |
85 sreader = new MarkerLineSymbolReader(lineSymbol); | |
86 } | |
87 else if(lineSymbol instanceof PictureLineSymbol) { | |
88 sreader = new PictureLineSymbolReader(lineSymbol); | |
89 } | |
90 else if(lineSymbol instanceof MultiLayerLineSymbol) { | |
91 sreader = new MultiLayerLineSymbolReader(lineSymbol); | |
92 } | |
93 else if(lineSymbol instanceof CartographicLineSymbol) { | |
94 sreader = new CartoLineSymbolReader(lineSymbol); | |
95 } | |
96 else if(lineSymbol instanceof HashLineSymbol) { | |
97 sreader = new HashLineSymbolReader(lineSymbol); | |
98 } | |
99 else { | |
100 logger.debug("The reader for type " + | |
101 lineSymbol.getClass().toString() + | |
102 " is not implemented!"); | |
103 return parent; | |
104 } | |
105 } | |
106 else { | |
107 return parent; | |
108 } | |
109 if (sreader != null) { | |
110 sreader.setParent(parent); | |
111 sreader.setUtil(util); | |
112 sreader.read(); | |
113 } | |
114 return parent; | |
115 } | |
116 | |
117 public void setSymbol(ISymbol sym) { | |
118 this.symbol = sym; | |
119 } | |
120 | |
121 public boolean canRead(ISymbol sym) { | |
122 if(sym instanceof SimpleLineSymbol || | |
123 sym instanceof MarkerLineSymbol || | |
124 sym instanceof PictureLineSymbol || | |
125 sym instanceof MultiLayerLineSymbol || | |
126 sym instanceof CartographicLineSymbol || | |
127 sym instanceof HashLineSymbol) { | |
128 return true; | |
129 } | |
130 else { | |
131 return false; | |
132 } | |
133 } | |
134 } | |
135 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |