annotate gnv-artifacts/src/main/java/de/intevation/gnv/transition/CoordinateSelectionTransition.java @ 173:1b2fc94766c9

Added real Coordinate-Query to TimeSeries-Mesh gnv-artifacts/trunk@212 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Tue, 13 Oct 2009 09:11:23 +0000
parents
children 72bd41ba548d
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;
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
8
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
9 import org.apache.log4j.Logger;
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
10
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
11 import com.vividsolutions.jts.geom.Point;
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
12
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
13 import de.intevation.gnv.geobackend.base.Result;
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
14 import de.intevation.gnv.transition.describedata.KeyValueDescibeData;
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
15 import de.intevation.gnv.transition.describedata.NamedCollection;
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
16 import de.intevation.gnv.utils.InputValidator;
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
17 import de.intevation.gnv.utils.exception.ValidationException;
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
18
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
19 /**
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
20 * @author Tim Englich <tim.englich@intevation.de>
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
21 *
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
22 */
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
23 public class CoordinateSelectionTransition extends TransitionBase {
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 /**
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
26 * 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
27 */
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
28 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
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 UID of this Class
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 final long serialVersionUID = 6318923553625195063L;
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 * Constructor
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 public CoordinateSelectionTransition() {
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
39 super();
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
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 * @see de.intevation.gnv.transition.Transition#validate()
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
44 */
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
45 public boolean validate() {
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
46 return true;
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
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
49 @Override
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
50 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
51 log.debug("CoordinateSelectionTransition.purifyResult");
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
52 if (this.descibeData == null) {
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
53 this.descibeData = new ArrayList<Object>();
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
54 }
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
55 NamedCollection<KeyValueDescibeData> keyValueDescibeData = this
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
56 .extractKVP(result, "FEATUREID", "SHAPE");
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
57 this.descibeData.add(keyValueDescibeData);
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
58 }
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 @Override
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
61 protected String prepareInputData4RegionDBQuery(String value) {
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
62 log.debug("CoordinateSelectionTransition.prepareInputData4RegionDBQuery");
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
63 double distance=0.;
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
64 String returnValue = null;
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
65 try {
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
66 Point center = new InputValidator().getPointValue(value);
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
67 String meshIDValue = super.inputData.get("meshid").getValue();
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
68 int segments = 97;
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
69 int meshid = new Integer(meshIDValue);
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
70 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
71 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
72 }else if (meshid == 1 || meshid == 4){
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
73 distance = 0.03; //Kuestenmodell 1 nm
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
74 }else if (meshid == 2 || meshid == 321){
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
75 distance = 0.3; //SST Karten ca 20km
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
76 }else if (meshid == 641){
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
77 distance = 0.3; //Eisdaten Klima
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
78 }
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
79 returnValue = center.buffer(distance,segments).toText();
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
80 } catch (NumberFormatException e) {
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
81 log.error(e,e);
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
82 } catch (ValidationException e) {
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
83 log.error(e,e);
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
84 }
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
85 return returnValue;
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
86
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
87 }
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
88 }

http://dive4elements.wald.intevation.org