annotate src/java/de/intevation/mxd/reader/PictureMarkerSymbolReader.java @ 80:83932f18dddc

All symbol reader now extend the abstract symbol reader.
author Raimund Renkert <rrenkert@intevation.de>
date Fri, 27 May 2011 13:15:15 +0200
parents 7eba97e8201b
children 59e06c405a9a
rev   line source
58
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
1 package de.intevation.mxd.reader;
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
2
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
3 import java.io.IOException;
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
4
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
5 import org.apache.log4j.Logger;
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
6
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
7 import com.esri.arcgis.display.ISymbol;
63
5c5ef5768893 Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents: 58
diff changeset
8 import com.esri.arcgis.display.IMarkerSymbol;
58
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
9 import com.esri.arcgis.display.PictureMarkerSymbol;
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
10 import com.esri.arcgis.display.IColor;
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
11 import com.esri.arcgis.carto.PictureElement;
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
12
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
13 import org.w3c.dom.Element;
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
14 import de.intevation.mxd.utils.MapToXMLUtils;
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
15
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
16 /**
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
17 * Reads picture marker symbol information.
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
18 *
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
19 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a>
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
20 */
80
83932f18dddc All symbol reader now extend the abstract symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
21 public class PictureMarkerSymbolReader
83932f18dddc All symbol reader now extend the abstract symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
22 extends AbstractSymbolReader {
58
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
23
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
24 /**
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
25 * The logger.
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
26 */
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
27 private static final Logger logger =
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
28 Logger.getLogger(PictureMarkerSymbolReader.class);
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
29
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
30 /**
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
31 * Private member.
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
32 */
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
33 private PictureMarkerSymbol symbol;
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
34
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
35 public PictureMarkerSymbolReader(ISymbol symbol)
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
36 throws Exception {
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
37 logger.debug("contructor()");
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
38 if(symbol instanceof PictureMarkerSymbol) {
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
39 this.symbol = (PictureMarkerSymbol)symbol;
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
40 }
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
41 else {
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
42 throw new Exception("Not a PictureMarkerSymbol!");
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
43 }
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
44 }
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
45
63
5c5ef5768893 Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents: 58
diff changeset
46 public PictureMarkerSymbolReader(IMarkerSymbol symbol)
5c5ef5768893 Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents: 58
diff changeset
47 throws Exception {
5c5ef5768893 Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents: 58
diff changeset
48 logger.debug("contructor()");
5c5ef5768893 Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents: 58
diff changeset
49 if(symbol instanceof PictureMarkerSymbol) {
5c5ef5768893 Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents: 58
diff changeset
50 this.symbol = (PictureMarkerSymbol)symbol;
5c5ef5768893 Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents: 58
diff changeset
51 }
5c5ef5768893 Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents: 58
diff changeset
52 else {
5c5ef5768893 Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents: 58
diff changeset
53 throw new Exception("Not a PictureMarkerSymbol!");
5c5ef5768893 Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents: 58
diff changeset
54 }
5c5ef5768893 Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents: 58
diff changeset
55 }
5c5ef5768893 Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents: 58
diff changeset
56
58
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
57 /**
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
58 * Reads the symbol attributes.
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
59 *
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
60 * @return The XML node.
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
61 */
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
62 public Element read()
74
7eba97e8201b Catch all exceptions in the MXDReader.
Raimund Renkert <rrenkert@intevation.de>
parents: 69
diff changeset
63 throws Exception {
58
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
64 logger.debug("read()");
80
83932f18dddc All symbol reader now extend the abstract symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
65 Element symbolElement = util.addSymbol(parent);
58
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
66
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
67 symbolElement.setAttribute(
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
68 "angle",
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
69 String.valueOf(symbol.getAngle()));
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
70 symbolElement.setAttribute(
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
71 "size",
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
72 String.valueOf(symbol.getSize()));
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
73 symbolElement.setAttribute(
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
74 "x_offset",
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
75 String.valueOf(symbol.getXOffset()));
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
76 symbolElement.setAttribute(
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
77 "y_offset",
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
78 String.valueOf(symbol.getYOffset()));
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
79 symbolElement.setAttribute(
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
80 "name",
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
81 symbol.getNameString());
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
82 PictureElement pElem = new PictureElement();
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
83 pElem.importPicture(symbol.getPicture());
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
84 symbolElement.setAttribute("style", "picture");
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
85 return symbolElement;
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
86 }
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
87 }
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
88 // 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)