Mercurial > dive4elements > gnv-client
annotate gnv-artifacts/src/main/java/de/intevation/gnv/state/CoordinateSelectionState.java @ 637:154d158238d3
Display the selected value if there is no description avaible. WKT-strings will be displayed again (issue182).
gnv-artifacts/trunk@720 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Mon, 01 Mar 2010 16:00:39 +0000 |
parents | 292fbcd5e9ac |
children | 9a828e5a2390 |
rev | line source |
---|---|
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
1 /** |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
2 * |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
3 */ |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
4 package de.intevation.gnv.state; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
5 |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
6 import java.util.ArrayList; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
7 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
|
8 import java.util.HashMap; |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
9 import java.util.Iterator; |
470
b7bb66440cc8
Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
461
diff
changeset
|
10 import java.util.List; |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
11 |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
12 import org.apache.log4j.Logger; |
511
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
13 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
|
14 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
|
15 import org.w3c.dom.NodeList; |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
16 |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
17 import com.vividsolutions.jts.geom.Point; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
18 |
511
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
19 import de.intevation.artifactdatabase.Config; |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
20 import de.intevation.gnv.geobackend.base.Result; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
21 import de.intevation.gnv.state.describedata.DefaultKeyValueDescribeData; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
22 import de.intevation.gnv.state.describedata.KeyValueDescibeData; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
23 import de.intevation.gnv.state.describedata.NamedArrayList; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
24 import de.intevation.gnv.state.describedata.NamedCollection; |
511
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
25 import de.intevation.gnv.utils.ArtifactXMLUtilities; |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
26 import de.intevation.gnv.utils.InputValidator; |
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
|
27 import de.intevation.gnv.utils.WKTUtils; |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
28 import de.intevation.gnv.utils.exception.ValidationException; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
29 |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
30 /** |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
31 * @author Tim Englich <tim.englich@intevation.de> |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
32 * |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
33 */ |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
34 public class CoordinateSelectionState extends StateBase { |
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 /** |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
37 * the logger, used to log exceptions and additonaly information |
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 private static Logger log = Logger.getLogger(CoordinateSelectionState.class); |
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 UID of this Class |
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 final long serialVersionUID = 6318923553625195063L; |
511
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
45 |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
46 /** |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
47 * 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
|
48 */ |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
49 |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
50 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
|
51 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
|
52 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
|
53 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
|
54 private final static String WIDTH_VALUE_XPATH = "width"; |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
55 |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
56 /** |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
57 * 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
|
58 */ |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
59 private HashMap<String, Double> meshWidths = null; |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
60 |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
61 /** |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
62 * Constructor |
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 public CoordinateSelectionState() { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
65 super(); |
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 |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
68 @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
|
69 protected List<Object> purifyResult(Collection<Result> result, String uuid) { |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
70 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
|
71 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
|
72 |
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 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
|
74 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
|
75 |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
76 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
|
77 return describeData; |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
78 } |
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 |
511
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
80 /** |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
81 * @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
|
82 */ |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
83 @Override |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
84 protected String prepareInputData4RegionDBQuery(String value) { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
85 log.debug("CoordinateSelectionState.prepareInputData4RegionDBQuery"); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
86 double distance=0.; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
87 String returnValue = null; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
88 try { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
89 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
|
90 String meshId = super.inputData.get("meshid").getValue(); |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
91 int segments = 97; |
511
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
92 if (meshWidths != null){ |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
93 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
|
94 if (distanceValue != null){ |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
95 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
|
96 distance = distanceValue.doubleValue(); |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
97 }else{ |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
98 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
|
99 } |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
100 }else{ |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
101 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
|
102 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
103 returnValue = center.buffer(distance,segments).toText(); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
104 } catch (NumberFormatException e) { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
105 log.error(e,e); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
106 } catch (ValidationException 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 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
109 return returnValue; |
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 } |
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 /** |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
114 * @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
|
115 */ |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
116 @Override |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
117 protected NamedCollection<KeyValueDescibeData> extractKVP( |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
118 Collection<Result> result, |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
119 String keyid, |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
120 String valueid) { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
121 Iterator<Result> rit = result.iterator(); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
122 NamedCollection<KeyValueDescibeData> keyValueDescibeData = new NamedArrayList<KeyValueDescibeData>( |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
123 this.dataName, result.size()); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
124 keyValueDescibeData.setMultiSelect(this.dataMultiSelect); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
125 String prevKey = null; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
126 while (rit.hasNext()) { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
127 Result resultValue = rit.next(); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
128 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
|
129 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
|
130 String geomString = this.convert2DisplayCoordinate(resultValue.getString(valueid)); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
131 String value = geomString; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
132 if (resultValue.getResultDescriptor().getColumnIndex("VALUE") > 0){ |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
133 value = resultValue.getString("VALUE") + " - "+value; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
134 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
135 |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
136 |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
137 keyValueDescibeData.add(new DefaultKeyValueDescribeData(key,value )); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
138 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
139 prevKey = key; |
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 return keyValueDescibeData; |
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 |
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
|
144 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
|
145 return WKTUtils.toText(wkt); |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
146 } |
511
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
147 |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
148 /** |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
149 * @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
|
150 */ |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
151 @Override |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
152 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
|
153 super.setup(configuration); |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
154 Element widthElement = (Element)Config.getNodeXPath(configuration, MESH_WIDTH_XPATH); |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
155 |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
156 if (widthElement != null){ |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
157 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
|
158 fileName = Config.replaceConfigDir(fileName); |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
159 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
|
160 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
|
161 if (meshNodes != null){ |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
162 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
|
163 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
|
164 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
|
165 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
|
166 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
|
167 meshWidths.put(id, value); |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
168 } |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
169 } |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
170 }else{ |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
171 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
|
172 } |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
173 } |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
174 } |