summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg Zotti <Georg.Zotti@univie.ac.at>2022-01-08 01:18:33 +0100
committerGeorg Zotti <Georg.Zotti@univie.ac.at>2022-01-08 01:18:33 +0100
commitda26f6c7fc614f927caf640fa3a2cba1597899ff (patch)
treec02f5b544cb13abb363c26a1defca0cb5de394b4
parentfabcf930854a5a9ec0a1693caaa7afdaa0b6a2dd (diff)
Simplified setFlagLabelsfix-nomenclature-longitudes
Removed useless update(), and activated in the Mgr class Now we have soft in/out
-rw-r--r--src/core/modules/NomenclatureItem.cpp8
-rw-r--r--src/core/modules/NomenclatureItem.hpp7
-rw-r--r--src/core/modules/NomenclatureMgr.cpp10
-rw-r--r--src/core/modules/NomenclatureMgr.hpp2
4 files changed, 8 insertions, 19 deletions
diff --git a/src/core/modules/NomenclatureItem.cpp b/src/core/modules/NomenclatureItem.cpp
index c48c16f281..295ad94a17 100644
--- a/src/core/modules/NomenclatureItem.cpp
+++ b/src/core/modules/NomenclatureItem.cpp
@@ -31,6 +31,7 @@
const QString NomenclatureItem::NOMENCLATURE_TYPE = QStringLiteral("NomenclatureItem");
Vec3f NomenclatureItem::color = Vec3f(0.1f,1.0f,0.1f);
bool NomenclatureItem::hideLocalNomenclature = false;
+LinearFader NomenclatureItem::labelsFader;
NomenclatureItem::NomenclatureItem(PlanetP nPlanet,
int nId,
@@ -358,11 +359,6 @@ float NomenclatureItem::getAngularSizeRatio(const StelCore *core) const
return static_cast<float>(getAngularSize(core))/core->getProjection(StelCore::FrameJ2000)->getFov();
}
-void NomenclatureItem::update(double deltaTime)
-{
- labelsFader.update(static_cast<int>(deltaTime*1000));
-}
-
void NomenclatureItem::draw(StelCore* core, StelPainter *painter)
{
if (!getFlagLabels())
@@ -392,7 +388,7 @@ void NomenclatureItem::draw(StelCore* core, StelPainter *painter)
float brightness=(getSolarAltitude(core)<0. ? 0.25f : 1.0f);
if (niType>=NomenclatureItem::niSpecialPointPole)
brightness = 0.5f;
- painter->setColor(color*brightness, 1.0f);
+ painter->setColor(color*brightness, labelsFader.getInterstate());
painter->drawCircle(static_cast<float>(srcPos[0]), static_cast<float>(srcPos[1]), 2.f);
painter->drawText(static_cast<float>(srcPos[0]), static_cast<float>(srcPos[1]), nameI18n, 0, 5.f, 5.f, false);
}
diff --git a/src/core/modules/NomenclatureItem.hpp b/src/core/modules/NomenclatureItem.hpp
index 5154c8fdff..6cc749d247 100644
--- a/src/core/modules/NomenclatureItem.hpp
+++ b/src/core/modules/NomenclatureItem.hpp
@@ -180,10 +180,9 @@ public:
void draw(StelCore* core, StelPainter *painter);
NomenclatureItemType getNomenclatureType() const { return nType;}
- void update(double deltaTime);
- void setFlagLabels(bool b){ labelsFader = b; }
- bool getFlagLabels(void) const { return labelsFader==true;}
+ static void setFlagLabels(bool b){ labelsFader = b; }
+ static bool getFlagLabels(void){ return labelsFader.getInterstate()>0.f;}
void setFlagHideLocalNomenclature(bool b) { hideLocalNomenclature=b; }
bool getFlagHideLocalNomenclature() const { return hideLocalNomenclature; }
//QString getEnglishPlanetName(void) const {return planet->getEnglishName();}
@@ -243,7 +242,7 @@ private:
mutable double longitude; // degrees. Declared mutable to allow change in otherwise const methods (for special points)
double size; // km
- LinearFader labelsFader;
+ static LinearFader labelsFader;
};
#endif // NOMENCLATUREITEM_HPP
diff --git a/src/core/modules/NomenclatureMgr.cpp b/src/core/modules/NomenclatureMgr.cpp
index aec949158f..8d7e005a29 100644
--- a/src/core/modules/NomenclatureMgr.cpp
+++ b/src/core/modules/NomenclatureMgr.cpp
@@ -491,20 +491,14 @@ void NomenclatureMgr::setFlagLabels(bool b)
{
if (getFlagLabels() != b)
{
- for (const auto& i : qAsConst(nomenclatureItems))
- i->setFlagLabels(b);
+ NomenclatureItem::setFlagLabels(b);
emit nomenclatureDisplayedChanged(b);
}
}
bool NomenclatureMgr::getFlagLabels() const
{
- for (const auto& i : nomenclatureItems)
- {
- if (i->getFlagLabels())
- return true;
- }
- return false;
+ return NomenclatureItem::getFlagLabels();
}
void NomenclatureMgr::setFlagHideLocalNomenclature(bool b)
diff --git a/src/core/modules/NomenclatureMgr.hpp b/src/core/modules/NomenclatureMgr.hpp
index 1ae87be78a..35d3f17154 100644
--- a/src/core/modules/NomenclatureMgr.hpp
+++ b/src/core/modules/NomenclatureMgr.hpp
@@ -57,7 +57,7 @@ public:
// Methods defined in the StelModule class
virtual void init() Q_DECL_OVERRIDE;
virtual void deinit() Q_DECL_OVERRIDE;
- virtual void update(double) Q_DECL_OVERRIDE{;}
+ virtual void update(double deltaTime) Q_DECL_OVERRIDE {NomenclatureItem::labelsFader.update(static_cast<int>(deltaTime*1000));}
virtual void draw(StelCore* core) Q_DECL_OVERRIDE;
virtual void drawPointer(StelCore* core, StelPainter& painter);
virtual double getCallOrder(StelModuleActionName actionName) const Q_DECL_OVERRIDE;