New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
More sophisticated RTree implementation #719
Conversation
This new implementation is based on http://github.com/imbcmdth/RTree/, with only a few modifications to add the optional type and provide the API of the previous implementation. There is still room for optimization, but this is such an improvement over the previous RTree already that it's worth bringing it in now.
|
More work needs to be done to make this work in advanced compilation mode. |
|
This is ready for review. I'm sure the Closure integration can be improved, but for now it works. |
|
Thanks for taking this on @ahocevar. Looks like a few more changes are needed to satisfy JSDoc3. I hope to get a chance to look this over in the next day or two. |
Not using Math.max and Math.min increases performance, and by using ol.extent functions instead of RTree's rectangle structures and calculations we can get rid of several functions.
Also fixes some issues that were revealed by the new tests.
|
@tschaub: JSDoc3 is also happy now. Don't worry if you don't see anything in the resulting docs - that's ok because there is nothing exported to the public API. |
| tree.nodes.splice(i + 1, 1); // Remove unsplit node | ||
| // workingObject.nodes contains a list of elements removed from the | ||
| // tree so far | ||
| if (tree.nodes.length > 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor, but it would match the rest of our style to have braces here (and below).
|
This is a fantastic improvement @ahocevar. Thanks for taking the time to adapt it. While it's a silly example, its nice to see the canvas renderer handling 20K features with aplomb: https://gist.github.com/tschaub/5617621 On my machine, these synthetic features take about 1s to create, about 1s to index (with 266ms in I can imagine we'll have discussion about where this gets used. It may only be of use in the Canvas 2d rendering case (in which case it should not be required by the vector layer). But I don't think that should keep this from going in. Please merge. |
More sophisticated RTree implementation. r=@tschaub
This new implementation is based on
http://github.com/imbcmdth/RTree/, with only a few modifications
to add the optional type and provide the API of the previous
implementation.
There is still room for optimization, but this is such an
improvement over the previous RTree already that it's worth
bringing it in now.