annotate src/java/de/intevation/mxd/reader/MarkerSymbolReader.java @ 74:7eba97e8201b

Catch all exceptions in the MXDReader.
author Raimund Renkert <rrenkert@intevation.de>
date Thu, 26 May 2011 18:11:29 +0200
parents 260748e3d08f
children 9ea64427ac7e
rev   line source
70
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
1 package de.intevation.mxd.reader;
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
2
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
3 import java.lang.Exception;
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
4
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
5 import org.w3c.dom.Element;
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
6
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
7 import org.apache.log4j.Logger;
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
8
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
9 import com.esri.arcgis.display.ISymbol;
71
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
10 import com.esri.arcgis.display.SimpleMarkerSymbol;
70
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
11 import com.esri.arcgis.display.ArrowMarkerSymbol;
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
12 import com.esri.arcgis.display.CharacterMarkerSymbol;
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
13 import com.esri.arcgis.display.PictureMarkerSymbol;
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
14 import com.esri.arcgis.display.MultiLayerMarkerSymbol;
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
15
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
16 /**
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
17 * Wrapper for marker symbol reader.
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
18 *
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
19 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a>
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
20 */
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
21 public class MarkerSymbolReader
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
22 extends AbstractSymbolReader {
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
23
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
24 /**
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
25 * The logger.
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
26 */
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
27 private static final Logger logger =
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
28 Logger.getLogger(SimpleFillSymbolReader.class);
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
29
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
30 private ISymbol symbol;
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
31
71
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
32 public MarkerSymbolReader(ISymbol symbol)
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
33 throws Exception {
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
34 logger.debug("contructor(ISymbol)");
70
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
35 this.symbol = symbol;
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
36 }
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
37
71
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
38 public MarkerSymbolReader() {
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
39 logger.debug("contructor()");
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
40 this.symbol = null;
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
41 }
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
42
74
7eba97e8201b Catch all exceptions in the MXDReader.
Raimund Renkert <rrenkert@intevation.de>
parents: 71
diff changeset
43 public Element read()
7eba97e8201b Catch all exceptions in the MXDReader.
Raimund Renkert <rrenkert@intevation.de>
parents: 71
diff changeset
44 throws Exception {
71
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
45 if(symbol == null) {
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
46 return parent;
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
47 }
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
48
70
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
49 ISymbolReader sreader = null;
71
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
50 if(symbol instanceof SimpleMarkerSymbol) {
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
51 sreader = new SimpleMarkerSymbolReader(symbol);
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
52 }
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
53 else if(symbol instanceof ArrowMarkerSymbol) {
70
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
54 sreader = new ArrowMarkerSymbolReader(symbol);
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
55 }
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
56 else if(symbol instanceof CharacterMarkerSymbol) {
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
57 sreader = new CharacterMarkerSymbolReader(symbol);
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
58 }
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
59 else if(symbol instanceof PictureMarkerSymbol) {
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
60 sreader = new PictureMarkerSymbolReader(symbol);
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
61 }
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
62 else if(symbol instanceof MultiLayerMarkerSymbol) {
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
63 sreader = new MultiLayerMarkerSymbolReader(symbol);
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
64 }
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
65 else {
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
66 logger.debug("The reader for type " + symbol.getClass().toString() +
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
67 " is not implemented!");
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
68 return parent;
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
69 }
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
70 if (sreader != null) {
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
71 sreader.setParent(parent);
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
72 sreader.setUtil(util);
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
73 return sreader.read();
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
74 }
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
75 return parent;
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
76 }
71
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
77
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
78 public void setSymbol(ISymbol sym) {
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
79 this.symbol = sym;
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
80 }
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
81
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
82 public boolean canRead(ISymbol sym) {
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
83 if(sym instanceof SimpleMarkerSymbol ||
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
84 sym instanceof ArrowMarkerSymbol ||
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
85 sym instanceof PictureMarkerSymbol ||
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
86 sym instanceof CharacterMarkerSymbol ||
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
87 sym instanceof MultiLayerMarkerSymbol) {
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
88 return true;
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
89 }
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
90 else {
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
91 return false;
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
92 }
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
93 }
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
94
70
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
95 }
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)