Commit 059fe9ed authored by Samikshan Bairagya's avatar Samikshan Bairagya

Add class ObsConditions to calculate the true limiting magnitude from...

Add class ObsConditions to calculate the true limiting magnitude from equipment specifications and location conditions. Not functional yet.
parent 6511a176
......@@ -130,6 +130,7 @@ set(libkstarstools_SRCS
tools/WhatsInteresting/modelmanager.cpp
tools/WhatsInteresting/skyobjitem.cpp
tools/WhatsInteresting/wiusersettings.cpp
tools/WhatsInteresting/obsconditions.cpp
tools/flagmanager.cpp
tools/moonphasetool.cpp
tools/starhopper.cpp
......
......@@ -19,10 +19,10 @@
#include "QGraphicsObject"
#include "skymap.h"
WIView::WIView ( QObject *parent) : QObject(parent)
WIView::WIView ( QObject *parent, ObsConditions *obs) : QObject(parent)
{
m = new ModelManager();
m = new ModelManager(obs);
QDeclarativeView *baseView;
baseView = new QDeclarativeView();
......
......@@ -21,12 +21,13 @@
#include "skyobject.h"
#include "modelmanager.h"
#include "skyobjlistmodel.h"
#include "obsconditions.h"
class WIView : public QObject
{
Q_OBJECT
public:
WIView(QObject *parent = 0);
WIView(QObject *parent = 0, ObsConditions *obs = 0);
~WIView();
void manageViews(int TYPE); //display view
void loadDetailsView( SkyObjItem* soitem, int index);
......
......@@ -21,7 +21,7 @@
#include "skymapcomposite.h"
#include "skyobject.h"
ModelManager::ModelManager()
ModelManager::ModelManager(ObsConditions *obs)
{
planetsModel = new SkyObjListModel();
starsModel = new SkyObjListModel();
......
......@@ -18,13 +18,14 @@
//#include <QStandardItemModel>
#include "skyobjlistmodel.h"
#include "kstarsdata.h"
#include "obsconditions.h"
class ModelManager
{
public:
enum LIST_TYPE {BaseList, PlanetaryObjects, DeepSkyObjects, Planets, Satellites,
Stars, Galaxies, Constellations, Star_Clusters, Nebulae};
ModelManager();
ModelManager(ObsConditions *obs);
~ModelManager();
void updateModels();
......
/***************************************************************************
obsconditions.cpp - K Desktop Planetarium
-------------------
begin : 2012/10/07
copyright : (C) 2012 by Samikshan Bairagya
email : samikshan@gmail.com
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "obsconditions.h"
ObsConditions::ObsConditions(int bortle, Equipment eq, EquipmentType t)
{
bortleClass = bortle;
equip = eq;
type = t;
}
ObsConditions::~ObsConditions() {}
void ObsConditions::setEquipment(Equipment eq)
{
equip = eq;
}
void ObsConditions::setEquipmentType(EquipmentType t)
{
type = t;
}
float ObsConditions::getTrueMagLim()
{
return 4.0; //dummy
}
/***************************************************************************
obsconditions.h - K Desktop Planetarium
-------------------
begin : 2012/10/07
copyright : (C) 2012 by Samikshan Bairagya
email : samikshan@gmail.com
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef OBS_CONDITIONS_H
#define OBS_CONDITIONS_H
class ObsConditions
{
public:
enum Equipment {Telescope = 0, Binoculars, Both, None };
enum EquipmentType { Reflector = 0, Refractor };
ObsConditions(int bortleClass, Equipment eq, EquipmentType t);
~ObsConditions();
void setEquipment(Equipment eq);
void setEquipmentType(EquipmentType t);
float getTrueMagLim();
private:
int bortleClass;
Equipment equip;
EquipmentType type;
};
#endif
\ No newline at end of file
......@@ -18,20 +18,62 @@
#include "wiusersettings.h"
#include "WIView.h"
#include "obsconditions.h"
#include "kdebug.h"
WIUserSettings::WIUserSettings(QWidget* parent, Qt::WindowFlags flags): QWizard(parent, flags)
{
setupUi(this);
connect(this, SIGNAL(finished(int)), this, SLOT(slotFinished(int)));
telescopeCheck = equipTypePage->findChild<QCheckBox*>("telescopeCheck");
binocularsCheck = equipTypePage->findChild<QCheckBox*>("binocularsCheck");
noEquipCheck = equipTypePage->findChild<QCheckBox*>("noEquipCheck");
makeConnections();
}
WIUserSettings::~WIUserSettings() {}
void WIUserSettings::slotFinished( int )
{
wi = new WIView();
eq = noEquipCheck->isEnabled() ? (ObsConditions::None) : (telescopeCheck->isChecked()
?(binocularsCheck->isChecked() ? ObsConditions::Both : ObsConditions::Telescope)
:(binocularsCheck->isChecked() ? ObsConditions::Binoculars : ObsConditions::None));
type = ObsConditions::Reflector;
wi = new WIView(0, new ObsConditions(bortleClass->value(), eq, type));
}
void WIUserSettings::makeConnections()
{
connect(this, SIGNAL(finished(int)), this, SLOT(slotFinished(int)));
connect(lightPollutionPage->findChild<QSlider*>("bortleClass"),
SIGNAL(valueChanged(int)), this, SLOT(slotSetBortleClass(int)));
connect(telescopeCheck, SIGNAL( toggled(bool)), this, SLOT(slotTelescopeCheck(bool)));
connect(binocularsCheck, SIGNAL( toggled(bool)), this, SLOT(slotBinocularCheck(bool)));
connect(noEquipCheck, SIGNAL( toggled(bool)), this, SLOT(slotNoEquipCheck(bool)));
}
void WIUserSettings::slotSetBortleClass(int value)
{
bortleClass->setValue(value);
}
void WIUserSettings::slotTelescopeCheck(bool on)
{
telescopeCheck->setChecked(on);
if (on)
noEquipCheck->setEnabled(false);
}
void WIUserSettings::slotBinocularsCheck(bool on)
{
binocularsCheck->setChecked(on);
if (on)
noEquipCheck->setEnabled(false);
}
void WIUserSettings::slotNoEquipCheck(bool on)
{
noEquipCheck->setChecked(on);
}
#include "wiusersettings.moc"
\ No newline at end of file
......@@ -20,6 +20,7 @@
class WIView;
#include "obsconditions.h"
#include <QWizard>
#include "ui_wiusersettings.h"
......@@ -27,13 +28,21 @@ class WIUserSettings : public QWizard , public Ui::WIUserSettingsUI
{
Q_OBJECT
public:
WIUserSettings(QWidget* parent = 0, Qt::WindowFlags flags = 0);
~WIUserSettings();
public slots:
void slotFinished(int);
void slotSetBortleClass(int);
void slotTelescopeCheck(bool);
void slotBinocularsCheck(bool);
void slotNoEquipCheck(bool);
private:
void makeConnections();
WIView *wi;
ObsConditions::Equipment eq;
ObsConditions::EquipmentType type;
};
#endif
\ No newline at end of file
......@@ -68,7 +68,7 @@
</widget>
</widget>
<widget class="QWizardPage" name="lightPollutionPage">
<widget class="QSlider" name="horizontalSlider">
<widget class="QSlider" name="bortleClass">
<property name="geometry">
<rect>
<x>80</x>
......@@ -191,7 +191,7 @@
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
<widget class="QCheckBox" name="checkBox">
<widget class="QCheckBox" name="telescopeCheck">
<property name="geometry">
<rect>
<x>260</x>
......@@ -204,7 +204,7 @@
<string>Telescope</string>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_2">
<widget class="QCheckBox" name="binocularsCheck">
<property name="geometry">
<rect>
<x>260</x>
......@@ -217,7 +217,7 @@
<string>Binoculars</string>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_3">
<widget class="QCheckBox" name="noEquipCheck">
<property name="geometry">
<rect>
<x>260</x>
......@@ -271,7 +271,7 @@
<string>Aperture</string>
</property>
</widget>
<widget class="KDoubleNumInput" name="kdoublenuminput">
<widget class="KDoubleNumInput" name="aperture">
<property name="geometry">
<rect>
<x>360</x>
......@@ -281,7 +281,7 @@
</rect>
</property>
</widget>
<widget class="KComboBox" name="kcombobox">
<widget class="KComboBox" name="equipmentType">
<property name="geometry">
<rect>
<x>360</x>
......
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