![]() |
VOOZH | about |
dotnet add package RBush.Signed --version 4.0.0
NuGet\Install-Package RBush.Signed -Version 4.0.0
<PackageReference Include="RBush.Signed" Version="4.0.0" />
<PackageVersion Include="RBush.Signed" Version="4.0.0" />Directory.Packages.props
<PackageReference Include="RBush.Signed" />Project file
paket add RBush.Signed --version 4.0.0
#r "nuget: RBush.Signed, 4.0.0"
#:package RBush.Signed@4.0.0
#addin nuget:?package=RBush.Signed&version=4.0.0Install as a Cake Addin
#tool nuget:?package=RBush.Signed&version=4.0.0Install as a Cake Tool
RBush is a high-performance .NET library for 2D spatial indexing of points and rectangles. It's based on an optimized R-tree data structure with bulk insertion support.
Spatial index is a special data structure for points and rectangles that allows you to perform queries like "all items within this bounding box" very efficiently (e.g. hundreds of times faster than looping over all items). It's most commonly used in maps and data visualizations.
This code has been copied over from the Javascript RBush library.
Install with Nuget (Install-Package RBush).
First, define the data item class to implement ISpatialData. Then the class can be used as such:
class Point : ISpatialData
{
public Point(Envelope envelope) =>
_envelope = envelope;
private readonly Envelope _envelope;
public public ref readonly Envelope Envelope => _envelope;
}
var tree = new RBush<Point>()
An optional argument (maxEntries) to the constructor defines the maximum number
of entries in a tree node. 9 (used by default) is a reasonable choice for most
applications. Higher value means faster insertion and slower search, and vice versa.
var tree = new RBush<Point>(maxEntries: 16)
Insert an item:
var item = new Point(
new Envelope(
MinX: 0,
MinY: 0,
MaxX: 0,
MaxY: 0));
tree.Insert(item);
Bulk-insert the given data into the tree:
var points = new List<Point>();
tree.BulkLoad(points);
Bulk insertion is usually ~2-3 times faster than inserting items one by one. After bulk loading (bulk insertion into an empty tree), subsequent query performance is also ~20-30% better.
Note that when you do bulk insertion into an existing tree, it bulk-loads the given data into a separate tree and inserts the smaller tree into the larger tree. This means that bulk insertion works very well for clustered data (where items in one update are close to each other), but makes query performance worse if the data is scattered.
var result = tree.Search(
new Envelope
(
minX: 40,
minY: 20,
maxX: 80,
maxY: 70
);
Returns an IEnumerable<T> of data items (points or rectangles) that the given bounding box intersects.
var allItems = tree.Search();
Returns all items of the tree.
tree.Delete(item);
Unless provided an IComparer<T>, RBush uses EqualityComparer<T>.Default
to select the item. If the item being passed in is not the same reference
value, ensure that the class supports EqualityComparer<T>.Default
equality testing.
tree.Clear();
This code was adapted from a Javascript library called RBush. The only changes made were to adapt coding styles and preferences.
Clone the repository and open RBush.sln in Visual Studio.
RBush should run on any .NET system that supports .NET Standard 1.2 (.NET Framework 4.5.1 or later; .NET Core 1.0 or later).
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 was computed. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 is compatible. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 4 NuGet packages that depend on RBush.Signed:
| Package | Downloads |
|---|---|
|
ClosedXML
See release notes https://github.com/ClosedXML/ClosedXML/releases/tag/0.105.0 ClosedXML is a .NET library for reading, manipulating and writing Excel 2007+ (.xlsx, .xlsm) files. It aims to provide an intuitive and user-friendly interface to dealing with the underlying OpenXML API. |
|
|
QuadrumClosedXML
See release notes https://github.com/ClosedXML/ClosedXML/releases/tag/ ClosedXML is a .NET library for reading, manipulating and writing Excel 2007+ (.xlsx, .xlsm) files. It aims to provide an intuitive and user-friendly interface to dealing with the underlying OpenXML API. |
|
|
XLibur
See release notes https://github.com/XLibur/XLibur/releases/tag/ XLibur is a .NET library for reading, manipulating and writing Excel 2007+ (.xlsx, .xlsm) files. It aims to provide an intuitive and user-friendly interface to dealing with the underlying OpenXML API. |
|
|
ClosedXMLFIXCUSTOMTables
See release notes https://github.com/ClosedXML/ClosedXML/releases/tag/ ClosedXML is a .NET library for reading, manipulating and writing Excel 2007+ (.xlsx, .xlsm) files. It aims to provide an intuitive and user-friendly interface to dealing with the underlying OpenXML API. |
Showing the top 2 popular GitHub repositories that depend on RBush.Signed:
| Repository | Stars |
|---|---|
|
ClosedXML/ClosedXML
ClosedXML is a .NET library for reading, manipulating and writing Excel 2007+ (.xlsx, .xlsm) files. It aims to provide an intuitive and user-friendly interface to dealing with the underlying OpenXML API.
|
|
|
Topkill/tianruoocr
天若OCR开源6.0版本,续更开源5.0版,全新版本,全新出发
|
| Version | Downloads | Last Updated |
|---|---|---|
| 4.0.0 | 27,925,692 | 11/18/2024 |