annotate 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
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;
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
13
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 * Wrapper for fill symbol reader.
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 * @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
18 */
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
19 public class FillSymbolReader
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
20 extends AbstractSymbolReader {
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
21
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 * The logger.
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 private static final Logger logger =
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
26 Logger.getLogger(FillSymbolReader.class);
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
27
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
28 private ISymbol symbol;
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
29 private IFillSymbol fillSymbol;
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
30
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
31 public FillSymbolReader() throws Exception{
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
32 logger.debug("contructor()");
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
33 this.symbol = null;
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
34 this.fillSymbol = null;
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
35 }
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 public FillSymbolReader(ISymbol symbol) throws Exception{
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
38 logger.debug("contructor(ISymbol)");
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
39 this.symbol = symbol;
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
40 this.fillSymbol = null;
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
41 }
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 public FillSymbolReader(IFillSymbol symbol) throws Exception{
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
44 logger.debug("contructor(ILineSymbol)");
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
45 this.fillSymbol = symbol;
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
46 this.symbol= null;
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
47 }
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 public Element read() throws Exception {
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
50 ISymbolReader sreader = null;
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
51 if(symbol != null) {
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
52 if(symbol instanceof SimpleFillSymbol) {
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
53 sreader = new SimpleFillSymbolReader(symbol);
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
54 }
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
55 else if(symbol instanceof MultiLayerFillSymbol) {
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
56 sreader = new MultiLayerFillSymbolReader(symbol);
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
57 }
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
58 else {
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
59 logger.debug("The reader for type " + symbol.getClass().toString() +
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
60 " is not implemented!");
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
61 return parent;
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
62 }
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
63 }
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
64 else if(fillSymbol != null) {
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
65 if(fillSymbol instanceof SimpleFillSymbol) {
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
66 sreader = new SimpleFillSymbolReader(fillSymbol);
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 instanceof MultiLayerFillSymbol) {
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
69 sreader = new MultiLayerFillSymbolReader(fillSymbol);
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 else {
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
72 logger.debug("The reader for type " +
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
73 fillSymbol.getClass().toString() +
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
74 " is not implemented!");
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
75 return parent;
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
76 }
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
77 }
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 return parent;
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
80 }
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
81 if (sreader != null) {
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
82 sreader.setParent(parent);
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
83 sreader.setUtil(util);
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
84 sreader.read();
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
85 }
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
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
89 public void setSymbol(ISymbol sym) {
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
90 this.symbol = sym;
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
91 this.fillSymbol = null;
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
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
94 public void setSymbol(IFillSymbol sym) {
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
95 this.symbol = null;
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
96 this.fillSymbol = sym;
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
97 }
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
98
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
99 public boolean canRead(ISymbol sym) {
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
100 if(sym instanceof SimpleFillSymbol ||
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
101 sym instanceof MultiLayerFillSymbol) {
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
102 return true;
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
103 }
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
104 else {
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
105 return false;
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
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
109 public boolean canRead(IFillSymbol sym) {
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
110 if(sym instanceof SimpleFillSymbol ||
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
111 sym instanceof MultiLayerFillSymbol) {
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
112 return true;
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
113 }
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
114 else {
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
115 return false;
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 }
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
118
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 // 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)