From: Edwin C. <com...@gm...> - 2010-02-04 17:54:25
|
Hi Robert, The WFS functionality is a recent contribution by Dave, maybe he recognizes the problem easily. I still need to get working on a Java port of the Open Proxy that is necessary for the WFS functionality and that is included in the OpenLayers examples. How are you running your code? Is the Python Open Proxy implementation up? The dev list is not publicly visible as far as I am aware, but I have cc'd this reply to the devl list. Greetings, Edwin On 4 February 2010 16:54, Robert Light <rob...@ve...> wrote: > Edwin, > > I think I've found a bug either in openlayers or in gwt-openlayers code. > > if I create a WFS layer: > WFSParams wfsParams = new WFSParams(); > wfsParams.setTypename("topp:states"); > WFSOptions wfsLayerOptions = new WFSOptions(); > wfsLayerOptions.setTransitionEffect(TransitionEffect.RESIZE); > wfsLayerOptions.setExtractAttributes(true); > > WFS wfsLayer = new WFS( > "states", > "http://192.168.1.167:8080/geoserver/wfs", > wfsParams, > wfsLayerOptions); > > and then I want to get selection events so I do: > > wfsLayer.addVectorFeatureSelectedListener( new > VectorFeatureSelectedListener() { > > public void onFeatureSelected(FeatureSelectedEvent > eventObject) { > JSONObject map = new > JSONObject(eventObject.getVectorFeature().getJSObject().getProperty("attributes")); > System.out.println("Feature.id = > "+eventObject.getVectorFeature().getId()); > for( String key : map.keySet()) { > System.out.println(key+"="+map.get(key)); > } > } > }); > > This does not work... my VectorFeatureSelectListener never get's called. > > To make this work, I had to add the following: > SelectFeatureOptions selectFeatureOptions = new > SelectFeatureOptions(); > selectFeatureOptions.onSelect( new > SelectFeature.SelectFeatureListener() { > > public void onFeatureSelected(VectorFeature vectorFeature) { > JSONObject map = new > JSONObject(vectorFeature.getJSObject().getProperty("attributes")); > for( String key : map.keySet()) { > System.out.println(key+"="+map.get(key)); > } > } > }); > > SelectFeature selfeature = new SelectFeature(wfsLayer, > selectFeatureOptions); > map.getMap().addControl(selfeature); > selfeature.activate(); > > > And now BOTH my VectureFeatureSelectListener AND my SelectFeatureListener > get called when I select a feature. > > To put another wrinkle in the puzzle....instead of adding the SelectFeature > Control as above, I do just the following: > > SelectFeature selfeature = new SelectFeature(wfsLayer); > map.getMap().addControl(selfeature); > selfeature.activate(); > > My VectorFeatureSelectListener does NOT get called. > > Any ideas? Is there a developer's list I should post this query to? > > Note, I'm working off the latest set of sources that I downloaded via > mercurial. > > many thanks. > > - Bob Light > > |