File indexing completed on 2024-07-14 07:17:20

0001 /*
0002     SPDX-FileCopyrightText: 2005 Thomas Kabelmann <thomas.kabelmann@gmx.de>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "listcomponent.h"
0010 
0011 class CultureList;
0012 class KSNumbers;
0013 class SkyComposite;
0014 class SkyPainter;
0015 
0016 /**
0017  * @class ConstellationNamesComponent
0018  * Represents the constellation names on the sky map.
0019  *
0020  * @author Thomas Kabelmann
0021  * @version 0.1
0022  */
0023 class ConstellationNamesComponent : public ListComponent
0024 {
0025   public:
0026     /**
0027      * @short Constructor
0028      * @p parent Pointer to the parent SkyComposite object
0029      *
0030      * Reads the constellation names data from cnames.dat
0031      * Each line in the file is parsed according to column position:
0032      * @li 0-1     RA hours [int]
0033      * @li 2-3     RA minutes [int]
0034      * @li 4-5     RA seconds [int]
0035      * @li 6       Dec sign [char; '+' or '-']
0036      * @li 7-8     Dec degrees [int]
0037      * @li 9-10    Dec minutes [int]
0038      * @li 11-12   Dec seconds [int]
0039      * @li 13-15   IAU Abbreviation [string]  e.g., 'Ori' == Orion
0040      * @li 17-     Constellation name [string]
0041      */
0042     ConstellationNamesComponent(SkyComposite *parent, CultureList *cultures);
0043 
0044     virtual ~ConstellationNamesComponent() override = default;
0045 
0046     /**
0047      * @short Draw constellation names on the sky map.
0048      * @p psky Reference to the QPainter on which to paint
0049      */
0050     void draw(SkyPainter *skyp) override;
0051 
0052     /**
0053      * @short we need a custom routine (for now) so we don't
0054      * precess the locations of the names.
0055      */
0056     void update(KSNumbers *num) override;
0057 
0058     /** @short Return true if we are using localized constellation names */
0059     inline bool isLocalCNames() { return localCNames; }
0060 
0061     bool selected() override;
0062 
0063     void loadData(CultureList *cultures);
0064 
0065   private:
0066     bool localCNames { false };
0067 };