Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/GaugeDischargeCurveArtifact.java @ 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 | eba517419832 |
children | b87d76a6da70 |
comparison
equal
deleted
inserted
replaced
4187:21f4e4b79121 | 4188:dc4087088c0b |
---|---|
40 public static final String XPATH_RIVER = "/art:action/art:river/@art:name"; | 40 public static final String XPATH_RIVER = "/art:action/art:river/@art:name"; |
41 public static final String XPATH_GAUGE = "/art:action/art:gauge/@art:reference"; | 41 public static final String XPATH_GAUGE = "/art:action/art:gauge/@art:reference"; |
42 public static final String NAME = "gaugedischargecurve"; | 42 public static final String NAME = "gaugedischargecurve"; |
43 public static final String STATIC_STATE_NAME = "state.gaugedischargecurve.static"; | 43 public static final String STATIC_STATE_NAME = "state.gaugedischargecurve.static"; |
44 public static final String UIPROVIDER = "gauge_discharge_curve"; | 44 public static final String UIPROVIDER = "gauge_discharge_curve"; |
45 public static final String GAUGE_DISCHARGE_CURVE_FACET = | |
46 "gauge_discharge_curve"; | |
47 public static final String GAUGE_DISCHARGE_CURVE_AT_EXPORT_FACET = | |
48 "gauge_discharge_curve_at_export"; | |
49 public static final String GAUGE_DISCHARGE_CURVE_OUT = | |
50 "discharge_curve"; | |
51 public static final String GAUGE_DISCHARGE_CURVE_AT_EXPORT_OUT = | |
52 "computed_dischargecurve_at_export"; | |
53 | |
54 private Facet atexportfacet; | |
55 private Facet curvefacet; | |
45 | 56 |
46 /** | 57 /** |
47 * Setup initializes the data by extracting the river and gauge from | 58 * Setup initializes the data by extracting the river and gauge from |
48 * the XML Document. | 59 * the XML Document. |
49 */ | 60 */ |
92 "facet.gauge_discharge_curve.description", | 103 "facet.gauge_discharge_curve.description", |
93 "Discharge curve on gauge", | 104 "Discharge curve on gauge", |
94 rivername, | 105 rivername, |
95 gaugename); | 106 gaugename); |
96 | 107 |
97 Facet gfacet = new GaugeDischargeCurveFacet(description); | 108 List<Facet> fs = new ArrayList<Facet>(2); |
109 curvefacet = new GaugeDischargeCurveFacet( | |
110 GAUGE_DISCHARGE_CURVE_FACET, description); | |
111 fs.add(curvefacet); | |
98 | 112 |
99 List<Facet> fs = new ArrayList<Facet>(1); | 113 description = Resources.format(callmeta, |
100 fs.add(gfacet); | 114 "facet.gauge_discharge_curve_at_export.description", |
115 "Discharge curve AT export on gauge", | |
116 rivername, | |
117 gaugename); | |
118 atexportfacet = new GaugeDischargeCurveFacet( | |
119 GAUGE_DISCHARGE_CURVE_AT_EXPORT_FACET, description); | |
120 fs.add(atexportfacet); | |
101 | 121 |
102 addFacets(STATIC_STATE_NAME, fs); | 122 addFacets(STATIC_STATE_NAME, fs); |
103 | 123 |
104 super.setup(identifier, factory, context, callmeta, data); | 124 super.setup(identifier, factory, context, callmeta, data); |
105 } | 125 } |
110 } | 130 } |
111 | 131 |
112 @Override | 132 @Override |
113 protected void initStaticState() { | 133 protected void initStaticState() { |
114 StaticState state = new StaticState(STATIC_STATE_NAME); | 134 StaticState state = new StaticState(STATIC_STATE_NAME); |
115 List<Facet> fs = facets.get(STATIC_STATE_NAME); | 135 |
136 List<Facet> fs = new ArrayList<Facet>(1); | |
137 fs.add(curvefacet); | |
138 | |
116 DefaultOutput output = new DefaultOutput( | 139 DefaultOutput output = new DefaultOutput( |
117 "discharge_curve", | 140 GAUGE_DISCHARGE_CURVE_OUT, |
118 "output.discharge_curve", "image/png", | 141 "output.discharge_curve", |
142 "image/png", | |
119 fs, | 143 fs, |
120 "chart"); | 144 "chart"); |
145 state.addOutput(output); | |
121 | 146 |
147 fs = new ArrayList<Facet>(1); | |
148 fs.add(atexportfacet); | |
149 output = new DefaultOutput( | |
150 GAUGE_DISCHARGE_CURVE_AT_EXPORT_OUT, | |
151 "output.computed_dischargecurve_at_export", | |
152 "text/plain", | |
153 fs, | |
154 "export"); | |
122 state.addOutput(output); | 155 state.addOutput(output); |
156 | |
123 state.setUIProvider(UIPROVIDER); | 157 state.setUIProvider(UIPROVIDER); |
124 setStaticState(state); | 158 setStaticState(state); |
125 } | 159 } |
126 } | 160 } |