comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/SedimentLoadFacet.java @ 4372:19772b414d46

New facet and result set for sediment load. * Added new facet and updated sediment load config and facet types. * Added new result set for sediment load.
author Raimund Renkert <rrenkert@intevation.de>
date Fri, 02 Nov 2012 14:53:51 +0100
parents
children 696d710470f5
comparison
equal deleted inserted replaced
4371:26afee1b8959 4372:19772b414d46
1 package de.intevation.flys.artifacts.model.minfo;
2
3 import org.apache.log4j.Logger;
4
5 import de.intevation.artifactdatabase.state.Facet;
6 import de.intevation.artifacts.Artifact;
7 import de.intevation.artifacts.CallContext;
8 import de.intevation.flys.artifacts.FLYSArtifact;
9 import de.intevation.flys.artifacts.model.CalculationResult;
10 import de.intevation.flys.artifacts.model.DataFacet;
11 import de.intevation.flys.artifacts.states.DefaultState.ComputeType;
12
13
14 public class SedimentLoadFacet
15 extends DataFacet
16 {
17 private static Logger logger = Logger.getLogger(SedimentLoadFacet.class);
18
19 public SedimentLoadFacet() {
20 }
21
22 public SedimentLoadFacet(int idx, String name, String description,
23 ComputeType type, String stateId, String hash) {
24 super(idx, name, description, type, hash, stateId);
25 }
26
27 public Object getData(Artifact artifact, CallContext context) {
28 logger.debug("Get data for sediment load at index: " + index);
29
30 FLYSArtifact flys = (FLYSArtifact) artifact;
31
32 CalculationResult res = (CalculationResult) flys.compute(context, hash,
33 stateId, type, false);
34
35 Object[] data =
36 (SedimentLoadResult[]) res.getData(); // TODO CAST TO SPECIFIC CLASS
37
38 return data != null && data.length > index ? data[index] : null;
39 }
40
41 /** Copy deeply. */
42 @Override
43 public Facet deepCopy() {
44 SedimentLoadFacet copy = new SedimentLoadFacet();
45 copy.set(this);
46 copy.type = type;
47 copy.hash = hash;
48 copy.stateId = stateId;
49 return copy;
50 }
51 }
52 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org