From aaa4fec14190359bbd026354581b8296d47f356a Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Sat, 25 May 2013 19:39:51 -0500 Subject: [PATCH] Move insert into method --- src/ol/structs/rtree.js | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/src/ol/structs/rtree.js b/src/ol/structs/rtree.js index d172de6d8a..a915adedb3 100644 --- a/src/ol/structs/rtree.js +++ b/src/ol/structs/rtree.js @@ -70,24 +70,6 @@ ol.structs.RTree = function(opt_maxWidth) { this.rootTree_ = /** @type {ol.structs.RTreeNode} */ ({extent: [0, 0, 0, 0], nodes: []}); - var that = this; // FIXME remove - - /** - * Non-recursive insert function. - * - * @param {ol.Extent} extent Extent. - * @param {Object} obj Object to insert. - * @param {string=} opt_type Optional type to store along with the object. - */ - this.insert = function(extent, obj, opt_type) { - var node = /** @type {ol.structs.RTreeNode} */ - ({extent: extent, leaf: obj}); - if (goog.isDef(opt_type)) { - node.type = opt_type; - } - that.insertSubtree_(node, that.rootTree_); - }; - //End of RTree }; @@ -200,6 +182,23 @@ ol.structs.RTree.prototype.chooseLeafSubtree_ = function(rect, root) { }; +/** + * Non-recursive insert function. + * + * @param {ol.Extent} extent Extent. + * @param {Object} obj Object to insert. + * @param {string=} opt_type Optional type to store along with the object. + */ +ol.structs.RTree.prototype.insert = function(extent, obj, opt_type) { + var node = /** @type {ol.structs.RTreeNode} */ + ({extent: extent, leaf: obj}); + if (goog.isDef(opt_type)) { + node.type = opt_type; + } + this.insertSubtree_(node, this.rootTree_); +}; + + /** * Non-recursive internal insert function. *