Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedHeightSoundingWidthFacet.java @ 8295:9ab967eb2c51
At least since rev eb052d759fcc, there are no bed height epochs anymore.
author | "Tom Gottfried <tom@intevation.de>" |
---|---|
date | Thu, 18 Sep 2014 18:16:51 +0200 |
parents | 99912f51468d |
children | 2f640972ecf6 |
rev | line source |
---|---|
7995 | 1 package org.dive4elements.river.artifacts.model.minfo; |
2 | |
3 import java.util.List; | |
4 | |
5 import org.dive4elements.artifacts.Artifact; | |
6 import org.dive4elements.artifacts.CallContext; | |
7 import org.dive4elements.river.artifacts.D4EArtifact; | |
8 import org.dive4elements.river.artifacts.access.BedHeightAccess; | |
9 import org.dive4elements.river.artifacts.model.BlackboardDataFacet; | |
10 import org.dive4elements.river.artifacts.model.FacetTypes; | |
11 import org.dive4elements.river.model.BedHeightSingle; | |
12 import org.dive4elements.river.model.BedHeightSingleValue; | |
13 | |
14 | |
15 public class BedHeightSoundingWidthFacet | |
16 extends BlackboardDataFacet | |
17 implements FacetTypes | |
18 { | |
19 public BedHeightSoundingWidthFacet(String name, String description) { | |
20 this.name = name; | |
21 this.description = description; | |
22 this.index = 0; | |
23 this.metaData.put("X", "chart.longitudinal.section.xaxis.label"); | |
8267
99912f51468d
A bit less chaos in i18n for bed heights.
"Tom Gottfried <tom@intevation.de>"
parents:
7995
diff
changeset
|
24 this.metaData.put("Y", "chart.bedheight_middle.section.yaxis.label"); |
7995 | 25 } |
26 | |
27 /** | |
28 * Returns the data this facet requires. | |
29 * | |
30 * @param artifact the owner artifact. | |
31 * @param context the CallContext (ignored). | |
32 * | |
33 * @return the data. | |
34 */ | |
35 @Override | |
36 public Object getData(Artifact artifact, CallContext context) { | |
37 BedHeightAccess access = new BedHeightAccess((D4EArtifact)artifact); | |
38 /* Former doc (from BedHeightAccess): | |
39 * Return a {@link List} of {@link BedHeightSingleValue}s | |
40 * at the range of the artifact | |
41 * @return List of {@link BedHeightSingleValue}s */ | |
42 BedHeightSingle single = BedHeightSingle.getBedHeightSingleById( | |
43 access.getHeightId()); | |
44 List<BedHeightSingleValue> bedheightValues = | |
45 BedHeightSingleValue.getBedHeightSingleValues( | |
46 single, | |
47 access.getFrom(), | |
48 access.getTo()); | |
49 double[][] values = new double[2][bedheightValues.size()]; | |
50 int i = 0; | |
51 for (BedHeightSingleValue bedheightValue : bedheightValues) { | |
52 values[0][i] = bedheightValue.getStation(); | |
53 values[1][i] = bedheightValue.getSoundingWidth(); | |
54 i++; | |
55 } | |
56 return values; | |
57 } | |
58 | |
59 /** | |
60 * Create a deep copy of this Facet. | |
61 * @return a deep copy. | |
62 */ | |
63 @Override | |
64 public BedHeightSoundingWidthFacet deepCopy() { | |
65 BedHeightSoundingWidthFacet copy = | |
66 new BedHeightSoundingWidthFacet(name, description); | |
67 copy.set(this); | |
68 return copy; | |
69 } | |
70 } |