Kstars

skymap.cpp
1/*
2 SPDX-FileCopyrightText: 2001 Jason Harris <jharris@30doradus.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#include "skyobjectuserdata.h"
8#ifdef _WIN32
9#include <windows.h>
10#endif
11
12#include "skymap.h"
13
14#include "ksasteroid.h"
15#include "kstars_debug.h"
16#include "fov.h"
17#include "imageviewer.h"
18#include "xplanetimageviewer.h"
19#include "ksdssdownloader.h"
20#include "kspaths.h"
21#include "kspopupmenu.h"
22#include "kstars.h"
23#include "ksutils.h"
24#include "Options.h"
25#include "skymapcomposite.h"
26#ifdef HAVE_OPENGL
27#include "skymapgldraw.h"
28#endif
29#include "skymapqdraw.h"
30#include "starhopperdialog.h"
31#include "starobject.h"
32#include "texturemanager.h"
33#include "dialogs/detaildialog.h"
34#include "printing/printingwizard.h"
35#include "skycomponents/flagcomponent.h"
36#include "skyobjects/ksplanetbase.h"
37#include "skyobjects/satellite.h"
38#include "tools/flagmanager.h"
39#include "widgets/infoboxwidget.h"
40#include "projections/azimuthalequidistantprojector.h"
41#include "projections/equirectangularprojector.h"
42#include "projections/lambertprojector.h"
43#include "projections/gnomonicprojector.h"
44#include "projections/orthographicprojector.h"
45#include "projections/stereographicprojector.h"
46#include "catalogobject.h"
47#include "catalogsdb.h"
48#include "catalogscomponent.h"
49
50#include <KActionCollection>
51#include <KToolBar>
52
53#include <QBitmap>
54#include <QPainterPath>
55#include <QToolTip>
56#include <QClipboard>
57#include <QInputDialog>
58#include <QDesktopServices>
59#include <QPropertyAnimation>
60#include <QGraphicsOpacityEffect>
61#include <QGraphicsSimpleTextItem>
62
63#include <QProcess>
64#include <QFileDialog>
65
66#include <cmath>
67
68namespace
69{
70// Draw bitmap for zoom cursor. Width is size of pen to draw with.
71QBitmap zoomCursorBitmap(int width)
72{
73 QBitmap b(32, 32);
74 b.fill(Qt::color0);
75 int mx = 16, my = 16;
76 // Begin drawing
77 QPainter p;
78 p.begin(&b);
79 p.setPen(QPen(Qt::color1, width));
80 p.drawEllipse(mx - 7, my - 7, 14, 14);
81 p.drawLine(mx + 5, my + 5, mx + 11, my + 11);
82 p.end();
83 return b;
84}
85
86// Draw bitmap for rotation cursor
87QBitmap rotationCursorBitmap(int width)
88{
89 constexpr int size = 32;
90 constexpr int mx = size / 2;
91 QBitmap b(size, size);
92 b.fill(Qt::color0);
93 const int pad = 4;
94
95 QPainter p;
96 p.begin(&b);
97 p.setPen(QPen(Qt::color1, width));
98
99 QPainterPath arc1;
100 arc1.moveTo(mx, pad);
101 arc1.arcTo(QRect(pad, pad, size - 2 * pad, size - 2 * pad), 90, 90);
102 auto arcEnd1 = arc1.currentPosition();
103 arc1.lineTo(arcEnd1.x() - pad / 2, arcEnd1.y() - pad);
104 p.drawPath(arc1);
105
106 QPainterPath arc2;
107 arc2.moveTo(mx, size - pad);
108 arc2.arcTo(QRect(pad, pad, size - 2 * pad, size - 2 * pad), 270, 90);
109 auto arcEnd2 = arc2.currentPosition();
110 arc2.lineTo(arcEnd2.x() + pad / 2, arcEnd2.y() + pad);
111 p.drawPath(arc2);
112
113 p.end();
114 return b;
115}
116
117// Draw bitmap for rotation cursor
118QBitmap fovRotationCursorBitmap(int width)
119{
120 constexpr int size = 32;
121 constexpr int mx = size / 2;
122 QBitmap b(size, size);
123 b.fill(Qt::color0);
124 const int pad = 4;
125
126 QPainter p;
127 p.begin(&b);
128 p.setPen(QPen(Qt::color1, width));
129
130 QPainterPath arc1;
131 arc1.moveTo(mx, pad);
132 arc1.arcTo(QRect(pad, pad, size - 2 * pad, size - 2 * pad), 90, 90);
133 auto arcEnd1 = arc1.currentPosition();
134 arc1.lineTo(arcEnd1.x() - pad / 2, arcEnd1.y() - pad);
135 p.drawPath(arc1);
136
137 QPainterPath arc2;
138 arc2.moveTo(mx, size - pad);
139 arc2.arcTo(QRect(pad, pad, size - 2 * pad, size - 2 * pad), 270, 90);
140 auto arcEnd2 = arc2.currentPosition();
141 arc2.lineTo(arcEnd2.x() + pad / 2, arcEnd2.y() + pad);
142 p.drawPath(arc2);
143
144 p.drawRect(size * .375, size * .375, size * .25, size * .25);
145
146 p.end();
147 return b;
148}
149
150// Draw bitmap for default cursor. Width is size of pen to draw with.
151QBitmap defaultCursorBitmap(int width)
152{
153 QBitmap b(32, 32);
154 b.fill(Qt::color0);
155 int mx = 16, my = 16;
156 // Begin drawing
157 QPainter p;
158 p.begin(&b);
159 p.setPen(QPen(Qt::color1, width));
160 // 1. diagonal
161 p.drawLine(mx - 2, my - 2, mx - 8, mx - 8);
162 p.drawLine(mx + 2, my + 2, mx + 8, mx + 8);
163 // 2. diagonal
164 p.drawLine(mx - 2, my + 2, mx - 8, mx + 8);
165 p.drawLine(mx + 2, my - 2, mx + 8, mx - 8);
166 p.end();
167 return b;
168}
169
170QBitmap circleCursorBitmap(int width)
171{
172 QBitmap b(32, 32);
173 b.fill(Qt::color0);
174 int mx = 16, my = 16;
175 // Begin drawing
176 QPainter p;
177 p.begin(&b);
178 p.setPen(QPen(Qt::color1, width));
179
180 // Circle
181 p.drawEllipse(mx - 8, my - 8, mx, my);
182 // 1. diagonal
183 p.drawLine(mx - 8, my - 8, 0, 0);
184 p.drawLine(mx + 8, my - 8, 32, 0);
185 // 2. diagonal
186 p.drawLine(mx - 8, my + 8, 0, 32);
187 p.drawLine(mx + 8, my + 8, 32, 32);
188
189 p.end();
190 return b;
191}
192
193} // namespace
194
195SkyMap *SkyMap::pinstance = nullptr;
196
197SkyMap *SkyMap::Create()
198{
199 delete pinstance;
200 pinstance = new SkyMap();
201 return pinstance;
202}
203
204SkyMap *SkyMap::Instance()
205{
206 return pinstance;
207}
208
210 : QGraphicsView(KStars::Instance()), computeSkymap(true), rulerMode(false), data(KStarsData::Instance()), pmenu(nullptr),
211 ClickedObject(nullptr), FocusObject(nullptr), m_proj(nullptr), m_previewLegend(false), m_objPointingMode(false)
212{
213#if !defined(KSTARS_LITE)
216#endif
217 m_Scale = 1.0;
218
219 ZoomRect = QRect();
220
221 // set the default cursor
222 setMouseCursorShape(static_cast<Cursor>(Options::defaultCursor()));
223
224 QPalette p = palette();
225 p.setColor(QPalette::Window, QColor(data->colorScheme()->colorNamed("SkyColor")));
226 setPalette(p);
227
229 setMinimumSize(380, 250);
233 setStyleSheet("QGraphicsView { border-style: none; }");
234
235 setMouseTracking(true); //Generate MouseMove events!
236 midMouseButtonDown = false;
237 mouseButtonDown = false;
238 slewing = false;
239 clockSlewing = false;
240
241 ClickedObject = nullptr;
242 FocusObject = nullptr;
243
244 m_SkyMapDraw = nullptr;
245
246 pmenu = new KSPopupMenu();
247
249
250 //Initialize Transient label stuff
251 m_HoverTimer.setSingleShot(true); // using this timer as a single shot timer
252
253 connect(&m_HoverTimer, SIGNAL(timeout()), this, SLOT(slotTransientLabel()));
254 connect(this, SIGNAL(destinationChanged()), this, SLOT(slewFocus()));
255 connect(KStarsData::Instance(), SIGNAL(skyUpdate(bool)), this, SLOT(slotUpdateSky(bool)));
256
257 // Time infobox
258 m_timeBox = new InfoBoxWidget(Options::shadeTimeBox(), Options::positionTimeBox(), Options::stickyTimeBox(),
259 QStringList(), this);
260 m_timeBox->setVisible(Options::showTimeBox());
261 connect(data->clock(), SIGNAL(timeChanged()), m_timeBox, SLOT(slotTimeChanged()));
262 connect(data->clock(), SIGNAL(timeAdvanced()), m_timeBox, SLOT(slotTimeChanged()));
263
264 // Geo infobox
265 m_geoBox = new InfoBoxWidget(Options::shadeGeoBox(), Options::positionGeoBox(), Options::stickyGeoBox(),
266 QStringList(), this);
267 m_geoBox->setVisible(Options::showGeoBox());
268 connect(data, SIGNAL(geoChanged()), m_geoBox, SLOT(slotGeoChanged()));
269
270 // Object infobox
271 m_objBox = new InfoBoxWidget(Options::shadeFocusBox(), Options::positionFocusBox(), Options::stickyFocusBox(),
272 QStringList(), this);
273 m_objBox->setVisible(Options::showFocusBox());
276
277 m_SkyMapDraw = new SkyMapQDraw(this);
278 m_SkyMapDraw->setMouseTracking(true);
279
280 m_SkyMapDraw->setParent(this->viewport());
281 m_SkyMapDraw->show();
282
283 m_iboxes = new InfoBoxes(m_SkyMapDraw);
284
285 m_iboxes->setVisible(Options::showInfoBoxes());
286 m_iboxes->addInfoBox(m_timeBox);
287 m_iboxes->addInfoBox(m_geoBox);
288 m_iboxes->addInfoBox(m_objBox);
289}
290
292{
293 m_geoBox->setVisible(flag);
294}
295
297{
298 m_objBox->setVisible(flag);
299}
300
302{
303 m_timeBox->setVisible(flag);
304}
305
307{
308 m_iboxes->setVisible(flag);
309 Options::setShowInfoBoxes(flag);
310}
311
313{
314 /* == Save infoxes status into Options == */
315 //Options::setShowInfoBoxes(m_iboxes->isVisibleTo(parentWidget()));
316 // Time box
317 Options::setPositionTimeBox(m_timeBox->pos());
318 Options::setShadeTimeBox(m_timeBox->shaded());
319 Options::setStickyTimeBox(m_timeBox->sticky());
320 Options::setShowTimeBox(m_timeBox->isVisibleTo(m_iboxes));
321 // Geo box
322 Options::setPositionGeoBox(m_geoBox->pos());
323 Options::setShadeGeoBox(m_geoBox->shaded());
324 Options::setStickyGeoBox(m_geoBox->sticky());
325 Options::setShowGeoBox(m_geoBox->isVisibleTo(m_iboxes));
326 // Obj box
327 Options::setPositionFocusBox(m_objBox->pos());
328 Options::setShadeFocusBox(m_objBox->shaded());
329 Options::setStickyFocusBox(m_objBox->sticky());
330 Options::setShowFocusBox(m_objBox->isVisibleTo(m_iboxes));
331
332 //store focus values in Options
333 //If not tracking and using Alt/Az coords, stor the Alt/Az coordinates
334 if (Options::useAltAz() && !Options::isTracking())
335 {
336 Options::setFocusRA(focus()->az().Degrees());
337 Options::setFocusDec(focus()->alt().Degrees());
338 }
339 else
340 {
341 Options::setFocusRA(focus()->ra().Hours());
342 Options::setFocusDec(focus()->dec().Degrees());
343 }
344
345#ifdef HAVE_OPENGL
346 delete m_SkyMapGLDraw;
347 delete m_SkyMapQDraw;
348 m_SkyMapDraw = 0; // Just a formality
349#else
350 delete m_SkyMapDraw;
351#endif
352
353 delete pmenu;
354
355 delete m_proj;
356
357 pinstance = nullptr;
358}
359
361{
362 if (focusObject() && Options::isTracking())
364 else
365 emit positionChanged(focus());
366}
367
369{
370 if (focusObject() && Options::isTracking())
371 m_objBox->slotObjectChanged(focusObject());
372 else
373 m_objBox->slotPointChanged(focus());
374}
375
376void SkyMap::slotTransientLabel()
377{
378 //This function is only called if the HoverTimer manages to timeout.
379 //(HoverTimer is restarted with every mouseMoveEvent; so if it times
380 //out, that means there was no mouse movement for HOVER_INTERVAL msec.)
381 if (hasFocus() && !slewing &&
382 !(Options::useAltAz() && Options::showGround() && m_MousePoint.altRefracted().Degrees() < 0.0))
383 {
384 double maxrad = 1000.0 / Options::zoomFactor();
385 SkyObject *so = data->skyComposite()->objectNearest(&m_MousePoint, maxrad);
386
387 if (so && !isObjectLabeled(so))
388 {
389 QString name = so->translatedLongName();
390 if (!std::isnan(so->mag()))
391 name += QString(": %1<sup>m</sup>").arg(QString::number(so->mag(), 'f', 1));
392 QToolTip::showText(QCursor::pos(), name, this);
393 }
394 }
395}
396
397//Slots
398
400{
401 ClickedObject = o;
402}
403
405{
406 FocusObject = o;
407 if (FocusObject)
408 Options::setFocusObject(FocusObject->name());
409 else
410 Options::setFocusObject(i18n("nothing"));
411}
412
414{
415 KStars *kstars = KStars::Instance();
416 TrailObject *trailObj = dynamic_cast<TrailObject *>(focusObject());
417
418 SkyPoint *foc;
419 if(ClickedObject != nullptr)
420 foc = ClickedObject;
421 else
422 foc = &ClickedPoint;
423
424 //clear the planet trail of old focusObject, if it was temporary
425 if (trailObj && data->temporaryTrail)
426 {
427 trailObj->clearTrail();
428 data->temporaryTrail = false;
429 }
430
431 //If the requested object is below the opaque horizon, issue a warning message
432 //(unless user is already pointed below the horizon)
433 if (Options::useAltAz() && Options::showGround() &&
434 focus()->alt().Degrees() > SkyPoint::altCrit &&
435 foc->alt().Degrees() <= SkyPoint::altCrit)
436 {
437 QString caption = i18n("Requested Position Below Horizon");
438 QString message = i18n("The requested position is below the horizon.\nWould you like to go there anyway?");
439 if (KMessageBox::warningContinueCancel(this, message, caption, KGuiItem(i18n("Go Anyway")),
440 KGuiItem(i18n("Keep Position")), "dag_focus_below_horiz") == KMessageBox::Cancel)
441 {
442 setClickedObject(nullptr);
443 setFocusObject(nullptr);
444 Options::setIsTracking(false);
445
446 return;
447 }
448 }
449
450 //set FocusObject before slewing. Otherwise, KStarsData::updateTime() can reset
451 //destination to previous object...
452 setFocusObject(ClickedObject);
453 if(ClickedObject == nullptr)
454 setFocusPoint(&ClickedPoint);
455
456 Options::setIsTracking(true);
457
458 if (kstars)
459 {
460 kstars->actionCollection()
461 ->action("track_object")
462 ->setIcon(QIcon::fromTheme("document-encrypt"));
463 kstars->actionCollection()->action("track_object")->setText(i18n("Stop &Tracking"));
464 }
465
466 //If focusObject is a SS body and doesn't already have a trail, set the temporaryTrail
467
468 if (Options::useAutoTrail() && trailObj && trailObj->hasTrail())
469 {
470 trailObj->addToTrail();
471 data->temporaryTrail = true;
472 }
473
474 //update the destination to the selected coordinates
475 if (Options::useAltAz())
476 {
477 setDestinationAltAz(foc->alt(), foc->az(), false);
478 }
479 else
480 {
481 setDestination(*foc);
482 }
483
484 foc->EquatorialToHorizontal(data->lst(), data->geo()->lat());
485
486 //display coordinates in statusBar
487 emit mousePointChanged(foc);
488 showFocusCoords(); //update FocusBox
489}
490
492{
493 // Code moved from KStarsData::updateTime()
494 //Update focus
495 updateFocus();
496
497 if (now)
499 0, this,
500 SLOT(forceUpdateNow())); // Why is it done this way rather than just calling forceUpdateNow()? -- asimha // --> Opening a neww thread? -- Valentin
501 else
502 forceUpdate();
503}
504
506{
507 dms ra(0.0), dec(0.0);
508 QString urlstring;
509
510 //ra and dec must be the coordinates at J2000. If we clicked on an object, just use the object's ra0, dec0 coords
511 //if we clicked on empty sky, we need to precess to J2000.
512 if (clickedObject())
513 {
515 }
516 else
517 {
518 //SkyPoint deprecessedPoint = clickedPoint()->deprecess(data->updateNum());
519 SkyPoint deprecessedPoint = clickedPoint()->catalogueCoord(data->updateNum()->julianDay());
520 ra = deprecessedPoint.ra();
521 dec = deprecessedPoint.dec();
522 urlstring = KSDssDownloader::getDSSURL(ra, dec); // Use default size for non-objects
523 }
524
525 QUrl url(urlstring);
526
527 KStars *kstars = KStars::Instance();
528 if (kstars)
529 {
530 new ImageViewer(
531 url, i18n("Digitized Sky Survey image provided by the Space Telescope Science Institute [free for non-commercial use]."),
532 this);
533 //iv->show();
534 }
535}
536
538{
539 dms J2000RA(0.0), J2000DE(0.0), JNowRA(0.0), JNowDE(0.0), Az, Alt;
540 if (clickedObject())
541 {
542 J2000RA = clickedObject()->ra0();
543 J2000DE = clickedObject()->dec0();
544 JNowRA = clickedObject()->ra();
545 JNowDE = clickedObject()->dec();
546 Az = clickedObject()->az();
547 Alt = clickedObject()->alt();
548 }
549 else
550 {
551 // Empty point only have valid JNow RA/DE, not J2000 information.
552 SkyPoint emptyPoint = *clickedPoint();
553 // Now get J2000 from JNow but de-aberrating, de-nutating, de-preccessing
554 // This modifies emptyPoint, but the RA/DE are now missing and need
555 // to be repopulated.
556 emptyPoint.catalogueCoord(data->updateNum()->julianDay());
557 emptyPoint.setRA(clickedPoint()->ra());
558 emptyPoint.setDec(clickedPoint()->dec());
559 emptyPoint.EquatorialToHorizontal(data->lst(), data->geo()->lat());
560
561 J2000RA = emptyPoint.ra0();
562 J2000DE = emptyPoint.dec0();
563 JNowRA = emptyPoint.ra();
564 JNowDE = emptyPoint.dec();
565 Az = emptyPoint.az();
566 Alt = emptyPoint.alt();
567 }
568
569 QApplication::clipboard()->setText(i18nc("Equatorial & Horizontal Coordinates",
570 "JNow:\t%1\t%2\nJ2000:\t%3\t%4\nAzAlt:\t%5\t%6",
571 JNowRA.toHMSString(),
572 JNowDE.toDMSString(),
573 J2000RA.toHMSString(),
574 J2000DE.toDMSString(),
575 Az.toDMSString(),
576 Alt.toDMSString()));
577}
578
580{
581
582 QString tle = "";
583 if (clickedObject()->type() == SkyObject::SATELLITE)
584 {
585 Satellite *sat = (Satellite *) clickedObject();
586 tle = sat->tle();
587 }
588 else
589 {
590 tle = "NO TLE FOR OBJECT";
591 }
592
594}
595
597{
598 // TODO: Remove code duplication -- we have the same stuff
599 // implemented in ObservingList::setCurrentImage() etc. in
600 // tools/observinglist.cpp; must try to de-duplicate as much as
601 // possible.
602 QString URLprefix("http://skyserver.sdss.org/dr16/SkyServerWS/ImgCutout/getjpeg?");
603 QString URLsuffix("&scale=1.0&width=600&height=600");
604 dms ra(0.0), dec(0.0);
605 QString RAString, DecString;
606
607 //ra and dec must be the coordinates at J2000. If we clicked on an object, just use the object's ra0, dec0 coords
608 //if we clicked on empty sky, we need to precess to J2000.
609 if (clickedObject())
610 {
611 ra = clickedObject()->ra0();
612 dec = clickedObject()->dec0();
613 }
614 else
615 {
616 //SkyPoint deprecessedPoint = clickedPoint()->deprecess(data->updateNum());
617 SkyPoint deprecessedPoint = clickedPoint()->catalogueCoord(data->updateNum()->julianDay());
618 deprecessedPoint.catalogueCoord(data->updateNum()->julianDay());
619 ra = deprecessedPoint.ra();
620 dec = deprecessedPoint.dec();
621 }
622
623 RAString = QString::asprintf("ra=%f", ra.Degrees());
624 DecString = QString::asprintf("&dec=%f", dec.Degrees());
625
626 //concat all the segments into the kview command line:
627 QUrl url(URLprefix + RAString + DecString + URLsuffix);
628
629 KStars *kstars = KStars::Instance();
630 if (kstars)
631 {
632 new ImageViewer(url,
633 i18n("Sloan Digital Sky Survey image provided by the Astrophysical Research Consortium [free "
634 "for non-commercial use]."),
635 this);
636 //iv->show();
637 }
638}
639
641{
642 beginRulerMode(false);
643}
644
645void SkyMap::slotBeginStarHop()
646{
647 beginRulerMode(true);
648}
649
650void SkyMap::beginRulerMode(bool starHopRuler)
651{
652 rulerMode = true;
653 starHopDefineMode = starHopRuler;
654 AngularRuler.clear();
655
656 //If the cursor is near a SkyObject, reset the AngularRuler's
657 //start point to the position of the SkyObject
658 double maxrad = 1000.0 / Options::zoomFactor();
659 SkyObject *so = data->skyComposite()->objectNearest(clickedPoint(), maxrad);
660 if (so)
661 {
662 AngularRuler.append(so);
663 AngularRuler.append(so);
664 m_rulerStartPoint = so;
665 }
666 else
667 {
668 AngularRuler.append(clickedPoint());
669 AngularRuler.append(clickedPoint());
670 m_rulerStartPoint = clickedPoint();
671 }
672
673 AngularRuler.update(data);
674}
675
677{
678 if (!rulerMode)
679 return;
680 if (!starHopDefineMode) // Angular Ruler
681 {
682 QString sbMessage;
683
684 //If the cursor is near a SkyObject, reset the AngularRuler's
685 //end point to the position of the SkyObject
686 double maxrad = 1000.0 / Options::zoomFactor();
687 SkyPoint *rulerEndPoint;
688 SkyObject *so = data->skyComposite()->objectNearest(clickedPoint(), maxrad);
689 if (so)
690 {
691 AngularRuler.setPoint(1, so);
692 sbMessage = so->translatedLongName() + " ";
693 rulerEndPoint = so;
694 }
695 else
696 {
697 AngularRuler.setPoint(1, clickedPoint());
698 rulerEndPoint = clickedPoint();
699 }
700
701 rulerMode = false;
702 AngularRuler.update(data);
703 dms angularDistance = AngularRuler.angularSize();
704
705 sbMessage += i18n("Angular distance: %1", angularDistance.toDMSString());
706
707 const StarObject *p1 = dynamic_cast<const StarObject *>(m_rulerStartPoint);
708 const StarObject *p2 = dynamic_cast<const StarObject *>(rulerEndPoint);
709
710 qCDebug(KSTARS) << "Starobjects? " << p1 << p2;
711 if (p1 && p2)
712 qCDebug(KSTARS) << "Distances: " << p1->distance() << "pc; " << p2->distance() << "pc";
713 if (p1 && p2 && std::isfinite(p1->distance()) && std::isfinite(p2->distance()) && p1->distance() > 0 &&
714 p2->distance() > 0)
715 {
716 double dist = sqrt(p1->distance() * p1->distance() + p2->distance() * p2->distance() -
717 2 * p1->distance() * p2->distance() * cos(angularDistance.radians()));
718 qCDebug(KSTARS) << "Could calculate physical distance: " << dist << " pc";
719 sbMessage += i18n("; Physical distance: %1 pc", QString::number(dist));
720 }
721
722 AngularRuler.clear();
723
724 // Create unobsructive message box with suicidal tendencies
725 // to display result.
726 InfoBoxWidget *box = new InfoBoxWidget(true, mapFromGlobal(QCursor::pos()), 0, QStringList(sbMessage), this);
727 connect(box, SIGNAL(clicked()), box, SLOT(deleteLater()));
728 QTimer::singleShot(5000, box, SLOT(deleteLater()));
729 box->adjust();
730 box->show();
731 }
732 else // Star Hop
733 {
734 StarHopperDialog *shd = new StarHopperDialog(this);
735 const SkyPoint &startHop = *AngularRuler.point(0);
736 const SkyPoint &stopHop = *clickedPoint();
737 double fov; // Field of view in arcminutes
738 bool ok; // true if user did not cancel the operation
739 if (data->getAvailableFOVs().size() == 1)
740 {
741 // Exactly 1 FOV symbol visible, so use that. Also assume a circular FOV of size min{sizeX, sizeY}
742 FOV *f = data->getAvailableFOVs().first();
743 fov = ((f->sizeX() >= f->sizeY() && f->sizeY() != 0) ? f->sizeY() : f->sizeX());
744 ok = true;
745 }
746 else if (!data->getAvailableFOVs().isEmpty())
747 {
748 // Ask the user to choose from a list of available FOVs.
749 FOV const *f;
750 QMap<QString, double> nameToFovMap;
751 foreach (f, data->getAvailableFOVs())
752 {
753 nameToFovMap.insert(f->name(),
754 ((f->sizeX() >= f->sizeY() && f->sizeY() != 0) ? f->sizeY() : f->sizeX()));
755 }
756 fov = nameToFovMap[QInputDialog::getItem(this, i18n("Star Hopper: Choose a field-of-view"),
757 i18n("FOV to use for star hopping:"), nameToFovMap.keys(), 0,
758 false, &ok)];
759 }
760 else
761 {
762 // Ask the user to enter a field of view
763 fov =
764 QInputDialog::getDouble(this, i18n("Star Hopper: Enter field-of-view to use"),
765 i18n("FOV to use for star hopping (in arcminutes):"), 60.0, 1.0, 600.0, 1, &ok);
766 }
767
768 Q_ASSERT(fov > 0.0);
769
770 if (ok)
771 {
772 qCDebug(KSTARS) << "fov = " << fov;
773
774 shd->starHop(startHop, stopHop, fov / 60.0, 9.0); //FIXME: Hardcoded maglimit value
775 shd->show();
776 }
777
778 rulerMode = false;
779 }
780}
781
783{
784 rulerMode = false;
785 AngularRuler.clear();
786}
787
789{
790 KStars *ks = KStars::Instance();
791
792 // popup FlagManager window and update coordinates
793 ks->slotFlagManager();
794 ks->flagManager()->clearFields();
795
796 //ra and dec must be the coordinates at J2000. If we clicked on an object, just use the object's ra0, dec0 coords
797 //if we clicked on empty sky, we need to precess to J2000.
798
799 dms J2000RA, J2000DE;
800
801 if (clickedObject())
802 {
803 J2000RA = clickedObject()->ra0();
804 J2000DE = clickedObject()->dec0();
805 }
806 else
807 {
808 //SkyPoint deprecessedPoint = clickedPoint()->deprecess(data->updateNum());
809 SkyPoint deprecessedPoint = clickedPoint()->catalogueCoord(data->updateNum()->julianDay());
810 deprecessedPoint.catalogueCoord(data->updateNum()->julianDay());
811 J2000RA = deprecessedPoint.ra();
812 J2000DE = deprecessedPoint.dec();
813 }
814
815 ks->flagManager()->setRaDec(J2000RA, J2000DE);
816}
817
819{
820 // popup FlagManager window and update coordinates
821 KStars *ks = KStars::Instance();
822 ks->slotFlagManager();
823 ks->flagManager()->clearFields();
824
825 SkyPoint pOrig = m_MousePointPressed;
826 SkyPoint p2000;
827 p2000 = pOrig.catalogueCoord(KStarsData::Instance()->updateNum()->julianDay());
828 ks->flagManager()->setRaDec(p2000.ra(), p2000.dec());
829}
830
831void SkyMap::slotEditFlag(int flagIdx)
832{
833 KStars *ks = KStars::Instance();
834
835 // popup FlagManager window and switch to selected flag
836 ks->slotFlagManager();
837 ks->flagManager()->showFlag(flagIdx);
838}
839
840void SkyMap::slotDeleteFlag(int flagIdx)
841{
842 KStars *ks = KStars::Instance();
843
844 ks->data()->skyComposite()->flags()->remove(flagIdx);
845 ks->data()->skyComposite()->flags()->saveToFile();
846
847 // if there is FlagManager created, update its flag model
848 if (ks->flagManager())
849 {
850 ks->flagManager()->deleteFlagItem(flagIdx);
851 }
852}
853
855{
856 const auto *action = qobject_cast<QAction *>(sender());
857 const auto url = action->data().toUrl();
858 const QString message{ action->text().remove('&') };
859
860 if (!url.isEmpty())
861 new ImageViewer(url, clickedObject()->messageFromTitle(message), this);
862}
863
865{
866 const auto *action = qobject_cast<QAction *>(sender());
867 const auto url = action->data().toUrl();
868
869 if (!url.isEmpty())
871}
872
874{
875 return data->skyComposite()->labelObjects().contains(object);
876}
877
878SkyPoint SkyMap::getCenterPoint()
879{
880 SkyPoint retVal;
881 // FIXME: subtraction of these 0.00001 is a simple workaround, because wrong
882 // SkyPoint is returned when _exact_ center of SkyMap is passed to the projector.
883 return projector()->fromScreen(QPointF((qreal)width() / 2 - 0.00001, (qreal)height() / 2 - 0.00001), data);
884}
885
887{
888 data->skyComposite()->removeNameLabel(clickedObject());
889 forceUpdate();
890}
891
893{
894 auto *object = dynamic_cast<CatalogObject *>(clickedObject());
895 if (!object)
896 return;
897
898 const auto &cat = object->getCatalog();
899 if (!cat.mut)
900 return;
901
902 CatalogsDB::DBManager manager{ CatalogsDB::dso_db_path() };
903 manager.remove_object(cat.id, object->getObjectId());
904
905 emit removeSkyObject(object);
906 data->skyComposite()->removeFromNames(object);
907 data->skyComposite()->removeFromLists(object);
908 data->skyComposite()->reloadDeepSky();
910}
911
913{
914 data->skyComposite()->addNameLabel(clickedObject());
915 forceUpdate();
916}
917
919{
920 TrailObject *tobj = dynamic_cast<TrailObject *>(clickedObject());
921 if (tobj)
922 {
923 tobj->clearTrail();
924 forceUpdate();
925 }
926}
927
929{
930 TrailObject *tobj = dynamic_cast<TrailObject *>(clickedObject());
931 if (tobj)
932 {
933 tobj->addToTrail();
934 forceUpdate();
935 }
936}
937
939{
940 // check if object is selected
941 if (!clickedObject())
942 {
943 KMessageBox::error(this, i18n("No object selected."), i18n("Object Details"));
944 return;
945 }
946 DetailDialog *detail = new DetailDialog(clickedObject(), data->ut(), data->geo(), KStars::Instance());
948 detail->show();
949}
950
952{
953 if (m_objPointingMode && KStars::Instance()->printingWizard())
954 {
955 KStars::Instance()->printingWizard()->pointingDone(clickedObject());
956 m_objPointingMode = false;
957 }
958}
959
960void SkyMap::slotCancelLegendPreviewMode()
961{
962 m_previewLegend = false;
963 forceUpdate(true);
964 KStars::Instance()->showImgExportDialog();
965}
966
967void SkyMap::slotFinishFovCaptureMode()
968{
969 if (m_fovCaptureMode && KStars::Instance()->printingWizard())
970 {
971 KStars::Instance()->printingWizard()->fovCaptureDone();
972 m_fovCaptureMode = false;
973 }
974}
975
976void SkyMap::slotCaptureFov()
977{
978 if (KStars::Instance()->printingWizard())
979 {
980 KStars::Instance()->printingWizard()->captureFov();
981 }
982}
983
985{
986 //If the current timescale exceeds slewTimeScale, set clockSlewing=true, and stop the clock.
987 if ((fabs(data->clock()->scale()) > Options::slewTimeScale()) ^ clockSlewing)
988 {
989 data->clock()->setManualMode(!clockSlewing);
990 clockSlewing = !clockSlewing;
991 // don't change automatically the DST status
992 KStars *kstars = KStars::Instance();
993 if (kstars)
994 kstars->updateTime(false);
995 }
996}
997
999{
1000 setFocus(p->ra(), p->dec());
1001}
1002
1003void SkyMap::setFocus(const dms &ra, const dms &dec)
1004{
1005 Options::setFocusRA(ra.Hours());
1006 Options::setFocusDec(dec.Degrees());
1007
1008 focus()->set(ra, dec);
1009 focus()->EquatorialToHorizontal(data->lst(), data->geo()->lat());
1010}
1011
1012void SkyMap::setFocusAltAz(const dms &alt, const dms &az)
1013{
1014 Options::setFocusRA(focus()->ra().Hours());
1015 Options::setFocusDec(focus()->dec().Degrees());
1016 focus()->setAlt(alt);
1017 focus()->setAz(az);
1019
1020 slewing = false;
1021 forceUpdate(); //need a total update, or slewing with the arrow keys doesn't work.
1022}
1023
1025{
1026 setDestination(p.ra(), p.dec());
1027}
1028
1029void SkyMap::setDestination(const dms &ra, const dms &dec)
1030{
1031 destination()->set(ra, dec);
1032 destination()->EquatorialToHorizontal(data->lst(), data->geo()->lat());
1033 emit destinationChanged();
1034}
1035
1036void SkyMap::setDestinationAltAz(const dms &alt, const dms &az, bool altIsRefracted)
1037{
1038 if (altIsRefracted)
1039 {
1040 // The alt in the SkyPoint is always actual, not apparent
1042 }
1043 else
1044 {
1045 destination()->setAlt(alt);
1046 }
1047 destination()->setAz(az);
1049 emit destinationChanged();
1050}
1051
1053{
1054 ClickedPoint = *f;
1055}
1056
1058{
1059 if (slewing)
1060 return;
1061
1062 //Tracking on an object
1063 if (Options::isTracking())
1064 {
1065 if (focusObject())
1066 {
1067 focusObject()->updateCoordsNow(data->updateNum());
1069 }
1070 else
1072 }
1073 else
1075}
1076
1078{
1079 //Don't slew if the mouse button is pressed
1080 //Also, no animated slews if the Manual Clock is active
1081 //08/2002: added possibility for one-time skipping of slew with snapNextFocus
1082 if (!mouseButtonDown)
1083 {
1084 bool goSlew = (Options::useAnimatedSlewing() && !data->snapNextFocus()) &&
1085 !(data->clock()->isManualMode() && data->clock()->isActive());
1086 if (goSlew)
1087 {
1088 double dX, dY;
1089 double maxstep = 10.0;
1090 if (Options::useAltAz())
1091 {
1092 dX = destination()->az().Degrees() - focus()->az().Degrees();
1093 dY = destination()->alt().Degrees() - focus()->alt().Degrees();
1094 }
1095 else
1096 {
1097 dX = destination()->ra().Degrees() - focus()->ra().Degrees();
1098 dY = destination()->dec().Degrees() - focus()->dec().Degrees();
1099 }
1100
1101 //switch directions to go the short way around the celestial sphere, if necessary.
1102 dX = KSUtils::reduceAngle(dX, -180.0, 180.0);
1103
1104 double r0 = sqrt(dX * dX + dY * dY);
1105 if (r0 < 20.0) //smaller slews have smaller maxstep
1106 {
1107 maxstep *= (10.0 + 0.5 * r0) / 20.0;
1108 }
1109 double step = 0.5;
1110 double r = r0;
1111 while (r > step)
1112 {
1113 //DEBUG
1114 //qDebug() << Q_FUNC_INFO << step << ": " << r << ": " << r0;
1115 double fX = dX / r;
1116 double fY = dY / r;
1117
1118 if (Options::useAltAz())
1119 {
1120 focus()->setAlt(focus()->alt().Degrees() + fY * step);
1121 focus()->setAz(dms(focus()->az().Degrees() + fX * step).reduce());
1123 }
1124 else
1125 {
1126 fX = fX / 15.; //convert RA degrees to hours
1127 SkyPoint newFocus(focus()->ra().Hours() + fX * step, focus()->dec().Degrees() + fY * step);
1128 setFocus(&newFocus);
1129 focus()->EquatorialToHorizontal(data->lst(), data->geo()->lat());
1130 }
1131
1132 slewing = true;
1133
1134 forceUpdate();
1135 qApp->processEvents(); //keep up with other stuff
1136
1137 if (Options::useAltAz())
1138 {
1139 dX = destination()->az().Degrees() - focus()->az().Degrees();
1140 dY = destination()->alt().Degrees() - focus()->alt().Degrees();
1141 }
1142 else
1143 {
1144 dX = destination()->ra().Degrees() - focus()->ra().Degrees();
1145 dY = destination()->dec().Degrees() - focus()->dec().Degrees();
1146 }
1147
1148 //switch directions to go the short way around the celestial sphere, if necessary.
1149 dX = KSUtils::reduceAngle(dX, -180.0, 180.0);
1150 r = sqrt(dX * dX + dY * dY);
1151
1152 //Modify step according to a cosine-shaped profile
1153 //centered on the midpoint of the slew
1154 //NOTE: don't allow the full range from -PI/2 to PI/2
1155 //because the slew will never reach the destination as
1156 //the speed approaches zero at the end!
1157 double t = dms::PI * (r - 0.5 * r0) / (1.05 * r0);
1158 step = cos(t) * maxstep;
1159 }
1160 }
1161
1162 //Either useAnimatedSlewing==false, or we have slewed, and are within one step of destination
1163 //set focus=destination.
1164 if (Options::useAltAz())
1165 {
1166 setFocusAltAz(destination()->alt(), destination()->az());
1168 }
1169 else
1170 {
1172 focus()->EquatorialToHorizontal(data->lst(), data->geo()->lat());
1173 }
1174
1175 slewing = false;
1176
1177 //Turn off snapNextFocus, we only want it to happen once
1178 if (data->snapNextFocus())
1179 {
1180 data->setSnapNextFocus(false);
1181 }
1182
1183 //Start the HoverTimer. if the user leaves the mouse in place after a slew,
1184 //we want to attach a label to the nearest object.
1185 if (Options::useHoverLabel())
1186 m_HoverTimer.start(HOVER_INTERVAL);
1187
1188 forceUpdate();
1189 }
1190}
1191
1193{
1194 setZoomFactor(Options::zoomFactor() * DZOOM);
1195}
1196
1198{
1199 setZoomFactor(Options::zoomFactor() / DZOOM);
1200}
1201
1203{
1204 setZoomFactor(DEFAULTZOOM);
1205}
1206
1207void SkyMap::setZoomFactor(double factor)
1208{
1209 Options::setZoomFactor(KSUtils::clamp(factor, MINZOOM, MAXZOOM));
1210 forceUpdate();
1211 emit zoomChanged();
1212}
1213
1214// force a new calculation of the skymap (used instead of update(), which may skip the redraw)
1215// if now=true, SkyMap::paintEvent() is run immediately, rather than being added to the event queue
1216// also, determine new coordinates of mouse cursor.
1218{
1220 if (!projector()->unusablePoint(mp))
1221 {
1222 //determine RA, Dec of mouse pointer
1223 m_MousePoint = projector()->fromScreen(mp, data);
1224 }
1225
1226 computeSkymap = true;
1227
1228 // Ensure that stars are recomputed
1229 data->incUpdateID();
1230
1231 if (now)
1232 m_SkyMapDraw->repaint();
1233 else
1234 m_SkyMapDraw->update();
1235}
1236
1238{
1239 float diagonalPixels = sqrt(static_cast<double>(width() * width() + height() * height()));
1240 return diagonalPixels / (2 * Options::zoomFactor() * dms::DegToRad);
1241}
1242
1243dms SkyMap::determineSkyRotation()
1244{
1245 // Note: The erect observer correction accounts for the fact that
1246 // an observer remains erect despite the tube of an
1247 // Altazmith-mounted Newtonian moving up and down, so an
1248 // additional rotation of altitude applies to match the
1249 // orientation of the field. This would not apply to a CCD camera
1250 // plugged into the same telescope, since the CCD would rotate as
1251 // seen from the ground when the telescope moves in altitude.
1252
1253 double erectObserverCorrection = 0.;
1254 if (Options::useAltAz() && Options::erectObserverCorrection() > 0)
1255 {
1256 erectObserverCorrection = (Options::erectObserverCorrection() == 1) ? focus()->alt().Degrees() : -focus()->alt().Degrees();
1257 }
1258
1259 return dms(Options::skyRotation() + erectObserverCorrection);
1260}
1261
1263{
1264 angle = dms(angle).reduce().Degrees();
1265 Options::setSkyRotation(angle);
1266 KStars *kstars = KStars::Instance();
1267 if (kstars)
1268 {
1269 if (angle == 0.)
1270 {
1271 kstars->actionCollection()->action("up_orientation")->setChecked(true);
1272 }
1273 else if (angle == 180.)
1274 {
1275 kstars->actionCollection()->action("down_orientation")->setChecked(true);
1276 }
1277 else
1278 {
1279 kstars->actionCollection()->action("arbitrary_orientation")->setChecked(true);
1280 }
1281 kstars->actionCollection()->action("view:arbitrary")->setChecked(true);
1282 }
1283 forceUpdate();
1284}
1285
1287{
1288 angle = dms(angle).reduce().Degrees();
1289 m_fovExtraRotation = angle;
1290 forceUpdate();
1291}
1292
1294{
1295 //Update View Parameters for projection
1296 ViewParams p;
1297 p.focus = focus();
1298 p.height = height();
1299 p.width = width();
1300 p.useAltAz = Options::useAltAz();
1301 p.useRefraction = Options::useRefraction();
1302 p.zoomFactor = Options::zoomFactor();
1303 p.rotationAngle = determineSkyRotation();
1304 p.mirror = Options::mirrorSkyMap();
1305 p.fillGround = Options::showGround();
1306 //Check if we need a new projector
1307 if (m_proj && Options::projection() == m_proj->type())
1308 m_proj->setViewParams(p);
1309 else
1310 {
1311 delete m_proj;
1312 switch (Options::projection())
1313 {
1314 case Gnomonic:
1315 m_proj = new GnomonicProjector(p);
1316 break;
1317 case Stereographic:
1318 m_proj = new StereographicProjector(p);
1319 break;
1320 case Orthographic:
1321 m_proj = new OrthographicProjector(p);
1322 break;
1323 case AzimuthalEquidistant:
1324 m_proj = new AzimuthalEquidistantProjector(p);
1325 break;
1326 case Equirectangular:
1327 m_proj = new EquirectangularProjector(p);
1328 break;
1329 case Lambert:
1330 default:
1331 //TODO: implement other projection classes
1332 m_proj = new LambertProjector(p);
1333 break;
1334 }
1335 }
1336}
1337
1338void SkyMap::setZoomMouseCursor()
1339{
1340 mouseMoveCursor = false; // no mousemove cursor
1341 mouseDragCursor = false;
1342 QBitmap cursor = zoomCursorBitmap(2);
1343 QBitmap mask = zoomCursorBitmap(4);
1345}
1346
1347void SkyMap::setRotationMouseCursor()
1348{
1349 mouseMoveCursor = false;
1350 mouseDragCursor = false;
1351 QBitmap cursor = rotationCursorBitmap(2);
1352 QBitmap mask = rotationCursorBitmap(4);
1353 setCursor(QCursor(cursor, mask));
1354}
1355
1356void SkyMap::setFovRotationMouseCursor()
1357{
1358 mouseMoveCursor = false;
1359 mouseDragCursor = false;
1360 QBitmap cursor = fovRotationCursorBitmap(2);
1361 QBitmap mask = fovRotationCursorBitmap(4);
1362 setCursor(QCursor(cursor, mask));
1363}
1364
1366{
1367 // no mousemove cursor
1368 mouseMoveCursor = false;
1369 mouseDragCursor = false;
1370
1371 switch (type)
1372 {
1373 case Cross:
1374 {
1375 QBitmap cursor = defaultCursorBitmap(2);
1376 QBitmap mask = defaultCursorBitmap(3);
1378 }
1379 break;
1380
1381 case Circle:
1382 {
1383 QBitmap cursor = circleCursorBitmap(2);
1384 QBitmap mask = circleCursorBitmap(3);
1386 }
1387 break;
1388
1389 case NoCursor:
1391 break;
1392 }
1393}
1394
1395void SkyMap::setMouseMoveCursor()
1396{
1397 if (mouseButtonDown)
1398 {
1399 setCursor(Qt::SizeAllCursor); // cursor shape defined in qt
1400 mouseMoveCursor = true;
1401 }
1402}
1403
1404void SkyMap::setMouseDragCursor()
1405{
1406 if (mouseButtonDown)
1407 {
1408 setCursor(Qt::OpenHandCursor); // cursor shape defined in qt
1409 mouseDragCursor = true;
1410 }
1411}
1412
1414{
1415 if (rulerMode && (!pmenu || !pmenu->isVisible()))
1416 AngularRuler.setPoint(1, &m_MousePoint);
1417 AngularRuler.update(data);
1418}
1419
1420bool SkyMap::isSlewing() const
1421{
1422 return (slewing || (clockSlewing && data->clock()->isActive()));
1423}
1424
1426{
1427 if(clickedObject())
1428 new XPlanetImageViewer(clickedObject()->name(), this);
1429 else
1430 new XPlanetImageViewer(i18n("Saturn"), this);
1431}
1432
1434{
1435 QLabel *fadingLabel = new QLabel(this);
1436 fadingLabel->setText(text);
1437 QFont font = fadingLabel->font();
1438 QPalette palette = fadingLabel->palette();
1439 font.setPointSize(32);
1440 palette.setColor(fadingLabel->foregroundRole(), KStarsData::Instance()->colorScheme()->colorNamed("BoxTextColor"));
1441 QColor backgroundColor = KStarsData::Instance()->colorScheme()->colorNamed("BoxBGColor");
1442 backgroundColor.setAlpha(192);
1443 palette.setColor(fadingLabel->backgroundRole(), backgroundColor);
1444 fadingLabel->setFont(font);
1445 fadingLabel->setAutoFillBackground(true);
1446 fadingLabel->setPalette(palette);
1447 fadingLabel->setAlignment(Qt::AlignCenter);
1448 fadingLabel->adjustSize();
1449 fadingLabel->move(QPoint((width() - fadingLabel->width()) / 2, (0.75 * height() - fadingLabel->height() / 2)));
1450 QGraphicsOpacityEffect* fadingEffect = new QGraphicsOpacityEffect(fadingLabel);
1451 fadingLabel->setGraphicsEffect(fadingEffect);
1452 fadingLabel->show();
1453
1454 QPropertyAnimation* animation = new QPropertyAnimation(fadingEffect, "opacity", fadingLabel);
1455 animation->setDuration(1500);
1456 animation->setStartValue(1.0);
1457 animation->setEndValue(0.0);
1458 connect(animation, &QPropertyAnimation::finished, fadingLabel, &QLabel::deleteLater);
1459 animation->start();
1460}
Implememntation of Azimuthal equidistant projection
A simple container object to hold the minimum information for a Deep Sky Object to be drawn on the sk...
const CatalogsDB::Catalog getCatalog() const
Get information about the catalog that this objects stems from.
Manages the catalog database and provides an interface to provide an interface to query and modify th...
Definition catalogsdb.h:183
std::pair< bool, QString > remove_object(const int catalog_id, const CatalogObject::oid &id)
Remove the catalog object with the `oid` from the catalog with the `catalog_id`.
DetailDialog is a window showing detailed information for a selected object.
Implememntation of Equirectangular projection
A simple class encapsulating a Field-of-View symbol.
Definition fov.h:28
void saveToFile()
Save flags to flags.dat file.
void remove(int index)
Remove a flag.
Implememntation of Gnomonic projection
Image viewer window for KStars.
Definition imageviewer.h:57
The InfoBoxWidget class is a widget that displays a transparent box for display of text messages.
void adjust()
Adjust widget's position.
void slotObjectChanged(SkyObject *obj)
Set information about object.
void slotPointChanged(SkyPoint *p)
Set information about pointing.
The InfoBoxes class is a collection of InfoBoxWidget objects that display a transparent box for displ...
Q_INVOKABLE QAction * action(const QString &name) const
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.
The KStars Popup Menu.
Definition kspopupmenu.h:35
KStarsData is the backbone of KStars.
Definition kstarsdata.h:74
Q_INVOKABLE SimClock * clock()
Definition kstarsdata.h:226
SkyMapComposite * skyComposite()
Definition kstarsdata.h:174
This is the main window for KStars.
Definition kstars.h:90
static KStars * Instance()
Definition kstars.h:122
KStarsData * data() const
Definition kstars.h:134
void slotFlagManager()
action slot: open Flag Manager
void updateTime(const bool automaticDSTchange=true)
Update time-dependent data and (possibly) repaint the sky map.
Definition kstars.cpp:611
virtual KActionCollection * actionCollection() const
Implememntation of Lambert azimuthal equal-area projection
Implememntation of Orthographic projection
void fovCaptureDone()
Disable FOV capture mode.
void pointingDone(SkyObject *obj)
Quit object pointing mode and set the pointed object.
void captureFov()
Capture current contents of FOV symbol.
virtual SkyPoint fromScreen(const QPointF &p, KStarsData *data, bool onlyAltAz=false) const
Determine RA, Dec coordinates of the pixel at (dx, dy), which are the screen pixel coordinate offsets...
Represents an artificial satellites.
Definition satellite.h:23
QString tle() const
Q_INVOKABLE bool isActive()
Whether the clock is active or not is a bit complicated by the introduction of "manual mode".
Definition simclock.cpp:128
SkyObject * objectNearest(SkyPoint *p, double &maxrad) override
This is the canvas on which the sky is painted.
Definition skymap.h:54
SkyPoint * focusPoint()
retrieve the FocusPoint position.
Definition skymap.h:149
void showFocusCoords()
Update object name and coordinates in the Focus InfoBox.
Definition skymap.cpp:360
void setZoomFactor(double factor)
@ Set zoom factor.
Definition skymap.cpp:1207
void zoomChanged()
Emitted when zoom level is changed.
void setMouseCursorShape(Cursor type)
Sets the shape of the default mouse cursor.
Definition skymap.cpp:1365
void slotToggleTimeBox(bool)
Toggle visibility of time infobox.
Definition skymap.cpp:301
SkyPoint * focus()
Retrieve the Focus point; the position on the sky at the center of the skymap.
Definition skymap.h:123
void slotSDSS()
Popup menu function: Display Sloan Digital Sky Survey image with the Image Viewer.
Definition skymap.cpp:596
void setupProjector()
Call to set up the projector before a draw cycle.
Definition skymap.cpp:1293
void slotObjectSelected()
Object pointing for Printing Wizard done.
Definition skymap.cpp:951
float fov()
Definition skymap.cpp:1237
void objectChanged(SkyObject *)
Emitted when current object changed.
void slotCopyCoordinates()
slotCopyCoordinates Copies J2000 and JNow equatorial coordinates to the clipboard in addition to hori...
Definition skymap.cpp:537
void setClickedPoint(const SkyPoint *f)
Set the ClickedPoint to the skypoint given as an argument.
Definition skymap.cpp:1052
void slotToggleGeoBox(bool)
Toggle visibility of geo infobox.
Definition skymap.cpp:291
void slotCopyTLE()
slotCopyTLE Copy satellite TLE to clipboard.
Definition skymap.cpp:579
void slotAddPlanetTrail()
Add a Planet Trail to ClickedObject.
Definition skymap.cpp:928
void slotAddObjectLabel()
Add ClickedObject to KStarsData::ObjLabelList, which stores pointers to SkyObjects which have User La...
Definition skymap.cpp:912
void slotUpdateSky(bool now)
Update the focus point and call forceUpdate()
Definition skymap.cpp:491
void slotZoomOut()
Zoom out one step.
Definition skymap.cpp:1197
void setClickedObject(SkyObject *o)
Set the ClickedObject pointer to the argument.
Definition skymap.cpp:399
void slotEndRulerMode()
Computes the angular distance, prints the result in the status bar and disables the angular distance ...
Definition skymap.cpp:676
void updateInfoBoxes()
Update info boxes coordinates.
Definition skymap.cpp:368
const Projector * projector() const
Get the current projector.
Definition skymap.h:300
void positionChanged(SkyPoint *)
Emitted when pointing changed.
void slotRemoveObjectLabel()
Remove ClickedObject from KStarsData::ObjLabelList, which stores pointers to SkyObjects which have Us...
Definition skymap.cpp:886
void slotClockSlewing()
Checks whether the timestep exceeds a threshold value.
Definition skymap.cpp:984
void slotCancelRulerMode()
Disables the angular distance measuring mode.
Definition skymap.cpp:782
void forceUpdate(bool now=false)
Recalculates the positions of objects in the sky, and then repaints the sky map.
Definition skymap.cpp:1217
SkyPoint * destination()
retrieve the Destination position.
Definition skymap.h:135
void slotRemovePlanetTrail()
Remove the PlanetTrail from ClickedObject.
Definition skymap.cpp:918
void setFocusAltAz(const dms &alt, const dms &az)
sets the focus point of the sky map, using its alt/az coordinates
Definition skymap.cpp:1012
void mousePointChanged(SkyPoint *)
Emitted when position under mouse changed.
void updateAngleRuler()
update the geometry of the angle ruler.
Definition skymap.cpp:1413
void slotSetSkyRotation(double angle)
Sets the base sky rotation (before correction) to the given angle.
Definition skymap.cpp:1262
void slotDSS()
Popup menu function: Display 1st-Generation DSS image with the Image Viewer.
Definition skymap.cpp:505
void slotToggleInfoboxes(bool)
Toggle visibility of all infoboxes.
Definition skymap.cpp:306
void setDestination(const SkyPoint &f)
sets the destination point of the sky map.
Definition skymap.cpp:1024
~SkyMap() override
Destructor (empty)
Definition skymap.cpp:312
void slotDisplayFadingText(const QString &text)
Render a fading text label on the screen to flash information.
Definition skymap.cpp:1433
SkyObject * clickedObject() const
Retrieve the object nearest to a mouse click event.
Definition skymap.h:244
SkyMap()
Constructor.
Definition skymap.cpp:209
void forceUpdateNow()
Convenience function; simply calls forceUpdate(true).
Definition skymap.h:386
bool isObjectLabeled(SkyObject *o)
Definition skymap.cpp:873
void slotZoomDefault()
Set default zoom.
Definition skymap.cpp:1202
void slotEditFlag(int flagIdx)
Open Flag Manager window with selected flag focused and ready to edit.
Definition skymap.cpp:831
void slotAddFlag()
Open Flag Manager window with clickedObject() RA and Dec entered.
Definition skymap.cpp:788
void slotImage()
Popup menu function: Show image of ClickedObject (only available for some objects).
Definition skymap.cpp:854
void destinationChanged()
Emitted by setDestination(), and connected to slewFocus().
void slotToggleFocusBox(bool)
Toggle visibility of focus infobox.
Definition skymap.cpp:296
void setDestinationAltAz(const dms &alt, const dms &az, bool altIsRefracted)
sets the destination point of the sky map, using its alt/az coordinates.
Definition skymap.cpp:1036
void slotAddFlagRaw()
Open Flag Manager window with RA and Dec entered.
Definition skymap.cpp:818
void setExtraFovRotation(double angle)
Sets the extra rotation applied to FOV symbols (before correction) to the given angle.
Definition skymap.cpp:1286
void slotStartXplanetViewer()
Run Xplanet Viewer to display images of the planets.
Definition skymap.cpp:1425
void slewFocus()
Step the Focus point toward the Destination point.
Definition skymap.cpp:1077
void updateFocus()
Update the focus position according to current options.
Definition skymap.cpp:1057
SkyPoint * clickedPoint()
Retrieve the ClickedPoint position.
Definition skymap.h:217
void removeSkyObject(SkyObject *object)
Emitted when a sky object is removed from the database.
void slotBeginAngularDistance()
Enables the angular distance measuring mode.
Definition skymap.cpp:640
void slotDeleteFlag(int flagIdx)
Delete selected flag.
Definition skymap.cpp:840
void slotZoomIn()
Zoom in one step.
Definition skymap.cpp:1192
void setFocusObject(SkyObject *o)
Set the FocusObject pointer to the argument.
Definition skymap.cpp:404
void slotInfo()
Popup menu function: Show webpage about ClickedObject (only available for some objects).
Definition skymap.cpp:864
void slotCenter()
Center the display at the point ClickedPoint.
Definition skymap.cpp:413
void setFocusPoint(SkyPoint *f)
set the FocusPoint; the position that is to be the next Destination.
Definition skymap.h:204
SkyObject * focusObject() const
Retrieve the object which is centered in the sky map.
Definition skymap.h:262
void slotRemoveCustomObject()
Remove custom object from internet search in the local catalog.
Definition skymap.cpp:892
void slotDetail()
Popup menu function: Show the Detailed Information window for ClickedObject.
Definition skymap.cpp:938
Provides all necessary information about an object in the sky: its coordinates, name(s),...
Definition skyobject.h:50
QString translatedLongName() const
Definition skyobject.h:190
float mag() const
Definition skyobject.h:236
The sky coordinates of a point in the sky.
Definition skypoint.h:45
static const double altCrit
Critical height for atmospheric refraction corrections.
Definition skypoint.h:746
const CachingDms & dec() const
Definition skypoint.h:269
const CachingDms & ra0() const
Definition skypoint.h:251
void setDec(dms d)
Sets Dec, the current Declination.
Definition skypoint.h:169
virtual void updateCoordsNow(const KSNumbers *num)
updateCoordsNow Shortcut for updateCoords( const KSNumbers *num, false, nullptr, nullptr,...
Definition skypoint.h:410
void setRA(dms &r)
Sets RA, the current Right Ascension.
Definition skypoint.h:144
const CachingDms & ra() const
Definition skypoint.h:263
dms altRefracted() const
void HorizontalToEquatorialNow()
Convenience method for Horizontal -> Equatorial at simulation time.
Definition skypoint.cpp:199
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
static double unrefract(const double alt, bool conditional=true)
Remove refraction correction, depending on conditional.
const dms & az() const
Definition skypoint.h:275
void set(const dms &r, const dms &d)
Sets RA, Dec and RA0, Dec0 according to arguments.
Definition skypoint.cpp:63
void setAlt(dms alt)
Sets Alt, the Altitude.
Definition skypoint.h:194
const dms & alt() const
Definition skypoint.h:281
void setAz(dms az)
Sets Az, the Azimuth.
Definition skypoint.h:230
const CachingDms & dec0() const
Definition skypoint.h:257
SkyPoint catalogueCoord(long double jdf)
Computes the J2000.0 catalogue coordinates for this SkyPoint using the epoch removing aberration,...
Definition skypoint.cpp:730
This is a subclass of SkyObject.
Definition starobject.h:33
double distance() const
Definition starobject.h:242
Implememntation of Stereographic projection
provides a SkyObject with an attachable Trail
Definition trailobject.h:22
bool hasTrail() const
Definition trailobject.h:36
void clearTrail()
clear the Trail
void addToTrail(const QString &label=QString())
adds a point to the planet's trail
This is just a container that holds information needed to do projections.
Definition projector.h:37
bool fillGround
If the ground is filled, then points below horizon are invisible.
Definition projector.h:44
XPlanet Image viewer window for KStars.
An angle, stored as degrees, but expressible in many ways.
Definition dms.h:38
double Hours() const
Definition dms.h:168
const dms reduce() const
return the equivalent angle between 0 and 360 degrees.
Definition dms.cpp:251
static constexpr double PI
PI is a const static member; it's public so that it can be used anywhere, as long as dms....
Definition dms.h:385
const QString toDMSString(const bool forceSign=false, const bool machineReadable=false, const bool highPrecision=false) const
Definition dms.cpp:287
double radians() const
Express the angle in radians.
Definition dms.h:325
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...)
ButtonCode warningContinueCancel(QWidget *parent, const QString &text, const QString &title=QString(), const KGuiItem &buttonContinue=KStandardGuiItem::cont(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Notify)
void error(QWidget *parent, const QString &text, const QString &title, const KGuiItem &buttonOk, Options options=Notify)
void start(QAbstractAnimation::DeletionPolicy policy)
void setHorizontalScrollBarPolicy(Qt::ScrollBarPolicy)
void setVerticalScrollBarPolicy(Qt::ScrollBarPolicy)
QWidget * viewport() const const
void setChecked(bool)
void setIcon(const QIcon &icon)
void setText(const QString &text)
void setText(const QString &text, Mode mode)
void setAlpha(int alpha)
QPoint pos()
bool openUrl(const QUrl &url)
QGraphicsView(QGraphicsScene *scene, QWidget *parent)
QClipboard * clipboard()
QIcon fromTheme(const QString &name)
double getDouble(QWidget *parent, const QString &title, const QString &label, double value, double min, double max, int decimals, bool *ok, Qt::WindowFlags flags, double step)
QString getItem(QWidget *parent, const QString &title, const QString &label, const QStringList &items, int current, bool editable, bool *ok, Qt::WindowFlags flags, Qt::InputMethodHints inputMethodHints)
void setAlignment(Qt::Alignment)
void setText(const QString &)
iterator insert(const Key &key, const T &value)
QList< Key > keys() const const
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
void deleteLater()
T qobject_cast(QObject *object)
QObject * sender() const const
bool begin(QPaintDevice *device)
void drawEllipse(const QPoint &center, int rx, int ry)
void drawLine(const QLine &line)
void drawPath(const QPainterPath &path)
void drawRect(const QRect &rectangle)
bool end()
void setPen(Qt::PenStyle style)
void arcTo(const QRectF &rectangle, qreal startAngle, qreal sweepLength)
QPointF currentPosition() const const
void lineTo(const QPointF &endPoint)
void moveTo(const QPointF &point)
void setColor(ColorGroup group, ColorRole role, const QColor &color)
QString arg(Args &&... args) const const
QString asprintf(const char *cformat,...)
QString number(double n, char format, int precision)
AlignCenter
ArrowCursor
StrongFocus
PinchGesture
ScrollBarAlwaysOff
WA_DeleteOnClose
void showText(const QPoint &pos, const QString &text, QWidget *w, const QRect &rect, int msecDisplayTime)
void setDuration(int msecs)
void setEndValue(const QVariant &value)
void setStartValue(const QVariant &value)
void adjustSize()
void setAutoFillBackground(bool enabled)
QPalette::ColorRole backgroundRole() const const
bool hasFocus() const const
void setFocusPolicy(Qt::FocusPolicy policy)
QPalette::ColorRole foregroundRole() const const
void grabGesture(Qt::GestureType gesture, Qt::GestureFlags flags)
QPoint mapFromGlobal(const QPoint &pos) const const
QRegion mask() const const
void setMinimumSize(const QSize &)
void setMouseTracking(bool enable)
void move(const QPoint &)
void setAttribute(Qt::WidgetAttribute attribute, bool on)
void setFocus()
void setGraphicsEffect(QGraphicsEffect *effect)
void show()
void setSizePolicy(QSizePolicy)
void setStyleSheet(const QString &styleSheet)
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Apr 18 2025 12:01:35 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.