Adding a removeAllFeatures method to the vector layer. This bypasses a few unnecessary steps when removing all features but retains the same behavior as the removeFeatures method otherwise. Optimizing the clear method on elements renderers a bit by avoiding length calculation of the live collection and looking up the first child once per node removal. r=ahocevar (closes #2774)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@10597 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -442,14 +442,17 @@ OpenLayers.Renderer.Elements = OpenLayers.Class(OpenLayers.Renderer, {
|
||||
* Remove all the elements from the root
|
||||
*/
|
||||
clear: function() {
|
||||
if (this.vectorRoot) {
|
||||
while (this.vectorRoot.childNodes.length > 0) {
|
||||
this.vectorRoot.removeChild(this.vectorRoot.firstChild);
|
||||
var child;
|
||||
var root = this.vectorRoot;
|
||||
if (root) {
|
||||
while (child = root.firstChild) {
|
||||
root.removeChild(child);
|
||||
}
|
||||
}
|
||||
if (this.textRoot) {
|
||||
while (this.textRoot.childNodes.length > 0) {
|
||||
this.textRoot.removeChild(this.textRoot.firstChild);
|
||||
root = this.textRoot;
|
||||
if (root) {
|
||||
while (child = root.firstChild) {
|
||||
root.removeChild(child);
|
||||
}
|
||||
}
|
||||
if (this.indexer) {
|
||||
|
||||
Reference in New Issue
Block a user