Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WQAdapted.java @ 5379:61bf64b102bc mapgenfix
Merge with default branch
author | Christian Lins <christian.lins@intevation.de> |
---|---|
date | Fri, 22 Mar 2013 11:25:54 +0100 |
parents | 05eeedc5b156 |
children | 0ebadc678fbc |
comparison
equal
deleted
inserted
replaced
5175:cfc5540a4eec | 5379:61bf64b102bc |
---|---|
56 } | 56 } |
57 } // class GaugeOrder | 57 } // class GaugeOrder |
58 | 58 |
59 public static final GaugeOrder GAUGE_UP = new GaugeOrder(true); | 59 public static final GaugeOrder GAUGE_UP = new GaugeOrder(true); |
60 public static final GaugeOrder GAUGE_DOWN = new GaugeOrder(false); | 60 public static final GaugeOrder GAUGE_DOWN = new GaugeOrder(false); |
61 | |
61 | 62 |
62 /** Trivial, empty constructor. */ | 63 /** Trivial, empty constructor. */ |
63 public WQAdapted() { | 64 public WQAdapted() { |
64 } | 65 } |
65 | 66 |
115 | 116 |
116 return new Element[] { w, q }; | 117 return new Element[] { w, q }; |
117 } | 118 } |
118 | 119 |
119 | 120 |
121 /** Create the items for input to the ranges per mode. */ | |
120 protected Element[] createValueItems( | 122 protected Element[] createValueItems( |
121 XMLUtils.ElementCreator cr, | 123 XMLUtils.ElementCreator cr, |
122 Artifact artifact, | 124 Artifact artifact, |
123 String name, | 125 String name, |
124 CallContext context) | 126 CallContext context) |
163 | 165 |
164 double[] mmQ = determineMinMaxQ(gauge, wst); | 166 double[] mmQ = determineMinMaxQ(gauge, wst); |
165 double[] mmW = gauge.determineMinMaxW(); | 167 double[] mmW = gauge.determineMinMaxW(); |
166 | 168 |
167 elements.add(createItem( | 169 elements.add(createItem( |
168 cr, new String[] { from + ";" + to, ""}, mmQ, mmW)); | 170 cr, new String[] { from + ";" + to, gauge.getName()}, mmQ, mmW)); |
169 } | 171 } |
170 } | 172 } |
171 else { | 173 else { |
172 Collections.sort(gauges, GAUGE_DOWN); | 174 Collections.sort(gauges, GAUGE_DOWN); |
173 rangeFrom = dist[1]; | 175 rangeFrom = dist[1]; |
184 | 186 |
185 double[] mmQ = determineMinMaxQ(gauge, wst); | 187 double[] mmQ = determineMinMaxQ(gauge, wst); |
186 double[] mmW = gauge.determineMinMaxW(); | 188 double[] mmW = gauge.determineMinMaxW(); |
187 | 189 |
188 elements.add(createItem( | 190 elements.add(createItem( |
189 cr, new String[] { to + ";" + from, ""}, mmQ, mmW)); | 191 cr, new String[] { to + ";" + from, gauge.getName()}, mmQ, mmW)); |
190 } | 192 } |
191 } | 193 } |
192 | 194 |
193 Element[] els = new Element[elements.size()]; | 195 Element[] els = new Element[elements.size()]; |
194 return elements.toArray(els); | 196 return elements.toArray(els); |
198 protected Element createItem(XMLUtils.ElementCreator cr, Object obj) { | 200 protected Element createItem(XMLUtils.ElementCreator cr, Object obj) { |
199 return createItem(cr, obj, null, null); | 201 return createItem(cr, obj, null, null); |
200 } | 202 } |
201 | 203 |
202 | 204 |
205 /** In obj: 0 is label, 1 is value. */ | |
203 protected Element createItem( | 206 protected Element createItem( |
204 XMLUtils.ElementCreator cr, | 207 XMLUtils.ElementCreator cr, |
205 Object obj, | 208 Object obj, |
206 double[] q, | 209 double[] q, |
207 double[] w) | 210 double[] w) |
447 String[] parts = range.split(";"); | 450 String[] parts = range.split(";"); |
448 | 451 |
449 double lower = Double.parseDouble(parts[0]); | 452 double lower = Double.parseDouble(parts[0]); |
450 double upper = Double.parseDouble(parts[1]); | 453 double upper = Double.parseDouble(parts[1]); |
451 | 454 |
452 String[] values = parts[2].split(","); | 455 String[] values = parts[3].split(","); |
453 | 456 |
454 int num = values.length; | 457 int num = values.length; |
455 double[] res = new double[num]; | 458 double[] res = new double[num]; |
456 | 459 |
457 for (int i = 0; i < num; i++) { | 460 for (int i = 0; i < num; i++) { |