summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander V. Wolf <alex.v.wolf@gmail.com>2022-01-30 00:48:59 +0700
committerAlexander V. Wolf <alex.v.wolf@gmail.com>2022-01-30 00:48:59 +0700
commit89bf73972cbd6c74c3a320c0314a7c64bf201d42 (patch)
tree63799bccbd7c5f4334b056fff2f957a86e297f01
parent35c580867f608a121d62d23136a77638ff22be47 (diff)
Fixed wrong range of galactic and supergalactic coordinate systems (fix #2219)
-rw-r--r--src/core/StelObject.cpp10
-rw-r--r--src/core/modules/GridLinesMgr.cpp15
2 files changed, 12 insertions, 13 deletions
diff --git a/src/core/StelObject.cpp b/src/core/StelObject.cpp
index 9c6afde5d4..520ef59e50 100644
--- a/src/core/StelObject.cpp
+++ b/src/core/StelObject.cpp
@@ -496,6 +496,7 @@ QString StelObject::getCommonInfoString(const StelCore *core, const InfoStringGr
{
double glong, glat;
StelUtils::rectToSphe(&glong, &glat, getGalacticPos(core));
+ if (glong<0.) glong += 2.0*M_PI;
if (withDecimalDegree)
{
firstCoordinate = StelUtils::radToDecDegStr(glong);
@@ -503,8 +504,8 @@ QString StelObject::getCommonInfoString(const StelCore *core, const InfoStringGr
}
else
{
- firstCoordinate = StelUtils::radToDmsStr(glong,true);
- secondCoordinate = StelUtils::radToDmsStr(glat,true);
+ firstCoordinate = StelUtils::radToDmsStr(glong, true);
+ secondCoordinate = StelUtils::radToDmsStr(glat, true);
}
// TRANSLATORS: Galactic longitude/latitude
@@ -520,6 +521,7 @@ QString StelObject::getCommonInfoString(const StelCore *core, const InfoStringGr
{
double sglong, sglat;
StelUtils::rectToSphe(&sglong, &sglat, getSupergalacticPos(core));
+ if (sglong<0.) sglong += 2.0*M_PI;
if (withDecimalDegree)
{
firstCoordinate = StelUtils::radToDecDegStr(sglong);
@@ -527,8 +529,8 @@ QString StelObject::getCommonInfoString(const StelCore *core, const InfoStringGr
}
else
{
- firstCoordinate = StelUtils::radToDmsStr(sglong,true);
- secondCoordinate = StelUtils::radToDmsStr(sglat,true);
+ firstCoordinate = StelUtils::radToDmsStr(sglong, true);
+ secondCoordinate = StelUtils::radToDmsStr(sglat, true);
}
// TRANSLATORS: Supergalactic longitude/latitude
diff --git a/src/core/modules/GridLinesMgr.cpp b/src/core/modules/GridLinesMgr.cpp
index f4bdb82e84..8dc86e3233 100644
--- a/src/core/modules/GridLinesMgr.cpp
+++ b/src/core/modules/GridLinesMgr.cpp
@@ -291,6 +291,8 @@ void viewportEdgeIntersectCallback(const Vec3d& screenPos, const Vec3d& directio
}
case StelCore::FrameObservercentricEclipticJ2000:
case StelCore::FrameObservercentricEclipticOfDate:
+ case StelCore::FrameGalactic:
+ case StelCore::FrameSupergalactic:
{
raAngle = d->raAngle;
if (raAngle<0.)
@@ -344,12 +346,7 @@ void viewportEdgeIntersectCallback(const Vec3d& screenPos, const Vec3d& directio
if (withDecimalDegree)
text = StelUtils::radToDecDegStr(textAngle, 4, false, true);
else
- {
- if (d->frameType == StelCore::FrameGalactic || d->frameType == StelCore::FrameSupergalactic)
- text = StelUtils::radToDmsStrAdapt(textAngle);
- else
- text = StelUtils::radToHmsStrAdapt(textAngle);
- }
+ text = StelUtils::radToHmsStrAdapt(textAngle);
}
}
}
@@ -399,13 +396,13 @@ void SkyGrid::draw(const StelCore* core) const
const double gridStepParallelRad = M_PI_180*getClosestResolutionDMS(static_cast<double>(prj->getPixelPerRadAtCenter()));
double gridStepMeridianRad;
if (northPoleInViewport || southPoleInViewport)
- gridStepMeridianRad = (frameType==StelCore::FrameAltAz || frameType==StelCore::FrameGalactic || frameType==StelCore::FrameSupergalactic) ? M_PI/180.* 10. : M_PI/180.* 15.;
+ gridStepMeridianRad = (frameType==StelCore::FrameAltAz) ? M_PI_180 * 10. : M_PI_180 * 15.;
else
{
- const double closestResLon = (frameType==StelCore::FrameAltAz || frameType==StelCore::FrameGalactic || frameType==StelCore::FrameSupergalactic) ?
+ const double closestResLon = (frameType==StelCore::FrameAltAz) ?
getClosestResolutionDMS(static_cast<double>(prj->getPixelPerRadAtCenter())*std::cos(lat2)) :
getClosestResolutionHMS(static_cast<double>(prj->getPixelPerRadAtCenter())*std::cos(lat2));
- gridStepMeridianRad = M_PI/180.* closestResLon;
+ gridStepMeridianRad = M_PI_180 * closestResLon;
}
// Get the bounding halfspace