[OpenLayers-Users] SplitFeature question

Maxime Phaneuf maxime.phaneuf at usherbrooke.ca
Wed Mar 10 10:30:17 EST 2010


Thank you Bart for your answer.

I used part of your solution. This is what I did:

            split = new OpenLayers.Control.Split({
                layer: vectors,
                source: vectors,
                tolerance: 0.0001,
                eventListeners: {
                    beforesplit: function(event) {
						var x1, x2, y1, y2;
						x1 = event.source.geometry.components[0].x;
						y1 = event.source.geometry.components[0].y;
						x2 = event.source.geometry.components[1].x;
						y2 = event.source.geometry.components[1].y;
						var target = {x1: x1, y1: y1, x2: x2, y2: y2};
						//alert(x1,y1,x2,y2);
						var splitResult = event.target.geometry.splitWithSegment(target);
						var point = splitResult.points[0];
						var featureToAdd = new OpenLayers.Feature.Vector(point);
						points.addFeatures(featureToAdd);
                    }
                }
            });

I used the source property to get the coordinates of each point. After, I
used the splitWithSegment() function because it returns the intersection
points.

Maxime
-- 
View this message in context: http://n2.nabble.com/SplitFeature-question-tp4702952p4709972.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.



More information about the Users mailing list