Mercurial > dive4elements > river
diff artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/FlowDepthDevelopmentProcessor.java @ 8980:b194fa64506a
SINFO - show results themes according to spec, either raw data or floating mean values.
Some improvements to error handling and handling of empty results.
author | gernotbelger |
---|---|
date | Thu, 05 Apr 2018 18:30:34 +0200 |
parents | ee5ce13016ed |
children | 1cc7653ca84f |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/FlowDepthDevelopmentProcessor.java Thu Apr 05 17:12:23 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/FlowDepthDevelopmentProcessor.java Thu Apr 05 18:30:34 2018 +0200 @@ -25,24 +25,29 @@ private static final String SINFO_CHART_FLOW_DEPTH_DEVELOPMENT_YAXIS_LABEL = "sinfo.chart.flow_depth.yaxis.label"; /* Theme name, usually defined in 'FacetTypes', but that is soooo bad dependencies... */ - // REMARK: these mustend with 'filtered' so extra handling happens in chart: point are always recalculated, because data - // changes depending on zoom state + // REMARK: these must end with 'filtered' so extra handling happens in chart: point are always recalculated, because + // data changes depending on zoom state public static final String FACET_FLOW_DEPTH_DEVELOPMENT_FILTERED = "sinfo_facet_flow_depth_development.filtered"; - private static final String I18N_FACET_FLOW_DEPTH_DEVELOPMENT_FILTERED_DESCRIPTION = "sinfo.facet.flow_depth_development.filtered.description"; + private static final String FACET_FLOW_DEPTH_DEVELOPMENT_FILTERED_DESCRIPTION = "sinfo.facet.flow_depth_development.filtered.description"; + + public static final String FACET_FLOW_DEPTH_DEVELOPMENT_RAW = "sinfo_facet_flow_depth_development"; + + private static final String FACET_FLOW_DEPTH_DEVELOPMENT_RAW_DESCRIPTION = "sinfo.facet.flow_depth_development.raw.description"; public static final String FACET_WATERLEVEL_DIFFERENCE_FILTERED = "sinfo_facet_waterlevel_difference.filtered"; - private static final String I18N_FACET_WATERLEVEL_DIFFERENCE_FILTERED_DESCRIPTION = "sinfo.facet.waterlevel_difference.filtered.description"; + private static final String FACET_WATERLEVEL_DIFFERENCE_FILTERED_DESCRIPTION = "sinfo.facet.waterlevel_difference.filtered.description"; public static final String FACET_BEDHEIGHT_DIFFERENCE_FILTERED = "sinfo_facet_bedheight_difference.filtered"; - private static final String I18N_FACET_BEDHEIGHT_DIFFERENCE_FILTERED_DESCRIPTION = "sinfo.facet.bedheight_difference.filtered.description"; + private static final String FACET_BEDHEIGHT_DIFFERENCE_FILTERED_DESCRIPTION = "sinfo.facet.bedheight_difference.filtered.description"; private static final Set<String> HANDLED_FACET_TYPES = new HashSet<>(); static { HANDLED_FACET_TYPES.add(FACET_FLOW_DEPTH_DEVELOPMENT_FILTERED); + HANDLED_FACET_TYPES.add(FACET_FLOW_DEPTH_DEVELOPMENT_RAW); HANDLED_FACET_TYPES.add(FACET_WATERLEVEL_DIFFERENCE_FILTERED); HANDLED_FACET_TYPES.add(FACET_BEDHEIGHT_DIFFERENCE_FILTERED); } @@ -56,6 +61,8 @@ if (FACET_FLOW_DEPTH_DEVELOPMENT_FILTERED.contentEquals(facetName)) return data.getStationPoints(SInfoResultType.flowdepthDevelopment); + if (FACET_FLOW_DEPTH_DEVELOPMENT_RAW.contentEquals(facetName)) + return data.getStationPoints(SInfoResultType.flowdepthDevelopment); if (FACET_WATERLEVEL_DIFFERENCE_FILTERED.contentEquals(facetName)) return data.getStationPoints(SInfoResultType.waterlevelDifference); @@ -67,18 +74,22 @@ throw new UnsupportedOperationException(error); } - public static Facet createFlowDepthDevelopmentFacet(final CallContext context, final String hash, final String id, + public static Facet createFlowDepthDevelopmentFilteredFacet(final CallContext context, final String hash, final String id, final AbstractSInfoCalculationResult result, final int index) { - final String facetFlowDepthFilteredDescription = Resources.getMsg(context.getMeta(), I18N_FACET_FLOW_DEPTH_DEVELOPMENT_FILTERED_DESCRIPTION, - I18N_FACET_FLOW_DEPTH_DEVELOPMENT_FILTERED_DESCRIPTION, result.getLabel()); - return new SInfoResultFacet(index, FACET_FLOW_DEPTH_DEVELOPMENT_FILTERED, facetFlowDepthFilteredDescription, - SINFO_CHART_FLOW_DEPTH_DEVELOPMENT_YAXIS_LABEL, ComputeType.ADVANCE, id, hash); + return AbstractSInfoLineProcessor.createFacet(context, hash, id, result, index, SINFO_CHART_FLOW_DEPTH_DEVELOPMENT_YAXIS_LABEL, + FACET_FLOW_DEPTH_DEVELOPMENT_FILTERED, FACET_FLOW_DEPTH_DEVELOPMENT_FILTERED_DESCRIPTION); + } + + public static Facet createFlowDepthDevelopmentRawFacet(final CallContext context, final String hash, final String id, + final AbstractSInfoCalculationResult result, final int index) { + return AbstractSInfoLineProcessor.createFacet(context, hash, id, result, index, SINFO_CHART_FLOW_DEPTH_DEVELOPMENT_YAXIS_LABEL, + FACET_FLOW_DEPTH_DEVELOPMENT_RAW, FACET_FLOW_DEPTH_DEVELOPMENT_RAW_DESCRIPTION); } public static Facet createWaterlevelDifferenceFacet(final CallContext context, final String hash, final String id, final AbstractSInfoCalculationResult result, final int index) { - final String facetFlowDepthTkhFilteredDescription = Resources.getMsg(context.getMeta(), I18N_FACET_WATERLEVEL_DIFFERENCE_FILTERED_DESCRIPTION, - I18N_FACET_WATERLEVEL_DIFFERENCE_FILTERED_DESCRIPTION, result.getLabel()); + final String facetFlowDepthTkhFilteredDescription = Resources.getMsg(context.getMeta(), FACET_WATERLEVEL_DIFFERENCE_FILTERED_DESCRIPTION, + FACET_WATERLEVEL_DIFFERENCE_FILTERED_DESCRIPTION, result.getLabel()); return new SInfoResultFacet(index, FACET_WATERLEVEL_DIFFERENCE_FILTERED, facetFlowDepthTkhFilteredDescription, SINFO_CHART_FLOW_DEPTH_DEVELOPMENT_YAXIS_LABEL, ComputeType.ADVANCE, id, hash); } @@ -86,8 +97,8 @@ public static Facet createBedHeightDifferenceFacet(final CallContext context, final String hash, final String id, final AbstractSInfoCalculationResult result, final int index) { - final String facetFlowDepthFilteredDescription = Resources.getMsg(context.getMeta(), I18N_FACET_BEDHEIGHT_DIFFERENCE_FILTERED_DESCRIPTION, - I18N_FACET_BEDHEIGHT_DIFFERENCE_FILTERED_DESCRIPTION, result.getLabel()); + final String facetFlowDepthFilteredDescription = Resources.getMsg(context.getMeta(), FACET_BEDHEIGHT_DIFFERENCE_FILTERED_DESCRIPTION, + FACET_BEDHEIGHT_DIFFERENCE_FILTERED_DESCRIPTION, result.getLabel()); return new SInfoResultFacet(index, FACET_BEDHEIGHT_DIFFERENCE_FILTERED, facetFlowDepthFilteredDescription, SINFO_CHART_FLOW_DEPTH_DEVELOPMENT_YAXIS_LABEL, ComputeType.ADVANCE, id, hash); }