Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodHeightProcessor.java @ 9347:08f46ccd37ba
salix.regional refactoring
author | gernotbelger |
---|---|
date | Tue, 31 Jul 2018 16:04:01 +0200 |
parents | 7100a555607c |
children | f8308db94634 |
comparison
equal
deleted
inserted
replaced
9346:d89976700474 | 9347:08f46ccd37ba |
---|---|
15 | 15 |
16 import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; | 16 import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; |
17 import org.dive4elements.artifactdatabase.state.Facet; | 17 import org.dive4elements.artifactdatabase.state.Facet; |
18 import org.dive4elements.artifacts.CallContext; | 18 import org.dive4elements.artifacts.CallContext; |
19 import org.dive4elements.river.artifacts.common.AbstractCalculationResult; | 19 import org.dive4elements.river.artifacts.common.AbstractCalculationResult; |
20 import org.dive4elements.river.artifacts.common.AbstractProcessor; | |
21 import org.dive4elements.river.artifacts.common.ResultFacet; | |
20 import org.dive4elements.river.artifacts.resources.Resources; | 22 import org.dive4elements.river.artifacts.resources.Resources; |
21 import org.dive4elements.river.artifacts.sinfo.common.AbstractSInfoProcessor; | |
22 import org.dive4elements.river.artifacts.sinfo.common.SInfoResultFacet; | |
23 import org.dive4elements.river.artifacts.sinfo.common.SInfoResultType; | 23 import org.dive4elements.river.artifacts.sinfo.common.SInfoResultType; |
24 import org.dive4elements.river.artifacts.sinfo.flood_duration.FloodDurationCalculationResult.ValueGetter; | 24 import org.dive4elements.river.artifacts.sinfo.flood_duration.FloodDurationCalculationResult.ValueGetter; |
25 import org.dive4elements.river.artifacts.states.DefaultState.ComputeType; | 25 import org.dive4elements.river.artifacts.states.DefaultState.ComputeType; |
26 import org.dive4elements.river.exports.DiagramGenerator; | 26 import org.dive4elements.river.exports.DiagramGenerator; |
27 import org.dive4elements.river.model.Attribute.AttributeKey; | 27 import org.dive4elements.river.model.Attribute.AttributeKey; |
31 * Processor to generate the facet and data series of infrastructure flood heights | 31 * Processor to generate the facet and data series of infrastructure flood heights |
32 * | 32 * |
33 * @author Matthias Schäfer | 33 * @author Matthias Schäfer |
34 * | 34 * |
35 */ | 35 */ |
36 public final class FloodHeightProcessor extends AbstractSInfoProcessor { | 36 public final class FloodHeightProcessor extends AbstractProcessor { |
37 | 37 |
38 private static final String FACET_FLOOD_HEIGHT_LEFT = "sinfo_facet_flood_height.left"; | 38 private static final String FACET_FLOOD_HEIGHT_LEFT = "sinfo_facet_flood_height.left"; |
39 | 39 |
40 private static final String FACET_FLOOD_HEIGHT_RIGHT = "sinfo_facet_flood_height.right"; | 40 private static final String FACET_FLOOD_HEIGHT_RIGHT = "sinfo_facet_flood_height.right"; |
41 | 41 |
63 final int facetIndex, final int resultIndex) { | 63 final int facetIndex, final int resultIndex) { |
64 | 64 |
65 if (facetIndex == 0) { | 65 if (facetIndex == 0) { |
66 final String description = Resources.getMsg(context.getMeta(), FACET_FLOOD_HEIGHT_DESCRIPTION, FACET_FLOOD_HEIGHT_DESCRIPTION, | 66 final String description = Resources.getMsg(context.getMeta(), FACET_FLOOD_HEIGHT_DESCRIPTION, FACET_FLOOD_HEIGHT_DESCRIPTION, |
67 SInfoResultType.localizeRiverside(context, AttributeKey.LEFT)); | 67 SInfoResultType.localizeRiverside(context, AttributeKey.LEFT)); |
68 return new SInfoResultFacet(facetIndex, resultIndex, FACET_FLOOD_HEIGHT_LEFT, description, I18N_AXIS_LABEL, ComputeType.ADVANCE, id, hash); | 68 return new ResultFacet(facetIndex, resultIndex, FACET_FLOOD_HEIGHT_LEFT, description, I18N_AXIS_LABEL, ComputeType.ADVANCE, id, hash); |
69 } | 69 } |
70 else { | 70 else { |
71 final String description = Resources.getMsg(context.getMeta(), FACET_FLOOD_HEIGHT_DESCRIPTION, FACET_FLOOD_HEIGHT_DESCRIPTION, | 71 final String description = Resources.getMsg(context.getMeta(), FACET_FLOOD_HEIGHT_DESCRIPTION, FACET_FLOOD_HEIGHT_DESCRIPTION, |
72 SInfoResultType.localizeRiverside(context, AttributeKey.RIGHT)); | 72 SInfoResultType.localizeRiverside(context, AttributeKey.RIGHT)); |
73 return new SInfoResultFacet(facetIndex, resultIndex, FACET_FLOOD_HEIGHT_RIGHT, description, I18N_AXIS_LABEL, ComputeType.ADVANCE, id, hash); | 73 return new ResultFacet(facetIndex, resultIndex, FACET_FLOOD_HEIGHT_RIGHT, description, I18N_AXIS_LABEL, ComputeType.ADVANCE, id, hash); |
74 } | 74 } |
75 } | 75 } |
76 | 76 |
77 public static Facet createMainValueHeightFacet(final CallContext context, final String hash, final String id, final FloodDurationCalculationResult result, | 77 public static Facet createMainValueHeightFacet(final CallContext context, final String hash, final String id, final FloodDurationCalculationResult result, |
78 final int facetIndex, final int resultIndex, final int dataIndex) { | 78 final int facetIndex, final int resultIndex, final int dataIndex) { |
107 public double getValue(final DurationWaterlevel waterlevel) { | 107 public double getValue(final DurationWaterlevel waterlevel) { |
108 return waterlevel.getWaterlevel(); | 108 return waterlevel.getWaterlevel(); |
109 } | 109 } |
110 }; | 110 }; |
111 final double[][] points = ((FloodDurationCalculationResult) data).getMainValueDurationPoints(valuegetter, index); | 111 final double[][] points = ((FloodDurationCalculationResult) data).getMainValueDurationPoints(valuegetter, index); |
112 return buildSeriesForType(points, generator, bundle, theme, visible, null); | 112 return buildSeriesForPoints(points, generator, bundle, theme, visible, null); |
113 } | 113 } |
114 } | 114 } |
115 | 115 |
116 final String error = String.format("Unknown facet name: %s", facetName); | 116 final String error = String.format("Unknown facet name: %s", facetName); |
117 throw new UnsupportedOperationException(error); | 117 throw new UnsupportedOperationException(error); |
122 | 122 |
123 final FloodDurationCalculationResult data = (FloodDurationCalculationResult) getResult(generator, bundle); | 123 final FloodDurationCalculationResult data = (FloodDurationCalculationResult) getResult(generator, bundle); |
124 | 124 |
125 final double[][] points = data.getInfrastructurePoints(SInfoResultType.infrastructureHeight, riverside); | 125 final double[][] points = data.getInfrastructurePoints(SInfoResultType.infrastructureHeight, riverside); |
126 | 126 |
127 return buildSeriesForType(points, generator, bundle, theme, visible, null); | 127 return buildSeriesForPoints(points, generator, bundle, theme, visible, null); |
128 } | 128 } |
129 } | 129 } |