diff --git a/kstars/tools/whatsinteresting/qml/wiview.qml b/kstars/tools/whatsinteresting/qml/wiview.qml index 04a6309fe2143f31ca2c027baa4ef1c472bce783..6178ebeefed30badf8649251866d9312a56facd1 100644 --- a/kstars/tools/whatsinteresting/qml/wiview.qml +++ b/kstars/tools/whatsinteresting/qml/wiview.qml @@ -641,7 +641,7 @@ Rectangle { Text { id: magText objectName: "magTextObj" - y: 72 + y: 104 width: 164 height: 15 color: "#ffffff" @@ -658,7 +658,7 @@ Rectangle { id: sbText objectName: "sbTextObj" x: 8 - y: 104 + y: 72 width: 164 height: 15 color: "#ffffff" diff --git a/kstars/tools/whatsinteresting/skyobjitem.cpp b/kstars/tools/whatsinteresting/skyobjitem.cpp index bae78f94af820e36d6fa943b780ff8b0381e2347..53fc6bd0a7946e93bebec94caa829fa80dd3158e 100644 --- a/kstars/tools/whatsinteresting/skyobjitem.cpp +++ b/kstars/tools/whatsinteresting/skyobjitem.cpp @@ -120,7 +120,29 @@ QString SkyObjItem::getDesc() const 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 diff --git a/kstars/tools/whatsinteresting/skyobjitem.h b/kstars/tools/whatsinteresting/skyobjitem.h index 04c9aafbf449dbedad3ad17ee15ccc58f9a63f5a..a73e505abf91ad131ea029259698d30180e7150c 100644 --- a/kstars/tools/whatsinteresting/skyobjitem.h +++ b/kstars/tools/whatsinteresting/skyobjitem.h @@ -110,13 +110,15 @@ public: inline float getMagnitude() const { return m_So->mag(); } /** - * \brief Get surface-brightness of sky-object associated with the SkyObjItem. - * \return Surface-brightness of sky-object associated with the SkyObjItem. + * \brief Get surface-brightness of sky-object associated with the SkyObjItem as a QString + * 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. */ QString getSize() const; diff --git a/kstars/tools/whatsinteresting/wiview.cpp b/kstars/tools/whatsinteresting/wiview.cpp index e9312b2bc35d391a0c13bf1675d9993d1707f5b1..5e3e5bdd45f7599889e21498d6fe527f10564bf5 100644 --- a/kstars/tools/whatsinteresting/wiview.cpp +++ b/kstars/tools/whatsinteresting/wiview.cpp @@ -108,10 +108,9 @@ void WIView::loadDetailsView(SkyObjItem *soitem, int index) int modelSize = m->returnModel(m_CurSoItem->getType())->rowCount(); 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); - //QString nextObjText = QString("Next: ") + nextItem->getName(); + QObject *nextTextObj = m_NextObj->findChild("nextTextObj"); nextTextObj->setProperty("text", nextItem->getName()); - //QString prevObjText = QString("Previous: ") + prevItem->getName(); QObject *prevTextObj = m_PrevObj->findChild("prevTextObj"); prevTextObj->setProperty("text", prevItem->getName()); @@ -119,16 +118,23 @@ void WIView::loadDetailsView(SkyObjItem *soitem, int index) QObject *posTextObj = m_DetailsViewObj->findChild("posTextObj"); QObject *descTextObj = m_DetailsViewObj->findChild("descTextObj"); QObject *magTextObj = m_DetailsViewObj->findChild("magTextObj"); -// QObject *sbTextObj = m_DetailsViewObj->findChild("sbTextObj"); + QObject *sbTextObj = m_DetailsViewObj->findChild("sbTextObj"); QObject *sizeTextObj = m_DetailsViewObj->findChild("sizeTextObj"); sonameObj->setProperty("text", soitem->getLongName()); posTextObj->setProperty("text", soitem->getPosition()); 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); + QString sbText = QString("Surface Brightness: ") + soitem->getSurfaceBrightness(); + sbTextObj->setProperty("text", sbText); + QString sizeText = QString("Size: ") + soitem->getSize(); sizeTextObj->setProperty("text", sizeText); }