-
-
Notifications
You must be signed in to change notification settings - Fork 989
Expand file tree
/
Copy pathArchaeoLines.cpp
More file actions
1663 lines (1575 loc) · 68.1 KB
/
ArchaeoLines.cpp
File metadata and controls
1663 lines (1575 loc) · 68.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Copyright (C) 2014-21 Georg Zotti
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
*/
#include "StelUtils.hpp"
#include "StelProjector.hpp"
#include "StelPainter.hpp"
#include "StelApp.hpp"
#include "StelCore.hpp"
#include "StelModuleMgr.hpp"
#include "StelObjectMgr.hpp"
#include "StelGui.hpp"
#include "StelGuiItems.hpp"
#include "ArchaeoLines.hpp"
#include "ArchaeoLinesDialog.hpp"
#include "SolarSystem.hpp"
#include "Planet.hpp"
#include <QDebug>
#include <QTimer>
#include <QPixmap>
#include <QColor>
#include <QFont>
#include <QSettings>
#include <QMouseEvent>
#include <cmath>
#include <stdexcept>
//! This method is the one called automatically by the StelModuleMgr just
//! after loading the dynamic library
StelModule* ArchaeoLinesStelPluginInterface::getStelModule() const
{
return new ArchaeoLines();
}
StelPluginInfo ArchaeoLinesStelPluginInterface::getPluginInfo() const
{
// Allow to load the resources when used as a static plugin
Q_INIT_RESOURCE(ArchaeoLines);
StelPluginInfo info;
info.id = "ArchaeoLines";
info.displayedName = N_("ArchaeoLines");
info.authors = "Georg Zotti";
info.contact = "https://homepage.univie.ac.at/Georg.Zotti";
info.description = N_("A tool for archaeo-/ethnoastronomical alignment studies");
info.version = ARCHAEOLINES_PLUGIN_VERSION;
info.license = ARCHAEOLINES_PLUGIN_LICENSE;
return info;
}
ArchaeoLines::ArchaeoLines()
: flagShowArchaeoLines(false)
, lineWidth(1)
, flagShowEquinox(false)
, flagShowSolstices(false)
, flagShowCrossquarters(false)
, flagShowMajorStandstills(false)
, flagShowMinorStandstills(false)
, flagShowPolarCircles(false)
, flagShowZenithPassage(false)
, flagShowNadirPassage(false)
, flagShowSelectedObject(false)
, flagShowSelectedObjectAzimuth(false)
, flagShowSelectedObjectHourAngle(false)
, flagShowCurrentSun(false)
, flagShowCurrentMoon(false)
, 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)
, flagShowCustomAltitude1(false)
, flagShowCustomAltitude2(false)
//, customAzimuth1(0.0)
//, customAzimuth2(0.0)
, flagShowCustomDeclination1(false)
, flagShowCustomDeclination2(false)
, lastJDE(0.0)
#ifndef NO_GUI
, toolbarButton(Q_NULLPTR)
#endif
{
setObjectName("ArchaeoLines");
core=StelApp::getInstance().getCore();
Q_ASSERT(core);
objMgr=GETSTELMODULE(StelObjectMgr);
Q_ASSERT(objMgr);
// optimize readability so that each upper line of the lunistice doubles is labeled.
equinoxLine = new ArchaeoLine(ArchaeoLine::Equinox, 0.0);
northernSolsticeLine = new ArchaeoLine(ArchaeoLine::Solstices, 23.50);
southernSolsticeLine = new ArchaeoLine(ArchaeoLine::Solstices, -23.50);
northernCrossquarterLine = new ArchaeoLine(ArchaeoLine::Crossquarters, 16.50);
southernCrossquarterLine = new ArchaeoLine(ArchaeoLine::Crossquarters, -16.50);
northernMajorStandstillLine0 = new ArchaeoLine(ArchaeoLine::MajorStandstill, 23.5+5.1);
northernMajorStandstillLine1 = new ArchaeoLine(ArchaeoLine::MajorStandstill, 23.5+5.1);
northernMajorStandstillLine0->setLabelVisible(false);
northernMinorStandstillLine2 = new ArchaeoLine(ArchaeoLine::MinorStandstill, 23.5-5.1);
northernMinorStandstillLine3 = new ArchaeoLine(ArchaeoLine::MinorStandstill, 23.5-5.1);
northernMinorStandstillLine2->setLabelVisible(false);
southernMinorStandstillLine4 = new ArchaeoLine(ArchaeoLine::MinorStandstill, -23.5+5.1);
southernMinorStandstillLine5 = new ArchaeoLine(ArchaeoLine::MinorStandstill, -23.5+5.1);
southernMinorStandstillLine4->setLabelVisible(false);
southernMajorStandstillLine6 = new ArchaeoLine(ArchaeoLine::MajorStandstill, -23.5-5.1);
southernMajorStandstillLine7 = new ArchaeoLine(ArchaeoLine::MajorStandstill, -23.5-5.1);
southernMajorStandstillLine6->setLabelVisible(false);
northernPolarCircleLine = new ArchaeoLine(ArchaeoLine::PolarCircles, 66.5);
southernPolarCircleLine = new ArchaeoLine(ArchaeoLine::PolarCircles, -66.5);
zenithPassageLine = new ArchaeoLine(ArchaeoLine::ZenithPassage, 48.0);
nadirPassageLine = new ArchaeoLine(ArchaeoLine::NadirPassage, 42.0);
selectedObjectLine = new ArchaeoLine(ArchaeoLine::SelectedObject, 0.0);
selectedObjectAzimuthLine = new ArchaeoLine(ArchaeoLine::SelectedObjectAzimuth, 0.0);
selectedObjectHourAngleLine = new ArchaeoLine(ArchaeoLine::SelectedObjectHourAngle, 0.0);
currentSunLine = new ArchaeoLine(ArchaeoLine::CurrentSun, 0.0);
currentMoonLine = new ArchaeoLine(ArchaeoLine::CurrentMoon, 0.0);
currentPlanetLine = new ArchaeoLine(ArchaeoLine::CurrentPlanetNone, 0.0);
geographicLocation1Line = new ArchaeoLine(ArchaeoLine::GeographicLocation1, 0.0);
geographicLocation2Line = new ArchaeoLine(ArchaeoLine::GeographicLocation2, 0.0);
customAzimuth1Line = new ArchaeoLine(ArchaeoLine::CustomAzimuth1, 0.0);
customAzimuth2Line = new ArchaeoLine(ArchaeoLine::CustomAzimuth2, 0.0);
customAltitude1Line = new ArchaeoLine(ArchaeoLine::CustomAltitude1, 0.0);
customAltitude2Line = new ArchaeoLine(ArchaeoLine::CustomAltitude2, 0.0);
customDeclination1Line = new ArchaeoLine(ArchaeoLine::CustomDeclination1, 0.0);
customDeclination2Line = new ArchaeoLine(ArchaeoLine::CustomDeclination2, 0.0);
#ifndef NO_GUI
configDialog = new ArchaeoLinesDialog();
#endif
conf = StelApp::getInstance().getSettings();
connect(core, SIGNAL(locationChanged(StelLocation)), this, SLOT(updateObserverLocation(StelLocation)));
}
ArchaeoLines::~ArchaeoLines()
{
delete equinoxLine; equinoxLine=Q_NULLPTR;
delete northernSolsticeLine; northernSolsticeLine=Q_NULLPTR;
delete southernSolsticeLine; southernSolsticeLine=Q_NULLPTR;
delete northernCrossquarterLine; northernCrossquarterLine=Q_NULLPTR;
delete southernCrossquarterLine; southernCrossquarterLine=Q_NULLPTR;
delete northernMajorStandstillLine0; northernMajorStandstillLine0=Q_NULLPTR;
delete northernMajorStandstillLine1; northernMajorStandstillLine1=Q_NULLPTR;
delete northernMinorStandstillLine2; northernMinorStandstillLine2=Q_NULLPTR;
delete northernMinorStandstillLine3; northernMinorStandstillLine3=Q_NULLPTR;
delete southernMinorStandstillLine4; southernMinorStandstillLine4=Q_NULLPTR;
delete southernMinorStandstillLine5; southernMinorStandstillLine5=Q_NULLPTR;
delete southernMajorStandstillLine6; southernMajorStandstillLine6=Q_NULLPTR;
delete southernMajorStandstillLine7; southernMajorStandstillLine7=Q_NULLPTR;
delete northernPolarCircleLine; northernPolarCircleLine=Q_NULLPTR;
delete southernPolarCircleLine; southernPolarCircleLine=Q_NULLPTR;
delete zenithPassageLine; zenithPassageLine=Q_NULLPTR;
delete nadirPassageLine; nadirPassageLine=Q_NULLPTR;
delete selectedObjectLine; selectedObjectLine=Q_NULLPTR;
delete selectedObjectAzimuthLine; selectedObjectAzimuthLine=Q_NULLPTR;
delete selectedObjectHourAngleLine; selectedObjectHourAngleLine=Q_NULLPTR;
delete currentSunLine; currentSunLine=Q_NULLPTR;
delete currentMoonLine; currentMoonLine=Q_NULLPTR;
delete currentPlanetLine; currentPlanetLine=Q_NULLPTR;
delete geographicLocation1Line; geographicLocation1Line=Q_NULLPTR;
delete geographicLocation2Line; geographicLocation2Line=Q_NULLPTR;
delete customAzimuth1Line; customAzimuth1Line=Q_NULLPTR;
delete customAzimuth2Line; customAzimuth2Line=Q_NULLPTR;
delete customAltitude1Line; customAltitude1Line=Q_NULLPTR;
delete customAltitude2Line; customAltitude2Line=Q_NULLPTR;
delete customDeclination1Line; customDeclination1Line=Q_NULLPTR;
delete customDeclination2Line; customDeclination2Line=Q_NULLPTR;
#ifndef NO_GUI
delete configDialog; configDialog=Q_NULLPTR;
#endif
}
bool ArchaeoLines::configureGui(bool show)
{
#ifdef NO_GUI
return false;
#else
if (show)
configDialog->setVisible(true);
return true;
#endif
}
//! Determine which "layer" the plugin's drawing will happen on.
double ArchaeoLines::getCallOrder(StelModuleActionName actionName) const
{
if (actionName==StelModule::ActionDraw)
return StelApp::getInstance().getModuleMgr().getModule("GridLinesMgr")->getCallOrder(actionName)+1.; // one after GridlineMgr: else its equator covers our equinox line!
return 0;
}
void ArchaeoLines::init()
{
Q_ASSERT(equinoxLine);
Q_ASSERT(northernSolsticeLine);
Q_ASSERT(southernSolsticeLine);
Q_ASSERT(northernCrossquarterLine);
Q_ASSERT(southernCrossquarterLine);
Q_ASSERT(northernMajorStandstillLine0);
Q_ASSERT(northernMajorStandstillLine1);
Q_ASSERT(northernMinorStandstillLine2);
Q_ASSERT(northernMinorStandstillLine3);
Q_ASSERT(southernMinorStandstillLine4);
Q_ASSERT(southernMinorStandstillLine5);
Q_ASSERT(southernMajorStandstillLine6);
Q_ASSERT(southernMajorStandstillLine7);
Q_ASSERT(northernPolarCircleLine);
Q_ASSERT(southernPolarCircleLine);
Q_ASSERT(zenithPassageLine);
Q_ASSERT(nadirPassageLine);
Q_ASSERT(selectedObjectLine);
Q_ASSERT(selectedObjectAzimuthLine);
Q_ASSERT(selectedObjectHourAngleLine);
Q_ASSERT(currentSunLine);
Q_ASSERT(currentMoonLine);
Q_ASSERT(currentPlanetLine);
Q_ASSERT(geographicLocation1Line);
Q_ASSERT(geographicLocation2Line);
Q_ASSERT(customAzimuth1Line);
Q_ASSERT(customAzimuth2Line);
Q_ASSERT(customAltitude1Line);
Q_ASSERT(customAltitude2Line);
Q_ASSERT(customDeclination1Line);
Q_ASSERT(customDeclination2Line);
connect(this, SIGNAL(equinoxColorChanged(Vec3f)), equinoxLine , SLOT(setColor(Vec3f)));
connect(this, SIGNAL(solsticesColorChanged(Vec3f)), northernSolsticeLine , SLOT(setColor(Vec3f)));
connect(this, SIGNAL(solsticesColorChanged(Vec3f)), southernSolsticeLine , SLOT(setColor(Vec3f)));
connect(this, SIGNAL(crossquartersColorChanged(Vec3f)), northernCrossquarterLine , SLOT(setColor(Vec3f)));
connect(this, SIGNAL(crossquartersColorChanged(Vec3f)), southernCrossquarterLine , SLOT(setColor(Vec3f)));
connect(this, SIGNAL(majorStandstillColorChanged(Vec3f)), northernMajorStandstillLine0, SLOT(setColor(Vec3f)));
connect(this, SIGNAL(majorStandstillColorChanged(Vec3f)), northernMajorStandstillLine1, SLOT(setColor(Vec3f)));
connect(this, SIGNAL(majorStandstillColorChanged(Vec3f)), southernMajorStandstillLine6, SLOT(setColor(Vec3f)));
connect(this, SIGNAL(majorStandstillColorChanged(Vec3f)), southernMajorStandstillLine7, SLOT(setColor(Vec3f)));
connect(this, SIGNAL(minorStandstillColorChanged(Vec3f)), northernMinorStandstillLine2, SLOT(setColor(Vec3f)));
connect(this, SIGNAL(minorStandstillColorChanged(Vec3f)), northernMinorStandstillLine3, SLOT(setColor(Vec3f)));
connect(this, SIGNAL(minorStandstillColorChanged(Vec3f)), southernMinorStandstillLine4, SLOT(setColor(Vec3f)));
connect(this, SIGNAL(minorStandstillColorChanged(Vec3f)), southernMinorStandstillLine5, SLOT(setColor(Vec3f)));
connect(this, SIGNAL(polarCirclesColorChanged(Vec3f)), northernPolarCircleLine , SLOT(setColor(Vec3f)));
connect(this, SIGNAL(polarCirclesColorChanged(Vec3f)), southernPolarCircleLine , SLOT(setColor(Vec3f)));
connect(this, SIGNAL(zenithPassageColorChanged(Vec3f)), zenithPassageLine , SLOT(setColor(Vec3f)));
connect(this, SIGNAL(nadirPassageColorChanged(Vec3f)), nadirPassageLine , SLOT(setColor(Vec3f)));
connect(this, SIGNAL(selectedObjectColorChanged(Vec3f)), selectedObjectLine , SLOT(setColor(Vec3f)));
connect(this, SIGNAL(selectedObjectAzimuthColorChanged(Vec3f)), selectedObjectAzimuthLine , SLOT(setColor(Vec3f)));
connect(this, SIGNAL(selectedObjectHourAngleColorChanged(Vec3f)),selectedObjectHourAngleLine , SLOT(setColor(Vec3f)));
connect(this, SIGNAL(currentSunColorChanged(Vec3f)), currentSunLine , SLOT(setColor(Vec3f)));
connect(this, SIGNAL(currentMoonColorChanged(Vec3f)), currentMoonLine , SLOT(setColor(Vec3f)));
connect(this, SIGNAL(currentPlanetColorChanged(Vec3f)), currentPlanetLine , SLOT(setColor(Vec3f)));
connect(this, SIGNAL(geographicLocation1ColorChanged(Vec3f)), geographicLocation1Line , SLOT(setColor(Vec3f)));
connect(this, SIGNAL(geographicLocation2ColorChanged(Vec3f)), geographicLocation2Line , SLOT(setColor(Vec3f)));
connect(this, SIGNAL(customAzimuth1ColorChanged(Vec3f)), customAzimuth1Line , SLOT(setColor(Vec3f)));
connect(this, SIGNAL(customAzimuth2ColorChanged(Vec3f)), customAzimuth2Line , SLOT(setColor(Vec3f)));
connect(this, SIGNAL(customAltitude1ColorChanged(Vec3f)), customAltitude1Line , SLOT(setColor(Vec3f)));
connect(this, SIGNAL(customAltitude2ColorChanged(Vec3f)), customAltitude2Line , SLOT(setColor(Vec3f)));
connect(this, SIGNAL(customDeclination1ColorChanged(Vec3f)), customDeclination1Line , SLOT(setColor(Vec3f)));
connect(this, SIGNAL(customDeclination2ColorChanged(Vec3f)), customDeclination2Line , SLOT(setColor(Vec3f)));
loadSettings();
// Create action for enable/disable & hook up signals
QString section=N_("ArchaeoLines");
addAction("actionShow_ArchaeoLines", section, N_("ArchaeoLines"), "enabled", "Ctrl+U");
#ifndef NO_GUI
addAction("actionShow_ArchaeoLines_dialog", section, N_("Show settings dialog"), configDialog, "visible", "Ctrl+Shift+U");
// Add a toolbar button
StelApp& app=StelApp::getInstance();
try
{
StelGui* gui = dynamic_cast<StelGui*>(app.getGui());
if (gui!=Q_NULLPTR)
{
toolbarButton = new StelButton(Q_NULLPTR,
QPixmap(":/archaeoLines/bt_archaeolines_on.png"),
QPixmap(":/archaeoLines/bt_archaeolines_off.png"),
QPixmap(":/graphicGui/miscGlow32x32.png"),
"actionShow_ArchaeoLines",
false,
"actionShow_ArchaeoLines_dialog");
gui->getButtonBar()->addButton(toolbarButton, "065-pluginsGroup");
}
}
catch (std::runtime_error& e)
{
qWarning() << "Unable to create toolbar button for ArchaeoLines plugin: " << e.what();
}
#endif
addAction("actionAL_showEquinoxLine", section, N_("Show Line for Equinox"), "flagShowEquinox" ); // No Shortcuts configured.
addAction("actionAL_showSolsticeLines", section, N_("Show Line for Solstices"), "flagShowSolstices" ); // No Shortcuts configured.
addAction("actionAL_showCrossquarterLines", section, N_("Show Line for Crossquarter"), "flagShowCrossquarters" ); // No Shortcuts configured.
addAction("actionAL_showMajorStandstillLines", section, N_("Show Line for Major Standstill"), "flagShowMajorStandstills"); // No Shortcuts configured.
addAction("actionAL_showMinorStandstillLines", section, N_("Show Line for Minor Standstill"), "flagShowMinorStandstills"); // No Shortcuts configured.
addAction("actionAL_showPolarCircleLines", section, N_("Show Polar Circles"), "flagShowPolarCircles" ); // No Shortcuts configured.
addAction("actionAL_showZenithPassageLine", section, N_("Show Line for Zenith Passage"), "flagShowZenithPassage" ); // No Shortcuts configured.
addAction("actionAL_showNadirPassageLine", section, N_("Show Line for Nadir Passage"), "flagShowNadirPassage" ); // No Shortcuts configured.
addAction("actionAL_showSelectedObjectLine", section, N_("Show Line for Selected Object"), "flagShowSelectedObject" ); // No Shortcuts configured.
addAction("actionAL_showSelectedObjectAzimuthLine", section, N_("Show Line for Selected Object's Azimuth"), "flagShowSelectedObjectAzimuth" ); // No Shortcuts configured.
addAction("actionAL_showSelectedObjectHourAngleLine", section, N_("Show Line for Selected Object's Hour Angle"), "flagShowSelectedObjectHourAngle" ); // No Shortcuts configured.
addAction("actionAL_showCurrentSunLine", section, N_("Show Line for Current Sun"), "flagShowCurrentSun" ); // No Shortcuts configured.
addAction("actionAL_showCurrentMoonLine", section, N_("Show Line for Current Moon"), "flagShowCurrentMoon" ); // No Shortcuts configured.
addAction("actionAL_showGeographicLocation1Line",section, N_("Show Vertical for Geographic Location 1"), "flagShowGeographicLocation1" ); // No Shortcuts configured.
addAction("actionAL_showGeographicLocation2Line",section, N_("Show Vertical for Geographic Location 2"), "flagShowGeographicLocation2" ); // No Shortcuts configured.
addAction("actionAL_showCustomAzimuth1Line", section, N_("Show Vertical for Custom Azimuth 1"), "flagShowCustomAzimuth1" ); // No Shortcuts configured.
addAction("actionAL_showCustomAzimuth2Line", section, N_("Show Vertical for Custom Azimuth 2"), "flagShowCustomAzimuth2" ); // No Shortcuts configured.
addAction("actionAL_showCustomAltitude1Line", section, N_("Show Line for Custom Altitude 1"), "flagShowCustomAltitude1" ); // No Shortcuts configured.
addAction("actionAL_showCustomAltitude2Line", section, N_("Show Line for Custom Altitude 2"), "flagShowCustomAltitude2" ); // No Shortcuts configured.
addAction("actionAL_showCustomDeclination1Line", section, N_("Show Line for Custom Declination 1"), "flagShowCustomDeclination1" ); // No Shortcuts configured.
addAction("actionAL_showCustomDeclination2Line", section, N_("Show Line for Custom Declination 2"), "flagShowCustomDeclination2" ); // No Shortcuts configured.
}
void ArchaeoLines::update(double deltaTime)
{
if (core->getCurrentPlanet()->getEnglishName()!="Earth")
return;
static SolarSystem *ssystem=GETSTELMODULE(SolarSystem);
static const double lunarI=5.145396; // inclination of lunar orbit
// compute min and max distance values for horizontal parallax.
// Meeus, AstrAlg 98, p342.
static const double meanDist=385000.56; // km earth-moon.
static const double addedValues=20905.355+3699.111+2955.968+569.925+48.888+3.149+246.158+152.138+170.733+
204.586+129.620+108.743+104.755+10.321+79.661+34.782+23.210+21.636+24.208+30.824+8.379+
16.675+12.831+10.445+11.650+14.403+7.003+10.056+6.322+9.884;
static const double minDist=meanDist-addedValues;
static const double maxDist=meanDist+addedValues;
static const double sinPiMin=6378.14/maxDist;
static const double sinPiMax=6378.14/minDist; // maximal parallax at min. distance!
static double eps;
PlanetP planet=ssystem->getSun();
double dec_equ, ra_equ, az, alt;
StelUtils::rectToSphe(&ra_equ,&dec_equ,planet->getEquinoxEquatorialPos(core));
currentSunLine->setDefiningAngle(dec_equ * 180.0/M_PI);
planet=ssystem->getMoon();
StelUtils::rectToSphe(&ra_equ,&dec_equ,planet->getEquinoxEquatorialPos(core));
currentMoonLine->setDefiningAngle(dec_equ * 180.0/M_PI);
if (enumShowCurrentPlanet>ArchaeoLine::CurrentPlanetNone)
{
const char *planetStrings[]={"", "Mercury", "Venus", "Mars", "Jupiter", "Saturn"};
QString currentPlanet(planetStrings[enumShowCurrentPlanet - ArchaeoLine::CurrentPlanetNone]);
planet=ssystem->searchByEnglishName(currentPlanet);
Q_ASSERT(planet);
StelUtils::rectToSphe(&ra_equ,&dec_equ,planet->getEquinoxEquatorialPos(core));
currentPlanetLine->setDefiningAngle(dec_equ * 180.0/M_PI);
}
double newJDE=core->getJDE();
if (fabs(newJDE-lastJDE) > 10.0) // enough to compute this every 10 days?
{
static const double invSqrt2=1.0/std::sqrt(2.0);
double epsRad=ssystem->getEarth()->getRotObliquity(newJDE);
double xqDec=asin(sin(epsRad)*invSqrt2)*180.0/M_PI;
eps= epsRad*180.0/M_PI;
northernSolsticeLine->setDefiningAngle(eps);
southernSolsticeLine->setDefiningAngle(-eps);
northernPolarCircleLine->setDefiningAngle(90.-eps);
southernPolarCircleLine->setDefiningAngle(-90.+eps);
northernCrossquarterLine->setDefiningAngle( xqDec);
southernCrossquarterLine->setDefiningAngle(-xqDec);
lastJDE=newJDE;
}
StelLocation loc=core->getCurrentLocation();
// compute parallax correction with Meeus 40.6. First, find H from h=0, then add corrections.
static const double b_over_a=0.99664719;
const bool useGeocentric = !core->getUseTopocentricCoordinates();
const double latRad=useGeocentric ? 0.0 : static_cast<double>(loc.getLatitude())*M_PI_180;
const double u=std::atan(b_over_a*std::tan(latRad));
const double rhoSinPhiP=useGeocentric ? 0. : b_over_a*std::sin(u)+loc.altitude/6378140.0*std::sin(latRad);
const double rhoCosPhiP=useGeocentric ? 1. : std::cos(u)+loc.altitude/6378140.0*std::cos(latRad);
QVector<double> lunarDE(8), sinPi(8);
lunarDE[0]=(eps+lunarI)*M_PI/180.0; // min_distance=max_parallax
lunarDE[1]=(eps+lunarI)*M_PI/180.0;
lunarDE[2]=(eps-lunarI)*M_PI/180.0;
lunarDE[3]=(eps-lunarI)*M_PI/180.0;
lunarDE[4]=(-eps+lunarI)*M_PI/180.0;
lunarDE[5]=(-eps+lunarI)*M_PI/180.0;
lunarDE[6]=(-eps-lunarI)*M_PI/180.0;
lunarDE[7]=(-eps-lunarI)*M_PI/180.0;
for (int i=0; i<8; i+=2){
sinPi[i]=sinPiMax;
sinPi[i+1]=sinPiMin;
}
// In the following we compute parallax-corrected declinations of the setting moon for max and min distances.
// odd indices for max_distance=min_parallax, even indices for min_distance=max_parallax. References are for Meeus AstrAlg 1998.
QVector<double> cosHo(8), sinHo(8); // setting hour angles.
for (int i=0; i<8; i++){
cosHo[i]=qMax(-1.0, qMin(1.0, -std::tan(latRad)*std::tan(lunarDE[i])));
sinHo[i]=std::sin(std::acos(cosHo[i]));
}
// 40.6
QVector<double> A(8), B(8), C(8), q(8), lunarDEtopo(8);
for (int i=0; i<8; i++){
A[i]=std::cos(lunarDE[i])*sinHo[i];
B[i]=std::cos(lunarDE[i])*cosHo[i]-rhoCosPhiP*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]);
lunarDEtopo[i]=std::asin(C[i]/q[i]);
}
northernMajorStandstillLine0->setDefiningAngle(lunarDEtopo[0] *180.0/M_PI);
northernMajorStandstillLine1->setDefiningAngle(lunarDEtopo[1] *180.0/M_PI);
northernMinorStandstillLine2->setDefiningAngle(lunarDEtopo[2] *180.0/M_PI);
northernMinorStandstillLine3->setDefiningAngle(lunarDEtopo[3] *180.0/M_PI);
southernMinorStandstillLine4->setDefiningAngle(lunarDEtopo[4] *180.0/M_PI);
southernMinorStandstillLine5->setDefiningAngle(lunarDEtopo[5] *180.0/M_PI);
southernMajorStandstillLine6->setDefiningAngle(lunarDEtopo[6] *180.0/M_PI);
southernMajorStandstillLine7->setDefiningAngle(lunarDEtopo[7] *180.0/M_PI);
zenithPassageLine->setDefiningAngle(static_cast<double>(loc.getLatitude()));
nadirPassageLine->setDefiningAngle(static_cast<double>(-loc.getLatitude()));
// Selected object?
if (objMgr->getWasSelected())
{
StelObjectP obj=objMgr->getSelectedObject().first();
StelUtils::rectToSphe(&ra_equ,&dec_equ,obj->getEquinoxEquatorialPos(core));
selectedObjectLine->setDefiningAngle(dec_equ * 180.0/M_PI);
selectedObjectLine->setLabel(obj->getNameI18n());
selectedObjectHourAngleLine->setDefiningAngle((M_PI-ra_equ) * 180.0/M_PI);
selectedObjectHourAngleLine->setLabel(obj->getNameI18n());
StelUtils::rectToSphe(&az,&alt,obj->getAltAzPosAuto(core));
selectedObjectAzimuthLine->setDefiningAngle((M_PI-az) * 180.0/M_PI);
selectedObjectAzimuthLine->setLabel(obj->getNameI18n());
}
// Updates for line brightness
lineFader.update(static_cast<int>(deltaTime*1000));
equinoxLine->update(deltaTime);
northernSolsticeLine->update(deltaTime);
southernSolsticeLine->update(deltaTime);
northernCrossquarterLine->update(deltaTime);
southernCrossquarterLine->update(deltaTime);
northernMajorStandstillLine0->update(deltaTime);
northernMajorStandstillLine1->update(deltaTime);
northernMinorStandstillLine2->update(deltaTime);
northernMinorStandstillLine3->update(deltaTime);
southernMinorStandstillLine4->update(deltaTime);
southernMinorStandstillLine5->update(deltaTime);
southernMajorStandstillLine6->update(deltaTime);
southernMajorStandstillLine7->update(deltaTime);
northernPolarCircleLine->update(deltaTime);
southernPolarCircleLine->update(deltaTime);
zenithPassageLine->update(deltaTime);
nadirPassageLine->update(deltaTime);
selectedObjectLine->update(deltaTime);
selectedObjectAzimuthLine->update(deltaTime);
selectedObjectHourAngleLine->update(deltaTime);
currentSunLine->update(deltaTime);
currentMoonLine->update(deltaTime);
currentPlanetLine->update(deltaTime);
geographicLocation1Line->update(deltaTime);
geographicLocation2Line->update(deltaTime);
customAzimuth1Line->update(deltaTime);
customAzimuth2Line->update(deltaTime);
customAltitude1Line->update(deltaTime);
customAltitude2Line->update(deltaTime);
customDeclination1Line->update(deltaTime);
customDeclination2Line->update(deltaTime);
}
//! Draw any parts on the screen which are for our module
void ArchaeoLines::draw(StelCore* core)
{
if (core->getCurrentPlanet()->getEnglishName()!="Earth")
return;
equinoxLine->draw(core, lineFader.getInterstate());
northernSolsticeLine->draw(core, lineFader.getInterstate());
southernSolsticeLine->draw(core, lineFader.getInterstate());
northernCrossquarterLine->draw(core, lineFader.getInterstate());
southernCrossquarterLine->draw(core, lineFader.getInterstate());
northernMajorStandstillLine0->draw(core, lineFader.getInterstate());
northernMajorStandstillLine1->draw(core, lineFader.getInterstate());
northernMinorStandstillLine2->draw(core, lineFader.getInterstate());
northernMinorStandstillLine3->draw(core, lineFader.getInterstate());
southernMinorStandstillLine4->draw(core, lineFader.getInterstate());
southernMinorStandstillLine5->draw(core, lineFader.getInterstate());
southernMajorStandstillLine6->draw(core, lineFader.getInterstate());
southernMajorStandstillLine7->draw(core, lineFader.getInterstate());
northernPolarCircleLine->draw(core, lineFader.getInterstate());
southernPolarCircleLine->draw(core, lineFader.getInterstate());
zenithPassageLine->draw(core, lineFader.getInterstate());
nadirPassageLine->draw(core, lineFader.getInterstate());
if (objMgr->getWasSelected())
{
selectedObjectLine->draw(core, lineFader.getInterstate());
selectedObjectAzimuthLine->draw(core, lineFader.getInterstate());
selectedObjectHourAngleLine->draw(core, lineFader.getInterstate());
}
currentSunLine->draw(core, lineFader.getInterstate());
currentMoonLine->draw(core, lineFader.getInterstate());
if (enumShowCurrentPlanet>ArchaeoLine::CurrentPlanetNone)
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());
customAltitude1Line->draw(core, lineFader.getInterstate());
customAltitude2Line->draw(core, lineFader.getInterstate());
customDeclination1Line->draw(core, lineFader.getInterstate());
customDeclination2Line->draw(core, lineFader.getInterstate());
}
void ArchaeoLines::enableArchaeoLines(bool b)
{
if (b!=flagShowArchaeoLines)
{
flagShowArchaeoLines = b;
lineFader = b;
conf->setValue("ArchaeoLines/enable_at_startup", flagShowArchaeoLines);
emit archaeoLinesEnabledChanged(b);
}
}
void ArchaeoLines::restoreDefaultSettings()
{
Q_ASSERT(conf);
// Remove the old values...
conf->remove("ArchaeoLines");
// ...load the default values...
loadSettings();
}
void ArchaeoLines::loadSettings()
{
const bool azFromSouth=StelApp::getInstance().getFlagSouthAzimuthUsage();
setLineWidth(conf->value("ArchaeoLines/line_thickness", 1).toInt());
setEquinoxColor( Vec3f(conf->value("ArchaeoLines/color_equinox", "1.00,1.00,0.50").toString()));
setSolsticesColor( Vec3f(conf->value("ArchaeoLines/color_solstices", "1.00,0.15,0.15").toString()));
setCrossquartersColor( Vec3f(conf->value("ArchaeoLines/color_crossquarters", "1.00,0.75,0.25").toString()));
setMajorStandstillColor( Vec3f(conf->value("ArchaeoLines/color_major_standstill", "0.25,1.00,0.25").toString()));
setMinorStandstillColor( Vec3f(conf->value("ArchaeoLines/color_minor_standstill", "0.20,0.75,0.20").toString()));
setPolarCirclesColor( Vec3f(conf->value("ArchaeoLines/color_polar_circles", "0.25,0.25,0.75").toString()));
setZenithPassageColor( Vec3f(conf->value("ArchaeoLines/color_zenith_passage", "0.75,0.75,0.75").toString()));
setNadirPassageColor( Vec3f(conf->value("ArchaeoLines/color_nadir_passage", "0.25,0.25,0.25").toString()));
setSelectedObjectColor( Vec3f(conf->value("ArchaeoLines/color_selected_object", "1.00,1.00,1.00").toString()));
setSelectedObjectAzimuthColor( Vec3f(conf->value("ArchaeoLines/color_selected_object_azimuth", "1.00,1.00,1.00").toString()));
setSelectedObjectHourAngleColor(Vec3f(conf->value("ArchaeoLines/color_selected_object_hour_angle", "1.00,1.00,1.00").toString()));
setCurrentSunColor( Vec3f(conf->value("ArchaeoLines/color_current_sun", "1.00,1.00,0.75").toString()));
setCurrentMoonColor( Vec3f(conf->value("ArchaeoLines/color_current_moon", "0.50,1.00,0.50").toString()));
setCurrentPlanetColor( Vec3f(conf->value("ArchaeoLines/color_current_planet", "0.25,0.80,1.00").toString()));
setGeographicLocation1Color( Vec3f(conf->value("ArchaeoLines/color_geographic_location_1", "0.25,1.00,0.25").toString()));
setGeographicLocation2Color( Vec3f(conf->value("ArchaeoLines/color_geographic_location_2", "0.25,0.25,1.00").toString()));
setCustomAzimuth1Color( Vec3f(conf->value("ArchaeoLines/color_custom_azimuth_1", "0.25,1.00,0.25").toString()));
setCustomAzimuth2Color( Vec3f(conf->value("ArchaeoLines/color_custom_azimuth_2", "0.25,0.50,0.75").toString()));
setCustomAltitude1Color( Vec3f(conf->value("ArchaeoLines/color_custom_altitude_1", "0.25,1.00,0.25").toString()));
setCustomAltitude2Color( Vec3f(conf->value("ArchaeoLines/color_custom_altitude_2", "0.25,0.50,0.75").toString()));
setCustomDeclination1Color( Vec3f(conf->value("ArchaeoLines/color_custom_declination_1", "0.45,1.00,0.15").toString()));
setCustomDeclination2Color( Vec3f(conf->value("ArchaeoLines/color_custom_declination_2", "0.45,0.50,0.65").toString()));
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();
double azi=loc.getAzimuthForLocation(geographicLocation1Longitude, geographicLocation1Latitude);
if (azFromSouth) azi+=180.0;
geographicLocation1Line->setDefiningAngle(azi);
azi = loc.getAzimuthForLocation(geographicLocation2Longitude, geographicLocation2Latitude);
if (azFromSouth) azi+=180.0;
geographicLocation2Line->setDefiningAngle(azi);
geographicLocation1Line->setLabel(conf->value("ArchaeoLines/geographic_location_1_label", "Mecca (Qibla)").toString());
geographicLocation2Line->setLabel(conf->value("ArchaeoLines/geographic_location_2_label", "Jerusalem").toString());
customAzimuth1Line->setDefiningAngle(conf->value("ArchaeoLines/custom_azimuth_1_angle", 0.0).toDouble());
customAzimuth2Line->setDefiningAngle(conf->value("ArchaeoLines/custom_azimuth_2_angle", 0.0).toDouble());
customAzimuth1Line->setLabel(conf->value("ArchaeoLines/custom_azimuth_1_label", "custAzi1").toString());
customAzimuth2Line->setLabel(conf->value("ArchaeoLines/custom_azimuth_2_label", "custAzi2").toString());
customAltitude1Line->setDefiningAngle(conf->value("ArchaeoLines/custom_altitude_1_angle", 0.0).toDouble());
customAltitude2Line->setDefiningAngle(conf->value("ArchaeoLines/custom_altitude_2_angle", 0.0).toDouble());
customAltitude1Line->setLabel(conf->value("ArchaeoLines/custom_altitude_1_label", "custAlt1").toString());
customAltitude2Line->setLabel(conf->value("ArchaeoLines/custom_altitude_2_label", "custAlt2").toString());
customDeclination1Line->setDefiningAngle(conf->value("ArchaeoLines/custom_declination_1_angle", 0.0).toDouble());
customDeclination2Line->setDefiningAngle(conf->value("ArchaeoLines/custom_declination_2_angle", 0.0).toDouble());
customDeclination1Line->setLabel(conf->value("ArchaeoLines/custom_declination_1_label", "custDec1").toString());
customDeclination2Line->setLabel(conf->value("ArchaeoLines/custom_declination_2_label", "custDec2").toString());
// Now activate line display if needed.
// 5 solar limits
showEquinox(conf->value("ArchaeoLines/show_equinox", true).toBool());
showSolstices(conf->value("ArchaeoLines/show_solstices", true).toBool());
showCrossquarters(conf->value("ArchaeoLines/show_crossquarters", true).toBool());
// 4 lunar limits
showMajorStandstills(conf->value("ArchaeoLines/show_major_standstills", true).toBool());
showMinorStandstills(conf->value("ArchaeoLines/show_minor_standstills", true).toBool());
// Polar circles (design mostly for sky globes)
showPolarCircles(conf->value("ArchaeoLines/show_polar_circles", true).toBool());
// esp. Mesoamerica
showZenithPassage(conf->value("ArchaeoLines/show_zenith_passage", true).toBool());
showNadirPassage(conf->value("ArchaeoLines/show_nadir_passage", false).toBool());
// indicators for line representing currently selected object's declination, azimuth and hour angle (or right ascension)
showSelectedObject(conf->value("ArchaeoLines/show_selected_object", false).toBool());
showSelectedObjectAzimuth(conf->value("ArchaeoLines/show_selected_object_azimuth", false).toBool());
showSelectedObjectHourAngle(conf->value("ArchaeoLines/show_selected_object_hour_angle", false).toBool());
// indicators for current declinations (those move fast over days...)
showCurrentSun(conf->value("ArchaeoLines/show_current_sun", true).toBool());
showCurrentMoon(conf->value("ArchaeoLines/show_current_moon", true).toBool());
showCurrentPlanetNamed(conf->value("ArchaeoLines/show_current_planet", "none").toString());
// azimuths to geographic targets, and custom azimuths.
showGeographicLocation1(conf->value("ArchaeoLines/show_geographic_location_1", false).toBool());
showGeographicLocation2(conf->value("ArchaeoLines/show_geographic_location_2", false).toBool());
showCustomAzimuth1(conf->value("ArchaeoLines/show_custom_azimuth_1", false).toBool());
showCustomAzimuth2(conf->value("ArchaeoLines/show_custom_azimuth_2", false).toBool());
showCustomAltitude1(conf->value("ArchaeoLines/show_custom_altitude_1", false).toBool());
showCustomAltitude2(conf->value("ArchaeoLines/show_custom_altitude_2", false).toBool());
showCustomDeclination1(conf->value("ArchaeoLines/show_custom_declination_1", false).toBool());
showCustomDeclination2(conf->value("ArchaeoLines/show_custom_declination_2", false).toBool());
enableArchaeoLines(conf->value("ArchaeoLines/enable_at_startup", false).toBool());
}
void ArchaeoLines::setLineWidth(int width)
{
if (width!=lineWidth)
{
lineWidth=qBound(1, width, 8); // Force some sensible limit
conf->setValue("ArchaeoLines/line_thickness", lineWidth);
emit lineWidthChanged(lineWidth);
}
}
void ArchaeoLines::showEquinox(bool b)
{
if (b!=flagShowEquinox)
{
flagShowEquinox=b;
conf->setValue("ArchaeoLines/show_equinox", isEquinoxDisplayed());
equinoxLine->setDisplayed(b);
emit showEquinoxChanged(b);
}
}
void ArchaeoLines::showSolstices(bool b)
{
if (b!=flagShowSolstices)
{
flagShowSolstices=b;
conf->setValue("ArchaeoLines/show_solstices", isSolsticesDisplayed());
northernSolsticeLine->setDisplayed(b);
southernSolsticeLine->setDisplayed(b);
emit showSolsticesChanged(b);
}
}
void ArchaeoLines::showCrossquarters(bool b)
{
if (b!=flagShowCrossquarters)
{
flagShowCrossquarters=b;
conf->setValue("ArchaeoLines/show_crossquarters", isCrossquartersDisplayed());
northernCrossquarterLine->setDisplayed(b);
southernCrossquarterLine->setDisplayed(b);
emit showCrossquartersChanged(b);
}
}
void ArchaeoLines::showMajorStandstills(bool b)
{
if (b!=flagShowMajorStandstills)
{
flagShowMajorStandstills=b;
conf->setValue("ArchaeoLines/show_major_standstills", isMajorStandstillsDisplayed());
northernMajorStandstillLine0->setDisplayed(b);
northernMajorStandstillLine1->setDisplayed(b);
southernMajorStandstillLine6->setDisplayed(b);
southernMajorStandstillLine7->setDisplayed(b);
emit showMajorStandstillsChanged(b);
}
}
void ArchaeoLines::showMinorStandstills(bool b)
{
if (b!=flagShowMinorStandstills)
{
flagShowMinorStandstills=b;
conf->setValue("ArchaeoLines/show_minor_standstills", isMinorStandstillsDisplayed());
northernMinorStandstillLine2->setDisplayed(b);
northernMinorStandstillLine3->setDisplayed(b);
southernMinorStandstillLine4->setDisplayed(b);
southernMinorStandstillLine5->setDisplayed(b);
emit showMinorStandstillsChanged(b);
}
}
void ArchaeoLines::showPolarCircles(bool b)
{
if (b!=flagShowPolarCircles)
{
flagShowPolarCircles=b;
conf->setValue("ArchaeoLines/show_polar_circles", isPolarCirclesDisplayed());
northernPolarCircleLine->setDisplayed(b);
southernPolarCircleLine->setDisplayed(b);
emit showPolarCirclesChanged(b);
}
}
void ArchaeoLines::showZenithPassage(bool b)
{
if (b!=flagShowZenithPassage)
{
flagShowZenithPassage=b;
conf->setValue("ArchaeoLines/show_zenith_passage", isZenithPassageDisplayed());
zenithPassageLine->setDisplayed(b);
emit showZenithPassageChanged(b);
}
}
void ArchaeoLines::showNadirPassage(bool b)
{
if (b!=flagShowNadirPassage)
{
flagShowNadirPassage=b;
conf->setValue("ArchaeoLines/show_nadir_passage", isNadirPassageDisplayed());
nadirPassageLine->setDisplayed(b);
emit showNadirPassageChanged(b);
}
}
void ArchaeoLines::showSelectedObject(bool b)
{
if (b!=flagShowSelectedObject)
{
flagShowSelectedObject=b;
conf->setValue("ArchaeoLines/show_selected_object", isSelectedObjectDisplayed());
selectedObjectLine->setDisplayed(b);
emit showSelectedObjectChanged(b);
}
}
void ArchaeoLines::showSelectedObjectAzimuth(bool b)
{
if (b!=flagShowSelectedObjectAzimuth)
{
flagShowSelectedObjectAzimuth=b;
conf->setValue("ArchaeoLines/show_selected_object_azimuth", isSelectedObjectAzimuthDisplayed());
selectedObjectAzimuthLine->setDisplayed(b);
emit showSelectedObjectAzimuthChanged(b);
}
}
void ArchaeoLines::showSelectedObjectHourAngle(bool b)
{
if (b!=flagShowSelectedObjectHourAngle)
{
flagShowSelectedObjectHourAngle=b;
conf->setValue("ArchaeoLines/show_selected_object_hour_angle", isSelectedObjectHourAngleDisplayed());
selectedObjectHourAngleLine->setDisplayed(b);
emit showSelectedObjectHourAngleChanged(b);
}
}
void ArchaeoLines::showCurrentSun(bool b)
{
if (b!=flagShowCurrentSun)
{
flagShowCurrentSun=b;
conf->setValue("ArchaeoLines/show_current_sun", isCurrentSunDisplayed());
currentSunLine->setDisplayed(b);
emit showCurrentSunChanged(b);
}
}
void ArchaeoLines::showCurrentMoon(bool b)
{
if (b!=flagShowCurrentMoon)
{
flagShowCurrentMoon=b;
conf->setValue("ArchaeoLines/show_current_moon", isCurrentMoonDisplayed());
currentMoonLine->setDisplayed(b);
emit showCurrentMoonChanged(b);
}
}
void ArchaeoLines::showCurrentPlanet(ArchaeoLine::Line l)
{
// Avoid a crash but give warning.
if ((l<ArchaeoLine::CurrentPlanetNone) || (l>ArchaeoLine::CurrentPlanetSaturn))
{
qWarning() << "ArchaeoLines::showCurrentPlanet: Invalid planet called:" << l << "Setting to none.";
l=ArchaeoLine::CurrentPlanetNone;
}
if(l!=enumShowCurrentPlanet)
{
enumShowCurrentPlanet=l;
const char *planetStrings[]={"none", "Mercury", "Venus", "Mars", "Jupiter", "Saturn"};
conf->setValue("ArchaeoLines/show_current_planet", planetStrings[l-ArchaeoLine::CurrentPlanetNone]);
currentPlanetLine->setLineType(enumShowCurrentPlanet);
currentPlanetLine->setDisplayed(enumShowCurrentPlanet != ArchaeoLine::CurrentPlanetNone);
emit currentPlanetChanged(l);
}
}
void ArchaeoLines::showCurrentPlanetNamed(const QString &planet)
{
static const QMap<QString, ArchaeoLine::Line>map={
{"none", ArchaeoLine::CurrentPlanetNone},
{"Mercury", ArchaeoLine::CurrentPlanetMercury},
{"Venus", ArchaeoLine::CurrentPlanetVenus},
{"Mars", ArchaeoLine::CurrentPlanetMars},
{"Jupiter", ArchaeoLine::CurrentPlanetJupiter},
{"Saturn", ArchaeoLine::CurrentPlanetSaturn}};
enumShowCurrentPlanet=map.value(planet, ArchaeoLine::CurrentPlanetNone);
if (!map.contains(planet))
qWarning() << "ArchaeoLines: showCurrentPlanet: Invalid planet requested: " << planet;
conf->setValue("ArchaeoLines/show_current_planet", map.key(enumShowCurrentPlanet));
currentPlanetLine->setLineType(enumShowCurrentPlanet);
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", isCustomAzimuth1Displayed());
customAzimuth1Line->setDisplayed(b);
emit showCustomAzimuth1Changed(b);
}
}
void ArchaeoLines::showCustomAzimuth2(bool b)
{
if (b!=flagShowCustomAzimuth2)
{
flagShowCustomAzimuth2=b;
conf->setValue("ArchaeoLines/show_custom_azimuth_2", isCustomAzimuth2Displayed());
customAzimuth2Line->setDisplayed(b);
emit showCustomAzimuth2Changed(b);
}
}
void ArchaeoLines::showCustomAltitude1(bool b)
{
if (b!=flagShowCustomAltitude1)
{
flagShowCustomAltitude1=b;
conf->setValue("ArchaeoLines/show_custom_altitude_1", isCustomAltitude1Displayed());
customAltitude1Line->setDisplayed(b);
emit showCustomAltitude1Changed(b);
}
}
void ArchaeoLines::showCustomAltitude2(bool b)
{
if (b!=flagShowCustomAltitude2)
{
flagShowCustomAltitude2=b;
conf->setValue("ArchaeoLines/show_custom_altitude_2", isCustomAltitude2Displayed());
customAltitude2Line->setDisplayed(b);
emit showCustomAltitude2Changed(b);
}
}
void ArchaeoLines::showCustomDeclination1(bool b)
{
if (b!=flagShowCustomDeclination1)
{
flagShowCustomDeclination1=b;
conf->setValue("ArchaeoLines/show_custom_declination_1", isCustomDeclination1Displayed());
customDeclination1Line->setDisplayed(b);
emit showCustomDeclination1Changed(b);
}
}
void ArchaeoLines::showCustomDeclination2(bool b)
{
if (b!=flagShowCustomDeclination2)
{
flagShowCustomDeclination2=b;
conf->setValue("ArchaeoLines/show_custom_declination_2", isCustomDeclination2Displayed());
customDeclination2Line->setDisplayed(b);
emit showCustomDeclination2Changed(b);
}
}
void ArchaeoLines::setGeographicLocation1Longitude(double lng)
{
conf->setValue("ArchaeoLines/geographic_location_1_longitude", lng);
geographicLocation1Longitude=lng;
StelLocation loc=core->getCurrentLocation();
double az=loc.getAzimuthForLocation(geographicLocation1Longitude, geographicLocation1Latitude);
if (StelApp::getInstance().getFlagSouthAzimuthUsage())
az+=180.0;
geographicLocation1Line->setDefiningAngle(az);
emit geographicLocation1Changed();
}
void ArchaeoLines::setGeographicLocation1Latitude(double lat)
{
conf->setValue("ArchaeoLines/geographic_location_1_latitude", lat);
geographicLocation1Latitude=lat;
StelLocation loc=core->getCurrentLocation();
double az=loc.getAzimuthForLocation(geographicLocation1Longitude, geographicLocation1Latitude);
if (StelApp::getInstance().getFlagSouthAzimuthUsage())
az+=180.0;
geographicLocation1Line->setDefiningAngle(az);
emit geographicLocation1Changed();
}
void ArchaeoLines::setGeographicLocation1Label(const QString &label)
{
geographicLocation1Line->setLabel(label);
conf->setValue("ArchaeoLines/geographic_location_1_label", label);
emit geographicLocation1LabelChanged(label);
}
void ArchaeoLines::setGeographicLocation2Longitude(double lng)
{
conf->setValue("ArchaeoLines/geographic_location_2_longitude", lng);
geographicLocation2Longitude=lng;
StelLocation loc=core->getCurrentLocation();
double az=loc.getAzimuthForLocation(geographicLocation2Longitude, geographicLocation2Latitude);
if (StelApp::getInstance().getFlagSouthAzimuthUsage())
az+=180.0;
geographicLocation2Line->setDefiningAngle(az);
emit geographicLocation2Changed();
}
void ArchaeoLines::setGeographicLocation2Latitude(double lat)
{
conf->setValue("ArchaeoLines/geographic_location_2_latitude", lat);
geographicLocation2Latitude=lat;
StelLocation loc=core->getCurrentLocation();
double az=loc.getAzimuthForLocation(geographicLocation2Longitude, geographicLocation2Latitude);
if (StelApp::getInstance().getFlagSouthAzimuthUsage())
az+=180.0;
geographicLocation2Line->setDefiningAngle(az);
emit geographicLocation2Changed();
}
void ArchaeoLines::setGeographicLocation2Label(const QString &label)
{
geographicLocation2Line->setLabel(label);
conf->setValue("ArchaeoLines/geographic_location_2_label", label);
emit geographicLocation2LabelChanged(label);
}
void ArchaeoLines::updateObserverLocation(const StelLocation &loc)
{
geographicLocation1Line->setDefiningAngle(loc.getAzimuthForLocation(geographicLocation1Longitude, geographicLocation1Latitude));
geographicLocation2Line->setDefiningAngle(loc.getAzimuthForLocation(geographicLocation2Longitude, geographicLocation2Latitude));
}
void ArchaeoLines::setCustomAzimuth1(double az)
{
if (!qFuzzyCompare(az, customAzimuth1Line->getDefiningAngle()))
{
customAzimuth1Line->setDefiningAngle(az);
conf->setValue("ArchaeoLines/custom_azimuth_1_angle", az);
emit customAzimuth1Changed(az);
}
}
void ArchaeoLines::setCustomAzimuth2(double az)
{
if (!qFuzzyCompare(az, customAzimuth2Line->getDefiningAngle()))
{
customAzimuth2Line->setDefiningAngle(az);
conf->setValue("ArchaeoLines/custom_azimuth_2_angle", az);
emit customAzimuth2Changed(az);
}
}
void ArchaeoLines::setCustomAzimuth1Label(const QString &label)
{
customAzimuth1Line->setLabel(label);
conf->setValue("ArchaeoLines/custom_azimuth_1_label", label);
emit customAzimuth1LabelChanged(label);
}
void ArchaeoLines::setCustomAzimuth2Label(const QString &label)
{
customAzimuth2Line->setLabel(label);
conf->setValue("ArchaeoLines/custom_azimuth_2_label", label);
emit customAzimuth2LabelChanged(label);
}