Skip to content
Snippets Groups Projects
Commit 05b970a6 authored by Karsten Rink's avatar Karsten Rink
Browse files

included tranlation option into GUI; removed multi-mesh from FEM Read and...

included tranlation option into GUI; removed multi-mesh from FEM Read and re-inserted adding the mesh into global mesh vector into files0.cpp
parent f1ee2c0a
No related branches found
No related tags found
No related merge requests found
...@@ -22,7 +22,7 @@ VtkCompositeSelectionFilter::VtkCompositeSelectionFilter( vtkAlgorithm* inputAlg ...@@ -22,7 +22,7 @@ VtkCompositeSelectionFilter::VtkCompositeSelectionFilter( vtkAlgorithm* inputAlg
void VtkCompositeSelectionFilter::init() void VtkCompositeSelectionFilter::init()
{ {
const char* filter_name = std::string("Selection").c_str(); const char* filter_name("Selection");
double thresholdLower(0.0), thresholdUpper(1.0); double thresholdLower(0.0), thresholdUpper(1.0);
this->_inputDataObjectType = VTK_UNSTRUCTURED_GRID; this->_inputDataObjectType = VTK_UNSTRUCTURED_GRID;
this->_outputDataObjectType = VTK_UNSTRUCTURED_GRID; this->_outputDataObjectType = VTK_UNSTRUCTURED_GRID;
......
...@@ -535,6 +535,19 @@ void VtkVisPipelineItem::setScale(double x, double y, double z) const ...@@ -535,6 +535,19 @@ void VtkVisPipelineItem::setScale(double x, double y, double z) const
} }
void VtkVisPipelineItem::setTranslation(double x, double y, double z) const
{
if (this->transformFilter())
{
vtkTransform* transform =
static_cast<vtkTransform*>(this->transformFilter()->GetTransform());
transform->Identity();
transform->Translate(x, y, z);
this->transformFilter()->Modified();
}
}
void VtkVisPipelineItem::setScaleOnChildren(double x, double y, double z) const void VtkVisPipelineItem::setScaleOnChildren(double x, double y, double z) const
{ {
for (int i = 0; i < this->childCount(); ++i) for (int i = 0; i < this->childCount(); ++i)
......
...@@ -100,6 +100,9 @@ public: ...@@ -100,6 +100,9 @@ public:
/// @brief Sets the geometry and data scaling. /// @brief Sets the geometry and data scaling.
void setScale(double x, double y, double z) const; void setScale(double x, double y, double z) const;
/// @brief Translates the item in vis-space.
void setTranslation(double x, double y, double z) const;
/// @brief Sets the geometry and date scaling recursively on all children of /// @brief Sets the geometry and date scaling recursively on all children of
/// this item. /// this item.
void setScaleOnChildren(double x, double y, double z) const; void setScaleOnChildren(double x, double y, double z) const;
......
...@@ -35,6 +35,10 @@ VtkVisTabWidget::VtkVisTabWidget( QWidget* parent /*= 0*/ ) ...@@ -35,6 +35,10 @@ VtkVisTabWidget::VtkVisTabWidget( QWidget* parent /*= 0*/ )
this->scaleZ->setValidator(new QDoubleValidator(0, 100, 8, this)); this->scaleZ->setValidator(new QDoubleValidator(0, 100, 8, this));
this->transX->setValidator(new QDoubleValidator(this));
this->transY->setValidator(new QDoubleValidator(this));
this->transZ->setValidator(new QDoubleValidator(this));
connect(this->vtkVisPipelineView, SIGNAL(requestViewUpdate()), connect(this->vtkVisPipelineView, SIGNAL(requestViewUpdate()),
this, SIGNAL(requestViewUpdate())); this, SIGNAL(requestViewUpdate()));
...@@ -56,16 +60,33 @@ void VtkVisTabWidget::setActiveItem( VtkVisPipelineItem* item ) ...@@ -56,16 +60,33 @@ void VtkVisTabWidget::setActiveItem( VtkVisPipelineItem* item )
if (actor) if (actor)
{ {
actorPropertiesGroupBox->setEnabled(true); actorPropertiesGroupBox->setEnabled(true);
transformTabWidget->setEnabled(true);
vtkProperty* vtkProps = actor->GetProperty(); vtkProperty* vtkProps = actor->GetProperty();
diffuseColorPickerButton->setColor(vtkProps->GetDiffuseColor()); diffuseColorPickerButton->setColor(vtkProps->GetDiffuseColor());
visibleEdgesCheckBox->setChecked(vtkProps->GetEdgeVisibility()); visibleEdgesCheckBox->setChecked(vtkProps->GetEdgeVisibility());
edgeColorPickerButton->setColor(vtkProps->GetEdgeColor()); edgeColorPickerButton->setColor(vtkProps->GetEdgeColor());
opacitySlider->setValue((int)(vtkProps->GetOpacity() * 100.0)); opacitySlider->setValue((int)(vtkProps->GetOpacity() * 100.0));
vtkTransform* transform = vtkTransform* transform =
static_cast<vtkTransform*>(_item->transformFilter()->GetTransform()); static_cast<vtkTransform*>(_item->transformFilter()->GetTransform());
//signals off
double scale[3]; double scale[3];
transform->GetScale(scale); transform->GetScale(scale);
scaleZ->setText(QString::number(scale[2])); double* trans = transform->GetPosition();
//switch signals off for just filling in text-boxes after clicking on an item
this->scaleZ->blockSignals(true);
this->transX->blockSignals(true);
this->transY->blockSignals(true);
this->transZ->blockSignals(true);
this->scaleZ->setText(QString::number(scale[2]));
this->transX->setText(QString::number(trans[0]));
this->transY->setText(QString::number(trans[1]));
this->transZ->setText(QString::number(trans[2]));
this->scaleZ->blockSignals(false);
this->transX->blockSignals(false);
this->transY->blockSignals(false);
this->transZ->blockSignals(false);
//switch signals back on
this->buildScalarArrayComboBox(_item); this->buildScalarArrayComboBox(_item);
...@@ -82,7 +103,10 @@ void VtkVisTabWidget::setActiveItem( VtkVisPipelineItem* item ) ...@@ -82,7 +103,10 @@ void VtkVisTabWidget::setActiveItem( VtkVisPipelineItem* item )
} }
} }
else else
{
actorPropertiesGroupBox->setEnabled(false); actorPropertiesGroupBox->setEnabled(false);
transformTabWidget->setEnabled(false);
}
this->buildProportiesDialog(item); this->buildProportiesDialog(item);
...@@ -110,6 +134,7 @@ void VtkVisTabWidget::setActiveItem( VtkVisPipelineItem* item ) ...@@ -110,6 +134,7 @@ void VtkVisTabWidget::setActiveItem( VtkVisPipelineItem* item )
else else
{ {
actorPropertiesGroupBox->setEnabled(false); actorPropertiesGroupBox->setEnabled(false);
transformTabWidget->setEnabled(false);
this->activeScalarComboBox->clear(); this->activeScalarComboBox->clear();
} }
...@@ -179,6 +204,22 @@ void VtkVisTabWidget::on_scaleZ_textChanged(const QString &text) ...@@ -179,6 +204,22 @@ void VtkVisTabWidget::on_scaleZ_textChanged(const QString &text)
} }
} }
void VtkVisTabWidget::translateItem()
{
bool okX(true), okY(true), okZ(true);
double trans[3];
trans[0] = transX->text().toDouble(&okX);
trans[1] = transY->text().toDouble(&okY);
trans[2] = transZ->text().toDouble(&okZ);
if (okX && okY && okZ)
{
_item->setTranslation(trans[0], trans[1], trans[2]);
emit requestViewUpdate();
}
}
void VtkVisTabWidget::buildProportiesDialog(VtkVisPipelineItem* item) void VtkVisTabWidget::buildProportiesDialog(VtkVisPipelineItem* item)
{ {
QFormLayout* layout = static_cast<QFormLayout*>(this->scrollAreaWidgetContents->layout()); QFormLayout* layout = static_cast<QFormLayout*>(this->scrollAreaWidgetContents->layout());
......
...@@ -34,6 +34,9 @@ protected slots: ...@@ -34,6 +34,9 @@ protected slots:
void on_edgeColorPickerButton_colorPicked(QColor color); void on_edgeColorPickerButton_colorPicked(QColor color);
void on_opacitySlider_sliderMoved(int value); void on_opacitySlider_sliderMoved(int value);
void on_scaleZ_textChanged(const QString &text); void on_scaleZ_textChanged(const QString &text);
void on_transX_textChanged(const QString &text) { this->translateItem(); };
void on_transY_textChanged(const QString &text) { this->translateItem(); };
void on_transZ_textChanged(const QString &text) { this->translateItem(); };
void SetActiveAttributeOnItem(const QString &name); void SetActiveAttributeOnItem(const QString &name);
...@@ -43,6 +46,9 @@ private: ...@@ -43,6 +46,9 @@ private:
/// Reads the scalar arrays of the given vtk-object and constructs content for the scalar array selection box. /// Reads the scalar arrays of the given vtk-object and constructs content for the scalar array selection box.
void buildScalarArrayComboBox(VtkVisPipelineItem* item); void buildScalarArrayComboBox(VtkVisPipelineItem* item);
void translateItem();
VtkVisPipelineItem* _item; VtkVisPipelineItem* _item;
signals: signals:
......
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>279</width> <width>259</width>
<height>741</height> <height>677</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>0</width> <width>0</width>
<height>200</height> <height>180</height>
</size> </size>
</property> </property>
<property name="title"> <property name="title">
...@@ -113,23 +113,6 @@ ...@@ -113,23 +113,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Scaling Factor</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="scaleZ">
<property name="text">
<string>1</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="1"> <item row="1" column="1">
<widget class="QComboBox" name="activeScalarComboBox"/> <widget class="QComboBox" name="activeScalarComboBox"/>
</item> </item>
...@@ -143,6 +126,183 @@ ...@@ -143,6 +126,183 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item>
<widget class="QTabWidget" name="transformTabWidget">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>60</height>
</size>
</property>
<property name="currentIndex">
<number>1</number>
</property>
<widget class="QWidget" name="scalingTab">
<attribute name="title">
<string>Scaling</string>
</attribute>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<property name="spacing">
<number>5</number>
</property>
<property name="margin">
<number>5</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>5</number>
</property>
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Scaling Factor</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="scaleZ">
<property name="text">
<string>1</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="translationTab">
<attribute name="title">
<string>Translation</string>
</attribute>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<property name="spacing">
<number>5</number>
</property>
<property name="margin">
<number>5</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>5</number>
</property>
<item>
<widget class="QLabel" name="transXLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>X</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="transX">
<property name="text">
<string>0</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="transYLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Y</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="transY">
<property name="text">
<string>0</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="transZLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Z</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="transZ">
<property name="text">
<string>0</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
</item>
<item> <item>
<widget class="QGroupBox" name="filterPropertiesGroupBox"> <widget class="QGroupBox" name="filterPropertiesGroupBox">
<property name="sizePolicy"> <property name="sizePolicy">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment