Adding getVertices method to all geometries. Call with nodesOnly true if you only want endpoints (of lines and multilines). r=crschmidt (closes #1192)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@8842 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -401,5 +401,27 @@ OpenLayers.Geometry.Collection = OpenLayers.Class(OpenLayers.Geometry, {
|
||||
return intersect;
|
||||
},
|
||||
|
||||
/**
|
||||
* APIMethod: getVertices
|
||||
* Return a list of all points in this geometry.
|
||||
*
|
||||
* Parameters:
|
||||
* nodesOnly - {Boolean} For lines, only return vertices that are
|
||||
* endpoints.
|
||||
*
|
||||
* Returns:
|
||||
* {Array} A list of all vertices in the geometry.
|
||||
*/
|
||||
getVertices: function(nodesOnly) {
|
||||
var vertices = [];
|
||||
for(var i=0, len=this.components.length; i<len; ++i) {
|
||||
Array.prototype.push.apply(
|
||||
vertices, this.components[i].getVertices(nodesOnly)
|
||||
);
|
||||
}
|
||||
return vertices;
|
||||
},
|
||||
|
||||
|
||||
CLASS_NAME: "OpenLayers.Geometry.Collection"
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user