|
libmoost
|
geo_map is a container that associates locations with objects of type Data.
More...
#include <geo_map.hpp>
Classes | |
| struct | location |
| Key/lookup type of geo_map. More... | |
Public Types | |
| typedef std::pair< location, Data > | value_type |
The type of object, pair<const location, Data>, stored in the geo_map. | |
| typedef std::vector < value_type >::const_iterator | const_iterator |
| Const iterator used to iterate through a geo_map. | |
Public Member Functions | |
| geo_map () | |
| Constructs an empty geo_map. | |
| void | reserve (int num_entries) |
| reserve space | |
| const_iterator | insert (const value_type &value, bool ordered=true) |
| Inserts value into the geo_map. | |
| void | order () |
| Orders the geo_map. Only necessary if unordered insert was invoked. | |
| template<class OutputIterator > | |
| void | find (location query, float radius, OutputIterator result) |
| Finds all values that lie within a distance radius of location. | |
| template<class OutputIterator > | |
| void | find_distances (location query, float radius, OutputIterator result) |
| Finds all values, and their distances from location inside a distace of radius. | |
| template<class OutputIterator > | |
| void | find (location min, location max, OutputIterator result) |
| Finds all values that lie within a bounding box. | |
| void | clear () |
| Clears all values from the geo_map. | |
| void | swap (geo_map< Data > &table) |
| Exchanges the contents of the geo_map with the contents of table. | |
| size_t | size () |
| Returns the number of elements in the geo_map. | |
| const_iterator | begin () const |
Returns a const_iterator pointing to the beginning of the geo_map. | |
| const_iterator | end () const |
Returns a const_iterator pointing to the end of the geo_map. | |
Private Types | |
| typedef std::vector < value_type >::iterator | iterator |
Private Member Functions | |
| void | degrees2radians (location &loc) |
| convert a locations latitude and longitude from degrees to radians | |
| float | radius2deltalon (location &loc, float radius) |
| construct a longitude delta for a query location in radians and a given radius | |
| float | haversine_dist (location &x, location &y) |
| distance between two locations using the Haversine formula | |
Static Private Member Functions | |
| static double | pi () |
| The math constant pi. | |
| static double | R () |
| Earth's mean radius, in kilometers. | |
| static bool | cmp_value_type (const value_type &value1, const value_type &value2) |
Private Attributes | |
| std::vector< value_type > | m_values |
geo_map is a container that associates locations with objects of type Data.
It is a pair associative container, meaning that its value type is pair<const Location, Data>. Elements in the container may have duplicate locations or values.
Elements in the container may be iterated, or searched for given a geographic bounding box, or a point and radius.
Definition at line 47 of file geo_map.hpp.
| typedef std::vector<value_type>::const_iterator moost::container::geo_map< Data >::const_iterator |
Const iterator used to iterate through a geo_map.
Definition at line 67 of file geo_map.hpp.
typedef std::vector<value_type>::iterator moost::container::geo_map< Data >::iterator [private] |
Definition at line 72 of file geo_map.hpp.
| typedef std::pair<location, Data> moost::container::geo_map< Data >::value_type |
The type of object, pair<const location, Data>, stored in the geo_map.
Definition at line 64 of file geo_map.hpp.
| moost::container::geo_map< Data >::geo_map | ( | ) | [inline] |
Constructs an empty geo_map.
Definition at line 130 of file geo_map.hpp.
| const_iterator moost::container::geo_map< Data >::begin | ( | ) | const [inline] |
Returns a const_iterator pointing to the beginning of the geo_map.
Definition at line 272 of file geo_map.hpp.

| void moost::container::geo_map< Data >::clear | ( | ) | [inline] |
Clears all values from the geo_map.
Definition at line 251 of file geo_map.hpp.
| static bool moost::container::geo_map< Data >::cmp_value_type | ( | const value_type & | value1, |
| const value_type & | value2 | ||
| ) | [inline, static, private] |
Definition at line 82 of file geo_map.hpp.
| void moost::container::geo_map< Data >::degrees2radians | ( | location & | loc | ) | [inline, private] |
convert a locations latitude and longitude from degrees to radians
Definition at line 88 of file geo_map.hpp.


| const_iterator moost::container::geo_map< Data >::end | ( | ) | const [inline] |
Returns a const_iterator pointing to the end of the geo_map.
Definition at line 274 of file geo_map.hpp.

| void moost::container::geo_map< Data >::find | ( | location | query, |
| float | radius, | ||
| OutputIterator | result | ||
| ) | [inline] |
Finds all values that lie within a distance radius of location.
| query | the query point |
| radius | the bounding search distance from location |
| result | an Output Iterator to which the range of matching values are copied |
Definition at line 168 of file geo_map.hpp.

| void moost::container::geo_map< Data >::find | ( | location | min, |
| location | max, | ||
| OutputIterator | result | ||
| ) | [inline] |
Finds all values that lie within a bounding box.
| min | the southwest corner of the bounding box. |
| max | the northeast corner of the bounding box. |
| result | an Output Iterator to which the range of matching values are copied |
Definition at line 229 of file geo_map.hpp.

| void moost::container::geo_map< Data >::find_distances | ( | location | query, |
| float | radius, | ||
| OutputIterator | result | ||
| ) | [inline] |
Finds all values, and their distances from location inside a distace of radius.
| query | the query point |
| radius | the bounding search distance from location |
| result | an Output Iterator to which the range of matching value,distance pairs are copied |
Definition at line 203 of file geo_map.hpp.

| float moost::container::geo_map< Data >::haversine_dist | ( | location & | x, |
| location & | y | ||
| ) | [inline, private] |
distance between two locations using the Haversine formula
Definition at line 112 of file geo_map.hpp.


| const_iterator moost::container::geo_map< Data >::insert | ( | const value_type & | value, |
| bool | ordered = true |
||
| ) | [inline] |
Inserts value into the geo_map.
Definition at line 140 of file geo_map.hpp.


| void moost::container::geo_map< Data >::order | ( | ) | [inline] |
Orders the geo_map. Only necessary if unordered insert was invoked.
Definition at line 157 of file geo_map.hpp.
| static double moost::container::geo_map< Data >::pi | ( | ) | [inline, static, private] |
The math constant pi.
Definition at line 75 of file geo_map.hpp.

| static double moost::container::geo_map< Data >::R | ( | ) | [inline, static, private] |
Earth's mean radius, in kilometers.
Definition at line 79 of file geo_map.hpp.

| float moost::container::geo_map< Data >::radius2deltalon | ( | location & | loc, |
| float | radius | ||
| ) | [inline, private] |
construct a longitude delta for a query location in radians and a given radius
Definition at line 95 of file geo_map.hpp.


| void moost::container::geo_map< Data >::reserve | ( | int | num_entries | ) | [inline] |
reserve space
Definition at line 134 of file geo_map.hpp.
| size_t moost::container::geo_map< Data >::size | ( | ) | [inline] |
Returns the number of elements in the geo_map.
Definition at line 266 of file geo_map.hpp.
| void moost::container::geo_map< Data >::swap | ( | geo_map< Data > & | table | ) | [inline] |
Exchanges the contents of the geo_map with the contents of table.
| table | another geo_map of the same type as this whose content is swapped with that of this container. |
Definition at line 259 of file geo_map.hpp.
std::vector< value_type > moost::container::geo_map< Data >::m_values [private] |
Definition at line 125 of file geo_map.hpp.