File indexing completed on 2025-04-27 12:57:39
0001 /* 0002 SPDX-FileCopyrightText: 2005 Jason Harris <kstars@30doradus.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "noprecessindex.h" 0010 0011 #include <QHash> 0012 #include <QPolygonF> 0013 0014 class PolyList; 0015 class ConstellationBoundary; 0016 class KSFileReader; 0017 0018 typedef QVector<std::shared_ptr<PolyList>> PolyListList; 0019 typedef QVector<std::shared_ptr<PolyListList>> PolyIndex; 0020 0021 /** 0022 * @class ConstellationBoundary 0023 * Collection of lines comprising the borders between constellations 0024 * 0025 * @author Jason Harris 0026 * @version 0.1 0027 */ 0028 class ConstellationBoundaryLines : public NoPrecessIndex 0029 { 0030 public: 0031 /** 0032 * @short Constructor 0033 * Simply adds all of the coordinate grid circles (meridians and parallels) 0034 * @p parent Pointer to the parent SkyComposite object 0035 * 0036 * Reads the constellation boundary data from cbounds.dat. The boundary data is defined by 0037 * a series of RA,Dec coordinate pairs defining the "nodes" of the boundaries. The nodes are 0038 * organized into "segments", such that each segment represents a continuous series 0039 * of boundary-line intervals that divide two particular constellations. 0040 */ 0041 explicit ConstellationBoundaryLines(SkyComposite *parent); 0042 virtual ~ConstellationBoundaryLines() override = default; 0043 0044 QString constellationName(const SkyPoint *p) const; 0045 0046 bool selected() override; 0047 0048 void preDraw(SkyPainter *skyp) override; 0049 0050 private: 0051 void appendPoly(const std::shared_ptr<PolyList> &polyList, int debug = 0); 0052 0053 /** 0054 * @short reads the indices from the KSFileReader instead of using 0055 * the SkyMesh to create them. If the file pointer is null or if 0056 * debug == -1 then we fall back to using the index. 0057 */ 0058 void appendPoly(std::shared_ptr<PolyList> &polyList, KSFileReader *file, int debug); 0059 0060 PolyList *ContainingPoly(const SkyPoint *p) const; 0061 0062 SkyMesh *m_skyMesh { nullptr }; 0063 PolyIndex m_polyIndex; 0064 int m_polyIndexCnt { 0 }; 0065 };