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