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