[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kstars/gsoc2012-samxan] kstars/tools/whatsinteresting: Use QMap<int, double> to implement lookup ta
From: Samikshan Bairagya <samikshan () gmail ! com>
Date: 2012-10-31 20:12:17
Message-ID: 20121031201217.9D98FA60C4 () git ! kde ! org
[Download RAW message or body]
Git commit 01d9beda593de0dc68e59ab2dce32d372b1d1b44 by Samikshan Bairagya.
Committed on 31/10/2012 at 21:01.
Pushed by bairagya into branch 'gsoc2012-samxan'.
Use QMap<int, double> to implement lookup table for bortle deep-sky scale and corresponding limiting magnitude.
M +19 -33 kstars/tools/whatsinteresting/obsconditions.cpp
M +3 -0 kstars/tools/whatsinteresting/obsconditions.h
http://commits.kde.org/kstars/01d9beda593de0dc68e59ab2dce32d372b1d1b44
diff --git a/kstars/tools/whatsinteresting/obsconditions.cpp b/kstars/tools/whatsinteresting/obsconditions.cpp
index 48d9c37..a1180fc 100644
--- a/kstars/tools/whatsinteresting/obsconditions.cpp
+++ b/kstars/tools/whatsinteresting/obsconditions.cpp
@@ -37,41 +37,27 @@ ObsConditions::ObsConditions(int bortle, double aperture, Equipment equip, Teles
ObsConditions::~ObsConditions() {}
+QMap<int, double> ObsConditions::setLMMap()
+{
+ QMap<int, double> LMMap;
+ LMMap.insert(1, 7.8);
+ LMMap.insert(2, 7.3);
+ LMMap.insert(3, 6.8);
+ LMMap.insert(4, 6.3);
+ LMMap.insert(5, 5.8);
+ LMMap.insert(6, 5.3);
+ LMMap.insert(7, 4.8);
+ LMMap.insert(8, 4.3);
+ LMMap.insert(9, 3.8);
+
+ return LMMap;
+}
+
+const QMap<int, double> ObsConditions::m_LMMap = setLMMap();
+
void ObsConditions::setLimMagnitude()
{
- switch (m_BortleClass)
- {
- case 1:
- m_LM = 7.8; //Excellent dark-sky site
- break;
- case 2:
- m_LM = 7.3; //Typical truly dark site
- break;
- case 3:
- m_LM = 6.8; //Rural sky
- break;
- case 4:
- m_LM = 6.3;
- break;
- case 5:
- m_LM = 5.8;
- break;
- case 6:
- m_LM = 5.3;
- break;
- case 7:
- m_LM = 4.8;
- break;
- case 8:
- m_LM = 4.3;
- break;
- case 9:
- m_LM = 3.8;
- break;
- default:
- m_LM = 4.0;
- break;
- }
+ m_LM = m_LMMap[m_BortleClass];
}
double ObsConditions::getOptimumMAG()
diff --git a/kstars/tools/whatsinteresting/obsconditions.h b/kstars/tools/whatsinteresting/obsconditions.h
index 50eb6d4..0b8dbfe 100644
--- a/kstars/tools/whatsinteresting/obsconditions.h
+++ b/kstars/tools/whatsinteresting/obsconditions.h
@@ -93,6 +93,8 @@ public:
*/
bool isVisible(GeoLocation *geo, dms *lst, SkyObject *so);
+ static QMap<int, double> setLMMap();
+
private:
int m_BortleClass; ///Bortle dark-sky rating (from 1-9)
Equipment m_Equip; ///Equipment type
@@ -100,6 +102,7 @@ private:
double m_Aperture; ///Aperture of equipment
double m_tParam; ///t-parameter corresponding to telescope type
double m_LM; ///Limiting Magnitude depending on m_BortleClass
+ static const QMap<int, double> m_LMMap;
};
#endif
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic