annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/HYKFacet.java @ 2184:fc86fcfe503e

Only add one legend item for manual point themes. flys-artifacts/trunk@3788 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Fri, 27 Jan 2012 11:19:16 +0000
parents 0fa37d4de13d
children 5642a83420f2
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
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
30 /** Trivial constructor, set (maybe localized) description. */
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
31 public HYKFacet(int idx, String description) {
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
32 super(idx, HYK, description, ComputeType.FEED, null, null);
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
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
36 /**
2150
0fa37d4de13d Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2133
diff changeset
37 * Set km from cross section- master to HYKArtifact, then fire up
0fa37d4de13d Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2133
diff changeset
38 * computation.
0fa37d4de13d Cosmetics.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2133
diff changeset
39 *
2133
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
40 * @param art artifact to get data from.
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
41 * @param context ignored
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
42 */
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
43 public Object getData(Artifact art, CallContext context) {
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
44 logger.debug("HYKFacet.getData");
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
45
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
46 String dataKey = CrossSectionFacet.BLACKBOARD_CS_MASTER_DATA;
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
47
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
48 List<DataProvider> providers = context.getDataProvider(dataKey);
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
49 if (providers.size() < 1) {
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
50 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
51 return null;
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
52 }
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
53
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
54 FastCrossSectionLine crossSection = (FastCrossSectionLine) providers.get(0)
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
55 .provideData(dataKey, null, context);
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
56
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
57 double km = crossSection.getKm();
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
58 logger.debug("HYKFacet.getData: Master Cross Section is at km: " + km);
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
59
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
60 // Set this km at hyk artifact to be evaluated.
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
61 HYKArtifact hyk = (HYKArtifact) art;
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
62 hyk.setKm(km);
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
63
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
64 return hyk.compute(context, hash, stateId, type, false);
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
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
68 /** Do a deep copy. */
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
69 @Override
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
70 public Facet deepCopy() {
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
71 HYKFacet copy = new HYKFacet(this.index, this.description);
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
72 copy.set(this);
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
73 return copy;
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 }
767ce9d1991f Added HYKFacet.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
76 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org