Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedHeightSoundingWidthFacet.java @ 8721:1083cb887ffb
(issue1754) Do not filter BedHeightSoundings to range.
This is more symetric to WINFO Raw data and fixes the problematic
master artifact information loss from issue1754 as the information
from the master (range) is no longer required.
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Mon, 27 Apr 2015 17:35:28 +0200 |
parents | 7e9d015b0f22 |
children | a805211690f7 |
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; | |
8559
6d8d7425a6b5
Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
8427
diff
changeset
|
11 import org.dive4elements.river.model.BedHeight; |
6d8d7425a6b5
Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
8427
diff
changeset
|
12 import org.dive4elements.river.model.BedHeightValue; |
7995 | 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"); | |
8701
7e9d015b0f22
(issue1602) Use correct descriptor for sounding width y-data.
Tom Gottfried <tom@intevation.de>
parents:
8648
diff
changeset
|
24 this.metaData.put("Y", "chart.bedheight_middle.sounding.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): | |
8559
6d8d7425a6b5
Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
8427
diff
changeset
|
39 * Return a {@link List} of {@link BedHeightValue}s |
7995 | 40 * at the range of the artifact |
8559
6d8d7425a6b5
Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
8427
diff
changeset
|
41 * @return List of {@link BedHeightValue}s */ |
6d8d7425a6b5
Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
8427
diff
changeset
|
42 BedHeight single = BedHeight.getBedHeightById( |
7995 | 43 access.getHeightId()); |
8559
6d8d7425a6b5
Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
8427
diff
changeset
|
44 List<BedHeightValue> bedheightValues = |
6d8d7425a6b5
Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
8427
diff
changeset
|
45 BedHeightValue.getBedHeightValues( |
8721
1083cb887ffb
(issue1754) Do not filter BedHeightSoundings to range.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
8701
diff
changeset
|
46 single); |
7995 | 47 double[][] values = new double[2][bedheightValues.size()]; |
48 int i = 0; | |
8559
6d8d7425a6b5
Bed heights are just bed heights since a while ('single' is obsolete).
"Tom Gottfried <tom@intevation.de>"
parents:
8427
diff
changeset
|
49 for (BedHeightValue bedheightValue : bedheightValues) { |
7995 | 50 values[0][i] = bedheightValue.getStation(); |
8427
2f640972ecf6
There might be no sounding width given at some stations of a bed height single.
Tom Gottfried <tom@intevation.de>
parents:
8267
diff
changeset
|
51 values[1][i] = bedheightValue.getSoundingWidth() != null |
2f640972ecf6
There might be no sounding width given at some stations of a bed height single.
Tom Gottfried <tom@intevation.de>
parents:
8267
diff
changeset
|
52 ? bedheightValue.getSoundingWidth() : Double.NaN; |
7995 | 53 i++; |
54 } | |
55 return values; | |
56 } | |
57 | |
58 /** | |
59 * Create a deep copy of this Facet. | |
60 * @return a deep copy. | |
61 */ | |
62 @Override | |
63 public BedHeightSoundingWidthFacet deepCopy() { | |
64 BedHeightSoundingWidthFacet copy = | |
65 new BedHeightSoundingWidthFacet(name, description); | |
66 copy.set(this); | |
67 return copy; | |
68 } | |
69 } |