annotate gnv-artifacts/src/main/java/de/intevation/gnv/transition/CoordinateSelectionTransition.java @ 207:d87347142702

Store the Results of an Artifact not in the Artifact but in an ehcache instance. issue3 gnv-artifacts/trunk@263 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Fri, 23 Oct 2009 08:50:50 +0000
parents 6e7952fd1744
children ee2d4134d0b3
rev   line source
173
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1 /**
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
2 *
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
3 */
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
4 package de.intevation.gnv.transition;
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
5
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
6 import java.util.ArrayList;
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
7 import java.util.Collection;
180
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
8 import java.util.Iterator;
173
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
9
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
10 import org.apache.log4j.Logger;
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
11
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
12 import com.vividsolutions.jts.geom.Point;
180
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
13 import com.vividsolutions.jts.io.ParseException;
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
14 import com.vividsolutions.jts.io.WKTReader;
173
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
15
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
16 import de.intevation.gnv.geobackend.base.Result;
180
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
17 import de.intevation.gnv.transition.describedata.DefaultKeyValueDescribeData;
173
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
18 import de.intevation.gnv.transition.describedata.KeyValueDescibeData;
180
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
19 import de.intevation.gnv.transition.describedata.NamedArrayList;
173
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
20 import de.intevation.gnv.transition.describedata.NamedCollection;
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
21 import de.intevation.gnv.utils.InputValidator;
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
22 import de.intevation.gnv.utils.exception.ValidationException;
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
23
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
24 /**
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
25 * @author Tim Englich <tim.englich@intevation.de>
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
26 *
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
27 */
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
28 public class CoordinateSelectionTransition extends TransitionBase {
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
29
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
30 /**
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
31 * the logger, used to log exceptions and additonaly information
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
32 */
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
33 private static Logger log = Logger.getLogger(CoordinateSelectionTransition.class);
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
34
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
35 /**
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
36 * The UID of this Class
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
37 */
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
38 private static final long serialVersionUID = 6318923553625195063L;
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
39
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
40 /**
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
41 * Constructor
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
42 */
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
43 public CoordinateSelectionTransition() {
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
44 super();
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
45 }
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
46
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
47 /**
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
48 * @see de.intevation.gnv.transition.Transition#validate()
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
49 */
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
50 public boolean validate() {
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
51 return true;
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
52 }
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
53
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
54 @Override
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
55 protected void purifyResult(Collection<Result> result, String uuid) {
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
56 log.debug("CoordinateSelectionTransition.purifyResult");
207
d87347142702 Store the Results of an Artifact not in the Artifact but in an ehcache instance. issue3
Tim Englich <tim.englich@intevation.de>
parents: 205
diff changeset
57 Collection<Object> describeData = this.getDescibeData(uuid);
d87347142702 Store the Results of an Artifact not in the Artifact but in an ehcache instance. issue3
Tim Englich <tim.englich@intevation.de>
parents: 205
diff changeset
58 if (describeData == null) {
d87347142702 Store the Results of an Artifact not in the Artifact but in an ehcache instance. issue3
Tim Englich <tim.englich@intevation.de>
parents: 205
diff changeset
59 describeData = new ArrayList<Object>();
173
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
60 }
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
61 NamedCollection<KeyValueDescibeData> keyValueDescibeData = this
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
62 .extractKVP(result, "FEATUREID", "SHAPE");
207
d87347142702 Store the Results of an Artifact not in the Artifact but in an ehcache instance. issue3
Tim Englich <tim.englich@intevation.de>
parents: 205
diff changeset
63 describeData.add(keyValueDescibeData);
d87347142702 Store the Results of an Artifact not in the Artifact but in an ehcache instance. issue3
Tim Englich <tim.englich@intevation.de>
parents: 205
diff changeset
64 this.setDescibeData(uuid, describeData);
173
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
65 }
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
66
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
67 @Override
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
68 protected String prepareInputData4RegionDBQuery(String value) {
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
69 log.debug("CoordinateSelectionTransition.prepareInputData4RegionDBQuery");
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
70 double distance=0.;
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
71 String returnValue = null;
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
72 try {
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
73 Point center = new InputValidator().getPointValue(value);
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
74 String meshIDValue = super.inputData.get("meshid").getValue();
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
75 int segments = 97;
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
76 int meshid = new Integer(meshIDValue);
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
77 if (meshid == 3 || meshid == 5){ // TODO nicht hier festbrennen.
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
78 distance = 0.15; //nord-ostsee 6nm // 97 St�tzpunkte
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
79 }else if (meshid == 1 || meshid == 4){
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
80 distance = 0.03; //Kuestenmodell 1 nm
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
81 }else if (meshid == 2 || meshid == 321){
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
82 distance = 0.3; //SST Karten ca 20km
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
83 }else if (meshid == 641){
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
84 distance = 0.3; //Eisdaten Klima
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
85 }
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
86 returnValue = center.buffer(distance,segments).toText();
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
87 } catch (NumberFormatException e) {
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
88 log.error(e,e);
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
89 } catch (ValidationException e) {
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
90 log.error(e,e);
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
91 }
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
92 return returnValue;
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
93
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
94 }
180
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
95
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
96 /**
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
97 * @see de.intevation.gnv.transition.TransitionBase#extractKVP(java.util.Collection, java.lang.String, java.lang.String)
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
98 */
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
99 @Override
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
100 protected NamedCollection<KeyValueDescibeData> extractKVP(
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
101 Collection<Result> result,
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
102 String keyid,
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
103 String valueid) {
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
104 Iterator<Result> rit = result.iterator();
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
105 NamedCollection<KeyValueDescibeData> keyValueDescibeData = new NamedArrayList<KeyValueDescibeData>(
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
106 this.dataName, result.size());
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
107 keyValueDescibeData.setMultiSelect(this.dataMultiSelect);
205
6e7952fd1744 Added the support to Display the Time and the position of an Measurement in an VerticalProfile of Type Instantaneous Point
Tim Englich <tim.englich@intevation.de>
parents: 180
diff changeset
108 String prevKey = null;
180
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
109 while (rit.hasNext()) {
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
110 Result resultValue = rit.next();
205
6e7952fd1744 Added the support to Display the Time and the position of an Measurement in an VerticalProfile of Type Instantaneous Point
Tim Englich <tim.englich@intevation.de>
parents: 180
diff changeset
111 String key = resultValue.getString(keyid);
6e7952fd1744 Added the support to Display the Time and the position of an Measurement in an VerticalProfile of Type Instantaneous Point
Tim Englich <tim.englich@intevation.de>
parents: 180
diff changeset
112 if(prevKey == null || !prevKey.equals(key)){ // m�ssen wir so machen, da die sde kein select distinct auf layern zul�sst.
6e7952fd1744 Added the support to Display the Time and the position of an Measurement in an VerticalProfile of Type Instantaneous Point
Tim Englich <tim.englich@intevation.de>
parents: 180
diff changeset
113 String geomString = this.convert2DisplayCoordinate(resultValue.getString(valueid));
6e7952fd1744 Added the support to Display the Time and the position of an Measurement in an VerticalProfile of Type Instantaneous Point
Tim Englich <tim.englich@intevation.de>
parents: 180
diff changeset
114 String value = geomString;
6e7952fd1744 Added the support to Display the Time and the position of an Measurement in an VerticalProfile of Type Instantaneous Point
Tim Englich <tim.englich@intevation.de>
parents: 180
diff changeset
115 if (resultValue.getResultDescriptor().getColumnIndex("VALUE") > 0){
6e7952fd1744 Added the support to Display the Time and the position of an Measurement in an VerticalProfile of Type Instantaneous Point
Tim Englich <tim.englich@intevation.de>
parents: 180
diff changeset
116 value = resultValue.getString("VALUE") + " - "+value;
6e7952fd1744 Added the support to Display the Time and the position of an Measurement in an VerticalProfile of Type Instantaneous Point
Tim Englich <tim.englich@intevation.de>
parents: 180
diff changeset
117 }
6e7952fd1744 Added the support to Display the Time and the position of an Measurement in an VerticalProfile of Type Instantaneous Point
Tim Englich <tim.englich@intevation.de>
parents: 180
diff changeset
118
6e7952fd1744 Added the support to Display the Time and the position of an Measurement in an VerticalProfile of Type Instantaneous Point
Tim Englich <tim.englich@intevation.de>
parents: 180
diff changeset
119
6e7952fd1744 Added the support to Display the Time and the position of an Measurement in an VerticalProfile of Type Instantaneous Point
Tim Englich <tim.englich@intevation.de>
parents: 180
diff changeset
120 keyValueDescibeData.add(new DefaultKeyValueDescribeData(key,value ));
6e7952fd1744 Added the support to Display the Time and the position of an Measurement in an VerticalProfile of Type Instantaneous Point
Tim Englich <tim.englich@intevation.de>
parents: 180
diff changeset
121 }
6e7952fd1744 Added the support to Display the Time and the position of an Measurement in an VerticalProfile of Type Instantaneous Point
Tim Englich <tim.englich@intevation.de>
parents: 180
diff changeset
122 prevKey = key;
180
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
123 }
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
124 return keyValueDescibeData;
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
125 }
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
126
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
127 protected String convert2DisplayCoordinate(String wkt){
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
128 String formattedCoordinate = null;
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
129 try {
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
130 Point p = (Point)new WKTReader().read(wkt);
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
131 double lat = p.getY();
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
132 double lon =p.getX();
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
133 String nord="N";
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
134 String ost="E";
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
135 if (lat <0 ){nord="S"; lat=-lat;}
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
136 if (lon <0 ){ost="W"; lon=-lon;}
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
137 formattedCoordinate = String.format("%1$02d�%2$1S %3$05.2f' %4$03d�%5$1S %6$05.2f'",
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
138 (int)lat, nord,60.*(lat-((int)lat)),(int)lon,ost,60.*(lon-((int)lon)));
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
139 } catch (ParseException e) {
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
140 log.error(e,e);
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
141 }
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
142
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
143 return formattedCoordinate;
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
144 }
173
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
145 }

http://dive4elements.wald.intevation.org