comparison artifacts/src/main/java/org/dive4elements/river/exports/process/FixWQProcessor.java @ 9325:094ed9d1f2ad

Fixed: change of point style of interpolated data did not change in WQ chart of fixanalysis Fixed: change of point style of interpolated data did not change in dWt chart of fixanalysis; also had duplicate legend entries
author gernotbelger
date Fri, 27 Jul 2018 14:33:41 +0200
parents 1cc7653ca84f
children a3f318347707
comparison
equal deleted inserted replaced
9324:058701d91552 9325:094ed9d1f2ad
28 import org.dive4elements.river.artifacts.model.fixings.QWD; 28 import org.dive4elements.river.artifacts.model.fixings.QWD;
29 import org.dive4elements.river.artifacts.model.fixings.QWI; 29 import org.dive4elements.river.artifacts.model.fixings.QWI;
30 import org.dive4elements.river.artifacts.resources.Resources; 30 import org.dive4elements.river.artifacts.resources.Resources;
31 import org.dive4elements.river.exports.DiagramGenerator; 31 import org.dive4elements.river.exports.DiagramGenerator;
32 import org.dive4elements.river.exports.StyledSeriesBuilder; 32 import org.dive4elements.river.exports.StyledSeriesBuilder;
33 import org.dive4elements.river.exports.fixings.FixWQCurveGenerator;
33 import org.dive4elements.river.java2d.ShapeUtils; 34 import org.dive4elements.river.java2d.ShapeUtils;
34 import org.dive4elements.river.jfree.CollisionFreeXYTextAnnotation; 35 import org.dive4elements.river.jfree.CollisionFreeXYTextAnnotation;
35 import org.dive4elements.river.jfree.JFreeUtil; 36 import org.dive4elements.river.jfree.JFreeUtil;
36 import org.dive4elements.river.jfree.RiverAnnotation; 37 import org.dive4elements.river.jfree.RiverAnnotation;
37 import org.dive4elements.river.jfree.StickyAxisAnnotation; 38 import org.dive4elements.river.jfree.StickyAxisAnnotation;
159 if (qwd == null) { 160 if (qwd == null) {
160 log.debug("doAnalysisEventsOut: qwd == null"); 161 log.debug("doAnalysisEventsOut: qwd == null");
161 return; 162 return;
162 } 163 }
163 164
164 // Force empty symbol. 165 // prevent potential side effects
165 if (qwd.getInterpolated()) { 166 final ThemeDocument themeInterpolated = FixWQCurveGenerator.configureThemeInterpolated(theme, qwd);
166 theme = new ThemeDocument(theme); // prevent potential side effects
167 theme.setValue(ThemeDocument.USE_FILL_PAINT, "true");
168 }
169 167
170 XYSeries series = new StyledXYSeries( 168 XYSeries series = new StyledXYSeries(
171 bundle.getFacetDescription(), 169 bundle.getFacetDescription(),
172 theme, 170 themeInterpolated,
173 qwd.getInterpolated() 171 qwd.getInterpolated()
174 ? ShapeUtils.INTERPOLATED_SHAPE 172 ? ShapeUtils.INTERPOLATED_SHAPE
175 : ShapeUtils.MEASURED_SHAPE); 173 : ShapeUtils.MEASURED_SHAPE);
176 174
177 series.add(qwd.getQ(), qwd.getW()); 175 series.add(qwd.getQ(), qwd.getW());
178 176
179 generator.addAxisSeries(series, axisName, visible); 177 generator.addAxisSeries(series, axisName, visible);
180 178
181 if (visible && theme.parseShowPointLabel()) { 179 if (visible && themeInterpolated.parseShowPointLabel()) {
182 180
183 List<XYTextAnnotation> textAnnos = 181 List<XYTextAnnotation> textAnnos =
184 new ArrayList<XYTextAnnotation>(); 182 new ArrayList<XYTextAnnotation>();
185 183
186 DateFormat dateFormat = DateFormat.getDateInstance( 184 DateFormat dateFormat = DateFormat.getDateInstance(
190 qwd.getQ(), 188 qwd.getQ(),
191 qwd.getW()); 189 qwd.getW());
192 textAnnos.add(anno); 190 textAnnos.add(anno);
193 191
194 RiverAnnotation flysAnno = 192 RiverAnnotation flysAnno =
195 new RiverAnnotation(null, null, null, theme); 193 new RiverAnnotation(null, null, null, themeInterpolated);
196 flysAnno.setTextAnnotations(textAnnos); 194 flysAnno.setTextAnnotations(textAnnos);
197 generator.addAnnotations(flysAnno); 195 generator.addAnnotations(flysAnno);
198 } 196 }
199 } 197 }
200 198
211 log.debug("doReferenceEventsOut: qwds == null in " 209 log.debug("doReferenceEventsOut: qwds == null in "
212 + bundle.getFacetDescription()); 210 + bundle.getFacetDescription());
213 return; 211 return;
214 } 212 }
215 213
216 // Force empty symbol. 214 final ThemeDocument themeInterpolated = FixWQCurveGenerator.configureThemeInterpolated(theme, qwd);
217 if (qwd.getInterpolated()) {
218 theme = new ThemeDocument(theme); // prevent potential side effects
219 theme.setValue(ThemeDocument.USE_FILL_PAINT, "true");
220 }
221 215
222 XYSeries series = new StyledXYSeries( 216 XYSeries series = new StyledXYSeries(
223 bundle.getFacetDescription(), 217 bundle.getFacetDescription(),
224 false, true, theme, 218 false, true, themeInterpolated,
225 qwd.getInterpolated() 219 qwd.getInterpolated()
226 ? ShapeUtils.INTERPOLATED_SHAPE 220 ? ShapeUtils.INTERPOLATED_SHAPE
227 : ShapeUtils.MEASURED_SHAPE); 221 : ShapeUtils.MEASURED_SHAPE);
228 222
229 series.add(qwd.getQ(), qwd.getW(), false); 223 series.add(qwd.getQ(), qwd.getW(), false);
230 224
231 if (visible && theme.parseShowPointLabel()) { 225 if (visible && themeInterpolated.parseShowPointLabel()) {
232 DateFormat dateFormat = DateFormat.getDateInstance( 226 DateFormat dateFormat = DateFormat.getDateInstance(
233 DateFormat.SHORT); 227 DateFormat.SHORT);
234 228
235 XYTextAnnotation anno = new CollisionFreeXYTextAnnotation( 229 XYTextAnnotation anno = new CollisionFreeXYTextAnnotation(
236 dateFormat.format(qwd.getDate()), 230 dateFormat.format(qwd.getDate()),
239 233
240 List<XYTextAnnotation> textAnnos = 234 List<XYTextAnnotation> textAnnos =
241 new ArrayList<XYTextAnnotation>(); 235 new ArrayList<XYTextAnnotation>();
242 textAnnos.add(anno); 236 textAnnos.add(anno);
243 RiverAnnotation flysAnno = 237 RiverAnnotation flysAnno =
244 new RiverAnnotation(null, null, null, theme); 238 new RiverAnnotation(null, null, null, themeInterpolated);
245 flysAnno.setTextAnnotations(textAnnos); 239 flysAnno.setTextAnnotations(textAnnos);
246 generator.addAnnotations(flysAnno); 240 generator.addAnnotations(flysAnno);
247 } 241 }
248 242
249 generator.addAxisSeries(series, axisName, visible); 243 generator.addAxisSeries(series, axisName, visible);

http://dive4elements.wald.intevation.org