File indexing completed on 2024-04-21 14:46:45

0001 /*
0002     SPDX-FileCopyrightText: 2006 Jason Harris <kstarss@30doradus.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "skypoint.h"
0010 
0011 class dms;
0012 class KStarsData;
0013 
0014 /**
0015  * @class SkyLine
0016  *
0017  * A series of connected line segments in the sky, composed of SkyPoints at
0018  * its vertices.  SkyLines are used for constellation lines and boundaries,
0019  * the coordinate grid, and the equator, ecliptic and horizon.
0020  *
0021  * @note the SkyLine segments are always straight lines, they are not
0022  * Great Circle segments joining the two endpoints.  Therefore, line segments
0023  * that need to follow great circles must be approximated with many short
0024  * SkyLine segments.
0025  */
0026 class SkyLine
0027 {
0028   public:
0029     SkyLine() = default;
0030 
0031     ~SkyLine();
0032 
0033     /**
0034      * Append a segment to the list by adding a new endpoint.
0035      *
0036      * @param p the new endpoint to be added
0037      */
0038     void append(SkyPoint *p);
0039 
0040     /**
0041      * @return a const pointer to a point in the SkyLine
0042      * param i the index position of the point
0043      */
0044     inline SkyPoint *point(int i) const { return m_pList[i]; }
0045 
0046     inline QList<SkyPoint *> &points() { return m_pList; }
0047 
0048     /** Remove all points from list */
0049     void clear();
0050 
0051     /**
0052      * Set point i in the SkyLine
0053      *
0054      * @param i the index position of the point to modify
0055      * @param p the new SkyPoint
0056      */
0057     void setPoint(int i, SkyPoint *p);
0058 
0059     /**
0060      * @return the angle subtended by any line segment along the SkyLine.
0061      * @param i the index of the line segment to be measured.
0062      * If no argument is given, the first segment is assumed.
0063      */
0064     dms angularSize(int i = 0) const;
0065 
0066     void update(KStarsData *data, KSNumbers *num = nullptr);
0067 
0068   private:
0069     QList<SkyPoint *> m_pList;
0070 };