annotate src/java/de/intevation/mxd/reader/CharacterMarkerSymbolReader.java @ 81:18814ae6d92d

Merged with Stephans commits.
author Raimund Renkert <rrenkert@intevation.de>
date Fri, 27 May 2011 13:25:58 +0200
parents 83932f18dddc
children 59e06c405a9a
rev   line source
47
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
1 package de.intevation.mxd.reader;
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
2
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
3 import java.io.IOException;
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
4
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
5 import java.awt.Color;
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
6
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
7 import org.apache.log4j.Logger;
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
8
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
9 import com.esri.arcgis.display.ISymbol;
63
5c5ef5768893 Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents: 48
diff changeset
10 import com.esri.arcgis.display.IMarkerSymbol;
47
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
11 import com.esri.arcgis.display.CharacterMarkerSymbol;
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
12 import com.esri.arcgis.display.IColor;
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
13 import com.esri.arcgis.support.ms.stdole.Font;
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
14
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
15 import org.w3c.dom.Element;
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
16 import de.intevation.mxd.utils.MapToXMLUtils;
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
17
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
18 /**
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
19 * Reads character marker symbol information.
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
20 *
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
21 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a>
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
22 */
80
83932f18dddc All symbol reader now extend the abstract symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
23 public class CharacterMarkerSymbolReader
83932f18dddc All symbol reader now extend the abstract symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
24 extends AbstractSymbolReader {
47
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
25
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
26 /**
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
27 * The logger.
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
28 */
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
29 private static final Logger logger =
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
30 Logger.getLogger(CharacterMarkerSymbolReader.class);
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
31
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
32 /**
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
33 * Private member.
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
34 */
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
35 private CharacterMarkerSymbol symbol;
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
36
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
37 public CharacterMarkerSymbolReader(ISymbol symbol)
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
38 throws Exception {
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
39 logger.debug("contructor()");
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
40 if(symbol instanceof CharacterMarkerSymbol) {
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
41 this.symbol = (CharacterMarkerSymbol)symbol;
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
42 }
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
43 else {
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
44 throw new Exception("Not a CharacterMarkerSymbol!");
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
45 }
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
46 }
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
47
63
5c5ef5768893 Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents: 48
diff changeset
48 public CharacterMarkerSymbolReader(IMarkerSymbol symbol)
5c5ef5768893 Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents: 48
diff changeset
49 throws Exception {
5c5ef5768893 Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents: 48
diff changeset
50 logger.debug("contructor()");
5c5ef5768893 Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents: 48
diff changeset
51 if(symbol instanceof CharacterMarkerSymbol) {
5c5ef5768893 Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents: 48
diff changeset
52 this.symbol = (CharacterMarkerSymbol)symbol;
5c5ef5768893 Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents: 48
diff changeset
53 }
5c5ef5768893 Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents: 48
diff changeset
54 else {
5c5ef5768893 Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents: 48
diff changeset
55 throw new Exception("Not a CharacterMarkerSymbol!");
5c5ef5768893 Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents: 48
diff changeset
56 }
5c5ef5768893 Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents: 48
diff changeset
57 }
5c5ef5768893 Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents: 48
diff changeset
58
47
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
59 /**
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
60 * Reads the symbol attributes.
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
61 *
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
62 * @return The XML node.
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
63 */
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
64 public Element read()
74
7eba97e8201b Catch all exceptions in the MXDReader.
Raimund Renkert <rrenkert@intevation.de>
parents: 63
diff changeset
65 throws Exception {
47
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
66 logger.debug("read()");
80
83932f18dddc All symbol reader now extend the abstract symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
67 Element symbolElement = util.addSymbol(parent);
47
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
68
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
69 IColor c = symbol.getColor();
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
70 symbolElement.setAttribute(
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
71 "angle",
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
72 String.valueOf(symbol.getAngle()));
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
73 symbolElement.setAttribute(
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
74 "size",
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
75 String.valueOf(symbol.getSize()));
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
76 symbolElement.setAttribute(
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
77 "x_offset",
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
78 String.valueOf(symbol.getXOffset()));
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
79 symbolElement.setAttribute(
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
80 "y_offset",
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
81 String.valueOf(symbol.getYOffset()));
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
82 symbolElement.setAttribute(
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
83 "color",
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
84 String.valueOf(c.getRGB()));
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
85 symbolElement.setAttribute(
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
86 "tranparency",
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
87 String.valueOf(c.getTransparency()));
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
88 symbolElement.setAttribute(
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
89 "name",
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
90 symbol.getNameString());
48
8e6d529e9a22 Completed the CharacterSymbolMarkerReader.
Raimund Renkert <rrenkert@intevation.de>
parents: 47
diff changeset
91 symbolElement.setAttribute(
8e6d529e9a22 Completed the CharacterSymbolMarkerReader.
Raimund Renkert <rrenkert@intevation.de>
parents: 47
diff changeset
92 "char",
8e6d529e9a22 Completed the CharacterSymbolMarkerReader.
Raimund Renkert <rrenkert@intevation.de>
parents: 47
diff changeset
93 String.valueOf(symbol.getCharacterIndex()));
8e6d529e9a22 Completed the CharacterSymbolMarkerReader.
Raimund Renkert <rrenkert@intevation.de>
parents: 47
diff changeset
94
47
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
95 Font f = symbol.getFont();
48
8e6d529e9a22 Completed the CharacterSymbolMarkerReader.
Raimund Renkert <rrenkert@intevation.de>
parents: 47
diff changeset
96 symbolElement.setAttribute("font", f.getName());
8e6d529e9a22 Completed the CharacterSymbolMarkerReader.
Raimund Renkert <rrenkert@intevation.de>
parents: 47
diff changeset
97 symbolElement.setAttribute("char_set", String.valueOf(f.getCharset()));
8e6d529e9a22 Completed the CharacterSymbolMarkerReader.
Raimund Renkert <rrenkert@intevation.de>
parents: 47
diff changeset
98 symbolElement.setAttribute("bold", String.valueOf(f.getBold()));
8e6d529e9a22 Completed the CharacterSymbolMarkerReader.
Raimund Renkert <rrenkert@intevation.de>
parents: 47
diff changeset
99 symbolElement.setAttribute("italic", String.valueOf(f.getItalic()));
8e6d529e9a22 Completed the CharacterSymbolMarkerReader.
Raimund Renkert <rrenkert@intevation.de>
parents: 47
diff changeset
100 symbolElement.setAttribute("font_size", String.valueOf(f.getSize()));
8e6d529e9a22 Completed the CharacterSymbolMarkerReader.
Raimund Renkert <rrenkert@intevation.de>
parents: 47
diff changeset
101 symbolElement.setAttribute(
8e6d529e9a22 Completed the CharacterSymbolMarkerReader.
Raimund Renkert <rrenkert@intevation.de>
parents: 47
diff changeset
102 "strike_through",
8e6d529e9a22 Completed the CharacterSymbolMarkerReader.
Raimund Renkert <rrenkert@intevation.de>
parents: 47
diff changeset
103 String.valueOf(f.getStrikethrough()));
8e6d529e9a22 Completed the CharacterSymbolMarkerReader.
Raimund Renkert <rrenkert@intevation.de>
parents: 47
diff changeset
104 symbolElement.setAttribute("weight", String.valueOf(f.getWeight()));
47
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
105 symbolElement.setAttribute("style", "char");
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
106 return symbolElement;
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
107 }
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
108 }
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
109 // 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)