Mercurial > mxd2map
annotate src/java/de/intevation/mxd/reader/MarkerLineSymbolReader.java @ 176:d95dbd643add
Removed superfluous style object from writer.
author | raimund renkert <raimund.renkert@intevation.de> |
---|---|
date | Thu, 07 Jul 2011 14:19:56 +0200 |
parents | fb93f20478cc |
children | 0bde090506f9 |
rev | line source |
---|---|
63
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.mxd.reader; |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
2 |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
3 import org.apache.log4j.Logger; |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
4 |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
5 import com.esri.arcgis.display.ISymbol; |
67
5ed9e720b6cd
Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
63
diff
changeset
|
6 import com.esri.arcgis.display.ILineSymbol; |
63
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
7 import com.esri.arcgis.display.IMarkerSymbol; |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
8 import com.esri.arcgis.display.MarkerLineSymbol; |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
9 import com.esri.arcgis.display.MultiLayerMarkerSymbol; |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
10 |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
11 import org.w3c.dom.Element; |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
12 |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
13 /** |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
14 * Reads marker line symbol information. |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
15 * |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
16 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
17 */ |
80
83932f18dddc
All symbol reader now extend the abstract symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
74
diff
changeset
|
18 public class MarkerLineSymbolReader |
83932f18dddc
All symbol reader now extend the abstract symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
74
diff
changeset
|
19 extends AbstractSymbolReader { |
63
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
20 |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
21 /** |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
22 * The logger. |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
23 */ |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
24 private static final Logger logger = |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
25 Logger.getLogger(MarkerLineSymbolReader.class); |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
26 |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
27 /** |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
28 * Private member. |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
29 */ |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
30 private MarkerLineSymbol symbol; |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
31 |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
32 public MarkerLineSymbolReader(ISymbol symbol) |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
33 throws Exception { |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
34 logger.debug("contructor()"); |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
35 if(symbol instanceof MarkerLineSymbol) { |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
36 this.symbol = (MarkerLineSymbol)symbol; |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
37 } |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
38 else { |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
39 throw new Exception("Not a MarkerLineSymbol!"); |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
40 } |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
41 } |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
42 |
67
5ed9e720b6cd
Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
63
diff
changeset
|
43 public MarkerLineSymbolReader(ILineSymbol symbol) |
5ed9e720b6cd
Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
63
diff
changeset
|
44 throws Exception { |
5ed9e720b6cd
Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
63
diff
changeset
|
45 logger.debug("contructor()"); |
5ed9e720b6cd
Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
63
diff
changeset
|
46 if(symbol instanceof MarkerLineSymbol) { |
5ed9e720b6cd
Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
63
diff
changeset
|
47 this.symbol = (MarkerLineSymbol)symbol; |
5ed9e720b6cd
Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
63
diff
changeset
|
48 } |
5ed9e720b6cd
Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
63
diff
changeset
|
49 else { |
5ed9e720b6cd
Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
63
diff
changeset
|
50 throw new Exception("Not a MarkerLineSymbol!"); |
5ed9e720b6cd
Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
63
diff
changeset
|
51 } |
5ed9e720b6cd
Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
63
diff
changeset
|
52 } |
5ed9e720b6cd
Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
63
diff
changeset
|
53 |
63
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
54 /** |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
55 * Reads the symbol attributes. |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
56 * |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
57 * @return The XML node. |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
58 */ |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
59 public Element read() { |
63
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
60 logger.debug("read()"); |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
61 try { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
62 IMarkerSymbol sym = symbol.getMarkerSymbol(); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
63 if(sym instanceof MultiLayerMarkerSymbol) { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
64 ISymbolReader sreader = new MultiLayerMarkerSymbolReader(sym); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
65 sreader.setParent(parent); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
66 sreader.setUtil(util); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
67 sreader.read(); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
68 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
69 else { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
70 logger.debug("The type of " + sym.getClass().toString() + |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
71 " is not implemented!"); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
72 } |
63
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
73 } |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
74 catch(Exception e) { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
75 logger.error( |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
76 "Could not read the symbol " + |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
77 symbol.getClass().toString()); |
63
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
78 } |
80
83932f18dddc
All symbol reader now extend the abstract symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
74
diff
changeset
|
79 return parent; |
63
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
80 } |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
81 } |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
82 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |