19 #ifndef _STELLOCATIONMGR_HPP_ 20 #define _STELLOCATIONMGR_HPP_ 22 #include "StelLocation.hpp" 28 typedef QList<StelLocation> LocationList;
29 typedef QMap<QString,StelLocation> LocationMap;
30 typedef QMap<QByteArray,QByteArray> TimezoneNameMap;
49 LocationList
getAll()
const {
return locations.values();}
82 LocationMap
pickLocationsNearby(
const QString planetName,
const float longitude,
const float latitude,
const float radiusDegrees);
110 void generateBinaryLocationFile(
const QString& txtFile,
bool isUserLocation,
const QString& binFile)
const;
113 static LocationMap loadCities(
const QString& fileName,
bool isUserLocation);
114 static LocationMap loadCitiesBin(
const QString& fileName);
117 LocationMap locations;
127 static TimezoneNameMap locationDBToIANAtranslations;
132 #endif // _STELLOCATIONMGR_HPP_ const StelLocation locationForString(const QString &s) const
Return the StelLocation for a given string Can match location name, or coordinates.
Store the informations for a location on a planet.
StelLocationMgr()
Default constructor which loads the list of locations from the base and user location files...
LocationMap getAllMap() const
Returns a map of all loaded locations. The key is the location ID, suitable for a list view...
static QString sanitizeTimezoneStringFromLocationDB(QString dbString)
Attempt to translate a timezone name from those used in Stellarium's location database to a name whic...
Manage the list of available location.
const StelLocation locationFromCLI() const
Return the StelLocation from a CLI.
bool saveUserLocation(const StelLocation &loc)
Add permanently a location to the list of user locations It is later identified by its small string...
void locationListChanged()
Can be used to detect changes to the full location list i.e.
void setLocations(const LocationList &locations)
Replaces the loaded location list.
LocationMap pickLocationsInCountry(const QString country)
Find list of locations in a particular country only.
void changeLocationFromNetworkLookup()
Process answer from online lookup of IP address.
LocationMap pickLocationsNearby(const QString planetName, const float longitude, const float latitude, const float radiusDegrees)
Find list of locations within.
const StelLocation & getLastResortLocation() const
Return a valid location when no valid one was found.
static QString sanitizeTimezoneStringForLocationDB(QString tzString)
Check timezone string and return either the same or one that we use in the Stellarium location databa...
bool deleteUserLocation(const QString &id)
Delete permanently the given location from the list of user locations If the location comes from the ...
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 ...
LocationList getAll() const
Return the list of all loaded locations.
void locationFromIP()
Find location via online lookup of IP address.
bool canSaveUserLocation(const StelLocation &loc) const
Get whether a location can be permanently added to the list of user locations The main constraint is ...