Oculars.cpp   Oculars.cpp 
skipping to change at line 53 skipping to change at line 53
#include "StelPropertyMgr.hpp" #include "StelPropertyMgr.hpp"
#include "LandscapeMgr.hpp" #include "LandscapeMgr.hpp"
#include <QAction> #include <QAction>
#include <QDebug> #include <QDebug>
#include <QDir> #include <QDir>
#include <QGraphicsWidget> #include <QGraphicsWidget>
#include <QKeyEvent> #include <QKeyEvent>
#include <QMenu> #include <QMenu>
#include <QMouseEvent> #include <QMouseEvent>
#include <QtNetwork>
#include <QPixmap> #include <QPixmap>
#include <QSignalMapper> #include <QSignalMapper>
#include <cmath> #include <cmath>
extern void qt_set_sequence_auto_mnemonic(bool b); extern void qt_set_sequence_auto_mnemonic(bool b);
static QSettings *settings; //!< The settings as read in from the ini file. static QSettings *settings; //!< The settings as read in from the ini file.
/* ************************************************************************ ****************************************** */ /* ************************************************************************ ****************************************** */
skipping to change at line 137 skipping to change at line 136
flagCardinalPoints(false), flagCardinalPoints(false),
flagCelestialJ2000Poles(false), flagCelestialJ2000Poles(false),
flagCelestialPoles(false), flagCelestialPoles(false),
flagZenithNadirPoints(false), flagZenithNadirPoints(false),
flagEclipticJ2000Poles(false), flagEclipticJ2000Poles(false),
flagEclipticPoles(false), flagEclipticPoles(false),
flagGalacticPoles(false), flagGalacticPoles(false),
flagSupergalacticPoles(false), flagSupergalacticPoles(false),
flagEquinoxJ2000Points(false), flagEquinoxJ2000Points(false),
flagEquinoxPoints(false), flagEquinoxPoints(false),
flagSolsticeJ2000Points(false),
flagSolsticePoints(false),
flagAdaptation(false), flagAdaptation(false),
flagLimitStars(false), flagLimitStars(false),
magLimitStars(0.0), magLimitStars(0.0),
flagLimitDSOs(false), flagLimitDSOs(false),
magLimitDSOs(0.0), magLimitDSOs(0.0),
flagLimitPlanets(false), flagLimitPlanets(false),
magLimitPlanets(0.0), magLimitPlanets(0.0),
relativeStarScale(1.0),
absoluteStarScale(1.0),
flagMoonScale(false), flagMoonScale(false),
maxEyepieceAngle(0.0), maxEyepieceAngle(0.0),
requireSelection(true), requireSelection(true),
flagLimitMagnitude(false), flagLimitMagnitude(false),
useMaxEyepieceAngle(true), useMaxEyepieceAngle(true),
guiPanelEnabled(false), guiPanelEnabled(false),
flagDecimalDegrees(false), flagDecimalDegrees(false),
flagSemiTransporency(false), flagSemiTransporency(false),
flagHideGridsLines(false), flagHideGridsLines(false),
flipVert(false), flipVert(false),
skipping to change at line 182 skipping to change at line 181
actionConfiguration(0), actionConfiguration(0),
actionMenu(0), actionMenu(0),
actionTelescopeIncrement(0), actionTelescopeIncrement(0),
actionTelescopeDecrement(0), actionTelescopeDecrement(0),
actionOcularIncrement(0), actionOcularIncrement(0),
actionOcularDecrement(0), actionOcularDecrement(0),
guiPanel(0), guiPanel(0),
actualFOV(0), actualFOV(0),
initialFOV(0), initialFOV(0),
flagInitFOVUsage(false), flagInitFOVUsage(false),
flagInitDirectionUsage(false),
flagAutosetMountForCCD(false), flagAutosetMountForCCD(false),
equatorialMountEnabled(false), equatorialMountEnabled(false),
reticleRotation(0) reticleRotation(0)
{ {
// Font size is 14 // Font size is 14
font.setPixelSize(StelApp::getInstance().getBaseFontSize()+1); font.setPixelSize(StelApp::getInstance().getBaseFontSize()+1);
ccds = QList<CCD *>(); ccds = QList<CCD *>();
oculars = QList<Ocular *>(); oculars = QList<Ocular *>();
telescopes = QList<Telescope *>(); telescopes = QList<Telescope *>();
skipping to change at line 290 skipping to change at line 290
index++; index++;
} }
settings->setValue("ocular_count", oculars.count()); settings->setValue("ocular_count", oculars.count());
settings->setValue("telescope_count", telescopes.count()); settings->setValue("telescope_count", telescopes.count());
settings->setValue("ccd_count", ccds.count()); settings->setValue("ccd_count", ccds.count());
settings->setValue("lens_count", lense.count()); settings->setValue("lens_count", lense.count());
settings->sync(); settings->sync();
disconnect(this, SIGNAL(selectedOcularChanged()), this, SLOT(updateO cularReticle())); disconnect(this, SIGNAL(selectedOcularChanged()), this, SLOT(updateO cularReticle()));
disconnect(&StelApp::getInstance(), SIGNAL(colorSchemeChanged(const QString&)), this, SLOT(setStelStyle(const QString&))); //disconnect(&StelApp::getInstance(), SIGNAL(colorSchemeChanged(cons t QString&)), this, SLOT(setStelStyle(const QString&)));
disconnect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslateGui())); disconnect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslateGui()));
} }
//! Draw any parts on the screen which are for our module //! Draw any parts on the screen which are for our module
void Oculars::draw(StelCore* core) void Oculars::draw(StelCore* core)
{ {
if (flagShowTelrad) if (flagShowTelrad)
{ {
paintTelrad(); paintTelrad();
} }
skipping to change at line 336 skipping to change at line 336
if (ready) if (ready)
{ {
if (selectedOcularIndex > -1) if (selectedOcularIndex > -1)
{ {
paintOcularMask(core); paintOcularMask(core);
if (flagShowCrosshairs) if (flagShowCrosshairs)
{ {
paintCrosshairs(); paintCrosshairs();
} }
} }
if (guiPanelEnabled) if (!guiPanelEnabled)
{
// Reset the state to allow the panel to be
painted normally
glDisable(GL_TEXTURE_2D);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_A
LPHA);
glEnable(GL_BLEND);
}
else
{ {
// Paint the information in the upper-right hand corner // Paint the information in the upper-right hand corner
paintText(core); paintText(core);
} }
} }
} }
else if (flagShowCCD) else if (flagShowCCD)
{ {
paintCCDBounds(); paintCCDBounds();
if (guiPanelEnabled) if (!guiPanelEnabled)
{
// Reset the state to allow the panel to be painted
normally
glDisable(GL_TEXTURE_2D);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
}
else
{ {
// Paint the information in the upper-right hand cor ner // Paint the information in the upper-right hand cor ner
paintText(core); paintText(core);
} }
} }
} }
//! Determine which "layer" the plugin's drawing will happen on. //! Determine which "layer" the plugin's drawing will happen on.
double Oculars::getCallOrder(StelModuleActionName actionName) const double Oculars::getCallOrder(StelModuleActionName actionName) const
{ {
skipping to change at line 386 skipping to change at line 372
order = StelApp::getInstance().getModuleMgr().getModule("Ste lMovementMgr")->getCallOrder(actionName) - 1.0; order = StelApp::getInstance().getModuleMgr().getModule("Ste lMovementMgr")->getCallOrder(actionName) - 1.0;
} }
else if (actionName==StelModule::ActionDraw) else if (actionName==StelModule::ActionDraw)
{ {
order = GETSTELMODULE(LabelMgr)->getCallOrder(actionName) + 100.0; order = GETSTELMODULE(LabelMgr)->getCallOrder(actionName) + 100.0;
} }
return order; return order;
} }
const StelStyle Oculars::getModuleStyleSheet(const StelStyle& style)
{
StelStyle pluginStyle(style);
if (StelApp::getInstance().getVisionModeNight())
{
pluginStyle.qtStyleSheet.append(nightStyleSheet);
}
else
{
pluginStyle.qtStyleSheet.append(normalStyleSheet);
}
return pluginStyle;
}
void Oculars::handleMouseClicks(class QMouseEvent* event) void Oculars::handleMouseClicks(class QMouseEvent* event)
{ {
StelCore *core = StelApp::getInstance().getCore(); StelCore *core = StelApp::getInstance().getCore();
StelMovementMgr *movementManager = core->getMovementMgr(); StelMovementMgr *movementManager = core->getMovementMgr();
if (StelApp::getInstance().getStelObjectMgr().getWasSelected()) if (StelApp::getInstance().getStelObjectMgr().getWasSelected())
{ {
if (flagShowOculars) if (flagShowOculars)
{ {
// center the selected object in the ocular, and tra ck. // center the selected object in the ocular, and tra ck.
movementManager->setFlagTracking(true); movementManager->setFlagTracking(true);
skipping to change at line 498 skipping to change at line 470
multiplier = 5.0; multiplier = 5.0;
} }
if (event->modifiers().testFlag(Qt::ShiftMod ifier)) if (event->modifiers().testFlag(Qt::ShiftMod ifier))
{ {
reticleRotation += (1.0 * multiplier ); reticleRotation += (1.0 * multiplier );
} }
else else
{ {
reticleRotation -= (1.0 * multiplier ); reticleRotation -= (1.0 * multiplier );
} }
qDebug() << reticleRotation; //qDebug() << reticleRotation;
consumeEvent = true; consumeEvent = true;
break; break;
} }
} }
else else
{ {
// When a deplacement key is released stop mooving // When a deplacement key is released stop mooving
switch (event->key()) switch (event->key())
{ {
case Qt::Key_Left: case Qt::Key_Left:
skipping to change at line 676 skipping to change at line 648
ocularDialog = new OcularDialog(this, &ccds, &oculars, &tele scopes, &lense); ocularDialog = new OcularDialog(this, &ccds, &oculars, &tele scopes, &lense);
initializeActivationActions(); initializeActivationActions();
determineMaxEyepieceAngle(); determineMaxEyepieceAngle();
guiPanelEnabled = settings->value("enable_control_panel", tr ue).toBool(); guiPanelEnabled = settings->value("enable_control_panel", tr ue).toBool();
enableGuiPanel(guiPanelEnabled); enableGuiPanel(guiPanelEnabled);
setFlagDecimalDegrees(settings->value("use_decimal_degrees", false).toBool()); setFlagDecimalDegrees(settings->value("use_decimal_degrees", false).toBool());
setFlagLimitMagnitude(settings->value("limit_stellar_magnitu de", true).toBool()); setFlagLimitMagnitude(settings->value("limit_stellar_magnitu de", true).toBool());
setFlagInitFovUsage(settings->value("use_initial_fov", false ).toBool()); setFlagInitFovUsage(settings->value("use_initial_fov", false ).toBool());
setFlagInitDirectionUsage(settings->value("use_initial_direc tion", false).toBool());
setFlagUseSemiTransparency(settings->value("use_semi_transpa rency", false).toBool()); setFlagUseSemiTransparency(settings->value("use_semi_transpa rency", false).toBool());
setFlagHideGridsLines(settings->value("hide_grids_and_lines" , true).toBool()); setFlagHideGridsLines(settings->value("hide_grids_and_lines" , true).toBool());
setFlagAutosetMountForCCD(settings->value("use_mount_autoset ", false).toBool()); setFlagAutosetMountForCCD(settings->value("use_mount_autoset ", false).toBool());
StelPropertyMgr* propMgr=StelApp::getInstance().getStelPrope rtyManager(); StelPropertyMgr* propMgr=StelApp::getInstance().getStelPrope rtyManager();
equatorialMountEnabled = propMgr->getStelPropertyValue("acti onSwitch_Equatorial_Mount").toBool(); equatorialMountEnabled = propMgr->getStelPropertyValue("acti onSwitch_Equatorial_Mount").toBool();
} }
catch (std::runtime_error& e) catch (std::runtime_error& e)
{ {
qWarning() << "WARNING: unable to locate ocular.ini file or create a default one for Ocular plugin: " << e.what(); qWarning() << "WARNING: unable to locate ocular.ini file or create a default one for Ocular plugin: " << e.what();
ready = false; ready = false;
} }
//Load the module's custom style sheets
QFile styleSheetFile;
styleSheetFile.setFileName(":/ocular/normalStyle.css");
if(styleSheetFile.open(QFile::ReadOnly|QFile::Text))
{
normalStyleSheet = styleSheetFile.readAll();
}
styleSheetFile.close();
styleSheetFile.setFileName(":/ocular/nightStyle.css");
if(styleSheetFile.open(QFile::ReadOnly|QFile::Text))
{
nightStyleSheet = styleSheetFile.readAll();
}
styleSheetFile.close();
connect(&StelApp::getInstance(), SIGNAL(colorSchemeChanged(const QSt
ring&)), this, SLOT(setStelStyle(const QString&)));
connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SL OT(retranslateGui())); connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SL OT(retranslateGui()));
connect(this, SIGNAL(selectedOcularChanged()), this, SLOT(updateOcul arReticle())); connect(this, SIGNAL(selectedOcularChanged()), this, SLOT(updateOcul arReticle()));
} }
void Oculars::setStelStyle(const QString&)
{
if(ocularDialog)
{
ocularDialog->updateStyle();
}
}
/* ************************************************************************ ****************************************** */ /* ************************************************************************ ****************************************** */
#if 0 #if 0
#pragma mark - #pragma mark -
#pragma mark Private slots Methods #pragma mark Private slots Methods
#endif #endif
/* ************************************************************************ ****************************************** */ /* ************************************************************************ ****************************************** */
void Oculars::determineMaxEyepieceAngle() void Oculars::determineMaxEyepieceAngle()
{ {
if (ready) if (ready)
{ {
skipping to change at line 1019 skipping to change at line 969
selectedOcularIndex = oculars.count() - 1; selectedOcularIndex = oculars.count() - 1;
} }
// validate the new selection // validate the new selection
if (selectedOcularIndex > -1 && !oculars[selectedOcularIndex]->isBin oculars()) if (selectedOcularIndex > -1 && !oculars[selectedOcularIndex]->isBin oculars())
{ {
if ( selectedTelescopeIndex == -1 && telescopes.count() == 0 ) if ( selectedTelescopeIndex == -1 && telescopes.count() == 0 )
{ {
// reject the change // reject the change
selectedOcularIndex++; selectedOcularIndex++;
} }
else if (selectedTelescopeIndex == -1)
{ if (selectedTelescopeIndex == -1)
selectedTelescopeIndex = 0; selectedTelescopeIndex = 0;
emit(selectedOcularChanged());
}
else
{
emit(selectedOcularChanged());
}
}
else
{
emit(selectedOcularChanged());
} }
emit(selectedOcularChanged());
} }
void Oculars::decrementTelescopeIndex() void Oculars::decrementTelescopeIndex()
{ {
selectedTelescopeIndex--; selectedTelescopeIndex--;
if (selectedTelescopeIndex == -1) if (selectedTelescopeIndex == -1)
{ {
selectedTelescopeIndex = telescopes.count() - 1; selectedTelescopeIndex = telescopes.count() - 1;
} }
emit(selectedTelescopeChanged()); emit(selectedTelescopeChanged());
skipping to change at line 1062 skipping to change at line 1004
if (selectedLensIndex == -2) if (selectedLensIndex == -2)
{ {
selectedLensIndex = lense.count() - 1; selectedLensIndex = lense.count() - 1;
} }
emit(selectedLensChanged()); emit(selectedLensChanged());
} }
void Oculars::displayPopupMenu() void Oculars::displayPopupMenu()
{ {
QMenu * popup = new QMenu(&StelMainView::getInstance()); QMenu * popup = new QMenu(&StelMainView::getInstance());
StelGui * gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui
());
Q_ASSERT(gui);
//qDebug() << "[Oculars]" << this->getModuleStyleSheet(gui->getStelS
tyle()).qtStyleSheet;
popup->setStyleSheet(this->getModuleStyleSheet(gui->getStelStyle()).
qtStyleSheet);
if (flagShowOculars) if (flagShowOculars)
{ {
// We are in Oculars mode // We are in Oculars mode
// We want to show all of the Oculars, and if the current oc ular is not a binocular, // We want to show all of the Oculars, and if the current oc ular is not a binocular,
// we will also show the telescopes. // we will also show the telescopes.
if (!oculars.isEmpty()) if (!oculars.isEmpty())
{ {
popup->addAction(q_("&Previous ocular"), this, SLOT( decrementOcularIndex())); popup->addAction(q_("&Previous ocular"), this, SLOT( decrementOcularIndex()));
popup->addAction(q_("&Next ocular"), this, SLOT(incr ementOcularIndex())); popup->addAction(q_("&Next ocular"), this, SLOT(incr ementOcularIndex()));
skipping to change at line 1091 skipping to change at line 1029
if (availableOcularCount < 10) if (availableOcularCount < 10)
{ {
label = QString("&%1: %2").arg(avail ableOcularCount).arg(oculars[index]->name()); label = QString("&%1: %2").arg(avail ableOcularCount).arg(oculars[index]->name());
} }
else else
{ {
label = oculars[index]->name(); label = oculars[index]->name();
} }
//BM: Does this happen at all any more? //BM: Does this happen at all any more?
QAction* action = 0; QAction* action = 0;
if (selectedTelescopeIndex == -1) if (selectedTelescopeIndex != -1 || oculars[ index]->isBinoculars())
{ {
if (oculars[index]->isBinoculars())
{
action = submenu->addAction( label, ocularsSignalMapper, SLOT(map())); action = submenu->addAction( label, ocularsSignalMapper, SLOT(map()));
availableOcularCount++; availableOcularCount++;
ocularsSignalMapper->setMapp ing(action, QString("%1").arg(index)); ocularsSignalMapper->setMapp ing(action, QString("%1").arg(index));
}
}
else
{
action = submenu->addAction(label, o
cularsSignalMapper, SLOT(map()));
availableOcularCount++;
ocularsSignalMapper->setMapping(acti
on, QString("%1").arg(index));
} }
if (action && index == selectedOcularIndex) if (action && index == selectedOcularIndex)
{ {
action->setCheckable(true); action->setCheckable(true);
action->setChecked(true); action->setChecked(true);
} }
} }
popup->addMenu(submenu); popup->addMenu(submenu);
popup->addSeparator(); popup->addSeparator();
} }
skipping to change at line 1209 skipping to change at line 1139
rotateAction = submenu->addAction(QString("&6: +1") + QChar(0x00B0), ccdRotationSignalMapper, SLOT(map())); rotateAction = submenu->addAction(QString("&6: +1") + QChar(0x00B0), ccdRotationSignalMapper, SLOT(map()));
ccdRotationSignalMapper->setMapping(rotateAction, QS tring("1")); ccdRotationSignalMapper->setMapping(rotateAction, QS tring("1"));
rotateAction = submenu->addAction(QString("&7: +5") + QChar(0x00B0), ccdRotationSignalMapper, SLOT(map())); rotateAction = submenu->addAction(QString("&7: +5") + QChar(0x00B0), ccdRotationSignalMapper, SLOT(map()));
ccdRotationSignalMapper->setMapping(rotateAction, QS tring("5")); ccdRotationSignalMapper->setMapping(rotateAction, QS tring("5"));
rotateAction = submenu->addAction(QString("&8: +15") + QChar(0x00B0), ccdRotationSignalMapper, SLOT(map())); rotateAction = submenu->addAction(QString("&8: +15") + QChar(0x00B0), ccdRotationSignalMapper, SLOT(map()));
ccdRotationSignalMapper->setMapping(rotateAction, QS tring("15")); ccdRotationSignalMapper->setMapping(rotateAction, QS tring("15"));
rotateAction = submenu->addAction(QString("&9: +45") + QChar(0x00B0), ccdRotationSignalMapper, SLOT(map())); rotateAction = submenu->addAction(QString("&9: +45") + QChar(0x00B0), ccdRotationSignalMapper, SLOT(map()));
ccdRotationSignalMapper->setMapping(rotateAction, QS tring("45")); ccdRotationSignalMapper->setMapping(rotateAction, QS tring("45"));
rotateAction = submenu->addAction(QString("&0: +90") + QChar(0x00B0), ccdRotationSignalMapper, SLOT(map())); rotateAction = submenu->addAction(QString("&0: +90") + QChar(0x00B0), ccdRotationSignalMapper, SLOT(map()));
ccdRotationSignalMapper->setMapping(rotateAction, QS tring("90")); ccdRotationSignalMapper->setMapping(rotateAction, QS tring("90"));
rotateAction = submenu->addAction(q_("&Reset rotatio n"), this, SLOT(ccdRotationReset())); submenu->addAction(q_("&Reset rotation"), this, SLOT (ccdRotationReset()));
popup->addMenu(submenu); popup->addMenu(submenu);
popup->addSeparator(); popup->addSeparator();
} }
if (flagShowCCD && selectedCCDIndex > -1 && telescopes.count () > 1) if (flagShowCCD && selectedCCDIndex > -1 && telescopes.count () > 1)
{ {
QMenu* submenu = addTelescopeSubmenu(popup); QMenu* submenu = addTelescopeSubmenu(popup);
popup->addMenu(submenu); popup->addMenu(submenu);
submenu = addLensSubmenu(popup); submenu = addLensSubmenu(popup);
popup->addMenu(submenu); popup->addMenu(submenu);
popup->addSeparator(); popup->addSeparator();
} }
skipping to change at line 1253 skipping to change at line 1182
selectedOcularIndex = 0; selectedOcularIndex = 0;
} }
// validate the new selection // validate the new selection
if (selectedOcularIndex > -1 && !oculars[selectedOcularIndex]->isBin oculars()) if (selectedOcularIndex > -1 && !oculars[selectedOcularIndex]->isBin oculars())
{ {
if ( selectedTelescopeIndex == -1 && telescopes.count() == 0 ) if ( selectedTelescopeIndex == -1 && telescopes.count() == 0 )
{ {
// reject the change // reject the change
selectedOcularIndex++; selectedOcularIndex++;
} }
else if (selectedTelescopeIndex == -1)
{ if (selectedTelescopeIndex == -1)
selectedTelescopeIndex = 0; selectedTelescopeIndex = 0;
emit(selectedOcularChanged());
}
else
{
emit(selectedOcularChanged());
}
}
else
{
emit(selectedOcularChanged());
} }
emit(selectedOcularChanged());
} }
void Oculars::incrementTelescopeIndex() void Oculars::incrementTelescopeIndex()
{ {
selectedTelescopeIndex++; selectedTelescopeIndex++;
if (selectedTelescopeIndex == telescopes.count()) if (selectedTelescopeIndex == telescopes.count())
{ {
selectedTelescopeIndex = 0; selectedTelescopeIndex = 0;
} }
emit(selectedTelescopeChanged()); emit(selectedTelescopeChanged());
skipping to change at line 1327 skipping to change at line 1248
{ {
selectedCCDIndex = index; selectedCCDIndex = index;
emit(selectedCCDChanged()); emit(selectedCCDChanged());
} }
} }
void Oculars::selectOcularAtIndex(QString indexString) void Oculars::selectOcularAtIndex(QString indexString)
{ {
int index = indexString.toInt(); int index = indexString.toInt();
// validate the new selection if (selectedTelescopeIndex == -1)
if (oculars[index]->isBinoculars()) selectedTelescopeIndex = 0;
if (telescopes.count() != 0 || oculars[index]->isBinoculars())
{ {
selectedOcularIndex = index; selectedOcularIndex = index;
emit(selectedOcularChanged()); emit(selectedOcularChanged());
} }
else
{
if ( selectedTelescopeIndex == -1 && telescopes.count() == 0
)
{
// reject the change
}
else
{
if (selectedTelescopeIndex == -1)
{
selectedTelescopeIndex = 0;
}
selectedOcularIndex = index;
emit(selectedOcularChanged());
}
}
} }
void Oculars::selectTelescopeAtIndex(QString indexString) void Oculars::selectTelescopeAtIndex(QString indexString)
{ {
int index = indexString.toInt(); int index = indexString.toInt();
if (index > -2 && index < telescopes.count()) if (index > -2 && index < telescopes.count())
{ {
selectedTelescopeIndex = index; selectedTelescopeIndex = index;
emit(selectedTelescopeChanged()); emit(selectedTelescopeChanged());
} }
skipping to change at line 1387 skipping to change at line 1294
//if there are no sensors. //if there are no sensors.
if (show) if (show)
qWarning() << "Oculars plugin: Unable to display a s ensor boundary: No sensors or telescopes are defined."; qWarning() << "Oculars plugin: Unable to display a s ensor boundary: No sensors or telescopes are defined.";
flagShowCCD = false; flagShowCCD = false;
selectedCCDIndex = -1; selectedCCDIndex = -1;
show = false; show = false;
} }
StelCore *core = StelApp::getInstance().getCore(); StelCore *core = StelApp::getInstance().getCore();
StelMovementMgr *movementManager = core->getMovementMgr(); StelMovementMgr *movementManager = core->getMovementMgr();
StelSkyDrawer *skyManager = core->getSkyDrawer();
skyManager->setAbsoluteStarScale(absoluteStarScale);
if (show) if (show)
{ {
initialFOV = movementManager->getCurrentFov(); initialFOV = movementManager->getCurrentFov();
//Mutually exclusive with the ocular mode //Mutually exclusive with the ocular mode
hideUsageMessageIfDisplayed(); hideUsageMessageIfDisplayed();
if (flagShowOculars) if (flagShowOculars)
enableOcular(false); enableOcular(false);
if (flagShowTelrad) { if (flagShowTelrad) {
toggleTelrad(false); toggleTelrad(false);
skipping to change at line 1412 skipping to change at line 1317
{ {
selectedTelescopeIndex = 0; selectedTelescopeIndex = 0;
} }
if (selectedCCDIndex < 0) if (selectedCCDIndex < 0)
{ {
selectedCCDIndex = 0; selectedCCDIndex = 0;
} }
flagShowCCD = true; flagShowCCD = true;
setScreenFOVForCCD(); setScreenFOVForCCD();
// Change relative scale for stars
// TODO: Finding experimental value for better rendering
skyManager->setRelativeStarScale(0.6);
if (guiPanel) if (guiPanel)
{ {
guiPanel->showCcdGui(); guiPanel->showCcdGui();
} }
} }
else else
{ {
flagShowCCD = false; flagShowCCD = false;
skyManager->setRelativeStarScale(relativeStarScale);
movementManager->setFlagTracking(false); movementManager->setFlagTracking(false);
//Zoom out //Zoom out
if (getFlagInitFovUsage()) if (getFlagInitFovUsage())
movementManager->zoomTo(movementManager->getInitFov( )); movementManager->zoomTo(movementManager->getInitFov( ));
else else
movementManager->zoomTo(initialFOV); movementManager->zoomTo(initialFOV);
if (getFlagInitDirectionUsage())
movementManager->setViewDirectionJ2000(core->altAzTo
J2000(movementManager->getInitViewingDirection(), StelCore::RefractionOff))
;
if (getFlagAutosetMountForCCD()) if (getFlagAutosetMountForCCD())
{ {
StelPropertyMgr* propMgr=StelApp::getInstance().getS telPropertyManager(); StelPropertyMgr* propMgr=StelApp::getInstance().getS telPropertyManager();
propMgr->setStelPropertyValue("actionSwitch_Equatori al_Mount", equatorialMountEnabled); propMgr->setStelPropertyValue("actionSwitch_Equatori al_Mount", equatorialMountEnabled);
} }
if (guiPanel) if (guiPanel)
{ {
guiPanel->foldGui(); guiPanel->foldGui();
} }
skipping to change at line 1478 skipping to change at line 1381
{ {
hideUsageMessageIfDisplayed(); hideUsageMessageIfDisplayed();
enableOcular(false); enableOcular(false);
toggleCCD(false); toggleCCD(false);
// NOTE: Added special zoom level for Telrad // NOTE: Added special zoom level for Telrad
// Seems problem was introduced with introducing Ste lProperty feature // Seems problem was introduced with introducing Ste lProperty feature
movementMgr->zoomTo(10.0); movementMgr->zoomTo(10.0);
} }
else if (getFlagInitFovUsage()) // Restoration of FOV is nee ded? else if (getFlagInitFovUsage()) // Restoration of FOV is nee ded?
movementMgr->zoomTo(movementMgr->getInitFov()); movementMgr->zoomTo(movementMgr->getInitFov());
if (getFlagInitDirectionUsage())
movementMgr->setViewDirectionJ2000(StelApp::getInsta
nce().getCore()->altAzToJ2000(movementMgr->getInitViewingDirection(), StelC
ore::RefractionOff));
flagShowTelrad = show; flagShowTelrad = show;
emit enableTelradChanged(flagShowTelrad); emit enableTelradChanged(flagShowTelrad);
} }
} }
void Oculars::toggleTelrad() void Oculars::toggleTelrad()
{ {
toggleTelrad(!flagShowTelrad); toggleTelrad(!flagShowTelrad);
} }
skipping to change at line 1562 skipping to change at line 1469
{ {
binocularFound = true; binocularFound = true;
break; break;
} }
} }
return binocularFound; return binocularFound;
} }
void Oculars::paintCCDBounds() void Oculars::paintCCDBounds()
{ {
int fontSize = StelApp::getInstance().getBaseFontSize();
StelCore *core = StelApp::getInstance().getCore(); StelCore *core = StelApp::getInstance().getCore();
StelProjector::StelProjectorParams params = core->getCurrentStelProj ectorParams(); StelProjector::StelProjectorParams params = core->getCurrentStelProj ectorParams();
Lens *lens = selectedLensIndex >=0 ? lense[selectedLensIndex] : NUL L; Lens *lens = selectedLensIndex >=0 ? lense[selectedLensIndex] : NUL L;
const StelProjectorP projector = core->getProjection(StelCore::Frame EquinoxEqu); const StelProjectorP projector = core->getProjection(StelCore::Frame EquinoxEqu);
double screenFOV = params.fov; double screenFOV = params.fov;
Vec2i centerScreen(projector->getViewportPosX() + projector->getView portWidth() / 2, Vec2i centerScreen(projector->getViewportPosX() + projector->getView portWidth() / 2,
projector->getViewportPosY() + projector->getView portHeight() / 2); projector->getViewportPosY() + projector->getView portHeight() / 2);
// draw sensor rectangle // draw sensor rectangle
if(selectedCCDIndex != -1) if(selectedCCDIndex != -1)
{ {
CCD *ccd = ccds[selectedCCDIndex]; CCD *ccd = ccds[selectedCCDIndex];
if (ccd) if (ccd)
{ {
StelPainter painter(projector); StelPainter painter(projector);
painter.setColor(0.77f, 0.14f, 0.16f, 1.0f); painter.setColor(0.77f, 0.14f, 0.16f, 1.0f);
painter.setFont(font);
Telescope *telescope = telescopes[selectedTelescopeI ndex]; Telescope *telescope = telescopes[selectedTelescopeI ndex];
const double ccdXRatio = ccd->getActualFOVx(telescop e, lens) / screenFOV; const double ccdXRatio = ccd->getActualFOVx(telescop e, lens) / screenFOV;
const double ccdYRatio = ccd->getActualFOVy(telescop e, lens) / screenFOV; const double ccdYRatio = ccd->getActualFOVy(telescop e, lens) / screenFOV;
const double fovX = ccd->getActualFOVx(telescope, le
ns);
const double fovY = ccd->getActualFOVy(telescope, le
ns);
// As the FOV is based on the narrow aspect of the s creen, we need to calculate // As the FOV is based on the narrow aspect of the s creen, we need to calculate
// height & width based soley off of that dimension. // height & width based soley off of that dimension.
int aspectIndex = 2; int aspectIndex = 2;
if (params.viewportXywh[2] > params.viewportXywh[3]) if (params.viewportXywh[2] > params.viewportXywh[3])
{ {
aspectIndex = 3; aspectIndex = 3;
} }
float width = params.viewportXywh[aspectIndex] * ccd float width = params.viewportXywh[aspectIndex] * ccd
YRatio * params.devicePixelsPerPixel; XRatio * params.devicePixelsPerPixel;
float height = params.viewportXywh[aspectIndex] * cc float height = params.viewportXywh[aspectIndex] * cc
dXRatio * params.devicePixelsPerPixel; dYRatio * params.devicePixelsPerPixel;
double polarAngle = 0; double polarAngle = 0;
// if the telescope is Equatorial derotate the field // if the telescope is Equatorial derotate the field
if (telescope->isEquatorial()) if (telescope->isEquatorial())
{ {
Vec3d CPos; Vec3d CPos;
Vec2f cpos = projector->getViewportCenter(); Vec2f cpos = projector->getViewportCenter();
projector->unProject(cpos[0], cpos[1], CPos) ; projector->unProject(cpos[0], cpos[1], CPos) ;
Vec3d CPrel(CPos); Vec3d CPrel(CPos);
CPrel[2]*=0.2; CPrel[2]*=0.2;
skipping to change at line 1692 skipping to change at line 1604
b = transform.map(QPoint(0.f, cross) ); b = transform.map(QPoint(0.f, cross) );
painter.drawLine2d(a.x(), a.y(), b.x (), b.y()); painter.drawLine2d(a.x(), a.y(), b.x (), b.y());
a = transform.map(QPoint(-cross, 0.f )); a = transform.map(QPoint(-cross, 0.f ));
b = transform.map(QPoint(cross, 0.f) ); b = transform.map(QPoint(cross, 0.f) );
painter.drawLine2d(a.x(), a.y(), b.x (), b.y()); painter.drawLine2d(a.x(), a.y(), b.x (), b.y());
// calculate coordinates of the cent er and show it // calculate coordinates of the cent er and show it
Vec3d centerPosition; Vec3d centerPosition;
projector->unProject(centerScreen[0] , centerScreen[1], centerPosition); projector->unProject(centerScreen[0] , centerScreen[1], centerPosition);
double cx, cy; double cx, cy;
QString cxt, cyt; QString cxt, cyt;
StelUtils::rectToSphe(&cx,&cy,core-> equinoxEquToJ2000(centerPosition)); // Calculate RA/DE (J2000.0) and show i t... StelUtils::rectToSphe(&cx,&cy,core-> equinoxEquToJ2000(centerPosition, StelCore::RefractionOff)); // Calculate R A/DE (J2000.0) and show it...
bool withDecimalDegree = StelApp::ge tInstance().getFlagShowDecimalDegrees(); bool withDecimalDegree = StelApp::ge tInstance().getFlagShowDecimalDegrees();
if (withDecimalDegree) if (withDecimalDegree)
{ {
cxt = StelUtils::radToDecDeg Str(cx, 5, false, true); cxt = StelUtils::radToDecDeg Str(cx, 5, false, true);
cyt = StelUtils::radToDecDeg Str(cy); cyt = StelUtils::radToDecDeg Str(cy);
} }
else else
{ {
cxt = StelUtils::radToHmsStr (cx, true); cxt = StelUtils::radToHmsStr (cx, true);
cyt = StelUtils::radToDmsStr (cy, true); cyt = StelUtils::radToDmsStr (cy, true);
} }
// Coordinates of center of visible field of view for CCD (red rectangle)
QString coords = QString("%1: %2/%3" ).arg(qc_("RA/Dec (J2000.0) of cross", "abbreviated in the plugin")).arg(cx t).arg(cyt); QString coords = QString("%1: %2/%3" ).arg(qc_("RA/Dec (J2000.0) of cross", "abbreviated in the plugin")).arg(cx t).arg(cyt);
a = transform.map(QPoint(-width/2.0, height/2.0 + 5.f)); a = transform.map(QPoint(-width/2.0, height/2.0 + 5.f));
painter.drawText(a.x(), a.y(), coord s, -(ccd->chipRotAngle() + polarAngle)); painter.drawText(a.x(), a.y(), coord s, -(ccd->chipRotAngle() + polarAngle));
// Dimensions of visible field of vi
ew for CCD (red rectangle)
a = transform.map(QPoint(-width/2.0,
-height/2.0 - fontSize*1.2f));
painter.drawText(a.x(), a.y(), getDi
mensionsString(fovX, fovY), -(ccd->chipRotAngle() + polarAngle));
// Horizontal and vertical scales of
visible field of view for CCD (red rectangle)
//TRANSLATORS: Unit of measure for s
cale - arcseconds per pixel
QString unit = q_("\"/px");
QString scales = QString("%1%3 %4 %2
%3")
.arg(QString::number
(fovX*3600*ccd->binningX()/ccd->resolutionX(), 'f', 4))
.arg(QString::number
(fovY*3600*ccd->binningY()/ccd->resolutionY(), 'f', 4))
.arg(unit)
.arg(QChar(0x00D7));
a = transform.map(QPoint(width/2.0 -
painter.getFontMetrics().width(scales), -height/2.0 - fontSize*1.2f));
painter.drawText(a.x(), a.y(), scale
s, -(ccd->chipRotAngle() + polarAngle));
// Rotation angle of visible field o
f view for CCD (red rectangle)
QString angle = QString("%1%2").arg(
QString::number(ccd->chipRotAngle(), 'f', 1)).arg(QChar(0x00B0));
a = transform.map(QPoint(width/2.0 -
painter.getFontMetrics().width(angle), height/2.0 + 5.f));
painter.drawText(a.x(), a.y(), angle
, -(ccd->chipRotAngle() + polarAngle));
} }
} }
} }
} }
} }
void Oculars::paintCrosshairs() void Oculars::paintCrosshairs()
{ {
StelCore *core = StelApp::getInstance().getCore(); StelCore *core = StelApp::getInstance().getCore();
skipping to change at line 1770 skipping to change at line 1700
StelPainter painter(prj); StelPainter painter(prj);
StelProjector::StelProjectorParams params = core->getCurrentStelProj ectorParams(); StelProjector::StelProjectorParams params = core->getCurrentStelProj ectorParams();
double inner = 0.5 * params.viewportFovDiameter * params.devicePixel sPerPixel; double inner = 0.5 * params.viewportFovDiameter * params.devicePixel sPerPixel;
// See if we need to scale the mask // See if we need to scale the mask
if (useMaxEyepieceAngle && oculars[selectedOcularIndex]->appearentFO V() > 0.0 && !oculars[selectedOcularIndex]->isBinoculars()) if (useMaxEyepieceAngle && oculars[selectedOcularIndex]->appearentFO V() > 0.0 && !oculars[selectedOcularIndex]->isBinoculars())
{ {
inner = oculars[selectedOcularIndex]->appearentFOV() * inner / maxEyepieceAngle; inner = oculars[selectedOcularIndex]->appearentFOV() * inner / maxEyepieceAngle;
} }
glEnable(GL_BLEND); painter.setBlending(true);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Normal transpa
rency mode
Vec2i centerScreen(prj->getViewportPosX()+prj->getViewportWidth()/2, prj->getViewportPosY()+prj->getViewportHeight()/2); Vec2i centerScreen(prj->getViewportPosX()+prj->getViewportWidth()/2, prj->getViewportPosY()+prj->getViewportHeight()/2);
// Paint the reticale, if needed // Paint the reticale, if needed
if (!reticleTexture.isNull()) if (!reticleTexture.isNull())
{ {
painter.enableTexture2d(true);
painter.setColor(0.77f, 0.14f, 0.16f, 1.f); painter.setColor(0.77f, 0.14f, 0.16f, 1.f);
reticleTexture->bind(); reticleTexture->bind();
int textureHeight; int textureHeight;
int textureWidth; int textureWidth;
reticleTexture->getDimensions(textureWidth, textureHeight); reticleTexture->getDimensions(textureWidth, textureHeight);
painter.drawSprite2dMode(centerScreen[0], centerScreen[1], i nner, reticleRotation); painter.drawSprite2dMode(centerScreen[0], centerScreen[1], i nner, reticleRotation);
} }
skipping to change at line 1863 skipping to change at line 1791
Ocular *ocular = NULL; Ocular *ocular = NULL;
if(selectedOcularIndex !=-1) if(selectedOcularIndex !=-1)
{ {
ocular = oculars[selectedOcularIndex]; ocular = oculars[selectedOcularIndex];
} }
Telescope *telescope = NULL; Telescope *telescope = NULL;
if(selectedTelescopeIndex != -1) if(selectedTelescopeIndex != -1)
{ {
telescope = telescopes[selectedTelescopeIndex]; telescope = telescopes[selectedTelescopeIndex];
} }
Lens *lens = NULL; Lens *lens = selectedLens();
if(selectedLensIndex != -1)
{
lens = lense[selectedLensIndex];
}
// set up the color and the GL state // set up the color and the GL state
painter.setColor(0.8f, 0.48f, 0.f, 1.f); painter.setColor(0.8f, 0.48f, 0.f, 1.f);
glDisable(GL_TEXTURE_2D); painter.setBlending(true);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
// Get the X & Y positions, and the line height // Get the X & Y positions, and the line height
painter.setFont(font); painter.setFont(font);
QString widthString = "MMMMMMMMMMMMMMMMMMM"; QString widthString = "MMMMMMMMMMMMMMMMMMM";
float insetFromRHS = painter.getFontMetrics().width(widthString); float insetFromRHS = painter.getFontMetrics().width(widthString);
StelProjector::StelProjectorParams projectorParams = core->getCurren tStelProjectorParams(); StelProjector::StelProjectorParams projectorParams = core->getCurren tStelProjectorParams();
int xPosition = projectorParams.viewportXywh[2] - projectorParams.vi ewportCenterOffset[0]; int xPosition = projectorParams.viewportXywh[2] - projectorParams.vi ewportCenterOffset[0];
xPosition -= insetFromRHS; xPosition -= insetFromRHS;
int yPosition = projectorParams.viewportXywh[3] - projectorParams.vi ewportCenterOffset[1]; int yPosition = projectorParams.viewportXywh[3] - projectorParams.vi ewportCenterOffset[1];
yPosition -= 40; yPosition -= 40;
skipping to change at line 1909 skipping to change at line 1831
// The name of the ocular could be really long. // The name of the ocular could be really long.
if (name.length() > widthString.length()) if (name.length() > widthString.length())
{ {
xPosition -= (insetFromRHS / 2.0); xPosition -= (insetFromRHS / 2.0);
} }
painter.drawText(xPosition, yPosition, ocularNumberLabel); painter.drawText(xPosition, yPosition, ocularNumberLabel);
yPosition-=lineHeight; yPosition-=lineHeight;
if (!ocular->isBinoculars()) if (!ocular->isBinoculars())
{ {
QString eFocalLength = QVariant(ocular->effectiveFoc alLength()).toString();
// TRANSLATORS: FL = Focal length // TRANSLATORS: FL = Focal length
QString eFocalLengthLabel = QString(q_("Ocular FL: % 1 mm")).arg(eFocalLength); QString eFocalLengthLabel = QString(q_("Ocular FL: % 1 mm")).arg(QString::number(ocular->effectiveFocalLength(), 'f', 1));
painter.drawText(xPosition, yPosition, eFocalLengthL abel); painter.drawText(xPosition, yPosition, eFocalLengthL abel);
yPosition-=lineHeight; yPosition-=lineHeight;
QString ocularFov = QString::number(ocular->appearen tFOV()); QString ocularFov = QString::number(ocular->appearen tFOV(), 'f', 2);
ocularFov.append(QChar(0x00B0));//Degree sign ocularFov.append(QChar(0x00B0));//Degree sign
// TRANSLATORS: aFOV = apparent field of view // TRANSLATORS: aFOV = apparent field of view
QString ocularFOVLabel = QString(q_("Ocular aFOV: %1 ")).arg(ocularFov); QString ocularFOVLabel = QString(q_("Ocular aFOV: %1 ")).arg(ocularFov);
painter.drawText(xPosition, yPosition, ocularFOVLabe l); painter.drawText(xPosition, yPosition, ocularFOVLabe l);
yPosition-=lineHeight; yPosition-=lineHeight;
QString lensNumberLabel; QString lensNumberLabel;
// Barlow and Shapley lens // Barlow and Shapley lens
if (lens != NULL) // it's null if lens is not select ed (lens index = -1) if (lens != NULL) // it's null if lens is not select ed (lens index = -1)
{ {
skipping to change at line 1943 skipping to change at line 1864
lensNumberLabel = QString (q_("Lens #%1: %2")).arg(selectedLensIndex).arg(lensName); lensNumberLabel = QString (q_("Lens #%1: %2")).arg(selectedLensIndex).arg(lensName);
} }
} }
else else
{ {
lensNumberLabel = QString (q_("Lens: none")) ; lensNumberLabel = QString (q_("Lens: none")) ;
} }
painter.drawText(xPosition, yPosition, lensNumberLab el); painter.drawText(xPosition, yPosition, lensNumberLab el);
yPosition-=lineHeight; yPosition-=lineHeight;
// The telescope
QString telescopeString = "";
QString magString = "";
QString fovString = "";
QString exitPupil = "";
if (telescope!=NULL) if (telescope!=NULL)
{ {
QString telescopeName = telescope->name(); QString telescopeName = telescope->name();
QString telescopeString = "";
if (telescopeName.isEmpty()) if (telescopeName.isEmpty())
telescopeString = QString("%1").arg( selectedTelescopeIndex); telescopeString = QString("%1").arg( selectedTelescopeIndex);
else else
telescopeString = QString("%1: %2"). arg(selectedTelescopeIndex).arg(telescopeName); telescopeString = QString("%1: %2"). arg(selectedTelescopeIndex).arg(telescopeName);
// General info painter.drawText(xPosition, yPosition, QStri
if (lens!=NULL) ng(q_("Telescope #%1")).arg(telescopeString));
{ yPosition-=lineHeight;
magString = QString::number(((int)(o
cular->magnification(telescope, lens) * 10.0)) / 10.0);
magString.append(QChar(0x00D7));//Mu
ltiplication sign
fovString = QString::number(((int)(o // General info
cular->actualFOV(telescope, lens) * 10000.00)) / 10000.0); double mag = ocular->magnification(telescope
fovString.append(QChar(0x00B0));//De , lens);
gree sign QString magString = QString::number(mag, 'f'
, 1);
magString.append(QChar(0x00D7));//Multiplica
tion sign
exitPupil = QString::number(telescop painter.drawText(xPosition, yPosition, QStri
e->diameter()/ocular->magnification(telescope, lens), 'f', 2); ng(q_("Magnification: %1")).arg(magString));
} yPosition-=lineHeight;
}
painter.drawText(xPosition, yPosition, QString(q_("T if (mag>0)
elescope #%1")).arg(telescopeString)); {
yPosition-=lineHeight; QString exitPupil = QString::number(
telescope->diameter()/mag, 'f', 2);
painter.drawText(xPosition, yPosition, QString(q_("M painter.drawText(xPosition, yPositio
agnification: %1")).arg(magString)); n, QString(q_("Exit pupil: %1 mm")).arg(exitPupil));
yPosition-=lineHeight; yPosition-=lineHeight;
}
painter.drawText(xPosition, yPosition, QString(q_("E QString fovString = QString::number(ocular->
xit pupil: %1 mm")).arg(exitPupil)); actualFOV(telescope, lens), 'f', 5);
yPosition-=lineHeight; fovString.append(QChar(0x00B0));//Degree sig
n
painter.drawText(xPosition, yPosition, QString(q_("F painter.drawText(xPosition, yPosition, QStri
OV: %1")).arg(fovString)); ng(q_("FOV: %1")).arg(fovString));
}
} }
} }
// The CCD // The CCD
if (flagShowCCD && ccd!=NULL) if (flagShowCCD && ccd!=NULL)
{ {
QString ccdSensorLabel, ccdInfoLabel; QString ccdSensorLabel, ccdInfoLabel;
QString name = ""; QString name = "";
QString telescopeName = ""; QString telescopeName = "";
double fovX = 0.0; double fovX = 0.0;
double fovY = 0.0; double fovY = 0.0;
if (telescope!=NULL && lens!=NULL) if (telescope!=NULL)
{ {
fovX = ((int)(ccd->getActualFOVx(telescope, lens) * fovX = ccd->getActualFOVx(telescope, lens);
1000.0)) / 1000.0; fovY = ccd->getActualFOVy(telescope, lens);
fovY = ((int)(ccd->getActualFOVy(telescope, lens) *
1000.0)) / 1000.0;
name = ccd->name(); name = ccd->name();
telescopeName = telescope->name(); telescopeName = telescope->name();
} }
ccdInfoLabel = QString(q_("Dimensions: %1")).arg(getDimensio nsString(fovX, fovY)); ccdInfoLabel = QString(q_("Dimensions: %1")).arg(getDimensio nsString(fovX, fovY));
if (name.isEmpty()) if (name.isEmpty())
{ {
ccdSensorLabel = QString(q_("Sensor #%1")).arg(selec tedCCDIndex); ccdSensorLabel = QString(q_("Sensor #%1")).arg(selec tedCCDIndex);
} }
skipping to change at line 2142 skipping to change at line 2059
gridManager->setFlagPrecessionCircles(flagPrecessionCircles) ; gridManager->setFlagPrecessionCircles(flagPrecessionCircles) ;
gridManager->setFlagCelestialJ2000Poles(flagCelestialJ2000Po les); gridManager->setFlagCelestialJ2000Poles(flagCelestialJ2000Po les);
gridManager->setFlagCelestialPoles(flagCelestialPoles); gridManager->setFlagCelestialPoles(flagCelestialPoles);
gridManager->setFlagZenithNadir(flagZenithNadirPoints); gridManager->setFlagZenithNadir(flagZenithNadirPoints);
gridManager->setFlagEclipticJ2000Poles(flagEclipticJ2000Pole s); gridManager->setFlagEclipticJ2000Poles(flagEclipticJ2000Pole s);
gridManager->setFlagEclipticPoles(flagEclipticPoles); gridManager->setFlagEclipticPoles(flagEclipticPoles);
gridManager->setFlagGalacticPoles(flagGalacticPoles); gridManager->setFlagGalacticPoles(flagGalacticPoles);
gridManager->setFlagSupergalacticPoles(flagSupergalacticPole s); gridManager->setFlagSupergalacticPoles(flagSupergalacticPole s);
gridManager->setFlagEquinoxJ2000Points(flagEquinoxJ2000Point s); gridManager->setFlagEquinoxJ2000Points(flagEquinoxJ2000Point s);
gridManager->setFlagEquinoxPoints(flagEquinoxPoints); gridManager->setFlagEquinoxPoints(flagEquinoxPoints);
gridManager->setFlagSolsticeJ2000Points(flagSolsticeJ2000Poi
nts);
gridManager->setFlagSolsticePoints(flagSolsticePoints);
GETSTELMODULE(LandscapeMgr)->setFlagCardinalsPoints(flagCard inalPoints); GETSTELMODULE(LandscapeMgr)->setFlagCardinalsPoints(flagCard inalPoints);
} }
skyManager->setFlagLuminanceAdaptation(flagAdaptation); skyManager->setFlagLuminanceAdaptation(flagAdaptation);
skyManager->setFlagStarMagnitudeLimit(flagLimitStars); skyManager->setFlagStarMagnitudeLimit(flagLimitStars);
skyManager->setFlagPlanetMagnitudeLimit(flagLimitPlanets); skyManager->setFlagPlanetMagnitudeLimit(flagLimitPlanets);
skyManager->setFlagNebulaMagnitudeLimit(flagLimitDSOs); skyManager->setFlagNebulaMagnitudeLimit(flagLimitDSOs);
skyManager->setCustomStarMagnitudeLimit(magLimitStars); skyManager->setCustomStarMagnitudeLimit(magLimitStars);
skyManager->setCustomPlanetMagnitudeLimit(magLimitPlanets); skyManager->setCustomPlanetMagnitudeLimit(magLimitPlanets);
skyManager->setCustomNebulaMagnitudeLimit(magLimitDSOs); skyManager->setCustomNebulaMagnitudeLimit(magLimitDSOs);
skyManager->setRelativeStarScale(relativeStarScale);
skyManager->setAbsoluteStarScale(absoluteStarScale);
movementManager->setFlagTracking(false); movementManager->setFlagTracking(false);
movementManager->setFlagEnableZoomKeys(true); movementManager->setFlagEnableZoomKeys(true);
movementManager->setFlagEnableMouseNavigation(true); movementManager->setFlagEnableMouseNavigation(true);
GETSTELMODULE(SolarSystem)->setFlagMoonScale(flagMoonScale); GETSTELMODULE(SolarSystem)->setFlagMoonScale(flagMoonScale);
// Set the screen display // Set the screen display
core->setFlipHorz(flipHorz); core->setFlipHorz(flipHorz);
core->setFlipVert(flipVert); core->setFlipVert(flipVert);
if (getFlagInitFovUsage()) if (getFlagInitFovUsage())
movementManager->zoomTo(movementManager->getInitFov()); movementManager->zoomTo(movementManager->getInitFov());
else else
movementManager->zoomTo(initialFOV); movementManager->zoomTo(initialFOV);
if (getFlagInitDirectionUsage())
movementManager->setViewDirectionJ2000(core->altAzToJ2000(mo
vementManager->getInitViewingDirection(), StelCore::RefractionOff));
} }
void Oculars::zoom(bool zoomedIn) void Oculars::zoom(bool zoomedIn)
{ {
if (flagShowOculars && selectedOcularIndex == -1) if (flagShowOculars && selectedOcularIndex == -1)
{ {
// The user cycled out the selected ocular // The user cycled out the selected ocular
flagShowOculars = false; flagShowOculars = false;
} }
skipping to change at line 2218 skipping to change at line 2138
flagPrecessionCircles = gridManager->getFlag PrecessionCircles(); flagPrecessionCircles = gridManager->getFlag PrecessionCircles();
flagCelestialJ2000Poles = gridManager->getFl agCelestialJ2000Poles(); flagCelestialJ2000Poles = gridManager->getFl agCelestialJ2000Poles();
flagCelestialPoles = gridManager->getFlagCel estialPoles(); flagCelestialPoles = gridManager->getFlagCel estialPoles();
flagZenithNadirPoints = gridManager->getFlag ZenithNadir(); flagZenithNadirPoints = gridManager->getFlag ZenithNadir();
flagEclipticJ2000Poles = gridManager->getFla gEclipticJ2000Poles(); flagEclipticJ2000Poles = gridManager->getFla gEclipticJ2000Poles();
flagEclipticPoles = gridManager->getFlagEcli pticPoles(); flagEclipticPoles = gridManager->getFlagEcli pticPoles();
flagGalacticPoles = gridManager->getFlagGala cticPoles(); flagGalacticPoles = gridManager->getFlagGala cticPoles();
flagSupergalacticPoles = gridManager->getFla gSupergalacticPoles(); flagSupergalacticPoles = gridManager->getFla gSupergalacticPoles();
flagEquinoxJ2000Points = gridManager->getFla gEquinoxJ2000Points(); flagEquinoxJ2000Points = gridManager->getFla gEquinoxJ2000Points();
flagEquinoxPoints = gridManager->getFlagEqui noxPoints(); flagEquinoxPoints = gridManager->getFlagEqui noxPoints();
flagSolsticeJ2000Points = gridManager->getFl
agSolsticeJ2000Points();
flagSolsticePoints = gridManager->getFlagSol
sticePoints();
flagCardinalPoints = GETSTELMODULE(Landscape Mgr)->getFlagCardinalsPoints(); flagCardinalPoints = GETSTELMODULE(Landscape Mgr)->getFlagCardinalsPoints();
} }
StelSkyDrawer *skyManager = core->getSkyDrawer(); StelSkyDrawer *skyManager = core->getSkyDrawer();
// Current state // Current state
flagAdaptation = skyManager->getFlagLuminanceAdaptat ion(); flagAdaptation = skyManager->getFlagLuminanceAdaptat ion();
flagLimitStars = skyManager->getFlagStarMagnitudeLim it(); flagLimitStars = skyManager->getFlagStarMagnitudeLim it();
flagLimitPlanets = skyManager->getFlagPlanetMagnitud eLimit(); flagLimitPlanets = skyManager->getFlagPlanetMagnitud eLimit();
flagLimitDSOs = skyManager->getFlagNebulaMagnitudeLi mit(); flagLimitDSOs = skyManager->getFlagNebulaMagnitudeLi mit();
magLimitStars = skyManager->getCustomStarMagnitudeLi mit(); magLimitStars = skyManager->getCustomStarMagnitudeLi mit();
magLimitPlanets = skyManager->getCustomPlanetMagnitu deLimit(); magLimitPlanets = skyManager->getCustomPlanetMagnitu deLimit();
magLimitDSOs = skyManager->getCustomNebulaMagnitudeL imit(); magLimitDSOs = skyManager->getCustomNebulaMagnitudeL imit();
relativeStarScale = skyManager->getRelativeStarScale
();
absoluteStarScale = skyManager->getAbsoluteStarScale
();
flagMoonScale = GETSTELMODULE(SolarSystem)->getFlagM oonScale(); flagMoonScale = GETSTELMODULE(SolarSystem)->getFlagM oonScale();
flipHorz = core->getFlipHorz(); flipHorz = core->getFlipHorz();
flipVert = core->getFlipVert(); flipVert = core->getFlipVert();
StelMovementMgr *movementManager = core->getMovement Mgr(); StelMovementMgr *movementManager = core->getMovement Mgr();
initialFOV = movementManager->getCurrentFov(); initialFOV = movementManager->getCurrentFov();
} }
skipping to change at line 2291 skipping to change at line 2211
gridManager->setFlagPrecessionCircles(false); gridManager->setFlagPrecessionCircles(false);
gridManager->setFlagCelestialJ2000Poles(false); gridManager->setFlagCelestialJ2000Poles(false);
gridManager->setFlagCelestialPoles(false); gridManager->setFlagCelestialPoles(false);
gridManager->setFlagZenithNadir(false); gridManager->setFlagZenithNadir(false);
gridManager->setFlagEclipticJ2000Poles(false); gridManager->setFlagEclipticJ2000Poles(false);
gridManager->setFlagEclipticPoles(false); gridManager->setFlagEclipticPoles(false);
gridManager->setFlagGalacticPoles(false); gridManager->setFlagGalacticPoles(false);
gridManager->setFlagSupergalacticPoles(false); gridManager->setFlagSupergalacticPoles(false);
gridManager->setFlagEquinoxJ2000Points(false); gridManager->setFlagEquinoxJ2000Points(false);
gridManager->setFlagEquinoxPoints(false); gridManager->setFlagEquinoxPoints(false);
gridManager->setFlagSolsticeJ2000Points(false);
gridManager->setFlagSolsticePoints(false);
GETSTELMODULE(LandscapeMgr)->setFlagCardinalsPoints(false); GETSTELMODULE(LandscapeMgr)->setFlagCardinalsPoints(false);
} }
skyManager->setFlagLuminanceAdaptation(false); skyManager->setFlagLuminanceAdaptation(false);
GETSTELMODULE(SolarSystem)->setFlagMoonScale(false); GETSTELMODULE(SolarSystem)->setFlagMoonScale(false);
movementManager->setFlagTracking(true); movementManager->setFlagTracking(true);
movementManager->setFlagEnableZoomKeys(false); movementManager->setFlagEnableZoomKeys(false);
skipping to change at line 2331 skipping to change at line 2253
{ {
if (selectedLensIndex >= 0) if (selectedLensIndex >= 0)
{ {
lens = lense[selectedLensIndex]; lens = lense[selectedLensIndex];
} }
telescope = telescopes[selectedTelescopeIndex]; telescope = telescopes[selectedTelescopeIndex];
core->setFlipHorz(telescope->isHFlipped()); core->setFlipHorz(telescope->isHFlipped());
core->setFlipVert(telescope->isVFlipped()); core->setFlipVert(telescope->isVFlipped());
} }
// Change relative and absolute scales for stars
// TODO: Finding experimental value for better rendering
skyManager->setRelativeStarScale(0.6);
skyManager->setAbsoluteStarScale(0.75);
// Limit stars and DSOs if it enable and it's telescope + eyepiece c ombination // Limit stars and DSOs if it enable and it's telescope + eyepiece c ombination
if (getFlagLimitMagnitude()) if (getFlagLimitMagnitude())
{ {
// Simplified calculation of the penetrating power of the te lescope // Simplified calculation of the penetrating power of the te lescope
double diameter = 0.; double diameter = 0.;
if (ocular->isBinoculars()) if (ocular->isBinoculars())
diameter = ocular->fieldStop(); diameter = ocular->fieldStop();
else else
diameter = telescope->diameter(); diameter = telescope!=NULL ? telescope->diameter() : 0.; // Avoid a potential call of null pointer
double limitMag = 2.1 + 5*std::log10(diameter); double limitMag = 2.1 + 5*std::log10(diameter);
skyManager->setFlagStarMagnitudeLimit(true); skyManager->setFlagStarMagnitudeLimit(true);
skyManager->setFlagNebulaMagnitudeLimit(true); skyManager->setFlagNebulaMagnitudeLimit(true);
skyManager->setCustomStarMagnitudeLimit(limitMag); skyManager->setCustomStarMagnitudeLimit(limitMag);
skyManager->setCustomNebulaMagnitudeLimit(limitMag); skyManager->setCustomNebulaMagnitudeLimit(limitMag);
} }
actualFOV = ocular->actualFOV(telescope, lens); actualFOV = ocular->actualFOV(telescope, lens);
// See if the mask was scaled; if so, correct the actualFOV. // See if the mask was scaled; if so, correct the actualFOV.
skipping to change at line 2481 skipping to change at line 2398
flagInitFOVUsage = b; flagInitFOVUsage = b;
settings->setValue("use_initial_fov", b); settings->setValue("use_initial_fov", b);
settings->sync(); settings->sync();
} }
bool Oculars::getFlagInitFovUsage() const bool Oculars::getFlagInitFovUsage() const
{ {
return flagInitFOVUsage; return flagInitFOVUsage;
} }
void Oculars::setFlagInitDirectionUsage(const bool b)
{
flagInitDirectionUsage = b;
settings->setValue("use_initial_direction", b);
settings->sync();
}
bool Oculars::getFlagInitDirectionUsage() const
{
return flagInitDirectionUsage;
}
void Oculars::setFlagAutosetMountForCCD(const bool b) void Oculars::setFlagAutosetMountForCCD(const bool b)
{ {
flagAutosetMountForCCD = b; flagAutosetMountForCCD = b;
settings->setValue("use_mount_autoset", b); settings->setValue("use_mount_autoset", b);
settings->sync(); settings->sync();
if (!b) if (!b)
{ {
StelPropertyMgr* propMgr=StelApp::getInstance().getStelPrope rtyManager(); StelPropertyMgr* propMgr=StelApp::getInstance().getStelPrope rtyManager();
propMgr->setStelPropertyValue("actionSwitch_Equatorial_Mount ", equatorialMountEnabled); propMgr->setStelPropertyValue("actionSwitch_Equatorial_Mount ", equatorialMountEnabled);
skipping to change at line 2531 skipping to change at line 2460
} }
QString Oculars::getDimensionsString(double fovX, double fovY) const QString Oculars::getDimensionsString(double fovX, double fovY) const
{ {
QString stringFovX, stringFovY; QString stringFovX, stringFovY;
if (getFlagDecimalDegrees()) if (getFlagDecimalDegrees())
{ {
if (fovX >= 1.0) if (fovX >= 1.0)
{ {
int degrees = (int)fovX; int degrees = (int)fovX;
int minutes = (int)((fovX - degrees) * 60); float minutes = (int)((fovX - degrees) * 60);
stringFovX = QString::number(degrees) + QChar(0x00B0 stringFovX = QString::number(degrees) + QChar(0x00B0
) + QString::number(minutes) + QChar(0x2032); ) + QString::number(minutes, 'f', 2) + QChar(0x2032);
} }
else else
{ {
int minutes = (int)(fovX * 60); float minutes = (fovX * 60);
stringFovX = QString::number(minutes) + QChar(0x2032 stringFovX = QString::number(minutes, 'f', 2) + QCha
); r(0x2032);
} }
if (fovY >= 1.0) if (fovY >= 1.0)
{ {
int degrees = (int)fovY; int degrees = (int)fovY;
int minutes = (int)((fovY - degrees) * 60); float minutes = ((fovY - degrees) * 60);
stringFovY = QString::number(degrees) + QChar(0x00B0 stringFovY = QString::number(degrees) + QChar(0x00B0
) + QString::number(minutes) + QChar(0x2032); ) + QString::number(minutes, 'f', 2) + QChar(0x2032);
} }
else else
{ {
int minutes = (int)(fovY * 60); float minutes = (fovY * 60);
stringFovY = QString::number(minutes) + QChar(0x2032 stringFovY = QString::number(minutes, 'f', 2) + QCha
); r(0x2032);
} }
} }
else else
{ {
stringFovX = QString::number(fovX) + QChar(0x00B0); stringFovX = QString::number(fovX, 'f', 5) + QChar(0x00B0);
stringFovY = QString::number(fovY) + QChar(0x00B0); stringFovY = QString::number(fovY, 'f', 5) + QChar(0x00B0);
} }
return stringFovX + QChar(0x00D7) + stringFovY; return stringFovX + QChar(0x00D7) + stringFovY;
} }
 End of changes. 71 change blocks. 
216 lines changed or deleted 155 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/