diff --git a/0001-Fix-ODR-violation-correct-Ui_TaskSketcherGeneral-nam.patch b/0001-Fix-ODR-violation-correct-Ui_TaskSketcherGeneral-nam.patch new file mode 100644 index 0000000..b31f335 --- /dev/null +++ b/0001-Fix-ODR-violation-correct-Ui_TaskSketcherGeneral-nam.patch @@ -0,0 +1,35 @@ +From 47be1f5e46acd7f438672b238f1e8354a494decf Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Stefan=20Br=C3=BCns?= +Date: Sat, 28 Nov 2020 13:35:59 +0100 +Subject: [PATCH] Fix ODR violation, correct Ui_TaskSketcherGeneral namespace + +The generated ui_TaskSketcherGeneral.h defines the class in the +SketcherGui namespace. +--- + src/Mod/Sketcher/Gui/TaskSketcherGeneral.h | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/src/Mod/Sketcher/Gui/TaskSketcherGeneral.h b/src/Mod/Sketcher/Gui/TaskSketcherGeneral.h +index eb3276ec7..c08489eeb 100644 +--- a/src/Mod/Sketcher/Gui/TaskSketcherGeneral.h ++++ b/src/Mod/Sketcher/Gui/TaskSketcherGeneral.h +@@ -28,8 +28,6 @@ + #include + #include + +-class Ui_TaskSketcherGeneral; +- + namespace App { + class Property; + } +@@ -40,6 +38,7 @@ class ViewProvider; + + namespace SketcherGui { + ++class Ui_TaskSketcherGeneral; + class ViewProviderSketch; + + class SketcherGeneralWidget : public QWidget +-- +2.29.2 + diff --git a/0001-boost-1.73.0-The-practice-of-declaring-the-Bind-plac.patch b/0001-boost-1.73.0-The-practice-of-declaring-the-Bind-plac.patch index 6e349f0..6377c8a 100644 --- a/0001-boost-1.73.0-The-practice-of-declaring-the-Bind-plac.patch +++ b/0001-boost-1.73.0-The-practice-of-declaring-the-Bind-plac.patch @@ -1,8 +1,8 @@ -From 74469f8a153f557fcb4dcb0704f40c5e75143f79 Mon Sep 17 00:00:00 2001 +From f32b8ff2e761f8967a25bfc6f7c91dff27ac70f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Br=C3=BCns?= Date: Sat, 19 Sep 2020 03:31:56 +0200 -Subject: [PATCH] boost 1.73.0: The practice of declaring the Bind placeholders - (_1, _2, ...) in the global namespace is deprecated +Subject: [PATCH 1/2] boost 1.73.0: The practice of declaring the Bind + placeholders (_1, _2, ...) in the global namespace is deprecated --- .../salomesmesh/src/SMESH/SMESH_Mesh.cpp | 4 +- @@ -61,7 +61,7 @@ Subject: [PATCH] boost 1.73.0: The practice of declaring the Bind placeholders src/Mod/Drawing/Gui/TaskOrthoViews.cpp | 7 +- src/Mod/Fem/Gui/PreCompiled.h | 2 +- src/Mod/Fem/Gui/ViewProviderAnalysis.cpp | 2 +- - .../Fem/Gui/ViewProviderFemPostFunction.cpp | 1224 ++++++++--------- + .../Fem/Gui/ViewProviderFemPostFunction.cpp | 5 +- src/Mod/Inspection/App/InspectionFeature.cpp | 5 +- src/Mod/Mesh/App/Core/Curvature.cpp | 5 +- src/Mod/Mesh/Gui/DlgEvaluateMeshImp.cpp | 2 - @@ -87,7 +87,7 @@ Subject: [PATCH] boost 1.73.0: The practice of declaring the Bind placeholders src/Mod/PartDesign/Gui/Workbench.cpp | 23 +- src/Mod/PartDesign/Gui/WorkflowManager.cpp | 9 +- src/Mod/Path/App/Area.cpp | 3 + - src/Mod/Path/libarea/PythonStuff.cpp | 1082 +++++++-------- + src/Mod/Path/libarea/PythonStuff.cpp | 1082 +++++++++-------- .../ReverseEngineering/App/ApproxSurface.cpp | 5 +- src/Mod/Sandbox/App/DocumentProtector.h | 1 - src/Mod/Sandbox/Gui/Command.cpp | 6 +- @@ -107,7 +107,7 @@ Subject: [PATCH] boost 1.73.0: The practice of declaring the Bind placeholders src/Mod/TechDraw/Gui/MDIViewPage.cpp | 5 +- .../TechDraw/Gui/ViewProviderDrawingView.cpp | 5 +- src/Mod/TechDraw/Gui/ViewProviderPage.cpp | 5 +- - 102 files changed, 1657 insertions(+), 1602 deletions(-) + 102 files changed, 1048 insertions(+), 992 deletions(-) diff --git a/src/3rdParty/salomesmesh/src/SMESH/SMESH_Mesh.cpp b/src/3rdParty/salomesmesh/src/SMESH/SMESH_Mesh.cpp index bb278f827..7ab201cef 100644 @@ -1925,1234 +1925,32 @@ index f062ad772..d1e9e8335 100644 # include #endif diff --git a/src/Mod/Fem/Gui/ViewProviderFemPostFunction.cpp b/src/Mod/Fem/Gui/ViewProviderFemPostFunction.cpp -index 91b615aa4..1d305f3ea 100644 +index 91b615aa4..06b40ee8c 100644 --- a/src/Mod/Fem/Gui/ViewProviderFemPostFunction.cpp +++ b/src/Mod/Fem/Gui/ViewProviderFemPostFunction.cpp -@@ -1,612 +1,612 @@ --/*************************************************************************** -- * Copyright (c) 2015 Stefan Tröger * -- * * -- * This file is part of the FreeCAD CAx development system. * -- * * -- * This library is free software; you can redistribute it and/or * -- * modify it under the terms of the GNU Library General Public * -- * License as published by the Free Software Foundation; either * -- * version 2 of the License, or (at your option) any later version. * -- * * -- * This library is distributed in the hope that it will be useful, * -- * but WITHOUT ANY WARRANTY; without even the implied warranty of * -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -- * GNU Library General Public License for more details. * -- * * -- * You should have received a copy of the GNU Library General Public * -- * License along with this library; see the file COPYING.LIB. If not, * -- * write to the Free Software Foundation, Inc., 59 Temple Place, * -- * Suite 330, Boston, MA 02111-1307, USA * -- * * -- ***************************************************************************/ -- -- --#include "PreCompiled.h" -- --#ifndef _PreComp_ --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include --#endif -- --#include "ViewProviderFemPostFunction.h" --#include "TaskPostBoxes.h" --#include --#include --#include --#include --#include --#include --#include --#include --#include --#include -- +@@ -60,19 +60,20 @@ + #include + #include + -#include --#include -- --#include "ui_PlaneWidget.h" --#include "ui_SphereWidget.h" -- --using namespace FemGui; -- --void FunctionWidget::setViewProvider(ViewProviderFemPostFunction* view) { -- -- m_view = view; -- m_object = static_cast(view->getObject()); ++#include + #include + + #include "ui_PlaneWidget.h" + #include "ui_SphereWidget.h" + + using namespace FemGui; ++namespace bp = boost::placeholders; + + void FunctionWidget::setViewProvider(ViewProviderFemPostFunction* view) { + + m_view = view; + m_object = static_cast(view->getObject()); - m_connection = m_object->getDocument()->signalChangedObject.connect(boost::bind(&FunctionWidget::onObjectsChanged, this, _1, _2)); --} -- --void FunctionWidget::onObjectsChanged(const App::DocumentObject& obj, const App::Property& p) { -- -- if(&obj == m_object) -- onChange(p); --} -- -- --PROPERTY_SOURCE(FemGui::ViewProviderFemPostFunctionProvider, Gui::ViewProviderDocumentObject) -- --ViewProviderFemPostFunctionProvider::ViewProviderFemPostFunctionProvider() { -- --} -- --ViewProviderFemPostFunctionProvider::~ViewProviderFemPostFunctionProvider() { -- --} -- --std::vector< App::DocumentObject* > ViewProviderFemPostFunctionProvider::claimChildren(void) const { -- -- return static_cast(getObject())->Functions.getValues(); --} -- --std::vector< App::DocumentObject* > ViewProviderFemPostFunctionProvider::claimChildren3D(void) const { -- return claimChildren(); --} -- --void ViewProviderFemPostFunctionProvider::onChanged(const App::Property* prop) { -- Gui::ViewProviderDocumentObject::onChanged(prop); -- -- updateSize(); --} -- --void ViewProviderFemPostFunctionProvider::updateData(const App::Property* prop) { -- Gui::ViewProviderDocumentObject::updateData(prop); -- -- if(strcmp(prop->getName(), "Functions") == 0) { -- updateSize(); -- } --} -- --void ViewProviderFemPostFunctionProvider::updateSize() { -- -- std::vector< App::DocumentObject* > vec = claimChildren(); -- for(std::vector< App::DocumentObject* >::iterator it = vec.begin(); it != vec.end(); ++it) { -- -- if(!(*it)->isDerivedFrom(Fem::FemPostFunction::getClassTypeId())) -- continue; -- -- ViewProviderFemPostFunction* vp = static_cast(Gui::Application::Instance->getViewProvider(*it)); -- vp->AutoScaleFactorX.setValue(SizeX.getValue()); -- vp->AutoScaleFactorY.setValue(SizeY.getValue()); -- vp->AutoScaleFactorZ.setValue(SizeZ.getValue()); -- } --} -- -- -- --PROPERTY_SOURCE(FemGui::ViewProviderFemPostFunction, Gui::ViewProviderDocumentObject) -- --ViewProviderFemPostFunction::ViewProviderFemPostFunction() : m_autoscale(false), m_isDragging(false) --{ -- -- ADD_PROPERTY_TYPE(AutoScaleFactorX, (1), "AutoScale", App::Prop_Hidden, "Automatic scaling factor"); -- ADD_PROPERTY_TYPE(AutoScaleFactorY, (1), "AutoScale", App::Prop_Hidden, "Automatic scaling factor"); -- ADD_PROPERTY_TYPE(AutoScaleFactorZ, (1), "AutoScale", App::Prop_Hidden, "Automatic scaling factor"); -- -- m_geometrySeperator = new SoSeparator(); -- m_geometrySeperator->ref(); -- -- m_transform = new SoTransform(); -- m_transform->ref(); -- -- m_scale = new SoScale(); -- m_scale->ref(); -- m_scale->scaleFactor = SbVec3f(1,1,1); --} -- --ViewProviderFemPostFunction::~ViewProviderFemPostFunction() --{ -- m_geometrySeperator->unref(); -- m_manip->unref(); -- m_scale->unref(); -- //transform is unref'd when it is replaced by the dragger --} -- --void ViewProviderFemPostFunction::attach(App::DocumentObject *pcObj) --{ -- ViewProviderDocumentObject::attach(pcObj); -- -- // setup the graph for editing the function unit geometry -- SoMaterial* color = new SoMaterial(); -- color->diffuseColor.setValue(0,0,1); -- color->transparency.setValue(0.5); -- -- m_transform = new SoTransform; -- -- m_manip = setupManipulator(); -- m_manip->ref(); -- -- SoSeparator* pcEditNode = new SoSeparator(); -- -- pcEditNode->addChild(color); -- pcEditNode->addChild(m_transform); -- pcEditNode->addChild(m_geometrySeperator); -- -- m_geometrySeperator->insertChild(m_scale, 0); -- -- // Now we replace the SoTransform node by a manipulator -- // Note: Even SoCenterballManip inherits from SoTransform -- // we cannot use it directly (in above code) because the -- // translation and center fields are overridden. -- SoSearchAction sa; -- sa.setInterest(SoSearchAction::FIRST); -- sa.setSearchingAll(FALSE); -- sa.setNode(m_transform); -- sa.apply(pcEditNode); -- SoPath * path = sa.getPath(); -- if (path) { -- m_manip->replaceNode(path); -- -- SoDragger* dragger = m_manip->getDragger(); -- dragger->addStartCallback(dragStartCallback, this); -- dragger->addFinishCallback(dragFinishCallback, this); -- dragger->addMotionCallback(dragMotionCallback, this); -- } -- -- addDisplayMaskMode(pcEditNode, "Default"); -- setDisplayMaskMode("Default"); --} -- --bool ViewProviderFemPostFunction::doubleClicked(void) { -- Gui::Application::Instance->activeDocument()->setEdit(this, (int)ViewProvider::Default); -- return true; --} -- -- --SoTransformManip* ViewProviderFemPostFunction::setupManipulator() { -- -- return new SoCenterballManip; --} -- -- --std::vector ViewProviderFemPostFunction::getDisplayModes(void) const --{ -- std::vector StrList; -- StrList.push_back("Default"); -- return StrList; --} -- --void ViewProviderFemPostFunction::dragStartCallback(void *data, SoDragger *) --{ -- // This is called when a manipulator is about to manipulating -- Gui::Application::Instance->activeDocument()->openCommand("Edit Mirror"); -- reinterpret_cast(data)->m_isDragging = true; -- -- ViewProviderFemPostFunction* that = reinterpret_cast(data); -- ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Fem"); -- that->m_autoRecompute = hGrp->GetBool("PostAutoRecompute", false); --} -- --void ViewProviderFemPostFunction::dragFinishCallback(void *data, SoDragger *) --{ -- // This is called when a manipulator has done manipulating -- Gui::Application::Instance->activeDocument()->commitCommand(); -- -- ViewProviderFemPostFunction* that = reinterpret_cast(data); -- if(that->m_autoRecompute) -- that->getObject()->getDocument()->recompute(); -- -- reinterpret_cast(data)->m_isDragging = false; --} -- --void ViewProviderFemPostFunction::dragMotionCallback(void *data, SoDragger *drag) --{ -- ViewProviderFemPostFunction* that = reinterpret_cast(data); -- that->draggerUpdate(drag); -- -- if(that->m_autoRecompute) -- that->getObject()->getDocument()->recompute(); --} -- -- --bool ViewProviderFemPostFunction::setEdit(int ModNum) { -- -- -- if (ModNum == ViewProvider::Default || ModNum == 1 ) { -- -- Gui::TaskView::TaskDialog *dlg = Gui::Control().activeDialog(); -- TaskDlgPost *postDlg = qobject_cast(dlg); -- if (postDlg && postDlg->getView() != this) -- postDlg = 0; // another pad left open its task panel -- if (dlg && !postDlg) { -- QMessageBox msgBox; -- msgBox.setText(QObject::tr("A dialog is already open in the task panel")); -- msgBox.setInformativeText(QObject::tr("Do you want to close this dialog?")); -- msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No); -- msgBox.setDefaultButton(QMessageBox::Yes); -- int ret = msgBox.exec(); -- if (ret == QMessageBox::Yes) -- Gui::Control().reject(); -- else -- return false; -- } -- -- // start the edit dialog -- if (postDlg) -- Gui::Control().showDialog(postDlg); -- else { -- postDlg = new TaskDlgPost(this); -- postDlg->appendBox(new TaskPostFunction(this)); -- Gui::Control().showDialog(postDlg); -- } -- -- return true; -- } -- else { -- return ViewProviderDocumentObject::setEdit(ModNum); -- } --} -- --void ViewProviderFemPostFunction::unsetEdit(int ModNum) { -- -- if (ModNum == ViewProvider::Default) { -- // when pressing ESC make sure to close the dialog -- Gui::Control().closeDialog(); -- } -- else { -- ViewProviderDocumentObject::unsetEdit(ModNum); -- } --} -- --void ViewProviderFemPostFunction::onChanged(const App::Property* prop) { -- -- Gui::ViewProviderDocumentObject::onChanged(prop); -- -- if(m_autoscale) -- m_scale->scaleFactor = SbVec3f(AutoScaleFactorX.getValue(), AutoScaleFactorY.getValue(), AutoScaleFactorZ.getValue()); --} -- -- -- --//################################################################################################# -- --PROPERTY_SOURCE(FemGui::ViewProviderFemPostPlaneFunction, FemGui::ViewProviderFemPostFunction) -- --ViewProviderFemPostPlaneFunction::ViewProviderFemPostPlaneFunction() { -- -- sPixmap = "fem-post-geo-plane"; -- -- setAutoScale(true); -- -- //setup the visualisation geometry -- SoCoordinate3* points = new SoCoordinate3(); -- points->point.setNum(4); -- points->point.set1Value(0, -0.5, -0.5, 0); -- points->point.set1Value(1, -0.5, 0.5, 0); -- points->point.set1Value(2, 0.5, 0.5, 0); -- points->point.set1Value(3, 0.5, -0.5, 0); -- points->point.set1Value(4, -0.5, -0.5, 0); -- SoLineSet* line = new SoLineSet(); -- getGeometryNode()->addChild(points); -- getGeometryNode()->addChild(line); --} -- --ViewProviderFemPostPlaneFunction::~ViewProviderFemPostPlaneFunction() { -- --} -- --void ViewProviderFemPostPlaneFunction::draggerUpdate(SoDragger* m) { -- -- Fem::FemPostPlaneFunction* func = static_cast(getObject()); -- SoCenterballDragger* dragger = static_cast(m); -- -- // the new axis of the plane -- SbRotation rot, scaleDir; -- const SbVec3f& center = dragger->center.getValue(); -- -- SbVec3f norm(0,0,1); -- dragger->rotation.getValue().multVec(norm,norm); -- func->Origin.setValue(center[0], center[1], center[2]); -- func->Normal.setValue(norm[0],norm[1],norm[2]); -- -- SbVec3f t = static_cast(getManipulator())->translation.getValue(); -- SbVec3f rt, irt; -- dragger->rotation.getValue().multVec(t,rt); -- dragger->rotation.getValue().inverse().multVec(t,irt); --} -- --void ViewProviderFemPostPlaneFunction::updateData(const App::Property* p) { -- -- Fem::FemPostPlaneFunction* func = static_cast(getObject()); -- -- if(!isDragging() && (p == &func->Origin || p == &func->Normal)) { -- -- Base::Vector3d trans = func->Origin.getValue(); -- Base::Vector3d norm = func->Normal.getValue(); -- -- norm = norm / norm.Length(); -- SbRotation rot(SbVec3f(0.,0.,1.), SbVec3f(norm.x, norm.y, norm.z)); -- -- SbMatrix t, translate; -- t.setRotate(rot); -- translate.setTranslate(SbVec3f(trans.x, trans.y, trans.z)); -- t.multRight(translate); -- getManipulator()->setMatrix(t); -- } -- Gui::ViewProviderDocumentObject::updateData(p); --} -- -- --FunctionWidget* ViewProviderFemPostPlaneFunction::createControlWidget() { -- return new PlaneWidget(); --} -- -- --PlaneWidget::PlaneWidget() { -- -- ui = new Ui_PlaneWidget(); -- ui->setupUi(this); -- -- connect(ui->originX, SIGNAL(valueChanged(double)), this, SLOT(originChanged(double))); -- connect(ui->originY, SIGNAL(valueChanged(double)), this, SLOT(originChanged(double))); -- connect(ui->originZ, SIGNAL(valueChanged(double)), this, SLOT(originChanged(double))); -- connect(ui->normalX, SIGNAL(valueChanged(double)), this, SLOT(normalChanged(double))); -- connect(ui->normalY, SIGNAL(valueChanged(double)), this, SLOT(normalChanged(double))); -- connect(ui->normalZ, SIGNAL(valueChanged(double)), this, SLOT(normalChanged(double))); -- --} -- --PlaneWidget::~PlaneWidget() { -- --} -- --void PlaneWidget::applyPythonCode() { -- --} -- --void PlaneWidget::setViewProvider(ViewProviderFemPostFunction* view) { -- -- FemGui::FunctionWidget::setViewProvider(view); -- onChange(static_cast(getObject())->Normal); -- onChange(static_cast(getObject())->Origin); --} -- --void PlaneWidget::onChange(const App::Property& p) { -- -- setBlockObjectUpdates(true); -- if(strcmp(p.getName(), "Normal") == 0) { -- const Base::Vector3d& vec = static_cast(&p)->getValue(); -- ui->normalX->setValue(vec.x); -- ui->normalY->setValue(vec.y); -- ui->normalZ->setValue(vec.z); -- } -- else if(strcmp(p.getName(), "Origin") == 0) { -- const Base::Vector3d& vec = static_cast(&p)->getValue(); -- ui->originX->setValue(vec.x); -- ui->originY->setValue(vec.y); -- ui->originZ->setValue(vec.z); -- } -- setBlockObjectUpdates(false); --} -- --void PlaneWidget::normalChanged(double) { -- -- if(!blockObjectUpdates()) { -- Base::Vector3d vec(ui->normalX->value(), ui->normalY->value(), ui->normalZ->value()); -- static_cast(getObject())->Normal.setValue(vec); -- } --} -- --void PlaneWidget::originChanged(double) { -- -- if(!blockObjectUpdates()) { -- Base::Vector3d vec(ui->originX->value(), ui->originY->value(), ui->originZ->value()); -- static_cast(getObject())->Origin.setValue(vec); -- } --} -- -- -- --//################################################################################################# -- --PROPERTY_SOURCE(FemGui::ViewProviderFemPostSphereFunction, FemGui::ViewProviderFemPostFunction) -- --ViewProviderFemPostSphereFunction::ViewProviderFemPostSphereFunction() { -- -- sPixmap = "fem-post-geo-sphere"; -- -- setAutoScale(false); -- -- //setup the visualisation geometry -- SoCoordinate3* points = new SoCoordinate3(); -- points->point.setNum(2*84); -- int idx = 0; -- for(int i=0; i<4; i++) { -- for(int j=0; j<21; j++) { -- points->point.set1Value(idx, SbVec3f(std::sin(2*M_PI/20*j) * std::cos(M_PI/4*i), -- std::sin(2*M_PI/20*j) * std::sin(M_PI/4*i), -- std::cos(2*M_PI/20*j) )); -- ++idx; -- } -- } -- for(int i=0; i<4; i++) { -- for(int j=0; j<21; j++) { -- points->point.set1Value(idx, SbVec3f(std::sin(M_PI/4*i) * std::cos(2*M_PI/20*j), -- std::sin(M_PI/4*i) * std::sin(2*M_PI/20*j), -- std::cos(M_PI/4*i) )); -- ++idx; -- } -- } -- -- SoLineSet* line = new SoLineSet(); -- getGeometryNode()->addChild(points); -- getGeometryNode()->addChild(line); --} -- --ViewProviderFemPostSphereFunction::~ViewProviderFemPostSphereFunction() { --} -- --SoTransformManip* ViewProviderFemPostSphereFunction::setupManipulator() { -- SoHandleBoxManip* manip = new SoHandleBoxManip(); -- manip->getDragger()->setPart("extruder1", new SoSeparator); -- manip->getDragger()->setPart("extruder2", new SoSeparator); -- manip->getDragger()->setPart("extruder3", new SoSeparator); -- manip->getDragger()->setPart("extruder4", new SoSeparator); -- manip->getDragger()->setPart("extruder5", new SoSeparator); -- manip->getDragger()->setPart("extruder6", new SoSeparator); -- manip->getDragger()->setPart("extruder1Active", new SoSeparator); -- manip->getDragger()->setPart("extruder2Active", new SoSeparator); -- manip->getDragger()->setPart("extruder3Active", new SoSeparator); -- manip->getDragger()->setPart("extruder4Active", new SoSeparator); -- manip->getDragger()->setPart("extruder5Active", new SoSeparator); -- manip->getDragger()->setPart("extruder6Active", new SoSeparator); -- -- return manip; --} -- -- --void ViewProviderFemPostSphereFunction::draggerUpdate(SoDragger* m) { -- -- Fem::FemPostSphereFunction* func = static_cast(getObject()); -- SoHandleBoxDragger* dragger = static_cast(m); -- -- // the new axis of the plane -- SbRotation rot, scaleDir; -- const SbVec3f& center = dragger->translation.getValue(); -- -- SbVec3f norm(0,0,1); -- func->Center.setValue(center[0], center[1], center[2]); -- func->Radius.setValue(dragger->scaleFactor.getValue()[0]); --} -- --void ViewProviderFemPostSphereFunction::updateData(const App::Property* p) { -- -- Fem::FemPostSphereFunction* func = static_cast(getObject()); -- -- if(!isDragging() && (p == &func->Center || p == &func->Radius)) { -- -- Base::Vector3d trans = func->Center.getValue(); -- double radius = func->Radius.getValue(); -- -- SbMatrix t, translate; -- t.setScale(radius); -- translate.setTranslate(SbVec3f(trans.x, trans.y, trans.z)); -- t.multRight(translate); -- getManipulator()->setMatrix(t); -- -- } -- Gui::ViewProviderDocumentObject::updateData(p); --} -- -- --FunctionWidget* ViewProviderFemPostSphereFunction::createControlWidget() { -- return new SphereWidget(); --} -- -- --SphereWidget::SphereWidget() { -- -- ui = new Ui_SphereWidget(); -- ui->setupUi(this); -- -- connect(ui->centerX, SIGNAL(valueChanged(double)), this, SLOT(centerChanged(double))); -- connect(ui->centerY, SIGNAL(valueChanged(double)), this, SLOT(centerChanged(double))); -- connect(ui->centerZ, SIGNAL(valueChanged(double)), this, SLOT(centerChanged(double))); -- connect(ui->radius, SIGNAL(valueChanged(double)), this, SLOT(radiusChanged(double))); --} -- --SphereWidget::~SphereWidget() { -- --} -- --void SphereWidget::applyPythonCode() { -- --} -- --void SphereWidget::setViewProvider(ViewProviderFemPostFunction* view) { -- -- FemGui::FunctionWidget::setViewProvider(view); -- onChange(static_cast(getObject())->Center); -- onChange(static_cast(getObject())->Radius); --} -- --void SphereWidget::onChange(const App::Property& p) { -- -- setBlockObjectUpdates(true); -- if(strcmp(p.getName(), "Radius") == 0) { -- double val = static_cast(&p)->getValue(); -- ui->radius->setValue(val); -- } -- else if(strcmp(p.getName(), "Center") == 0) { -- const Base::Vector3d& vec = static_cast(&p)->getValue(); -- ui->centerX->setValue(vec.x); -- ui->centerY->setValue(vec.y); -- ui->centerZ->setValue(vec.z); -- } -- setBlockObjectUpdates(false); --} -- --void SphereWidget::centerChanged(double) { -- -- if(!blockObjectUpdates()) { -- Base::Vector3d vec(ui->centerX->value(), ui->centerY->value(), ui->centerZ->value()); -- static_cast(getObject())->Center.setValue(vec); -- } --} -- --void SphereWidget::radiusChanged(double) { -- -- if(!blockObjectUpdates()) { -- static_cast(getObject())->Radius.setValue(ui->radius->value()); -- } --} -- --#include "moc_ViewProviderFemPostFunction.cpp" -+/*************************************************************************** -+ * Copyright (c) 2015 Stefan Tröger * -+ * * -+ * This file is part of the FreeCAD CAx development system. * -+ * * -+ * This library is free software; you can redistribute it and/or * -+ * modify it under the terms of the GNU Library General Public * -+ * License as published by the Free Software Foundation; either * -+ * version 2 of the License, or (at your option) any later version. * -+ * * -+ * This library is distributed in the hope that it will be useful, * -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of * -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -+ * GNU Library General Public License for more details. * -+ * * -+ * You should have received a copy of the GNU Library General Public * -+ * License along with this library; see the file COPYING.LIB. If not, * -+ * write to the Free Software Foundation, Inc., 59 Temple Place, * -+ * Suite 330, Boston, MA 02111-1307, USA * -+ * * -+ ***************************************************************************/ -+ -+ -+#include "PreCompiled.h" -+ -+#ifndef _PreComp_ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#endif -+ -+#include "ViewProviderFemPostFunction.h" -+#include "TaskPostBoxes.h" -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+ -+#include "ui_PlaneWidget.h" -+#include "ui_SphereWidget.h" -+ -+using namespace FemGui; -+ -+void FunctionWidget::setViewProvider(ViewProviderFemPostFunction* view) { -+ -+ m_view = view; -+ m_object = static_cast(view->getObject()); -+ m_connection = m_object->getDocument()->signalChangedObject.connect(boost::bind(&FunctionWidget::onObjectsChanged, this, bp::_1, bp::_2)); -+} -+ -+void FunctionWidget::onObjectsChanged(const App::DocumentObject& obj, const App::Property& p) { -+ -+ if(&obj == m_object) -+ onChange(p); -+} -+ -+ -+PROPERTY_SOURCE(FemGui::ViewProviderFemPostFunctionProvider, Gui::ViewProviderDocumentObject) -+ -+ViewProviderFemPostFunctionProvider::ViewProviderFemPostFunctionProvider() { -+ -+} -+ -+ViewProviderFemPostFunctionProvider::~ViewProviderFemPostFunctionProvider() { -+ -+} -+ -+std::vector< App::DocumentObject* > ViewProviderFemPostFunctionProvider::claimChildren(void) const { -+ -+ return static_cast(getObject())->Functions.getValues(); -+} -+ -+std::vector< App::DocumentObject* > ViewProviderFemPostFunctionProvider::claimChildren3D(void) const { -+ return claimChildren(); -+} -+ -+void ViewProviderFemPostFunctionProvider::onChanged(const App::Property* prop) { -+ Gui::ViewProviderDocumentObject::onChanged(prop); -+ -+ updateSize(); -+} -+ -+void ViewProviderFemPostFunctionProvider::updateData(const App::Property* prop) { -+ Gui::ViewProviderDocumentObject::updateData(prop); -+ -+ if(strcmp(prop->getName(), "Functions") == 0) { -+ updateSize(); -+ } -+} -+ -+void ViewProviderFemPostFunctionProvider::updateSize() { -+ -+ std::vector< App::DocumentObject* > vec = claimChildren(); -+ for(std::vector< App::DocumentObject* >::iterator it = vec.begin(); it != vec.end(); ++it) { -+ -+ if(!(*it)->isDerivedFrom(Fem::FemPostFunction::getClassTypeId())) -+ continue; -+ -+ ViewProviderFemPostFunction* vp = static_cast(Gui::Application::Instance->getViewProvider(*it)); -+ vp->AutoScaleFactorX.setValue(SizeX.getValue()); -+ vp->AutoScaleFactorY.setValue(SizeY.getValue()); -+ vp->AutoScaleFactorZ.setValue(SizeZ.getValue()); -+ } -+} -+ -+ -+ -+PROPERTY_SOURCE(FemGui::ViewProviderFemPostFunction, Gui::ViewProviderDocumentObject) -+ -+ViewProviderFemPostFunction::ViewProviderFemPostFunction() : m_autoscale(false), m_isDragging(false) -+{ -+ -+ ADD_PROPERTY_TYPE(AutoScaleFactorX, (1), "AutoScale", App::Prop_Hidden, "Automatic scaling factor"); -+ ADD_PROPERTY_TYPE(AutoScaleFactorY, (1), "AutoScale", App::Prop_Hidden, "Automatic scaling factor"); -+ ADD_PROPERTY_TYPE(AutoScaleFactorZ, (1), "AutoScale", App::Prop_Hidden, "Automatic scaling factor"); -+ -+ m_geometrySeperator = new SoSeparator(); -+ m_geometrySeperator->ref(); -+ -+ m_transform = new SoTransform(); -+ m_transform->ref(); -+ -+ m_scale = new SoScale(); -+ m_scale->ref(); -+ m_scale->scaleFactor = SbVec3f(1,1,1); -+} -+ -+ViewProviderFemPostFunction::~ViewProviderFemPostFunction() -+{ -+ m_geometrySeperator->unref(); -+ m_manip->unref(); -+ m_scale->unref(); -+ //transform is unref'd when it is replaced by the dragger -+} -+ -+void ViewProviderFemPostFunction::attach(App::DocumentObject *pcObj) -+{ -+ ViewProviderDocumentObject::attach(pcObj); -+ -+ // setup the graph for editing the function unit geometry -+ SoMaterial* color = new SoMaterial(); -+ color->diffuseColor.setValue(0,0,1); -+ color->transparency.setValue(0.5); -+ -+ m_transform = new SoTransform; -+ -+ m_manip = setupManipulator(); -+ m_manip->ref(); -+ -+ SoSeparator* pcEditNode = new SoSeparator(); -+ -+ pcEditNode->addChild(color); -+ pcEditNode->addChild(m_transform); -+ pcEditNode->addChild(m_geometrySeperator); -+ -+ m_geometrySeperator->insertChild(m_scale, 0); -+ -+ // Now we replace the SoTransform node by a manipulator -+ // Note: Even SoCenterballManip inherits from SoTransform -+ // we cannot use it directly (in above code) because the -+ // translation and center fields are overridden. -+ SoSearchAction sa; -+ sa.setInterest(SoSearchAction::FIRST); -+ sa.setSearchingAll(FALSE); -+ sa.setNode(m_transform); -+ sa.apply(pcEditNode); -+ SoPath * path = sa.getPath(); -+ if (path) { -+ m_manip->replaceNode(path); -+ -+ SoDragger* dragger = m_manip->getDragger(); -+ dragger->addStartCallback(dragStartCallback, this); -+ dragger->addFinishCallback(dragFinishCallback, this); -+ dragger->addMotionCallback(dragMotionCallback, this); -+ } -+ -+ addDisplayMaskMode(pcEditNode, "Default"); -+ setDisplayMaskMode("Default"); -+} -+ -+bool ViewProviderFemPostFunction::doubleClicked(void) { -+ Gui::Application::Instance->activeDocument()->setEdit(this, (int)ViewProvider::Default); -+ return true; -+} -+ -+ -+SoTransformManip* ViewProviderFemPostFunction::setupManipulator() { -+ -+ return new SoCenterballManip; -+} -+ -+ -+std::vector ViewProviderFemPostFunction::getDisplayModes(void) const -+{ -+ std::vector StrList; -+ StrList.push_back("Default"); -+ return StrList; -+} -+ -+void ViewProviderFemPostFunction::dragStartCallback(void *data, SoDragger *) -+{ -+ // This is called when a manipulator is about to manipulating -+ Gui::Application::Instance->activeDocument()->openCommand("Edit Mirror"); -+ reinterpret_cast(data)->m_isDragging = true; -+ -+ ViewProviderFemPostFunction* that = reinterpret_cast(data); -+ ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Fem"); -+ that->m_autoRecompute = hGrp->GetBool("PostAutoRecompute", false); -+} -+ -+void ViewProviderFemPostFunction::dragFinishCallback(void *data, SoDragger *) -+{ -+ // This is called when a manipulator has done manipulating -+ Gui::Application::Instance->activeDocument()->commitCommand(); -+ -+ ViewProviderFemPostFunction* that = reinterpret_cast(data); -+ if(that->m_autoRecompute) -+ that->getObject()->getDocument()->recompute(); -+ -+ reinterpret_cast(data)->m_isDragging = false; -+} -+ -+void ViewProviderFemPostFunction::dragMotionCallback(void *data, SoDragger *drag) -+{ -+ ViewProviderFemPostFunction* that = reinterpret_cast(data); -+ that->draggerUpdate(drag); -+ -+ if(that->m_autoRecompute) -+ that->getObject()->getDocument()->recompute(); -+} -+ -+ -+bool ViewProviderFemPostFunction::setEdit(int ModNum) { -+ -+ -+ if (ModNum == ViewProvider::Default || ModNum == 1 ) { -+ -+ Gui::TaskView::TaskDialog *dlg = Gui::Control().activeDialog(); -+ TaskDlgPost *postDlg = qobject_cast(dlg); -+ if (postDlg && postDlg->getView() != this) -+ postDlg = 0; // another pad left open its task panel -+ if (dlg && !postDlg) { -+ QMessageBox msgBox; -+ msgBox.setText(QObject::tr("A dialog is already open in the task panel")); -+ msgBox.setInformativeText(QObject::tr("Do you want to close this dialog?")); -+ msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No); -+ msgBox.setDefaultButton(QMessageBox::Yes); -+ int ret = msgBox.exec(); -+ if (ret == QMessageBox::Yes) -+ Gui::Control().reject(); -+ else -+ return false; -+ } -+ -+ // start the edit dialog -+ if (postDlg) -+ Gui::Control().showDialog(postDlg); -+ else { -+ postDlg = new TaskDlgPost(this); -+ postDlg->appendBox(new TaskPostFunction(this)); -+ Gui::Control().showDialog(postDlg); -+ } -+ -+ return true; -+ } -+ else { -+ return ViewProviderDocumentObject::setEdit(ModNum); -+ } -+} -+ -+void ViewProviderFemPostFunction::unsetEdit(int ModNum) { -+ -+ if (ModNum == ViewProvider::Default) { -+ // when pressing ESC make sure to close the dialog -+ Gui::Control().closeDialog(); -+ } -+ else { -+ ViewProviderDocumentObject::unsetEdit(ModNum); -+ } -+} -+ -+void ViewProviderFemPostFunction::onChanged(const App::Property* prop) { -+ -+ Gui::ViewProviderDocumentObject::onChanged(prop); -+ -+ if(m_autoscale) -+ m_scale->scaleFactor = SbVec3f(AutoScaleFactorX.getValue(), AutoScaleFactorY.getValue(), AutoScaleFactorZ.getValue()); -+} -+ -+ -+ -+//################################################################################################# -+ -+PROPERTY_SOURCE(FemGui::ViewProviderFemPostPlaneFunction, FemGui::ViewProviderFemPostFunction) -+ -+ViewProviderFemPostPlaneFunction::ViewProviderFemPostPlaneFunction() { -+ -+ sPixmap = "fem-post-geo-plane"; -+ -+ setAutoScale(true); -+ -+ //setup the visualisation geometry -+ SoCoordinate3* points = new SoCoordinate3(); -+ points->point.setNum(4); -+ points->point.set1Value(0, -0.5, -0.5, 0); -+ points->point.set1Value(1, -0.5, 0.5, 0); -+ points->point.set1Value(2, 0.5, 0.5, 0); -+ points->point.set1Value(3, 0.5, -0.5, 0); -+ points->point.set1Value(4, -0.5, -0.5, 0); -+ SoLineSet* line = new SoLineSet(); -+ getGeometryNode()->addChild(points); -+ getGeometryNode()->addChild(line); -+} -+ -+ViewProviderFemPostPlaneFunction::~ViewProviderFemPostPlaneFunction() { -+ -+} -+ -+void ViewProviderFemPostPlaneFunction::draggerUpdate(SoDragger* m) { -+ -+ Fem::FemPostPlaneFunction* func = static_cast(getObject()); -+ SoCenterballDragger* dragger = static_cast(m); -+ -+ // the new axis of the plane -+ SbRotation rot, scaleDir; -+ const SbVec3f& center = dragger->center.getValue(); -+ -+ SbVec3f norm(0,0,1); -+ dragger->rotation.getValue().multVec(norm,norm); -+ func->Origin.setValue(center[0], center[1], center[2]); -+ func->Normal.setValue(norm[0],norm[1],norm[2]); -+ -+ SbVec3f t = static_cast(getManipulator())->translation.getValue(); -+ SbVec3f rt, irt; -+ dragger->rotation.getValue().multVec(t,rt); -+ dragger->rotation.getValue().inverse().multVec(t,irt); -+} -+ -+void ViewProviderFemPostPlaneFunction::updateData(const App::Property* p) { -+ -+ Fem::FemPostPlaneFunction* func = static_cast(getObject()); -+ -+ if(!isDragging() && (p == &func->Origin || p == &func->Normal)) { -+ -+ Base::Vector3d trans = func->Origin.getValue(); -+ Base::Vector3d norm = func->Normal.getValue(); -+ -+ norm = norm / norm.Length(); -+ SbRotation rot(SbVec3f(0.,0.,1.), SbVec3f(norm.x, norm.y, norm.z)); -+ -+ SbMatrix t, translate; -+ t.setRotate(rot); -+ translate.setTranslate(SbVec3f(trans.x, trans.y, trans.z)); -+ t.multRight(translate); -+ getManipulator()->setMatrix(t); -+ } -+ Gui::ViewProviderDocumentObject::updateData(p); -+} -+ -+ -+FunctionWidget* ViewProviderFemPostPlaneFunction::createControlWidget() { -+ return new PlaneWidget(); -+} -+ -+ -+PlaneWidget::PlaneWidget() { -+ -+ ui = new Ui_PlaneWidget(); -+ ui->setupUi(this); -+ -+ connect(ui->originX, SIGNAL(valueChanged(double)), this, SLOT(originChanged(double))); -+ connect(ui->originY, SIGNAL(valueChanged(double)), this, SLOT(originChanged(double))); -+ connect(ui->originZ, SIGNAL(valueChanged(double)), this, SLOT(originChanged(double))); -+ connect(ui->normalX, SIGNAL(valueChanged(double)), this, SLOT(normalChanged(double))); -+ connect(ui->normalY, SIGNAL(valueChanged(double)), this, SLOT(normalChanged(double))); -+ connect(ui->normalZ, SIGNAL(valueChanged(double)), this, SLOT(normalChanged(double))); -+ -+} -+ -+PlaneWidget::~PlaneWidget() { -+ -+} -+ -+void PlaneWidget::applyPythonCode() { -+ -+} -+ -+void PlaneWidget::setViewProvider(ViewProviderFemPostFunction* view) { -+ -+ FemGui::FunctionWidget::setViewProvider(view); -+ onChange(static_cast(getObject())->Normal); -+ onChange(static_cast(getObject())->Origin); -+} -+ -+void PlaneWidget::onChange(const App::Property& p) { -+ -+ setBlockObjectUpdates(true); -+ if(strcmp(p.getName(), "Normal") == 0) { -+ const Base::Vector3d& vec = static_cast(&p)->getValue(); -+ ui->normalX->setValue(vec.x); -+ ui->normalY->setValue(vec.y); -+ ui->normalZ->setValue(vec.z); -+ } -+ else if(strcmp(p.getName(), "Origin") == 0) { -+ const Base::Vector3d& vec = static_cast(&p)->getValue(); -+ ui->originX->setValue(vec.x); -+ ui->originY->setValue(vec.y); -+ ui->originZ->setValue(vec.z); -+ } -+ setBlockObjectUpdates(false); -+} -+ -+void PlaneWidget::normalChanged(double) { -+ -+ if(!blockObjectUpdates()) { -+ Base::Vector3d vec(ui->normalX->value(), ui->normalY->value(), ui->normalZ->value()); -+ static_cast(getObject())->Normal.setValue(vec); -+ } -+} -+ -+void PlaneWidget::originChanged(double) { -+ -+ if(!blockObjectUpdates()) { -+ Base::Vector3d vec(ui->originX->value(), ui->originY->value(), ui->originZ->value()); -+ static_cast(getObject())->Origin.setValue(vec); -+ } -+} -+ -+ -+ -+//################################################################################################# -+ -+PROPERTY_SOURCE(FemGui::ViewProviderFemPostSphereFunction, FemGui::ViewProviderFemPostFunction) -+ -+ViewProviderFemPostSphereFunction::ViewProviderFemPostSphereFunction() { -+ -+ sPixmap = "fem-post-geo-sphere"; -+ -+ setAutoScale(false); -+ -+ //setup the visualisation geometry -+ SoCoordinate3* points = new SoCoordinate3(); -+ points->point.setNum(2*84); -+ int idx = 0; -+ for(int i=0; i<4; i++) { -+ for(int j=0; j<21; j++) { -+ points->point.set1Value(idx, SbVec3f(std::sin(2*M_PI/20*j) * std::cos(M_PI/4*i), -+ std::sin(2*M_PI/20*j) * std::sin(M_PI/4*i), -+ std::cos(2*M_PI/20*j) )); -+ ++idx; -+ } -+ } -+ for(int i=0; i<4; i++) { -+ for(int j=0; j<21; j++) { -+ points->point.set1Value(idx, SbVec3f(std::sin(M_PI/4*i) * std::cos(2*M_PI/20*j), -+ std::sin(M_PI/4*i) * std::sin(2*M_PI/20*j), -+ std::cos(M_PI/4*i) )); -+ ++idx; -+ } -+ } -+ -+ SoLineSet* line = new SoLineSet(); -+ getGeometryNode()->addChild(points); -+ getGeometryNode()->addChild(line); -+} -+ -+ViewProviderFemPostSphereFunction::~ViewProviderFemPostSphereFunction() { -+} -+ -+SoTransformManip* ViewProviderFemPostSphereFunction::setupManipulator() { -+ SoHandleBoxManip* manip = new SoHandleBoxManip(); -+ manip->getDragger()->setPart("extruder1", new SoSeparator); -+ manip->getDragger()->setPart("extruder2", new SoSeparator); -+ manip->getDragger()->setPart("extruder3", new SoSeparator); -+ manip->getDragger()->setPart("extruder4", new SoSeparator); -+ manip->getDragger()->setPart("extruder5", new SoSeparator); -+ manip->getDragger()->setPart("extruder6", new SoSeparator); -+ manip->getDragger()->setPart("extruder1Active", new SoSeparator); -+ manip->getDragger()->setPart("extruder2Active", new SoSeparator); -+ manip->getDragger()->setPart("extruder3Active", new SoSeparator); -+ manip->getDragger()->setPart("extruder4Active", new SoSeparator); -+ manip->getDragger()->setPart("extruder5Active", new SoSeparator); -+ manip->getDragger()->setPart("extruder6Active", new SoSeparator); -+ -+ return manip; -+} -+ -+ -+void ViewProviderFemPostSphereFunction::draggerUpdate(SoDragger* m) { -+ -+ Fem::FemPostSphereFunction* func = static_cast(getObject()); -+ SoHandleBoxDragger* dragger = static_cast(m); -+ -+ // the new axis of the plane -+ SbRotation rot, scaleDir; -+ const SbVec3f& center = dragger->translation.getValue(); -+ -+ SbVec3f norm(0,0,1); -+ func->Center.setValue(center[0], center[1], center[2]); -+ func->Radius.setValue(dragger->scaleFactor.getValue()[0]); -+} -+ -+void ViewProviderFemPostSphereFunction::updateData(const App::Property* p) { -+ -+ Fem::FemPostSphereFunction* func = static_cast(getObject()); -+ -+ if(!isDragging() && (p == &func->Center || p == &func->Radius)) { -+ -+ Base::Vector3d trans = func->Center.getValue(); -+ double radius = func->Radius.getValue(); -+ -+ SbMatrix t, translate; -+ t.setScale(radius); -+ translate.setTranslate(SbVec3f(trans.x, trans.y, trans.z)); -+ t.multRight(translate); -+ getManipulator()->setMatrix(t); -+ -+ } -+ Gui::ViewProviderDocumentObject::updateData(p); -+} -+ -+ -+FunctionWidget* ViewProviderFemPostSphereFunction::createControlWidget() { -+ return new SphereWidget(); -+} -+ -+ -+SphereWidget::SphereWidget() { -+ -+ ui = new Ui_SphereWidget(); -+ ui->setupUi(this); -+ -+ connect(ui->centerX, SIGNAL(valueChanged(double)), this, SLOT(centerChanged(double))); -+ connect(ui->centerY, SIGNAL(valueChanged(double)), this, SLOT(centerChanged(double))); -+ connect(ui->centerZ, SIGNAL(valueChanged(double)), this, SLOT(centerChanged(double))); -+ connect(ui->radius, SIGNAL(valueChanged(double)), this, SLOT(radiusChanged(double))); -+} -+ -+SphereWidget::~SphereWidget() { -+ -+} -+ -+void SphereWidget::applyPythonCode() { -+ -+} -+ -+void SphereWidget::setViewProvider(ViewProviderFemPostFunction* view) { -+ -+ FemGui::FunctionWidget::setViewProvider(view); -+ onChange(static_cast(getObject())->Center); -+ onChange(static_cast(getObject())->Radius); -+} -+ -+void SphereWidget::onChange(const App::Property& p) { -+ -+ setBlockObjectUpdates(true); -+ if(strcmp(p.getName(), "Radius") == 0) { -+ double val = static_cast(&p)->getValue(); -+ ui->radius->setValue(val); -+ } -+ else if(strcmp(p.getName(), "Center") == 0) { -+ const Base::Vector3d& vec = static_cast(&p)->getValue(); -+ ui->centerX->setValue(vec.x); -+ ui->centerY->setValue(vec.y); -+ ui->centerZ->setValue(vec.z); -+ } -+ setBlockObjectUpdates(false); -+} -+ -+void SphereWidget::centerChanged(double) { -+ -+ if(!blockObjectUpdates()) { -+ Base::Vector3d vec(ui->centerX->value(), ui->centerY->value(), ui->centerZ->value()); -+ static_cast(getObject())->Center.setValue(vec); -+ } -+} -+ -+void SphereWidget::radiusChanged(double) { -+ -+ if(!blockObjectUpdates()) { -+ static_cast(getObject())->Radius.setValue(ui->radius->value()); -+ } -+} -+ -+#include "moc_ViewProviderFemPostFunction.cpp" ++ m_connection = m_object->getDocument()->signalChangedObject.connect(boost::bind(&FunctionWidget::onObjectsChanged, this, bp::_1, bp::_2)); + } + + void FunctionWidget::onObjectsChanged(const App::DocumentObject& obj, const App::Property& p) { diff --git a/src/Mod/Inspection/App/InspectionFeature.cpp b/src/Mod/Inspection/App/InspectionFeature.cpp index aac0006ba..0bcf55ae0 100644 --- a/src/Mod/Inspection/App/InspectionFeature.cpp @@ -5659,5 +4457,5 @@ index b03a2159f..01c850645 100644 if (feature != nullptr) { connectGuiRepaint = feature->signalGuiPaint.connect(bnd); -- -2.28.0 +2.29.2 diff --git a/FreeCAD-0.18.4.obscpio b/FreeCAD-0.18.4.obscpio deleted file mode 100644 index 6d0e860..0000000 --- a/FreeCAD-0.18.4.obscpio +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:6d5e0772aaca0a5aeb6b9e7fef35420011bcf312c7853904c1399e388f648728 -size 427464206 diff --git a/FreeCAD-0.18.4.tar.xz b/FreeCAD-0.18.4.tar.xz deleted file mode 100644 index fca8bbd..0000000 --- a/FreeCAD-0.18.4.tar.xz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:702e78a04df4681226cd71eba8afc53487c2c43c1aaf218450939ef33851b5dd -size 200393700 diff --git a/FreeCAD-0.18.5.obscpio b/FreeCAD-0.18.5.obscpio new file mode 100644 index 0000000..1eeb37a --- /dev/null +++ b/FreeCAD-0.18.5.obscpio @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:53ffe7703d67b768fedb216bc9dfa6c0c79ca41acc94a1f7fedadf85e5fc75b4 +size 427464718 diff --git a/FreeCAD-0.18.5.tar.xz b/FreeCAD-0.18.5.tar.xz new file mode 100644 index 0000000..c4a9f66 --- /dev/null +++ b/FreeCAD-0.18.5.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c173d76fe0737c7a9dd203205945c46c4113b5fec61b70dd22a58e683bad3633 +size 200710932 diff --git a/FreeCAD-test.spec b/FreeCAD-test.spec index 1392f6f..4c6ca33 100644 --- a/FreeCAD-test.spec +++ b/FreeCAD-test.spec @@ -17,7 +17,7 @@ Name: FreeCAD-test -Version: 0.18.4 +Version: 0.18.5 Release: 0 Summary: Meta source package that runs the FreeCAD testsuite when built License: LGPL-2.0-or-later AND GPL-2.0-or-later diff --git a/FreeCAD.changes b/FreeCAD.changes index b28b9e0..10dc38e 100644 --- a/FreeCAD.changes +++ b/FreeCAD.changes @@ -1,3 +1,13 @@ +------------------------------------------------------------------- +Sat Nov 28 14:08:01 UTC 2020 - Stefan Brüns + +- Update to version 0.18.5: + * Fix addon manager to adapt to GitHub infrastructure changes. + * Add 0001-Fix-ODR-violation-correct-Ui_TaskSketcherGeneral-nam.patch + * Rebase 0001-boost-1.73.0-The-practice-of-declaring-the-Bind-plac.patch +- Reenable workbenches dependent on Mesher (e.g. Path, FEM): + * Add fix-smesh-vtk9.patch + ------------------------------------------------------------------- Sat Sep 19 01:37:12 UTC 2020 - Stefan Brüns diff --git a/FreeCAD.obsinfo b/FreeCAD.obsinfo index f716b42..76e1a63 100644 --- a/FreeCAD.obsinfo +++ b/FreeCAD.obsinfo @@ -1,5 +1,5 @@ name: FreeCAD -version: 0.18.4 -mtime: 1582676121 -commit: 783e1346c7a078f5265c3f0c6a927d09a8c1fe70 +version: 0.18.5 +mtime: 1603973581 +commit: 734202bc810bf61bd6f66bdc060e6951bd0d134d diff --git a/FreeCAD.spec b/FreeCAD.spec index 32c6e40..a034cde 100644 --- a/FreeCAD.spec +++ b/FreeCAD.spec @@ -26,10 +26,10 @@ %bcond_with boost_signals2 %endif # Bundled SALOME-MESH (smesh) fails to build with VTK 9.0 -%bcond_with smesh +%bcond_without smesh Name: FreeCAD -Version: 0.18.4 +Version: 0.18.5 Release: 0 Summary: General Purpose 3D CAD Modeler License: LGPL-2.0-or-later AND GPL-2.0-or-later @@ -50,6 +50,10 @@ Patch6: fix_unittestgui_tkinter_py3.patch Patch7: fix_qt_5.15_build.patch # PATCH-FIX-UPSTREAM -- Rebased https://github.com/FreeCAD/FreeCAD/commit/4ec45b545ebf Patch8: 0001-boost-1.73.0-The-practice-of-declaring-the-Bind-plac.patch +# PATCH-FIX-UPSTREAM Rebased https://github.com/wwmayer/FreeCAD/commit/bb9bcbd51df7 +Patch9: fix-smesh-vtk9.patch +# PATCH-FIX-UPSTREAM +Patch10: 0001-Fix-ODR-violation-correct-Ui_TaskSketcherGeneral-nam.patch # Test suite fails on 32bit and I don't want to debug that anymore ExcludeArch: %ix86 %arm ppc s390 s390x @@ -81,6 +85,7 @@ BuildRequires: hdf5-devel BuildRequires: hicolor-icon-theme # We use the internal smesh version with fixes atm #BuildRequires: smesh-devel +BuildRequires: java-devel BuildRequires: libXerces-c-devel BuildRequires: libXi-devel BuildRequires: libmed-devel @@ -190,7 +195,6 @@ rm src/3rdparty/Pivy -fr rm src/3rdparty/Pivy-0.5 -fr %build -# disabled until vtk 9 support arrives: -DBUILD_MESH_PART:BOOL=ON -DBUILD_FEM:BOOL=ON %cmake \ -DCMAKE_INSTALL_PREFIX=%{x_prefix} \ -DCMAKE_INSTALL_DATADIR=%{_datadir}/%{name} \ diff --git a/fix-smesh-vtk9.patch b/fix-smesh-vtk9.patch new file mode 100644 index 0000000..d3f6e6d --- /dev/null +++ b/fix-smesh-vtk9.patch @@ -0,0 +1,840 @@ +From bb9bcbd51df7c3cb76c5823038e4ea0f7e25a9ff Mon Sep 17 00:00:00 2001 +From: wmayer +Date: Mon, 12 Oct 2020 17:56:03 +0200 +Subject: [PATCH] Make smesh compile with vtk9 + +--- + .../salomesmesh/inc/SMDS_MeshElement.hxx | 9 +++- + .../salomesmesh/inc/SMDS_UnstructuredGrid.hxx | 4 ++ + .../salomesmesh/src/SMDS/SMDS_BallElement.cpp | 9 +++- + .../salomesmesh/src/SMDS/SMDS_Downward.cpp | 44 +++++++++---------- + .../salomesmesh/src/SMDS/SMDS_Mesh.cpp | 6 ++- + .../src/SMDS/SMDS_Mesh0DElement.cpp | 12 +++++ + .../salomesmesh/src/SMDS/SMDS_MeshNode.cpp | 10 ++--- + .../src/SMDS/SMDS_UnstructuredGrid.cpp | 35 +++++++++++++-- + .../src/SMDS/SMDS_VtkCellIterator.cpp | 7 +-- + .../salomesmesh/src/SMDS/SMDS_VtkEdge.cpp | 19 +++++++- + .../salomesmesh/src/SMDS/SMDS_VtkFace.cpp | 29 ++++++++++-- + .../salomesmesh/src/SMDS/SMDS_VtkVolume.cpp | 38 +++++++++++----- + .../src/SMESH/SMESH_MeshEditor.cpp | 8 ++-- + src/Mod/Fem/Gui/ViewProviderFemPostObject.cpp | 7 ++- + 14 files changed, 179 insertions(+), 58 deletions(-) + +diff --git a/src/3rdParty/salomesmesh/inc/SMDS_MeshElement.hxx b/src/3rdParty/salomesmesh/inc/SMDS_MeshElement.hxx +index 14a6d9a763f..0e9b9e6c905 100644 +--- a/src/3rdParty/salomesmesh/inc/SMDS_MeshElement.hxx ++++ b/src/3rdParty/salomesmesh/inc/SMDS_MeshElement.hxx +@@ -40,11 +40,16 @@ + + #include + #include ++#include + + //typedef unsigned short UShortType; + typedef short ShortType; + typedef int LongType; +- ++#ifdef VTK_CELL_ARRAY_V2 ++typedef const vtkIdType* vtkIdTypePtr; ++#else ++typedef vtkIdType* vtkIdTypePtr; ++#endif + class SMDS_MeshNode; + class SMDS_MeshEdge; + class SMDS_MeshFace; +@@ -192,7 +197,7 @@ protected: + //! Element index in vector SMDS_Mesh::myNodes or SMDS_Mesh::myCells + int myID; + //! index in vtkUnstructuredGrid +- int myVtkID; ++ vtkIdType myVtkID; + //! SMDS_Mesh identification in SMESH + ShortType myMeshId; + //! SubShape and SubMesh identification in SMESHDS +diff --git a/src/3rdParty/salomesmesh/inc/SMDS_UnstructuredGrid.hxx b/src/3rdParty/salomesmesh/inc/SMDS_UnstructuredGrid.hxx +index 9e4a23eddfb..77465814541 100644 +--- a/src/3rdParty/salomesmesh/inc/SMDS_UnstructuredGrid.hxx ++++ b/src/3rdParty/salomesmesh/inc/SMDS_UnstructuredGrid.hxx +@@ -95,7 +95,11 @@ public: + std::map >& nodeQuadDomains); + vtkCellLinks* GetLinks() + { ++#ifdef VTK_CELL_ARRAY_V2 ++ return static_cast(GetCellLinks()); ++#else + return Links; ++#endif + } + SMDS_Downward* getDownArray(unsigned char vtkType) + { +diff --git a/src/3rdParty/salomesmesh/src/SMDS/SMDS_BallElement.cpp b/src/3rdParty/salomesmesh/src/SMDS/SMDS_BallElement.cpp +index 299093c94f6..2680c217305 100644 +--- a/src/3rdParty/salomesmesh/src/SMDS/SMDS_BallElement.cpp ++++ b/src/3rdParty/salomesmesh/src/SMDS/SMDS_BallElement.cpp +@@ -67,10 +67,16 @@ void SMDS_BallElement::SetDiameter(double diameter) + bool SMDS_BallElement::ChangeNode (const SMDS_MeshNode * node) + { + vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid(); ++#ifdef VTK_CELL_ARRAY_V2 ++ vtkNew cellPoints; ++ grid->GetCellPoints(myVtkID, cellPoints.GetPointer()); ++ cellPoints->SetId(0, node->getVtkId()); ++#else + vtkIdType npts = 0; + vtkIdType* pts = 0; + grid->GetCellPoints(myVtkID, npts, pts); + pts[0] = node->getVtkId(); ++#endif + SMDS_Mesh::_meshList[myMeshId]->setMyModified(); + return true; + } +@@ -83,7 +89,8 @@ void SMDS_BallElement::Print (std::ostream & OS) const + const SMDS_MeshNode* SMDS_BallElement::GetNode (const int ind) const + { + vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid(); +- vtkIdType npts, *pts; ++ vtkIdType npts; ++ vtkIdTypePtr pts; + grid->GetCellPoints( myVtkID, npts, pts ); + return SMDS_Mesh::_meshList[myMeshId]->FindNodeVtk( pts[ 0 ]); + } +diff --git a/src/3rdParty/salomesmesh/src/SMDS/SMDS_Downward.cpp b/src/3rdParty/salomesmesh/src/SMDS/SMDS_Downward.cpp +index d6049c0bd19..a41f5c18e78 100644 +--- a/src/3rdParty/salomesmesh/src/SMDS/SMDS_Downward.cpp ++++ b/src/3rdParty/salomesmesh/src/SMDS/SMDS_Downward.cpp +@@ -303,7 +303,7 @@ int SMDS_Down1D::getNodeSet(int cellId, int* nodeSet) + void SMDS_Down1D::setNodes(int cellId, int vtkId) + { + vtkIdType npts = 0; +- vtkIdType *pts; // will refer to the point id's of the face ++ vtkIdTypePtr pts; // will refer to the point id's of the face + _grid->GetCellPoints(vtkId, npts, pts); + // MESSAGE(vtkId << " " << npts << " " << _nbDownCells); + //ASSERT(npts == _nbDownCells); +@@ -357,7 +357,7 @@ int SMDS_Down1D::computeVtkCells(int *pts, std::vector& vtkIds) + { + vtkIdType point = pts[i]; + int numCells = _grid->GetLinks()->GetNcells(point); +- vtkIdType *cells = _grid->GetLinks()->GetCells(point); ++ vtkIdTypePtr cells = _grid->GetLinks()->GetCells(point); + for (int j = 0; j < numCells; j++) + { + int vtkCellId = cells[j]; +@@ -532,7 +532,7 @@ int SMDS_Down2D::computeVolumeIds(int cellId, int* ids) + // --- find point id's of the face + + vtkIdType npts = 0; +- vtkIdType *pts; // will refer to the point id's of the face ++ vtkIdTypePtr pts; // will refer to the point id's of the face + _grid->GetCellPoints(cellId, npts, pts); + vector nodes; + for (int i = 0; i < npts; i++) +@@ -577,7 +577,7 @@ int SMDS_Down2D::computeVolumeIdsFromNodesFace(int* pts, int npts, int* ids) + vtkIdType point = pts[i]; + int numCells = _grid->GetLinks()->GetNcells(point); + //MESSAGE("cells pour " << i << " " << numCells); +- vtkIdType *cells = _grid->GetLinks()->GetCells(point); ++ vtkIdTypePtr cells = _grid->GetLinks()->GetCells(point); + for (int j = 0; j < numCells; j++) + { + int vtkCellId = cells[j]; +@@ -627,7 +627,7 @@ int SMDS_Down2D::computeVolumeIdsFromNodesFace(int* pts, int npts, int* ids) + void SMDS_Down2D::setTempNodes(int cellId, int vtkId) + { + vtkIdType npts = 0; +- vtkIdType *pts; // will refer to the point id's of the face ++ vtkIdTypePtr pts; // will refer to the point id's of the face + _grid->GetCellPoints(vtkId, npts, pts); + // MESSAGE(vtkId << " " << npts << " " << _nbNodes); + //ASSERT(npts == _nbNodes); +@@ -795,7 +795,7 @@ void SMDS_Down3D::getNodeIds(int cellId, std::set& nodeSet) + { + int vtkId = this->_vtkCellIds[cellId]; + vtkIdType npts = 0; +- vtkIdType *nodes; // will refer to the point id's of the volume ++ vtkIdTypePtr nodes; // will refer to the point id's of the volume + _grid->GetCellPoints(vtkId, npts, nodes); + for (int i = 0; i < npts; i++) + nodeSet.insert(nodes[i]); +@@ -1126,7 +1126,7 @@ void SMDS_DownTetra::getOrderedNodesOfFace(int cellId, std::vector& o + //MESSAGE("cellId = " << cellId); + + vtkIdType npts = 0; +- vtkIdType *nodes; // will refer to the point id's of the volume ++ vtkIdTypePtr nodes; // will refer to the point id's of the volume + _grid->GetCellPoints(this->_vtkCellIds[cellId], npts, nodes); + + set tofind; +@@ -1178,7 +1178,7 @@ void SMDS_DownTetra::computeFacesWithNodes(int cellId, ListElemByNodesType& face + // --- find point id's of the volume + + vtkIdType npts = 0; +- vtkIdType *nodes; // will refer to the point id's of the volume ++ vtkIdTypePtr nodes; // will refer to the point id's of the volume + _grid->GetCellPoints(cellId, npts, nodes); + + // --- create all the ordered list of node id's for each face +@@ -1234,7 +1234,7 @@ void SMDS_DownQuadTetra::getOrderedNodesOfFace(int cellId, std::vectorGetCellLinks(); ++#ifdef VTK_CELL_ARRAY_V2 ++ vtkCellLinks *links = static_cast(myGrid->GetCellLinks()); ++#else ++ vtkCellLinks *links = myGrid->GetCellLinks(); ++#endif + for (int i=0; iGetNcells(i); +diff --git a/src/3rdParty/salomesmesh/src/SMDS/SMDS_Mesh0DElement.cpp b/src/3rdParty/salomesmesh/src/SMDS/SMDS_Mesh0DElement.cpp +index 95438eab064..0df32e3b97c 100644 +--- a/src/3rdParty/salomesmesh/src/SMDS/SMDS_Mesh0DElement.cpp ++++ b/src/3rdParty/salomesmesh/src/SMDS/SMDS_Mesh0DElement.cpp +@@ -146,6 +146,17 @@ bool SMDS_Mesh0DElement::ChangeNodes(const SMDS_MeshNode* nodes[], const int nbN + if ( nbNodes == 1 ) + { + vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid(); ++#ifdef VTK_CELL_ARRAY_V2 ++ vtkNew cellPoints; ++ grid->GetCellPoints(myVtkID, cellPoints.GetPointer()); ++ if (nbNodes != cellPoints->GetNumberOfIds()) ++ { ++ MESSAGE("ChangeNodes problem: not the same number of nodes " << cellPoints->GetNumberOfIds() << " -> " << nbNodes); ++ return false; ++ } ++ myNode = nodes[0]; ++ cellPoints->SetId(0, myNode->getVtkId()); ++#else + vtkIdType npts = 0; + vtkIdType* pts = 0; + grid->GetCellPoints(myVtkID, npts, pts); +@@ -156,6 +167,7 @@ bool SMDS_Mesh0DElement::ChangeNodes(const SMDS_MeshNode* nodes[], const int nbN + } + myNode = nodes[0]; + pts[0] = myNode->getVtkId(); ++#endif + + SMDS_Mesh::_meshList[myMeshId]->setMyModified(); + return true; +diff --git a/src/3rdParty/salomesmesh/src/SMDS/SMDS_MeshNode.cpp b/src/3rdParty/salomesmesh/src/SMDS/SMDS_MeshNode.cpp +index f647a5f1b8f..5b903c8fb55 100644 +--- a/src/3rdParty/salomesmesh/src/SMDS/SMDS_MeshNode.cpp ++++ b/src/3rdParty/salomesmesh/src/SMDS/SMDS_MeshNode.cpp +@@ -191,7 +191,7 @@ class SMDS_MeshNode_MyInvIterator: public SMDS_ElemIterator + SMDS_ElemIteratorPtr SMDS_MeshNode:: + GetInverseElementIterator(SMDSAbs_ElementType type) const + { +- vtkCellLinks::Link l = SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetCellLinks()->GetLink(myVtkID); ++ vtkCellLinks::Link l = static_cast(SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetCellLinks())->GetLink(myVtkID); + //MESSAGE("myID " << myID << " ncells " << l.ncells); + return SMDS_ElemIteratorPtr(new SMDS_MeshNode_MyInvIterator(SMDS_Mesh::_meshList[myMeshId], l.cells, l.ncells, type)); + } +@@ -251,7 +251,7 @@ elementsIterator(SMDSAbs_ElementType type) const + return SMDS_MeshElement::elementsIterator(SMDSAbs_Node); + else + { +- vtkCellLinks::Link l = SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetCellLinks()->GetLink(myVtkID); ++ vtkCellLinks::Link l = static_cast(SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetCellLinks())->GetLink(myVtkID); + return SMDS_ElemIteratorPtr(new SMDS_MeshNode_MyIterator(SMDS_Mesh::_meshList[myMeshId], l.cells, l.ncells, type)); + } + } +@@ -350,7 +350,7 @@ void SMDS_MeshNode::AddInverseElement(const SMDS_MeshElement* ME) + const SMDS_MeshCell *cell = dynamic_cast (ME); + assert(cell); + SMDS_UnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid(); +- vtkCellLinks *Links = grid->GetCellLinks(); ++ vtkCellLinks *Links = static_cast(grid->GetCellLinks()); + Links->ResizeCellList(myVtkID, 1); + Links->AddCellReference(cell->getVtkId(), myVtkID); + } +@@ -366,7 +366,7 @@ void SMDS_MeshNode::ClearInverseElements() + + bool SMDS_MeshNode::emptyInverseElements() + { +- vtkCellLinks::Link l = SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetCellLinks()->GetLink(myVtkID); ++ vtkCellLinks::Link l = static_cast(SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetCellLinks())->GetLink(myVtkID); + return (l.ncells == 0); + } + +@@ -378,7 +378,7 @@ bool SMDS_MeshNode::emptyInverseElements() + + int SMDS_MeshNode::NbInverseElements(SMDSAbs_ElementType type) const + { +- vtkCellLinks::Link l = SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetCellLinks()->GetLink(myVtkID); ++ vtkCellLinks::Link l = static_cast(SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetCellLinks())->GetLink(myVtkID); + + if ( type == SMDSAbs_All ) + return l.ncells; +diff --git a/src/3rdParty/salomesmesh/src/SMDS/SMDS_UnstructuredGrid.cpp b/src/3rdParty/salomesmesh/src/SMDS/SMDS_UnstructuredGrid.cpp +index fbd903b1e74..ff2b81e9694 100644 +--- a/src/3rdParty/salomesmesh/src/SMDS/SMDS_UnstructuredGrid.cpp ++++ b/src/3rdParty/salomesmesh/src/SMDS/SMDS_UnstructuredGrid.cpp +@@ -139,8 +139,8 @@ int SMDS_UnstructuredGrid::InsertNextLinkedCell(int type, int npts, vtkIdType *p + for (; it != setOfNodes.end(); ++it) + { + //MESSAGE("reverse link for node " << *it << " cell " << cellid); +- this->Links->ResizeCellList(*it, 1); +- this->Links->AddCellReference(cellid, *it); ++ this->GetLinks()->ResizeCellList(*it, 1); ++ this->GetLinks()->AddCellReference(cellid, *it); + } + + return cellid; +@@ -332,9 +332,13 @@ void SMDS_UnstructuredGrid::copyBloc(vtkUnsignedCharArray *newTypes, + { + newTypes->SetValue(alreadyCopied, this->Types->GetValue(j)); + idCellsOldToNew[j] = alreadyCopied; // old vtkId --> new vtkId ++#ifdef VTK_CELL_ARRAY_V2 ++ vtkIdType oldLoc = this->GetCellLocationsArray()->GetValue(j); ++#else + vtkIdType oldLoc = this->Locations->GetValue(j); ++#endif + vtkIdType nbpts; +- vtkIdType *oldPtsCell = 0; ++ vtkIdTypePtr oldPtsCell = 0; + this->Connectivity->GetCell(oldLoc, nbpts, oldPtsCell); + assert(nbpts < NBMAXNODESINCELL); + //MESSAGE(j << " " << alreadyCopied << " " << (int)this->Types->GetValue(j) << " " << oldLoc << " " << nbpts ); +@@ -952,6 +956,21 @@ void SMDS_UnstructuredGrid::GetNodeIds(std::set& nodeSet, int downId, unsig + */ + void SMDS_UnstructuredGrid::ModifyCellNodes(int vtkVolId, std::map localClonedNodeIds) + { ++#ifdef VTK_CELL_ARRAY_V2 ++ vtkNew cellPoints; ++ this->GetCellPoints(vtkVolId, cellPoints.GetPointer()); ++ for (vtkIdType i = 0; i < cellPoints->GetNumberOfIds(); i++) ++ { ++ if (localClonedNodeIds.count(cellPoints->GetId(i))) ++ { ++ vtkIdType oldpt = cellPoints->GetId(i); ++ cellPoints->SetId(i, localClonedNodeIds[oldpt]); ++ //MESSAGE(oldpt << " --> " << pts[i]); ++ //this->RemoveReferenceToCell(oldpt, vtkVolId); ++ //this->AddReferenceToCell(pts[i], vtkVolId); ++ } ++ } ++#else + vtkIdType npts = 0; + vtkIdType *pts; // will refer to the point id's of the face + this->GetCellPoints(vtkVolId, npts, pts); +@@ -966,6 +985,7 @@ void SMDS_UnstructuredGrid::ModifyCellNodes(int vtkVolId, std::map loc + //this->AddReferenceToCell(pts[i], vtkVolId); + } + } ++#endif + } + + /*! reorder the nodes of a face +@@ -995,11 +1015,20 @@ void SMDS_UnstructuredGrid::BuildLinks() + this->Links->UnRegister(this); + } + ++#ifdef VTK_CELL_ARRAY_V2 ++ this->Links = SMDS_CellLinks::New(); ++ GetLinks()->Allocate(this->GetNumberOfPoints()); ++ GetLinks()->Register(this); ++//FIXME: vtk9 ++ GetLinks()->BuildLinks(this); ++ GetLinks()->Delete(); ++#else + this->Links = SMDS_CellLinks::New(); + this->Links->Allocate(this->GetNumberOfPoints()); + this->Links->Register(this); + this->Links->BuildLinks(this, this->Connectivity); + this->Links->Delete(); ++#endif + } + + /*! Create a volume (prism or hexahedron) by duplication of a face. +diff --git a/src/3rdParty/salomesmesh/src/SMDS/SMDS_VtkCellIterator.cpp b/src/3rdParty/salomesmesh/src/SMDS/SMDS_VtkCellIterator.cpp +index deb05985f00..63b6eabb704 100644 +--- a/src/3rdParty/salomesmesh/src/SMDS/SMDS_VtkCellIterator.cpp ++++ b/src/3rdParty/salomesmesh/src/SMDS/SMDS_VtkCellIterator.cpp +@@ -33,7 +33,8 @@ SMDS_VtkCellIterator::SMDS_VtkCellIterator(SMDS_Mesh* mesh, int vtkCellId, SMDSA + } + else + { +- vtkIdType npts, *pts; ++ vtkIdType npts; ++ vtkIdTypePtr pts; + grid->GetCellPoints( _cellId, npts, pts ); + _vtkIdList->SetNumberOfIds( _nbNodes = npts ); + for (int i = 0; i < _nbNodes; i++) +@@ -67,7 +68,7 @@ SMDS_VtkCellIteratorToUNV::SMDS_VtkCellIteratorToUNV(SMDS_Mesh* mesh, int vtkCel + //MESSAGE("SMDS_VtkCellInterlacedIterator (UNV)" << _type); + + _vtkIdList = vtkIdList::New(); +- vtkIdType* pts; ++ vtkIdTypePtr pts; + vtkIdType npts; + vtkUnstructuredGrid* grid = _mesh->getGrid(); + grid->GetCellPoints((vtkIdType)_cellId, npts, pts); +@@ -182,7 +183,7 @@ SMDS_VtkCellIteratorPolyH::SMDS_VtkCellIteratorPolyH(SMDS_Mesh* mesh, int vtkCel + { + //MESSAGE("SMDS_VtkCellIterator Polyhedra"); + vtkIdType nFaces = 0; +- vtkIdType* ptIds = 0; ++ vtkIdTypePtr ptIds = 0; + grid->GetFaceStream(_cellId, nFaces, ptIds); + int id = 0; + _nbNodesInFaces = 0; +diff --git a/src/3rdParty/salomesmesh/src/SMDS/SMDS_VtkEdge.cpp b/src/3rdParty/salomesmesh/src/SMDS/SMDS_VtkEdge.cpp +index 9786abf9aae..6d772a3cd4a 100644 +--- a/src/3rdParty/salomesmesh/src/SMDS/SMDS_VtkEdge.cpp ++++ b/src/3rdParty/salomesmesh/src/SMDS/SMDS_VtkEdge.cpp +@@ -67,6 +67,19 @@ bool SMDS_VtkEdge::ChangeNodes(const SMDS_MeshNode * node1, const SMDS_MeshNode + bool SMDS_VtkEdge::ChangeNodes(const SMDS_MeshNode* nodes[], const int nbNodes) + { + vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid(); ++#ifdef VTK_CELL_ARRAY_V2 ++ vtkNew cellPoints; ++ grid->GetCellPoints(myVtkID, cellPoints.GetPointer()); ++ if (nbNodes != cellPoints->GetNumberOfIds()) ++ { ++ MESSAGE("ChangeNodes problem: not the same number of nodes " << cellPoints->GetNumberOfIds() << " -> " << nbNodes); ++ return false; ++ } ++ for (int i = 0; i < nbNodes; i++) ++ { ++ cellPoints->SetId(i, nodes[i]->getVtkId()); ++ } ++#else + vtkIdType npts = 0; + vtkIdType* pts = 0; + grid->GetCellPoints(myVtkID, npts, pts); +@@ -79,6 +92,7 @@ bool SMDS_VtkEdge::ChangeNodes(const SMDS_MeshNode* nodes[], const int nbNodes) + { + pts[i] = nodes[i]->getVtkId(); + } ++#endif + SMDS_Mesh::_meshList[myMeshId]->setMyModified(); + return true; + } +@@ -87,7 +101,7 @@ bool SMDS_VtkEdge::IsMediumNode(const SMDS_MeshNode* node) const + { + vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid(); + vtkIdType npts = 0; +- vtkIdType* pts = 0; ++ vtkIdTypePtr pts = 0; + grid->GetCellPoints(myVtkID, npts, pts); + //MESSAGE("IsMediumNode " << npts << " " << (node->getVtkId() == pts[npts-1])); + return ((npts == 3) && (node->getVtkId() == pts[2])); +@@ -137,7 +151,8 @@ const SMDS_MeshNode* + SMDS_VtkEdge::GetNode(const int ind) const + { + vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid(); +- vtkIdType npts, *pts; ++ vtkIdType npts; ++ vtkIdTypePtr pts; + grid->GetCellPoints( this->myVtkID, npts, pts ); + return SMDS_Mesh::_meshList[myMeshId]->FindNodeVtk( pts[ ind ]); + } +diff --git a/src/3rdParty/salomesmesh/src/SMDS/SMDS_VtkFace.cpp b/src/3rdParty/salomesmesh/src/SMDS/SMDS_VtkFace.cpp +index 1389e0d3585..cb981bfb18e 100644 +--- a/src/3rdParty/salomesmesh/src/SMDS/SMDS_VtkFace.cpp ++++ b/src/3rdParty/salomesmesh/src/SMDS/SMDS_VtkFace.cpp +@@ -101,6 +101,19 @@ void SMDS_VtkFace::initQuadPoly(const std::vector& nodeIds, SMDS_Mesh + bool SMDS_VtkFace::ChangeNodes(const SMDS_MeshNode* nodes[], const int nbNodes) + { + vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid(); ++#ifdef VTK_CELL_ARRAY_V2 ++ vtkNew cellPoints; ++ grid->GetCellPoints(myVtkID, cellPoints.GetPointer()); ++ if (nbNodes != cellPoints->GetNumberOfIds()) ++ { ++ MESSAGE("ChangeNodes problem: not the same number of nodes " << cellPoints->GetNumberOfIds() << " -> " << nbNodes); ++ return false; ++ } ++ for (int i = 0; i < nbNodes; i++) ++ { ++ cellPoints->SetId(i, nodes[i]->getVtkId()); ++ } ++#else + vtkIdType npts = 0; + vtkIdType* pts = 0; + grid->GetCellPoints(myVtkID, npts, pts); +@@ -113,6 +126,7 @@ bool SMDS_VtkFace::ChangeNodes(const SMDS_MeshNode* nodes[], const int nbNodes) + { + pts[i] = nodes[i]->getVtkId(); + } ++#endif + SMDS_Mesh::_meshList[myMeshId]->setMyModified(); + return true; + } +@@ -173,7 +187,8 @@ const SMDS_MeshNode* + SMDS_VtkFace::GetNode(const int ind) const + { + vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid(); +- vtkIdType npts, *pts; ++ vtkIdType npts; ++ vtkIdTypePtr pts; + grid->GetCellPoints( this->myVtkID, npts, pts ); + return SMDS_Mesh::_meshList[myMeshId]->FindNodeVtk( pts[ ind ]); + } +@@ -186,7 +201,8 @@ SMDS_VtkFace::GetNode(const int ind) const + int SMDS_VtkFace::GetNodeIndex( const SMDS_MeshNode* node ) const + { + vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid(); +- vtkIdType npts, *pts; ++ vtkIdType npts; ++ vtkIdTypePtr pts; + grid->GetCellPoints( this->myVtkID, npts, pts ); + for ( vtkIdType i = 0; i < npts; ++i ) + if ( pts[i] == node->getVtkId() ) +@@ -251,7 +267,7 @@ bool SMDS_VtkFace::IsMediumNode(const SMDS_MeshNode* node) const + return false; + } + vtkIdType npts = 0; +- vtkIdType* pts = 0; ++ vtkIdTypePtr pts = 0; + grid->GetCellPoints(myVtkID, npts, pts); + vtkIdType nodeId = node->getVtkId(); + for (int rank = 0; rank < npts; rank++) +@@ -356,11 +372,18 @@ SMDS_NodeIteratorPtr SMDS_VtkFace::interlacedNodesIterator() const + void SMDS_VtkFace::ChangeApex(SMDS_MeshNode* node) + { + vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid(); ++#ifdef VTK_CELL_ARRAY_V2 ++ vtkNew cellPoints; ++ grid->GetCellPoints(myVtkID, cellPoints.GetPointer()); ++ grid->RemoveReferenceToCell(cellPoints->GetId(0), myVtkID); ++ cellPoints->SetId(0, node->getVtkId()); ++#else + vtkIdType npts = 0; + vtkIdType* pts = 0; + grid->GetCellPoints(myVtkID, npts, pts); + grid->RemoveReferenceToCell(pts[0], myVtkID); + pts[0] = node->getVtkId(); ++#endif + node->AddInverseElement(this), + SMDS_Mesh::_meshList[myMeshId]->setMyModified(); + } +diff --git a/src/3rdParty/salomesmesh/src/SMDS/SMDS_VtkVolume.cpp b/src/3rdParty/salomesmesh/src/SMDS/SMDS_VtkVolume.cpp +index 015edf75fd2..19ebd0746c8 100644 +--- a/src/3rdParty/salomesmesh/src/SMDS/SMDS_VtkVolume.cpp ++++ b/src/3rdParty/salomesmesh/src/SMDS/SMDS_VtkVolume.cpp +@@ -133,6 +133,19 @@ void SMDS_VtkVolume::initPoly(const std::vector& nodeIds, + bool SMDS_VtkVolume::ChangeNodes(const SMDS_MeshNode* nodes[], const int nbNodes) + { + vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid(); ++#ifdef VTK_CELL_ARRAY_V2 ++ vtkNew cellPoints; ++ grid->GetCellPoints(myVtkID, cellPoints.GetPointer()); ++ if (nbNodes != cellPoints->GetNumberOfIds()) ++ { ++ MESSAGE("ChangeNodes problem: not the same number of nodes " << cellPoints->GetNumberOfIds() << " -> " << nbNodes); ++ return false; ++ } ++ for (int i = 0; i < nbNodes; i++) ++ { ++ cellPoints->SetId(i, nodes[i]->getVtkId()); ++ } ++#else + vtkIdType npts = 0; + vtkIdType* pts = 0; + grid->GetCellPoints(myVtkID, npts, pts); +@@ -145,6 +158,7 @@ bool SMDS_VtkVolume::ChangeNodes(const SMDS_MeshNode* nodes[], const int nbNodes + { + pts[i] = nodes[i]->getVtkId(); + } ++#endif + SMDS_Mesh::_meshList[myMeshId]->setMyModified(); + return true; + } +@@ -207,7 +221,7 @@ int SMDS_VtkVolume::NbFaces() const + case VTK_POLYHEDRON: + { + vtkIdType nFaces = 0; +- vtkIdType* ptIds = 0; ++ vtkIdTypePtr ptIds = 0; + grid->GetFaceStream(this->myVtkID, nFaces, ptIds); + nbFaces = nFaces; + break; +@@ -236,7 +250,7 @@ int SMDS_VtkVolume::NbNodes() const + else + { + vtkIdType nFaces = 0; +- vtkIdType* ptIds = 0; ++ vtkIdTypePtr ptIds = 0; + grid->GetFaceStream(this->myVtkID, nFaces, ptIds); + int id = 0; + for (int i = 0; i < nFaces; i++) +@@ -276,7 +290,7 @@ int SMDS_VtkVolume::NbEdges() const + case VTK_POLYHEDRON: + { + vtkIdType nFaces = 0; +- vtkIdType* ptIds = 0; ++ vtkIdTypePtr ptIds = 0; + grid->GetFaceStream(this->myVtkID, nFaces, ptIds); + nbEdges = 0; + int id = 0; +@@ -312,7 +326,7 @@ int SMDS_VtkVolume::NbFaceNodes(const int face_ind) const + if (aVtkType == VTK_POLYHEDRON) + { + vtkIdType nFaces = 0; +- vtkIdType* ptIds = 0; ++ vtkIdTypePtr ptIds = 0; + grid->GetFaceStream(this->myVtkID, nFaces, ptIds); + int id = 0; + for (int i = 0; i < nFaces; i++) +@@ -342,7 +356,7 @@ const SMDS_MeshNode* SMDS_VtkVolume::GetFaceNode(const int face_ind, const int n + if (aVtkType == VTK_POLYHEDRON) + { + vtkIdType nFaces = 0; +- vtkIdType* ptIds = 0; ++ vtkIdTypePtr ptIds = 0; + grid->GetFaceStream(this->myVtkID, nFaces, ptIds); + int id = 0; + for (int i = 0; i < nFaces; i++) +@@ -372,7 +386,7 @@ std::vector SMDS_VtkVolume::GetQuantities() const + if (aVtkType == VTK_POLYHEDRON) + { + vtkIdType nFaces = 0; +- vtkIdType* ptIds = 0; ++ vtkIdTypePtr ptIds = 0; + grid->GetFaceStream(this->myVtkID, nFaces, ptIds); + int id = 0; + for (int i = 0; i < nFaces; i++) +@@ -430,7 +444,7 @@ const SMDS_MeshNode* SMDS_VtkVolume::GetNode(const int ind) const + if ( aVtkType == VTK_POLYHEDRON) + { + vtkIdType nFaces = 0; +- vtkIdType* ptIds = 0; ++ vtkIdTypePtr ptIds = 0; + grid->GetFaceStream(this->myVtkID, nFaces, ptIds); + int id = 0, nbPoints = 0; + for (int i = 0; i < nFaces; i++) +@@ -443,7 +457,8 @@ const SMDS_MeshNode* SMDS_VtkVolume::GetNode(const int ind) const + } + return 0; + } +- vtkIdType npts, *pts; ++ vtkIdType npts; ++ vtkIdTypePtr pts; + grid->GetCellPoints( this->myVtkID, npts, pts ); + const std::vector& interlace = SMDS_MeshCell::fromVtkOrder( VTKCellType( aVtkType )); + return SMDS_Mesh::_meshList[myMeshId]->FindNodeVtk( pts[ interlace.empty() ? ind : interlace[ind]] ); +@@ -460,7 +475,7 @@ int SMDS_VtkVolume::GetNodeIndex( const SMDS_MeshNode* node ) const + if ( aVtkType == VTK_POLYHEDRON) + { + vtkIdType nFaces = 0; +- vtkIdType* ptIds = 0; ++ vtkIdTypePtr ptIds = 0; + grid->GetFaceStream(this->myVtkID, nFaces, ptIds); + int id = 0; + for (int iF = 0; iF < nFaces; iF++) +@@ -473,7 +488,8 @@ int SMDS_VtkVolume::GetNodeIndex( const SMDS_MeshNode* node ) const + } + return -1; + } +- vtkIdType npts, *pts; ++ vtkIdType npts; ++ vtkIdTypePtr pts; + grid->GetCellPoints( this->myVtkID, npts, pts ); + for ( vtkIdType i = 0; i < npts; ++i ) + if ( pts[i] == node->getVtkId() ) +@@ -534,7 +550,7 @@ bool SMDS_VtkVolume::IsMediumNode(const SMDS_MeshNode* node) const + return false; + } + vtkIdType npts = 0; +- vtkIdType* pts = 0; ++ vtkIdTypePtr pts = 0; + grid->GetCellPoints(myVtkID, npts, pts); + vtkIdType nodeId = node->getVtkId(); + for (int rank = 0; rank < npts; rank++) +diff --git a/src/3rdParty/salomesmesh/src/SMESH/SMESH_MeshEditor.cpp b/src/3rdParty/salomesmesh/src/SMESH/SMESH_MeshEditor.cpp +index fcd044b00f2..f54c24f8618 100644 +--- a/src/3rdParty/salomesmesh/src/SMESH/SMESH_MeshEditor.cpp ++++ b/src/3rdParty/salomesmesh/src/SMESH/SMESH_MeshEditor.cpp +@@ -11348,7 +11348,7 @@ bool SMESH_MeshEditor::DoubleNodesOnGroupBoundaries( const std::vectorGetCellLinks()->GetLink(oldId); ++ vtkCellLinks::Link l = static_cast(grid->GetCellLinks())->GetLink(oldId); + for (int i=0; iGetID()); + double values[3]; + vtkIdType npts = 0; +- vtkIdType* pts = 0; ++ vtkIdTypePtr pts = 0; + grid->GetCellPoints(vtkVolIds[ivol], npts, pts); + SMDS_VtkVolume::gravityCenter(grid, pts, npts, values); + if (id ==0) +@@ -11708,7 +11708,7 @@ bool SMESH_MeshEditor::DoubleNodesOnGroupBoundaries( const std::vectorfirst; + //MESSAGE(" node " << oldId); +- vtkCellLinks::Link l = grid->GetCellLinks()->GetLink(oldId); ++ vtkCellLinks::Link l = static_cast(grid->GetCellLinks())->GetLink(oldId); + for (int i = 0; i < l.ncells; i++) + { + int vtkId = l.cells[i]; +@@ -12165,7 +12165,7 @@ void SMESH_MeshEditor::CreateHoleSkin(double radius, + MESSAGE("volume to check, vtkId " << vtkId << " smdsId " << meshDS->fromVtkToSmds(vtkId)); + bool volInside = false; + vtkIdType npts = 0; +- vtkIdType* pts = 0; ++ vtkIdTypePtr pts = 0; + grid->GetCellPoints(vtkId, npts, pts); + for (int i=0; iGetPoints(); + pntData = pd->GetPointData();