Kstars

constellationsart.h
1 /*
2  SPDX-FileCopyrightText: 2015 M.S.Adityan <[email protected]>
3 
4  SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 
7 #pragma once
8 
9 #include "skyobjects/skyobject.h"
10 
11 #include <QImage>
12 #include <QString>
13 
14 class dms;
15 
16 /**
17  * @class ConstellationsArt
18  * @short Information about a ConstellationsArt object. This class represents a constellation image.
19  *
20  * Provides all necessary information about a constellationsart object
21  * data inherited from SkyObject includes RA/DEC coordinate pairs.
22  * Data specific to ConstellationsArt objects includes the abbreviation
23  * filename, constellation image, position angle, width and height.
24  *
25  * @author M.S.Adityan
26  * @version 0.1
27  */
29 {
30  public:
31  /**
32  * Constructor. Set ConstellationsArt data according to parameters.
33  * @param midpointra RA of the midpoint of the constellation
34  * @param midpointdec DEC of the midpoint of the constellation
35  * @param pa position angle
36  * @param w width of the constellation image
37  * @param h height of the constellation image
38  * @param abbreviation abbreviation of the constellation
39  * @param filename the file name of the image of the constellation.
40  */
41  explicit ConstellationsArt(dms &midpointra, dms &midpointdec, double pa, double w, double h,
42  const QString &abbreviation, const QString &filename);
43 
44  /** @return an object's image */
45  const QImage &image()
46  {
47  if (imageLoaded)
48  return constellationArtImage;
49  else
50  {
51  loadImage();
52  return constellationArtImage;
53  }
54  }
55 
56  /** Load the object's image. This also scales the object's image to 1024x1024 pixels. */
57  void loadImage();
58 
59  /** @return an object's abbreviation */
60  inline QString getAbbrev() const { return abbrev; }
61 
62  /** @return an object's image file name*/
63  inline QString getImageFileName() const { return imageFileName; }
64 
65  /** @return an object's position angle */
66  inline double pa() const override { return positionAngle; }
67 
68  /** Set the position angle */
69  inline void setPositionAngle(double pa) { positionAngle = pa; }
70 
71  /** @return an object's width */
72  inline double getWidth() { return width; }
73 
74  /** @return an object's height*/
75  inline double getHeight() { return height; }
76 
77  private:
78  QString abbrev;
79  QString imageFileName;
80  QImage constellationArtImage;
81  double positionAngle { 0 };
82  double width { 0 };
83  double height { 0 };
84  bool imageLoaded { false };
85 };
ConstellationsArt(dms &midpointra, dms &midpointdec, double pa, double w, double h, const QString &abbreviation, const QString &filename)
Constructor.
void loadImage()
Load the object's image.
QString getImageFileName() const
double pa() const override
const QImage & image()
An angle, stored as degrees, but expressible in many ways.
Definition: dms.h:37
QString getAbbrev() const
void setPositionAngle(double pa)
Set the position angle.
Information about a ConstellationsArt object. This class represents a constellation image.
Information about an object in the sky.
Definition: skyobject.h:41
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Fri Aug 19 2022 03:57:50 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.