Mercurial > dive4elements > river
comparison 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 |
comparison
equal
deleted
inserted
replaced
8915:d9dbf0b74bc2 | 8916:5d5d0051723f |
---|---|
12 | 12 |
13 import org.dive4elements.artifactdatabase.state.Facet; | 13 import org.dive4elements.artifactdatabase.state.Facet; |
14 import org.dive4elements.artifacts.CallContext; | 14 import org.dive4elements.artifacts.CallContext; |
15 import org.dive4elements.river.artifacts.ChartArtifact; | 15 import org.dive4elements.river.artifacts.ChartArtifact; |
16 import org.dive4elements.river.artifacts.D4EArtifact; | 16 import org.dive4elements.river.artifacts.D4EArtifact; |
17 import org.dive4elements.river.artifacts.model.Calculation; | |
17 import org.dive4elements.river.artifacts.model.CalculationResult; | 18 import org.dive4elements.river.artifacts.model.CalculationResult; |
18 import org.dive4elements.river.artifacts.model.EmptyFacet; | 19 import org.dive4elements.river.artifacts.model.EmptyFacet; |
20 import org.dive4elements.river.artifacts.model.ReportFacet; | |
19 import org.dive4elements.river.artifacts.sinfo.SINFOArtifact; | 21 import org.dive4elements.river.artifacts.sinfo.SINFOArtifact; |
22 import org.dive4elements.river.artifacts.sinfo.common.TkhProcessor; | |
20 import org.dive4elements.river.artifacts.states.DefaultState; | 23 import org.dive4elements.river.artifacts.states.DefaultState; |
21 | 24 |
22 /** State in which a waterlevel has been calculated. */ | 25 /** State in which a waterlevel has been calculated. */ |
23 public class TkhState extends DefaultState { | 26 public class TkhState extends DefaultState { |
24 | 27 |
25 /// ** The log that is used in this state. */ | 28 /// ** The log that is used in this state. */ |
26 // private static Logger log = Logger.getLogger(FlowDepthState.class); | 29 // private static Logger log = Logger.getLogger(FlowDepthState.class); |
27 | 30 |
28 private static final long serialVersionUID = 1L; | 31 private static final long serialVersionUID = 1L; |
29 | 32 |
30 private static final String I18N_FACET_FLOW_DEPTH_FILTERED_DESCRIPTION = "sinfo.facet.flow_depth.filtered.description"; | |
31 | |
32 private static final String I18N_FACET_FLOW_DEPTH_TKH_FILTERED_DESCRIPTION = "sinfo.facet.flow_depth.tkh.filtered.description"; | |
33 | |
34 private static final String I18N_FACET_TKH_DESCRIPTION = "sinfo.facet.tkh.description"; | |
35 | |
36 private static final String SINFO_CHART_FLOW_DEPTH_YAXIS_LABEL = "sinfo.chart.flow_depth.yaxis.label"; | |
37 | |
38 private static final String SINFO_CHART_TKX_YAXIS_LABEL = "sinfo.chart.tkh.yaxis.label"; | |
39 | 33 |
40 /** | 34 /** |
41 * From this state can only be continued trivially. | 35 * From this state can only be continued trivially. |
42 */ | 36 */ |
43 @Override | 37 @Override |
76 final CalculationResult res = doCompute(sinfo, context, old); | 70 final CalculationResult res = doCompute(sinfo, context, old); |
77 | 71 |
78 if (facets == null) | 72 if (facets == null) |
79 return res; | 73 return res; |
80 | 74 |
81 // final FlowDepthCalculationResults results = (FlowDepthCalculationResults) res.getData(); | 75 final TkhCalculationResults results = (TkhCalculationResults) res.getData(); |
82 // | 76 |
83 // /* add themes for chart, for each result */ | 77 /* add themes for chart, for each result */ |
84 // final List<FlowDepthCalculationResult> resultList = results.getResults(); | 78 final List<TkhCalculationResult> resultList = results.getResults(); |
85 // for (int index = 0; index < resultList.size(); index++) { | 79 for (int index = 0; index < resultList.size(); index++) { |
86 // | 80 |
87 // final FlowDepthCalculationResult result = resultList.get(index); | 81 final TkhCalculationResult result = resultList.get(index); |
88 // | 82 |
89 // /* filtered (zoom dependent mean) flow depth */ | 83 facets.add(TkhProcessor.createTkhFacet(context, hash, this.id, result, index)); |
90 // final String facetFlowDepthFilteredDescription = Resources.getMsg(context.getMeta(), | 84 } |
91 // I18N_FACET_FLOW_DEPTH_FILTERED_DESCRIPTION, | 85 |
92 // I18N_FACET_FLOW_DEPTH_FILTERED_DESCRIPTION, result.getLabel()); | |
93 // facets.add(new FlowDepthFacet(index, FlowDepthProcessor.FACET_FLOW_DEPTH_FILTERED, facetFlowDepthFilteredDescription, | |
94 // SINFO_CHART_FLOW_DEPTH_YAXIS_LABEL, ComputeType.ADVANCE, this.id, hash)); | |
95 // | |
96 // if (results.isUseTkh()) { | |
97 // /* filtered (zoom dependent mean) flow depth including tkh */ | |
98 // final String facetFlowDepthTkhFilteredDescription = Resources.getMsg(context.getMeta(), | |
99 // I18N_FACET_FLOW_DEPTH_TKH_FILTERED_DESCRIPTION, | |
100 // I18N_FACET_FLOW_DEPTH_TKH_FILTERED_DESCRIPTION, result.getLabel()); | |
101 // facets.add(new FlowDepthFacet(index, FlowDepthProcessor.FACET_FLOW_DEPTH_TKH_FILTERED, | |
102 // facetFlowDepthTkhFilteredDescription, | |
103 // SINFO_CHART_FLOW_DEPTH_YAXIS_LABEL, ComputeType.ADVANCE, this.id, hash)); | |
104 // | |
105 // // FIXME: add other themes | |
106 // // - Streckenfavoriten | |
107 // | |
108 // // FIXME: | |
109 // // - Gemittelte Linie der Fließtiefe mitsamt TKH | |
110 // // - Transportkörperhöhen (oben/unten/schraffur) | |
111 // final String facetTkhDescription = Resources.getMsg(context.getMeta(), I18N_FACET_TKH_DESCRIPTION, | |
112 // I18N_FACET_TKH_DESCRIPTION, | |
113 // result.getLabel()); | |
114 // facets.add(new FlowDepthFacet(index, TkhProcessor.FACET_TKH, facetTkhDescription, SINFO_CHART_TKX_YAXIS_LABEL, | |
115 // ComputeType.ADVANCE, this.id, | |
116 // hash)); | |
117 // } | |
118 // | |
119 // // FIXME: Datenkorbkonfiguration | |
120 // } | |
121 // | |
122 // if (!resultList.isEmpty()) { | 86 // if (!resultList.isEmpty()) { |
123 // final Facet csv = new DataFacet(FacetTypes.CSV, "CSV data", ComputeType.ADVANCE, hash, this.id); | 87 // final Facet csv = new DataFacet(FacetTypes.CSV, "CSV data", ComputeType.ADVANCE, hash, this.id); |
124 // final Facet pdf = new DataFacet(FacetTypes.PDF, "PDF data", ComputeType.ADVANCE, hash, this.id); | 88 // final Facet pdf = new DataFacet(FacetTypes.PDF, "PDF data", ComputeType.ADVANCE, hash, this.id); |
125 // | 89 // |
126 // facets.add(csv); | 90 // facets.add(csv); |
127 // facets.add(pdf); | 91 // facets.add(pdf); |
128 // } | 92 // } |
129 // | 93 |
130 // final Calculation report = res.getReport(); | 94 final Calculation report = res.getReport(); |
131 // | 95 |
132 // if (report.hasProblems()) { | 96 if (report.hasProblems()) |
133 // facets.add(new ReportFacet(ComputeType.ADVANCE, hash, this.id)); | 97 facets.add(new ReportFacet(ComputeType.ADVANCE, hash, this.id)); |
134 // } | 98 |
135 // | 99 return res; |
136 // return res; | |
137 return null; | |
138 } | 100 } |
139 | 101 |
140 private CalculationResult doCompute(final SINFOArtifact sinfo, final CallContext context, final Object old) { | 102 private CalculationResult doCompute(final SINFOArtifact sinfo, final CallContext context, final Object old) { |
141 if (old instanceof CalculationResult) | 103 if (old instanceof CalculationResult) |
142 return (CalculationResult) old; | 104 return (CalculationResult) old; |