Commit c44c1d8b authored by Samikshan Bairagya's avatar Samikshan Bairagya

Show size for planets and DSOs in details-view.

parent bc3837e5
......@@ -17,6 +17,8 @@
#include "ksfilereader.h"
#include "kstarsdata.h"
#include "deepskyobject.h"
#include "ksplanetbase.h"
#include "skyobjitem.h"
SkyObjItem::SkyObjItem(SkyObject *so) : m_Name(so->name()), m_LongName(so->longname()),m_TypeName(so->typeName()), m_So(so)
......@@ -120,3 +122,18 @@ QString SkyObjItem::getDesc() const
return QString("No Description found for selected sky-object");
}
QString SkyObjItem::getSize() const
{
switch (getType())
{
case Galaxy:
case Cluster:
case Nebula:
return QString::number(((DeepSkyObject *)m_So)->a()) + " arcminutes";
case Planet:
return QString::number(((KSPlanetBase *)m_So)->angSize()) + " arcseconds";
default:
return QString(" --");
}
}
......@@ -83,7 +83,7 @@ public:
* \brief Get category of sky-object associated with the SkyObjItem as an integer.
* \return Category of sky-object associated with the SkyObjItem as a QString as an integer.
*/
inline int getType() const { return int(m_Type); }
inline int getType() const { return m_Type; }
/**
* \brief Get current position of sky-object associated with the SkyObjItem.
......@@ -117,9 +117,9 @@ public:
/**
* \brief Get size of sky-object associated with the SkyObjItem.
* \return Size of sky-object associated with the SkyObjItem.
* \return Size of sky-object associated with the SkyObjItem as a QString.
*/
inline float getSize() const { return 0.0; }
QString getSize() const;
/**
* \brief Set current position of the sky-object in the sky.
......
......@@ -120,17 +120,17 @@ void WIView::loadDetailsView(SkyObjItem *soitem, int index)
QObject *descTextObj = m_DetailsViewObj->findChild<QObject *>("descTextObj");
QObject *magTextObj = m_DetailsViewObj->findChild<QObject *>("magTextObj");
// QObject *sbTextObj = m_DetailsViewObj->findChild<QObject *>("sbTextObj");
// QObject *sizeTextObj = m_DetailsViewObj->findChild<QObject *>("sizeTextObj");
QString magText = QString("Magnitude: ") + QString::number(soitem->getMagnitude());
QObject *sizeTextObj = m_DetailsViewObj->findChild<QObject *>("sizeTextObj");
sonameObj->setProperty("text", soitem->getLongName());
posTextObj->setProperty("text", soitem->getPosition());
descTextObj->setProperty("text", soitem->getDesc());
QString magText = QString("Magnitude: ") + QString::number(soitem->getMagnitude());
magTextObj->setProperty("text", magText);
/*
sbTextObj->setProperty("text", magText);
sizeTextObj->setProperty("text", soitem->getSize());*/
QString sizeText = QString("Size: ") + soitem->getSize();
sizeTextObj->setProperty("text", sizeText);
}
void WIView::onNextObjClicked()
......
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