Mercurial > dive4elements > river
diff flys-artifacts/src/main/java/de/intevation/flys/artifacts/GaugeDischargeCurveArtifact.java @ 4211:47b7325eafeb
merged
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Mon, 22 Oct 2012 17:07:02 +0200 |
parents | b87d76a6da70 |
children | 8c51c43e59ca |
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/GaugeDischargeCurveArtifact.java Mon Oct 22 09:10:40 2012 +0200 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/GaugeDischargeCurveArtifact.java Mon Oct 22 17:07:02 2012 +0200 @@ -1,5 +1,6 @@ package de.intevation.flys.artifacts; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; @@ -42,6 +43,17 @@ public static final String NAME = "gaugedischargecurve"; public static final String STATIC_STATE_NAME = "state.gaugedischargecurve.static"; public static final String UIPROVIDER = "gauge_discharge_curve"; + public static final String GAUGE_DISCHARGE_CURVE_FACET = + "gauge_discharge_curve"; + public static final String GAUGE_DISCHARGE_CURVE_AT_EXPORT_FACET = + "gauge_discharge_curve_at_export"; + public static final String GAUGE_DISCHARGE_CURVE_OUT = + "discharge_curve"; + public static final String GAUGE_DISCHARGE_CURVE_AT_EXPORT_OUT = + "computed_dischargecurve_at_export"; + + private Facet atexportfacet; + private Facet curvefacet; /** * Setup initializes the data by extracting the river and gauge from @@ -74,12 +86,17 @@ Resources.getMsg(callmeta, "facet.gauge_discharge_curve.reference_gauge", "Gauge official number"), - "Double", gaugeref)); + "Long", gaugeref)); Gauge gauge = FLYSUtils.getReferenceGauge(this); String gaugename = ""; + Double gaugelocation = null; if (gauge != null) { gaugename = gauge.getName(); + BigDecimal station = gauge.getStation(); + if (station != null) { + gaugelocation = station.doubleValue(); + } } addData("gauge_name", new DefaultStateData("gauge_name", @@ -88,16 +105,33 @@ "Name of the gauge"), "String", gaugename)); + if (gaugelocation != null) { + addData("ld_locations", new DefaultStateData("ld_locations", + Resources.getMsg(callmeta, + "facet.gauge_discharge_curve.gauge_location", + "Location of the gauge"), + "Double", gaugelocation.toString())); + } + String description = Resources.format(callmeta, "facet.gauge_discharge_curve.description", "Discharge curve on gauge", rivername, gaugename); - Facet gfacet = new GaugeDischargeCurveFacet(description); + List<Facet> fs = new ArrayList<Facet>(2); + curvefacet = new GaugeDischargeCurveFacet( + GAUGE_DISCHARGE_CURVE_FACET, description); + fs.add(curvefacet); - List<Facet> fs = new ArrayList<Facet>(1); - fs.add(gfacet); + description = Resources.format(callmeta, + "facet.gauge_discharge_curve_at_export.description", + "Discharge curve AT export on gauge", + rivername, + gaugename); + atexportfacet = new GaugeDischargeCurveFacet( + GAUGE_DISCHARGE_CURVE_AT_EXPORT_FACET, description); + fs.add(atexportfacet); addFacets(STATIC_STATE_NAME, fs); @@ -112,14 +146,28 @@ @Override protected void initStaticState() { StaticState state = new StaticState(STATIC_STATE_NAME); - List<Facet> fs = facets.get(STATIC_STATE_NAME); + + List<Facet> fs = new ArrayList<Facet>(1); + fs.add(curvefacet); + DefaultOutput output = new DefaultOutput( - "discharge_curve", - "output.discharge_curve", "image/png", + GAUGE_DISCHARGE_CURVE_OUT, + "output.discharge_curve", + "image/png", fs, "chart"); + state.addOutput(output); + fs = new ArrayList<Facet>(1); + fs.add(atexportfacet); + output = new DefaultOutput( + GAUGE_DISCHARGE_CURVE_AT_EXPORT_OUT, + "output.computed_dischargecurve_at_export", + "text/plain", + fs, + "export"); state.addOutput(output); + state.setUIProvider(UIPROVIDER); setStaticState(state); }