comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FlowVelocityFacet.java @ 2706:d8444fcb4e44

Create chart facets for flow velocity calculation and a chart generator for this. flys-artifacts/trunk@4424 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 16 May 2012 12:39:13 +0000
parents
children 587b0e82924a
comparison
equal deleted inserted replaced
2705:71f072d8b3d8 2706:d8444fcb4e44
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