File indexing completed on 2022-12-06 18:58:55

0001 /*
0002     SkyPainter: class for painting onto the sky for KStars
0003     SPDX-FileCopyrightText: 2010 Henry de Valence <hdevalence@gmail.com>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #include "skypainter.h"
0009 
0010 #include "skymap.h"
0011 #include "Options.h"
0012 #include "kstarsdata.h"
0013 #include "skycomponents/skiphashlist.h"
0014 #include "skycomponents/linelistlabel.h"
0015 #include "skyobjects/kscomet.h"
0016 #include "skyobjects/ksasteroid.h"
0017 #include "skyobjects/ksplanetbase.h"
0018 #include "skyobjects/trailobject.h"
0019 #include "skyobjects/constellationsart.h"
0020 
0021 SkyPainter::SkyPainter()
0022 {
0023 }
0024 
0025 void SkyPainter::setSizeMagLimit(float sizeMagLim)
0026 {
0027     m_sizeMagLim = sizeMagLim;
0028 }
0029 
0030 float SkyPainter::starWidth(float mag) const
0031 {
0032     //adjust maglimit for ZoomLevel
0033     const double maxSize = 10.0;
0034 
0035     double lgmin = log10(MINZOOM);
0036     //    double lgmax = log10(MAXZOOM);
0037     double lgz = log10(Options::zoomFactor());
0038 
0039     float sizeFactor = maxSize + (lgz - lgmin);
0040 
0041     float size = (sizeFactor * (m_sizeMagLim - mag) / m_sizeMagLim) + 1.;
0042     if (size <= 1.0)
0043         size = 1.0;
0044     if (size > maxSize)
0045         size = maxSize;
0046 
0047     return size;
0048 }