OGS
VisPrefsDialog.cpp
Go to the documentation of this file.
1
15#include "VisPrefsDialog.h"
16
17#include <QDoubleValidator>
18#include <QLineEdit>
19#include <QSettings>
20#include <QVariant>
21
22#include "VisualizationWidget.h"
23#include "VtkVisPipeline.h"
24
27 VisualizationWidget& widget,
28 QDialog* parent)
29 : QDialog(parent),
30 _vtkVisPipeline(pipeline),
31 _visWidget(widget),
32 _above(0, 0, 2000000),
33 _below(0, 0, -2000000)
34{
35 setupUi(this);
37 {
38 lightAboveBox->toggle();
39 }
41 {
42 lightBelowBox->toggle();
43 }
44
45 bgColorButton->setColor(_vtkVisPipeline.getBGColor());
46
47 QValidator* validator = new QDoubleValidator(0, 100000, 2, this);
48 superelevationLineEdit->setValidator(validator);
49 QSettings settings;
50 superelevationLineEdit->setText(
51 settings.value("globalSuperelevation", 1.0).toString());
52 cullBackfacesCheckBox->setCheckState(
53 Qt::CheckState(settings.value("globalCullBackfaces", 0).toInt()));
54 loadShowAllCheckBox->setCheckState(
55 Qt::CheckState(settings.value("resetViewOnLoad", 2).toInt()));
56}
57
59{
60 QColor bgColor(color.red(), color.green(), color.blue());
62}
63
65{
66 if (lightAboveBox->isChecked())
67 {
69 }
70 else
71 {
73 }
74}
75
77{
78 if (lightBelowBox->isChecked())
79 {
81 }
82 else
83 {
85 }
86}
87
89{
90 double factor = superelevationLineEdit->text().toDouble();
92
93 QSettings settings;
94 settings.setValue("globalSuperelevation", factor);
95}
96
98{
99 _visWidget.setShowAllOnLoad(static_cast<bool>(state));
100 _vtkVisPipeline.resetCameraOnAddOrRemove(static_cast<bool>(state));
101
102 QSettings settings;
103 settings.setValue("resetViewOnLoad", state);
104}
105
107{
108 _vtkVisPipeline.setGlobalBackfaceCulling(static_cast<bool>(state));
109
110 QSettings settings;
111 settings.setValue("globalCullBackfaces", state);
112}
Definition of the VisPrefsDialog class.
Definition of the VisualizationWidget class.
Definition of the VtkVisPipeline class.
void on_bgColorButton_colorPicked(QColor color)
Sets the background colour.
VtkVisPipeline & _vtkVisPipeline
void on_superelevationPushButton_pressed()
Sets the given superelevation on all vis pipeline source objects.
void on_loadShowAllCheckBox_stateChanged(int state)
void on_lightAboveBox_clicked()
Adds a light above the scene.
VisPrefsDialog(VtkVisPipeline &pipeline, VisualizationWidget &widget, QDialog *parent=nullptr)
Constructor.
void on_cullBackfacesCheckBox_stateChanged(int state)
Culls backfacing rendering primitives on all actors.
GeoLib::Point _above
GeoLib::Point _below
void on_lightBelowBox_clicked()
Adds a light below the scene.
VisualizationWidget & _visWidget
Widget containing the 3d VTK scene view.
void setShowAllOnLoad(bool show)
See updateViewOnLoad().
VtkVisPipeline manages the VTK visualization. It is a TreeModel and provides functions for adding and...
void setGlobalBackfaceCulling(bool enable) const
Enables / disables backface culling on all actors.
void addLight(const GeoLib::Point &pos)
Adds a light to the scene at the given coordinates.
void resetCameraOnAddOrRemove(bool reset)
Defaults to on.
void removeLight(const GeoLib::Point &pos)
Removes a light at the given coordinates (if possible).
void setBGColor(const QColor &color)
Sets the background-colour of the scene.
void setGlobalSuperelevation(double factor) const
Sets a global superelevation factor on all source items and resets the factor on other items to 1.
vtkLight * getLight(const GeoLib::Point &pos) const
Returns a light (or nullptr) for the given coordinates.
QColor getBGColor() const
Returns the background-colour of the scene.