annotate src/java/de/intevation/mxd/reader/FillSymbolReader.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 3087c89a5bb8
children fb93f20478cc
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;
76
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
14 import com.esri.arcgis.display.LineFillSymbol;
72
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 /**
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
17 * Wrapper for fill symbol reader.
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
18 *
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
19 * @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
20 */
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
21 public class FillSymbolReader
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
22 extends AbstractSymbolReader {
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 /**
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
25 * The logger.
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
26 */
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
27 private static final Logger logger =
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
28 Logger.getLogger(FillSymbolReader.class);
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
29
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
30 private ISymbol symbol;
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
31 private IFillSymbol fillSymbol;
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
32
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
33 public FillSymbolReader() throws Exception{
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
34 logger.debug("contructor()");
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
35 this.symbol = null;
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
36 this.fillSymbol = null;
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
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
39 public FillSymbolReader(ISymbol symbol) throws Exception{
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
40 logger.debug("contructor(ISymbol)");
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
41 this.symbol = symbol;
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
42 this.fillSymbol = null;
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
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
45 public FillSymbolReader(IFillSymbol symbol) throws Exception{
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
46 logger.debug("contructor(ILineSymbol)");
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
47 this.fillSymbol = symbol;
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
48 this.symbol= null;
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
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
51 public Element read() throws Exception {
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
52 ISymbolReader sreader = null;
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
53 if(symbol != null) {
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
54 if(symbol instanceof SimpleFillSymbol) {
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
55 sreader = new SimpleFillSymbolReader(symbol);
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
56 }
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
57 else if(symbol instanceof MultiLayerFillSymbol) {
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
58 sreader = new MultiLayerFillSymbolReader(symbol);
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
59 }
75
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 72
diff changeset
60 else if(symbol instanceof MarkerFillSymbol) {
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 72
diff changeset
61 sreader = new MarkerFillSymbolReader(symbol);
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 72
diff changeset
62 }
76
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
63 else if(symbol instanceof LineFillSymbol) {
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
64 sreader = new LineFillSymbolReader(symbol);
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
65 }
72
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
66 else {
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
67 logger.debug("The reader for type " + symbol.getClass().toString() +
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
68 " is not implemented!");
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
69 return parent;
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
70 }
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 != null) {
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
73 if(fillSymbol instanceof SimpleFillSymbol) {
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
74 sreader = new SimpleFillSymbolReader(fillSymbol);
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
75 }
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
76 else if(fillSymbol instanceof MultiLayerFillSymbol) {
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
77 sreader = new MultiLayerFillSymbolReader(fillSymbol);
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
78 }
75
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 72
diff changeset
79 else if(fillSymbol instanceof MarkerFillSymbol) {
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 72
diff changeset
80 sreader = new MarkerFillSymbolReader(fillSymbol);
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 72
diff changeset
81 }
76
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
82 else if(fillSymbol instanceof LineFillSymbol) {
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
83 sreader = new LineFillSymbolReader(fillSymbol);
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
84 }
72
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 logger.debug("The reader for type " +
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
87 fillSymbol.getClass().toString() +
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
88 " is not implemented!");
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
89 return parent;
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
90 }
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
91 }
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
92 else {
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 if (sreader != null) {
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
96 sreader.setParent(parent);
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
97 sreader.setUtil(util);
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
98 sreader.read();
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 return parent;
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
101 }
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
102
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
103 public void setSymbol(ISymbol sym) {
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
104 this.symbol = sym;
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
105 this.fillSymbol = null;
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
106 }
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
107
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
108 public void setSymbol(IFillSymbol sym) {
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
109 this.symbol = null;
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
110 this.fillSymbol = sym;
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
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
113 public boolean canRead(ISymbol sym) {
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
114 if(sym instanceof SimpleFillSymbol ||
75
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 72
diff changeset
115 sym instanceof MarkerFillSymbol ||
76
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
116 sym instanceof MultiLayerFillSymbol ||
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
117 sym instanceof LineFillSymbol) {
72
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
118 return true;
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
119 }
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
120 else {
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
121 return false;
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 }
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
124
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
125 public boolean canRead(IFillSymbol sym) {
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
126 if(sym instanceof SimpleFillSymbol ||
75
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 72
diff changeset
127 sym instanceof MarkerFillSymbol ||
76
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
128 sym instanceof MultiLayerFillSymbol ||
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
129 sym instanceof LineFillSymbol) {
72
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
130 return true;
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
131 }
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
132 else {
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
133 return false;
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
134 }
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
135 }
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
136
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
137 }
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
138 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)