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() &&
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::warningYesNo(this, message, caption, KGuiItem(i18n("Go Anyway")),
407 KGuiItem(i18n("Keep Position")), "dag_focus_below_horiz") == KMessageBox::No)
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
612{
613 beginRulerMode(false);
614}
615
616void SkyMap::slotBeginStarHop()
617{
618 beginRulerMode(true);
619}
620
621void SkyMap::beginRulerMode(bool starHopRuler)
622{
623 rulerMode = true;
624 starHopDefineMode = starHopRuler;
625 AngularRuler.clear();
626
627 //If the cursor is near a SkyObject, reset the AngularRuler's
628 //start point to the position of the SkyObject
629 double maxrad = 1000.0 / Options::zoomFactor();
630 SkyObject *so = data->skyComposite()->objectNearest(clickedPoint(), maxrad);
631 if (so)
632 {
633 AngularRuler.append(so);
634 AngularRuler.append(so);
635 m_rulerStartPoint = so;
636 }
637 else
638 {
639 AngularRuler.append(clickedPoint());
640 AngularRuler.append(clickedPoint());
641 m_rulerStartPoint = clickedPoint();
642 }
643
644 AngularRuler.update(data);
645}
646
648{
649 if (!rulerMode)
650 return;
651 if (!starHopDefineMode) // Angular Ruler
652 {
653 QString sbMessage;
654
655 //If the cursor is near a SkyObject, reset the AngularRuler's
656 //end point to the position of the SkyObject
657 double maxrad = 1000.0 / Options::zoomFactor();
658 SkyPoint *rulerEndPoint;
659 SkyObject *so = data->skyComposite()->objectNearest(clickedPoint(), maxrad);
660 if (so)
661 {
662 AngularRuler.setPoint(1, so);
663 sbMessage = so->translatedLongName() + " ";
664 rulerEndPoint = so;
665 }
666 else
667 {
668 AngularRuler.setPoint(1, clickedPoint());
669 rulerEndPoint = clickedPoint();
670 }
671
672 rulerMode = false;
673 AngularRuler.update(data);
674 dms angularDistance = AngularRuler.angularSize();
675
676 sbMessage += i18n("Angular distance: %1", angularDistance.toDMSString());
677
678 const StarObject *p1 = dynamic_cast<const StarObject *>(m_rulerStartPoint);
679 const StarObject *p2 = dynamic_cast<const StarObject *>(rulerEndPoint);
680
681 qCDebug(KSTARS) << "Starobjects? " << p1 << p2;
682 if (p1 && p2)
683 qCDebug(KSTARS) << "Distances: " << p1->distance() << "pc; " << p2->distance() << "pc";
684 if (p1 && p2 && std::isfinite(p1->distance()) && std::isfinite(p2->distance()) && p1->distance() > 0 &&
685 p2->distance() > 0)
686 {
687 double dist = sqrt(p1->distance() * p1->distance() + p2->distance() * p2->distance() -
688 2 * p1->distance() * p2->distance() * cos(angularDistance.radians()));
689 qCDebug(KSTARS) << "Could calculate physical distance: " << dist << " pc";
690 sbMessage += i18n("; Physical distance: %1 pc", QString::number(dist));
691 }
692
693 AngularRuler.clear();
694
695 // Create unobsructive message box with suicidal tendencies
696 // to display result.
697 InfoBoxWidget *box = new InfoBoxWidget(true, mapFromGlobal(QCursor::pos()), 0, QStringList(sbMessage), this);
698 connect(box, SIGNAL(clicked()), box, SLOT(deleteLater()));
699 QTimer::singleShot(5000, box, SLOT(deleteLater()));
700 box->adjust();
701 box->show();
702 }
703 else // Star Hop
704 {
705 StarHopperDialog *shd = new StarHopperDialog(this);
706 const SkyPoint &startHop = *AngularRuler.point(0);
707 const SkyPoint &stopHop = *clickedPoint();
708 double fov; // Field of view in arcminutes
709 bool ok; // true if user did not cancel the operation
710 if (data->getAvailableFOVs().size() == 1)
711 {
712 // Exactly 1 FOV symbol visible, so use that. Also assume a circular FOV of size min{sizeX, sizeY}
713 FOV *f = data->getAvailableFOVs().first();
714 fov = ((f->sizeX() >= f->sizeY() && f->sizeY() != 0) ? f->sizeY() : f->sizeX());
715 ok = true;
716 }
717 else if (!data->getAvailableFOVs().isEmpty())
718 {
719 // Ask the user to choose from a list of available FOVs.
720 FOV const *f;
721 QMap<QString, double> nameToFovMap;
722 foreach (f, data->getAvailableFOVs())
723 {
724 nameToFovMap.insert(f->name(),
725 ((f->sizeX() >= f->sizeY() && f->sizeY() != 0) ? f->sizeY() : f->sizeX()));
726 }
727 fov = nameToFovMap[QInputDialog::getItem(this, i18n("Star Hopper: Choose a field-of-view"),
728 i18n("FOV to use for star hopping:"), nameToFovMap.keys(), 0,
729 false, &ok)];
730 }
731 else
732 {
733 // Ask the user to enter a field of view
734 fov =
735 QInputDialog::getDouble(this, i18n("Star Hopper: Enter field-of-view to use"),
736 i18n("FOV to use for star hopping (in arcminutes):"), 60.0, 1.0, 600.0, 1, &ok);
737 }
738
739 Q_ASSERT(fov > 0.0);
740
741 if (ok)
742 {
743 qCDebug(KSTARS) << "fov = " << fov;
744
745 shd->starHop(startHop, stopHop, fov / 60.0, 9.0); //FIXME: Hardcoded maglimit value
746 shd->show();
747 }
748
749 rulerMode = false;
750 }
751}
752
754{
755 rulerMode = false;
756 AngularRuler.clear();
757}
758
760{
761 KStars *ks = KStars::Instance();
762
763 // popup FlagManager window and update coordinates
764 ks->slotFlagManager();
765 ks->flagManager()->clearFields();
766
767 //ra and dec must be the coordinates at J2000. If we clicked on an object, just use the object's ra0, dec0 coords
768 //if we clicked on empty sky, we need to precess to J2000.
769
770 dms J2000RA, J2000DE;
771
772 if (clickedObject())
773 {
774 J2000RA = clickedObject()->ra0();
775 J2000DE = clickedObject()->dec0();
776 }
777 else
778 {
779 //SkyPoint deprecessedPoint = clickedPoint()->deprecess(data->updateNum());
780 SkyPoint deprecessedPoint = clickedPoint()->catalogueCoord(data->updateNum()->julianDay());
781 deprecessedPoint.catalogueCoord(data->updateNum()->julianDay());
782 J2000RA = deprecessedPoint.ra();
783 J2000DE = deprecessedPoint.dec();
784 }
785
786 ks->flagManager()->setRaDec(J2000RA, J2000DE);
787}
788
789void SkyMap::slotEditFlag(int flagIdx)
790{
791 KStars *ks = KStars::Instance();
792
793 // popup FlagManager window and switch to selected flag
794 ks->slotFlagManager();
795 ks->flagManager()->showFlag(flagIdx);
796}
797
798void SkyMap::slotDeleteFlag(int flagIdx)
799{
800 KStars *ks = KStars::Instance();
801
802 ks->data()->skyComposite()->flags()->remove(flagIdx);
803 ks->data()->skyComposite()->flags()->saveToFile();
804
805 // if there is FlagManager created, update its flag model
806 if (ks->flagManager())
807 {
808 ks->flagManager()->deleteFlagItem(flagIdx);
809 }
810}
811
813{
814 const auto *action = qobject_cast<QAction *>(sender());
815 const auto url = action->data().toUrl();
816 const QString message{ action->text().remove('&') };
817
818 if (!url.isEmpty())
819 new ImageViewer(url, clickedObject()->messageFromTitle(message), this);
820}
821
823{
824 const auto *action = qobject_cast<QAction *>(sender());
825 const auto url = action->data().toUrl();
826
827 if (!url.isEmpty())
829}
830
832{
833 return data->skyComposite()->labelObjects().contains(object);
834}
835
836SkyPoint SkyMap::getCenterPoint()
837{
838 SkyPoint retVal;
839 // FIXME: subtraction of these 0.00001 is a simple workaround, because wrong
840 // SkyPoint is returned when _exact_ center of SkyMap is passed to the projector.
841 retVal = projector()->fromScreen(QPointF((qreal)width() / 2 - 0.00001, (qreal)height() / 2 - 0.00001), data->lst(),
842 data->geo()->lat());
843 return retVal;
844}
845
847{
848 data->skyComposite()->removeNameLabel(clickedObject());
849 forceUpdate();
850}
851
853{
854 auto *object = dynamic_cast<CatalogObject *>(clickedObject());
855 if (!object)
856 return;
857
858 const auto &cat = object->getCatalog();
859 if (!cat.mut)
860 return;
861
862 CatalogsDB::DBManager manager{ CatalogsDB::dso_db_path() };
863 manager.remove_object(cat.id, object->getObjectId());
864
865 emit removeSkyObject(object);
866 data->skyComposite()->removeFromNames(object);
867 data->skyComposite()->removeFromLists(object);
868 data->skyComposite()->reloadDeepSky();
870}
871
873{
874 data->skyComposite()->addNameLabel(clickedObject());
875 forceUpdate();
876}
877
879{
880 TrailObject *tobj = dynamic_cast<TrailObject *>(clickedObject());
881 if (tobj)
882 {
883 tobj->clearTrail();
884 forceUpdate();
885 }
886}
887
889{
890 TrailObject *tobj = dynamic_cast<TrailObject *>(clickedObject());
891 if (tobj)
892 {
893 tobj->addToTrail();
894 forceUpdate();
895 }
896}
897
899{
900 // check if object is selected
901 if (!clickedObject())
902 {
903 KMessageBox::sorry(this, i18n("No object selected."), i18n("Object Details"));
904 return;
905 }
906 DetailDialog *detail = new DetailDialog(clickedObject(), data->ut(), data->geo(), KStars::Instance());
908 detail->show();
909}
910
912{
913 if (m_objPointingMode && KStars::Instance()->printingWizard())
914 {
915 KStars::Instance()->printingWizard()->pointingDone(clickedObject());
916 m_objPointingMode = false;
917 }
918}
919
920void SkyMap::slotCancelLegendPreviewMode()
921{
922 m_previewLegend = false;
923 forceUpdate(true);
924 KStars::Instance()->showImgExportDialog();
925}
926
927void SkyMap::slotFinishFovCaptureMode()
928{
929 if (m_fovCaptureMode && KStars::Instance()->printingWizard())
930 {
931 KStars::Instance()->printingWizard()->fovCaptureDone();
932 m_fovCaptureMode = false;
933 }
934}
935
936void SkyMap::slotCaptureFov()
937{
938 if (KStars::Instance()->printingWizard())
939 {
940 KStars::Instance()->printingWizard()->captureFov();
941 }
942}
943
945{
946 //If the current timescale exceeds slewTimeScale, set clockSlewing=true, and stop the clock.
947 if ((fabs(data->clock()->scale()) > Options::slewTimeScale()) ^ clockSlewing)
948 {
949 data->clock()->setManualMode(!clockSlewing);
950 clockSlewing = !clockSlewing;
951 // don't change automatically the DST status
952 KStars *kstars = KStars::Instance();
953 if (kstars)
954 kstars->updateTime(false);
955 }
956}
957
959{
960 setFocus(p->ra(), p->dec());
961}
962
963void SkyMap::setFocus(const dms &ra, const dms &dec)
964{
965 Options::setFocusRA(ra.Hours());
966 Options::setFocusDec(dec.Degrees());
967
968 focus()->set(ra, dec);
969 focus()->EquatorialToHorizontal(data->lst(), data->geo()->lat());
970}
971
972void SkyMap::setFocusAltAz(const dms &alt, const dms &az)
973{
974 Options::setFocusRA(focus()->ra().Hours());
975 Options::setFocusDec(focus()->dec().Degrees());
976 focus()->setAlt(alt);
977 focus()->setAz(az);
978 focus()->HorizontalToEquatorial(data->lst(), data->geo()->lat());
979
980 slewing = false;
981 forceUpdate(); //need a total update, or slewing with the arrow keys doesn't work.
982}
983
985{
986 setDestination(p.ra(), p.dec());
987}
988
989void SkyMap::setDestination(const dms &ra, const dms &dec)
990{
991 destination()->set(ra, dec);
992 destination()->EquatorialToHorizontal(data->lst(), data->geo()->lat());
993 emit destinationChanged();
994}
995
996void SkyMap::setDestinationAltAz(const dms &alt, const dms &az, bool altIsRefracted)
997{
998 if (altIsRefracted)
999 {
1000 // The alt in the SkyPoint is always actual, not apparent
1002 }
1003 else
1004 {
1005 destination()->setAlt(alt);
1006 }
1007 destination()->setAz(az);
1008 destination()->HorizontalToEquatorial(data->lst(), data->geo()->lat());
1009 emit destinationChanged();
1010}
1011
1013{
1014 ClickedPoint = *f;
1015}
1016
1018{
1019 if (slewing)
1020 return;
1021
1022 //Tracking on an object
1023 if (Options::isTracking())
1024 {
1025 if (focusObject())
1026 {
1027 focusObject()->updateCoordsNow(data->updateNum());
1029 }
1030 else
1032 }
1033 else
1034 focus()->HorizontalToEquatorial(data->lst(), data->geo()->lat());
1035}
1036
1038{
1039 //Don't slew if the mouse button is pressed
1040 //Also, no animated slews if the Manual Clock is active
1041 //08/2002: added possibility for one-time skipping of slew with snapNextFocus
1042 if (!mouseButtonDown)
1043 {
1044 bool goSlew = (Options::useAnimatedSlewing() && !data->snapNextFocus()) &&
1045 !(data->clock()->isManualMode() && data->clock()->isActive());
1046 if (goSlew)
1047 {
1048 double dX, dY;
1049 double maxstep = 10.0;
1050 if (Options::useAltAz())
1051 {
1052 dX = destination()->az().Degrees() - focus()->az().Degrees();
1053 dY = destination()->alt().Degrees() - focus()->alt().Degrees();
1054 }
1055 else
1056 {
1057 dX = destination()->ra().Degrees() - focus()->ra().Degrees();
1058 dY = destination()->dec().Degrees() - focus()->dec().Degrees();
1059 }
1060
1061 //switch directions to go the short way around the celestial sphere, if necessary.
1062 dX = KSUtils::reduceAngle(dX, -180.0, 180.0);
1063
1064 double r0 = sqrt(dX * dX + dY * dY);
1065 if (r0 < 20.0) //smaller slews have smaller maxstep
1066 {
1067 maxstep *= (10.0 + 0.5 * r0) / 20.0;
1068 }
1069 double step = 0.5;
1070 double r = r0;
1071 while (r > step)
1072 {
1073 //DEBUG
1074 //qDebug() << Q_FUNC_INFO << step << ": " << r << ": " << r0;
1075 double fX = dX / r;
1076 double fY = dY / r;
1077
1078 if (Options::useAltAz())
1079 {
1080 focus()->setAlt(focus()->alt().Degrees() + fY * step);
1081 focus()->setAz(dms(focus()->az().Degrees() + fX * step).reduce());
1082 focus()->HorizontalToEquatorial(data->lst(), data->geo()->lat());
1083 }
1084 else
1085 {
1086 fX = fX / 15.; //convert RA degrees to hours
1087 SkyPoint newFocus(focus()->ra().Hours() + fX * step, focus()->dec().Degrees() + fY * step);
1088 setFocus(&newFocus);
1089 focus()->EquatorialToHorizontal(data->lst(), data->geo()->lat());
1090 }
1091
1092 slewing = true;
1093
1094 forceUpdate();
1095 qApp->processEvents(); //keep up with other stuff
1096
1097 if (Options::useAltAz())
1098 {
1099 dX = destination()->az().Degrees() - focus()->az().Degrees();
1100 dY = destination()->alt().Degrees() - focus()->alt().Degrees();
1101 }
1102 else
1103 {
1104 dX = destination()->ra().Degrees() - focus()->ra().Degrees();
1105 dY = destination()->dec().Degrees() - focus()->dec().Degrees();
1106 }
1107
1108 //switch directions to go the short way around the celestial sphere, if necessary.
1109 dX = KSUtils::reduceAngle(dX, -180.0, 180.0);
1110 r = sqrt(dX * dX + dY * dY);
1111
1112 //Modify step according to a cosine-shaped profile
1113 //centered on the midpoint of the slew
1114 //NOTE: don't allow the full range from -PI/2 to PI/2
1115 //because the slew will never reach the destination as
1116 //the speed approaches zero at the end!
1117 double t = dms::PI * (r - 0.5 * r0) / (1.05 * r0);
1118 step = cos(t) * maxstep;
1119 }
1120 }
1121
1122 //Either useAnimatedSlewing==false, or we have slewed, and are within one step of destination
1123 //set focus=destination.
1124 if (Options::useAltAz())
1125 {
1126 setFocusAltAz(destination()->alt(), destination()->az());
1127 focus()->HorizontalToEquatorial(data->lst(), data->geo()->lat());
1128 }
1129 else
1130 {
1132 focus()->EquatorialToHorizontal(data->lst(), data->geo()->lat());
1133 }
1134
1135 slewing = false;
1136
1137 //Turn off snapNextFocus, we only want it to happen once
1138 if (data->snapNextFocus())
1139 {
1140 data->setSnapNextFocus(false);
1141 }
1142
1143 //Start the HoverTimer. if the user leaves the mouse in place after a slew,
1144 //we want to attach a label to the nearest object.
1145 if (Options::useHoverLabel())
1146 m_HoverTimer.start(HOVER_INTERVAL);
1147
1148 forceUpdate();
1149 }
1150}
1151
1153{
1154 setZoomFactor(Options::zoomFactor() * DZOOM);
1155}
1156
1158{
1159 setZoomFactor(Options::zoomFactor() / DZOOM);
1160}
1161
1163{
1164 setZoomFactor(DEFAULTZOOM);
1165}
1166
1167void SkyMap::setZoomFactor(double factor)
1168{
1169 Options::setZoomFactor(KSUtils::clamp(factor, MINZOOM, MAXZOOM));
1170 forceUpdate();
1171 emit zoomChanged();
1172}
1173
1174// force a new calculation of the skymap (used instead of update(), which may skip the redraw)
1175// if now=true, SkyMap::paintEvent() is run immediately, rather than being added to the event queue
1176// also, determine new coordinates of mouse cursor.
1178{
1180 if (!projector()->unusablePoint(mp))
1181 {
1182 //determine RA, Dec of mouse pointer
1183 m_MousePoint = projector()->fromScreen(mp, data->lst(), data->geo()->lat());
1184 }
1185
1186 computeSkymap = true;
1187
1188 // Ensure that stars are recomputed
1189 data->incUpdateID();
1190
1191 if (now)
1192 m_SkyMapDraw->repaint();
1193 else
1194 m_SkyMapDraw->update();
1195}
1196
1198{
1199 float diagonalPixels = sqrt(static_cast<double>(width() * width() + height() * height()));
1200 return diagonalPixels / (2 * Options::zoomFactor() * dms::DegToRad);
1201}
1202
1203dms SkyMap::determineSkyRotation()
1204{
1205 // Note: The erect observer correction accounts for the fact that
1206 // an observer remains erect despite the tube of an
1207 // Altazmith-mounted Newtonian moving up and down, so an
1208 // additional rotation of altitude applies to match the
1209 // orientation of the field. This would not apply to a CCD camera
1210 // plugged into the same telescope, since the CCD would rotate as
1211 // seen from the ground when the telescope moves in altitude.
1212
1213 double erectObserverCorrection = 0.;
1214 if (Options::useAltAz() && Options::erectObserverCorrection() > 0)
1215 {
1216 erectObserverCorrection = (Options::erectObserverCorrection() == 1) ? focus()->alt().Degrees() : -focus()->alt().Degrees();
1217 }
1218
1219 return dms(Options::skyRotation() + erectObserverCorrection);
1220}
1221
1223{
1224 angle = dms(angle).reduce().Degrees();
1225 Options::setSkyRotation(angle);
1226 KStars *kstars = KStars::Instance();
1227 if (kstars)
1228 {
1229 if (angle == 0.)
1230 {
1231 kstars->actionCollection()->action("up_orientation")->setChecked(true);
1232 }
1233 else if (angle == 180.)
1234 {
1235 kstars->actionCollection()->action("down_orientation")->setChecked(true);
1236 }
1237 else
1238 {
1239 kstars->actionCollection()->action("arbitrary_orientation")->setChecked(true);
1240 }
1241 kstars->actionCollection()->action("view:arbitrary")->setChecked(true);
1242 }
1243 forceUpdate();
1244}
1245
1247{
1248 //Update View Parameters for projection
1249 ViewParams p;
1250 p.focus = focus();
1251 p.height = height();
1252 p.width = width();
1253 p.useAltAz = Options::useAltAz();
1254 p.useRefraction = Options::useRefraction();
1255 p.zoomFactor = Options::zoomFactor();
1256 p.rotationAngle = determineSkyRotation();
1257 p.mirror = Options::mirrorSkyMap();
1258 p.fillGround = Options::showGround();
1259 //Check if we need a new projector
1260 if (m_proj && Options::projection() == m_proj->type())
1261 m_proj->setViewParams(p);
1262 else
1263 {
1264 delete m_proj;
1265 switch (Options::projection())
1266 {
1267 case Gnomonic:
1268 m_proj = new GnomonicProjector(p);
1269 break;
1270 case Stereographic:
1271 m_proj = new StereographicProjector(p);
1272 break;
1273 case Orthographic:
1274 m_proj = new OrthographicProjector(p);
1275 break;
1276 case AzimuthalEquidistant:
1277 m_proj = new AzimuthalEquidistantProjector(p);
1278 break;
1279 case Equirectangular:
1280 m_proj = new EquirectangularProjector(p);
1281 break;
1282 case Lambert:
1283 default:
1284 //TODO: implement other projection classes
1285 m_proj = new LambertProjector(p);
1286 break;
1287 }
1288 }
1289}
1290
1291void SkyMap::setZoomMouseCursor()
1292{
1293 mouseMoveCursor = false; // no mousemove cursor
1294 mouseDragCursor = false;
1295 QBitmap cursor = zoomCursorBitmap(2);
1296 QBitmap mask = zoomCursorBitmap(4);
1298}
1299
1300void SkyMap::setRotationMouseCursor()
1301{
1302 mouseMoveCursor = false;
1303 mouseDragCursor = false;
1304 QBitmap cursor = rotationCursorBitmap(2);
1305 QBitmap mask = rotationCursorBitmap(4);
1307}
1308
1310{
1311 // no mousemove cursor
1312 mouseMoveCursor = false;
1313 mouseDragCursor = false;
1314
1315 switch (type)
1316 {
1317 case Cross:
1318 {
1319 QBitmap cursor = defaultCursorBitmap(2);
1320 QBitmap mask = defaultCursorBitmap(3);
1322 }
1323 break;
1324
1325 case Circle:
1326 {
1327 QBitmap cursor = circleCursorBitmap(2);
1328 QBitmap mask = circleCursorBitmap(3);
1330 }
1331 break;
1332
1333 case NoCursor:
1335 break;
1336 }
1337}
1338
1339void SkyMap::setMouseMoveCursor()
1340{
1341 if (mouseButtonDown)
1342 {
1343 setCursor(Qt::SizeAllCursor); // cursor shape defined in qt
1344 mouseMoveCursor = true;
1345 }
1346}
1347
1348void SkyMap::setMouseDragCursor()
1349{
1350 if (mouseButtonDown)
1351 {
1352 setCursor(Qt::OpenHandCursor); // cursor shape defined in qt
1353 mouseDragCursor = true;
1354 }
1355}
1356
1358{
1359 if (rulerMode && (!pmenu || !pmenu->isVisible()))
1360 AngularRuler.setPoint(1, &m_MousePoint);
1361 AngularRuler.update(data);
1362}
1363
1364bool SkyMap::isSlewing() const
1365{
1366 return (slewing || (clockSlewing && data->clock()->isActive()));
1367}
1368
1370{
1371 if(clickedObject())
1372 new XPlanetImageViewer(clickedObject()->name(), this);
1373 else
1374 new XPlanetImageViewer(i18n("Saturn"), this);
1375}
1376
1378{
1379 QLabel *fadingLabel = new QLabel(this);
1380 fadingLabel->setText(text);
1381 QFont font = fadingLabel->font();
1382 QPalette palette = fadingLabel->palette();
1383 font.setPointSize(32);
1384 palette.setColor(fadingLabel->foregroundRole(), KStarsData::Instance()->colorScheme()->colorNamed("BoxTextColor"));
1385 QColor backgroundColor = KStarsData::Instance()->colorScheme()->colorNamed("BoxBGColor");
1386 backgroundColor.setAlpha(192);
1387 palette.setColor(fadingLabel->backgroundRole(), backgroundColor);
1388 fadingLabel->setFont(font);
1389 fadingLabel->setAutoFillBackground(true);
1390 fadingLabel->setPalette(palette);
1391 fadingLabel->setAlignment(Qt::AlignCenter);
1392 fadingLabel->adjustSize();
1393 fadingLabel->move(QPoint((width() - fadingLabel->width()) / 2, (0.75 * height() - fadingLabel->height() / 2)));
1394 QGraphicsOpacityEffect* fadingEffect = new QGraphicsOpacityEffect(fadingLabel);
1395 fadingLabel->setGraphicsEffect(fadingEffect);
1396 fadingLabel->show();
1397
1398 QPropertyAnimation* animation = new QPropertyAnimation(fadingEffect, "opacity", fadingLabel);
1399 animation->setDuration(1500);
1400 animation->setStartValue(1.0);
1401 animation->setEndValue(0.0);
1402 connect(animation, &QPropertyAnimation::finished, fadingLabel, &QLabel::deleteLater);
1403 animation->start();
1404}
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
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:72
CachingDms * lst()
Definition kstarsdata.h:224
bool snapNextFocus() const
Definition kstarsdata.h:268
ColorScheme * colorScheme()
Definition kstarsdata.h:172
const QList< FOV * > getAvailableFOVs() const
Definition kstarsdata.h:314
const KStarsDateTime & ut() const
Definition kstarsdata.h:157
Q_INVOKABLE SimClock * clock()
Definition kstarsdata.h:218
GeoLocation * geo()
Definition kstarsdata.h:230
SkyMapComposite * skyComposite()
Definition kstarsdata.h:166
void setSnapNextFocus(bool b=true)
Disable or re-enable the slewing animation for the next Focus change.
Definition kstarsdata.h:283
This is the main window for KStars.
Definition kstars.h:91
static KStars * Instance()
Definition kstars.h:123
void slotEyepieceView(SkyPoint *sp, const QString &imagePath=QString())
Show the eyepiece view tool.
KStarsData * data() const
Definition kstars.h:135
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:1167
void zoomChanged()
Emitted when zoom level is changed.
void setMouseCursorShape(Cursor type)
Sets the shape of the default mouse cursor.
Definition skymap.cpp:1309
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 slotEyepieceView()
Render eyepiece view.
Definition skymap.cpp:607
void setupProjector()
Call to set up the projector before a draw cycle.
Definition skymap.cpp:1246
void slotObjectSelected()
Object pointing for Printing Wizard done.
Definition skymap.cpp:911
float fov()
Definition skymap.cpp:1197
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:1012
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:888
void slotAddObjectLabel()
Add ClickedObject to KStarsData::ObjLabelList, which stores pointers to SkyObjects which have User La...
Definition skymap.cpp:872
void slotUpdateSky(bool now)
Update the focus point and call forceUpdate()
Definition skymap.cpp:458
void slotZoomOut()
Zoom out one step.
Definition skymap.cpp:1157
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:647
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:846
void slotClockSlewing()
Checks whether the timestep exceeds a threshold value.
Definition skymap.cpp:944
void slotCancelRulerMode()
Disables the angular distance measuring mode.
Definition skymap.cpp:753
void forceUpdate(bool now=false)
Recalculates the positions of objects in the sky, and then repaints the sky map.
Definition skymap.cpp:1177
SkyPoint * destination()
retrieve the Destination position.
Definition skymap.h:135
void slotRemovePlanetTrail()
Remove the PlanetTrail from ClickedObject.
Definition skymap.cpp:878
void setFocusAltAz(const dms &alt, const dms &az)
sets the focus point of the sky map, using its alt/az coordinates
Definition skymap.cpp:972
void mousePointChanged(SkyPoint *)
Emitted when position under mouse changed.
void updateAngleRuler()
update the geometry of the angle ruler.
Definition skymap.cpp:1357
void slotSetSkyRotation(double angle)
Sets the base sky rotation (before correction) to the given angle.
Definition skymap.cpp:1222
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:984
~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:1377
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:831
void slotZoomDefault()
Set default zoom.
Definition skymap.cpp:1162
void slotEditFlag(int flagIdx)
Open Flag Manager window with selected flag focused and ready to edit.
Definition skymap.cpp:789
void slotAddFlag()
Open Flag Manager window with clickedObject() RA and Dec entered.
Definition skymap.cpp:759
void slotImage()
Popup menu function: Show image of ClickedObject (only available for some objects).
Definition skymap.cpp:812
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:996
void slotStartXplanetViewer()
Run Xplanet Viewer to display images of the planets.
Definition skymap.cpp:1369
void slewFocus()
Step the Focus point toward the Destination point.
Definition skymap.cpp:1037
void updateFocus()
Update the focus position according to current options.
Definition skymap.cpp:1017
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:611
void slotDeleteFlag(int flagIdx)
Delete selected flag.
Definition skymap.cpp:798
void slotZoomIn()
Zoom in one step.
Definition skymap.cpp:1152
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:822
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:852
void slotDetail()
Popup menu function: Show the Detailed Information window for ClickedObject.
Definition skymap.cpp:898
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:145
QString translatedLongName() const
Definition skyobject.h:169
float mag() const
Definition skyobject.h:206
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:718
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:382
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:236
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...)
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)
QString & remove(QChar ch, Qt::CaseSensitivity cs)
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 Fri Jul 26 2024 11:59:52 by doxygen 1.11.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.