Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentDensityFacet.java @ 8098:09725b65955a
Add new and simplyfied SedimentLoadFacet
The SedimentLoadFacet is intended to work with the Measurement stations.
It uses the same mechanismn to access the Mesurement station values
as the calculation does.
SedimentLoadLS values need a different facet that will come soon.
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Fri, 15 Aug 2014 18:27:19 +0200 |
parents | 42076d94977e |
children | e4606eae8ea5 |
rev | line source |
---|---|
7199
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
2 * Software engineering by Intevation GmbH |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
3 * |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
4 * This file is Free Software under the GNU AGPL (>=v3) |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
6 * documentation coming with Dive4Elements River for details. |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
7 */ |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
8 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
9 package org.dive4elements.river.artifacts.model.minfo; |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
10 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
11 import org.dive4elements.artifactdatabase.state.Facet; |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
12 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
13 import org.dive4elements.artifacts.Artifact; |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
14 import org.dive4elements.artifacts.CallContext; |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
15 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
16 import org.dive4elements.river.artifacts.D4EArtifact; |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
17 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
18 import org.dive4elements.river.artifacts.model.DataFacet; |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
19 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
20 import org.dive4elements.river.artifacts.states.DefaultState.ComputeType; |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
21 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
22 import org.apache.log4j.Logger; |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
23 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
24 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
25 /** Facet to access sediment density values measured in one year. */ |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
26 public class SedimentDensityFacet |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
27 extends DataFacet |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
28 { |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
29 /** Very own logger. */ |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
30 private static Logger logger = Logger.getLogger(SedimentDensityFacet.class); |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
31 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
32 /** Used as tolerance value when fetching measurement stations. */ |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
33 private static double EPSILON = 1e-5; |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
34 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
35 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
36 public SedimentDensityFacet() { |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
37 } |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
38 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
39 public SedimentDensityFacet(int idx, String name, String description, |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
40 ComputeType type, String stateId, String hash) { |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
41 super(idx, name, description, type, hash, stateId); |
7894
42076d94977e
Added metadata to facets.
Raimund Renkert <rrenkert@intevation.de>
parents:
7206
diff
changeset
|
42 this.metaData.put("X", "chart.longitudinal.section.xaxis.label"); |
42076d94977e
Added metadata to facets.
Raimund Renkert <rrenkert@intevation.de>
parents:
7206
diff
changeset
|
43 this.metaData.put("Y", "chart.yaxis.label.sedimentdensity"); |
7199
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
44 } |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
45 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
46 @Override |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
47 public Object getData(Artifact artifact, CallContext context) { |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
48 logger.debug("Get data for sediment density at index: " + index); |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
49 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
50 D4EArtifact flys = (D4EArtifact) artifact; |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
51 |
7206
cb3965dbf22e
issue1435: SedimentDensityFacet: Access sediment density data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7205
diff
changeset
|
52 SedimentDensity res = (SedimentDensity) flys.compute(context, hash, |
7199
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
53 stateId, type, false); |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
54 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
55 if (res == null) { |
7206
cb3965dbf22e
issue1435: SedimentDensityFacet: Access sediment density data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7205
diff
changeset
|
56 logger.error("No SedimentDensity"); |
7199
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
57 } |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
58 |
7206
cb3965dbf22e
issue1435: SedimentDensityFacet: Access sediment density data.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
7205
diff
changeset
|
59 return res; |
7199
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
60 } |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
61 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
62 |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
63 /** Copy deeply. */ |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
64 @Override |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
65 public Facet deepCopy() { |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
66 SedimentDensityFacet copy = new SedimentDensityFacet(); |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
67 copy.set(this); |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
68 copy.type = type; |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
69 copy.hash = hash; |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
70 copy.stateId = stateId; |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
71 return copy; |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
72 } |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
73 } |
baf04164fcc6
issue1435: Stubs for SedimentDensityFacet and -Artifact.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff
changeset
|
74 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |