• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Stellarium / stellarium / 15670918640

16 Jun 2025 02:08AM UTC coverage: 11.775% (-0.2%) from 11.931%
15670918640

push

github

alex-w
Updated data

14700 of 124846 relevant lines covered (11.77%)

18324.52 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/plugins/ArchaeoLines/src/ArchaeoLines.cpp
1
/*
2
 * Copyright (C) 2014-21 Georg Zotti
3
 *
4
 * This program is free software; you can redistribute it and/or
5
 * modify it under the terms of the GNU General Public License
6
 * as published by the Free Software Foundation; either version 2
7
 * of the License, or (at your option) any later version.
8
 *
9
 * This program is distributed in the hope that it will be useful,
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 * GNU General Public License for more details.
13
 *
14
 * You should have received a copy of the GNU General Public License
15
 * along with this program; if not, write to the Free Software
16
 * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA  02110-1335, USA.
17
 */
18

19
#include "StelUtils.hpp"
20
#include "StelProjector.hpp"
21
#include "StelPainter.hpp"
22
#include "StelApp.hpp"
23
#include "StelCore.hpp"
24
#include "StelModuleMgr.hpp"
25
#include "StelObjectMgr.hpp"
26
#include "StelGui.hpp"
27
#include "StelGuiItems.hpp"
28
#include "ArchaeoLines.hpp"
29
#include "ArchaeoLinesDialog.hpp"
30
#include "SolarSystem.hpp"
31
#include "Planet.hpp"
32

33
#include <QDebug>
34
#include <QTimer>
35
#include <QPixmap>
36
#include <QColor>
37
#include <QSettings>
38
#include <QMouseEvent>
39
#include <cmath>
40
#include <stdexcept>
41

42
//! This method is the one called automatically by the StelModuleMgr just
43
//! after loading the dynamic library
44
StelModule* ArchaeoLinesStelPluginInterface::getStelModule() const
×
45
{
46
        return new ArchaeoLines();
×
47
}
48

49
StelPluginInfo ArchaeoLinesStelPluginInterface::getPluginInfo() const
×
50
{
51
        // Allow to load the resources when used as a static plugin
52
        Q_INIT_RESOURCE(ArchaeoLines);
×
53

54
        StelPluginInfo info;
×
55
        info.id = "ArchaeoLines";
×
56
        info.displayedName = N_("ArchaeoLines");
×
57
        info.authors = "Georg Zotti";
×
58
        info.contact = "https://homepage.univie.ac.at/Georg.Zotti";
×
59
        info.description = N_("A tool for archaeo-/ethnoastronomical alignment studies");
×
60
        info.version = ARCHAEOLINES_PLUGIN_VERSION;
×
61
        info.license = ARCHAEOLINES_PLUGIN_LICENSE;
×
62
        return info;
×
63
}
×
64

65
ArchaeoLines::ArchaeoLines()
×
66
        : flagShowArchaeoLines(false)
×
67
        , lineWidth(1)
×
68
        , flagShowEquinox(false)
×
69
        , flagShowSolstices(false)
×
70
        , flagShowCrossquarters(false)
×
71
        , flagShowMajorStandstills(false)
×
72
        , flagShowMinorStandstills(false)
×
73
        , flagShowPolarCircles(false)
×
74
        , flagShowZenithPassage(false)
×
75
        , flagShowNadirPassage(false)
×
76
        , flagShowSelectedObject(false)
×
77
        , flagShowSelectedObjectAzimuth(false)
×
78
        , flagShowSelectedObjectHourAngle(false)
×
79
        , flagShowCurrentSun(false)
×
80
        , flagShowCurrentMoon(false)
×
81
        , enumShowCurrentPlanet(ArchaeoLine::CurrentPlanetNone)
×
82
        , flagShowGeographicLocation1(false)
×
83
        , geographicLocation1Longitude(39.8) // approx. Mecca
×
84
        , geographicLocation1Latitude(21.4)
×
85
        , flagShowGeographicLocation2(false)
×
86
        , geographicLocation2Longitude(35.2) // approx. Jerusalem
×
87
        , geographicLocation2Latitude(31.8)
×
88
        , flagShowCustomAzimuth1(false)
×
89
        , flagShowCustomAzimuth2(false)
×
90
        , flagShowCustomAltitude1(false)
×
91
        , flagShowCustomAltitude2(false)
×
92
        //, customAzimuth1(0.0)
93
        //, customAzimuth2(0.0)
94
        , flagShowCustomDeclination1(false)
×
95
        , flagShowCustomDeclination2(false)
×
96
        , lastJDE(0.0)
×
97
        , toolbarButton(Q_NULLPTR)
×
98
{
99
        setObjectName("ArchaeoLines");
×
100
        font.setPixelSize(16);
×
101
        core=StelApp::getInstance().getCore();
×
102
        Q_ASSERT(core);
×
103
        objMgr=GETSTELMODULE(StelObjectMgr);
×
104
        Q_ASSERT(objMgr);
×
105

106
        // optimize readability so that each upper line of the lunistice doubles is labeled.
107
        equinoxLine = new ArchaeoLine(ArchaeoLine::Equinox, 0.0);
×
108
        northernSolsticeLine = new ArchaeoLine(ArchaeoLine::Solstices, 23.50);
×
109
        southernSolsticeLine = new ArchaeoLine(ArchaeoLine::Solstices, -23.50);
×
110
        northernCrossquarterLine = new ArchaeoLine(ArchaeoLine::Crossquarters, 16.50);
×
111
        southernCrossquarterLine = new ArchaeoLine(ArchaeoLine::Crossquarters, -16.50);
×
112
        northernMajorStandstillLine0 = new ArchaeoLine(ArchaeoLine::MajorStandstill, 23.5+5.1);
×
113
        northernMajorStandstillLine1 = new ArchaeoLine(ArchaeoLine::MajorStandstill, 23.5+5.1);
×
114
        northernMajorStandstillLine0->setLabelVisible(false);
×
115
        northernMinorStandstillLine2 = new ArchaeoLine(ArchaeoLine::MinorStandstill, 23.5-5.1);
×
116
        northernMinorStandstillLine3 = new ArchaeoLine(ArchaeoLine::MinorStandstill, 23.5-5.1);
×
117
        northernMinorStandstillLine2->setLabelVisible(false);
×
118
        southernMinorStandstillLine4 = new ArchaeoLine(ArchaeoLine::MinorStandstill, -23.5+5.1);
×
119
        southernMinorStandstillLine5 = new ArchaeoLine(ArchaeoLine::MinorStandstill, -23.5+5.1);
×
120
        southernMinorStandstillLine4->setLabelVisible(false);
×
121
        southernMajorStandstillLine6 = new ArchaeoLine(ArchaeoLine::MajorStandstill, -23.5-5.1);
×
122
        southernMajorStandstillLine7 = new ArchaeoLine(ArchaeoLine::MajorStandstill, -23.5-5.1);
×
123
        southernMajorStandstillLine6->setLabelVisible(false);
×
124
        northernPolarCircleLine = new ArchaeoLine(ArchaeoLine::PolarCircles, 66.5);
×
125
        southernPolarCircleLine = new ArchaeoLine(ArchaeoLine::PolarCircles, -66.5);
×
126
        zenithPassageLine  = new ArchaeoLine(ArchaeoLine::ZenithPassage, 48.0);
×
127
        nadirPassageLine   = new ArchaeoLine(ArchaeoLine::NadirPassage, 42.0);
×
128
        selectedObjectLine = new ArchaeoLine(ArchaeoLine::SelectedObject, 0.0);
×
129
        selectedObjectAzimuthLine = new ArchaeoLine(ArchaeoLine::SelectedObjectAzimuth, 0.0);
×
130
        selectedObjectHourAngleLine = new ArchaeoLine(ArchaeoLine::SelectedObjectHourAngle, 0.0);
×
131
        currentSunLine     = new ArchaeoLine(ArchaeoLine::CurrentSun, 0.0);
×
132
        currentMoonLine    = new ArchaeoLine(ArchaeoLine::CurrentMoon, 0.0);
×
133
        currentPlanetLine  = new ArchaeoLine(ArchaeoLine::CurrentPlanetNone, 0.0);
×
134
        geographicLocation1Line = new ArchaeoLine(ArchaeoLine::GeographicLocation1, 0.0);
×
135
        geographicLocation2Line = new ArchaeoLine(ArchaeoLine::GeographicLocation2, 0.0);
×
136
        customAzimuth1Line = new ArchaeoLine(ArchaeoLine::CustomAzimuth1, 0.0);
×
137
        customAzimuth2Line = new ArchaeoLine(ArchaeoLine::CustomAzimuth2, 0.0);
×
138
        customAltitude1Line = new ArchaeoLine(ArchaeoLine::CustomAltitude1, 0.0);
×
139
        customAltitude2Line = new ArchaeoLine(ArchaeoLine::CustomAltitude2, 0.0);
×
140
        customDeclination1Line = new ArchaeoLine(ArchaeoLine::CustomDeclination1, 0.0);
×
141
        customDeclination2Line = new ArchaeoLine(ArchaeoLine::CustomDeclination2, 0.0);
×
142

143
        configDialog = new ArchaeoLinesDialog();
×
144
        conf = StelApp::getInstance().getSettings();
×
145

146
        connect(core, SIGNAL(locationChanged(StelLocation)), this, SLOT(updateObserverLocation(StelLocation)));
×
147
}
×
148

149
ArchaeoLines::~ArchaeoLines()
×
150
{
151
        delete equinoxLine; equinoxLine=Q_NULLPTR;
×
152
        delete northernSolsticeLine; northernSolsticeLine=Q_NULLPTR;
×
153
        delete southernSolsticeLine; southernSolsticeLine=Q_NULLPTR;
×
154
        delete northernCrossquarterLine; northernCrossquarterLine=Q_NULLPTR;
×
155
        delete southernCrossquarterLine; southernCrossquarterLine=Q_NULLPTR;
×
156
        delete northernMajorStandstillLine0; northernMajorStandstillLine0=Q_NULLPTR;
×
157
        delete northernMajorStandstillLine1; northernMajorStandstillLine1=Q_NULLPTR;
×
158
        delete northernMinorStandstillLine2; northernMinorStandstillLine2=Q_NULLPTR;
×
159
        delete northernMinorStandstillLine3; northernMinorStandstillLine3=Q_NULLPTR;
×
160
        delete southernMinorStandstillLine4; southernMinorStandstillLine4=Q_NULLPTR;
×
161
        delete southernMinorStandstillLine5; southernMinorStandstillLine5=Q_NULLPTR;
×
162
        delete southernMajorStandstillLine6; southernMajorStandstillLine6=Q_NULLPTR;
×
163
        delete southernMajorStandstillLine7; southernMajorStandstillLine7=Q_NULLPTR;
×
164
        delete northernPolarCircleLine; northernPolarCircleLine=Q_NULLPTR;
×
165
        delete southernPolarCircleLine; southernPolarCircleLine=Q_NULLPTR;
×
166
        delete zenithPassageLine;  zenithPassageLine=Q_NULLPTR;
×
167
        delete nadirPassageLine;   nadirPassageLine=Q_NULLPTR;
×
168
        delete selectedObjectLine; selectedObjectLine=Q_NULLPTR;
×
169
        delete selectedObjectAzimuthLine; selectedObjectAzimuthLine=Q_NULLPTR;
×
170
        delete selectedObjectHourAngleLine; selectedObjectHourAngleLine=Q_NULLPTR;
×
171
        delete currentSunLine;     currentSunLine=Q_NULLPTR;
×
172
        delete currentMoonLine;    currentMoonLine=Q_NULLPTR;
×
173
        delete currentPlanetLine;  currentPlanetLine=Q_NULLPTR;
×
174
        delete geographicLocation1Line; geographicLocation1Line=Q_NULLPTR;
×
175
        delete geographicLocation2Line; geographicLocation2Line=Q_NULLPTR;
×
176
        delete customAzimuth1Line; customAzimuth1Line=Q_NULLPTR;
×
177
        delete customAzimuth2Line; customAzimuth2Line=Q_NULLPTR;
×
178
        delete customAltitude1Line; customAltitude1Line=Q_NULLPTR;
×
179
        delete customAltitude2Line; customAltitude2Line=Q_NULLPTR;
×
180
        delete customDeclination1Line; customDeclination1Line=Q_NULLPTR;
×
181
        delete customDeclination2Line; customDeclination2Line=Q_NULLPTR;
×
182

183
        delete configDialog; configDialog=Q_NULLPTR;
×
184
}
×
185

186
bool ArchaeoLines::configureGui(bool show)
×
187
{
188
        if (show)
×
189
                configDialog->setVisible(true);
×
190
        return true;
×
191
}
192

193
//! Determine which "layer" the plugin's drawing will happen on.
194
double ArchaeoLines::getCallOrder(StelModuleActionName actionName) const
×
195
{
196
        if (actionName==StelModule::ActionDraw)
×
197
          return StelApp::getInstance().getModuleMgr().getModule("GridLinesMgr")->getCallOrder(actionName)+1.; // one after GridlineMgr: else its equator covers our equinox line!
×
198
        return 0;
×
199
}
200

201
void ArchaeoLines::init()
×
202
{
203
        Q_ASSERT(equinoxLine);
×
204
        Q_ASSERT(northernSolsticeLine);
×
205
        Q_ASSERT(southernSolsticeLine);
×
206
        Q_ASSERT(northernCrossquarterLine);
×
207
        Q_ASSERT(southernCrossquarterLine);
×
208
        Q_ASSERT(northernMajorStandstillLine0);
×
209
        Q_ASSERT(northernMajorStandstillLine1);
×
210
        Q_ASSERT(northernMinorStandstillLine2);
×
211
        Q_ASSERT(northernMinorStandstillLine3);
×
212
        Q_ASSERT(southernMinorStandstillLine4);
×
213
        Q_ASSERT(southernMinorStandstillLine5);
×
214
        Q_ASSERT(southernMajorStandstillLine6);
×
215
        Q_ASSERT(southernMajorStandstillLine7);
×
216
        Q_ASSERT(northernPolarCircleLine);
×
217
        Q_ASSERT(southernPolarCircleLine);
×
218
        Q_ASSERT(zenithPassageLine);
×
219
        Q_ASSERT(nadirPassageLine);
×
220
        Q_ASSERT(selectedObjectLine);
×
221
        Q_ASSERT(selectedObjectAzimuthLine);
×
222
        Q_ASSERT(selectedObjectHourAngleLine);
×
223
        Q_ASSERT(currentSunLine);
×
224
        Q_ASSERT(currentMoonLine);
×
225
        Q_ASSERT(currentPlanetLine);
×
226
        Q_ASSERT(geographicLocation1Line);
×
227
        Q_ASSERT(geographicLocation2Line);
×
228
        Q_ASSERT(customAzimuth1Line);
×
229
        Q_ASSERT(customAzimuth2Line);
×
230
        Q_ASSERT(customAltitude1Line);
×
231
        Q_ASSERT(customAltitude2Line);
×
232
        Q_ASSERT(customDeclination1Line);
×
233
        Q_ASSERT(customDeclination2Line);
×
234

235
        connect(this, SIGNAL(equinoxColorChanged(Vec3f)),                equinoxLine                 , SLOT(setColor(Vec3f)));
×
236
        connect(this, SIGNAL(solsticesColorChanged(Vec3f)),              northernSolsticeLine        , SLOT(setColor(Vec3f)));
×
237
        connect(this, SIGNAL(solsticesColorChanged(Vec3f)),              southernSolsticeLine        , SLOT(setColor(Vec3f)));
×
238
        connect(this, SIGNAL(crossquartersColorChanged(Vec3f)),          northernCrossquarterLine    , SLOT(setColor(Vec3f)));
×
239
        connect(this, SIGNAL(crossquartersColorChanged(Vec3f)),          southernCrossquarterLine    , SLOT(setColor(Vec3f)));
×
240
        connect(this, SIGNAL(majorStandstillColorChanged(Vec3f)),        northernMajorStandstillLine0, SLOT(setColor(Vec3f)));
×
241
        connect(this, SIGNAL(majorStandstillColorChanged(Vec3f)),        northernMajorStandstillLine1, SLOT(setColor(Vec3f)));
×
242
        connect(this, SIGNAL(majorStandstillColorChanged(Vec3f)),        southernMajorStandstillLine6, SLOT(setColor(Vec3f)));
×
243
        connect(this, SIGNAL(majorStandstillColorChanged(Vec3f)),        southernMajorStandstillLine7, SLOT(setColor(Vec3f)));
×
244
        connect(this, SIGNAL(minorStandstillColorChanged(Vec3f)),        northernMinorStandstillLine2, SLOT(setColor(Vec3f)));
×
245
        connect(this, SIGNAL(minorStandstillColorChanged(Vec3f)),        northernMinorStandstillLine3, SLOT(setColor(Vec3f)));
×
246
        connect(this, SIGNAL(minorStandstillColorChanged(Vec3f)),        southernMinorStandstillLine4, SLOT(setColor(Vec3f)));
×
247
        connect(this, SIGNAL(minorStandstillColorChanged(Vec3f)),        southernMinorStandstillLine5, SLOT(setColor(Vec3f)));
×
248
        connect(this, SIGNAL(polarCirclesColorChanged(Vec3f)),           northernPolarCircleLine     , SLOT(setColor(Vec3f)));
×
249
        connect(this, SIGNAL(polarCirclesColorChanged(Vec3f)),           southernPolarCircleLine     , SLOT(setColor(Vec3f)));
×
250
        connect(this, SIGNAL(zenithPassageColorChanged(Vec3f)),          zenithPassageLine           , SLOT(setColor(Vec3f)));
×
251
        connect(this, SIGNAL(nadirPassageColorChanged(Vec3f)),           nadirPassageLine            , SLOT(setColor(Vec3f)));
×
252
        connect(this, SIGNAL(selectedObjectColorChanged(Vec3f)),         selectedObjectLine          , SLOT(setColor(Vec3f)));
×
253
        connect(this, SIGNAL(selectedObjectAzimuthColorChanged(Vec3f)),  selectedObjectAzimuthLine   , SLOT(setColor(Vec3f)));
×
254
        connect(this, SIGNAL(selectedObjectHourAngleColorChanged(Vec3f)),selectedObjectHourAngleLine , SLOT(setColor(Vec3f)));
×
255
        connect(this, SIGNAL(currentSunColorChanged(Vec3f)),             currentSunLine              , SLOT(setColor(Vec3f)));
×
256
        connect(this, SIGNAL(currentMoonColorChanged(Vec3f)),            currentMoonLine             , SLOT(setColor(Vec3f)));
×
257
        connect(this, SIGNAL(currentPlanetColorChanged(Vec3f)),          currentPlanetLine           , SLOT(setColor(Vec3f)));
×
258
        connect(this, SIGNAL(geographicLocation1ColorChanged(Vec3f)),    geographicLocation1Line     , SLOT(setColor(Vec3f)));
×
259
        connect(this, SIGNAL(geographicLocation2ColorChanged(Vec3f)),    geographicLocation2Line     , SLOT(setColor(Vec3f)));
×
260
        connect(this, SIGNAL(customAzimuth1ColorChanged(Vec3f)),         customAzimuth1Line          , SLOT(setColor(Vec3f)));
×
261
        connect(this, SIGNAL(customAzimuth2ColorChanged(Vec3f)),         customAzimuth2Line          , SLOT(setColor(Vec3f)));
×
262
        connect(this, SIGNAL(customAltitude1ColorChanged(Vec3f)),        customAltitude1Line         , SLOT(setColor(Vec3f)));
×
263
        connect(this, SIGNAL(customAltitude2ColorChanged(Vec3f)),        customAltitude2Line         , SLOT(setColor(Vec3f)));
×
264
        connect(this, SIGNAL(customDeclination1ColorChanged(Vec3f)),     customDeclination1Line      , SLOT(setColor(Vec3f)));
×
265
        connect(this, SIGNAL(customDeclination2ColorChanged(Vec3f)),     customDeclination2Line      , SLOT(setColor(Vec3f)));
×
266

267
        loadSettings();
×
268

269
        // Create action for enable/disable & hook up signals
270
        QString section=N_("ArchaeoLines");
×
271
        addAction("actionShow_ArchaeoLines",         section, N_("ArchaeoLines"), "enabled", "Ctrl+U");
×
272
        addAction("actionShow_ArchaeoLines_dialog",  section, N_("Show settings dialog"),  configDialog,  "visible",           "Ctrl+Shift+U");
×
273

274
        // Add a toolbar button
275
        StelApp& app=StelApp::getInstance();
×
276
        try
277
        {
278
                StelGui* gui = dynamic_cast<StelGui*>(app.getGui());
×
279
                if (gui!=Q_NULLPTR)
×
280
                {
281
                        toolbarButton = new StelButton(Q_NULLPTR,
×
282
                                                       QPixmap(":/archaeoLines/bt_archaeolines_on.png"),
×
283
                                                       QPixmap(":/archaeoLines/bt_archaeolines_off.png"),
×
284
                                                       QPixmap(":/graphicGui/miscGlow32x32.png"),
×
285
                                                       "actionShow_ArchaeoLines",
286
                                                       false,
287
                                                       "actionShow_ArchaeoLines_dialog");
×
288
                        gui->getButtonBar()->addButton(toolbarButton, "065-pluginsGroup");
×
289
                }
290
        }
291
        catch (std::runtime_error& e)
×
292
        {
293
                qWarning() << "Unable to create toolbar button for ArchaeoLines plugin: " << e.what();
×
294
        }
×
295
        addAction("actionAL_showEquinoxLine",          section, N_("Show Line for Equinox"),            "flagShowEquinox"         ); // No Shortcuts configured.
×
296
        addAction("actionAL_showSolsticeLines",        section, N_("Show Line for Solstices"),          "flagShowSolstices"       ); // No Shortcuts configured.
×
297
        addAction("actionAL_showCrossquarterLines",    section, N_("Show Line for Crossquarter"),       "flagShowCrossquarters"   ); // No Shortcuts configured.
×
298
        addAction("actionAL_showMajorStandstillLines", section, N_("Show Line for Major Standstill"),   "flagShowMajorStandstills"); // No Shortcuts configured.
×
299
        addAction("actionAL_showMinorStandstillLines", section, N_("Show Line for Minor Standstill"),   "flagShowMinorStandstills"); // No Shortcuts configured.
×
300
        addAction("actionAL_showPolarCircleLines",     section, N_("Show Polar Circles"),               "flagShowPolarCircles"    ); // No Shortcuts configured.
×
301
        addAction("actionAL_showZenithPassageLine",    section, N_("Show Line for Zenith Passage"),     "flagShowZenithPassage"   ); // No Shortcuts configured.
×
302
        addAction("actionAL_showNadirPassageLine",     section, N_("Show Line for Nadir Passage"),      "flagShowNadirPassage"    ); // No Shortcuts configured.
×
303
        addAction("actionAL_showSelectedObjectLine",   section, N_("Show Line for Selected Object"),    "flagShowSelectedObject"  ); // No Shortcuts configured.
×
304
        addAction("actionAL_showSelectedObjectAzimuthLine",   section, N_("Show Line for Selected Object's Azimuth"),    "flagShowSelectedObjectAzimuth"   ); // No Shortcuts configured.
×
305
        addAction("actionAL_showSelectedObjectHourAngleLine", section, N_("Show Line for Selected Object's Hour Angle"), "flagShowSelectedObjectHourAngle" ); // No Shortcuts configured.
×
306
        addAction("actionAL_showCurrentSunLine",       section, N_("Show Line for Current Sun"),        "flagShowCurrentSun"      ); // No Shortcuts configured.
×
307
        addAction("actionAL_showCurrentMoonLine",      section, N_("Show Line for Current Moon"),       "flagShowCurrentMoon"     ); // No Shortcuts configured.
×
308
        addAction("actionAL_showGeographicLocation1Line",section, N_("Show Vertical for Geographic Location 1"),   "flagShowGeographicLocation1"  ); // No Shortcuts configured.
×
309
        addAction("actionAL_showGeographicLocation2Line",section, N_("Show Vertical for Geographic Location 2"),   "flagShowGeographicLocation2"  ); // No Shortcuts configured.
×
310
        addAction("actionAL_showCustomAzimuth1Line",     section, N_("Show Vertical for Custom Azimuth 1"),   "flagShowCustomAzimuth1"  ); // No Shortcuts configured.
×
311
        addAction("actionAL_showCustomAzimuth2Line",     section, N_("Show Vertical for Custom Azimuth 2"),   "flagShowCustomAzimuth2"  ); // No Shortcuts configured.
×
312
        addAction("actionAL_showCustomAltitude1Line",    section, N_("Show Line for Custom Altitude 1"),   "flagShowCustomAltitude1"  ); // No Shortcuts configured.
×
313
        addAction("actionAL_showCustomAltitude2Line",    section, N_("Show Line for Custom Altitude 2"),   "flagShowCustomAltitude2"  ); // No Shortcuts configured.
×
314
        addAction("actionAL_showCustomDeclination1Line", section, N_("Show Line for Custom Declination 1"),   "flagShowCustomDeclination1"  ); // No Shortcuts configured.
×
315
        addAction("actionAL_showCustomDeclination2Line", section, N_("Show Line for Custom Declination 2"),   "flagShowCustomDeclination2"  ); // No Shortcuts configured.
×
316
}
×
317

318
void ArchaeoLines::update(double deltaTime)
×
319
{
320
        if (core->getCurrentPlanet()->getEnglishName()!="Earth")
×
321
                return;
×
322

323
        static SolarSystem *ssystem=GETSTELMODULE(SolarSystem);
×
324
        static const double lunarI=5.145396; // inclination of lunar orbit
325
        // compute min and max distance values for horizontal parallax.
326
        // Meeus, AstrAlg 98, p342.
327
        static const double meanDist=385000.56; // km earth-moon.
328
        static const double addedValues=20905.355+3699.111+2955.968+569.925+48.888+3.149+246.158+152.138+170.733+
329
                        204.586+129.620+108.743+104.755+10.321+79.661+34.782+23.210+21.636+24.208+30.824+8.379+
330
                        16.675+12.831+10.445+11.650+14.403+7.003+10.056+6.322+9.884;
331
        static const double minDist=meanDist-addedValues;
332
        static const double maxDist=meanDist+addedValues;
333
        static const double sinPiMin=6378.14/maxDist;
334
        static const double sinPiMax=6378.14/minDist; // maximal parallax at min. distance!
335
        static double eps;
336

337
        PlanetP planet=ssystem->getSun();
×
338
        double dec_equ, ra_equ, az, alt;
339
        StelUtils::rectToSphe(&ra_equ,&dec_equ,planet->getEquinoxEquatorialPos(core));
×
340
        currentSunLine->setDefiningAngle(dec_equ * 180.0/M_PI);
×
341
        planet=ssystem->getMoon();
×
342
        StelUtils::rectToSphe(&ra_equ,&dec_equ,planet->getEquinoxEquatorialPos(core));
×
343
        currentMoonLine->setDefiningAngle(dec_equ * 180.0/M_PI);
×
344

345
        if (enumShowCurrentPlanet>ArchaeoLine::CurrentPlanetNone)
×
346
        {
347
                const char *planetStrings[]={"", "Mercury", "Venus", "Mars", "Jupiter", "Saturn"};
×
348
                QString currentPlanet(planetStrings[enumShowCurrentPlanet - ArchaeoLine::CurrentPlanetNone]);
×
349
                planet=ssystem->searchByEnglishName(currentPlanet);
×
350
                Q_ASSERT(planet);
×
351
                StelUtils::rectToSphe(&ra_equ,&dec_equ,planet->getEquinoxEquatorialPos(core));
×
352
                currentPlanetLine->setDefiningAngle(dec_equ * 180.0/M_PI);
×
353
        }
×
354

355
        double newJDE=core->getJDE();
×
356
        if (fabs(newJDE-lastJDE) > 10.0) // enough to compute this every 10 days?
×
357
        {
358
                static const double invSqrt2=1.0/std::sqrt(2.0);
359
                double epsRad=ssystem->getEarth()->getRotObliquity(newJDE);
×
360
                double xqDec=asin(sin(epsRad)*invSqrt2)*180.0/M_PI;
×
361
                eps= epsRad*180.0/M_PI;
×
362
                northernSolsticeLine->setDefiningAngle(eps);
×
363
                southernSolsticeLine->setDefiningAngle(-eps);
×
364
                northernPolarCircleLine->setDefiningAngle(90.-eps);
×
365
                southernPolarCircleLine->setDefiningAngle(-90.+eps);
×
366
                northernCrossquarterLine->setDefiningAngle( xqDec);
×
367
                southernCrossquarterLine->setDefiningAngle(-xqDec);
×
368
                lastJDE=newJDE;
×
369
        }
370
        StelLocation loc=core->getCurrentLocation();
×
371

372
        // compute parallax correction with Meeus 40.6. First, find H from h=0, then add corrections.
373

374
        static const double b_over_a=0.99664719;
375
        const bool useGeocentric = !core->getUseTopocentricCoordinates();
×
376
        const double latRad=useGeocentric ? 0.0 : static_cast<double>(loc.getLatitude())*M_PI_180;
×
377
        const double u=std::atan(b_over_a*std::tan(latRad));
×
378
        const double rhoSinPhiP=useGeocentric ? 0. : b_over_a*std::sin(u)+loc.altitude/6378140.0*std::sin(latRad);
×
379
        const double rhoCosPhiP=useGeocentric ? 1. :          std::cos(u)+loc.altitude/6378140.0*std::cos(latRad);
×
380

381
        QVector<double> lunarDE(8), sinPi(8);
×
382
        lunarDE[0]=(eps+lunarI)*M_PI/180.0; // min_distance=max_parallax
×
383
        lunarDE[1]=(eps+lunarI)*M_PI/180.0;
×
384
        lunarDE[2]=(eps-lunarI)*M_PI/180.0;
×
385
        lunarDE[3]=(eps-lunarI)*M_PI/180.0;
×
386
        lunarDE[4]=(-eps+lunarI)*M_PI/180.0;
×
387
        lunarDE[5]=(-eps+lunarI)*M_PI/180.0;
×
388
        lunarDE[6]=(-eps-lunarI)*M_PI/180.0;
×
389
        lunarDE[7]=(-eps-lunarI)*M_PI/180.0;
×
390
        for (int i=0; i<8; i+=2){
×
391
                sinPi[i]=sinPiMax;
×
392
                sinPi[i+1]=sinPiMin;
×
393
        }
394

395
        // In the following we compute parallax-corrected declinations of the setting moon for max and min distances.
396
        // odd indices for max_distance=min_parallax, even indices for min_distance=max_parallax. References are for Meeus AstrAlg 1998.
397
        QVector<double> cosHo(8), sinHo(8); // setting hour angles.
×
398
        for (int i=0; i<8; i++){
×
399
                cosHo[i]=qMax(-1.0, qMin(1.0, -std::tan(latRad)*std::tan(lunarDE[i])));
×
400
                sinHo[i]=std::sin(std::acos(cosHo[i]));
×
401
        }
402

403
        // 40.6
404
        QVector<double> A(8), B(8), C(8), q(8), lunarDEtopo(8);
×
405
        for (int i=0; i<8; i++){
×
406
                A[i]=std::cos(lunarDE[i])*sinHo[i];
×
407
                B[i]=std::cos(lunarDE[i])*cosHo[i]-rhoCosPhiP*sinPi[i];
×
408
                C[i]=std::sin(lunarDE[i])-rhoSinPhiP*sinPi[i];
×
409
                q[i]=std::sqrt(A[i]*A[i]+B[i]*B[i]+C[i]*C[i]);
×
410
                lunarDEtopo[i]=std::asin(C[i]/q[i]);
×
411
        }
412
        northernMajorStandstillLine0->setDefiningAngle(lunarDEtopo[0] *180.0/M_PI);
×
413
        northernMajorStandstillLine1->setDefiningAngle(lunarDEtopo[1] *180.0/M_PI);
×
414
        northernMinorStandstillLine2->setDefiningAngle(lunarDEtopo[2] *180.0/M_PI);
×
415
        northernMinorStandstillLine3->setDefiningAngle(lunarDEtopo[3] *180.0/M_PI);
×
416
        southernMinorStandstillLine4->setDefiningAngle(lunarDEtopo[4] *180.0/M_PI);
×
417
        southernMinorStandstillLine5->setDefiningAngle(lunarDEtopo[5] *180.0/M_PI);
×
418
        southernMajorStandstillLine6->setDefiningAngle(lunarDEtopo[6] *180.0/M_PI);
×
419
        southernMajorStandstillLine7->setDefiningAngle(lunarDEtopo[7] *180.0/M_PI);
×
420

421
        zenithPassageLine->setDefiningAngle(static_cast<double>(loc.getLatitude()));
×
422
        nadirPassageLine->setDefiningAngle(static_cast<double>(-loc.getLatitude()));
×
423

424
        // Selected object?
425
        if (objMgr->getWasSelected())
×
426
        {
427
                StelObjectP obj=objMgr->getSelectedObject().first();
×
428
                StelUtils::rectToSphe(&ra_equ,&dec_equ,obj->getEquinoxEquatorialPos(core));
×
429
                selectedObjectLine->setDefiningAngle(dec_equ * 180.0/M_PI);
×
430
                selectedObjectLine->setLabel(obj->getNameI18n());
×
431
                selectedObjectHourAngleLine->setDefiningAngle((M_PI-ra_equ) * 180.0/M_PI);
×
432
                selectedObjectHourAngleLine->setLabel(obj->getNameI18n());
×
433
                StelUtils::rectToSphe(&az,&alt,obj->getAltAzPosAuto(core));
×
434
                selectedObjectAzimuthLine->setDefiningAngle((M_PI-az) * 180.0/M_PI);
×
435
                selectedObjectAzimuthLine->setLabel(obj->getNameI18n());
×
436
        }
×
437

438
        // Updates for line brightness
439
        lineFader.update(static_cast<int>(deltaTime*1000));
×
440
        equinoxLine->update(deltaTime);
×
441
        northernSolsticeLine->update(deltaTime);
×
442
        southernSolsticeLine->update(deltaTime);
×
443
        northernCrossquarterLine->update(deltaTime);
×
444
        southernCrossquarterLine->update(deltaTime);
×
445
        northernMajorStandstillLine0->update(deltaTime);
×
446
        northernMajorStandstillLine1->update(deltaTime);
×
447
        northernMinorStandstillLine2->update(deltaTime);
×
448
        northernMinorStandstillLine3->update(deltaTime);
×
449
        southernMinorStandstillLine4->update(deltaTime);
×
450
        southernMinorStandstillLine5->update(deltaTime);
×
451
        southernMajorStandstillLine6->update(deltaTime);
×
452
        southernMajorStandstillLine7->update(deltaTime);
×
453
        northernPolarCircleLine->update(deltaTime);
×
454
        southernPolarCircleLine->update(deltaTime);
×
455
        zenithPassageLine->update(deltaTime);
×
456
        nadirPassageLine->update(deltaTime);
×
457
        selectedObjectLine->update(deltaTime);
×
458
        selectedObjectAzimuthLine->update(deltaTime);
×
459
        selectedObjectHourAngleLine->update(deltaTime);
×
460
        currentSunLine->update(deltaTime);
×
461
        currentMoonLine->update(deltaTime);
×
462
        currentPlanetLine->update(deltaTime);
×
463
        geographicLocation1Line->update(deltaTime);
×
464
        geographicLocation2Line->update(deltaTime);
×
465
        customAzimuth1Line->update(deltaTime);
×
466
        customAzimuth2Line->update(deltaTime);
×
467
        customAltitude1Line->update(deltaTime);
×
468
        customAltitude2Line->update(deltaTime);
×
469
        customDeclination1Line->update(deltaTime);
×
470
        customDeclination2Line->update(deltaTime);
×
471
}
×
472

473
//! Draw any parts on the screen which are for our module
474
void ArchaeoLines::draw(StelCore* core)
×
475
{
476
        if (core->getCurrentPlanet()->getEnglishName()!="Earth")
×
477
                return;
×
478

479
        equinoxLine->draw(core, lineFader.getInterstate());
×
480
        northernSolsticeLine->draw(core, lineFader.getInterstate());
×
481
        southernSolsticeLine->draw(core, lineFader.getInterstate());
×
482
        northernCrossquarterLine->draw(core, lineFader.getInterstate());
×
483
        southernCrossquarterLine->draw(core, lineFader.getInterstate());
×
484
        northernMajorStandstillLine0->draw(core, lineFader.getInterstate());
×
485
        northernMajorStandstillLine1->draw(core, lineFader.getInterstate());
×
486
        northernMinorStandstillLine2->draw(core, lineFader.getInterstate());
×
487
        northernMinorStandstillLine3->draw(core, lineFader.getInterstate());
×
488
        southernMinorStandstillLine4->draw(core, lineFader.getInterstate());
×
489
        southernMinorStandstillLine5->draw(core, lineFader.getInterstate());
×
490
        southernMajorStandstillLine6->draw(core, lineFader.getInterstate());
×
491
        southernMajorStandstillLine7->draw(core, lineFader.getInterstate());
×
492
        northernPolarCircleLine->draw(core, lineFader.getInterstate());
×
493
        southernPolarCircleLine->draw(core, lineFader.getInterstate());
×
494
        zenithPassageLine->draw(core, lineFader.getInterstate());
×
495
        nadirPassageLine->draw(core, lineFader.getInterstate());
×
496
        if (objMgr->getWasSelected())
×
497
        {
498
                selectedObjectLine->draw(core, lineFader.getInterstate());
×
499
                selectedObjectAzimuthLine->draw(core, lineFader.getInterstate());
×
500
                selectedObjectHourAngleLine->draw(core, lineFader.getInterstate());
×
501
        }
502
        currentSunLine->draw(core, lineFader.getInterstate());
×
503
        currentMoonLine->draw(core, lineFader.getInterstate());
×
504
        if (enumShowCurrentPlanet>ArchaeoLine::CurrentPlanetNone)
×
505
                currentPlanetLine->draw(core, lineFader.getInterstate());
×
506
        geographicLocation1Line->draw(core, lineFader.getInterstate());
×
507
        geographicLocation2Line->draw(core, lineFader.getInterstate());
×
508
        customAzimuth1Line->draw(core, lineFader.getInterstate());
×
509
        customAzimuth2Line->draw(core, lineFader.getInterstate());
×
510
        customAltitude1Line->draw(core, lineFader.getInterstate());
×
511
        customAltitude2Line->draw(core, lineFader.getInterstate());
×
512
        customDeclination1Line->draw(core, lineFader.getInterstate());
×
513
        customDeclination2Line->draw(core, lineFader.getInterstate());
×
514
}
515

516

517
void ArchaeoLines::enableArchaeoLines(bool b)
×
518
{
519
        if (b!=flagShowArchaeoLines)
×
520
        {
521
                flagShowArchaeoLines = b;
×
522
                lineFader = b;
×
523
                conf->setValue("ArchaeoLines/enable_at_startup", flagShowArchaeoLines);
×
524
                emit archaeoLinesEnabledChanged(b);
×
525
        }
526
}
×
527

528
void ArchaeoLines::restoreDefaultSettings()
×
529
{
530
        Q_ASSERT(conf);
×
531
        // Remove the old values...
532
        conf->remove("ArchaeoLines");
×
533
        // ...load the default values...
534
        loadSettings();
×
535
}
×
536

537
void ArchaeoLines::loadSettings()
×
538
{
539
        const bool azFromSouth=StelApp::getInstance().getFlagSouthAzimuthUsage();
×
540
        setLineWidth(conf->value("ArchaeoLines/line_thickness", 1).toInt());
×
541
        setEquinoxColor(                Vec3f(conf->value("ArchaeoLines/color_equinox",                    "1.00,1.00,0.50").toString()));
×
542
        setSolsticesColor(              Vec3f(conf->value("ArchaeoLines/color_solstices",                  "1.00,0.15,0.15").toString()));
×
543
        setCrossquartersColor(          Vec3f(conf->value("ArchaeoLines/color_crossquarters",              "1.00,0.75,0.25").toString()));
×
544
        setMajorStandstillColor(        Vec3f(conf->value("ArchaeoLines/color_major_standstill",           "0.25,1.00,0.25").toString()));
×
545
        setMinorStandstillColor(        Vec3f(conf->value("ArchaeoLines/color_minor_standstill",           "0.20,0.75,0.20").toString()));
×
546
        setPolarCirclesColor(           Vec3f(conf->value("ArchaeoLines/color_polar_circles",              "0.25,0.25,0.75").toString()));
×
547
        setZenithPassageColor(          Vec3f(conf->value("ArchaeoLines/color_zenith_passage",             "0.75,0.75,0.75").toString()));
×
548
        setNadirPassageColor(           Vec3f(conf->value("ArchaeoLines/color_nadir_passage",              "0.25,0.25,0.25").toString()));
×
549
        setSelectedObjectColor(         Vec3f(conf->value("ArchaeoLines/color_selected_object",            "1.00,1.00,1.00").toString()));
×
550
        setSelectedObjectAzimuthColor(  Vec3f(conf->value("ArchaeoLines/color_selected_object_azimuth",    "1.00,1.00,1.00").toString()));
×
551
        setSelectedObjectHourAngleColor(Vec3f(conf->value("ArchaeoLines/color_selected_object_hour_angle", "1.00,1.00,1.00").toString()));
×
552
        setCurrentSunColor(             Vec3f(conf->value("ArchaeoLines/color_current_sun",                "1.00,1.00,0.75").toString()));
×
553
        setCurrentMoonColor(            Vec3f(conf->value("ArchaeoLines/color_current_moon",               "0.50,1.00,0.50").toString()));
×
554
        setCurrentPlanetColor(          Vec3f(conf->value("ArchaeoLines/color_current_planet",             "0.25,0.80,1.00").toString()));
×
555
        setGeographicLocation1Color(    Vec3f(conf->value("ArchaeoLines/color_geographic_location_1",      "0.25,1.00,0.25").toString()));
×
556
        setGeographicLocation2Color(    Vec3f(conf->value("ArchaeoLines/color_geographic_location_2",      "0.25,0.25,1.00").toString()));
×
557
        setCustomAzimuth1Color(         Vec3f(conf->value("ArchaeoLines/color_custom_azimuth_1",           "0.25,1.00,0.25").toString()));
×
558
        setCustomAzimuth2Color(         Vec3f(conf->value("ArchaeoLines/color_custom_azimuth_2",           "0.25,0.50,0.75").toString()));
×
559
        setCustomAltitude1Color(        Vec3f(conf->value("ArchaeoLines/color_custom_altitude_1",          "0.25,1.00,0.25").toString()));
×
560
        setCustomAltitude2Color(        Vec3f(conf->value("ArchaeoLines/color_custom_altitude_2",          "0.25,0.50,0.75").toString()));
×
561
        setCustomDeclination1Color(     Vec3f(conf->value("ArchaeoLines/color_custom_declination_1",       "0.45,1.00,0.15").toString()));
×
562
        setCustomDeclination2Color(     Vec3f(conf->value("ArchaeoLines/color_custom_declination_2",       "0.45,0.50,0.65").toString()));
×
563

564
        setGeographicLocation1Longitude(conf->value("ArchaeoLines/geographic_location_1_longitude",  39.826175).toDouble());
×
565
        setGeographicLocation1Latitude( conf->value("ArchaeoLines/geographic_location_1_latitude",   21.422476).toDouble());
×
566
        setGeographicLocation2Longitude(conf->value("ArchaeoLines/geographic_location_2_longitude",  35.235774).toDouble());
×
567
        setGeographicLocation2Latitude( conf->value("ArchaeoLines/geographic_location_2_latitude",   31.778087).toDouble());
×
568
        StelLocation loc=core->getCurrentLocation();
×
569
        double azi=loc.getAzimuthForLocation(geographicLocation1Longitude, geographicLocation1Latitude);
×
570
        if (azFromSouth) azi+=180.0;
×
571
        geographicLocation1Line->setDefiningAngle(azi);
×
572
        azi = loc.getAzimuthForLocation(geographicLocation2Longitude, geographicLocation2Latitude);
×
573
        if (azFromSouth) azi+=180.0;
×
574
        geographicLocation2Line->setDefiningAngle(azi);
×
575
        geographicLocation1Line->setLabel(conf->value("ArchaeoLines/geographic_location_1_label", "Mecca (Qibla)").toString());
×
576
        geographicLocation2Line->setLabel(conf->value("ArchaeoLines/geographic_location_2_label", "Jerusalem").toString());
×
577

578
        customAzimuth1Line->setDefiningAngle(conf->value("ArchaeoLines/custom_azimuth_1_angle", 0.0).toDouble());
×
579
        customAzimuth2Line->setDefiningAngle(conf->value("ArchaeoLines/custom_azimuth_2_angle", 0.0).toDouble());
×
580
        customAzimuth1Line->setLabel(conf->value("ArchaeoLines/custom_azimuth_1_label", "custAzi1").toString());
×
581
        customAzimuth2Line->setLabel(conf->value("ArchaeoLines/custom_azimuth_2_label", "custAzi2").toString());
×
582
        customAltitude1Line->setDefiningAngle(conf->value("ArchaeoLines/custom_altitude_1_angle", 0.0).toDouble());
×
583
        customAltitude2Line->setDefiningAngle(conf->value("ArchaeoLines/custom_altitude_2_angle", 0.0).toDouble());
×
584
        customAltitude1Line->setLabel(conf->value("ArchaeoLines/custom_altitude_1_label", "custAlt1").toString());
×
585
        customAltitude2Line->setLabel(conf->value("ArchaeoLines/custom_altitude_2_label", "custAlt2").toString());
×
586
        customDeclination1Line->setDefiningAngle(conf->value("ArchaeoLines/custom_declination_1_angle", 0.0).toDouble());
×
587
        customDeclination2Line->setDefiningAngle(conf->value("ArchaeoLines/custom_declination_2_angle", 0.0).toDouble());
×
588
        customDeclination1Line->setLabel(conf->value("ArchaeoLines/custom_declination_1_label", "custDec1").toString());
×
589
        customDeclination2Line->setLabel(conf->value("ArchaeoLines/custom_declination_2_label", "custDec2").toString());
×
590

591
        // Now activate line display if needed.
592
        // 5 solar limits
593
        showEquinox(conf->value("ArchaeoLines/show_equinox", true).toBool());
×
594
        showSolstices(conf->value("ArchaeoLines/show_solstices", true).toBool());
×
595
        showCrossquarters(conf->value("ArchaeoLines/show_crossquarters", true).toBool());
×
596
        // 4 lunar limits
597
        showMajorStandstills(conf->value("ArchaeoLines/show_major_standstills", true).toBool());
×
598
        showMinorStandstills(conf->value("ArchaeoLines/show_minor_standstills", true).toBool());
×
599
        // Polar circles (design mostly for sky globes)
600
        showPolarCircles(conf->value("ArchaeoLines/show_polar_circles", true).toBool());
×
601
        // esp. Mesoamerica
602
        showZenithPassage(conf->value("ArchaeoLines/show_zenith_passage", true).toBool());
×
603
        showNadirPassage(conf->value("ArchaeoLines/show_nadir_passage",  false).toBool());
×
604
        // indicators for line representing currently selected object's declination, azimuth and hour angle (or right ascension)
605
        showSelectedObject(conf->value("ArchaeoLines/show_selected_object", false).toBool());
×
606
        showSelectedObjectAzimuth(conf->value("ArchaeoLines/show_selected_object_azimuth", false).toBool());
×
607
        showSelectedObjectHourAngle(conf->value("ArchaeoLines/show_selected_object_hour_angle", false).toBool());
×
608
        // indicators for current declinations (those move fast over days...)
609
        showCurrentSun(conf->value("ArchaeoLines/show_current_sun", true).toBool());
×
610
        showCurrentMoon(conf->value("ArchaeoLines/show_current_moon", true).toBool());
×
611
        showCurrentPlanetNamed(conf->value("ArchaeoLines/show_current_planet", "none").toString());
×
612
        // azimuths to geographic targets, and custom azimuths.
613
        showGeographicLocation1(conf->value("ArchaeoLines/show_geographic_location_1", false).toBool());
×
614
        showGeographicLocation2(conf->value("ArchaeoLines/show_geographic_location_2", false).toBool());
×
615
        showCustomAzimuth1(conf->value("ArchaeoLines/show_custom_azimuth_1", false).toBool());
×
616
        showCustomAzimuth2(conf->value("ArchaeoLines/show_custom_azimuth_2", false).toBool());
×
617
        showCustomAltitude1(conf->value("ArchaeoLines/show_custom_altitude_1", false).toBool());
×
618
        showCustomAltitude2(conf->value("ArchaeoLines/show_custom_altitude_2", false).toBool());
×
619
        showCustomDeclination1(conf->value("ArchaeoLines/show_custom_declination_1", false).toBool());
×
620
        showCustomDeclination2(conf->value("ArchaeoLines/show_custom_declination_2", false).toBool());
×
621

622
        enableArchaeoLines(conf->value("ArchaeoLines/enable_at_startup", false).toBool());
×
623
}
×
624

625
void ArchaeoLines::setLineWidth(int width)
×
626
{
627
        if (width!=lineWidth)
×
628
        {
629
                lineWidth=qBound(1, width, 8); // Force some sensible limit
×
630
                conf->setValue("ArchaeoLines/line_thickness", lineWidth);
×
631
                emit lineWidthChanged(lineWidth);
×
632
        }
633
}
×
634

635
void ArchaeoLines::showEquinox(bool b)
×
636
{
637
        if (b!=flagShowEquinox)
×
638
        {
639
                flagShowEquinox=b;
×
640
                conf->setValue("ArchaeoLines/show_equinox",         isEquinoxDisplayed());
×
641
                equinoxLine->setDisplayed(b);
×
642
                emit showEquinoxChanged(b);
×
643
        }
644
}
×
645
void ArchaeoLines::showSolstices(bool b)
×
646
{
647
        if (b!=flagShowSolstices)
×
648
        {
649
                flagShowSolstices=b;
×
650
                conf->setValue("ArchaeoLines/show_solstices",         isSolsticesDisplayed());
×
651
                northernSolsticeLine->setDisplayed(b);
×
652
                southernSolsticeLine->setDisplayed(b);
×
653
                emit showSolsticesChanged(b);
×
654
        }
655
}
×
656
void ArchaeoLines::showCrossquarters(bool b)
×
657
{
658
        if (b!=flagShowCrossquarters)
×
659
        {
660
                flagShowCrossquarters=b;
×
661
                conf->setValue("ArchaeoLines/show_crossquarters",     isCrossquartersDisplayed());
×
662
                northernCrossquarterLine->setDisplayed(b);
×
663
                southernCrossquarterLine->setDisplayed(b);
×
664
                emit showCrossquartersChanged(b);
×
665
        }
666
}
×
667
void ArchaeoLines::showMajorStandstills(bool b)
×
668
{
669
        if (b!=flagShowMajorStandstills)
×
670
        {
671
                flagShowMajorStandstills=b;
×
672
                conf->setValue("ArchaeoLines/show_major_standstills", isMajorStandstillsDisplayed());
×
673
                northernMajorStandstillLine0->setDisplayed(b);
×
674
                northernMajorStandstillLine1->setDisplayed(b);
×
675
                southernMajorStandstillLine6->setDisplayed(b);
×
676
                southernMajorStandstillLine7->setDisplayed(b);
×
677
                emit showMajorStandstillsChanged(b);
×
678
        }
679
}
×
680
void ArchaeoLines::showMinorStandstills(bool b)
×
681
{
682
        if (b!=flagShowMinorStandstills)
×
683
        {
684
                flagShowMinorStandstills=b;
×
685
                conf->setValue("ArchaeoLines/show_minor_standstills", isMinorStandstillsDisplayed());
×
686
                northernMinorStandstillLine2->setDisplayed(b);
×
687
                northernMinorStandstillLine3->setDisplayed(b);
×
688
                southernMinorStandstillLine4->setDisplayed(b);
×
689
                southernMinorStandstillLine5->setDisplayed(b);
×
690
                emit showMinorStandstillsChanged(b);
×
691
        }
692
}
×
693
void ArchaeoLines::showPolarCircles(bool b)
×
694
{
695
        if (b!=flagShowPolarCircles)
×
696
        {
697
                flagShowPolarCircles=b;
×
698
                conf->setValue("ArchaeoLines/show_polar_circles",      isPolarCirclesDisplayed());
×
699
                northernPolarCircleLine->setDisplayed(b);
×
700
                southernPolarCircleLine->setDisplayed(b);
×
701
                emit showPolarCirclesChanged(b);
×
702
        }
703
}
×
704
void ArchaeoLines::showZenithPassage(bool b)
×
705
{
706
        if (b!=flagShowZenithPassage)
×
707
        {
708
                flagShowZenithPassage=b;
×
709
                conf->setValue("ArchaeoLines/show_zenith_passage",      isZenithPassageDisplayed());
×
710
                zenithPassageLine->setDisplayed(b);
×
711
                emit showZenithPassageChanged(b);
×
712
        }
713
}
×
714
void ArchaeoLines::showNadirPassage(bool b)
×
715
{
716
        if (b!=flagShowNadirPassage)
×
717
        {
718
                flagShowNadirPassage=b;
×
719
                conf->setValue("ArchaeoLines/show_nadir_passage",       isNadirPassageDisplayed());
×
720
                nadirPassageLine->setDisplayed(b);
×
721
                emit showNadirPassageChanged(b);
×
722
        }
723
}
×
724
void ArchaeoLines::showSelectedObject(bool b)
×
725
{
726
        if (b!=flagShowSelectedObject)
×
727
        {
728
                flagShowSelectedObject=b;
×
729
                conf->setValue("ArchaeoLines/show_selected_object",       isSelectedObjectDisplayed());
×
730
                selectedObjectLine->setDisplayed(b);
×
731
                emit showSelectedObjectChanged(b);
×
732
        }
733
}
×
734
void ArchaeoLines::showSelectedObjectAzimuth(bool b)
×
735
{
736
        if (b!=flagShowSelectedObjectAzimuth)
×
737
        {
738
                flagShowSelectedObjectAzimuth=b;
×
739
                conf->setValue("ArchaeoLines/show_selected_object_azimuth", isSelectedObjectAzimuthDisplayed());
×
740
                selectedObjectAzimuthLine->setDisplayed(b);
×
741
                emit showSelectedObjectAzimuthChanged(b);
×
742
        }
743
}
×
744
void ArchaeoLines::showSelectedObjectHourAngle(bool b)
×
745
{
746
        if (b!=flagShowSelectedObjectHourAngle)
×
747
        {
748
                flagShowSelectedObjectHourAngle=b;
×
749
                conf->setValue("ArchaeoLines/show_selected_object_hour_angle", isSelectedObjectHourAngleDisplayed());
×
750
                selectedObjectHourAngleLine->setDisplayed(b);
×
751
                emit showSelectedObjectHourAngleChanged(b);
×
752
        }
753
}
×
754
void ArchaeoLines::showCurrentSun(bool b)
×
755
{
756
        if (b!=flagShowCurrentSun)
×
757
        {
758
                flagShowCurrentSun=b;
×
759
                conf->setValue("ArchaeoLines/show_current_sun",       isCurrentSunDisplayed());
×
760
                currentSunLine->setDisplayed(b);
×
761
                emit showCurrentSunChanged(b);
×
762
        }
763
}
×
764
void ArchaeoLines::showCurrentMoon(bool b)
×
765
{
766
        if (b!=flagShowCurrentMoon)
×
767
        {
768
                flagShowCurrentMoon=b;
×
769
                conf->setValue("ArchaeoLines/show_current_moon",       isCurrentMoonDisplayed());
×
770
                currentMoonLine->setDisplayed(b);
×
771
                emit showCurrentMoonChanged(b);
×
772
        }
773
}
×
774
void ArchaeoLines::showCurrentPlanet(ArchaeoLine::Line l)
×
775
{
776
        // Avoid a crash but give warning.
777
        if ((l<ArchaeoLine::CurrentPlanetNone) || (l>ArchaeoLine::CurrentPlanetSaturn))
×
778
        {
779
                qWarning() << "ArchaeoLines::showCurrentPlanet: Invalid planet called:" << l << "Setting to none.";
×
780
                l=ArchaeoLine::CurrentPlanetNone;
×
781
        }
782
        if(l!=enumShowCurrentPlanet)
×
783
        {
784
                enumShowCurrentPlanet=l;
×
785
                const char *planetStrings[]={"none", "Mercury", "Venus", "Mars", "Jupiter", "Saturn"};
×
786

787
                conf->setValue("ArchaeoLines/show_current_planet", planetStrings[l-ArchaeoLine::CurrentPlanetNone]);
×
788
                currentPlanetLine->setLineType(enumShowCurrentPlanet);
×
789
                currentPlanetLine->setDisplayed(enumShowCurrentPlanet != ArchaeoLine::CurrentPlanetNone);
×
790

791
                emit currentPlanetChanged(l);
×
792
        }
793
}
×
794
void ArchaeoLines::showCurrentPlanetNamed(const QString &planet)
×
795
{
796
        static const QMap<QString, ArchaeoLine::Line>map={
797
                {"none",    ArchaeoLine::CurrentPlanetNone},
×
798
                {"Mercury", ArchaeoLine::CurrentPlanetMercury},
×
799
                {"Venus",   ArchaeoLine::CurrentPlanetVenus},
×
800
                {"Mars",    ArchaeoLine::CurrentPlanetMars},
×
801
                {"Jupiter", ArchaeoLine::CurrentPlanetJupiter},
×
802
                {"Saturn",  ArchaeoLine::CurrentPlanetSaturn}};
×
803
        enumShowCurrentPlanet=map.value(planet, ArchaeoLine::CurrentPlanetNone);
×
804

805
        if (!map.contains(planet))
×
806
                qWarning() << "ArchaeoLines: showCurrentPlanet: Invalid planet requested: " << planet;
×
807

808
        conf->setValue("ArchaeoLines/show_current_planet", map.key(enumShowCurrentPlanet));
×
809

810
        currentPlanetLine->setLineType(enumShowCurrentPlanet);
×
811
        currentPlanetLine->setDisplayed(enumShowCurrentPlanet != ArchaeoLine::CurrentPlanetNone);
×
812
        emit currentPlanetChanged(enumShowCurrentPlanet);
×
813
}
×
814
void ArchaeoLines::showGeographicLocation1(bool b)
×
815
{
816
        if (b!=flagShowGeographicLocation1)
×
817
        {
818
                flagShowGeographicLocation1=b;
×
819
                conf->setValue("ArchaeoLines/show_geographic_location_1",       isGeographicLocation1Displayed());
×
820
                geographicLocation1Line->setDisplayed(b);
×
821
                emit showGeographicLocation1Changed(b);
×
822
        }
823
}
×
824
void ArchaeoLines::showGeographicLocation2(bool b)
×
825
{
826
        if (b!=flagShowGeographicLocation2)
×
827
        {
828
                flagShowGeographicLocation2=b;
×
829
                conf->setValue("ArchaeoLines/show_geographic_location_2",       isGeographicLocation2Displayed());
×
830
                geographicLocation2Line->setDisplayed(b);
×
831
                emit showGeographicLocation2Changed(b);
×
832
        }
833
}
×
834
void ArchaeoLines::showCustomAzimuth1(bool b)
×
835
{
836
        if (b!=flagShowCustomAzimuth1)
×
837
        {
838
                flagShowCustomAzimuth1=b;
×
839
                conf->setValue("ArchaeoLines/show_custom_azimuth_1",       isCustomAzimuth1Displayed());
×
840
                customAzimuth1Line->setDisplayed(b);
×
841
                emit showCustomAzimuth1Changed(b);
×
842
        }
843
}
×
844
void ArchaeoLines::showCustomAzimuth2(bool b)
×
845
{
846
        if (b!=flagShowCustomAzimuth2)
×
847
        {
848
                flagShowCustomAzimuth2=b;
×
849
                conf->setValue("ArchaeoLines/show_custom_azimuth_2",       isCustomAzimuth2Displayed());
×
850
                customAzimuth2Line->setDisplayed(b);
×
851
                emit showCustomAzimuth2Changed(b);
×
852
        }
853
}
×
854
void ArchaeoLines::showCustomAltitude1(bool b)
×
855
{
856
        if (b!=flagShowCustomAltitude1)
×
857
        {
858
                flagShowCustomAltitude1=b;
×
859
                conf->setValue("ArchaeoLines/show_custom_altitude_1",       isCustomAltitude1Displayed());
×
860
                customAltitude1Line->setDisplayed(b);
×
861
                emit showCustomAltitude1Changed(b);
×
862
        }
863
}
×
864
void ArchaeoLines::showCustomAltitude2(bool b)
×
865
{
866
        if (b!=flagShowCustomAltitude2)
×
867
        {
868
                flagShowCustomAltitude2=b;
×
869
                conf->setValue("ArchaeoLines/show_custom_altitude_2",       isCustomAltitude2Displayed());
×
870
                customAltitude2Line->setDisplayed(b);
×
871
                emit showCustomAltitude2Changed(b);
×
872
        }
873
}
×
874
void ArchaeoLines::showCustomDeclination1(bool b)
×
875
{
876
        if (b!=flagShowCustomDeclination1)
×
877
        {
878
                flagShowCustomDeclination1=b;
×
879
                conf->setValue("ArchaeoLines/show_custom_declination_1",       isCustomDeclination1Displayed());
×
880
                customDeclination1Line->setDisplayed(b);
×
881
                emit showCustomDeclination1Changed(b);
×
882
        }
883
}
×
884
void ArchaeoLines::showCustomDeclination2(bool b)
×
885
{
886
        if (b!=flagShowCustomDeclination2)
×
887
        {
888
                flagShowCustomDeclination2=b;
×
889
                conf->setValue("ArchaeoLines/show_custom_declination_2",       isCustomDeclination2Displayed());
×
890
                customDeclination2Line->setDisplayed(b);
×
891
                emit showCustomDeclination2Changed(b);
×
892
        }
893
}
×
894

895
void ArchaeoLines::setGeographicLocation1Longitude(double lng)
×
896
{
897
        conf->setValue("ArchaeoLines/geographic_location_1_longitude", lng);
×
898
        geographicLocation1Longitude=lng;
×
899
        StelLocation loc=core->getCurrentLocation();
×
900
        double az=loc.getAzimuthForLocation(geographicLocation1Longitude, geographicLocation1Latitude);
×
901
        if (StelApp::getInstance().getFlagSouthAzimuthUsage())
×
902
                az+=180.0;
×
903
        geographicLocation1Line->setDefiningAngle(az);
×
904
        emit geographicLocation1Changed();
×
905
}
×
906
void ArchaeoLines::setGeographicLocation1Latitude(double lat)
×
907
{
908
        conf->setValue("ArchaeoLines/geographic_location_1_latitude", lat);
×
909
        geographicLocation1Latitude=lat;
×
910
        StelLocation loc=core->getCurrentLocation();
×
911
        double az=loc.getAzimuthForLocation(geographicLocation1Longitude, geographicLocation1Latitude);
×
912
        if (StelApp::getInstance().getFlagSouthAzimuthUsage())
×
913
                az+=180.0;
×
914
        geographicLocation1Line->setDefiningAngle(az);
×
915
        emit geographicLocation1Changed();
×
916
}
×
917
void ArchaeoLines::setGeographicLocation1Label(const QString &label)
×
918
{
919
        geographicLocation1Line->setLabel(label);
×
920
        conf->setValue("ArchaeoLines/geographic_location_1_label", label);
×
921
        emit geographicLocation1LabelChanged(label);
×
922
}
×
923
void ArchaeoLines::setGeographicLocation2Longitude(double lng)
×
924
{
925
        conf->setValue("ArchaeoLines/geographic_location_2_longitude", lng);
×
926
        geographicLocation2Longitude=lng;
×
927
        StelLocation loc=core->getCurrentLocation();
×
928
        double az=loc.getAzimuthForLocation(geographicLocation2Longitude, geographicLocation2Latitude);
×
929
        if (StelApp::getInstance().getFlagSouthAzimuthUsage())
×
930
                az+=180.0;
×
931
        geographicLocation2Line->setDefiningAngle(az);
×
932
        emit geographicLocation2Changed();
×
933
}
×
934
void ArchaeoLines::setGeographicLocation2Latitude(double lat)
×
935
{
936
        conf->setValue("ArchaeoLines/geographic_location_2_latitude", lat);
×
937
        geographicLocation2Latitude=lat;
×
938
        StelLocation loc=core->getCurrentLocation();
×
939
        double az=loc.getAzimuthForLocation(geographicLocation2Longitude, geographicLocation2Latitude);
×
940
        if (StelApp::getInstance().getFlagSouthAzimuthUsage())
×
941
                az+=180.0;
×
942
        geographicLocation2Line->setDefiningAngle(az);
×
943
        emit geographicLocation2Changed();
×
944
}
×
945
void ArchaeoLines::setGeographicLocation2Label(const QString &label)
×
946
{
947
        geographicLocation2Line->setLabel(label);
×
948
        conf->setValue("ArchaeoLines/geographic_location_2_label", label);
×
949
        emit geographicLocation2LabelChanged(label);
×
950
}
×
951

952
void ArchaeoLines::updateObserverLocation(const StelLocation &loc)
×
953
{
954
        geographicLocation1Line->setDefiningAngle(loc.getAzimuthForLocation(geographicLocation1Longitude, geographicLocation1Latitude));
×
955
        geographicLocation2Line->setDefiningAngle(loc.getAzimuthForLocation(geographicLocation2Longitude, geographicLocation2Latitude));
×
956
}
×
957

958

959
void ArchaeoLines::setCustomAzimuth1(double az)
×
960
{
961
        if (!qFuzzyCompare(az, customAzimuth1Line->getDefiningAngle()))
×
962
        {
963
                customAzimuth1Line->setDefiningAngle(az);
×
964
                conf->setValue("ArchaeoLines/custom_azimuth_1_angle", az);
×
965
                emit customAzimuth1Changed(az);
×
966
        }
967
}
×
968
void ArchaeoLines::setCustomAzimuth2(double az)
×
969
{
970
        if (!qFuzzyCompare(az, customAzimuth2Line->getDefiningAngle()))
×
971
        {
972
                customAzimuth2Line->setDefiningAngle(az);
×
973
                conf->setValue("ArchaeoLines/custom_azimuth_2_angle", az);
×
974
                emit customAzimuth2Changed(az);
×
975
        }
976
}
×
977
void ArchaeoLines::setCustomAzimuth1Label(const QString &label)
×
978
{
979
        customAzimuth1Line->setLabel(label);
×
980
        conf->setValue("ArchaeoLines/custom_azimuth_1_label", label);
×
981
        emit customAzimuth1LabelChanged(label);
×
982
}
×
983
void ArchaeoLines::setCustomAzimuth2Label(const QString &label)
×
984
{
985
        customAzimuth2Line->setLabel(label);
×
986
        conf->setValue("ArchaeoLines/custom_azimuth_2_label", label);
×
987
        emit customAzimuth2LabelChanged(label);
×
988
}
×
989

990
void ArchaeoLines::setCustomAltitude1(double alt)
×
991
{
992
        if (!qFuzzyCompare(alt, customAltitude1Line->getDefiningAngle()))
×
993
        {
994
                customAltitude1Line->setDefiningAngle(alt);
×
995
                conf->setValue("ArchaeoLines/custom_altitude_1_angle", alt);
×
996
                emit customAltitude1Changed(alt);
×
997
        }
998
}
×
999
void ArchaeoLines::setCustomAltitude2(double alt)
×
1000
{
1001
        if (!qFuzzyCompare(alt, customAltitude2Line->getDefiningAngle()))
×
1002
        {
1003
                customAltitude2Line->setDefiningAngle(alt);
×
1004
                conf->setValue("ArchaeoLines/custom_altitude_2_angle", alt);
×
1005
                emit customAltitude2Changed(alt);
×
1006
        }
1007
}
×
1008
void ArchaeoLines::setCustomAltitude1Label(const QString &label)
×
1009
{
1010
        customAltitude1Line->setLabel(label);
×
1011
        conf->setValue("ArchaeoLines/custom_altitude_1_label", label);
×
1012
        emit customAltitude1LabelChanged(label);
×
1013
}
×
1014
void ArchaeoLines::setCustomAltitude2Label(const QString &label)
×
1015
{
1016
        customAltitude2Line->setLabel(label);
×
1017
        conf->setValue("ArchaeoLines/custom_altitude_2_label", label);
×
1018
        emit customAltitude2LabelChanged(label);
×
1019
}
×
1020

1021
void ArchaeoLines::setCustomDeclination1(double dec)
×
1022
{
1023
        if (!qFuzzyCompare(dec, customDeclination1Line->getDefiningAngle()))
×
1024
        {
1025
                customDeclination1Line->setDefiningAngle(dec);
×
1026
                conf->setValue("ArchaeoLines/custom_declination_1_angle", dec);
×
1027
                emit customDeclination1Changed(dec);
×
1028
        }
1029
}
×
1030
void ArchaeoLines::setCustomDeclination2(double dec)
×
1031
{
1032
        if (!qFuzzyCompare(dec, customDeclination2Line->getDefiningAngle()))
×
1033
        {
1034
                customDeclination2Line->setDefiningAngle(dec);
×
1035
                conf->setValue("ArchaeoLines/custom_declination_2_angle", dec);
×
1036
                emit customDeclination2Changed(dec);
×
1037
        }
1038
}
×
1039
void ArchaeoLines::setCustomDeclination1Label(const QString &label)
×
1040
{
1041
        customDeclination1Line->setLabel(label);
×
1042
        conf->setValue("ArchaeoLines/custom_declination_1_label", label);
×
1043
        emit customDeclination1LabelChanged(label);
×
1044
}
×
1045
void ArchaeoLines::setCustomDeclination2Label(const QString &label)
×
1046
{
1047
        customDeclination2Line->setLabel(label);
×
1048
        conf->setValue("ArchaeoLines/custom_declination_2_label", label);
×
1049
        emit customDeclination2LabelChanged(label);
×
1050
}
×
1051

1052
void ArchaeoLines::setEquinoxColor(const Vec3f &color)
×
1053
{
1054
        if (color!=getEquinoxColor())
×
1055
        {
1056
                equinoxColor=color;
×
1057
                emit equinoxColorChanged(color);
×
1058
        }
1059
}
×
1060
void ArchaeoLines::setSolsticesColor(const Vec3f &color)
×
1061
{
1062
        if (color!=getSolsticesColor())
×
1063
        {
1064
                solsticesColor=color;
×
1065
                emit solsticesColorChanged(color);
×
1066
        }
1067
}
×
1068
void ArchaeoLines::setCrossquartersColor(const Vec3f &color)
×
1069
{
1070
        if (color!=getCrossquartersColor())
×
1071
        {
1072
                crossquartersColor=color;
×
1073
                emit crossquartersColorChanged(color);
×
1074
        }
1075
}
×
1076
void ArchaeoLines::setMajorStandstillColor(const Vec3f &color)
×
1077
{
1078
        if (color!=getMajorStandstillColor())
×
1079
        {
1080
                majorStandstillColor=color;
×
1081
                emit majorStandstillColorChanged(color);
×
1082
        }
1083
}
×
1084
void ArchaeoLines::setMinorStandstillColor(const Vec3f &color)
×
1085
{
1086
        if (color!=getMinorStandstillColor())
×
1087
        {
1088
                minorStandstillColor=color;
×
1089
                emit minorStandstillColorChanged(color);
×
1090
        }
1091
}
×
1092
void ArchaeoLines::setPolarCirclesColor(const Vec3f &color)
×
1093
{
1094
        if (color!=getPolarCirclesColor())
×
1095
        {
1096
                polarCirclesColor=color;
×
1097
                emit polarCirclesColorChanged(color);
×
1098
        }
1099
}
×
1100
void ArchaeoLines::setZenithPassageColor(const Vec3f &color)
×
1101
{
1102
        if (color!=getZenithPassageColor())
×
1103
        {
1104
                zenithPassageColor=color;
×
1105
                emit zenithPassageColorChanged(color);
×
1106
        }
1107
}
×
1108
void ArchaeoLines::setNadirPassageColor(const Vec3f &color)
×
1109
{
1110
        if (color!=getNadirPassageColor())
×
1111
        {
1112
                nadirPassageColor=color;
×
1113
                emit nadirPassageColorChanged(color);
×
1114
        }
1115
}
×
1116
void ArchaeoLines::setSelectedObjectColor(const Vec3f &color)
×
1117
{
1118
        if (color!=getSelectedObjectColor())
×
1119
        {
1120
                selectedObjectColor=color;
×
1121
                emit selectedObjectColorChanged(color);
×
1122
        }
1123
}
×
1124
void ArchaeoLines::setSelectedObjectAzimuthColor(const Vec3f &color)
×
1125
{
1126
        if (color!=getSelectedObjectAzimuthColor())
×
1127
        {
1128
                selectedObjectAzimuthColor=color;
×
1129
                emit selectedObjectAzimuthColorChanged(color);
×
1130
        }
1131
}
×
1132
void ArchaeoLines::setSelectedObjectHourAngleColor(const Vec3f &color)
×
1133
{
1134
        if (color!=getSelectedObjectHourAngleColor())
×
1135
        {
1136
                selectedObjectHourAngleColor=color;
×
1137
                emit selectedObjectHourAngleColorChanged(color);
×
1138
        }
1139
}
×
1140
void ArchaeoLines::setCurrentSunColor(const Vec3f &color)
×
1141
{
1142
        if (color!=getCurrentSunColor())
×
1143
        {
1144
                currentSunColor=color;
×
1145
                emit currentSunColorChanged(color);
×
1146
        }
1147
}
×
1148
void ArchaeoLines::setCurrentMoonColor(const Vec3f &color)
×
1149
{
1150
        if (color!=getCurrentMoonColor())
×
1151
        {
1152
                currentMoonColor=color;
×
1153
                emit currentMoonColorChanged(color);
×
1154
        }
1155
}
×
1156
void ArchaeoLines::setCurrentPlanetColor(const Vec3f &color)
×
1157
{
1158
        if (color!=getCurrentPlanetColor())
×
1159
        {
1160
                currentPlanetColor=color;
×
1161
                emit currentPlanetColorChanged(color);
×
1162
        }
1163
}
×
1164
void ArchaeoLines::setGeographicLocation1Color(const Vec3f &color)
×
1165
{
1166
        if (color!=getGeographicLocation1Color())
×
1167
        {
1168
                geographicLocation1Color=color;
×
1169
                emit geographicLocation1ColorChanged(color);
×
1170
        }
1171
}
×
1172
void ArchaeoLines::setGeographicLocation2Color(const Vec3f &color)
×
1173
{
1174
        if (color!=getGeographicLocation2Color())
×
1175
        {
1176
                geographicLocation2Color=color;
×
1177
                emit geographicLocation2ColorChanged(color);
×
1178
        }
1179
}
×
1180
void ArchaeoLines::setCustomAzimuth1Color(const Vec3f &color)
×
1181
{
1182
        if (color!=getCustomAzimuth1Color())
×
1183
        {
1184
                customAzimuth1Color=color;
×
1185
                emit customAzimuth1ColorChanged(color);
×
1186
        }
1187
}
×
1188
void ArchaeoLines::setCustomAzimuth2Color(const Vec3f &color)
×
1189
{
1190
        if (color!=getCustomAzimuth2Color())
×
1191
        {
1192
                customAzimuth2Color=color;
×
1193
                emit customAzimuth2ColorChanged(color);
×
1194
        }
1195
}
×
1196
void ArchaeoLines::setCustomAltitude1Color(const Vec3f &color)
×
1197
{
1198
        if (color!=getCustomAltitude1Color())
×
1199
        {
1200
                customAltitude1Color=color;
×
1201
                emit customAltitude1ColorChanged(color);
×
1202
        }
1203
}
×
1204
void ArchaeoLines::setCustomAltitude2Color(const Vec3f &color)
×
1205
{
1206
        if (color!=getCustomAltitude2Color())
×
1207
        {
1208
                customAltitude2Color=color;
×
1209
                emit customAltitude2ColorChanged(color);
×
1210
        }
1211
}
×
1212
void ArchaeoLines::setCustomDeclination1Color(const Vec3f &color)
×
1213
{
1214
        if (color!=getCustomDeclination1Color())
×
1215
        {
1216
                customDeclination1Color=color;
×
1217
                emit customDeclination1ColorChanged(color);
×
1218
        }
1219
}
×
1220
void ArchaeoLines::setCustomDeclination2Color(const Vec3f &color)
×
1221
{
1222
        if (color!=getCustomDeclination2Color())
×
1223
        {
1224
                customDeclination2Color=color;
×
1225
                emit customDeclination2ColorChanged(color);
×
1226
        }
1227
}
×
1228

1229

1230

1231
double ArchaeoLines::getLineAngle(ArchaeoLine::Line whichLine) const
×
1232
{
1233
        switch (whichLine){
×
1234
                case ArchaeoLine::Equinox:
×
1235
                        return equinoxLine->getDefiningAngle();
×
1236
                case ArchaeoLine::Solstices:
×
1237
                        return northernSolsticeLine->getDefiningAngle();
×
1238
                case ArchaeoLine::Crossquarters:
×
1239
                        return northernCrossquarterLine->getDefiningAngle();
×
1240
                case ArchaeoLine::MajorStandstill:
×
1241
                        return northernMajorStandstillLine0->getDefiningAngle();
×
1242
                case ArchaeoLine::MinorStandstill:
×
1243
                        return northernMinorStandstillLine2->getDefiningAngle();
×
1244
                case ArchaeoLine::PolarCircles:
×
1245
                        return northernPolarCircleLine->getDefiningAngle();
×
1246
                case ArchaeoLine::ZenithPassage:
×
1247
                        return zenithPassageLine->getDefiningAngle();
×
1248
                case ArchaeoLine::NadirPassage:
×
1249
                        return nadirPassageLine->getDefiningAngle();
×
1250
                case ArchaeoLine::SelectedObject:
×
1251
                        return selectedObjectLine->getDefiningAngle();
×
1252
                case ArchaeoLine::SelectedObjectAzimuth:
×
1253
                        return selectedObjectAzimuthLine->getDefiningAngle();
×
1254
                case ArchaeoLine::SelectedObjectHourAngle:
×
1255
                        return selectedObjectHourAngleLine->getDefiningAngle();
×
1256
                case ArchaeoLine::CurrentSun:
×
1257
                        return currentSunLine->getDefiningAngle();
×
1258
                case ArchaeoLine::CurrentMoon:
×
1259
                        return currentMoonLine->getDefiningAngle();
×
1260
                case ArchaeoLine::CurrentPlanetNone:
×
1261
                        return 0.0;
×
1262
                case ArchaeoLine::CurrentPlanetMercury:
×
1263
                case ArchaeoLine::CurrentPlanetVenus:
1264
                case ArchaeoLine::CurrentPlanetMars:
1265
                case ArchaeoLine::CurrentPlanetJupiter:
1266
                case ArchaeoLine::CurrentPlanetSaturn:
1267
                        return currentPlanetLine->getDefiningAngle();
×
1268
                case ArchaeoLine::GeographicLocation1:
×
1269
                        return geographicLocation1Line->getDefiningAngle();
×
1270
                case ArchaeoLine::GeographicLocation2:
×
1271
                        return geographicLocation2Line->getDefiningAngle();
×
1272
                case ArchaeoLine::CustomAzimuth1:
×
1273
                        return customAzimuth1Line->getDefiningAngle();
×
1274
                case ArchaeoLine::CustomAzimuth2:
×
1275
                        return customAzimuth2Line->getDefiningAngle();
×
1276
                case ArchaeoLine::CustomAltitude1:
×
1277
                        return customAltitude1Line->getDefiningAngle();
×
1278
                case ArchaeoLine::CustomAltitude2:
×
1279
                        return customAltitude2Line->getDefiningAngle();
×
1280
                case ArchaeoLine::CustomDeclination1:
×
1281
                        return customDeclination1Line->getDefiningAngle();
×
1282
                case ArchaeoLine::CustomDeclination2:
×
1283
                        return customDeclination2Line->getDefiningAngle();
×
1284
        }
1285
        return -100.0;
×
1286
}
1287

1288
QString ArchaeoLines::getLineLabel(ArchaeoLine::Line whichLine) const
×
1289
{
1290
        switch (whichLine){
×
1291
                case ArchaeoLine::Equinox:
×
1292
                        return equinoxLine->getLabel();
×
1293
                case ArchaeoLine::Solstices:
×
1294
                        return northernSolsticeLine->getLabel();
×
1295
                case ArchaeoLine::Crossquarters:
×
1296
                        return northernCrossquarterLine->getLabel();
×
1297
                case ArchaeoLine::MajorStandstill:
×
1298
                        return northernMajorStandstillLine0->getLabel();
×
1299
                case ArchaeoLine::MinorStandstill:
×
1300
                        return northernMinorStandstillLine2->getLabel();
×
1301
                case ArchaeoLine::PolarCircles:
×
1302
                        return northernPolarCircleLine->getLabel();
×
1303
                case ArchaeoLine::ZenithPassage:
×
1304
                        return zenithPassageLine->getLabel();
×
1305
                case ArchaeoLine::NadirPassage:
×
1306
                        return nadirPassageLine->getLabel();
×
1307
                case ArchaeoLine::SelectedObject:
×
1308
                        return selectedObjectLine->getLabel();
×
1309
                case ArchaeoLine::SelectedObjectAzimuth:
×
1310
                        return selectedObjectAzimuthLine->getLabel();
×
1311
                case ArchaeoLine::SelectedObjectHourAngle:
×
1312
                        return selectedObjectHourAngleLine->getLabel();
×
1313
                case ArchaeoLine::CurrentSun:
×
1314
                        return currentSunLine->getLabel();
×
1315
                case ArchaeoLine::CurrentMoon:
×
1316
                        return currentMoonLine->getLabel();
×
1317
                case ArchaeoLine::CurrentPlanetNone:
×
1318
                case ArchaeoLine::CurrentPlanetMercury:
1319
                case ArchaeoLine::CurrentPlanetVenus:
1320
                case ArchaeoLine::CurrentPlanetMars:
1321
                case ArchaeoLine::CurrentPlanetJupiter:
1322
                case ArchaeoLine::CurrentPlanetSaturn:
1323
                        return currentPlanetLine->getLabel();
×
1324
                case ArchaeoLine::GeographicLocation1:
×
1325
                        return geographicLocation1Line->getLabel();
×
1326
                case ArchaeoLine::GeographicLocation2:
×
1327
                        return geographicLocation2Line->getLabel();
×
1328
                case ArchaeoLine::CustomAzimuth1:
×
1329
                        return customAzimuth1Line->getLabel();
×
1330
                case ArchaeoLine::CustomAzimuth2:
×
1331
                        return customAzimuth2Line->getLabel();
×
1332
                case ArchaeoLine::CustomAltitude1:
×
1333
                        return customAltitude1Line->getLabel();
×
1334
                case ArchaeoLine::CustomAltitude2:
×
1335
                        return customAltitude2Line->getLabel();
×
1336
                case ArchaeoLine::CustomDeclination1:
×
1337
                        return customDeclination1Line->getLabel();
×
1338
                case ArchaeoLine::CustomDeclination2:
×
1339
                        return customDeclination2Line->getLabel();
×
1340
        }
1341
        Q_ASSERT(0);
×
1342
        return "ArchaeoLines::getLineLabel(): Error!";
1343
}
1344

1345
// callback stuff shamelessly taken from GridLinesMgr. Changes: Text MUST be filled, can also be empty for no label!
1346
struct ALViewportEdgeIntersectCallbackData
1347
{
1348
        ALViewportEdgeIntersectCallbackData(StelPainter* p)
×
1349
                : sPainter(p)
×
1350
        {}
×
1351
        StelPainter* sPainter;
1352
        //Vec4f textColor;
1353
        QString text;                // Label to display at the intersection of the lines and screen side
1354
};
1355

1356
// Callback which draws the label of the grid
1357
void alViewportEdgeIntersectCallback(const Vec3d& screenPos, const Vec3d& direction, void* userData)
×
1358
{
1359
        // TODO: decide whether to use different color for labels.
1360
        // Currently label color is equal to line color, and provisions for changing that are commented away.
1361

1362
        ALViewportEdgeIntersectCallbackData* d = static_cast<ALViewportEdgeIntersectCallbackData*>(userData);
×
1363
        Vec3d direc(direction);
×
1364
        direc.normalize();
×
1365
        //const Vec4f tmpColor = d->sPainter->getColor();
1366
        //d->sPainter->setColor(d->textColor[0], d->textColor[1], d->textColor[2], d->textColor[3]);
1367
        const float ppx = static_cast<float>(d->sPainter->getProjector()->getDevicePixelsPerPixel());
×
1368

1369
        const int viewportWidth  = d->sPainter->getProjector()->getViewportWidth();
×
1370
        const int viewportHeight = d->sPainter->getProjector()->getViewportHeight();
×
1371

1372
        QString text = d->text; // original text-from-coordinates taken out!
×
1373
        if (text.isEmpty())
×
1374
                return;
×
1375

1376
        float angleDeg = static_cast<float>(std::atan2(-direc[1], -direc[0])*M_180_PI);
×
1377
        float xshift=6.f;
×
1378
        if (angleDeg>90.f || angleDeg<-90.f)
×
1379
        {
1380
                angleDeg+=180.f;
×
1381
                xshift=-d->sPainter->getFontMetrics().boundingRect(text).width()-6.f*ppx;
×
1382
        }
1383

1384
        // Copy tweak from GridlineMgr
1385
        if ((fabs(screenPos[0])<1.) && (angleDeg>0.f )) // LEFT
×
1386
        {
1387
                xshift+=0.5f*tan(angleDeg*M_PI_180f)*d->sPainter->getFontMetrics().boundingRect(text).height();
×
1388
        }
1389
        else if ((fabs(screenPos[0]-viewportWidth)<1.) && (angleDeg>180.f )) // RIGHT
×
1390
        {
1391
                xshift += 0.5 * tan(angleDeg*M_PI_180f)*d->sPainter->getFontMetrics().boundingRect(text).height();
×
1392
        }
1393
        else if ((fabs(screenPos[1]-viewportHeight)<1.) && fabs(angleDeg)>5.f) // TOP
×
1394
        {
1395
                const float sign = angleDeg<-90.f ? 0.5f : -0.5f;
×
1396
                xshift += sign * (1./tan(angleDeg*M_PI_180f))*d->sPainter->getFontMetrics().boundingRect(text).height();
×
1397
        }
1398
        // It seems bottom edge is always OK!
1399

1400

1401
        d->sPainter->drawText(static_cast<float>(screenPos[0]), static_cast<float>(screenPos[1]), text, angleDeg, xshift*ppx, 3*ppx);
×
1402
        //d->sPainter->setColor(tmpColor[0], tmpColor[1], tmpColor[2], tmpColor[3]); // RESTORE
1403
        d->sPainter->setBlending(true);
×
1404
}
×
1405

1406
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
1407

1408
ArchaeoLine::ArchaeoLine(ArchaeoLine::Line lineType, double definingAngle) :
×
1409
        lineType(lineType), definingAngle(definingAngle), color(0.f, 0.f, 1.f), frameType(StelCore::FrameEquinoxEqu), flagLabel(true)
×
1410
{
1411
        if (lineType>=SelectedObjectAzimuth)
×
1412
                frameType=StelCore::FrameAltAz;
×
1413
        // Font size is 14
1414
        setFontSizeFromApp(StelApp::getInstance().getScreenFontSize());
×
1415
        updateLabel();
×
1416
        fader.setDuration(1000);
×
1417
        // Initialize the message strings and make sure they are translated when the language changes.
1418
        StelApp& app = StelApp::getInstance();
×
1419
        connect(&app, SIGNAL(languageChanged()), this, SLOT(updateLabel()));
×
1420
        connect(&app, SIGNAL(screenFontSizeChanged(int)), this, SLOT(setFontSizeFromApp(const int)));
×
1421
}
×
1422

1423
void ArchaeoLine::updateLabel()
×
1424
{
1425
        //qDebug() << "ArchaeoLine::updateLabel(): lineType is " << lineType;
1426
        // TODO: decide whether showing declinations in addition.
1427
        switch (lineType)
×
1428
        {
1429
                case ArchaeoLine::Equinox:
×
1430
                        label = q_("Equinox");
×
1431
                        break;
×
1432
                case ArchaeoLine::Solstices:
×
1433
                        label = q_("Solstice");
×
1434
                        break;
×
1435
                case ArchaeoLine::Crossquarters:
×
1436
                        label = q_("Crossquarter");
×
1437
                        break;
×
1438
                case ArchaeoLine::MajorStandstill:
×
1439
                        label = q_("Major Lunar Standstill");
×
1440
                        break;
×
1441
                case ArchaeoLine::MinorStandstill:
×
1442
                        label = q_("Minor Lunar Standstill");
×
1443
                        break;
×
1444
                case ArchaeoLine::PolarCircles:
×
1445
                        label = q_("Polar Circle");
×
1446
                        break;
×
1447
                case ArchaeoLine::ZenithPassage:
×
1448
                        label = q_("Zenith Passage");
×
1449
                        break;
×
1450
                case ArchaeoLine::NadirPassage:
×
1451
                        label = q_("Nadir Passage");
×
1452
                        break;
×
1453
                case ArchaeoLine::SelectedObject:
×
1454
                case ArchaeoLine::SelectedObjectAzimuth:
1455
                case ArchaeoLine::SelectedObjectHourAngle:
1456
                        label = q_("Selected Object");
×
1457
                        break;
×
1458
                case ArchaeoLine::CurrentSun:
×
1459
                        label = q_("Sun");
×
1460
                        break;
×
1461
                case ArchaeoLine::CurrentMoon:
×
1462
                        label = q_("Moon");
×
1463
                        break;
×
1464
                case ArchaeoLine::CurrentPlanetNone:
×
1465
                        label = q_("error if you can read this");
×
1466
                        break;
×
1467
                case ArchaeoLine::CurrentPlanetMercury:
×
1468
                        label = q_("Mercury");
×
1469
                        break;
×
1470
                case ArchaeoLine::CurrentPlanetVenus:
×
1471
                        label = q_("Venus");
×
1472
                        break;
×
1473
                case ArchaeoLine::CurrentPlanetMars:
×
1474
                        label = q_("Mars");
×
1475
                        break;
×
1476
                case ArchaeoLine::CurrentPlanetJupiter:
×
1477
                        label = q_("Jupiter");
×
1478
                        break;
×
1479
                case ArchaeoLine::CurrentPlanetSaturn:
×
1480
                        label = q_("Saturn");
×
1481
                        break;
×
1482
                case ArchaeoLine::GeographicLocation1: // label was set in setLabel(). DO NOT update.
×
1483
                case ArchaeoLine::GeographicLocation2:
1484
                case ArchaeoLine::CustomAzimuth1:
1485
                case ArchaeoLine::CustomAzimuth2:
1486
                case ArchaeoLine::CustomAltitude1:
1487
                case ArchaeoLine::CustomAltitude2:
1488
                case ArchaeoLine::CustomDeclination1:
1489
                case ArchaeoLine::CustomDeclination2:
1490
                        break;
×
1491
        }
1492
}
×
1493

1494

1495
void ArchaeoLine::draw(StelCore *core, float intensity) const
×
1496
{
1497
        // borrowed largely from GridLinesMgr.
1498
        if (intensity*fader.getInterstate() < 0.000001f)
×
1499
                return;
×
1500

1501

1502
        StelProjectorP prj = core->getProjection(frameType, StelCore::RefractionAuto);
×
1503

1504
        // Get the bounding halfspace
1505
        const SphericalCap& viewPortSphericalCap = prj->getBoundingCap();
×
1506

1507
        // Initialize a painter and set OpenGL state
1508
        StelPainter sPainter(prj);
×
1509
        const float ppx = static_cast<float>(sPainter.getProjector()->getDevicePixelsPerPixel());
×
1510
        sPainter.setBlending(true);
×
1511
        sPainter.setLineSmooth(true);
×
1512
        const float oldLineWidth=sPainter.getLineWidth();
×
1513
        sPainter.setLineWidth(GETSTELMODULE(ArchaeoLines)->getLineWidth()*ppx);
×
1514
        sPainter.setColor(color[0], color[1], color[2], intensity*fader.getInterstate());
×
1515
        //Vec4f textColor(color[0], color[1], color[2], intensity*fader.getInterstate());
1516

1517
        ALViewportEdgeIntersectCallbackData userData(&sPainter);
×
1518
        sPainter.setFont(font);
×
1519
        //userData.textColor = textColor;
1520
        userData.text = (isLabelVisible() ? label : "");
×
1521
        /////////////////////////////////////////////////
1522
        // Azimuth lines are Great Semicircles. TODO: Make sure the code commented away below is OK in all cases, then cleanup if full circles are never required.
1523
        // Note: The following list must include all Great Circle lines
1524
        if (QList<Line>({SelectedObjectHourAngle, SelectedObjectAzimuth, GeographicLocation1, GeographicLocation2, CustomAzimuth1, CustomAzimuth2}).contains(lineType))
×
1525
        {
1526
                SphericalCap meridianSphericalCap(Vec3d(0,1,0), 0);
×
1527
                Vec3d fpt(-1,0,0);
×
1528
                meridianSphericalCap.n.transfo4d(Mat4d::rotation(Vec3d(0, 0, 1), -definingAngle*M_PI/180.));
×
1529
                fpt.transfo4d(Mat4d::rotation(Vec3d(0, 0, 1), -definingAngle*M_PI/180.));
×
1530

1531
//                Vec3d p1, p2;
1532
//                //if (!SphericalCap::intersectionPoints(viewPortSphericalCap, meridianSphericalCap, p1, p2))
1533
//                {
1534
//                        //if ((viewPortSphericalCap.d<meridianSphericalCap.d && viewPortSphericalCap.contains(meridianSphericalCap.n))
1535
//                        //        || (viewPortSphericalCap.d<-meridianSphericalCap.d && viewPortSphericalCap.contains(-meridianSphericalCap.n)))
1536
//                        { // N.B. we had 3x120degrees here. Look into GridLineMgr to restore if necessary.
1537
//                                // The meridian is fully included in the viewport, draw it in 3 sub-arcs to avoid length > 180.
1538
                                const Mat4d& rotLonP90 = Mat4d::rotation(meridianSphericalCap.n, 90.*M_PI/180.);
×
1539
                                const Mat4d& rotLonM90 = Mat4d::rotation(meridianSphericalCap.n, -90.*M_PI/180.);
×
1540
                                Vec3d rotFpt=fpt;
×
1541
                                rotFpt.transfo4d(rotLonP90);
×
1542
                                Vec3d rotFpt2=fpt;
×
1543
                                rotFpt2.transfo4d(rotLonM90);
×
1544
                                sPainter.drawGreatCircleArc(fpt, rotFpt, Q_NULLPTR, alViewportEdgeIntersectCallback, &userData);
×
1545
                                sPainter.drawGreatCircleArc(rotFpt2, fpt, Q_NULLPTR, alViewportEdgeIntersectCallback, &userData);
×
1546
                                //sPainter.drawGreatCircleArc(rotFpt2, fpt, Q_NULLPTR, alViewportEdgeIntersectCallback, &userData);
1547
                                //return;
1548
//                        }
1549
//                        //else
1550
//                        //        return;
1551
//                }
1552

1553
//                Vec3d middlePoint = p1+p2;
1554
//                middlePoint.normalize();
1555
//                if (!viewPortSphericalCap.contains(middlePoint))
1556
//                        middlePoint*=-1.;
1557

1558
//                // Draw the arc in 2 sub-arcs to avoid lengths > 180 deg
1559
//                sPainter.drawGreatCircleArc(p1, middlePoint, Q_NULLPTR, alViewportEdgeIntersectCallback, &userData);
1560
//                sPainter.drawGreatCircleArc(p2, middlePoint, Q_NULLPTR, alViewportEdgeIntersectCallback, &userData);
1561

1562
//                // OpenGL ES 2.0 doesn't have GL_LINE_SMOOTH
1563
//                #ifdef GL_LINE_SMOOTH
1564
//                if (QOpenGLContext::currentContext()->format().renderableType()==QSurfaceFormat::OpenGL)
1565
//                        glDisable(GL_LINE_SMOOTH);
1566
//                #endif
1567

1568
//                glDisable(GL_BLEND);
1569

1570
//                return;
1571
        }
×
1572
        /////////////////////////////////////////////////
1573
        // Else draw small circles (declinations, altitudes). (Technically, Equator is one, but ok...)
1574
        else
1575
        {
1576
                // Draw the line
1577
                const double lat=definingAngle*M_PI/180.0;
×
1578
                SphericalCap declinationCap(Vec3d(0,0,1), std::sin(lat));
×
1579
                const Vec3d rotCenter(0,0,declinationCap.d);
×
1580

1581
                Vec3d p1, p2;
×
1582
                if (!SphericalCap::intersectionPoints(viewPortSphericalCap, declinationCap, p1, p2))
×
1583
                {
1584
                        if ((viewPortSphericalCap.d<declinationCap.d && viewPortSphericalCap.contains(declinationCap.n))
×
1585
                                        || (viewPortSphericalCap.d<-declinationCap.d && viewPortSphericalCap.contains(-declinationCap.n)))
×
1586
                        {
1587
                                // The line is fully included in the viewport, draw it in 3 sub-arcs to avoid length > 180.
1588
                                Vec3d pt1;
×
1589
                                Vec3d pt2;
×
1590
                                Vec3d pt3;
×
1591
                                const double lon1=0.0;
×
1592
                                const double lon2=120.0*M_PI/180.0;
×
1593
                                const double lon3=240.0*M_PI/180.0;
×
1594
                                StelUtils::spheToRect(lon1, lat, pt1); pt1.normalize();
×
1595
                                StelUtils::spheToRect(lon2, lat, pt2); pt2.normalize();
×
1596
                                StelUtils::spheToRect(lon3, lat, pt3); pt3.normalize();
×
1597

1598
                                sPainter.drawSmallCircleArc(pt1, pt2, rotCenter, alViewportEdgeIntersectCallback, &userData);
×
1599
                                sPainter.drawSmallCircleArc(pt2, pt3, rotCenter, alViewportEdgeIntersectCallback, &userData);
×
1600
                                sPainter.drawSmallCircleArc(pt3, pt1, rotCenter, alViewportEdgeIntersectCallback, &userData);
×
1601
                        }
1602
                }
1603
                else
1604
                {
1605
                        // Draw the arc in 2 sub-arcs to avoid lengths > 180 deg
1606
                        Vec3d middlePoint = p1-rotCenter+p2-rotCenter;
×
1607
                        middlePoint.normalize();
×
1608
                        middlePoint*=(p1-rotCenter).norm();
×
1609
                        middlePoint+=rotCenter;
×
1610
                        if (!viewPortSphericalCap.contains(middlePoint))
×
1611
                        {
1612
                                middlePoint-=rotCenter;
×
1613
                                middlePoint*=-1.;
×
1614
                                middlePoint+=rotCenter;
×
1615
                        }
1616

1617
                        sPainter.drawSmallCircleArc(p1, middlePoint, rotCenter,alViewportEdgeIntersectCallback, &userData);
×
1618
                        sPainter.drawSmallCircleArc(p2, middlePoint, rotCenter, alViewportEdgeIntersectCallback, &userData);
×
1619
                }
1620
        }
×
1621

1622
        sPainter.setLineWidth(oldLineWidth); // restore
×
1623
        sPainter.setLineSmooth(false);
×
1624
        sPainter.setBlending(false);
×
1625
}
×
1626

1627
void ArchaeoLine::setColor(const Vec3f& c)
×
1628
{
1629
        if (c!=color)
×
1630
        {
1631
                color = c;
×
1632
                emit colorChanged(c);
×
1633
        }
1634
}
×
1635
void ArchaeoLine::setDefiningAngle(const double angle)
×
1636
{
1637
        if (!qFuzzyCompare(angle, definingAngle))
×
1638
        {
1639
                definingAngle=angle;
×
1640
                emit definingAngleChanged(angle);
×
1641
        }
1642
}
×
1643
void ArchaeoLine::setLabelVisible(const bool b)
×
1644
{
1645
        if (b!=flagLabel)
×
1646
        {
1647
                flagLabel=b;
×
1648
                emit flagLabelChanged(b);
×
1649
        }
1650
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc