annotate src/java/de/intevation/mxd/reader/PictureLineSymbolReader.java @ 188:43f1cbdcd597

Modified and beautified the documentation: * INSTALL.txt, doku/Makefile, doku/source/conf.py, doku/source/functionality.txt, doku/source/index.txt, doku/source/restrictions.txt, website/favicon.png, LICENCE.txt: added more details to the content of the documentation. some more configurations. * doku/source/LICENCE.txt: New. Added a licence-text (symlinking into the documentation). * doku/source/_static/favicon.png, doku/source/_static/logo_wide.png, doku/source/_templates/indexsidebar.html, doku/source/_templates/layout.html: Optic-cosmetics.
author Stephan Holl <stephan.holl@intevation.de>
date Wed, 20 Jul 2011 15:53:01 +0200
parents a4ab239509f1
children df4e0946ef02
rev   line source
64
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
1 package de.intevation.mxd.reader;
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
2
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
3 import java.awt.Color;
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
4 import java.awt.Image;
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
5
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
6 import org.apache.log4j.Logger;
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
7
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
8 import com.esri.arcgis.display.ISymbol;
67
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 64
diff changeset
9 import com.esri.arcgis.display.ILineSymbol;
64
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
10 import com.esri.arcgis.display.PictureLineSymbol;
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
11 import com.esri.arcgis.support.ms.stdole.Picture;
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
12 import com.esri.arcgis.display.IRgbColor;
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
13 import com.esri.arcgis.display.RgbColor;
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
14
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
15 import org.w3c.dom.Element;
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
16 import java.io.IOException;
64
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
17
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
18 /**
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
19 * Reads picture line symbol information.
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
20 *
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
21 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a>
c73647bd71c0 Added picture line symbol 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 PictureLineSymbolReader
83932f18dddc All symbol reader now extend the abstract symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
24 extends AbstractSymbolReader {
64
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
25
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
26 /**
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
27 * The logger.
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
28 */
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
29 private static final Logger logger =
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
30 Logger.getLogger(SimpleLineSymbolReader.class);
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
31
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
32 /**
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
33 * Private member.
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
34 */
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
35 private PictureLineSymbol symbol;
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
36
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
37 public PictureLineSymbolReader(ISymbol symbol)
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
38 throws Exception {
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
39 logger.debug("contructor()");
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
40 if(symbol instanceof PictureLineSymbol) {
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
41 this.symbol = (PictureLineSymbol)symbol;
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
42 }
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
43 else {
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
44 throw new Exception("Not a PictureLineSymbol!");
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
45 }
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
46 }
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
47
67
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 64
diff changeset
48 public PictureLineSymbolReader(ILineSymbol symbol)
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 64
diff changeset
49 throws Exception {
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 64
diff changeset
50 logger.debug("contructor()");
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 64
diff changeset
51 if(symbol instanceof PictureLineSymbol) {
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 64
diff changeset
52 this.symbol = (PictureLineSymbol)symbol;
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 64
diff changeset
53 }
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 64
diff changeset
54 else {
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 64
diff changeset
55 throw new Exception("Not a PictureLineSymbol!");
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 64
diff changeset
56 }
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 64
diff changeset
57 }
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 64
diff changeset
58
64
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
59 /**
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
60 * Reads the symbol attributes.
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
61 *
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
62 * @return The XML node.
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
63 */
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
64 public Element read() {
84
2362609ffa66 Added TODOs for picture symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
65 //TODO Read the picture from mxd and write it as base64 string to the
2362609ffa66 Added TODOs for picture symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
66 // XML Element.
64
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
67 logger.debug("read()");
80
83932f18dddc All symbol reader now extend the abstract symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
68 Element symbolElement = util.addSymbol(parent);
64
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
69
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
70 try {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
71 symbolElement.setAttribute("name", symbol.getNameString());
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
72 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
73 catch(IOException ioe) {
135
a4ab239509f1 Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
74 logger.warn("Could not read name. Setting name to \"default\"");
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
75 symbolElement.setAttribute("name", "default");
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
76 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
77
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
78 try {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
79 if(symbol.getColor() instanceof IRgbColor) {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
80 IRgbColor color = (IRgbColor)symbol.getColor();
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
81 Color c = new Color (
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
82 color.getRed(),
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
83 color.getGreen(),
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
84 color.getBlue());
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
85 symbolElement.setAttribute("color", String.valueOf(c.getRGB()));
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
86 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
87 else {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
88 RgbColor col = new RgbColor();
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
89 col.setRGB(symbol.getColor().getRGB());
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
90 Color c = new Color (
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
91 col.getRed(),
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
92 col.getGreen(),
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
93 col.getBlue());
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
94 symbolElement.setAttribute("color", String.valueOf(c.getRGB()));
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
95 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
96 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
97 catch(IOException ioe) {
135
a4ab239509f1 Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
98 logger.warn("Could not read color.");
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
99 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
100
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
101 try {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
102 symbolElement.setAttribute(
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
103 "offset",
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
104 String.valueOf(symbol.getOffset()));
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
105 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
106 catch(IOException ioe) {
135
a4ab239509f1 Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
107 logger.warn("Could not read offset.");
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
108 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
109
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
110 try {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
111 symbolElement.setAttribute(
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
112 "x_scale",
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
113 String.valueOf(symbol.getXScale()));
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
114 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
115 catch(IOException ioe) {
135
a4ab239509f1 Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
116 logger.warn("Could not read x-scale.");
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
117 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
118
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
119 try {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
120 symbolElement.setAttribute(
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
121 "y_scale",
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
122 String.valueOf(symbol.getYScale()));
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
123 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
124 catch(IOException ioe) {
135
a4ab239509f1 Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
125 logger.warn("Could not read y-scale.");
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
126 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
127
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
128 try {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
129 symbolElement.setAttribute(
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
130 "width",
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
131 String.valueOf(symbol.getWidth()));
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
132 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
133 catch(IOException ioe) {
135
a4ab239509f1 Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
134 logger.warn("Could not read width.");
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
135 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
136
97
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents: 84
diff changeset
137 symbolElement.setAttribute("type", "line");
64
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
138 symbolElement.setAttribute("style", "picture");
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
139
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
140 return symbolElement;
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
141 }
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
142 }
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
143 // 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)