Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StelCore: reduce confusion around location signals #3180

Merged
merged 42 commits into from
Jun 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
f9e5122
StelCore: reduce one location signal
gzotti Apr 14, 2023
83d1420
Simplifications
gzotti Apr 15, 2023
73ddd85
Add a more complete constructor
gzotti Apr 15, 2023
0544b66
Do not load auto-landscape (again) when target planet reached, but be…
gzotti Apr 15, 2023
c8d5812
Avoid update if no time passed
gzotti Apr 16, 2023
5f0f858
cosmetics
gzotti Apr 16, 2023
710b0fd
Try a slow transition with lots of debug output
gzotti Apr 16, 2023
064f346
Suppress computing RTS when on transition to a new location
gzotti Apr 16, 2023
e1958a2
Add debug output (temporarily)
gzotti Apr 16, 2023
000029a
Avoid computing minor bodies while on a transitioning observer
gzotti Apr 16, 2023
d72a404
Cosmetics: Make location change faster
gzotti Apr 16, 2023
61e078a
Revert ec17f40bbd4459f64 and apply better solution (Fix #3173)
gzotti Apr 16, 2023
667a306
Fix for Qt5
gzotti Apr 16, 2023
ad9be8c
Refactoring: a bit simplification the code
alex-w Apr 18, 2023
8f7aec6
Fix a few properties
gzotti Apr 24, 2023
cc4b9d7
SUG: Add missing doc for some flags
gzotti Apr 24, 2023
de392bd
When autoselecting landscape and planet landscape not found,
gzotti Apr 25, 2023
42da3f7
Sync a different signal
gzotti Apr 25, 2023
745d83f
Load zero landscape if landscape not found.
gzotti Apr 28, 2023
c998beb
Unselect object when it is the upcoming location's planet
gzotti Apr 29, 2023
666c23b
Add diagnostic warning if default location is broken
gzotti Apr 30, 2023
65b5aae
Refactoring
gzotti Apr 30, 2023
417221b
When clicking on the map, apply a zero landscape with color from the …
gzotti Apr 30, 2023
0f55fb9
Fix Qt5 compilation
gzotti Apr 30, 2023
72a4fd5
And complete that fix...
gzotti Apr 30, 2023
6f005f8
Obvious fix
gzotti May 1, 2023
a856d74
restore proper loading of landscapeID
gzotti May 18, 2023
c89cfb4
Make planet landscape loading more explicit
gzotti May 18, 2023
0701e6b
Allow dynamic loading of colorized zero landscape everywhere
gzotti May 18, 2023
7014dc1
Move 2 buttons into location dialog
gzotti May 18, 2023
b698625
Some more auto-color zero landscapes
gzotti Jun 16, 2023
5d0b079
Cosmetic fix for GUI
alex-w Jun 16, 2023
01e0395
Another cosmetic fix
alex-w Jun 16, 2023
f828aba
Avoid auto-enabling atmosphere if we stay on the same planet
gzotti Jun 16, 2023
5c3ce93
Initialize value, and avoid division by zero
gzotti Jun 16, 2023
0ca8928
Use ZeroColor landscape also only when "Autoselect Landscapes"
gzotti Jun 16, 2023
295c0ef
Fix special handling of earth map
gzotti Jun 16, 2023
b5788b5
SUG: interface changes, new figures
gzotti Jun 16, 2023
122dbbe
SUG: cosmetics
gzotti Jun 16, 2023
cc18279
Fix a bad connection definition
gzotti Jun 16, 2023
7c9a6a2
Use actual planet texture name
gzotti Jun 16, 2023
0ab2920
Fix missing include
alex-w Jun 17, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions guide/app_config_ini.tex
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ \subsection{\big[navigation\big]}
or \emph{Preset} (start at time defined by preset\_sky\_time)\\%\midrule
flag\_enable\_zoom\_keys & bool & Set to \emph{false} if you want to disable the zoom\\%\midrule
flag\_manual\_zoom & bool & Set to \emph{false} for normal zoom behaviour as described in this guide.
When set to true, the auto zoom feature only moves in a small amount and must be pressed many times\\%\midrule
When set to \emph{true}, the auto zoom feature only moves in a small amount and must be pressed many times\\%\midrule
flag\_enable\_move\_keys & bool & Set to \emph{false} if you want to disable the arrow keys\\%\midrule
flag\_enable\_mouse\_navigation & bool & Set to \emph{false} if you want to disable the mouse pan (drag).\\%\midrule
flag\_enable\_mouse\_zooming & bool & Set to \emph{false} if you want to disable the mouse zooming (mousewheel).\\%\midrule
Expand All @@ -646,7 +646,6 @@ \subsection{\big[navigation\big]}
zoom\_speed & float & Sets the zoom speed\\%\midrule
viewing\_mode & string & If set to \emph{horizon}, the viewing mode simulate an alt/azi mount,
if set to \emph{equator}, the viewing mode simulates an equatorial mount\\%\midrule
flag\_manual\_zoom & bool & Set to \emph{true} if you want to auto-zoom in incrementally.\\%\midrule
auto\_zoom\_out\_resets\_direction & bool & Set to \emph{true} if you want to auto-zoom restoring direction.\\%\midrule
time\_correction\_algorithm & string & Algorithm of DeltaT correction.\\\bottomrule %% TODO: list values! And write ref. chapter!
\end{longtable}
Expand Down Expand Up @@ -952,7 +951,9 @@ \subsection{\big[viewing\big]}
flag\_night & bool & Enable night mode (red-only mode) on startup\\\midrule
light\_pollution\_luminance & float & Sets the level of the light pollution simulation\\\midrule %% TODO: WHAT IS THIS?
use\_luminance\_adaptation & bool & Enable dynamic eye adaptation\\\midrule %% TODO: DESCRIBE!
sky\_brightness\_label\_threshold & float & Sky brightness [$cd/m^2$] to show infotext in black \\ %%
sky\_brightness\_label\_threshold & float & Sky brightness [$cd/m^2$] to show infotext in black \\\midrule %%
flag\_landscape\_autoselection & bool & load fitting landscape after changing planet (use \emph{zero} landscape when no fitting found).\\
flag\_environment\_auto\_enable & bool & Enable/disable atmosphere, fog and cardinals for observer location when switching planet.\\
\bottomrule
\end{longtable}

Expand Down
16 changes: 11 additions & 5 deletions guide/ch_interface.tex
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ \section{Setting Your Location}
\label{sec:gui:location}

\begin{figure}[htbp]
\centering\includegraphics[width=0.75\textwidth]{location_dialog.png}
\centering\includegraphics[width=0.85\textwidth]{location_dialog.png}
\caption{Location window}
\label{fig:gui:location}
\end{figure}
Expand Down Expand Up @@ -113,6 +113,16 @@ \section{Setting Your Location}
``use as default'' checkbox, disable ``Get location from Network'',
and close the location window.

Two settings may influence the Landscape when changing locations:
\begin{description}
\item[Auto select landscapes] When changing the planet,
a fitting landscape panorama will be shown when available.
Also, \newFeature{23.2} when clicking on the earth map,
a zero-altitude landscape is displayed in the approximate color of that location (taken from the map).
\item[Auto-enable atmosphere] When changing planet during
location change, the atmosphere will be switched as required.
\end{description}

\subsection{Time Zones}
\label{sec:gui:location:timezones}
Locations in Stellarium's location database include their respective
Expand Down Expand Up @@ -337,8 +347,6 @@ \subsection{The Tools Tab}
\item[Select single constellation] When active, clicking on a star
that is member in the constellation lines will make the
constellation stand out. See section~\ref{sec:starlore:singleConstellations} for details.
\item[Auto-enabling for the environment] When changing planet during
location change, atmosphere will be switched as required.
\item[Dithering] options to allow select better simulation of sky on different hardware.
\item[Auto zoom out returns to initial direction of view] When enabled,
this option changes the behavior of the zoom out key
Expand All @@ -363,8 +371,6 @@ \subsection{The Tools Tab}
Usually it should be enabled. (See~\ref{sec:Concepts:Parallax:Topocentric})
\item[Include nutation] Compute the slight wobble of earth's
axis. This feature is active only about 500 years around J2000.0.
\item[Auto select landscapes] When changing the planet in the location
panel, a fitting landscape panorama will be shown when available.
\item[Indication for mount mode] You can activate the short display of a message when switching type of used mount.
\item[Edit keyboard shortcuts\ldots] See section~\ref{sec:gui:help:hotkeys}.
\item[Mouse cursor timeout] You can decide whether, and when, the
Expand Down
Binary file modified guide/pictures/config_dialog_extras_tab.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified guide/pictures/config_dialog_info_tab.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified guide/pictures/config_dialog_main_tab.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified guide/pictures/config_dialog_time_tab.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified guide/pictures/config_dialog_tools_tab.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified guide/pictures/location_dialog.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion plugins/RemoteSync/src/SyncClientHandlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ bool ClientLocationHandler::handleMessage(QDataStream &stream, SyncProtocol::tPa
//create a normal observer
core->setObserver(new StelObserver(msg.stelLocation));
}
emit core->targetLocationChanged(msg.stelLocation);
emit core->targetLocationChanged(msg.stelLocation, QString());
emit core->locationChanged(core->getCurrentLocation());


Expand Down
3 changes: 2 additions & 1 deletion plugins/RemoteSync/src/SyncServerEventSenders.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ Time TimeEventSender::constructMessage()

LocationEventSender::LocationEventSender()
{
connect(core,SIGNAL(targetLocationChanged(StelLocation)), this, SLOT(reactToStellariumEvent()));
//connect(core,&StelCore::targetLocationChanged, this, &LocationEventSender::reactToStellariumEvent);
connect(core,&StelCore::locationChanged, this, &LocationEventSender::reactToStellariumEvent);
}

Location LocationEventSender::constructMessage()
Expand Down
24 changes: 12 additions & 12 deletions src/core/StelCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1091,7 +1091,9 @@ void StelCore::returnToDefaultLocation()
StelLocationMgr& locationMgr = StelApp::getInstance().getLocationMgr();
StelLocation loc = locationMgr.locationForString(defaultLocationID);
if (loc.isValid())
moveObserverTo(loc, 0.);
moveObserverTo(loc, 1., 2.);
else
qDebug() << "StelCore::returnToDefaultLocation: Location " << loc.serializeToLine().replace('\t', '|') << "is invalid. Store an entry from the locations list as default location.";
}

void StelCore::returnToHome()
Expand Down Expand Up @@ -1231,7 +1233,7 @@ void StelCore::moveObserverToSelected()
if (!results.isEmpty())
loc = results.value(results.firstKey()); // ...and use it!

moveObserverTo(loc);
moveObserverTo(loc, 1, 1, pl->getEnglishName());
}
}
else
Expand All @@ -1240,15 +1242,10 @@ void StelCore::moveObserverToSelected()
if (ni)
{
// We need to move to the nomenclature item's host planet.
StelLocation loc; // = getCurrentLocation();
loc.planetName = ni->getPlanet()->getEnglishName();
loc.name=ni->getEnglishName();
loc.state = "";
loc.setLongitude(ni->getLongitude());
loc.setLatitude(ni->getLatitude());
loc.lightPollutionLuminance = 0;
StelLocation loc(ni->getEnglishName(), "", "", ni->getPlanet()->getEnglishName(), ni->getLongitude(), ni->getLatitude(), 0, 0, getCurrentTimeZone(), 1, 'X', ni->getPlanet()->getEnglishName());
loc.lightPollutionLuminance = 0; // be dead sure it's zero!

moveObserverTo(loc);
moveObserverTo(loc, 1, 1, pl->getEnglishName());
objmgr->unSelect(); // no use to keep it: Marker will flicker around the screen.
}
}
Expand Down Expand Up @@ -1285,7 +1282,8 @@ void StelCore::setObserver(StelObserver *obs)
// Smoothly move the observer to the given location
void StelCore::moveObserverTo(const StelLocation& target, double duration, double durationIfPlanetChange, const QString &landscapeID)
{
double d = (getCurrentLocation().planetName==target.planetName) ? duration : durationIfPlanetChange;
const double d = (getCurrentLocation().planetName==target.planetName) ? duration : durationIfPlanetChange;
//qDebug() << "StelCore::moveObserverTo" << target.name << "in" << d << "seconds with Landscape" << landscapeID ;
if (d>0.)
{
StelLocation curLoc = getCurrentLocation();
Expand Down Expand Up @@ -1321,7 +1319,7 @@ void StelCore::moveObserverTo(const StelLocation& target, double duration, doubl
}
}
}
emit targetLocationChanged(target, landscapeID);
emit targetLocationChanged(target, landscapeID); // inform others about our next location. E.g., let LandscapeMgr load a new landscape.
emit locationChanged(getCurrentLocation());
}

Expand Down Expand Up @@ -2021,7 +2019,9 @@ void StelCore::updateTime(double deltaTime)
position = newObs;
}
if (position->update(deltaTime))
{
emit locationChanged(getCurrentLocation());
}

// Position of sun and all the satellites (ie planets)
// GZ maybe setting this static can speedup a bit?
Expand Down
5 changes: 3 additions & 2 deletions src/core/StelCore.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -793,8 +793,9 @@ public slots:
signals:
//! This signal is emitted when the observer location has changed.
void locationChanged(const StelLocation&);
//! This signal is emitted whenever the targeted location changes. The second parameter can transmit a landscapeID.
void targetLocationChanged(const StelLocation&, const QString& = QString());
//! This signal is emitted whenever the targeted location changes, i.e., at the onset of location transitions.
//! The second parameter can transmit a landscapeID or should be QString().
void targetLocationChanged(const StelLocation& loc, const QString& id);
//! This signal is emitted when the current timezone name is changed.
void currentTimeZoneChanged(const QString& tz);
//! This signal is emitted when custom timezone use is activated (true) or deactivated (false).
Expand Down
8 changes: 8 additions & 0 deletions src/core/StelLocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ StelLocation::StelLocation(const QString &lName, const QString &lState, const QS
{
}

StelLocation::StelLocation(const QString &lName, const QString &lState, const QString &lRegion, const QString &plName, const float lng, const float lat, const int alt,
const int populationK, const QString &timeZone, const int bortleIndex, const QChar roleKey, const QString &landscapeID)
: StelLocation(lName, lState, lRegion, lng, lat, alt, populationK, timeZone, bortleIndex, roleKey, landscapeID)
{
planetName=plName;
}


// Output the location as a string ready to be stored in the user_location file
QString StelLocation::serializeToLine() const
{
Expand Down
5 changes: 4 additions & 1 deletion src/core/StelLocation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ class StelLocation
{
public:
StelLocation() : altitude(0), population(0), role('X'), isUserLocation(true), longitude(0.f), latitude(0.f) {}
//! constructor for ad-hoc locations.
//! constructors for ad-hoc locations. The first, shorter version is only for earth locations
//! @arg lName location name
//! @arg lState may be usedful if region has more than one such name
//! @arg lRegion must be the long name of UN UM49 only! (E.g., "Western Europe")
//! @arg plName planetName. This must be identical to the englishName of a solar system object.
//! @arg lng geographical longitude, east-positive, degrees
//! @arg lat geographical latitude, north-positive, degrees
//! @arg alt altitude above mean sea level
Expand All @@ -45,6 +46,8 @@ class StelLocation
//! @arg landscapeID a fitting landscape
StelLocation(const QString &lName, const QString &lState, const QString &lRegion, const float lng, const float lat, const int alt,
const int populationK, const QString &timeZone, const int bortleIndex, const QChar roleKey='X', const QString &landscapeID=QString());
StelLocation(const QString &lName, const QString &lState, const QString &lRegion, const QString &plName, const float lng, const float lat, const int alt,
const int populationK, const QString &timeZone, const int bortleIndex, const QChar roleKey, const QString &landscapeID);

//! Return a short string which can be used in a list view.
QString getID() const;
Expand Down
59 changes: 51 additions & 8 deletions src/core/StelLocationMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@
*/

#include "StelLocationMgr.hpp"
#include "SolarSystem.hpp"
#include "StelLocationMgr_p.hpp"

#include "StelApp.hpp"
#include "StelCore.hpp"
#include "StelFileMgr.hpp"
#include "StelModuleMgr.hpp"
#include "StelUtils.hpp"
#include "StelJsonParser.hpp"

Expand Down Expand Up @@ -491,6 +493,10 @@ StelLocationMgr::StelLocationMgr()
#endif
// Init to Paris France because it's the center of the world.
lastResortLocation = locationForString(conf->value("init_location/last_location", "Paris, Western Europe").toString());

planetName="Earth";
planetSurfaceMap=QImage(":/graphicGui/miscWorldMap.jpg");
connect(StelApp::getInstance().getCore(), SIGNAL(locationChanged(StelLocation)), this, SLOT(changePlanetMapForLocation(StelLocation)));
}

StelLocationMgr::~StelLocationMgr()
Expand Down Expand Up @@ -1075,8 +1081,8 @@ void StelLocationMgr::changeLocationFromGPSQuery(const StelLocation &locin)
loc.name=QString("GPS %1%2 %3%4")
.arg(loc.getLatitude()<0?"S":"N").arg(qRound(abs(loc.getLatitude())))
.arg(loc.getLongitude()<0?"W":"E").arg(qRound(abs(loc.getLongitude())));

core->moveObserverTo(loc, 0.0, 0.0);
QColor color=getColorForCoordinates(loc.getLongitude(), loc.getLatitude());
core->moveObserverTo(loc, 0.0, 0.0, QString("ZeroColor(%1)").arg(Vec3f(color).toStr()));
if (nmeaHelper)
{
if (verbose)
Expand Down Expand Up @@ -1154,15 +1160,17 @@ void StelLocationMgr::changeLocationFromNetworkLookup()
// Ensure that ipTimeZone is a valid IANA timezone name!
QTimeZone ipTZ(ipTimeZone.toUtf8());
core->setCurrentTimeZone( !ipTZ.isValid() || ipTimeZone.isEmpty() ? "LMST" : ipTimeZone);
core->moveObserverTo(loc, 0.0, 0.0);
QColor color=getColorForCoordinates(loc.getLongitude(), loc.getLatitude());
core->moveObserverTo(loc, 0.0, 0.0, QString("ZeroColor(%1)").arg(Vec3f(color).toStr()));

QSettings* conf = StelApp::getInstance().getSettings();
conf->setValue("init_location/last_location", QString("%1, %2").arg(latitude).arg(longitude));
}
catch (const std::exception& e)
{
qDebug() << "Failure getting IP-based location: answer is in not acceptable format! Error: " << e.what()
<< "\nLet's use Paris, France as default location...";
core->moveObserverTo(getLastResortLocation(), 0.0, 0.0); // Answer is not in JSON format! A possible block by DNS server or firewall
core->moveObserverTo(getLastResortLocation(), 0.0, 0.0, "guereins"); // Answer is not in JSON format! A possible block by DNS server or firewall
}
}
else
Expand All @@ -1173,7 +1181,7 @@ void StelLocationMgr::changeLocationFromNetworkLookup()
networkReply->deleteLater();
}

LocationMap StelLocationMgr::pickLocationsNearby(const QString planetName, const float longitude, const float latitude, const float radiusDegrees)
LocationMap StelLocationMgr::pickLocationsNearby(const QString &planetName, const float longitude, const float latitude, const float radiusDegrees)
{
QMap<QString, StelLocation> results;
QMapIterator<QString, StelLocation> iter(locations);
Expand All @@ -1190,7 +1198,7 @@ LocationMap StelLocationMgr::pickLocationsNearby(const QString planetName, const
return results;
}

LocationMap StelLocationMgr::pickLocationsInRegion(const QString region)
LocationMap StelLocationMgr::pickLocationsInRegion(const QString &region)
{
QMap<QString, StelLocation> results;
QMapIterator<QString, StelLocation> iter(locations);
Expand Down Expand Up @@ -1324,13 +1332,13 @@ QStringList StelLocationMgr::getRegionNames(const QString& planet) const
return allregions;
}

QString StelLocationMgr::pickRegionFromCountryCode(const QString countryCode)
QString StelLocationMgr::pickRegionFromCountryCode(const QString &countryCode)
{
QMap<QString, QString>::ConstIterator i = countryCodeToRegionMap.find(countryCode);
return (i!=countryCodeToRegionMap.constEnd()) ? i.value() : QString();
}

QString StelLocationMgr::pickRegionFromCountry(const QString country)
QString StelLocationMgr::pickRegionFromCountry(const QString &country)
{
QMap<QString, QString>::ConstIterator i = countryNameToCodeMap.find(country);
QString code = (i!=countryNameToCodeMap.constEnd()) ? i.value() : QString();
Expand Down Expand Up @@ -1556,3 +1564,38 @@ QStringList StelLocationMgr::getAllTimezoneNames() const
ret.sort();
return ret;
}

// To be connected from StelCore::locationChanged(loc)
void StelLocationMgr::changePlanetMapForLocation(StelLocation loc)
{
if (loc.planetName==planetName)
return;

planetName=loc.planetName;
if (planetName=="Earth")
planetSurfaceMap=QImage(":/graphicGui/miscWorldMap.jpg");
else
{
SolarSystem *ssm=GETSTELMODULE(SolarSystem);
PlanetP p=ssm->searchByEnglishName(loc.planetName); // nullptr for "SpaceShip" transitions
QString mapName="textures/" + (p ? p->getTextMapName() : planetName) + ".png";

if (!planetSurfaceMap.load(StelFileMgr::findFile(mapName, StelFileMgr::File)))
{
// texture not found. Use a gray pixel.
planetSurfaceMap=QImage(16,16,QImage::Format_RGB32);
planetSurfaceMap.fill(QColor(64, 64, 64));
}
}
}

QColor StelLocationMgr::getColorForCoordinates(const double lng, const double lat) const
{
QPoint imgPoint( (lng+180.)/ 360. * planetSurfaceMap.width(),
(90.-lat) / 180. * planetSurfaceMap.height());

// Sample the map pixel color. Use a small box to avoid 1-pixel surprises.
QImage sampledPix=planetSurfaceMap.copy(QRect(imgPoint-QPoint(1,1), QSize(2,2))).scaled(1,1);
return sampledPix.pixelColor(0,0);

}
20 changes: 16 additions & 4 deletions src/core/StelLocationMgr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <QObject>
#include <QMetaType>
#include <QMap>
#include <QImage>
#ifdef Q_OS_WIN
#include <QtPositioning/QGeoPositionInfoSource>
#endif
Expand Down Expand Up @@ -91,17 +92,17 @@ class StelLocationMgr : public QObject
bool deleteUserLocation(const QString& id);

//! Find list of locations within @param radiusDegrees of selected (usually screen-clicked) coordinates.
LocationMap pickLocationsNearby(const QString planetName, const float longitude, const float latitude, const float radiusDegrees);
LocationMap pickLocationsNearby(const QString& planetName, const float longitude, const float latitude, const float radiusDegrees);
//! Find list of locations in a particular region only.
LocationMap pickLocationsInRegion(const QString region);
LocationMap pickLocationsInRegion(const QString& region);

//! return a QStringList of region names by planet (return all list of regions if planet name is empty)
QStringList getRegionNames(const QString& planet = "") const;

//! Pick region name from ISO 3166-1 two-letter country codes
static QString pickRegionFromCountryCode(const QString countryCode);
static QString pickRegionFromCountryCode(const QString& countryCode);
//! Pick region name from country English name
static QString pickRegionFromCountry(const QString country);
static QString pickRegionFromCountry(const QString& country);
//! Pick region name from region code
static QString pickRegionFromCode(int regionCode);

Expand Down Expand Up @@ -136,6 +137,9 @@ public slots:
//! return a QStringList of valid timezone names in Stellarium's location database.
QStringList getAllTimezoneNames() const;

//! Retrieve a color from coordinate lookup into the current planet texture (or specialized earth map)
QColor getColorForCoordinates(const double lng, const double lat) const;

#ifdef ENABLE_GPS
//! Try to get a location from GPS lookup.
//! This prefers GPSD on non-Windows platforms, and uses Qt positioning with a NMEA serial device otherwise
Expand Down Expand Up @@ -171,6 +175,8 @@ public slots:
private slots:
//! Process answer from online lookup of IP address
void changeLocationFromNetworkLookup();
//! To be connected from StelCore::locationChanged(loc)
void changePlanetMapForLocation(StelLocation loc);
#ifdef ENABLE_GPS
void changeLocationFromGPSQuery(const StelLocation& loc);
void gpsQueryError(const QString& err);
Expand Down Expand Up @@ -206,6 +212,12 @@ private slots:

StelLocation lastResortLocation;

//! Used to sample a color from our current planet's surface map.
//! This must be kept in-sync with the map shown in the LocationDialog.
QImage planetSurfaceMap;
//! Auxiliary to the surface map. This tracks whether we actually have to load a new image.
QString planetName;

GPSLookupHelper *nmeaHelper,*libGpsHelper;
#ifdef Q_OS_WIN
QGeoPositionInfoSource *positionSource=Q_NULLPTR;
Expand Down
Loading