Commit 1dd3381f authored by Robert Lancaster's avatar Robert Lancaster Committed by Jasem Mutlaq

This patch includes the previous 2. It also modifies the first screen of whats...

This patch includes the previous 2. It also modifies the first screen of whats interesting and adds Messier objects to the list. As a part of that, I also had to add a way to identify that the object was below the horizon.
parent 83430ff8
...@@ -30,12 +30,16 @@ ModelManager::ModelManager(ObsConditions * obs) ...@@ -30,12 +30,16 @@ ModelManager::ModelManager(ObsConditions * obs)
m_ConModel = new SkyObjListModel(); m_ConModel = new SkyObjListModel();
m_ClustModel = new SkyObjListModel(); m_ClustModel = new SkyObjListModel();
m_NebModel = new SkyObjListModel(); m_NebModel = new SkyObjListModel();
m_MessierModel = new SkyObjListModel();
m_SharplessModel = new SkyObjListModel();
m_InitObjects[Star_Model] = QList<SkyObject *>(); m_InitObjects[Star_Model] = QList<SkyObject *>();
m_InitObjects[Galaxy_Model] = QList<SkyObject *>(); m_InitObjects[Galaxy_Model] = QList<SkyObject *>();
m_InitObjects[Constellation_Model] = QList<SkyObject *>(); m_InitObjects[Constellation_Model] = QList<SkyObject *>();
m_InitObjects[Cluster_Model] = QList<SkyObject *>(); m_InitObjects[Cluster_Model] = QList<SkyObject *>();
m_InitObjects[Nebula_Model] = QList<SkyObject *>(); m_InitObjects[Nebula_Model] = QList<SkyObject *>();
m_InitObjects[Messier_Model] = QList<SkyObject *>();
m_InitObjects[Sharpless_Model] = QList<SkyObject *>();
updateModels(obs); updateModels(obs);
} }
...@@ -47,6 +51,8 @@ ModelManager::~ModelManager() ...@@ -47,6 +51,8 @@ ModelManager::~ModelManager()
delete m_ConModel; delete m_ConModel;
delete m_ClustModel; delete m_ClustModel;
delete m_NebModel; delete m_NebModel;
delete m_MessierModel;
delete m_SharplessModel;
} }
void ModelManager::updateModels(ObsConditions * obs) void ModelManager::updateModels(ObsConditions * obs)
...@@ -148,6 +154,21 @@ void ModelManager::updateModels(ObsConditions * obs) ...@@ -148,6 +154,21 @@ void ModelManager::updateModels(ObsConditions * obs)
m_PlanetsModel->addSkyObject(new SkyObjItem(so)); m_PlanetsModel->addSkyObject(new SkyObjItem(so));
} }
} }
for(int i=1;i<=110;i++)
{
SkyObject * o;
if ((o = data->skyComposite()->findByName("M " + QString::number(i))))
m_MessierModel->addSkyObject(new SkyObjItem(o));
}
/**
for(int i=1;i<=350;i++)
{
SkyObject * o;
if ((o = data->skyComposite()->findByName("Sh2 " + QString::number(i))))
m_SharplessModel->addSkyObject(new SkyObjItem(o));
}
**/
} }
void ModelManager::resetModels() void ModelManager::resetModels()
...@@ -158,6 +179,8 @@ void ModelManager::resetModels() ...@@ -158,6 +179,8 @@ void ModelManager::resetModels()
m_GalModel->resetModel(); m_GalModel->resetModel();
m_ClustModel->resetModel(); m_ClustModel->resetModel();
m_NebModel->resetModel(); m_NebModel->resetModel();
m_MessierModel->resetModel();
m_SharplessModel->resetModel();
} }
SkyObjListModel * ModelManager::returnModel(int type) SkyObjListModel * ModelManager::returnModel(int type)
...@@ -176,6 +199,10 @@ SkyObjListModel * ModelManager::returnModel(int type) ...@@ -176,6 +199,10 @@ SkyObjListModel * ModelManager::returnModel(int type)
return m_ClustModel; return m_ClustModel;
case 5: //Nebula type case 5: //Nebula type
return m_NebModel; return m_NebModel;
case 6: //Messier Objects
return m_MessierModel;
case 7: //Sharpless Objects
return m_SharplessModel;
default: default:
return 0; return 0;
} }
......
...@@ -34,7 +34,7 @@ class ModelManager ...@@ -34,7 +34,7 @@ class ModelManager
* \enum ModelType * \enum ModelType
* \brief Model type for different types of sky-objects. * \brief Model type for different types of sky-objects.
*/ */
enum ModelType {Planet_Model, Star_Model, Constellation_Model, Galaxy_Model, Cluster_Model, Nebula_Model}; enum ModelType {Planet_Model, Star_Model, Constellation_Model, Galaxy_Model, Cluster_Model, Nebula_Model, Messier_Model, Sharpless_Model};
/** /**
* \brief Constructor - Creates models for different sky-object types. * \brief Constructor - Creates models for different sky-object types.
...@@ -66,7 +66,7 @@ class ModelManager ...@@ -66,7 +66,7 @@ class ModelManager
private: private:
ObsConditions * m_ObsConditions; ObsConditions * m_ObsConditions;
SkyObjListModel * m_PlanetsModel, *m_StarsModel, *m_GalModel, *m_ConModel, *m_ClustModel, *m_NebModel; SkyObjListModel * m_PlanetsModel, *m_StarsModel, *m_GalModel, *m_ConModel, *m_ClustModel, *m_NebModel, *m_MessierModel, *m_SharplessModel;
QHash< ModelType, QList <SkyObject *> > m_InitObjects; QHash< ModelType, QList <SkyObject *> > m_InitObjects;
}; };
......
...@@ -107,7 +107,10 @@ void SkyObjItem::setPosition(SkyObject * so) ...@@ -107,7 +107,10 @@ void SkyObjItem::setPosition(SkyObject * so)
sp.EquatorialToHorizontal(data->lst(), data->geo()->lat()); sp.EquatorialToHorizontal(data->lst(), data->geo()->lat());
double rounded_altitude = (int)(sp.alt().Degrees()/5.0)*5.0; double rounded_altitude = (int)(sp.alt().Degrees()/5.0)*5.0;
m_Position = xi18n("Now visible: About %1 degrees above the %2 horizon", rounded_altitude, KSUtils::toDirectionString( sp.az() ) ); if(rounded_altitude<=0)
m_Position = "<span style='color:red'>" + xi18n("NOT VISIBLE: About %1 degrees below the %2 horizon", -rounded_altitude, KSUtils::toDirectionString( sp.az() ) ) + "</span>";
else
m_Position = "<span style='color:yellow'>" + xi18n("Now visible: About %1 degrees above the %2 horizon", rounded_altitude, KSUtils::toDirectionString( sp.az() ) ) + "</span>";
} }
QString SkyObjItem::getImageURL(bool preferThumb) const QString SkyObjItem::getImageURL(bool preferThumb) const
...@@ -214,7 +217,7 @@ QString SkyObjItem::getSurfaceBrightness() const ...@@ -214,7 +217,7 @@ QString SkyObjItem::getSurfaceBrightness() const
{ {
case Galaxy: case Galaxy:
case Nebula: case Nebula:
return QLocale().toString(SB,'f', 2) + "\n (mag/arcmin^2)"; return QLocale().toString(SB,'f', 2) + "<BR> (mag/arcmin^2)";
default: default:
return QString(" --"); // Not applicable for other sky-objects return QString(" --"); // Not applicable for other sky-objects
} }
...@@ -246,7 +249,7 @@ inline QString SkyObjItem::loadObjectDescription() const{ ...@@ -246,7 +249,7 @@ inline QString SkyObjItem::loadObjectDescription() const{
{ {
QTextStream in(&file); QTextStream in(&file);
QString line; QString line;
line = in.readAll(); line = in.readLine();//This should only read the description since the source is on the next line
file.close(); file.close();
return line; return line;
} }
......
This diff is collapsed.
...@@ -120,8 +120,8 @@ class WIView : public QWidget ...@@ -120,8 +120,8 @@ class WIView : public QWidget
*/ */
void onReloadIconClicked(); void onReloadIconClicked();
void tryToLoadDescFromWikipedia(QObject * descTextObj, QObject *descSrcTextObj, SkyObjItem * soitem); void tryToLoadDescFromWikipedia(QObject * descTextObj, SkyObjItem * soitem);
void loadObjectDescription(QObject * descTextObj, QObject *descSrcTextObj, SkyObjItem * soitem); void loadObjectDescription(QObject * descTextObj, SkyObjItem * soitem);
void tryToLoadInfoBoxFromWikipedia(QObject * infoBoxText, SkyObjItem * soitem); void tryToLoadInfoBoxFromWikipedia(QObject * infoBoxText, SkyObjItem * soitem);
void loadObjectInfoBox(QObject * infoBoxText, SkyObjItem * soitem); void loadObjectInfoBox(QObject * infoBoxText, SkyObjItem * soitem);
void saveImageURL(SkyObjItem * soitem, QString imageURL); void saveImageURL(SkyObjItem * soitem, QString imageURL);
......
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