Mercurial > mxd2map
annotate src/java/de/intevation/mxd/reader/MarkerLineSymbolReader.java @ 344:2e170d69af30
Added a bunch of epsg codes.
author | Bjoern Schilberg <bjoern@intevation.de> |
---|---|
date | Wed, 14 Nov 2012 13:34:43 +0100 |
parents | a46adb3697fa |
children |
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 |
63
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
20 package de.intevation.mxd.reader; |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
21 |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
22 import org.apache.log4j.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 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
|
25 import com.esri.arcgis.display.ILineSymbol; |
63
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
26 import com.esri.arcgis.display.IMarkerSymbol; |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
27 import com.esri.arcgis.display.MarkerLineSymbol; |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
28 import com.esri.arcgis.display.MultiLayerMarkerSymbol; |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
29 |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
30 import org.w3c.dom.Element; |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
31 |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
32 /** |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
33 * Reads marker line symbol information. |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
34 * |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
35 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
36 */ |
80
83932f18dddc
All symbol reader now extend the abstract symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
74
diff
changeset
|
37 public class MarkerLineSymbolReader |
83932f18dddc
All symbol reader now extend the abstract symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
74
diff
changeset
|
38 extends AbstractSymbolReader { |
63
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
39 |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
40 /** |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
41 * The logger. |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
42 */ |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
43 private static final Logger logger = |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
44 Logger.getLogger(MarkerLineSymbolReader.class); |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
45 |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
46 /** |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
47 * Private member. |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
48 */ |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
49 private MarkerLineSymbol symbol; |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
50 |
181 | 51 /** |
52 * Constructor with symbol. | |
53 * | |
54 * @param symbol The symbol used to display lines. | |
55 */ | |
63
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
56 public MarkerLineSymbolReader(ISymbol symbol) |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
57 throws Exception { |
336
a46adb3697fa
Fix annoying typo. s/contructor/constructor
Andre Heinecke <aheinecke@intevation.de>
parents:
243
diff
changeset
|
58 logger.debug("constructor()"); |
63
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
59 if(symbol instanceof MarkerLineSymbol) { |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
60 this.symbol = (MarkerLineSymbol)symbol; |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
61 } |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
62 else { |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
63 throw new Exception("Not a MarkerLineSymbol!"); |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
64 } |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
65 } |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
66 |
181 | 67 /** |
68 * Constructor with symbol. | |
69 * | |
70 * @param symbol The symbol used to display lines. | |
71 */ | |
67
5ed9e720b6cd
Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
63
diff
changeset
|
72 public MarkerLineSymbolReader(ILineSymbol symbol) |
5ed9e720b6cd
Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
63
diff
changeset
|
73 throws Exception { |
336
a46adb3697fa
Fix annoying typo. s/contructor/constructor
Andre Heinecke <aheinecke@intevation.de>
parents:
243
diff
changeset
|
74 logger.debug("constructor()"); |
67
5ed9e720b6cd
Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
63
diff
changeset
|
75 if(symbol instanceof MarkerLineSymbol) { |
5ed9e720b6cd
Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
63
diff
changeset
|
76 this.symbol = (MarkerLineSymbol)symbol; |
5ed9e720b6cd
Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
63
diff
changeset
|
77 } |
5ed9e720b6cd
Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
63
diff
changeset
|
78 else { |
5ed9e720b6cd
Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
63
diff
changeset
|
79 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
|
80 } |
5ed9e720b6cd
Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
63
diff
changeset
|
81 } |
5ed9e720b6cd
Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
63
diff
changeset
|
82 |
63
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
83 /** |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
84 * Reads the symbol attributes. |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
85 * |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
86 * @return The XML node. |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
87 */ |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
88 public Element read() { |
63
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
89 logger.debug("read()"); |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
90 try { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
91 IMarkerSymbol sym = symbol.getMarkerSymbol(); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
92 if(sym instanceof MultiLayerMarkerSymbol) { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
93 ISymbolReader sreader = new MultiLayerMarkerSymbolReader(sym); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
94 sreader.setParent(parent); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
95 sreader.setUtil(util); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
96 sreader.read(); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
97 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
98 else { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
99 logger.debug("The type of " + sym.getClass().toString() + |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
100 " is not implemented!"); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
101 } |
63
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
102 } |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
103 catch(Exception e) { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
104 logger.error( |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
105 "Could not read the symbol " + |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
106 symbol.getClass().toString()); |
63
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
107 } |
80
83932f18dddc
All symbol reader now extend the abstract symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
74
diff
changeset
|
108 return parent; |
63
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
109 } |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
110 } |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
111 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |