Merge pull request #2235 from oefirouz/master

Added rTree interface
This commit is contained in:
Masahiro Wakame
2014-06-05 10:53:56 +09:00
3 changed files with 39 additions and 0 deletions
+1
View File
@@ -270,6 +270,7 @@ All definitions files include a header with the author and editors, so at some p
* [Raphael](http://raphaeljs.com/) (by [CheCoxshall](https://github.com/CheCoxshall))
* [Restangular](https://github.com/mgonto/restangular/) (by [Boris Yankov](https://github.com/borisyankov))
* [require.js](http://requirejs.org/) (by [Josh Baldwin](https://github.com/jbaldwin/))
* [rtree.js] (https://github.com/leaflet-extras/RTree) (by [Omede Firouz](https://github.com/oefirouz))
* [Sammy.js](http://sammyjs.org/) (by [Boris Yankov](https://github.com/borisyankov))
* [Select2](http://ivaynberg.github.com/select2/) (by [Boris Yankov](https://github.com/borisyankov))
* [Selenium WebDriverJS](https://code.google.com/p/selenium/) (by [Bill Armstrong](https://github.com/BillArmstrong))
+13
View File
@@ -0,0 +1,13 @@
/// <reference path="rtree.d.ts"/>
var myRTree = RTree(5);
var el = "test";
myRTree.insert({x: 0, y: 0, w: 1, h: 1}, el);
var intersections = myRTree.search({x: 0.5, y: 0.5, w: 1, h: 1});
intersections = myRTree.remove({x: 0.5, y: 0.5, w: 1, h: 1}, "notTest!");
intersections = myRTree.remove({x: 0.5, y: 0.5, w: 1, h: 1});
+25
View File
@@ -0,0 +1,25 @@
// Type definitions for rtree 1.4.0
// Project: https://github.com/leaflet-extras/RTree
// Definitions by: Omede Firouz <https://github.com/oefirouz>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
interface Rectangle {
x: number;
y: number;
w: number;
h: number;
}
interface RTreeStatic {
insert(bounds: Rectangle, element: Object): boolean;
remove(area: Rectangle, element?: Object): any[];
geoJSON(geoJSON: any): void;
bbox(arg1: any, arg2?: any, arg3?: number, arg4?: number): any[];
search(area: Rectangle, return_node?: boolean, return_array?: any[]): any[];
}
interface RTreeFactory {
(max_node_width?: number): RTreeStatic;
}
declare var RTree: RTreeFactory;