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 RADIALMAP_H 9 #define RADIALMAP_H 10 11 #include <QColor> 12 13 class File; 14 15 namespace RadialMap 16 { 17 class Segment //all angles are in 16ths of degrees 18 { 19 public: 20 Segment(const File *f, uint s, uint l, bool isFake = false) m_angleStart(s)21 : m_angleStart(s) 22 , m_angleSegment(l) 23 , m_file(f) 24 , m_hasHiddenChildren(false) 25 , m_fake(isFake) {} 26 ~Segment(); 27 start()28 uint start() const { 29 return m_angleStart; 30 } length()31 uint length() const { 32 return m_angleSegment; 33 } end()34 uint end() const { 35 return m_angleStart + m_angleSegment; 36 } file()37 const File *file() const { 38 return m_file; 39 } pen()40 const QColor& pen() const { 41 return m_pen; 42 } brush()43 const QColor& brush() const { 44 return m_brush; 45 } 46 isFake()47 bool isFake() const { 48 return m_fake; 49 } hasHiddenChildren()50 bool hasHiddenChildren() const { 51 return m_hasHiddenChildren; 52 } 53 intersects(uint a)54 bool intersects(uint a) const { 55 return ((a >= start()) && (a < end())); 56 } 57 58 friend class Map; 59 friend class Builder; 60 61 private: setPalette(const QColor & p,const QColor & b)62 void setPalette(const QColor &p, const QColor &b) { 63 m_pen = p; 64 m_brush = b; 65 } 66 67 const uint m_angleStart, m_angleSegment; 68 const File* const m_file = nullptr; 69 QColor m_pen, m_brush; 70 bool m_hasHiddenChildren; 71 const bool m_fake; 72 }; 73 } 74 75 76 #ifndef PI 77 #define PI 3.141592653589793 78 #endif 79 #ifndef M_PI 80 #define M_PI 3.14159265358979323846264338327 81 #endif 82 83 #define MIN_RING_BREADTH 20 84 #define MAX_RING_BREADTH 60 85 #define DEFAULT_RING_DEPTH 4 //first level = 0 86 #define MIN_RING_DEPTH 0 87 88 #define MAP_HIDDEN_TRIANGLE_SIZE 5 89 90 #define LABEL_MAP_SPACER 7 91 #define LABEL_TEXT_HMARGIN 5 92 #define LABEL_TEXT_VMARGIN 0 93 #define LABEL_ANGLE_MARGIN 32 94 #define LABEL_MIN_ANGLE_FACTOR 0.05 95 #define LABEL_MAX_CHARS 30 96 97 #endif 98