-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathactions.cpp
More file actions
194 lines (164 loc) · 6.69 KB
/
actions.cpp
File metadata and controls
194 lines (164 loc) · 6.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
#include "actions.h"
/***********************
* BASE ACTTIONS CLASS *
***********************/
ActionFamily::ActionFamily(bool multiselect, bool checkable) :
m_multiselect(multiselect), m_checkable(checkable)
{
}
ActionFamily::~ActionFamily()
{
for(QAction* a : m_actions.values())
delete a;
}
QAction * ActionFamily::operator[](QString key)
{
return m_actions[key];
}
std::vector<QAction*> ActionFamily::allActions()
{
return m_all_actions;
}
QActionGroup * ActionFamily::getActionGroup()
{
return m_action_group;
}
void ActionFamily::finalise()
{
m_action_group = new QActionGroup(this);
m_action_group->setExclusive(!m_multiselect);
for(QAction * a : m_actions.values())
{
a->setActionGroup(m_action_group);
a->setCheckable(m_checkable);
m_all_actions.push_back(a);
}
}
/*****************
* BASE ACTTIONS *
*****************/
const QString BaseActionFamily::_CLOSE_APP = "Close";
const QString BaseActionFamily::_LOAD_TERRAIN = "Load Terrain";
const QString BaseActionFamily::_OPEN_SETTINGS = "Open Settings";
BaseActionFamily::BaseActionFamily() : ActionFamily(true, false)
{
init_actions();
finalise();
}
BaseActionFamily::~BaseActionFamily()
{
}
void BaseActionFamily::init_actions()
{
m_actions[BaseActionFamily::_CLOSE_APP] = new QAction(BaseActionFamily::_CLOSE_APP, NULL);
m_actions[BaseActionFamily::_CLOSE_APP]->setShortcut(QKeySequence::Close);
m_actions[BaseActionFamily::_LOAD_TERRAIN] = new QAction(BaseActionFamily::_LOAD_TERRAIN, NULL);
m_actions[BaseActionFamily::_OPEN_SETTINGS] = new QAction(BaseActionFamily::_OPEN_SETTINGS, NULL);
}
/*******************
* RENDER ACTTIONS *
*******************/
const QString RenderActionFamily::_GRID = "Grid";
const QString RenderActionFamily::_TERRAIN = "Terrain";
const QString RenderActionFamily::_RAYS = "Rays";
const QString RenderActionFamily::_SUN = "Sun";
RenderActionFamily::RenderActionFamily() : ActionFamily(true, true)
{
init_actions();
finalise();
m_actions[RenderActionFamily::_GRID]->setChecked(true);
m_actions[RenderActionFamily::_TERRAIN]->setChecked(true);
}
RenderActionFamily::~RenderActionFamily()
{
}
void RenderActionFamily::init_actions()
{
m_actions[RenderActionFamily::_GRID] = new QAction(RenderActionFamily::_GRID, NULL);
m_actions[RenderActionFamily::_TERRAIN] = new QAction(RenderActionFamily::_TERRAIN, NULL);
m_actions[RenderActionFamily::_RAYS] = new QAction(RenderActionFamily::_RAYS, NULL);
m_actions[RenderActionFamily::_SUN] = new QAction(RenderActionFamily::_SUN, NULL);
}
/********************
* OVERLAY ACTTIONS *
********************/
const QString OverlayActionFamily::_NONE = "None";
const QString OverlayActionFamily::_SLOPE = "Slope";
const QString OverlayActionFamily::_ALTITUDE = "Altitude";
const QString OverlayActionFamily::_SHADE = "Shade";
const QString OverlayActionFamily::_TEMPERATURE = "Temperature";
const QString OverlayActionFamily::_ILLUMINATION = "Illumination";
const QString OverlayActionFamily::_SOIL_INFILTRATION_RATE = "Soil Infiltration Rate";
const QString OverlayActionFamily::_MONTHLY_SOIL_HUMIDITY = "Monthly";
const QString OverlayActionFamily::_WEIGHTED_AVG_SOIL_HUMIDITY = "Weighted average";
const QString OverlayActionFamily::_CLUSTERS = "Clusters";
OverlayActionFamily::OverlayActionFamily() : ActionFamily(false, true)
{
init_actions();
finalise();
m_actions[OverlayActionFamily::_NONE]->setChecked(true);
}
OverlayActionFamily::~OverlayActionFamily()
{
}
void OverlayActionFamily::init_actions()
{
m_actions[OverlayActionFamily::_NONE] = new QAction(OverlayActionFamily::_NONE, NULL);
m_actions[OverlayActionFamily::_SLOPE] = new QAction(OverlayActionFamily::_SLOPE, NULL);
m_actions[OverlayActionFamily::_ALTITUDE] = new QAction(OverlayActionFamily::_ALTITUDE, NULL);
m_actions[OverlayActionFamily::_SHADE] = new QAction(OverlayActionFamily::_SHADE, NULL);
m_actions[OverlayActionFamily::_TEMPERATURE] = new QAction(OverlayActionFamily::_TEMPERATURE, NULL);
m_actions[OverlayActionFamily::_ILLUMINATION] = new QAction(OverlayActionFamily::_ILLUMINATION, NULL);
m_actions[OverlayActionFamily::_SOIL_INFILTRATION_RATE] = new QAction(OverlayActionFamily::_SOIL_INFILTRATION_RATE, NULL);
m_actions[OverlayActionFamily::_MONTHLY_SOIL_HUMIDITY] = new QAction(OverlayActionFamily::_MONTHLY_SOIL_HUMIDITY, NULL);
m_actions[OverlayActionFamily::_WEIGHTED_AVG_SOIL_HUMIDITY] = new QAction(OverlayActionFamily::_WEIGHTED_AVG_SOIL_HUMIDITY, NULL);
m_actions[OverlayActionFamily::_CLUSTERS] = new QAction(OverlayActionFamily::_CLUSTERS, NULL);
}
/****************
* SHOW ACTIONS *
****************/
const QString ShowActionFamily::_POINTER_INFO = "Pointer Info";
ShowActionFamily::ShowActionFamily() : ActionFamily(true, false)
{
init_actions();
finalise();
}
ShowActionFamily::~ShowActionFamily()
{
}
void ShowActionFamily::init_actions()
{
m_actions[ShowActionFamily::_POINTER_INFO] = new QAction(ShowActionFamily::_POINTER_INFO, NULL);
}
/*****************
* EDIT ACTTIONS *
*****************/
const QString EditActionFamily::_TEMPERATURE = "Temperature";
const QString EditActionFamily::_ORIENTATION = "Orientation";
const QString EditActionFamily::_TIME = "Time";
const QString EditActionFamily::_LATITUDE = "Latitude";
const QString EditActionFamily::_MONTHLY_RAINFALL = "Monthly Rainfall";
const QString EditActionFamily::_SOIL_INFILTRATION_RATE = "Soil Infiltration Rate";
const QString EditActionFamily::_FLOOD_FILL = "Flood fill";
const QString EditActionFamily::_ABSOLUTE_AGGREGATE_HEIGHT = "Absolute Aggregate Height";
EditActionFamily::EditActionFamily() : ActionFamily(true, true)
{
init_actions();
finalise();
m_actions[EditActionFamily::_TEMPERATURE]->setCheckable(false);
m_actions[EditActionFamily::_MONTHLY_RAINFALL]->setCheckable(false);
}
EditActionFamily::~EditActionFamily()
{
}
void EditActionFamily::init_actions()
{
m_actions[EditActionFamily::_TEMPERATURE] = new QAction(EditActionFamily::_TEMPERATURE, NULL);
m_actions[EditActionFamily::_ORIENTATION] = new QAction(EditActionFamily::_ORIENTATION, NULL);
m_actions[EditActionFamily::_TIME] = new QAction(EditActionFamily::_TIME, NULL);
m_actions[EditActionFamily::_LATITUDE] = new QAction(EditActionFamily::_LATITUDE, NULL);
m_actions[EditActionFamily::_MONTHLY_RAINFALL] = new QAction(EditActionFamily::_MONTHLY_RAINFALL, NULL);
m_actions[EditActionFamily::_SOIL_INFILTRATION_RATE] = new QAction(EditActionFamily::_SOIL_INFILTRATION_RATE, NULL);
m_actions[EditActionFamily::_FLOOD_FILL] = new QAction(EditActionFamily::_FLOOD_FILL, NULL);
m_actions[EditActionFamily::_ABSOLUTE_AGGREGATE_HEIGHT] = new QAction(EditActionFamily::_ABSOLUTE_AGGREGATE_HEIGHT, NULL);
}