搜索插件、代码仓与 APP 分类

插件详情v3.0.2

r_tree

用于索引和查询二维数据的 R 树实现

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
2万
喜欢数
11
Pub 分数
145

安装插件

flutter pub add r_tree

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

r_tree 包提供了一个 R 树实现,用于在 Dart 中高效地索引和查询二维空间数据。它支持快速的范围查询和最近邻搜索,非常适合涉及地理坐标、碰撞检测或布局管理的应用程序。该包专为性能和跨平台兼容性而设计,支持 Android、iOS、Web、macOS、Windows 和 Linux。该包由 Workiva 维护,并可通过 pub 与 Flutter 项目无缝集成。

适合场景

  • 空间数据索引
  • 游戏中的碰撞检测
  • 地理坐标查询
  • UI 元素命中测试
  • 基于距离的搜索
  • 基于地图的应用程序功能

主要特点

  • 高效的二维范围查询
  • 支持最近邻搜索
  • 跨平台兼容性
  • 高性能空间索引
  • 用于插入和查询的简单 API
  • 线程安全操作

适合对象

  • 游戏开发
  • GIS 应用
  • 具有空间逻辑的交互式 UI
  • 数据可视化工具
  • 位置感知应用
  • 性能敏感的空间操作

使用建议

  • 最适合2D数据
  • 未针对无分区的大数据集进行优化
  • 需要仔细处理坐标精度
  • 在某些使用场景中,仅限于静态或批量更新的数据
  • 无内置持久化支持

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

RTree Build Status

A recursive RTree library written in Dart. This R-tree implementation is used to index and query two-dimensional data. Items are inserted and balanced via the RTree class and can then be queried by Rectangle. The balancing can be tweaked by modifying the branch factor of the RTree.

"R-trees are tree data structures used for spatial access methods, i.e., for indexing multi-dimensional information such as geographical coordinates, rectangles or polygons." - http://en.wikipedia.org/wiki/R-tree

Example

Run the example app for a visual demonstration of the RTree

webdev serve example:8080

Navigate to http://localhost:8080. A canvas is drawn, click & drag on the canvas to add rectangles of various colors to your RTree, then click the search button and click & drag over an area of the canvas to search it for rectangles.

Benchmarks

Run the benchmarks in the command line (Dart VM) using:

dart benchmark/benchmarks.dart

You can also run them in a browser using dart2js. This takes an extra step since webdev will only build the web directory as of this writing. You'll also need some binary for serving a directory on a web server, the example below uses serve.

cp -R benchmark/ web
webdev build
serve build

Click the run button and observe the output in the browser console.

所属分类

源码仓库

使用此插件的项目

暂无相关数据。