OGS
VisPrefsDialog Class Reference

Detailed Description

A dialog window for settung up a visualisation preferences.

Definition at line 28 of file VisPrefsDialog.h.

#include <VisPrefsDialog.h>

Inheritance diagram for VisPrefsDialog:
[legend]
Collaboration diagram for VisPrefsDialog:
[legend]

Public Member Functions

 VisPrefsDialog (VtkVisPipeline &pipeline, VisualizationWidget &widget, QDialog *parent=nullptr)
 Constructor.
 

Protected Slots

void on_bgColorButton_colorPicked (QColor color)
 Sets the background colour.
 
void on_lightAboveBox_clicked ()
 Adds a light above the scene.
 
void on_lightBelowBox_clicked ()
 Adds a light below the scene.
 
void on_superelevationPushButton_pressed ()
 Sets the given superelevation on all vis pipeline source objects.
 
void on_loadShowAllCheckBox_stateChanged (int state)
 
void on_cullBackfacesCheckBox_stateChanged (int state)
 Culls backfacing rendering primitives on all actors.
 

Private Attributes

VtkVisPipeline_vtkVisPipeline
 
VisualizationWidget_visWidget
 
GeoLib::Point _above
 
GeoLib::Point _below
 

Constructor & Destructor Documentation

◆ VisPrefsDialog()

VisPrefsDialog::VisPrefsDialog ( VtkVisPipeline & pipeline,
VisualizationWidget & widget,
QDialog * parent = nullptr )

Constructor.

Definition at line 26 of file VisPrefsDialog.cpp.

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}
VtkVisPipeline & _vtkVisPipeline
GeoLib::Point _above
GeoLib::Point _below
VisualizationWidget & _visWidget
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.

References _above, _below, _vtkVisPipeline, VtkVisPipeline::getBGColor(), and VtkVisPipeline::getLight().

Member Function Documentation

◆ on_bgColorButton_colorPicked

void VisPrefsDialog::on_bgColorButton_colorPicked ( QColor color)
protectedslot

Sets the background colour.

Definition at line 58 of file VisPrefsDialog.cpp.

59{
60 QColor bgColor(color.red(), color.green(), color.blue());
62}
void setBGColor(const QColor &color)
Sets the background-colour of the scene.

References _vtkVisPipeline, and VtkVisPipeline::setBGColor().

◆ on_cullBackfacesCheckBox_stateChanged

void VisPrefsDialog::on_cullBackfacesCheckBox_stateChanged ( int state)
protectedslot

Culls backfacing rendering primitives on all actors.

Definition at line 106 of file VisPrefsDialog.cpp.

107{
108 _vtkVisPipeline.setGlobalBackfaceCulling(static_cast<bool>(state));
109
110 QSettings settings;
111 settings.setValue("globalCullBackfaces", state);
112}
void setGlobalBackfaceCulling(bool enable) const
Enables / disables backface culling on all actors.

References _vtkVisPipeline, and VtkVisPipeline::setGlobalBackfaceCulling().

◆ on_lightAboveBox_clicked

void VisPrefsDialog::on_lightAboveBox_clicked ( )
protectedslot

Adds a light above the scene.

Definition at line 64 of file VisPrefsDialog.cpp.

65{
66 if (lightAboveBox->isChecked())
67 {
69 }
70 else
71 {
73 }
74}
void addLight(const GeoLib::Point &pos)
Adds a light to the scene at the given coordinates.
void removeLight(const GeoLib::Point &pos)
Removes a light at the given coordinates (if possible).

References _above, _vtkVisPipeline, VtkVisPipeline::addLight(), and VtkVisPipeline::removeLight().

◆ on_lightBelowBox_clicked

void VisPrefsDialog::on_lightBelowBox_clicked ( )
protectedslot

Adds a light below the scene.

Definition at line 76 of file VisPrefsDialog.cpp.

77{
78 if (lightBelowBox->isChecked())
79 {
81 }
82 else
83 {
85 }
86}

References _below, _vtkVisPipeline, VtkVisPipeline::addLight(), and VtkVisPipeline::removeLight().

◆ on_loadShowAllCheckBox_stateChanged

void VisPrefsDialog::on_loadShowAllCheckBox_stateChanged ( int state)
protectedslot

Definition at line 97 of file VisPrefsDialog.cpp.

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}
void setShowAllOnLoad(bool show)
See updateViewOnLoad().
void resetCameraOnAddOrRemove(bool reset)
Defaults to on.

References _visWidget, _vtkVisPipeline, VtkVisPipeline::resetCameraOnAddOrRemove(), and VisualizationWidget::setShowAllOnLoad().

◆ on_superelevationPushButton_pressed

void VisPrefsDialog::on_superelevationPushButton_pressed ( )
protectedslot

Sets the given superelevation on all vis pipeline source objects.

Definition at line 88 of file VisPrefsDialog.cpp.

89{
90 double factor = superelevationLineEdit->text().toDouble();
92
93 QSettings settings;
94 settings.setValue("globalSuperelevation", factor);
95}
void setGlobalSuperelevation(double factor) const
Sets a global superelevation factor on all source items and resets the factor on other items to 1.

References _vtkVisPipeline, and VtkVisPipeline::setGlobalSuperelevation().

Member Data Documentation

◆ _above

GeoLib::Point VisPrefsDialog::_above
private

Definition at line 59 of file VisPrefsDialog.h.

Referenced by VisPrefsDialog(), and on_lightAboveBox_clicked().

◆ _below

GeoLib::Point VisPrefsDialog::_below
private

Definition at line 60 of file VisPrefsDialog.h.

Referenced by VisPrefsDialog(), and on_lightBelowBox_clicked().

◆ _visWidget

VisualizationWidget& VisPrefsDialog::_visWidget
private

Definition at line 58 of file VisPrefsDialog.h.

Referenced by on_loadShowAllCheckBox_stateChanged().

◆ _vtkVisPipeline


The documentation for this class was generated from the following files: