Kstars

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

KDE's Doxygen guidelines are available online.