Mercurial > dive4elements > river
diff flys-client/src/main/java/de/intevation/flys/client/server/ChartOutputServiceImpl.java @ 542:7c57149e8715
Append the x and y ranges determined after zooming with the ZoomboxControl to the attribute document used for the chart creation.
flys-client/trunk@2045 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 03 Jun 2011 06:34:32 +0000 |
parents | 8ea213bd8fba |
children | e74bf6bfeeb6 |
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/server/ChartOutputServiceImpl.java Wed Jun 01 14:13:29 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/server/ChartOutputServiceImpl.java Fri Jun 03 06:34:32 2011 +0000 @@ -82,7 +82,13 @@ ArtifactNamespaceContext.NAMESPACE_URI, ArtifactNamespaceContext.NAMESPACE_PREFIX); - appendChartSize(req, doc, ec); + Element attributes = ec.create("attributes"); + + appendChartSize(req, attributes, ec); + appendXRange(req, attributes, ec); + appendYRange(req, attributes, ec); + + doc.appendChild(attributes); return doc; } @@ -94,12 +100,12 @@ * document used to adjust chart settings. * * @param req The request object that might contain the chart size. - * @param doc The attribute document used to adjust chart settings. + * @param attributes The attributes element used to adjust chart settings. * @param ec The ElementCreator that might be used to create new Elements. */ protected void appendChartSize( HttpServletRequest req, - Document doc, + Element attributes, ElementCreator ec) { Element size = ec.create("size"); @@ -115,7 +121,63 @@ ec.addAttr(size, "width", width, true); ec.addAttr(size, "height", height, true); - doc.appendChild(size); + attributes.appendChild(size); + } + + + /** + * This method extracts the x range for the chart from request object and + * appends those range - if it exists - to the attribute document used to + * adjust the chart settings. + * + * @param req The request object that might contain the chart size. + * @param doc The attribute document used to adjust chart settings. + * @param ec The ElementCreator that might be used to create new Elements. + */ + protected void appendXRange( + HttpServletRequest req, + Element attributes, + ElementCreator ec) + { + Element range = ec.create("xrange"); + + String from = req.getParameter("minx"); + String to = req.getParameter("maxx"); + + if (from != null && to != null) { + ec.addAttr(range, "from", from, true); + ec.addAttr(range, "to", to, true); + + attributes.appendChild(range); + } + } + + + /** + * This method extracts the x range for the chart from request object and + * appends those range - if it exists - to the attribute document used to + * adjust the chart settings. + * + * @param req The request object that might contain the chart size. + * @param doc The attribute document used to adjust chart settings. + * @param ec The ElementCreator that might be used to create new Elements. + */ + protected void appendYRange( + HttpServletRequest req, + Element attributes, + ElementCreator ec) + { + Element range = ec.create("yrange"); + + String from = req.getParameter("miny"); + String to = req.getParameter("maxy"); + + if (from != null && to != null) { + ec.addAttr(range, "from", from, true); + ec.addAttr(range, "to", to, true); + + attributes.appendChild(range); + } } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :