annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/GaugeDischargeCurveArtifact.java @ 4645:105463e2234f

Merged.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Wed, 05 Dec 2012 12:59:32 +0100
parents 526fd442e0e5
children
rev   line source
3936
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.artifacts;
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
2
4190
b87d76a6da70 The AT export needs a ld_locations data item
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4188
diff changeset
3 import java.math.BigDecimal;
3936
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
4 import java.util.ArrayList;
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
5 import java.util.List;
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
6
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
7 import org.apache.log4j.Logger;
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
8
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
9 import org.w3c.dom.Document;
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
10
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
11 import de.intevation.artifactdatabase.state.DefaultOutput;
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
12 import de.intevation.artifactdatabase.state.Facet;
4034
46c1210be26b Set translated data descriptions
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4032
diff changeset
13 import de.intevation.artifactdatabase.data.DefaultStateData;
3936
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
14
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
15 import de.intevation.artifacts.ArtifactFactory;
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
16 import de.intevation.artifacts.CallMeta;
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
17
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
18 import de.intevation.artifacts.common.ArtifactNamespaceContext;
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
19 import de.intevation.artifacts.common.utils.XMLUtils;
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
20
4032
a5e1ca620f15 Add description and set correct name for GaugeDischargeCurveFacet
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4028
diff changeset
21 import de.intevation.flys.artifacts.model.GaugeDischargeCurveFacet;
a5e1ca620f15 Add description and set correct name for GaugeDischargeCurveFacet
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4028
diff changeset
22 import de.intevation.flys.artifacts.resources.Resources;
3936
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
23 import de.intevation.flys.artifacts.states.StaticState;
4032
a5e1ca620f15 Add description and set correct name for GaugeDischargeCurveFacet
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4028
diff changeset
24
a5e1ca620f15 Add description and set correct name for GaugeDischargeCurveFacet
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4028
diff changeset
25 import de.intevation.flys.model.Gauge;
a5e1ca620f15 Add description and set correct name for GaugeDischargeCurveFacet
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4028
diff changeset
26 import de.intevation.flys.utils.FLYSUtils;
3936
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
27
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
28
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
29 /**
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
30 * Artifact to calculate a discharge curve from a gauge overview info
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
31 *
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
32 * @author <a href="mailto:bjoern.ricks@intevation.de">Björn Ricks</a>
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
33 */
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
34 public class GaugeDischargeCurveArtifact
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
35 extends AbstractStaticStateArtifact
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
36 {
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
37
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
38 private static final Logger logger =
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
39 Logger.getLogger(GaugeDischargeCurveArtifact.class);
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
40
4027
21cac9482958 Fix xpath for attributes
Björn Ricks <bjoern.ricks@intevation.de>
parents: 3991
diff changeset
41 public static final String XPATH_RIVER = "/art:action/art:river/@art:name";
21cac9482958 Fix xpath for attributes
Björn Ricks <bjoern.ricks@intevation.de>
parents: 3991
diff changeset
42 public static final String XPATH_GAUGE = "/art:action/art:gauge/@art:reference";
3936
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
43 public static final String NAME = "gaugedischargecurve";
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
44 public static final String STATIC_STATE_NAME = "state.gaugedischargecurve.static";
4159
bbae306fcb4f Set uiprovider on the state
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4034
diff changeset
45 public static final String UIPROVIDER = "gauge_discharge_curve";
4188
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
46 public static final String GAUGE_DISCHARGE_CURVE_FACET =
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
47 "gauge_discharge_curve";
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
48 public static final String GAUGE_DISCHARGE_CURVE_AT_EXPORT_FACET =
4305
8c51c43e59ca Rename gauge_discharge_curve_at_export facet to at
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4190
diff changeset
49 "at";
4188
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
50 public static final String GAUGE_DISCHARGE_CURVE_OUT =
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
51 "discharge_curve";
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
52 public static final String GAUGE_DISCHARGE_CURVE_AT_EXPORT_OUT =
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
53 "computed_dischargecurve_at_export";
4611
526fd442e0e5 Add pdf export to GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4586
diff changeset
54 public static final String GAUGE_DISCHARGE_CURVE_EXPORT_OUT =
4586
319565a48182 Add the csv export to the GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4305
diff changeset
55 "computed_dischargecurve_export";
319565a48182 Add the csv export to the GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4305
diff changeset
56 public static final String GAUGE_DISCHARGE_CURVE_CSV_FACET =
319565a48182 Add the csv export to the GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4305
diff changeset
57 "csv";
4611
526fd442e0e5 Add pdf export to GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4586
diff changeset
58 public static final String GAUGE_DISCHARGE_CURVE_PDF_FACET =
526fd442e0e5 Add pdf export to GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4586
diff changeset
59 "pdf";
4188
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
60
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
61 private Facet atexportfacet;
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
62 private Facet curvefacet;
4586
319565a48182 Add the csv export to the GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4305
diff changeset
63 private Facet csvfacet;
4611
526fd442e0e5 Add pdf export to GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4586
diff changeset
64 private Facet pdffacet;
3936
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
65
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
66 /**
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
67 * Setup initializes the data by extracting the river and gauge from
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
68 * the XML Document.
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
69 */
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
70 @Override
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
71 public void setup(
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
72 String identifier,
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
73 ArtifactFactory factory,
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
74 Object context,
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
75 CallMeta callmeta,
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
76 Document data)
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
77 {
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
78 logger.debug("GaugeDischargeCurveArtifact.setup");
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
79
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
80 if (logger.isDebugEnabled()) {
4028
b993d328f8b0 Improve debug output
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4027
diff changeset
81 logger.debug("GaugeDischargeCurveArtifact.setup" + XMLUtils.toString(data));
3936
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
82 }
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
83 String gaugeref = XMLUtils.xpathString(data, XPATH_GAUGE,
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
84 ArtifactNamespaceContext.INSTANCE);
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
85 String rivername = XMLUtils.xpathString(data, XPATH_RIVER,
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
86 ArtifactNamespaceContext.INSTANCE);
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
87
4034
46c1210be26b Set translated data descriptions
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4032
diff changeset
88 addData("river", new DefaultStateData("river",
46c1210be26b Set translated data descriptions
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4032
diff changeset
89 Resources.getMsg(callmeta,
46c1210be26b Set translated data descriptions
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4032
diff changeset
90 "facet.gauge_discharge_curve.river",
46c1210be26b Set translated data descriptions
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4032
diff changeset
91 "Name of the river"),
46c1210be26b Set translated data descriptions
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4032
diff changeset
92 "String", rivername));
46c1210be26b Set translated data descriptions
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4032
diff changeset
93 addData("reference_gauge", new DefaultStateData("reference_gauge",
46c1210be26b Set translated data descriptions
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4032
diff changeset
94 Resources.getMsg(callmeta,
46c1210be26b Set translated data descriptions
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4032
diff changeset
95 "facet.gauge_discharge_curve.reference_gauge",
46c1210be26b Set translated data descriptions
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4032
diff changeset
96 "Gauge official number"),
4186
eba517419832 Change reference_gauge paremeter to Long
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4185
diff changeset
97 "Long", gaugeref));
3936
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
98
4032
a5e1ca620f15 Add description and set correct name for GaugeDischargeCurveFacet
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4028
diff changeset
99 Gauge gauge = FLYSUtils.getReferenceGauge(this);
4034
46c1210be26b Set translated data descriptions
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4032
diff changeset
100 String gaugename = "";
4190
b87d76a6da70 The AT export needs a ld_locations data item
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4188
diff changeset
101 Double gaugelocation = null;
4034
46c1210be26b Set translated data descriptions
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4032
diff changeset
102 if (gauge != null) {
46c1210be26b Set translated data descriptions
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4032
diff changeset
103 gaugename = gauge.getName();
4190
b87d76a6da70 The AT export needs a ld_locations data item
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4188
diff changeset
104 BigDecimal station = gauge.getStation();
b87d76a6da70 The AT export needs a ld_locations data item
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4188
diff changeset
105 if (station != null) {
b87d76a6da70 The AT export needs a ld_locations data item
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4188
diff changeset
106 gaugelocation = station.doubleValue();
b87d76a6da70 The AT export needs a ld_locations data item
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4188
diff changeset
107 }
4034
46c1210be26b Set translated data descriptions
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4032
diff changeset
108 }
4032
a5e1ca620f15 Add description and set correct name for GaugeDischargeCurveFacet
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4028
diff changeset
109
4164
8d3e8cb54e4c Add data for the gauge name to the GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4159
diff changeset
110 addData("gauge_name", new DefaultStateData("gauge_name",
8d3e8cb54e4c Add data for the gauge name to the GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4159
diff changeset
111 Resources.getMsg(callmeta,
8d3e8cb54e4c Add data for the gauge name to the GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4159
diff changeset
112 "facet.gauge_discharge_curve.gauge_name",
8d3e8cb54e4c Add data for the gauge name to the GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4159
diff changeset
113 "Name of the gauge"),
8d3e8cb54e4c Add data for the gauge name to the GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4159
diff changeset
114 "String", gaugename));
8d3e8cb54e4c Add data for the gauge name to the GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4159
diff changeset
115
4190
b87d76a6da70 The AT export needs a ld_locations data item
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4188
diff changeset
116 if (gaugelocation != null) {
b87d76a6da70 The AT export needs a ld_locations data item
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4188
diff changeset
117 addData("ld_locations", new DefaultStateData("ld_locations",
b87d76a6da70 The AT export needs a ld_locations data item
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4188
diff changeset
118 Resources.getMsg(callmeta,
b87d76a6da70 The AT export needs a ld_locations data item
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4188
diff changeset
119 "facet.gauge_discharge_curve.gauge_location",
b87d76a6da70 The AT export needs a ld_locations data item
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4188
diff changeset
120 "Location of the gauge"),
b87d76a6da70 The AT export needs a ld_locations data item
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4188
diff changeset
121 "Double", gaugelocation.toString()));
b87d76a6da70 The AT export needs a ld_locations data item
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4188
diff changeset
122 }
b87d76a6da70 The AT export needs a ld_locations data item
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4188
diff changeset
123
4032
a5e1ca620f15 Add description and set correct name for GaugeDischargeCurveFacet
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4028
diff changeset
124 String description = Resources.format(callmeta,
a5e1ca620f15 Add description and set correct name for GaugeDischargeCurveFacet
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4028
diff changeset
125 "facet.gauge_discharge_curve.description",
a5e1ca620f15 Add description and set correct name for GaugeDischargeCurveFacet
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4028
diff changeset
126 "Discharge curve on gauge",
a5e1ca620f15 Add description and set correct name for GaugeDischargeCurveFacet
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4028
diff changeset
127 rivername,
4034
46c1210be26b Set translated data descriptions
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4032
diff changeset
128 gaugename);
4032
a5e1ca620f15 Add description and set correct name for GaugeDischargeCurveFacet
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4028
diff changeset
129
4611
526fd442e0e5 Add pdf export to GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4586
diff changeset
130 List<Facet> fs = new ArrayList<Facet>(4);
4188
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
131 curvefacet = new GaugeDischargeCurveFacet(
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
132 GAUGE_DISCHARGE_CURVE_FACET, description);
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
133 fs.add(curvefacet);
3936
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
134
4188
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
135 description = Resources.format(callmeta,
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
136 "facet.gauge_discharge_curve_at_export.description",
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
137 "Discharge curve AT export on gauge",
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
138 rivername,
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
139 gaugename);
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
140 atexportfacet = new GaugeDischargeCurveFacet(
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
141 GAUGE_DISCHARGE_CURVE_AT_EXPORT_FACET, description);
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
142 fs.add(atexportfacet);
3936
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
143
4586
319565a48182 Add the csv export to the GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4305
diff changeset
144 description = Resources.format(callmeta,
319565a48182 Add the csv export to the GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4305
diff changeset
145 "facet.computed_dischargecurve_export.csv",
319565a48182 Add the csv export to the GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4305
diff changeset
146 "Discharge curve CSV export on gauge",
319565a48182 Add the csv export to the GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4305
diff changeset
147 rivername,
319565a48182 Add the csv export to the GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4305
diff changeset
148 gaugename);
319565a48182 Add the csv export to the GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4305
diff changeset
149 csvfacet = new GaugeDischargeCurveFacet(
319565a48182 Add the csv export to the GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4305
diff changeset
150 GAUGE_DISCHARGE_CURVE_CSV_FACET, description);
319565a48182 Add the csv export to the GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4305
diff changeset
151 fs.add(csvfacet);
319565a48182 Add the csv export to the GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4305
diff changeset
152
4611
526fd442e0e5 Add pdf export to GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4586
diff changeset
153 description = Resources.format(callmeta,
526fd442e0e5 Add pdf export to GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4586
diff changeset
154 "facet.computed_dischargecurve_export.pdf",
526fd442e0e5 Add pdf export to GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4586
diff changeset
155 "Discharge curve PDF export on gauge",
526fd442e0e5 Add pdf export to GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4586
diff changeset
156 rivername,
526fd442e0e5 Add pdf export to GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4586
diff changeset
157 gaugename);
526fd442e0e5 Add pdf export to GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4586
diff changeset
158 pdffacet = new GaugeDischargeCurveFacet(
526fd442e0e5 Add pdf export to GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4586
diff changeset
159 GAUGE_DISCHARGE_CURVE_PDF_FACET, description);
526fd442e0e5 Add pdf export to GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4586
diff changeset
160 fs.add(pdffacet);
526fd442e0e5 Add pdf export to GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4586
diff changeset
161
3936
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
162 addFacets(STATIC_STATE_NAME, fs);
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
163
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
164 super.setup(identifier, factory, context, callmeta, data);
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
165 }
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
166
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
167 @Override
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
168 public String getName() {
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
169 return NAME;
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
170 }
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
171
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
172 @Override
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
173 protected void initStaticState() {
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
174 StaticState state = new StaticState(STATIC_STATE_NAME);
4188
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
175
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
176 List<Facet> fs = new ArrayList<Facet>(1);
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
177 fs.add(curvefacet);
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
178
3936
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
179 DefaultOutput output = new DefaultOutput(
4188
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
180 GAUGE_DISCHARGE_CURVE_OUT,
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
181 "output.discharge_curve",
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
182 "image/png",
3936
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
183 fs,
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
184 "chart");
4188
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
185 state.addOutput(output);
3936
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
186
4188
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
187 fs = new ArrayList<Facet>(1);
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
188 fs.add(atexportfacet);
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
189 output = new DefaultOutput(
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
190 GAUGE_DISCHARGE_CURVE_AT_EXPORT_OUT,
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
191 "output.computed_dischargecurve_at_export",
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
192 "text/plain",
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
193 fs,
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
194 "export");
3936
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
195 state.addOutput(output);
4188
dc4087088c0b Add a new outputmode for an at export in GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4186
diff changeset
196
4611
526fd442e0e5 Add pdf export to GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4586
diff changeset
197 fs = new ArrayList<Facet>(2);
4586
319565a48182 Add the csv export to the GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4305
diff changeset
198 fs.add(csvfacet);
4611
526fd442e0e5 Add pdf export to GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4586
diff changeset
199 fs.add(pdffacet);
4586
319565a48182 Add the csv export to the GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4305
diff changeset
200 output = new DefaultOutput(
4611
526fd442e0e5 Add pdf export to GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4586
diff changeset
201 GAUGE_DISCHARGE_CURVE_EXPORT_OUT,
4586
319565a48182 Add the csv export to the GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4305
diff changeset
202 "output.computed_dischargecurve_export",
319565a48182 Add the csv export to the GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4305
diff changeset
203 "text/plain",
319565a48182 Add the csv export to the GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4305
diff changeset
204 fs,
319565a48182 Add the csv export to the GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4305
diff changeset
205 "export");
319565a48182 Add the csv export to the GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4305
diff changeset
206 state.addOutput(output);
319565a48182 Add the csv export to the GaugeDischargeCurveArtifact
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4305
diff changeset
207
4159
bbae306fcb4f Set uiprovider on the state
Björn Ricks <bjoern.ricks@intevation.de>
parents: 4034
diff changeset
208 state.setUIProvider(UIPROVIDER);
3936
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
209 setStaticState(state);
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
210 }
4e1b3b4ef132 Add new Artifacts and State for displaying discharge curves at a gauge
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
211 }

http://dive4elements.wald.intevation.org