From: Lukas J. <luk...@de...> - 2010-11-24 16:02:28
|
I've commited a version that make the control a more complete and which uses the drilldown parameter introduced in OL 2.9[1] which can be used to access multiple servers. In october we realized that my patch hadn't been commited so this was taken care of, however I do not think that its in the current stable build. Instead you need to checkout your own version. [1] http://dev.openlayers.org/releases/OpenLayers-2.9.1/doc/apidocs/files/OpenLayers/Control/WMSGetFeatureInfo-js.html#OpenLayers.Control.WMSGetFeatureInfo.drillDown You add the controller to the map, if you do not use drilldown only to top layer is queried. Most settings are set in WmsGetFeatureInfoOptions and not on the control itself. Usage is something along this path (copied from our working code, but you get the idea): WMSGetFeatureInfoOptions options = new WMSGetFeatureInfoOptions(); options.setLayers(arrayOfLayersToQuery)); //allows you to tell what layers that should be queried options.setDrillDown(true); options.setQueryVisible(true); options.setInfoFormat("application/vnd.ogc.gml"); //return result as gml wmsSelectControl = new WMSGetFeatureInfo(options); wmsSelectControl.addGetFeatureListener(new GetFeatureInfoListener(){ public void onGetFeatureInfo(GetFeatureInfoEvent eventObject) { VectorFeature[] features = eventObject.getFeatures(); String html = "foo"; FrameCloud popup = new FramedCloud("MapFeaturePopup", features[0].getCenterLonLat(), new Size(300, 400), html); } } map.addControl(wmsSelectControl); /Lukas Från: man...@go... [mailto:man...@go...] För Jon Britton Skickat: den 24 november 2010 16:42 Till: Lukas Johansson Kopia: gwt-openlayers-users Ämne: Re: [Gwt-openlayers-users] MapClickListener support Hi Lukas, You haven't misunderstood, I wasn't aware there was a map control for this. My client application is for displaying many WMS layers, possibly from different servers. The user can add/remove WMS layers as they see fit by using their own WMS URLs. What I want to do is display the feature info for every layer currently visible on my map, but I'm struggling to figure out how WMSGetFeatureInfo can be used for this as each control corresponds to only one WMS URL. Would I need to make a new control for each map layer? Another problem is that the GWT-Openlayers WMGetFeatureInfo control seems to be incomplete as I can't access many of it's properties directly (such as url, title, layers...). Thanks, Jon On 24 November 2010 15:37, Lukas Johansson <luk...@de...> wrote: You want the x/y of the mouseclick in order to construct a WMSGetFeautureInfo? Why not use the existing WMSGetFeatureInfo control to begin with? This will handle the events, the request to the server and you can get it to produce a parsable result in GML from witch you can create features. Or have I misunderstood your usecase? /Lukas Från: Jon Britton [mailto:jon...@go...] Skickat: den 24 november 2010 15:20 Till: gwt-openlayers-users Ämne: [Gwt-openlayers-users] MapClickListener support Hi I'm trying to register a MapClickListener so that I can generate a GetFeatureInfo request using the mouse x and y coordinates. Here is what I've got so far: mw.getMap().getListeners().add(new MapClickListener() { @Override public void onClick(MapClickEvent e) { SC.say("Map click at " + e.getLonLat()); } }); However, getListeners() isn't supported as far as I can tell (I get an UnsupportedOperationException on the first line above). Are there any plans to implement this soon? Alternatively, is there any other way to access the map coordinates of the mouse cursor? Thanks, Jon ------------------------------------------------------------------------------ Increase Visibility of Your 3D Game App & Earn a Chance To Win $500! Tap into the largest installed PC base & get more eyes on your game by optimizing for Intel(R) Graphics Technology. Get started today with the Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs. http://p.sf.net/sfu/intelisp-dev2dev _______________________________________________ Gwt-openlayers-users mailing list Gwt...@li... https://lists.sourceforge.net/lists/listinfo/gwt-openlayers-users |