annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WQSelect.java @ 320:a8e7c351bdf1

The getGauge() method of the FLYSArtifact returns the first gauge based on the given stationing now. flys-artifacts/trunk@1712 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 18 Apr 2011 07:39:17 +0000
parents d8558dd64152
children 448d0dc64357
rev   line source
137
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.artifacts.states;
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
3 import org.apache.log4j.Logger;
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
4
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
5 import org.w3c.dom.Element;
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
6
313
89bd0417418f The location/distance state now writes default values into DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 137
diff changeset
7 import de.intevation.artifacts.Artifact;
137
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
8 import de.intevation.artifacts.CallContext;
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
9
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10 import de.intevation.artifacts.common.utils.XMLUtils;
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
12 import de.intevation.artifactdatabase.ProtocolUtils;
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13 import de.intevation.artifactdatabase.data.StateData;
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14
319
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
15 import de.intevation.flys.model.Gauge;
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
16 import de.intevation.flys.model.River;
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
17 import de.intevation.flys.model.Wst;
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
18
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
19 import de.intevation.flys.artifacts.FLYSArtifact;
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
20 import de.intevation.flys.artifacts.model.WstFactory;
137
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
21 import de.intevation.flys.artifacts.resources.Resources;
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
22
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
23 /**
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
24 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
25 */
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
26 public class WQSelect extends DefaultState {
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
27
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
28 /** The logger used in this class.*/
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
29 private static Logger logger = Logger.getLogger(WQSelect.class);
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
30
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
31
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
32 /** The default step width for Qs.*/
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
33 public static final String DEFAULT_STEP_Q = "50";
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
34
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
35 /** The default step width for Qs.*/
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
36 public static final String DEFAULT_STEP_W = "30";
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38 /**
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39 * The default constructor that initializes an empty State object.
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40 */
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
41 public WQSelect() {
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
42 }
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
43
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
44 protected Element createData(
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
45 XMLUtils.ElementCreator cr,
313
89bd0417418f The location/distance state now writes default values into DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 137
diff changeset
46 Artifact artifact,
137
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
47 StateData data,
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
48 CallContext context)
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
49 {
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
50 Element select = ProtocolUtils.createArtNode(
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
51 cr, "select", null, null);
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
52
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
53 cr.addAttr(select, "name", data.getName(), true);
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
54
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
55 Element label = ProtocolUtils.createArtNode(
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
56 cr, "label", null, null);
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
57
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
58 Element choices = ProtocolUtils.createArtNode(
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
59 cr, "choices", null, null);
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
60
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
61 label.setTextContent(Resources.getMsg(
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
62 context.getMeta(),
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
63 data.getName(),
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
64 data.getName()));
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
65
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
66 select.appendChild(label);
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
67
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
68 return select;
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
69 }
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
70
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
71
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
72 protected Element[] createItems(
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
73 XMLUtils.ElementCreator cr,
313
89bd0417418f The location/distance state now writes default values into DESCRIBE.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 137
diff changeset
74 Artifact artifact,
137
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
75 String name,
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
76 CallContext context)
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
77 {
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
78 // TODO Insert correct min/max values!
319
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
79 double[] minmaxW = determineMinMaxW(artifact);
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
80 double[] minmaxQ = determineMinMaxQ(artifact);
137
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
81
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
82 if (name.equals("wq_from")) {
319
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
83 Element minW = createItem(
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
84 cr, new String[] {"minW", new Double(minmaxW[0]).toString()});
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
85 Element minQ = createItem(
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
86 cr, new String[] {"minQ", new Double(minmaxQ[0]).toString()});
137
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
87 return new Element[] { minW, minQ };
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
88 }
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
89 else if (name.equals("wq_to")) {
319
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
90 Element maxW = createItem(
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
91 cr, new String[] {"maxW", new Double(minmaxW[1]).toString()});
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
92 Element maxQ = createItem(
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
93 cr, new String[] {"maxQ", new Double(minmaxQ[1]).toString()});
137
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
94 return new Element[] { maxW, maxQ };
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
95 }
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
96 else {
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
97 Element stepW = createItem(cr, new String[] {"stepW", DEFAULT_STEP_W});
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
98 Element stepQ = createItem(cr, new String[] {"stepQ", DEFAULT_STEP_Q});
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
99 return new Element[] { stepW, stepQ };
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
100 }
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
101 }
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
102
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
103
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
104 protected Element createItem(XMLUtils.ElementCreator cr, Object obj) {
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
105 Element item = ProtocolUtils.createArtNode(cr, "item", null, null);
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
106 Element label = ProtocolUtils.createArtNode(cr, "label", null, null);
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
107 Element value = ProtocolUtils.createArtNode(cr, "value", null, null);
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
108
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
109 String[] arr = (String[]) obj;
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
110
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
111 label.setTextContent(arr[0]);
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
112 value.setTextContent(arr[1]);
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
113
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
114 item.appendChild(label);
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
115 item.appendChild(value);
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
116
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
117 return item;
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
118 }
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
119
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
120
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
121 protected String getUIProvider() {
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
122 return "wq_panel";
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
123 }
319
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
124
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
125
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
126 /**
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
127 * Determines the min and max W value for the current gauge. If no min and
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
128 * max values could be determined, this method will return
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
129 * [Double.MIN_VALUE, Double.MAX_VALUE].
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
130 *
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
131 * @param artifact The FLYSArtifact.
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
132 *
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
133 * @return the min and max W values for the current gauge.
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
134 */
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
135 protected double[] determineMinMaxW(Artifact artifact) {
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
136 logger.debug("WQSelect.determineCurrentGauge");
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
137
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
138 Gauge gauge = ((FLYSArtifact) artifact).getGauge();
320
a8e7c351bdf1 The getGauge() method of the FLYSArtifact returns the first gauge based on the given stationing now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 319
diff changeset
139 double[] minmaxW = gauge != null ? gauge.determineMinMaxW() : null;
319
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
140
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
141 double minW = minmaxW != null ? minmaxW[0] : Double.MIN_VALUE;
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
142 double maxW = minmaxW != null ? minmaxW[1] : Double.MAX_VALUE;
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
143
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
144 return new double[] { minW, maxW };
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
145 }
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
146
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
147
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
148 /**
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
149 * Determines the min and max Q value for the current gauge. If no min and
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
150 * max values could be determined, this method will return
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
151 * [Double.MIN_VALUE, Double.MAX_VALUE].
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
152 *
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
153 * @param artifact The FLYSArtifact.
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
154 *
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
155 * @return the min and max Q values for the current gauge.
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
156 */
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
157 protected double[] determineMinMaxQ(Artifact artifact) {
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
158 logger.debug("WQSelect.determineMinMaxQ");
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
159
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
160 FLYSArtifact flysArtifact = (FLYSArtifact) artifact;
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
161
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
162 River river = flysArtifact.getRiver();
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
163 Gauge gauge = flysArtifact.getGauge();
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
164 Wst wst = WstFactory.getWst(river);
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
165
320
a8e7c351bdf1 The getGauge() method of the FLYSArtifact returns the first gauge based on the given stationing now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 319
diff changeset
166 double[] minmaxQ = gauge != null
a8e7c351bdf1 The getGauge() method of the FLYSArtifact returns the first gauge based on the given stationing now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 319
diff changeset
167 ? wst.determineMinMaxQ(gauge.getRange())
a8e7c351bdf1 The getGauge() method of the FLYSArtifact returns the first gauge based on the given stationing now.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 319
diff changeset
168 : null;
319
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
169
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
170 double minQ = minmaxQ != null ? minmaxQ[0] : Double.MIN_VALUE;
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
171 double maxQ = minmaxQ != null ? minmaxQ[1] : Double.MAX_VALUE;
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
172
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
173 return new double[] { minQ, maxQ };
d8558dd64152 The WQ state fills the DESCRIBE with default values for W and Q.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 313
diff changeset
174 }
137
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
175 }
7f839b81cdde Added a new state for the W/Q input in the WINFO parameterization.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
176 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org