annotate src/java/de/intevation/mxd/reader/MultiLayerFillSymbolReader.java @ 341:10a0bf9a47ab

Added OUTPUTFORMAT jpeg.
author Bjoern Schilberg <bjoern@intevation.de>
date Wed, 14 Nov 2012 13:07:40 +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
68
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
20 package de.intevation.mxd.reader;
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
21
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
22 import org.apache.log4j.Logger;
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
23
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
24 import com.esri.arcgis.display.ISymbol;
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
25 import com.esri.arcgis.display.IFillSymbol;
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
26 import com.esri.arcgis.display.MultiLayerFillSymbol;
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
27
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
28 import org.w3c.dom.Element;
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
29
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
30 /**
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
31 * Reads multi layer line symbol information.
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
32 *
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
33 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a>
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
34 */
80
83932f18dddc All symbol reader now extend the abstract symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
35 public class MultiLayerFillSymbolReader
83932f18dddc All symbol reader now extend the abstract symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
36 extends AbstractSymbolReader {
68
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
37
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
38 /**
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
39 * The logger.
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
40 */
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
41 private static final Logger logger =
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
42 Logger.getLogger(MultiLayerFillSymbolReader.class);
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
43
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
44 /**
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
45 * Private member.
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
46 */
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
47 private MultiLayerFillSymbol symbol;
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
48
181
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
49 /**
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
50 * Constructor with symbol.
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
51 *
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
52 * @param symbol The symbol used to display polygons.
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
53 */
68
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
54 public MultiLayerFillSymbolReader(ISymbol symbol)
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
55 throws Exception {
336
a46adb3697fa Fix annoying typo. s/contructor/constructor
Andre Heinecke <aheinecke@intevation.de>
parents: 243
diff changeset
56 logger.debug("constructor()");
68
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
57 if(symbol instanceof MultiLayerFillSymbol) {
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
58 this.symbol = (MultiLayerFillSymbol)symbol;
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
59 }
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
60 else {
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
61 throw new Exception("Not a MultiLayerFillSymbol!");
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
62 }
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
63 }
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
64
181
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
65 /**
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
66 * Constructor with symbol.
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
67 *
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
68 * @param symbol The symbol used to display polygons.
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
69 */
68
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
70 public MultiLayerFillSymbolReader(IFillSymbol symbol)
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
71 throws Exception {
336
a46adb3697fa Fix annoying typo. s/contructor/constructor
Andre Heinecke <aheinecke@intevation.de>
parents: 243
diff changeset
72 logger.debug("constructor()");
68
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
73 if(symbol instanceof MultiLayerFillSymbol) {
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
74 this.symbol = (MultiLayerFillSymbol)symbol;
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
75 }
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
76 else {
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
77 throw new Exception("Not a MultiLayerFillSymbol!");
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
78 }
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
79 }
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
80
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
81 /**
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
82 * Reads the symbol attributes.
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
83 *
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
84 * @return The XML node.
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
85 */
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
86 public Element read() {
68
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
87 logger.debug("read()");
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
88 try {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
89 for(int i = 0; i < symbol.getLayerCount(); i++) {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
90 ISymbol sym = (ISymbol)symbol.getLayer(i);
68
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
91
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
92 FillSymbolReader fsr = new FillSymbolReader();
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
93 if(fsr.canRead(sym)) {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
94 fsr.setSymbol(sym);
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
95 fsr.setParent(parent);
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
96 fsr.setUtil(util);
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
97 fsr.read();
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
98 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
99 else {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
100 logger.debug("The type of " + sym.getClass().toString() +
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
101 " is not implemented!");
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
102 }
68
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
103 }
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
104 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
105 catch(Exception e) {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
106 logger.error(
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
107 "Could not read the symbol " +
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
108 symbol.getClass().toString());
68
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
109 }
80
83932f18dddc All symbol reader now extend the abstract symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
110 return parent;
68
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
111 }
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
112 }
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
113 // 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)