FreeCAD/0001-Part-Import-skip-ci-disable-use-of-Message_ProgressI.patch
Stefan Brüns 5b15f7dc8a Accepting request 874945 from home:StefanBruens:branches:science
- Fix build and tests with OCCT 7.5, add
  0001-Part-Import-skip-ci-disable-use-of-Message_ProgressI.patch
  0001-import-Hotfix-for-build-failure-from-bad-debug-code.patch
  0001-partdesign-fix-failing-tapered-hole-test.patch
- Add 0001-add-missing-std-namespace-to-build-on-Debian-10.patch
- Cleanup specfile:
  * Use system PyCXX, drop unused libboost_python3
  * Drop some unused dependencies
  * Remove ChangeLog.txt, not updated since version 0.14

OBS-URL: https://build.opensuse.org/request/show/874945
OBS-URL: https://build.opensuse.org/package/show/science/FreeCAD?expand=0&rev=134
2021-02-25 02:28:55 +00:00

427 lines
16 KiB
Diff

From de4de28563383c08f247738623a7ea469604e4d0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
Date: Tue, 23 Feb 2021 17:37:07 +0100
Subject: [PATCH] Part/Import: [skip ci] disable use of
Message_ProgressIndicator for OCC >= 7.5 due to major API changes
---
src/Mod/Import/App/AppImportPy.cpp | 8 ++++++++
src/Mod/Import/Gui/AppImportGuiPy.cpp | 16 ++++++++++++++++
src/Mod/Part/App/ImportIges.cpp | 6 ++++++
src/Mod/Part/App/ImportStep.cpp | 4 ++++
src/Mod/Part/App/ProgressIndicator.cpp | 2 ++
src/Mod/Part/App/ProgressIndicator.h | 3 +++
src/Mod/Part/App/TopoShape.cpp | 22 +++++++++++++++++++---
src/Mod/Part/Gui/TaskCheckGeometry.cpp | 13 ++++++++++++-
src/Mod/Part/Gui/TaskCheckGeometry.h | 4 +++-
9 files changed, 73 insertions(+), 5 deletions(-)
diff --git a/src/Mod/Import/App/AppImportPy.cpp b/src/Mod/Import/App/AppImportPy.cpp
index dfb6234e5a..8c11ee2078 100644
--- a/src/Mod/Import/App/AppImportPy.cpp
+++ b/src/Mod/Import/App/AppImportPy.cpp
@@ -146,12 +146,16 @@ private:
throw Py::Exception(PyExc_IOError, "cannot read STEP file");
}
+#if OCC_VERSION_HEX < 0x070500
Handle(Message_ProgressIndicator) pi = new Part::ProgressIndicator(100);
aReader.Reader().WS()->MapReader()->SetProgress(pi);
pi->NewScope(100, "Reading STEP file...");
pi->Show();
+#endif
aReader.Transfer(hDoc);
+#if OCC_VERSION_HEX < 0x070500
pi->EndScope();
+#endif
}
catch (OSD_Exception& e) {
Base::Console().Error("%s\n", e.GetMessageString());
@@ -178,12 +182,16 @@ private:
throw Py::Exception(PyExc_IOError, "cannot read IGES file");
}
+#if OCC_VERSION_HEX < 0x070500
Handle(Message_ProgressIndicator) pi = new Part::ProgressIndicator(100);
aReader.WS()->MapReader()->SetProgress(pi);
pi->NewScope(100, "Reading IGES file...");
pi->Show();
+#endif
aReader.Transfer(hDoc);
+#if OCC_VERSION_HEX < 0x070500
pi->EndScope();
+#endif
// http://opencascade.blogspot.de/2009/03/unnoticeable-memory-leaks-part-2.html
Handle(IGESToBRep_Actor)::DownCast(aReader.WS()->TransferReader()->Actor())
->SetModel(new IGESData_IGESModel);
diff --git a/src/Mod/Import/Gui/AppImportGuiPy.cpp b/src/Mod/Import/Gui/AppImportGuiPy.cpp
index 8f9ace29c7..9414e622a8 100644
--- a/src/Mod/Import/Gui/AppImportGuiPy.cpp
+++ b/src/Mod/Import/Gui/AppImportGuiPy.cpp
@@ -391,12 +391,16 @@ private:
throw Py::Exception(PyExc_IOError, "cannot read STEP file");
}
+#if OCC_VERSION_HEX < 0x070500
Handle(Message_ProgressIndicator) pi = new Part::ProgressIndicator(100);
aReader.Reader().WS()->MapReader()->SetProgress(pi);
pi->NewScope(100, "Reading STEP file...");
pi->Show();
+#endif
aReader.Transfer(hDoc);
+#if OCC_VERSION_HEX < 0x070500
pi->EndScope();
+#endif
}
catch (OSD_Exception& e) {
Base::Console().Error("%s\n", e.GetMessageString());
@@ -423,12 +427,16 @@ private:
throw Py::Exception(Base::BaseExceptionFreeCADError, "cannot read IGES file");
}
+#if OCC_VERSION_HEX < 0x070500
Handle(Message_ProgressIndicator) pi = new Part::ProgressIndicator(100);
aReader.WS()->MapReader()->SetProgress(pi);
pi->NewScope(100, "Reading IGES file...");
pi->Show();
+#endif
aReader.Transfer(hDoc);
+#if OCC_VERSION_HEX < 0x070500
pi->EndScope();
+#endif
// http://opencascade.blogspot.de/2009/03/unnoticeable-memory-leaks-part-2.html
Handle(IGESToBRep_Actor)::DownCast(aReader.WS()->TransferReader()->Actor())
->SetModel(new IGESData_IGESModel);
@@ -601,12 +609,16 @@ private:
throw Py::Exception(PyExc_IOError, "cannot read STEP file");
}
+#if OCC_VERSION_HEX < 0x070500
Handle(Message_ProgressIndicator) pi = new Part::ProgressIndicator(100);
aReader.Reader().WS()->MapReader()->SetProgress(pi);
pi->NewScope(100, "Reading STEP file...");
pi->Show();
+#endif
aReader.Transfer(hDoc);
+#if OCC_VERSION_HEX < 0x070500
pi->EndScope();
+#endif
}
else if (file.hasExtension("igs") || file.hasExtension("iges")) {
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
@@ -623,12 +635,16 @@ private:
throw Py::Exception(PyExc_IOError, "cannot read IGES file");
}
+#if OCC_VERSION_HEX < 0x070500
Handle(Message_ProgressIndicator) pi = new Part::ProgressIndicator(100);
aReader.WS()->MapReader()->SetProgress(pi);
pi->NewScope(100, "Reading IGES file...");
pi->Show();
+#endif
aReader.Transfer(hDoc);
+#if OCC_VERSION_HEX < 0x070500
pi->EndScope();
+#endif
// http://opencascade.blogspot.de/2009/03/unnoticeable-memory-leaks-part-2.html
Handle(IGESToBRep_Actor)::DownCast(aReader.WS()->TransferReader()->Actor())
->SetModel(new IGESData_IGESModel);
diff --git a/src/Mod/Part/App/ImportIges.cpp b/src/Mod/Part/App/ImportIges.cpp
index abc0faeb59..f004e9bc36 100644
--- a/src/Mod/Part/App/ImportIges.cpp
+++ b/src/Mod/Part/App/ImportIges.cpp
@@ -52,6 +52,8 @@
#include <Interface_EntityIterator.hxx>
#include <Quantity_Color.hxx>
#include <TCollection_ExtendedString.hxx>
+#include <Standard_Version.hxx>
+
#include <Base/Console.h>
#include <Base/Sequencer.h>
@@ -90,16 +92,20 @@ int Part::ImportIgesParts(App::Document *pcDoc, const char* FileName)
#if 1
std::string aName = fi.fileNamePure();
+#if OCC_VERSION_HEX < 0x070500
Handle(Message_ProgressIndicator) pi = new ProgressIndicator(100);
pi->NewScope(100, "Reading IGES file...");
pi->Show();
aReader.WS()->MapReader()->SetProgress(pi);
+#endif
// make model
aReader.ClearShapes();
//Standard_Integer nbRootsForTransfer = aReader.NbRootsForTransfer();
aReader.TransferRoots();
+#if OCC_VERSION_HEX < 0x070500
pi->EndScope();
+#endif
// put all other free-flying shapes into a single compound
Standard_Boolean emptyComp = Standard_True;
diff --git a/src/Mod/Part/App/ImportStep.cpp b/src/Mod/Part/App/ImportStep.cpp
index 828c27040b..9db9e397d8 100644
--- a/src/Mod/Part/App/ImportStep.cpp
+++ b/src/Mod/Part/App/ImportStep.cpp
@@ -105,10 +105,12 @@ int Part::ImportStepParts(App::Document *pcDoc, const char* Name)
throw Base::FileException("Cannot open STEP file");
}
+#if OCC_VERSION_HEX < 0x070500
Handle(Message_ProgressIndicator) pi = new ProgressIndicator(100);
aReader.WS()->MapReader()->SetProgress(pi);
pi->NewScope(100, "Reading STEP file...");
pi->Show();
+#endif
// Root transfers
Standard_Integer nbr = aReader.NbRootsForTransfer();
@@ -117,7 +119,9 @@ int Part::ImportStepParts(App::Document *pcDoc, const char* Name)
Base::Console().Log("STEP: Transferring Root %d\n",n);
aReader.TransferRoot(n);
}
+#if OCC_VERSION_HEX < 0x070500
pi->EndScope();
+#endif
// Collecting resulting entities
Standard_Integer nbs = aReader.NbShapes();
diff --git a/src/Mod/Part/App/ProgressIndicator.cpp b/src/Mod/Part/App/ProgressIndicator.cpp
index c5f9d64261..8eb0fcadd1 100644
--- a/src/Mod/Part/App/ProgressIndicator.cpp
+++ b/src/Mod/Part/App/ProgressIndicator.cpp
@@ -54,6 +54,7 @@ using namespace Part;
\endcode
*/
+#if OCC_VERSION_HEX < 0x070500
ProgressIndicator::ProgressIndicator (int theMaxVal)
: myProgress(new Base::SequencerLauncher("", theMaxVal))
{
@@ -83,3 +84,4 @@ Standard_Boolean ProgressIndicator::UserBreak()
{
return myProgress->wasCanceled();
}
+#endif
diff --git a/src/Mod/Part/App/ProgressIndicator.h b/src/Mod/Part/App/ProgressIndicator.h
index 73214c0716..ad34d2ee5e 100644
--- a/src/Mod/Part/App/ProgressIndicator.h
+++ b/src/Mod/Part/App/ProgressIndicator.h
@@ -25,11 +25,13 @@
#define PART_PROGRESSINDICATOR_H
#include <Message_ProgressIndicator.hxx>
+#include <Standard_Version.hxx>
#include <Base/Sequencer.h>
#include <memory>
namespace Part {
+#if OCC_VERSION_HEX < 0x070500
class PartExport ProgressIndicator : public Message_ProgressIndicator
{
public:
@@ -42,6 +44,7 @@ public:
private:
std::unique_ptr<Base::SequencerLauncher> myProgress;
};
+#endif
}
diff --git a/src/Mod/Part/App/TopoShape.cpp b/src/Mod/Part/App/TopoShape.cpp
index cc8772e6ed..5615f217a7 100644
--- a/src/Mod/Part/App/TopoShape.cpp
+++ b/src/Mod/Part/App/TopoShape.cpp
@@ -584,17 +584,21 @@ void TopoShape::importIges(const char *FileName)
if (aReader.ReadFile(encodeFilename(FileName).c_str()) != IFSelect_RetDone)
throw Base::FileException("Error in reading IGES");
+#if OCC_VERSION_HEX < 0x070500
Handle(Message_ProgressIndicator) pi = new ProgressIndicator(100);
pi->NewScope(100, "Reading IGES file...");
pi->Show();
aReader.WS()->MapReader()->SetProgress(pi);
+#endif
// make brep
aReader.ClearShapes();
aReader.TransferRoots();
// one shape that contains all subshapes
this->_Shape = aReader.OneShape();
+#if OCC_VERSION_HEX < 0x070500
pi->EndScope();
+#endif
}
catch (Standard_Failure& e) {
throw Base::CADKernelError(e.GetMessageString());
@@ -608,16 +612,20 @@ void TopoShape::importStep(const char *FileName)
if (aReader.ReadFile(encodeFilename(FileName).c_str()) != IFSelect_RetDone)
throw Base::FileException("Error in reading STEP");
+#if OCC_VERSION_HEX < 0x070500
Handle(Message_ProgressIndicator) pi = new ProgressIndicator(100);
aReader.WS()->MapReader()->SetProgress(pi);
pi->NewScope(100, "Reading STEP file...");
pi->Show();
+#endif
// Root transfers
aReader.TransferRoots();
// one shape that contains all subshapes
this->_Shape = aReader.OneShape();
+#if OCC_VERSION_HEX < 0x070500
pi->EndScope();
+#endif
}
catch (Standard_Failure& e) {
throw Base::CADKernelError(e.GetMessageString());
@@ -630,7 +638,7 @@ void TopoShape::importBrep(const char *FileName)
// read brep-file
BRep_Builder aBuilder;
TopoDS_Shape aShape;
-#if OCC_VERSION_HEX >= 0x060300
+#if OCC_VERSION_HEX >= 0x060300 && OCC_VERSION_HEX < 0x070500
Handle(Message_ProgressIndicator) pi = new ProgressIndicator(100);
pi->NewScope(100, "Reading BREP file...");
pi->Show();
@@ -652,16 +660,19 @@ void TopoShape::importBrep(std::istream& str, int indicator)
// read brep-file
BRep_Builder aBuilder;
TopoDS_Shape aShape;
-#if OCC_VERSION_HEX >= 0x060300
+#if OCC_VERSION_HEX >= 0x060300 && OCC_VERSION_HEX < 0x070500
if (indicator) {
Handle(Message_ProgressIndicator) pi = new ProgressIndicator(100);
pi->NewScope(100, "Reading BREP file...");
pi->Show();
BRepTools::Read(aShape,str,aBuilder,pi);
pi->EndScope();
- } else
+ }
+ else {
BRepTools::Read(aShape,str,aBuilder);
+ }
#else
+ (void)indicator;
BRepTools::Read(aShape,str,aBuilder);
#endif
this->_Shape = aShape;
@@ -750,10 +761,13 @@ void TopoShape::exportStep(const char *filename) const
const Handle(XSControl_TransferWriter)& hTransferWriter = aWriter.WS()->TransferWriter();
Handle(Transfer_FinderProcess) hFinder = hTransferWriter->FinderProcess();
+
+#if OCC_VERSION_HEX < 0x070500
Handle(Message_ProgressIndicator) pi = new ProgressIndicator(100);
hFinder->SetProgress(pi);
pi->NewScope(100, "Writing STEP file...");
pi->Show();
+#endif
if (aWriter.Transfer(this->_Shape, STEPControl_AsIs) != IFSelect_RetDone)
throw Base::FileException("Error in transferring STEP");
@@ -767,7 +781,9 @@ void TopoShape::exportStep(const char *filename) const
if (aWriter.Write(encodeFilename(filename).c_str()) != IFSelect_RetDone)
throw Base::FileException("Writing of STEP failed");
+#if OCC_VERSION_HEX < 0x070500
pi->EndScope();
+#endif
}
catch (Standard_Failure& e) {
throw Base::CADKernelError(e.GetMessageString());
diff --git a/src/Mod/Part/Gui/TaskCheckGeometry.cpp b/src/Mod/Part/Gui/TaskCheckGeometry.cpp
index 0b74eec02b..b5d6d11ebb 100644
--- a/src/Mod/Part/Gui/TaskCheckGeometry.cpp
+++ b/src/Mod/Part/Gui/TaskCheckGeometry.cpp
@@ -418,10 +418,12 @@ void TaskCheckGeometryResults::goCheck()
std::vector<Gui::SelectionSingleton::SelObj>::iterator it;
ResultEntry *theRoot = new ResultEntry();
+#if OCC_VERSION_HEX < 0x070500
Handle(Message_ProgressIndicator) theProgress = new BOPProgressIndicator(tr("Check geometry"), Gui::getMainWindow());
theProgress->NewScope("BOP check...");
#if OCC_VERSION_HEX >= 0x060900
theProgress->Show();
+#endif
#endif
selectedCount = static_cast<int>(selection.size());
@@ -484,11 +486,18 @@ void TaskCheckGeometryResults::goCheck()
std::string label = "Checking ";
label += feature->Label.getStrValue();
label += "...";
+#if OCC_VERSION_HEX < 0x070500
theProgress->NewScope(label.c_str());
invalidShapes += goBOPSingleCheck(shape, theRoot, baseName, theProgress);
+#else
+ invalidShapes += goBOPSingleCheck(shape, theRoot, baseName, nullptr);
+#endif
+
+#if OCC_VERSION_HEX < 0x070500
theProgress->EndScope();
if (theProgress->UserBreak())
break;
+#endif
}
}
}
@@ -613,7 +622,7 @@ int TaskCheckGeometryResults::goBOPSingleCheck(const TopoDS_Shape& shapeIn, Resu
//this is left for another time.
TopoDS_Shape BOPCopy = BRepBuilderAPI_Copy(shapeIn).Shape();
BOPAlgo_ArgumentAnalyzer BOPCheck;
-#if OCC_VERSION_HEX >= 0x060900
+#if OCC_VERSION_HEX >= 0x060900 && OCC_VERSION_HEX < 0x070500
BOPCheck.SetProgressIndicator(theProgress);
#else
Q_UNUSED(theProgress);
@@ -961,6 +970,7 @@ TaskCheckGeometryDialog::~TaskCheckGeometryDialog()
////////////////////////////////////////////////////////////////////////////////////////////////
+#if OCC_VERSION_HEX < 0x070500
BOPProgressIndicator::BOPProgressIndicator (const QString& title, QWidget* parent)
{
steps = 0;
@@ -1023,5 +1033,6 @@ Standard_Boolean BOPProgressIndicator::UserBreak()
return Standard_False;
}
+#endif
#include "moc_TaskCheckGeometry.cpp"
diff --git a/src/Mod/Part/Gui/TaskCheckGeometry.h b/src/Mod/Part/Gui/TaskCheckGeometry.h
index e7d7d31271..1cf595bf85 100644
--- a/src/Mod/Part/Gui/TaskCheckGeometry.h
+++ b/src/Mod/Part/Gui/TaskCheckGeometry.h
@@ -27,6 +27,7 @@
#include <BRepCheck_Analyzer.hxx>
#include <BRepCheck_Status.hxx>
#include <Message_ProgressIndicator.hxx>
+#include <Standard_Version.hxx>
#include <TopTools_MapOfShape.hxx>
#include <Gui/TaskView/TaskDialog.h>
#include <Gui/TaskView/TaskView.h>
@@ -147,6 +148,7 @@ private:
QTextEdit *contentLabel;
};
+#if OCC_VERSION_HEX < 0x070500
class BOPProgressIndicator : public Message_ProgressIndicator
{
public:
@@ -162,7 +164,7 @@ private:
QTime time;
QProgressDialog* myProgress;
};
-
+#endif
}
#endif // TASKCHECKGEOMETRY_H
--
2.30.1