Loading...
Searching...
No Matches
mdds::point_quad_tree< _Key, _Value > Class Template Reference

## Classes

class | data_not_found
class | node_access
struct | point
class | search_results

## Public Types

typedef _Key | key_type
typedef _Value | value_type
typedef size_t | size_type
typedef ::std::vector< value_type > | data_array_type

## Public Member Functions

| point_quad_tree (const point_quad_tree &r)
void | insert (key_type x, key_type y, value_type data)
void | search_region (key_type x1, key_type y1, key_type x2, key_type y2, data_array_type &result) const
search_results | search_region (key_type x1, key_type y1, key_type x2, key_type y2) const
value_type | find (key_type x, key_type y) const
void | remove (key_type x, key_type y)
void | swap (point_quad_tree &r)
void | clear ()
bool | empty () const
size_t | size () const
node_access | get_node_access () const
point_quad_tree & | operator= (const point_quad_tree &r)
bool | operator== (const point_quad_tree &r) const
bool | operator!= (const point_quad_tree &r) const

## Member Function Documentation

## clear()

template<typename _Key, typename _Value>

void mdds::point_quad_tree< _Key, _Value >::clear | ( |  | ) |

Remove all stored data.

## empty()

template<typename _Key, typename _Value>

bool mdds::point_quad_tree< _Key, _Value >::empty | ( |  | ) | const

Check whether or not the container is empty.

Returns
  bool true if empty, false otherwise.

## find()

template<typename _Key, typename _Value>

point_quad_tree< _Key, _Value >::value_type mdds::point_quad_tree< _Key, _Value >::find | ( | key_type | x,
|  | key_type | y ) const

Find data at specified coordinates. If no data exists at the specified coordinates, this method throws a `point_quad_tree::data_not_found` exception.

Parameters

  x | x coordinate
  y | y coordinate

Returns
  data found at the specified coordinates.

## get_node_access()

template<typename _Key, typename _Value>

point_quad_tree< _Key, _Value >::node_access mdds::point_quad_tree< _Key, _Value >::get_node_access | ( |  | ) | const

Get read-only access to the internal quad node tree.

Returns
  root node

## insert()

template<typename _Key, typename _Value>

void mdds::point_quad_tree< _Key, _Value >::insert | ( | key_type | x,
|  | key_type | y,
|  | value_type | data )

Insert a new data at specified coordinates. It overwrites existing data in case one exists at the specified coordinates.

Parameters

  x | x coordinate of new data position
  y | y coordinate of new data position
  data | data being inserted at the specified coordinates.

## remove()

template<typename _Key, typename _Value>

void mdds::point_quad_tree< _Key, _Value >::remove | ( | key_type | x,
|  | key_type | y )

Remove data from specified coordinates. This method does nothing if no data exists at the specified coordinates.

Parameters

  x | x coordinate
  y | y coordinate

## search_region() [1/2]

template<typename _Key, typename _Value>

point_quad_tree< _Key, _Value >::search_results mdds::point_quad_tree< _Key, _Value >::search_region | ( | key_type | x1,
|  | key_type | y1,
|  | key_type | x2,
|  | key_type | y2 ) const

Perform region search (aka window search), that is, find all points that fall within specified rectangular region. The boundaries are inclusive.

Parameters

  x1 | left coordinate of the search region
  y1 | top coordinate of the search region
  x2 | right coordinate of the search region
  y2 | bottom coordinate of the search region

Returns
  search result object containing all data found within the specified region.

## search_region() [2/2]

template<typename _Key, typename _Value>

void mdds::point_quad_tree< _Key, _Value >::search_region | ( | key_type | x1,
|  | key_type | y1,
|  | key_type | x2,
|  | key_type | y2,
|  | data_array_type & | result ) const

Perform region search (aka window search), that is, find all points that fall within specified rectangular region. The boundaries are inclusive.

Parameters

  x1 | left coordinate of the search region
  y1 | top coordinate of the search region
  x2 | right coordinate of the search region
  y2 | bottom coordinate of the search region
  result | this array will contain all data found without specified region.

## size()

template<typename _Key, typename _Value>

size_t mdds::point_quad_tree< _Key, _Value >::size | ( |  | ) | const

Get the number of stored data.

Returns
  the number of data currently stored in the container.

## swap()

template<typename _Key, typename _Value>

void mdds::point_quad_tree< _Key, _Value >::swap | ( | point_quad_tree< _Key, _Value > & | r | ) |

Swap the internal state with another instance.

Parameters

  r | another instance to swap internals with.