Ocular.cpp   Ocular.cpp 
skipping to change at line 25 skipping to change at line 25
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
*/ */
#include "Ocular.hpp" #include "Ocular.hpp"
#include "Telescope.hpp" #include "Telescope.hpp"
#include "Lens.hpp" #include "Lens.hpp"
Ocular::Ocular() Ocular::Ocular()
: m_binoculars(false), : m_binoculars(false),
m_permanetCrosshair(false),
m_appearentFOV(0.0), m_appearentFOV(0.0),
m_effectiveFocalLength(0.0), m_effectiveFocalLength(0.0),
m_fieldStop(0.0), m_fieldStop(0.0),
m_reticleFOV(0.0) m_reticleFOV(0.0)
{ {
} }
Ocular::Ocular(const QObject& other) Ocular::Ocular(const QObject& other)
: m_binoculars(other.property("binoculars").toBool()), : m_binoculars(other.property("binoculars").toBool()),
m_permanetCrosshair(other.property("permanentCrosshair").toBool()) ,
m_appearentFOV(other.property("appearentFOV").toDouble()), m_appearentFOV(other.property("appearentFOV").toDouble()),
m_effectiveFocalLength(other.property("effectiveFocalLength").toDo uble()), m_effectiveFocalLength(other.property("effectiveFocalLength").toDo uble()),
m_fieldStop(other.property("fieldStop").toDouble()), m_fieldStop(other.property("fieldStop").toDouble()),
m_name(other.property("name").toString()), m_name(other.property("name").toString()),
m_reticleFOV(other.property("reticleFOV").toDouble()) m_reticleFOV(other.property("reticleFOV").toDouble())
{ {
} }
Ocular::~Ocular() Ocular::~Ocular()
{ {
skipping to change at line 56 skipping to change at line 58
static QMap<int, QString> mapping; static QMap<int, QString> mapping;
QMap<int, QString> Ocular::propertyMap(void) QMap<int, QString> Ocular::propertyMap(void)
{ {
if(mapping.isEmpty()) { if(mapping.isEmpty()) {
mapping = QMap<int, QString>(); mapping = QMap<int, QString>();
mapping[0] = "name"; mapping[0] = "name";
mapping[1] = "appearentFOV"; mapping[1] = "appearentFOV";
mapping[2] = "effectiveFocalLength"; mapping[2] = "effectiveFocalLength";
mapping[3] = "fieldStop"; mapping[3] = "fieldStop";
mapping[4] = "binoculars"; mapping[4] = "binoculars";
mapping[5] = "reticlePath"; mapping[5] = "permanentCrosshair";
mapping[6] = "reticlePath";
} }
return mapping; return mapping;
} }
/* ********************************************************************* */ /* ********************************************************************* */
#if 0 #if 0
#pragma mark - #pragma mark -
#pragma mark Instance Methods #pragma mark Instance Methods
#endif #endif
/* ********************************************************************* */ /* ********************************************************************* */
skipping to change at line 150 skipping to change at line 153
bool Ocular::isBinoculars(void) const bool Ocular::isBinoculars(void) const
{ {
return m_binoculars; return m_binoculars;
} }
void Ocular::setBinoculars(const bool flag) void Ocular::setBinoculars(const bool flag)
{ {
m_binoculars = flag; m_binoculars = flag;
} }
bool Ocular::hasPermanentCrosshair(void) const
{
return m_permanetCrosshair;
}
void Ocular::setPermanentCrosshair(const bool flag)
{
m_permanetCrosshair = flag;
}
QString Ocular::reticlePath(void) const QString Ocular::reticlePath(void) const
{ {
return m_reticlePath; return m_reticlePath;
} }
void Ocular::setReticlePath(const QString path) void Ocular::setReticlePath(const QString path)
{ {
m_reticlePath = path; m_reticlePath = path;
} }
/* ********************************************************************* */ /* ********************************************************************* */
skipping to change at line 176 skipping to change at line 189
Ocular * Ocular::ocularFromSettings(const QSettings *theSettings, const int ocularIndex) Ocular * Ocular::ocularFromSettings(const QSettings *theSettings, const int ocularIndex)
{ {
Ocular* ocular = new Ocular(); Ocular* ocular = new Ocular();
QString prefix = "ocular/" + QVariant(ocularIndex).toString() + "/"; QString prefix = "ocular/" + QVariant(ocularIndex).toString() + "/";
ocular->setName(theSettings->value(prefix + "name", "").toString()); ocular->setName(theSettings->value(prefix + "name", "").toString());
ocular->setAppearentFOV(theSettings->value(prefix + "afov", "0.0").t oDouble()); ocular->setAppearentFOV(theSettings->value(prefix + "afov", "0.0").t oDouble());
ocular->setEffectiveFocalLength(theSettings->value(prefix + "efl", " 0.0").toDouble()); ocular->setEffectiveFocalLength(theSettings->value(prefix + "efl", " 0.0").toDouble());
ocular->setFieldStop(theSettings->value(prefix + "fieldStop", "0.0") .toDouble()); ocular->setFieldStop(theSettings->value(prefix + "fieldStop", "0.0") .toDouble());
ocular->setBinoculars(theSettings->value(prefix + "binoculars", "fal se").toBool()); ocular->setBinoculars(theSettings->value(prefix + "binoculars", "fal se").toBool());
ocular->setPermanentCrosshair(theSettings->value(prefix + "permanent Crosshair", "false").toBool());
ocular->setReticlePath(theSettings->value(prefix + "reticlePath", "" ).toString()); ocular->setReticlePath(theSettings->value(prefix + "reticlePath", "" ).toString());
if (!(ocular->appearentFOV() > 0.0 && ocular->effectiveFocalLength() > 0.0)) { if (!(ocular->appearentFOV() > 0.0 && ocular->effectiveFocalLength() > 0.0)) {
qWarning() << "WARNING: Invalid data for ocular. Ocular valu es must be positive. \n" qWarning() << "WARNING: Invalid data for ocular. Ocular valu es must be positive. \n"
<< "\tafov: " << ocular->appearentFOV() << "\n" << "\tafov: " << ocular->appearentFOV() << "\n"
<< "\tefl: " << ocular->effectiveFocalLength() << "\n" << "\tefl: " << ocular->effectiveFocalLength() << "\n"
<< "\tThis ocular will be ignored."; << "\tThis ocular will be ignored.";
delete ocular; delete ocular;
ocular = NULL; ocular = NULL;
} }
skipping to change at line 198 skipping to change at line 212
} }
void Ocular::writeToSettings(QSettings * settings, const int index) void Ocular::writeToSettings(QSettings * settings, const int index)
{ {
QString prefix = "ocular/" + QVariant(index).toString() + "/"; QString prefix = "ocular/" + QVariant(index).toString() + "/";
settings->setValue(prefix + "name", this->name()); settings->setValue(prefix + "name", this->name());
settings->setValue(prefix + "afov", this->appearentFOV()); settings->setValue(prefix + "afov", this->appearentFOV());
settings->setValue(prefix + "efl", this->effectiveFocalLength()); settings->setValue(prefix + "efl", this->effectiveFocalLength());
settings->setValue(prefix + "fieldStop", this->fieldStop()); settings->setValue(prefix + "fieldStop", this->fieldStop());
settings->setValue(prefix + "binoculars", this->isBinoculars()); settings->setValue(prefix + "binoculars", this->isBinoculars());
settings->setValue(prefix + "permanentCrosshair", this->hasPermanent Crosshair());
settings->setValue(prefix + "reticlePath", this->reticlePath()); settings->setValue(prefix + "reticlePath", this->reticlePath());
} }
Ocular * Ocular::ocularModel(void) Ocular * Ocular::ocularModel(void)
{ {
Ocular* model = new Ocular(); Ocular* model = new Ocular();
model->setName("My Ocular"); model->setName("My Ocular");
model->setAppearentFOV(68); model->setAppearentFOV(68);
model->setEffectiveFocalLength(32); model->setEffectiveFocalLength(32);
model->setFieldStop(0); model->setFieldStop(0);
model->setBinoculars(false); model->setBinoculars(false);
model->setPermanentCrosshair(false);
model->setReticlePath(""); model->setReticlePath("");
return model; return model;
} }
 End of changes. 7 change blocks. 
1 lines changed or deleted 17 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/