Commit 8a5451ca authored by Samikshan Bairagya's avatar Samikshan Bairagya

Display surface brightness for DSOs (specifically Galaxies and Nebulae) in...

Display surface brightness for DSOs (specifically Galaxies and Nebulae) in details-view of WI interface.
parent c44c1d8b
...@@ -641,7 +641,7 @@ Rectangle { ...@@ -641,7 +641,7 @@ Rectangle {
Text { Text {
id: magText id: magText
objectName: "magTextObj" objectName: "magTextObj"
y: 72 y: 104
width: 164 width: 164
height: 15 height: 15
color: "#ffffff" color: "#ffffff"
...@@ -658,7 +658,7 @@ Rectangle { ...@@ -658,7 +658,7 @@ Rectangle {
id: sbText id: sbText
objectName: "sbTextObj" objectName: "sbTextObj"
x: 8 x: 8
y: 104 y: 72
width: 164 width: 164
height: 15 height: 15
color: "#ffffff" color: "#ffffff"
......
...@@ -120,7 +120,29 @@ QString SkyObjItem::getDesc() const ...@@ -120,7 +120,29 @@ QString SkyObjItem::getDesc() const
return "Constellation"; return "Constellation";
} }
return QString("No Description found for selected sky-object"); return getTypeName();
}
QString SkyObjItem::getSurfaceBrightness() const
{
/** Surface Brightness is applicable only for extended light sources like
* Deep-Sky Objects. Here we use the formula SB = m + log10(a*b/4)
* where m is the magnitude of the sky-object. a and b are the major and minor
* axis lengths of the objects respectively in arcminutes. SB is the surface
* brightness obtained in mag * arcminutes^-2
*/
DeepSkyObject *dso = (DeepSkyObject *)m_So;
float SB = m_So->mag() + 2.5 * log10(dso->a() * dso->b() / 4);
switch(getType())
{
case Galaxy:
case Nebula:
return KGlobal::locale()->formatNumber(SB) + " mag/arcmin^2";
default:
return QString(" --"); // Not applicable for other sky-objects
}
} }
QString SkyObjItem::getSize() const QString SkyObjItem::getSize() const
......
...@@ -110,13 +110,15 @@ public: ...@@ -110,13 +110,15 @@ public:
inline float getMagnitude() const { return m_So->mag(); } inline float getMagnitude() const { return m_So->mag(); }
/** /**
* \brief Get surface-brightness of sky-object associated with the SkyObjItem. * \brief Get surface-brightness of sky-object associated with the SkyObjItem as a QString
* \return Surface-brightness of sky-object associated with the SkyObjItem. * to be displayed on the details-view.
* \return Surface-brightness of sky-object associated with the SkyObjItem as a QString.
*/ */
inline float getSurfaceBrightness() const { return 0.0; } QString getSurfaceBrightness() const;
/** /**
* \brief Get size of sky-object associated with the SkyObjItem. * \brief Get size of sky-object associated with the SkyObjItem as a QString
* to be displayed on the details-view.
* \return Size of sky-object associated with the SkyObjItem as a QString. * \return Size of sky-object associated with the SkyObjItem as a QString.
*/ */
QString getSize() const; QString getSize() const;
......
...@@ -108,10 +108,9 @@ void WIView::loadDetailsView(SkyObjItem *soitem, int index) ...@@ -108,10 +108,9 @@ void WIView::loadDetailsView(SkyObjItem *soitem, int index)
int modelSize = m->returnModel(m_CurSoItem->getType())->rowCount(); int modelSize = m->returnModel(m_CurSoItem->getType())->rowCount();
SkyObjItem *nextItem = m->returnModel(m_CurSoItem->getType())->getSkyObjItem((m_CurIndex+1)%modelSize); SkyObjItem *nextItem = m->returnModel(m_CurSoItem->getType())->getSkyObjItem((m_CurIndex+1)%modelSize);
SkyObjItem *prevItem = m->returnModel(m_CurSoItem->getType())->getSkyObjItem((m_CurIndex-1+modelSize)%modelSize); SkyObjItem *prevItem = m->returnModel(m_CurSoItem->getType())->getSkyObjItem((m_CurIndex-1+modelSize)%modelSize);
//QString nextObjText = QString("Next: ") + nextItem->getName();
QObject *nextTextObj = m_NextObj->findChild<QObject *>("nextTextObj"); QObject *nextTextObj = m_NextObj->findChild<QObject *>("nextTextObj");
nextTextObj->setProperty("text", nextItem->getName()); nextTextObj->setProperty("text", nextItem->getName());
//QString prevObjText = QString("Previous: ") + prevItem->getName();
QObject *prevTextObj = m_PrevObj->findChild<QObject *>("prevTextObj"); QObject *prevTextObj = m_PrevObj->findChild<QObject *>("prevTextObj");
prevTextObj->setProperty("text", prevItem->getName()); prevTextObj->setProperty("text", prevItem->getName());
...@@ -119,16 +118,23 @@ void WIView::loadDetailsView(SkyObjItem *soitem, int index) ...@@ -119,16 +118,23 @@ void WIView::loadDetailsView(SkyObjItem *soitem, int index)
QObject *posTextObj = m_DetailsViewObj->findChild<QObject *>("posTextObj"); QObject *posTextObj = m_DetailsViewObj->findChild<QObject *>("posTextObj");
QObject *descTextObj = m_DetailsViewObj->findChild<QObject *>("descTextObj"); QObject *descTextObj = m_DetailsViewObj->findChild<QObject *>("descTextObj");
QObject *magTextObj = m_DetailsViewObj->findChild<QObject *>("magTextObj"); QObject *magTextObj = m_DetailsViewObj->findChild<QObject *>("magTextObj");
// QObject *sbTextObj = m_DetailsViewObj->findChild<QObject *>("sbTextObj"); QObject *sbTextObj = m_DetailsViewObj->findChild<QObject *>("sbTextObj");
QObject *sizeTextObj = m_DetailsViewObj->findChild<QObject *>("sizeTextObj"); QObject *sizeTextObj = m_DetailsViewObj->findChild<QObject *>("sizeTextObj");
sonameObj->setProperty("text", soitem->getLongName()); sonameObj->setProperty("text", soitem->getLongName());
posTextObj->setProperty("text", soitem->getPosition()); posTextObj->setProperty("text", soitem->getPosition());
descTextObj->setProperty("text", soitem->getDesc()); descTextObj->setProperty("text", soitem->getDesc());
QString magText = QString("Magnitude: ") + QString::number(soitem->getMagnitude()); QString magText;
if (soitem->getType() == SkyObjItem::Constellation)
magText = QString("Magnitude: --");
else
magText = QString("Magnitude: ") + QString::number(soitem->getMagnitude()) + " mag";
magTextObj->setProperty("text", magText); magTextObj->setProperty("text", magText);
QString sbText = QString("Surface Brightness: ") + soitem->getSurfaceBrightness();
sbTextObj->setProperty("text", sbText);
QString sizeText = QString("Size: ") + soitem->getSize(); QString sizeText = QString("Size: ") + soitem->getSize();
sizeTextObj->setProperty("text", sizeText); sizeTextObj->setProperty("text", sizeText);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment