Mercurial > dive4elements > gnv-client
annotate gnv-artifacts/src/main/java/de/intevation/gnv/state/CoordinateSelectionState.java @ 822:ac1b9f00603f
Added more Javadoc. Removed obsolet TODO-Flags. Added missing Files to Revision 907
gnv-artifacts/trunk@909 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Tue, 13 Apr 2010 08:17:00 +0000 |
parents | 22c18083225e |
children | 499cfbbb61bc |
rev | line source |
---|---|
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.gnv.state; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
2 |
779
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
778
diff
changeset
|
3 import com.vividsolutions.jts.geom.Point; |
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
778
diff
changeset
|
4 |
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
778
diff
changeset
|
5 import de.intevation.artifactdatabase.Config; |
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
778
diff
changeset
|
6 |
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
778
diff
changeset
|
7 import de.intevation.gnv.geobackend.base.Result; |
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
778
diff
changeset
|
8 |
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
778
diff
changeset
|
9 import de.intevation.gnv.state.describedata.DefaultKeyValueDescribeData; |
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
778
diff
changeset
|
10 import de.intevation.gnv.state.describedata.KeyValueDescibeData; |
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
778
diff
changeset
|
11 import de.intevation.gnv.state.describedata.NamedArrayList; |
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
778
diff
changeset
|
12 import de.intevation.gnv.state.describedata.NamedCollection; |
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
778
diff
changeset
|
13 |
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
778
diff
changeset
|
14 import de.intevation.gnv.utils.ArtifactXMLUtilities; |
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
778
diff
changeset
|
15 import de.intevation.gnv.utils.InputValidator; |
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
778
diff
changeset
|
16 import de.intevation.gnv.utils.WKTUtils; |
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
778
diff
changeset
|
17 |
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
778
diff
changeset
|
18 import de.intevation.gnv.utils.exception.ValidationException; |
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
778
diff
changeset
|
19 |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
20 import java.util.ArrayList; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
21 import java.util.Collection; |
511
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
22 import java.util.HashMap; |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
23 import java.util.Iterator; |
470
b7bb66440cc8
Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
461
diff
changeset
|
24 import java.util.List; |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
25 |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
26 import org.apache.log4j.Logger; |
779
b1f5f2a8840f
Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
778
diff
changeset
|
27 |
511
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
28 import org.w3c.dom.Element; |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
29 import org.w3c.dom.Node; |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
30 import org.w3c.dom.NodeList; |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
31 |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
32 /** |
796
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
33 * This state handles coordinate input by the user. It searches database results |
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
34 * for coordinates and turns them into a human readable form. |
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
35 * |
780
c4156275c1e1
Bring @author javadoc tags in form '@author <a href="john.doe@example.com">John Doe</a>'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
779
diff
changeset
|
36 * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
37 * |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
38 */ |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
39 public class CoordinateSelectionState extends StateBase { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
40 |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
41 /** |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
42 * the logger, used to log exceptions and additonaly information |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
43 */ |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
44 private static Logger log = Logger.getLogger(CoordinateSelectionState.class); |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
607
diff
changeset
|
45 |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
46 /** |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
47 * The UID of this Class |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
48 */ |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
49 private static final long serialVersionUID = 6318923553625195063L; |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
607
diff
changeset
|
50 |
511
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
51 /** |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
52 * XPATH Expressions for the setup. |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
53 */ |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
607
diff
changeset
|
54 |
511
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
55 private final static String MESH_WIDTH_XPATH = "mesh-width"; |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
56 private final static String XLINK_XPATH = "xlink:href"; |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
57 private final static String MESH_LIST_XPATH = "/mesh-widths/mesh"; |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
58 private final static String ID_XPATH = "id"; |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
59 private final static String WIDTH_VALUE_XPATH = "width"; |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
607
diff
changeset
|
60 |
511
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
61 /** |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
62 * Holds all given Widths between two MeshPoints for different Meshes. |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
63 */ |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
64 private HashMap<String, Double> meshWidths = null; |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
65 |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
66 /** |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
67 * Constructor |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
68 */ |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
69 public CoordinateSelectionState() { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
70 super(); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
71 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
72 |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
73 @Override |
607
292fbcd5e9ac
Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
511
diff
changeset
|
74 protected List<Object> purifyResult(Collection<Result> result, String uuid) { |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
75 log.debug("CoordinateSelectionState.purifyResult"); |
607
292fbcd5e9ac
Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
511
diff
changeset
|
76 List<Object> describeData = new ArrayList<Object>(); |
292fbcd5e9ac
Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
511
diff
changeset
|
77 |
292fbcd5e9ac
Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
511
diff
changeset
|
78 NamedCollection<KeyValueDescibeData> keyValueDescibeData = |
292fbcd5e9ac
Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
511
diff
changeset
|
79 extractKVP(result, "FEATUREID", "SHAPE"); |
292fbcd5e9ac
Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
511
diff
changeset
|
80 |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
81 describeData.add(keyValueDescibeData); |
607
292fbcd5e9ac
Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
511
diff
changeset
|
82 return describeData; |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
83 } |
607
292fbcd5e9ac
Parted the cache blob into pieces and changed the way how user input is stored on each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
511
diff
changeset
|
84 |
815
22c18083225e
Removed compiler warnings while JavaDoc generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
796
diff
changeset
|
85 |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
86 @Override |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
87 protected String prepareInputData4RegionDBQuery(String value) { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
88 log.debug("CoordinateSelectionState.prepareInputData4RegionDBQuery"); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
89 double distance=0.; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
90 String returnValue = null; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
91 try { |
796
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
92 @SuppressWarnings("static-access") |
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
93 Point center = InputValidator.getPointValue(value); |
511
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
94 String meshId = super.inputData.get("meshid").getValue(); |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
95 int segments = 97; |
511
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
96 if (meshWidths != null){ |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
97 Double distanceValue = this.meshWidths.get(meshId); |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
98 if (distanceValue != null){ |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
99 log.debug("User "+distanceValue+" as Buffer around given Point"); |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
100 distance = distanceValue.doubleValue(); |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
101 }else{ |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
102 log.warn("No distance is configured for Mesh with id"+ meshId); |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
103 } |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
104 }else{ |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
105 log.warn("No MeshWidth configured. Check if this is correct."); |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
106 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
107 returnValue = center.buffer(distance,segments).toText(); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
108 } catch (NumberFormatException e) { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
109 log.error(e,e); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
110 } catch (ValidationException e) { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
111 log.error(e,e); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
112 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
113 return returnValue; |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
607
diff
changeset
|
114 |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
115 } |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
607
diff
changeset
|
116 |
815
22c18083225e
Removed compiler warnings while JavaDoc generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
796
diff
changeset
|
117 |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
118 @Override |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
119 protected NamedCollection<KeyValueDescibeData> extractKVP( |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
120 Collection<Result> result, |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
121 String keyid, |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
122 String valueid) { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
123 Iterator<Result> rit = result.iterator(); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
124 NamedCollection<KeyValueDescibeData> keyValueDescibeData = new NamedArrayList<KeyValueDescibeData>( |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
125 this.dataName, result.size()); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
126 keyValueDescibeData.setMultiSelect(this.dataMultiSelect); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
127 String prevKey = null; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
128 while (rit.hasNext()) { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
129 Result resultValue = rit.next(); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
130 String key = resultValue.getString(keyid); |
461
3ddc22aab764
Removed Encodingerrors from listed Files. All Files are now UTF-8 compliant.
Tim Englich <tim.englich@intevation.de>
parents:
335
diff
changeset
|
131 if(prevKey == null || !prevKey.equals(key)){ // TODO: FIXME: We have to do that because the arcsde does not support a distinct Query on Layers |
796
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
132 @SuppressWarnings("static-access") |
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
133 String geomString = CoordinateSelectionState.convert2DisplayCoordinate(resultValue.getString(valueid)); |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
134 String value = geomString; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
135 if (resultValue.getResultDescriptor().getColumnIndex("VALUE") > 0){ |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
136 value = resultValue.getString("VALUE") + " - "+value; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
137 } |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
607
diff
changeset
|
138 |
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
607
diff
changeset
|
139 |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
140 keyValueDescibeData.add(new DefaultKeyValueDescribeData(key,value )); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
141 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
142 prevKey = key; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
143 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
144 return keyValueDescibeData; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
145 } |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
607
diff
changeset
|
146 |
796
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
147 /** |
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
148 * Turn coordinate into a human readable format. |
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
149 * |
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
150 * @param wkt Coordinate as wkt string. |
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
151 * @return formatted coordinate. |
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
152 */ |
507
45be952a3215
Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
470
diff
changeset
|
153 protected static String convert2DisplayCoordinate(String wkt){ |
45be952a3215
Solved some issues. Removed encoding problems while formatting coordinates (issue137) and use this format as subtitle in charts (issue136).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
470
diff
changeset
|
154 return WKTUtils.toText(wkt); |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
155 } |
511
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
156 |
815
22c18083225e
Removed compiler warnings while JavaDoc generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
796
diff
changeset
|
157 |
511
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
158 @Override |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
159 public void setup(Node configuration) { |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
160 super.setup(configuration); |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
161 Element widthElement = (Element)Config.getNodeXPath(configuration, MESH_WIDTH_XPATH); |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
607
diff
changeset
|
162 |
511
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
163 if (widthElement != null){ |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
164 String fileName = widthElement.getAttribute(XLINK_XPATH); |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
165 fileName = Config.replaceConfigDir(fileName); |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
166 Node configurationNode = new ArtifactXMLUtilities().readConfiguration(fileName); |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
167 NodeList meshNodes = Config.getNodeSetXPath(configurationNode,MESH_LIST_XPATH ); |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
168 if (meshNodes != null){ |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
169 meshWidths = new HashMap<String, Double>(meshNodes.getLength()); |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
170 for (int i = 0; i < meshNodes.getLength(); i++){ |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
171 Element meshNode = (Element)meshNodes.item(i); |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
172 String id = meshNode.getAttribute(ID_XPATH); |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
173 Double value = Double.parseDouble(meshNode.getAttribute(WIDTH_VALUE_XPATH)); |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
174 meshWidths.put(id, value); |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
175 } |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
176 } |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
177 }else{ |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
178 log.warn("No Mesh Width defined."); |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
179 } |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
180 } |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
181 } |
796
a5526908f92f
Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
182 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |