annotate src/java/de/intevation/mxd/reader/CartoLineSymbolReader.java @ 354:5c5c4ddb20bd

Remove outdated repository URL
author Tom Gottfried <tom@intevation.de>
date Mon, 04 Jan 2021 15:38:14 +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
65
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
20 package de.intevation.mxd.reader;
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
21
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
22 import java.awt.Color;
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
23
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
24 import org.apache.log4j.Logger;
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
25
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
26 import com.esri.arcgis.display.ISymbol;
67
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 65
diff changeset
27 import com.esri.arcgis.display.ILineSymbol;
65
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
28 import com.esri.arcgis.display.CartographicLineSymbol;
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
29 import com.esri.arcgis.display.IRgbColor;
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
30 import com.esri.arcgis.display.RgbColor;
136
7632850b9520 Convert cartographic line template to mapfile pattern.
Raimund Renkert <rrenkert@intevation.de>
parents: 135
diff changeset
31 import com.esri.arcgis.display.Template;
65
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
32
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
33 import com.esri.arcgis.display.esriLineCapStyle;
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
34 import com.esri.arcgis.display.esriLineJoinStyle;
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
35
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
36 import org.w3c.dom.Element;
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
37 import java.io.IOException;
65
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
38
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
39 /**
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
40 * Reads cartoline symbol information.
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
41 *
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
42 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a>
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
43 */
80
83932f18dddc All symbol reader now extend the abstract symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
44 public class CartoLineSymbolReader
83932f18dddc All symbol reader now extend the abstract symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
45 extends AbstractSymbolReader {
65
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
46
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
47 /**
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
48 * The logger.
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
49 */
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
50 private static final Logger logger =
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
51 Logger.getLogger(CartoLineSymbolReader.class);
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
52
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
53 /**
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
54 * Private member.
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
55 */
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
56 private CartographicLineSymbol symbol;
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
57
181
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
58 /**
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
59 * Constructor with symbol.
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
60 *
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
61 * @param symbol The symbol used to display lines.
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
62 */
65
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
63 public CartoLineSymbolReader(ISymbol symbol)
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
64 throws Exception {
336
a46adb3697fa Fix annoying typo. s/contructor/constructor
Andre Heinecke <aheinecke@intevation.de>
parents: 243
diff changeset
65 logger.debug("constructor()");
65
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
66 if(symbol instanceof CartographicLineSymbol) {
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
67 this.symbol = (CartographicLineSymbol)symbol;
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
68 }
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
69 else {
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
70 throw new Exception("Not a CartographicLineSymbol!");
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
71 }
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
72 }
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
73
181
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
74 /**
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
75 * Constructor with symbol.
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
76 *
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
77 * @param symbol The symbol used to display lines.
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
78 */
67
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 65
diff changeset
79 public CartoLineSymbolReader(ILineSymbol symbol)
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 65
diff changeset
80 throws Exception {
336
a46adb3697fa Fix annoying typo. s/contructor/constructor
Andre Heinecke <aheinecke@intevation.de>
parents: 243
diff changeset
81 logger.debug("constructor()");
67
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 65
diff changeset
82 if(symbol instanceof CartographicLineSymbol) {
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 65
diff changeset
83 this.symbol = (CartographicLineSymbol)symbol;
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 65
diff changeset
84 }
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 65
diff changeset
85 else {
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 65
diff changeset
86 throw new Exception("Not a CartographicLineSymbol!");
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 65
diff changeset
87 }
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 65
diff changeset
88 }
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 65
diff changeset
89
65
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
90 /**
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
91 * Reads the symbol attributes.
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
92 *
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
93 * @return The XML node.
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
94 */
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
95 public Element read() {
65
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
96 logger.debug("read()");
80
83932f18dddc All symbol reader now extend the abstract symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
97 Element symbolElement = util.addSymbol(parent);
65
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
98
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
99 try {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
100 symbolElement.setAttribute("name", symbol.getNameString());
65
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
101 }
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
102 catch(IOException ioe) {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
103 logger.warn("Could not read name. Setting name to \"default\"");
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
104 symbolElement.setAttribute("name", "default");
65
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
105 }
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
106
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
107 try {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
108 if(symbol.getColor() instanceof IRgbColor) {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
109 IRgbColor color = (IRgbColor)symbol.getColor();
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
110 Color c = new Color (
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
111 color.getRed(),
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
112 color.getGreen(),
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
113 color.getBlue());
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
114 symbolElement.setAttribute("color", String.valueOf(c.getRGB()));
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
115 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
116 else {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
117 RgbColor col = new RgbColor();
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
118 col.setRGB(symbol.getColor().getRGB());
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
119 Color c = new Color (
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
120 col.getRed(),
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
121 col.getGreen(),
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
122 col.getBlue());
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
123 symbolElement.setAttribute("color", String.valueOf(c.getRGB()));
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
124 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
125 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
126 catch(IOException ioe) {
135
a4ab239509f1 Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
127 logger.warn("Could not read color.");
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
128 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
129
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
130 int cap;
135
a4ab239509f1 Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
131 String capStyle = "";
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
132 try {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
133 cap = symbol.getCap();
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
134 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
135 catch(IOException ioe) {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
136 logger.warn(
135
a4ab239509f1 Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
137 "Could not read line cap.");
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
138 cap = -1;
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
139 }
65
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
140 switch(cap) {
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
141 case esriLineCapStyle.esriLCSRound: capStyle = "round"; break;
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
142 case esriLineCapStyle.esriLCSSquare: capStyle = "square"; break;
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
143 default: break;
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
144 }
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
145
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
146
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
147 int join;
135
a4ab239509f1 Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
148 String joinStyle = "";
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
149 try {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
150 join = symbol.getJoin();
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
151 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
152 catch(IOException ioe) {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
153 logger.warn(
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
154 "Could not read line join." +
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
155 " Setting line join to \"bevel\".");
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
156 join = -1;
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
157 }
65
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
158 switch(join) {
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
159 case esriLineJoinStyle.esriLJSRound: joinStyle = "round"; break;
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
160 case esriLineJoinStyle.esriLJSMitre: joinStyle = "miter"; break;
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
161 default: break;
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
162 }
135
a4ab239509f1 Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
163 if(!capStyle.equals("")) {
a4ab239509f1 Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
164 symbolElement.setAttribute("cap", capStyle);
a4ab239509f1 Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
165 }
a4ab239509f1 Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
166 if (!joinStyle.equals("")) {
a4ab239509f1 Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
167 symbolElement.setAttribute("join", joinStyle);
a4ab239509f1 Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
168 }
65
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
169
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
170 try {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
171 symbolElement.setAttribute(
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
172 "linestart",
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
173 String.valueOf(symbol.getLineStartOffset()));
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
174 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
175 catch(IOException ioe) {
135
a4ab239509f1 Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
176 logger.warn("Could not read line start offset.");
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
177 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
178
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
179 try {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
180 symbolElement.setAttribute(
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
181 "miterlimit",
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
182 String.valueOf(symbol.getMiterLimit()));
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
183 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
184 catch(IOException ioe) {
135
a4ab239509f1 Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
185 logger.warn("Could not read miter limit.");
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
186 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
187
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
188 try {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
189 symbolElement.setAttribute(
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
190 "offset",
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
191 String.valueOf(symbol.getOffset()));
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
192 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
193 catch(IOException ioe) {
135
a4ab239509f1 Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
194 logger.warn("Could not read offset.");
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
195 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
196
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
197 try {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
198 symbolElement.setAttribute(
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
199 "width",
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
200 String.valueOf(symbol.getWidth()));
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
201 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
202 catch(IOException ioe) {
135
a4ab239509f1 Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
203 logger.warn("Could not read width.");
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
204 }
136
7632850b9520 Convert cartographic line template to mapfile pattern.
Raimund Renkert <rrenkert@intevation.de>
parents: 135
diff changeset
205
7632850b9520 Convert cartographic line template to mapfile pattern.
Raimund Renkert <rrenkert@intevation.de>
parents: 135
diff changeset
206 try {
7632850b9520 Convert cartographic line template to mapfile pattern.
Raimund Renkert <rrenkert@intevation.de>
parents: 135
diff changeset
207 Template temp = (Template)symbol.getTemplate();
7632850b9520 Convert cartographic line template to mapfile pattern.
Raimund Renkert <rrenkert@intevation.de>
parents: 135
diff changeset
208 double length = temp.getInterval();
7632850b9520 Convert cartographic line template to mapfile pattern.
Raimund Renkert <rrenkert@intevation.de>
parents: 135
diff changeset
209 int count = temp.getPatternElementCount();
7632850b9520 Convert cartographic line template to mapfile pattern.
Raimund Renkert <rrenkert@intevation.de>
parents: 135
diff changeset
210 symbolElement.setAttribute("pattern_count", String.valueOf(count));
7632850b9520 Convert cartographic line template to mapfile pattern.
Raimund Renkert <rrenkert@intevation.de>
parents: 135
diff changeset
211 for (int j = 0; j < count; j++) {
7632850b9520 Convert cartographic line template to mapfile pattern.
Raimund Renkert <rrenkert@intevation.de>
parents: 135
diff changeset
212 double[] mark = new double[1];
7632850b9520 Convert cartographic line template to mapfile pattern.
Raimund Renkert <rrenkert@intevation.de>
parents: 135
diff changeset
213 double[] gap = new double[1];
7632850b9520 Convert cartographic line template to mapfile pattern.
Raimund Renkert <rrenkert@intevation.de>
parents: 135
diff changeset
214 temp.getPatternElement(j, mark, gap);
7632850b9520 Convert cartographic line template to mapfile pattern.
Raimund Renkert <rrenkert@intevation.de>
parents: 135
diff changeset
215 symbolElement.setAttribute(
7632850b9520 Convert cartographic line template to mapfile pattern.
Raimund Renkert <rrenkert@intevation.de>
parents: 135
diff changeset
216 "mark_" + j,
7632850b9520 Convert cartographic line template to mapfile pattern.
Raimund Renkert <rrenkert@intevation.de>
parents: 135
diff changeset
217 String.valueOf(mark[0]));
7632850b9520 Convert cartographic line template to mapfile pattern.
Raimund Renkert <rrenkert@intevation.de>
parents: 135
diff changeset
218 symbolElement.setAttribute("gap_" + j, String.valueOf(gap[0]));
7632850b9520 Convert cartographic line template to mapfile pattern.
Raimund Renkert <rrenkert@intevation.de>
parents: 135
diff changeset
219 }
7632850b9520 Convert cartographic line template to mapfile pattern.
Raimund Renkert <rrenkert@intevation.de>
parents: 135
diff changeset
220 }
7632850b9520 Convert cartographic line template to mapfile pattern.
Raimund Renkert <rrenkert@intevation.de>
parents: 135
diff changeset
221 catch(IOException ioe){
7632850b9520 Convert cartographic line template to mapfile pattern.
Raimund Renkert <rrenkert@intevation.de>
parents: 135
diff changeset
222 logger.warn("Could not read pattern elements.");
7632850b9520 Convert cartographic line template to mapfile pattern.
Raimund Renkert <rrenkert@intevation.de>
parents: 135
diff changeset
223 }
143
6d294beb0e59 Fixed exception handling for CartoLineSymbolReader.
vc11884admin@VC11884.win.bsh.de
parents: 136
diff changeset
224 catch(NullPointerException npe) {
6d294beb0e59 Fixed exception handling for CartoLineSymbolReader.
vc11884admin@VC11884.win.bsh.de
parents: 136
diff changeset
225 logger.debug("No pattern elements in carto line symbol");
6d294beb0e59 Fixed exception handling for CartoLineSymbolReader.
vc11884admin@VC11884.win.bsh.de
parents: 136
diff changeset
226 }
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
227 symbolElement.setAttribute("type", "line");
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
228 symbolElement.setAttribute("style", "carto");
65
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
229
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
230 return symbolElement;
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
231 }
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
232 }
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
233 // 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)