Stellarium 0.15.2
List of all members | Public Slots | Signals | Public Member Functions
StelLocationMgr Class Reference

Manage the list of available location. More...

#include <StelLocationMgr.hpp>

+ Inheritance diagram for StelLocationMgr:
+ Collaboration diagram for StelLocationMgr:

Public Slots

const StelLocation locationForString (const QString &s) const
 Return the StelLocation for a given string Can match location name, or coordinates. More...
 
void changeLocationFromNetworkLookup ()
 Process answer from online lookup of IP address. More...
 
static QString sanitizeTimezoneStringForLocationDB (QString tzString)
 Check timezone string and return either the same or one that we use in the Stellarium location database. More...
 
static QString sanitizeTimezoneStringFromLocationDB (QString dbString)
 Attempt to translate a timezone name from those used in Stellarium's location database to a name which is known to Qt at runtime as result of QTimeZone::availableTimeZoneIds(). More...
 

Signals

void locationListChanged ()
 Can be used to detect changes to the full location list i.e. More...
 

Public Member Functions

 StelLocationMgr ()
 Default constructor which loads the list of locations from the base and user location files. More...
 
 StelLocationMgr (const LocationList &locations)
 Construct a StelLocationMgr which uses the locations given instead of loading them from the files. More...
 
void setLocations (const LocationList &locations)
 Replaces the loaded location list. More...
 
LocationList getAll () const
 Return the list of all loaded locations. More...
 
LocationMap getAllMap () const
 Returns a map of all loaded locations. The key is the location ID, suitable for a list view. More...
 
const StelLocation locationFromCLI () const
 Return the StelLocation from a CLI. More...
 
const StelLocationgetLastResortLocation () const
 Return a valid location when no valid one was found. More...
 
bool canSaveUserLocation (const StelLocation &loc) const
 Get whether a location can be permanently added to the list of user locations The main constraint is that the small string must be unique. More...
 
bool saveUserLocation (const StelLocation &loc)
 Add permanently a location to the list of user locations It is later identified by its small string. More...
 
bool canDeleteUserLocation (const QString &id) const
 Get whether a location can be deleted from the list of user locations If the location comes from the base read only list, it cannot be deleted. More...
 
bool deleteUserLocation (const QString &id)
 Delete permanently the given location from the list of user locations If the location comes from the base read only list, it cannot be deleted and false is returned. More...
 
void locationFromIP ()
 Find location via online lookup of IP address. More...
 
LocationMap pickLocationsNearby (const QString planetName, const float longitude, const float latitude, const float radiusDegrees)
 Find list of locations within. More...
 
LocationMap pickLocationsInCountry (const QString country)
 Find list of locations in a particular country only. More...
 

Detailed Description

Manage the list of available location.

Definition at line 34 of file StelLocationMgr.hpp.

Constructor & Destructor Documentation

StelLocationMgr::StelLocationMgr ( )

Default constructor which loads the list of locations from the base and user location files.

StelLocationMgr::StelLocationMgr ( const LocationList &  locations)

Construct a StelLocationMgr which uses the locations given instead of loading them from the files.

Member Function Documentation

bool StelLocationMgr::canDeleteUserLocation ( const QString &  id) const

Get whether a location can be deleted from the list of user locations If the location comes from the base read only list, it cannot be deleted.

Parameters
idthe location ID
bool StelLocationMgr::canSaveUserLocation ( const StelLocation loc) const

Get whether a location can be permanently added to the list of user locations The main constraint is that the small string must be unique.

void StelLocationMgr::changeLocationFromNetworkLookup ( )
slot

Process answer from online lookup of IP address.

bool StelLocationMgr::deleteUserLocation ( const QString &  id)

Delete permanently the given location from the list of user locations If the location comes from the base read only list, it cannot be deleted and false is returned.

Parameters
idthe location ID
LocationList StelLocationMgr::getAll ( ) const
inline

Return the list of all loaded locations.

Definition at line 49 of file StelLocationMgr.hpp.

LocationMap StelLocationMgr::getAllMap ( ) const
inline

Returns a map of all loaded locations. The key is the location ID, suitable for a list view.

Definition at line 52 of file StelLocationMgr.hpp.

const StelLocation& StelLocationMgr::getLastResortLocation ( ) const
inline

Return a valid location when no valid one was found.

Definition at line 58 of file StelLocationMgr.hpp.

const StelLocation StelLocationMgr::locationForString ( const QString &  s) const
slot

Return the StelLocation for a given string Can match location name, or coordinates.

const StelLocation StelLocationMgr::locationFromCLI ( ) const

Return the StelLocation from a CLI.

void StelLocationMgr::locationFromIP ( )

Find location via online lookup of IP address.

void StelLocationMgr::locationListChanged ( )
signal

Can be used to detect changes to the full location list i.e.

when the user added or removed locations

LocationMap StelLocationMgr::pickLocationsInCountry ( const QString  country)

Find list of locations in a particular country only.

LocationMap StelLocationMgr::pickLocationsNearby ( const QString  planetName,
const float  longitude,
const float  latitude,
const float  radiusDegrees 
)

Find list of locations within.

Parameters
radiusDegreesof selected (usually screen-clicked) coordinates.
static QString StelLocationMgr::sanitizeTimezoneStringForLocationDB ( QString  tzString)
staticslot

Check timezone string and return either the same or one that we use in the Stellarium location database.

If timezone name starts with "UTC", always return unchanged. This is required to store timezone names exactly as we know them, and not mix ours and corrent-IANA spelling flavour.

static QString StelLocationMgr::sanitizeTimezoneStringFromLocationDB ( QString  dbString)
staticslot

Attempt to translate a timezone name from those used in Stellarium's location database to a name which is known to Qt at runtime as result of QTimeZone::availableTimeZoneIds().

That list may be updated by OS anytime and is known to differ between OSes. Some spellings may be different, or in some cases some names get simply translated to "UTC+HH:MM" style. The empty string gets translated to "UTC".

bool StelLocationMgr::saveUserLocation ( const StelLocation loc)

Add permanently a location to the list of user locations It is later identified by its small string.

void StelLocationMgr::setLocations ( const LocationList &  locations)

Replaces the loaded location list.


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