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 retVal = projector()->fromScreen(QPointF((qreal)width() / 2 - 0.00001, (qreal)height() / 2 - 0.00001), data->lst(),
851 data->geo()->lat());
852 return retVal;
853}
854
856{
857 data->skyComposite()->removeNameLabel(clickedObject());
858 forceUpdate();
859}
860
862{
863 auto *object = dynamic_cast<CatalogObject *>(clickedObject());
864 if (!object)
865 return;
866
867 const auto &cat = object->getCatalog();
868 if (!cat.mut)
869 return;
870
871 CatalogsDB::DBManager manager{ CatalogsDB::dso_db_path() };
872 manager.remove_object(cat.id, object->getObjectId());
873
874 emit removeSkyObject(object);
875 data->skyComposite()->removeFromNames(object);
876 data->skyComposite()->removeFromLists(object);
877 data->skyComposite()->reloadDeepSky();
879}
880
882{
883 data->skyComposite()->addNameLabel(clickedObject());
884 forceUpdate();
885}
886
888{
889 TrailObject *tobj = dynamic_cast<TrailObject *>(clickedObject());
890 if (tobj)
891 {
892 tobj->clearTrail();
893 forceUpdate();
894 }
895}
896
898{
899 TrailObject *tobj = dynamic_cast<TrailObject *>(clickedObject());
900 if (tobj)
901 {
902 tobj->addToTrail();
903 forceUpdate();
904 }
905}
906
908{
909 // check if object is selected
910 if (!clickedObject())
911 {
912 KMessageBox::error(this, i18n("No object selected."), i18n("Object Details"));
913 return;
914 }
915 DetailDialog *detail = new DetailDialog(clickedObject(), data->ut(), data->geo(), KStars::Instance());
917 detail->show();
918}
919
921{
922 if (m_objPointingMode && KStars::Instance()->printingWizard())
923 {
924 KStars::Instance()->printingWizard()->pointingDone(clickedObject());
925 m_objPointingMode = false;
926 }
927}
928
929void SkyMap::slotCancelLegendPreviewMode()
930{
931 m_previewLegend = false;
932 forceUpdate(true);
933 KStars::Instance()->showImgExportDialog();
934}
935
936void SkyMap::slotFinishFovCaptureMode()
937{
938 if (m_fovCaptureMode && KStars::Instance()->printingWizard())
939 {
940 KStars::Instance()->printingWizard()->fovCaptureDone();
941 m_fovCaptureMode = false;
942 }
943}
944
945void SkyMap::slotCaptureFov()
946{
947 if (KStars::Instance()->printingWizard())
948 {
949 KStars::Instance()->printingWizard()->captureFov();
950 }
951}
952
954{
955 //If the current timescale exceeds slewTimeScale, set clockSlewing=true, and stop the clock.
956 if ((fabs(data->clock()->scale()) > Options::slewTimeScale()) ^ clockSlewing)
957 {
958 data->clock()->setManualMode(!clockSlewing);
959 clockSlewing = !clockSlewing;
960 // don't change automatically the DST status
961 KStars *kstars = KStars::Instance();
962 if (kstars)
963 kstars->updateTime(false);
964 }
965}
966
968{
969 setFocus(p->ra(), p->dec());
970}
971
972void SkyMap::setFocus(const dms &ra, const dms &dec)
973{
974 Options::setFocusRA(ra.Hours());
975 Options::setFocusDec(dec.Degrees());
976
977 focus()->set(ra, dec);
978 focus()->EquatorialToHorizontal(data->lst(), data->geo()->lat());
979}
980
981void SkyMap::setFocusAltAz(const dms &alt, const dms &az)
982{
983 Options::setFocusRA(focus()->ra().Hours());
984 Options::setFocusDec(focus()->dec().Degrees());
985 focus()->setAlt(alt);
986 focus()->setAz(az);
987 focus()->HorizontalToEquatorial(data->lst(), data->geo()->lat());
988
989 slewing = false;
990 forceUpdate(); //need a total update, or slewing with the arrow keys doesn't work.
991}
992
994{
995 setDestination(p.ra(), p.dec());
996}
997
998void SkyMap::setDestination(const dms &ra, const dms &dec)
999{
1000 destination()->set(ra, dec);
1001 destination()->EquatorialToHorizontal(data->lst(), data->geo()->lat());
1002 emit destinationChanged();
1003}
1004
1005void SkyMap::setDestinationAltAz(const dms &alt, const dms &az, bool altIsRefracted)
1006{
1007 if (altIsRefracted)
1008 {
1009 // The alt in the SkyPoint is always actual, not apparent
1011 }
1012 else
1013 {
1014 destination()->setAlt(alt);
1015 }
1016 destination()->setAz(az);
1017 destination()->HorizontalToEquatorial(data->lst(), data->geo()->lat());
1018 emit destinationChanged();
1019}
1020
1022{
1023 ClickedPoint = *f;
1024}
1025
1027{
1028 if (slewing)
1029 return;
1030
1031 //Tracking on an object
1032 if (Options::isTracking())
1033 {
1034 if (focusObject())
1035 {
1036 focusObject()->updateCoordsNow(data->updateNum());
1038 }
1039 else
1041 }
1042 else
1043 focus()->HorizontalToEquatorial(data->lst(), data->geo()->lat());
1044}
1045
1047{
1048 //Don't slew if the mouse button is pressed
1049 //Also, no animated slews if the Manual Clock is active
1050 //08/2002: added possibility for one-time skipping of slew with snapNextFocus
1051 if (!mouseButtonDown)
1052 {
1053 bool goSlew = (Options::useAnimatedSlewing() && !data->snapNextFocus()) &&
1054 !(data->clock()->isManualMode() && data->clock()->isActive());
1055 if (goSlew)
1056 {
1057 double dX, dY;
1058 double maxstep = 10.0;
1059 if (Options::useAltAz())
1060 {
1061 dX = destination()->az().Degrees() - focus()->az().Degrees();
1062 dY = destination()->alt().Degrees() - focus()->alt().Degrees();
1063 }
1064 else
1065 {
1066 dX = destination()->ra().Degrees() - focus()->ra().Degrees();
1067 dY = destination()->dec().Degrees() - focus()->dec().Degrees();
1068 }
1069
1070 //switch directions to go the short way around the celestial sphere, if necessary.
1071 dX = KSUtils::reduceAngle(dX, -180.0, 180.0);
1072
1073 double r0 = sqrt(dX * dX + dY * dY);
1074 if (r0 < 20.0) //smaller slews have smaller maxstep
1075 {
1076 maxstep *= (10.0 + 0.5 * r0) / 20.0;
1077 }
1078 double step = 0.5;
1079 double r = r0;
1080 while (r > step)
1081 {
1082 //DEBUG
1083 //qDebug() << Q_FUNC_INFO << step << ": " << r << ": " << r0;
1084 double fX = dX / r;
1085 double fY = dY / r;
1086
1087 if (Options::useAltAz())
1088 {
1089 focus()->setAlt(focus()->alt().Degrees() + fY * step);
1090 focus()->setAz(dms(focus()->az().Degrees() + fX * step).reduce());
1091 focus()->HorizontalToEquatorial(data->lst(), data->geo()->lat());
1092 }
1093 else
1094 {
1095 fX = fX / 15.; //convert RA degrees to hours
1096 SkyPoint newFocus(focus()->ra().Hours() + fX * step, focus()->dec().Degrees() + fY * step);
1097 setFocus(&newFocus);
1098 focus()->EquatorialToHorizontal(data->lst(), data->geo()->lat());
1099 }
1100
1101 slewing = true;
1102
1103 forceUpdate();
1104 qApp->processEvents(); //keep up with other stuff
1105
1106 if (Options::useAltAz())
1107 {
1108 dX = destination()->az().Degrees() - focus()->az().Degrees();
1109 dY = destination()->alt().Degrees() - focus()->alt().Degrees();
1110 }
1111 else
1112 {
1113 dX = destination()->ra().Degrees() - focus()->ra().Degrees();
1114 dY = destination()->dec().Degrees() - focus()->dec().Degrees();
1115 }
1116
1117 //switch directions to go the short way around the celestial sphere, if necessary.
1118 dX = KSUtils::reduceAngle(dX, -180.0, 180.0);
1119 r = sqrt(dX * dX + dY * dY);
1120
1121 //Modify step according to a cosine-shaped profile
1122 //centered on the midpoint of the slew
1123 //NOTE: don't allow the full range from -PI/2 to PI/2
1124 //because the slew will never reach the destination as
1125 //the speed approaches zero at the end!
1126 double t = dms::PI * (r - 0.5 * r0) / (1.05 * r0);
1127 step = cos(t) * maxstep;
1128 }
1129 }
1130
1131 //Either useAnimatedSlewing==false, or we have slewed, and are within one step of destination
1132 //set focus=destination.
1133 if (Options::useAltAz())
1134 {
1135 setFocusAltAz(destination()->alt(), destination()->az());
1136 focus()->HorizontalToEquatorial(data->lst(), data->geo()->lat());
1137 }
1138 else
1139 {
1141 focus()->EquatorialToHorizontal(data->lst(), data->geo()->lat());
1142 }
1143
1144 slewing = false;
1145
1146 //Turn off snapNextFocus, we only want it to happen once
1147 if (data->snapNextFocus())
1148 {
1149 data->setSnapNextFocus(false);
1150 }
1151
1152 //Start the HoverTimer. if the user leaves the mouse in place after a slew,
1153 //we want to attach a label to the nearest object.
1154 if (Options::useHoverLabel())
1155 m_HoverTimer.start(HOVER_INTERVAL);
1156
1157 forceUpdate();
1158 }
1159}
1160
1162{
1163 setZoomFactor(Options::zoomFactor() * DZOOM);
1164}
1165
1167{
1168 setZoomFactor(Options::zoomFactor() / DZOOM);
1169}
1170
1172{
1173 setZoomFactor(DEFAULTZOOM);
1174}
1175
1176void SkyMap::setZoomFactor(double factor)
1177{
1178 Options::setZoomFactor(KSUtils::clamp(factor, MINZOOM, MAXZOOM));
1179 forceUpdate();
1180 emit zoomChanged();
1181}
1182
1183// force a new calculation of the skymap (used instead of update(), which may skip the redraw)
1184// if now=true, SkyMap::paintEvent() is run immediately, rather than being added to the event queue
1185// also, determine new coordinates of mouse cursor.
1187{
1189 if (!projector()->unusablePoint(mp))
1190 {
1191 //determine RA, Dec of mouse pointer
1192 m_MousePoint = projector()->fromScreen(mp, data->lst(), data->geo()->lat());
1193 }
1194
1195 computeSkymap = true;
1196
1197 // Ensure that stars are recomputed
1198 data->incUpdateID();
1199
1200 if (now)
1201 m_SkyMapDraw->repaint();
1202 else
1203 m_SkyMapDraw->update();
1204}
1205
1207{
1208 float diagonalPixels = sqrt(static_cast<double>(width() * width() + height() * height()));
1209 return diagonalPixels / (2 * Options::zoomFactor() * dms::DegToRad);
1210}
1211
1212dms SkyMap::determineSkyRotation()
1213{
1214 // Note: The erect observer correction accounts for the fact that
1215 // an observer remains erect despite the tube of an
1216 // Altazmith-mounted Newtonian moving up and down, so an
1217 // additional rotation of altitude applies to match the
1218 // orientation of the field. This would not apply to a CCD camera
1219 // plugged into the same telescope, since the CCD would rotate as
1220 // seen from the ground when the telescope moves in altitude.
1221
1222 double erectObserverCorrection = 0.;
1223 if (Options::useAltAz() && Options::erectObserverCorrection() > 0)
1224 {
1225 erectObserverCorrection = (Options::erectObserverCorrection() == 1) ? focus()->alt().Degrees() : -focus()->alt().Degrees();
1226 }
1227
1228 return dms(Options::skyRotation() + erectObserverCorrection);
1229}
1230
1232{
1233 angle = dms(angle).reduce().Degrees();
1234 Options::setSkyRotation(angle);
1235 KStars *kstars = KStars::Instance();
1236 if (kstars)
1237 {
1238 if (angle == 0.)
1239 {
1240 kstars->actionCollection()->action("up_orientation")->setChecked(true);
1241 }
1242 else if (angle == 180.)
1243 {
1244 kstars->actionCollection()->action("down_orientation")->setChecked(true);
1245 }
1246 else
1247 {
1248 kstars->actionCollection()->action("arbitrary_orientation")->setChecked(true);
1249 }
1250 kstars->actionCollection()->action("view:arbitrary")->setChecked(true);
1251 }
1252 forceUpdate();
1253}
1254
1256{
1257 //Update View Parameters for projection
1258 ViewParams p;
1259 p.focus = focus();
1260 p.height = height();
1261 p.width = width();
1262 p.useAltAz = Options::useAltAz();
1263 p.useRefraction = Options::useRefraction();
1264 p.zoomFactor = Options::zoomFactor();
1265 p.rotationAngle = determineSkyRotation();
1266 p.mirror = Options::mirrorSkyMap();
1267 p.fillGround = Options::showGround();
1268 //Check if we need a new projector
1269 if (m_proj && Options::projection() == m_proj->type())
1270 m_proj->setViewParams(p);
1271 else
1272 {
1273 delete m_proj;
1274 switch (Options::projection())
1275 {
1276 case Gnomonic:
1277 m_proj = new GnomonicProjector(p);
1278 break;
1279 case Stereographic:
1280 m_proj = new StereographicProjector(p);
1281 break;
1282 case Orthographic:
1283 m_proj = new OrthographicProjector(p);
1284 break;
1285 case AzimuthalEquidistant:
1286 m_proj = new AzimuthalEquidistantProjector(p);
1287 break;
1288 case Equirectangular:
1289 m_proj = new EquirectangularProjector(p);
1290 break;
1291 case Lambert:
1292 default:
1293 //TODO: implement other projection classes
1294 m_proj = new LambertProjector(p);
1295 break;
1296 }
1297 }
1298}
1299
1300void SkyMap::setZoomMouseCursor()
1301{
1302 mouseMoveCursor = false; // no mousemove cursor
1303 mouseDragCursor = false;
1304 QBitmap cursor = zoomCursorBitmap(2);
1305 QBitmap mask = zoomCursorBitmap(4);
1307}
1308
1309void SkyMap::setRotationMouseCursor()
1310{
1311 mouseMoveCursor = false;
1312 mouseDragCursor = false;
1313 QBitmap cursor = rotationCursorBitmap(2);
1314 QBitmap mask = rotationCursorBitmap(4);
1316}
1317
1319{
1320 // no mousemove cursor
1321 mouseMoveCursor = false;
1322 mouseDragCursor = false;
1323
1324 switch (type)
1325 {
1326 case Cross:
1327 {
1328 QBitmap cursor = defaultCursorBitmap(2);
1329 QBitmap mask = defaultCursorBitmap(3);
1331 }
1332 break;
1333
1334 case Circle:
1335 {
1336 QBitmap cursor = circleCursorBitmap(2);
1337 QBitmap mask = circleCursorBitmap(3);
1339 }
1340 break;
1341
1342 case NoCursor:
1344 break;
1345 }
1346}
1347
1348void SkyMap::setMouseMoveCursor()
1349{
1350 if (mouseButtonDown)
1351 {
1352 setCursor(Qt::SizeAllCursor); // cursor shape defined in qt
1353 mouseMoveCursor = true;
1354 }
1355}
1356
1357void SkyMap::setMouseDragCursor()
1358{
1359 if (mouseButtonDown)
1360 {
1361 setCursor(Qt::OpenHandCursor); // cursor shape defined in qt
1362 mouseDragCursor = true;
1363 }
1364}
1365
1367{
1368 if (rulerMode && (!pmenu || !pmenu->isVisible()))
1369 AngularRuler.setPoint(1, &m_MousePoint);
1370 AngularRuler.update(data);
1371}
1372
1373bool SkyMap::isSlewing() const
1374{
1375 return (slewing || (clockSlewing && data->clock()->isActive()));
1376}
1377
1379{
1380 if(clickedObject())
1381 new XPlanetImageViewer(clickedObject()->name(), this);
1382 else
1383 new XPlanetImageViewer(i18n("Saturn"), this);
1384}
1385
1387{
1388 QLabel *fadingLabel = new QLabel(this);
1389 fadingLabel->setText(text);
1390 QFont font = fadingLabel->font();
1391 QPalette palette = fadingLabel->palette();
1392 font.setPointSize(32);
1393 palette.setColor(fadingLabel->foregroundRole(), KStarsData::Instance()->colorScheme()->colorNamed("BoxTextColor"));
1394 QColor backgroundColor = KStarsData::Instance()->colorScheme()->colorNamed("BoxBGColor");
1395 backgroundColor.setAlpha(192);
1396 palette.setColor(fadingLabel->backgroundRole(), backgroundColor);
1397 fadingLabel->setFont(font);
1398 fadingLabel->setAutoFillBackground(true);
1399 fadingLabel->setPalette(palette);
1400 fadingLabel->setAlignment(Qt::AlignCenter);
1401 fadingLabel->adjustSize();
1402 fadingLabel->move(QPoint((width() - fadingLabel->width()) / 2, (0.75 * height() - fadingLabel->height() / 2)));
1403 QGraphicsOpacityEffect* fadingEffect = new QGraphicsOpacityEffect(fadingLabel);
1404 fadingLabel->setGraphicsEffect(fadingEffect);
1405 fadingLabel->show();
1406
1407 QPropertyAnimation* animation = new QPropertyAnimation(fadingEffect, "opacity", fadingLabel);
1408 animation->setDuration(1500);
1409 animation->setStartValue(1.0);
1410 animation->setEndValue(0.0);
1411 connect(animation, &QPropertyAnimation::finished, fadingLabel, &QLabel::deleteLater);
1412 animation->start();
1413}
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`.
QColor colorNamed(const QString &name) const
Retrieve a color by name.
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.
const CachingDms * lat() const
Definition geolocation.h:70
Implememntation of Gnomonic projection
The InfoBoxWidget class is a widget that displays a transparent box for display of text messages.
bool shaded() const
Check whether box is shaded.
void adjust()
Adjust widget's position.
void slotObjectChanged(SkyObject *obj)
Set information about object.
void slotPointChanged(SkyPoint *p)
Set information about pointing.
int sticky() const
Get stickyness status of.
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.
long double julianDay() const
Definition ksnumbers.h:91
The KStars Popup Menu.
Definition kspopupmenu.h:35
KStarsData is the backbone of KStars.
Definition kstarsdata.h:74
CachingDms * lst()
Definition kstarsdata.h:226
bool snapNextFocus() const
Definition kstarsdata.h:270
ColorScheme * colorScheme()
Definition kstarsdata.h:174
const QList< FOV * > getAvailableFOVs() const
Definition kstarsdata.h:316
const KStarsDateTime & ut() const
Definition kstarsdata.h:159
Q_INVOKABLE SimClock * clock()
Definition kstarsdata.h:220
GeoLocation * geo()
Definition kstarsdata.h:232
SkyMapComposite * skyComposite()
Definition kstarsdata.h:168
void setSnapNextFocus(bool b=true)
Disable or re-enable the slewing animation for the next Focus change.
Definition kstarsdata.h:285
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, dms *LST, const dms *lat, bool onlyAltAz=false) const
Determine RA, Dec coordinates of the pixel at (dx, dy), which are the screen pixel coordinate offsets...
void setViewParams(const ViewParams &p)
Update cached values for projector.
Definition projector.cpp:46
virtual Q_INVOKABLE Projection type() const =0
Return the type of this projection.
Represents an artificial satellites.
Definition satellite.h:23
QString tle() const
double scale() const
Definition simclock.h:51
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
void setManualMode(bool on=true)
Sets Manual Mode on/off according to the bool argument.
Definition simclock.cpp:66
bool isManualMode() const
Manual Mode is a new (04/2002) addition to the SimClock.
Definition simclock.h:69
void setPoint(int i, SkyPoint *p)
Set point i in the SkyLine.
Definition skyline.cpp:30
void clear()
Remove all points from list.
Definition skyline.cpp:19
SkyPoint * point(int i) const
Definition skyline.h:44
void append(SkyPoint *p)
Append a segment to the list by adding a new endpoint.
Definition skyline.cpp:25
dms angularSize(int i=0) const
Definition skyline.cpp:40
SkyObject * objectNearest(SkyPoint *p, double &maxrad) override
This class draws the SkyMap using native QPainter.
Definition skymapqdraw.h:22
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:1176
void zoomChanged()
Emitted when zoom level is changed.
void setMouseCursorShape(Cursor type)
Sets the shape of the default mouse cursor.
Definition skymap.cpp:1318
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:1255
void slotObjectSelected()
Object pointing for Printing Wizard done.
Definition skymap.cpp:920
float fov()
Definition skymap.cpp:1206
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:1021
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:897
void slotAddObjectLabel()
Add ClickedObject to KStarsData::ObjLabelList, which stores pointers to SkyObjects which have User La...
Definition skymap.cpp:881
void slotUpdateSky(bool now)
Update the focus point and call forceUpdate()
Definition skymap.cpp:458
void slotZoomOut()
Zoom out one step.
Definition skymap.cpp:1166
void setClickedObject(SkyObject *o)
Set the ClickedObject pointer to the argument.
Definition skymap.cpp:366
void 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:855
void slotClockSlewing()
Checks whether the timestep exceeds a threshold value.
Definition skymap.cpp:953
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:1186
SkyPoint * destination()
retrieve the Destination position.
Definition skymap.h:135
void slotRemovePlanetTrail()
Remove the PlanetTrail from ClickedObject.
Definition skymap.cpp:887
void setFocusAltAz(const dms &alt, const dms &az)
sets the focus point of the sky map, using its alt/az coordinates
Definition skymap.cpp:981
void mousePointChanged(SkyPoint *)
Emitted when position under mouse changed.
void updateAngleRuler()
update the geometry of the angle ruler.
Definition skymap.cpp:1366
void slotSetSkyRotation(double angle)
Sets the base sky rotation (before correction) to the given angle.
Definition skymap.cpp:1231
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:993
~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:1386
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:1171
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:1005
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:1378
void slewFocus()
Step the Focus point toward the Destination point.
Definition skymap.cpp:1046
void updateFocus()
Update the focus position according to current options.
Definition skymap.cpp:1026
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:1161
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:861
void slotDetail()
Popup menu function: Show the Detailed Information window for ClickedObject.
Definition skymap.cpp:907
Provides all necessary information about an object in the sky: its coordinates, name(s),...
Definition skyobject.h:42
virtual QString name(void) const
Definition skyobject.h:146
QString translatedLongName() const
Definition skyobject.h:170
float mag() const
Definition skyobject.h:207
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:727
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:391
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 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 HorizontalToEquatorial(const dms *LST, const dms *lat)
Determine the (RA, Dec) coordinates of the SkyPoint from its (Altitude, Azimuth) coordinates,...
Definition skypoint.cpp:143
void setAz(dms az)
Sets Az, the Azimuth.
Definition skypoint.h:230
const CachingDms & dec0() const
Definition skypoint.h:257
SkyPoint catalogueCoord(long double jdf)
Computes the J2000.0 catalogue coordinates for this SkyPoint using the epoch removing aberration,...
Definition skypoint.cpp:710
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)
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 &)
bool contains(const AT &value) const const
T & first()
bool isEmpty() const const
qsizetype size() const const
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 setSingleShot(bool singleShot)
void start()
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)
bool isVisibleTo(const QWidget *ancestor) const const
QPoint mapFromGlobal(const QPoint &pos) const const
QRegion mask() const const
void setMinimumSize(const QSize &)
void setMouseTracking(bool enable)
void repaint()
void setAttribute(Qt::WidgetAttribute attribute, bool on)
void setFocus()
void setGraphicsEffect(QGraphicsEffect *effect)
void setParent(QWidget *parent)
void show()
void setSizePolicy(QSizePolicy)
void setStyleSheet(const QString &styleSheet)
void update()
virtual void setVisible(bool visible)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:04:47 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.