Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedHeightSoundingWidthFacet.java @ 8858:a805211690f7 3.2.x
Fix license headers.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Thu, 18 Jan 2018 20:52:41 +0100 |
parents | 1083cb887ffb |
children |
rev | line source |
---|---|
8858 | 1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde |
2 * Software engineering by Intevation GmbH | |
3 * | |
4 * This file is Free Software under the GNU AGPL (>=v3) | |
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the | |
6 * documentation coming with Dive4Elements River for details. | |
7 */ | |
8 | |
7995 | 9 package org.dive4elements.river.artifacts.model.minfo; |
10 | |
11 import java.util.List; | |
12 | |
13 import org.dive4elements.artifacts.Artifact; | |
14 import org.dive4elements.artifacts.CallContext; | |
15 import org.dive4elements.river.artifacts.D4EArtifact; | |
16 import org.dive4elements.river.artifacts.access.BedHeightAccess; | |
17 import org.dive4elements.river.artifacts.model.BlackboardDataFacet; | |
18 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
|
19 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
|
20 import org.dive4elements.river.model.BedHeightValue; |
7995 | 21 |
22 | |
23 public class BedHeightSoundingWidthFacet | |
24 extends BlackboardDataFacet | |
25 implements FacetTypes | |
26 { | |
27 public BedHeightSoundingWidthFacet(String name, String description) { | |
28 this.name = name; | |
29 this.description = description; | |
30 this.index = 0; | |
31 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
|
32 this.metaData.put("Y", "chart.bedheight_middle.sounding.yaxis.label"); |
7995 | 33 } |
34 | |
35 /** | |
36 * Returns the data this facet requires. | |
37 * | |
38 * @param artifact the owner artifact. | |
39 * @param context the CallContext (ignored). | |
40 * | |
41 * @return the data. | |
42 */ | |
43 @Override | |
44 public Object getData(Artifact artifact, CallContext context) { | |
45 BedHeightAccess access = new BedHeightAccess((D4EArtifact)artifact); | |
46 /* 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
|
47 * Return a {@link List} of {@link BedHeightValue}s |
7995 | 48 * 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
|
49 * @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
|
50 BedHeight single = BedHeight.getBedHeightById( |
7995 | 51 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
|
52 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
|
53 BedHeightValue.getBedHeightValues( |
8721
1083cb887ffb
(issue1754) Do not filter BedHeightSoundings to range.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
8701
diff
changeset
|
54 single); |
7995 | 55 double[][] values = new double[2][bedheightValues.size()]; |
56 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
|
57 for (BedHeightValue bedheightValue : bedheightValues) { |
7995 | 58 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
|
59 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
|
60 ? bedheightValue.getSoundingWidth() : Double.NaN; |
7995 | 61 i++; |
62 } | |
63 return values; | |
64 } | |
65 | |
66 /** | |
67 * Create a deep copy of this Facet. | |
68 * @return a deep copy. | |
69 */ | |
70 @Override | |
71 public BedHeightSoundingWidthFacet deepCopy() { | |
72 BedHeightSoundingWidthFacet copy = | |
73 new BedHeightSoundingWidthFacet(name, description); | |
74 copy.set(this); | |
75 return copy; | |
76 } | |
77 } |