comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WaterlevelFacet.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 5f3726f31f00
children 1de62ac261f7
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 Waterlevel (WQKms).
16 */
17 public class WaterlevelFacet extends DataFacet {
18
19 private static Logger logger = Logger.getLogger(WaterlevelFacet.class);
20
21 public WaterlevelFacet(int index, String name, String description) {
22 super(index, name, description, ComputeType.ADVANCE, null, null);
23 }
24
25 public WaterlevelFacet(
26 int index,
27 String name,
28 String description,
29 ComputeType type,
30 String stateID,
31 String hash
32
33 ) {
34 super(index, name, description, type, hash, stateID);
35 }
36
37 public WaterlevelFacet() {
38 }
39
40
41 /**
42 * Get waterlevel data.
43 * @return a WQKms at given index.
44 */
45 public Object getData(Artifact artifact, CallContext context) {
46
47 if (logger.isDebugEnabled()) {
48 logger.debug("Get data for waterlevels at index: " + index +
49 " /stateId: " + stateId);
50 }
51
52 FLYSArtifact winfo = (FLYSArtifact)artifact;
53
54 CalculationResult res = (CalculationResult)
55 winfo.compute(context, hash, stateId, type, false);
56
57 WQKms [] wqkms = (WQKms [])res.getData();
58
59 return wqkms[index];
60 }
61
62
63 /** Copy deeply. */
64 @Override
65 public Facet deepCopy() {
66 WaterlevelFacet copy = new WaterlevelFacet();
67 copy.set(this);
68 copy.type = type;
69 copy.hash = hash;
70 copy.stateId = stateId;
71 return copy;
72 }
73 }
74 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org