[OpenLayers-Users] How to use split events

emmexx emmexx at tiscalinet.it
Wed Oct 7 12:14:21 EDT 2009


I'm trying to use the split control to cut a line (LineString) with the
conditione that the line can only be cut in 2 parts.

I tried to use the split event with the following code:

split: function(event) {
	var a = event.original;
	var b = event.features;
	if (b.length>2)
		//do something to stop splitting

but I couldn't find a way to accomplish it. I tried all of the following
to no avail:
event.features=null
this.deactivate()
event.features=event.original

Is there a simple way to do it or should I use a 2 steps strategy,
setting a flag in the split event and restoring the original feature in
the aftersplit event?

Thank you

	maxx



More information about the Users mailing list