Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/RelativePointFacet.java @ 2743:10e6400d4166
Added (dummy-) implementation of relative point facet in staticwkms case.
flys-artifacts/trunk@4478 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 23 May 2012 13:48:20 +0000 |
parents | |
children | 94c6f4ad9b98 |
comparison
equal
deleted
inserted
replaced
2742:faf73245ec73 | 2743:10e6400d4166 |
---|---|
1 package de.intevation.flys.artifacts.model; | |
2 | |
3 import java.util.List; | |
4 import java.awt.geom.Point2D; | |
5 | |
6 import org.apache.log4j.Logger; | |
7 | |
8 import de.intevation.artifacts.Artifact; | |
9 import de.intevation.artifacts.CallContext; | |
10 import de.intevation.artifacts.DataProvider; | |
11 | |
12 import de.intevation.flys.artifacts.StaticWKmsArtifact; | |
13 import de.intevation.flys.artifacts.model.FacetTypes; | |
14 | |
15 /** | |
16 * Facet to access a point | |
17 */ | |
18 public class RelativePointFacet | |
19 extends BlackboardDataFacet | |
20 implements FacetTypes { | |
21 | |
22 private static Logger logger = Logger.getLogger(RelativePointFacet.class); | |
23 | |
24 /** Trivial Constructor. */ | |
25 public RelativePointFacet(String description) { | |
26 this(RELATIVE_POINT, description); | |
27 } | |
28 | |
29 public RelativePointFacet(String name, String description) { | |
30 this.name = name; | |
31 this.description = description; | |
32 this.index = 0; | |
33 } | |
34 | |
35 | |
36 /** | |
37 * Returns the data this facet requires. | |
38 * | |
39 * @param artifact the owner artifact. | |
40 * @param context the CallContext (ignored). | |
41 * | |
42 * @return the data. | |
43 */ | |
44 @Override | |
45 public Object getData(Artifact artifact, CallContext context) { | |
46 /* CrossSectionWaterLineFacet: | |
47 List<DataProvider> providers = context. | |
48 getDataProvider(CrossSectionFacet.BLACKBOARD_CS_MASTER_DATA); | |
49 if (providers.size() < 1) { | |
50 logger.warn("Could not find Cross-Section data provider."); | |
51 return new Lines.LineData(new double[][] {}, 0d, 0d); | |
52 } | |
53 | |
54 Object crossSection = providers.get(0) | |
55 .provideData(CrossSectionFacet.BLACKBOARD_CS_MASTER_DATA, null, context); | |
56 | |
57 WaterLineArtifact winfo = (WaterLineArtifact)artifact; | |
58 */ | |
59 // Find out whether we live in a duration curve context, there we would | |
60 // provide only a single point. | |
61 List<DataProvider> providers = context. | |
62 getDataProvider("durationcurve"); | |
63 if (providers.size() < 1) { | |
64 logger.debug("Could not find durationcurve data provider."); | |
65 //return new Lines.LineData(new double[][] {}, 0d, 0d); | |
66 } | |
67 else { | |
68 Object crossSection = providers.get(0) | |
69 .provideData(CrossSectionFacet.BLACKBOARD_CS_MASTER_DATA, null, context); | |
70 | |
71 } | |
72 | |
73 StaticWKmsArtifact staticData = | |
74 (StaticWKmsArtifact) artifact; | |
75 //return staticData.getWKms(0); | |
76 return new Point2D.Double(10d,180d); | |
77 } | |
78 | |
79 | |
80 /** | |
81 * Create a deep copy of this Facet. | |
82 * @return a deep copy. | |
83 */ | |
84 @Override | |
85 public RelativePointFacet deepCopy() { | |
86 RelativePointFacet copy = new RelativePointFacet(description); | |
87 copy.set(this); | |
88 return copy; | |
89 } | |
90 } | |
91 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |