CCD.cpp   CCD.cpp 
/* /*
* portions Copyright (C) 2010 Bernhard Reutner-Fischer * Copyright (C) 2010 Timothy Reaves
* portions Copyright (C) 2010 Timothy Reaves
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
skipping to change at line 28 skipping to change at line 27
*/ */
#include "CCD.hpp" #include "CCD.hpp"
#include "Telescope.hpp" #include "Telescope.hpp"
#include <QDebug> #include <QDebug>
#include <QSettings> #include <QSettings>
#include <math.h> #include <math.h>
#define RADIAN_TO_DEGREES 57.2957795131
CCD::CCD() CCD::CCD()
{ {
} }
CCD::CCD(const QObject& other) CCD::CCD(const QObject& other)
{ {
this->m_name = other.property("name").toString(); this->m_name = other.property("name").toString();
this->m_chipHeight = other.property("chipHeight").toFloat(); this->m_chipHeight = other.property("chipHeight").toFloat();
this->m_chipWidth = other.property("chipWidth").toFloat(); this->m_chipWidth = other.property("chipWidth").toFloat();
this->m_pixelHeight = other.property("pixelHeight").toFloat(); this->m_pixelHeight = other.property("pixelHeight").toFloat();
skipping to change at line 100 skipping to change at line 101
int CCD::resolutionY() const int CCD::resolutionY() const
{ {
return m_resolutionY; return m_resolutionY;
} }
void CCD::setResolutionY(int resolution) void CCD::setResolutionY(int resolution)
{ {
m_resolutionY = resolution; m_resolutionY = resolution;
} }
float CCD::chipWidth() const double CCD::chipWidth() const
{ {
return m_chipWidth; return m_chipWidth;
} }
void CCD::setChipWidth(float width) void CCD::setChipWidth(double width)
{ {
m_chipWidth = width; m_chipWidth = width;
} }
float CCD::chipHeight() const double CCD::chipHeight() const
{ {
return m_chipHeight; return m_chipHeight;
} }
void CCD::setChipHeight(float height) void CCD::setChipHeight(double height)
{ {
m_chipHeight = height; m_chipHeight = height;
} }
float CCD::pixelWidth() const double CCD::pixelWidth() const
{ {
return m_pixelWidth; return m_pixelWidth;
} }
void CCD::setPixelWidth(float width) void CCD::setPixelWidth(double width)
{ {
m_pixelWidth = width; m_pixelWidth = width;
} }
float CCD::pixelHeight() const double CCD::pixelHeight() const
{ {
return m_pixelHeight; return m_pixelHeight;
} }
void CCD::setPixelHeight(float height) void CCD::setPixelHeight(double height)
{ {
m_pixelHeight = height; m_pixelHeight = height;
} }
float CCD::getActualFOVx(Telescope *telescope) const double CCD::getActualFOVx(Telescope *telescope) const
{ {
float FOVx = 6875.5 * atan(this->chipWidth() / telescope->focalLengt h() / 2); double FOVx = RADIAN_TO_DEGREES * this->chipHeight() / telescope->fo calLength();
return FOVx; return FOVx;
} }
float CCD::getActualFOVy(Telescope *telescope) const double CCD::getActualFOVy(Telescope *telescope) const
{ {
float FOVy = 6875.5 * atan(this->chipWidth() / telescope->focalLengt h() / 2); double FOVy = RADIAN_TO_DEGREES * this->chipWidth() / telescope->foc alLength();
return FOVy; return FOVy;
} }
/* ********************************************************************* */ /* ********************************************************************* */
#if 0 #if 0
#pragma mark - #pragma mark -
#pragma mark Static Methods #pragma mark Static Methods
#endif #endif
/* ********************************************************************* */ /* ********************************************************************* */
CCD* CCD::ccdFromSettings(QSettings* theSettings, int ccdIndex) CCD* CCD::ccdFromSettings(QSettings* theSettings, int ccdIndex)
{ {
CCD* ccd = new CCD(); CCD* ccd = new CCD();
QString prefix = "ccd/" + QVariant(ccdIndex).toString() + "/"; QString prefix = "ccd/" + QVariant(ccdIndex).toString() + "/";
ccd->setName(theSettings->value(prefix + "name", "").toString()); ccd->setName(theSettings->value(prefix + "name", "").toString());
ccd->setResolutionX(theSettings->value(prefix + "resolutionX", "0"). toInt()); ccd->setResolutionX(theSettings->value(prefix + "resolutionX", "0"). toInt());
ccd->setResolutionY(theSettings->value(prefix + "resolutionY", "0"). toInt()); ccd->setResolutionY(theSettings->value(prefix + "resolutionY", "0"). toInt());
ccd->setChipWidth(theSettings->value(prefix + "chip_width", "0.0").t ccd->setChipWidth(theSettings->value(prefix + "chip_width", "0.0").t
oFloat()); oDouble());
ccd->setChipHeight(theSettings->value(prefix + "chip_height", "0.0") ccd->setChipHeight(theSettings->value(prefix + "chip_height", "0.0")
.toFloat()); .toDouble());
ccd->setPixelWidth(theSettings->value(prefix + "pixel_width", "0.0") ccd->setPixelWidth(theSettings->value(prefix + "pixel_width", "0.0")
.toFloat()); .toDouble());
ccd->setPixelHeight(theSettings->value(prefix + "pixel_height", "0.0 ccd->setPixelHeight(theSettings->value(prefix + "pixel_height", "0.0
").toFloat()); ").toDouble());
return ccd; return ccd;
} }
CCD* CCD::ccdModel() CCD* CCD::ccdModel()
{ {
CCD* model = new CCD(); CCD* model = new CCD();
model->setName("My CCD"); model->setName("My CCD");
model->setChipHeight(36.8); model->setChipHeight(36.8);
model->setChipWidth(36.8); model->setChipWidth(36.8);
 End of changes. 15 change blocks. 
22 lines changed or deleted 23 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/