[OpenLayers-Dev] DrawFeature.featureAdded() - called in wrong
jdege at korterra.com
Thu Apr 5 18:23:41 EDT 2007
> From: Christopher Schmidt [mailto:crschmidt at metacarta.com]
> Sent: Thursday, April 05, 2007 5:01 PM
> On Thu, Apr 05, 2007 at 04:49:06PM -0500, Jeff Dege wrote:
> > 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.
> the State of the feature is used for posting to WFS servers
> -- depending
> on the state, a feature is added, updated or deleted.
> I'd probably feel more comfortable offering advice to you if I had a
> better idea why you need to know which control added a feature before
> it's added -- styling, I presume?
No. It's a bit more fundamental than that.
We have a map displaying a landbase, and a geographical area that our
users are editing. The area consists of a set of non-overlapping
polygons that are displayed on the map. The user is given the choice
between navigate, add, or subtract mode. Navigate mode works as you'd
expect. In add or subtract mode, the user draws polygons on the map.
When he's completed drawing a polygon, in onFeatureInsert(), we either
add or subtract the new polygon from the set we'd been displaying. Not
as in adding the new polygon to the list of polygons, but as in doing a
union or a difference with the existing polygons, resulting in a new set
Adding one polygon to a set of three polygons may result in one polygon
or four, subtracting one polygon from another may result in one polygon
or three. depending upon the geometry. We're not preserving the
identity of the polygons, but instead are preserving the area covered by
them in the simplest way possible. The user can tweak the borders to
his hearts content. When he has everything the way he likes, he clicks
on the save button, and it all gets stored away in the appropriate
It's all working fine, thanks to third-party polygon clipping library,
using some plain html controls outside the map. I'd rather use controls
that are on the map, inside the toolbar. But that requires that I know
which control created the feature, when onFeatureInsert() is called.
More information about the Dev