ArchaeoLines.cpp   ArchaeoLines.cpp 
skipping to change at line 69 skipping to change at line 69
info.displayedName = N_("ArchaeoLines"); info.displayedName = N_("ArchaeoLines");
info.authors = "Georg Zotti"; info.authors = "Georg Zotti";
info.contact = "http://homepage.univie.ac.at/Georg.Zotti"; info.contact = "http://homepage.univie.ac.at/Georg.Zotti";
info.description = N_("A tool for archaeo-/ethnoastronomical alignme nt studies"); info.description = N_("A tool for archaeo-/ethnoastronomical alignme nt studies");
info.version = ARCHAEOLINES_VERSION; info.version = ARCHAEOLINES_VERSION;
return info; return info;
} }
ArchaeoLines::ArchaeoLines() ArchaeoLines::ArchaeoLines()
: flagShowArchaeoLines(false) : flagShowArchaeoLines(false)
, withDecimalDegree(false) //, withDecimalDegree(false)
, flagUseDmsFormat(false) //, flagUseDmsFormat(false)
, flagShowEquinox(false) , flagShowEquinox(false)
, flagShowSolstices(false) , flagShowSolstices(false)
, flagShowCrossquarters(false) , flagShowCrossquarters(false)
, flagShowMajorStandstills(false) , flagShowMajorStandstills(false)
, flagShowMinorStandstills(false) , flagShowMinorStandstills(false)
, flagShowZenithPassage(false) , flagShowZenithPassage(false)
, flagShowNadirPassage(false) , flagShowNadirPassage(false)
, flagShowSelectedObject(false) , flagShowSelectedObject(false)
, flagShowCurrentSun(false) , flagShowCurrentSun(false)
, flagShowCurrentMoon(false) , flagShowCurrentMoon(false)
, enumShowCurrentPlanet(ArchaeoLine::CurrentPlanetNone) , enumShowCurrentPlanet(ArchaeoLine::CurrentPlanetNone)
, flagShowGeographicLocation1(false)
, geographicLocation1Longitude(39.8) // approx. Mecca
, geographicLocation1Latitude(21.4)
, flagShowGeographicLocation2(false)
, geographicLocation2Longitude(35.2) // approx. Jerusalem
, geographicLocation2Latitude(31.8)
, flagShowCustomAzimuth1(false)
, flagShowCustomAzimuth2(false)
//, customAzimuth1(0.0)
//, customAzimuth2(0.0)
, lastJDE(0.0) , lastJDE(0.0)
, toolbarButton(NULL) , toolbarButton(NULL)
{ {
setObjectName("ArchaeoLines"); setObjectName("ArchaeoLines");
font.setPixelSize(16); font.setPixelSize(16);
core=StelApp::getInstance().getCore(); core=StelApp::getInstance().getCore();
Q_ASSERT(core); Q_ASSERT(core);
objMgr=GETSTELMODULE(StelObjectMgr); objMgr=GETSTELMODULE(StelObjectMgr);
Q_ASSERT(objMgr); Q_ASSERT(objMgr);
// optimize readabiity so that each upper line of the lunistice doub les is labeled. // optimize readability so that each upper line of the lunistice dou bles is labeled.
equinoxLine = new ArchaeoLine(ArchaeoLine::Equinox, 0.0); equinoxLine = new ArchaeoLine(ArchaeoLine::Equinox, 0.0);
northernSolsticeLine = new ArchaeoLine(ArchaeoLine::Solstices, 23.50 ); northernSolsticeLine = new ArchaeoLine(ArchaeoLine::Solstices, 23.50 );
southernSolsticeLine = new ArchaeoLine(ArchaeoLine::Solstices, -23.5 0); southernSolsticeLine = new ArchaeoLine(ArchaeoLine::Solstices, -23.5 0);
northernCrossquarterLine = new ArchaeoLine(ArchaeoLine::Crossquarter s, 16.50); northernCrossquarterLine = new ArchaeoLine(ArchaeoLine::Crossquarter s, 16.50);
southernCrossquarterLine = new ArchaeoLine(ArchaeoLine::Crossquarter s, -16.50); southernCrossquarterLine = new ArchaeoLine(ArchaeoLine::Crossquarter s, -16.50);
northernMajorStandstillLine0 = new ArchaeoLine(ArchaeoLine::MajorSta ndstill, 23.5+5.1); northernMajorStandstillLine0 = new ArchaeoLine(ArchaeoLine::MajorSta ndstill, 23.5+5.1);
northernMajorStandstillLine1 = new ArchaeoLine(ArchaeoLine::MajorSta ndstill, 23.5+5.1); northernMajorStandstillLine1 = new ArchaeoLine(ArchaeoLine::MajorSta ndstill, 23.5+5.1);
northernMajorStandstillLine0->setLabelVisible(false); northernMajorStandstillLine0->setLabelVisible(false);
northernMinorStandstillLine2 = new ArchaeoLine(ArchaeoLine::MinorSta ndstill, 23.5-5.1); northernMinorStandstillLine2 = new ArchaeoLine(ArchaeoLine::MinorSta ndstill, 23.5-5.1);
northernMinorStandstillLine3 = new ArchaeoLine(ArchaeoLine::MinorSta ndstill, 23.5-5.1); northernMinorStandstillLine3 = new ArchaeoLine(ArchaeoLine::MinorSta ndstill, 23.5-5.1);
skipping to change at line 116 skipping to change at line 126
southernMinorStandstillLine4->setLabelVisible(false); southernMinorStandstillLine4->setLabelVisible(false);
southernMajorStandstillLine6 = new ArchaeoLine(ArchaeoLine::MajorSta ndstill, -23.5-5.1); southernMajorStandstillLine6 = new ArchaeoLine(ArchaeoLine::MajorSta ndstill, -23.5-5.1);
southernMajorStandstillLine7 = new ArchaeoLine(ArchaeoLine::MajorSta ndstill, -23.5-5.1); southernMajorStandstillLine7 = new ArchaeoLine(ArchaeoLine::MajorSta ndstill, -23.5-5.1);
southernMajorStandstillLine6->setLabelVisible(false); southernMajorStandstillLine6->setLabelVisible(false);
zenithPassageLine = new ArchaeoLine(ArchaeoLine::ZenithPassage, 48. 0); zenithPassageLine = new ArchaeoLine(ArchaeoLine::ZenithPassage, 48. 0);
nadirPassageLine = new ArchaeoLine(ArchaeoLine::NadirPassage, 42.0 ); nadirPassageLine = new ArchaeoLine(ArchaeoLine::NadirPassage, 42.0 );
selectedObjectLine = new ArchaeoLine(ArchaeoLine::SelectedObject, 0. 0); selectedObjectLine = new ArchaeoLine(ArchaeoLine::SelectedObject, 0. 0);
currentSunLine = new ArchaeoLine(ArchaeoLine::CurrentSun, 0.0); currentSunLine = new ArchaeoLine(ArchaeoLine::CurrentSun, 0.0);
currentMoonLine = new ArchaeoLine(ArchaeoLine::CurrentMoon, 0.0); currentMoonLine = new ArchaeoLine(ArchaeoLine::CurrentMoon, 0.0);
currentPlanetLine = new ArchaeoLine(ArchaeoLine::CurrentPlanetNone, 0.0); currentPlanetLine = new ArchaeoLine(ArchaeoLine::CurrentPlanetNone, 0.0);
geographicLocation1Line = new ArchaeoLine(ArchaeoLine::GeographicLoc
ation1, 0.0);
geographicLocation2Line = new ArchaeoLine(ArchaeoLine::GeographicLoc
ation2, 0.0);
customAzimuth1Line = new ArchaeoLine(ArchaeoLine::CustomAzimuth1, 0.
0);
customAzimuth2Line = new ArchaeoLine(ArchaeoLine::CustomAzimuth2, 0.
0);
configDialog = new ArchaeoLinesDialog(); configDialog = new ArchaeoLinesDialog();
conf = StelApp::getInstance().getSettings(); conf = StelApp::getInstance().getSettings();
connect(core, SIGNAL(locationChanged(StelLocation)), this, SLOT(upda
teObserverLocation(StelLocation)));
} }
ArchaeoLines::~ArchaeoLines() ArchaeoLines::~ArchaeoLines()
{ {
delete equinoxLine; equinoxLine=NULL; delete equinoxLine; equinoxLine=NULL;
delete northernSolsticeLine; northernSolsticeLine=NULL; delete northernSolsticeLine; northernSolsticeLine=NULL;
delete southernSolsticeLine; southernSolsticeLine=NULL; delete southernSolsticeLine; southernSolsticeLine=NULL;
delete northernCrossquarterLine; northernCrossquarterLine=NULL; delete northernCrossquarterLine; northernCrossquarterLine=NULL;
delete southernCrossquarterLine; southernCrossquarterLine=NULL; delete southernCrossquarterLine; southernCrossquarterLine=NULL;
delete northernMajorStandstillLine0; northernMajorStandstillLine0=NU LL; delete northernMajorStandstillLine0; northernMajorStandstillLine0=NU LL;
skipping to change at line 142 skipping to change at line 159
delete southernMinorStandstillLine4; southernMinorStandstillLine4=NU LL; delete southernMinorStandstillLine4; southernMinorStandstillLine4=NU LL;
delete southernMinorStandstillLine5; southernMinorStandstillLine5=NU LL; delete southernMinorStandstillLine5; southernMinorStandstillLine5=NU LL;
delete southernMajorStandstillLine6; southernMajorStandstillLine6=NU LL; delete southernMajorStandstillLine6; southernMajorStandstillLine6=NU LL;
delete southernMajorStandstillLine7; southernMajorStandstillLine7=NU LL; delete southernMajorStandstillLine7; southernMajorStandstillLine7=NU LL;
delete zenithPassageLine; zenithPassageLine=NULL; delete zenithPassageLine; zenithPassageLine=NULL;
delete nadirPassageLine; nadirPassageLine=NULL; delete nadirPassageLine; nadirPassageLine=NULL;
delete selectedObjectLine; selectedObjectLine=NULL; delete selectedObjectLine; selectedObjectLine=NULL;
delete currentSunLine; currentSunLine=NULL; delete currentSunLine; currentSunLine=NULL;
delete currentMoonLine; currentMoonLine=NULL; delete currentMoonLine; currentMoonLine=NULL;
delete currentPlanetLine; currentPlanetLine=NULL; delete currentPlanetLine; currentPlanetLine=NULL;
delete geographicLocation1Line; geographicLocation1Line=NULL;
delete geographicLocation2Line; geographicLocation2Line=NULL;
delete customAzimuth1Line; customAzimuth1Line=NULL;
delete customAzimuth2Line; customAzimuth2Line=NULL;
delete configDialog; configDialog=NULL; delete configDialog; configDialog=NULL;
} }
bool ArchaeoLines::configureGui(bool show) bool ArchaeoLines::configureGui(bool show)
{ {
if (show) if (show)
configDialog->setVisible(true); configDialog->setVisible(true);
return true; return true;
} }
skipping to change at line 182 skipping to change at line 203
Q_ASSERT(southernMinorStandstillLine4); Q_ASSERT(southernMinorStandstillLine4);
Q_ASSERT(southernMinorStandstillLine5); Q_ASSERT(southernMinorStandstillLine5);
Q_ASSERT(southernMajorStandstillLine6); Q_ASSERT(southernMajorStandstillLine6);
Q_ASSERT(southernMajorStandstillLine7); Q_ASSERT(southernMajorStandstillLine7);
Q_ASSERT(zenithPassageLine); Q_ASSERT(zenithPassageLine);
Q_ASSERT(nadirPassageLine); Q_ASSERT(nadirPassageLine);
Q_ASSERT(selectedObjectLine); Q_ASSERT(selectedObjectLine);
Q_ASSERT(currentSunLine); Q_ASSERT(currentSunLine);
Q_ASSERT(currentMoonLine); Q_ASSERT(currentMoonLine);
Q_ASSERT(currentPlanetLine); Q_ASSERT(currentPlanetLine);
Q_ASSERT(geographicLocation1Line);
Q_ASSERT(geographicLocation2Line);
Q_ASSERT(customAzimuth1Line);
Q_ASSERT(customAzimuth2Line);
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
addAction("actionShow_Archaeo_Lines", N_("ArchaeoLines"), N_("Archae QString section=N_("ArchaeoLines");
oLines"), "enabled", "Ctrl+U"); addAction("actionShow_Archaeo_Lines", section, N_("ArchaeoLines"), "
enabled", "Ctrl+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_Archaeo_L ines");
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_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_showMajorStandstillLines", section, N_("Show Lin
e for Major Standstill"), "flagShowMajorStandstills"); // No Shortcuts co
nfigured.
addAction("actionAL_showMinorStandstillLines", section, N_("Show Lin
e for Minor Standstill"), "flagShowMinorStandstills"); // No Shortcuts co
nfigured.
addAction("actionAL_showZenithPassageLine", section, N_("Show Lin
e for Zenith Passage"), "flagShowZenithPassage" ); // No Shortcuts co
nfigured.
addAction("actionAL_showNadirPassageLine", section, N_("Show Lin
e for Nadir Passage"), "flagShowNadirPassage" ); // No Shortcuts co
nfigured.
addAction("actionAL_showSelectedObjectLine", section, N_("Show Lin
e for Selected Object"), "flagShowSelectedObject" ); // No Shortcuts co
nfigured.
addAction("actionAL_showCurrentSunLine", section, N_("Show Lin
e for Current Sun"), "flagShowCurrentSun" ); // No Shortcuts co
nfigured.
addAction("actionAL_showCurrentMoonLine", section, N_("Show Lin
e for Current Moon"), "flagShowCurrentMoon" ); // No Shortcuts co
nfigured.
addAction("actionAL_showGeographicLocation1Line", section, N_("Sho
w Line for Geographic Location 1"), "flagShowGeographicLocation1" ); //
No Shortcuts configured.
addAction("actionAL_showGeographicLocation2Line", section, N_("Sho
w Line for Geographic Location 2"), "flagShowGeographicLocation2" ); //
No Shortcuts configured.
addAction("actionAL_showCustomAzimuth1Line", section, N_("Show Lin
e for Custom Azimuth 1"), "flagShowCustomAzimuth1" ); // No Shortcuts co
nfigured.
addAction("actionAL_showCustomAzimuth2Line", section, N_("Show Lin
e for Custom Azimuth 2"), "flagShowCustomAzimuth2" ); // No Shortcuts co
nfigured.
} }
void ArchaeoLines::update(double deltaTime) void ArchaeoLines::update(double deltaTime)
{ {
if (core->getCurrentPlanet()->getEnglishName()!="Earth") if (core->getCurrentPlanet()->getEnglishName()!="Earth")
return; return;
static SolarSystem *ssystem=GETSTELMODULE(SolarSystem); static SolarSystem *ssystem=GETSTELMODULE(SolarSystem);
static const double lunarI=5.145396; // inclination of lunar orbit static const double lunarI=5.145396; // inclination of lunar orbit
// compute min and max distance values for horizontal parallax. // compute min and max distance values for horizontal parallax.
skipping to change at line 235 skipping to change at line 275
16.675+12.831+10.445+11.650+14.403+7.003+10.056+6.32 2+9.884; 16.675+12.831+10.445+11.650+14.403+7.003+10.056+6.32 2+9.884;
static const double minDist=meanDist-addedValues; static const double minDist=meanDist-addedValues;
static const double maxDist=meanDist+addedValues; static const double maxDist=meanDist+addedValues;
static const double sinPiMin=6378.14/maxDist; static const double sinPiMin=6378.14/maxDist;
static const double sinPiMax=6378.14/minDist; // maximal parallax at min. distance! static const double sinPiMax=6378.14/minDist; // maximal parallax at min. distance!
static double eps; static double eps;
PlanetP planet=ssystem->getSun(); PlanetP planet=ssystem->getSun();
double dec_equ, ra_equ; double dec_equ, ra_equ;
StelUtils::rectToSphe(&ra_equ,&dec_equ,planet->getEquinoxEquatorialP os(core)); StelUtils::rectToSphe(&ra_equ,&dec_equ,planet->getEquinoxEquatorialP os(core));
currentSunLine->setDeclination(dec_equ * 180.0/M_PI); currentSunLine->setDefiningAngle(dec_equ * 180.0/M_PI);
planet=ssystem->getMoon(); planet=ssystem->getMoon();
StelUtils::rectToSphe(&ra_equ,&dec_equ,planet->getEquinoxEquatorialP os(core)); StelUtils::rectToSphe(&ra_equ,&dec_equ,planet->getEquinoxEquatorialP os(core));
currentMoonLine->setDeclination(dec_equ * 180.0/M_PI); currentMoonLine->setDefiningAngle(dec_equ * 180.0/M_PI);
if (enumShowCurrentPlanet>ArchaeoLine::CurrentPlanetNone) if (enumShowCurrentPlanet>ArchaeoLine::CurrentPlanetNone)
{ {
const char *planetStrings[]={"", "Mercury", "Venus", "Mars", "Jupiter", "Saturn"}; const char *planetStrings[]={"", "Mercury", "Venus", "Mars", "Jupiter", "Saturn"};
QString currentPlanet(planetStrings[enumShowCurrentPlanet - ArchaeoLine::CurrentPlanetNone]); QString currentPlanet(planetStrings[enumShowCurrentPlanet - ArchaeoLine::CurrentPlanetNone]);
planet=ssystem->searchByEnglishName(currentPlanet); planet=ssystem->searchByEnglishName(currentPlanet);
Q_ASSERT(planet); Q_ASSERT(planet);
StelUtils::rectToSphe(&ra_equ,&dec_equ,planet->getEquinoxEqu atorialPos(core)); StelUtils::rectToSphe(&ra_equ,&dec_equ,planet->getEquinoxEqu atorialPos(core));
currentPlanetLine->setDeclination(dec_equ * 180.0/M_PI); currentPlanetLine->setDefiningAngle(dec_equ * 180.0/M_PI);
} }
double newJDE=core->getJDE(); double newJDE=core->getJDE();
if (fabs(newJDE-lastJDE) > 10.0) // enough to compute this every 10 days? if (fabs(newJDE-lastJDE) > 10.0) // enough to compute this every 10 days?
{ {
eps= ssystem->getEarth()->getRotObliquity(newJDE) *180.0/M_P I; eps= ssystem->getEarth()->getRotObliquity(newJDE) *180.0/M_P I;
static const double invSqrt2=1.0/std::sqrt(2.0); static const double invSqrt2=1.0/std::sqrt(2.0);
northernSolsticeLine->setDeclination( eps); northernSolsticeLine->setDefiningAngle(eps);
southernSolsticeLine->setDeclination(-eps); southernSolsticeLine->setDefiningAngle(-eps);
northernCrossquarterLine->setDeclination( eps*invSqrt2); northernCrossquarterLine->setDefiningAngle( eps*invSqrt2);
southernCrossquarterLine->setDeclination(-eps*invSqrt2); southernCrossquarterLine->setDefiningAngle(-eps*invSqrt2);
lastJDE=newJDE; lastJDE=newJDE;
} }
StelLocation loc=core->getCurrentLocation(); StelLocation loc=core->getCurrentLocation();
// compute parallax correction with Meeus 40.6. First, find H from h =0, then add corrections. // compute parallax correction with Meeus 40.6. First, find H from h =0, then add corrections.
static const double b_over_a=0.99664719; static const double b_over_a=0.99664719;
double latRad=loc.latitude*M_PI/180.0; double latRad=loc.latitude*M_PI/180.0;
double u=std::atan(b_over_a*std::tan(latRad)); double u=std::atan(b_over_a*std::tan(latRad));
double rhoSinPhiP=b_over_a*std::sin(u)+loc.altitude/6378140.0*std::s in(latRad); double rhoSinPhiP=b_over_a*std::sin(u)+loc.altitude/6378140.0*std::s in(latRad);
skipping to change at line 302 skipping to change at line 342
// 40.6 // 40.6
QVector<double> A(8), B(8), C(8), q(8), lunarDEtopo(8); QVector<double> A(8), B(8), C(8), q(8), lunarDEtopo(8);
for (int i=0; i<8; i++){ for (int i=0; i<8; i++){
A[i]=std::cos(lunarDE[i])*sinHo[i]; A[i]=std::cos(lunarDE[i])*sinHo[i];
B[i]=std::cos(lunarDE[i])*cosHo[i]-rhoCosPhiP*sinPi[i]; B[i]=std::cos(lunarDE[i])*cosHo[i]-rhoCosPhiP*sinPi[i];
C[i]=std::sin(lunarDE[i])-rhoSinPhiP*sinPi[i]; C[i]=std::sin(lunarDE[i])-rhoSinPhiP*sinPi[i];
q[i]=std::sqrt(A[i]*A[i]+B[i]*B[i]+C[i]*C[i]); q[i]=std::sqrt(A[i]*A[i]+B[i]*B[i]+C[i]*C[i]);
lunarDEtopo[i]=std::asin(C[i]/q[i]); lunarDEtopo[i]=std::asin(C[i]/q[i]);
} }
northernMajorStandstillLine0->setDeclination(lunarDEtopo[0] *180.0/M northernMajorStandstillLine0->setDefiningAngle(lunarDEtopo[0] *180.0
_PI); /M_PI);
northernMajorStandstillLine1->setDeclination(lunarDEtopo[1] *180.0/M northernMajorStandstillLine1->setDefiningAngle(lunarDEtopo[1] *180.0
_PI); /M_PI);
northernMinorStandstillLine2->setDeclination(lunarDEtopo[2] *180.0/M northernMinorStandstillLine2->setDefiningAngle(lunarDEtopo[2] *180.0
_PI); /M_PI);
northernMinorStandstillLine3->setDeclination(lunarDEtopo[3] *180.0/M northernMinorStandstillLine3->setDefiningAngle(lunarDEtopo[3] *180.0
_PI); /M_PI);
southernMinorStandstillLine4->setDeclination(lunarDEtopo[4] *180.0/M southernMinorStandstillLine4->setDefiningAngle(lunarDEtopo[4] *180.0
_PI); /M_PI);
southernMinorStandstillLine5->setDeclination(lunarDEtopo[5] *180.0/M southernMinorStandstillLine5->setDefiningAngle(lunarDEtopo[5] *180.0
_PI); /M_PI);
southernMajorStandstillLine6->setDeclination(lunarDEtopo[6] *180.0/M southernMajorStandstillLine6->setDefiningAngle(lunarDEtopo[6] *180.0
_PI); /M_PI);
southernMajorStandstillLine7->setDeclination(lunarDEtopo[7] *180.0/M southernMajorStandstillLine7->setDefiningAngle(lunarDEtopo[7] *180.0
_PI); /M_PI);
zenithPassageLine->setDeclination(loc.latitude); zenithPassageLine->setDefiningAngle(loc.latitude);
nadirPassageLine->setDeclination(-loc.latitude); nadirPassageLine->setDefiningAngle(-loc.latitude);
// Selected object? // Selected object?
if (objMgr->getWasSelected()) if (objMgr->getWasSelected())
{ {
StelObjectP obj=objMgr->getSelectedObject().first(); StelObjectP obj=objMgr->getSelectedObject().first();
StelUtils::rectToSphe(&ra_equ,&dec_equ,obj->getEquinoxEquato rialPos(core)); StelUtils::rectToSphe(&ra_equ,&dec_equ,obj->getEquinoxEquato rialPos(core));
selectedObjectLine->setDeclination(dec_equ * 180.0/M_PI); selectedObjectLine->setDefiningAngle(dec_equ * 180.0/M_PI);
selectedObjectLine->setLabel(obj->getNameI18n()); selectedObjectLine->setLabel(obj->getNameI18n());
} }
// Updates for line brightness // Updates for line brightness
lineFader.update((int)(deltaTime*1000)); lineFader.update((int)(deltaTime*1000));
equinoxLine->update(deltaTime); equinoxLine->update(deltaTime);
northernSolsticeLine->update(deltaTime); northernSolsticeLine->update(deltaTime);
southernSolsticeLine->update(deltaTime); southernSolsticeLine->update(deltaTime);
northernCrossquarterLine->update(deltaTime); northernCrossquarterLine->update(deltaTime);
skipping to change at line 345 skipping to change at line 385
southernMinorStandstillLine4->update(deltaTime); southernMinorStandstillLine4->update(deltaTime);
southernMinorStandstillLine5->update(deltaTime); southernMinorStandstillLine5->update(deltaTime);
southernMajorStandstillLine6->update(deltaTime); southernMajorStandstillLine6->update(deltaTime);
southernMajorStandstillLine7->update(deltaTime); southernMajorStandstillLine7->update(deltaTime);
zenithPassageLine->update(deltaTime); zenithPassageLine->update(deltaTime);
nadirPassageLine->update(deltaTime); nadirPassageLine->update(deltaTime);
selectedObjectLine->update(deltaTime); selectedObjectLine->update(deltaTime);
currentSunLine->update(deltaTime); currentSunLine->update(deltaTime);
currentMoonLine->update(deltaTime); currentMoonLine->update(deltaTime);
currentPlanetLine->update(deltaTime); currentPlanetLine->update(deltaTime);
geographicLocation1Line->update(deltaTime);
geographicLocation2Line->update(deltaTime);
customAzimuth1Line->update(deltaTime);
customAzimuth2Line->update(deltaTime);
withDecimalDegree = StelApp::getInstance().getFlagShowDecimalDegrees ();; //withDecimalDegree = StelApp::getInstance().getFlagShowDecimalDegre es();;
} }
//! Draw any parts on the screen which are for our module //! Draw any parts on the screen which are for our module
void ArchaeoLines::draw(StelCore* core) void ArchaeoLines::draw(StelCore* core)
{ {
if (core->getCurrentPlanet()->getEnglishName()!="Earth") if (core->getCurrentPlanet()->getEnglishName()!="Earth")
return; return;
equinoxLine->draw(core, lineFader.getInterstate()); equinoxLine->draw(core, lineFader.getInterstate());
northernSolsticeLine->draw(core, lineFader.getInterstate()); northernSolsticeLine->draw(core, lineFader.getInterstate());
skipping to change at line 376 skipping to change at line 420
southernMajorStandstillLine6->draw(core, lineFader.getInterstate()); southernMajorStandstillLine6->draw(core, lineFader.getInterstate());
southernMajorStandstillLine7->draw(core, lineFader.getInterstate()); southernMajorStandstillLine7->draw(core, lineFader.getInterstate());
zenithPassageLine->draw(core, lineFader.getInterstate()); zenithPassageLine->draw(core, lineFader.getInterstate());
nadirPassageLine->draw(core, lineFader.getInterstate()); nadirPassageLine->draw(core, lineFader.getInterstate());
if (objMgr->getWasSelected()) if (objMgr->getWasSelected())
selectedObjectLine->draw(core, lineFader.getInterstate()); selectedObjectLine->draw(core, lineFader.getInterstate());
currentSunLine->draw(core, lineFader.getInterstate()); currentSunLine->draw(core, lineFader.getInterstate());
currentMoonLine->draw(core, lineFader.getInterstate()); currentMoonLine->draw(core, lineFader.getInterstate());
if (enumShowCurrentPlanet>ArchaeoLine::CurrentPlanetNone) if (enumShowCurrentPlanet>ArchaeoLine::CurrentPlanetNone)
currentPlanetLine->draw(core, lineFader.getInterstate()); currentPlanetLine->draw(core, lineFader.getInterstate());
geographicLocation1Line->draw(core, lineFader.getInterstate());
geographicLocation2Line->draw(core, lineFader.getInterstate());
customAzimuth1Line->draw(core, lineFader.getInterstate());
customAzimuth2Line->draw(core, lineFader.getInterstate());
} }
void ArchaeoLines::enableArchaeoLines(bool b) void ArchaeoLines::enableArchaeoLines(bool b)
{ {
flagShowArchaeoLines = b; if (b!=flagShowArchaeoLines)
lineFader = b; {
flagShowArchaeoLines = b;
lineFader = b;
conf->setValue("ArchaeoLines/enable_at_startup", flagShowArc
haeoLines);
emit archaeoLinesEnabledChanged(b);
}
} }
//void ArchaeoLines::useDmsFormat(bool b)
//{
// flagUseDmsFormat=b;
// conf->setValue("ArchaeoLines/angle_format_dms", isDmsFormat())
;
//}
void ArchaeoLines::restoreDefaultSettings() void ArchaeoLines::restoreDefaultSettings()
{ {
Q_ASSERT(conf); Q_ASSERT(conf);
// Remove the old values... // Remove the old values...
conf->remove("ArchaeoLines"); conf->remove("ArchaeoLines");
// ...load the default values... // ...load the default values...
loadSettings(); loadSettings();
} }
void ArchaeoLines::loadSettings() void ArchaeoLines::loadSettings()
{ {
//useDmsFormat(conf->value("ArchaeoLines/angle_format_dms", false).t
oBool());
equinoxColor = StelUtils::strToVec3f(conf->value("ArchaeoLin es/color_equinox", "1.00,1.00,0.5").toString()); equinoxColor = StelUtils::strToVec3f(conf->value("ArchaeoLin es/color_equinox", "1.00,1.00,0.5").toString());
equinoxLine->setColor(equinoxColor); equinoxLine->setColor(equinoxColor);
solsticesColor = StelUtils::strToVec3f(conf->value("ArchaeoLin es/color_solstices", "1.00,1.00,0.25").toString()); solsticesColor = StelUtils::strToVec3f(conf->value("ArchaeoLin es/color_solstices", "1.00,0.15,0.15").toString());
northernSolsticeLine->setColor(solsticesColor); northernSolsticeLine->setColor(solsticesColor);
southernSolsticeLine->setColor(solsticesColor); southernSolsticeLine->setColor(solsticesColor);
crossquartersColor = StelUtils::strToVec3f(conf->value("ArchaeoLin es/color_crossquarters", "1.00,0.75,0.25").toString()); crossquartersColor = StelUtils::strToVec3f(conf->value("ArchaeoLin es/color_crossquarters", "1.00,0.75,0.25").toString());
northernCrossquarterLine->setColor(crossquartersColor); northernCrossquarterLine->setColor(crossquartersColor);
southernCrossquarterLine->setColor(crossquartersColor); southernCrossquarterLine->setColor(crossquartersColor);
majorStandstillColor = StelUtils::strToVec3f(conf->value("ArchaeoLin es/color_major_standstill", "0.25,1.00,0.25").toString()); majorStandstillColor = StelUtils::strToVec3f(conf->value("ArchaeoLin es/color_major_standstill", "0.25,1.00,0.25").toString());
northernMajorStandstillLine0->setColor(majorStandstillColor); northernMajorStandstillLine0->setColor(majorStandstillColor);
northernMajorStandstillLine1->setColor(majorStandstillColor); northernMajorStandstillLine1->setColor(majorStandstillColor);
southernMajorStandstillLine6->setColor(majorStandstillColor); southernMajorStandstillLine6->setColor(majorStandstillColor);
southernMajorStandstillLine7->setColor(majorStandstillColor); southernMajorStandstillLine7->setColor(majorStandstillColor);
minorStandstillColor = StelUtils::strToVec3f(conf->value("ArchaeoLin es/color_minor_standstill", "0.20,0.75,0.20").toString()); minorStandstillColor = StelUtils::strToVec3f(conf->value("ArchaeoLin es/color_minor_standstill", "0.20,0.75,0.20").toString());
northernMinorStandstillLine2->setColor(minorStandstillColor); northernMinorStandstillLine2->setColor(minorStandstillColor);
northernMinorStandstillLine3->setColor(minorStandstillColor); northernMinorStandstillLine3->setColor(minorStandstillColor);
southernMinorStandstillLine4->setColor(minorStandstillColor); southernMinorStandstillLine4->setColor(minorStandstillColor);
southernMinorStandstillLine5->setColor(minorStandstillColor); southernMinorStandstillLine5->setColor(minorStandstillColor);
zenithPassageColor = StelUtils::strToVec3f(conf->value("ArchaeoLin es/color_zenith_passage", "1.00,0.75,0.75").toString()); zenithPassageColor = StelUtils::strToVec3f(conf->value("ArchaeoLin es/color_zenith_passage", "0.75,0.75,0.75").toString());
zenithPassageLine->setColor(zenithPassageColor); zenithPassageLine->setColor(zenithPassageColor);
nadirPassageColor = StelUtils::strToVec3f(conf->value("ArchaeoLin es/color_nadir_passage", "1.00,0.75,0.75").toString()); nadirPassageColor = StelUtils::strToVec3f(conf->value("ArchaeoLin es/color_nadir_passage", "0.25,0.25,0.25").toString());
nadirPassageLine->setColor(nadirPassageColor); nadirPassageLine->setColor(nadirPassageColor);
selectedObjectColor = StelUtils::strToVec3f(conf->value("ArchaeoL ines/color_selected_object", "1.00,1.00,1.00").toString()); selectedObjectColor = StelUtils::strToVec3f(conf->value("ArchaeoL ines/color_selected_object", "1.00,1.00,1.00").toString());
selectedObjectLine->setColor(selectedObjectColor); selectedObjectLine->setColor(selectedObjectColor);
currentSunColor = StelUtils::strToVec3f(conf->value("ArchaeoLines /color_current_sun", "1.00,1.00,0.75").toString()); currentSunColor = StelUtils::strToVec3f(conf->value("ArchaeoLines /color_current_sun", "1.00,1.00,0.75").toString());
currentSunLine->setColor(currentSunColor); currentSunLine->setColor(currentSunColor);
currentMoonColor = StelUtils::strToVec3f(conf->value("ArchaeoLine s/color_current_moon", "0.50,1.00,0.50").toString()); currentMoonColor = StelUtils::strToVec3f(conf->value("ArchaeoLine s/color_current_moon", "0.50,1.00,0.50").toString());
currentMoonLine->setColor(currentMoonColor); currentMoonLine->setColor(currentMoonColor);
currentPlanetColor = StelUtils::strToVec3f(conf->value("ArchaeoLi nes/color_current_planet", "0.25,0.80,1.00").toString()); currentPlanetColor = StelUtils::strToVec3f(conf->value("ArchaeoLi nes/color_current_planet", "0.25,0.80,1.00").toString());
currentPlanetLine->setColor(currentPlanetColor); currentPlanetLine->setColor(currentPlanetColor);
geographicLocation1Color = StelUtils::strToVec3f(conf->value("Arch
aeoLines/color_geographic_location_1", "0.25,1.00,0.25").toString());
geographicLocation1Line->setColor(geographicLocation1Color);
geographicLocation2Color = StelUtils::strToVec3f(conf->value("Arch
aeoLines/color_geographic_location_2", "0.25,0.25,1.00").toString());
geographicLocation2Line->setColor(geographicLocation2Color);
customAzimuth1Color = StelUtils::strToVec3f(conf->value("ArchaeoLi
nes/color_custom_azimuth_1", "0.25,1.00,0.25").toString());
customAzimuth1Line->setColor(customAzimuth1Color);
customAzimuth2Color = StelUtils::strToVec3f(conf->value("ArchaeoLi
nes/color_custom_azimuth_2", "0.25,0.50,0.75").toString());
customAzimuth2Line->setColor(customAzimuth2Color);
setGeographicLocation1Longitude(conf->value("ArchaeoLines/geographic
_location_1_longitude", 39.826175).toDouble());
setGeographicLocation1Latitude( conf->value("ArchaeoLines/geographic
_location_1_latitude", 21.422476).toDouble());
setGeographicLocation2Longitude(conf->value("ArchaeoLines/geographic
_location_2_longitude", 35.235774).toDouble());
setGeographicLocation2Latitude( conf->value("ArchaeoLines/geographic
_location_2_latitude", 31.778087).toDouble());
StelLocation loc=core->getCurrentLocation();
geographicLocation1Line->setDefiningAngle(getAzimuthForLocation(loc.
longitude, loc.latitude, geographicLocation1Longitude, geographicLocation1L
atitude));
geographicLocation2Line->setDefiningAngle(getAzimuthForLocation(loc.
longitude, loc.latitude, geographicLocation2Longitude, geographicLocation2L
atitude));
geographicLocation1Line->setLabel(conf->value("ArchaeoLines/geograph
ic_location_1_label", "Mecca (Qibla)").toString());
geographicLocation2Line->setLabel(conf->value("ArchaeoLines/geograph
ic_location_2_label", "Jerusalem").toString());
customAzimuth1Line->setDefiningAngle(conf->value("ArchaeoLines/custo
m_azimuth_1_angle", 0.0).toDouble());
customAzimuth2Line->setDefiningAngle(conf->value("ArchaeoLines/custo
m_azimuth_2_angle", 0.0).toDouble());
customAzimuth1Line->setLabel(conf->value("ArchaeoLines/custom_azimut
h_1_label", "custAzi1").toString());
customAzimuth2Line->setLabel(conf->value("ArchaeoLines/custom_azimut
h_2_label", "custAzi2").toString());
// Now activate line display if needed.
// 5 solar limits // 5 solar limits
showEquinox(conf->value("ArchaeoLines/show_equinox", true).toBool()) ; showEquinox(conf->value("ArchaeoLines/show_equinox", true).toBool()) ;
showSolstices(conf->value("ArchaeoLines/show_solstices", true).toBoo l()); showSolstices(conf->value("ArchaeoLines/show_solstices", true).toBoo l());
showCrossquarters(conf->value("ArchaeoLines/show_crossquarters", tru e).toBool()); showCrossquarters(conf->value("ArchaeoLines/show_crossquarters", tru e).toBool());
// 4 lunar limits // 4 lunar limits
showMajorStandstills(conf->value("ArchaeoLines/show_major_standstill s", true).toBool()); showMajorStandstills(conf->value("ArchaeoLines/show_major_standstill s", true).toBool());
showMinorStandstills(conf->value("ArchaeoLines/show_minor_standstill s", true).toBool()); showMinorStandstills(conf->value("ArchaeoLines/show_minor_standstill s", true).toBool());
// esp. Mesoamerica // esp. Mesoamerica
showZenithPassage(conf->value("ArchaeoLines/show_zenith_passage", tr ue).toBool()); showZenithPassage(conf->value("ArchaeoLines/show_zenith_passage", tr ue).toBool());
showNadirPassage(conf->value("ArchaeoLines/show_nadir_passage", tru e).toBool()); showNadirPassage(conf->value("ArchaeoLines/show_nadir_passage", fal se).toBool());
// indicator for a line representing currently selected object // indicator for a line representing currently selected object
showSelectedObject(conf->value("ArchaeoLines/show_selected_object", false).toBool()); showSelectedObject(conf->value("ArchaeoLines/show_selected_object", false).toBool());
// indicators for current declinations (those move fast over days... ) // indicators for current declinations (those move fast over days... )
showCurrentSun(conf->value("ArchaeoLines/show_current_sun", true).to Bool()); showCurrentSun(conf->value("ArchaeoLines/show_current_sun", true).to Bool());
showCurrentMoon(conf->value("ArchaeoLines/show_current_moon", true). toBool()); showCurrentMoon(conf->value("ArchaeoLines/show_current_moon", true). toBool());
showCurrentPlanet(conf->value("ArchaeoLines/show_current_planet", "n showCurrentPlanetNamed(conf->value("ArchaeoLines/show_current_planet
one").toString()); ", "none").toString());
// azimuths to geographic targets, and custom azimuths.
showGeographicLocation1(conf->value("ArchaeoLines/show_geographic_lo
cation_1", false).toBool());
showGeographicLocation2(conf->value("ArchaeoLines/show_geographic_lo
cation_2", false).toBool());
showCustomAzimuth1(conf->value("ArchaeoLines/show_custom_azimuth_1",
false).toBool());
showCustomAzimuth2(conf->value("ArchaeoLines/show_custom_azimuth_2",
false).toBool());
enableArchaeoLines(conf->value("ArchaeoLines/enable_at_startup", fal
se).toBool());
} }
void ArchaeoLines::showEquinox(bool b) void ArchaeoLines::showEquinox(bool b)
{ {
flagShowEquinox=b; if (b!=flagShowEquinox)
conf->setValue("ArchaeoLines/show_equinox", isEquinoxDisplay {
ed()); flagShowEquinox=b;
equinoxLine->setDisplayed(b); conf->setValue("ArchaeoLines/show_equinox", isEquino
xDisplayed());
equinoxLine->setDisplayed(b);
emit showEquinoxChanged(b);
}
} }
void ArchaeoLines::showSolstices(bool b) void ArchaeoLines::showSolstices(bool b)
{ {
flagShowSolstices=b; if (b!=flagShowSolstices)
conf->setValue("ArchaeoLines/show_solstices", isSolsticesDis {
played()); flagShowSolstices=b;
northernSolsticeLine->setDisplayed(b); conf->setValue("ArchaeoLines/show_solstices", isSols
southernSolsticeLine->setDisplayed(b); ticesDisplayed());
northernSolsticeLine->setDisplayed(b);
southernSolsticeLine->setDisplayed(b);
emit showSolsticesChanged(b);
}
} }
void ArchaeoLines::showCrossquarters(bool b) void ArchaeoLines::showCrossquarters(bool b)
{ {
flagShowCrossquarters=b; if (b!=flagShowCrossquarters)
conf->setValue("ArchaeoLines/show_crossquarters", isCrossquarter {
sDisplayed()); flagShowCrossquarters=b;
northernCrossquarterLine->setDisplayed(b); conf->setValue("ArchaeoLines/show_crossquarters", isCros
southernCrossquarterLine->setDisplayed(b); squartersDisplayed());
northernCrossquarterLine->setDisplayed(b);
southernCrossquarterLine->setDisplayed(b);
emit showCrossquartersChanged(b);
}
} }
void ArchaeoLines::showMajorStandstills(bool b) void ArchaeoLines::showMajorStandstills(bool b)
{ {
flagShowMajorStandstills=b; if (b!=flagShowMajorStandstills)
conf->setValue("ArchaeoLines/show_major_standstills", isMajorStandst {
illsDisplayed()); flagShowMajorStandstills=b;
northernMajorStandstillLine0->setDisplayed(b); conf->setValue("ArchaeoLines/show_major_standstills", isMajo
northernMajorStandstillLine1->setDisplayed(b); rStandstillsDisplayed());
southernMajorStandstillLine6->setDisplayed(b); northernMajorStandstillLine0->setDisplayed(b);
southernMajorStandstillLine7->setDisplayed(b); northernMajorStandstillLine1->setDisplayed(b);
southernMajorStandstillLine6->setDisplayed(b);
southernMajorStandstillLine7->setDisplayed(b);
emit showMajorStandstillsChanged(b);
}
} }
void ArchaeoLines::showMinorStandstills(bool b) void ArchaeoLines::showMinorStandstills(bool b)
{ {
flagShowMinorStandstills=b; if (b!=flagShowMinorStandstills)
conf->setValue("ArchaeoLines/show_minor_standstills", isMinorStandst {
illsDisplayed()); flagShowMinorStandstills=b;
northernMinorStandstillLine2->setDisplayed(b); conf->setValue("ArchaeoLines/show_minor_standstills", isMino
northernMinorStandstillLine3->setDisplayed(b); rStandstillsDisplayed());
southernMinorStandstillLine4->setDisplayed(b); northernMinorStandstillLine2->setDisplayed(b);
southernMinorStandstillLine5->setDisplayed(b); northernMinorStandstillLine3->setDisplayed(b);
southernMinorStandstillLine4->setDisplayed(b);
southernMinorStandstillLine5->setDisplayed(b);
emit showMinorStandstillsChanged(b);
}
} }
void ArchaeoLines::showZenithPassage(bool b) void ArchaeoLines::showZenithPassage(bool b)
{ {
flagShowZenithPassage=b; if (b!=flagShowZenithPassage)
conf->setValue("ArchaeoLines/show_zenith_passage", isZenithPass {
ageDisplayed()); flagShowZenithPassage=b;
zenithPassageLine->setDisplayed(b); conf->setValue("ArchaeoLines/show_zenith_passage", isZe
nithPassageDisplayed());
zenithPassageLine->setDisplayed(b);
emit showZenithPassageChanged(b);
}
} }
void ArchaeoLines::showNadirPassage(bool b) void ArchaeoLines::showNadirPassage(bool b)
{ {
flagShowNadirPassage=b; if (b!=flagShowNadirPassage)
conf->setValue("ArchaeoLines/show_nadir_passage", isNadirPassa {
geDisplayed()); flagShowNadirPassage=b;
nadirPassageLine->setDisplayed(b); conf->setValue("ArchaeoLines/show_nadir_passage", isNa
dirPassageDisplayed());
nadirPassageLine->setDisplayed(b);
emit showNadirPassageChanged(b);
}
} }
void ArchaeoLines::showSelectedObject(bool b) void ArchaeoLines::showSelectedObject(bool b)
{ {
flagShowSelectedObject=b; if (b!=flagShowSelectedObject)
conf->setValue("ArchaeoLines/show_selected_object", isSelected {
ObjectDisplayed()); flagShowSelectedObject=b;
selectedObjectLine->setDisplayed(b); conf->setValue("ArchaeoLines/show_selected_object", is
SelectedObjectDisplayed());
selectedObjectLine->setDisplayed(b);
emit showSelectedObjectChanged(b);
}
} }
void ArchaeoLines::showCurrentSun(bool b) void ArchaeoLines::showCurrentSun(bool b)
{ {
flagShowCurrentSun=b; if (b!=flagShowCurrentSun)
conf->setValue("ArchaeoLines/show_current_sun", isCurrentSunDi {
splayed()); flagShowCurrentSun=b;
currentSunLine->setDisplayed(b); conf->setValue("ArchaeoLines/show_current_sun", isCurr
entSunDisplayed());
currentSunLine->setDisplayed(b);
emit showCurrentSunChanged(b);
}
} }
void ArchaeoLines::showCurrentMoon(bool b) void ArchaeoLines::showCurrentMoon(bool b)
{ {
flagShowCurrentMoon=b; if (b!=flagShowCurrentMoon)
conf->setValue("ArchaeoLines/show_current_moon", isCurrentMoon {
Displayed()); flagShowCurrentMoon=b;
currentMoonLine->setDisplayed(b); conf->setValue("ArchaeoLines/show_current_moon", isCur
rentMoonDisplayed());
currentMoonLine->setDisplayed(b);
emit showCurrentMoonChanged(b);
}
} }
void ArchaeoLines::showCurrentPlanet(ArchaeoLine::Line l) void ArchaeoLines::showCurrentPlanet(ArchaeoLine::Line l)
{ {
enumShowCurrentPlanet=l; if(l!=enumShowCurrentPlanet)
const char *planetStrings[]={"none", "Mercury", "Venus", "Mars", "Ju {
piter", "Saturn"}; enumShowCurrentPlanet=l;
const char *planetStrings[]={"none", "Mercury", "Venus", "Ma
rs", "Jupiter", "Saturn"};
conf->setValue("ArchaeoLines/show_current_planet", planetStrings[l-A conf->setValue("ArchaeoLines/show_current_planet", planetStr
rchaeoLine::CurrentPlanetNone]); ings[l-ArchaeoLine::CurrentPlanetNone]);
currentPlanetLine->setLineType(enumShowCurrentPlanet); currentPlanetLine->setLineType(enumShowCurrentPlanet);
currentPlanetLine->setDisplayed(enumShowCurrentPlanet != ArchaeoLine currentPlanetLine->setDisplayed(enumShowCurrentPlanet != Arc
::CurrentPlanetNone); haeoLine::CurrentPlanetNone);
}
void ArchaeoLines::showCurrentPlanet(QString planet) emit currentPlanetChanged(l);
}
}
void ArchaeoLines::showCurrentPlanetNamed(QString planet)
{ {
if (planet=="none") if (planet=="none")
enumShowCurrentPlanet=ArchaeoLine::CurrentPlanetNone; enumShowCurrentPlanet=ArchaeoLine::CurrentPlanetNone;
else if (planet=="Mercury") else if (planet=="Mercury")
enumShowCurrentPlanet=ArchaeoLine::CurrentPlanetMercury; enumShowCurrentPlanet=ArchaeoLine::CurrentPlanetMercury;
else if (planet=="Venus") else if (planet=="Venus")
enumShowCurrentPlanet=ArchaeoLine::CurrentPlanetVenus; enumShowCurrentPlanet=ArchaeoLine::CurrentPlanetVenus;
else if (planet=="Mars") else if (planet=="Mars")
enumShowCurrentPlanet=ArchaeoLine::CurrentPlanetMars; enumShowCurrentPlanet=ArchaeoLine::CurrentPlanetMars;
else if (planet=="Jupiter") else if (planet=="Jupiter")
skipping to change at line 553 skipping to change at line 672
else if (planet=="Saturn") else if (planet=="Saturn")
enumShowCurrentPlanet=ArchaeoLine::CurrentPlanetSaturn; enumShowCurrentPlanet=ArchaeoLine::CurrentPlanetSaturn;
else { else {
qWarning() << "ArchaeoLines: showCurrentPlanet: Invalid plan et requested: " << planet; qWarning() << "ArchaeoLines: showCurrentPlanet: Invalid plan et requested: " << planet;
enumShowCurrentPlanet=ArchaeoLine::CurrentPlanetNone; enumShowCurrentPlanet=ArchaeoLine::CurrentPlanetNone;
} }
conf->setValue("ArchaeoLines/show_current_planet", planet); conf->setValue("ArchaeoLines/show_current_planet", planet);
currentPlanetLine->setLineType(enumShowCurrentPlanet); currentPlanetLine->setLineType(enumShowCurrentPlanet);
currentPlanetLine->setDisplayed(enumShowCurrentPlanet != ArchaeoLine ::CurrentPlanetNone); currentPlanetLine->setDisplayed(enumShowCurrentPlanet != ArchaeoLine ::CurrentPlanetNone);
emit currentPlanetChanged(enumShowCurrentPlanet);
}
void ArchaeoLines::showGeographicLocation1(bool b)
{
if (b!=flagShowGeographicLocation1)
{
flagShowGeographicLocation1=b;
conf->setValue("ArchaeoLines/show_geographic_location_1",
isGeographicLocation1Displayed());
geographicLocation1Line->setDisplayed(b);
emit showGeographicLocation1Changed(b);
}
}
void ArchaeoLines::showGeographicLocation2(bool b)
{
if (b!=flagShowGeographicLocation2)
{
flagShowGeographicLocation2=b;
conf->setValue("ArchaeoLines/show_geographic_location_2",
isGeographicLocation2Displayed());
geographicLocation2Line->setDisplayed(b);
emit showGeographicLocation2Changed(b);
}
}
void ArchaeoLines::showCustomAzimuth1(bool b)
{
if (b!=flagShowCustomAzimuth1)
{
flagShowCustomAzimuth1=b;
conf->setValue("ArchaeoLines/show_custom_azimuth_1", i
sCustomAzimuth1Displayed());
customAzimuth1Line->setDisplayed(b);
emit showCustomAzimuth1Changed(b);
}
}
void ArchaeoLines::showCustomAzimuth2(bool b)
{
if (b!=flagShowCustomAzimuth2)
{
flagShowCustomAzimuth2=b;
conf->setValue("ArchaeoLines/show_custom_azimuth_2", i
sCustomAzimuth2Displayed());
customAzimuth2Line->setDisplayed(b);
emit showCustomAzimuth2Changed(b);
}
}
void ArchaeoLines::setGeographicLocation1Longitude(double lng)
{
conf->setValue("ArchaeoLines/geographic_location_1_longitude", lng);
geographicLocation1Longitude=lng;
StelLocation loc=core->getCurrentLocation();
geographicLocation1Line->setDefiningAngle(getAzimuthForLocation(loc.
longitude, loc.latitude, geographicLocation1Longitude, geographicLocation1L
atitude));
emit geographicLocation1Changed();
}
void ArchaeoLines::setGeographicLocation1Latitude(double lat)
{
conf->setValue("ArchaeoLines/geographic_location_1_latitude", lat);
geographicLocation1Latitude=lat;
StelLocation loc=core->getCurrentLocation();
geographicLocation1Line->setDefiningAngle(getAzimuthForLocation(loc.
longitude, loc.latitude, geographicLocation1Longitude, geographicLocation1L
atitude));
emit geographicLocation1Changed();
}
void ArchaeoLines::setGeographicLocation1Label(QString label)
{
geographicLocation1Line->setLabel(label);
conf->setValue("ArchaeoLines/geographic_location_1_label", label);
}
void ArchaeoLines::setGeographicLocation2Longitude(double lng)
{
conf->setValue("ArchaeoLines/geographic_location_2_longitude", lng);
geographicLocation2Longitude=lng;
StelLocation loc=core->getCurrentLocation();
geographicLocation2Line->setDefiningAngle(getAzimuthForLocation(loc.
longitude, loc.latitude, geographicLocation2Longitude, geographicLocation2L
atitude));
emit geographicLocation2Changed();
}
void ArchaeoLines::setGeographicLocation2Latitude(double lat)
{
conf->setValue("ArchaeoLines/geographic_location_2_latitude", lat);
geographicLocation2Latitude=lat;
StelLocation loc=core->getCurrentLocation();
geographicLocation2Line->setDefiningAngle(getAzimuthForLocation(loc.
longitude, loc.latitude, geographicLocation2Longitude, geographicLocation2L
atitude));
emit geographicLocation2Changed();
}
void ArchaeoLines::setGeographicLocation2Label(QString label)
{
geographicLocation2Line->setLabel(label);
conf->setValue("ArchaeoLines/geographic_location_2_label", label);
}
void ArchaeoLines::updateObserverLocation(StelLocation loc)
{
geographicLocation1Line->setDefiningAngle(getAzimuthForLocation(loc.
longitude, loc.latitude, geographicLocation1Longitude, geographicLocation1L
atitude));
geographicLocation2Line->setDefiningAngle(getAzimuthForLocation(loc.
longitude, loc.latitude, geographicLocation2Longitude, geographicLocation2L
atitude));
}
void ArchaeoLines::setCustomAzimuth1(double az)
{
if (az!=customAzimuth1Line->getDefiningAngle())
{
customAzimuth1Line->setDefiningAngle(az);
conf->setValue("ArchaeoLines/custom_azimuth_1_angle", az);
emit customAzimuth1Changed(az);
}
}
void ArchaeoLines::setCustomAzimuth2(double az)
{
customAzimuth2Line->setDefiningAngle(az);
conf->setValue("ArchaeoLines/custom_azimuth_2_angle", az);
emit customAzimuth2Changed(az);
}
void ArchaeoLines::setCustomAzimuth1Label(QString label)
{
customAzimuth1Line->setLabel(label);
conf->setValue("ArchaeoLines/custom_azimuth_1_label", label);
}
void ArchaeoLines::setCustomAzimuth2Label(QString label)
{
customAzimuth2Line->setLabel(label);
conf->setValue("ArchaeoLines/custom_azimuth_2_label", label);
} }
// called by the dialog UI, converts QColor (0..255) to Stellarium's Vec3f float color. // called by the dialog UI, converts QColor (0..255) to Stellarium's Vec3f float color.
void ArchaeoLines::setLineColor(ArchaeoLine::Line whichLine, QColor color) void ArchaeoLines::setLineColor(ArchaeoLine::Line whichLine, QColor color)
{ {
switch (whichLine){ switch (whichLine){
case ArchaeoLine::Equinox: case ArchaeoLine::Equinox:
equinoxColor.set(color.redF(), color.greenF(), color .blueF()); equinoxColor.set(color.redF(), color.greenF(), color .blueF());
conf->setValue("ArchaeoLines/color_equinox", QString("%1,%2,%3").arg(equinoxColor.v[0]).arg(equinoxColor.v[1]).arg(equin oxColor.v[2])); conf->setValue("ArchaeoLines/color_equinox", QString("%1,%2,%3").arg(equinoxColor.v[0]).arg(equinoxColor.v[1]).arg(equin oxColor.v[2]));
equinoxLine->setColor(equinoxColor); equinoxLine->setColor(equinoxColor);
skipping to change at line 627 skipping to change at line 862
case ArchaeoLine::CurrentPlanetNone: case ArchaeoLine::CurrentPlanetNone:
case ArchaeoLine::CurrentPlanetMercury: case ArchaeoLine::CurrentPlanetMercury:
case ArchaeoLine::CurrentPlanetVenus: case ArchaeoLine::CurrentPlanetVenus:
case ArchaeoLine::CurrentPlanetMars: case ArchaeoLine::CurrentPlanetMars:
case ArchaeoLine::CurrentPlanetJupiter: case ArchaeoLine::CurrentPlanetJupiter:
case ArchaeoLine::CurrentPlanetSaturn: case ArchaeoLine::CurrentPlanetSaturn:
currentPlanetColor.set(color.redF(), color.greenF(), color.blueF()); currentPlanetColor.set(color.redF(), color.greenF(), color.blueF());
conf->setValue("ArchaeoLines/color_current_planet", QString("%1,%2,%3").arg(currentPlanetColor.v[0]).arg(currentPlanetColo r.v[1]).arg(currentPlanetColor.v[2])); conf->setValue("ArchaeoLines/color_current_planet", QString("%1,%2,%3").arg(currentPlanetColor.v[0]).arg(currentPlanetColo r.v[1]).arg(currentPlanetColor.v[2]));
currentPlanetLine->setColor(currentPlanetColor); currentPlanetLine->setColor(currentPlanetColor);
break; break;
default: case ArchaeoLine::GeographicLocation1:
geographicLocation1Color.set(color.redF(), color.gre
enF(), color.blueF());
conf->setValue("ArchaeoLines/color_geographic_locati
on_1", QString("%1,%2,%3").arg(geographicLocation1Color.v[0]).arg(geographi
cLocation1Color.v[1]).arg(geographicLocation1Color.v[2]));
geographicLocation1Line->setColor(geographicLocation
1Color);
break;
case ArchaeoLine::GeographicLocation2:
geographicLocation2Color.set(color.redF(), color.gre
enF(), color.blueF());
conf->setValue("ArchaeoLines/color_geographic_locati
on_2", QString("%1,%2,%3").arg(geographicLocation2Color.v[0]).arg(geographi
cLocation2Color.v[1]).arg(geographicLocation2Color.v[2]));
geographicLocation2Line->setColor(geographicLocation
2Color);
break;
case ArchaeoLine::CustomAzimuth1:
customAzimuth1Color.set(color.redF(), color.greenF()
, color.blueF());
conf->setValue("ArchaeoLines/color_custom_azimuth_1"
, QString("%1,%2,%3").arg(customAzimuth1Color.v[0]).arg(customAzimuth1Co
lor.v[1]).arg(customAzimuth1Color.v[2]));
customAzimuth1Line->setColor(customAzimuth1Color);
break;
case ArchaeoLine::CustomAzimuth2:
customAzimuth2Color.set(color.redF(), color.greenF()
, color.blueF());
conf->setValue("ArchaeoLines/color_custom_azimuth_2"
, QString("%1,%2,%3").arg(customAzimuth2Color.v[0]).arg(customAzimuth2Co
lor.v[1]).arg(customAzimuth2Color.v[2]));
customAzimuth2Line->setColor(customAzimuth2Color);
break; default:
Q_ASSERT(0); Q_ASSERT(0);
} }
} }
// called by the dialog UI, converts Stellarium's Vec3f float color to QCol or (0..255). // called by the dialog UI, converts Stellarium's Vec3f float color to QCol or (0..255).
QColor ArchaeoLines::getLineColor(ArchaeoLine::Line whichLine) QColor ArchaeoLines::getLineColor(ArchaeoLine::Line whichLine)
{ {
QColor color(0,0,0); QColor color(0,0,0);
Vec3f* vColor; Vec3f* vColor;
switch (whichLine){ switch (whichLine){
skipping to change at line 676 skipping to change at line 930
vColor=&currentMoonColor; vColor=&currentMoonColor;
break; break;
case ArchaeoLine::CurrentPlanetNone: case ArchaeoLine::CurrentPlanetNone:
case ArchaeoLine::CurrentPlanetMercury: case ArchaeoLine::CurrentPlanetMercury:
case ArchaeoLine::CurrentPlanetVenus: case ArchaeoLine::CurrentPlanetVenus:
case ArchaeoLine::CurrentPlanetMars: case ArchaeoLine::CurrentPlanetMars:
case ArchaeoLine::CurrentPlanetJupiter: case ArchaeoLine::CurrentPlanetJupiter:
case ArchaeoLine::CurrentPlanetSaturn: case ArchaeoLine::CurrentPlanetSaturn:
vColor=&currentPlanetColor; vColor=&currentPlanetColor;
break; break;
case ArchaeoLine::GeographicLocation1:
vColor=&geographicLocation1Color;
break;
case ArchaeoLine::GeographicLocation2:
vColor=&geographicLocation2Color;
break;
case ArchaeoLine::CustomAzimuth1:
vColor=&customAzimuth1Color;
break;
case ArchaeoLine::CustomAzimuth2:
vColor=&customAzimuth2Color;
break;
default: default:
vColor=&selectedObjectColor; // this is only to sile nce compiler warning about uninitialized variable vColor. vColor=&selectedObjectColor; // this is only to sile nce compiler warning about uninitialized variable vColor.
Q_ASSERT(0); Q_ASSERT(0);
} }
color.setRgbF(vColor->v[0], vColor->v[1], vColor->v[2]); color.setRgbF(vColor->v[0], vColor->v[1], vColor->v[2]);
return color; return color;
} }
double ArchaeoLines::getLineAngle(ArchaeoLine::Line whichLine)
{
switch (whichLine){
case ArchaeoLine::Equinox:
return equinoxLine->getDefiningAngle();
break;
case ArchaeoLine::Solstices:
return northernSolsticeLine->getDefiningAngle();
break;
case ArchaeoLine::Crossquarters:
return northernCrossquarterLine->getDefiningAngle();
break;
case ArchaeoLine::MajorStandstill:
return northernMajorStandstillLine0->getDefiningAngl
e();
break;
case ArchaeoLine::MinorStandstill:
return northernMinorStandstillLine2->getDefiningAngl
e();
break;
case ArchaeoLine::ZenithPassage:
return zenithPassageLine->getDefiningAngle();
break;
case ArchaeoLine::NadirPassage:
return nadirPassageLine->getDefiningAngle();
break;
case ArchaeoLine::SelectedObject:
return selectedObjectLine->getDefiningAngle();
break;
case ArchaeoLine::CurrentSun:
return currentSunLine->getDefiningAngle();
break;
case ArchaeoLine::CurrentMoon:
return currentMoonLine->getDefiningAngle();
break;
case ArchaeoLine::CurrentPlanetNone:
return 0.0;
break;
case ArchaeoLine::CurrentPlanetMercury:
case ArchaeoLine::CurrentPlanetVenus:
case ArchaeoLine::CurrentPlanetMars:
case ArchaeoLine::CurrentPlanetJupiter:
case ArchaeoLine::CurrentPlanetSaturn:
return currentPlanetLine->getDefiningAngle();
break;
case ArchaeoLine::GeographicLocation1:
return geographicLocation1Line->getDefiningAngle();
break;
case ArchaeoLine::GeographicLocation2:
return geographicLocation2Line->getDefiningAngle();
break;
case ArchaeoLine::CustomAzimuth1:
return customAzimuth1Line->getDefiningAngle();
break;
case ArchaeoLine::CustomAzimuth2:
return customAzimuth2Line->getDefiningAngle();
break;
default:
Q_ASSERT(0);
}
return -100.0;
}
QString ArchaeoLines::getLineLabel(ArchaeoLine::Line whichLine)
{
switch (whichLine){
case ArchaeoLine::Equinox:
return equinoxLine->getLabel();
break;
case ArchaeoLine::Solstices:
return northernSolsticeLine->getLabel();
break;
case ArchaeoLine::Crossquarters:
return northernCrossquarterLine->getLabel();
break;
case ArchaeoLine::MajorStandstill:
return northernMajorStandstillLine0->getLabel();
break;
case ArchaeoLine::MinorStandstill:
return northernMinorStandstillLine2->getLabel();
break;
case ArchaeoLine::ZenithPassage:
return zenithPassageLine->getLabel();
break;
case ArchaeoLine::NadirPassage:
return nadirPassageLine->getLabel();
break;
case ArchaeoLine::SelectedObject:
return selectedObjectLine->getLabel();
break;
case ArchaeoLine::CurrentSun:
return currentSunLine->getLabel();
break;
case ArchaeoLine::CurrentMoon:
return currentMoonLine->getLabel();
break;
case ArchaeoLine::CurrentPlanetNone:
case ArchaeoLine::CurrentPlanetMercury:
case ArchaeoLine::CurrentPlanetVenus:
case ArchaeoLine::CurrentPlanetMars:
case ArchaeoLine::CurrentPlanetJupiter:
case ArchaeoLine::CurrentPlanetSaturn:
return currentPlanetLine->getLabel();
break;
case ArchaeoLine::GeographicLocation1:
return geographicLocation1Line->getLabel();
break;
case ArchaeoLine::GeographicLocation2:
return geographicLocation2Line->getLabel();
break;
case ArchaeoLine::CustomAzimuth1:
return customAzimuth1Line->getLabel();
break;
case ArchaeoLine::CustomAzimuth2:
return customAzimuth2Line->getLabel();
break;
default:
Q_ASSERT(0);
return "ArchaeoLines::getLineLabel(): Error!";
}
}
double ArchaeoLines::getAzimuthForLocation(double longObs, double latObs, d
ouble longTarget, double latTarget) const
{
longObs *= (M_PI/180.0);
latObs *= (M_PI/180.0);
longTarget *= (M_PI/180.0);
latTarget *= (M_PI/180.0);
return (180.0/M_PI) * atan2(sin(longTarget-longObs), cos(latObs)*tan
(latTarget)-sin(latObs)*cos(longTarget-longObs));
}
// callback stuff shamelessly taken from GridLinesMgr. Changes: Text MUST b e filled, can also be empty for no label! // callback stuff shamelessly taken from GridLinesMgr. Changes: Text MUST b e filled, can also be empty for no label!
struct ALViewportEdgeIntersectCallbackData struct ALViewportEdgeIntersectCallbackData
{ {
ALViewportEdgeIntersectCallbackData(StelPainter* p) ALViewportEdgeIntersectCallbackData(StelPainter* p)
: sPainter(p) : sPainter(p)
{;} {;}
StelPainter* sPainter; StelPainter* sPainter;
//Vec4f textColor; //Vec4f textColor;
QString text; // Label to display at the intersection of t he lines and screen side QString text; // Label to display at the intersection of t he lines and screen side
}; };
skipping to change at line 721 skipping to change at line 1117
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);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
} }
ArchaeoLine::ArchaeoLine(ArchaeoLine::Line lineType, double declination) : ArchaeoLine::ArchaeoLine(ArchaeoLine::Line lineType, double definingAngle)
lineType(lineType), declination(declination), 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)
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();
fader.setDuration(1000); fader.setDuration(1000);
// Initialize the message strings and make sure they are translated when the language changes. // Initialize the message strings and make sure they are translated when the language changes.
StelApp& app = StelApp::getInstance(); StelApp& app = StelApp::getInstance();
//updateLabel(); // WHY AGAIN?? //updateLabel(); // WHY AGAIN??
connect(&app, SIGNAL(languageChanged()), this, SLOT(updateLabel())); connect(&app, SIGNAL(languageChanged()), this, SLOT(updateLabel()));
} }
skipping to change at line 791 skipping to change at line 1192
break; break;
case ArchaeoLine::CurrentPlanetMars: case ArchaeoLine::CurrentPlanetMars:
label = q_("Mars"); label = q_("Mars");
break; break;
case ArchaeoLine::CurrentPlanetJupiter: case ArchaeoLine::CurrentPlanetJupiter:
label = q_("Jupiter"); label = q_("Jupiter");
break; break;
case ArchaeoLine::CurrentPlanetSaturn: case ArchaeoLine::CurrentPlanetSaturn:
label = q_("Saturn"); label = q_("Saturn");
break; break;
case ArchaeoLine::GeographicLocation1: // label was set in s
etLabel(). DO NOT update.
case ArchaeoLine::GeographicLocation2:
case ArchaeoLine::CustomAzimuth1:
case ArchaeoLine::CustomAzimuth2:
break;
default: default:
Q_ASSERT(0); Q_ASSERT(0);
} }
} }
void ArchaeoLine::draw(StelCore *core, float intensity) const void ArchaeoLine::draw(StelCore *core, float intensity) const
{ {
// borrowed largely from GridLinesMgr. // borrowed largely from GridLinesMgr.
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);
sPainter.setColor(color[0], color[1], color[2], intensity*fader.getI nterstate()); 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
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);
glEnable(GL_BLEND);
// OpenGL ES 2.0 doesn't have GL_LINE_SMOOTH // OpenGL ES 2.0 doesn't have GL_LINE_SMOOTH
#ifdef GL_LINE_SMOOTH #ifdef GL_LINE_SMOOTH
if (QOpenGLContext::currentContext()->format().renderableType()==QSu rfaceFormat::OpenGL) if (QOpenGLContext::currentContext()->format().renderableType()==QSu rfaceFormat::OpenGL)
glEnable(GL_LINE_SMOOTH); glEnable(GL_LINE_SMOOTH);
#endif #endif
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.
if (lineType>=ArchaeoLine::GeographicLocation1)
{
SphericalCap meridianSphericalCap(Vec3d(0,1,0), 0);
Vec3d fpt(-1,0,0);
meridianSphericalCap.n.transfo4d(Mat4d::rotation(Vec3d(0, 0,
1), -definingAngle*M_PI/180.));
fpt.transfo4d(Mat4d::rotation(Vec3d(0, 0, 1), -definingAngle
*M_PI/180.));
// Vec3d p1, p2;
// //if (!SphericalCap::intersectionPoints(viewPortSphericalCap
, meridianSphericalCap, p1, p2))
// {
// //if ((viewPortSphericalCap.d<meridianSphericalCap.d
&& viewPortSphericalCap.contains(meridianSphericalCap.n))
// // || (viewPortSphericalCap.d<-meridianSpherica
lCap.d && viewPortSphericalCap.contains(-meridianSphericalCap.n)))
// { // N.B. we had 3x120degrees here. Look into GridLi
neMgr to restore if neessary.
// // The meridian is fully included in the vie
wport, draw it in 3 sub-arcs to avoid length > 180.
const Mat4d& rotLonP90 = Mat4d::rotation(mer
idianSphericalCap.n, 90.*M_PI/180.);
const Mat4d& rotLonM90 = Mat4d::rotation(mer
idianSphericalCap.n, -90.*M_PI/180.);
Vec3d rotFpt=fpt;
rotFpt.transfo4d(rotLonP90);
Vec3d rotFpt2=fpt;
rotFpt2.transfo4d(rotLonM90);
sPainter.drawGreatCircleArc(fpt, rotFpt, NUL
L, alViewportEdgeIntersectCallback, &userData);
sPainter.drawGreatCircleArc(rotFpt2, fpt, NU
LL, alViewportEdgeIntersectCallback, &userData);
//sPainter.drawGreatCircleArc(rotFpt2, fpt,
NULL, alViewportEdgeIntersectCallback, &userData);
return;
// }
// //else
// // return;
// }
// Vec3d middlePoint = p1+p2;
// middlePoint.normalize();
// if (!viewPortSphericalCap.contains(middlePoint))
// middlePoint*=-1.;
// // Draw the arc in 2 sub-arcs to avoid lengths > 180 deg
// sPainter.drawGreatCircleArc(p1, middlePoint, NULL, alViewpor
tEdgeIntersectCallback, &userData);
// sPainter.drawGreatCircleArc(p2, middlePoint, NULL, alViewpor
tEdgeIntersectCallback, &userData);
// // OpenGL ES 2.0 doesn't have GL_LINE_SMOOTH
// #ifdef GL_LINE_SMOOTH
// if (QOpenGLContext::currentContext()->format().renderableTyp
e()==QSurfaceFormat::OpenGL)
// glDisable(GL_LINE_SMOOTH);
// #endif
// glDisable(GL_BLEND);
// return;
}
/////////////////////////////////////////////////
// Else draw small circles (declinations). (Technically, Equator is
one, but ok...)
// Draw the line // Draw the line
const double lat=declination*M_PI/180.0; const double lat=definingAngle*M_PI/180.0;
SphericalCap declinationCap(Vec3d(0,0,1), std::sin(lat)); SphericalCap declinationCap(Vec3d(0,0,1), std::sin(lat));
const Vec3d rotCenter(0,0,declinationCap.d); const Vec3d rotCenter(0,0,declinationCap.d);
Vec3d p1, p2; Vec3d p1, p2;
if (!SphericalCap::intersectionPoints(viewPortSphericalCap, declinat ionCap, p1, p2)) if (!SphericalCap::intersectionPoints(viewPortSphericalCap, declinat ionCap, p1, p2))
{ {
if ((viewPortSphericalCap.d<declinationCap.d && viewPortSphe ricalCap.contains(declinationCap.n)) if ((viewPortSphericalCap.d<declinationCap.d && viewPortSphe ricalCap.contains(declinationCap.n))
|| (viewPortSphericalCap.d<-declinationCap.d && view PortSphericalCap.contains(-declinationCap.n))) || (viewPortSphericalCap.d<-declinationCap.d && view PortSphericalCap.contains(-declinationCap.n)))
{ {
// The line is fully included in the viewport, draw it in 3 sub-arcs to avoid length > 180. // The line is fully included in the viewport, draw it in 3 sub-arcs to avoid length > 180.
 End of changes. 57 change blocks. 
118 lines changed or deleted 685 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/