Mercurial > dive4elements > river
diff flys-client/src/main/java/de/intevation/flys/client/client/ui/map/GetFeatureInfo.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 | 46fc11ad697f |
children | e0ab5a566688 |
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/GetFeatureInfo.java Tue Apr 23 15:32:22 2013 +0200 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/GetFeatureInfo.java Tue Apr 23 17:14:07 2013 +0200 @@ -6,6 +6,7 @@ import com.google.gwt.user.client.rpc.AsyncCallback; import com.smartgwt.client.util.SC; +import com.smartgwt.client.widgets.grid.ListGridRecord; import org.gwtopenmaps.openlayers.client.Map; import org.gwtopenmaps.openlayers.client.LonLat; @@ -17,6 +18,8 @@ import de.intevation.flys.client.client.FLYSConstants; import de.intevation.flys.client.client.services.GFIService; import de.intevation.flys.client.client.services.GFIServiceAsync; +import de.intevation.flys.client.shared.model.FacetRecord; +import de.intevation.flys.client.shared.model.Theme; import de.intevation.flys.client.client.ui.ThemePanel; @@ -71,22 +74,34 @@ LonLat lonlat = e.getLonLat(); Pixel pixel = map.getPixelFromLonLat(lonlat); - gfiService.query( - themePanel.getThemeList().getActiveThemes(), - infoFormat, - map.getExtent().toString(), - map.getProjection(), - (int) map.getSize().getHeight(), - (int) map.getSize().getWidth(), - pixel.x(), pixel.y(), - new AsyncCallback<List<FeatureInfo>>() { - public void onFailure(Throwable e) { - SC.warn(MSG.getString(e.getMessage())); - } + if (themePanel.getSelectedRecords().length == 0) { + SC.say(MSG.requireTheme()); + } - public void onSuccess(List<FeatureInfo> features) { - newGetFeatureInfoWindow(features); - } - }); + for (ListGridRecord rec : themePanel.getSelectedRecords()) { + Theme act_theme = ((FacetRecord)rec).getTheme(); + gfiService.query( + act_theme, + infoFormat, + map.getExtent().toString(), + map.getProjection(), + (int) map.getSize().getHeight(), + (int) map.getSize().getWidth(), + pixel.x(), pixel.y(), + new AsyncCallback<List<FeatureInfo>>() { + @Override + public void onFailure(Throwable e) { + SC.warn(MSG.getString(e.getMessage())); + } + + @Override + public void onSuccess(List<FeatureInfo> features) { + if (features != null && !features.isEmpty()) + newGetFeatureInfoWindow(features); + } + } + ); + break; // More intelligent handling when more then one is selected + } } }