comparison artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationMainValuesWFacet.java @ 9259:66b003701546

Added infrastructure height and Q annotation to S-Info flood duration curve chart
author mschaefer
date Mon, 16 Jul 2018 08:43:07 +0200
parents ef7b65576d4b
children 465347d12990
comparison
equal deleted inserted replaced
9258:d950c6055102 9259:66b003701546
14 import org.dive4elements.artifacts.CallContext; 14 import org.dive4elements.artifacts.CallContext;
15 import org.dive4elements.river.artifacts.D4EArtifact; 15 import org.dive4elements.river.artifacts.D4EArtifact;
16 import org.dive4elements.river.artifacts.model.CalculationResult; 16 import org.dive4elements.river.artifacts.model.CalculationResult;
17 import org.dive4elements.river.artifacts.model.WQDay; 17 import org.dive4elements.river.artifacts.model.WQDay;
18 import org.dive4elements.river.artifacts.states.DefaultState.ComputeType; 18 import org.dive4elements.river.artifacts.states.DefaultState.ComputeType;
19 import org.dive4elements.river.jfree.RiverAnnotation;
19 import org.dive4elements.river.jfree.StickyAxisAnnotation; 20 import org.dive4elements.river.jfree.StickyAxisAnnotation;
20 21
21 /** 22 /**
22 * Facet to show Main W Values. 23 * Facet to show Main W Values.
23 */ 24 */
37 /** 38 /**
38 * Set the hit-point in W where a line drawn from the axis would hit the 39 * Set the hit-point in W where a line drawn from the axis would hit the
39 * curve in WQDay (if hit). 40 * curve in WQDay (if hit).
40 * Employ linear interpolation. 41 * Employ linear interpolation.
41 */ 42 */
42 protected static void setHitPoint(final WQDay wqday, final StickyAxisAnnotation annotation) { 43 public static void setHitPoint(final WQDay wqday, final StickyAxisAnnotation annotation) {
43 44
44 final float w = annotation.getPos(); 45 final float w = annotation.getPos();
45
46 final Double day = wqday.interpolateDayByW(w); 46 final Double day = wqday.interpolateDayByW(w);
47 47 if (day != null)
48 if (day != null) {
49 annotation.setHitPoint(day.floatValue()); 48 annotation.setHitPoint(day.floatValue());
50 } 49 else
51 else if (log.isDebugEnabled()) {
52 log.debug("StickyAnnotation does not hit wqday curve: " + w); 50 log.debug("StickyAnnotation does not hit wqday curve: " + w);
53 }
54 } 51 }
55 52
56 53
57 /** 54 /**
58 * Returns the data this facet provides. 55 * Returns the data this facet provides.
72 69
73 final CalculationResult res = (CalculationResult) flys.compute(context, ComputeType.ADVANCE, false); 70 final CalculationResult res = (CalculationResult) flys.compute(context, ComputeType.ADVANCE, false);
74 71
75 final FloodDurationCalculationResults data = (FloodDurationCalculationResults) res.getData(); 72 final FloodDurationCalculationResults data = (FloodDurationCalculationResults) res.getData();
76 73
77 return data.getMainValueWAnnotation(); 74 return new RiverAnnotation(this.description, data.getMainValueWAnnotations());
78 } 75 }
79 76
80 77
81 /** 78 /**
82 * Create a deep copy of this Facet. 79 * Create a deep copy of this Facet.

http://dive4elements.wald.intevation.org