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
785void SkyMap::slotEditFlag(int flagIdx)
786{
787 KStars *ks = KStars::Instance();
788
789 // popup FlagManager window and switch to selected flag
790 ks->slotFlagManager();
791 ks->flagManager()->showFlag(flagIdx);
792}
793
794void SkyMap::slotDeleteFlag(int flagIdx)
795{
796 KStars *ks = KStars::Instance();
797
798 ks->data()->skyComposite()->flags()->remove(flagIdx);
799 ks->data()->skyComposite()->flags()->saveToFile();
800
801 // if there is FlagManager created, update its flag model
802 if (ks->flagManager())
803 {
804 ks->flagManager()->deleteFlagItem(flagIdx);
805 }
806}
807
809{
810 const auto *action = qobject_cast<QAction *>(sender());
811 const auto url = action->data().toUrl();
812 const QString message{ action->text().remove('&') };
813
814 if (!url.isEmpty())
815 new ImageViewer(url, clickedObject()->messageFromTitle(message), this);
816}
817
819{
820 const auto *action = qobject_cast<QAction *>(sender());
821 const auto url = action->data().toUrl();
822
823 if (!url.isEmpty())
825}
826
828{
829 return data->skyComposite()->labelObjects().contains(object);
830}
831
832SkyPoint SkyMap::getCenterPoint()
833{
834 SkyPoint retVal;
835 // FIXME: subtraction of these 0.00001 is a simple workaround, because wrong
836 // SkyPoint is returned when _exact_ center of SkyMap is passed to the projector.
837 retVal = projector()->fromScreen(QPointF((qreal)width() / 2 - 0.00001, (qreal)height() / 2 - 0.00001), data->lst(),
838 data->geo()->lat());
839 return retVal;
840}
841
843{
844 data->skyComposite()->removeNameLabel(clickedObject());
845 forceUpdate();
846}
847
849{
850 auto *object = dynamic_cast<CatalogObject *>(clickedObject());
851 if (!object)
852 return;
853
854 const auto &cat = object->getCatalog();
855 if (!cat.mut)
856 return;
857
858 CatalogsDB::DBManager manager{ CatalogsDB::dso_db_path() };
859 manager.remove_object(cat.id, object->getObjectId());
860
861 emit removeSkyObject(object);
862 data->skyComposite()->removeFromNames(object);
863 data->skyComposite()->removeFromLists(object);
864 data->skyComposite()->reloadDeepSky();
866}
867
869{
870 data->skyComposite()->addNameLabel(clickedObject());
871 forceUpdate();
872}
873
875{
876 TrailObject *tobj = dynamic_cast<TrailObject *>(clickedObject());
877 if (tobj)
878 {
879 tobj->clearTrail();
880 forceUpdate();
881 }
882}
883
885{
886 TrailObject *tobj = dynamic_cast<TrailObject *>(clickedObject());
887 if (tobj)
888 {
889 tobj->addToTrail();
890 forceUpdate();
891 }
892}
893
895{
896 // check if object is selected
897 if (!clickedObject())
898 {
899 KMessageBox::error(this, i18n("No object selected."), i18n("Object Details"));
900 return;
901 }
902 DetailDialog *detail = new DetailDialog(clickedObject(), data->ut(), data->geo(), KStars::Instance());
904 detail->show();
905}
906
908{
909 if (m_objPointingMode && KStars::Instance()->printingWizard())
910 {
911 KStars::Instance()->printingWizard()->pointingDone(clickedObject());
912 m_objPointingMode = false;
913 }
914}
915
916void SkyMap::slotCancelLegendPreviewMode()
917{
918 m_previewLegend = false;
919 forceUpdate(true);
920 KStars::Instance()->showImgExportDialog();
921}
922
923void SkyMap::slotFinishFovCaptureMode()
924{
925 if (m_fovCaptureMode && KStars::Instance()->printingWizard())
926 {
927 KStars::Instance()->printingWizard()->fovCaptureDone();
928 m_fovCaptureMode = false;
929 }
930}
931
932void SkyMap::slotCaptureFov()
933{
934 if (KStars::Instance()->printingWizard())
935 {
936 KStars::Instance()->printingWizard()->captureFov();
937 }
938}
939
941{
942 //If the current timescale exceeds slewTimeScale, set clockSlewing=true, and stop the clock.
943 if ((fabs(data->clock()->scale()) > Options::slewTimeScale()) ^ clockSlewing)
944 {
945 data->clock()->setManualMode(!clockSlewing);
946 clockSlewing = !clockSlewing;
947 // don't change automatically the DST status
948 KStars *kstars = KStars::Instance();
949 if (kstars)
950 kstars->updateTime(false);
951 }
952}
953
954void SkyMap::setFocus(SkyPoint *p)
955{
956 setFocus(p->ra(), p->dec());
957}
958
959void SkyMap::setFocus(const dms &ra, const dms &dec)
960{
961 Options::setFocusRA(ra.Hours());
962 Options::setFocusDec(dec.Degrees());
963
964 focus()->set(ra, dec);
965 focus()->EquatorialToHorizontal(data->lst(), data->geo()->lat());
966}
967
968void SkyMap::setFocusAltAz(const dms &alt, const dms &az)
969{
970 Options::setFocusRA(focus()->ra().Hours());
971 Options::setFocusDec(focus()->dec().Degrees());
972 focus()->setAlt(alt);
973 focus()->setAz(az);
974 focus()->HorizontalToEquatorial(data->lst(), data->geo()->lat());
975
976 slewing = false;
977 forceUpdate(); //need a total update, or slewing with the arrow keys doesn't work.
978}
979
980void SkyMap::setDestination(const SkyPoint &p)
981{
982 setDestination(p.ra(), p.dec());
983}
984
985void SkyMap::setDestination(const dms &ra, const dms &dec)
986{
987 destination()->set(ra, dec);
988 destination()->EquatorialToHorizontal(data->lst(), data->geo()->lat());
989 emit destinationChanged();
990}
991
992void SkyMap::setDestinationAltAz(const dms &alt, const dms &az, bool altIsRefracted)
993{
994 if (altIsRefracted)
995 {
996 // The alt in the SkyPoint is always actual, not apparent
997 destination()->setAlt(SkyPoint::unrefract(alt));
998 }
999 else
1000 {
1001 destination()->setAlt(alt);
1002 }
1003 destination()->setAz(az);
1004 destination()->HorizontalToEquatorial(data->lst(), data->geo()->lat());
1005 emit destinationChanged();
1006}
1007
1008void SkyMap::setClickedPoint(const SkyPoint *f)
1009{
1010 ClickedPoint = *f;
1011}
1012
1014{
1015 if (slewing)
1016 return;
1017
1018 //Tracking on an object
1019 if (Options::isTracking())
1020 {
1021 if (focusObject())
1022 {
1023 focusObject()->updateCoordsNow(data->updateNum());
1025 }
1026 else
1028 }
1029 else
1030 focus()->HorizontalToEquatorial(data->lst(), data->geo()->lat());
1031}
1032
1034{
1035 //Don't slew if the mouse button is pressed
1036 //Also, no animated slews if the Manual Clock is active
1037 //08/2002: added possibility for one-time skipping of slew with snapNextFocus
1038 if (!mouseButtonDown)
1039 {
1040 bool goSlew = (Options::useAnimatedSlewing() && !data->snapNextFocus()) &&
1041 !(data->clock()->isManualMode() && data->clock()->isActive());
1042 if (goSlew)
1043 {
1044 double dX, dY;
1045 double maxstep = 10.0;
1046 if (Options::useAltAz())
1047 {
1048 dX = destination()->az().Degrees() - focus()->az().Degrees();
1049 dY = destination()->alt().Degrees() - focus()->alt().Degrees();
1050 }
1051 else
1052 {
1053 dX = destination()->ra().Degrees() - focus()->ra().Degrees();
1054 dY = destination()->dec().Degrees() - focus()->dec().Degrees();
1055 }
1056
1057 //switch directions to go the short way around the celestial sphere, if necessary.
1058 dX = KSUtils::reduceAngle(dX, -180.0, 180.0);
1059
1060 double r0 = sqrt(dX * dX + dY * dY);
1061 if (r0 < 20.0) //smaller slews have smaller maxstep
1062 {
1063 maxstep *= (10.0 + 0.5 * r0) / 20.0;
1064 }
1065 double step = 0.5;
1066 double r = r0;
1067 while (r > step)
1068 {
1069 //DEBUG
1070 //qDebug() << Q_FUNC_INFO << step << ": " << r << ": " << r0;
1071 double fX = dX / r;
1072 double fY = dY / r;
1073
1074 if (Options::useAltAz())
1075 {
1076 focus()->setAlt(focus()->alt().Degrees() + fY * step);
1077 focus()->setAz(dms(focus()->az().Degrees() + fX * step).reduce());
1078 focus()->HorizontalToEquatorial(data->lst(), data->geo()->lat());
1079 }
1080 else
1081 {
1082 fX = fX / 15.; //convert RA degrees to hours
1083 SkyPoint newFocus(focus()->ra().Hours() + fX * step, focus()->dec().Degrees() + fY * step);
1084 setFocus(&newFocus);
1085 focus()->EquatorialToHorizontal(data->lst(), data->geo()->lat());
1086 }
1087
1088 slewing = true;
1089
1090 forceUpdate();
1091 qApp->processEvents(); //keep up with other stuff
1092
1093 if (Options::useAltAz())
1094 {
1095 dX = destination()->az().Degrees() - focus()->az().Degrees();
1096 dY = destination()->alt().Degrees() - focus()->alt().Degrees();
1097 }
1098 else
1099 {
1100 dX = destination()->ra().Degrees() - focus()->ra().Degrees();
1101 dY = destination()->dec().Degrees() - focus()->dec().Degrees();
1102 }
1103
1104 //switch directions to go the short way around the celestial sphere, if necessary.
1105 dX = KSUtils::reduceAngle(dX, -180.0, 180.0);
1106 r = sqrt(dX * dX + dY * dY);
1107
1108 //Modify step according to a cosine-shaped profile
1109 //centered on the midpoint of the slew
1110 //NOTE: don't allow the full range from -PI/2 to PI/2
1111 //because the slew will never reach the destination as
1112 //the speed approaches zero at the end!
1113 double t = dms::PI * (r - 0.5 * r0) / (1.05 * r0);
1114 step = cos(t) * maxstep;
1115 }
1116 }
1117
1118 //Either useAnimatedSlewing==false, or we have slewed, and are within one step of destination
1119 //set focus=destination.
1120 if (Options::useAltAz())
1121 {
1122 setFocusAltAz(destination()->alt(), destination()->az());
1123 focus()->HorizontalToEquatorial(data->lst(), data->geo()->lat());
1124 }
1125 else
1126 {
1128 focus()->EquatorialToHorizontal(data->lst(), data->geo()->lat());
1129 }
1130
1131 slewing = false;
1132
1133 //Turn off snapNextFocus, we only want it to happen once
1134 if (data->snapNextFocus())
1135 {
1136 data->setSnapNextFocus(false);
1137 }
1138
1139 //Start the HoverTimer. if the user leaves the mouse in place after a slew,
1140 //we want to attach a label to the nearest object.
1141 if (Options::useHoverLabel())
1142 m_HoverTimer.start(HOVER_INTERVAL);
1143
1144 forceUpdate();
1145 }
1146}
1147
1149{
1150 setZoomFactor(Options::zoomFactor() * DZOOM);
1151}
1152
1154{
1155 setZoomFactor(Options::zoomFactor() / DZOOM);
1156}
1157
1159{
1160 setZoomFactor(DEFAULTZOOM);
1161}
1162
1163void SkyMap::setZoomFactor(double factor)
1164{
1165 Options::setZoomFactor(KSUtils::clamp(factor, MINZOOM, MAXZOOM));
1166 forceUpdate();
1167 emit zoomChanged();
1168}
1169
1170// force a new calculation of the skymap (used instead of update(), which may skip the redraw)
1171// if now=true, SkyMap::paintEvent() is run immediately, rather than being added to the event queue
1172// also, determine new coordinates of mouse cursor.
1174{
1176 if (!projector()->unusablePoint(mp))
1177 {
1178 //determine RA, Dec of mouse pointer
1179 m_MousePoint = projector()->fromScreen(mp, data->lst(), data->geo()->lat());
1180 }
1181
1182 computeSkymap = true;
1183
1184 // Ensure that stars are recomputed
1185 data->incUpdateID();
1186
1187 if (now)
1188 m_SkyMapDraw->repaint();
1189 else
1190 m_SkyMapDraw->update();
1191}
1192
1194{
1195 float diagonalPixels = sqrt(static_cast<double>(width() * width() + height() * height()));
1196 return diagonalPixels / (2 * Options::zoomFactor() * dms::DegToRad);
1197}
1198
1199dms SkyMap::determineSkyRotation()
1200{
1201 // Note: The erect observer correction accounts for the fact that
1202 // an observer remains erect despite the tube of an
1203 // Altazmith-mounted Newtonian moving up and down, so an
1204 // additional rotation of altitude applies to match the
1205 // orientation of the field. This would not apply to a CCD camera
1206 // plugged into the same telescope, since the CCD would rotate as
1207 // seen from the ground when the telescope moves in altitude.
1208
1209 double erectObserverCorrection = 0.;
1210 if (Options::useAltAz() && Options::erectObserverCorrection() > 0)
1211 {
1212 erectObserverCorrection = (Options::erectObserverCorrection() == 1) ? focus()->alt().Degrees() : -focus()->alt().Degrees();
1213 }
1214
1215 return dms(Options::skyRotation() + erectObserverCorrection);
1216}
1217
1219{
1220 angle = dms(angle).reduce().Degrees();
1221 Options::setSkyRotation(angle);
1222 KStars *kstars = KStars::Instance();
1223 if (kstars)
1224 {
1225 if (angle == 0.)
1226 {
1227 kstars->actionCollection()->action("up_orientation")->setChecked(true);
1228 }
1229 else if (angle == 180.)
1230 {
1231 kstars->actionCollection()->action("down_orientation")->setChecked(true);
1232 }
1233 else
1234 {
1235 kstars->actionCollection()->action("arbitrary_orientation")->setChecked(true);
1236 }
1237 kstars->actionCollection()->action("view:arbitrary")->setChecked(true);
1238 }
1239 forceUpdate();
1240}
1241
1243{
1244 //Update View Parameters for projection
1245 ViewParams p;
1246 p.focus = focus();
1247 p.height = height();
1248 p.width = width();
1249 p.useAltAz = Options::useAltAz();
1250 p.useRefraction = Options::useRefraction();
1251 p.zoomFactor = Options::zoomFactor();
1252 p.rotationAngle = determineSkyRotation();
1253 p.mirror = Options::mirrorSkyMap();
1254 p.fillGround = Options::showGround();
1255 //Check if we need a new projector
1256 if (m_proj && Options::projection() == m_proj->type())
1257 m_proj->setViewParams(p);
1258 else
1259 {
1260 delete m_proj;
1261 switch (Options::projection())
1262 {
1263 case Gnomonic:
1264 m_proj = new GnomonicProjector(p);
1265 break;
1266 case Stereographic:
1267 m_proj = new StereographicProjector(p);
1268 break;
1269 case Orthographic:
1270 m_proj = new OrthographicProjector(p);
1271 break;
1272 case AzimuthalEquidistant:
1273 m_proj = new AzimuthalEquidistantProjector(p);
1274 break;
1275 case Equirectangular:
1276 m_proj = new EquirectangularProjector(p);
1277 break;
1278 case Lambert:
1279 default:
1280 //TODO: implement other projection classes
1281 m_proj = new LambertProjector(p);
1282 break;
1283 }
1284 }
1285}
1286
1287void SkyMap::setZoomMouseCursor()
1288{
1289 mouseMoveCursor = false; // no mousemove cursor
1290 mouseDragCursor = false;
1291 QBitmap cursor = zoomCursorBitmap(2);
1292 QBitmap mask = zoomCursorBitmap(4);
1294}
1295
1296void SkyMap::setRotationMouseCursor()
1297{
1298 mouseMoveCursor = false;
1299 mouseDragCursor = false;
1300 QBitmap cursor = rotationCursorBitmap(2);
1301 QBitmap mask = rotationCursorBitmap(4);
1303}
1304
1306{
1307 // no mousemove cursor
1308 mouseMoveCursor = false;
1309 mouseDragCursor = false;
1310
1311 switch (type)
1312 {
1313 case Cross:
1314 {
1315 QBitmap cursor = defaultCursorBitmap(2);
1316 QBitmap mask = defaultCursorBitmap(3);
1318 }
1319 break;
1320
1321 case Circle:
1322 {
1323 QBitmap cursor = circleCursorBitmap(2);
1324 QBitmap mask = circleCursorBitmap(3);
1326 }
1327 break;
1328
1329 case NoCursor:
1331 break;
1332 }
1333}
1334
1335void SkyMap::setMouseMoveCursor()
1336{
1337 if (mouseButtonDown)
1338 {
1339 setCursor(Qt::SizeAllCursor); // cursor shape defined in qt
1340 mouseMoveCursor = true;
1341 }
1342}
1343
1344void SkyMap::setMouseDragCursor()
1345{
1346 if (mouseButtonDown)
1347 {
1348 setCursor(Qt::OpenHandCursor); // cursor shape defined in qt
1349 mouseDragCursor = true;
1350 }
1351}
1352
1354{
1355 if (rulerMode && (!pmenu || !pmenu->isVisible()))
1356 AngularRuler.setPoint(1, &m_MousePoint);
1357 AngularRuler.update(data);
1358}
1359
1360bool SkyMap::isSlewing() const
1361{
1362 return (slewing || (clockSlewing && data->clock()->isActive()));
1363}
1364
1366{
1367 if(clickedObject())
1368 new XPlanetImageViewer(clickedObject()->name(), this);
1369 else
1370 new XPlanetImageViewer(i18n("Saturn"), this);
1371}
1372
1374{
1375 QLabel *fadingLabel = new QLabel(this);
1376 fadingLabel->setText(text);
1377 QFont font = fadingLabel->font();
1378 QPalette palette = fadingLabel->palette();
1379 font.setPointSize(32);
1380 palette.setColor(fadingLabel->foregroundRole(), KStarsData::Instance()->colorScheme()->colorNamed("BoxTextColor"));
1381 QColor backgroundColor = KStarsData::Instance()->colorScheme()->colorNamed("BoxBGColor");
1382 backgroundColor.setAlpha(192);
1383 palette.setColor(fadingLabel->backgroundRole(), backgroundColor);
1384 fadingLabel->setFont(font);
1385 fadingLabel->setAutoFillBackground(true);
1386 fadingLabel->setPalette(palette);
1387 fadingLabel->setAlignment(Qt::AlignCenter);
1388 fadingLabel->adjustSize();
1389 fadingLabel->move(QPoint((width() - fadingLabel->width()) / 2, (0.75 * height() - fadingLabel->height() / 2)));
1390 QGraphicsOpacityEffect* fadingEffect = new QGraphicsOpacityEffect(fadingLabel);
1391 fadingLabel->setGraphicsEffect(fadingEffect);
1392 fadingLabel->show();
1393
1394 QPropertyAnimation* animation = new QPropertyAnimation(fadingEffect, "opacity", fadingLabel);
1395 animation->setDuration(1500);
1396 animation->setStartValue(1.0);
1397 animation->setEndValue(0.0);
1398 connect(animation, &QPropertyAnimation::finished, fadingLabel, &QLabel::deleteLater);
1399 animation->start();
1400}
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:1163
void zoomChanged()
Emitted when zoom level is changed.
void setMouseCursorShape(Cursor type)
Sets the shape of the default mouse cursor.
Definition skymap.cpp:1305
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:1242
void slotObjectSelected()
Object pointing for Printing Wizard done.
Definition skymap.cpp:907
float fov()
Definition skymap.cpp:1193
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:1008
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:884
void slotAddObjectLabel()
Add ClickedObject to KStarsData::ObjLabelList, which stores pointers to SkyObjects which have User La...
Definition skymap.cpp:868
void slotUpdateSky(bool now)
Update the focus point and call forceUpdate()
Definition skymap.cpp:458
void slotZoomOut()
Zoom out one step.
Definition skymap.cpp:1153
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:842
void slotClockSlewing()
Checks whether the timestep exceeds a threshold value.
Definition skymap.cpp:940
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:1173
SkyPoint * destination()
retrieve the Destination position.
Definition skymap.h:135
void slotRemovePlanetTrail()
Remove the PlanetTrail from ClickedObject.
Definition skymap.cpp:874
void setFocusAltAz(const dms &alt, const dms &az)
sets the focus point of the sky map, using its alt/az coordinates
Definition skymap.cpp:968
void mousePointChanged(SkyPoint *)
Emitted when position under mouse changed.
void updateAngleRuler()
update the geometry of the angle ruler.
Definition skymap.cpp:1353
void slotSetSkyRotation(double angle)
Sets the base sky rotation (before correction) to the given angle.
Definition skymap.cpp:1218
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:980
~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:1373
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:827
void slotZoomDefault()
Set default zoom.
Definition skymap.cpp:1158
void slotEditFlag(int flagIdx)
Open Flag Manager window with selected flag focused and ready to edit.
Definition skymap.cpp:785
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:808
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:992
void slotStartXplanetViewer()
Run Xplanet Viewer to display images of the planets.
Definition skymap.cpp:1365
void slewFocus()
Step the Focus point toward the Destination point.
Definition skymap.cpp:1033
void updateFocus()
Update the focus position according to current options.
Definition skymap.cpp:1013
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:794
void slotZoomIn()
Zoom in one step.
Definition skymap.cpp:1148
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:818
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:848
void slotDetail()
Popup menu function: Show the Detailed Information window for ClickedObject.
Definition skymap.cpp:894
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
virtual void updateCoordsNow(const KSNumbers *num)
updateCoordsNow Shortcut for updateCoords( const KSNumbers *num, false, nullptr, nullptr,...
Definition skypoint.h:391
const CachingDms & ra() const
Definition skypoint.h:263
static double unrefract(const double alt, bool conditional=true)
Remove refraction correction, depending on conditional.
const dms & az() const
Definition skypoint.h:275
const dms & alt() const
Definition skypoint.h:281
const CachingDms & dec0() const
Definition skypoint.h:257
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
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
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 Mon Nov 18 2024 12:16:41 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.