From 64e6e7a781018436be67be84ccfdc3a824fb88eb Mon Sep 17 00:00:00 2001 From: Uwe Date: Sun, 12 Jun 2022 03:34:02 +0200 Subject: [PATCH] [FEM] fix point filter output fixes #7008: - the point data must be read also when the center changed - when the dialog is called it has only the value for the current field, thus recompute the feature to fill all fields with data - on clicking on a mesh point display the value at the clicked position - due to the object's recomputation at the start, a complete recomputation (for the whole pipeline) is needed on closing the dialog --- src/Mod/Fem/App/FemPostFilter.cpp | 11 ++++------- src/Mod/Fem/Gui/TaskPostBoxes.cpp | 18 +++++++++++++----- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/Mod/Fem/App/FemPostFilter.cpp b/src/Mod/Fem/App/FemPostFilter.cpp index aeba7649fb..ce4edf9070 100644 --- a/src/Mod/Fem/App/FemPostFilter.cpp +++ b/src/Mod/Fem/App/FemPostFilter.cpp @@ -385,19 +385,16 @@ void FemPostDataAtPointFilter::onChanged(const Property* prop) { const Base::Vector3d& vec = Center.getValue(); m_point->SetCenter(vec.x, vec.y, vec.z); } - else if (prop == &FieldName) { - GetPointData(); - } + GetPointData(); Fem::FemPostFilter::onChanged(prop); } short int FemPostDataAtPointFilter::mustExecute(void) const { - if (Center.isTouched()) { - + if (Center.isTouched()) return 1; - } - else return App::DocumentObject::mustExecute(); + else + return App::DocumentObject::mustExecute(); } void FemPostDataAtPointFilter::GetPointData() { diff --git a/src/Mod/Fem/Gui/TaskPostBoxes.cpp b/src/Mod/Fem/Gui/TaskPostBoxes.cpp index 77a659d23f..c8ef193189 100644 --- a/src/Mod/Fem/Gui/TaskPostBoxes.cpp +++ b/src/Mod/Fem/Gui/TaskPostBoxes.cpp @@ -257,7 +257,6 @@ void TaskDlgPost::clicked(int button) bool TaskDlgPost::accept() { - try { std::vector::iterator it = m_boxes.begin(); for (; it != m_boxes.end(); ++it) @@ -811,12 +810,16 @@ TaskPostDataAtPoint::TaskPostDataAtPoint(ViewProviderDocumentObject* view, QWidg connect(ui->centerY, SIGNAL(valueChanged(double)), this, SLOT(centerChanged(double))); connect(ui->centerZ, SIGNAL(valueChanged(double)), this, SLOT(centerChanged(double))); - //update all fields + // update all fields updateEnumerationList(getTypedView()->Field, ui->Field); + + // the point filter object needs to be recompiled + // to fill all fields with data at the current point + static_cast(getObject())->recomputeFeature(); } TaskPostDataAtPoint::~TaskPostDataAtPoint() { - + App::GetApplication().getActiveDocument()->recompute(); } void TaskPostDataAtPoint::applyPythonCode() { @@ -883,6 +886,12 @@ void TaskPostDataAtPoint::onChange(double x, double y, double z) { ui->centerX->setValue(x); ui->centerY->setValue(y); ui->centerZ->setValue(z); + Base::Console().Error("on Change\n"); + // recompute the feature to fill all fields with data at this point + static_cast(getObject())->recomputeFeature(); + // show the data ba calling on_Field_activated with the field that is currently set + auto Field = getTypedView()->Field.getValue(); + on_Field_activated(Field); } void TaskPostDataAtPoint::centerChanged(double) { @@ -974,9 +983,8 @@ void TaskPostDataAtPoint::on_Field_activated(int i) { bool scientific = (pointValue < 1e-2) || (pointValue > 1e4); std::ios::fmtflags flags = scientific ? (std::ios::scientific | std::ios::showpoint | std::ios::showpos) : (std::ios::fixed | std::ios::showpoint | std::ios::showpos); - int UserDecimals = Base::UnitsApi::getDecimals(); std::stringstream valueStream; - valueStream.precision(UserDecimals); + valueStream.precision(Base::UnitsApi::getDecimals()); valueStream.setf(flags); valueStream << pointValue;