annotate src/java/de/intevation/mxd/reader/MarkerSymbolReader.java @ 247:30e10eb9ac68

Print out a message if an empty layer is not written to the mapfile.
author raimund renkert <raimund.renkert@intevation.de>
date Wed, 10 Aug 2011 13:23:29 +0200
parents df4e0946ef02
children a46adb3697fa
rev   line source
243
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 181
diff changeset
1 /*
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 181
diff changeset
2 * Copyright (c) 2011 by Intevation GmbH, Germany <info@intevation.de>
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 181
diff changeset
3 *
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 181
diff changeset
4 * This file is part of MXD2map.
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 181
diff changeset
5 *
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 181
diff changeset
6 * This program is free software under the LGPL (>=v2.1)
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 181
diff changeset
7 * Read the file LICENCE.txt coming with the software for details
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 181
diff changeset
8 * or visit http://www.gnu.org/licenses/ if it does not exist.
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 181
diff changeset
9 *
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 181
diff changeset
10 * MXD2map has been developed on behalf of the
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 181
diff changeset
11 * Bundesamt fuer Seeschifffahrt und Hydrographie (BSH) in Hamburg
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 181
diff changeset
12 * by Intevation GmbH.
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 181
diff changeset
13 *
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 181
diff changeset
14 * Authors:
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 181
diff changeset
15 * Raimund Renkert <raimund.renkert@intevation.de>
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 181
diff changeset
16 * Bjoern Schilberg <bjoern.schilberg@intevation.de>
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 181
diff changeset
17 * Stephan Holl <stephan.holl@intevation.de>
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 181
diff changeset
18 */
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 181
diff changeset
19
70
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
20 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
21
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
22 import java.lang.Exception;
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 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
25
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
26 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
27
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
28 import com.esri.arcgis.display.ISymbol;
75
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
29 import com.esri.arcgis.display.IMarkerSymbol;
71
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
30 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
31 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
32 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
33 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
34 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
35
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 * 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
38 *
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
39 * @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
40 */
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
41 public class MarkerSymbolReader
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
42 extends AbstractSymbolReader {
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
43
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
44 /**
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
45 * The logger.
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
46 */
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
47 private static final Logger logger =
75
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
48 Logger.getLogger(MarkerSymbolReader.class);
70
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
49
181
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
50 /**
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
51 * Private member.
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
52 */
70
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
53 private ISymbol symbol;
75
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
54 private IMarkerSymbol markerSymbol;
70
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
55
181
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
56 /**
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
57 * Constructor with symbol.
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
58 *
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
59 * @param symbol The symbol used to display points.
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
60 */
71
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
61 public MarkerSymbolReader(ISymbol symbol)
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
62 throws Exception {
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
63 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
64 this.symbol = symbol;
75
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
65 this.markerSymbol = null;
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
66 }
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
67
181
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
68 /**
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
69 * Constructor with symbol.
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
70 *
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
71 * @param symbol The symbol used to display points.
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
72 */
75
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
73 public MarkerSymbolReader(IMarkerSymbol symbol)
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
74 throws Exception {
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
75 logger.debug("contructor(ISymbol)");
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
76 this.markerSymbol = symbol;
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
77 this.symbol = null;
70
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
78 }
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
79
181
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
80 /**
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
81 * Default constructor.
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
82 */
71
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
83 public MarkerSymbolReader() {
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
84 logger.debug("contructor()");
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
85 this.symbol = null;
75
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
86 this.markerSymbol = null;
71
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
87 }
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
88
181
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
89 /**
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
90 * Reads the symbol attributes.
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
91 *
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
92 * @return The DOM element containing the attributes.
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
93 */
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
94 public Element read() {
75
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
95 logger.debug("read()");
70
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
96 ISymbolReader sreader = null;
75
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
97
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
98 if(symbol != null) {
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
99 try {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
100 if(symbol instanceof SimpleMarkerSymbol) {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
101 sreader = new SimpleMarkerSymbolReader(symbol);
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
102 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
103 else if(symbol instanceof ArrowMarkerSymbol) {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
104 sreader = new ArrowMarkerSymbolReader(symbol);
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
105 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
106 else if(symbol instanceof CharacterMarkerSymbol) {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
107 sreader = new CharacterMarkerSymbolReader(symbol);
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
108 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
109 else if(symbol instanceof PictureMarkerSymbol) {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
110 sreader = new PictureMarkerSymbolReader(symbol);
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
111 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
112 else if(symbol instanceof MultiLayerMarkerSymbol) {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
113 sreader = new MultiLayerMarkerSymbolReader(symbol);
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
114 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
115 else {
180
f4eb506499f5 Done some code styling and removed TODOs.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
116 logger.debug("The reader for type " +
f4eb506499f5 Done some code styling and removed TODOs.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
117 symbol.getClass().toString() +
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
118 " is not implemented!");
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
119 return parent;
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
120 }
75
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
121 }
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
122 catch(Exception e) {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
123 logger.error(
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
124 "Could not read the symbol " +
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
125 symbol.getClass().toString());
75
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
126 return parent;
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
127
75
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
128 }
70
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
129 }
75
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
130 else if(markerSymbol != null) {
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
131 try {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
132 if(markerSymbol instanceof SimpleMarkerSymbol) {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
133 sreader = new SimpleMarkerSymbolReader(markerSymbol);
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
134 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
135 else if(markerSymbol instanceof ArrowMarkerSymbol) {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
136 sreader = new ArrowMarkerSymbolReader(markerSymbol);
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
137 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
138 else if(markerSymbol instanceof CharacterMarkerSymbol) {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
139 sreader = new CharacterMarkerSymbolReader(markerSymbol);
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
140 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
141 else if(markerSymbol instanceof PictureMarkerSymbol) {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
142 sreader = new PictureMarkerSymbolReader(markerSymbol);
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
143 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
144 else if(markerSymbol instanceof MultiLayerMarkerSymbol) {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
145 sreader = new MultiLayerMarkerSymbolReader(markerSymbol);
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
146 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
147 else {
180
f4eb506499f5 Done some code styling and removed TODOs.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
148 logger.debug("The reader for type " +
f4eb506499f5 Done some code styling and removed TODOs.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
149 symbol.getClass().toString() +
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
150 " is not implemented!");
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
151 return parent;
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
152 }
75
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
153 }
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
154 catch(Exception e) {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
155 logger.error(
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
156 "Could not read the symbol " +
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
157 symbol.getClass().toString());
75
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
158 return parent;
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
159
75
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
160 }
70
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
161 }
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
162 if (sreader != null) {
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
163 sreader.setParent(parent);
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
164 sreader.setUtil(util);
75
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
165 sreader.read();
70
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
166 }
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
167 return parent;
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
168 }
71
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
169
181
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
170 /**
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
171 * Sets the symbol to read.
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
172 *
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
173 * @param sym The symbol used to display points.
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
174 */
71
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
175 public void setSymbol(ISymbol sym) {
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
176 this.symbol = sym;
75
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
177 this.markerSymbol = null;
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
178 }
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
179
181
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
180 /**
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
181 * Sets the symbol to read.
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
182 *
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
183 * @param sym The symbol used to display points.
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
184 */
75
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
185 public void setSymbol(IMarkerSymbol sym) {
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
186 this.markerSymbol = sym;
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
187 this.symbol = null;
71
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
188 }
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
189
181
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
190 /**
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
191 * Determine whether this reader can be used to read the symbol.
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
192 *
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
193 * @param sym The ArcGIS symbol.
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
194 */
71
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
195 public boolean canRead(ISymbol sym) {
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
196 if(sym instanceof SimpleMarkerSymbol ||
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
197 sym instanceof ArrowMarkerSymbol ||
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
198 sym instanceof PictureMarkerSymbol ||
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
199 sym instanceof CharacterMarkerSymbol ||
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
200 sym instanceof MultiLayerMarkerSymbol) {
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
201 return true;
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
202 }
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
203 else {
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
204 return false;
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
205 }
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
206 }
260748e3d08f Added wrapper for line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 70
diff changeset
207
181
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
208 /**
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
209 * Determine whether this reader can be used to read the symbol.
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
210 *
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
211 * @param sym The ArcGIS symbol.
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
212 */
75
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
213 public boolean canRead(IMarkerSymbol sym) {
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
214 if(sym instanceof SimpleMarkerSymbol ||
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
215 sym instanceof ArrowMarkerSymbol ||
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
216 sym instanceof PictureMarkerSymbol ||
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
217 sym instanceof CharacterMarkerSymbol ||
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
218 sym instanceof MultiLayerMarkerSymbol) {
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
219 return true;
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
220 }
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
221 else {
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
222 return false;
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
223 }
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
224 }
70
6d181c02efce Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
225 }
180
f4eb506499f5 Done some code styling and removed TODOs.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
226 // 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)