GridLinesMgr.cpp   GridLinesMgr.cpp 
skipping to change at line 32 skipping to change at line 32
#include "StelUtils.hpp" #include "StelUtils.hpp"
#include "StelTranslator.hpp" #include "StelTranslator.hpp"
#include "StelProjector.hpp" #include "StelProjector.hpp"
#include "StelFader.hpp" #include "StelFader.hpp"
#include "Planet.hpp" #include "Planet.hpp"
#include "StelLocaleMgr.hpp" #include "StelLocaleMgr.hpp"
#include "StelModuleMgr.hpp" #include "StelModuleMgr.hpp"
#include "StelCore.hpp" #include "StelCore.hpp"
#include "StelPainter.hpp" #include "StelPainter.hpp"
#include "StelSkyDrawer.hpp" #include "StelSkyDrawer.hpp"
#include "StelMovementMgr.hpp" #include "StelGui.hpp"
#include <set> #include <set>
#include <QSettings> #include <QSettings>
#include <QDebug> #include <QDebug>
#include <QFontMetrics> #include <QFontMetrics>
//! @class SkyGrid //! @class SkyGrid
//! Class which manages a grid to display in the sky. //! Class which manages a grid to display in the sky.
//! TODO needs support for DMS/DMS labelling, not only HMS/DMS //! TODO needs support for DMS/DMS labelling, not only HMS/DMS
class SkyGrid class SkyGrid
skipping to change at line 74 skipping to change at line 74
//! Class which manages a line to display around the sky like the ecliptic line. //! Class which manages a line to display around the sky like the ecliptic line.
class SkyLine class SkyLine
{ {
public: public:
enum SKY_LINE_TYPE enum SKY_LINE_TYPE
{ {
EQUATOR, EQUATOR,
ECLIPTIC, ECLIPTIC,
MERIDIAN, MERIDIAN,
HORIZON, HORIZON,
GALACTICPLANE GALACTICEQUATOR
}; };
// Create and precompute positions of a SkyGrid // Create and precompute positions of a SkyGrid
SkyLine(SKY_LINE_TYPE _line_type = EQUATOR); SkyLine(SKY_LINE_TYPE _line_type = EQUATOR);
virtual ~SkyLine(); virtual ~SkyLine();
void draw(StelCore* core) const; void draw(StelCore* core) const;
void setColor(const Vec3f& c) {color = c;} void setColor(const Vec3f& c) {color = c;}
const Vec3f& getColor() {return color;} const Vec3f& getColor() {return color;}
void update(double deltaTime) {fader.update((int)(deltaTime*1000));} void update(double deltaTime) {fader.update((int)(deltaTime*1000));}
void setFadeDuration(float duration) {fader.setDuration((int)(durati on*1000.f));} void setFadeDuration(float duration) {fader.setDuration((int)(durati on*1000.f));}
void setDisplayed(const bool displayed){fader = displayed;} void setDisplayed(const bool displayed){fader = displayed;}
skipping to change at line 101 skipping to change at line 101
Vec3f color; Vec3f color;
StelCore::FrameType frameType; StelCore::FrameType frameType;
LinearFader fader; LinearFader fader;
QFont font; QFont font;
QString label; QString label;
}; };
// rms added color as parameter // rms added color as parameter
SkyGrid::SkyGrid(StelCore::FrameType frame) : color(0.2,0.2,0.2), frameType (frame) SkyGrid::SkyGrid(StelCore::FrameType frame) : color(0.2,0.2,0.2), frameType (frame)
{ {
font.setPixelSize(12); // Font size is 12
font.setPixelSize(StelApp::getInstance().getBaseFontSize()-1);
} }
SkyGrid::~SkyGrid() SkyGrid::~SkyGrid()
{ {
} }
void SkyGrid::setFontSize(double newFontSize) void SkyGrid::setFontSize(double newFontSize)
{ {
font.setPixelSize(newFontSize); font.setPixelSize(newFontSize);
} }
skipping to change at line 168 skipping to change at line 169
}; };
// Callback which draws the label of the grid // Callback which draws the label of the grid
void viewportEdgeIntersectCallback(const Vec3d& screenPos, const Vec3d& dir ection, void* userData) void viewportEdgeIntersectCallback(const Vec3d& screenPos, const Vec3d& dir ection, void* userData)
{ {
ViewportEdgeIntersectCallbackData* d = static_cast<ViewportEdgeInter sectCallbackData*>(userData); ViewportEdgeIntersectCallbackData* d = static_cast<ViewportEdgeInter sectCallbackData*>(userData);
Vec3d direc(direction); Vec3d direc(direction);
direc.normalize(); direc.normalize();
const Vec4f tmpColor = d->sPainter->getColor(); const Vec4f tmpColor = d->sPainter->getColor();
d->sPainter->setColor(d->textColor[0], d->textColor[1], d->textColor [2], d->textColor[3]); d->sPainter->setColor(d->textColor[0], d->textColor[1], d->textColor [2], d->textColor[3]);
bool withDecimalDegree = dynamic_cast<StelGui*>(StelApp::getInstance ().getGui())->getFlagShowDecimalDegrees();
QString text; QString text;
if (d->text.isEmpty()) if (d->text.isEmpty())
{ {
// We are in the case of meridians, we need to determine whi ch of the 2 labels (3h or 15h to use) // We are in the case of meridians, we need to determine whi ch of the 2 labels (3h or 15h to use)
Vec3d tmpV; Vec3d tmpV;
d->sPainter->getProjector()->unProject(screenPos, tmpV); d->sPainter->getProjector()->unProject(screenPos, tmpV);
double cFOV = StelApp::getInstance().getCore()->getMovementM double lon, lat, textAngle;
gr()->getCurrentFov();
double lon, lat;
StelUtils::rectToSphe(&lon, &lat, tmpV); StelUtils::rectToSphe(&lon, &lat, tmpV);
switch (d->frameType) switch (d->frameType)
{ {
case StelCore::FrameAltAz: case StelCore::FrameAltAz:
{ {
double raAngle = M_PI-d->raAngle; double raAngle = ::fmod(M_PI-d->raAngle,2.*M
if (cFOV<50.) _PI);
text = StelUtils::radToDmsStrAdapt(r lon = ::fmod(M_PI-lon,2.*M_PI);
aAngle);
if (std::fabs(2.*M_PI-lon)<0.001) // We are
at meridian 0
lon = 0.;
const double delta = raAngle<M_PI ? M_PI : -
M_PI;
if (std::fabs(lon-raAngle) < 0.01 || (lon==0
. && raAngle!=M_PI))
textAngle = raAngle;
else else
{ textAngle = raAngle+delta;
lon = M_PI-lon;
if (raAngle<0) if (raAngle==2*M_PI && delta==-M_PI)
raAngle=+2.*M_PI; textAngle = 0;
if (lon<0)
lon=+2.*M_PI; if (withDecimalDegree)
text = StelUtils::radToDecDegStr(tex
if (std::fabs(2.*M_PI-lon)<0.01) tAngle);
{ else
// We are at meridian 0 text = StelUtils::radToDmsStrAdapt(t
lon = 0.; extAngle);
}
if (std::fabs(lon-raAngle) < 0.01)
text = StelUtils::radToDmsSt
rAdapt(raAngle);
else
{
const double delta = raAngle
<M_PI ? M_PI : -M_PI;
if (raAngle==2*M_PI && delta
==-M_PI)
{
text = StelUtils::ra
dToDmsStrAdapt(0);
}
else
{
text = StelUtils::ra
dToDmsStrAdapt(raAngle+delta);
}
}
}
break; break;
} }
case StelCore::FrameObservercentricEcliptic: case StelCore::FrameObservercentricEcliptic:
{
double raAngle = d->raAngle;
if (raAngle<0.)
raAngle += 2.*M_PI;
if (lon<0.)
lon += 2*M_PI;
if (std::fabs(2.*M_PI-lon)<0.001) // We are
at meridian 0
lon = 0.;
const double delta = raAngle<M_PI ? M_PI : -
M_PI;
if (std::fabs(lon-raAngle) < 1. || lon==0.)
textAngle = raAngle;
else
textAngle = raAngle+delta;
if (raAngle==2*M_PI && delta==-M_PI)
textAngle = 0;
if (withDecimalDegree)
text = StelUtils::radToDecDegStr(tex
tAngle);
else
text = StelUtils::radToDmsStrAdapt(t
extAngle);
break;
}
case StelCore::FrameGalactic: case StelCore::FrameGalactic:
{ {
double raAngle = M_PI-d->raAngle; double raAngle = M_PI-d->raAngle;
lon = M_PI-lon; lon = M_PI-lon;
if (raAngle<0) if (raAngle<0)
raAngle=+2.*M_PI; raAngle=+2.*M_PI;
if (lon<0) if (lon<0)
lon=+2.*M_PI; lon=+2.*M_PI;
if (std::fabs(2.*M_PI-lon)<0.01) if (std::fabs(2.*M_PI-lon)<0.01) // We are a
{ t meridian 0
// We are at meridian 0
lon = 0.; lon = 0.;
}
if (std::fabs(lon-raAngle) < 0.01) if (std::fabs(lon-raAngle) < 0.01)
text = StelUtils::radToDmsStrAdapt(- raAngle+M_PI); textAngle = -raAngle+M_PI;
else else
{ {
const double delta = raAngle<M_PI ? M_PI : -M_PI; const double delta = raAngle<M_PI ? M_PI : -M_PI;
text = StelUtils::radToDmsStrAdapt(- raAngle-delta+M_PI); textAngle = -raAngle-delta+M_PI;
} }
if (withDecimalDegree)
text = StelUtils::radToDecDegStr(tex
tAngle);
else
text = StelUtils::radToDmsStrAdapt(t
extAngle);
break; break;
} }
default: default:
{ {
if (cFOV<50.) if (std::fabs(2.*M_PI-lon)<0.001)
text = StelUtils::radToHmsStrAdapt(d
->raAngle);
else
{ {
if (std::fabs(2.*M_PI-lon)<0.01) // We are at meridian 0
{ lon = 0.;
// We are at meridian 0
lon = 0.;
}
if (std::fabs(lon-d->raAngle) < 0.01
)
text = StelUtils::radToHmsSt
rAdapt(d->raAngle);
else
{
const double delta = d->raAn
gle<M_PI ? M_PI : -M_PI;
text = StelUtils::radToHmsSt
rAdapt(d->raAngle+delta);
}
} }
const double delta = d->raAngle<M_PI ? M_PI
: -M_PI;
if (std::fabs(lon-d->raAngle) < 1. || lon==0
. || d->raAngle==M_PI)
textAngle = d->raAngle;
else
textAngle = d->raAngle+delta;
if (d->raAngle+delta==0.)
textAngle = M_PI;
if (withDecimalDegree)
text = StelUtils::radToDecDegStr(tex
tAngle,false,true);
else
text = StelUtils::radToHmsStrAdapt(t
extAngle);
} }
} }
} }
else else
text = d->text; text = d->text;
double angleDeg = std::atan2(-direc[1], -direc[0])*180./M_PI; double angleDeg = std::atan2(-direc[1], -direc[0])*180./M_PI;
float xshift=6.f; float xshift=6.f;
if (angleDeg>90. || angleDeg<-90.) if (angleDeg>90. || angleDeg<-90.)
{ {
skipping to change at line 286 skipping to change at line 309
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
} }
//! Draw the sky grid in the current frame //! Draw the sky grid in the current frame
void SkyGrid::draw(const StelCore* core) const void SkyGrid::draw(const StelCore* core) const
{ {
const StelProjectorP prj = core->getProjection(frameType, frameType! =StelCore::FrameAltAz ? StelCore::RefractionAuto : StelCore::RefractionOff) ; const StelProjectorP prj = core->getProjection(frameType, frameType! =StelCore::FrameAltAz ? StelCore::RefractionAuto : StelCore::RefractionOff) ;
if (!fader.getInterstate()) if (!fader.getInterstate())
return; return;
bool withDecimalDegree = dynamic_cast<StelGui*>(StelApp::getInstance
().getGui())->getFlagShowDecimalDegrees();
// Look for all meridians and parallels intersecting with the disk b ounding the viewport // Look for all meridians and parallels intersecting with the disk b ounding the viewport
// Check whether the pole are in the viewport // Check whether the pole are in the viewport
bool northPoleInViewport = false; bool northPoleInViewport = false;
bool southPoleInViewport = false; bool southPoleInViewport = false;
Vec3f win; Vec3f win;
if (prj->project(Vec3f(0,0,1), win) && prj->checkInViewport(win)) if (prj->project(Vec3f(0,0,1), win) && prj->checkInViewport(win))
northPoleInViewport = true; northPoleInViewport = true;
if (prj->project(Vec3f(0,0,-1), win) && prj->checkInViewport(win)) if (prj->project(Vec3f(0,0,-1), win) && prj->checkInViewport(win))
southPoleInViewport = true; southPoleInViewport = true;
// Get the longitude and latitude resolution at the center of the vi ewport // Get the longitude and latitude resolution at the center of the vi ewport
skipping to change at line 422 skipping to change at line 447
///////////////////////////////////////////////// /////////////////////////////////////////////////
// Draw all the parallels (small circles) // Draw all the parallels (small circles)
SphericalCap parallelSphericalCap(Vec3d(0,0,1), 0); SphericalCap parallelSphericalCap(Vec3d(0,0,1), 0);
rotLon = Mat4d::rotation(firstPoint^Vec3d(0,0,1), gridStepParallelRa d); rotLon = Mat4d::rotation(firstPoint^Vec3d(0,0,1), gridStepParallelRa d);
fpt = firstPoint; fpt = firstPoint;
maxNbIter = (int)(M_PI/gridStepParallelRad)-1; maxNbIter = (int)(M_PI/gridStepParallelRad)-1;
for (i=0; i<maxNbIter; ++i) for (i=0; i<maxNbIter; ++i)
{ {
StelUtils::rectToSphe(&lon2, &lat2, fpt); StelUtils::rectToSphe(&lon2, &lat2, fpt);
userData.text = StelUtils::radToDmsStrAdapt(lat2); if (withDecimalDegree)
userData.text = StelUtils::radToDecDegStr(lat2);
else
userData.text = StelUtils::radToDmsStrAdapt(lat2);
parallelSphericalCap.d = fpt[2]; parallelSphericalCap.d = fpt[2];
if (parallelSphericalCap.d>0.9999999) if (parallelSphericalCap.d>0.9999999)
break; break;
const Vec3d rotCenter(0,0,parallelSphericalCap.d); const Vec3d rotCenter(0,0,parallelSphericalCap.d);
if (!SphericalCap::intersectionPoints(viewPortSphericalCap, parallelSphericalCap, p1, p2)) if (!SphericalCap::intersectionPoints(viewPortSphericalCap, parallelSphericalCap, p1, p2))
{ {
if ((viewPortSphericalCap.d<parallelSphericalCap.d & & viewPortSphericalCap.contains(parallelSphericalCap.n)) if ((viewPortSphericalCap.d<parallelSphericalCap.d & & viewPortSphericalCap.contains(parallelSphericalCap.n))
|| (viewPortSphericalCap.d<-parallelSpherica lCap.d && viewPortSphericalCap.contains(-parallelSphericalCap.n))) || (viewPortSphericalCap.d<-parallelSpherica lCap.d && viewPortSphericalCap.contains(-parallelSphericalCap.n)))
skipping to change at line 476 skipping to change at line 504
} }
if (i!=maxNbIter) if (i!=maxNbIter)
{ {
rotLon = Mat4d::rotation(firstPoint^Vec3d(0,0,1), -gridStepP arallelRad); rotLon = Mat4d::rotation(firstPoint^Vec3d(0,0,1), -gridStepP arallelRad);
fpt = firstPoint; fpt = firstPoint;
fpt.transfo4d(rotLon); fpt.transfo4d(rotLon);
for (int j=0; j<maxNbIter-i; ++j) for (int j=0; j<maxNbIter-i; ++j)
{ {
StelUtils::rectToSphe(&lon2, &lat2, fpt); StelUtils::rectToSphe(&lon2, &lat2, fpt);
userData.text = StelUtils::radToDmsStrAdapt(lat2); if (withDecimalDegree)
userData.text = StelUtils::radToDecDegStr(la
t2);
else
userData.text = StelUtils::radToDmsStrAdapt(
lat2);
parallelSphericalCap.d = fpt[2]; parallelSphericalCap.d = fpt[2];
const Vec3d rotCenter(0,0,parallelSphericalCap.d); const Vec3d rotCenter(0,0,parallelSphericalCap.d);
if (!SphericalCap::intersectionPoints(viewPortSpheri calCap, parallelSphericalCap, p1, p2)) if (!SphericalCap::intersectionPoints(viewPortSpheri calCap, parallelSphericalCap, p1, p2))
{ {
if ((viewPortSphericalCap.d<parallelSpherica lCap.d && viewPortSphericalCap.contains(parallelSphericalCap.n)) if ((viewPortSphericalCap.d<parallelSpherica lCap.d && viewPortSphericalCap.contains(parallelSphericalCap.n))
|| (viewPortSphericalCap.d<-paralle lSphericalCap.d && viewPortSphericalCap.contains(-parallelSphericalCap.n))) || (viewPortSphericalCap.d<-paralle lSphericalCap.d && viewPortSphericalCap.contains(-parallelSphericalCap.n)))
{ {
// The parallel is fully included in the viewport, draw it in 3 sub-arcs to avoid lengths >= 180 deg // The parallel is fully included in the viewport, draw it in 3 sub-arcs to avoid lengths >= 180 deg
static const Mat4d rotLon120 = Mat4d ::zrotation(120.*M_PI/180.); static const Mat4d rotLon120 = Mat4d ::zrotation(120.*M_PI/180.);
skipping to change at line 523 skipping to change at line 554
sPainter.drawSmallCircleArc(p1, middlePoint, rotCent er, viewportEdgeIntersectCallback, &userData); sPainter.drawSmallCircleArc(p1, middlePoint, rotCent er, viewportEdgeIntersectCallback, &userData);
sPainter.drawSmallCircleArc(p2, middlePoint, rotCent er, viewportEdgeIntersectCallback, &userData); sPainter.drawSmallCircleArc(p2, middlePoint, rotCent er, viewportEdgeIntersectCallback, &userData);
fpt.transfo4d(rotLon); fpt.transfo4d(rotLon);
} }
} }
} }
SkyLine::SkyLine(SKY_LINE_TYPE _line_type) : color(0.f, 0.f, 1.f) SkyLine::SkyLine(SKY_LINE_TYPE _line_type) : color(0.f, 0.f, 1.f)
{ {
font.setPixelSize(14); // Font size is 14
font.setPixelSize(StelApp::getInstance().getBaseFontSize()+1);
line_type = _line_type; line_type = _line_type;
updateLabel(); updateLabel();
} }
SkyLine::~SkyLine() SkyLine::~SkyLine()
{ {
} }
void SkyLine::setFontSize(double newFontSize) void SkyLine::setFontSize(double newFontSize)
skipping to change at line 558 skipping to change at line 590
label = q_("Ecliptic"); label = q_("Ecliptic");
break; break;
case EQUATOR: case EQUATOR:
frameType = StelCore::FrameEquinoxEqu; frameType = StelCore::FrameEquinoxEqu;
label = q_("Equator"); label = q_("Equator");
break; break;
case HORIZON: case HORIZON:
frameType = StelCore::FrameAltAz; frameType = StelCore::FrameAltAz;
label = q_("Horizon"); label = q_("Horizon");
break; break;
case GALACTICPLANE: case GALACTICEQUATOR:
frameType = StelCore::FrameGalactic; frameType = StelCore::FrameGalactic;
label = q_("Galactic Plane"); label = q_("Galactic Equator");
break; break;
} }
} }
void SkyLine::draw(StelCore *core) const void SkyLine::draw(StelCore *core) const
{ {
if (!fader.getInterstate()) if (!fader.getInterstate())
return; return;
StelProjectorP prj = core->getProjection(frameType, frameType!=StelC ore::FrameAltAz ? StelCore::RefractionAuto : StelCore::RefractionOff); StelProjectorP prj = core->getProjection(frameType, frameType!=StelC ore::FrameAltAz ? StelCore::RefractionAuto : StelCore::RefractionOff);
skipping to change at line 645 skipping to change at line 677
setObjectName("GridLinesMgr"); setObjectName("GridLinesMgr");
equGrid = new SkyGrid(StelCore::FrameEquinoxEqu); equGrid = new SkyGrid(StelCore::FrameEquinoxEqu);
equJ2000Grid = new SkyGrid(StelCore::FrameJ2000); equJ2000Grid = new SkyGrid(StelCore::FrameJ2000);
eclJ2000Grid = new SkyGrid(StelCore::FrameObservercentricEcliptic); eclJ2000Grid = new SkyGrid(StelCore::FrameObservercentricEcliptic);
galacticGrid = new SkyGrid(StelCore::FrameGalactic); galacticGrid = new SkyGrid(StelCore::FrameGalactic);
aziGrid = new SkyGrid(StelCore::FrameAltAz); aziGrid = new SkyGrid(StelCore::FrameAltAz);
equatorLine = new SkyLine(SkyLine::EQUATOR); equatorLine = new SkyLine(SkyLine::EQUATOR);
eclipticLine = new SkyLine(SkyLine::ECLIPTIC); eclipticLine = new SkyLine(SkyLine::ECLIPTIC);
meridianLine = new SkyLine(SkyLine::MERIDIAN); meridianLine = new SkyLine(SkyLine::MERIDIAN);
horizonLine = new SkyLine(SkyLine::HORIZON); horizonLine = new SkyLine(SkyLine::HORIZON);
galacticPlaneLine = new SkyLine(SkyLine::GALACTICPLANE); galacticEquatorLine = new SkyLine(SkyLine::GALACTICEQUATOR);
} }
GridLinesMgr::~GridLinesMgr() GridLinesMgr::~GridLinesMgr()
{ {
delete equGrid; delete equGrid;
delete equJ2000Grid; delete equJ2000Grid;
delete eclJ2000Grid; delete eclJ2000Grid;
delete galacticGrid; delete galacticGrid;
delete aziGrid; delete aziGrid;
delete equatorLine; delete equatorLine;
delete eclipticLine; delete eclipticLine;
delete meridianLine; delete meridianLine;
delete horizonLine; delete horizonLine;
delete galacticPlaneLine; delete galacticEquatorLine;
} }
/************************************************************************* /*************************************************************************
Reimplementation of the getCallOrder method Reimplementation of the getCallOrder method
*************************************************************************/ *************************************************************************/
double GridLinesMgr::getCallOrder(StelModuleActionName actionName) const double GridLinesMgr::getCallOrder(StelModuleActionName actionName) const
{ {
if (actionName==StelModule::ActionDraw) if (actionName==StelModule::ActionDraw)
return StelApp::getInstance().getModuleMgr().getModule("Nebu laMgr")->getCallOrder(actionName)+10; return StelApp::getInstance().getModuleMgr().getModule("Nebu laMgr")->getCallOrder(actionName)+10;
return 0; return 0;
skipping to change at line 686 skipping to change at line 718
setFlagAzimuthalGrid(conf->value("viewing/flag_azimuthal_grid").toBo ol()); setFlagAzimuthalGrid(conf->value("viewing/flag_azimuthal_grid").toBo ol());
setFlagEquatorGrid(conf->value("viewing/flag_equatorial_grid").toBoo l()); setFlagEquatorGrid(conf->value("viewing/flag_equatorial_grid").toBoo l());
setFlagEquatorJ2000Grid(conf->value("viewing/flag_equatorial_J2000_g rid").toBool()); setFlagEquatorJ2000Grid(conf->value("viewing/flag_equatorial_J2000_g rid").toBool());
setFlagEclipticJ2000Grid(conf->value("viewing/flag_ecliptic_J2000_gr id").toBool()); setFlagEclipticJ2000Grid(conf->value("viewing/flag_ecliptic_J2000_gr id").toBool());
setFlagGalacticGrid(conf->value("viewing/flag_galactic_grid").toBool ()); setFlagGalacticGrid(conf->value("viewing/flag_galactic_grid").toBool ());
setFlagEquatorLine(conf->value("viewing/flag_equator_line").toBool() ); setFlagEquatorLine(conf->value("viewing/flag_equator_line").toBool() );
setFlagEclipticLine(conf->value("viewing/flag_ecliptic_line").toBool ()); setFlagEclipticLine(conf->value("viewing/flag_ecliptic_line").toBool ());
setFlagMeridianLine(conf->value("viewing/flag_meridian_line").toBool ()); setFlagMeridianLine(conf->value("viewing/flag_meridian_line").toBool ());
setFlagHorizonLine(conf->value("viewing/flag_horizon_line").toBool() ); setFlagHorizonLine(conf->value("viewing/flag_horizon_line").toBool() );
setFlagGalacticPlaneLine(conf->value("viewing/flag_galactic_plane_li ne").toBool()); setFlagGalacticEquatorLine(conf->value("viewing/flag_galactic_equato r_line").toBool());
StelApp& app = StelApp::getInstance(); StelApp& app = StelApp::getInstance();
connect(&app, SIGNAL(colorSchemeChanged(const QString&)), this, SLOT (setStelStyle(const QString&))); connect(&app, SIGNAL(colorSchemeChanged(const QString&)), this, SLOT (setStelStyle(const QString&)));
connect(&app, SIGNAL(languageChanged()), this, SLOT(updateLineLabels ())); connect(&app, SIGNAL(languageChanged()), this, SLOT(updateLineLabels ()));
QString displayGroup = N_("Display Options"); QString displayGroup = N_("Display Options");
addAction("actionShow_Equatorial_Grid", displayGroup, N_("Equatorial grid"), "equatorGridDisplayed", "E"); addAction("actionShow_Equatorial_Grid", displayGroup, N_("Equatorial grid"), "equatorGridDisplayed", "E");
addAction("actionShow_Azimuthal_Grid", displayGroup, N_("Azimuthal g rid"), "azimuthalGridDisplayed", "Z"); addAction("actionShow_Azimuthal_Grid", displayGroup, N_("Azimuthal g rid"), "azimuthalGridDisplayed", "Z");
addAction("actionShow_Ecliptic_Line", displayGroup, N_("Ecliptic lin e"), "eclipticLineDisplayed", ","); addAction("actionShow_Ecliptic_Line", displayGroup, N_("Ecliptic lin e"), "eclipticLineDisplayed", ",");
addAction("actionShow_Equator_Line", displayGroup, N_("Equator line" ), "equatorLineDisplayed", "."); addAction("actionShow_Equator_Line", displayGroup, N_("Equator line" ), "equatorLineDisplayed", ".");
addAction("actionShow_Meridian_Line", displayGroup, N_("Meridian lin e"), "meridianLineDisplayed", ";"); addAction("actionShow_Meridian_Line", displayGroup, N_("Meridian lin e"), "meridianLineDisplayed", ";");
addAction("actionShow_Horizon_Line", displayGroup, N_("Horizon line" ), "horizonLineDisplayed", "H"); addAction("actionShow_Horizon_Line", displayGroup, N_("Horizon line" ), "horizonLineDisplayed", "H");
addAction("actionShow_Equatorial_J2000_Grid", displayGroup, N_("Equa torial J2000 grid"), "equatorJ2000GridDisplayed"); addAction("actionShow_Equatorial_J2000_Grid", displayGroup, N_("Equa torial J2000 grid"), "equatorJ2000GridDisplayed");
addAction("actionShow_Ecliptic_J2000_Grid", displayGroup, N_("Eclipt ic J2000 grid"), "eclipticJ2000GridDisplayed"); addAction("actionShow_Ecliptic_J2000_Grid", displayGroup, N_("Eclipt ic J2000 grid"), "eclipticJ2000GridDisplayed");
addAction("actionShow_Galactic_Grid", displayGroup, N_("Galactic gri d"), "galacticGridDisplayed"); addAction("actionShow_Galactic_Grid", displayGroup, N_("Galactic gri d"), "galacticGridDisplayed");
addAction("actionShow_Galactic_Plane_Line", displayGroup, N_("Galact ic plane"), "galacticPlaneLineDisplayed"); addAction("actionShow_Galactic_Equator_Line", displayGroup, N_("Gala ctic equator"), "galacticEquatorLineDisplayed");
} }
void GridLinesMgr::update(double deltaTime) void GridLinesMgr::update(double deltaTime)
{ {
// Update faders // Update faders
equGrid->update(deltaTime); equGrid->update(deltaTime);
equJ2000Grid->update(deltaTime); equJ2000Grid->update(deltaTime);
eclJ2000Grid->update(deltaTime); eclJ2000Grid->update(deltaTime);
galacticGrid->update(deltaTime); galacticGrid->update(deltaTime);
aziGrid->update(deltaTime); aziGrid->update(deltaTime);
equatorLine->update(deltaTime); equatorLine->update(deltaTime);
eclipticLine->update(deltaTime); eclipticLine->update(deltaTime);
meridianLine->update(deltaTime); meridianLine->update(deltaTime);
horizonLine->update(deltaTime); horizonLine->update(deltaTime);
galacticPlaneLine->update(deltaTime); galacticEquatorLine->update(deltaTime);
} }
void GridLinesMgr::draw(StelCore* core) void GridLinesMgr::draw(StelCore* core)
{ {
equGrid->draw(core); equGrid->draw(core);
galacticGrid->draw(core); galacticGrid->draw(core);
equJ2000Grid->draw(core); equJ2000Grid->draw(core);
eclJ2000Grid->draw(core); eclJ2000Grid->draw(core);
aziGrid->draw(core); aziGrid->draw(core);
equatorLine->draw(core); equatorLine->draw(core);
eclipticLine->draw(core); eclipticLine->draw(core);
meridianLine->draw(core); meridianLine->draw(core);
horizonLine->draw(core); horizonLine->draw(core);
galacticPlaneLine->draw(core); galacticEquatorLine->draw(core);
} }
void GridLinesMgr::setStelStyle(const QString& section) void GridLinesMgr::setStelStyle(const QString& section)
{ {
QSettings* conf = StelApp::getInstance().getSettings(); QSettings* conf = StelApp::getInstance().getSettings();
// Load colors from config file // Load colors from config file
QString defaultColor = conf->value(section+"/default_color").toStrin g(); QString defaultColor = conf->value(section+"/default_color").toStrin g();
setColorEquatorGrid(StelUtils::strToVec3f(conf->value(section+"/equa torial_color", defaultColor).toString())); setColorEquatorGrid(StelUtils::strToVec3f(conf->value(section+"/equa torial_color", defaultColor).toString()));
setColorEquatorJ2000Grid(StelUtils::strToVec3f(conf->value(section+" /equatorial_J2000_color", defaultColor).toString())); setColorEquatorJ2000Grid(StelUtils::strToVec3f(conf->value(section+" /equatorial_J2000_color", defaultColor).toString()));
setColorEclipticJ2000Grid(StelUtils::strToVec3f(conf->value(section+ "/ecliptic_J2000_color", defaultColor).toString())); setColorEclipticJ2000Grid(StelUtils::strToVec3f(conf->value(section+ "/ecliptic_J2000_color", defaultColor).toString()));
setColorGalacticGrid(StelUtils::strToVec3f(conf->value(section+"/gal actic_color", defaultColor).toString())); setColorGalacticGrid(StelUtils::strToVec3f(conf->value(section+"/gal actic_color", defaultColor).toString()));
setColorAzimuthalGrid(StelUtils::strToVec3f(conf->value(section+"/az imuthal_color", defaultColor).toString())); setColorAzimuthalGrid(StelUtils::strToVec3f(conf->value(section+"/az imuthal_color", defaultColor).toString()));
setColorEquatorLine(StelUtils::strToVec3f(conf->value(section+"/equa tor_color", defaultColor).toString())); setColorEquatorLine(StelUtils::strToVec3f(conf->value(section+"/equa tor_color", defaultColor).toString()));
setColorEclipticLine(StelUtils::strToVec3f(conf->value(section+"/ecl iptic_color", defaultColor).toString())); setColorEclipticLine(StelUtils::strToVec3f(conf->value(section+"/ecl iptic_color", defaultColor).toString()));
setColorMeridianLine(StelUtils::strToVec3f(conf->value(section+"/mer idian_color", defaultColor).toString())); setColorMeridianLine(StelUtils::strToVec3f(conf->value(section+"/mer idian_color", defaultColor).toString()));
setColorHorizonLine(StelUtils::strToVec3f(conf->value(section+"/hori zon_color", defaultColor).toString())); setColorHorizonLine(StelUtils::strToVec3f(conf->value(section+"/hori zon_color", defaultColor).toString()));
setColorGalacticPlaneLine(StelUtils::strToVec3f(conf->value(section+ "/galactic_plane_color", defaultColor).toString())); setColorGalacticEquatorLine(StelUtils::strToVec3f(conf->value(sectio n+"/galactic_equator_color", defaultColor).toString()));
} }
void GridLinesMgr::updateLineLabels() void GridLinesMgr::updateLineLabels()
{ {
equatorLine->updateLabel(); equatorLine->updateLabel();
eclipticLine->updateLabel(); eclipticLine->updateLabel();
meridianLine->updateLabel(); meridianLine->updateLabel();
horizonLine->updateLabel(); horizonLine->updateLabel();
galacticPlaneLine->updateLabel(); galacticEquatorLine->updateLabel();
} }
//! Set flag for displaying Azimuthal Grid //! Set flag for displaying Azimuthal Grid
void GridLinesMgr::setFlagAzimuthalGrid(const bool displayed) void GridLinesMgr::setFlagAzimuthalGrid(const bool displayed)
{ {
if(displayed != aziGrid->isDisplayed()) { if(displayed != aziGrid->isDisplayed()) {
aziGrid->setDisplayed(displayed); aziGrid->setDisplayed(displayed);
emit azimuthalGridDisplayedChanged(displayed); emit azimuthalGridDisplayedChanged(displayed);
} }
} }
skipping to change at line 986 skipping to change at line 1018
return horizonLine->getColor(); return horizonLine->getColor();
} }
void GridLinesMgr::setColorHorizonLine(const Vec3f& newColor) void GridLinesMgr::setColorHorizonLine(const Vec3f& newColor)
{ {
if(newColor != horizonLine->getColor()) { if(newColor != horizonLine->getColor()) {
horizonLine->setColor(newColor); horizonLine->setColor(newColor);
emit horizonLineColorChanged(newColor); emit horizonLineColorChanged(newColor);
} }
} }
//! Set flag for displaying GalacticPlane Line //! Set flag for displaying Galactic Equator Line
void GridLinesMgr::setFlagGalacticPlaneLine(const bool displayed) void GridLinesMgr::setFlagGalacticEquatorLine(const bool displayed)
{ {
if(displayed != galacticPlaneLine->isDisplayed()) { if(displayed != galacticEquatorLine->isDisplayed()) {
galacticPlaneLine->setDisplayed(displayed); galacticEquatorLine->setDisplayed(displayed);
emit galacticPlaneLineDisplayedChanged(displayed); emit galacticEquatorLineDisplayedChanged(displayed);
} }
} }
//! Get flag for displaying GalacticPlane Line //! Get flag for displaying Galactic Equator Line
bool GridLinesMgr::getFlagGalacticPlaneLine(void) const bool GridLinesMgr::getFlagGalacticEquatorLine(void) const
{ {
return galacticPlaneLine->isDisplayed(); return galacticEquatorLine->isDisplayed();
} }
Vec3f GridLinesMgr::getColorGalacticPlaneLine(void) const Vec3f GridLinesMgr::getColorGalacticEquatorLine(void) const
{ {
return galacticPlaneLine->getColor(); return galacticEquatorLine->getColor();
} }
void GridLinesMgr::setColorGalacticPlaneLine(const Vec3f& newColor) void GridLinesMgr::setColorGalacticEquatorLine(const Vec3f& newColor)
{ {
if(newColor != galacticPlaneLine->getColor()) { if(newColor != galacticEquatorLine->getColor()) {
galacticPlaneLine->setColor(newColor); galacticEquatorLine->setColor(newColor);
emit galacticPlaneLineColorChanged(newColor); emit galacticEquatorLineColorChanged(newColor);
} }
} }
 End of changes. 40 change blocks. 
95 lines changed or deleted 135 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/