diff --git a/src/Mod/Import/App/AppImportPy.cpp b/src/Mod/Import/App/AppImportPy.cpp index 9cd2e57ff1..63a7ab6161 100644 --- a/src/Mod/Import/App/AppImportPy.cpp +++ b/src/Mod/Import/App/AppImportPy.cpp @@ -174,12 +174,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()); @@ -206,12 +210,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 07217541a4..ff3d2b2bdd 100644 --- a/src/Mod/Import/Gui/AppImportGuiPy.cpp +++ b/src/Mod/Import/Gui/AppImportGuiPy.cpp @@ -459,12 +459,17 @@ private: if (aReader.ReadFile((const char*)name8bit.c_str()) != IFSelect_RetDone) { 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()); @@ -491,12 +496,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); @@ -710,12 +719,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 hGrp = App::GetApplication().GetUserParameter() @@ -732,12 +745,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 e0230a9055..bf22ec2da2 100644 --- a/src/Mod/Part/App/ImportIges.cpp +++ b/src/Mod/Part/App/ImportIges.cpp @@ -47,6 +47,7 @@ # include # include # include +# include #endif #include @@ -86,16 +87,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 fa9760db4d..0f9be37eda 100644 --- a/src/Mod/Part/App/ImportStep.cpp +++ b/src/Mod/Part/App/ImportStep.cpp @@ -103,10 +103,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(); @@ -115,7 +117,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 +#include #include #include namespace Part { +#if OCC_VERSION_HEX < 0x070500 class PartExport ProgressIndicator : public Message_ProgressIndicator { public: @@ -42,6 +44,7 @@ public: private: std::unique_ptr myProgress; }; +#endif } diff --git a/src/Mod/Part/App/TopoShape.cpp b/src/Mod/Part/App/TopoShape.cpp index ddc1f8b1b7..014c12c8d7 100644 --- a/src/Mod/Part/App/TopoShape.cpp +++ b/src/Mod/Part/App/TopoShape.cpp @@ -739,17 +739,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()); @@ -763,16 +767,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()); @@ -785,7 +793,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(); @@ -807,16 +815,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; @@ -905,10 +916,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"); @@ -922,7 +936,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()); @@ -3455,13 +3471,20 @@ void TopoShape::setFaces(const std::vector &Points, aSewingTool.Load(aComp); +#if OCC_VERSION_HEX < 0x070500 Handle(Message_ProgressIndicator) pi = new ProgressIndicator(100); pi->NewScope(100, "Sewing Faces..."); pi->Show(); aSewingTool.Perform(pi); +#else + aSewingTool.Perform(); +#endif + _Shape = aSewingTool.SewedShape(); +#if OCC_VERSION_HEX < 0x070500 pi->EndScope(); +#endif if (_Shape.IsNull()) _Shape = aComp; } diff --git a/src/Mod/Part/Gui/TaskCheckGeometry.cpp b/src/Mod/Part/Gui/TaskCheckGeometry.cpp index 5fc3332a71..206738b5ae 100644 --- a/src/Mod/Part/Gui/TaskCheckGeometry.cpp +++ b/src/Mod/Part/Gui/TaskCheckGeometry.cpp @@ -419,10 +419,13 @@ void TaskCheckGeometryResults::goCheck() Gui::WaitCursor wc; int selectedCount(0), checkedCount(0), invalidShapes(0); 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 for(const auto &sel : Gui::Selection().getSelection()) { @@ -473,11 +476,18 @@ void TaskCheckGeometryResults::goCheck() std::string label = "Checking "; label += sel.pObject->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 } } } @@ -684,7 +694,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); @@ -1370,6 +1380,7 @@ TaskCheckGeometryDialog::~TaskCheckGeometryDialog() //////////////////////////////////////////////////////////////////////////////////////////////// +#if OCC_VERSION_HEX < 0x070500 BOPProgressIndicator::BOPProgressIndicator (const QString& title, QWidget* parent) { steps = 0; @@ -1432,5 +1443,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 3f886c0ab9..c0afdb27bb 100644 --- a/src/Mod/Part/Gui/TaskCheckGeometry.h +++ b/src/Mod/Part/Gui/TaskCheckGeometry.h @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -190,6 +191,7 @@ private: QPushButton *resultsBtn; }; +#if OCC_VERSION_HEX < 0x070500 class BOPProgressIndicator : public Message_ProgressIndicator { public: @@ -205,7 +207,7 @@ private: QElapsedTimer time; QProgressDialog* myProgress; }; - +#endif } #endif // TASKCHECKGEOMETRY_H