Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffMorphSubFacet.java @ 7985:10debf4b82be facet-metadata
Split bed differences facet into data specific facets.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Tue, 01 Jul 2014 15:09:56 +0200 |
parents | |
children | 5acaf44062b5 |
comparison
equal
deleted
inserted
replaced
7984:cf674b03901a | 7985:10debf4b82be |
---|---|
1 package org.dive4elements.river.artifacts.model.minfo; | |
2 | |
3 import org.apache.log4j.Logger; | |
4 import org.dive4elements.artifactdatabase.state.Facet; | |
5 import org.dive4elements.artifacts.Artifact; | |
6 import org.dive4elements.artifacts.CallContext; | |
7 import org.dive4elements.river.artifacts.D4EArtifact; | |
8 import org.dive4elements.river.artifacts.model.CalculationResult; | |
9 import org.dive4elements.river.artifacts.model.DataFacet; | |
10 import org.dive4elements.river.artifacts.model.FacetTypes; | |
11 import org.dive4elements.river.artifacts.states.DefaultState.ComputeType; | |
12 | |
13 | |
14 public class BedDiffMorphSubFacet | |
15 extends DataFacet | |
16 implements FacetTypes | |
17 { | |
18 private static Logger logger = Logger.getLogger(BedDiffMorphSubFacet.class); | |
19 | |
20 public BedDiffMorphSubFacet() { | |
21 } | |
22 | |
23 public BedDiffMorphSubFacet(int idx, String name, String description, | |
24 ComputeType type, String stateId, String hash) { | |
25 super(idx, name, description, type, hash, stateId); | |
26 this.metaData.put("X", "chart.longitudinal.section.xaxis.label"); | |
27 this.metaData.put("Y", "chart.beddifference.axis.label.y"); | |
28 } | |
29 | |
30 public Object getData(Artifact artifact, CallContext context) { | |
31 logger.debug("Get data for bed density at index: " + index); | |
32 | |
33 D4EArtifact flys = (D4EArtifact) artifact; | |
34 | |
35 CalculationResult res = (CalculationResult) flys.compute(context, hash, | |
36 stateId, type, false); | |
37 | |
38 BedDiffYearResult[] resultData = | |
39 (BedDiffYearResult[]) res.getData(); // TODO CAST TO SPECIFIC CLASS | |
40 | |
41 if (resultData != null && resultData.length > index) { | |
42 BedDiffYearResult data = resultData[index]; | |
43 return data.getMorphWidth2Data(); | |
44 } | |
45 return null; | |
46 } | |
47 | |
48 /** Copy deeply. */ | |
49 @Override | |
50 public Facet deepCopy() { | |
51 BedDiffMorphSubFacet copy = new BedDiffMorphSubFacet(); | |
52 copy.set(this); | |
53 copy.type = type; | |
54 copy.hash = hash; | |
55 copy.stateId = stateId; | |
56 return copy; | |
57 } | |
58 } |