Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/collision/CollisionState.java @ 9157:f9bb5d0a6ff3
Added the S-Info collision calculation and chart output
author | mschaefer |
---|---|
date | Tue, 19 Jun 2018 14:19:32 +0200 |
parents | 23945061daec |
children | a4121ec450d6 |
comparison
equal
deleted
inserted
replaced
9156:568961ff709a | 9157:f9bb5d0a6ff3 |
---|---|
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.common.AbstractCalculationExportableResult; | 17 import org.dive4elements.river.artifacts.common.AbstractCalculationExportableResult; |
18 import org.dive4elements.river.artifacts.model.Calculation; | |
18 import org.dive4elements.river.artifacts.model.CalculationResult; | 19 import org.dive4elements.river.artifacts.model.CalculationResult; |
19 import org.dive4elements.river.artifacts.model.DataFacet; | 20 import org.dive4elements.river.artifacts.model.DataFacet; |
20 import org.dive4elements.river.artifacts.model.EmptyFacet; | 21 import org.dive4elements.river.artifacts.model.EmptyFacet; |
21 import org.dive4elements.river.artifacts.model.FacetTypes; | 22 import org.dive4elements.river.artifacts.model.FacetTypes; |
23 import org.dive4elements.river.artifacts.model.ReportFacet; | |
22 import org.dive4elements.river.artifacts.sinfo.SINFOArtifact; | 24 import org.dive4elements.river.artifacts.sinfo.SINFOArtifact; |
25 import org.dive4elements.river.artifacts.sinfo.common.CollisionCalcProcessor; | |
23 import org.dive4elements.river.artifacts.states.DefaultState; | 26 import org.dive4elements.river.artifacts.states.DefaultState; |
24 | 27 |
25 /** State in which a waterlevel has been calculated. */ | 28 /** |
29 * State in which a collision count has been calculated. | |
30 */ | |
26 public class CollisionState extends DefaultState { | 31 public class CollisionState extends DefaultState { |
27 | 32 |
28 /// ** The log that is used in this state. */ | 33 /// ** The log that is used in this state. */ |
29 // private static Logger log = Logger.getLogger(FlowDepthState.class); | 34 // private static Logger log = Logger.getLogger(CollisionState.class); |
30 | 35 |
31 private static final long serialVersionUID = 1L; | 36 private static final long serialVersionUID = 1L; |
32 | 37 |
33 /** | 38 /** |
34 * From this state can only be continued trivially. | 39 * From this state can only be continued trivially. |
42 public Object computeFeed(final D4EArtifact artifact, final String hash, final CallContext context, final List<Facet> facets, final Object old) { | 47 public Object computeFeed(final D4EArtifact artifact, final String hash, final CallContext context, final List<Facet> facets, final Object old) { |
43 if (artifact instanceof ChartArtifact) { | 48 if (artifact instanceof ChartArtifact) { |
44 facets.add(new EmptyFacet()); | 49 facets.add(new EmptyFacet()); |
45 return null; | 50 return null; |
46 } | 51 } |
47 | |
48 return compute((SINFOArtifact) artifact, context, hash, facets, old); | 52 return compute((SINFOArtifact) artifact, context, hash, facets, old); |
49 } | 53 } |
50 | 54 |
51 @Override | 55 @Override |
52 public Object computeAdvance(final D4EArtifact artifact, final String hash, final CallContext context, final List<Facet> facets, final Object old) { | 56 public Object computeAdvance(final D4EArtifact artifact, final String hash, final CallContext context, final List<Facet> facets, final Object old) { |
69 | 73 |
70 if (facets == null) | 74 if (facets == null) |
71 return res; | 75 return res; |
72 // | 76 // |
73 final CollisionCalculationResults results = (CollisionCalculationResults) res.getData(); | 77 final CollisionCalculationResults results = (CollisionCalculationResults) res.getData(); |
74 // | |
75 // /* add themes for chart, for each result */ | |
76 // final List<CollisionCalcOverviewResult> resultList = results.getResults(); | |
77 // for (int index = 0; index < resultList.size(); index++) { | |
78 // | |
79 final AbstractCalculationExportableResult<CollisionCalculationResults> result = results.getResults().get(0); | |
80 | 78 |
81 // | 79 /* add themes for chart, for each result */ |
82 // /* filtered (zoom dependent mean) flow depth */ | 80 final List<AbstractCalculationExportableResult<CollisionCalculationResults>> resultList = results.getResults(); |
83 // facets.add(FlowDepthProcessor.createFlowDepthFilteredFacet(context, hash, this.id, result, index)); | 81 for (int index = 0; index < resultList.size(); index++) { |
84 // facets.add(FlowDepthProcessor.createFlowDepthRawFacet(context, hash, this.id, result, index)); | 82 if (resultList.get(index) instanceof CollisionCalcOverviewResult) { |
85 // | 83 final CollisionCalcOverviewResult result = (CollisionCalcOverviewResult) resultList.get(index); |
86 // if (results.isUseTkh()) { | 84 facets.add(CollisionCalcProcessor.createFacet(context, hash, this.id, result, index)); |
87 // /* filtered (zoom dependent mean) flow depth including tkh */ | 85 } |
88 // facets.add(FlowDepthProcessor.createFlowDepthTkhFilteredFacet(context, hash, this.id, result, index)); | 86 } |
89 // facets.add(FlowDepthProcessor.createFlowDepthTkhRawFacet(context, hash, this.id, result, index)); | |
90 // | |
91 // facets.add(TkhProcessor.createTkhFacet(context, hash, this.id, result, index)); | |
92 // } | |
93 // } | |
94 | 87 |
95 if (!result.isEmpty()) { | 88 if (!resultList.isEmpty()) { |
96 final Facet csv = new DataFacet(FacetTypes.CSV, "CSV data", ComputeType.ADVANCE, hash, this.id); | 89 final Facet csv = new DataFacet(FacetTypes.CSV, "CSV data", ComputeType.ADVANCE, hash, this.id); |
97 final Facet pdf = new DataFacet(FacetTypes.PDF, "PDF data", ComputeType.ADVANCE, hash, this.id); | 90 final Facet pdf = new DataFacet(FacetTypes.PDF, "PDF data", ComputeType.ADVANCE, hash, this.id); |
98 | 91 |
99 facets.add(csv); | 92 facets.add(csv); |
100 facets.add(pdf); | 93 facets.add(pdf); |
101 } | 94 } |
102 // | 95 |
103 // final Calculation report = res.getReport(); | 96 final Calculation report = res.getReport(); |
104 // | 97 |
105 // if (report.hasProblems()) { | 98 if (report.hasProblems()) { |
106 // facets.add(new ReportFacet(ComputeType.ADVANCE, hash, this.id)); | 99 facets.add(new ReportFacet(ComputeType.ADVANCE, hash, this.id)); |
107 // } | 100 } |
108 | 101 |
109 return res; | 102 return res; |
110 } | 103 } |
111 | 104 |
112 private CalculationResult doCompute(final SINFOArtifact sinfo, final CallContext context, final Object old) { | 105 private CalculationResult doCompute(final SINFOArtifact sinfo, final CallContext context, final Object old) { |