Skip to content

Commit

Permalink
Merge pull request #18 from leaflet-extras/multifile
Browse files Browse the repository at this point in the history
refactor into multiple files
  • Loading branch information
Calvin Metcalf committed Jun 18, 2013
2 parents 3713f89 + 8f3ddda commit 8a590c4
Show file tree
Hide file tree
Showing 11 changed files with 733 additions and 808 deletions.
57 changes: 38 additions & 19 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,38 @@ module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
banner:'/****************************************************************************** \nrtree.js -Non-Recursive Javascript R-Tree Library\nVersion 1.0.0, March 15th 2013\n\nhttps://github.com/leaflet-extras/RTree.\n******************************************************************************/\n',
uglify: {
banner:'/****************************************************************************** \n\
rtree.js -Non-Recursive Javascript R-Tree Library\n\
Version 1.0.0, March 15th 2013\n\n\
https://github.com/leaflet-extras/RTree.\n\
******************************************************************************/\n\
(function(){\n\
/*global module,window,self */\n\
\'use strict\';\n',
footer:'if (typeof module !== \'undefined\' && module.exports) {\n\
module.exports = rTree;\n\
}else if(typeof document === \'undefined\'){\n\
self.rTree = rTree;\n\
self.RTree = RTree;\n\
}else{\n\
window.rTree = rTree;\n\
window.RTree = RTree;\n\
}\n\
})(this);\n',
uglify: {
all: {
options:{
banner: '<%= banner %>'
},
src: 'src/<%= pkg.name %>.js',
dest: 'dist/<%= pkg.name %>.min.js'
src: 'dist/rtree.js',
dest: 'dist/rtree.min.js'
}
},
concat: {
all: {
options:{
banner: '<%= banner %>'
banner: '<%= banner %>',
footer:'<%= footer %>'
},
src: 'src/<%= pkg.name %>.js',
dest: 'dist/<%= pkg.name %>.js'
src: ['src/rtree.js','src/rtree.json.js','src/rtree.geojson.js','src/rtree.end.js','src/rtree.rectangle.js'],
dest: 'dist/rtree.js'
}
},
jshint: {
Expand All @@ -39,13 +54,13 @@ module.exports = function(grunt) {
strict:true,
trailing:true
},
src: 'src/<%= pkg.name %>.js'
src: 'dist/<%= pkg.name %>.js'
}
},
connect: {
server: {
options: {
port: 8000,
port: process.env.PORT||8000,
base: '.'
}
}
Expand All @@ -54,7 +69,8 @@ module.exports = function(grunt) {
all: {
options: {
urls: [
"http://localhost:8000/tests/index.html"
"http://"+process.env.IP+":"+process.env.PORT+"/tests/index.html",
"http://"+process.env.IP+":"+process.env.PORT+"/tests/index.html"
]
}
}
Expand All @@ -67,6 +83,11 @@ module.exports = function(grunt) {
concurrency:3,
build: process.env.TRAVIS_JOB_ID,
browsers: [
{
browserName: 'internet explorer',
platform: 'win7',
version: '9'
},
{
browserName: "firefox",
platform: "linux",
Expand All @@ -86,7 +107,7 @@ module.exports = function(grunt) {
},{
browserName: 'chrome',
platform: 'linux'
}, {
},{
browserName: 'internet explorer',
platform: 'WIN8',
version: '10'
Expand All @@ -98,10 +119,6 @@ module.exports = function(grunt) {
browserName: 'opera',
platform: 'win7',
version: '12'
},{
browserName: 'internet explorer',
platform: 'win7',
version: '9'
}
],
urls: [
Expand All @@ -119,6 +136,8 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-mocha-phantomjs');
grunt.loadNpmTasks('grunt-saucelabs');
grunt.registerTask('c9Test', ['connect:server','mocha_phantomjs']);
grunt.registerTask('test', ['connect:server','saucelabs-mocha']);
grunt.registerTask('default', ['jshint','concat','uglify','test']);
grunt.registerTask('default', ['concat','uglify','jshint','test']);
grunt.registerTask('c9', ['concat','uglify','jshint','c9Test']);
};
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

A non-recursive R-Tree library in pure JavaScript with no dependencies. Fork of [Jon-Carlos Rivera's fantastic library](https://github.com/imbcmdth/RTree) which sadly seems not to be maintained. MIT Licensed.

[![Selenium Test Status](https://saucelabs.com/browser-matrix/rtrees.svg)](https://saucelabs.com/u/rtrees)

##So far:

- Bugfix when deleting points.
Expand All @@ -13,13 +15,15 @@ A non-recursive R-Tree library in pure JavaScript with no dependencies. Fork of
- Query by bbox instead of rectangle.
- Submit to NPM.
- Update examples.

##Todo:

- add closure
- add GruntFile
- fix syntax (make it pass jslint)

##todo

- more modular
- that bug with deleting

##API

- *rTree* ( _[ Number **max_node_width**, Function **callback** ]_ )
Expand Down Expand Up @@ -137,7 +141,7 @@ myRTree.geoJSON({
###Parameters

- **area** : **required** : Area to search, this can either be represented by a single parameter bounds array `[[x1,y1],[x2,y2]]`, two parameters representing the southwest and northeast corners `[x1,y1],[x2,y2]`, or 4 parameters of `[x1,y1,x2,y2]`.
- **callback** : _optional_ : Function called with the results<sup>2</sup>](#f2).
- **callback** : _optional_ : Function called with the results.[<sup>2</sup>](#f2).

###Returns:

Expand All @@ -161,7 +165,7 @@ myRTree.geoJSON({
- **area** : **required** : An area to search within.
- **return_node** : _optional_ : Whether to return the entire node, mainly internal option.
- **return_array** : _optional_ : An existing array to add the results to, defaults to [], mainly internal option.
- **callback** : _optional_ : Function called with the results<sup>2</sup>](#f2).
- **callback** : _optional_ : Function called with the results[<sup>2</sup>](#f2).

###Returns:

Expand Down
Loading

0 comments on commit 8a590c4

Please sign in to comment.