[OpenLayers-Users] Which OpenLayers.Feature.Vector.style is used while drawing?

Tim Schaub noreply at geocartic.com
Fri Mar 30 20:38:43 EDT 2007


Hey-

Lance Dyas wrote:
> Speaking of this how would you capture the "done" event after the user 
> draws a feature?

You have two options.

If you want to let the DrawFeature control do it's job and get notified 
after a feature has been added, construct your control with options like:

     function myFunction(feature) {
         // do something after a feature is added
     }

     var options = {featureAdded: myFunction};
     var control = new OpenLayers.Control.DrawFeature(lineLayer,
                             OpenLayers.Handler.Path, options);


If you want to stop the feature from being added in the normal way and 
do something else with it, you modify the callbacks that get sent to the 
handler like:

     function myFunction(geometry) {
         // do something before the new feature is created
     }

     var options = {callbacks: {done: myFunction}};
     var control = new OpenLayers.Control.DrawFeature(lineLayer,
                             OpenLayers.Handler.Path, options);


> And is decent measuring tool already in the works by somebody?

In the works.

Tim



More information about the Users mailing list