Mercurial > mxd2map
comparison src/java/de/intevation/mxd/reader/FillSymbolReader.java @ 72:2cbe423b1fda
Added wrapper for fill symbol reader.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Thu, 26 May 2011 16:49:03 +0200 |
parents | |
children | 9ea64427ac7e |
comparison
equal
deleted
inserted
replaced
71:260748e3d08f | 72:2cbe423b1fda |
---|---|
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.IFillSymbol; | |
11 import com.esri.arcgis.display.MultiLayerFillSymbol; | |
12 import com.esri.arcgis.display.SimpleFillSymbol; | |
13 | |
14 /** | |
15 * Wrapper for fill symbol reader. | |
16 * | |
17 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> | |
18 */ | |
19 public class FillSymbolReader | |
20 extends AbstractSymbolReader { | |
21 | |
22 /** | |
23 * The logger. | |
24 */ | |
25 private static final Logger logger = | |
26 Logger.getLogger(FillSymbolReader.class); | |
27 | |
28 private ISymbol symbol; | |
29 private IFillSymbol fillSymbol; | |
30 | |
31 public FillSymbolReader() throws Exception{ | |
32 logger.debug("contructor()"); | |
33 this.symbol = null; | |
34 this.fillSymbol = null; | |
35 } | |
36 | |
37 public FillSymbolReader(ISymbol symbol) throws Exception{ | |
38 logger.debug("contructor(ISymbol)"); | |
39 this.symbol = symbol; | |
40 this.fillSymbol = null; | |
41 } | |
42 | |
43 public FillSymbolReader(IFillSymbol symbol) throws Exception{ | |
44 logger.debug("contructor(ILineSymbol)"); | |
45 this.fillSymbol = symbol; | |
46 this.symbol= null; | |
47 } | |
48 | |
49 public Element read() throws Exception { | |
50 ISymbolReader sreader = null; | |
51 if(symbol != null) { | |
52 if(symbol instanceof SimpleFillSymbol) { | |
53 sreader = new SimpleFillSymbolReader(symbol); | |
54 } | |
55 else if(symbol instanceof MultiLayerFillSymbol) { | |
56 sreader = new MultiLayerFillSymbolReader(symbol); | |
57 } | |
58 else { | |
59 logger.debug("The reader for type " + symbol.getClass().toString() + | |
60 " is not implemented!"); | |
61 return parent; | |
62 } | |
63 } | |
64 else if(fillSymbol != null) { | |
65 if(fillSymbol instanceof SimpleFillSymbol) { | |
66 sreader = new SimpleFillSymbolReader(fillSymbol); | |
67 } | |
68 else if(fillSymbol instanceof MultiLayerFillSymbol) { | |
69 sreader = new MultiLayerFillSymbolReader(fillSymbol); | |
70 } | |
71 else { | |
72 logger.debug("The reader for type " + | |
73 fillSymbol.getClass().toString() + | |
74 " is not implemented!"); | |
75 return parent; | |
76 } | |
77 } | |
78 else { | |
79 return parent; | |
80 } | |
81 if (sreader != null) { | |
82 sreader.setParent(parent); | |
83 sreader.setUtil(util); | |
84 sreader.read(); | |
85 } | |
86 return parent; | |
87 } | |
88 | |
89 public void setSymbol(ISymbol sym) { | |
90 this.symbol = sym; | |
91 this.fillSymbol = null; | |
92 } | |
93 | |
94 public void setSymbol(IFillSymbol sym) { | |
95 this.symbol = null; | |
96 this.fillSymbol = sym; | |
97 } | |
98 | |
99 public boolean canRead(ISymbol sym) { | |
100 if(sym instanceof SimpleFillSymbol || | |
101 sym instanceof MultiLayerFillSymbol) { | |
102 return true; | |
103 } | |
104 else { | |
105 return false; | |
106 } | |
107 } | |
108 | |
109 public boolean canRead(IFillSymbol sym) { | |
110 if(sym instanceof SimpleFillSymbol || | |
111 sym instanceof MultiLayerFillSymbol) { | |
112 return true; | |
113 } | |
114 else { | |
115 return false; | |
116 } | |
117 } | |
118 | |
119 } | |
120 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |