Mercurial > dive4elements > gnv-client
annotate gnv-artifacts/src/main/java/de/intevation/gnv/state/CoordinateSelectionState.java @ 795:cdade5005cba
Added javadoc in jfreechart package.
gnv-artifacts/trunk@877 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Wed, 31 Mar 2010 13:48:07 +0000 |
parents | c4156275c1e1 |
children | a5526908f92f |
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 /** |
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
|
33 * @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
|
34 * |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
35 */ |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
36 public class CoordinateSelectionState extends StateBase { |
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 * the logger, used to log exceptions and additonaly information |
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 private static Logger log = Logger.getLogger(CoordinateSelectionState.class); |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
607
diff
changeset
|
42 |
335
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 * The UID of this Class |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
45 */ |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
46 private static final long serialVersionUID = 6318923553625195063L; |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
607
diff
changeset
|
47 |
511
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
48 /** |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
49 * 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
|
50 */ |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
607
diff
changeset
|
51 |
511
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
52 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
|
53 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
|
54 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
|
55 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
|
56 private final static String WIDTH_VALUE_XPATH = "width"; |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
607
diff
changeset
|
57 |
511
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
58 /** |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
59 * 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
|
60 */ |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
61 private HashMap<String, Double> meshWidths = null; |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
62 |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
63 /** |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
64 * Constructor |
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 public CoordinateSelectionState() { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
67 super(); |
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 |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
70 @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
|
71 protected List<Object> purifyResult(Collection<Result> result, String uuid) { |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
72 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
|
73 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
|
74 |
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
|
75 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
|
76 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
|
77 |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
78 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
|
79 return describeData; |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
80 } |
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
|
81 |
511
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
82 /** |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
83 * @see de.intevation.gnv.state.StateBase#prepareInputData4RegionDBQuery(java.lang.String) |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
84 */ |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
85 @Override |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
86 protected String prepareInputData4RegionDBQuery(String value) { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
87 log.debug("CoordinateSelectionState.prepareInputData4RegionDBQuery"); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
88 double distance=0.; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
89 String returnValue = null; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
90 try { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
91 Point center = new InputValidator().getPointValue(value); |
511
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
92 String meshId = super.inputData.get("meshid").getValue(); |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
93 int segments = 97; |
511
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
94 if (meshWidths != null){ |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
95 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
|
96 if (distanceValue != null){ |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
97 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
|
98 distance = distanceValue.doubleValue(); |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
99 }else{ |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
100 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
|
101 } |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
102 }else{ |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
103 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
|
104 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
105 returnValue = center.buffer(distance,segments).toText(); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
106 } catch (NumberFormatException e) { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
107 log.error(e,e); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
108 } catch (ValidationException 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 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
111 return returnValue; |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
607
diff
changeset
|
112 |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
113 } |
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 /** |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
116 * @see de.intevation.gnv.state.StateBase#extractKVP(java.util.Collection, java.lang.String, java.lang.String) |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
117 */ |
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 |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
132 String geomString = this.convert2DisplayCoordinate(resultValue.getString(valueid)); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
133 String value = geomString; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
134 if (resultValue.getResultDescriptor().getColumnIndex("VALUE") > 0){ |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
135 value = resultValue.getString("VALUE") + " - "+value; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
136 } |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
607
diff
changeset
|
137 |
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
607
diff
changeset
|
138 |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
139 keyValueDescibeData.add(new DefaultKeyValueDescribeData(key,value )); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
140 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
141 prevKey = key; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
142 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
143 return keyValueDescibeData; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
144 } |
778
9a828e5a2390
Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
607
diff
changeset
|
145 |
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
|
146 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
|
147 return WKTUtils.toText(wkt); |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
148 } |
511
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
149 |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
150 /** |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
151 * @see de.intevation.gnv.state.StateBase#setup(org.w3c.dom.Node) |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
152 */ |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
153 @Override |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
154 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
|
155 super.setup(configuration); |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
156 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
|
157 |
511
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
158 if (widthElement != null){ |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
159 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
|
160 fileName = Config.replaceConfigDir(fileName); |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
161 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
|
162 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
|
163 if (meshNodes != null){ |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
164 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
|
165 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
|
166 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
|
167 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
|
168 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
|
169 meshWidths.put(id, value); |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
170 } |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
171 } |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
172 }else{ |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
173 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
|
174 } |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
175 } |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
176 } |