Mercurial > dive4elements > river
diff flys-client/src/main/java/de/intevation/flys/client/server/GFIServiceImpl.java @ 5794:af2aa716152f
Fix issue1254, make GetFeatureInfo work reliably
This reduced GetFeatureInfo to one request per layer and chooses
the layer based on the selected theme
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Tue, 23 Apr 2013 17:14:07 +0200 |
parents | 30c7f8f9f1b7 |
children | a4ff4167be1e |
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/server/GFIServiceImpl.java Tue Apr 23 15:32:22 2013 +0200 +++ b/flys-client/src/main/java/de/intevation/flys/client/server/GFIServiceImpl.java Tue Apr 23 17:14:07 2013 +0200 @@ -47,7 +47,7 @@ /** - * @param themes + * @param theme * @param format * @param bbox * @param height @@ -58,7 +58,7 @@ * @return */ public List<FeatureInfo> query( - List<Theme> themes, + Theme theme, String format, String bbox, String projection, @@ -71,7 +71,7 @@ logger.info("GFIServiceImpl.query"); String path = createGetFeautureInfoURL( - themes, format, bbox, projection, height, width, x, y); + theme, format, bbox, projection, height, width, x, y); logger.debug("URL=" + path); @@ -96,7 +96,7 @@ /** * @param map - * @param themes + * @param theme * @param format * @param x * @param y @@ -104,7 +104,7 @@ * @return */ protected String createGetFeautureInfoURL( - List<Theme> themes, + Theme theme, String infoFormat, String bbox, String projection, @@ -114,13 +114,13 @@ int y ) throws ServerException { - String url = getUrl(themes); + String url = getUrl(theme); if (url == null || url.length() == 0) { throw new ServerException(ERR_NO_VALID_GFI_URL); } - String layers = createLayersString(themes); + String layers = ((AttributedTheme)theme).getAttr("layers"); StringBuilder sb = new StringBuilder(); sb.append(url); @@ -149,36 +149,13 @@ } - protected String getUrl(List<Theme> themes) { - for (Theme t: themes) { - AttributedTheme attr = (AttributedTheme) t; - - if (attr.getAttrAsBoolean("queryable")) { - return attr.getAttr("url"); - } - } - - return null; - } - + protected String getUrl(Theme theme) { + AttributedTheme attr = (AttributedTheme) theme; - protected String createLayersString(List<Theme> themes) { - StringBuilder sb = new StringBuilder(); - boolean first = true; - - for (Theme theme: themes) { - AttributedTheme layer = (AttributedTheme) theme; - if (layer.getAttrAsBoolean("queryable")) { - if (!first) { - sb.append(","); - } - - sb.append(layer.getAttr("layers")); - first = false; - } + if (attr.getAttrAsBoolean("queryable")) { + return attr.getAttr("url"); } - - return sb.toString(); + return null; }