Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/AbstractSInfoLineProcessor.java @ 8946:5d5d482da3e9
Implementing SINFO - FlowDepthMinMax calculation
author | gernotbelger |
---|---|
date | Tue, 13 Mar 2018 18:49:33 +0100 |
parents | 82998242ba84 |
children | a4f1ac81f26d |
comparison
equal
deleted
inserted
replaced
8945:4a6b6a3c279c | 8946:5d5d482da3e9 |
---|---|
24 import org.dive4elements.river.exports.DiagramGenerator; | 24 import org.dive4elements.river.exports.DiagramGenerator; |
25 import org.dive4elements.river.exports.StyledSeriesBuilder; | 25 import org.dive4elements.river.exports.StyledSeriesBuilder; |
26 import org.dive4elements.river.jfree.StyledXYSeries; | 26 import org.dive4elements.river.jfree.StyledXYSeries; |
27 import org.dive4elements.river.themes.ThemeDocument; | 27 import org.dive4elements.river.themes.ThemeDocument; |
28 | 28 |
29 abstract class AbstractSInfoLineProcessor extends AbstractSInfoProcessor { | 29 abstract class AbstractSInfoLineProcessor<RESULT extends AbstractSInfoCalculationResult<?>> extends AbstractSInfoProcessor { |
30 | 30 |
31 public AbstractSInfoLineProcessor(final String i18nAxisLabel, final Set<String> handledFacetType) { | 31 public AbstractSInfoLineProcessor(final String i18nAxisLabel, final Set<String> handledFacetType) { |
32 super(i18nAxisLabel, handledFacetType); | 32 super(i18nAxisLabel, handledFacetType); |
33 } | 33 } |
34 | 34 |
42 | 42 |
43 final StyledXYSeries series = new StyledXYSeries(bundle.getFacetDescription(), theme); | 43 final StyledXYSeries series = new StyledXYSeries(bundle.getFacetDescription(), theme); |
44 series.putMetaData(metaData, artifact, context); | 44 series.putMetaData(metaData, artifact, context); |
45 | 45 |
46 final String facetName = bundle.getFacetName(); | 46 final String facetName = bundle.getFacetName(); |
47 final AbstractSInfoCalculationResult<?> data = (AbstractSInfoCalculationResult<?>) bundle.getData(context); | 47 @SuppressWarnings("unchecked") |
48 final RESULT data = (RESULT) bundle.getData(context); | |
48 if (data == null) { | 49 if (data == null) { |
49 // Check has been here before so we keep it for security reasons | 50 // Check has been here before so we keep it for security reasons |
50 // this should never happen though. | 51 // this should never happen though. |
51 throw new IllegalStateException("Data is null for facet: " + facetName); | 52 throw new IllegalStateException("Data is null for facet: " + facetName); |
52 } | 53 } |
72 final String river = access.getRiverName(); | 73 final String river = access.getRiverName(); |
73 | 74 |
74 return scales.getRadius(river, start, end); | 75 return scales.getRadius(river, start, end); |
75 } | 76 } |
76 | 77 |
77 private double[][] generatePoints(final CallContext context, final Artifact artifact, final AbstractSInfoCalculationResult<?> data, | 78 private double[][] generatePoints(final CallContext context, final Artifact artifact, final RESULT data, |
78 final String facetName) { | 79 final String facetName) { |
79 | 80 |
80 final double[][] points = doGetPoints(data, facetName); | 81 final double[][] points = doGetPoints(data, facetName); |
81 if( facetName.endsWith(".filtered")) | 82 if( facetName.endsWith(".filtered")) |
82 { | 83 { |
85 } | 86 } |
86 | 87 |
87 return points; | 88 return points; |
88 } | 89 } |
89 | 90 |
90 protected abstract double[][] doGetPoints(AbstractSInfoCalculationResult<?> data, String facetName); | 91 protected abstract double[][] doGetPoints(RESULT data, String facetName); |
91 | 92 |
92 private double[][] movingAverage(final Double radius, final double[][] points) { | 93 private double[][] movingAverage(final Double radius, final double[][] points) { |
93 | 94 |
94 if (radius == null) | 95 if (radius == null) |
95 return points; | 96 return points; |