diff artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhstate/TkhState.java @ 8916:5d5d0051723f

Working on outputmodes of tkh calculation
author gernotbelger
date Wed, 28 Feb 2018 18:55:39 +0100
parents d9dbf0b74bc2
children 9c02733a1b3c
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhstate/TkhState.java	Wed Feb 28 17:27:15 2018 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhstate/TkhState.java	Wed Feb 28 18:55:39 2018 +0100
@@ -14,9 +14,12 @@
 import org.dive4elements.artifacts.CallContext;
 import org.dive4elements.river.artifacts.ChartArtifact;
 import org.dive4elements.river.artifacts.D4EArtifact;
+import org.dive4elements.river.artifacts.model.Calculation;
 import org.dive4elements.river.artifacts.model.CalculationResult;
 import org.dive4elements.river.artifacts.model.EmptyFacet;
+import org.dive4elements.river.artifacts.model.ReportFacet;
 import org.dive4elements.river.artifacts.sinfo.SINFOArtifact;
+import org.dive4elements.river.artifacts.sinfo.common.TkhProcessor;
 import org.dive4elements.river.artifacts.states.DefaultState;
 
 /** State in which a waterlevel has been calculated. */
@@ -27,15 +30,6 @@
 
     private static final long serialVersionUID = 1L;
 
-    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.
@@ -78,47 +72,17 @@
         if (facets == null)
             return res;
 
-        // final FlowDepthCalculationResults results = (FlowDepthCalculationResults) res.getData();
-        //
-        // /* add themes for chart, for each result */
-        // final List<FlowDepthCalculationResult> resultList = results.getResults();
-        // for (int index = 0; index < resultList.size(); index++) {
-        //
-        // 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 FlowDepthFacet(index, FlowDepthProcessor.FACET_FLOW_DEPTH_FILTERED, facetFlowDepthFilteredDescription,
-        // SINFO_CHART_FLOW_DEPTH_YAXIS_LABEL, ComputeType.ADVANCE, this.id, hash));
-        //
-        // 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
-        // }
-        //
+        final TkhCalculationResults results = (TkhCalculationResults) res.getData();
+
+        /* add themes for chart, for each result */
+        final List<TkhCalculationResult> resultList = results.getResults();
+        for (int index = 0; index < resultList.size(); index++) {
+
+            final TkhCalculationResult result = resultList.get(index);
+
+            facets.add(TkhProcessor.createTkhFacet(context, hash, this.id, result, index));
+        }
+
         // 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);
@@ -126,15 +90,13 @@
         // facets.add(csv);
         // facets.add(pdf);
         // }
-        //
-        // final Calculation report = res.getReport();
-        //
-        // if (report.hasProblems()) {
-        // facets.add(new ReportFacet(ComputeType.ADVANCE, hash, this.id));
-        // }
-        //
-        // return res;
-        return null;
+
+        final Calculation report = res.getReport();
+
+        if (report.hasProblems())
+            facets.add(new ReportFacet(ComputeType.ADVANCE, hash, this.id));
+
+        return res;
     }
 
     private CalculationResult doCompute(final SINFOArtifact sinfo, final CallContext context, final Object old) {

http://dive4elements.wald.intevation.org