Mercurial > mxd2map
annotate src/java/de/intevation/mxd/reader/UniqueValueRendererReader.java @ 354:5c5c4ddb20bd
Remove outdated repository URL
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Mon, 04 Jan 2021 15:38:14 +0100 |
parents | ee77a3ae0201 |
children |
rev | line source |
---|---|
243
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
185
diff
changeset
|
1 /* |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
185
diff
changeset
|
2 * Copyright (c) 2011 by Intevation GmbH, Germany <info@intevation.de> |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
185
diff
changeset
|
3 * |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
185
diff
changeset
|
4 * This file is part of MXD2map. |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
185
diff
changeset
|
5 * |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
185
diff
changeset
|
6 * This program is free software under the LGPL (>=v2.1) |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
185
diff
changeset
|
7 * Read the file LICENCE.txt coming with the software for details |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
185
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:
185
diff
changeset
|
9 * |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
185
diff
changeset
|
10 * MXD2map has been developed on behalf of the |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
185
diff
changeset
|
11 * Bundesamt fuer Seeschifffahrt und Hydrographie (BSH) in Hamburg |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
185
diff
changeset
|
12 * by Intevation GmbH. |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
185
diff
changeset
|
13 * |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
185
diff
changeset
|
14 * Authors: |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
185
diff
changeset
|
15 * Raimund Renkert <raimund.renkert@intevation.de> |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
185
diff
changeset
|
16 * Bjoern Schilberg <bjoern.schilberg@intevation.de> |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
185
diff
changeset
|
17 * Stephan Holl <stephan.holl@intevation.de> |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
185
diff
changeset
|
18 */ |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
185
diff
changeset
|
19 |
33
c51376f8e24c
Separated converter components into packages.
Raimund Renkert <rrenkert@intevation.de>
parents:
31
diff
changeset
|
20 package de.intevation.mxd.reader; |
25
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
21 |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
22 import org.apache.log4j.Logger; |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
23 |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
24 import com.esri.arcgis.carto.IFeatureRenderer; |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
25 import com.esri.arcgis.display.ISymbol; |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
26 import com.esri.arcgis.carto.UniqueValueRenderer; |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
27 |
31
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
28 import org.w3c.dom.Element; |
116
c8a1361ddd38
Improved exceptionhandlin for renderer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
29 import java.io.IOException; |
31
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
30 |
33
c51376f8e24c
Separated converter components into packages.
Raimund Renkert <rrenkert@intevation.de>
parents:
31
diff
changeset
|
31 import de.intevation.mxd.utils.MapToXMLUtils; |
c51376f8e24c
Separated converter components into packages.
Raimund Renkert <rrenkert@intevation.de>
parents:
31
diff
changeset
|
32 |
25
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
33 /** |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
34 * Reads unique vaule renderer information. |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
35 * |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
36 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
37 */ |
31
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
38 public class UniqueValueRendererReader |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
39 implements IRendererReader { |
25
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
40 |
31
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
41 /** |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
42 * The logger. |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
43 */ |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
44 private static final Logger logger = |
337
ee77a3ae0201
* src/java/de/intevation/mxd/reader/UniqueValueRendererReader.java:
Andre Heinecke <aheinecke@intevation.de>
parents:
243
diff
changeset
|
45 Logger.getLogger(UniqueValueRendererReader.class); |
25
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
46 |
31
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
47 /** |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
48 * Private Member. |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
49 */ |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
50 private UniqueValueRenderer renderer; |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
51 private Element layer; |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
52 private MapToXMLUtils util; |
25
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
53 |
181 | 54 /** |
55 * Constructor with renderer. | |
56 * | |
57 * @param renderer ArcGIS renderer. | |
58 */ | |
31
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
59 public UniqueValueRendererReader(IFeatureRenderer renderer) |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
60 throws Exception { |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
61 logger.debug("constructor()"); |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
62 if (renderer instanceof UniqueValueRenderer) { |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
63 this.renderer = (UniqueValueRenderer)renderer; |
25
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
64 } |
31
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
65 else { |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
66 throw new Exception ("Not an instance of UniqueValueRenderer."); |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
67 } |
25
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
68 } |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
69 |
31
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
70 /** |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
71 * Setter for the parent XML element. |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
72 * |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
73 * @param parent The XML parent node. |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
74 */ |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
75 public void setParent(Element parent) { |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
76 this.layer = parent; |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
77 } |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
78 |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
79 /** |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
80 * Setter for XML document helper. |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
81 * |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
82 * @param util The helper class for storing map information. |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
83 */ |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
84 public void setUtil(MapToXMLUtils util) { |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
85 this.util = util; |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
86 } |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
87 |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
88 /** |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
89 * Reads the renderer attributes. |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
90 * |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
91 * @return The parent XML node. |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
92 */ |
116
c8a1361ddd38
Improved exceptionhandlin for renderer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
93 public Element read() { |
c8a1361ddd38
Improved exceptionhandlin for renderer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
94 int count = 0; |
c8a1361ddd38
Improved exceptionhandlin for renderer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
95 try { |
c8a1361ddd38
Improved exceptionhandlin for renderer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
96 count = renderer.getClassCount(); |
337
ee77a3ae0201
* src/java/de/intevation/mxd/reader/UniqueValueRendererReader.java:
Andre Heinecke <aheinecke@intevation.de>
parents:
243
diff
changeset
|
97 logger.debug("Renderer with " + count + " classes."); |
116
c8a1361ddd38
Improved exceptionhandlin for renderer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
98 } |
c8a1361ddd38
Improved exceptionhandlin for renderer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
99 catch(IOException ioe) { |
117
6c3d880db7c5
Improved exception handling for layer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
116
diff
changeset
|
100 logger.error( |
6c3d880db7c5
Improved exception handling for layer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
116
diff
changeset
|
101 "Could not read class count."+ |
6c3d880db7c5
Improved exception handling for layer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
116
diff
changeset
|
102 " Stopped reading renderer."); |
116
c8a1361ddd38
Improved exceptionhandlin for renderer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
103 return layer; |
c8a1361ddd38
Improved exceptionhandlin for renderer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
104 } |
151
1623c8c99135
Read all classes with UniqueValueRendererReader, including the last one.
vc11884admin@VC11884.win.bsh.de
parents:
134
diff
changeset
|
105 for(int i = 0; i < count; i++) { |
74
7eba97e8201b
Catch all exceptions in the MXDReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
73
diff
changeset
|
106 Element rendererElement = util.addRenderer(layer); |
337
ee77a3ae0201
* src/java/de/intevation/mxd/reader/UniqueValueRendererReader.java:
Andre Heinecke <aheinecke@intevation.de>
parents:
243
diff
changeset
|
107 ISymbol sym; |
116
c8a1361ddd38
Improved exceptionhandlin for renderer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
108 try { |
337
ee77a3ae0201
* src/java/de/intevation/mxd/reader/UniqueValueRendererReader.java:
Andre Heinecke <aheinecke@intevation.de>
parents:
243
diff
changeset
|
109 if (!renderer.isUseDefaultSymbol() || i != count - 1) { |
ee77a3ae0201
* src/java/de/intevation/mxd/reader/UniqueValueRendererReader.java:
Andre Heinecke <aheinecke@intevation.de>
parents:
243
diff
changeset
|
110 // When a default symbol exists the last class is the default class |
ee77a3ae0201
* src/java/de/intevation/mxd/reader/UniqueValueRendererReader.java:
Andre Heinecke <aheinecke@intevation.de>
parents:
243
diff
changeset
|
111 String value = renderer.getValue(i); |
ee77a3ae0201
* src/java/de/intevation/mxd/reader/UniqueValueRendererReader.java:
Andre Heinecke <aheinecke@intevation.de>
parents:
243
diff
changeset
|
112 String fieldSep = renderer.getFieldDelimiter(); |
ee77a3ae0201
* src/java/de/intevation/mxd/reader/UniqueValueRendererReader.java:
Andre Heinecke <aheinecke@intevation.de>
parents:
243
diff
changeset
|
113 if(value.indexOf(fieldSep) > 0) { |
ee77a3ae0201
* src/java/de/intevation/mxd/reader/UniqueValueRendererReader.java:
Andre Heinecke <aheinecke@intevation.de>
parents:
243
diff
changeset
|
114 int j = 0; |
ee77a3ae0201
* src/java/de/intevation/mxd/reader/UniqueValueRendererReader.java:
Andre Heinecke <aheinecke@intevation.de>
parents:
243
diff
changeset
|
115 while(value.indexOf(fieldSep) > 0) { |
ee77a3ae0201
* src/java/de/intevation/mxd/reader/UniqueValueRendererReader.java:
Andre Heinecke <aheinecke@intevation.de>
parents:
243
diff
changeset
|
116 String v = value.substring(0, value.indexOf(fieldSep)); |
ee77a3ae0201
* src/java/de/intevation/mxd/reader/UniqueValueRendererReader.java:
Andre Heinecke <aheinecke@intevation.de>
parents:
243
diff
changeset
|
117 rendererElement.setAttribute("value_" + j, v); |
ee77a3ae0201
* src/java/de/intevation/mxd/reader/UniqueValueRendererReader.java:
Andre Heinecke <aheinecke@intevation.de>
parents:
243
diff
changeset
|
118 value = value.substring( |
ee77a3ae0201
* src/java/de/intevation/mxd/reader/UniqueValueRendererReader.java:
Andre Heinecke <aheinecke@intevation.de>
parents:
243
diff
changeset
|
119 value.indexOf(fieldSep) + fieldSep.length(), |
ee77a3ae0201
* src/java/de/intevation/mxd/reader/UniqueValueRendererReader.java:
Andre Heinecke <aheinecke@intevation.de>
parents:
243
diff
changeset
|
120 value.length()); |
ee77a3ae0201
* src/java/de/intevation/mxd/reader/UniqueValueRendererReader.java:
Andre Heinecke <aheinecke@intevation.de>
parents:
243
diff
changeset
|
121 j++; |
ee77a3ae0201
* src/java/de/intevation/mxd/reader/UniqueValueRendererReader.java:
Andre Heinecke <aheinecke@intevation.de>
parents:
243
diff
changeset
|
122 } |
ee77a3ae0201
* src/java/de/intevation/mxd/reader/UniqueValueRendererReader.java:
Andre Heinecke <aheinecke@intevation.de>
parents:
243
diff
changeset
|
123 rendererElement.setAttribute("value_" + j, value); |
134
acc9e5430177
Handle SDE connection attributes and expressions.
vc11884admin@VC11884.win.bsh.de
parents:
117
diff
changeset
|
124 } |
337
ee77a3ae0201
* src/java/de/intevation/mxd/reader/UniqueValueRendererReader.java:
Andre Heinecke <aheinecke@intevation.de>
parents:
243
diff
changeset
|
125 else { |
ee77a3ae0201
* src/java/de/intevation/mxd/reader/UniqueValueRendererReader.java:
Andre Heinecke <aheinecke@intevation.de>
parents:
243
diff
changeset
|
126 rendererElement.setAttribute("value", value); |
ee77a3ae0201
* src/java/de/intevation/mxd/reader/UniqueValueRendererReader.java:
Andre Heinecke <aheinecke@intevation.de>
parents:
243
diff
changeset
|
127 } |
ee77a3ae0201
* src/java/de/intevation/mxd/reader/UniqueValueRendererReader.java:
Andre Heinecke <aheinecke@intevation.de>
parents:
243
diff
changeset
|
128 |
ee77a3ae0201
* src/java/de/intevation/mxd/reader/UniqueValueRendererReader.java:
Andre Heinecke <aheinecke@intevation.de>
parents:
243
diff
changeset
|
129 value = renderer.getValue(i); |
ee77a3ae0201
* src/java/de/intevation/mxd/reader/UniqueValueRendererReader.java:
Andre Heinecke <aheinecke@intevation.de>
parents:
243
diff
changeset
|
130 rendererElement.setAttribute("name", renderer.esri_getClass(i)); |
ee77a3ae0201
* src/java/de/intevation/mxd/reader/UniqueValueRendererReader.java:
Andre Heinecke <aheinecke@intevation.de>
parents:
243
diff
changeset
|
131 rendererElement.setAttribute("description", |
ee77a3ae0201
* src/java/de/intevation/mxd/reader/UniqueValueRendererReader.java:
Andre Heinecke <aheinecke@intevation.de>
parents:
243
diff
changeset
|
132 renderer.getDescription(value)); |
ee77a3ae0201
* src/java/de/intevation/mxd/reader/UniqueValueRendererReader.java:
Andre Heinecke <aheinecke@intevation.de>
parents:
243
diff
changeset
|
133 |
ee77a3ae0201
* src/java/de/intevation/mxd/reader/UniqueValueRendererReader.java:
Andre Heinecke <aheinecke@intevation.de>
parents:
243
diff
changeset
|
134 rendererElement.setAttribute("label", renderer.getLabel(value)); |
ee77a3ae0201
* src/java/de/intevation/mxd/reader/UniqueValueRendererReader.java:
Andre Heinecke <aheinecke@intevation.de>
parents:
243
diff
changeset
|
135 rendererElement.setAttribute( |
ee77a3ae0201
* src/java/de/intevation/mxd/reader/UniqueValueRendererReader.java:
Andre Heinecke <aheinecke@intevation.de>
parents:
243
diff
changeset
|
136 "field_count", |
ee77a3ae0201
* src/java/de/intevation/mxd/reader/UniqueValueRendererReader.java:
Andre Heinecke <aheinecke@intevation.de>
parents:
243
diff
changeset
|
137 String.valueOf(renderer.getFieldCount())); |
ee77a3ae0201
* src/java/de/intevation/mxd/reader/UniqueValueRendererReader.java:
Andre Heinecke <aheinecke@intevation.de>
parents:
243
diff
changeset
|
138 for(int j = 0; j < renderer.getFieldCount(); j++) { |
ee77a3ae0201
* src/java/de/intevation/mxd/reader/UniqueValueRendererReader.java:
Andre Heinecke <aheinecke@intevation.de>
parents:
243
diff
changeset
|
139 rendererElement.setAttribute( |
ee77a3ae0201
* src/java/de/intevation/mxd/reader/UniqueValueRendererReader.java:
Andre Heinecke <aheinecke@intevation.de>
parents:
243
diff
changeset
|
140 "expression_field_" + j, |
ee77a3ae0201
* src/java/de/intevation/mxd/reader/UniqueValueRendererReader.java:
Andre Heinecke <aheinecke@intevation.de>
parents:
243
diff
changeset
|
141 renderer.getField(j)); |
ee77a3ae0201
* src/java/de/intevation/mxd/reader/UniqueValueRendererReader.java:
Andre Heinecke <aheinecke@intevation.de>
parents:
243
diff
changeset
|
142 } |
ee77a3ae0201
* src/java/de/intevation/mxd/reader/UniqueValueRendererReader.java:
Andre Heinecke <aheinecke@intevation.de>
parents:
243
diff
changeset
|
143 rendererElement.setAttribute("expression_operator", "="); |
ee77a3ae0201
* src/java/de/intevation/mxd/reader/UniqueValueRendererReader.java:
Andre Heinecke <aheinecke@intevation.de>
parents:
243
diff
changeset
|
144 sym = renderer.getSymbol(value); |
ee77a3ae0201
* src/java/de/intevation/mxd/reader/UniqueValueRendererReader.java:
Andre Heinecke <aheinecke@intevation.de>
parents:
243
diff
changeset
|
145 } else { |
ee77a3ae0201
* src/java/de/intevation/mxd/reader/UniqueValueRendererReader.java:
Andre Heinecke <aheinecke@intevation.de>
parents:
243
diff
changeset
|
146 sym = renderer.getDefaultSymbol(); |
134
acc9e5430177
Handle SDE connection attributes and expressions.
vc11884admin@VC11884.win.bsh.de
parents:
117
diff
changeset
|
147 } |
116
c8a1361ddd38
Improved exceptionhandlin for renderer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
148 MarkerSymbolReader markerReader = new MarkerSymbolReader(); |
c8a1361ddd38
Improved exceptionhandlin for renderer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
149 LineSymbolReader lineReader = new LineSymbolReader(); |
c8a1361ddd38
Improved exceptionhandlin for renderer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
150 FillSymbolReader fillReader = new FillSymbolReader(); |
c8a1361ddd38
Improved exceptionhandlin for renderer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
151 if(markerReader.canRead(sym)) { |
c8a1361ddd38
Improved exceptionhandlin for renderer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
152 markerReader.setSymbol(sym); |
c8a1361ddd38
Improved exceptionhandlin for renderer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
153 markerReader.setUtil(util); |
c8a1361ddd38
Improved exceptionhandlin for renderer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
154 markerReader.setParent(rendererElement); |
c8a1361ddd38
Improved exceptionhandlin for renderer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
155 markerReader.read(); |
c8a1361ddd38
Improved exceptionhandlin for renderer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
156 } |
c8a1361ddd38
Improved exceptionhandlin for renderer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
157 else if(lineReader.canRead(sym)) { |
c8a1361ddd38
Improved exceptionhandlin for renderer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
158 lineReader.setSymbol(sym); |
c8a1361ddd38
Improved exceptionhandlin for renderer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
159 lineReader.setUtil(util); |
c8a1361ddd38
Improved exceptionhandlin for renderer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
160 lineReader.setParent(rendererElement); |
c8a1361ddd38
Improved exceptionhandlin for renderer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
161 lineReader.read(); |
c8a1361ddd38
Improved exceptionhandlin for renderer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
162 } |
c8a1361ddd38
Improved exceptionhandlin for renderer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
163 else if(fillReader.canRead(sym)) { |
c8a1361ddd38
Improved exceptionhandlin for renderer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
164 fillReader.setSymbol(sym); |
c8a1361ddd38
Improved exceptionhandlin for renderer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
165 fillReader.setUtil(util); |
c8a1361ddd38
Improved exceptionhandlin for renderer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
166 fillReader.setParent(rendererElement); |
c8a1361ddd38
Improved exceptionhandlin for renderer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
167 fillReader.read(); |
c8a1361ddd38
Improved exceptionhandlin for renderer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
168 } |
c8a1361ddd38
Improved exceptionhandlin for renderer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
169 else { |
c8a1361ddd38
Improved exceptionhandlin for renderer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
170 logger.debug("Not a known symbol type: " + |
c8a1361ddd38
Improved exceptionhandlin for renderer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
171 sym.getClass().toString()); |
c8a1361ddd38
Improved exceptionhandlin for renderer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
172 } |
74
7eba97e8201b
Catch all exceptions in the MXDReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
73
diff
changeset
|
173 } |
116
c8a1361ddd38
Improved exceptionhandlin for renderer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
174 catch(Exception e) { |
c8a1361ddd38
Improved exceptionhandlin for renderer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
175 logger.error( |
c8a1361ddd38
Improved exceptionhandlin for renderer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
176 "Could not read unique value data." + |
c8a1361ddd38
Improved exceptionhandlin for renderer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
177 e.toString()); |
c8a1361ddd38
Improved exceptionhandlin for renderer reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
178 return layer; |
31
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
179 } |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
180 } |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
181 return layer; |
25
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
182 } |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
183 } |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
184 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |