annotate gnv-artifacts/src/main/java/de/intevation/gnv/state/CoordinateSelectionState.java @ 1139:3a28fef65500

dummy merge for repo head
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 28 Sep 2012 12:15:16 +0200
parents dec4257ad570
children
rev   line source
1115
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
1 /*
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
2 * Copyright (c) 2010 by Intevation GmbH
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
3 *
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
4 * This program is free software under the LGPL (>=v2.1)
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
5 * Read the file LGPL.txt coming with the software for details
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
6 * or visit http://www.gnu.org/licenses/ if it does not exist.
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
7 */
f953c9a559d8 Added license file and license headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 836
diff changeset
8
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
9 package de.intevation.gnv.state;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
10
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
11 import java.util.ArrayList;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
12 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
13 import java.util.HashMap;
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
14 import java.util.Iterator;
470
b7bb66440cc8 Added mechanism for advancing to previous states.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 461
diff changeset
15 import java.util.List;
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 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
18 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
19 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
20 import org.w3c.dom.NodeList;
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
21
823
499cfbbb61bc Removed obsolet SuppressWarnings-Annotations.
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
22 import com.vividsolutions.jts.geom.Point;
499cfbbb61bc Removed obsolet SuppressWarnings-Annotations.
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
23
1117
dec4257ad570 Changed imports to fit new positions of XMLUtils and Config
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1115
diff changeset
24 import de.intevation.artifacts.common.utils.Config;
823
499cfbbb61bc Removed obsolet SuppressWarnings-Annotations.
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
25 import de.intevation.gnv.geobackend.base.Result;
499cfbbb61bc Removed obsolet SuppressWarnings-Annotations.
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
26 import de.intevation.gnv.state.describedata.DefaultKeyValueDescribeData;
499cfbbb61bc Removed obsolet SuppressWarnings-Annotations.
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
27 import de.intevation.gnv.state.describedata.KeyValueDescibeData;
499cfbbb61bc Removed obsolet SuppressWarnings-Annotations.
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
28 import de.intevation.gnv.state.describedata.NamedArrayList;
499cfbbb61bc Removed obsolet SuppressWarnings-Annotations.
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
29 import de.intevation.gnv.state.describedata.NamedCollection;
499cfbbb61bc Removed obsolet SuppressWarnings-Annotations.
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
30 import de.intevation.gnv.utils.ArtifactXMLUtilities;
499cfbbb61bc Removed obsolet SuppressWarnings-Annotations.
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
31 import de.intevation.gnv.utils.InputValidator;
499cfbbb61bc Removed obsolet SuppressWarnings-Annotations.
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
32 import de.intevation.gnv.utils.WKTUtils;
499cfbbb61bc Removed obsolet SuppressWarnings-Annotations.
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
33 import de.intevation.gnv.utils.exception.ValidationException;
499cfbbb61bc Removed obsolet SuppressWarnings-Annotations.
Tim Englich <tim.englich@intevation.de>
parents: 815
diff changeset
34
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
35 /**
796
a5526908f92f Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
36 * 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
37 * 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
38 *
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
39 * @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
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 public class CoordinateSelectionState extends StateBase {
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 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
45 * the logger, used to log exceptions and additonaly information
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
46 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
47 private static Logger log = Logger.getLogger(CoordinateSelectionState.class);
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 607
diff changeset
48
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
49 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
50 * The UID of this Class
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
51 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
52 private static final long serialVersionUID = 6318923553625195063L;
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 607
diff changeset
53
511
c5ed4ea8fb64 Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents: 507
diff changeset
54 /**
c5ed4ea8fb64 Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents: 507
diff changeset
55 * 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
56 */
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 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
59 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
60 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
61 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
62 private final static String WIDTH_VALUE_XPATH = "width";
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 607
diff changeset
63
511
c5ed4ea8fb64 Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents: 507
diff changeset
64 /**
c5ed4ea8fb64 Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents: 507
diff changeset
65 * 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
66 */
c5ed4ea8fb64 Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents: 507
diff changeset
67 private HashMap<String, Double> meshWidths = null;
335
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 * Constructor
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
71 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
72 public CoordinateSelectionState() {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
73 super();
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
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
76 @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
77 protected List<Object> purifyResult(Collection<Result> result, String uuid) {
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
78 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
79 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
80
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 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
82 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
83
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
84 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
85 return describeData;
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
86 }
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
87
815
22c18083225e Removed compiler warnings while JavaDoc generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 796
diff changeset
88
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
89 @Override
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
90 protected String prepareInputData4RegionDBQuery(String value) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
91 log.debug("CoordinateSelectionState.prepareInputData4RegionDBQuery");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
92 double distance=0.;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
93 String returnValue = null;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
94 try {
796
a5526908f92f Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
95 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
96 String meshId = super.inputData.get("meshid").getValue();
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
97 int segments = 97;
511
c5ed4ea8fb64 Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents: 507
diff changeset
98 if (meshWidths != null){
c5ed4ea8fb64 Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents: 507
diff changeset
99 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
100 if (distanceValue != null){
c5ed4ea8fb64 Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents: 507
diff changeset
101 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
102 distance = distanceValue.doubleValue();
c5ed4ea8fb64 Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents: 507
diff changeset
103 }else{
c5ed4ea8fb64 Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents: 507
diff changeset
104 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
105 }
c5ed4ea8fb64 Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents: 507
diff changeset
106 }else{
c5ed4ea8fb64 Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents: 507
diff changeset
107 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
108 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
109 returnValue = center.buffer(distance,segments).toText();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
110 } catch (NumberFormatException e) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
111 log.error(e,e);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
112 } catch (ValidationException e) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
113 log.error(e,e);
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 return returnValue;
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 607
diff changeset
116
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
117 }
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 607
diff changeset
118
815
22c18083225e Removed compiler warnings while JavaDoc generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 796
diff changeset
119
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
120 @Override
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
121 protected NamedCollection<KeyValueDescibeData> extractKVP(
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
122 Collection<Result> result,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
123 String keyid,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
124 String valueid) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
125 Iterator<Result> rit = result.iterator();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
126 NamedCollection<KeyValueDescibeData> keyValueDescibeData = new NamedArrayList<KeyValueDescibeData>(
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
127 this.dataName, result.size());
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
128 keyValueDescibeData.setMultiSelect(this.dataMultiSelect);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
129 String prevKey = null;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
130 while (rit.hasNext()) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
131 Result resultValue = rit.next();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
132 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
133 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
134 String geomString = CoordinateSelectionState.convert2DisplayCoordinate(resultValue.getString(valueid));
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
135 String value = geomString;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
136 if (resultValue.getResultDescriptor().getColumnIndex("VALUE") > 0){
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
137 value = resultValue.getString("VALUE") + " - "+value;
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
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 607
diff changeset
140
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
141 keyValueDescibeData.add(new DefaultKeyValueDescribeData(key,value ));
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 prevKey = key;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
144 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
145 return keyValueDescibeData;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
146 }
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 607
diff changeset
147
796
a5526908f92f Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
148 /**
a5526908f92f Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
149 * Turn coordinate into a human readable format.
a5526908f92f Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
150 *
a5526908f92f Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
151 * @param wkt Coordinate as wkt string.
a5526908f92f Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
152 * @return formatted coordinate.
a5526908f92f Added javadoc in state package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
153 */
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
154 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
155 return WKTUtils.toText(wkt);
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
156 }
511
c5ed4ea8fb64 Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents: 507
diff changeset
157
815
22c18083225e Removed compiler warnings while JavaDoc generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 796
diff changeset
158
511
c5ed4ea8fb64 Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents: 507
diff changeset
159 @Override
c5ed4ea8fb64 Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents: 507
diff changeset
160 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
161 super.setup(configuration);
c5ed4ea8fb64 Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents: 507
diff changeset
162 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
163
511
c5ed4ea8fb64 Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents: 507
diff changeset
164 if (widthElement != null){
c5ed4ea8fb64 Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents: 507
diff changeset
165 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
166 fileName = Config.replaceConfigDir(fileName);
c5ed4ea8fb64 Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents: 507
diff changeset
167 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
168 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
169 if (meshNodes != null){
c5ed4ea8fb64 Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents: 507
diff changeset
170 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
171 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
172 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
173 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
174 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
175 meshWidths.put(id, value);
c5ed4ea8fb64 Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents: 507
diff changeset
176 }
c5ed4ea8fb64 Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents: 507
diff changeset
177 }
c5ed4ea8fb64 Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents: 507
diff changeset
178 }else{
c5ed4ea8fb64 Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents: 507
diff changeset
179 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
180 }
c5ed4ea8fb64 Make the mean with of an Mesh configurable issue93
Tim Englich <tim.englich@intevation.de>
parents: 507
diff changeset
181 }
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
182 }
836
05bf8534a35a Using unix line endings only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 823
diff changeset
183 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org