File indexing completed on 2024-04-14 03:43:09

0001 /*
0002     SPDX-FileCopyrightText: 2015 M.S.Adityan <msadityan@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "skyobjects/skyobject.h"
0010 
0011 #include <QImage>
0012 #include <QString>
0013 
0014 class dms;
0015 
0016 /**
0017  * @class ConstellationsArt
0018  * @short Information about a ConstellationsArt object. This class represents a constellation image.
0019  *
0020  * Provides all necessary information about a constellationsart object
0021  * data inherited from SkyObject includes RA/DEC coordinate pairs.
0022  * Data specific to ConstellationsArt objects includes the abbreviation
0023  * filename, constellation image, position angle, width and height.
0024  *
0025  * @author M.S.Adityan
0026  * @version 0.1
0027  */
0028 class ConstellationsArt : public SkyObject
0029 {
0030   public:
0031     /**
0032      * Constructor. Set ConstellationsArt data according to parameters.
0033      * @param midpointra RA of the midpoint of the constellation
0034      * @param midpointdec DEC of the midpoint of the constellation
0035      * @param pa position angle
0036      * @param w width of the constellation image
0037      * @param h height of the constellation image
0038      * @param abbreviation abbreviation of the constellation
0039      * @param filename the file name of the image of the constellation.
0040      */
0041     explicit ConstellationsArt(dms &midpointra, dms &midpointdec, double pa, double w, double h,
0042                                const QString &abbreviation, const QString &filename);
0043 
0044     /** @return an object's image */
0045     const QImage &image()
0046     {
0047         if (imageLoaded)
0048             return constellationArtImage;
0049         else
0050         {
0051             loadImage();
0052             return constellationArtImage;
0053         }
0054     }
0055 
0056     /** Load the object's image. This also scales the object's image to 1024x1024 pixels. */
0057     void loadImage();
0058 
0059     /** @return an object's abbreviation */
0060     inline QString getAbbrev() const { return abbrev; }
0061 
0062     /** @return an object's image file name*/
0063     inline QString getImageFileName() const { return imageFileName; }
0064 
0065     /** @return an object's position angle */
0066     inline double pa() const override { return positionAngle; }
0067 
0068     /** Set the position angle */
0069     inline void setPositionAngle(double pa) { positionAngle = pa; }
0070 
0071     /** @return an object's width */
0072     inline double getWidth() { return width; }
0073 
0074     /** @return an object's height*/
0075     inline double getHeight() { return height; }
0076 
0077   private:
0078     QString abbrev;
0079     QString imageFileName;
0080     QImage constellationArtImage;
0081     double positionAngle { 0 };
0082     double width { 0 };
0083     double height { 0 };
0084     bool imageLoaded { false };
0085 };