Mercurial > dive4elements > gnv-client
annotate gnv-artifacts/src/main/java/de/intevation/gnv/state/CoordinateSelectionState.java @ 513:ca5048e4e515
Removed debug output which has been checked in by mistake.
gnv-artifacts/trunk@605 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 22 Jan 2010 15:45:59 +0000 |
parents | c5ed4ea8fb64 |
children | 292fbcd5e9ac |
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 |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
69 protected void purifyResult(Collection<Result> result, String uuid) { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
70 log.debug("CoordinateSelectionState.purifyResult"); |
470
b7bb66440cc8
Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
461
diff
changeset
|
71 List<Object> describeData = this.getDescibeData(uuid); |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
72 if (describeData == null) { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
73 describeData = new ArrayList<Object>(); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
74 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
75 NamedCollection<KeyValueDescibeData> keyValueDescibeData = this |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
76 .extractKVP(result, "FEATUREID", "SHAPE"); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
77 describeData.add(keyValueDescibeData); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
78 this.setDescibeData(uuid, describeData); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
79 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
80 |
511
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
81 /** |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
82 * @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
|
83 */ |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
84 @Override |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
85 protected String prepareInputData4RegionDBQuery(String value) { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
86 log.debug("CoordinateSelectionState.prepareInputData4RegionDBQuery"); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
87 double distance=0.; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
88 String returnValue = null; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
89 try { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
90 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
|
91 String meshId = super.inputData.get("meshid").getValue(); |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
92 int segments = 97; |
511
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
93 if (meshWidths != null){ |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
94 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
|
95 if (distanceValue != null){ |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
96 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
|
97 distance = distanceValue.doubleValue(); |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
98 }else{ |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
99 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
|
100 } |
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 MeshWidth configured. Check if this is correct."); |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
103 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
104 returnValue = center.buffer(distance,segments).toText(); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
105 } catch (NumberFormatException e) { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
106 log.error(e,e); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
107 } catch (ValidationException e) { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
108 log.error(e,e); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
109 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
110 return returnValue; |
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 /** |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
115 * @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
|
116 */ |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
117 @Override |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
118 protected NamedCollection<KeyValueDescibeData> extractKVP( |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
119 Collection<Result> result, |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
120 String keyid, |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
121 String valueid) { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
122 Iterator<Result> rit = result.iterator(); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
123 NamedCollection<KeyValueDescibeData> keyValueDescibeData = new NamedArrayList<KeyValueDescibeData>( |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
124 this.dataName, result.size()); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
125 keyValueDescibeData.setMultiSelect(this.dataMultiSelect); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
126 String prevKey = null; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
127 while (rit.hasNext()) { |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
128 Result resultValue = rit.next(); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
129 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
|
130 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
|
131 String geomString = this.convert2DisplayCoordinate(resultValue.getString(valueid)); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
132 String value = geomString; |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
133 if (resultValue.getResultDescriptor().getColumnIndex("VALUE") > 0){ |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
134 value = resultValue.getString("VALUE") + " - "+value; |
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 |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
138 keyValueDescibeData.add(new DefaultKeyValueDescribeData(key,value )); |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
139 } |
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
140 prevKey = key; |
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 return keyValueDescibeData; |
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 |
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
|
145 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
|
146 return WKTUtils.toText(wkt); |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
147 } |
511
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 /** |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
150 * @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
|
151 */ |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
152 @Override |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
153 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
|
154 super.setup(configuration); |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
155 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
|
156 |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
157 if (widthElement != null){ |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
158 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
|
159 fileName = Config.replaceConfigDir(fileName); |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
160 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
|
161 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
|
162 if (meshNodes != null){ |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
163 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
|
164 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
|
165 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
|
166 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
|
167 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
|
168 meshWidths.put(id, value); |
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 } |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
171 }else{ |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
172 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
|
173 } |
c5ed4ea8fb64
Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents:
507
diff
changeset
|
174 } |
335
e964a3d8f7bc
Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
175 } |