Mercurial > dive4elements > gnv-client
comparison gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileOutputState.java @ 740:0563389138bb
Changed source of displayed coordinate in 'HorizontalProfil'-charts' subtitle (issue120).
gnv-artifacts/trunk@779 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Mon, 15 Mar 2010 15:39:59 +0000 |
parents | d9d933e06875 |
children | b3f922908a31 |
comparison
equal
deleted
inserted
replaced
739:a40a6de70459 | 740:0563389138bb |
---|---|
1 /** | |
2 * | |
3 */ | |
4 package de.intevation.gnv.state.profile.horizontal; | 1 package de.intevation.gnv.state.profile.horizontal; |
5 | |
6 import com.vividsolutions.jts.io.ParseException; | |
7 import com.vividsolutions.jts.io.WKTReader; | |
8 | 2 |
9 import de.intevation.artifacts.CallContext; | 3 import de.intevation.artifacts.CallContext; |
10 | 4 |
11 import de.intevation.gnv.chart.Chart; | 5 import de.intevation.gnv.chart.Chart; |
12 import de.intevation.gnv.chart.ChartLabels; | 6 import de.intevation.gnv.chart.ChartLabels; |
23 | 17 |
24 import de.intevation.gnv.state.describedata.KeyValueDescibeData; | 18 import de.intevation.gnv.state.describedata.KeyValueDescibeData; |
25 | 19 |
26 import de.intevation.gnv.state.exception.StateException; | 20 import de.intevation.gnv.state.exception.StateException; |
27 | 21 |
22 import de.intevation.gnv.state.InputData; | |
23 | |
28 import de.intevation.gnv.state.timeseries.TimeSeriesOutputState; | 24 import de.intevation.gnv.state.timeseries.TimeSeriesOutputState; |
29 | 25 |
30 import de.intevation.gnv.statistics.HorizontalProfileStatistics; | 26 import de.intevation.gnv.statistics.HorizontalProfileStatistics; |
31 import de.intevation.gnv.statistics.Statistics; | 27 import de.intevation.gnv.statistics.Statistics; |
32 | 28 |
29 import de.intevation.gnv.utils.InputValidator; | |
33 import de.intevation.gnv.utils.WKTUtils; | 30 import de.intevation.gnv.utils.WKTUtils; |
34 | 31 |
35 import java.io.IOException; | 32 import java.io.IOException; |
36 import java.io.OutputStream; | 33 import java.io.OutputStream; |
37 import java.io.UnsupportedEncodingException; | 34 import java.io.UnsupportedEncodingException; |
38 | 35 |
36 import java.text.ParseException; | |
39 import java.text.SimpleDateFormat; | 37 import java.text.SimpleDateFormat; |
40 | 38 |
41 import java.util.Collection; | 39 import java.util.Collection; |
42 import java.util.Date; | 40 import java.util.Date; |
43 import java.util.Iterator; | 41 import java.util.Iterator; |
47 | 45 |
48 import org.jfree.chart.ChartTheme; | 46 import org.jfree.chart.ChartTheme; |
49 | 47 |
50 /** | 48 /** |
51 * @author Tim Englich (tim.englich@intevation.de) | 49 * @author Tim Englich (tim.englich@intevation.de) |
50 * @author Ingo Weinzierl (ingo.weinzierl@intevation.de) | |
52 */ | 51 */ |
53 public class HorizontalProfileOutputState | 52 public class HorizontalProfileOutputState |
54 extends TimeSeriesOutputState | 53 extends TimeSeriesOutputState |
55 { | 54 { |
56 public static final String [] HORIZONTAL_PROFILE_COLUMNS = { | 55 public static final String [] HORIZONTAL_PROFILE_COLUMNS = { |
255 log.debug("Fetch meta information and put it into subtitle."); | 254 log.debug("Fetch meta information and put it into subtitle."); |
256 if (result == null) | 255 if (result == null) |
257 return ""; | 256 return ""; |
258 | 257 |
259 StringBuilder meta = new StringBuilder(); | 258 StringBuilder meta = new StringBuilder(); |
260 WKTReader wktReader = new WKTReader(); | |
261 | |
262 | 259 |
263 for (int i = 0; i < CHART_TITLE_META.length; i++) { | 260 for (int i = 0; i < CHART_TITLE_META.length; i++) { |
264 String qry = CHART_TITLE_META[i]; | 261 String qry = CHART_TITLE_META[i]; |
265 | 262 |
266 if (qry.equals("SHAPE")) { | 263 if (qry.equals("SHAPE")) { |
267 String wktPoint = result.getString(qry); | 264 try { |
268 | 265 InputData data = getInputDataByName("mesh_coordinate"); |
269 meta.append(getMessage(locale,"coordinate","coordinate")); | 266 if (data == null) { |
270 meta.append(": "); | 267 continue; |
271 meta.append(WKTUtils.toText(wktPoint)); | 268 } |
269 String wktPoint = data.getValue(); | |
270 meta.append(getMessage(locale,"coordinate","coordinate")); | |
271 meta.append(": "); | |
272 meta.append(WKTUtils.toText( | |
273 locale, | |
274 new InputValidator().getPointValue(wktPoint))); | |
275 } | |
276 catch (Exception e) { | |
277 log.error(e, e); | |
278 } | |
272 } | 279 } |
273 else { | 280 else { |
274 log.debug( | 281 log.debug( |
275 "Add " + qry + " to meta information of subtitle: " | 282 "Add " + qry + " to meta information of subtitle: " |
276 + result.getString(qry) | 283 + result.getString(qry) |
328 } | 335 } |
329 else if (time > endDate.getTime()) { | 336 else if (time > endDate.getTime()) { |
330 endDate = current; | 337 endDate = current; |
331 } | 338 } |
332 } | 339 } |
333 catch (java.text.ParseException pe) { | 340 catch (ParseException pe) { |
334 log.warn("Error while parsing date: " + data.getValue(), pe); | 341 log.warn("Error while parsing date: " + data.getValue(), pe); |
335 } | 342 } |
336 } | 343 } |
337 | 344 |
338 if (startDate != null && endDate != null) | 345 if (startDate != null && endDate != null) |