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

KDE's Doxygen guidelines are available online.