Warning, file /education/kstars/kstars/skypainter.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
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 #pragma once 0009 0010 #include "skycomponents/typedef.h" 0011 #include "config-kstars.h" 0012 0013 #include <QList> 0014 #include <QPainter> 0015 0016 class ConstellationsArt; 0017 class DeepSkyObject; 0018 class KSComet; 0019 class KSPlanetBase; 0020 class KSEarthShadow; 0021 class LineList; 0022 class LineListLabel; 0023 class Satellite; 0024 class MosaicTiles; 0025 class SkipHashList; 0026 class SkyMap; 0027 class SkyObject; 0028 class SkyPoint; 0029 class Supernova; 0030 class CatalogObject; 0031 0032 /** 0033 * @short Draws things on the sky, without regard to backend. 0034 * This class serves as an interface to draw objects onto the sky without 0035 * worrying about whether we are using a QPainter or OpenGL. 0036 */ 0037 class SkyPainter 0038 { 0039 public: 0040 SkyPainter(); 0041 0042 virtual ~SkyPainter() = default; 0043 0044 /** @short Set the pen of the painter **/ 0045 virtual void setPen(const QPen &pen) = 0; 0046 0047 /** @short Set the brush of the painter **/ 0048 virtual void setBrush(const QBrush &brush) = 0; 0049 0050 //FIXME: find a better way to do this. 0051 void setSizeMagLimit(float sizeMagLim); 0052 0053 /** 0054 * Begin painting. 0055 * @note this function <b>must</b> be called before painting anything. 0056 * @see end() 0057 */ 0058 virtual void begin() = 0; 0059 0060 /** 0061 * End and finalize painting. 0062 * @note this function <b>must</b> be called after painting anything. 0063 * @note it is not guaranteed that anything will actually be drawn until end() is called. 0064 * @see begin(); 0065 */ 0066 virtual void end() = 0; 0067 0068 //////////////////////////////////// 0069 // // 0070 // SKY DRAWING FUNCTIONS: // 0071 // // 0072 //////////////////////////////////// 0073 0074 /** @short Draw the sky background */ 0075 virtual void drawSkyBackground() = 0; 0076 0077 /** 0078 * @short Draw a line between points in the sky. 0079 * @param a the first point 0080 * @param b the second point 0081 * @note this function will skip lines not on screen and clip lines 0082 * that are only partially visible. 0083 */ 0084 virtual void drawSkyLine(SkyPoint *a, SkyPoint *b) = 0; 0085 0086 /** 0087 * @short Draw a polyline in the sky. 0088 * @param list a list of points in the sky 0089 * @param skipList a SkipList object used to control skipping line segments 0090 * @param label a pointer to the label for this line 0091 * @note it's more efficient to use this than repeated calls to drawSkyLine(), 0092 * because it avoids an extra points->size() -2 projections. 0093 */ 0094 virtual void drawSkyPolyline(LineList *list, SkipHashList *skipList = nullptr, 0095 LineListLabel *label = nullptr) = 0; 0096 0097 /** 0098 * @short Draw a polygon in the sky. 0099 * @param list a list of points in the sky 0100 * @param forceClip If true (default), it enforces clipping of the polygon, otherwise, it draws the 0101 * complete polygen without running any boundary checks. 0102 * @see drawSkyPolyline() 0103 */ 0104 virtual void drawSkyPolygon(LineList *list, bool forceClip = true) = 0; 0105 0106 /** 0107 * @short Draw a comet in the sky. 0108 * @param com comet to draw 0109 * @return true if a comet was drawn 0110 */ 0111 virtual bool drawComet(KSComet *com) = 0; 0112 0113 /** 0114 * @short Draw a point source (e.g., a star). 0115 * @param loc the location of the source in the sky 0116 * @param mag the magnitude of the source 0117 * @param sp the spectral class of the source 0118 * @return true if a source was drawn 0119 */ 0120 virtual bool drawPointSource(const SkyPoint *loc, float mag, char sp = 'A') = 0; 0121 0122 /** 0123 * @short Draw a deep sky object (loaded from the new implementation) 0124 * @param obj the object to draw 0125 * @param drawImage if true, try to draw the image of the object 0126 * @return true if it was drawn 0127 */ 0128 virtual bool drawCatalogObject(const CatalogObject &obj) = 0; 0129 0130 /** 0131 * @short Draw a planet 0132 * @param planet the planet to draw 0133 * @return true if it was drawn 0134 */ 0135 virtual bool drawPlanet(KSPlanetBase *planet) = 0; 0136 0137 /** 0138 * @short Draw the earths shadow on the moon (red-ish) 0139 * @param shadow the shadow to draw 0140 * @return true if it was drawn 0141 */ 0142 virtual bool drawEarthShadow(KSEarthShadow *shadow) = 0; 0143 0144 /** 0145 * @short Draw the symbols for the observing list 0146 * @param obs the observing list 0147 */ 0148 virtual void drawObservingList(const QList<SkyObject *> &obs) = 0; 0149 0150 /** @short Draw flags */ 0151 virtual void drawFlags() = 0; 0152 0153 /** @short Draw a satellite */ 0154 virtual bool drawSatellite(Satellite *sat) = 0; 0155 0156 /** @short Draw a Supernova */ 0157 virtual bool drawSupernova(Supernova *sup) = 0; 0158 0159 virtual void drawHorizon(bool filled, SkyPoint *labelPoint = nullptr, 0160 bool *drawLabel = nullptr) = 0; 0161 0162 /** @short Get the width of a star of magnitude mag */ 0163 float starWidth(float mag) const; 0164 0165 /** 0166 * @short Draw a ConstellationsArt object 0167 * @param obj the object to draw 0168 * @return true if it was drawn 0169 */ 0170 virtual bool drawConstellationArtImage(ConstellationsArt *obj) = 0; 0171 0172 /** 0173 * @brief drawMosaicPanel Draws mosaic panel in planning or operation mode. 0174 * @return true if it was drawn 0175 */ 0176 #ifdef HAVE_INDI 0177 virtual bool drawMosaicPanel(MosaicTiles *obj) = 0; 0178 #endif 0179 /** 0180 * @brief drawHips Draw HIPS all sky catalog 0181 * @param useCache if True, try to re-use last generated image instead of rendering a new image. 0182 * @return true if it was drawn 0183 */ 0184 virtual bool drawHips(bool useCache = false) = 0; 0185 0186 /** 0187 * @brief drawHips Draw the Terrain 0188 * @param useCache if True, try to re-use last generated image instead of rendering a new image. 0189 * @return true if it was drawn 0190 */ 0191 virtual bool drawTerrain(bool useCache = false) = 0; 0192 0193 private: 0194 float m_sizeMagLim{ 10.0f }; 0195 };