annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/CrossSectionFacet.java @ 2719:d1d35892bbdd

Adjusted fixings transitions and implemented event select state. flys-artifacts/trunk@4450 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Raimund Renkert <raimund.renkert@intevation.de>
date Mon, 21 May 2012 09:27:32 +0000
parents f008c3335a77
children 5642a83420f2
rev   line source
1116
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.artifacts.model;
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
2
1967
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
3 import java.util.ArrayList;
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
4 import java.util.List;
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
5
1116
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
6 import org.apache.log4j.Logger;
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
7
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
8 import de.intevation.artifacts.Artifact;
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
9 import de.intevation.artifacts.CallContext;
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
10
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
11 import de.intevation.artifactdatabase.state.Facet;
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
12
1967
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
13 import de.intevation.flys.artifacts.CrossSectionArtifact;
1116
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
14
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
15 import de.intevation.flys.artifacts.states.DefaultState.ComputeType;
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
16
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
17
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
18 /**
1967
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
19 * Trival Facet for Cross Sections (profiles).
1116
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
20 */
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
21 public class CrossSectionFacet
2301
bc23341bf322 Repair area over cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2002
diff changeset
22 extends BlackboardDataFacet
1116
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
23 implements FacetTypes {
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
24
1967
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
25 public static String BLACKBOARD_CS_MASTER_DATA
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
26 = "crosssection.masterprofile.data";
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
27
1116
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
28 private static Logger logger = Logger.getLogger(CrossSectionFacet.class);
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
29
1138
d90f5bfa3ddf Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
30 protected ComputeType type;
1116
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
31
1967
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
32
1116
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
33 /** Trivial constructor, set (maybe localized) description. */
1803
51e59f221333 Minor preparations for WINFO/CrossSection to handle multiple cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1138
diff changeset
34 public CrossSectionFacet(int idx, String description) {
51e59f221333 Minor preparations for WINFO/CrossSection to handle multiple cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1138
diff changeset
35 super(idx, CROSS_SECTION, description);
1138
d90f5bfa3ddf Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
36 type = ComputeType.ADVANCE;
1116
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
37 }
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
38
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
39
1967
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
40 /** Tell world we know about crosssection masters data and its index. */
2405
f008c3335a77 Towards fixe of flys/issue495.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2303
diff changeset
41 public List getStaticDataProviderKeys(Artifact art) {
1967
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
42 CrossSectionArtifact artifact = (CrossSectionArtifact) art;
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
43 List keys = new ArrayList();
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
44 if (artifact.isMaster()) {
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
45 keys.add(BLACKBOARD_CS_MASTER_DATA);
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
46 }
2002
98f3ef8da857 Register under a key on blackboard to meet assumptions by areaartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1967
diff changeset
47 keys.add(artifact.identifier() + getIndex());
2405
f008c3335a77 Towards fixe of flys/issue495.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2303
diff changeset
48 keys.addAll(super.getStaticDataProviderKeys(art));
1967
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
49 return keys;
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
50 }
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
51
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
52
1116
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
53 /**
1967
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
54 * Can provide the master cross section lines or its index.
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
55 * @param artifact crosssection-artifact
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
56 * @param key will respond on BLACKBOARD_CS_MASTER_DATA
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
57 * @param param ignored
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
58 * @param context ignored
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
59 * @return data from artifact (cross section master track).
1116
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
60 */
1967
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
61 public Object provideBlackboardData(Artifact artifact,
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
62 Object key,
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
63 Object param,
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
64 CallContext context
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
65 ) {
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
66 CrossSectionArtifact crossSection = (CrossSectionArtifact) artifact;
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
67
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
68 if (key.equals(BLACKBOARD_CS_MASTER_DATA)) {
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
69 return crossSection.searchCrossSectionLine();
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
70 }
2002
98f3ef8da857 Register under a key on blackboard to meet assumptions by areaartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1967
diff changeset
71 else if (key.equals(artifact.identifier() + getIndex())) {
98f3ef8da857 Register under a key on blackboard to meet assumptions by areaartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1967
diff changeset
72 return getData(artifact, context);
98f3ef8da857 Register under a key on blackboard to meet assumptions by areaartifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1967
diff changeset
73 }
1967
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
74 else {
2301
bc23341bf322 Repair area over cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2002
diff changeset
75 Object obj = super.provideBlackboardData(artifact, key, param,
bc23341bf322 Repair area over cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2002
diff changeset
76 context);
bc23341bf322 Repair area over cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2002
diff changeset
77 if (obj == null) {
bc23341bf322 Repair area over cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2002
diff changeset
78 logger.warn("Cannot provide data for key: " + key);
bc23341bf322 Repair area over cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2002
diff changeset
79 }
bc23341bf322 Repair area over cross sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2002
diff changeset
80 return obj;
1967
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
81 }
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
82 }
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
83
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
84
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
85 /**
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
86 * Gets Cross Section (profile).
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
87 * @param art artifact to get data from.
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
88 * @param context ignored
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
89 */
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
90 public Object getData(Artifact art, CallContext context) {
1116
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
91 logger.debug("Get data for cross section");
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
92
1967
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
93 CrossSectionArtifact artifact = (CrossSectionArtifact)art;
1116
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
94
1967
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
95 return artifact.getCrossSectionData();
1116
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
96 }
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
97
1138
d90f5bfa3ddf Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
98
d90f5bfa3ddf Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
99 /** Do a deep copy. */
1116
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
100 @Override
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
101 public Facet deepCopy() {
1803
51e59f221333 Minor preparations for WINFO/CrossSection to handle multiple cross-sections.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1138
diff changeset
102 CrossSectionFacet copy = new CrossSectionFacet(this.index, this.description);
1116
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
103 copy.set(this);
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
104 return copy;
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
105 }
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
106 }
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
107 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org