Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/FloodHeightProcessor.java @ 9208:53cc5b496692
funcion replaced by interface
author | gernotbelger |
---|---|
date | Tue, 03 Jul 2018 11:16:51 +0200 |
parents | 3dae6b78e1da |
children |
comparison
equal
deleted
inserted
replaced
9207:559775e2f53c | 9208:53cc5b496692 |
---|---|
10 | 10 |
11 package org.dive4elements.river.artifacts.sinfo.common; | 11 package org.dive4elements.river.artifacts.sinfo.common; |
12 | 12 |
13 import java.util.HashSet; | 13 import java.util.HashSet; |
14 import java.util.Set; | 14 import java.util.Set; |
15 import java.util.function.Function; | |
16 | 15 |
17 import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; | 16 import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; |
18 import org.dive4elements.artifactdatabase.state.Facet; | 17 import org.dive4elements.artifactdatabase.state.Facet; |
19 import org.dive4elements.artifacts.CallContext; | 18 import org.dive4elements.artifacts.CallContext; |
20 import org.dive4elements.river.artifacts.common.AbstractCalculationResult; | 19 import org.dive4elements.river.artifacts.common.AbstractCalculationResult; |
21 import org.dive4elements.river.artifacts.resources.Resources; | 20 import org.dive4elements.river.artifacts.resources.Resources; |
22 import org.dive4elements.river.artifacts.sinfo.flood_duration.DurationWaterlevel; | 21 import org.dive4elements.river.artifacts.sinfo.flood_duration.DurationWaterlevel; |
23 import org.dive4elements.river.artifacts.sinfo.flood_duration.FloodDurationCalculationResult; | 22 import org.dive4elements.river.artifacts.sinfo.flood_duration.FloodDurationCalculationResult; |
23 import org.dive4elements.river.artifacts.sinfo.flood_duration.FloodDurationCalculationResult.ValueGetter; | |
24 import org.dive4elements.river.artifacts.states.DefaultState.ComputeType; | 24 import org.dive4elements.river.artifacts.states.DefaultState.ComputeType; |
25 import org.dive4elements.river.exports.DiagramGenerator; | 25 import org.dive4elements.river.exports.DiagramGenerator; |
26 import org.dive4elements.river.exports.LongitudinalSectionGenerator; | 26 import org.dive4elements.river.exports.LongitudinalSectionGenerator; |
27 import org.dive4elements.river.themes.ThemeDocument; | 27 import org.dive4elements.river.themes.ThemeDocument; |
28 | 28 |
75 | 75 |
76 if (FACET_FLOOD_HEIGHT.contentEquals(facetName)) | 76 if (FACET_FLOOD_HEIGHT.contentEquals(facetName)) |
77 return buildSeriesForType(generator, bundle, theme, visible, SInfoResultType.infrastructureHeight, null); | 77 return buildSeriesForType(generator, bundle, theme, visible, SInfoResultType.infrastructureHeight, null); |
78 | 78 |
79 if (FACET_MAIN_VALUE_HEIGHT.contentEquals(facetName)) { | 79 if (FACET_MAIN_VALUE_HEIGHT.contentEquals(facetName)) { |
80 final double[][] heightPoints = FloodDurationProcessor.getMainValueDurationPoints(generator, bundle, new Function<DurationWaterlevel, Double>() { | 80 |
81 @Override | 81 final AbstractCalculationResult data = getResult(generator, bundle); |
82 public Double apply(final DurationWaterlevel waterlevel) { | 82 |
83 return waterlevel.getWaterlevel(); | 83 if (data instanceof FloodDurationCalculationResult) { |
84 } | 84 final int index = getDataIndex(bundle); |
85 }); | 85 final FloodDurationCalculationResult.ValueGetter valuegetter = new ValueGetter() { |
86 return buildSeriesForType(heightPoints, generator, bundle, theme, visible, null); | 86 @Override |
87 public double getValue(final DurationWaterlevel waterlevel) { | |
88 return waterlevel.getWaterlevel(); | |
89 } | |
90 }; | |
91 final double[][] points = ((FloodDurationCalculationResult) data).getMainValueDurationPoints(generator, bundle, valuegetter, index); | |
92 return buildSeriesForType(points, generator, bundle, theme, visible, null); | |
93 } | |
94 | |
87 } | 95 } |
88 | 96 |
89 final String error = String.format("Unknown facet name: %s", facetName); | 97 final String error = String.format("Unknown facet name: %s", facetName); |
90 throw new UnsupportedOperationException(error); | 98 throw new UnsupportedOperationException(error); |
91 } | 99 } |