2.0.0b10
catchment modelling framework
Loading...
Searching...
No Matches
Quadtree Class Reference

Detailed Description

A simple quad tree to check if the boundaries of geometries overlap or not

Public Member Functions

 __init__ (self, area, divisions=50)
 
 __call__ (self, bounds)
 
 append (self, obj, bounds)
 
 extend (self, objects_with_boundaries)
 
 iterbounds (self, bounds)
 

Constructor & Destructor Documentation

◆ __init__()

__init__ ( self,
area,
divisions = 50 )
:param area: The total area of the study area in m2
:param divisions: The number of divisions of the area, default is 20

Member Function Documentation

◆ __call__()

__call__ ( self,
bounds )
Get all objects in the given boundaries
:param bounds: The boundary rectangle of the tree. A 4 item sequence (xmin, ymin, xmax, ymax)
:return:

◆ append()

append ( self,
obj,
bounds )
Appends an object to the qtree using the given bounds.
:param obj: An object to append to the tree, must be hashable
:param bounds: The boundary rectangle of the object. A 4 item sequence (xmin, ymin, xmax, ymax)

◆ extend()

extend ( self,
objects_with_boundaries )
Extends the Quadtree with objects
:param objects_with_boundaries: an iterable of (object, bounds) tuples
:return:

◆ iterbounds()

iterbounds ( self,
bounds )
Iterates through all positions in the boundaries
:param bounds: The boundary rectangle. A 4 item sequence (xmin, ymin, xmax, ymax)
:return: (i,j) position tuple