Mercurial > dive4elements > gnv-client
annotate gnv-artifacts/src/main/java/de/intevation/gnv/transition/CoordinateSelectionTransition.java @ 188:693f7b676ade
Adding two further fis which are based on Mesh to the System.
Fis in Median.Mesh will be choosen using the sourceid issue49
gnv-artifacts/trunk@232 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Fri, 16 Oct 2009 14:51:43 +0000 |
parents | 72bd41ba548d |
children | 6e7952fd1744 |
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"); |
1b2fc94766c9
Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
57 if (this.descibeData == null) { |
1b2fc94766c9
Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
58 this.descibeData = new ArrayList<Object>(); |
1b2fc94766c9
Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
59 } |
1b2fc94766c9
Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
60 NamedCollection<KeyValueDescibeData> keyValueDescibeData = this |
1b2fc94766c9
Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
61 .extractKVP(result, "FEATUREID", "SHAPE"); |
1b2fc94766c9
Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
62 this.descibeData.add(keyValueDescibeData); |
1b2fc94766c9
Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
63 } |
1b2fc94766c9
Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
64 |
1b2fc94766c9
Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
65 @Override |
1b2fc94766c9
Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
66 protected String prepareInputData4RegionDBQuery(String value) { |
1b2fc94766c9
Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
67 log.debug("CoordinateSelectionTransition.prepareInputData4RegionDBQuery"); |
1b2fc94766c9
Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
68 double distance=0.; |
1b2fc94766c9
Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
69 String returnValue = null; |
1b2fc94766c9
Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
70 try { |
1b2fc94766c9
Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
71 Point center = new InputValidator().getPointValue(value); |
1b2fc94766c9
Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
72 String meshIDValue = super.inputData.get("meshid").getValue(); |
1b2fc94766c9
Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
73 int segments = 97; |
1b2fc94766c9
Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
74 int meshid = new Integer(meshIDValue); |
1b2fc94766c9
Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
75 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
|
76 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
|
77 }else if (meshid == 1 || meshid == 4){ |
1b2fc94766c9
Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
78 distance = 0.03; //Kuestenmodell 1 nm |
1b2fc94766c9
Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
79 }else if (meshid == 2 || meshid == 321){ |
1b2fc94766c9
Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
80 distance = 0.3; //SST Karten ca 20km |
1b2fc94766c9
Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
81 }else if (meshid == 641){ |
1b2fc94766c9
Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
82 distance = 0.3; //Eisdaten Klima |
1b2fc94766c9
Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
83 } |
1b2fc94766c9
Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
84 returnValue = center.buffer(distance,segments).toText(); |
1b2fc94766c9
Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
85 } catch (NumberFormatException e) { |
1b2fc94766c9
Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
86 log.error(e,e); |
1b2fc94766c9
Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
87 } catch (ValidationException 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 } |
1b2fc94766c9
Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
90 return returnValue; |
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 } |
180
72bd41ba548d
Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents:
173
diff
changeset
|
93 |
72bd41ba548d
Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents:
173
diff
changeset
|
94 /** |
72bd41ba548d
Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents:
173
diff
changeset
|
95 * @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
|
96 */ |
72bd41ba548d
Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents:
173
diff
changeset
|
97 @Override |
72bd41ba548d
Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents:
173
diff
changeset
|
98 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
|
99 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
|
100 String keyid, |
72bd41ba548d
Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents:
173
diff
changeset
|
101 String valueid) { |
72bd41ba548d
Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents:
173
diff
changeset
|
102 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
|
103 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
|
104 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
|
105 keyValueDescibeData.setMultiSelect(this.dataMultiSelect); |
72bd41ba548d
Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents:
173
diff
changeset
|
106 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
|
107 Result resultValue = rit.next(); |
72bd41ba548d
Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents:
173
diff
changeset
|
108 keyValueDescibeData.add(new DefaultKeyValueDescribeData(resultValue |
72bd41ba548d
Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents:
173
diff
changeset
|
109 .getString(keyid), this.convert2DisplayCoordinate(resultValue.getString(valueid)))); |
72bd41ba548d
Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents:
173
diff
changeset
|
110 } |
72bd41ba548d
Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents:
173
diff
changeset
|
111 return keyValueDescibeData; |
72bd41ba548d
Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents:
173
diff
changeset
|
112 } |
72bd41ba548d
Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents:
173
diff
changeset
|
113 |
72bd41ba548d
Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents:
173
diff
changeset
|
114 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
|
115 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
|
116 try { |
72bd41ba548d
Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents:
173
diff
changeset
|
117 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
|
118 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
|
119 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
|
120 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
|
121 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
|
122 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
|
123 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
|
124 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
|
125 (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
|
126 } 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
|
127 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
|
128 } |
72bd41ba548d
Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents:
173
diff
changeset
|
129 |
72bd41ba548d
Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents:
173
diff
changeset
|
130 return formattedCoordinate; |
72bd41ba548d
Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents:
173
diff
changeset
|
131 } |
173
1b2fc94766c9
Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
132 } |