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

KDE's Doxygen guidelines are available online.