comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FlowVelocityFacet.java @ 3318:dbe2f85bf160

merged flys-artifacts/2.8
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 28 Sep 2012 12:14:35 +0200
parents d8444fcb4e44
children 587b0e82924a
comparison
equal deleted inserted replaced
2987:98c7a46ec5ae 3318:dbe2f85bf160
1 package de.intevation.flys.artifacts.model;
2
3 import de.intevation.artifactdatabase.state.Facet;
4
5 import de.intevation.artifacts.Artifact;
6 import de.intevation.artifacts.CallContext;
7
8 import de.intevation.flys.artifacts.FLYSArtifact;
9
10 import de.intevation.flys.artifacts.states.DefaultState.ComputeType;
11
12 import org.apache.log4j.Logger;
13
14 /**
15 * Facet of a FlowVelocity curve.
16 */
17 public class FlowVelocityFacet extends DataFacet {
18
19 private static Logger logger = Logger.getLogger(FlowVelocityFacet.class);
20
21
22 public FlowVelocityFacet() {
23 // required for clone operation deepCopy()
24 }
25
26
27 public FlowVelocityFacet(
28 int idx,
29 String name,
30 String description,
31 ComputeType type,
32 String stateId,
33 String hash
34 ) {
35 super(idx, name, description, type, hash, stateId);
36 }
37
38
39 public Object getData(Artifact artifact, CallContext context) {
40 logger.debug("Get data for flow velocity at index: " + index);
41
42 FLYSArtifact flys = (FLYSArtifact) artifact;
43
44 CalculationResult res = (CalculationResult)
45 flys.compute(context, hash, stateId, type, false);
46
47 FlowVelocityData[] data = (FlowVelocityData[]) res.getData();
48
49 return data[index];
50 }
51
52
53 /** Copy deeply. */
54 @Override
55 public Facet deepCopy() {
56 FlowVelocityFacet copy = new FlowVelocityFacet();
57 copy.set(this);
58 copy.type = type;
59 copy.hash = hash;
60 copy.stateId = stateId;
61 return copy;
62 }
63 }
64 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org