1 // This file is part of Heimer.
2 // Copyright (C) 2018 Jussi Lind <jussi.lind@iki.fi>
3 //
4 // Heimer is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 // Heimer is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with Heimer. If not, see <http://www.gnu.org/licenses/>.
15 
16 #ifndef MIND_MAP_DATA_HPP
17 #define MIND_MAP_DATA_HPP
18 
19 #include <QFont>
20 #include <QString>
21 
22 #include "constants.hpp"
23 #include "graph.hpp"
24 #include "image_manager.hpp"
25 #include "mind_map_data_base.hpp"
26 
27 class ObjectModelLoader;
28 
29 class MindMapData : public MindMapDataBase
30 {
31 public:
32     MindMapData(QString name = "");
33 
34     MindMapData(const MindMapData & other);
35 
36     virtual ~MindMapData() override;
37 
38     double aspectRatio() const;
39 
40     void setAspectRatio(double aspectRatio);
41 
42     QColor backgroundColor() const;
43 
44     void setBackgroundColor(const QColor & backgroundColor);
45 
46     int cornerRadius() const;
47 
48     void setCornerRadius(int cornerRadius);
49 
50     QColor edgeColor() const;
51 
52     void setEdgeColor(const QColor & edgeColor);
53 
54     QColor gridColor() const;
55 
56     void setGridColor(const QColor & edgeColor);
57 
58     double edgeWidth() const;
59 
60     void setEdgeWidth(double width);
61 
62     QString fileName() const override;
63 
64     void setFileName(QString fileName) override;
65 
66     Graph & graph() override;
67 
68     const Graph & graph() const override;
69 
70     double minEdgeLength() const;
71 
72     void setMinEdgeLength(double minEdgeLength);
73 
74     QFont font() const;
75 
76     void setFont(QFont font);
77 
78     int textSize() const;
79 
80     void setTextSize(int textSize);
81 
82     QString version() const;
83 
84     void setVersion(const QString & version);
85 
86     ImageManager & imageManager();
87 
88     const ImageManager & imageManager() const;
89 
90 private:
91     void copyGraph(const MindMapData & other);
92 
93     QString m_fileName;
94 
95     QString m_version;
96 
97     QColor m_backgroundColor = Constants::MindMap::DEFAULT_BACKGROUND_COLOR;
98 
99     QColor m_edgeColor = Constants::MindMap::DEFAULT_EDGE_COLOR;
100 
101     QColor m_gridColor = Constants::MindMap::DEFAULT_GRID_COLOR;
102 
103     double m_edgeWidth = Constants::MindMap::DEFAULT_EDGE_WIDTH;
104 
105     QFont m_font;
106 
107     int m_textSize = Constants::MindMap::DEFAULT_TEXT_SIZE;
108 
109     int m_cornerRadius = Constants::Node::DEFAULT_CORNER_RADIUS;
110 
111     double m_aspectRatio = Constants::LayoutOptimizer::DEFAULT_ASPECT_RATIO;
112 
113     double m_minEdgeLength = Constants::LayoutOptimizer::DEFAULT_MIN_EDGE_LENGTH;
114 
115     Graph m_graph;
116 
117     static ImageManager m_imageManager;
118 };
119 
120 typedef std::shared_ptr<MindMapData> MindMapDataPtr;
121 
122 #endif // MIND_MAP_DATA_HPP
123