• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • edu API Reference
  • KDE Home
  • Contact Us
 

kstars

  • extragear
  • edu
  • kstars
  • kstars
skyqpainter.cpp
Go to the documentation of this file.
1 /*
2  (C) 2010 Henry de Valence <[email protected]>
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more decomas.
13 
14  You should have received a copy of the GNU General Public License along
15  with this program; if not, write to the Free Software Foundation, Inc.,
16  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 
18 */
19 
20 #include "skyqpainter.h"
21 
22 #include <QPointer>
23 
24 #include "kstarsdata.h"
25 #include "Options.h"
26 #include "skymap.h"
27 #include "projections/projector.h"
28 #include "skycomponents/flagcomponent.h"
29 #include "skycomponents/linelist.h"
30 #include "skycomponents/linelistlabel.h"
31 #include "skycomponents/satellitescomponent.h"
32 #include "skycomponents/skiphashlist.h"
33 #include "skycomponents/skymapcomposite.h"
34 #include "skycomponents/solarsystemcomposite.h"
35 #include "skycomponents/earthshadowcomponent.h"
36 #include "skyobjects/constellationsart.h"
37 #include "skyobjects/deepskyobject.h"
38 #include "skyobjects/ksasteroid.h"
39 #include "skyobjects/kscomet.h"
40 #include "skyobjects/kssun.h"
41 #include "skyobjects/satellite.h"
42 #include "skyobjects/supernova.h"
43 #include "skyobjects/ksearthshadow.h"
44 #include "hips/hipsrenderer.h"
45 
46 namespace
47 {
48 // Convert spectral class to numerical index.
49 // If spectral class is invalid return index for white star (A class)
50 int harvardToIndex(char c)
51 {
52  switch (c)
53  {
54  case 'o':
55  case 'O':
56  return 0;
57  case 'b':
58  case 'B':
59  return 1;
60  case 'a':
61  case 'A':
62  return 2;
63  case 'f':
64  case 'F':
65  return 3;
66  case 'g':
67  case 'G':
68  return 4;
69  case 'k':
70  case 'K':
71  return 5;
72  case 'm':
73  case 'M':
74  return 6;
75  // For unknown spectral class assume A class (white star)
76  default:
77  return 2;
78  }
79 }
80 
81 // Total number of sizes of stars.
82 const int nStarSizes = 15;
83 // Total number of spectral classes
84 // N.B. Must be in sync with harvardToIndex
85 const int nSPclasses = 7;
86 
87 // Cache for star images.
88 //
89 // These pixmaps are never deallocated. Not really good...
90 QPixmap *imageCache[nSPclasses][nStarSizes] = { { nullptr } };
91 
92 std::unique_ptr<QPixmap> visibleSatPixmap, invisibleSatPixmap;
93 }
94 
95 int SkyQPainter::starColorMode = 0;
96 QColor SkyQPainter::m_starColor = QColor();
97 QMap<char, QColor> SkyQPainter::ColorMap = QMap<char, QColor>();
98 
99 void SkyQPainter::releaseImageCache()
100 {
101  for (char &color : ColorMap.keys())
102  {
103  QPixmap **pmap = imageCache[harvardToIndex(color)];
104 
105  for (int size = 1; size < nStarSizes; size++)
106  {
107  if (pmap[size])
108  delete pmap[size];
109 
110  pmap[size] = nullptr;
111  }
112  }
113 }
114 
115 SkyQPainter::SkyQPainter(QPaintDevice *pd) : SkyPainter(), QPainter()
116 {
117  Q_ASSERT(pd);
118  m_pd = pd;
119  m_size = QSize(pd->width(), pd->height());
120  m_hipsRender = new HIPSRenderer();
121 }
122 
123 SkyQPainter::SkyQPainter(QPaintDevice *pd, const QSize &size) : SkyPainter(), QPainter()
124 {
125  Q_ASSERT(pd);
126  m_pd = pd;
127  m_size = size;
128  m_hipsRender = new HIPSRenderer();
129 }
130 
131 SkyQPainter::SkyQPainter(QWidget *widget, QPaintDevice *pd) : SkyPainter(), QPainter()
132 {
133  Q_ASSERT(widget);
134  // Set paint device pointer to pd or to the widget if pd = 0
135  m_pd = (pd ? pd : widget);
136  m_size = widget->size();
137  m_hipsRender = new HIPSRenderer();
138 }
139 
140 SkyQPainter::~SkyQPainter()
141 {
142  delete (m_hipsRender);
143 }
144 
145 void SkyQPainter::begin()
146 {
147  QPainter::begin(m_pd);
148  bool aa = !m_sm->isSlewing() && Options::useAntialias();
149  setRenderHint(QPainter::Antialiasing, aa);
150  setRenderHint(QPainter::HighQualityAntialiasing, aa);
151  m_proj = m_sm->projector();
152 }
153 
154 void SkyQPainter::end()
155 {
156  QPainter::end();
157 }
158 
159 void SkyQPainter::drawSkyBackground()
160 {
161  //FIXME use projector
162  fillRect(0, 0, m_size.width(), m_size.height(), KStarsData::Instance()->colorScheme()->colorNamed("SkyColor"));
163 }
164 
165 void SkyQPainter::setPen(const QPen &pen)
166 {
167  QPainter::setPen(pen);
168 }
169 
170 void SkyQPainter::setBrush(const QBrush &brush)
171 {
172  QPainter::setBrush(brush);
173 }
174 
175 void SkyQPainter::initStarImages()
176 {
177  const int starColorIntensity = Options::starColorIntensity();
178 
179  ColorMap.clear();
180  switch (Options::starColorMode())
181  {
182  case 1: // Red stars.
183  m_starColor = Qt::red;
184  break;
185  case 2: // Black stars.
186  m_starColor = Qt::black;
187  break;
188  case 3: // White stars
189  m_starColor = Qt::white;
190  break;
191  case 0: // Real color
192  default: // And use real color for everything else
193  m_starColor = QColor();
194  ColorMap.insert('O', QColor::fromRgb(0, 0, 255));
195  ColorMap.insert('B', QColor::fromRgb(0, 200, 255));
196  ColorMap.insert('A', QColor::fromRgb(0, 255, 255));
197  ColorMap.insert('F', QColor::fromRgb(200, 255, 100));
198  ColorMap.insert('G', QColor::fromRgb(255, 255, 0));
199  ColorMap.insert('K', QColor::fromRgb(255, 100, 0));
200  ColorMap.insert('M', QColor::fromRgb(255, 0, 0));
201  break;
202  }
203  if (ColorMap.isEmpty())
204  {
205  ColorMap.insert('O', m_starColor);
206  ColorMap.insert('B', m_starColor);
207  ColorMap.insert('A', m_starColor);
208  ColorMap.insert('F', m_starColor);
209  ColorMap.insert('G', m_starColor);
210  ColorMap.insert('K', m_starColor);
211  ColorMap.insert('M', m_starColor);
212  }
213 
214  for (char &color : ColorMap.keys())
215  {
216  QPixmap BigImage(15, 15);
217  BigImage.fill(Qt::transparent);
218 
219  QPainter p;
220  p.begin(&BigImage);
221 
222  if (Options::starColorMode() == 0)
223  {
224  qreal h, s, v, a;
225  p.setRenderHint(QPainter::Antialiasing, false);
226  QColor starColor = ColorMap[color];
227  starColor.getHsvF(&h, &s, &v, &a);
228  for (int i = 0; i < 8; i++)
229  {
230  for (int j = 0; j < 8; j++)
231  {
232  qreal x = i - 7;
233  qreal y = j - 7;
234  qreal dist = sqrt(x * x + y * y) / 7.0;
235  starColor.setHsvF(h, qMin(qreal(1), dist < (10 - starColorIntensity) / 10.0 ? 0 : dist), v,
236  qMax(qreal(0), dist < (10 - starColorIntensity) / 20.0 ? 1 : 1 - dist));
237  p.setPen(starColor);
238  p.drawPoint(i, j);
239  p.drawPoint(14 - i, j);
240  p.drawPoint(i, 14 - j);
241  p.drawPoint(14 - i, 14 - j);
242  }
243  }
244  }
245  else
246  {
247  p.setRenderHint(QPainter::Antialiasing, true);
248  p.setPen(QPen(ColorMap[color], 2.0));
249  p.setBrush(p.pen().color());
250  p.drawEllipse(QRectF(2, 2, 10, 10));
251  }
252  p.end();
253 
254  // Cache array slice
255  QPixmap **pmap = imageCache[harvardToIndex(color)];
256 
257  for (int size = 1; size < nStarSizes; size++)
258  {
259  if (!pmap[size])
260  pmap[size] = new QPixmap();
261  *pmap[size] = BigImage.scaled(size, size, Qt::KeepAspectRatio, Qt::SmoothTransformation);
262  }
263  }
264  starColorMode = Options::starColorMode();
265 
266  if (!visibleSatPixmap.get())
267  visibleSatPixmap.reset(new QPixmap(":/icons/kstars_satellites_visible.svg"));
268  if (!invisibleSatPixmap.get())
269  invisibleSatPixmap.reset(new QPixmap(":/icons/kstars_satellites_invisible.svg"));
270 }
271 
272 void SkyQPainter::drawSkyLine(SkyPoint *a, SkyPoint *b)
273 {
274  bool aVisible, bVisible;
275  QPointF aScreen = m_proj->toScreen(a, true, &aVisible);
276  QPointF bScreen = m_proj->toScreen(b, true, &bVisible);
277 
278  drawLine(aScreen, bScreen);
279 
280  //THREE CASES:
281  // if (aVisible && bVisible)
282  // {
283  // //Both a,b visible, so paint the line normally:
284  // drawLine(aScreen, bScreen);
285  // }
286  // else if (aVisible)
287  // {
288  // //a is visible but b isn't:
289  // drawLine(aScreen, m_proj->clipLine(a, b));
290  // }
291  // else if (bVisible)
292  // {
293  // //b is visible but a isn't:
294  // drawLine(bScreen, m_proj->clipLine(b, a));
295  // } //FIXME: what if both are offscreen but the line isn't?
296 }
297 
298 void SkyQPainter::drawSkyPolyline(LineList *list, SkipHashList *skipList, LineListLabel *label)
299 {
300  SkyList *points = list->points();
301  bool isVisible, isVisibleLast;
302 
303  QPointF oLast = m_proj->toScreen(points->first().get(), true, &isVisibleLast);
304  // & with the result of checkVisibility to clip away things below horizon
305  isVisibleLast &= m_proj->checkVisibility(points->first().get());
306  QPointF oThis, oThis2;
307 
308  for (int j = 1; j < points->size(); j++)
309  {
310  SkyPoint *pThis = points->at(j).get();
311 
312  oThis2 = oThis = m_proj->toScreen(pThis, true, &isVisible);
313  // & with the result of checkVisibility to clip away things below horizon
314  isVisible &= m_proj->checkVisibility(pThis);
315  bool doSkip = false;
316  if (skipList)
317  {
318  doSkip = skipList->skip(j);
319  }
320 
321  bool pointsVisible = false;
322  //Temporary solution to avoid random lines in Gnomonic projection and draw lines up to horizon
323  if (SkyMap::Instance()->projector()->type() == Projector::Gnomonic)
324  {
325  if (isVisible && isVisibleLast)
326  pointsVisible = true;
327  }
328  else
329  {
330  if (isVisible || isVisibleLast)
331  pointsVisible = true;
332  }
333 
334  if (!doSkip)
335  {
336  if (pointsVisible)
337  {
338  drawLine(oLast, oThis);
339  if (label)
340  label->updateLabelCandidates(oThis.x(), oThis.y(), list, j);
341  }
342  }
343 
344  oLast = oThis2;
345  isVisibleLast = isVisible;
346  }
347 }
348 
349 void SkyQPainter::drawSkyPolygon(LineList *list, bool forceClip)
350 {
351  bool isVisible = false, isVisibleLast;
352  SkyList *points = list->points();
353  QPolygonF polygon;
354 
355  if (forceClip == false)
356  {
357  for (const auto &point : *points)
358  {
359  polygon << m_proj->toScreen(point.get(), false, &isVisibleLast);
360  isVisible |= isVisibleLast;
361  }
362 
363  // If 1+ points are visible, draw it
364  if (polygon.size() && isVisible)
365  drawPolygon(polygon);
366 
367  return;
368  }
369 
370  SkyPoint *pLast = points->last().get();
371  QPointF oLast = m_proj->toScreen(pLast, true, &isVisibleLast);
372  // & with the result of checkVisibility to clip away things below horizon
373  isVisibleLast &= m_proj->checkVisibility(pLast);
374 
375  for (const auto &point : *points)
376  {
377  SkyPoint *pThis = point.get();
378  QPointF oThis = m_proj->toScreen(pThis, true, &isVisible);
379  // & with the result of checkVisibility to clip away things below horizon
380  isVisible &= m_proj->checkVisibility(pThis);
381 
382  if (isVisible && isVisibleLast)
383  {
384  polygon << oThis;
385  }
386  else if (isVisibleLast)
387  {
388  QPointF oMid = m_proj->clipLine(pLast, pThis);
389  polygon << oMid;
390  }
391  else if (isVisible)
392  {
393  QPointF oMid = m_proj->clipLine(pThis, pLast);
394  polygon << oMid;
395  polygon << oThis;
396  }
397 
398  pLast = pThis;
399  oLast = oThis;
400  isVisibleLast = isVisible;
401  }
402 
403  if (polygon.size())
404  drawPolygon(polygon);
405 }
406 
407 bool SkyQPainter::drawPlanet(KSPlanetBase *planet)
408 {
409  if (!m_proj->checkVisibility(planet))
410  return false;
411 
412  bool visible = false;
413  QPointF pos = m_proj->toScreen(planet, true, &visible);
414  if (!visible || !m_proj->onScreen(pos))
415  return false;
416 
417  float fakeStarSize = (10.0 + log10(Options::zoomFactor()) - log10(MINZOOM)) * (10 - planet->mag()) / 10;
418  if (fakeStarSize > 15.0)
419  fakeStarSize = 15.0;
420 
421  double size = planet->angSize() * dms::PI * Options::zoomFactor() / 10800.0;
422  if (size < fakeStarSize && planet->name() != i18n("Sun") && planet->name() != i18n("Moon"))
423  {
424  // Draw them as bright stars of appropriate color instead of images
425  char spType;
426  //FIXME: do these need i18n?
427  if (planet->name() == i18n("Mars"))
428  {
429  spType = 'K';
430  }
431  else if (planet->name() == i18n("Jupiter") || planet->name() == i18n("Mercury") ||
432  planet->name() == i18n("Saturn"))
433  {
434  spType = 'F';
435  }
436  else
437  {
438  spType = 'B';
439  }
440  drawPointSource(pos, fakeStarSize, spType);
441  }
442  else
443  {
444  float sizemin = 1.0;
445  if (planet->name() == i18n("Sun") || planet->name() == i18n("Moon"))
446  sizemin = 8.0;
447 
448  if (size < sizemin)
449  size = sizemin;
450 
451  if (Options::showPlanetImages() && !planet->image().isNull())
452  {
453  //Because Saturn has rings, we inflate its image size by a factor 2.5
454  if (planet->name() == "Saturn")
455  size = int(2.5 * size);
456  // Scale size exponentially so it is visible at large zooms
457  else if (planet->name() == "Pluto")
458  size = int(size * exp(1.5 * size));
459 
460  save();
461  translate(pos);
462  rotate(m_proj->findPA(planet, pos.x(), pos.y()));
463  drawImage(QRectF(-0.5 * size, -0.5 * size, size, size), planet->image());
464  restore();
465  }
466  else //Otherwise, draw a simple circle.
467  {
468  drawEllipse(pos, size * .5, size * .5);
469  }
470  }
471  return true;
472 }
473 
474 bool SkyQPainter::drawEarthShadow(KSEarthShadow *shadow)
475 {
476  if (!m_proj->checkVisibility(shadow))
477  return false;
478 
479  bool visible = false;
480  QPointF pos = m_proj->toScreen(shadow, true, &visible);
481 
482  if(!visible)
483  return false;
484 
485  double umbra_size = shadow->getUmbraAngSize() * dms::PI * Options::zoomFactor() / 10800.0;
486  double penumbra_size = shadow->getPenumbraAngSize() * dms::PI * Options::zoomFactor() / 10800.0;
487 
488  save();
489  setBrush(QBrush(QColor(255, 96, 38, 128)));
490  drawEllipse(pos, umbra_size, umbra_size);
491  setBrush(QBrush(QColor(255, 96, 38, 90)));
492  drawEllipse(pos, penumbra_size, penumbra_size);
493  restore();
494 
495  return true;
496 }
497 
498 bool SkyQPainter::drawComet(KSComet *com)
499 {
500  if (!m_proj->checkVisibility(com))
501  return false;
502 
503  double size = com->angSize() * dms::PI * Options::zoomFactor() / 10800.0 / 2; // Radius
504  if (size < 1)
505  size = 1;
506 
507  bool visible = false;
508  QPointF pos = m_proj->toScreen(com, true, &visible);
509 
510  // Draw the coma. FIXME: Another Check??
511  if (visible && m_proj->onScreen(pos))
512  {
513  // Draw the comet.
514  drawEllipse(pos, size, size);
515 
516  double comaLength = (com->getComaAngSize().arcmin() * dms::PI * Options::zoomFactor() / 10800.0);
517 
518  // If coma is visible and long enough.
519  if (Options::showCometComas() && comaLength > size)
520  {
521  KSSun *sun = KStarsData::Instance()->skyComposite()->solarSystemComposite()->sun();
522 
523  // Find the angle to the sun.
524  double comaAngle = m_proj->findPA(sun, pos.x(), pos.y());
525 
526  const QVector<QPoint> coma = { QPoint(pos.x() - size, pos.y()), QPoint(pos.x() + size, pos.y()),
527  QPoint(pos.x(), pos.y() + comaLength)
528  };
529 
530  QPolygon comaPoly(coma);
531 
532  comaPoly = QTransform()
533  .translate(pos.x(), pos.y())
534  .rotate(comaAngle) // Already + 180 Deg, because rotated from south, not north.
535  .translate(-pos.x(), -pos.y())
536  .map(comaPoly);
537 
538  save();
539 
540  // Nice fade for the Coma.
541  QLinearGradient linearGrad(pos, comaPoly.point(2));
542  linearGrad.setColorAt(0, QColor("white"));
543  linearGrad.setColorAt(size / comaLength, QColor("white"));
544  linearGrad.setColorAt(0.9, QColor("transparent"));
545  setBrush(linearGrad);
546 
547  // Render Coma.
548  drawConvexPolygon(comaPoly);
549  restore();
550  }
551 
552  return true;
553  }
554  else
555  {
556  return false;
557  }
558 }
559 
560 bool SkyQPainter::drawPointSource(SkyPoint *loc, float mag, char sp)
561 {
562  //Check if it's even visible before doing anything
563  if (!m_proj->checkVisibility(loc))
564  return false;
565 
566  bool visible = false;
567  QPointF pos = m_proj->toScreen(loc, true, &visible);
568  if (visible &&
569  m_proj->onScreen(
570  pos)) // FIXME: onScreen here should use canvas size rather than SkyMap size, especially while printing in portrait mode!
571  {
572  drawPointSource(pos, starWidth(mag), sp);
573  return true;
574  }
575  else
576  {
577  return false;
578  }
579 }
580 
581 void SkyQPainter::drawPointSource(const QPointF &pos, float size, char sp)
582 {
583  int isize = qMin(static_cast<int>(size), 14);
584  if (!m_vectorStars || starColorMode == 0)
585  {
586  // Draw stars as bitmaps, either because we were asked to, or because we're painting real colors
587  QPixmap *im = imageCache[harvardToIndex(sp)][isize];
588  float offset = 0.5 * im->width();
589  drawPixmap(QPointF(pos.x() - offset, pos.y() - offset), *im);
590  }
591  else
592  {
593  // Draw stars as vectors, for better printing / SVG export etc.
594  if (starColorMode != 4)
595  {
596  setPen(m_starColor);
597  setBrush(m_starColor);
598  }
599  else
600  {
601  // Note: This is not efficient, but we use vector stars only when plotting SVG, not when drawing the skymap, so speed is not very important.
602  QColor c = ColorMap.value(sp, Qt::white);
603  setPen(c);
604  setBrush(c);
605  }
606 
607  // Be consistent with old raster representation
608  if (size > 14)
609  size = 14;
610  if (size >= 2)
611  drawEllipse(pos.x() - 0.5 * size, pos.y() - 0.5 * size, int(size), int(size));
612  else if (size >= 1)
613  drawPoint(pos.x(), pos.y());
614  }
615 }
616 
617 bool SkyQPainter::drawConstellationArtImage(ConstellationsArt *obj)
618 {
619  double zoom = Options::zoomFactor();
620 
621  bool visible = false;
622  obj->EquatorialToHorizontal(KStarsData::Instance()->lst(), KStarsData::Instance()->geo()->lat());
623  QPointF constellationmidpoint = m_proj->toScreen(obj, true, &visible);
624 
625  if (!visible || !m_proj->onScreen(constellationmidpoint))
626  return false;
627 
628  //qDebug() << "o->pa() " << obj->pa();
629  float positionangle = m_proj->findPA(obj, constellationmidpoint.x(), constellationmidpoint.y());
630  //qDebug() << " final PA " << positionangle;
631 
632  float w = obj->getWidth() * 60 * dms::PI * zoom / 10800;
633  float h = obj->getHeight() * 60 * dms::PI * zoom / 10800;
634 
635  save();
636 
637  setRenderHint(QPainter::SmoothPixmapTransform);
638 
639  translate(constellationmidpoint);
640  rotate(positionangle);
641  setOpacity(0.7);
642  drawImage(QRectF(-0.5 * w, -0.5 * h, w, h), obj->image());
643  setOpacity(1);
644 
645  setRenderHint(QPainter::SmoothPixmapTransform, false);
646  restore();
647  return true;
648 }
649 
650 bool SkyQPainter::drawHips()
651 {
652  int w = viewport().width();
653  int h = viewport().height();
654  QImage *hipsImage = new QImage(w, h, QImage::Format_ARGB32_Premultiplied);
655  bool rendered = m_hipsRender->render(w, h, hipsImage, m_proj);
656  if (rendered)
657  drawImage(viewport(), *hipsImage);
658 
659  delete (hipsImage);
660  return rendered;
661 }
662 
663 bool SkyQPainter::drawDeepSkyObject(DeepSkyObject *obj, bool drawImage)
664 {
665  if (!m_proj->checkVisibility(obj))
666  return false;
667 
668  bool visible = false;
669  QPointF pos = m_proj->toScreen(obj, true, &visible);
670  if (!visible || !m_proj->onScreen(pos))
671  return false;
672 
673  // if size is 0.0 set it to 1.0, this are normally stars (type 0 and 1)
674  // if we use size 0.0 the star wouldn't be drawn
675  float majorAxis = obj->a();
676  if (majorAxis == 0.0)
677  {
678  majorAxis = 1.0;
679  }
680 
681  float size = majorAxis * dms::PI * Options::zoomFactor() / 10800.0;
682 
683  //FIXME: this is probably incorrect
684  float positionAngle = m_proj->findPA(obj, pos.x(), pos.y());
685 
686  //Draw Image
687  if (drawImage && Options::zoomFactor() > 5. * MINZOOM)
688  drawDeepSkyImage(pos, obj, positionAngle);
689 
690  //Draw Symbol
691  drawDeepSkySymbol(pos, obj->type(), size, obj->e(), positionAngle);
692 
693  return true;
694 }
695 
696 bool SkyQPainter::drawDeepSkyImage(const QPointF &pos, DeepSkyObject *obj, float positionAngle)
697 {
698  double zoom = Options::zoomFactor();
699  double w = obj->a() * dms::PI * zoom / 10800.0;
700  double h = obj->e() * w;
701 
702  save();
703  translate(pos);
704  rotate(positionAngle);
705  drawImage(QRectF(-0.5 * w, -0.5 * h, w, h), obj->image());
706  restore();
707 
708  return true;
709 }
710 
711 void SkyQPainter::drawDeepSkySymbol(const QPointF &pos, int type, float size, float e, float positionAngle)
712 {
713  float x = pos.x();
714  float y = pos.y();
715  float zoom = Options::zoomFactor();
716 
717  int isize = int(size);
718 
719  float dx1 = -0.5 * size;
720  float dx2 = 0.5 * size;
721  float dy1 = -1.0 * e * size / 2.;
722  float dy2 = e * size / 2.;
723  float x1 = x + dx1;
724  float x2 = x + dx2;
725  float y1 = y + dy1;
726  float y2 = y + dy2;
727 
728  float dxa = -size / 4.;
729  float dxb = size / 4.;
730  float dya = -1.0 * e * size / 4.;
731  float dyb = e * size / 4.;
732  float xa = x + dxa;
733  float xb = x + dxb;
734  float ya = y + dya;
735  float yb = y + dyb;
736 
737  QString color;
738 
739  float psize;
740 
741  QBrush tempBrush;
742 
743  std::function<void(float, float, float, float)> lambdaDrawEllipse;
744  std::function<void(float, float, float, float)> lambdaDrawLine;
745  std::function<void(float, float, float, float)> lambdaDrawCross;
746 
747  if (Options::useAntialias())
748  {
749  lambdaDrawEllipse = [this](float x, float y, float width, float height)
750  {
751  drawEllipse(QRectF(x, y, width, height));
752  };
753  lambdaDrawLine = [this](float x1, float y1, float x2, float y2)
754  {
755  drawLine(QLineF(x1, y1, x2, y2));
756  };
757  lambdaDrawCross = [this](float centerX, float centerY, float sizeX, float sizeY)
758  {
759  drawLine(QLineF(centerX - sizeX / 2., centerY, centerX + sizeX / 2., centerY));
760  drawLine(QLineF(centerX, centerY - sizeY / 2., centerX, centerY + sizeY / 2.));
761  };
762  }
763  else
764  {
765  lambdaDrawEllipse = [this](float x, float y, float width, float height)
766  {
767  drawEllipse(QRect(x, y, width, height));
768  };
769  lambdaDrawLine = [this](float x1, float y1, float x2, float y2)
770  {
771  drawLine(QLine(x1, y1, x2, y2));
772  };
773  lambdaDrawCross = [this](float centerX, float centerY, float sizeX, float sizeY)
774  {
775  drawLine(QLine(centerX - sizeX / 2., centerY, centerX + sizeX / 2., centerY));
776  drawLine(QLine(centerX, centerY - sizeY / 2., centerX, centerY + sizeY / 2.));
777  };
778  }
779 
780  switch (type)
781  {
782  case 0:
783  case 1: //catalog star
784  //Some NGC/IC objects are stars...changed their type to 1 (was double star)
785  if (size < 2.)
786  size = 2.;
787  lambdaDrawEllipse(x - size / 2., y - size / 2., size, size);
788  break;
789  case 2: //Planet
790  break;
791  case 3: //Open cluster; draw circle of points
792  case 13: // Asterism
793  {
794  tempBrush = brush();
795  color = pen().color().name();
796  setBrush(pen().color());
797  psize = 2.;
798  if (size > 50.)
799  psize *= 2.;
800  if (size > 100.)
801  psize *= 2.;
802  auto putDot = [psize, &lambdaDrawEllipse](float x, float y)
803  {
804  lambdaDrawEllipse(x - psize / 2., y - psize / 2., psize, psize);
805  };
806  putDot(xa, y1);
807  putDot(xb, y1);
808  putDot(xa, y2);
809  putDot(xb, y2);
810  putDot(x1, ya);
811  putDot(x1, yb);
812  putDot(x2, ya);
813  putDot(x2, yb);
814  setBrush(tempBrush);
815  break;
816  }
817  case 4: //Globular Cluster
818  if (size < 2.)
819  size = 2.;
820  save();
821  translate(x, y);
822  color = pen().color().name();
823  rotate(positionAngle); //rotate the coordinate system
824  lambdaDrawEllipse(dx1, dy1, size, e * size);
825  lambdaDrawCross(0, 0, size, e * size);
826  restore(); //reset coordinate system
827  break;
828 
829  case 5: //Gaseous Nebula
830  case 15: // Dark Nebula
831  save();
832  translate(x, y);
833  rotate(positionAngle); //rotate the coordinate system
834  color = pen().color().name();
835  lambdaDrawLine(dx1, dy1, dx2, dy1);
836  lambdaDrawLine(dx2, dy1, dx2, dy2);
837  lambdaDrawLine(dx2, dy2, dx1, dy2);
838  lambdaDrawLine(dx1, dy2, dx1, dy1);
839  restore(); //reset coordinate system
840  break;
841  case 6: //Planetary Nebula
842  if (size < 2.)
843  size = 2.;
844  save();
845  translate(x, y);
846  rotate(positionAngle); //rotate the coordinate system
847  color = pen().color().name();
848  lambdaDrawEllipse(dx1, dy1, size, e * size);
849  lambdaDrawLine(0., dy1, 0., dy1 - e * size / 2.);
850  lambdaDrawLine(0., dy2, 0., dy2 + e * size / 2.);
851  lambdaDrawLine(dx1, 0., dx1 - size / 2., 0.);
852  lambdaDrawLine(dx2, 0., dx2 + size / 2., 0.);
853  restore(); //reset coordinate system
854  break;
855  case 7: //Supernova remnant // FIXME: Why is SNR drawn different from a gaseous nebula?
856  save();
857  translate(x, y);
858  rotate(positionAngle); //rotate the coordinate system
859  color = pen().color().name();
860  lambdaDrawLine(0., dy1, dx2, 0.);
861  lambdaDrawLine(dx2, 0., 0., dy2);
862  lambdaDrawLine(0., dy2, dx1, 0.);
863  lambdaDrawLine(dx1, 0., 0., dy1);
864  restore(); //reset coordinate system
865  break;
866  case 8: //Galaxy
867  case 16: // Quasar
868  color = pen().color().name();
869  if (size < 1. && zoom > 20 * MINZOOM)
870  size = 3.; //force ellipse above zoomFactor 20
871  if (size < 1. && zoom > 5 * MINZOOM)
872  size = 1.; //force points above zoomFactor 5
873  if (size > 2.)
874  {
875  save();
876  translate(x, y);
877  rotate(positionAngle); //rotate the coordinate system
878  lambdaDrawEllipse(dx1, dy1, size, e * size);
879  restore(); //reset coordinate system
880  }
881  else if (size > 0.)
882  {
883  drawPoint(QPointF(x, y));
884  }
885  break;
886  case 14: // Galaxy cluster - draw a dashed circle
887  {
888  tempBrush = brush();
889  setBrush(QBrush());
890  color = pen().color().name();
891  save();
892  translate(x, y);
893  rotate(positionAngle); //rotate the coordinate system
894  QPen newPen = pen();
895  newPen.setStyle(Qt::DashLine);
896  setPen(newPen);
897  lambdaDrawEllipse(dx1, dy1, size, e * size);
898  restore();
899  setBrush(tempBrush);
900  break;
901  }
902  default: // Unknown object or something we don't know how to draw. Just draw an ellipse with a ?-mark
903  color = pen().color().name();
904  if (size < 1. && zoom > 20 * MINZOOM)
905  size = 3.; //force ellipse above zoomFactor 20
906  if (size < 1. && zoom > 5 * MINZOOM)
907  size = 1.; //force points above zoomFactor 5
908  if (size > 2.)
909  {
910  save();
911  QFont f = font();
912  const QString qMark = " ? ";
913  double scaleFactor = 0.8 * size / fontMetrics().width(qMark);
914  f.setPointSizeF(f.pointSizeF() * scaleFactor);
915  setFont(f);
916  translate(x, y);
917  rotate(positionAngle); //rotate the coordinate system
918  lambdaDrawEllipse(dx1, dy1, size, e * size);
919  if (Options::useAntialias())
920  drawText(QRectF(dx1, dy1, size, e * size), Qt::AlignCenter, qMark);
921  else
922  {
923  int idx1 = int(dx1);
924  int idy1 = int(dy1);
925  drawText(QRect(idx1, idy1, isize, int(e * size)), Qt::AlignCenter, qMark);
926  }
927  restore(); //reset coordinate system (and font?)
928  }
929  else if (size > 0.)
930  {
931  if (Options::useAntialias())
932  drawPoint(QPointF(x, y));
933  else
934  drawPoint(QPoint(x, y));
935  }
936  }
937 }
938 
939 void SkyQPainter::drawObservingList(const QList<SkyObject *> &obs)
940 {
941  foreach (SkyObject *obj, obs)
942  {
943  bool visible = false;
944  QPointF o = m_proj->toScreen(obj, true, &visible);
945  if (!visible || !m_proj->onScreen(o))
946  continue;
947 
948  float size = 20.;
949  float x1 = o.x() - 0.5 * size;
950  float y1 = o.y() - 0.5 * size;
951  drawArc(QRectF(x1, y1, size, size), -60 * 16, 120 * 16);
952  drawArc(QRectF(x1, y1, size, size), 120 * 16, 120 * 16);
953  }
954 }
955 
956 void SkyQPainter::drawFlags()
957 {
958  KStarsData *data = KStarsData::Instance();
959  std::shared_ptr<SkyPoint> point;
960  QImage image;
961  bool visible = false;
962  QPointF pos;
963 
964  for (int i = 0; i < data->skyComposite()->flags()->size(); i++)
965  {
966  point = data->skyComposite()->flags()->pointList().at(i);
967  image = data->skyComposite()->flags()->image(i);
968 
969  // Set Horizontal coordinates
970  point->EquatorialToHorizontal(data->lst(), data->geo()->lat());
971 
972  // Get flag position on screen
973  pos = m_proj->toScreen(point.get(), true, &visible);
974 
975  // Return if flag is not visible
976  if (!visible || !m_proj->onScreen(pos))
977  continue;
978 
979  // Draw flag image
980  drawImage(pos.x() - 0.5 * image.width(), pos.y() - 0.5 * image.height(), image);
981 
982  // Draw flag label
983  setPen(data->skyComposite()->flags()->labelColor(i));
984  setFont(QFont("Helvetica", 10, QFont::Bold));
985  drawText(pos.x() + 10, pos.y() - 10, data->skyComposite()->flags()->label(i));
986  }
987 }
988 
989 void SkyQPainter::drawHorizon(bool filled, SkyPoint *labelPoint, bool *drawLabel)
990 {
991  QVector<Vector2f> ground = m_proj->groundPoly(labelPoint, drawLabel);
992  if (ground.size())
993  {
994  QPolygonF groundPoly(ground.size());
995  for (int i = 0; i < ground.size(); ++i)
996  groundPoly[i] = KSUtils::vecToPoint(ground[i]);
997  if (filled)
998  drawPolygon(groundPoly);
999  else
1000  {
1001  groundPoly.append(groundPoly.first());
1002  drawPolyline(groundPoly);
1003  }
1004  }
1005 }
1006 
1007 bool SkyQPainter::drawSatellite(Satellite *sat)
1008 {
1009  if (!m_proj->checkVisibility(sat))
1010  return false;
1011 
1012  QPointF pos;
1013  bool visible = false;
1014 
1015  //sat->HorizontalToEquatorial( data->lst(), data->geo()->lat() );
1016 
1017  pos = m_proj->toScreen(sat, true, &visible);
1018 
1019  if (!visible || !m_proj->onScreen(pos))
1020  return false;
1021 
1022  if (Options::drawSatellitesLikeStars())
1023  {
1024  drawPointSource(pos, 3.5, 'B');
1025  }
1026  else
1027  {
1028  if (sat->isVisible())
1029  drawPixmap(QPoint(pos.x() - 15, pos.y() - 11), *visibleSatPixmap);
1030  else
1031  drawPixmap(QPoint(pos.x() - 15, pos.y() - 11), *invisibleSatPixmap);
1032 
1033  //drawPixmap(pos, *genericSatPixmap);
1034  /*drawLine( QPoint( pos.x() - 0.5, pos.y() - 0.5 ), QPoint( pos.x() + 0.5, pos.y() - 0.5 ) );
1035  drawLine( QPoint( pos.x() + 0.5, pos.y() - 0.5 ), QPoint( pos.x() + 0.5, pos.y() + 0.5 ) );
1036  drawLine( QPoint( pos.x() + 0.5, pos.y() + 0.5 ), QPoint( pos.x() - 0.5, pos.y() + 0.5 ) );
1037  drawLine( QPoint( pos.x() - 0.5, pos.y() + 0.5 ), QPoint( pos.x() - 0.5, pos.y() - 0.5 ) );*/
1038  }
1039 
1040  return true;
1041 
1042  //if ( Options::showSatellitesLabels() )
1043  //data->skyComposite()->satellites()->drawLabel( sat, pos );
1044 }
1045 
1046 bool SkyQPainter::drawSupernova(Supernova *sup)
1047 {
1048  KStarsData *data = KStarsData::Instance();
1049  if (!m_proj->checkVisibility(sup))
1050  {
1051  return false;
1052  }
1053 
1054  bool visible = false;
1055  QPointF pos = m_proj->toScreen(sup, true, &visible);
1056  //qDebug()<<"sup->ra() = "<<(sup->ra()).toHMSString()<<"sup->dec() = "<<sup->dec().toDMSString();
1057  //qDebug()<<"pos = "<<pos<<"m_proj->onScreen(pos) = "<<m_proj->onScreen(pos);
1058  if (!visible || !m_proj->onScreen(pos))
1059  return false;
1060 
1061  setPen(data->colorScheme()->colorNamed("SupernovaColor"));
1062  //qDebug()<<"Here"<<endl;
1063  drawLine(QPoint(pos.x() - 2.0, pos.y()), QPoint(pos.x() + 2.0, pos.y()));
1064  drawLine(QPoint(pos.x(), pos.y() - 2.0), QPoint(pos.x(), pos.y() + 2.0));
1065  return true;
1066 }
SkyQPainter::initStarImages
static void initStarImages()
Recalculates the star pixmaps.
Definition: skyqpainter.cpp:175
FlagComponent::size
int size()
Return the numbers of flags.
Definition: flagcomponent.cpp:241
QTransform
satellitescomponent.h
QPainter::setOpacity
void setOpacity(qreal opacity)
QWidget
QLine
QPen::setStyle
void setStyle(Qt::PenStyle style)
Projector::onScreen
bool onScreen(const QPointF &p) const
Check whether the projected point is on-screen.
Definition: projector.cpp:108
SkyQPainter::releaseImageCache
static void releaseImageCache()
Release the image cache.
Definition: skyqpainter.cpp:99
hipsrenderer.h
SkyQPainter::drawSupernova
bool drawSupernova(Supernova *sup) override
Draw a Supernova.
Definition: skyqpainter.cpp:1046
QSize::width
int width() const
SkyQPainter::drawFlags
void drawFlags() override
Draw flags.
Definition: skyqpainter.cpp:956
KSEarthShadow::getUmbraAngSize
double getUmbraAngSize() const
Definition: ksearthshadow.h:103
KStarsData
KStarsData is the backbone of KStars.
Definition: kstarsdata.h:78
SkyQPainter::drawDeepSkyObject
bool drawDeepSkyObject(DeepSkyObject *obj, bool drawImage=false) override
Draw a deep sky object.
Definition: skyqpainter.cpp:663
SkyQPainter::drawHorizon
void drawHorizon(bool filled, SkyPoint *labelPoint=nullptr, bool *drawLabel=nullptr) override
Definition: skyqpainter.cpp:989
QPixmap::width
int width() const
QPainter::end
bool end()
SkyQPainter::begin
void begin() override
Begin painting.
Definition: skyqpainter.cpp:145
supernova.h
QPainter::fillRect
void fillRect(const QRectF &rectangle, const QBrush &brush)
QPainter::setRenderHint
void setRenderHint(RenderHint hint, bool on)
KSSun
Child class of KSPlanetBase; encapsulates information about the Sun.
Definition: kssun.h:34
SkyQPainter::drawSkyPolyline
void drawSkyPolyline(LineList *list, SkipHashList *skipList=nullptr, LineListLabel *label=nullptr) override
Draw a polyline in the sky.
Definition: skyqpainter.cpp:298
QPixmap::fill
void fill(const QColor &color)
SkyQPainter::drawPlanet
bool drawPlanet(KSPlanetBase *planet) override
Draw a planet.
Definition: skyqpainter.cpp:407
QColor::name
QString name() const
QFont::pointSizeF
qreal pointSizeF() const
KStarsData::colorScheme
ColorScheme * colorScheme()
Definition: kstarsdata.h:179
QPaintDevice
LineListLabel
Definition: linelistlabel.h:35
QGradient::setColorAt
void setColorAt(qreal position, const QColor &color)
deepskyobject.h
QPainter::font
const QFont & font() const
QFont
QPainter::drawPolyline
void drawPolyline(const QPointF *points, int pointCount)
QList::at
const T & at(int i) const
QMap< char, QColor >
KStarsData::Instance
static KStarsData * Instance()
Definition: kstarsdata.h:98
QVector::last
T & last()
ConstellationsArt::image
const QImage & image()
Definition: constellationsart.h:56
QPainter::save
void save()
KStarsData::lst
CachingDms * lst()
Definition: kstarsdata.h:209
SkyQPainter::setPen
void setPen(const QPen &pen) override
Set the pen of the painter.
Definition: skyqpainter.cpp:165
QPainter::drawPolygon
void drawPolygon(const QPointF *points, int pointCount, Qt::FillRule fillRule)
SkyQPainter::drawEarthShadow
bool drawEarthShadow(KSEarthShadow *shadow) override
Draw the earths shadow on the moon (red-ish)
Definition: skyqpainter.cpp:474
constellationsart.h
SkyQPainter::drawSkyPolygon
void drawSkyPolygon(LineList *list, bool forceClip=true) override
Draw a polygon in the sky.
Definition: skyqpainter.cpp:349
SkyMapComposite::solarSystemComposite
SolarSystemComposite * solarSystemComposite()
Definition: skymapcomposite.h:198
QRect::height
int height() const
SkyPoint::EquatorialToHorizontal
void EquatorialToHorizontal(const CachingDms *LST, const CachingDms *lat)
Determine the (Altitude, Azimuth) coordinates of the SkyPoint from its (RA, Dec) coordinates, given the local sidereal time and the observer's latitude.
Definition: skypoint.cpp:70
QBrush
ColorScheme::colorNamed
QColor colorNamed(const QString &name) const
Retrieve a color by name.
Definition: colorscheme.cpp:99
QPoint
QVector::first
T & first()
QImage::isNull
bool isNull() const
KStarsData::geo
GeoLocation * geo()
Definition: kstarsdata.h:215
QPainter::rotate
void rotate(qreal angle)
QPainter::drawLine
void drawLine(const QLineF &line)
QMap::clear
void clear()
QLinearGradient
SkyPainter::m_sm
SkyMap * m_sm
Definition: skypainter.h:187
SkyQPainter::drawSkyBackground
void drawSkyBackground() override
Draw the sky background.
Definition: skyqpainter.cpp:159
LineList
A simple data container used by LineListIndex.
Definition: linelist.h:35
ConstellationsArt::getHeight
double getHeight()
Definition: constellationsart.h:86
QPolygon
GeoLocation::lat
const CachingDms * lat() const
Definition: geolocation.h:82
solarsystemcomposite.h
QPointF
QPaintDevice::width
int width() const
SkyObject::mag
float mag() const
Definition: skyobject.h:208
QMap::keys
QList< Key > keys() const
QWidget::size
size
QPen::color
QColor color() const
QRect
Projector::Gnomonic
Definition: projector.h:90
QPainter::setFont
void setFont(const QFont &font)
SkipHashList
Definition: skiphashlist.h:32
QColor::fromRgb
QColor fromRgb(QRgb rgb)
QTransform::translate
QTransform & translate(qreal dx, qreal dy)
NaN::f
const float f
Definition: nan.h:35
Projector::findPA
double findPA(SkyObject *o, float x, float y) const
Determine the on-screen position angle of a SkyObject.
Definition: projector.cpp:275
QPointF::x
qreal x() const
QPointF::y
qreal y() const
LineList::points
SkyList * points()
return the list of points for iterating or appending (or whatever).
Definition: linelist.h:44
FlagComponent::image
QImage image(int index)
Get image.
Definition: flagcomponent.cpp:276
QPainter::drawPoint
void drawPoint(const QPointF &position)
SkyPoint
The sky coordinates of a point in the sky.
Definition: skypoint.h:56
PointListComponent::pointList
QList< std::shared_ptr< SkyPoint > > & pointList()
Definition: pointlistcomponent.h:59
SkyMapComposite::flags
FlagComponent * flags()
Definition: skymapcomposite.cpp:906
SkyPainter::starWidth
float starWidth(float mag) const
Get the width of a star of magnitude mag.
Definition: skypainter.cpp:45
QPainter::drawArc
void drawArc(const QRectF &rectangle, int startAngle, int spanAngle)
DeepSkyObject::a
float a() const
Definition: deepskyobject.h:141
SkyQPainter::~SkyQPainter
~SkyQPainter() override
Definition: skyqpainter.cpp:140
SkyQPainter::drawPointSource
bool drawPointSource(SkyPoint *loc, float mag, char sp= 'A') override
Draw a point source (e.g., a star).
Definition: skyqpainter.cpp:560
QPainter::setPen
void setPen(const QColor &color)
linelist.h
QImage::width
int width() const
QPainter::drawEllipse
void drawEllipse(const QRectF &rectangle)
DeepSkyObject::image
const QImage & image()
Definition: deepskyobject.h:170
skymapcomposite.h
QPainter::drawPixmap
void drawPixmap(const QRectF &target, const QPixmap &pixmap, const QRectF &source)
QPainter
MINZOOM
#define MINZOOM
Definition: kstarsdata.h:39
SkipHashList::skip
bool skip(int i)
returns the skip flag for the i-th line segment.
Definition: skiphashlist.h:49
SkyQPainter::drawComet
bool drawComet(KSComet *com) override
Draw a comet in the sky.
Definition: skyqpainter.cpp:498
FlagComponent::label
QString label(int index)
Get label.
Definition: flagcomponent.cpp:256
linelistlabel.h
KSPlanetBase::angSize
double angSize() const
Definition: ksplanetbase.h:195
KSComet
A subclass of KSPlanetBase that implements comets.
Definition: kscomet.h:54
QPainter::setBrush
void setBrush(const QBrush &brush)
SkyQPainter::drawSkyLine
void drawSkyLine(SkyPoint *a, SkyPoint *b) override
Draw a line between points in the sky.
Definition: skyqpainter.cpp:272
Options::starColorIntensity
static uint starColorIntensity()
Get Saturation level of star colors.
Definition: Options.h:3413
Supernova
Represents the supernova object.
Definition: supernova.h:36
QPainter::drawText
void drawText(const QPointF &position, const QString &text)
SkyQPainter::drawObservingList
void drawObservingList(const QList< SkyObject * > &obs) override
Draw the symbols for the observing list.
Definition: skyqpainter.cpp:939
SkyMap::isSlewing
bool isSlewing() const
Definition: skymap.cpp:1314
skymap.h
QPixmap::scaled
QPixmap scaled(int width, int height, Qt::AspectRatioMode aspectRatioMode, Qt::TransformationMode transformMode) const
QString
QList< SkyObject * >
QColor
KSPlanetBase::image
const QImage & image() const
Definition: ksplanetbase.h:138
QLineF
QPixmap
KStarsData::skyComposite
SkyMapComposite * skyComposite()
Definition: kstarsdata.h:173
HIPSRenderer::render
bool render(uint16_t w, uint16_t h, QImage *hipsImage, const Projector *m_proj)
Definition: hipsrenderer.cpp:36
Projector::clipLine
QPointF clipLine(SkyPoint *p1, SkyPoint *p2) const
ASSUMES *p1 did not clip but *p2 did.
Definition: projector.cpp:118
QSize
QPainter::brush
const QBrush & brush() const
QColor::setHsvF
void setHsvF(qreal h, qreal s, qreal v, qreal a)
QFontMetrics::width
int width(const QString &text, int len) const
QImage
QFont::setPointSizeF
void setPointSizeF(qreal pointSize)
KSEarthShadow::getPenumbraAngSize
double getPenumbraAngSize() const
Definition: ksearthshadow.h:111
QPainter::viewport
QRect viewport() const
KSEarthShadow
A class that manages the calculation of the earths shadow (in moon distance) as a 'virtual' skyobject...
Definition: ksearthshadow.h:38
QPainter::restore
void restore()
Options.h
DeepSkyObject
Provides all necessary information about a deep-sky object: data inherited from SkyObject (coordinate...
Definition: deepskyobject.h:45
QVector::at
const T & at(int i) const
SkyQPainter::SkyQPainter
SkyQPainter(QPaintDevice *pd, const QSize &canvasSize)
Creates a SkyQPainter with the given QPaintDevice and uses the dimensions of the paint device as canv...
Definition: skyqpainter.cpp:123
point
Definition: overlap.h:177
QRect::width
int width() const
kssun.h
QPainter::drawImage
void drawImage(const QRectF &target, const QImage &image, const QRectF &source, QFlags< Qt::ImageConversionFlag > flags)
SkyQPainter::drawDeepSkySymbol
virtual void drawDeepSkySymbol(const QPointF &pos, int type, float size, float e, float positionAngle)
Definition: skyqpainter.cpp:711
QVector< std::shared_ptr< SkyPoint > >
Options::drawSatellitesLikeStars
static bool drawSatellitesLikeStars()
Get If selected, satellites will be draw like stars, otherwise, draw satellites as small colored squa...
Definition: Options.h:4933
SolarSystemComposite::sun
KSSun * sun()
Definition: solarsystemcomposite.h:49
SkyObject::type
int type(void) const
Definition: skyobject.h:190
ConstellationsArt::getWidth
double getWidth()
Definition: constellationsart.h:83
kscomet.h
Satellite::isVisible
bool isVisible()
Definition: satellite.cpp:1304
dms::PI
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
FlagComponent::labelColor
QColor labelColor(int index)
Get label color.
Definition: flagcomponent.cpp:266
QRectF
QPainter::fontMetrics
QFontMetrics fontMetrics() const
KSUtils::vecToPoint
QPointF vecToPoint(const Eigen::Vector2f &vec)
Convert a vector to a point.
Definition: ksutils.h:116
QPainter::drawConvexPolygon
void drawConvexPolygon(const QPointF *points, int pointCount)
earthshadowcomponent.h
Options::zoomFactor
static double zoomFactor()
Get Zoom Factor, in pixels per radian.
Definition: Options.h:2931
skyqpainter.h
satellite.h
QSize::height
int height() const
Options::starColorMode
static uint starColorMode()
Get Mode for rendering stars.
Definition: Options.h:3387
projector.h
ksearthshadow.h
QPainter::translate
void translate(const QPointF &offset)
SkyMap::Instance
static SkyMap * Instance()
Definition: skymap.cpp:145
Options::showCometComas
static bool showCometComas()
Get Draw comet comas in the sky map?
Definition: Options.h:1779
Satellite
Represents an artificial satellites.
Definition: satellite.h:33
KSPlanetBase
A subclass of TrailObject that provides additional information needed for most solar system objects...
Definition: ksplanetbase.h:60
SkyQPainter::end
void end() override
End and finalize painting.
Definition: skyqpainter.cpp:154
HIPSRenderer
Definition: hipsrenderer.h:31
QPen
QColor::getHsvF
void getHsvF(qreal *h, qreal *s, qreal *v, qreal *a) const
QImage::height
int height() const
ConstellationsArt
Information about a ConstellationsArt object.
Definition: constellationsart.h:39
QMap::insert
iterator insert(const Key &key, const T &value)
ksasteroid.h
SkyQPainter::drawSatellite
bool drawSatellite(Satellite *sat) override
Draw a satellite.
Definition: skyqpainter.cpp:1007
QMap::isEmpty
bool isEmpty() const
kstarsdata.h
DeepSkyObject::e
float e() const
Definition: deepskyobject.cpp:102
SkyQPainter::drawConstellationArtImage
bool drawConstellationArtImage(ConstellationsArt *obj) override
Draw a ConstellationsArt object.
Definition: skyqpainter.cpp:617
Projector::groundPoly
virtual QVector< Vector2f > groundPoly(SkyPoint *labelpoint=nullptr, bool *drawLabel=nullptr) const
Get the ground polygon.
Definition: projector.cpp:280
QPaintDevice::height
int height() const
SkyObject::name
virtual QString name(void) const
Definition: skyobject.h:147
KSComet::getComaAngSize
dms getComaAngSize()
Definition: kscomet.h:120
SkyQPainter::setBrush
void setBrush(const QBrush &brush) override
Set the brush of the painter.
Definition: skyqpainter.cpp:170
QVector::size
int size() const
SkyObject
Provides all necessary information about an object in the sky: its coordinates, name(s), type, magnitude, and QStringLists of URLs for images and webpages regarding the object.
Definition: skyobject.h:43
Projector::toScreen
QPointF toScreen(const SkyPoint *o, bool oRefract=true, bool *onVisibleHemisphere=nullptr) const
This is exactly the same as toScreenVec but it returns a QPointF.
Definition: projector.cpp:103
QPainter::begin
bool begin(QPaintDevice *device)
Projector::checkVisibility
bool checkVisibility(const SkyPoint *p) const
Determine if the skypoint p is likely to be visible in the display window.
Definition: projector.cpp:193
QPainter::pen
const QPen & pen() const
SkyMap::projector
const Projector * projector() const
Get the current projector.
Definition: skymap.h:300
skiphashlist.h
SkyPainter
Draws things on the sky, without regard to backend.
Definition: skypainter.h:47
flagcomponent.h
Options::useAntialias
static bool useAntialias()
Get Use antialiasing when drawing the screen?
Definition: Options.h:2900
Options::showPlanetImages
static bool showPlanetImages()
Get Draw planets as images in the sky map?
Definition: Options.h:2349
LineListLabel::updateLabelCandidates
void updateLabelCandidates(qreal x, qreal y, LineList *lineList, int i)
Definition: linelistlabel.cpp:62
QMap::value
const T value(const Key &key) const
dms::arcmin
int arcmin() const
Definition: dms.cpp:188
QPolygonF
SkyQPainter::drawHips
bool drawHips() override
drawHips Draw HIPS all sky catalog
Definition: skyqpainter.cpp:650
This file is part of the KDE documentation.
Documentation copyright © 1996-2019 The KDE developers.
Generated on Sun Dec 15 2019 03:10:19 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kstars

Skip menu "kstars"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

edu API Reference

Skip menu "edu API Reference"
  •     core
  • kstars

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal