Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedHeightFacet.java @ 7984:cf674b03901a facet-metadata
Bedheight facet now returns double[][]. Removed obsolete processor code.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Tue, 01 Jul 2014 13:27:53 +0200 |
parents | 42076d94977e |
children | b0cee7dfd6fe |
comparison
equal
deleted
inserted
replaced
7983:62befca02480 | 7984:cf674b03901a |
---|---|
6 * documentation coming with Dive4Elements River for details. | 6 * documentation coming with Dive4Elements River for details. |
7 */ | 7 */ |
8 | 8 |
9 package org.dive4elements.river.artifacts.model.minfo; | 9 package org.dive4elements.river.artifacts.model.minfo; |
10 | 10 |
11 import gnu.trove.TDoubleArrayList; | |
12 | |
13 import java.util.List; | |
14 | |
15 import org.apache.log4j.Logger; | |
11 import org.dive4elements.artifacts.Artifact; | 16 import org.dive4elements.artifacts.Artifact; |
12 import org.dive4elements.artifacts.CallContext; | 17 import org.dive4elements.artifacts.CallContext; |
13 import org.dive4elements.river.artifacts.D4EArtifact; | 18 import org.dive4elements.river.artifacts.D4EArtifact; |
14 import org.dive4elements.river.artifacts.access.BedHeightAccess; | 19 import org.dive4elements.river.artifacts.access.BedHeightAccess; |
15 import org.dive4elements.river.artifacts.model.BlackboardDataFacet; | 20 import org.dive4elements.river.artifacts.model.BlackboardDataFacet; |
18 import org.dive4elements.river.model.BedHeightSingleValue; | 23 import org.dive4elements.river.model.BedHeightSingleValue; |
19 | 24 |
20 public class BedHeightFacet | 25 public class BedHeightFacet |
21 extends BlackboardDataFacet | 26 extends BlackboardDataFacet |
22 implements FacetTypes { | 27 implements FacetTypes { |
28 | |
29 private static final Logger logger = Logger.getLogger(BedHeightFacet.class); | |
23 | 30 |
24 private String type; | 31 private String type; |
25 | 32 |
26 public BedHeightFacet(String name, String description, String type) { | 33 public BedHeightFacet(String name, String description, String type) { |
27 this.name = name; | 34 this.name = name; |
48 * Return a {@link List} of {@link BedHeightSingleValue}s | 55 * Return a {@link List} of {@link BedHeightSingleValue}s |
49 * at the range of the artifact | 56 * at the range of the artifact |
50 * @return List of {@link BedHeightSingleValue}s */ | 57 * @return List of {@link BedHeightSingleValue}s */ |
51 BedHeightSingle single = BedHeightSingle.getBedHeightSingleById( | 58 BedHeightSingle single = BedHeightSingle.getBedHeightSingleById( |
52 access.getHeightId()); | 59 access.getHeightId()); |
53 return BedHeightSingleValue.getBedHeightSingleValues(single, | 60 List<BedHeightSingleValue> bedheightValues = |
61 BedHeightSingleValue.getBedHeightSingleValues( | |
62 single, | |
54 access.getFrom(), | 63 access.getFrom(), |
55 access.getTo()); | 64 access.getTo()); |
65 double[][] values = new double[2][bedheightValues.size()]; | |
66 int i = 0; | |
67 for (BedHeightSingleValue bedheightValue : bedheightValues) { | |
68 values[0][i] = bedheightValue.getStation(); | |
69 values[1][i] = bedheightValue.getHeight(); | |
70 i++; | |
71 } | |
72 return values; | |
56 } | 73 } |
57 else { | 74 else { |
58 /* Former doc (from BedHeightAccess): | 75 /* Former doc (from BedHeightAccess): |
59 * Return the {@link BedHeight} at the height_id and time of the artifact | 76 * Return the {@link BedHeight} at the height_id and time of the artifact |
60 * @return {@link BedHeight} */ | 77 * @return {@link BedHeight} */ |
61 return BedHeightFactory.getHeight( | 78 BedHeightData data = BedHeightFactory.getHeight( |
62 access.getType(), | 79 access.getType(), |
63 access.getHeightId(), | 80 access.getHeightId(), |
64 access.getTime()); | 81 access.getTime()); |
82 //data.removeNaNs(); | |
83 TDoubleArrayList stations= data.getStations(); | |
84 double[][] values = new double[2][stations.size()]; | |
85 logger.debug("stations: " + stations.size()); | |
86 for (int i = 0; i < stations.size(); i++) { | |
87 logger.debug("station: " + stations.get(i)); | |
88 values[0][i] = stations.get(i); | |
89 logger.debug("height: " + data.getHeight(i)); | |
90 values[1][i] = data.getHeight(i); | |
91 } | |
92 return values; | |
65 } | 93 } |
66 } | 94 } |
67 | 95 |
68 /** | 96 /** |
69 * Create a deep copy of this Facet. | 97 * Create a deep copy of this Facet. |