[FEM] fix illegal storage access in point filter

- occurred when changing Field to "None"

- also remove doubled and unused code and add a blank line to separate the different filters in the code better
This commit is contained in:
Uwe
2022-06-10 13:16:23 +02:00
parent 19ffd1ca94
commit 4c3c23776d

View File

@@ -328,6 +328,7 @@ void TaskPostBox::updateEnumerationList(App::PropertyEnumeration& prop, QComboBo
box->setCurrentIndex(index);
}
// ***************************************************************************
// post pipeline results
TaskPostDisplay::TaskPostDisplay(Gui::ViewProviderDocumentObject* view, QWidget* parent)
@@ -408,6 +409,7 @@ void TaskPostFunction::applyPythonCode() {
//we apply the views widgets python code
}
// ***************************************************************************
// region clip filter
TaskPostClip::TaskPostClip(ViewProviderDocumentObject* view, App::PropertyLink* function, QWidget* parent)
@@ -535,6 +537,7 @@ void TaskPostClip::on_InsideOut_toggled(bool val) {
recompute();
}
// ***************************************************************************
// data along a line
TaskPostDataAlongLine::TaskPostDataAlongLine(ViewProviderDocumentObject* view, QWidget* parent)
@@ -753,6 +756,7 @@ plt.show()\n";
return oss.str();
}
// ***************************************************************************
// data at point
TaskPostDataAtPoint::TaskPostDataAtPoint(ViewProviderDocumentObject* view, QWidget* parent)
@@ -864,7 +868,6 @@ void TaskPostDataAtPoint::onChange(double x, double y, double z) {
void TaskPostDataAtPoint::centerChanged(double) {
Base::Vector3d vec(ui->centerX->value().getValue(), ui->centerY->value().getValue(), ui->centerZ->value().getValue());
std::string ObjName = static_cast<Fem::FemPostDataAtPointFilter*>(getObject())->Label.getValue();
Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.%s.Center = App.Vector(%f, %f, %f)", ObjName.c_str(),
ui->centerX->value().getValue(), ui->centerY->value().getValue(), ui->centerZ->value().getValue());
@@ -908,10 +911,15 @@ void TaskPostDataAtPoint::on_Field_activated(int i) {
getTypedView<ViewProviderFemPostObject>()->Field.setValue(i);
std::string FieldName = ui->Field->currentText().toStdString();
// there is no "None" for the FieldName property, thus return here
if (FieldName == "None") {
static_cast<Fem::FemPostDataAtPointFilter*>(getObject())->Unit.setValue("");
return;
}
static_cast<Fem::FemPostDataAtPointFilter*>(getObject())->FieldName.setValue(FieldName);
if ((FieldName == "von Mises Stress") || (FieldName == "Tresca Stress")
|| (FieldName == "Major Principal Stress") || (FieldName == "Intermediate Principal Stress")
|| (FieldName == "Minor Principal Stress") || (FieldName == "Minor Principal Stress")
|| (FieldName == "Minor Principal Stress")
|| (FieldName == "Stress xx component") || (FieldName == "Stress xy component")
|| (FieldName == "Stress xz component") || (FieldName == "Stress yy component")
|| (FieldName == "Stress yz component") || (FieldName == "Stress zz component")) {
@@ -949,6 +957,7 @@ void TaskPostDataAtPoint::on_Field_activated(int i) {
Base::Console().Error(PointData.c_str());
}
// ***************************************************************************
// scalar clip filter
TaskPostScalarClip::TaskPostScalarClip(ViewProviderDocumentObject* view, QWidget* parent) :
@@ -1055,6 +1064,7 @@ void TaskPostScalarClip::on_InsideOut_toggled(bool val) {
recompute();
}
// ***************************************************************************
// warp filter
// spinbox min, slider, spinbox max
@@ -1198,6 +1208,7 @@ void TaskPostWarpVector::on_Min_valueChanged(double) {
ui->Slider->blockSignals(false);
}
// ***************************************************************************
// function clip filter
TaskPostCut::TaskPostCut(ViewProviderDocumentObject* view, App::PropertyLink* function, QWidget* parent)