[OpenLayers-Users] How to use split events

Andreas Hocevar ahocevar at opengeo.org
Thu Oct 8 09:20:15 EDT 2009


Hi,

ok, this is something different. How about the following split handler:

split: function(event) {
	if (event.features.length>2) {
		event.features = [event.original.clone()];
        }
}

Regards,
Andreas.

emmexx wrote:
> Il 08/10/2009 12:14, Andreas Hocevar scrisse:
>   
>> Hi,
>>
>> instead of working with the split event, use a beforesplit event handler
>> and check the geometry of the target feature. Return false from the
>> beforesplit handler if the target feature has more than 1 part (note:
>> before splitting!).
>>     
>
> Sorry but I don't understand.
> In beforesplit the source and target are the original features, there's
> no information about how many parts the source will cut the target in.
>
> Probably you misunderstood my question.
> Just suppose that you have a Linestring that is like half a square. I
> can draw a straight line that is parallel to the square diagonal and
> that cuts the half square in 2 points.
> I don't want this to happen.
>
> Thank you
> 	maxx
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>   


-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.




More information about the Users mailing list