libosmscout  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups
osmscout::LocationService Class Reference

The LocationService offers a number of methods for location lookup ( search for a certain location by its name) and location reverse lookup (retrieve the name of a location). More...

#include <LocationService.h>

Public Member Functions

 LocationService (const DatabaseRef &database)
 LocationService constructor. More...
 
bool ResolveAdminRegionHierachie (const AdminRegionRef &adminRegion, std::map< FileOffset, AdminRegionRef > &refs) const
 Resolve all parent regions of the given region (walk the region tree up to the root)Use AdminRegion::regionOffset and AdminRegion::parentRegionOffset to build the tree. More...
 
bool SearchForLocationByForm (const LocationFormSearchParameter &searchParameter, LocationSearchResult &result) const
 
bool SearchForLocationByString (const LocationStringSearchParameter &searchParameter, LocationSearchResult &result) const
 
bool SearchForPOIByForm (const POIFormSearchParameter &searchParameter, LocationSearchResult &result) const
 
bool VisitAdminRegionLocations (const AdminRegion &region, const PostalArea &postalArea, LocationVisitor &visitor) const
 Visit the location at the given region and all its sub regions. More...
 
bool VisitAdminRegionPOIs (const AdminRegion &region, POIVisitor &visitor) const
 Visit the POIs at the given region and all its sub regions. More...
 
bool VisitAdminRegions (AdminRegionVisitor &visitor) const
 Call the given visitor for each region in the index (deep first) More...
 
bool VisitLocationAddresses (const AdminRegion &region, const PostalArea &postalArea, const Location &location, AddressVisitor &visitor) const
 Visit all addresses at the given location. More...
 

Detailed Description

The LocationService offers a number of methods for location lookup ( search for a certain location by its name) and location reverse lookup (retrieve the name of a location).

The support different type of requests for different interfaces the visitor pattern is used.

Currently the following functionalities are supported:

  • Visit all region (recursivly)
  • Visit all locations of a region and (optionally) all locations of all sub regions.
  • Visit all addresses of a location (non recursive)
  • Resolve all parent regions for a given region
  • General interface for location lookup, offering default visitors for the individual index traversals.
  • Retrieve the addresses of one or more objects.

Constructor & Destructor Documentation

osmscout::LocationService::LocationService ( const DatabaseRef database)
explicit

LocationService constructor.

Parameters
databaseValid reference to a database instance

Member Function Documentation

bool osmscout::LocationService::ResolveAdminRegionHierachie ( const AdminRegionRef adminRegion,
std::map< FileOffset, AdminRegionRef > &  refs 
) const

Resolve all parent regions of the given region (walk the region tree up to the root)Use AdminRegion::regionOffset and AdminRegion::parentRegionOffset to build the tree.

Parameters
adminRegionThe region to start at
refsA map of all parent regions
Returns
True, if there was no error
bool osmscout::LocationService::VisitAdminRegionLocations ( const AdminRegion region,
const PostalArea postalArea,
LocationVisitor visitor 
) const

Visit the location at the given region and all its sub regions.

Parameters
regionRegion to start at
visitorVisitor
Returns
True, if there was no error
bool osmscout::LocationService::VisitAdminRegionPOIs ( const AdminRegion region,
POIVisitor visitor 
) const

Visit the POIs at the given region and all its sub regions.

Parameters
regionRegion to start at
visitorVisitor
Returns
True, if there was no error
bool osmscout::LocationService::VisitAdminRegions ( AdminRegionVisitor visitor) const

Call the given visitor for each region in the index (deep first)

Parameters
visitorThe visitor
Returns
True if the traversal finished and the visitor did not signal an error, else false
bool osmscout::LocationService::VisitLocationAddresses ( const AdminRegion region,
const PostalArea postalArea,
const Location location,
AddressVisitor visitor 
) const

Visit all addresses at the given location.

Parameters
regionRegion the location belongs to
locationThe location itself
visitorThe Visitor
Returns
True, if there was no error

The documentation for this class was generated from the following files: