annotate gnv-artifacts/src/main/java/de/intevation/gnv/state/CoordinateSelectionState.java @ 1043:d955571cdf2a

Added queries for Meshes using Vectorvalues for TimeSeries. gnv-artifacts/trunk@1115 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Fri, 21 May 2010 08:28:49 +0000
parents 05bf8534a35a
children f953c9a559d8
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
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
3 import java.util.ArrayList;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
4 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
5 import java.util.HashMap;
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
6 import java.util.Iterator;
470
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
7 import java.util.List;
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
8
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
9 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
10 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
11 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
12 import org.w3c.dom.NodeList;
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
13
823
499cfbbb61bc Removed obsolet SuppressWarnings-Annotations.
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
14 import com.vividsolutions.jts.geom.Point;
499cfbbb61bc Removed obsolet SuppressWarnings-Annotations.
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
15
499cfbbb61bc Removed obsolet SuppressWarnings-Annotations.
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
16 import de.intevation.artifactdatabase.Config;
499cfbbb61bc Removed obsolet SuppressWarnings-Annotations.
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
17 import de.intevation.gnv.geobackend.base.Result;
499cfbbb61bc Removed obsolet SuppressWarnings-Annotations.
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
18 import de.intevation.gnv.state.describedata.DefaultKeyValueDescribeData;
499cfbbb61bc Removed obsolet SuppressWarnings-Annotations.
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
19 import de.intevation.gnv.state.describedata.KeyValueDescibeData;
499cfbbb61bc Removed obsolet SuppressWarnings-Annotations.
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
20 import de.intevation.gnv.state.describedata.NamedArrayList;
499cfbbb61bc Removed obsolet SuppressWarnings-Annotations.
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
21 import de.intevation.gnv.state.describedata.NamedCollection;
499cfbbb61bc Removed obsolet SuppressWarnings-Annotations.
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
22 import de.intevation.gnv.utils.ArtifactXMLUtilities;
499cfbbb61bc Removed obsolet SuppressWarnings-Annotations.
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
23 import de.intevation.gnv.utils.InputValidator;
499cfbbb61bc Removed obsolet SuppressWarnings-Annotations.
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
24 import de.intevation.gnv.utils.WKTUtils;
499cfbbb61bc Removed obsolet SuppressWarnings-Annotations.
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
25 import de.intevation.gnv.utils.exception.ValidationException;
499cfbbb61bc Removed obsolet SuppressWarnings-Annotations.
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
26
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
27 /**
796
a5526908f92f Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
28 * 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
29 * 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
30 *
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
31 * @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
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);
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 607
diff changeset
40
335
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;
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 607
diff changeset
45
511
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 */
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 607
diff changeset
49
511
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";
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 607
diff changeset
55
511
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
815
22c18083225e Removed compiler warnings while JavaDoc generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 796
diff changeset
80
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
81 @Override
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
82 protected String prepareInputData4RegionDBQuery(String value) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
83 log.debug("CoordinateSelectionState.prepareInputData4RegionDBQuery");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
84 double distance=0.;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
85 String returnValue = null;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
86 try {
796
a5526908f92f Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
87 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
88 String meshId = super.inputData.get("meshid").getValue();
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
89 int segments = 97;
511
c5ed4ea8fb64 Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents: 507
diff changeset
90 if (meshWidths != null){
c5ed4ea8fb64 Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents: 507
diff changeset
91 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
92 if (distanceValue != null){
c5ed4ea8fb64 Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents: 507
diff changeset
93 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
94 distance = distanceValue.doubleValue();
c5ed4ea8fb64 Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents: 507
diff changeset
95 }else{
c5ed4ea8fb64 Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents: 507
diff changeset
96 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
97 }
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 MeshWidth configured. Check if this is correct.");
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
100 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
101 returnValue = center.buffer(distance,segments).toText();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
102 } catch (NumberFormatException e) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
103 log.error(e,e);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
104 } catch (ValidationException 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 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
107 return returnValue;
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 607
diff changeset
108
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
109 }
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 607
diff changeset
110
815
22c18083225e Removed compiler warnings while JavaDoc generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 796
diff changeset
111
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
112 @Override
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
113 protected NamedCollection<KeyValueDescibeData> extractKVP(
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
114 Collection<Result> result,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
115 String keyid,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
116 String valueid) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
117 Iterator<Result> rit = result.iterator();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
118 NamedCollection<KeyValueDescibeData> keyValueDescibeData = new NamedArrayList<KeyValueDescibeData>(
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
119 this.dataName, result.size());
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
120 keyValueDescibeData.setMultiSelect(this.dataMultiSelect);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
121 String prevKey = null;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
122 while (rit.hasNext()) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
123 Result resultValue = rit.next();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
124 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
125 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
126 String geomString = CoordinateSelectionState.convert2DisplayCoordinate(resultValue.getString(valueid));
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
127 String value = geomString;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
128 if (resultValue.getResultDescriptor().getColumnIndex("VALUE") > 0){
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
129 value = resultValue.getString("VALUE") + " - "+value;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
130 }
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 607
diff changeset
131
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 607
diff changeset
132
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
133 keyValueDescibeData.add(new DefaultKeyValueDescribeData(key,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 prevKey = key;
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 return keyValueDescibeData;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
138 }
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 607
diff changeset
139
796
a5526908f92f Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
140 /**
a5526908f92f Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
141 * Turn coordinate into a human readable format.
a5526908f92f Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
142 *
a5526908f92f Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
143 * @param wkt Coordinate as wkt string.
a5526908f92f Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
144 * @return formatted coordinate.
a5526908f92f Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
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
815
22c18083225e Removed compiler warnings while JavaDoc generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 796
diff changeset
150
511
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);
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 607
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 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 }
836
05bf8534a35a Using unix line endings only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 823
diff changeset
175 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org