Mercurial > mxd2map
annotate src/java/de/intevation/mxd/reader/MultiLayerMarkerSymbolReader.java @ 87:7d4cf2db43f1
Added new writer classes to be flexible in creating mapfiles.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Tue, 31 May 2011 17:54:43 +0200 |
parents | 59e06c405a9a |
children | fb93f20478cc |
rev | line source |
---|---|
46
34a93dad7604
Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.mxd.reader; |
34a93dad7604
Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
2 |
34a93dad7604
Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
3 import org.apache.log4j.Logger; |
34a93dad7604
Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
4 |
34a93dad7604
Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
5 import com.esri.arcgis.display.ISymbol; |
34a93dad7604
Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
6 import com.esri.arcgis.display.IMarkerSymbol; |
34a93dad7604
Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
7 import com.esri.arcgis.display.MultiLayerMarkerSymbol; |
34a93dad7604
Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
8 |
34a93dad7604
Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
9 import org.w3c.dom.Element; |
34a93dad7604
Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
10 |
34a93dad7604
Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
11 /** |
34a93dad7604
Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
12 * Reads multi layer marker symbol information. |
34a93dad7604
Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
13 * |
34a93dad7604
Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
14 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> |
34a93dad7604
Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
15 */ |
80
83932f18dddc
All symbol reader now extend the abstract symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
74
diff
changeset
|
16 public class MultiLayerMarkerSymbolReader |
83932f18dddc
All symbol reader now extend the abstract symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
74
diff
changeset
|
17 extends AbstractSymbolReader { |
46
34a93dad7604
Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
18 |
34a93dad7604
Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
19 /** |
34a93dad7604
Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
20 * The logger. |
34a93dad7604
Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
21 */ |
34a93dad7604
Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
22 private static final Logger logger = |
34a93dad7604
Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
23 Logger.getLogger(MultiLayerMarkerSymbolReader.class); |
34a93dad7604
Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
24 |
34a93dad7604
Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
25 /** |
34a93dad7604
Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
26 * Private member. |
34a93dad7604
Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
27 */ |
34a93dad7604
Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
28 private MultiLayerMarkerSymbol symbol; |
34a93dad7604
Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
29 |
34a93dad7604
Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
30 public MultiLayerMarkerSymbolReader(ISymbol symbol) |
34a93dad7604
Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
31 throws Exception { |
34a93dad7604
Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
32 logger.debug("contructor()"); |
34a93dad7604
Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
33 if(symbol instanceof MultiLayerMarkerSymbol) { |
34a93dad7604
Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
34 this.symbol = (MultiLayerMarkerSymbol)symbol; |
34a93dad7604
Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
35 } |
34a93dad7604
Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
36 else { |
34a93dad7604
Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
37 throw new Exception("Not a MultiLayerMarkerSymbol!"); |
34a93dad7604
Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
38 } |
34a93dad7604
Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
39 } |
34a93dad7604
Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
40 |
63
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
58
diff
changeset
|
41 public MultiLayerMarkerSymbolReader(IMarkerSymbol symbol) |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
58
diff
changeset
|
42 throws Exception { |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
58
diff
changeset
|
43 logger.debug("contructor()"); |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
58
diff
changeset
|
44 if(symbol instanceof MultiLayerMarkerSymbol) { |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
58
diff
changeset
|
45 this.symbol = (MultiLayerMarkerSymbol)symbol; |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
58
diff
changeset
|
46 } |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
58
diff
changeset
|
47 else { |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
58
diff
changeset
|
48 throw new Exception("Not a MultiLayerMarkerSymbol!"); |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
58
diff
changeset
|
49 } |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
58
diff
changeset
|
50 } |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
58
diff
changeset
|
51 |
46
34a93dad7604
Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
52 /** |
34a93dad7604
Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
53 * Reads the symbol attributes. |
34a93dad7604
Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
54 * |
34a93dad7604
Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
55 * @return The XML node. |
34a93dad7604
Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
56 */ |
34a93dad7604
Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
57 public Element read() |
74
7eba97e8201b
Catch all exceptions in the MXDReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
70
diff
changeset
|
58 throws Exception { |
46
34a93dad7604
Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
59 logger.debug("read()"); |
34a93dad7604
Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
60 for(int i = 0; i < symbol.getLayerCount(); i++) { |
74
7eba97e8201b
Catch all exceptions in the MXDReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
70
diff
changeset
|
61 ISymbol sym = (ISymbol)symbol.getLayer(i); |
7eba97e8201b
Catch all exceptions in the MXDReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
70
diff
changeset
|
62 ISymbolReader sreader = new MarkerSymbolReader(sym); |
80
83932f18dddc
All symbol reader now extend the abstract symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
74
diff
changeset
|
63 sreader.setParent(parent); |
74
7eba97e8201b
Catch all exceptions in the MXDReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
70
diff
changeset
|
64 sreader.setUtil(util); |
7eba97e8201b
Catch all exceptions in the MXDReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
70
diff
changeset
|
65 sreader.read(); |
46
34a93dad7604
Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
66 } |
80
83932f18dddc
All symbol reader now extend the abstract symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
74
diff
changeset
|
67 return parent; |
46
34a93dad7604
Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
68 } |
34a93dad7604
Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
69 } |
34a93dad7604
Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
70 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |