Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/exports/ChartGenerator.java @ 1944:21a4d2c677a1
Changed doOut signature, side effect from blackboard feature (to come).
flys-artifacts/trunk@3334 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 30 Nov 2011 10:10:42 +0000 |
parents | 41ba2276d785 |
children | 65f9d707caff |
comparison
equal
deleted
inserted
replaced
1943:06d8d371d244 | 1944:21a4d2c677a1 |
---|---|
24 import de.intevation.artifactdatabase.state.Facet; | 24 import de.intevation.artifactdatabase.state.Facet; |
25 | 25 |
26 import de.intevation.flys.model.River; | 26 import de.intevation.flys.model.River; |
27 | 27 |
28 import de.intevation.flys.artifacts.WINFOArtifact; | 28 import de.intevation.flys.artifacts.WINFOArtifact; |
29 import de.intevation.artifactdatabase.state.ArtifactAndFacet; | |
29 | 30 |
30 import de.intevation.flys.artifacts.resources.Resources; | 31 import de.intevation.flys.artifacts.resources.Resources; |
31 import de.intevation.flys.utils.FLYSUtils; | 32 import de.intevation.flys.utils.FLYSUtils; |
32 | 33 |
33 | 34 |
181 ? DEFAULT_CHART_FORMAT | 182 ? DEFAULT_CHART_FORMAT |
182 : format; | 183 : format; |
183 } | 184 } |
184 | 185 |
185 | 186 |
187 /** | |
188 * Get Range of Domain ("X"-) Axis from request. | |
189 */ | |
186 protected Range getDomainAxisRange() { | 190 protected Range getDomainAxisRange() { |
187 Element xrange = (Element)XMLUtils.xpath( | 191 Element xrange = (Element)XMLUtils.xpath( |
188 request, | 192 request, |
189 XPATH_CHART_X_RANGE, | 193 XPATH_CHART_X_RANGE, |
190 XPathConstants.NODE, | 194 XPathConstants.NODE, |
196 | 200 |
197 String uri = ArtifactNamespaceContext.NAMESPACE_URI; | 201 String uri = ArtifactNamespaceContext.NAMESPACE_URI; |
198 | 202 |
199 String lower = xrange.getAttributeNS(uri, "from"); | 203 String lower = xrange.getAttributeNS(uri, "from"); |
200 String upper = xrange.getAttributeNS(uri, "to"); | 204 String upper = xrange.getAttributeNS(uri, "to"); |
201 | |
202 logger.debug("FOUND X RANGE: " + lower + " -> " + upper); | |
203 | 205 |
204 if (lower.length() > 0 && upper.length() > 0) { | 206 if (lower.length() > 0 && upper.length() > 0) { |
205 try { | 207 try { |
206 double from = Double.parseDouble(lower); | 208 double from = Double.parseDouble(lower); |
207 double to = Double.parseDouble(upper); | 209 double to = Double.parseDouble(upper); |
237 | 239 |
238 if (yrange == null) { | 240 if (yrange == null) { |
239 return null; | 241 return null; |
240 } | 242 } |
241 | 243 |
244 | |
242 String uri = ArtifactNamespaceContext.NAMESPACE_URI; | 245 String uri = ArtifactNamespaceContext.NAMESPACE_URI; |
246 | |
243 | 247 |
244 String lower = yrange.getAttributeNS(uri, "from"); | 248 String lower = yrange.getAttributeNS(uri, "from"); |
245 String upper = yrange.getAttributeNS(uri, "to"); | 249 String upper = yrange.getAttributeNS(uri, "to"); |
246 | 250 |
247 if (lower.length() > 0 && upper.length() > 0) { | 251 if (lower.length() > 0 && upper.length() > 0) { |
252 if (from == 0 && to == 0) { | 256 if (from == 0 && to == 0) { |
253 logger.debug("No range specified. Lower and upper Y == 0"); | 257 logger.debug("No range specified. Lower and upper Y == 0"); |
254 return null; | 258 return null; |
255 } | 259 } |
256 | 260 |
257 if (from > to) { | 261 return from > to |
258 double tmp = to; | 262 ? new Range(to, from) |
259 to = from; | 263 : new Range(from, to); |
260 from = tmp; | |
261 } | |
262 | |
263 return new Range(from, to); | |
264 } | 264 } |
265 catch (NumberFormatException nfe) { | 265 catch (NumberFormatException nfe) { |
266 logger.warn("Wrong values for value axis range."); | 266 logger.warn("Wrong values for value axis range."); |
267 } | 267 } |
268 } | 268 } |
280 return new int[] { DEFAULT_CHART_WIDTH, DEFAULT_CHART_HEIGHT }; | 280 return new int[] { DEFAULT_CHART_WIDTH, DEFAULT_CHART_HEIGHT }; |
281 } | 281 } |
282 | 282 |
283 | 283 |
284 public abstract void doOut( | 284 public abstract void doOut( |
285 Artifact artifact, | 285 ArtifactAndFacet bundle, |
286 Facet facet, | |
287 Document attr, | 286 Document attr, |
288 boolean visible); | 287 boolean visible); |
289 | 288 |
290 public abstract void generate() throws IOException; | 289 public abstract void generate() throws IOException; |
291 } | 290 } |