Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/map/GetFeatureInfo.java @ 5818:a4ff4167be1e
Request feature info on all layers and show it as html if
the server does not return valid gml.
Non queryable layers produce an error message when the request
fails. This is good enough
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Wed, 24 Apr 2013 17:33:27 +0200 |
parents | e0ab5a566688 |
children |
comparison
equal
deleted
inserted
replaced
5817:a1dd784d8b07 | 5818:a4ff4167be1e |
---|---|
19 import de.intevation.flys.client.client.services.GFIService; | 19 import de.intevation.flys.client.client.services.GFIService; |
20 import de.intevation.flys.client.client.services.GFIServiceAsync; | 20 import de.intevation.flys.client.client.services.GFIServiceAsync; |
21 import de.intevation.flys.client.shared.model.FacetRecord; | 21 import de.intevation.flys.client.shared.model.FacetRecord; |
22 import de.intevation.flys.client.shared.model.Theme; | 22 import de.intevation.flys.client.shared.model.Theme; |
23 import de.intevation.flys.client.shared.model.AttributedTheme; | 23 import de.intevation.flys.client.shared.model.AttributedTheme; |
24 import de.intevation.flys.client.shared.model.FeatureInfoResponse; | |
24 import de.intevation.flys.client.client.ui.ThemePanel; | 25 import de.intevation.flys.client.client.ui.ThemePanel; |
25 | 26 |
26 | 27 |
27 public class GetFeatureInfo implements MapClickListener { | 28 public class GetFeatureInfo implements MapClickListener { |
28 | 29 |
67 | 68 |
68 gfiWindow = new GetFeatureInfoWindow(features, title); | 69 gfiWindow = new GetFeatureInfoWindow(features, title); |
69 gfiWindow.show(); | 70 gfiWindow.show(); |
70 } | 71 } |
71 | 72 |
73 protected void newGetFeatureInfoWindow(String response, String title) { | |
74 if (gfiWindow != null) { | |
75 gfiWindow.destroy(); | |
76 } | |
77 | |
78 gfiWindow = new GetFeatureInfoWindow(response, title); | |
79 gfiWindow.show(); | |
80 } | |
72 | 81 |
73 @Override | 82 @Override |
74 public void onClick(MapClickListener.MapClickEvent e) { | 83 public void onClick(MapClickListener.MapClickEvent e) { |
75 LonLat lonlat = e.getLonLat(); | 84 LonLat lonlat = e.getLonLat(); |
76 Pixel pixel = map.getPixelFromLonLat(lonlat); | 85 Pixel pixel = map.getPixelFromLonLat(lonlat); |
88 map.getExtent().toString(), | 97 map.getExtent().toString(), |
89 map.getProjection(), | 98 map.getProjection(), |
90 (int) map.getSize().getHeight(), | 99 (int) map.getSize().getHeight(), |
91 (int) map.getSize().getWidth(), | 100 (int) map.getSize().getWidth(), |
92 pixel.x(), pixel.y(), | 101 pixel.x(), pixel.y(), |
93 new AsyncCallback<List<FeatureInfo>>() { | 102 new AsyncCallback<FeatureInfoResponse>() { |
94 @Override | 103 @Override |
95 public void onFailure(Throwable e) { | 104 public void onFailure(Throwable e) { |
96 SC.warn(MSG.getString(e.getMessage())); | 105 SC.warn(MSG.getString(e.getMessage())); |
97 } | 106 } |
98 | 107 |
99 @Override | 108 @Override |
100 public void onSuccess(List<FeatureInfo> features) { | 109 public void onSuccess(FeatureInfoResponse response) { |
101 if (features != null && !features.isEmpty()) | 110 List<FeatureInfo> features = response.getFeatures(); |
111 if (features != null && !features.isEmpty()) { | |
102 newGetFeatureInfoWindow(features, at.getAttr("description")); | 112 newGetFeatureInfoWindow(features, at.getAttr("description")); |
113 } else if (response.getFeatureInfoHTML() != null) { | |
114 newGetFeatureInfoWindow(response.getFeatureInfoHTML(), | |
115 at.getAttr("description")); | |
116 } else { | |
117 GWT.log("GetFeatureInfo returned neither a list of features nor a string"); | |
118 } | |
103 } | 119 } |
104 } | 120 } |
105 ); | 121 ); |
106 break; // More intelligent handling when more then one is selected | 122 break; // More intelligent handling when more then one is selected |
107 } | 123 } |