File indexing completed on 2024-05-12 17:21:41

0001 /*
0002     SPDX-FileCopyrightText: 2003-2004 Max Howell <max.howell@methylblue.com>
0003     SPDX-FileCopyrightText: 2004-2022 Krusader Krew <https://krusader.org>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #ifndef RADIALMAP_H
0009 #define RADIALMAP_H
0010 
0011 // QtGui
0012 #include <QColor>
0013 
0014 class File;
0015 
0016 namespace RadialMap
0017 {
0018 class Segment // all angles are in 16ths of degrees
0019 {
0020 public:
0021     Segment(const File *f, uint s, uint l, bool isFake = false)
0022         : m_angleStart(s)
0023         , m_angleSegment(l)
0024         , m_file(f)
0025         , m_hasHiddenChildren(false)
0026         , m_fake(isFake)
0027     {
0028     }
0029     ~Segment();
0030 
0031     uint start() const
0032     {
0033         return m_angleStart;
0034     }
0035     uint length() const
0036     {
0037         return m_angleSegment;
0038     }
0039     uint end() const
0040     {
0041         return m_angleStart + m_angleSegment;
0042     }
0043     const File *file() const
0044     {
0045         return m_file;
0046     }
0047     const QColor &pen() const
0048     {
0049         return m_pen;
0050     }
0051     const QColor &brush() const
0052     {
0053         return m_brush;
0054     }
0055 
0056     bool isFake() const
0057     {
0058         return m_fake;
0059     }
0060     bool hasHiddenChildren() const
0061     {
0062         return m_hasHiddenChildren;
0063     }
0064 
0065     bool intersects(uint a) const
0066     {
0067         return ((a >= start()) && (a < end()));
0068     }
0069 
0070     friend class Map;
0071     friend class Builder;
0072 
0073 private:
0074     void setPalette(const QColor &p, const QColor &b)
0075     {
0076         m_pen = p;
0077         m_brush = b;
0078     }
0079 
0080     const uint m_angleStart, m_angleSegment;
0081     const File *const m_file;
0082     QColor m_pen, m_brush;
0083     bool m_hasHiddenChildren;
0084     const bool m_fake;
0085 };
0086 }
0087 
0088 #ifndef PI
0089 #define PI 3.141592653589793
0090 #endif
0091 #ifndef M_PI
0092 #define M_PI 3.14159265358979323846264338327
0093 #endif
0094 
0095 #define MIN_RING_BREADTH 20
0096 #define MAX_RING_BREADTH 60
0097 #define DEFAULT_RING_DEPTH 4 // first level = 0
0098 #define MIN_RING_DEPTH 0
0099 
0100 #define LABEL_MAP_SPACER 7
0101 #define LABEL_HMARGIN 10
0102 #define LABEL_TEXT_HMARGIN 5
0103 #define LABEL_TEXT_VMARGIN 0
0104 #define LABEL_ANGLE_MARGIN 32
0105 #define LABEL_MIN_ANGLE_FACTOR 0.05
0106 
0107 #endif