Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/exports/ChartGenerator.java @ 3078:0e0efd1acb4f
Added getter for current km in chart generator (used for navigation in fix
analysis charts).
flys-artifacts/trunk@4674 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Fri, 15 Jun 2012 12:16:49 +0000 |
parents | 57d6670ddda3 |
children | 960307cf2adc |
comparison
equal
deleted
inserted
replaced
3077:5c87d4ca1bd3 | 3078:0e0efd1acb4f |
---|---|
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 | |
97 | 100 |
98 /** The document of the incoming out() request.*/ | 101 /** The document of the incoming out() request.*/ |
99 protected Document request; | 102 protected Document request; |
100 | 103 |
101 /** The output stream where the data should be written to.*/ | 104 /** The output stream where the data should be written to.*/ |
1077 | 1080 |
1078 return new String[] { lower, upper }; | 1081 return new String[] { lower, upper }; |
1079 } | 1082 } |
1080 | 1083 |
1081 | 1084 |
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 | |
1082 /** | 1109 /** |
1083 * Returns the default size of a chart export as array. | 1110 * Returns the default size of a chart export as array. |
1084 * | 1111 * |
1085 * @return the default size of a chart as [width, height]. | 1112 * @return the default size of a chart as [width, height]. |
1086 */ | 1113 */ |