annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/CrossSectionFacet.java @ 1996:c6432e8ea31e

Bugfix: add new Outputs during merge process in AttributeWriter. flys-artifacts/trunk@3433 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 16 Dec 2011 10:25:55 +0000
parents 27bb2e24f7f8
children 98f3ef8da857
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.DefaultFacet;
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
12 import de.intevation.artifactdatabase.state.Facet;
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
13
1967
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
14 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
15
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
16 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
17
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
18
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
19 /**
1967
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
20 * 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
21 */
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
22 public class CrossSectionFacet
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
23 extends DefaultFacet
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
24 implements FacetTypes {
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
25
1967
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
26 public static String BLACKBOARD_CS_MASTER_DATA
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
27 = "crosssection.masterprofile.data";
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
28
1116
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
29 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
30
1138
d90f5bfa3ddf Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
31 protected ComputeType type;
1116
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
32
1967
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
33
1116
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
34 /** 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
35 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
36 super(idx, CROSS_SECTION, description);
1138
d90f5bfa3ddf Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
37 type = ComputeType.ADVANCE;
1116
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
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
40
1967
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
41 /** Tell world we know about crosssection masters data and its index. */
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
42 public List getDataProviderKeys(Artifact art) {
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
43 CrossSectionArtifact artifact = (CrossSectionArtifact) art;
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
44 List keys = new ArrayList();
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
45 if (artifact.isMaster()) {
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
46 keys.add(BLACKBOARD_CS_MASTER_DATA);
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
47 }
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
48 return keys;
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
49 }
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
1116
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
52 /**
1967
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
53 * 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
54 * @param artifact crosssection-artifact
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
55 * @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
56 * @param param ignored
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
57 * @param context ignored
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
58 * @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
59 */
1967
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
60 public Object provideBlackboardData(Artifact artifact,
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
61 Object key,
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
62 Object param,
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
63 CallContext context
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
64 ) {
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
65 CrossSectionArtifact crossSection = (CrossSectionArtifact) artifact;
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
66
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
67 if (key.equals(BLACKBOARD_CS_MASTER_DATA)) {
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
68 return crossSection.searchCrossSectionLine();
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
69 }
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
70 else {
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
71 logger.warn("Cannot provide data for key: " + key);
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
72 return null;
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
73 }
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
74 }
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
75
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
76
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
77 /**
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
78 * Gets Cross Section (profile).
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
79 * @param art artifact to get data from.
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
80 * @param context ignored
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 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
83 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
84
1967
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
85 CrossSectionArtifact artifact = (CrossSectionArtifact)art;
1116
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
86
1967
27bb2e24f7f8 Preparations for better CrossSection diagrams.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1803
diff changeset
87 return artifact.getCrossSectionData();
1116
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
88 }
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
89
1138
d90f5bfa3ddf Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
90
d90f5bfa3ddf Fix profile loading of cross section diagram.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1122
diff changeset
91 /** Do a deep copy. */
1116
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
92 @Override
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
93 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
94 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
95 copy.set(this);
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
96 return copy;
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
97 }
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
98 }
05e4ef0f9489 Improved stub for CrossSections (including Factory and Facet).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
99 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org