Kstars

kstarsdbus.cpp
1/*
2 SPDX-FileCopyrightText: 2002 Thomas Kabelmann <tk78@gmx.de>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7//KStars DBUS functions
8
9#include "kstars.h"
10
11#include "colorscheme.h"
12#include "eyepiecefield.h"
13#include "imageexporter.h"
14#include "ksdssdownloader.h"
15#include "kstarsdata.h"
16#include "observinglist.h"
17#include "Options.h"
18#include "skymap.h"
19#include "skycomponents/constellationboundarylines.h"
20#include "skycomponents/skymapcomposite.h"
21#include "skyobjects/catalogobject.h"
22#include "catalogsdb.h"
23#include "skyobjects/ksplanetbase.h"
24#include "skyobjects/starobject.h"
25#include "tools/whatsinteresting/wiview.h"
26#include "dialogs/finddialog.h"
27#include "tools/nameresolver.h"
28
29#ifdef HAVE_CFITSIO
30#include "fitsviewer/fitsviewer.h"
31#ifdef HAVE_INDI
32#include "ekos/manager.h"
33#endif
34#endif
35
36#include <KActionCollection>
37
38#include <QPrintDialog>
39#include <QPrinter>
40#include <QElapsedTimer>
41
42#include "kstars_debug.h"
43
44void KStars::setRaDec(double ra, double dec)
45{
46 SkyPoint p(ra, dec);
47 map()->setClickedPoint(&p);
48 map()->slotCenter();
49}
50
51void KStars::setRaDecJ2000(double ra0, double dec0)
52{
53 SkyPoint p;
54 p.setRA0(ra0);
55 p.setDec0(dec0);
56 p.updateCoordsNow(data()->updateNum());
57 map()->setClickedPoint(&p);
58 map()->slotCenter();
59}
60
61void KStars::setAltAz(double alt, double az, bool altIsRefracted)
62{
63 SkyPoint p;
64 if (altIsRefracted)
65 {
66 alt = SkyPoint::unrefract(alt);
67 }
68 p.setAlt(alt);
69 p.setAz(az);
70 p.HorizontalToEquatorial(data()->lst(), data()->geo()->lat());
71 map()->setClickedPoint(&p);
72 map()->slotCenter();
73}
74
75void KStars::lookTowards(const QString &direction)
76{
77 QString dir = direction.toLower();
78 if (dir == i18n("zenith") || dir == "z")
79 {
80 actionCollection()->action("zenith")->trigger();
81 }
82 else if (dir == i18n("north") || dir == "n")
83 {
84 actionCollection()->action("north")->trigger();
85 }
86 else if (dir == i18n("east") || dir == "e")
87 {
88 actionCollection()->action("east")->trigger();
89 }
90 else if (dir == i18n("south") || dir == "s")
91 {
92 actionCollection()->action("south")->trigger();
93 }
94 else if (dir == i18n("west") || dir == "w")
95 {
96 actionCollection()->action("west")->trigger();
97 }
98 else if (dir == i18n("northeast") || dir == "ne")
99 {
100 map()->stopTracking();
101 map()->clickedPoint()->setAlt(15.0);
102 map()->clickedPoint()->setAz(45.0);
103 map()->clickedPoint()->HorizontalToEquatorial(data()->lst(), data()->geo()->lat());
104 map()->slotCenter();
105 }
106 else if (dir == i18n("southeast") || dir == "se")
107 {
108 map()->stopTracking();
109 map()->clickedPoint()->setAlt(15.0);
110 map()->clickedPoint()->setAz(135.0);
111 map()->clickedPoint()->HorizontalToEquatorial(data()->lst(), data()->geo()->lat());
112 map()->slotCenter();
113 }
114 else if (dir == i18n("southwest") || dir == "sw")
115 {
116 map()->stopTracking();
117 map()->clickedPoint()->setAlt(15.0);
118 map()->clickedPoint()->setAz(225.0);
119 map()->clickedPoint()->HorizontalToEquatorial(data()->lst(), data()->geo()->lat());
120 map()->slotCenter();
121 }
122 else if (dir == i18n("northwest") || dir == "nw")
123 {
124 map()->stopTracking();
125 map()->clickedPoint()->setAlt(15.0);
126 map()->clickedPoint()->setAz(315.0);
127 map()->clickedPoint()->HorizontalToEquatorial(data()->lst(), data()->geo()->lat());
128 map()->slotCenter();
129 }
130 else
131 {
132 SkyObject *target = data()->objectNamed(direction);
133 if (target != nullptr)
134 {
135 map()->setClickedObject(target);
136 map()->setClickedPoint(target);
137 map()->slotCenter();
138 }
139 }
140}
141
142void KStars::addLabel(const QString &name)
143{
144 SkyObject *target = data()->objectNamed(name);
145 if (target != nullptr)
146 {
147 data()->skyComposite()->addNameLabel(target);
148 map()->forceUpdate();
149 }
150}
151
153{
154 SkyObject *target = data()->objectNamed(name);
155 if (target != nullptr)
156 {
157 data()->skyComposite()->removeNameLabel(target);
158 map()->forceUpdate();
159 }
160}
161
162void KStars::addTrail(const QString &name)
163{
164 TrailObject *target = dynamic_cast<TrailObject *>(data()->objectNamed(name));
165 if (target)
166 {
167 target->addToTrail();
168 map()->forceUpdate();
169 }
170}
171
173{
174 TrailObject *target = dynamic_cast<TrailObject *>(data()->objectNamed(name));
175 if (target)
176 {
177 target->clearTrail();
178 map()->forceUpdate();
179 }
180}
181
182void KStars::zoom(double z)
183{
184 map()->setZoomFactor(z);
185}
186
188{
189 map()->slotZoomIn();
190}
191
193{
194 map()->slotZoomOut();
195}
196
198{
199 map()->slotZoomDefault();
200}
201
202void KStars::setLocalTime(int yr, int mth, int day, int hr, int min, int sec)
203{
204 data()->changeDateTime(data()->geo()->LTtoUT(KStarsDateTime(QDate(yr, mth, day), QTime(hr, min, sec))));
205}
206
211
212void KStars::waitFor(double sec)
213{
214 QElapsedTimer tm;
215 tm.start();
216 while (tm.elapsed() < int(1000. * sec))
217 {
218 qApp->processEvents();
219 }
220}
221
223{
224 data()->resumeKey = QKeySequence::fromString(k);
225 if (!data()->resumeKey.isEmpty())
226 {
227 //When the resumeKey is pressed, resumeKey is set to empty
228 while (!data()->resumeKey.isEmpty())
229 qApp->processEvents();
230 }
231 else
232 {
233 qDebug() << Q_FUNC_INFO << "Error [D-Bus waitForKey()]: Invalid key requested.";
234 }
235}
236
237void KStars::setTracking(bool track)
238{
239 if (track != Options::isTracking())
240 slotTrack();
241}
242
243void KStars::popupMessage(int /*x*/, int /*y*/, const QString & /*message*/)
244{
245 //Show a small popup window at (x,y) with a text message
246}
247
248void KStars::drawLine(int /*x1*/, int /*y1*/, int /*x2*/, int /*y2*/, int /*speed*/)
249{
250 //Draw a line on the skymap display
251}
252
254{
255 GeoLocation *currentLocation = data()->geo();
256
257 QJsonObject locationInfo =
258 {
259 {"name", currentLocation->name()},
260 {"province", currentLocation->province()},
261 {"country", currentLocation->country()},
262 {"longitude", currentLocation->lng()->Degrees()},
263 {"latitude", currentLocation->lat()->Degrees()},
264 {"tz0", currentLocation->TZ0()},
265 {"tz", currentLocation->TZ()}
266 };
267
268 return QJsonDocument(locationInfo).toJson(QJsonDocument::Compact);
269}
270
271bool KStars::setGeoLocation(const QString &city, const QString &province, const QString &country)
272{
273 //Set the geographic location
274 bool cityFound(false);
275
276 foreach (GeoLocation *loc, data()->geoList)
277 {
278 if (loc->translatedName() == city && (province.isEmpty() || loc->translatedProvince() == province) &&
279 loc->translatedCountry() == country)
280 {
281 cityFound = true;
282
283 data()->setLocation(*loc);
284
285 //configure time zone rule
286 KStarsDateTime ltime = loc->UTtoLT(data()->ut());
287 loc->tzrule()->reset_with_ltime(ltime, loc->TZ0(), data()->isTimeRunningForward());
289
290 //reset LST
291 data()->syncLST();
292
293 //make sure planets, etc. are updated immediately
295
296 // If the sky is in Horizontal mode and not tracking, reset focus such that
297 // Alt/Az remain constant.
298 if (!Options::isTracking() && Options::useAltAz())
299 {
300 map()->focus()->HorizontalToEquatorial(data()->lst(), data()->geo()->lat());
301 }
302
303 // recalculate new times and objects
305 updateTime();
306
307 //no need to keep looking, we're done.
308 break;
309 }
310 }
311
312 if (!cityFound)
313 {
314 if (province.isEmpty())
315 qDebug()
316 << QString("Error [D-Bus setGeoLocation]: city %1, %2 not found in database.").arg(city, country);
317 else
318 qDebug() << Q_FUNC_INFO << QString("Error [D-Bus setGeoLocation]: city %1, %2, %3 not found in database.")
319 .arg(city, province, country);
320 }
321
322 return cityFound;
323}
324
325bool KStars::setGPSLocation(double longitude, double latitude, double elevation, double tz0)
326{
327 GeoLocation *geo = data()->geo();
328 std::unique_ptr<GeoLocation> tempGeo;
329
330 QString newLocationName("GPS Location");
331
332 dms lng(longitude), lat(latitude);
333
334 GeoLocation *nearest = data()->nearestLocation(longitude, latitude);
335
336 if (nearest)
337 tempGeo.reset(new GeoLocation(lng, lat, newLocationName, "", "", nearest->TZ0(), nearest->tzrule(), elevation));
338 else
339 tempGeo.reset(new GeoLocation(lng, lat, newLocationName, "", "", tz0, new TimeZoneRule(), elevation));
340
341 geo = tempGeo.get();
342
343 qCInfo(KSTARS) << "Setting location from DBus. Longitude:" << longitude << "Latitude:" << latitude;
344
345 data()->setLocation(*geo);
346
347 return true;
348}
349
351{
352 //Load config file values into Options object
353 Options::self()->load();
354
355 applyConfig();
356
357 //Reset date, if one was stored
358 if (data()->StoredDate.isValid())
359 {
360 data()->changeDateTime(data()->geo()->LTtoUT(data()->StoredDate));
361 data()->StoredDate = KStarsDateTime(QDateTime()); //invalidate StoredDate
362 }
363
364 map()->forceUpdate();
365}
366
368{
369 Options::self()->save();
370
371 //Store current simulation time
372 data()->StoredDate = data()->lt();
373}
374
376{
377 //Some config items are not stored in the Options object while
378 //the program is running; catch these here and returntheir current value.
379 if (name == "FocusRA")
380 {
381 return QString::number(map()->focus()->ra().Hours(), 'f', 6);
382 }
383 if (name == "FocusDec")
384 {
385 return QString::number(map()->focus()->dec().Degrees(), 'f', 6);
386 }
387
388 KConfigSkeletonItem *it = Options::self()->findItem(name);
389 if (it)
390 return it->property().toString();
391 else
392 return QString();
393}
394
396{
397 QString output;
398 QXmlStreamWriter stream(&output);
399 SkyPoint* focus = map()->focus();
400 Q_ASSERT(!!focus);
401 stream.setAutoFormatting(true);
402 stream.writeStartDocument();
403 stream.writeStartElement("focus");
404 stream.writeTextElement("FOV_Degrees", QString::number(map()->fov()));
405 stream.writeTextElement("RA_JNow_Degrees", QString::number(focus->ra().Degrees()));
406 stream.writeTextElement("Dec_JNow_Degrees", QString::number(focus->dec().Degrees()));
407 stream.writeTextElement("RA_JNow_HMS", focus->ra().toHMSString());
408 stream.writeTextElement("Dec_JNow_DMS", focus->dec().toDMSString());
409 stream.writeTextElement("Altitude_Degrees", QString::number(focus->alt().Degrees()));
410 stream.writeTextElement("Azimuth_Degrees", QString::number(focus->az().Degrees()));
411 stream.writeTextElement("Altitude_DMS", focus->alt().toDMSString());
412 stream.writeTextElement("Azimuth_DMS", focus->az().toDMSString());
413 stream.writeTextElement("Focused_Object", map()->focusObject() ? map()->focusObject()->name() : QString());
414 stream.writeEndElement(); // focus
415 stream.writeEndDocument();
416 return output;
417}
418
419void KStars::changeViewOption(const QString &op, const QString &val)
420{
421 bool bOk(false), dOk(false);
422
423 //parse bool value
424 bool bVal(false);
425 if (val.toLower() == "true")
426 {
427 bOk = true;
428 bVal = true;
429 }
430 if (val.toLower() == "false")
431 {
432 bOk = true;
433 bVal = false;
434 }
435 if (val == "1")
436 {
437 bOk = true;
438 bVal = true;
439 }
440 if (val == "0")
441 {
442 bOk = true;
443 bVal = false;
444 }
445
446 //parse double value
447 double dVal = val.toDouble(&dOk);
448
449 //[GUI]
450 if (op == "ShowInfoBoxes" && bOk)
451 Options::setShowInfoBoxes(bVal);
452 if (op == "ShowTimeBox" && bOk)
453 Options::setShowTimeBox(bVal);
454 if (op == "ShowGeoBox" && bOk)
455 Options::setShowGeoBox(bVal);
456 if (op == "ShowFocusBox" && bOk)
457 Options::setShowFocusBox(bVal);
458 if (op == "ShadeTimeBox" && bOk)
459 Options::setShadeTimeBox(bVal);
460 if (op == "ShadeGeoBox" && bOk)
461 Options::setShadeGeoBox(bVal);
462 if (op == "ShadeFocusBox" && bOk)
463 Options::setShadeFocusBox(bVal);
464
465 //[View]
466 // FIXME: REGRESSION
467 // if ( op == "FOVName" ) Options::setFOVName( val );
468 // if ( op == "FOVSizeX" && dOk ) Options::setFOVSizeX( (float)dVal );
469 // if ( op == "FOVSizeY" && dOk ) Options::setFOVSizeY( (float)dVal );
470 // if ( op == "FOVShape" && nOk ) Options::setFOVShape( nVal );
471 // if ( op == "FOVColor" ) Options::setFOVColor( val );
472 if (op == "ShowStars" && bOk)
473 Options::setShowStars(bVal);
474 if (op == "ShowCLines" && bOk)
475 Options::setShowCLines(bVal);
476 if (op == "ShowCBounds" && bOk)
477 Options::setShowCBounds(bVal);
478 if (op == "ShowCNames" && bOk)
479 Options::setShowCNames(bVal);
480 if (op == "ShowMilkyWay" && bOk)
481 Options::setShowMilkyWay(bVal);
482 if (op == "AutoSelectGrid" && bOk)
483 Options::setAutoSelectGrid(bVal);
484 if (op == "ShowEquatorialGrid" && bOk)
485 Options::setShowEquatorialGrid(bVal);
486 if (op == "ShowHorizontalGrid" && bOk)
487 Options::setShowHorizontalGrid(bVal);
488 if (op == "ShowEquator" && bOk)
489 Options::setShowEquator(bVal);
490 if (op == "ShowEcliptic" && bOk)
491 Options::setShowEcliptic(bVal);
492 if (op == "ShowHorizon" && bOk)
493 Options::setShowHorizon(bVal);
494 if (op == "ShowGround" && bOk)
495 Options::setShowGround(bVal);
496 if (op == "ShowSun" && bOk)
497 Options::setShowSun(bVal);
498 if (op == "ShowMoon" && bOk)
499 Options::setShowMoon(bVal);
500 if (op == "ShowMercury" && bOk)
501 Options::setShowMercury(bVal);
502 if (op == "ShowVenus" && bOk)
503 Options::setShowVenus(bVal);
504 if (op == "ShowMars" && bOk)
505 Options::setShowMars(bVal);
506 if (op == "ShowJupiter" && bOk)
507 Options::setShowJupiter(bVal);
508 if (op == "ShowSaturn" && bOk)
509 Options::setShowSaturn(bVal);
510 if (op == "ShowUranus" && bOk)
511 Options::setShowUranus(bVal);
512 if (op == "ShowNeptune" && bOk)
513 Options::setShowNeptune(bVal);
514 //if ( op == "ShowPluto" && bOk ) Options::setShowPluto( bVal );
515 if (op == "ShowAsteroids" && bOk)
516 Options::setShowAsteroids(bVal);
517 if (op == "ShowComets" && bOk)
518 Options::setShowComets(bVal);
519 if (op == "ShowSolarSystem" && bOk)
520 Options::setShowSolarSystem(bVal);
521 if (op == "ShowDeepSky" && bOk)
522 Options::setShowDeepSky(bVal);
523 if (op == "ShowSupernovae" && bOk)
524 Options::setShowSupernovae(bVal);
525 if (op == "ShowStarNames" && bOk)
526 Options::setShowStarNames(bVal);
527 if (op == "ShowStarMagnitudes" && bOk)
528 Options::setShowStarMagnitudes(bVal);
529 if (op == "ShowAsteroidNames" && bOk)
530 Options::setShowAsteroidNames(bVal);
531 if (op == "ShowCometNames" && bOk)
532 Options::setShowCometNames(bVal);
533 if (op == "ShowPlanetNames" && bOk)
534 Options::setShowPlanetNames(bVal);
535 if (op == "ShowPlanetImages" && bOk)
536 Options::setShowPlanetImages(bVal);
537 if (op == "HideOnSlew" && bOk)
538 Options::setHideOnSlew(bVal);
539 if (op == "HideStars" && bOk)
540 Options::setHideStars(bVal);
541 if (op == "HidePlanets" && bOk)
542 Options::setHidePlanets(bVal);
543 if (op == "HideMilkyWay" && bOk)
544 Options::setHideMilkyWay(bVal);
545 if (op == "HideCNames" && bOk)
546 Options::setHideCNames(bVal);
547 if (op == "HideCLines" && bOk)
548 Options::setHideCLines(bVal);
549 if (op == "HideCBounds" && bOk)
550 Options::setHideCBounds(bVal);
551 if (op == "HideGrids" && bOk)
552 Options::setHideGrids(bVal);
553 if (op == "HideLabels" && bOk)
554 Options::setHideLabels(bVal);
555
556 if (op == "UseAltAz" && bOk)
557 Options::setUseAltAz(bVal);
558 if (op == "UseRefraction" && bOk)
559 Options::setUseRefraction(bVal);
560 if (op == "UseAutoLabel" && bOk)
561 Options::setUseAutoLabel(bVal);
562 if (op == "UseHoverLabel" && bOk)
563 Options::setUseHoverLabel(bVal);
564 if (op == "UseAutoTrail" && bOk)
565 Options::setUseAutoTrail(bVal);
566 if (op == "UseAnimatedSlewing" && bOk)
567 Options::setUseAnimatedSlewing(bVal);
568 if (op == "FadePlanetTrails" && bOk)
569 Options::setFadePlanetTrails(bVal);
570 if (op == "SlewTimeScale" && dOk)
571 Options::setSlewTimeScale(dVal);
572 if (op == "ZoomFactor" && dOk)
573 Options::setZoomFactor(dVal);
574 // if ( op == "MagLimitDrawStar" && dOk ) Options::setMagLimitDrawStar( dVal );
575 if (op == "MagLimitDrawDeepSky" && dOk)
576 Options::setMagLimitDrawDeepSky(dVal);
577 if (op == "StarDensity" && dOk)
578 Options::setStarDensity(dVal);
579 // if ( op == "MagLimitDrawStarZoomOut" && dOk ) Options::setMagLimitDrawStarZoomOut( dVal );
580 if (op == "MagLimitDrawDeepSkyZoomOut" && dOk)
581 Options::setMagLimitDrawDeepSkyZoomOut(dVal);
582 if (op == "StarLabelDensity" && dOk)
583 Options::setStarLabelDensity(dVal);
584 if (op == "MagLimitHideStar" && dOk)
585 Options::setMagLimitHideStar(dVal);
586 if (op == "MagLimitAsteroid" && dOk)
587 Options::setMagLimitAsteroid(dVal);
588 if (op == "AsteroidLabelDensity" && dOk)
589 Options::setAsteroidLabelDensity(dVal);
590 if (op == "MaxRadCometName" && dOk)
591 Options::setMaxRadCometName(dVal);
592
593 //these three are a "radio group"
594 if (op == "UseLatinConstellationNames" && bOk)
595 {
596 Options::setUseLatinConstellNames(true);
597 Options::setUseLocalConstellNames(false);
598 Options::setUseAbbrevConstellNames(false);
599 }
600 if (op == "UseLocalConstellationNames" && bOk)
601 {
602 Options::setUseLatinConstellNames(false);
603 Options::setUseLocalConstellNames(true);
604 Options::setUseAbbrevConstellNames(false);
605 }
606 if (op == "UseAbbrevConstellationNames" && bOk)
607 {
608 Options::setUseLatinConstellNames(false);
609 Options::setUseLocalConstellNames(false);
610 Options::setUseAbbrevConstellNames(true);
611 }
612
613 map()->forceUpdate();
614}
615
616void KStars::setColor(const QString &name, const QString &value)
617{
618 ColorScheme *cs = data()->colorScheme();
619 if (cs->hasColorNamed(name))
620 {
621 cs->setColor(name, value);
622 map()->forceUpdate();
623 }
624}
625
626QString KStars::colorScheme() const
627{
628 return data()->colorScheme()->fileName();
629}
630
632{
633 data()->colorScheme()->load(name);
634
635#if 0
636 if (ok)
637 {
638 //set the application colors for the Night Vision scheme
639 if (Options::darkAppColors())
640 {
641 //OriginalPalette = QApplication::palette();
642 QApplication::setPalette(DarkPalette);
643 if (KStars::Instance()->wiView())
644 KStars::Instance()->wiView()->setNightVisionOn(true);
645 //Note: This uses style sheets to set the dark colors, this is cross platform. Palettes have a different behavior on OS X and Windows as opposed to Linux.
646 //It might be a good idea to use stylesheets in the future instead of palettes but this will work for now for OS X.
647 //This is also in KStars.cpp. If you change it, change it in BOTH places.
648#ifdef Q_OS_MACOS
649 qDebug() << Q_FUNC_INFO << "setting dark stylesheet";
650 qApp->setStyleSheet(
651 "QWidget { background-color: black; color:red; "
652 "selection-background-color:rgb(30,30,30);selection-color:white}"
653 "QToolBar { border:none }"
654 "QTabBar::tab:selected { background-color:rgb(50,50,50) }"
655 "QTabBar::tab:!selected { background-color:rgb(30,30,30) }"
656 "QPushButton { background-color:rgb(50,50,50);border-width:1px; border-style:solid;border-color:black}"
657 "QPushButton::disabled { background-color:rgb(10,10,10);border-width:1px; "
658 "border-style:solid;border-color:black }"
659 "QToolButton:Checked { background-color:rgb(30,30,30); border:none }"
660 "QComboBox { background-color:rgb(30,30,30); }"
661 "QComboBox::disabled { background-color:rgb(10,10,10) }"
662 "QScrollBar::handle { background: rgb(30,30,30) }"
663 "QSpinBox { border-width: 1px; border-style:solid; border-color:rgb(30,30,30) }"
664 "QDoubleSpinBox { border-width:1px; border-style:solid; border-color:rgb(30,30,30) }"
665 "QLineEdit { border-width: 1px; border-style: solid; border-color:rgb(30,30,30) }"
666 "QCheckBox::indicator:unchecked { background-color:rgb(30,30,30);border-width:1px; "
667 "border-style:solid;border-color:black }"
668 "QCheckBox::indicator:checked { background-color:red;border-width:1px; "
669 "border-style:solid;border-color:black }"
670 "QRadioButton::indicator:unchecked { background-color:rgb(30,30,30) }"
671 "QRadioButton::indicator:checked { background-color:red }"
672 "QRoundProgressBar { alternate-background-color:black }"
673 "QDateTimeEdit {background-color:rgb(30,30,30); border-width: 1px; border-style:solid; "
674 "border-color:rgb(30,30,30) }"
675 "QHeaderView { color:red;background-color:black }"
676 "QHeaderView::Section { background-color:rgb(30,30,30) }"
677 "QTableCornerButton::section{ background-color:rgb(30,30,30) }"
678 "");
679 qDebug() << Q_FUNC_INFO << "stylesheet set";
680#endif
681 }
682 else
683 {
684 if (KStars::Instance()->wiView())
685 KStars::Instance()->wiView()->setNightVisionOn(false);
686 QApplication::setPalette(OriginalPalette);
687#ifdef Q_OS_MACOS
688 qDebug() << Q_FUNC_INFO << "setting light stylesheet";
689 qApp->setStyleSheet("");
690 qDebug() << Q_FUNC_INFO << "stylesheet set";
691#endif
692 }
693 }
694#endif
695
696 Options::setColorSchemeFile(name);
697
698 emit colorSchemeChanged();
699
700 map()->forceUpdate();
701}
702
703void KStars::exportImage(const QString &url, int w, int h, bool includeLegend)
704{
705 ImageExporter *m_ImageExporter = m_KStarsData->imageExporter();
706
707 if (w <= 0)
708 w = map()->width();
709 if (h <= 0)
710 h = map()->height();
711
712 QSize size(w, h);
713
714 m_ImageExporter->includeLegend(includeLegend);
715 m_ImageExporter->setRasterOutputSize(&size);
716 m_ImageExporter->exportImage(url);
717}
718
720{
721 SkyObject *target = data()->objectNamed(objectName);
722 if (!target)
723 {
724 return QString("ERROR");
725 }
726 else
727 {
728 return KSDssDownloader::getDSSURL(target);
729 }
730}
731
732QString KStars::getDSSURL(double RA_J2000, double Dec_J2000, float width, float height)
733{
734 dms ra(RA_J2000), dec(Dec_J2000);
735 return KSDssDownloader::getDSSURL(ra, dec, width, height);
736}
737
738QString KStars::getObjectDataXML(const QString &objectName, bool fallbackToInternet, bool storeInternetResolved)
739{
740 bool deleteTargetAfterUse = false;
741 const SkyObject *target = data()->objectNamed(objectName);
742 if (!target && fallbackToInternet)
743 {
744 if (!storeInternetResolved)
745 {
746 const auto &cedata = NameResolver::resolveName(objectName);
747 if (cedata.first)
748 {
749 target = cedata.second.clone(); // We have to free this since we own the pointer
750 deleteTargetAfterUse = true; // so note that down
751 }
752 }
753 else
754 {
755 CatalogsDB::DBManager db_manager { CatalogsDB::dso_db_path() };
756 target = FindDialog::resolveAndAdd(db_manager, objectName);
757 }
758
759 }
760 if (!target)
761 {
762 return QString("<xml></xml>");
763 }
764 QString output;
765 QXmlStreamWriter stream(&output);
766 stream.setAutoFormatting(true);
767 stream.writeStartDocument();
768 stream.writeStartElement("object");
769 stream.writeTextElement("Name", target->name());
770 stream.writeTextElement("Alt_Name", target->name2());
771 stream.writeTextElement("Long_Name", target->longname());
772 stream.writeTextElement("Constellation",
773 KStarsData::Instance()->skyComposite()->constellationBoundary()->constellationName(target));
774 stream.writeTextElement("RA_Dec_Epoch_JD", QString::number(target->getLastPrecessJD(), 'f', 3));
775 stream.writeTextElement("RA_HMS", target->ra().toHMSString());
776 stream.writeTextElement("Dec_DMS", target->dec().toDMSString());
777 stream.writeTextElement("RA_J2000_HMS", target->ra0().toHMSString());
778 stream.writeTextElement("Dec_J2000_DMS", target->dec0().toDMSString());
779 stream.writeTextElement("RA_Degrees", QString::number(target->ra().Degrees()));
780 stream.writeTextElement("Dec_Degrees", QString::number(target->dec().Degrees()));
781 stream.writeTextElement("RA_J2000_Degrees", QString::number(target->ra0().Degrees()));
782 stream.writeTextElement("Dec_J2000_Degrees", QString::number(target->dec0().Degrees()));
783 stream.writeTextElement("Type", target->typeName());
784 stream.writeTextElement("Magnitude", QString::number(target->mag(), 'g', 2));
785 stream.writeTextElement("Position_Angle", QString::number(target->pa(), 'g', 3));
786 auto *star = dynamic_cast<const StarObject *>(target);
787 auto *dso = dynamic_cast<const CatalogObject *>(target);
788 if (star)
789 {
790 stream.writeTextElement("Spectral_Type", star->sptype());
791 stream.writeTextElement("Genetive_Name", star->gname());
792 stream.writeTextElement("Greek_Letter", star->greekLetter());
793 stream.writeTextElement("Proper_Motion", QString::number(star->pmMagnitude()));
794 stream.writeTextElement("Proper_Motion_RA", QString::number(star->pmRA()));
795 stream.writeTextElement("Proper_Motion_Dec", QString::number(star->pmDec()));
796 stream.writeTextElement("Parallax_mas", QString::number(star->parallax()));
797 stream.writeTextElement("Distance_pc", QString::number(star->distance()));
798 stream.writeTextElement("Henry_Draper", QString::number(star->getHDIndex()));
799 stream.writeTextElement("BV_Index", QString::number(star->getBVIndex()));
800 }
801 else if (dso)
802 {
803 stream.writeTextElement("Catalog", dso->getCatalog().name);
804 stream.writeTextElement("Major_Axis", QString::number(dso->a()));
805 stream.writeTextElement("Minor_Axis", QString::number(dso->a() * dso->e()));
806 }
807 stream.writeEndElement(); // object
808 stream.writeEndDocument();
809
810 if (deleteTargetAfterUse)
811 {
812 Q_ASSERT(!!target);
813 delete target;
814 }
815
816 return output;
817}
818
820{
821 Q_ASSERT(data());
822 const SkyObject *obj = data()->objectNamed(objectName); // make sure we work with a clone
823 if (!obj)
824 {
825 return QString("<xml></xml>");
826 }
827 SkyObject *target = obj->clone();
828 if (!target) // should not happen
829 {
830 qWarning() << "ERROR: Could not clone SkyObject " << objectName << "!";
831 return QString("<xml></xml>");
832 }
833
834 const KSNumbers *updateNum = data()->updateNum();
835 const KStarsDateTime ut = data()->ut();
836 const GeoLocation *geo = data()->geo();
837 QString riseTimeString, setTimeString, transitTimeString;
838 QString riseAzString, setAzString, transitAltString;
839
840 // Make sure the coordinates of the SkyObject are updated
841 target->updateCoords(updateNum, true, geo->lat(), data()->lst(), true);
842 target->EquatorialToHorizontal(data()->lst(), geo->lat());
843
844 // Compute rise, set and transit times and parameters -- Code pulled from DetailDialog
845 QTime riseTime = target->riseSetTime(ut, geo, true); //true = use rise time
846 dms riseAz = target->riseSetTimeAz(ut, geo, true); //true = use rise time
847 QTime transitTime = target->transitTime(ut, geo);
848 dms transitAlt = target->transitAltitude(ut, geo);
849 if (transitTime < riseTime)
850 {
851 transitTime = target->transitTime(ut.addDays(1), geo);
852 transitAlt = target->transitAltitude(ut.addDays(1), geo);
853 }
854 //If set time is before rise time, use set time for tomorrow
855 QTime setTime = target->riseSetTime(ut, geo, false); //false = use set time
856 dms setAz = target->riseSetTimeAz(ut, geo, false); //false = use set time
857 if (setTime < riseTime)
858 {
859 setTime = target->riseSetTime(ut.addDays(1), geo, false); //false = use set time
860 setAz = target->riseSetTimeAz(ut.addDays(1), geo, false); //false = use set time
861 }
862 if (riseTime.isValid())
863 {
864 riseTimeString = QString::asprintf("%02d:%02d", riseTime.hour(), riseTime.minute());
865 setTimeString = QString::asprintf("%02d:%02d", setTime.hour(), setTime.minute());
866 riseAzString = riseAz.toDMSString(true, true);
867 setAzString = setAz.toDMSString(true, true);
868 }
869 else
870 {
871 if (target->alt().Degrees() > 0.0)
872 {
873 riseTimeString = setTimeString = QString("Circumpolar");
874 }
875 else
876 {
877 riseTimeString = setTimeString = QString("Never Rises");
878 }
879 riseAzString = setAzString = QString("N/A");
880 }
881
882 transitTimeString = QString::asprintf("%02d:%02d", transitTime.hour(), transitTime.minute());
883 transitAltString = transitAlt.toDMSString(true, true);
884
885 QString output;
886 QXmlStreamWriter stream(&output);
887 stream.setAutoFormatting(true);
888 stream.writeStartDocument();
889 stream.writeStartElement("object");
890 stream.writeTextElement("Name", target->name());
891 stream.writeTextElement("RA_Dec_Epoch_JD", QString::number(target->getLastPrecessJD(), 'f', 3));
892 stream.writeTextElement("AltAz_JD", QString::number(data()->ut().djd(), 'f', 3));
893 stream.writeTextElement("RA_HMS", target->ra().toHMSString(true));
894 stream.writeTextElement("Dec_DMS", target->dec().toDMSString(true, true));
895 stream.writeTextElement("RA_J2000_HMS", target->ra0().toHMSString(true));
896 stream.writeTextElement("Dec_J2000_DMS", target->dec0().toDMSString(true, true));
897 stream.writeTextElement("RA_Degrees", QString::number(target->ra().Degrees()));
898 stream.writeTextElement("Dec_Degrees", QString::number(target->dec().Degrees()));
899 stream.writeTextElement("RA_J2000_Degrees", QString::number(target->ra0().Degrees()));
900 stream.writeTextElement("Dec_J2000_Degrees", QString::number(target->dec0().Degrees()));
901 stream.writeTextElement("Altitude_DMS", target->alt().toDMSString(true, true));
902 stream.writeTextElement("Azimuth_DMS", target->az().toDMSString(true, true));
903 stream.writeTextElement("Altitude_Degrees", QString::number(target->alt().Degrees()));
904 stream.writeTextElement("Azimuth_Degrees", QString::number(target->az().Degrees()));
905 stream.writeTextElement("Rise", riseTimeString);
906 stream.writeTextElement("Rise_Az_DMS", riseAzString);
907 stream.writeTextElement("Set", setTimeString);
908 stream.writeTextElement("Set_Az_DMS", setAzString);
909 stream.writeTextElement("Transit", transitTimeString);
910 stream.writeTextElement("Transit_Alt_DMS", transitAltString);
911 stream.writeTextElement("Time_Zone_Offset", QString::asprintf("%02.2f", geo->TZ()));
912
913 stream.writeEndElement(); // object
914 stream.writeEndDocument();
915 return output;
916}
917
918void KStars::renderEyepieceView(const QString &objectName, const QString &destPathChart, const double fovWidth,
919 const double fovHeight, const double rotation, const double scale, const bool flip,
920 const bool invert, QString imagePath, const QString &destPathImage, const bool overlay,
921 const bool invertColors)
922{
923 const SkyObject *obj = data()->objectNamed(objectName);
924 if (!obj)
925 {
926 qCWarning(KSTARS) << "Object named " << objectName << " was not found!";
927 return;
928 }
929 SkyObject *target = obj->clone();
930 const KSNumbers *updateNum = data()->updateNum();
931 const KStarsDateTime ut = data()->ut();
932 const GeoLocation *geo = data()->geo();
933 QPixmap *renderChart = new QPixmap();
934 QPixmap *renderImage = nullptr;
935 QTemporaryFile tempFile;
936 if (overlay || (!destPathImage.isEmpty()))
937 {
938 if (!QFile::exists(imagePath))
939 {
940 // We must download a DSS image
941 tempFile.open();
942 QEventLoop loop;
943 std::function<void(bool)> slot = [&loop](bool unused)
944 {
945 Q_UNUSED(unused);
946 loop.quit();
947 };
948 new KSDssDownloader(target, tempFile.fileName(), slot, this);
949 qDebug() << Q_FUNC_INFO << "DSS download requested. Waiting for download to complete...";
950 loop.exec(); // wait for download to complete
951 imagePath = tempFile.fileName();
952 }
953 if (QFile::exists(imagePath)) // required because DSS Download may fail
954 renderImage = new QPixmap();
955 }
956
957 // Make sure the coordinates of the SkyObject are updated
958 target->updateCoords(updateNum, true, geo->lat(), data()->lst(), true);
959 target->EquatorialToHorizontal(data()->lst(), geo->lat());
960
961 EyepieceField::renderEyepieceView(target, renderChart, fovWidth, fovHeight, rotation, scale, flip, invert,
962 imagePath, renderImage, overlay, invertColors);
963 renderChart->save(destPathChart);
964 delete renderChart;
965 if (renderImage)
966 {
967 renderImage->save(destPathImage);
968 delete renderImage;
969 }
970}
972{
973 QString output;
974
975 for (auto &object : KStarsData::Instance()->observingList()->obsList())
976 {
977 output.append(object->name() + '\n');
978 }
979 return output;
980}
981
983{
984 QString output;
985
986 for (auto &object : KStarsData::Instance()->observingList()->sessionList())
987 {
988 output.append(object->name() + '\n');
989 }
990 return output;
991}
992
993void KStars::setApproxFOV(double FOV_Degrees)
994{
995 zoom(map()->width() / (FOV_Degrees * dms::DegToRad));
996}
997
1002void KStars::printImage(bool usePrintDialog, bool useChartColors)
1003{
1004 //QPRINTER_FOR_NOW
1005 // KPrinter printer( true, QPrinter::HighResolution );
1007 printer.setFullPage(false);
1008
1009 //Set up the printer (either with the Print Dialog,
1010 //or using the default settings)
1011 bool ok(false);
1012 if (usePrintDialog)
1013 {
1014 //QPRINTER_FOR_NOW
1015 // ok = printer.setup( this, i18n("Print Sky") );
1016 //QPrintDialog *dialog = KdePrint::createPrintDialog(&printer, this);
1017 QPrintDialog *dialog = new QPrintDialog(&printer, this);
1018 dialog->setWindowTitle(i18nc("@title:window", "Print Sky"));
1019 if (dialog->exec() == QDialog::Accepted)
1020 ok = true;
1021 delete dialog;
1022 }
1023 else
1024 {
1025 //QPRINTER_FOR_NOW
1026 // ok = printer.autoConfigure();
1027 ok = true;
1028 }
1029
1030 if (ok)
1031 {
1033
1034 //Save current ColorScheme file name and switch to Star Chart
1035 //scheme (if requested)
1036 QString schemeName = data()->colorScheme()->fileName();
1037 if (useChartColors)
1038 {
1039 loadColorScheme("chart.colors");
1040 }
1041
1042 map()->setupProjector();
1043 map()->exportSkyImage(&printer, true);
1044
1045 //Restore old color scheme if necessary
1046 //(if printing was aborted, the ColorScheme is still restored)
1047 if (useChartColors)
1048 {
1049 loadColorScheme(schemeName);
1050 map()->forceUpdate();
1051 }
1052
1054 }
1055}
1056
1057void KStars::openFITS(const QUrl &imageURL)
1058{
1059#ifndef HAVE_CFITSIO
1060 qWarning() << "KStars does not support loading FITS. Please recompile KStars with FITS support.";
1061#else
1062 QSharedPointer<FITSViewer> fv = createFITSViewer();
1063 fv->loadFile(imageURL);
1064#endif
1065}
A simple container object to hold the minimum information for a Deep Sky Object to be drawn on the sk...
Manages the catalog database and provides an interface to provide an interface to query and modify th...
Definition catalogsdb.h:183
This class stores all of the adjustable colors in KStars, in a QMap object keyed by the names of the ...
Definition colorscheme.h:27
QString fileName() const
Definition colorscheme.h:91
bool hasColorNamed(const QString &name) const
Definition colorscheme.h:36
bool load(const QString &filename)
Load a color scheme from a *.colors file filename the filename of the color scheme to be loaded.
void setColor(const QString &key, const QString &color)
Change the color with the given key to the given value key the key-name of the color to be changed co...
static CatalogObject * resolveAndAdd(CatalogsDB::DBManager &db_manager, const QString &query)
Resolves an object using the internet and adds it to the database.
Contains all relevant information for specifying a location on Earth: City Name, State/Province name,...
Definition geolocation.h:28
QString country() const
const CachingDms * lat() const
Definition geolocation.h:70
const CachingDms * lng() const
Definition geolocation.h:64
QString translatedCountry() const
double TZ0() const
QString province() const
double TZ() const
QString translatedName() const
QString translatedProvince() const
TimeZoneRule * tzrule()
QString name() const
Backends for exporting a sky image, either raster or vector, with a legend.
void includeLegend(bool include)
Include legend?
bool exportImage(QString url)
Exports an image with the defined settings.
void setRasterOutputSize(const QSize *size)
Set the size of output raster images.
Q_INVOKABLE QAction * action(const QString &name) const
virtual QVariant property() const=0
Helps download a DSS image.
static QString getDSSURL(const SkyPoint *const p, const QString &version="all", struct KSDssImage::Metadata *md=nullptr)
High-level method to create a URL to obtain a DSS image for a given SkyPoint.
There are several time-dependent values used in position calculations, that are not specific to an ob...
Definition ksnumbers.h:43
const KStarsDateTime & lt() const
Definition kstarsdata.h:153
void setNextDSTChange(const KStarsDateTime &dt)
Set the NextDSTChange member.
Definition kstarsdata.h:112
void setLocation(const GeoLocation &l)
Set the GeoLocation according to the argument.
void changeDateTime(const KStarsDateTime &newDate)
Change the current simulation date/time to the KStarsDateTime argument.
void setFullTimeUpdate()
The Sky is updated more frequently than the moon, which is updated more frequently than the planets.
SkyObject * objectNamed(const QString &name)
Find object by name.
GeoLocation * nearestLocation(double longitude, double latitude)
nearestLocation Return nearest location to the given longitude and latitude coordinates
ColorScheme * colorScheme()
Definition kstarsdata.h:174
void syncLST()
Sync the LST with the simulation clock.
const KStarsDateTime & ut() const
Definition kstarsdata.h:159
GeoLocation * geo()
Definition kstarsdata.h:232
SkyMapComposite * skyComposite()
Definition kstarsdata.h:168
void setSnapNextFocus(bool b=true)
Disable or re-enable the slewing animation for the next Focus change.
Definition kstarsdata.h:285
Extension of QDateTime for KStars KStarsDateTime can represent the date/time as a Julian Day,...
KStarsDateTime addDays(int nd) const
Modify the Date/Time by adding a number of days.
Q_SCRIPTABLE Q_NOREPLY void setRaDec(double ra, double dec)
DBUS interface function.
SkyMap * map() const
Definition kstars.h:139
Q_SCRIPTABLE QString getFocusInformationXML()
DBUS interface function.
void applyConfig(bool doApplyFocus=true)
Apply config options throughout the program.
Definition kstars.cpp:311
Q_SCRIPTABLE Q_NOREPLY void readConfig()
DBUS interface function.
static KStars * Instance()
Definition kstars.h:121
Q_SCRIPTABLE Q_NOREPLY void zoomOut()
DBUS interface function.
Q_SCRIPTABLE Q_NOREPLY void setColor(const QString &colorName, const QString &value)
DBUS interface function.
Q_SCRIPTABLE Q_NOREPLY void renderEyepieceView(const QString &objectName, const QString &destPathChart, const double fovWidth=-1.0, const double fovHeight=-1.0, const double rotation=0.0, const double scale=1.0, const bool flip=false, const bool invert=false, QString imagePath=QString(), const QString &destPathImage=QString(), const bool overlay=false, const bool invertColors=false)
DBUS interface function.
Q_SCRIPTABLE Q_NOREPLY void popupMessage(int x, int y, const QString &message)
DBUS interface function.
Q_SCRIPTABLE Q_NOREPLY void openFITS(const QUrl &imageUrl)
DBUS interface function.
Q_SCRIPTABLE Q_NOREPLY void setTimeToNow()
DBUS interface function.
Q_SCRIPTABLE QString location()
location Returns a JSON Object (as string) that contains the following information: name: String prov...
void slotTrack()
action slot: Toggle whether kstars is tracking current position
Q_SCRIPTABLE QString getObservingWishListObjectNames()
DBUS interface function.
Q_SCRIPTABLE Q_NOREPLY void setTracking(bool track)
DBUS interface function.
KStarsData * data() const
Definition kstars.h:133
Q_DECL_DEPRECATED Q_SCRIPTABLE QString getOption(const QString &name)
DBUS interface function.
Q_SCRIPTABLE QString getDSSURL(const QString &objectName)
DBUS interface function.
Q_SCRIPTABLE QString getObjectDataXML(const QString &objectName, bool fallbackToInternet=false, bool storeInternetResolved=true)
DBUS interface function.
void colorSchemeChanged()
DBUS interface notification.
Q_SCRIPTABLE Q_NOREPLY void setAltAz(double alt, double az, bool altIsRefracted=false)
DBUS interface function.
Q_SCRIPTABLE Q_NOREPLY void waitForKey(const QString &k)
DBUS interface function.
Q_SCRIPTABLE Q_NOREPLY void addLabel(const QString &name)
DBUS interface function.
Q_SCRIPTABLE Q_NOREPLY void drawLine(int x1, int y1, int x2, int y2, int speed)
DBUS interface function.
Q_SCRIPTABLE QString getObjectPositionInfo(const QString &objectName)
DBUS interface function.
Q_SCRIPTABLE Q_NOREPLY void writeConfig()
DBUS interface function.
Q_SCRIPTABLE QString getSkyMapDimensions()
DBUS interface function.
Q_SCRIPTABLE Q_NOREPLY void addTrail(const QString &name)
DBUS interface function.
Q_SCRIPTABLE Q_NOREPLY void changeViewOption(const QString &option, const QString &value)
DBUS interface function.
Q_SCRIPTABLE Q_NOREPLY void zoomIn()
DBUS interface function.
Q_SCRIPTABLE Q_NOREPLY void setApproxFOV(double FOV_Degrees)
DBUS interface function.
Q_SCRIPTABLE Q_NOREPLY void exportImage(const QString &filename, int width=-1, int height=-1, bool includeLegend=false)
DBUS interface function.
Q_SCRIPTABLE Q_NOREPLY void waitFor(double t)
DBUS interface function.
Q_SCRIPTABLE Q_NOREPLY void loadColorScheme(const QString &name)
DBUS interface function.
Q_SCRIPTABLE Q_NOREPLY void printImage(bool usePrintDialog, bool useChartColors)
DBUS interface function.
Q_SCRIPTABLE bool setGPSLocation(double longitude, double latitude, double elevation, double tz0)
DBUS interface function.
Q_SCRIPTABLE Q_NOREPLY void setRaDecJ2000(double ra0, double dec0)
DBUS interface function.
void updateTime(const bool automaticDSTchange=true)
Update time-dependent data and (possibly) repaint the sky map.
Definition kstars.cpp:592
Q_SCRIPTABLE Q_NOREPLY void removeLabel(const QString &name)
DBUS interface function.
Q_SCRIPTABLE Q_NOREPLY void setLocalTime(int yr, int mth, int day, int hr, int min, int sec)
DBUS interface function.
Q_SCRIPTABLE QString getObservingSessionPlanObjectNames()
DBUS interface function.
Q_SCRIPTABLE Q_NOREPLY void zoom(double z)
DBUS interface function.
Q_SCRIPTABLE bool setGeoLocation(const QString &city, const QString &province, const QString &country)
DBUS interface function.
Q_SCRIPTABLE Q_NOREPLY void lookTowards(const QString &direction)
DBUS interface function.
void slotSetTimeToNow()
action slot: sync kstars clock to system time
Q_SCRIPTABLE Q_NOREPLY void removeTrail(const QString &name)
DBUS interface function.
Q_SCRIPTABLE Q_NOREPLY void defaultZoom()
DBUS interface function.
virtual KActionCollection * actionCollection() const
void setZoomFactor(double factor)
@ Set zoom factor.
Definition skymap.cpp:1176
SkyPoint * focus()
Retrieve the Focus point; the position on the sky at the center of the skymap.
Definition skymap.h:123
void setupProjector()
Call to set up the projector before a draw cycle.
Definition skymap.cpp:1255
void exportSkyImage(QPaintDevice *pd, bool scale=false)
Proxy method for SkyMapDrawAbstract::exportSkyImage()
Definition skymap.h:309
void setClickedPoint(const SkyPoint *f)
Set the ClickedPoint to the skypoint given as an argument.
Definition skymap.cpp:1021
void slotZoomOut()
Zoom out one step.
Definition skymap.cpp:1166
void setClickedObject(SkyObject *o)
Set the ClickedObject pointer to the argument.
Definition skymap.cpp:366
void forceUpdate(bool now=false)
Recalculates the positions of objects in the sky, and then repaints the sky map.
Definition skymap.cpp:1186
void slotZoomDefault()
Set default zoom.
Definition skymap.cpp:1171
SkyPoint * clickedPoint()
Retrieve the ClickedPoint position.
Definition skymap.h:217
void slotZoomIn()
Zoom in one step.
Definition skymap.cpp:1161
void slotCenter()
Center the display at the point ClickedPoint.
Definition skymap.cpp:380
Provides all necessary information about an object in the sky: its coordinates, name(s),...
Definition skyobject.h:42
virtual SkyObject * clone() const
Create copy of object.
Definition skyobject.cpp:50
dms riseSetTimeAz(const KStarsDateTime &dt, const GeoLocation *geo, bool rst) const
virtual double pa() const
Definition skyobject.h:213
virtual QString name(void) const
Definition skyobject.h:146
dms transitAltitude(const KStarsDateTime &dt, const GeoLocation *geo) const
virtual QString longname(void) const
Definition skyobject.h:165
QString name2(void) const
Definition skyobject.h:157
QTime transitTime(const KStarsDateTime &dt, const GeoLocation *geo) const
The same iteration technique described in riseSetTime() is used here.
QTime riseSetTime(const KStarsDateTime &dt, const GeoLocation *geo, bool rst, bool exact=true) const
Determine the time at which the point will rise or set.
Definition skyobject.cpp:93
static QString typeName(const int t)
float mag() const
Definition skyobject.h:207
The sky coordinates of a point in the sky.
Definition skypoint.h:45
const CachingDms & dec() const
Definition skypoint.h:269
const CachingDms & ra0() const
Definition skypoint.h:251
virtual void updateCoordsNow(const KSNumbers *num)
updateCoordsNow Shortcut for updateCoords( const KSNumbers *num, false, nullptr, nullptr,...
Definition skypoint.h:391
const CachingDms & ra() const
Definition skypoint.h:263
long double getLastPrecessJD() const
Definition skypoint.h:294
void EquatorialToHorizontal(const CachingDms *LST, const CachingDms *lat)
Determine the (Altitude, Azimuth) coordinates of the SkyPoint from its (RA, Dec) coordinates,...
Definition skypoint.cpp:77
void setRA0(dms r)
Sets RA0, the catalog Right Ascension.
Definition skypoint.h:94
static double unrefract(const double alt, bool conditional=true)
Remove refraction correction, depending on conditional.
const dms & az() const
Definition skypoint.h:275
virtual void updateCoords(const KSNumbers *num, bool includePlanets=true, const CachingDms *lat=nullptr, const CachingDms *LST=nullptr, bool forceRecompute=false)
Determine the current coordinates (RA, Dec) from the catalog coordinates (RA0, Dec0),...
Definition skypoint.cpp:582
void setAlt(dms alt)
Sets Alt, the Altitude.
Definition skypoint.h:194
const dms & alt() const
Definition skypoint.h:281
void HorizontalToEquatorial(const dms *LST, const dms *lat)
Determine the (RA, Dec) coordinates of the SkyPoint from its (Altitude, Azimuth) coordinates,...
Definition skypoint.cpp:143
void setAz(dms az)
Sets Az, the Azimuth.
Definition skypoint.h:230
const CachingDms & dec0() const
Definition skypoint.h:257
void setDec0(dms d)
Sets Dec0, the catalog Declination.
Definition skypoint.h:119
This is a subclass of SkyObject.
Definition starobject.h:33
This class provides the information needed to determine whether Daylight Savings Time (DST; a....
KStarsDateTime nextDSTChange() const
void reset_with_ltime(KStarsDateTime &ltime, const double TZoffset, const bool time_runs_forward, const bool automaticDSTchange=false)
Recalculate next dst change and if DST is active by a given local time with timezone offset and time ...
provides a SkyObject with an attachable Trail
Definition trailobject.h:22
void clearTrail()
clear the Trail
void addToTrail(const QString &label=QString())
adds a point to the planet's trail
An angle, stored as degrees, but expressible in many ways.
Definition dms.h:38
const QString toDMSString(const bool forceSign=false, const bool machineReadable=false, const bool highPrecision=false) const
Definition dms.cpp:287
const QString toHMSString(const bool machineReadable=false, const bool highPrecision=false) const
Definition dms.cpp:378
const double & Degrees() const
Definition dms.h:141
static constexpr double DegToRad
DegToRad is a const static member equal to the number of radians in one degree (dms::PI/180....
Definition dms.h:390
QString i18nc(const char *context, const char *text, const TYPE &arg...)
QString i18n(const char *text, const TYPE &arg...)
std::pair< bool, CatalogObject > resolveName(const QString &name)
Resolve the name of the given DSO and extract data from various sources.
void trigger()
void setPalette(const QPalette &palette, const char *className)
qint64 elapsed() const const
int exec(ProcessEventsFlags flags)
void quit()
bool exists() const const
void restoreOverrideCursor()
void setOverrideCursor(const QCursor &cursor)
QByteArray toJson(JsonFormat format) const const
QKeySequence fromString(const QString &str, SequenceFormat format)
bool save(QIODevice *device, const char *format, int quality) const const
virtual int exec() override
void setFullPage(bool fp)
QString & append(QChar ch)
QString arg(Args &&... args) const const
QString asprintf(const char *cformat,...)
bool isEmpty() const const
QString number(double n, char format, int precision)
double toDouble(bool *ok) const const
QString toLower() const const
WaitCursor
virtual QString fileName() const const override
int hour() const const
bool isValid(int h, int m, int s, int ms)
int minute() const const
QString toString() const const
void setWindowTitle(const QString &)
void setAutoFormatting(bool enable)
void writeEndDocument()
void writeEndElement()
void writeStartDocument()
void writeStartElement(QAnyStringView namespaceUri, QAnyStringView name)
void writeTextElement(QAnyStringView namespaceUri, QAnyStringView name, QAnyStringView text)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 27 2024 11:51:46 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.