RTree

sealed trait RTree[A]

In-memory immutable r-tree with the minimal bounding rectangle (MBR).

In-memory immutable r-tree with the minimal bounding rectangle (MBR).

Type Params
A

a type of values being put in the tree

Companion
object
class Object
trait Matchable
class Any
class RTreeEntry[A]

Value members

Abstract methods

def isEmpty: Boolean
def maxX: Float
Returns

x value of the upper right point of the MBR

def maxY: Float
Returns

y value of the upper right point of the MBR

def minX: Float
Returns

x value of the lower left point of the MBR

def minY: Float
Returns

y value of the lower left point of the MBR

def nearest(x: Float, y: Float, maxDist: Float)(f: (Float, RTreeEntry[A]) => Float)(distCalc: DistanceCalculator): Float

Returns a distance to the nearest R-tree entry for the given point.

Returns a distance to the nearest R-tree entry for the given point.

Search distance can be limited by the maxDist parameter.

Value Params
distCalc

a distance calculator provided according to geometry of indexed entries

f

the function that receives found values and their distances and returns the current maximum distance

maxDist

an exclusive limit of the distance (infinity by default)

x

x value of the given point

y

y value of the given point

Returns

the distance to a found entry or initially submitted value of maxDist

def pretty(sb: StringBuilder, indent: Int): StringBuilder

Appends a prettified string representation of the r-tree.

Appends a prettified string representation of the r-tree.

Value Params
indent

a size of indent step for each level or 0 if indenting is not required

sb

a string builder to append to

Returns

the provided string builder

def search(x: Float, y: Float)(f: RTreeEntry[A] => Unit): Unit

Call the provided f function with entries whose MBR contains the given point.

Call the provided f function with entries whose MBR contains the given point.

Value Params
f

the function that receives found values

x

x value of the given point

y

y value of the given point

def search(minX: Float, minY: Float, maxX: Float, maxY: Float)(f: RTreeEntry[A] => Unit): Unit

Call the provided f function with entries whose MBR intersects with the given point.

Call the provided f function with entries whose MBR intersects with the given point.

Value Params
f

the function that receives found values

maxX

x value of the upper right point of the given rectangle

maxY

y value of the upper right point of the given rectangle

minX

x value of the lower left point of the given rectangle

minY

y value of the lower left point of the given rectangle

Concrete methods

def entries: IndexedSeq[RTreeEntry[A]]
Returns

a sequence of all entries

def nearestK(x: Float, y: Float, k: Int, maxDist: Float)(distCalc: DistanceCalculator): IndexedSeq[RTreeEntry[A]]

Returns a sequence of up to the specified number of nearest R-tree entries for the given point.

Returns a sequence of up to the specified number of nearest R-tree entries for the given point.

Search distance can be limited by the maxDist parameter.

Value Params
distCalc

a distance calculator provided according to geometry of indexed entries

k

a maximum number of nearest entries to collect

maxDist

an exclusive limit of the distance (infinity by default)

x

x value of the given point

y

y value of the given point

Returns

a sequence of the nearest entries

def nearestOption(x: Float, y: Float, maxDist: Float)(distCalc: DistanceCalculator): Option[RTreeEntry[A]]

Returns an option of the nearest R-tree entry for the given point.

Returns an option of the nearest R-tree entry for the given point.

Search distance can be limited by the maxDist parameter.

Value Params
distCalc

a distance calculator provided according to geometry of indexed entries

maxDist

an exclusive limit of the distance (infinity by default)

x

x value of the given point

y

y value of the given point

Returns

an option of the nearest entry

def searchAll(x: Float, y: Float): IndexedSeq[RTreeEntry[A]]

Returns a sequence of all entries in the R-tree whose MBR contains the given point.

Returns a sequence of all entries in the R-tree whose MBR contains the given point.

Value Params
x

x value of the given point

y

y value of the given point

Returns

a sequence of found values

def searchAll(minX: Float, minY: Float, maxX: Float, maxY: Float): IndexedSeq[RTreeEntry[A]]

Returns a sequence of all entries in the R-tree whose MBR intersects the given rectangle.

Returns a sequence of all entries in the R-tree whose MBR intersects the given rectangle.

Value Params
maxX

x value of the upper right point of the given rectangle

maxY

y value of the upper right point of the given rectangle

minX

x value of the lower left point of the given rectangle

minY

y value of the lower left point of the given rectangle

Returns

a sequence of found values

override def toString: String
Returns

a prettified string representation of the r-tree

Definition Classes
Any