Mercurial > dive4elements > gnv-client
comparison 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 |
comparison
equal
deleted
inserted
replaced
172:b5e55f460f0b | 173:1b2fc94766c9 |
---|---|
1 /** | |
2 * | |
3 */ | |
4 package de.intevation.gnv.transition; | |
5 | |
6 import java.util.ArrayList; | |
7 import java.util.Collection; | |
8 | |
9 import org.apache.log4j.Logger; | |
10 | |
11 import com.vividsolutions.jts.geom.Point; | |
12 | |
13 import de.intevation.gnv.geobackend.base.Result; | |
14 import de.intevation.gnv.transition.describedata.KeyValueDescibeData; | |
15 import de.intevation.gnv.transition.describedata.NamedCollection; | |
16 import de.intevation.gnv.utils.InputValidator; | |
17 import de.intevation.gnv.utils.exception.ValidationException; | |
18 | |
19 /** | |
20 * @author Tim Englich <tim.englich@intevation.de> | |
21 * | |
22 */ | |
23 public class CoordinateSelectionTransition extends TransitionBase { | |
24 | |
25 /** | |
26 * the logger, used to log exceptions and additonaly information | |
27 */ | |
28 private static Logger log = Logger.getLogger(CoordinateSelectionTransition.class); | |
29 | |
30 /** | |
31 * The UID of this Class | |
32 */ | |
33 private static final long serialVersionUID = 6318923553625195063L; | |
34 | |
35 /** | |
36 * Constructor | |
37 */ | |
38 public CoordinateSelectionTransition() { | |
39 super(); | |
40 } | |
41 | |
42 /** | |
43 * @see de.intevation.gnv.transition.Transition#validate() | |
44 */ | |
45 public boolean validate() { | |
46 return true; | |
47 } | |
48 | |
49 @Override | |
50 protected void purifyResult(Collection<Result> result, String uuid) { | |
51 log.debug("CoordinateSelectionTransition.purifyResult"); | |
52 if (this.descibeData == null) { | |
53 this.descibeData = new ArrayList<Object>(); | |
54 } | |
55 NamedCollection<KeyValueDescibeData> keyValueDescibeData = this | |
56 .extractKVP(result, "FEATUREID", "SHAPE"); | |
57 this.descibeData.add(keyValueDescibeData); | |
58 } | |
59 | |
60 @Override | |
61 protected String prepareInputData4RegionDBQuery(String value) { | |
62 log.debug("CoordinateSelectionTransition.prepareInputData4RegionDBQuery"); | |
63 double distance=0.; | |
64 String returnValue = null; | |
65 try { | |
66 Point center = new InputValidator().getPointValue(value); | |
67 String meshIDValue = super.inputData.get("meshid").getValue(); | |
68 int segments = 97; | |
69 int meshid = new Integer(meshIDValue); | |
70 if (meshid == 3 || meshid == 5){ // TODO nicht hier festbrennen. | |
71 distance = 0.15; //nord-ostsee 6nm // 97 Stützpunkte | |
72 }else if (meshid == 1 || meshid == 4){ | |
73 distance = 0.03; //Kuestenmodell 1 nm | |
74 }else if (meshid == 2 || meshid == 321){ | |
75 distance = 0.3; //SST Karten ca 20km | |
76 }else if (meshid == 641){ | |
77 distance = 0.3; //Eisdaten Klima | |
78 } | |
79 returnValue = center.buffer(distance,segments).toText(); | |
80 } catch (NumberFormatException e) { | |
81 log.error(e,e); | |
82 } catch (ValidationException e) { | |
83 log.error(e,e); | |
84 } | |
85 return returnValue; | |
86 | |
87 } | |
88 } |