comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WQSelect.java @ 2062:ed6c6d437875

Added min/max values for free Qs to the Artifact's DESCRIBE document. flys-artifacts/trunk@3555 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Thu, 29 Dec 2011 14:21:52 +0000
parents 87f9153bb7ca
children 48fd8b06bce5
comparison
equal deleted inserted replaced
2061:87f9153bb7ca 2062:ed6c6d437875
218 XMLUtils.ElementCreator cr, 218 XMLUtils.ElementCreator cr,
219 Artifact artifact, 219 Artifact artifact,
220 String name, 220 String name,
221 CallContext context) 221 CallContext context)
222 { 222 {
223 // TODO Insert correct min/max values! 223 double[] minmaxW = determineMinMaxW(artifact);
224 double[] minmaxW = determineMinMaxW(artifact); 224 double[] minmaxQ = determineMinMaxQAtGauge(artifact);
225 double[] minmaxQ = determineMinMaxQAtGauge(artifact); 225 double[] minmaxQFree = determineMinMaxQ(artifact);
226 226
227 if (name.equals("wq_from")) { 227 if (name.equals("wq_from")) {
228 Element minW = createItem( 228 Element minW = createItem(cr, new String[] {
229 cr, new String[] {"minW", new Double(minmaxW[0]).toString()}); 229 "minW",
230 Element minQ = createItem( 230 String.valueOf(minmaxW[0])});
231 cr, new String[] {"minQ", new Double(minmaxQ[0]).toString()}); 231
232 return new Element[] { minW, minQ }; 232 Element minQ = createItem(cr, new String[] {
233 "minQ",
234 String.valueOf(minmaxQ[0])});
235
236 Element minQFree = createItem(cr, new String[] {
237 "minQFree",
238 String.valueOf(minmaxQFree[0])});
239
240 return new Element[] { minW, minQ, minQFree };
233 } 241 }
234 else if (name.equals("wq_to")) { 242 else if (name.equals("wq_to")) {
235 Element maxW = createItem( 243 Element maxW = createItem(cr, new String[] {
236 cr, new String[] {"maxW", new Double(minmaxW[1]).toString()}); 244 "maxW",
237 Element maxQ = createItem( 245 String.valueOf(minmaxW[1])});
238 cr, new String[] {"maxQ", new Double(minmaxQ[1]).toString()}); 246
239 return new Element[] { maxW, maxQ }; 247 Element maxQ = createItem(cr, new String[] {
248 "maxQ",
249 String.valueOf(minmaxQ[1])});
250
251 Element maxQFree = createItem(cr, new String[] {
252 "maxQFree",
253 String.valueOf(minmaxQFree[1])});
254
255 return new Element[] { maxW, maxQ, maxQFree };
240 } 256 }
241 else { 257 else {
242 Element stepW = createItem( 258 Element stepW = createItem(
243 cr, new String[] { 259 cr, new String[] {
244 "stepW", 260 "stepW",
245 String.valueOf(getStepsW(minmaxW[0], minmaxW[1]))}); 261 String.valueOf(getStepsW(minmaxW[0], minmaxW[1]))});
246 Element stepQ = createItem( 262 Element stepQ = createItem(
247 cr, new String[] { 263 cr, new String[] {
248 "stepQ", 264 "stepQ",
249 String.valueOf(getStepsW(minmaxQ[0], minmaxQ[1]))}); 265 String.valueOf(getStepsQ(minmaxQ[0], minmaxQ[1]))});
250 return new Element[] { stepW, stepQ }; 266 Element stepQFree = createItem(
267 cr, new String[] {
268 "stepQFree",
269 String.valueOf(getStepsQ(minmaxQFree[0], minmaxQFree[1]))});
270
271 return new Element[] { stepW, stepQ, stepQFree };
251 } 272 }
252 } 273 }
253 274
254 275
255 protected static double getStepsW(double min, double max) { 276 protected static double getStepsW(double min, double max) {

http://dive4elements.wald.intevation.org