[OpenLayers-Users] Selectfeature after DrawFeature

Alexandre Dubé adube at mapgears.com
Mon Nov 26 05:27:59 PST 2012


Hi Diego,

   You can register a 'featureadded' event to your draw feature control 
to do so :

   myDrawFeatureCtrl.events.on({
     "featureadded": function(object) {
       object.feature.state = OpenLayers.State.INSERT;
       mySelectControl.activate(); // if not already
       myDrawFeatureCtrl.deactivate(); // if not already
       mySelectControl.select(object.feature);
     },
     scope: this
   });

   If both controls were part of the same OpenLayers.Control.Panel 
control, you would only need to do a :
     myPanelCtro.activateControl(mySelectControl);
   instead of enabling and disabling your draw and select controls.

HTH,

Alexandre


On 12-11-24 04:48 AM, Diego M. wrote:
> If I add a feature by : layer.drawFeature(feature);
> and I would like to activate the selectfeature control on it
> How I can do that ?
>
> the control already activated on the layer, but no affect the new drawn
> feature.
>
>
>
> --
> View this message in context: http://osgeo-org.1560.n6.nabble.com/Selectfeature-after-DrawFeature-tp5018519.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users


-- 
Alexandre Dubé
Mapgears
www.mapgears.com



More information about the Users mailing list