CCD.cpp   CCD.cpp 
skipping to change at line 27 skipping to change at line 27
*/ */
#include "CCD.hpp" #include "CCD.hpp"
#include "Telescope.hpp" #include "Telescope.hpp"
#include "Lens.hpp" #include "Lens.hpp"
#include <QDebug> #include <QDebug>
#include <QSettings> #include <QSettings>
#include <QtMath> #include <QtMath>
#include <math.h> #include <cmath>
#define RADIAN_TO_DEGREES 57.2957795131 #define RADIAN_TO_DEGREES 57.2957795131
CCD::CCD() CCD::CCD()
: m_resolutionX(0) : m_resolutionX(0)
, m_resolutionY(0) , m_resolutionY(0)
, m_chipWidth(0.) , m_chipWidth(0.)
, m_chipHeight(0.) , m_chipHeight(0.)
, m_pixelWidth(0.) , m_pixelWidth(0.)
, m_pixelHeight(0.) , m_pixelHeight(0.)
, m_chipRotAngle(0.) , m_chipRotAngle(0.)
, m_binningX(1)
, m_binningY(1)
, m_has_oag(false) , m_has_oag(false)
, m_oag_prismHeight(0.) , m_oag_prismHeight(0.)
, m_oag_prismWidth(0.) , m_oag_prismWidth(0.)
, m_oag_prismDistance(0.) , m_oag_prismDistance(0.)
, m_oag_prismPosAngle(0.) , m_oag_prismPosAngle(0.)
{ {
} }
CCD::CCD(const QObject& other) CCD::CCD(const QObject& other)
: m_name(other.property("name").toString()) : m_name(other.property("name").toString())
, m_resolutionX(other.property("resolutionX").toInt()) , m_resolutionX(other.property("resolutionX").toInt())
, m_resolutionY(other.property("resolutionY").toInt()) , m_resolutionY(other.property("resolutionY").toInt())
, m_chipWidth(other.property("chipWidth").toFloat()) , m_chipWidth(other.property("chipWidth").toFloat())
, m_chipHeight(other.property("chipHeight").toFloat()) , m_chipHeight(other.property("chipHeight").toFloat())
, m_pixelWidth(other.property("pixelWidth").toFloat()) , m_pixelWidth(other.property("pixelWidth").toFloat())
, m_pixelHeight(other.property("pixelHeight").toFloat()) , m_pixelHeight(other.property("pixelHeight").toFloat())
, m_chipRotAngle(other.property("chipRotAngle").toFloat()) , m_chipRotAngle(other.property("chipRotAngle").toFloat())
, m_binningX(other.property("binningX").toInt())
, m_binningY(other.property("binningY").toInt())
, m_has_oag(other.property("hasOAG").toBool()) , m_has_oag(other.property("hasOAG").toBool())
, m_oag_prismHeight(other.property("prismHeight").toFloat()) , m_oag_prismHeight(other.property("prismHeight").toFloat())
, m_oag_prismWidth(other.property("prismWidth").toFloat()) , m_oag_prismWidth(other.property("prismWidth").toFloat())
, m_oag_prismDistance(other.property("prismDistance").toFloat()) , m_oag_prismDistance(other.property("prismDistance").toFloat())
, m_oag_prismPosAngle(other.property("prismPosAngle").toFloat()) , m_oag_prismPosAngle(other.property("prismPosAngle").toFloat())
{ {
} }
CCD::~CCD() CCD::~CCD()
{ {
skipping to change at line 82 skipping to change at line 86
if(mapping.isEmpty()) { if(mapping.isEmpty()) {
mapping = QMap<int, QString>(); mapping = QMap<int, QString>();
mapping[0] = "name"; mapping[0] = "name";
mapping[1] = "chipHeight"; mapping[1] = "chipHeight";
mapping[2] = "chipWidth"; mapping[2] = "chipWidth";
mapping[3] = "pixelHeight"; mapping[3] = "pixelHeight";
mapping[4] = "pixelWidth"; mapping[4] = "pixelWidth";
mapping[5] = "resolutionX"; mapping[5] = "resolutionX";
mapping[6] = "resolutionY"; mapping[6] = "resolutionY";
mapping[7] = "chipRotAngle"; mapping[7] = "chipRotAngle";
mapping[8] = "hasOAG"; mapping[8] = "binningX";
mapping[9] = "prismHeight"; mapping[9] = "binningY";
mapping[10] = "prismWidth"; mapping[10] = "hasOAG";
mapping[11] = "prismDistance"; mapping[11] = "prismHeight";
mapping[12] = "prismPosAngle"; mapping[12] = "prismWidth";
mapping[13] = "prismDistance";
mapping[14] = "prismPosAngle";
} }
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 227 skipping to change at line 233
void CCD::setPrismPosAngle(double angle) void CCD::setPrismPosAngle(double angle)
{ {
m_oag_prismPosAngle = angle; m_oag_prismPosAngle = angle;
} }
double CCD::prismPosAngle() const double CCD::prismPosAngle() const
{ {
return m_oag_prismPosAngle; return m_oag_prismPosAngle;
} }
int CCD::binningX() const
{
return m_binningX;
}
void CCD::setBinningX(int binning)
{
m_binningX = binning;
}
int CCD::binningY() const
{
return m_binningY;
}
void CCD::setBinningY(int binning)
{
m_binningY = binning;
}
double CCD::getInnerOAGRadius(Telescope *telescope, Lens *lens) const double CCD::getInnerOAGRadius(Telescope *telescope, Lens *lens) const
{ {
const double lens_multipler = (lens != NULL ? lens->getMultipler() : 1.0f); const double lens_multipler = (lens != NULL ? lens->getMultipler() : 1.0f);
double radius = RADIAN_TO_DEGREES * 2 * qAtan(this->prismDistance() /(2.0 * telescope->focalLength() * lens_multipler)); double radius = RADIAN_TO_DEGREES * 2 * qAtan(this->prismDistance() /(2.0 * telescope->focalLength() * lens_multipler));
return radius; return radius;
} }
double CCD::getOuterOAGRadius(Telescope *telescope, Lens *lens) const double CCD::getOuterOAGRadius(Telescope *telescope, Lens *lens) const
{ {
const double lens_multipler = (lens != NULL ? lens->getMultipler() : 1.0f); const double lens_multipler = (lens != NULL ? lens->getMultipler() : 1.0f);
skipping to change at line 251 skipping to change at line 277
double CCD::getOAGActualFOVx(Telescope *telescope, Lens *lens) const double CCD::getOAGActualFOVx(Telescope *telescope, Lens *lens) const
{ {
const double lens_multipler = (lens != NULL ? lens->getMultipler() : 1.0f); const double lens_multipler = (lens != NULL ? lens->getMultipler() : 1.0f);
double fovX = RADIAN_TO_DEGREES * 2 * qAtan(this->prismWidth() /(2.0 * telescope->focalLength() * lens_multipler)); double fovX = RADIAN_TO_DEGREES * 2 * qAtan(this->prismWidth() /(2.0 * telescope->focalLength() * lens_multipler));
return fovX; return fovX;
} }
double CCD::getActualFOVx(Telescope *telescope, Lens *lens) const double CCD::getActualFOVx(Telescope *telescope, Lens *lens) const
{ {
const double lens_multipler = (lens != NULL ? lens->getMultipler() : 1.0f); const double lens_multipler = (lens != NULL ? lens->getMultipler() : 1.0f);
double fovX = RADIAN_TO_DEGREES * 2 * qAtan(this->chipHeight() /(2.0 * telescope->focalLength() * lens_multipler)); double fovX = RADIAN_TO_DEGREES * 2 * qAtan(this->chipWidth() /(2.0 * telescope->focalLength() * lens_multipler));
return fovX; return fovX;
} }
double CCD::getActualFOVy(Telescope *telescope, Lens *lens) const double CCD::getActualFOVy(Telescope *telescope, Lens *lens) const
{ {
const double lens_multipler = (lens != NULL ? lens->getMultipler() : 1.0f); const double lens_multipler = (lens != NULL ? lens->getMultipler() : 1.0f);
double fovY = RADIAN_TO_DEGREES * 2 * qAtan(this->chipWidth() /(2.0 * telescope->focalLength() * lens_multipler)); double fovY = RADIAN_TO_DEGREES * 2 * qAtan(this->chipHeight() /(2.0 * telescope->focalLength() * lens_multipler));
return fovY; return fovY;
} }
void CCD::writeToSettings(QSettings * settings, const int index) void CCD::writeToSettings(QSettings * settings, const int index)
{ {
QString prefix = "ccd/" + QVariant(index).toString() + "/"; QString prefix = "ccd/" + QVariant(index).toString() + "/";
settings->setValue(prefix + "name", this->name()); settings->setValue(prefix + "name", this->name());
settings->setValue(prefix + "resolutionX", this->resolutionX()); settings->setValue(prefix + "resolutionX", this->resolutionX());
settings->setValue(prefix + "resolutionY", this->resolutionY()); settings->setValue(prefix + "resolutionY", this->resolutionY());
settings->setValue(prefix + "chip_width", this->chipWidth()); settings->setValue(prefix + "chip_width", this->chipWidth());
settings->setValue(prefix + "chip_height", this->chipHeight()); settings->setValue(prefix + "chip_height", this->chipHeight());
settings->setValue(prefix + "pixel_width", this->pixelWidth()); settings->setValue(prefix + "pixel_width", this->pixelWidth());
settings->setValue(prefix + "pixel_height", this->pixelHeight()); settings->setValue(prefix + "pixel_height", this->pixelHeight());
settings->setValue(prefix + "chip_rot_angle", this->chipRotAngle()); settings->setValue(prefix + "chip_rot_angle", this->chipRotAngle());
settings->setValue(prefix + "binningX", this->binningX());
settings->setValue(prefix + "binningY", this->binningY());
settings->setValue(prefix + "has_oag", this->hasOAG()); settings->setValue(prefix + "has_oag", this->hasOAG());
settings->setValue(prefix + "prism_height", this->prismHeight()); settings->setValue(prefix + "prism_height", this->prismHeight());
settings->setValue(prefix + "prism_width", this->prismWidth()); settings->setValue(prefix + "prism_width", this->prismWidth());
settings->setValue(prefix + "prism_distance", this->prismDistance()) ; settings->setValue(prefix + "prism_distance", this->prismDistance()) ;
settings->setValue(prefix + "prism_pos_angle", this->prismPosAngle() ); settings->setValue(prefix + "prism_pos_angle", this->prismPosAngle() );
} }
/* ********************************************************************* */ /* ********************************************************************* */
#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"). ccd->setResolutionX(theSettings->value(prefix + "resolutionX", 0).to
toInt()); Int());
ccd->setResolutionY(theSettings->value(prefix + "resolutionY", "0"). ccd->setResolutionY(theSettings->value(prefix + "resolutionY", 0).to
toInt()); Int());
ccd->setChipWidth(theSettings->value(prefix + "chip_width", "0.0").t ccd->setChipWidth(theSettings->value(prefix + "chip_width", 0.0).toD
oDouble()); ouble());
ccd->setChipHeight(theSettings->value(prefix + "chip_height", "0.0") ccd->setChipHeight(theSettings->value(prefix + "chip_height", 0.0).t
.toDouble()); oDouble());
ccd->setPixelWidth(theSettings->value(prefix + "pixel_width", "0.0") ccd->setPixelWidth(theSettings->value(prefix + "pixel_width", 0.0).t
.toDouble()); oDouble());
ccd->setPixelHeight(theSettings->value(prefix + "pixel_height", "0.0 ccd->setPixelHeight(theSettings->value(prefix + "pixel_height", 0.0)
").toDouble()); .toDouble());
ccd->setChipRotAngle(theSettings->value(prefix + "chip_rot_angle", " ccd->setChipRotAngle(theSettings->value(prefix + "chip_rot_angle", 0
0.0").toDouble()); .0).toDouble());
ccd->setBinningX(theSettings->value(prefix + "binningX", 1).toInt())
;
ccd->setBinningY(theSettings->value(prefix + "binningY", 1).toInt())
;
ccd->setHasOAG(theSettings->value(prefix + "has_oag", "false").toBoo l()); ccd->setHasOAG(theSettings->value(prefix + "has_oag", "false").toBoo l());
ccd->setPrismHeight(theSettings->value(prefix + "prism_height", "0.0 ccd->setPrismHeight(theSettings->value(prefix + "prism_height", 0.0)
").toDouble()); .toDouble());
ccd->setPrismWidth(theSettings->value(prefix + "prism_width", "0.0") ccd->setPrismWidth(theSettings->value(prefix + "prism_width", 0.0).t
.toDouble()); oDouble());
ccd->setPrismDistance(theSettings->value(prefix + "prism_distance", ccd->setPrismDistance(theSettings->value(prefix + "prism_distance",
"0.0").toDouble()); 0.0).toDouble());
ccd->setPrismPosAngle(theSettings->value(prefix + "prism_pos_angle", ccd->setPrismPosAngle(theSettings->value(prefix + "prism_pos_angle",
"0.0").toDouble()); 0.0).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);
model->setPixelHeight(9); model->setPixelHeight(9);
model->setPixelWidth(9); model->setPixelWidth(9);
model->setResolutionX(4096); model->setResolutionX(4096);
model->setResolutionY(4096); model->setResolutionY(4096);
model->setChipRotAngle(0); model->setChipRotAngle(0);
model->setBinningX(1);
model->setBinningY(1);
model->setHasOAG(false);
model->setPrismHeight(0);
model->setPrismWidth(0);
model->setPrismDistance(0);
model->setPrismPosAngle(0);
return model; return model;
} }
 End of changes. 11 change blocks. 
30 lines changed or deleted 69 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/