Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/exports/HistoricalDischargeCurveGenerator.java @ 9556:9b8e8fc1f408
Use facetName in all processors as themeType for legend aggregation.
author | gernotbelger |
---|---|
date | Tue, 23 Oct 2018 16:26:58 +0200 |
parents | 740d65e4aa14 |
children |
comparison
equal
deleted
inserted
replaced
9555:ef5754ba5573 | 9556:9b8e8fc1f408 |
---|---|
111 } | 111 } |
112 | 112 |
113 @Override | 113 @Override |
114 public void doOut(final ArtifactAndFacet artifactFacet, final ThemeDocument theme, final boolean visible) { | 114 public void doOut(final ArtifactAndFacet artifactFacet, final ThemeDocument theme, final boolean visible) { |
115 final String name = artifactFacet.getFacetName(); | 115 final String name = artifactFacet.getFacetName(); |
116 String facetDescription = artifactFacet.getFacetDescription(); | |
117 | |
116 log.debug("HistoricalDischargeCurveGenerator.doOut: " + name); | 118 log.debug("HistoricalDischargeCurveGenerator.doOut: " + name); |
117 log.debug("Theme description is: " + artifactFacet.getFacetDescription()); | 119 log.debug("Theme description is: " + facetDescription); |
118 | 120 |
119 final CallContext context = getContext(); | 121 final CallContext context = getContext(); |
120 | 122 |
121 if (name.equals(HISTORICAL_DISCHARGE_Q)) { | 123 if (name.equals(HISTORICAL_DISCHARGE_Q)) { |
122 doHistoricalDischargeOutQ((D4EArtifact) artifactFacet.getArtifact(), artifactFacet.getData(context), artifactFacet.getFacetDescription(), theme, | 124 doHistoricalDischargeOutQ(name, (D4EArtifact) artifactFacet.getArtifact(), artifactFacet.getData(context), facetDescription, theme, |
123 visible); | 125 visible); |
124 } else if (name.equals(HISTORICAL_DISCHARGE_W)) { | 126 } else if (name.equals(HISTORICAL_DISCHARGE_W)) { |
125 doHistoricalDischargeOutW((D4EArtifact) artifactFacet.getArtifact(), artifactFacet.getData(context), artifactFacet.getFacetDescription(), theme, | 127 doHistoricalDischargeOutW(name, (D4EArtifact) artifactFacet.getArtifact(), artifactFacet.getData(context), facetDescription, theme, |
126 visible); | 128 visible); |
127 } else if (name.equals(HISTORICAL_DISCHARGE_Q_DIFF)) { | 129 } else if (name.equals(HISTORICAL_DISCHARGE_Q_DIFF)) { |
128 doHistoricalDischargeDifferenceOutQ((D4EArtifact) artifactFacet.getArtifact(), artifactFacet.getData(context), artifactFacet.getFacetDescription(), | 130 doHistoricalDischargeDifferenceOutQ(name, (D4EArtifact) artifactFacet.getArtifact(), artifactFacet.getData(context), facetDescription, |
129 theme, visible); | 131 theme, visible); |
130 } else if (name.equals(HISTORICAL_DISCHARGE_W_DIFF)) { | 132 } else if (name.equals(HISTORICAL_DISCHARGE_W_DIFF)) { |
131 doHistoricalDischargeDifferenceOutW((D4EArtifact) artifactFacet.getArtifact(), artifactFacet.getData(context), artifactFacet.getFacetDescription(), | 133 doHistoricalDischargeDifferenceOutW(name, (D4EArtifact) artifactFacet.getArtifact(), artifactFacet.getData(context), facetDescription, |
132 theme, visible); | 134 theme, visible); |
133 } else if (FacetTypes.IS.MANUALPOINTS(name)) { | 135 } else if (FacetTypes.IS.MANUALPOINTS(name)) { |
134 final HistoricalDischargeAccess.EvaluationMode mode = new HistoricalDischargeAccess((D4EArtifact) getMaster()).getEvaluationMode(); | 136 final HistoricalDischargeAccess.EvaluationMode mode = new HistoricalDischargeAccess((D4EArtifact) getMaster()).getEvaluationMode(); |
135 final int axis = mode == HistoricalDischargeAccess.EvaluationMode.W ? YAXIS.Q.idx : YAXIS.W.idx; | 137 final int axis = mode == HistoricalDischargeAccess.EvaluationMode.W ? YAXIS.Q.idx : YAXIS.W.idx; |
136 | 138 |
139 log.warn("doOut(): unknown facet name: " + name); | 141 log.warn("doOut(): unknown facet name: " + name); |
140 return; | 142 return; |
141 } | 143 } |
142 } | 144 } |
143 | 145 |
144 protected void doHistoricalDischargeOutQ(final D4EArtifact artifact, final Object data, final String desc, final ThemeDocument theme, | 146 protected void doHistoricalDischargeOutQ(final String facetName, final D4EArtifact artifact, final Object data, final String desc, final ThemeDocument theme, |
145 final boolean visible) { | 147 final boolean visible) { |
146 log.debug("doHistoricalDischargeOut(): description = " + desc); | 148 log.debug("doHistoricalDischargeOut(): description = " + desc); |
147 | 149 |
148 final WQTimerange wqt = (WQTimerange) data; | 150 final WQTimerange wqt = (WQTimerange) data; |
149 | 151 |
150 final TimeSeriesCollection tsc = newTimeSeriesCollection(wqt.getTimeranges(), wqt.getQs(), theme, desc); | 152 final TimeSeriesCollection tsc = newTimeSeriesCollection(facetName, wqt.getTimeranges(), wqt.getQs(), theme, desc); |
151 | 153 |
152 addAxisDataset(tsc, YAXIS.Q.idx, visible); | 154 addAxisDataset(tsc, YAXIS.Q.idx, visible); |
153 } | 155 } |
154 | 156 |
155 protected void doHistoricalDischargeOutW(final D4EArtifact artifact, final Object data, final String desc, final ThemeDocument theme, | 157 protected void doHistoricalDischargeOutW(final String facetName, final D4EArtifact artifact, final Object data, final String desc, final ThemeDocument theme, |
156 final boolean visible) { | 158 final boolean visible) { |
157 log.debug("doHistoricalDischargeOut(): description = " + desc); | 159 log.debug("doHistoricalDischargeOut(): description = " + desc); |
158 | 160 |
159 final WQTimerange wqt = (WQTimerange) data; | 161 final WQTimerange wqt = (WQTimerange) data; |
160 | 162 |
161 final TimeSeriesCollection tsc = newTimeSeriesCollection(wqt.getTimeranges(), wqt.getWs(), theme, desc); | 163 final TimeSeriesCollection tsc = newTimeSeriesCollection(facetName, wqt.getTimeranges(), wqt.getWs(), theme, desc); |
162 | 164 |
163 addAxisDataset(tsc, YAXIS.W.idx, visible); | 165 addAxisDataset(tsc, YAXIS.W.idx, visible); |
164 } | 166 } |
165 | 167 |
166 protected void doHistoricalDischargeDifferenceOutQ(final D4EArtifact artifact, final Object data, final String desc, final ThemeDocument theme, | 168 protected void doHistoricalDischargeDifferenceOutQ(final String facetName, final D4EArtifact artifact, final Object data, final String desc, final ThemeDocument theme, |
167 final boolean visible) { | 169 final boolean visible) { |
168 log.debug("doHistoricalDischargeDifferenceOut: desc = " + desc); | 170 log.debug("doHistoricalDischargeDifferenceOut: desc = " + desc); |
169 | 171 |
170 final HistoricalWQTimerange wqt = (HistoricalWQTimerange) data; | 172 final HistoricalWQTimerange wqt = (HistoricalWQTimerange) data; |
171 | 173 |
172 final TimeSeriesCollection tsc = newTimeSeriesCollection(wqt.getTimeranges(), wqt.getDiffs(), theme, desc); | 174 final TimeSeriesCollection tsc = newTimeSeriesCollection(facetName, wqt.getTimeranges(), wqt.getDiffs(), theme, desc); |
173 | 175 |
174 addAxisDataset(tsc, YAXIS.Q.idx, visible); | 176 addAxisDataset(tsc, YAXIS.Q.idx, visible); |
175 } | 177 } |
176 | 178 |
177 protected void doHistoricalDischargeDifferenceOutW(final D4EArtifact artifact, final Object data, final String desc, final ThemeDocument theme, | 179 protected void doHistoricalDischargeDifferenceOutW(final String facetName, final D4EArtifact artifact, final Object data, final String desc, final ThemeDocument theme, |
178 final boolean visible) { | 180 final boolean visible) { |
179 log.debug("doHistoricalDischargeDifferenceOut: desc = " + desc); | 181 log.debug("doHistoricalDischargeDifferenceOut: desc = " + desc); |
180 | 182 |
181 final HistoricalWQTimerange wqt = (HistoricalWQTimerange) data; | 183 final HistoricalWQTimerange wqt = (HistoricalWQTimerange) data; |
182 | 184 |
183 final TimeSeriesCollection tsc = newTimeSeriesCollection(wqt.getTimeranges(), wqt.getDiffs(), theme, desc); | 185 final TimeSeriesCollection tsc = newTimeSeriesCollection(facetName, wqt.getTimeranges(), wqt.getDiffs(), theme, desc); |
184 | 186 |
185 addAxisDataset(tsc, YAXIS.W.idx, visible); | 187 addAxisDataset(tsc, YAXIS.W.idx, visible); |
186 } | 188 } |
187 | 189 |
188 /** | 190 /** |
189 * Creates a new TimeSeriesCollection with a single TimeSeries. The | 191 * Creates a new TimeSeriesCollection with a single TimeSeries. The |
190 * TimeSeries will consist of two RegularTimePeriods for each W/Q value | 192 * TimeSeries will consist of two RegularTimePeriods for each W/Q value |
191 * provided by <i>wqt</i>. This has the effect, that the line in the chart | 193 * provided by <i>wqt</i>. This has the effect, that the line in the chart |
192 * looks like a "step chart". | 194 * looks like a "step chart". |
193 */ | 195 */ |
194 protected TimeSeriesCollection newTimeSeriesCollection(final Timerange[] timeranges, final double[] values, final ThemeDocument theme, final String desc) { | 196 protected TimeSeriesCollection newTimeSeriesCollection(final String facetName, final Timerange[] timeranges, final double[] values, final ThemeDocument theme, final String desc) { |
195 log.debug("Create new TimeSeriesCollection for: " + desc); | 197 log.debug("Create new TimeSeriesCollection for: " + desc); |
196 | 198 |
197 final TimeSeriesCollection tsc = new TimeSeriesCollection(); | 199 final TimeSeriesCollection tsc = new TimeSeriesCollection(); |
198 final TimeSeries series = new StyledTimeSeries(desc, theme); | 200 final TimeSeries series = new StyledTimeSeries(facetName, desc, theme); |
199 | 201 |
200 for (int i = 0, n = timeranges.length; i < n; i++) { | 202 for (int i = 0, n = timeranges.length; i < n; i++) { |
201 final RegularTimePeriod[] rtp = newRegularTimePeriod(timeranges[i]); | 203 final RegularTimePeriod[] rtp = newRegularTimePeriod(timeranges[i]); |
202 | 204 |
203 try { | 205 try { |