annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/HYKFacet.java @ 3600:b5b3e73143a6

Removed debug outputs in exporter. flys-artifacts/trunk@5225 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Raimund Renkert <raimund.renkert@intevation.de>
date Fri, 17 Aug 2012 11:38:18 +0000
parents cd5eb8f5f6f1
children e1fd2dfdcb80
rev   line source
2133
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.artifacts.model;
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
2
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
3 import java.util.List;
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
4
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
5 import org.apache.log4j.Logger;
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
6
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
7 import de.intevation.artifacts.Artifact;
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
8 import de.intevation.artifacts.CallContext;
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
9 import de.intevation.artifacts.DataProvider;
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
10
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
11 import de.intevation.artifactdatabase.state.Facet;
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
12
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
13 import de.intevation.flys.artifacts.HYKArtifact;
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
14
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
15 import de.intevation.flys.artifacts.states.DefaultState.ComputeType;
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
16 import de.intevation.flys.model.FastCrossSectionLine;
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
17
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
18
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
19 /**
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
20 * Trival Facet for HYKs
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
21 */
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
22 public class HYKFacet
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
23 extends DataFacet
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
24 implements FacetTypes {
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
25
2150
0fa37d4de13d Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2133
diff changeset
26 /** House logger. */
2133
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
27 private static Logger logger = Logger.getLogger(HYKFacet.class);
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
28
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
29 /** Trivial constructor, set (maybe localized) description. */
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
30 public HYKFacet(int idx, String description) {
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
31 super(idx, HYK, description, ComputeType.FEED, null, null);
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
32 }
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
33
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
34
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
35 /**
2150
0fa37d4de13d Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2133
diff changeset
36 * Set km from cross section- master to HYKArtifact, then fire up
0fa37d4de13d Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2133
diff changeset
37 * computation.
0fa37d4de13d Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2133
diff changeset
38 *
2133
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
39 * @param art artifact to get data from.
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
40 * @param context ignored
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
41 */
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
42 public Object getData(Artifact art, CallContext context) {
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
43 logger.debug("HYKFacet.getData");
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
44
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
45 String dataKey = CrossSectionFacet.BLACKBOARD_CS_MASTER_DATA;
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
46
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
47 List<DataProvider> providers = context.getDataProvider(dataKey);
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
48 if (providers.size() < 1) {
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
49 logger.warn("Could not find Cross-Section data provider to get master cs km.");
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
50 return null;
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
51 }
3076
5642a83420f2 FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2150
diff changeset
52
2133
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
53 FastCrossSectionLine crossSection = (FastCrossSectionLine) providers.get(0)
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
54 .provideData(dataKey, null, context);
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
55
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
56 double km = crossSection.getKm();
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
57 logger.debug("HYKFacet.getData: Master Cross Section is at km: " + km);
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
58
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
59 // Set this km at hyk artifact to be evaluated.
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
60 HYKArtifact hyk = (HYKArtifact) art;
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
61 hyk.setKm(km);
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
62
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
63 return hyk.compute(context, hash, stateId, type, false);
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
64 }
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
65
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
66
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
67 /** Do a deep copy. */
3076
5642a83420f2 FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2150
diff changeset
68 @Override
2133
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
69 public Facet deepCopy() {
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
70 HYKFacet copy = new HYKFacet(this.index, this.description);
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
71 copy.set(this);
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
72 return copy;
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
73 }
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
74 }
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
75 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org