Oculars.cpp   Oculars.cpp 
skipping to change at line 43 skipping to change at line 43
#include "StelMainView.hpp" #include "StelMainView.hpp"
#include "StelModuleMgr.hpp" #include "StelModuleMgr.hpp"
#include "StelMovementMgr.hpp" #include "StelMovementMgr.hpp"
#include "StelObjectMgr.hpp" #include "StelObjectMgr.hpp"
#include "StelPainter.hpp" #include "StelPainter.hpp"
#include "StelProjector.hpp" #include "StelProjector.hpp"
#include "StelTextureMgr.hpp" #include "StelTextureMgr.hpp"
#include "StelTranslator.hpp" #include "StelTranslator.hpp"
#include "SolarSystem.hpp" #include "SolarSystem.hpp"
#include "StelUtils.hpp" #include "StelUtils.hpp"
#include "StelPropertyMgr.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 <QtNetwork>
#include <QPixmap> #include <QPixmap>
skipping to change at line 107 skipping to change at line 109
selectedOcularIndex(-1), selectedOcularIndex(-1),
selectedTelescopeIndex(-1), selectedTelescopeIndex(-1),
selectedLensIndex(-1), selectedLensIndex(-1),
flagShowCCD(false), flagShowCCD(false),
flagShowOculars(false), flagShowOculars(false),
flagShowCrosshairs(false), flagShowCrosshairs(false),
flagShowTelrad(false), flagShowTelrad(false),
usageMessageLabelID(-1), usageMessageLabelID(-1),
flagAzimuthalGrid(false), flagAzimuthalGrid(false),
flagGalacticGrid(false), flagGalacticGrid(false),
flagEquatorGrid(false), flagSupergalacticGrid(false),
flagEquatorJ2000Grid(false), flagEquatorJ2000Grid(false),
flagEquatorGrid(false),
flagEquatorJ2000Line(false),
flagEquatorLine(false), flagEquatorLine(false),
flagEclipticJ2000Line(false),
flagEclipticLine(false), flagEclipticLine(false),
flagEclipticJ2000Grid(false), flagEclipticJ2000Grid(false),
flagEclipticGrid(false),
flagMeridianLine(false), flagMeridianLine(false),
flagLongitudeLine(false), flagLongitudeLine(false),
flagHorizonLine(false), flagHorizonLine(false),
flagGalacticEquatorLine(false), flagGalacticEquatorLine(false),
flagSupergalacticEquatorLine(false),
flagPrimeVerticalLine(false),
flagColureLines(false),
flagCircumpolarCircles(false),
flagPrecessionCircles(false),
flagCardinalPoints(false),
flagCelestialJ2000Poles(false),
flagCelestialPoles(false),
flagZenithNadirPoints(false),
flagEclipticJ2000Poles(false),
flagEclipticPoles(false),
flagGalacticPoles(false),
flagSupergalacticPoles(false),
flagEquinoxJ2000Points(false),
flagEquinoxPoints(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), relativeStarScale(1.0),
absoluteStarScale(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),
flipVert(false), flipVert(false),
flipHorz(false), flipHorz(false),
ccdRotationSignalMapper(0), ccdRotationSignalMapper(0),
ccdsSignalMapper(0), ccdsSignalMapper(0),
ocularsSignalMapper(0), ocularsSignalMapper(0),
telescopesSignalMapper(0), telescopesSignalMapper(0),
lenseSignalMapper(0), lenseSignalMapper(0),
pxmapGlow(NULL), pxmapGlow(NULL),
pxmapOnIcon(NULL), pxmapOnIcon(NULL),
pxmapOffIcon(NULL), pxmapOffIcon(NULL),
skipping to change at line 160 skipping to change at line 182
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),
flagUseFlipForCCD(false), flagAutosetMountForCCD(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 *>();
lense = QList<Lens *> (); lense = QList<Lens *> ();
skipping to change at line 653 skipping to change at line 676
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());
setFlagUseFlipForCCD(settings->value("use_ccd_flip", 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());
setFlagAutosetMountForCCD(settings->value("use_mount_autoset
", false).toBool());
StelPropertyMgr* propMgr=StelApp::getInstance().getStelPrope
rtyManager();
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 //Load the module's custom style sheets
QFile styleSheetFile; QFile styleSheetFile;
styleSheetFile.setFileName(":/ocular/normalStyle.css"); styleSheetFile.setFileName(":/ocular/normalStyle.css");
skipping to change at line 941 skipping to change at line 968
LabelMgr* labelManager = GETSTELMODULE(LabelMgr); LabelMgr* labelManager = GETSTELMODULE(LabelMgr);
// Toggle the ocular view on & off. To toggle on, we want to ensure there is a selected object. // Toggle the ocular view on & off. To toggle on, we want to ensure there is a selected object.
if (!flagShowOculars && requireSelection && !StelApp::getInstance(). getStelObjectMgr().getWasSelected() ) if (!flagShowOculars && requireSelection && !StelApp::getInstance(). getStelObjectMgr().getWasSelected() )
{ {
if (usageMessageLabelID == -1) if (usageMessageLabelID == -1)
{ {
QFontMetrics metrics(font); QFontMetrics metrics(font);
QString labelText = q_("Please select an object befo re switching to ocular view."); QString labelText = q_("Please select an object befo re switching to ocular view.");
StelProjector::StelProjectorParams projectorParams = core->getCurrentStelProjectorParams(); StelProjector::StelProjectorParams projectorParams = core->getCurrentStelProjectorParams();
int xPosition = projectorParams.viewportCenter[0]; int xPosition = projectorParams.viewportCenter[0] + projectorParams.viewportCenterOffset[0];
xPosition = xPosition - 0.5 * (metrics.width(labelTe xt)); xPosition = xPosition - 0.5 * (metrics.width(labelTe xt));
int yPosition = projectorParams.viewportCenter[1]; int yPosition = projectorParams.viewportCenter[1] + projectorParams.viewportCenterOffset[1];
yPosition = yPosition - 0.5 * (metrics.height()); yPosition = yPosition - 0.5 * (metrics.height());
const char *tcolor = "#99FF99"; const char *tcolor = "#99FF99";
usageMessageLabelID = labelManager->labelScreen(labe lText, xPosition, yPosition, usageMessageLabelID = labelManager->labelScreen(labe lText, xPosition, yPosition,
true , font.pixelSize(), tcolor); true , font.pixelSize(), tcolor);
} }
} }
else else
{ {
if (selectedOcularIndex != -1) if (selectedOcularIndex != -1)
{ {
skipping to change at line 1037 skipping to change at line 1064
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 ()); StelGui * gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui ());
Q_ASSERT(gui); Q_ASSERT(gui);
qDebug() <<this->getModuleStyleSheet(gui->getStelStyle()).qtStyleShe et; //qDebug() << "[Oculars]" << this->getModuleStyleSheet(gui->getStelS tyle()).qtStyleSheet;
popup->setStyleSheet(this->getModuleStyleSheet(gui->getStelStyle()). 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()));
skipping to change at line 1367 skipping to change at line 1394
StelCore *core = StelApp::getInstance().getCore(); StelCore *core = StelApp::getInstance().getCore();
StelMovementMgr *movementManager = core->getMovementMgr(); StelMovementMgr *movementManager = core->getMovementMgr();
StelSkyDrawer *skyManager = core->getSkyDrawer(); StelSkyDrawer *skyManager = core->getSkyDrawer();
skyManager->setAbsoluteStarScale(absoluteStarScale); 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();
enableOcular(false); if (flagShowOculars)
enableOcular(false);
if (flagShowTelrad) { if (flagShowTelrad) {
toggleTelrad(false); toggleTelrad(false);
} }
if (selectedTelescopeIndex < 0) if (selectedTelescopeIndex < 0)
{ {
selectedTelescopeIndex = 0; selectedTelescopeIndex = 0;
} }
if (selectedCCDIndex < 0) if (selectedCCDIndex < 0)
skipping to change at line 1405 skipping to change at line 1433
flagShowCCD = false; flagShowCCD = false;
skyManager->setRelativeStarScale(relativeStarScale); 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 (getFlagUseFlipForCCD()) if (getFlagAutosetMountForCCD())
{ {
core->setFlipHorz(false); StelPropertyMgr* propMgr=StelApp::getInstance().getS
core->setFlipVert(false); telPropertyManager();
propMgr->setStelPropertyValue("actionSwitch_Equatori
al_Mount", equatorialMountEnabled);
} }
if (guiPanel) if (guiPanel)
{ {
guiPanel->foldGui(); guiPanel->foldGui();
} }
} }
emit enableCCDChanged(flagShowCCD); emit enableCCDChanged(flagShowCCD);
} }
skipping to change at line 1438 skipping to change at line 1466
{ {
flagShowCrosshairs = show; flagShowCrosshairs = show;
emit enableCrosshairsChanged(show); emit enableCrosshairsChanged(show);
} }
} }
void Oculars::toggleTelrad(bool show) void Oculars::toggleTelrad(bool show)
{ {
if(show!=flagShowTelrad) if(show!=flagShowTelrad)
{ {
StelMovementMgr* movementMgr = StelApp::getInstance().getCor e()->getMovementMgr();
if (show) if (show)
{ {
hideUsageMessageIfDisplayed(); hideUsageMessageIfDisplayed();
enableOcular(false); enableOcular(false);
toggleCCD(false); toggleCCD(false);
// NOTE: Added special zoom level for Telrad
// Seems problem was introduced with introducing Ste
lProperty feature
movementMgr->zoomTo(10.0);
} }
else if (getFlagInitFovUsage()) // Restoration of FOV is nee
ded?
movementMgr->zoomTo(movementMgr->getInitFov());
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 1535 skipping to change at line 1569
void Oculars::paintCCDBounds() void Oculars::paintCCDBounds()
{ {
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,
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);
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;
// flip are needed and allowed?
float ratioLimit = 0.125f;
if (getFlagUseFlipForCCD() && (ccdXRatio>=ratioLimit
|| ccdYRatio>=ratioLimit))
{
core->setFlipHorz(telescope->isHFlipped());
core->setFlipVert(telescope->isVFlipped());
}
else
{
core->setFlipHorz(false);
core->setFlipVert(false);
}
// 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 YRatio * params.devicePixelsPerPixel; float width = params.viewportXywh[aspectIndex] * ccd YRatio * params.devicePixelsPerPixel;
float height = params.viewportXywh[aspectIndex] * cc dXRatio * params.devicePixelsPerPixel; float height = params.viewportXywh[aspectIndex] * cc dXRatio * params.devicePixelsPerPixel;
skipping to change at line 1587 skipping to change at line 1611
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;
Vec3d crel; Vec3d crel;
projector->project(CPrel, crel); projector->project(CPrel, crel);
polarAngle = atan2(cpos[1] - crel[1], cpos[0 ] - crel[0]) * (-180.0)/M_PI; // convert to degrees polarAngle = atan2(cpos[1] - crel[1], cpos[0 ] - crel[0]) * (-180.0)/M_PI; // convert to degrees
if (CPos[2] > 0) polarAngle += 90.0; if (CPos[2] > 0) polarAngle += 90.0;
else polarAngle -= 90.0; else polarAngle -= 90.0;
} }
if (getFlagAutosetMountForCCD())
{
StelPropertyMgr* propMgr=StelApp::getInstanc
e().getStelPropertyManager();
propMgr->setStelPropertyValue("actionSwitch_
Equatorial_Mount", telescope->isEquatorial());
polarAngle = 0;
}
if (width > 0.0 && height > 0.0) if (width > 0.0 && height > 0.0)
{ {
QPoint a, b; QPoint a, b;
QTransform transform = QTransform().translat QTransform transform = QTransform().translat
e(params.viewportCenter[0] * params.devicePixelsPerPixel, e(centerScreen[0], centerScreen[1]).rotate(-(ccd->chipRotAngle() + polarAng
params.viewportCenter[1] * p le));
arams.devicePixelsPerPixel).rotate(-(ccd->chipRotAngle() + polarAngle));
// bottom line // bottom line
a = transform.map(QPoint(-width/2.0, -height /2.0)); a = transform.map(QPoint(-width/2.0, -height /2.0));
b = transform.map(QPoint(width/2.0, -height/ 2.0)); b = transform.map(QPoint(width/2.0, -height/ 2.0));
painter.drawLine2d(a.x(), a.y(), b.x(), b.y( )); painter.drawLine2d(a.x(), a.y(), b.x(), b.y( ));
// top line // top line
a = transform.map(QPoint(-width/2.0, height/ 2.0)); a = transform.map(QPoint(-width/2.0, height/ 2.0));
b = transform.map(QPoint(width/2.0, height/2 .0)); b = transform.map(QPoint(width/2.0, height/2 .0));
painter.drawLine2d(a.x(), a.y(), b.x(), b.y( )); painter.drawLine2d(a.x(), a.y(), b.x(), b.y( ));
// left line // left line
a = transform.map(QPoint(-width/2.0, -height /2.0)); a = transform.map(QPoint(-width/2.0, -height /2.0));
skipping to change at line 1619 skipping to change at line 1649
if(ccd->hasOAG()) if(ccd->hasOAG())
{ {
const double InnerOAGRatio = ccd->ge tInnerOAGRadius(telescope, lens) / screenFOV; const double InnerOAGRatio = ccd->ge tInnerOAGRadius(telescope, lens) / screenFOV;
const double OuterOAGRatio = ccd->ge tOuterOAGRadius(telescope, lens) / screenFOV; const double OuterOAGRatio = ccd->ge tOuterOAGRadius(telescope, lens) / screenFOV;
const double prismXRatio = ccd->getO AGActualFOVx(telescope, lens) / screenFOV; const double prismXRatio = ccd->getO AGActualFOVx(telescope, lens) / screenFOV;
float in_oag_r = params.viewportXywh [aspectIndex] * InnerOAGRatio * params.devicePixelsPerPixel; float in_oag_r = params.viewportXywh [aspectIndex] * InnerOAGRatio * params.devicePixelsPerPixel;
float out_oag_r = params.viewportXyw h[aspectIndex] * OuterOAGRatio * params.devicePixelsPerPixel; float out_oag_r = params.viewportXyw h[aspectIndex] * OuterOAGRatio * params.devicePixelsPerPixel;
float h_width = params.viewportXywh[ aspectIndex] * prismXRatio * params.devicePixelsPerPixel / 2.0; float h_width = params.viewportXywh[ aspectIndex] * prismXRatio * params.devicePixelsPerPixel / 2.0;
//painter.setColor(0.60f, 0.20f, 0.2 0f, .5f); //painter.setColor(0.60f, 0.20f, 0.2 0f, .5f);
painter.drawCircle(params.viewportCe painter.drawCircle(centerScreen[0],
nter[0] * params.devicePixelsPerPixel, centerScreen[1], in_oag_r);
params.viewportCente painter.drawCircle(centerScreen[0],
r[1] * params.devicePixelsPerPixel, in_oag_r); centerScreen[1], out_oag_r);
painter.drawCircle(params.viewportCe
nter[0] * params.devicePixelsPerPixel,
params.viewportCente
r[1] * params.devicePixelsPerPixel, out_oag_r);
QTransform oag_transform = QTransfor QTransform oag_transform = QTransfor
m().translate(params.viewportCenter[0] * params.devicePixelsPerPixel, m().translate(centerScreen[0], centerScreen[1]).rotate(-(ccd->chipRotAngle(
params.viewportCente ) + polarAngle + ccd->prismPosAngle()));
r[1] * params.devicePixelsPerPixel).rotate(-(ccd->chipRotAngle() + polarAng
le + ccd->prismPosAngle()));
// bottom line // bottom line
a = oag_transform.map(QPoint(-h_widt h, in_oag_r)); a = oag_transform.map(QPoint(-h_widt h, in_oag_r));
b = oag_transform.map(QPoint(h_width , in_oag_r)); b = oag_transform.map(QPoint(h_width , in_oag_r));
painter.drawLine2d(a.x(),a.y(), b.x( ), b.y()); painter.drawLine2d(a.x(),a.y(), b.x( ), b.y());
// top line // top line
a = oag_transform.map(QPoint(-h_widt h, out_oag_r)); a = oag_transform.map(QPoint(-h_widt h, out_oag_r));
b = oag_transform.map(QPoint(h_width , out_oag_r)); b = oag_transform.map(QPoint(h_width , out_oag_r));
painter.drawLine2d(a.x(),a.y(), b.x( ), b.y()); painter.drawLine2d(a.x(),a.y(), b.x( ), b.y());
// left line // left line
skipping to change at line 1649 skipping to change at line 1676
// right line // right line
a = oag_transform.map(QPoint(h_width , out_oag_r)); a = oag_transform.map(QPoint(h_width , out_oag_r));
b = oag_transform.map(QPoint(h_width , in_oag_r)); b = oag_transform.map(QPoint(h_width , in_oag_r));
painter.drawLine2d(a.x(),a.y(), b.x( ), b.y()); painter.drawLine2d(a.x(),a.y(), b.x( ), b.y());
} }
// Tool for planning a mosaic astrophotograp hy: shows a small cross at center of CCD's // Tool for planning a mosaic astrophotograp hy: shows a small cross at center of CCD's
// frame and equatorial coordinates for epoc h J2000.0 of that center. // frame and equatorial coordinates for epoc h J2000.0 of that center.
// Details: https://bugs.launchpad.net/stell arium/+bug/1404695 // Details: https://bugs.launchpad.net/stell arium/+bug/1404695
ratioLimit = 0.25f; float ratioLimit = 0.25f;
if (ccdXRatio>=ratioLimit || ccdYRatio>=rati oLimit) if (ccdXRatio>=ratioLimit || ccdYRatio>=rati oLimit)
{ {
// draw cross at center // draw cross at center
float cross = width>height ? height/ 50.f : width/50.f; float cross = width>height ? height/ 50.f : width/50.f;
a = transform.map(QPoint(0.f, -cross )); a = transform.map(QPoint(0.f, -cross ));
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;
Vec2f center = projector->getViewpor projector->unProject(centerScreen[0]
tCenter(); , centerScreen[1], centerPosition);
projector->unProject(center[0], cent
er[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)); // Calculate RA/DE (J2000.0) and show i t...
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
skipping to change at line 1698 skipping to change at line 1724
void Oculars::paintCrosshairs() void Oculars::paintCrosshairs()
{ {
StelCore *core = StelApp::getInstance().getCore(); StelCore *core = StelApp::getInstance().getCore();
const StelProjectorP projector = core->getProjection(StelCore::Frame EquinoxEqu); const StelProjectorP projector = core->getProjection(StelCore::Frame EquinoxEqu);
StelProjector::StelProjectorParams params = core->getCurrentStelProj ectorParams(); StelProjector::StelProjectorParams params = core->getCurrentStelProj ectorParams();
// Center of screen // Center of screen
Vec2i centerScreen(projector->getViewportPosX()+projector->getViewpo rtWidth()/2, Vec2i centerScreen(projector->getViewportPosX()+projector->getViewpo rtWidth()/2,
projector->getViewportPosY()+projector->getViewpo rtHeight()/2); projector->getViewportPosY()+projector->getViewpo rtHeight()/2);
float length = 0.5 * params.viewportFovDiameter; float length = 0.5 * params.viewportFovDiameter;
// See if we need to scale the length // See if we need to scale the length
if (useMaxEyepieceAngle && oculars[selectedOcularIndex]->appearentFO V() > 0.0) if (useMaxEyepieceAngle && oculars[selectedOcularIndex]->appearentFO V() > 0.0 && !oculars[selectedOcularIndex]->isBinoculars())
{ {
length = oculars[selectedOcularIndex]->appearentFOV() * leng th / maxEyepieceAngle; length = oculars[selectedOcularIndex]->appearentFOV() * leng th / maxEyepieceAngle;
} }
length *= params.devicePixelsPerPixel; length *= params.devicePixelsPerPixel;
// Draw the lines // Draw the lines
StelPainter painter(projector); StelPainter painter(projector);
painter.setColor(0.77f, 0.14f, 0.16f, 1.f); painter.setColor(0.77f, 0.14f, 0.16f, 1.f);
painter.drawLine2d(centerScreen[0], centerScreen[1], centerScreen[0] , centerScreen[1] + length); painter.drawLine2d(centerScreen[0], centerScreen[1], centerScreen[0] , centerScreen[1] + length);
painter.drawLine2d(centerScreen[0], centerScreen[1], centerScreen[0] , centerScreen[1] - length); painter.drawLine2d(centerScreen[0], centerScreen[1], centerScreen[0] , centerScreen[1] - length);
painter.drawLine2d(centerScreen[0], centerScreen[1], centerScreen[0] + length, centerScreen[1]); painter.drawLine2d(centerScreen[0], centerScreen[1], centerScreen[0] + length, centerScreen[1]);
painter.drawLine2d(centerScreen[0], centerScreen[1], centerScreen[0] - length, centerScreen[1]); painter.drawLine2d(centerScreen[0], centerScreen[1], centerScreen[0] - length, centerScreen[1]);
} }
void Oculars::paintTelrad() void Oculars::paintTelrad()
{ {
if (!flagShowOculars) { if (!flagShowOculars) {
const StelProjectorP projector = StelApp::getInstance().getC StelCore *core = StelApp::getInstance().getCore();
ore()->getProjection(StelCore::FrameEquinoxEqu); const StelProjectorP projector = core->getProjection(StelCor
e::FrameEquinoxEqu);
// StelPainter drawing // StelPainter drawing
StelPainter painter(projector); StelPainter painter(projector);
StelProjector::StelProjectorParams params = core->getCurrent StelProjectorParams();
painter.setColor(0.77f, 0.14f, 0.16f, 1.f); painter.setColor(0.77f, 0.14f, 0.16f, 1.f);
Vec2i centerScreen(projector->getViewportPosX() + projector- Vec2i centerScreen(projector->getViewportPosX()+projector->g
>getViewportWidth() / 2, etViewportWidth()/2,
projector->getViewportPosY() + projector- projector->getViewportPosY()+projector->g
>getViewportHeight() / 2); etViewportHeight()/2);
float pixelsPerRad = projector->getPixelPerRadAtCenter(); float pixelsPerRad = projector->getPixelPerRadAtCenter() * p
arams.devicePixelsPerPixel;
painter.drawCircle(centerScreen[0], centerScreen[1], 0.5 * p ixelsPerRad * (M_PI/180) * (0.5)); painter.drawCircle(centerScreen[0], centerScreen[1], 0.5 * p ixelsPerRad * (M_PI/180) * (0.5));
painter.drawCircle(centerScreen[0], centerScreen[1], 0.5 * p ixelsPerRad * (M_PI/180) * (2.0)); painter.drawCircle(centerScreen[0], centerScreen[1], 0.5 * p ixelsPerRad * (M_PI/180) * (2.0));
painter.drawCircle(centerScreen[0], centerScreen[1], 0.5 * p ixelsPerRad * (M_PI/180) * (4.0)); painter.drawCircle(centerScreen[0], centerScreen[1], 0.5 * p ixelsPerRad * (M_PI/180) * (4.0));
} }
} }
void Oculars::paintOcularMask(const StelCore *core) void Oculars::paintOcularMask(const StelCore *core)
{ {
const StelProjectorP prj = core->getProjection(StelCore::FrameAltAz) ; const StelProjectorP prj = core->getProjection(StelCore::FrameAltAz) ;
skipping to change at line 1745 skipping to change at line 1773
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); glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Normal transpa rency mode 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);
// Paint the reticale, if needed // Paint the reticale, if needed
if (!reticleTexture.isNull()) if (!reticleTexture.isNull())
{ {
painter.enableTexture2d(true); 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(params.viewportXywh[2] / 2 * params painter.drawSprite2dMode(centerScreen[0], centerScreen[1], i
.devicePixelsPerPixel, nner, reticleRotation);
params.viewportXywh[3] / 2 * params.devicePi
xelsPerPixel,
inner, reticleRotation);
} }
if (oculars[selectedOcularIndex]->hasPermanentCrosshair()) if (oculars[selectedOcularIndex]->hasPermanentCrosshair())
{ {
paintCrosshairs(); paintCrosshairs();
} }
float alpha = 1.f; float alpha = 1.f;
if (getFlagUseSemiTransparency()) if (getFlagUseSemiTransparency())
alpha = 0.85f; alpha = 0.85f;
skipping to change at line 1803 skipping to change at line 1831
sinCache[slices]=sinCache[0]; sinCache[slices]=sinCache[0];
cosCache[slices]=cosCache[0]; cosCache[slices]=cosCache[0];
/* Enable arrays */ /* Enable arrays */
painter.enableClientStates(true); painter.enableClientStates(true);
painter.setVertexPointer(3, GL_FLOAT, vertices); painter.setVertexPointer(3, GL_FLOAT, vertices);
radiusHigh=outerRadius-deltaRadius; radiusHigh=outerRadius-deltaRadius;
for (int i=0; i<=slices; i++) for (int i=0; i<=slices; i++)
{ {
vertices[i*2][0]= params.viewportCenter[0] * params.devicePi vertices[i*2][0]= centerScreen[0] + outerRadius*sinCache[i];
xelsPerPixel + outerRadius*sinCache[i]; vertices[i*2][1]= centerScreen[1] + outerRadius*cosCache[i];
vertices[i*2][1]= params.viewportCenter[1] * params.devicePi
xelsPerPixel + outerRadius*cosCache[i];
vertices[i*2][2] = 0.0; vertices[i*2][2] = 0.0;
vertices[i*2+1][0]= params.viewportCenter[0] * params.device vertices[i*2+1][0]= centerScreen[0] + radiusHigh*sinCache[i]
PixelsPerPixel + radiusHigh*sinCache[i]; ;
vertices[i*2+1][1]= params.viewportCenter[1] * params.device vertices[i*2+1][1]= centerScreen[1] + radiusHigh*cosCache[i]
PixelsPerPixel + radiusHigh*cosCache[i]; ;
vertices[i*2+1][2] = 0.0; vertices[i*2+1][2] = 0.0;
} }
painter.drawFromArray(StelPainter::TriangleStrip, (slices+1)*2, 0, f alse); painter.drawFromArray(StelPainter::TriangleStrip, (slices+1)*2, 0, f alse);
painter.enableClientStates(false); painter.enableClientStates(false);
} }
void Oculars::paintText(const StelCore* core) void Oculars::paintText(const StelCore* core)
{ {
const StelProjectorP prj = core->getProjection(StelCore::FrameAltAz) ; const StelProjectorP prj = core->getProjection(StelCore::FrameAltAz) ;
StelPainter painter(prj); StelPainter painter(prj);
skipping to change at line 1852 skipping to change at line 1880
painter.setColor(0.8f, 0.48f, 0.f, 1.f); painter.setColor(0.8f, 0.48f, 0.f, 1.f);
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND); 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]; int xPosition = projectorParams.viewportXywh[2] - projectorParams.vi ewportCenterOffset[0];
xPosition -= insetFromRHS; xPosition -= insetFromRHS;
int yPosition = projectorParams.viewportXywh[3]; int yPosition = projectorParams.viewportXywh[3] - projectorParams.vi ewportCenterOffset[1];
yPosition -= 40; yPosition -= 40;
const int lineHeight = painter.getFontMetrics().height(); const int lineHeight = painter.getFontMetrics().height();
// The Ocular // The Ocular
if (flagShowOculars && ocular!=NULL) if (flagShowOculars && ocular!=NULL)
{ {
QString ocularNumberLabel; QString ocularNumberLabel;
QString name = ocular->name(); QString name = ocular->name();
if (name.isEmpty()) if (name.isEmpty())
{ {
skipping to change at line 1898 skipping to change at line 1926
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)
{ {
QString lensName = lens->name(); QString lensName = lens->getName();
if (lensName.isEmpty()) if (lensName.isEmpty())
{ {
lensNumberLabel = QString(q_("Lens # %1")).arg(selectedLensIndex); lensNumberLabel = QString(q_("Lens # %1")).arg(selectedLensIndex);
} }
else else
{ {
lensNumberLabel = QString (q_("Lens #%1: %2")).arg(selectedLensIndex).arg(lensName); lensNumberLabel = QString (q_("Lens #%1: %2")).arg(selectedLensIndex).arg(lensName);
} }
} }
else else
skipping to change at line 2036 skipping to change at line 2064
qDebug() << "Oculars::validateIniFile copied default _ocular.ini to " << QDir::toNativeSeparators(ocularIniPath); qDebug() << "Oculars::validateIniFile copied default _ocular.ini to " << QDir::toNativeSeparators(ocularIniPath);
// The resource is read only, and the new file inher its this, so set write-able. // The resource is read only, and the new file inher its this, so set write-able.
QFile dest(ocularIniPath); QFile dest(ocularIniPath);
dest.setPermissions(dest.permissions() | QFile::Writ eOwner); dest.setPermissions(dest.permissions() | QFile::Writ eOwner);
} }
} }
else else
{ {
qDebug() << "Oculars::validateIniFile ocular.ini exists at: " << QDir::toNativeSeparators(ocularIniPath) << ". Checking version..."; qDebug() << "Oculars::validateIniFile ocular.ini exists at: " << QDir::toNativeSeparators(ocularIniPath) << ". Checking version...";
QSettings settings(ocularIniPath, QSettings::IniFormat); QSettings settings(ocularIniPath, QSettings::IniFormat);
double ocularsVersion = settings.value("oculars_version", "0 .0").toDouble(); float ocularsVersion = settings.value("oculars_version", 0.0 ).toFloat();
qWarning() << "Oculars::validateIniFile found existing ini f ile version " << ocularsVersion; qWarning() << "Oculars::validateIniFile found existing ini f ile version " << ocularsVersion;
if (ocularsVersion < MIN_OCULARS_INI_VERSION) if (ocularsVersion < MIN_OCULARS_INI_VERSION)
{ {
qWarning() << "Oculars::validateIniFile existing ini file version " << ocularsVersion qWarning() << "Oculars::validateIniFile existing ini file version " << ocularsVersion
<< " too old to use; required version is " << MIN_OCULARS_INI_VERSION << ". Copying over new one."; << " too old to use; required version is " << MIN_OCULARS_INI_VERSION << ". Copying over new one.";
// delete last "old" file, if it exists // delete last "old" file, if it exists
QFile deleteFile(ocularIniPath + ".old"); QFile deleteFile(ocularIniPath + ".old");
deleteFile.remove(); deleteFile.remove();
skipping to change at line 2079 skipping to change at line 2107
} }
} }
} }
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");
StelSkyDrawer *skyManager = core->getSkyDrawer(); StelSkyDrawer *skyManager = core->getSkyDrawer();
gridManager->setFlagAzimuthalGrid(flagAzimuthalGrid); if (flagHideGridsLines)
gridManager->setFlagGalacticGrid(flagGalacticGrid); {
gridManager->setFlagEquatorGrid(flagEquatorGrid); GridLinesMgr *gridManager = (GridLinesMgr *)StelApp::getInst
gridManager->setFlagEquatorJ2000Grid(flagEquatorJ2000Grid); ance().getModuleMgr().getModule("GridLinesMgr");
gridManager->setFlagEquatorLine(flagEquatorLine);
gridManager->setFlagEclipticLine(flagEclipticLine); gridManager->setFlagAzimuthalGrid(flagAzimuthalGrid);
gridManager->setFlagEclipticJ2000Grid(flagEclipticJ2000Grid); gridManager->setFlagGalacticGrid(flagGalacticGrid);
gridManager->setFlagMeridianLine(flagMeridianLine); gridManager->setFlagSupergalacticGrid(flagSupergalacticGrid)
gridManager->setFlagLongitudeLine(flagLongitudeLine); ;
gridManager->setFlagHorizonLine(flagHorizonLine); gridManager->setFlagEquatorJ2000Grid(flagEquatorJ2000Grid);
gridManager->setFlagGalacticEquatorLine(flagGalacticEquatorLine); gridManager->setFlagEquatorGrid(flagEquatorGrid);
gridManager->setFlagEquatorJ2000Line(flagEquatorJ2000Line);
gridManager->setFlagEquatorLine(flagEquatorLine);
gridManager->setFlagEclipticJ2000Line(flagEclipticJ2000Line)
;
gridManager->setFlagEclipticLine(flagEclipticLine);
gridManager->setFlagEclipticJ2000Grid(flagEclipticJ2000Grid)
;
gridManager->setFlagEclipticGrid(flagEclipticGrid);
gridManager->setFlagMeridianLine(flagMeridianLine);
gridManager->setFlagLongitudeLine(flagLongitudeLine);
gridManager->setFlagHorizonLine(flagHorizonLine);
gridManager->setFlagGalacticEquatorLine(flagGalacticEquatorL
ine);
gridManager->setFlagSupergalacticEquatorLine(flagSupergalact
icEquatorLine);
gridManager->setFlagPrimeVerticalLine(flagPrimeVerticalLine)
;
gridManager->setFlagColureLines(flagColureLines);
gridManager->setFlagCircumpolarCircles(flagCircumpolarCircle
s);
gridManager->setFlagPrecessionCircles(flagPrecessionCircles)
;
gridManager->setFlagCelestialJ2000Poles(flagCelestialJ2000Po
les);
gridManager->setFlagCelestialPoles(flagCelestialPoles);
gridManager->setFlagZenithNadir(flagZenithNadirPoints);
gridManager->setFlagEclipticJ2000Poles(flagEclipticJ2000Pole
s);
gridManager->setFlagEclipticPoles(flagEclipticPoles);
gridManager->setFlagGalacticPoles(flagGalacticPoles);
gridManager->setFlagSupergalacticPoles(flagSupergalacticPole
s);
gridManager->setFlagEquinoxJ2000Points(flagEquinoxJ2000Point
s);
gridManager->setFlagEquinoxPoints(flagEquinoxPoints);
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->setRelativeStarScale(relativeStarScale);
skyManager->setAbsoluteStarScale(absoluteStarScale); skyManager->setAbsoluteStarScale(absoluteStarScale);
movementManager->setFlagTracking(false); movementManager->setFlagTracking(false);
skipping to change at line 2132 skipping to change at line 2185
// The user cycled out the selected ocular // The user cycled out the selected ocular
flagShowOculars = false; flagShowOculars = false;
} }
if (flagShowOculars) if (flagShowOculars)
{ {
if (!zoomedIn) if (!zoomedIn)
{ {
StelCore *core = StelApp::getInstance().getCore(); StelCore *core = StelApp::getInstance().getCore();
GridLinesMgr *gridManager = (GridLinesMgr *)StelApp: if (flagHideGridsLines)
:getInstance().getModuleMgr().getModule("GridLinesMgr"); {
// Current state GridLinesMgr *gridManager = (GridLinesMgr *)
flagAzimuthalGrid = gridManager->getFlagAzimuthalGri StelApp::getInstance().getModuleMgr().getModule("GridLinesMgr");
d(); // Current state
flagGalacticGrid = gridManager->getFlagGalacticGrid( flagAzimuthalGrid = gridManager->getFlagAzim
); uthalGrid();
flagEquatorGrid = gridManager->getFlagEquatorGrid(); flagGalacticGrid = gridManager->getFlagGalac
flagEquatorJ2000Grid = gridManager->getFlagEquatorJ2 ticGrid();
000Grid(); flagSupergalacticGrid = gridManager->getFlag
flagEquatorLine = gridManager->getFlagEquatorLine(); SupergalacticGrid();
flagEclipticLine = gridManager->getFlagEclipticLine( flagEquatorJ2000Grid = gridManager->getFlagE
); quatorJ2000Grid();
flagEclipticJ2000Grid = gridManager->getFlagEcliptic flagEquatorGrid = gridManager->getFlagEquato
J2000Grid(); rGrid();
flagMeridianLine = gridManager->getFlagMeridianLine( flagEquatorJ2000Line = gridManager->getFlagE
); quatorJ2000Line();
flagLongitudeLine = gridManager->getFlagLongitudeLin flagEquatorLine = gridManager->getFlagEquato
e(); rLine();
flagHorizonLine = gridManager->getFlagHorizonLine(); flagEclipticJ2000Line = gridManager->getFlag
flagGalacticEquatorLine = gridManager->getFlagGalact EclipticJ2000Line();
icEquatorLine(); flagEclipticLine = gridManager->getFlagEclip
ticLine();
flagEclipticJ2000Grid = gridManager->getFlag
EclipticJ2000Grid();
flagEclipticGrid = gridManager->getFlagEclip
ticGrid();
flagMeridianLine = gridManager->getFlagMerid
ianLine();
flagLongitudeLine = gridManager->getFlagLong
itudeLine();
flagHorizonLine = gridManager->getFlagHorizo
nLine();
flagGalacticEquatorLine = gridManager->getFl
agGalacticEquatorLine();
flagSupergalacticEquatorLine = gridManager->
getFlagSupergalacticEquatorLine();
flagPrimeVerticalLine = gridManager->getFlag
PrimeVerticalLine();
flagColureLines = gridManager->getFlagColure
Lines();
flagCircumpolarCircles = gridManager->getFla
gCircumpolarCircles();
flagPrecessionCircles = gridManager->getFlag
PrecessionCircles();
flagCelestialJ2000Poles = gridManager->getFl
agCelestialJ2000Poles();
flagCelestialPoles = gridManager->getFlagCel
estialPoles();
flagZenithNadirPoints = gridManager->getFlag
ZenithNadir();
flagEclipticJ2000Poles = gridManager->getFla
gEclipticJ2000Poles();
flagEclipticPoles = gridManager->getFlagEcli
pticPoles();
flagGalacticPoles = gridManager->getFlagGala
cticPoles();
flagSupergalacticPoles = gridManager->getFla
gSupergalacticPoles();
flagEquinoxJ2000Points = gridManager->getFla
gEquinoxJ2000Points();
flagEquinoxPoints = gridManager->getFlagEqui
noxPoints();
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();
skipping to change at line 2181 skipping to change at line 2256
{ {
//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 *)StelApp::getInstance().g
etModuleMgr().getModule("GridLinesMgr");
StelSkyDrawer *skyManager = core->getSkyDrawer(); StelSkyDrawer *skyManager = core->getSkyDrawer();
gridManager->setFlagAzimuthalGrid(false); if (flagHideGridsLines)
gridManager->setFlagGalacticGrid(false); {
gridManager->setFlagEquatorGrid(false); GridLinesMgr *gridManager = (GridLinesMgr *)StelApp::getInst
gridManager->setFlagEquatorJ2000Grid(false); ance().getModuleMgr().getModule("GridLinesMgr");
gridManager->setFlagEquatorLine(false);
gridManager->setFlagEclipticLine(false); gridManager->setFlagAzimuthalGrid(false);
gridManager->setFlagEclipticJ2000Grid(false); gridManager->setFlagGalacticGrid(false);
gridManager->setFlagMeridianLine(false); gridManager->setFlagSupergalacticGrid(false);
gridManager->setFlagLongitudeLine(false); gridManager->setFlagEquatorJ2000Grid(false);
gridManager->setFlagHorizonLine(false); gridManager->setFlagEquatorGrid(false);
gridManager->setFlagGalacticEquatorLine(false); gridManager->setFlagEquatorJ2000Line(false);
gridManager->setFlagEquatorLine(false);
gridManager->setFlagEclipticJ2000Line(false);
gridManager->setFlagEclipticLine(false);
gridManager->setFlagEclipticJ2000Grid(false);
gridManager->setFlagEclipticGrid(false);
gridManager->setFlagMeridianLine(false);
gridManager->setFlagLongitudeLine(false);
gridManager->setFlagHorizonLine(false);
gridManager->setFlagGalacticEquatorLine(false);
gridManager->setFlagSupergalacticEquatorLine(false);
gridManager->setFlagPrimeVerticalLine(false);
gridManager->setFlagColureLines(false);
gridManager->setFlagCircumpolarCircles(false);
gridManager->setFlagPrecessionCircles(false);
gridManager->setFlagCelestialJ2000Poles(false);
gridManager->setFlagCelestialPoles(false);
gridManager->setFlagZenithNadir(false);
gridManager->setFlagEclipticJ2000Poles(false);
gridManager->setFlagEclipticPoles(false);
gridManager->setFlagGalacticPoles(false);
gridManager->setFlagSupergalacticPoles(false);
gridManager->setFlagEquinoxJ2000Points(false);
gridManager->setFlagEquinoxPoints(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);
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())
skipping to change at line 2238 skipping to change at line 2337
core->setFlipHorz(telescope->isHFlipped()); core->setFlipHorz(telescope->isHFlipped());
core->setFlipVert(telescope->isVFlipped()); core->setFlipVert(telescope->isVFlipped());
} }
// Change relative and absolute scales for stars // Change relative and absolute scales for stars
// TODO: Finding experimental value for better rendering // TODO: Finding experimental value for better rendering
skyManager->setRelativeStarScale(0.6); skyManager->setRelativeStarScale(0.6);
skyManager->setAbsoluteStarScale(0.75); 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() && !ocular->isBinoculars()) if (getFlagLimitMagnitude())
{ {
// Simplified calculation of the penetrating power of the te lescope // Simplified calculation of the penetrating power of the te lescope
double limitMag = 2.1 + 5*std::log10(telescope->diameter()); double diameter = 0.;
if (ocular->isBinoculars())
diameter = ocular->fieldStop();
else
diameter = telescope->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.
if (useMaxEyepieceAngle && ocular->appearentFOV() > 0.0 && !ocular-> isBinoculars()) if (useMaxEyepieceAngle && ocular->appearentFOV() > 0.0 && !ocular-> isBinoculars())
skipping to change at line 2293 skipping to change at line 2397
submenu->addAction(q_("&Previous lens"), this, SLOT(decrementLensInd ex())); submenu->addAction(q_("&Previous lens"), this, SLOT(decrementLensInd ex()));
submenu->addAction(q_("&Next lens"), this, SLOT(incrementLensIndex() )); submenu->addAction(q_("&Next lens"), this, SLOT(incrementLensIndex() ));
submenu->addSeparator(); submenu->addSeparator();
submenu->addAction(q_("None"), this, SLOT(disableLens())); submenu->addAction(q_("None"), this, SLOT(disableLens()));
for (int index = 0; index < lense.count(); ++index) for (int index = 0; index < lense.count(); ++index)
{ {
QString label; QString label;
if (index < 10) if (index < 10)
{ {
label = QString("&%1: %2").arg(index).arg(lense[inde x]->name()); label = QString("&%1: %2").arg(index).arg(lense[inde x]->getName());
} }
else else
{ {
label = lense[index]->name(); label = lense[index]->getName();
} }
QAction* action = submenu->addAction(label, lenseSignalMappe r, SLOT(map())); QAction* action = submenu->addAction(label, lenseSignalMappe r, SLOT(map()));
if (index == selectedLensIndex) if (index == selectedLensIndex)
{ {
action->setCheckable(true); action->setCheckable(true);
action->setChecked(true); action->setChecked(true);
} }
lenseSignalMapper->setMapping(action, QString("%1").arg(inde x)); lenseSignalMapper->setMapping(action, QString("%1").arg(inde x));
} }
return submenu; return submenu;
skipping to change at line 2377 skipping to change at line 2481
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::setFlagUseFlipForCCD(const bool b) void Oculars::setFlagAutosetMountForCCD(const bool b)
{ {
flagUseFlipForCCD = b; flagAutosetMountForCCD = b;
settings->setValue("use_ccd_flip", b); settings->setValue("use_mount_autoset", b);
settings->sync(); settings->sync();
if (!b)
{
StelPropertyMgr* propMgr=StelApp::getInstance().getStelPrope
rtyManager();
propMgr->setStelPropertyValue("actionSwitch_Equatorial_Mount
", equatorialMountEnabled);
}
} }
bool Oculars::getFlagUseFlipForCCD() const bool Oculars::getFlagAutosetMountForCCD() const
{ {
return flagUseFlipForCCD; return flagAutosetMountForCCD;
} }
void Oculars::setFlagUseSemiTransparency(const bool b) void Oculars::setFlagUseSemiTransparency(const bool b)
{ {
flagSemiTransporency = b; flagSemiTransporency = b;
settings->setValue("use_semi_transparency", b); settings->setValue("use_semi_transparency", b);
settings->sync(); settings->sync();
} }
bool Oculars::getFlagUseSemiTransparency() const bool Oculars::getFlagUseSemiTransparency() const
{ {
return flagSemiTransporency; return flagSemiTransporency;
} }
void Oculars::setFlagHideGridsLines(const bool b)
{
flagHideGridsLines = b;
settings->setValue("hide_grids_and_lines", b);
settings->sync();
}
bool Oculars::getFlagHideGridsLines() const
{
return flagHideGridsLines;
}
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. 54 change blocks. 
128 lines changed or deleted 294 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/