ArchaeoLines.cpp   ArchaeoLines.cpp 
skipping to change at line 40 skipping to change at line 40
#include "StelVertexArray.hpp" #include "StelVertexArray.hpp"
#include "ArchaeoLines.hpp" #include "ArchaeoLines.hpp"
#include "ArchaeoLinesDialog.hpp" #include "ArchaeoLinesDialog.hpp"
#include "SolarSystem.hpp" #include "SolarSystem.hpp"
#include "Planet.hpp" #include "Planet.hpp"
#include <QDebug> #include <QDebug>
#include <QTimer> #include <QTimer>
#include <QPixmap> #include <QPixmap>
#include <QColor> #include <QColor>
#include <QtNetwork>
#include <QSettings> #include <QSettings>
#include <QMouseEvent> #include <QMouseEvent>
#include <cmath> #include <cmath>
//! This method is the one called automatically by the StelModuleMgr just //! This method is the one called automatically by the StelModuleMgr just
//! after loading the dynamic library //! after loading the dynamic library
StelModule* ArchaeoLinesStelPluginInterface::getStelModule() const StelModule* ArchaeoLinesStelPluginInterface::getStelModule() const
{ {
return new ArchaeoLines(); return new ArchaeoLines();
} }
skipping to change at line 225 skipping to change at line 224
// if (!conf->childGroups().contains("ArchaeoLines")) // if (!conf->childGroups().contains("ArchaeoLines"))
// restoreDefaultSettings(); // restoreDefaultSettings();
loadSettings(); loadSettings();
StelApp& app = StelApp::getInstance(); StelApp& app = StelApp::getInstance();
// Create action for enable/disable & hook up signals // Create action for enable/disable & hook up signals
QString section=N_("ArchaeoLines"); QString section=N_("ArchaeoLines");
addAction("actionShow_Archaeo_Lines", section, N_("ArchaeoLines"), " addAction("actionShow_ArchaeoLines", section, N_("ArchaeoLin
enabled", "Ctrl+U"); es"), "enabled", "Ctrl+U");
addAction("actionShow_ArchaeoLines_dialog", section, N_("Show setti
ngs dialog"), configDialog, "visible", "Ctrl+Shift+U");
// Add a toolbar button // Add a toolbar button
try try
{ {
StelGui* gui = dynamic_cast<StelGui*>(app.getGui()); StelGui* gui = dynamic_cast<StelGui*>(app.getGui());
if (gui!=NULL) if (gui!=NULL)
{ {
toolbarButton = new StelButton(NULL, toolbarButton = new StelButton(NULL,
QPixmap(":/archaeoLin es/bt_archaeolines_on.png"), QPixmap(":/archaeoLin es/bt_archaeolines_on.png"),
QPixmap(":/archaeoLin es/bt_archaeolines_off.png"), QPixmap(":/archaeoLin es/bt_archaeolines_off.png"),
QPixmap(":/graphicGui /glow32x32.png"), QPixmap(":/graphicGui /glow32x32.png"),
"actionShow_Archaeo_L ines"); "actionShow_ArchaeoLi nes");
gui->getButtonBar()->addButton(toolbarButton, "065-p luginsGroup"); gui->getButtonBar()->addButton(toolbarButton, "065-p luginsGroup");
} }
} }
catch (std::runtime_error& e) catch (std::runtime_error& e)
{ {
qWarning() << "WARNING: unable to create toolbar button for ArchaeoLines plugin: " << e.what(); qWarning() << "WARNING: unable to create toolbar button for ArchaeoLines plugin: " << e.what();
} }
addAction("actionAL_showEquinoxLine", section, N_("Show Lin e for Equinox"), "flagShowEquinox" ); // No Shortcuts co nfigured. addAction("actionAL_showEquinoxLine", section, N_("Show Lin e for Equinox"), "flagShowEquinox" ); // No Shortcuts co nfigured.
addAction("actionAL_showSolsticeLines", section, N_("Show Lin e for Solstices"), "flagShowSolstices" ); // No Shortcuts co nfigured. addAction("actionAL_showSolsticeLines", section, N_("Show Lin e for Solstices"), "flagShowSolstices" ); // No Shortcuts co nfigured.
addAction("actionAL_showCrossquarterLines", section, N_("Show Lin e for Crossquarter"), "flagShowCrossquarters" ); // No Shortcuts co nfigured. addAction("actionAL_showCrossquarterLines", section, N_("Show Lin e for Crossquarter"), "flagShowCrossquarters" ); // No Shortcuts co nfigured.
skipping to change at line 662 skipping to change at line 662
if (b!=flagShowCurrentMoon) if (b!=flagShowCurrentMoon)
{ {
flagShowCurrentMoon=b; flagShowCurrentMoon=b;
conf->setValue("ArchaeoLines/show_current_moon", isCur rentMoonDisplayed()); conf->setValue("ArchaeoLines/show_current_moon", isCur rentMoonDisplayed());
currentMoonLine->setDisplayed(b); currentMoonLine->setDisplayed(b);
emit showCurrentMoonChanged(b); emit showCurrentMoonChanged(b);
} }
} }
void ArchaeoLines::showCurrentPlanet(ArchaeoLine::Line l) void ArchaeoLines::showCurrentPlanet(ArchaeoLine::Line l)
{ {
// Avoid a crash but give warning.
if ((l<ArchaeoLine::CurrentPlanetNone) || (l>ArchaeoLine::CurrentPla
netSaturn))
{
qWarning() << "ArchaeoLines::showCurrentPlanet: Invalid plan
et called:" << l << "Setting to none.";
l=ArchaeoLine::CurrentPlanetNone;
}
if(l!=enumShowCurrentPlanet) if(l!=enumShowCurrentPlanet)
{ {
enumShowCurrentPlanet=l; enumShowCurrentPlanet=l;
const char *planetStrings[]={"none", "Mercury", "Venus", "Ma rs", "Jupiter", "Saturn"}; const char *planetStrings[]={"none", "Mercury", "Venus", "Ma rs", "Jupiter", "Saturn"};
conf->setValue("ArchaeoLines/show_current_planet", planetStr ings[l-ArchaeoLine::CurrentPlanetNone]); conf->setValue("ArchaeoLines/show_current_planet", planetStr ings[l-ArchaeoLine::CurrentPlanetNone]);
currentPlanetLine->setLineType(enumShowCurrentPlanet); currentPlanetLine->setLineType(enumShowCurrentPlanet);
currentPlanetLine->setDisplayed(enumShowCurrentPlanet != Arc haeoLine::CurrentPlanetNone); currentPlanetLine->setDisplayed(enumShowCurrentPlanet != Arc haeoLine::CurrentPlanetNone);
emit currentPlanetChanged(l); emit currentPlanetChanged(l);
skipping to change at line 1221 skipping to change at line 1227
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.)
{ {
angleDeg+=180.; angleDeg+=180.;
xshift=-d->sPainter->getFontMetrics().width(text)-6.f; xshift=-d->sPainter->getFontMetrics().width(text)-6.f;
} }
d->sPainter->drawText(screenPos[0], screenPos[1], text, angleDeg, xs hift, 3); d->sPainter->drawText(screenPos[0], screenPos[1], text, angleDeg, xs hift, 3);
//d->sPainter->setColor(tmpColor[0], tmpColor[1], tmpColor[2], tmpCo lor[3]); // RESTORE //d->sPainter->setColor(tmpColor[0], tmpColor[1], tmpColor[2], tmpCo lor[3]); // RESTORE
glDisable(GL_TEXTURE_2D); d->sPainter->setBlending(true);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
} }
ArchaeoLine::ArchaeoLine(ArchaeoLine::Line lineType, double definingAngle) : ArchaeoLine::ArchaeoLine(ArchaeoLine::Line lineType, double definingAngle) :
lineType(lineType), definingAngle(definingAngle), color(0.f, 0.f, 1. f), frameType(StelCore::FrameEquinoxEqu), flagLabel(true) lineType(lineType), definingAngle(definingAngle), color(0.f, 0.f, 1. f), frameType(StelCore::FrameEquinoxEqu), flagLabel(true)
{ {
if (lineType>=GeographicLocation1) if (lineType>=GeographicLocation1)
frameType=StelCore::FrameAltAz; frameType=StelCore::FrameAltAz;
// Font size is 14 // Font size is 14
font.setPixelSize(StelApp::getInstance().getBaseFontSize()+1); font.setPixelSize(StelApp::getInstance().getBaseFontSize()+1);
updateLabel(); updateLabel();
skipping to change at line 1319 skipping to change at line 1323
if (intensity*fader.getInterstate() < 0.000001f) if (intensity*fader.getInterstate() < 0.000001f)
return; return;
StelProjectorP prj = core->getProjection(frameType, StelCore::Refrac tionAuto); StelProjectorP prj = core->getProjection(frameType, StelCore::Refrac tionAuto);
// Get the bounding halfspace // Get the bounding halfspace
const SphericalCap& viewPortSphericalCap = prj->getBoundingCap(); const SphericalCap& viewPortSphericalCap = prj->getBoundingCap();
// Initialize a painter and set OpenGL state // Initialize a painter and set OpenGL state
StelPainter sPainter(prj); StelPainter sPainter(prj);
glEnable(GL_BLEND); sPainter.setBlending(true);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Normal transpa sPainter.setLineSmooth(true);
rency mode
glDisable(GL_TEXTURE_2D);
// OpenGL ES 2.0 doesn't have GL_LINE_SMOOTH
#ifdef GL_LINE_SMOOTH
if (QOpenGLContext::currentContext()->format().renderableType()==QSu
rfaceFormat::OpenGL)
glEnable(GL_LINE_SMOOTH);
#endif
sPainter.setColor(color[0], color[1], color[2], intensity*fader.getI nterstate()); sPainter.setColor(color[0], color[1], color[2], intensity*fader.getI nterstate());
//Vec4f textColor(color[0], color[1], color[2], intensity*fader.getI nterstate()); //Vec4f textColor(color[0], color[1], color[2], intensity*fader.getI nterstate());
ALViewportEdgeIntersectCallbackData userData(&sPainter); ALViewportEdgeIntersectCallbackData userData(&sPainter);
sPainter.setFont(font); sPainter.setFont(font);
//userData.textColor = textColor; //userData.textColor = textColor;
userData.text = (isLabelVisible() ? label : ""); userData.text = (isLabelVisible() ? label : "");
///////////////////////////////////////////////// /////////////////////////////////////////////////
// Azimuth lines are Great Semicircles. TODO: Make sure the code com mented away below is OK in all cases, then cleanup if full circles are neve r required. // Azimuth lines are Great Semicircles. TODO: Make sure the code com mented away below is OK in all cases, then cleanup if full circles are neve r required.
if (lineType>=ArchaeoLine::GeographicLocation1) if (lineType>=ArchaeoLine::GeographicLocation1)
skipping to change at line 1414 skipping to change at line 1410
const double lon1=0.0; const double lon1=0.0;
const double lon2=120.0*M_PI/180.0; const double lon2=120.0*M_PI/180.0;
const double lon3=240.0*M_PI/180.0; const double lon3=240.0*M_PI/180.0;
StelUtils::spheToRect(lon1, lat, pt1); pt1.normalize (); StelUtils::spheToRect(lon1, lat, pt1); pt1.normalize ();
StelUtils::spheToRect(lon2, lat, pt2); pt2.normalize (); StelUtils::spheToRect(lon2, lat, pt2); pt2.normalize ();
StelUtils::spheToRect(lon3, lat, pt3); pt3.normalize (); StelUtils::spheToRect(lon3, lat, pt3); pt3.normalize ();
sPainter.drawSmallCircleArc(pt1, pt2, rotCenter, alV iewportEdgeIntersectCallback, &userData); sPainter.drawSmallCircleArc(pt1, pt2, rotCenter, alV iewportEdgeIntersectCallback, &userData);
sPainter.drawSmallCircleArc(pt2, pt3, rotCenter, alV iewportEdgeIntersectCallback, &userData); sPainter.drawSmallCircleArc(pt2, pt3, rotCenter, alV iewportEdgeIntersectCallback, &userData);
sPainter.drawSmallCircleArc(pt3, pt1, rotCenter, alV iewportEdgeIntersectCallback, &userData); sPainter.drawSmallCircleArc(pt3, pt1, rotCenter, alV iewportEdgeIntersectCallback, &userData);
#ifdef GL_LINE_SMOOTH
if (QOpenGLContext::currentContext()->format().rende
rableType()==QSurfaceFormat::OpenGL)
glDisable(GL_LINE_SMOOTH);
#endif
glDisable(GL_BLEND);
return;
}
else
{
#ifdef GL_LINE_SMOOTH
if (QOpenGLContext::currentContext()->format().rende
rableType()==QSurfaceFormat::OpenGL)
glDisable(GL_LINE_SMOOTH);
#endif
glDisable(GL_BLEND);
return;
} }
sPainter.setLineSmooth(false);
sPainter.setBlending(false);
return;
} }
// Draw the arc in 2 sub-arcs to avoid lengths > 180 deg // Draw the arc in 2 sub-arcs to avoid lengths > 180 deg
Vec3d middlePoint = p1-rotCenter+p2-rotCenter; Vec3d middlePoint = p1-rotCenter+p2-rotCenter;
middlePoint.normalize(); middlePoint.normalize();
middlePoint*=(p1-rotCenter).length(); middlePoint*=(p1-rotCenter).length();
middlePoint+=rotCenter; middlePoint+=rotCenter;
if (!viewPortSphericalCap.contains(middlePoint)) if (!viewPortSphericalCap.contains(middlePoint))
{ {
middlePoint-=rotCenter; middlePoint-=rotCenter;
middlePoint*=-1.; middlePoint*=-1.;
middlePoint+=rotCenter; middlePoint+=rotCenter;
} }
sPainter.drawSmallCircleArc(p1, middlePoint, rotCenter,alViewportEdg eIntersectCallback, &userData); sPainter.drawSmallCircleArc(p1, middlePoint, rotCenter,alViewportEdg eIntersectCallback, &userData);
sPainter.drawSmallCircleArc(p2, middlePoint, rotCenter, alViewportEd geIntersectCallback, &userData); sPainter.drawSmallCircleArc(p2, middlePoint, rotCenter, alViewportEd geIntersectCallback, &userData);
// OpenGL ES 2.0 doesn't have GL_LINE_SMOOTH sPainter.setLineSmooth(false);
#ifdef GL_LINE_SMOOTH sPainter.setBlending(false);
if (QOpenGLContext::currentContext()->format().renderableType()==QSu
rfaceFormat::OpenGL)
glDisable(GL_LINE_SMOOTH);
#endif
glDisable(GL_BLEND);
} }
 End of changes. 9 change blocks. 
44 lines changed or deleted 22 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/