annotate src/java/de/intevation/mxd/reader/CharacterMarkerSymbolReader.java @ 89:475ee3e4bc8b

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