Kstars

skypainter.cpp
1 /*
2  SkyPainter: class for painting onto the sky for KStars
3  SPDX-FileCopyrightText: 2010 Henry de Valence <[email protected]>
4 
5  SPDX-License-Identifier: GPL-2.0-or-later
6 */
7 
8 #include "skypainter.h"
9 
10 #include "skymap.h"
11 #include "Options.h"
12 #include "kstarsdata.h"
13 #include "skycomponents/skiphashlist.h"
14 #include "skycomponents/linelistlabel.h"
15 #include "skyobjects/kscomet.h"
16 #include "skyobjects/ksasteroid.h"
17 #include "skyobjects/ksplanetbase.h"
18 #include "skyobjects/trailobject.h"
19 #include "skyobjects/constellationsart.h"
20 
21 SkyPainter::SkyPainter()
22 {
23 }
24 
25 void SkyPainter::setSizeMagLimit(float sizeMagLim)
26 {
27  m_sizeMagLim = sizeMagLim;
28 }
29 
30 float SkyPainter::starWidth(float mag) const
31 {
32  //adjust maglimit for ZoomLevel
33  const double maxSize = 10.0;
34 
35  double lgmin = log10(MINZOOM);
36  // double lgmax = log10(MAXZOOM);
37  double lgz = log10(Options::zoomFactor());
38 
39  float sizeFactor = maxSize + (lgz - lgmin);
40 
41  float size = (sizeFactor * (m_sizeMagLim - mag) / m_sizeMagLim) + 1.;
42  if (size <= 1.0)
43  size = 1.0;
44  if (size > maxSize)
45  size = maxSize;
46 
47  return size;
48 }
float starWidth(float mag) const
Get the width of a star of magnitude mag.
Definition: skypainter.cpp:30
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Fri Aug 12 2022 04:00:58 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.