Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhstate/TkhState.java @ 8940:82998242ba84
Preparing for additional outputs of SINFO-Tkh
author | gernotbelger |
---|---|
date | Tue, 06 Mar 2018 18:51:18 +0100 |
parents | 9c02733a1b3c |
children | a9950a3a71e5 |
comparison
equal
deleted
inserted
replaced
8939:2970368ae1e3 | 8940:82998242ba84 |
---|---|
9 package org.dive4elements.river.artifacts.sinfo.tkhstate; | 9 package org.dive4elements.river.artifacts.sinfo.tkhstate; |
10 | 10 |
11 import java.util.List; | 11 import java.util.List; |
12 | 12 |
13 import org.dive4elements.artifactdatabase.state.Facet; | 13 import org.dive4elements.artifactdatabase.state.Facet; |
14 import org.dive4elements.artifactdatabase.state.FacetActivity; | |
15 import org.dive4elements.artifacts.Artifact; | |
14 import org.dive4elements.artifacts.CallContext; | 16 import org.dive4elements.artifacts.CallContext; |
15 import org.dive4elements.river.artifacts.ChartArtifact; | 17 import org.dive4elements.river.artifacts.ChartArtifact; |
16 import org.dive4elements.river.artifacts.D4EArtifact; | 18 import org.dive4elements.river.artifacts.D4EArtifact; |
17 import org.dive4elements.river.artifacts.model.Calculation; | 19 import org.dive4elements.river.artifacts.model.Calculation; |
18 import org.dive4elements.river.artifacts.model.CalculationResult; | 20 import org.dive4elements.river.artifacts.model.CalculationResult; |
19 import org.dive4elements.river.artifacts.model.DataFacet; | 21 import org.dive4elements.river.artifacts.model.DataFacet; |
20 import org.dive4elements.river.artifacts.model.EmptyFacet; | 22 import org.dive4elements.river.artifacts.model.EmptyFacet; |
21 import org.dive4elements.river.artifacts.model.FacetTypes; | 23 import org.dive4elements.river.artifacts.model.FacetTypes; |
22 import org.dive4elements.river.artifacts.model.ReportFacet; | 24 import org.dive4elements.river.artifacts.model.ReportFacet; |
23 import org.dive4elements.river.artifacts.sinfo.SINFOArtifact; | 25 import org.dive4elements.river.artifacts.sinfo.SINFOArtifact; |
26 import org.dive4elements.river.artifacts.sinfo.common.FlowDepthProcessor; | |
24 import org.dive4elements.river.artifacts.sinfo.common.TkhProcessor; | 27 import org.dive4elements.river.artifacts.sinfo.common.TkhProcessor; |
25 import org.dive4elements.river.artifacts.states.DefaultState; | 28 import org.dive4elements.river.artifacts.states.DefaultState; |
26 | 29 |
27 /** State in which a waterlevel has been calculated. */ | 30 /** State in which a waterlevel has been calculated. */ |
28 public class TkhState extends DefaultState { | 31 public class TkhState extends DefaultState { |
29 | 32 |
30 /// ** The log that is used in this state. */ | 33 /// ** The log that is used in this state. */ |
31 // private static Logger log = Logger.getLogger(FlowDepthState.class); | 34 // private static Logger log = Logger.getLogger(FlowDepthState.class); |
32 | 35 |
33 private static final long serialVersionUID = 1L; | 36 private static final long serialVersionUID = 1L; |
37 | |
38 static { | |
39 // Active/deactivate facets. | |
40 // BEWARE: we can only define one activity for "sinfo", so this is not the right place.... | |
41 FacetActivity.Registry.getInstance().register("sinfo", new FacetActivity() { | |
42 @Override | |
43 public Boolean isInitialActive(final Artifact artifact, final Facet facet, final String output) { | |
44 | |
45 /* only */ | |
46 if ("sinfo_tkk".equals(output)) { | |
47 final String name = facet.getName(); | |
48 if (FlowDepthProcessor.FACET_FLOW_DEPTH_FILTERED.equals(name)) | |
49 return Boolean.FALSE; | |
50 } | |
51 | |
52 return null; | |
53 } | |
54 }); | |
55 } | |
34 | 56 |
35 /** | 57 /** |
36 * From this state can only be continued trivially. | 58 * From this state can only be continued trivially. |
37 */ | 59 */ |
38 @Override | 60 @Override |
80 for (int index = 0; index < resultList.size(); index++) { | 102 for (int index = 0; index < resultList.size(); index++) { |
81 | 103 |
82 final TkhCalculationResult result = resultList.get(index); | 104 final TkhCalculationResult result = resultList.get(index); |
83 | 105 |
84 facets.add(TkhProcessor.createTkhFacet(context, hash, this.id, result, index)); | 106 facets.add(TkhProcessor.createTkhFacet(context, hash, this.id, result, index)); |
107 | |
108 // FIXME: should only be optionally visible | |
109 facets.add(FlowDepthProcessor.createFlowDepthTkhFacet(context, hash, this.id, result, index)); | |
85 } | 110 } |
86 | 111 |
87 if (!resultList.isEmpty()) { | 112 if (!resultList.isEmpty()) { |
88 facets.add(new DataFacet(FacetTypes.CSV, "CSV data", ComputeType.ADVANCE, hash, this.id)); | 113 facets.add(new DataFacet(FacetTypes.CSV, "CSV data", ComputeType.ADVANCE, hash, this.id)); |
89 facets.add(new DataFacet(FacetTypes.PDF, "PDF data", ComputeType.ADVANCE, hash, this.id)); | 114 facets.add(new DataFacet(FacetTypes.PDF, "PDF data", ComputeType.ADVANCE, hash, this.id)); |