[OpenLayers-Dev] DrawFeature.featureAdded() - called in wrong place?

Jeff Dege jdege at korterra.com
Thu Apr 5 17:49:06 EDT 2007

Maybe I don't understand what you intend DrawFeature.featureAdded to be
used for, and it's possible that this whole area of functionality will
be replaced, prior to 2.4, and it's current implementation is moot, but:

I'm trying to create two controls on a tool bar, both of which draw
polygons, but where what happens after the polygon is drawn would be
different.  I had noticed that in EditingToolBar.js, each control is
assigned a featureAdded() function that sets the state of the feature to
OpenLayers.State.INSERT.  I'd thought that I could use this function to
set a different state, or to add my own status attribute to the feature,
and then check on the value of that state in

But in Control\DrawFeature.js, the drawFeature() function calls
this.featureAdded() after it calls this.layer.addFeatures(), so there's
no way in onFeatureInsert() to distinguish which control created the

As far as I can tell, the feature.state variable isn't actually used for
anything.  Maybe I'm missing something, but would it break anything to
make these calls in reverse order?

Or is all of this going to be scrapped and replaced?

More information about the Dev mailing list