comparison flys-artifacts/src/main/java/de/intevation/flys/exports/ChartGenerator.java @ 3088:960307cf2adc

Moved current km to context and added an abstract generator for fix analysis charts. flys-artifacts/trunk@4686 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Raimund Renkert <raimund.renkert@intevation.de>
date Mon, 18 Jun 2012 11:21:30 +0000
parents 0e0efd1acb4f
children 5a0aef74c316
comparison
equal deleted inserted replaced
3087:4a76da133144 3088:960307cf2adc
92 "/art:action/art:attributes/art:xrange"; 92 "/art:action/art:attributes/art:xrange";
93 93
94 public static final String XPATH_CHART_Y_RANGE = 94 public static final String XPATH_CHART_Y_RANGE =
95 "/art:action/art:attributes/art:yrange"; 95 "/art:action/art:attributes/art:yrange";
96 96
97 public static final String XPATH_CHART_CURRENTKM =
98 "/art:action/art:attributes/art:currentKm";
99
100 97
101 /** The document of the incoming out() request.*/ 98 /** The document of the incoming out() request.*/
102 protected Document request; 99 protected Document request;
103 100
104 /** The output stream where the data should be written to.*/ 101 /** The output stream where the data should be written to.*/
1080 1077
1081 return new String[] { lower, upper }; 1078 return new String[] { lower, upper };
1082 } 1079 }
1083 1080
1084 1081
1085 public double getCurrentKmFromRequest() {
1086 Element km = (Element)XMLUtils.xpath(
1087 request,
1088 XPATH_CHART_CURRENTKM,
1089 XPathConstants.NODE,
1090 ArtifactNamespaceContext.INSTANCE);
1091
1092 if (km == null) {
1093 return -1d;
1094 }
1095
1096 String uri = ArtifactNamespaceContext.NAMESPACE_URI;
1097
1098 String currentKm = km.getAttributeNS(uri, "km");
1099 try {
1100 double d = Double.valueOf(currentKm).doubleValue();
1101 return d;
1102 }
1103 catch(NumberFormatException nfe) {
1104 return -1d;
1105 }
1106 }
1107
1108
1109 /** 1082 /**
1110 * Returns the default size of a chart export as array. 1083 * Returns the default size of a chart export as array.
1111 * 1084 *
1112 * @return the default size of a chart as [width, height]. 1085 * @return the default size of a chart as [width, height].
1113 */ 1086 */

http://dive4elements.wald.intevation.org