Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/collision/CollisionCalcProcessor.java @ 9487:504f63512379
Sinfo collisions: calculation of multiple epochs, avoiding duplicate collision events in the details report
author | mschaefer |
---|---|
date | Tue, 18 Sep 2018 12:21:17 +0200 |
parents | 08f46ccd37ba |
children | 1d4262a68f1f |
comparison
equal
deleted
inserted
replaced
9486:ce13a2f07290 | 9487:504f63512379 |
---|---|
58 | 58 |
59 @Override | 59 @Override |
60 protected String generateSeries(final DiagramGenerator generator, final ArtifactAndFacet bundle, final ThemeDocument theme, final boolean visible) { | 60 protected String generateSeries(final DiagramGenerator generator, final ArtifactAndFacet bundle, final ThemeDocument theme, final boolean visible) { |
61 | 61 |
62 final CollisionCalcFacet facet = (CollisionCalcFacet) bundle.getFacet(); | 62 final CollisionCalcFacet facet = (CollisionCalcFacet) bundle.getFacet(); |
63 final int year = facet.getYear(); | |
64 | 63 |
65 final CollisionCalcOverviewResult result = (CollisionCalcOverviewResult) getResult(generator, bundle); | 64 final CollisionCalcOverviewResult result = (CollisionCalcOverviewResult) getResult(generator, bundle); |
66 | 65 |
67 final double[][] points = result.getStationPointsByYear(SInfoResultType.collisionCount, year); | 66 final double[][] points = result.getStationPointsByYear(SInfoResultType.collisionCount, facet.getYears()); |
68 | 67 |
69 return buildSeriesForPoints(points, generator, bundle, theme, visible, null); | 68 return buildSeriesForPoints(points, generator, bundle, theme, visible, null); |
70 } | 69 } |
71 | 70 |
72 public static final Facet createFacet(final CallContext context, final String hash, final String id, final AbstractCalculationResult result, | 71 public static final Facet createFacet(final CallContext context, final String hash, final String id, final AbstractCalculationResult result, |
74 | 73 |
75 // REMARK: we are using themeCount as facet index, because we get several lines (with the same facet name) for the same | 74 // REMARK: we are using themeCount as facet index, because we get several lines (with the same facet name) for the same |
76 // result index; however name and index are used on client side as unique id. | 75 // result index; however name and index are used on client side as unique id. |
77 | 76 |
78 final CollisionCalcOverviewResult ccoResult = (CollisionCalcOverviewResult) result; | 77 final CollisionCalcOverviewResult ccoResult = (CollisionCalcOverviewResult) result; |
79 if (ccoResult.getSingleYears() == null) { | 78 final String years = CollisionCalculation.yearsToString(ccoResult.getIsEpochs(), ccoResult.getYears().get(themeCount)); |
80 final String facetDescription = Resources.getMsg(context.getMeta(), I18N_SERIES_NAME_PATTERN, I18N_SERIES_NAME_PATTERN, result.getLabel()); | 79 final String facetDescription = Resources.getMsg(context.getMeta(), I18N_SERIES_NAME_PATTERN, I18N_SERIES_NAME_PATTERN, years); |
81 return new CollisionCalcFacet(themeCount, resultIndex, -1, FACET_COLLISION_CALC_COUNT, facetDescription, I18N_AXIS_LABEL, ComputeType.ADVANCE, hash, | 80 return new CollisionCalcFacet(themeCount, resultIndex, years, COLLISION_FACETS[themeCount % 3], facetDescription, I18N_AXIS_LABEL, |
82 id); | 81 ComputeType.ADVANCE, hash, id); |
83 } else { | |
84 final String facetDescription = Resources.getMsg(context.getMeta(), I18N_SERIES_NAME_PATTERN, I18N_SERIES_NAME_PATTERN, Integer.toString(year)); | |
85 return new CollisionCalcFacet(themeCount, resultIndex, year, COLLISION_FACETS[themeCount % 3], facetDescription, I18N_AXIS_LABEL, | |
86 ComputeType.ADVANCE, hash, id); | |
87 } | |
88 } | 82 } |
89 } | 83 } |