1 /***********************************************************************
2 * SPDX-FileCopyrightText: 2003-2004 Max Howell <max.howell@methylblue.com>
3 * SPDX-FileCopyrightText: 2008-2009 Martin Sandsmark <martin.sandsmark@kde.org>
4 *
5 * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
6 ***********************************************************************/
7 
8 #ifndef MAP_H
9 #define MAP_H
10 
11 #include "fileTree.h"
12 
13 #include <KColorScheme>
14 
15 #include <QPixmap>
16 #include <QRectF>
17 #include <QString>
18 
19 namespace RadialMap {
20 class Segment;
21 
22 class Map
23 {
24 public:
25     explicit Map(bool summary);
26     ~Map();
27 
28     void make(const Folder *, bool = false);
29     bool resize(const QRectF&);
30 
isNull()31     bool isNull() const {
32         return (m_signature.isEmpty());
33     }
34     void invalidate();
35 
height()36     qreal height() const {
37         return m_rect.height();
38     }
width()39     qreal width() const {
40         return m_rect.width();
41     }
pixmap()42     QPixmap pixmap() const {
43         return m_pixmap;
44     }
45 
46     void saveSvg(const QString &path);
47 
48 
49     friend class Widget;
50 
51 private:
52     void paint(QPaintDevice *paintDevice = nullptr);
53     void colorise();
54     void setRingBreadth();
55     void findVisibleDepth(const Folder *dir, uint currentDepth = 0);
56     bool build(const Folder* const dir, const uint depth =0, uint a_start =0, const uint a_end =5760);
57 
58     QVector<QList<Segment*>> m_signature;
59 
60     const Folder *m_root;
61     uint m_minSize;
62     QVector<FileSize> m_limits;
63     QRectF m_rect;
64     uint m_visibleDepth; ///visible level depth of system
65     QPixmap m_pixmap;
66     int m_ringBreadth;
67     uint m_innerRadius;  ///radius of inner circle
68     QString m_centerText;
69     bool m_summary;
70     qreal m_dpr;
71 
72     uint MAP_2MARGIN;
73 };
74 }
75 
76 #endif
77