Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/CrossSectionWaterLineFacet.java @ 2424:092e519ff461
merged flys-artifacts/2.6.1
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 28 Sep 2012 12:14:26 +0200 |
parents | 79a94c4171cb |
children | 9d2a06c3a134 |
comparison
equal
deleted
inserted
replaced
2392:8112ec686a9a | 2424:092e519ff461 |
---|---|
1 package de.intevation.flys.artifacts.model; | |
2 | |
3 import org.apache.log4j.Logger; | |
4 | |
5 import java.util.List; | |
6 | |
7 import de.intevation.artifacts.Artifact; | |
8 import de.intevation.artifacts.CallContext; | |
9 import de.intevation.artifacts.DataProvider; | |
10 | |
11 import de.intevation.artifactdatabase.state.Facet; | |
12 | |
13 import de.intevation.flys.artifacts.WaterLineArtifact; | |
14 | |
15 import de.intevation.flys.model.FastCrossSectionLine; | |
16 | |
17 /** | |
18 * Facet for Waterlines in Cross Sections. | |
19 */ | |
20 public class CrossSectionWaterLineFacet | |
21 extends BlackboardDataFacet | |
22 implements FacetTypes { | |
23 | |
24 private static Logger logger = Logger.getLogger(CrossSectionWaterLineFacet.class); | |
25 | |
26 | |
27 /** Trivial constructor, set (maybe localized) description. */ | |
28 public CrossSectionWaterLineFacet(int idx, String description) { | |
29 super(idx, CROSS_SECTION_WATER_LINE, description); | |
30 } | |
31 | |
32 | |
33 /** | |
34 * Gets waterline (crossed with cross section) of waterlevel. | |
35 */ | |
36 public Object getData(Artifact artifact, CallContext context) { | |
37 logger.debug("Get data for cross section water line"); | |
38 | |
39 List<DataProvider> providers = context. | |
40 getDataProvider(CrossSectionFacet.BLACKBOARD_CS_MASTER_DATA); | |
41 if (providers.size() < 1) { | |
42 logger.warn("Could not find Cross-Section data provider."); | |
43 return new double[][] {}; | |
44 } | |
45 | |
46 Object crossSection = providers.get(0) | |
47 .provideData(CrossSectionFacet.BLACKBOARD_CS_MASTER_DATA, null, context); | |
48 | |
49 WaterLineArtifact winfo = (WaterLineArtifact)artifact; | |
50 | |
51 return winfo.getWaterLines(this.getIndex(), (FastCrossSectionLine) crossSection); | |
52 } | |
53 | |
54 | |
55 /** Do a deep copy. */ | |
56 @Override | |
57 public Facet deepCopy() { | |
58 CrossSectionWaterLineFacet copy = new CrossSectionWaterLineFacet( | |
59 this.getIndex(), | |
60 this.description); | |
61 copy.set(this); | |
62 return copy; | |
63 } | |
64 } | |
65 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |