settings_variables.h 7.9 KB
Newer Older
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
/**
 * TAS paths tool -- global settings variables
 * @author Tobias Weber <tweber@ill.fr>
 * @date apr-2021
 * @license GPLv3, see 'LICENSE' file
 *
 * ----------------------------------------------------------------------------
 * TAS-Paths (part of the Takin software suite)
 * Copyright (C) 2021  Tobias WEBER (Institut Laue-Langevin (ILL),
 *                     Grenoble, France).
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, version 3 of the License.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * ----------------------------------------------------------------------------
 */

#ifndef __TASPATHS_SETTINGS_VARIABLES__
#define __TASPATHS_SETTINGS_VARIABLES__

#include <QtCore/QString>

#include <string>
Tobias WEBER's avatar
Tobias WEBER committed
32
33
34
#include <array>
#include <variant>

Tobias WEBER's avatar
Tobias WEBER committed
35
#include "Resources.h"
36
#include "src/core/types.h"
Tobias WEBER's avatar
Tobias WEBER committed
37
#include "tlibs2/libs/qt/gl.h"
38

39
40
#include "settings_common.h"

41
42
43
44
45


// ----------------------------------------------------------------------------
// global settings variables
// ----------------------------------------------------------------------------
Tobias WEBER's avatar
Tobias WEBER committed
46
47
48
// resource manager
extern Resources g_res;

49
50
51
52
53
54
// application binary path
extern std::string g_apppath;

// maximum number of threads for calculations
extern unsigned int g_maxnum_threads;

55
56
57
// maximum number of recent files
extern unsigned int g_maxnum_recents;

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

// number precisions
extern int g_prec, g_prec_gui;

// epsilons
extern t_real g_eps, g_eps_angular, g_eps_gui;
extern t_real g_eps_voronoiedge;

// subdivision length of lines for interpolation
extern t_real g_line_subdiv_len;

// crystal angle offset
extern t_real g_a3_offs;

// angular deltas for calculation step width
extern t_real g_a2_delta;
extern t_real g_a4_delta;


// which polygon intersection method should be used?
// 0: sweep, 1: half-plane test
extern int g_poly_intersection_method;

// which backend to use for voronoi diagram calculation?
// 0: boost.polygon, 1: cgal
extern int g_voronoi_backend;

// use region calculation function
extern int g_use_region_function;

Tobias WEBER's avatar
Tobias WEBER committed
88
89
90
// use bisector verification function
extern int g_remove_bisectors_below_min_wall_dist;

91
92
93
94
95

// which path finding strategy to use?
// 0: shortest path, 1: avoid walls
extern int g_pathstrategy;

Tobias WEBER's avatar
Tobias WEBER committed
96
97
98
// choose a direct path if possible
extern int g_try_direct_path;

99
100
101
// verify the generated path?
extern int g_verifypath;

102
103
104
// minimum distance to keep from the walls
extern t_real g_min_dist_to_walls;

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

// path tracker fps
extern unsigned int g_pathtracker_fps;

// renderer fps
extern unsigned int g_timer_fps;

extern int g_light_follows_cursor;
extern int g_enable_shadow_rendering;

// screenshots
extern int g_combined_screenshots;
extern int g_automatic_screenshots;

// camera translation scaling factor
extern tl2::t_real_gl g_move_scale;

// camera rotation scaling factor
extern tl2::t_real_gl g_rotation_scale;


// gui theme
extern QString g_theme;

// gui font
extern QString g_font;

// use native menubar?
extern int g_use_native_menubar;

// use native dialogs?
extern int g_use_native_dialogs;
Tobias WEBER's avatar
Tobias WEBER committed
137
138
139
140
141
142
143
144
145

// use gui animations
extern int g_use_animations;

// allow tabbed dock widgets?
extern int g_tabbed_docks;

// allow nested dock widgets?
extern int g_nested_docks;
146
147
148
149
150
151
152
// ----------------------------------------------------------------------------



// ----------------------------------------------------------------------------
// variables register
// ----------------------------------------------------------------------------
Tobias WEBER's avatar
Tobias WEBER committed
153
constexpr std::array<SettingsVariable, 26> g_settingsvariables
154
155
{{
	// epsilons and precisions
Tobias WEBER's avatar
Tobias WEBER committed
156
157
158
159
160
161
162
163
164
165
166
167
168
169
	{
		.description = "Calculation epsilon",
		.key = "settings/eps",
		.value = &g_eps,
	},
	{
		.description = "Angular epsilon",
		.key = "settings/eps_angular",
		.value = &g_eps_angular,
		.is_angle = true
	},
	{
		.description = "Voronoi edge epsilon",
		.key = "settings/eps_voronoi_edge",
170
		.value = &g_eps_voronoiedge,
Tobias WEBER's avatar
Tobias WEBER committed
171
172
173
174
	},
	{
		.description = "Drawing epsilon",
		.key = "settings/eps_gui",
175
		.value = &g_eps_gui,
Tobias WEBER's avatar
Tobias WEBER committed
176
177
178
179
	},
	{
		.description = "Number precision",
		.key = "settings/prec",
180
		.value = &g_prec,
Tobias WEBER's avatar
Tobias WEBER committed
181
182
183
184
	},
	{
		.description = "GUI number precision",
		.key = "settings/prec_gui",
185
		.value = &g_prec_gui,
Tobias WEBER's avatar
Tobias WEBER committed
186
187
188
189
190
	},

	{
		.description = "Line subdivision length",
		.key = "settings/line_subdiv_len",
191
		.value = &g_line_subdiv_len,
Tobias WEBER's avatar
Tobias WEBER committed
192
	},
193
194

	// threading options
Tobias WEBER's avatar
Tobias WEBER committed
195
196
197
	{
		.description = "Maximum number of threads",
		.key = "settings/maxnum_threads",
198
		.value = &g_maxnum_threads,
Tobias WEBER's avatar
Tobias WEBER committed
199
	},
200
	// file options
Tobias WEBER's avatar
Tobias WEBER committed
201
202
203
	{
		.description = "Maximum number of recent files",
		.key = "settings/maxnum_recents",
204
		.value = &g_maxnum_recents,
Tobias WEBER's avatar
Tobias WEBER committed
205
	},
206
207

	// angle options
Tobias WEBER's avatar
Tobias WEBER committed
208
209
210
211
212
213
214
215
216
217
	{
		.description = "Sample rotation offset",
		.key = "settings/a3_offs",
		.value = &g_a3_offs,
		.is_angle = true
	},
	{
		.description = "Monochromator scattering angle delta",
		.key = "settings/a2_delta",
		.value = &g_a2_delta,
218
		.is_angle = true,
Tobias WEBER's avatar
Tobias WEBER committed
219
220
221
222
223
	},
	{
		.description = "Sample scattering angle delta",
		.key = "settings/a4_delta",
		.value = &g_a4_delta,
224
		.is_angle = true,
Tobias WEBER's avatar
Tobias WEBER committed
225
	},
226
227

	// mesh options
Tobias WEBER's avatar
Tobias WEBER committed
228
229
230
	{
		.description = "Polygon intersection method",
		.key = "settings/poly_inters_method",
231
232
		.value = &g_poly_intersection_method,
		.editor = SettingsVariableEditor::COMBOBOX,
Tobias WEBER's avatar
Tobias WEBER committed
233
		.editor_config = "Sweep;;Half-plane Test",
Tobias WEBER's avatar
Tobias WEBER committed
234
235
236
237
	},
	{
		.description = "Voronoi calculation backend",
		.key = "settings/voronoi_backend",
238
239
		.value = &g_voronoi_backend,
		.editor = SettingsVariableEditor::COMBOBOX,
240
		.editor_config = "BOOST/Polygon;;CGAL/S.D.Graph",
Tobias WEBER's avatar
Tobias WEBER committed
241
242
243
244
	},
	{
		.description = "Use region function",
		.key = "settings/use_region_function",
245
246
		.value = &g_use_region_function,
		.editor = SettingsVariableEditor::YESNO,
Tobias WEBER's avatar
Tobias WEBER committed
247
	},
Tobias WEBER's avatar
Tobias WEBER committed
248
249
250
251
252
253
	{
		.description = "Remove bisectors close to walls",
		.key = "settings/remove_bisectors_below_min_wall_dist",
		.value = &g_remove_bisectors_below_min_wall_dist,
		.editor = SettingsVariableEditor::YESNO,
	},
254
255

	// path options
Tobias WEBER's avatar
Tobias WEBER committed
256
257
258
	{
		.description = "Path finding strategy",
		.key = "settings/path_finding_strategy",
259
260
		.value = &g_pathstrategy,
		.editor = SettingsVariableEditor::COMBOBOX,
Tobias WEBER's avatar
Tobias WEBER committed
261
		.editor_config = "Shortest Path;;Avoid Walls",
Tobias WEBER's avatar
Tobias WEBER committed
262
	},
Tobias WEBER's avatar
Tobias WEBER committed
263
	{
Tobias WEBER's avatar
Tobias WEBER committed
264
		.description = "Try using direct path segments",
Tobias WEBER's avatar
Tobias WEBER committed
265
266
267
268
		.key = "settings/try_direct_path",
		.value = &g_try_direct_path,
		.editor = SettingsVariableEditor::YESNO,
	},
Tobias WEBER's avatar
Tobias WEBER committed
269
270
271
	{
		.description = "Verify generated path",
		.key = "settings/verify_path",
272
273
		.value = &g_verifypath,
		.editor = SettingsVariableEditor::YESNO,
Tobias WEBER's avatar
Tobias WEBER committed
274
275
276
277
	},
	{
		.description = "Path tracker FPS",
		.key = "settings/pathtracker_fps",
278
		.value = &g_pathtracker_fps,
Tobias WEBER's avatar
Tobias WEBER committed
279
	},
280
281
282
283
284
285
286
	{
		.description = "Minimum angular distance to walls",
		.key = "settings/min_dist_to_walls",
		.value = &g_min_dist_to_walls,
		.is_angle = true
	},

287
288

	// renderer options
Tobias WEBER's avatar
Tobias WEBER committed
289
290
291
	{
		.description = "Renderer FPS",
		.key = "settings/renderer_fps",
292
		.value = &g_timer_fps,
Tobias WEBER's avatar
Tobias WEBER committed
293
294
295
296
	},
	{
		.description = "Light follows cursor",
		.key = "settings/light_follows_cursor",
297
298
		.value = &g_light_follows_cursor,
		.editor = SettingsVariableEditor::YESNO,
Tobias WEBER's avatar
Tobias WEBER committed
299
300
301
302
	},
	{
		.description = "Enable shadow rendering",
		.key = "settings/enable_shadow_rendering",
303
304
		.value = &g_enable_shadow_rendering,
		.editor = SettingsVariableEditor::YESNO,
Tobias WEBER's avatar
Tobias WEBER committed
305
	},
306
307

	// screenshot options
Tobias WEBER's avatar
Tobias WEBER committed
308
309
310
	{
		.description = "Combine instrument/configuration space screenshots",
		.key = "settings/combined_screenshots",
311
312
		.value = &g_combined_screenshots,
		.editor = SettingsVariableEditor::YESNO,
Tobias WEBER's avatar
Tobias WEBER committed
313
314
315
316
	},
	{
		.description = "Automatically take screenshots (careful!)",
		.key = "settings/automatic_screenshots",
317
318
		.value = &g_automatic_screenshots,
		.editor = SettingsVariableEditor::YESNO,
Tobias WEBER's avatar
Tobias WEBER committed
319
	},
320
321
322
323
324
}};
// ----------------------------------------------------------------------------


#endif