File indexing completed on 2024-05-12 03:45:46

0001 /*
0002     SPDX-FileCopyrightText: 2016 Artem Fedoskin <afedoskin3@gmail.com>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #pragma once
0007 
0008 #include "linelist.h"
0009 #include "../../skyopacitynode.h"
0010 
0011 #include <QColor>
0012 #include <QSGGeometryNode>
0013 
0014 class QSGFlatColorMaterial;
0015 
0016 class SkyMapLite;
0017 class SkipHashList;
0018 
0019 /**
0020  * @class LineNode
0021  *
0022  * @short SkyOpacityNode derived class that draws lines from LineList
0023  *
0024  * @author Artem Fedoskin
0025  * @version 1.0
0026  */
0027 class LineNode : public SkyOpacityNode
0028 {
0029   public:
0030     /**
0031      * @short Constructor
0032      * @param lineList - lines that have to be drawn
0033      * @param skipList - lines that have to be skipped
0034      * @param color - line color
0035      * @param width - line width
0036      * @param drawStyle - not used currently
0037      */
0038     LineNode(LineList *lineList, SkipHashList *skipList, QColor color, int width, Qt::PenStyle drawStyle);
0039     virtual ~LineNode();
0040 
0041     void setColor(QColor color);
0042     void setWidth(int width);
0043     void setDrawStyle(Qt::PenStyle drawStyle);
0044 
0045     void setStyle(QColor color, int width, Qt::PenStyle drawStyle);
0046 
0047     /**
0048      * @short Update lines based on the visibility of line segments in m_lineList
0049      */
0050     void updateGeometry();
0051 
0052     inline LineList *lineList() { return m_lineList; }
0053 
0054   private:
0055     QSGGeometryNode *m_geometryNode { nullptr };
0056     LineList *m_lineList { nullptr };
0057     SkipHashList *m_skipList { nullptr };
0058 
0059     QSGGeometry *m_geometry { nullptr };
0060     QSGFlatColorMaterial *m_material { nullptr };
0061 
0062     Qt::PenStyle m_drawStyle;
0063     QColor m_color;
0064 };