comparison artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/SInfoResultFacet.java @ 9215:0fc9c82e744e

work on collison, flood_duration
author gernotbelger
date Tue, 03 Jul 2018 17:00:48 +0200
parents 3dae6b78e1da
children
comparison
equal deleted inserted replaced
9214:091fd9676496 9215:0fc9c82e744e
20 import org.dive4elements.river.artifacts.states.DefaultState.ComputeType; 20 import org.dive4elements.river.artifacts.states.DefaultState.ComputeType;
21 21
22 /** 22 /**
23 * Facet of one of the S-Info curves. 23 * Facet of one of the S-Info curves.
24 */ 24 */
25 public final class SInfoResultFacet extends DataFacet { 25 public class SInfoResultFacet extends DataFacet {
26 26
27 private static final long serialVersionUID = 1L; 27 private static final long serialVersionUID = 1L;
28 28
29 private static Logger log = Logger.getLogger(SInfoResultFacet.class); 29 private static Logger log = Logger.getLogger(SInfoResultFacet.class);
30
31 private int dataIndex;
32 30
33 private int resultIndex; 31 private int resultIndex;
34 32
35 public SInfoResultFacet() { 33 public SInfoResultFacet() {
36 // required for clone operation deepCopy() 34 // required for clone operation deepCopy()
37 } 35 }
38 36
39 public SInfoResultFacet(final int resultIndex, final String name, final String description, final String yAxisLabelKey, final ComputeType type, 37 public SInfoResultFacet(final int resultIndex, final String name, final String description, final String yAxisLabelKey, final ComputeType type,
40 final String stateId, final String hash) { 38 final String stateId, final String hash) {
41 // REMARK: 39 this(resultIndex, resultIndex, name, description, yAxisLabelKey, type, stateId, hash);
42 this(resultIndex, resultIndex, -1, name, description, yAxisLabelKey, type, stateId, hash);
43 } 40 }
44 41
45 public SInfoResultFacet(final int resultIndex, final int dataIndex, final String name, final String description, final String yAxisLabelKey, 42 public SInfoResultFacet(final int facetIndex, final int resultIndex, final String name, final String description, final String yAxisLabelKey,
46 final ComputeType type, final String stateId, final String hash) { 43 final ComputeType type, final String stateId, final String hash) {
47 // REMARK: in some cases, we have several 44 // REMARK: in some cases, we have several data-lines for the same result (which normally determines the facet index) and
48 this(resultIndex, resultIndex, dataIndex, name, description, yAxisLabelKey, type, stateId, hash); 45 // facet name. But index and name are used by the client side as unique keys for the chart themes...
49 } 46 // So we might have different facet index and result index.
50
51 public SInfoResultFacet(final int facetIndex, final int resultIndex, final int dataIndex, final String name, final String description,
52 // REMARK: in some cases, we have several data-lines for the same result (which normally determines the facet index) and
53 // facet name. But index and name are used by the client side as unique keys for the chart themes...
54 // So we might have different facet index and result index.
55 final String yAxisLabelKey, final ComputeType type, final String stateId, final String hash) {
56 super(facetIndex, name, description, type, hash, stateId); 47 super(facetIndex, name, description, type, hash, stateId);
57 this.resultIndex = resultIndex; 48 this.resultIndex = resultIndex;
58 this.dataIndex = dataIndex; 49
59 this.metaData.put("X", "sinfo.chart.km.xaxis.label"); 50 this.metaData.put("X", "sinfo.chart.km.xaxis.label");
60 this.metaData.put("Y", yAxisLabelKey); 51 this.metaData.put("Y", yAxisLabelKey);
61 } 52 }
62 53
63 public int getDataIndex() {
64 return this.dataIndex;
65 }
66
67 @Override 54 @Override
68 public Object getData(final Artifact artifact, final CallContext context) { 55 public final Object getData(final Artifact artifact, final CallContext context) {
69 log.debug("Get data for result at index: " + this.index); 56 log.debug("Get data for result at index: " + this.resultIndex);
70 57
71 final D4EArtifact flys = (D4EArtifact) artifact; 58 final D4EArtifact flys = (D4EArtifact) artifact;
72 59
73 final CalculationResult res = (CalculationResult) flys.compute(context, this.hash, this.stateId, this.type, false); 60 final CalculationResult res = (CalculationResult) flys.compute(context, this.hash, this.stateId, this.type, false);
74 61

http://dive4elements.wald.intevation.org