Oculars.cpp   Oculars.cpp 
skipping to change at line 537 skipping to change at line 537
} }
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", fa lse).toBool(); guiPanelEnabled = settings->value("enable_control_panel", fa lse).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());
} 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 //Load the module's custom style sheets
QFile styleSheetFile; QFile styleSheetFile;
styleSheetFile.setFileName(":/ocular/normalStyle.css"); styleSheetFile.setFileName(":/ocular/normalStyle.css");
if(styleSheetFile.open(QFile::ReadOnly|QFile::Text)) { if(styleSheetFile.open(QFile::ReadOnly|QFile::Text)) {
normalStyleSheet = styleSheetFile.readAll(); normalStyleSheet = styleSheetFile.readAll();
skipping to change at line 1728 skipping to change at line 1729
} }
} }
settings = new QSettings(ocularIniPath, QSettings::IniFormat, this); settings = new QSettings(ocularIniPath, QSettings::IniFormat, this);
} }
void Oculars::unzoomOcular() void Oculars::unzoomOcular()
{ {
StelCore *core = StelApp::getInstance().getCore(); StelCore *core = StelApp::getInstance().getCore();
StelMovementMgr *movementManager = core->getMovementMgr(); StelMovementMgr *movementManager = core->getMovementMgr();
GridLinesMgr *gridManager = (GridLinesMgr *)StelApp::getInstance().g etModuleMgr().getModule("GridLinesMgr"); GridLinesMgr *gridManager = (GridLinesMgr *)StelApp::getInstance().g etModuleMgr().getModule("GridLinesMgr");
StelSkyDrawer *skyManager = core->getSkyDrawer();
gridManager->setFlagAzimuthalGrid(flagAzimuthalGrid); gridManager->setFlagAzimuthalGrid(flagAzimuthalGrid);
gridManager->setFlagGalacticGrid(flagGalacticGrid); gridManager->setFlagGalacticGrid(flagGalacticGrid);
gridManager->setFlagEquatorGrid(flagEquatorGrid); gridManager->setFlagEquatorGrid(flagEquatorGrid);
gridManager->setFlagEquatorJ2000Grid(flagEquatorJ2000Grid); gridManager->setFlagEquatorJ2000Grid(flagEquatorJ2000Grid);
gridManager->setFlagEquatorLine(flagEquatorLine); gridManager->setFlagEquatorLine(flagEquatorLine);
gridManager->setFlagEclipticLine(flagEclipticLine); gridManager->setFlagEclipticLine(flagEclipticLine);
gridManager->setFlagEclipticJ2000Grid(flagEclipticJ2000Grid); gridManager->setFlagEclipticJ2000Grid(flagEclipticJ2000Grid);
gridManager->setFlagMeridianLine(flagMeridianLine); gridManager->setFlagMeridianLine(flagMeridianLine);
gridManager->setFlagHorizonLine(flagHorizonLine); gridManager->setFlagHorizonLine(flagHorizonLine);
gridManager->setFlagGalacticPlaneLine(flagGalacticPlaneLine); gridManager->setFlagGalacticPlaneLine(flagGalacticPlaneLine);
core->getSkyDrawer()->setFlagLuminanceAdaptation(flagAdaptation); skyManager->setFlagLuminanceAdaptation(flagAdaptation);
skyManager->setFlagStarMagnitudeLimit(flagLimitStars);
skyManager->setFlagNebulaMagnitudeLimit(flagLimitDSOs);
skyManager->setCustomStarMagnitudeLimit(magLimitStars);
skyManager->setCustomNebulaMagnitudeLimit(magLimitDSOs);
movementManager->setFlagTracking(false); movementManager->setFlagTracking(false);
movementManager->setFlagEnableZoomKeys(true); movementManager->setFlagEnableZoomKeys(true);
movementManager->setFlagEnableMouseNavigation(true); movementManager->setFlagEnableMouseNavigation(true);
// Set the screen display // Set the screen display
// core->setMaskType(StelProjector::MaskNone); // core->setMaskType(StelProjector::MaskNone);
core->setFlipHorz(false); core->setFlipHorz(false);
core->setFlipVert(false); core->setFlipVert(false);
movementManager->zoomTo(movementManager->getInitFov()); movementManager->zoomTo(movementManager->getInitFov());
skipping to change at line 1773 skipping to change at line 1779
flagAzimuthalGrid = gridManager->getFlagAzimuthalGri d(); flagAzimuthalGrid = gridManager->getFlagAzimuthalGri d();
flagGalacticGrid = gridManager->getFlagGalacticGrid( ); flagGalacticGrid = gridManager->getFlagGalacticGrid( );
flagEquatorGrid = gridManager->getFlagEquatorGrid(); flagEquatorGrid = gridManager->getFlagEquatorGrid();
flagEquatorJ2000Grid = gridManager->getFlagEquatorJ2 000Grid(); flagEquatorJ2000Grid = gridManager->getFlagEquatorJ2 000Grid();
flagEquatorLine = gridManager->getFlagEquatorLine(); flagEquatorLine = gridManager->getFlagEquatorLine();
flagEclipticLine = gridManager->getFlagEclipticLine( ); flagEclipticLine = gridManager->getFlagEclipticLine( );
flagEclipticJ2000Grid = gridManager->getFlagEcliptic J2000Grid(); flagEclipticJ2000Grid = gridManager->getFlagEcliptic J2000Grid();
flagMeridianLine = gridManager->getFlagMeridianLine( ); flagMeridianLine = gridManager->getFlagMeridianLine( );
flagHorizonLine = gridManager->getFlagHorizonLine(); flagHorizonLine = gridManager->getFlagHorizonLine();
flagGalacticPlaneLine = gridManager->getFlagGalactic PlaneLine(); flagGalacticPlaneLine = gridManager->getFlagGalactic PlaneLine();
flagAdaptation = StelApp::getInstance().getCore()->g
etSkyDrawer()->getFlagLuminanceAdaptation(); StelSkyDrawer *skyManager = StelApp::getInstance().g
etCore()->getSkyDrawer();
// Current state
flagAdaptation = skyManager->getFlagLuminanceAdaptat
ion();
flagLimitStars = skyManager->getFlagStarMagnitudeLim
it();
flagLimitDSOs = skyManager->getFlagNebulaMagnitudeLi
mit();
magLimitStars = skyManager->getCustomStarMagnitudeLi
mit();
magLimitDSOs = skyManager->getCustomNebulaMagnitudeL
imit();
} }
// set new state // set new state
zoomOcular(); zoomOcular();
} else { } else {
//reset to original state //reset to original state
unzoomOcular(); unzoomOcular();
} }
} }
void Oculars::zoomOcular() void Oculars::zoomOcular()
{ {
StelCore *core = StelApp::getInstance().getCore(); StelCore *core = StelApp::getInstance().getCore();
StelMovementMgr *movementManager = core->getMovementMgr(); StelMovementMgr *movementManager = core->getMovementMgr();
GridLinesMgr *gridManager = GridLinesMgr *gridManager =
(GridLinesMgr *)StelApp::getInstance().getModuleMgr( ).getModule("GridLinesMgr"); (GridLinesMgr *)StelApp::getInstance().getModuleMgr( ).getModule("GridLinesMgr");
StelSkyDrawer *skyManager = core->getSkyDrawer();
gridManager->setFlagAzimuthalGrid(false); gridManager->setFlagAzimuthalGrid(false);
gridManager->setFlagGalacticGrid(false); gridManager->setFlagGalacticGrid(false);
gridManager->setFlagEquatorGrid(false); gridManager->setFlagEquatorGrid(false);
gridManager->setFlagEquatorJ2000Grid(false); gridManager->setFlagEquatorJ2000Grid(false);
gridManager->setFlagEquatorLine(false); gridManager->setFlagEquatorLine(false);
gridManager->setFlagEclipticLine(false); gridManager->setFlagEclipticLine(false);
gridManager->setFlagEclipticJ2000Grid(false); gridManager->setFlagEclipticJ2000Grid(false);
gridManager->setFlagMeridianLine(false); gridManager->setFlagMeridianLine(false);
gridManager->setFlagHorizonLine(false); gridManager->setFlagHorizonLine(false);
gridManager->setFlagGalacticPlaneLine(false); gridManager->setFlagGalacticPlaneLine(false);
core->getSkyDrawer()->setFlagLuminanceAdaptation(false); skyManager->setFlagLuminanceAdaptation(false);
movementManager->setFlagTracking(true); movementManager->setFlagTracking(true);
movementManager->setFlagEnableZoomKeys(false); movementManager->setFlagEnableZoomKeys(false);
movementManager->setFlagEnableMouseNavigation(false); movementManager->setFlagEnableMouseNavigation(false);
// We won't always have a selected object // We won't always have a selected object
if (StelApp::getInstance().getStelObjectMgr().getWasSelected()) { if (StelApp::getInstance().getStelObjectMgr().getWasSelected()) {
StelObjectP selectedObject = StelApp::getInstance().getStelO bjectMgr().getSelectedObject()[0]; StelObjectP selectedObject = StelApp::getInstance().getStelO bjectMgr().getSelectedObject()[0];
movementManager->moveToJ2000(selectedObject->getEquinoxEquat orialPos(core), 0.0, 1); movementManager->moveToJ2000(selectedObject->getEquinoxEquat orialPos(core), 0.0, 1);
} }
skipping to change at line 1826 skipping to change at line 1841
Telescope *telescope = NULL; Telescope *telescope = NULL;
Lens *lens = NULL; Lens *lens = NULL;
// Only consider flip is we're not binoculars // Only consider flip is we're not binoculars
if (ocular->isBinoculars()) if (ocular->isBinoculars())
{ {
core->setFlipHorz(false); core->setFlipHorz(false);
core->setFlipVert(false); core->setFlipVert(false);
} }
else else
{ {
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());
} }
// Limit stars and DSOs if it enable
if (getFlagLimitMagnitude())
{
// Simplified calculation of the penetrating power of the te
lescope
// TODO: need improvements?
double limitMag = 2.1 + 5*std::log10(telescope->diameter());
skyManager->setFlagStarMagnitudeLimit(true);
skyManager->setFlagNebulaMagnitudeLimit(true);
skyManager->setCustomStarMagnitudeLimit(limitMag);
skyManager->setCustomNebulaMagnitudeLimit(limitMag);
}
double actualFOV = ocular->actualFOV(telescope, lens); double 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.
if (useMaxEyepieceAngle && ocular->appearentFOV() > 0.0 && !ocular-> isBinoculars()) { if (useMaxEyepieceAngle && ocular->appearentFOV() > 0.0 && !ocular-> isBinoculars()) {
actualFOV = maxEyepieceAngle * actualFOV / ocular->appearent FOV(); actualFOV = maxEyepieceAngle * actualFOV / ocular->appearent FOV();
} }
movementManager->zoomTo(actualFOV, 0.0); movementManager->zoomTo(actualFOV, 0.0);
} }
void Oculars::hideUsageMessageIfDisplayed() void Oculars::hideUsageMessageIfDisplayed()
{ {
skipping to change at line 1934 skipping to change at line 1963
flagDecimalDegrees = b; flagDecimalDegrees = b;
settings->setValue("use_decimal_degrees", b); settings->setValue("use_decimal_degrees", b);
settings->sync(); settings->sync();
} }
bool Oculars::getFlagDecimalDegrees() const bool Oculars::getFlagDecimalDegrees() const
{ {
return flagDecimalDegrees; return flagDecimalDegrees;
} }
void Oculars::setFlagLimitMagnitude(const bool b)
{
flagLimitMagnitude = b;
settings->setValue("limit_stellar_magnitude", b);
settings->sync();
}
bool Oculars::getFlagLimitMagnitude() const
{
return flagLimitMagnitude;
}
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); int minutes = (int)((fovX - degrees) * 60);
stringFovX = QString::number(degrees) + QChar(0x00B0 ) + QString::number(minutes) + QChar(0x2032); stringFovX = QString::number(degrees) + QChar(0x00B0 ) + QString::number(minutes) + QChar(0x2032);
 End of changes. 9 change blocks. 
6 lines changed or deleted 53 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/