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