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 QDBusVariant(QString::number(map()->focus()->ra().Hours(), 'f', 6));
382 }
383 if (name == "FocusDec")
384 {
385 return QDBusVariant(QString::number(map()->focus()->dec().Degrees(), 'f', 6));
386 }
387
388 auto propertyName = name;
389 // Ensure first letter is always small-case so that Options can return the correct info
390 propertyName[0] = propertyName.at(0).toLower();
391
392 return QDBusVariant(Options::self()->property(propertyName.toLatin1().constData()));
393}
394
395void KStars::setOption(const QString &name, const QDBusVariant &value)
396{
397 auto propertyName = name;
398 // Ensure first letter is always small-case so that Options can set the correct info
399 propertyName[0] = propertyName.at(0).toLower();
400 Options::self()->setProperty(propertyName.toLatin1().constData(), value.variant());
401}
402
404{
405 QString output;
406 QXmlStreamWriter stream(&output);
407 SkyPoint* focus = map()->focus();
408 Q_ASSERT(!!focus);
409 stream.setAutoFormatting(true);
410 stream.writeStartDocument();
411 stream.writeStartElement("focus");
412 stream.writeTextElement("FOV_Degrees", QString::number(map()->fov()));
413 stream.writeTextElement("RA_JNow_Degrees", QString::number(focus->ra().Degrees()));
414 stream.writeTextElement("Dec_JNow_Degrees", QString::number(focus->dec().Degrees()));
415 stream.writeTextElement("RA_JNow_HMS", focus->ra().toHMSString());
416 stream.writeTextElement("Dec_JNow_DMS", focus->dec().toDMSString());
417 stream.writeTextElement("Altitude_Degrees", QString::number(focus->alt().Degrees()));
418 stream.writeTextElement("Azimuth_Degrees", QString::number(focus->az().Degrees()));
419 stream.writeTextElement("Altitude_DMS", focus->alt().toDMSString());
420 stream.writeTextElement("Azimuth_DMS", focus->az().toDMSString());
421 stream.writeTextElement("Focused_Object", map()->focusObject() ? map()->focusObject()->name() : QString());
422 stream.writeEndElement(); // focus
423 stream.writeEndDocument();
424 return output;
425}
426
427void KStars::changeViewOption(const QString &op, const QString &val)
428{
429 bool bOk(false), dOk(false);
430
431 //parse bool value
432 bool bVal(false);
433 if (val.toLower() == "true")
434 {
435 bOk = true;
436 bVal = true;
437 }
438 if (val.toLower() == "false")
439 {
440 bOk = true;
441 bVal = false;
442 }
443 if (val == "1")
444 {
445 bOk = true;
446 bVal = true;
447 }
448 if (val == "0")
449 {
450 bOk = true;
451 bVal = false;
452 }
453
454 //parse double value
455 double dVal = val.toDouble(&dOk);
456
457 //[GUI]
458 if (op == "ShowInfoBoxes" && bOk)
459 Options::setShowInfoBoxes(bVal);
460 if (op == "ShowTimeBox" && bOk)
461 Options::setShowTimeBox(bVal);
462 if (op == "ShowGeoBox" && bOk)
463 Options::setShowGeoBox(bVal);
464 if (op == "ShowFocusBox" && bOk)
465 Options::setShowFocusBox(bVal);
466 if (op == "ShadeTimeBox" && bOk)
467 Options::setShadeTimeBox(bVal);
468 if (op == "ShadeGeoBox" && bOk)
469 Options::setShadeGeoBox(bVal);
470 if (op == "ShadeFocusBox" && bOk)
471 Options::setShadeFocusBox(bVal);
472
473 //[View]
474 // FIXME: REGRESSION
475 // if ( op == "FOVName" ) Options::setFOVName( val );
476 // if ( op == "FOVSizeX" && dOk ) Options::setFOVSizeX( (float)dVal );
477 // if ( op == "FOVSizeY" && dOk ) Options::setFOVSizeY( (float)dVal );
478 // if ( op == "FOVShape" && nOk ) Options::setFOVShape( nVal );
479 // if ( op == "FOVColor" ) Options::setFOVColor( val );
480 if (op == "ShowStars" && bOk)
481 Options::setShowStars(bVal);
482 if (op == "ShowCLines" && bOk)
483 Options::setShowCLines(bVal);
484 if (op == "ShowCBounds" && bOk)
485 Options::setShowCBounds(bVal);
486 if (op == "ShowCNames" && bOk)
487 Options::setShowCNames(bVal);
488 if (op == "ShowMilkyWay" && bOk)
489 Options::setShowMilkyWay(bVal);
490 if (op == "AutoSelectGrid" && bOk)
491 Options::setAutoSelectGrid(bVal);
492 if (op == "ShowEquatorialGrid" && bOk)
493 Options::setShowEquatorialGrid(bVal);
494 if (op == "ShowHorizontalGrid" && bOk)
495 Options::setShowHorizontalGrid(bVal);
496 if (op == "ShowEquator" && bOk)
497 Options::setShowEquator(bVal);
498 if (op == "ShowEcliptic" && bOk)
499 Options::setShowEcliptic(bVal);
500 if (op == "ShowHorizon" && bOk)
501 Options::setShowHorizon(bVal);
502 if (op == "ShowGround" && bOk)
503 Options::setShowGround(bVal);
504 if (op == "ShowSun" && bOk)
505 Options::setShowSun(bVal);
506 if (op == "ShowMoon" && bOk)
507 Options::setShowMoon(bVal);
508 if (op == "ShowMercury" && bOk)
509 Options::setShowMercury(bVal);
510 if (op == "ShowVenus" && bOk)
511 Options::setShowVenus(bVal);
512 if (op == "ShowMars" && bOk)
513 Options::setShowMars(bVal);
514 if (op == "ShowJupiter" && bOk)
515 Options::setShowJupiter(bVal);
516 if (op == "ShowSaturn" && bOk)
517 Options::setShowSaturn(bVal);
518 if (op == "ShowUranus" && bOk)
519 Options::setShowUranus(bVal);
520 if (op == "ShowNeptune" && bOk)
521 Options::setShowNeptune(bVal);
522 //if ( op == "ShowPluto" && bOk ) Options::setShowPluto( bVal );
523 if (op == "ShowAsteroids" && bOk)
524 Options::setShowAsteroids(bVal);
525 if (op == "ShowComets" && bOk)
526 Options::setShowComets(bVal);
527 if (op == "ShowSolarSystem" && bOk)
528 Options::setShowSolarSystem(bVal);
529 if (op == "ShowDeepSky" && bOk)
530 Options::setShowDeepSky(bVal);
531 if (op == "ShowSupernovae" && bOk)
532 Options::setShowSupernovae(bVal);
533 if (op == "ShowStarNames" && bOk)
534 Options::setShowStarNames(bVal);
535 if (op == "ShowStarMagnitudes" && bOk)
536 Options::setShowStarMagnitudes(bVal);
537 if (op == "ShowAsteroidNames" && bOk)
538 Options::setShowAsteroidNames(bVal);
539 if (op == "ShowCometNames" && bOk)
540 Options::setShowCometNames(bVal);
541 if (op == "ShowPlanetNames" && bOk)
542 Options::setShowPlanetNames(bVal);
543 if (op == "ShowPlanetImages" && bOk)
544 Options::setShowPlanetImages(bVal);
545 if (op == "HideOnSlew" && bOk)
546 Options::setHideOnSlew(bVal);
547 if (op == "HideStars" && bOk)
548 Options::setHideStars(bVal);
549 if (op == "HidePlanets" && bOk)
550 Options::setHidePlanets(bVal);
551 if (op == "HideMilkyWay" && bOk)
552 Options::setHideMilkyWay(bVal);
553 if (op == "HideCNames" && bOk)
554 Options::setHideCNames(bVal);
555 if (op == "HideCLines" && bOk)
556 Options::setHideCLines(bVal);
557 if (op == "HideCBounds" && bOk)
558 Options::setHideCBounds(bVal);
559 if (op == "HideGrids" && bOk)
560 Options::setHideGrids(bVal);
561 if (op == "HideLabels" && bOk)
562 Options::setHideLabels(bVal);
563
564 if (op == "UseAltAz" && bOk)
565 Options::setUseAltAz(bVal);
566 if (op == "UseRefraction" && bOk)
567 Options::setUseRefraction(bVal);
568 if (op == "UseAutoLabel" && bOk)
569 Options::setUseAutoLabel(bVal);
570 if (op == "UseHoverLabel" && bOk)
571 Options::setUseHoverLabel(bVal);
572 if (op == "UseAutoTrail" && bOk)
573 Options::setUseAutoTrail(bVal);
574 if (op == "UseAnimatedSlewing" && bOk)
575 Options::setUseAnimatedSlewing(bVal);
576 if (op == "FadePlanetTrails" && bOk)
577 Options::setFadePlanetTrails(bVal);
578 if (op == "SlewTimeScale" && dOk)
579 Options::setSlewTimeScale(dVal);
580 if (op == "ZoomFactor" && dOk)
581 Options::setZoomFactor(dVal);
582 // if ( op == "MagLimitDrawStar" && dOk ) Options::setMagLimitDrawStar( dVal );
583 if (op == "MagLimitDrawDeepSky" && dOk)
584 Options::setMagLimitDrawDeepSky(dVal);
585 if (op == "StarDensity" && dOk)
586 Options::setStarDensity(dVal);
587 // if ( op == "MagLimitDrawStarZoomOut" && dOk ) Options::setMagLimitDrawStarZoomOut( dVal );
588 if (op == "MagLimitDrawDeepSkyZoomOut" && dOk)
589 Options::setMagLimitDrawDeepSkyZoomOut(dVal);
590 if (op == "StarLabelDensity" && dOk)
591 Options::setStarLabelDensity(dVal);
592 if (op == "MagLimitHideStar" && dOk)
593 Options::setMagLimitHideStar(dVal);
594 if (op == "MagLimitAsteroid" && dOk)
595 Options::setMagLimitAsteroid(dVal);
596 if (op == "AsteroidLabelDensity" && dOk)
597 Options::setAsteroidLabelDensity(dVal);
598 if (op == "MaxRadCometName" && dOk)
599 Options::setMaxRadCometName(dVal);
600
601 //these three are a "radio group"
602 if (op == "UseLatinConstellationNames" && bOk)
603 {
604 Options::setUseLatinConstellNames(true);
605 Options::setUseLocalConstellNames(false);
606 Options::setUseAbbrevConstellNames(false);
607 }
608 if (op == "UseLocalConstellationNames" && bOk)
609 {
610 Options::setUseLatinConstellNames(false);
611 Options::setUseLocalConstellNames(true);
612 Options::setUseAbbrevConstellNames(false);
613 }
614 if (op == "UseAbbrevConstellationNames" && bOk)
615 {
616 Options::setUseLatinConstellNames(false);
617 Options::setUseLocalConstellNames(false);
618 Options::setUseAbbrevConstellNames(true);
619 }
620
621 map()->forceUpdate();
622}
623
624void KStars::setColor(const QString &name, const QString &value)
625{
626 ColorScheme *cs = data()->colorScheme();
627 if (cs->hasColorNamed(name))
628 {
629 cs->setColor(name, value);
630 map()->forceUpdate();
631 }
632}
633
634QString KStars::colorScheme() const
635{
636 return data()->colorScheme()->fileName();
637}
638
640{
641 data()->colorScheme()->load(name);
642
643#if 0
644 if (ok)
645 {
646 //set the application colors for the Night Vision scheme
647 if (Options::darkAppColors())
648 {
649 //OriginalPalette = QApplication::palette();
650 QApplication::setPalette(DarkPalette);
651 if (KStars::Instance()->wiView())
652 KStars::Instance()->wiView()->setNightVisionOn(true);
653 //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.
654 //It might be a good idea to use stylesheets in the future instead of palettes but this will work for now for OS X.
655 //This is also in KStars.cpp. If you change it, change it in BOTH places.
656#ifdef Q_OS_MACOS
657 qDebug() << Q_FUNC_INFO << "setting dark stylesheet";
658 qApp->setStyleSheet(
659 "QWidget { background-color: black; color:red; "
660 "selection-background-color:rgb(30,30,30);selection-color:white}"
661 "QToolBar { border:none }"
662 "QTabBar::tab:selected { background-color:rgb(50,50,50) }"
663 "QTabBar::tab:!selected { background-color:rgb(30,30,30) }"
664 "QPushButton { background-color:rgb(50,50,50);border-width:1px; border-style:solid;border-color:black}"
665 "QPushButton::disabled { background-color:rgb(10,10,10);border-width:1px; "
666 "border-style:solid;border-color:black }"
667 "QToolButton:Checked { background-color:rgb(30,30,30); border:none }"
668 "QComboBox { background-color:rgb(30,30,30); }"
669 "QComboBox::disabled { background-color:rgb(10,10,10) }"
670 "QScrollBar::handle { background: rgb(30,30,30) }"
671 "QSpinBox { border-width: 1px; border-style:solid; border-color:rgb(30,30,30) }"
672 "QDoubleSpinBox { border-width:1px; border-style:solid; border-color:rgb(30,30,30) }"
673 "QLineEdit { border-width: 1px; border-style: solid; border-color:rgb(30,30,30) }"
674 "QCheckBox::indicator:unchecked { background-color:rgb(30,30,30);border-width:1px; "
675 "border-style:solid;border-color:black }"
676 "QCheckBox::indicator:checked { background-color:red;border-width:1px; "
677 "border-style:solid;border-color:black }"
678 "QRadioButton::indicator:unchecked { background-color:rgb(30,30,30) }"
679 "QRadioButton::indicator:checked { background-color:red }"
680 "QRoundProgressBar { alternate-background-color:black }"
681 "QDateTimeEdit {background-color:rgb(30,30,30); border-width: 1px; border-style:solid; "
682 "border-color:rgb(30,30,30) }"
683 "QHeaderView { color:red;background-color:black }"
684 "QHeaderView::Section { background-color:rgb(30,30,30) }"
685 "QTableCornerButton::section{ background-color:rgb(30,30,30) }"
686 "");
687 qDebug() << Q_FUNC_INFO << "stylesheet set";
688#endif
689 }
690 else
691 {
692 if (KStars::Instance()->wiView())
693 KStars::Instance()->wiView()->setNightVisionOn(false);
694 QApplication::setPalette(OriginalPalette);
695#ifdef Q_OS_MACOS
696 qDebug() << Q_FUNC_INFO << "setting light stylesheet";
697 qApp->setStyleSheet("");
698 qDebug() << Q_FUNC_INFO << "stylesheet set";
699#endif
700 }
701 }
702#endif
703
704 Options::setColorSchemeFile(name);
705
706 emit colorSchemeChanged();
707
708 map()->forceUpdate();
709}
710
711void KStars::exportImage(const QString &url, int w, int h, bool includeLegend)
712{
713 ImageExporter *m_ImageExporter = m_KStarsData->imageExporter();
714
715 if (w <= 0)
716 w = map()->width();
717 if (h <= 0)
718 h = map()->height();
719
720 QSize size(w, h);
721
722 m_ImageExporter->includeLegend(includeLegend);
723 m_ImageExporter->setRasterOutputSize(&size);
724 m_ImageExporter->exportImage(url);
725}
726
728{
729 SkyObject *target = data()->objectNamed(objectName);
730 if (!target)
731 {
732 return QString("ERROR");
733 }
734 else
735 {
736 return KSDssDownloader::getDSSURL(target);
737 }
738}
739
740QString KStars::getDSSURL(double RA_J2000, double Dec_J2000, float width, float height)
741{
742 dms ra(RA_J2000), dec(Dec_J2000);
743 return KSDssDownloader::getDSSURL(ra, dec, width, height);
744}
745
746QString KStars::getObjectDataXML(const QString &objectName, bool fallbackToInternet, bool storeInternetResolved)
747{
748 bool deleteTargetAfterUse = false;
749 const SkyObject *target = data()->objectNamed(objectName);
750 if (!target && fallbackToInternet)
751 {
752 if (!storeInternetResolved)
753 {
754 const auto &cedata = NameResolver::resolveName(objectName);
755 if (cedata.first)
756 {
757 target = cedata.second.clone(); // We have to free this since we own the pointer
758 deleteTargetAfterUse = true; // so note that down
759 }
760 }
761 else
762 {
763 CatalogsDB::DBManager db_manager { CatalogsDB::dso_db_path() };
764 target = FindDialog::resolveAndAdd(db_manager, objectName);
765 }
766
767 }
768 if (!target)
769 {
770 return QString("<xml></xml>");
771 }
772 QString output;
773 QXmlStreamWriter stream(&output);
774 stream.setAutoFormatting(true);
775 stream.writeStartDocument();
776 stream.writeStartElement("object");
777 stream.writeTextElement("Name", target->name());
778 stream.writeTextElement("Alt_Name", target->name2());
779 stream.writeTextElement("Long_Name", target->longname());
780 stream.writeTextElement("Constellation",
781 KStarsData::Instance()->skyComposite()->constellationBoundary()->constellationName(target));
782 stream.writeTextElement("RA_Dec_Epoch_JD", QString::number(target->getLastPrecessJD(), 'f', 3));
783 stream.writeTextElement("RA_HMS", target->ra().toHMSString());
784 stream.writeTextElement("Dec_DMS", target->dec().toDMSString());
785 stream.writeTextElement("RA_J2000_HMS", target->ra0().toHMSString());
786 stream.writeTextElement("Dec_J2000_DMS", target->dec0().toDMSString());
787 stream.writeTextElement("RA_Degrees", QString::number(target->ra().Degrees()));
788 stream.writeTextElement("Dec_Degrees", QString::number(target->dec().Degrees()));
789 stream.writeTextElement("RA_J2000_Degrees", QString::number(target->ra0().Degrees()));
790 stream.writeTextElement("Dec_J2000_Degrees", QString::number(target->dec0().Degrees()));
791 stream.writeTextElement("Type", target->typeName());
792 stream.writeTextElement("Magnitude", QString::number(target->mag(), 'g', 2));
793 stream.writeTextElement("Position_Angle", QString::number(target->pa(), 'g', 3));
794 auto *star = dynamic_cast<const StarObject *>(target);
795 auto *dso = dynamic_cast<const CatalogObject *>(target);
796 if (star)
797 {
798 stream.writeTextElement("Spectral_Type", star->sptype());
799 stream.writeTextElement("Genetive_Name", star->gname());
800 stream.writeTextElement("Greek_Letter", star->greekLetter());
801 stream.writeTextElement("Proper_Motion", QString::number(star->pmMagnitude()));
802 stream.writeTextElement("Proper_Motion_RA", QString::number(star->pmRA()));
803 stream.writeTextElement("Proper_Motion_Dec", QString::number(star->pmDec()));
804 stream.writeTextElement("Parallax_mas", QString::number(star->parallax()));
805 stream.writeTextElement("Distance_pc", QString::number(star->distance()));
806 stream.writeTextElement("Henry_Draper", QString::number(star->getHDIndex()));
807 stream.writeTextElement("BV_Index", QString::number(star->getBVIndex()));
808 }
809 else if (dso)
810 {
811 stream.writeTextElement("Catalog", dso->getCatalog().name);
812 stream.writeTextElement("Major_Axis", QString::number(dso->a()));
813 stream.writeTextElement("Minor_Axis", QString::number(dso->a() * dso->e()));
814 }
815 stream.writeEndElement(); // object
816 stream.writeEndDocument();
817
818 if (deleteTargetAfterUse)
819 {
820 Q_ASSERT(!!target);
821 delete target;
822 }
823
824 return output;
825}
826
828{
829 Q_ASSERT(data());
830 const SkyObject *obj = data()->objectNamed(objectName); // make sure we work with a clone
831 if (!obj)
832 {
833 return QString("<xml></xml>");
834 }
835 SkyObject *target = obj->clone();
836 if (!target) // should not happen
837 {
838 qWarning() << "ERROR: Could not clone SkyObject " << objectName << "!";
839 return QString("<xml></xml>");
840 }
841
842 const KSNumbers *updateNum = data()->updateNum();
843 const KStarsDateTime ut = data()->ut();
844 const GeoLocation *geo = data()->geo();
845 QString riseTimeString, setTimeString, transitTimeString;
846 QString riseAzString, setAzString, transitAltString;
847
848 // Make sure the coordinates of the SkyObject are updated
849 target->updateCoords(updateNum, true, geo->lat(), data()->lst(), true);
850 target->EquatorialToHorizontal(data()->lst(), geo->lat());
851
852 // Compute rise, set and transit times and parameters -- Code pulled from DetailDialog
853 QTime riseTime = target->riseSetTime(ut, geo, true); //true = use rise time
854 dms riseAz = target->riseSetTimeAz(ut, geo, true); //true = use rise time
855 QTime transitTime = target->transitTime(ut, geo);
856 dms transitAlt = target->transitAltitude(ut, geo);
857 if (transitTime < riseTime)
858 {
859 transitTime = target->transitTime(ut.addDays(1), geo);
860 transitAlt = target->transitAltitude(ut.addDays(1), geo);
861 }
862 //If set time is before rise time, use set time for tomorrow
863 QTime setTime = target->riseSetTime(ut, geo, false); //false = use set time
864 dms setAz = target->riseSetTimeAz(ut, geo, false); //false = use set time
865 if (setTime < riseTime)
866 {
867 setTime = target->riseSetTime(ut.addDays(1), geo, false); //false = use set time
868 setAz = target->riseSetTimeAz(ut.addDays(1), geo, false); //false = use set time
869 }
870 if (riseTime.isValid())
871 {
872 riseTimeString = QString::asprintf("%02d:%02d", riseTime.hour(), riseTime.minute());
873 setTimeString = QString::asprintf("%02d:%02d", setTime.hour(), setTime.minute());
874 riseAzString = riseAz.toDMSString(true, true);
875 setAzString = setAz.toDMSString(true, true);
876 }
877 else
878 {
879 if (target->alt().Degrees() > 0.0)
880 {
881 riseTimeString = setTimeString = QString("Circumpolar");
882 }
883 else
884 {
885 riseTimeString = setTimeString = QString("Never Rises");
886 }
887 riseAzString = setAzString = QString("N/A");
888 }
889
890 transitTimeString = QString::asprintf("%02d:%02d", transitTime.hour(), transitTime.minute());
891 transitAltString = transitAlt.toDMSString(true, true);
892
893 QString output;
894 QXmlStreamWriter stream(&output);
895 stream.setAutoFormatting(true);
896 stream.writeStartDocument();
897 stream.writeStartElement("object");
898 stream.writeTextElement("Name", target->name());
899 stream.writeTextElement("RA_Dec_Epoch_JD", QString::number(target->getLastPrecessJD(), 'f', 3));
900 stream.writeTextElement("AltAz_JD", QString::number(data()->ut().djd(), 'f', 3));
901 stream.writeTextElement("RA_HMS", target->ra().toHMSString(true));
902 stream.writeTextElement("Dec_DMS", target->dec().toDMSString(true, true));
903 stream.writeTextElement("RA_J2000_HMS", target->ra0().toHMSString(true));
904 stream.writeTextElement("Dec_J2000_DMS", target->dec0().toDMSString(true, true));
905 stream.writeTextElement("RA_Degrees", QString::number(target->ra().Degrees()));
906 stream.writeTextElement("Dec_Degrees", QString::number(target->dec().Degrees()));
907 stream.writeTextElement("RA_J2000_Degrees", QString::number(target->ra0().Degrees()));
908 stream.writeTextElement("Dec_J2000_Degrees", QString::number(target->dec0().Degrees()));
909 stream.writeTextElement("Altitude_DMS", target->alt().toDMSString(true, true));
910 stream.writeTextElement("Azimuth_DMS", target->az().toDMSString(true, true));
911 stream.writeTextElement("Altitude_Degrees", QString::number(target->alt().Degrees()));
912 stream.writeTextElement("Azimuth_Degrees", QString::number(target->az().Degrees()));
913 stream.writeTextElement("Rise", riseTimeString);
914 stream.writeTextElement("Rise_Az_DMS", riseAzString);
915 stream.writeTextElement("Set", setTimeString);
916 stream.writeTextElement("Set_Az_DMS", setAzString);
917 stream.writeTextElement("Transit", transitTimeString);
918 stream.writeTextElement("Transit_Alt_DMS", transitAltString);
919 stream.writeTextElement("Time_Zone_Offset", QString::asprintf("%02.2f", geo->TZ()));
920
921 stream.writeEndElement(); // object
922 stream.writeEndDocument();
923 return output;
924}
925
926void KStars::renderEyepieceView(const QString &objectName, const QString &destPathChart, const double fovWidth,
927 const double fovHeight, const double rotation, const double scale, const bool flip,
928 const bool invert, QString imagePath, const QString &destPathImage, const bool overlay,
929 const bool invertColors)
930{
931 const SkyObject *obj = data()->objectNamed(objectName);
932 if (!obj)
933 {
934 qCWarning(KSTARS) << "Object named " << objectName << " was not found!";
935 return;
936 }
937 SkyObject *target = obj->clone();
938 const KSNumbers *updateNum = data()->updateNum();
939 const KStarsDateTime ut = data()->ut();
940 const GeoLocation *geo = data()->geo();
941 QPixmap *renderChart = new QPixmap();
942 QPixmap *renderImage = nullptr;
943 QTemporaryFile tempFile;
944 if (overlay || (!destPathImage.isEmpty()))
945 {
946 if (!QFile::exists(imagePath))
947 {
948 // We must download a DSS image
949 tempFile.open();
950 QEventLoop loop;
951 std::function<void(bool)> slot = [&loop](bool unused)
952 {
953 Q_UNUSED(unused);
954 loop.quit();
955 };
956 new KSDssDownloader(target, tempFile.fileName(), slot, this);
957 qDebug() << Q_FUNC_INFO << "DSS download requested. Waiting for download to complete...";
958 loop.exec(); // wait for download to complete
959 imagePath = tempFile.fileName();
960 }
961 if (QFile::exists(imagePath)) // required because DSS Download may fail
962 renderImage = new QPixmap();
963 }
964
965 // Make sure the coordinates of the SkyObject are updated
966 target->updateCoords(updateNum, true, geo->lat(), data()->lst(), true);
967 target->EquatorialToHorizontal(data()->lst(), geo->lat());
968
969 EyepieceField::renderEyepieceView(target, renderChart, fovWidth, fovHeight, rotation, scale, flip, invert,
970 imagePath, renderImage, overlay, invertColors);
971 renderChart->save(destPathChart);
972 delete renderChart;
973 if (renderImage)
974 {
975 renderImage->save(destPathImage);
976 delete renderImage;
977 }
978}
980{
981 QString output;
982
983 for (auto &object : KStarsData::Instance()->observingList()->obsList())
984 {
985 output.append(object->name() + '\n');
986 }
987 return output;
988}
989
991{
992 QString output;
993
994 for (auto &object : KStarsData::Instance()->observingList()->sessionList())
995 {
996 output.append(object->name() + '\n');
997 }
998 return output;
999}
1000
1001void KStars::setApproxFOV(double FOV_Degrees)
1002{
1003 zoom(map()->width() / (FOV_Degrees * dms::DegToRad));
1004}
1005
1010void KStars::printImage(bool usePrintDialog, bool useChartColors)
1011{
1012 //QPRINTER_FOR_NOW
1013 // KPrinter printer( true, QPrinter::HighResolution );
1015 printer.setFullPage(false);
1016
1017 //Set up the printer (either with the Print Dialog,
1018 //or using the default settings)
1019 bool ok(false);
1020 if (usePrintDialog)
1021 {
1022 //QPRINTER_FOR_NOW
1023 // ok = printer.setup( this, i18n("Print Sky") );
1024 //QPrintDialog *dialog = KdePrint::createPrintDialog(&printer, this);
1025 QPrintDialog *dialog = new QPrintDialog(&printer, this);
1026 dialog->setWindowTitle(i18nc("@title:window", "Print Sky"));
1027 if (dialog->exec() == QDialog::Accepted)
1028 ok = true;
1029 delete dialog;
1030 }
1031 else
1032 {
1033 //QPRINTER_FOR_NOW
1034 // ok = printer.autoConfigure();
1035 ok = true;
1036 }
1037
1038 if (ok)
1039 {
1041
1042 //Save current ColorScheme file name and switch to Star Chart
1043 //scheme (if requested)
1044 QString schemeName = data()->colorScheme()->fileName();
1045 if (useChartColors)
1046 {
1047 loadColorScheme("chart.colors");
1048 }
1049
1050 map()->setupProjector();
1051 map()->exportSkyImage(&printer, true);
1052
1053 //Restore old color scheme if necessary
1054 //(if printing was aborted, the ColorScheme is still restored)
1055 if (useChartColors)
1056 {
1057 loadColorScheme(schemeName);
1058 map()->forceUpdate();
1059 }
1060
1062 }
1063}
1064
1065void KStars::openFITS(const QUrl &imageURL)
1066{
1067#ifndef HAVE_CFITSIO
1068 qWarning() << "KStars does not support loading FITS. Please recompile KStars with FITS support.";
1069#else
1070 QSharedPointer<FITSViewer> fv = createFITSViewer();
1071 fv->loadFile(imageURL);
1072#endif
1073}
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
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:180
void syncLST()
Sync the LST with the simulation clock.
const KStarsDateTime & ut() const
Definition kstarsdata.h:159
GeoLocation * geo()
Definition kstarsdata.h:238
SkyMapComposite * skyComposite()
Definition kstarsdata.h:174
void setSnapNextFocus(bool b=true)
Disable or re-enable the slewing animation for the next Focus change.
Definition kstarsdata.h:291
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:140
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:122
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:134
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 QDBusVariant getOption(const QString &name)
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 Q_NOREPLY void setOption(const QString &name, const QDBusVariant &value)
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:1174
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:1253
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:1019
void slotZoomOut()
Zoom out one step.
Definition skymap.cpp:1164
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:1184
void slotZoomDefault()
Set default zoom.
Definition skymap.cpp:1169
SkyPoint * clickedPoint()
Retrieve the ClickedPoint position.
Definition skymap.h:217
void slotZoomIn()
Zoom in one step.
Definition skymap.cpp:1159
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:50
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:245
virtual QString name(void) const
Definition skyobject.h:154
dms transitAltitude(const KStarsDateTime &dt, const GeoLocation *geo) const
virtual QString longname(void) const
Definition skyobject.h:182
QString name2(void) const
Definition skyobject.h:168
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:236
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:410
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:602
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)
char32_t toLower(char32_t ucs4)
QVariant variant() const const
qint64 elapsed() const const
int exec(ProcessEventsFlags flags)
void quit()
bool exists(const QString &fileName)
void restoreOverrideCursor()
void setOverrideCursor(const QCursor &cursor)
QByteArray toJson(JsonFormat format) const const
QKeySequence fromString(const QString &str, SequenceFormat format)
QVariant property(const char *name) const const
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,...)
const QChar at(qsizetype position) const const
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
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-2025 The KDE developers.
Generated on Fri Jan 31 2025 11:53:49 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.