comparison artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java @ 7525:6650485c2c9b

Part fix for flys/issue1585: Use result from fitting to display interpolated W/Q points, too. TODO: Draw interpolated as circles.
author Sascha L. Teichmann <teichmann@intevation.de>
date Wed, 06 Nov 2013 19:12:46 +0100
parents a365e587af67
children 0ee545a02204
comparison
equal deleted inserted replaced
7524:25d890e3eb69 7525:6650485c2c9b
153 return axis; 153 return axis;
154 } 154 }
155 155
156 /** Returns value != 0 if the current km is not at a gauge. */ 156 /** Returns value != 0 if the current km is not at a gauge. */
157 public double getCurrentGaugeDatum() { 157 public double getCurrentGaugeDatum() {
158 if (context.getContextValue(CURRENT_KM) != null) { 158 Object ckm = context.getContextValue(CURRENT_KM);
159 if (ckm != null) {
159 return DischargeCurveGenerator.getCurrentGaugeDatum( 160 return DischargeCurveGenerator.getCurrentGaugeDatum(
160 (Double) context.getContextValue(CURRENT_KM), 161 (Double) ckm,
161 (D4EArtifact) getMaster(), 1e-4); 162 (D4EArtifact) getMaster(), 1e-4);
162 } 163 }
163 else return 0d; 164 return 0d;
164 } 165 }
165 166
166 /** Overriden to show second axis also if no visible data present. */ 167 /** Overriden to show second axis also if no visible data present. */
167 @Override 168 @Override
168 protected void adjustAxes(XYPlot plot) { 169 protected void adjustAxes(XYPlot plot) {
194 doSectorAverageOut(aaf, doc, visible); 195 doSectorAverageOut(aaf, doc, visible);
195 } 196 }
196 else if(FIX_ANALYSIS_EVENTS_WQ.equals(name)) { 197 else if(FIX_ANALYSIS_EVENTS_WQ.equals(name)) {
197 doAnalysisEventsOut(aaf, doc, visible); 198 doAnalysisEventsOut(aaf, doc, visible);
198 } 199 }
199 else if(FIX_REFERENCE_EVENTS_WQ.equals(name)) { 200 else if(FIX_REFERENCE_EVENTS_WQ.equals(name)
201 || FIX_EVENTS.equals(name)) {
200 doReferenceEventsOut(aaf, doc, visible); 202 doReferenceEventsOut(aaf, doc, visible);
201 } 203 }
202 else if(FIX_WQ_CURVE.equals(name)) { 204 else if(FIX_WQ_CURVE.equals(name)) {
203 doWQCurveOut(aaf, doc, visible); 205 doWQCurveOut(aaf, doc, visible);
204 } 206 }
206 doOutlierOut(aaf, doc, visible); 208 doOutlierOut(aaf, doc, visible);
207 } 209 }
208 else if(QSECTOR.equals(name)) { 210 else if(QSECTOR.equals(name)) {
209 doQSectorOut(aaf, doc, visible); 211 doQSectorOut(aaf, doc, visible);
210 } 212 }
213 /*
211 else if(FIX_EVENTS.equals(name)) { 214 else if(FIX_EVENTS.equals(name)) {
212 doEventsOut(aaf, doc, visible); 215 doEventsOut(aaf, doc, visible);
213 } 216 }
217 */
214 else if(/*STATIC_WKMS_INTERPOL.equals(name) ||*/ 218 else if(/*STATIC_WKMS_INTERPOL.equals(name) ||*/
215 STATIC_WKMS_MARKS.equals(name) || 219 STATIC_WKMS_MARKS.equals(name) ||
216 STATIC_WKMS.equals(name) || 220 STATIC_WKMS.equals(name) ||
217 HEIGHTMARKS_POINTS.equals(name) ) { 221 HEIGHTMARKS_POINTS.equals(name) ) {
218 doWAnnotations( 222 doWAnnotations(
225 || STATIC_WKMS_INTERPOL.equals(name) 229 || STATIC_WKMS_INTERPOL.equals(name)
226 || FIX_WQ_LS.equals(name)) { 230 || FIX_WQ_LS.equals(name)) {
227 doWQOut(aaf.getData(context), aaf, doc, visible); 231 doWQOut(aaf.getData(context), aaf, doc, visible);
228 } 232 }
229 else if (name.equals(DISCHARGE_CURVE)) { 233 else if (name.equals(DISCHARGE_CURVE)) {
230 logger.debug("diso " + name); 234 logger.debug("diso " + name);
231 doDischargeOut( 235 doDischargeOut(
232 (WINFOArtifact) aaf.getArtifact(), 236 (WINFOArtifact) aaf.getArtifact(),
233 aaf.getData(context), 237 aaf.getData(context),
234 aaf.getFacetDescription(), 238 aaf.getFacetDescription(),
235 doc, 239 doc,
429 500, // number of samples 433 500, // number of samples
430 0.0 , // start 434 0.0 , // start
431 maxQ); // end 435 maxQ); // end
432 addAxisSeries(series2, YAXIS.W.idx, false); 436 addAxisSeries(series2, YAXIS.W.idx, false);
433 // Use second axis at cm if at gauge. 437 // Use second axis at cm if at gauge.
434 for (int i = 0; i < series.getItemCount(); i++) { 438 for (int i = 0, N = series.getItemCount(); i < N; i++) {
435 series.updateByIndex(i, new Double(100d*(series.getY(i).doubleValue()-gaugeDatum))); 439 series.updateByIndex(
440 i, new Double(100d*(series.getY(i).doubleValue()-gaugeDatum)));
436 } 441 }
437 addAxisSeries(series, YAXIS.WCm.idx, visible); 442 addAxisSeries(series, YAXIS.WCm.idx, visible);
438 } 443 }
439 } 444 }
440 else { 445 else {
756 761
757 @Override 762 @Override
758 protected String getDefaultYAxisLabel(int pos) { 763 protected String getDefaultYAxisLabel(int pos) {
759 D4EArtifact flys = (D4EArtifact) master; 764 D4EArtifact flys = (D4EArtifact) master;
760 765
761 String unit = RiverUtils.getRiver(flys).getWstUnit().getName(); 766 String unit = pos == 0
762 if (pos == 0) { 767 ? "cm"
763 unit = "cm"; 768 : RiverUtils.getRiver(flys).getWstUnit().getName();
764 }
765 769
766 return msg(I18N_YAXIS_LABEL, I18N_YAXIS_LABEL_DEFAULT, new Object[] { unit }); 770 return msg(I18N_YAXIS_LABEL, I18N_YAXIS_LABEL_DEFAULT, new Object[] { unit });
767 } 771 }
768 772
769 @Override 773 @Override

http://dive4elements.wald.intevation.org