Mercurial > dive4elements > river
diff artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthState.java @ 8884:7a8c12706834
Work on SINFO-FlowDepth
author | gernotbelger |
---|---|
date | Tue, 13 Feb 2018 14:53:23 +0100 |
parents | 64ca63f79f6f |
children | e3519c3e7a0a |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthState.java Fri Feb 09 18:07:22 2018 +0100 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthState.java Tue Feb 13 14:53:23 2018 +0100 @@ -25,9 +25,8 @@ import org.dive4elements.river.artifacts.states.DefaultState; /** State in which a waterlevel has been calculated. */ -public class FlowDepthState -extends DefaultState -{ +public class FlowDepthState extends DefaultState { + /// ** The log that is used in this state. */ // private static Logger log = Logger.getLogger(FlowDepthState.class); @@ -35,6 +34,14 @@ private static final String I18N_FACET_FLOW_DEPTH_FILTERED_DESCRIPTION = "sinfo.facet.flow_depth.filtered.description"; + private static final String I18N_FACET_FLOW_DEPTH_TKH_FILTERED_DESCRIPTION = "sinfo.facet.flow_depth.tkh.filtered.description"; + + private static final String I18N_FACET_TKH_DESCRIPTION = "sinfo.facet.tkh.description"; + + private static final String SINFO_CHART_FLOW_DEPTH_YAXIS_LABEL = "sinfo.chart.flow_depth.yaxis.label"; + + private static final String SINFO_CHART_TKX_YAXIS_LABEL = "sinfo.chart.tkh.yaxis.label"; + /** * From this state can only be continued trivially. */ @@ -44,13 +51,7 @@ } @Override - public Object computeFeed( - final D4EArtifact artifact, - final String hash, - final CallContext context, - final List<Facet> facets, - final Object old - ) { + public Object computeFeed(final D4EArtifact artifact, final String hash, final CallContext context, final List<Facet> facets, final Object old) { // FIXME: why is this necessary? if (artifact instanceof ChartArtifact) { facets.add(new EmptyFacet()); @@ -61,13 +62,7 @@ } @Override - public Object computeAdvance( - final D4EArtifact artifact, - final String hash, - final CallContext context, - final List<Facet> facets, - final Object old - ) { + public Object computeAdvance(final D4EArtifact artifact, final String hash, final CallContext context, final List<Facet> facets, final Object old) { if (artifact instanceof ChartArtifact) { facets.add(new EmptyFacet()); return null; @@ -77,15 +72,11 @@ /** * Compute result or returned object from cache, create facets. - * @param old Object that was cached. + * + * @param old + * Object that was cached. */ - private Object compute( - final SINFOArtifact sinfo, - final CallContext context, - final String hash, - final List<Facet> facets, - final Object old - ) { + private Object compute(final SINFOArtifact sinfo, final CallContext context, final String hash, final List<Facet> facets, final Object old) { final CalculationResult res; if (old instanceof CalculationResult) @@ -97,7 +88,7 @@ return res; } - final FlowDepthCalculationResults results = (FlowDepthCalculationResults) res.getData(); + final FlowDepthCalculationResults results = (FlowDepthCalculationResults) res.getData(); /* add themes for chart, for each result */ final List<FlowDepthCalculationResult> resultList = results.getResults(); @@ -106,24 +97,36 @@ final FlowDepthCalculationResult result = resultList.get(index); /* filtered (zoom dependent mean) flow depth */ - final String facetFlowDepthFilteredDescription = Resources.getMsg( context.getMeta(), I18N_FACET_FLOW_DEPTH_FILTERED_DESCRIPTION, I18N_FACET_FLOW_DEPTH_FILTERED_DESCRIPTION, result.getLabel() ); - facets.add(new FlowDepthFilterFacet( - index, - FlowDepthProcessor.FACET_FLOW_DEPTH_FILTERED, - facetFlowDepthFilteredDescription, - ComputeType.ADVANCE, - this.id, - hash - )); + final String facetFlowDepthFilteredDescription = Resources.getMsg(context.getMeta(), I18N_FACET_FLOW_DEPTH_FILTERED_DESCRIPTION, + I18N_FACET_FLOW_DEPTH_FILTERED_DESCRIPTION, result.getLabel()); + facets.add(new FlowDepthFacet(index, FlowDepthProcessor.FACET_FLOW_DEPTH_FILTERED, facetFlowDepthFilteredDescription, + SINFO_CHART_FLOW_DEPTH_YAXIS_LABEL, ComputeType.ADVANCE, this.id, hash)); - // FIXME: add other themes + if (results.isUseTkh()) { + /* filtered (zoom dependent mean) flow depth including tkh */ + final String facetFlowDepthTkhFilteredDescription = Resources.getMsg(context.getMeta(), I18N_FACET_FLOW_DEPTH_TKH_FILTERED_DESCRIPTION, + I18N_FACET_FLOW_DEPTH_TKH_FILTERED_DESCRIPTION, result.getLabel()); + facets.add(new FlowDepthFacet(index, FlowDepthProcessor.FACET_FLOW_DEPTH_TKH_FILTERED, facetFlowDepthTkhFilteredDescription, + SINFO_CHART_FLOW_DEPTH_YAXIS_LABEL, ComputeType.ADVANCE, this.id, hash)); + + // FIXME: add other themes + // - Streckenfavoriten + + // FIXME: + // - Gemittelte Linie der Fließtiefe mitsamt TKH + // - Transportkörperhöhen (oben/unten/schraffur) + final String facetTkhDescription = Resources.getMsg(context.getMeta(), I18N_FACET_TKH_DESCRIPTION, I18N_FACET_TKH_DESCRIPTION, + result.getLabel()); + facets.add(new FlowDepthFacet(index, TkhProcessor.FACET_TKH, facetTkhDescription, SINFO_CHART_TKX_YAXIS_LABEL, ComputeType.ADVANCE, this.id, + hash)); + } + + // FIXME: Datenkorbkonfiguration } - if (!resultList.isEmpty() ) { - final Facet csv = new DataFacet( - FacetTypes.CSV, "CSV data", ComputeType.ADVANCE, hash, this.id); - final Facet pdf = new DataFacet( - FacetTypes.PDF, "PDF data", ComputeType.ADVANCE, hash, this.id); + if (!resultList.isEmpty()) { + final Facet csv = new DataFacet(FacetTypes.CSV, "CSV data", ComputeType.ADVANCE, hash, this.id); + final Facet pdf = new DataFacet(FacetTypes.PDF, "PDF data", ComputeType.ADVANCE, hash, this.id); facets.add(csv); facets.add(pdf);