18#include <vtkImageChangeInformation.h>
19#include <vtkProperty.h>
20#include <vtkTransform.h>
21#include <vtkTransformFilter.h>
36 this->scaleZ->setValidator(
new QDoubleValidator(0, 100, 8,
this));
38 this->transX->setValidator(
new QDoubleValidator(
this));
39 this->transY->setValidator(
new QDoubleValidator(
this));
40 this->transZ->setValidator(
new QDoubleValidator(
this));
48 connect(this->activeScalarComboBox,
49 SIGNAL(currentIndexChanged(
const QString&)),
this,
56 const QString selected_array_name =
57 this->activeScalarComboBox->currentText();
67 transformTabWidget->setEnabled(
true);
69 auto* transform_filter =
73 actorPropertiesGroupBox->setEnabled(
true);
74 vtkProperty* vtkProps =
75 static_cast<vtkActor*
>(
_item->
actor())->GetProperty();
76 diffuseColorPickerButton->setColor(vtkProps->GetDiffuseColor());
77 visibleEdgesCheckBox->setChecked(vtkProps->GetEdgeVisibility());
78 edgeColorPickerButton->setColor(vtkProps->GetEdgeColor());
79 opacitySlider->setValue(
80 static_cast<int>(vtkProps->GetOpacity() * 100.0));
83 static_cast<vtkTransform*
>(transform_filter->GetTransform());
87 transform->GetScale(scale);
89 transform->GetPosition(trans);
93 this->scaleZ->blockSignals(
true);
94 this->transX->blockSignals(
true);
95 this->transY->blockSignals(
true);
96 this->transZ->blockSignals(
true);
97 this->scaleZ->setText(QString::number(scale[2]));
98 this->transX->setText(QString::number(trans[0] / scale[0]));
99 this->transY->setText(QString::number(trans[1] / scale[1]));
100 this->transZ->setText(QString::number(trans[2] / scale[2]));
101 this->scaleZ->blockSignals(
false);
102 this->transX->blockSignals(
false);
103 this->transY->blockSignals(
false);
104 this->transZ->blockSignals(
false);
111 if (activeAttribute.length() > 0)
113 for (
int i = 0; i < this->activeScalarComboBox->count(); i++)
115 QString itemText = this->activeScalarComboBox->itemText(i);
116 if (itemText.compare(activeAttribute) == 0)
118 this->activeScalarComboBox->setCurrentIndex(i);
127 actorPropertiesGroupBox->setEnabled(
false);
131 transform->GetOriginTranslation(trans);
132 this->transX->blockSignals(
true);
133 this->transY->blockSignals(
true);
134 this->transZ->blockSignals(
true);
135 this->transX->setText(QString::number(trans[0]));
136 this->transY->setText(QString::number(trans[1]));
137 this->transZ->setText(QString::number(trans[2]));
138 this->transX->blockSignals(
false);
139 this->transY->blockSignals(
false);
140 this->transZ->blockSignals(
false);
149 actorPropertiesGroupBox->setEnabled(
false);
150 transformTabWidget->setEnabled(
false);
151 this->activeScalarComboBox->clear();
159 ->SetDiffuseColor(color.redF(), color.greenF(), color.blueF());
166 if (state == Qt::Checked)
170 ->SetEdgeVisibility(1);
171 edgeColorPickerButton->setEnabled(
true);
177 ->SetEdgeVisibility(0);
178 edgeColorPickerButton->setEnabled(
false);
188 ->SetEdgeColor(color.redF(), color.greenF(), color.blueF());
196 ->SetOpacity(value / 100.0);
203 double scale = text.toDouble(&ok);
206 if (ok && scale != 0.0)
220 VtkColorByHeightFilter::SafeDownCast(
221 colorFilter->GetOutputAlgorithm())
222 ->SetTableRangeScaling(scale);
238 trans[0] = transX->text().toDouble(&okX);
239 trans[1] = transY->text().toDouble(&okY);
240 trans[2] = transZ->text().toDouble(&okZ);
242 if (okX && okY && okZ)
252 static_cast<QFormLayout*
>(this->scrollAreaWidgetContents->layout());
253 while (layout->count())
255 delete layout->takeAt(0)->widget();
258 QMap<QString, QVariant>* propMap =
nullptr;
259 QMap<QString, QList<QVariant>>* propVecMap =
nullptr;
262 if (algProps ==
nullptr)
263 WARN(
"VtkAlgorithmProperties null!");
284 QMapIterator<QString, QVariant> i(*propMap);
288 QString key = i.key();
289 QVariant value = i.value();
293 switch (value.type())
295 case QVariant::Double:
297 QString::number(value.toDouble()), key,
298 QVariant::Double, algProps);
299 connect(lineEdit, SIGNAL(editingFinished()),
this,
301 layout->addRow(key, lineEdit);
306 QString::number(value.toInt()), key, QVariant::Int,
308 connect(lineEdit, SIGNAL(editingFinished()),
this,
310 layout->addRow(key, lineEdit);
316 connect(checkbox, SIGNAL(stateChanged(
int)),
this,
318 layout->addRow(key, checkbox);
329 QMapIterator<QString, QList<QVariant>> i(*propVecMap);
333 QString key = i.key();
334 QList<QVariant> values = i.value();
338 QList<QString> valuesAsString;
339 foreach (QVariant variant, values)
340 valuesAsString.push_back(variant.toString());
344 valuesAsString, key, values.front().type(), algProps);
345 connect(vectorEdit, SIGNAL(editingFinished()),
this,
347 layout->addRow(key, vectorEdit);
356 dataSetAttributesList.push_back(
"Solid Color");
357 this->activeScalarComboBox->blockSignals(
true);
358 this->activeScalarComboBox->clear();
359 this->activeScalarComboBox->insertItems(0, dataSetAttributesList);
360 this->activeScalarComboBox->blockSignals(
false);
362 QList<QString>::iterator it = dataSetAttributesList.begin();
363 if (active_array_name.length() == 0)
370 for (it = dataSetAttributesList.begin();
371 it != dataSetAttributesList.end();
374 if (active_array_name.compare((*it).right((*it).length() - 2)) == 0)
376 this->activeScalarComboBox->setCurrentIndex(idx);
void WARN(fmt::format_string< Args... > fmt, Args &&... args)
Definition of the VtkAlgorithmPropertyCheckbox class.
Definition of the VtkAlgorithmPropertyLineEdit class.
Definition of the VtkAlgorithmPropertyVectorEdit class.
Definition of the VtkColorByHeightFilter class.
Definition of the VtkCompositeColorByHeightFilter class.
Definition of the VtkVisImageItem class.
Definition of the VtkVisPipelineItem class.
virtual int childCount() const
Contains properties for the visualization of objects as VtkVisPipelineItems.
QMap< QString, QVariant > * GetAlgorithmUserProperties() const
Returns a map of user properties.
void RemoveLookupTable(const QString &array_name)
Removes the lookup table for the given scalar.
QMap< QString, QList< QVariant > > * GetAlgorithmUserVectorProperties() const
Returns a map of vector user properties.
This checkbox sets a user property on the given VtkAlgorithmProperties object automatically.
This QLineEdit sets a user property on the given VtkAlgorithmProperties object automatically.
This edit widget consists of several QLineEdit to set a user vector property on the given VtkAlgorith...
This filter colors the input by the points z-value.
An item in the VtkVisPipeline containing an image to be visualized.
vtkAlgorithm * transformFilter() const override
An item in the VtkVisPipeline containing a graphic object to be visualized.
virtual void setScale(double x, double y, double z) const
Scales the data in visualisation-space. This function is empty and needs to be implemented by derived...
virtual void setTranslation(double x, double y, double z) const
Translates the item in visualisation-space. This function is empty and needs to be implemented by der...
vtkProp3D * actor() const
Returns the actor as vtkProp3D.
QStringList getScalarArrayNames() const
Returns a list of array names prefixed with P- or C- for point and cell data.
virtual vtkAlgorithm * transformFilter() const =0
VtkVisPipelineItem * child(int row) const
Returns a VtkVisPipelineItem.
VtkAlgorithmProperties * getVtkProperties() const
Returns the VtkAlgorithmProperties.
virtual QString GetActiveAttribute() const
VtkCompositeFilter * compositeFilter() const
Returns the composite filter.
virtual void SetActiveAttribute(const QString &str)