changeset 4188:dc4087088c0b

Add a new outputmode for an at export in GaugeDischargeCurveArtifact The data provided by the GaugeDischargeCurveArtifact can be used for displaying a curve and also for an at file. Therefore provide another output mode that for a at export.
author Björn Ricks <bjoern.ricks@intevation.de>
date Fri, 19 Oct 2012 13:28:24 +0200
parents 21f4e4b79121
children 84ea5f5d84fe
files flys-artifacts/doc/conf/artifacts/gaugedischargecurve.xml flys-artifacts/src/main/java/de/intevation/flys/artifacts/GaugeDischargeCurveArtifact.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java
diffstat 3 files changed, 46 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/doc/conf/artifacts/gaugedischargecurve.xml	Fri Oct 19 13:25:49 2012 +0200
+++ b/flys-artifacts/doc/conf/artifacts/gaugedischargecurve.xml	Fri Oct 19 13:28:24 2012 +0200
@@ -11,6 +11,11 @@
                         <facet name="gauge_discharge_curve"/>
                     </facets>
                 </outputmode>
+                <outputmode name="computed_dischargecurve_at_export" description="output.computed_dischargecurve_at_export" mime-type="text/plain" type="export">
+                    <facets>
+                        <facet name="gauge_discharge_curve_at_export" description="facet.gauge_discharge_curve_export.at"/>
+                    </facets>
+                </outputmode>
             </outputmodes>
          </state>
     </states>
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/GaugeDischargeCurveArtifact.java	Fri Oct 19 13:25:49 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/GaugeDischargeCurveArtifact.java	Fri Oct 19 13:28:24 2012 +0200
@@ -42,6 +42,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
@@ -94,10 +105,19 @@
                 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 +132,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);
     }
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java	Fri Oct 19 13:25:49 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java	Fri Oct 19 13:28:24 2012 +0200
@@ -180,6 +180,7 @@
 
     String DISCHARGE_CURVE = "discharge_curve.curve";
     String GAUGE_DISCHARGE_CURVE = "gauge_discharge_curve";
+    String GAUGE_DISCHARGE_CURVE_AT_EXPORT = "gauge_discharge_curve_at_export";
 
     String DURATION_W = "duration_curve.w";
     String DURATION_Q = "duration_curve.q";

http://dive4elements.wald.intevation.org