Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
ElmerCSC
GitHub Repository: ElmerCSC/elmerfem
Path: blob/devel/ElmerGUI/Application/vtkpost/preferences.cpp
3203 views
1
/*****************************************************************************
2
* *
3
* Elmer, A Finite Element Software for Multiphysical Problems *
4
* *
5
* Copyright 1st April 1995 - , CSC - IT Center for Science Ltd., Finland *
6
* *
7
* This program is free software; you can redistribute it and/or *
8
* modify it under the terms of the GNU General Public License *
9
* as published by the Free Software Foundation; either version 2 *
10
* of the License, or (at your option) any later version. *
11
* *
12
* This program is distributed in the hope that it will be useful, *
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15
* GNU General Public License for more details. *
16
* *
17
* You should have received a copy of the GNU General Public License *
18
* along with this program (in file fem/GPL-2); if not, write to the *
19
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, *
20
* Boston, MA 02110-1301, USA. *
21
* *
22
*****************************************************************************/
23
24
/*****************************************************************************
25
* *
26
* ElmerGUI preferences *
27
* *
28
*****************************************************************************
29
* *
30
* Authors: Mikko Lyly, Juha Ruokolainen and Peter R�back *
31
* Email: [email protected] *
32
* Web: http://www.csc.fi/elmer *
33
* Address: CSC - IT Center for Science Ltd. *
34
* Keilaranta 14 *
35
* 02101 Espoo, Finland *
36
* *
37
* Original Date: 15 Mar 2008 *
38
* *
39
*****************************************************************************/
40
41
#include <QtGui>
42
#include <QColorDialog>
43
#include <iostream>
44
#include "vtkpost.h"
45
#include "preferences.h"
46
47
using namespace std;
48
49
Preferences::Preferences(QWidget *parent)
50
: QDialog(parent)
51
{
52
ui.setupUi(this);
53
54
connect(ui.cancelButton, SIGNAL(clicked()), this, SLOT(cancelButtonClicked()));
55
connect(ui.okButton, SIGNAL(clicked()), this, SLOT(okButtonClicked()));
56
connect(ui.applyButton, SIGNAL(clicked()), this, SLOT(applyButtonClicked()));
57
58
setWindowIcon(QIcon(":/icons/Mesh3D.png"));
59
60
ui.cancelButton->setIcon(QIcon::fromTheme("dialog-error-round"));
61
ui.applyButton->setIcon(QIcon::fromTheme("view-refresh"));
62
ui.okButton->setIcon(QIcon::fromTheme("dialog-accept"));
63
64
setMeshPointColor(Qt::gray);
65
setMeshEdgeColor(Qt::darkGray);
66
setFeatureEdgeColor(Qt::black);
67
connect(ui.meshPointColorButton, SIGNAL(clicked()), this, SLOT(meshPointColorButtonClicked()));
68
connect(ui.meshEdgeColorButton, SIGNAL(clicked()), this, SLOT(meshEdgeColorButtonClicked()));
69
connect(ui.featureEdgeColorButton, SIGNAL(clicked()), this, SLOT(featureEdgeColorButtonClicked()));
70
// connect(ui.meshPointsGroup, SIGNAL(toggled(bool)), this, SLOT(meshPointToggled(bool)));
71
// connect(ui.meshEdgesGroup, SIGNAL(toggled(bool)), this, SLOT(meshEdgeToggled(bool)));
72
// connect(ui.featureGroup, SIGNAL(toggled(bool)), this, SLOT(featureEdgeToggled(bool)));
73
}
74
75
Preferences::~Preferences()
76
{
77
}
78
79
void Preferences::okButtonClicked()
80
{
81
emit(redrawSignal());
82
close();
83
}
84
85
void Preferences::applyButtonClicked()
86
{
87
emit(redrawSignal());
88
}
89
90
void Preferences::cancelButtonClicked()
91
{
92
close();
93
}
94
95
96
// Public slots:
97
//---------------
98
int Preferences::GetFeatureAngle()
99
{
100
return ui.angleSpin->value();
101
}
102
103
void Preferences::UseSurfaceMeshForPoints(bool b)
104
{
105
ui.meshPointsSurface->setChecked(b);
106
}
107
void Preferences::UseVolumeMeshForPoints(bool b)
108
{
109
ui.meshPointsVolume->setChecked(b);
110
}
111
void Preferences::SetPointSize(int n)
112
{
113
ui.pointSize->setValue(n);
114
}
115
void Preferences::SetPointQuality(int n)
116
{
117
ui.pointQuality->setValue(n);
118
}
119
void Preferences::UseClipPlaneForPoints(bool b)
120
{
121
ui.meshPointsClip->setChecked(b);
122
}
123
124
void Preferences::UseSurfaceMeshForEdges(bool b)
125
{
126
ui.meshEdgesSurface->setChecked(b);
127
}
128
129
void Preferences::UseVolumeMeshForEdges(bool b)
130
{
131
ui.meshEdgesVolume->setChecked(b);
132
}
133
134
void Preferences::UseTubeFilterForEdges(bool b)
135
{
136
ui.meshEdgeTubes->setChecked(b);
137
}
138
139
void Preferences::UseClipPlaneForEdges(bool b)
140
{
141
ui.meshEdgesClip->setChecked(b);
142
}
143
144
void Preferences::SetLineWidthForEdges(int n)
145
{
146
ui.meshLineWidth->setValue(n);
147
}
148
149
void Preferences::SetTubeQualityForEdges(int n)
150
{
151
ui.meshEdgeTubeQuality->setValue(n);
152
}
153
154
void Preferences::SetTubeRadiusForEdges(int n)
155
{
156
ui.meshEdgeTubeRadius->setValue(n);
157
}
158
159
void Preferences::UseSurfaceMeshForFeatureEdges(bool b)
160
{
161
ui.surfaceRButton->setChecked(b);
162
}
163
164
void Preferences::UseVolumeMeshForFeatureEdges(bool b)
165
{
166
ui.volumeRButton->setChecked(b);
167
}
168
169
void Preferences::UseTubeFilterForFeatureEdges(bool b)
170
{
171
ui.featureEdgeTubes->setChecked(b);
172
}
173
174
void Preferences::UseClipPlaneForFeatureEdges(bool b)
175
{
176
ui.featureEdgesClip->setChecked(b);
177
}
178
179
void Preferences::DrawBoundaryEdges(bool b)
180
{
181
ui.drawBoundaryEdges->setChecked(b);
182
}
183
184
void Preferences::SetFeatureAngle(int n)
185
{
186
ui.angleSpin->setValue(n);
187
}
188
189
void Preferences::SetLineWidthForFeatureEdges(int n)
190
{
191
ui.lineWidthSpin->setValue(n);
192
}
193
194
void Preferences::SetTubeQualityForFeatureEdges(int n)
195
{
196
ui.featureEdgeTubeQuality->setValue(n);
197
}
198
199
void Preferences::SetTubeRadiusForFeatureEdges(int n)
200
{
201
ui.featureEdgeTubeRadius->setValue(n);
202
}
203
204
void Preferences::SetClipPlaneOx(double f)
205
{
206
ui.clipPointX->setText(QString::number(f));
207
}
208
209
void Preferences::SetClipPlaneOy(double f)
210
{
211
ui.clipPointY->setText(QString::number(f));
212
}
213
214
void Preferences::SetClipPlaneOz(double f)
215
{
216
ui.clipPointZ->setText(QString::number(f));
217
}
218
219
void Preferences::SetClipPlaneNx(double f)
220
{
221
ui.clipNormalX->setText(QString::number(f));
222
}
223
224
void Preferences::SetClipPlaneNy(double f)
225
{
226
ui.clipNormalY->setText(QString::number(f));
227
}
228
229
void Preferences::SetClipPlaneNz(double f)
230
{
231
ui.clipNormalZ->setText(QString::number(f));
232
}
233
234
void Preferences::meshPointColorButtonClicked()
235
{
236
setMeshPointColor(QColorDialog::getColor(meshPointColor));
237
}
238
239
void Preferences::setMeshPointColor(QColor color){
240
if(!color.isValid()) return;
241
242
meshPointColor = color;
243
244
QPalette plt(ui.meshPointColorLabel->palette());
245
plt.setColor(QPalette::WindowText, meshPointColor);
246
ui.meshPointColorLabel->setPalette(plt);
247
}
248
249
void Preferences::meshEdgeColorButtonClicked()
250
{
251
setMeshEdgeColor(QColorDialog::getColor(meshEdgeColor));
252
}
253
254
void Preferences::setMeshEdgeColor(QColor color){
255
if(!color.isValid()) return;
256
257
meshEdgeColor = color;
258
259
QPalette plt(ui.meshEdgeColorLabel->palette());
260
plt.setColor(QPalette::WindowText, meshEdgeColor);
261
ui.meshEdgeColorLabel->setPalette(plt);
262
}
263
264
void Preferences::featureEdgeColorButtonClicked()
265
{
266
setFeatureEdgeColor(QColorDialog::getColor(featureEdgeColor));
267
}
268
269
void Preferences::setFeatureEdgeColor(QColor color){
270
if(!color.isValid()) return;
271
272
featureEdgeColor = color;
273
274
QPalette plt(ui.featureEdgeColorLabel->palette());
275
plt.setColor(QPalette::WindowText, featureEdgeColor);
276
ui.featureEdgeColorLabel->setPalette(plt);
277
}
278
279
QColor Preferences::getMeshPointColor(){
280
return meshPointColor;
281
}
282
283
QColor Preferences::getMeshEdgeColor(){
284
return meshEdgeColor;
285
}
286
287
QColor Preferences::getFeatureEdgeColor(){
288
return featureEdgeColor;
289
}
290
291
void Preferences::meshPointToggled(bool checked)
292
{
293
294
}
295
296
void Preferences::meshEdgeToggled(bool checked)
297
{
298
299
}
300
301
void Preferences::featureEdgeToggled(bool checked)
302
{
303
304
}
305