From 3026bd413dcf235cf9e8244ca69bddc2269cbdeb Mon Sep 17 00:00:00 2001 From: mosfet80 Date: Fri, 21 Mar 2025 13:06:47 +0100 Subject: [PATCH] Remove support to oldest occ <7.5 (#20084) * remove support to oldest occ <7.5 The os ubuntu 22.04 not supported use occ 7.5.1. There is a lot of code implemented to support even older versions. The patch removes support for versions lower than occ 7.5.0 * . * move include library #pieterhijma change request : * removed deprecated functions get/setAngle functions has been removed with OCC 7.5 --- cMake/FindOCC.cmake | 6 +- src/Mod/Import/App/AppImportPy.cpp | 4 +- src/Mod/Import/App/ImportOCAF2.cpp | 6 +- src/Mod/Import/App/ReaderGltf.cpp | 17 ---- src/Mod/Import/App/ReaderIges.cpp | 11 +-- src/Mod/Import/App/ReaderStep.cpp | 10 --- src/Mod/Import/App/StepShape.cpp | 10 --- src/Mod/Import/App/Tools.cpp | 4 - src/Mod/Import/App/WriterGltf.cpp | 7 -- src/Mod/Import/Gui/AppImportGuiPy.cpp | 1 - src/Mod/Part/App/CMakeLists.txt | 2 - .../Part/App/HLRBRep/HLRBRep_PolyAlgoPy.xml | 6 -- .../App/HLRBRep/HLRBRep_PolyAlgoPyImp.cpp | 17 ---- src/Mod/Part/App/ImportIges.cpp | 10 --- src/Mod/Part/App/ImportStep.cpp | 22 ----- src/Mod/Part/App/OpenCascadeAll.h | 3 - src/Mod/Part/App/ProgressIndicator.cpp | 85 ------------------- src/Mod/Part/App/ProgressIndicator.h | 54 ------------ .../Part/App/ShapeFix/ShapeFix_SolidPyImp.cpp | 5 +- src/Mod/Part/App/TopoShape.cpp | 64 +------------- src/Mod/Part/App/TopoShapeExpansion.cpp | 15 +--- src/Mod/Part/Gui/TaskCheckGeometry.cpp | 52 +----------- src/Mod/Part/Gui/TaskCheckGeometry.h | 12 +-- src/Mod/Part/Gui/ViewProviderExt.cpp | 4 - tests/src/Mod/Part/App/TopoShapeExpansion.cpp | 10 --- 25 files changed, 15 insertions(+), 422 deletions(-) delete mode 100644 src/Mod/Part/App/ProgressIndicator.cpp delete mode 100644 src/Mod/Part/App/ProgressIndicator.h diff --git a/cMake/FindOCC.cmake b/cMake/FindOCC.cmake index 552f0b1896..4e34c009ef 100644 --- a/cMake/FindOCC.cmake +++ b/cMake/FindOCC.cmake @@ -9,7 +9,7 @@ # we first try to find opencascade directly: if (NOT OCCT_CMAKE_FALLBACK) - find_package(OpenCASCADE CONFIG QUIET) + find_package(OpenCASCADE "7.5.1" CONFIG QUIET) get_property(flags DIRECTORY PROPERTY COMPILE_DEFINITIONS) # OCCT 7.5 adds this define that causes hundreds of compiler warnings with Qt5.x, so remove it again list(FILTER flags EXCLUDE REGEX [[GL_GLEXT_LEGACY]]) @@ -121,11 +121,9 @@ if (OCC_FOUND) TKMeshVS TKService TKV3d + TKRWMesh ) - if (NOT OCC_VERSION_STRING VERSION_LESS 7.5.0) - list(APPEND OCC_OCAF_LIBRARIES TKRWMesh) - endif () if (OCC_VERSION_STRING VERSION_LESS 7.8.0) list(APPEND OCC_LIBRARIES TKIGES TKSTL TKSTEPBase TKSTEPAttr TKSTEP209 TKSTEP) list(APPEND OCC_OCAF_LIBRARIES TKXDESTEP TKXDEIGES) diff --git a/src/Mod/Import/App/AppImportPy.cpp b/src/Mod/Import/App/AppImportPy.cpp index 56ef9a84ab..31fd806866 100644 --- a/src/Mod/Import/App/AppImportPy.cpp +++ b/src/Mod/Import/App/AppImportPy.cpp @@ -42,9 +42,8 @@ #include #include #include -#if OCC_VERSION_HEX >= 0x070500 #include -#endif + #if defined(__clang__) #pragma clang diagnostic pop #endif @@ -62,7 +61,6 @@ #include #include #include -#include #include #include diff --git a/src/Mod/Import/App/ImportOCAF2.cpp b/src/Mod/Import/App/ImportOCAF2.cpp index 9e885a8d5b..6c8778e63f 100644 --- a/src/Mod/Import/App/ImportOCAF2.cpp +++ b/src/Mod/Import/App/ImportOCAF2.cpp @@ -57,13 +57,9 @@ #include "ImportOCAF2.h" - -#if OCC_VERSION_HEX >= 0x070500 // See https://dev.opencascade.org/content/occt-3d-viewer-becomes-srgb-aware #define OCC_COLOR_SPACE Quantity_TOC_sRGB -#else -#define OCC_COLOR_SPACE Quantity_TOC_RGB -#endif + FC_LOG_LEVEL_INIT("Import", true, true) diff --git a/src/Mod/Import/App/ReaderGltf.cpp b/src/Mod/Import/App/ReaderGltf.cpp index 7dbe50ea82..2671c62359 100644 --- a/src/Mod/Import/App/ReaderGltf.cpp +++ b/src/Mod/Import/App/ReaderGltf.cpp @@ -26,7 +26,6 @@ #ifndef _PreComp_ #include #include -#if OCC_VERSION_HEX >= 0x070500 #include #include #include @@ -39,7 +38,6 @@ #include #include #endif -#endif #include "ReaderGltf.h" #include "Tools.h" @@ -57,7 +55,6 @@ ReaderGltf::ReaderGltf(const Base::FileInfo& file) // NOLINTNEXTLINE void ReaderGltf::read(Handle(TDocStd_Document) hDoc) { -#if OCC_VERSION_HEX >= 0x070500 const double unit = 0.001; // mm RWGltf_CafReader aReader; aReader.SetSystemLengthUnit(unit); @@ -72,17 +69,11 @@ void ReaderGltf::read(Handle(TDocStd_Document) hDoc) } processDocument(hDoc); - -#else - boost::ignore_unused(hDoc); - throw Base::RuntimeError("gITF support requires OCCT 7.5.0 or later"); -#endif } // NOLINTNEXTLINE void ReaderGltf::processDocument(Handle(TDocStd_Document) hDoc) { -#if OCC_VERSION_HEX >= 0x070500 Handle(XCAFDoc_ShapeTool) aShapeTool = XCAFDoc_DocumentTool::ShapeTool(hDoc->Main()); TDF_LabelSequence shapeLabels; @@ -101,9 +92,6 @@ void ReaderGltf::processDocument(Handle(TDocStd_Document) hDoc) } } } -#else - boost::ignore_unused(hDoc); -#endif } // NOLINTNEXTLINE @@ -111,7 +99,6 @@ TopoDS_Shape ReaderGltf::processSubShapes(Handle(TDocStd_Document) hDoc, const TDF_LabelSequence& subShapeLabels) { TopoDS_Compound compound; -#if OCC_VERSION_HEX >= 0x070500 Handle(XCAFDoc_ShapeTool) aShapeTool = XCAFDoc_DocumentTool::ShapeTool(hDoc->Main()); Handle(XCAFDoc_ColorTool) aColorTool = XCAFDoc_DocumentTool::ColorTool(hDoc->Main()); Handle(XCAFDoc_VisMaterialTool) aVisTool = XCAFDoc_DocumentTool::VisMaterialTool(hDoc->Main()); @@ -141,10 +128,6 @@ TopoDS_Shape ReaderGltf::processSubShapes(Handle(TDocStd_Document) hDoc, aColorTool->SetColor(faceLabel, rgba, XCAFDoc_ColorSurf); } } -#else - boost::ignore_unused(hDoc); - boost::ignore_unused(subShapeLabels); -#endif return {std::move(compound)}; } diff --git a/src/Mod/Import/App/ReaderIges.cpp b/src/Mod/Import/App/ReaderIges.cpp index 22171052e2..31a9b56fff 100644 --- a/src/Mod/Import/App/ReaderIges.cpp +++ b/src/Mod/Import/App/ReaderIges.cpp @@ -39,7 +39,6 @@ #include #include #include -#include using namespace Import; @@ -69,16 +68,8 @@ void ReaderIges::read(Handle(TDocStd_Document) hDoc) // NOLINT throw Base::FileException("Cannot read IGES file", 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/App/ReaderStep.cpp b/src/Mod/Import/App/ReaderStep.cpp index d7c7bf9ad7..45eee35219 100644 --- a/src/Mod/Import/App/ReaderStep.cpp +++ b/src/Mod/Import/App/ReaderStep.cpp @@ -34,7 +34,6 @@ #include "ReaderStep.h" #include #include -#include using namespace Import; @@ -66,14 +65,5 @@ void ReaderStep::read(Handle(TDocStd_Document) hDoc) // NOLINT throw Base::FileException("Cannot read STEP file", 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 } diff --git a/src/Mod/Import/App/StepShape.cpp b/src/Mod/Import/App/StepShape.cpp index 87b793f17d..a09798cbb4 100644 --- a/src/Mod/Import/App/StepShape.cpp +++ b/src/Mod/Import/App/StepShape.cpp @@ -69,22 +69,12 @@ int StepShape::read(const char* fileName) std::cout << "dump of step header:" << std::endl; -#if OCC_VERSION_HEX < 0x070401 - Handle(Message_PrinterOStream) mstr = new Message_PrinterOStream(); - Handle(Message_Messenger) msg = new Message_Messenger(mstr); - model->DumpHeader(msg); -#else model->DumpHeader(std::cout); -#endif for (int nent = 1; nent <= model->NbEntities(); nent++) { Handle(Standard_Transient) entity = model->Entity(nent); std::cout << "label entity " << nent << ":"; -#if OCC_VERSION_HEX < 0x070401 - model->PrintLabel(entity, msg); -#else model->PrintLabel(entity, std::cout); -#endif std::cout << ";" << entity->DynamicType()->Name() << std::endl; } diff --git a/src/Mod/Import/App/Tools.cpp b/src/Mod/Import/App/Tools.cpp index 5fe73d32c2..7efc54abe9 100644 --- a/src/Mod/Import/App/Tools.cpp +++ b/src/Mod/Import/App/Tools.cpp @@ -35,12 +35,8 @@ #include #include -#if OCC_VERSION_HEX >= 0x070500 // See https://dev.opencascade.org/content/occt-3d-viewer-becomes-srgb-aware #define OCC_COLOR_SPACE Quantity_TOC_sRGB -#else -#define OCC_COLOR_SPACE Quantity_TOC_RGB -#endif FC_LOG_LEVEL_INIT("Import", true, true) diff --git a/src/Mod/Import/App/WriterGltf.cpp b/src/Mod/Import/App/WriterGltf.cpp index e9b1e1c559..eb12e3417e 100644 --- a/src/Mod/Import/App/WriterGltf.cpp +++ b/src/Mod/Import/App/WriterGltf.cpp @@ -27,11 +27,9 @@ #include #include #include -#if OCC_VERSION_HEX >= 0x070500 #include #include #endif -#endif #include "WriterGltf.h" #include @@ -48,7 +46,6 @@ void WriterGltf::write(Handle(TDocStd_Document) hDoc) const // NOLINT std::string utf8Name = file.filePath(); std::string name8bit = Part::encodeFilename(utf8Name); -#if OCC_VERSION_HEX >= 0x070500 TColStd_IndexedDataMapOfStringString aMetadata; RWGltf_CafWriter aWriter(name8bit.c_str(), file.hasExtension("glb")); aWriter.SetTransformationFormat(RWGltf_WriterTrsfFormat_Compact); @@ -62,8 +59,4 @@ void WriterGltf::write(Handle(TDocStd_Document) hDoc) const // NOLINT if (!ret) { throw Base::FileException("Cannot save to file: ", file); } -#else - boost::ignore_unused(hDoc); - throw Base::RuntimeError("gITF support requires OCCT 7.5.0 or later"); -#endif } diff --git a/src/Mod/Import/Gui/AppImportGuiPy.cpp b/src/Mod/Import/Gui/AppImportGuiPy.cpp index 5e1ad27022..246a1dafb2 100644 --- a/src/Mod/Import/Gui/AppImportGuiPy.cpp +++ b/src/Mod/Import/Gui/AppImportGuiPy.cpp @@ -71,7 +71,6 @@ #include #include #include -#include #include #include #include diff --git a/src/Mod/Part/App/CMakeLists.txt b/src/Mod/Part/App/CMakeLists.txt index aaa3d4c600..0ad53f24ad 100644 --- a/src/Mod/Part/App/CMakeLists.txt +++ b/src/Mod/Part/App/CMakeLists.txt @@ -556,8 +556,6 @@ SET(Part_SRCS Interface.h PreCompiled.cpp PreCompiled.h - ProgressIndicator.cpp - ProgressIndicator.h Services.cpp Services.h TopoShape.cpp diff --git a/src/Mod/Part/App/HLRBRep/HLRBRep_PolyAlgoPy.xml b/src/Mod/Part/App/HLRBRep/HLRBRep_PolyAlgoPy.xml index 36527f8c7c..253c2ffe25 100644 --- a/src/Mod/Part/App/HLRBRep/HLRBRep_PolyAlgoPy.xml +++ b/src/Mod/Part/App/HLRBRep/HLRBRep_PolyAlgoPy.xml @@ -158,12 +158,6 @@ Make a shape with the internal outlines in each face of shape S. - - - - - - diff --git a/src/Mod/Part/App/HLRBRep/HLRBRep_PolyAlgoPyImp.cpp b/src/Mod/Part/App/HLRBRep/HLRBRep_PolyAlgoPyImp.cpp index a599d7d1ba..7bf7609b6a 100644 --- a/src/Mod/Part/App/HLRBRep/HLRBRep_PolyAlgoPyImp.cpp +++ b/src/Mod/Part/App/HLRBRep/HLRBRep_PolyAlgoPyImp.cpp @@ -243,23 +243,6 @@ PyObject* HLRBRep_PolyAlgoPy::outLinedShape(PyObject *args) return new TopoShapePy(new TopoShape(result)); } -Py::Float HLRBRep_PolyAlgoPy::getAngle() const -{ -#if OCC_VERSION_HEX <= 0x070400 - return Py::Float(getHLRBRep_PolyAlgoPtr()->Angle()); -#else - throw Py::RuntimeError("Function has been removed with OCC 7.5"); -#endif -} - -void HLRBRep_PolyAlgoPy::setAngle(Py::Float arg) -{ -#if OCC_VERSION_HEX <= 0x070400 - getHLRBRep_PolyAlgoPtr()->Angle(static_cast(arg)); -#else - (void)arg; -#endif -} Py::Float HLRBRep_PolyAlgoPy::getTolAngular() const { diff --git a/src/Mod/Part/App/ImportIges.cpp b/src/Mod/Part/App/ImportIges.cpp index 272a8173ee..705557bd0d 100644 --- a/src/Mod/Part/App/ImportIges.cpp +++ b/src/Mod/Part/App/ImportIges.cpp @@ -45,7 +45,6 @@ #include "ImportIges.h" #include "PartFeature.h" -#include "ProgressIndicator.h" using namespace Part; @@ -75,20 +74,11 @@ int Part::ImportIgesParts(App::Document *pcDoc, const char* FileName) aReader.PrintCheckLoad(Standard_True,IFSelect_GeneralInfo); 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 8c26ab469e..f040919d91 100644 --- a/src/Mod/Part/App/ImportStep.cpp +++ b/src/Mod/Part/App/ImportStep.cpp @@ -50,7 +50,6 @@ #include "encodeFilename.h" #include "ShapeMapHasher.h" #include "PartFeature.h" -#include "ProgressIndicator.h" namespace Part { @@ -82,23 +81,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(); - //aReader.PrintCheckTransfer (failsonly, IFSelect_ItemsByEntity); for (Standard_Integer n = 1; n<= nbr; n++) { 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(); @@ -106,13 +94,8 @@ int Part::ImportStepParts(App::Document *pcDoc, const char* Name) throw Base::FileException("No shapes found in file "); } else { - //Handle(StepData_StepModel) Model = aReader.StepModel(); - //Handle(XSControl_WorkSession) ws = aReader.WS(); - //Handle(XSControl_TransferReader) tr = ws->TransferReader(); std::map hash_col; - //ReadColors(aReader.WS(), hash_col); - //ReadNames(aReader.WS()); for (Standard_Integer i=1; i<=nbs; i++) { Base::Console().Log("STEP: Transferring Shape %d\n",i); @@ -148,7 +131,6 @@ int Part::ImportStepParts(App::Document *pcDoc, const char* Name) col.setItem(1, Py::Float(it->second.Green())); col.setItem(2, Py::Float(it->second.Blue())); vp.setAttr("ShapeAppearance", col); - //Base::Console().Message("Set color to shape\n"); } catch (Py::Exception& e) { e.clear(); @@ -162,10 +144,6 @@ int Part::ImportStepParts(App::Document *pcDoc, const char* Name) const TopoDS_Shell& aShell = TopoDS::Shell(ex.Current()); std::string name = fi.fileNamePure(); - //Handle(Standard_Transient) ent = tr->EntityFromShapeResult(aShell, 3); - //if (!ent.IsNull()) { - // name += ws->Model()->StringLabel(ent)->ToCString(); - //} Part::Feature *pcFeature = pcDoc->addObject(name.c_str()); pcFeature->Shape.setValue(aShell); diff --git a/src/Mod/Part/App/OpenCascadeAll.h b/src/Mod/Part/App/OpenCascadeAll.h index 7cbc243c96..a3099cecbf 100644 --- a/src/Mod/Part/App/OpenCascadeAll.h +++ b/src/Mod/Part/App/OpenCascadeAll.h @@ -174,9 +174,6 @@ #include #include -#if OCC_VERSION_HEX < 0x070400 -# include -#endif #include #include #include diff --git a/src/Mod/Part/App/ProgressIndicator.cpp b/src/Mod/Part/App/ProgressIndicator.cpp deleted file mode 100644 index fbc6b5108c..0000000000 --- a/src/Mod/Part/App/ProgressIndicator.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/*************************************************************************** - * Copyright (c) 2009 Werner Mayer * - * * - * 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" - -#include "ProgressIndicator.h" - - -using namespace Part; -/*! - \code - #include - #include - - STEPControl_Reader aReader; - Handle(Message_ProgressIndicator) pi = new ProgressIndicator(100); - - pi->NewScope(20, "Loading STEP file..."); - pi->Show(); - aReader.ReadFile("myfile.stp"); - pi->EndScope(); - - Handle(StepData_StepModel) Model = aReader.StepModel(); - pi->NewScope(80, "Translating..."); - pi->Show(); - aReader.WS()->MapReader()->SetProgress(pi); - Standard_Integer nbr = aReader.NbRootsForTransfer(); - for ( Standard_Integer n = 1; n<= nbr; n++) { - ... - } - - pi->EndScope(); - \endcode - */ - -#if OCC_VERSION_HEX < 0x070500 -ProgressIndicator::ProgressIndicator (int theMaxVal) - : myProgress(new Base::SequencerLauncher("", theMaxVal)) -{ - SetScale (0, theMaxVal, 1); -} - -ProgressIndicator::~ProgressIndicator () -{ -} - -Standard_Boolean ProgressIndicator::Show (const Standard_Boolean theForce) -{ - if (theForce) { - Handle(TCollection_HAsciiString) aName = GetScope(1).GetName(); //current step - if (!aName.IsNull()) - myProgress->setText (aName->ToCString()); - } - - Standard_Real aPc = GetPosition(); //always within [0,1] - int aVal = (int)(aPc * myProgress->numberOfSteps()); - myProgress->setProgress (aVal); - - return Standard_True; -} - -Standard_Boolean ProgressIndicator::UserBreak() -{ - return myProgress->wasCanceled(); -} -#endif diff --git a/src/Mod/Part/App/ProgressIndicator.h b/src/Mod/Part/App/ProgressIndicator.h deleted file mode 100644 index 2ffe6766ac..0000000000 --- a/src/Mod/Part/App/ProgressIndicator.h +++ /dev/null @@ -1,54 +0,0 @@ -/*************************************************************************** - * Copyright (c) 2009 Werner Mayer * - * * - * 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 * - * * - ***************************************************************************/ - -#ifndef PART_PROGRESSINDICATOR_H -#define PART_PROGRESSINDICATOR_H - -#include - -#include -#include - -#include -#include - - -namespace Part { - -#if OCC_VERSION_HEX < 0x070500 -class PartExport ProgressIndicator : public Message_ProgressIndicator -{ -public: - ProgressIndicator (int theMaxVal = 100); - virtual ~ProgressIndicator (); - - virtual Standard_Boolean Show (const Standard_Boolean theForce = Standard_True); - virtual Standard_Boolean UserBreak(); - -private: - std::unique_ptr myProgress; -}; -#endif - -} - -#endif // PART_PROGRESSINDICATOR_H diff --git a/src/Mod/Part/App/ShapeFix/ShapeFix_SolidPyImp.cpp b/src/Mod/Part/App/ShapeFix/ShapeFix_SolidPyImp.cpp index 2eac76f081..9b959e5c00 100644 --- a/src/Mod/Part/App/ShapeFix/ShapeFix_SolidPyImp.cpp +++ b/src/Mod/Part/App/ShapeFix/ShapeFix_SolidPyImp.cpp @@ -25,10 +25,7 @@ # include # include # include - -# if OCC_VERSION_HEX >= 0x070500 -# include -# endif +# include #endif #include "ShapeFix/ShapeFix_SolidPy.h" diff --git a/src/Mod/Part/App/TopoShape.cpp b/src/Mod/Part/App/TopoShape.cpp index b4425386b2..8d70e4c3c1 100644 --- a/src/Mod/Part/App/TopoShape.cpp +++ b/src/Mod/Part/App/TopoShape.cpp @@ -180,7 +180,6 @@ #include "Interface.h" #include "modelRefine.h" #include "PartPyCXX.h" -#include "ProgressIndicator.h" #include "Tools.h" #include "TopoShapeCompoundPy.h" #include "TopoShapeCompSolidPy.h" @@ -721,21 +720,11 @@ 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()); @@ -749,20 +738,10 @@ 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()); @@ -775,15 +754,7 @@ void TopoShape::importBrep(const char *FileName) // read brep-file BRep_Builder aBuilder; TopoDS_Shape aShape; -#if OCC_VERSION_HEX < 0x070500 - Handle(Message_ProgressIndicator) pi = new ProgressIndicator(100); - pi->NewScope(100, "Reading BREP file..."); - pi->Show(); - BRepTools::Read(aShape,encodeFilename(FileName).c_str(),aBuilder,pi); - pi->EndScope(); -#else BRepTools::Read(aShape,static_cast(FileName),aBuilder); -#endif this->_Shape = aShape; } catch (Standard_Failure& e) { @@ -797,21 +768,8 @@ void TopoShape::importBrep(std::istream& str, int indicator) // read brep-file BRep_Builder aBuilder; TopoDS_Shape aShape; -#if 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 { - BRepTools::Read(aShape,str,aBuilder); - } -#else (void)indicator; BRepTools::Read(aShape,str,aBuilder); -#endif this->_Shape = aShape; } catch (Standard_Failure& e) { @@ -903,13 +861,6 @@ 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"); @@ -923,9 +874,6 @@ 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()); @@ -3472,20 +3420,10 @@ void TopoShape::setFaces(const std::vector &Points, aSewingTool.Init(tolerance, performSewing); aSewingTool.Load(aComp); -#if OCC_VERSION_HEX < 0x070500 - Handle(Message_ProgressIndicator) pi = new ProgressIndicator(100); - pi->NewScope(100, "Create shape from mesh..."); - 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/App/TopoShapeExpansion.cpp b/src/Mod/Part/App/TopoShapeExpansion.cpp index b3ddff0db1..5118bcf94b 100644 --- a/src/Mod/Part/App/TopoShapeExpansion.cpp +++ b/src/Mod/Part/App/TopoShapeExpansion.cpp @@ -83,9 +83,7 @@ #endif -#if OCC_VERSION_HEX >= 0x070500 #include -#endif #include "modelRefine.h" #include "CrossSection.h" @@ -2661,9 +2659,7 @@ TopoShape& TopoShape::makeElementOffset2D(const TopoShape& shape, if (shape.isNull()) { FC_THROWM(Base::ValueError, "makeOffset2D: input shape is null!"); } - if (allowOpenResult == OpenResult::allowOpenResult && OCC_VERSION_HEX < 0x060900) { - FC_THROWM(Base::AttributeError, "openResult argument is not supported on OCC < 6.9.0."); - } + // OUTLINE OF MAKEOFFSET2D // * Prepare shapes to process @@ -5742,17 +5738,8 @@ TopoShape& TopoShape::makeElementBoolean(const char* maker, } } -#if OCC_VERSION_HEX >= 0x070500 - // -1/22/2024 Removing the parameter. - // if (PartParams::getParallelRunThreshold() > 0) { mk->SetRunParallel(Standard_True); OSD_Parallel::SetUseOcctThreads(Standard_True); - // } -#else - // 01/22/2024 This will be an extremely rare case, since we don't - // build against OCCT versions this old. Removing the parameter. - mk->SetRunParallel(true); -#endif mk->SetArguments(shapeArguments); mk->SetTools(shapeTools); diff --git a/src/Mod/Part/Gui/TaskCheckGeometry.cpp b/src/Mod/Part/Gui/TaskCheckGeometry.cpp index ec0e6e94ba..bc8fc68b96 100644 --- a/src/Mod/Part/Gui/TaskCheckGeometry.cpp +++ b/src/Mod/Part/Gui/TaskCheckGeometry.cpp @@ -422,12 +422,7 @@ void TaskCheckGeometryResults::goCheck() reportViewStrings << QLatin1String("\n"); std::string scopeName {tr("Boolean operation check...").toStdString()}; -#if OCC_VERSION_HEX < 0x070500 - Handle(Message_ProgressIndicator) theProgress = new BOPProgressIndicator(tr("Check geometry"), - Gui::getMainWindow()); - theProgress->NewScope(scopeName.c_str()); - theProgress->Show(); -#else + Handle(Message_ProgressIndicator) theProgress = new BOPProgressIndicator(tr("Check geometry"), Gui::getMainWindow()); Message_ProgressRange theRange(theProgress->Start()); @@ -435,7 +430,6 @@ void TaskCheckGeometryResults::goCheck() TCollection_AsciiString(scopeName.c_str()), selection.size()); theScope.Show(); -#endif // 0x070500 for(const auto &sel : selection) { selectedCount++; @@ -516,14 +510,7 @@ void TaskCheckGeometryResults::goCheck() std::string label = tr("Checking").toStdString() + " "; label += sel.pObject->Label.getStrValue(); label += "..."; -#if OCC_VERSION_HEX < 0x070500 - theProgress->NewScope(label.c_str()); - localInvalidShapeCount += goBOPSingleCheck(shape, theRoot, baseName, theProgress); - invalidShapes += localInvalidShapeCount; - theProgress->EndScope(); - if (theProgress->UserBreak()) - break; -#else + Message_ProgressScope theInnerScope(theScope.Next(), TCollection_AsciiString(label.c_str()), 1); theInnerScope.Show(); localInvalidShapeCount += goBOPSingleCheck(shape, theRoot, baseName, theInnerScope); @@ -531,7 +518,6 @@ void TaskCheckGeometryResults::goCheck() theInnerScope.Close(); if (theScope.UserBreak()) break; -#endif } } // create an entry for shapes without errors @@ -705,13 +691,8 @@ QString TaskCheckGeometryResults::getShapeContentString() return QString::fromStdString(shapeContentString); } -#if OCC_VERSION_HEX < 0x070500 -int TaskCheckGeometryResults::goBOPSingleCheck(const TopoDS_Shape& shapeIn, ResultEntry *theRoot, const QString &baseName, - const Handle(Message_ProgressIndicator)& theProgress) -#else int TaskCheckGeometryResults::goBOPSingleCheck(const TopoDS_Shape& shapeIn, ResultEntry *theRoot, const QString &baseName, const Message_ProgressScope& theScope) -#endif { ParameterGrp::handle group = App::GetApplication().GetUserParameter(). GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod")->GetGroup("Part")->GetGroup("CheckGeometry"); @@ -740,13 +721,11 @@ int TaskCheckGeometryResults::goBOPSingleCheck(const TopoDS_Shape& shapeIn, Resu TopoDS_Shape BOPCopy = BRepBuilderAPI_Copy(shapeIn).Shape(); BOPAlgo_ArgumentAnalyzer BOPCheck; -#if OCC_VERSION_HEX < 0x070500 - BOPCheck.SetProgressIndicator(theProgress); -#elif OCC_VERSION_HEX < 0x070600 +#if OCC_VERSION_HEX < 0x070600 BOPCheck.SetProgressIndicator(theScope); #else Q_UNUSED(theScope) -#endif // 0x070500 +#endif // 0x070600 BOPCheck.SetShape1(BOPCopy); @@ -1441,28 +1420,6 @@ BOPProgressIndicator::~BOPProgressIndicator () myProgress->close(); } -#if OCC_VERSION_HEX < 0x070500 -Standard_Boolean BOPProgressIndicator::Show (const Standard_Boolean theForce) -{ - if (theForce) { - steps = 0; - canceled = false; - - time.start(); - myProgress->show(); - - myProgress->setRange(0, 0); - myProgress->setValue(0); - } - else { - Handle(TCollection_HAsciiString) aName = GetScope(1).GetName(); //current step - if (!aName.IsNull()) - myProgress->setLabelText (QString::fromUtf8(aName->ToCString())); - } - - return Standard_True; -} -#else void BOPProgressIndicator::Show (const Message_ProgressScope& theScope, const Standard_Boolean isForce) { @@ -1486,7 +1443,6 @@ void BOPProgressIndicator::Reset() myProgress->setRange(0, 0); myProgress->setValue(0); } -#endif Standard_Boolean BOPProgressIndicator::UserBreak() { diff --git a/src/Mod/Part/Gui/TaskCheckGeometry.h b/src/Mod/Part/Gui/TaskCheckGeometry.h index 1a8343b825..209f3fe738 100644 --- a/src/Mod/Part/Gui/TaskCheckGeometry.h +++ b/src/Mod/Part/Gui/TaskCheckGeometry.h @@ -123,13 +123,10 @@ private: void dispatchError(ResultEntry *entry, const BRepCheck_Status &stat); bool split(QString &input, QString &doc, QString &object, QString &sub); void setupFunctionMap(); -#if OCC_VERSION_HEX < 0x070500 - int goBOPSingleCheck(const TopoDS_Shape &shapeIn, ResultEntry *theRoot, const QString &baseName, - const Handle(Message_ProgressIndicator)& theProgress); -#else + int goBOPSingleCheck(const TopoDS_Shape &shapeIn, ResultEntry *theRoot, const QString &baseName, const Message_ProgressScope& theScope); -#endif + void buildShapeContent(App::DocumentObject *pObject, const QString &baseName, const TopoDS_Shape &shape); ResultModel *model; QTreeView *treeView; @@ -207,13 +204,10 @@ public: BOPProgressIndicator (const QString &title, QWidget* parent); ~BOPProgressIndicator () override; -#if OCC_VERSION_HEX < 0x070500 - Standard_Boolean Show (const Standard_Boolean theForce = Standard_True) override; -#else void Show (const Message_ProgressScope& theScope, const Standard_Boolean isForce) override; void Reset() override; -#endif + Standard_Boolean UserBreak() override; private: diff --git a/src/Mod/Part/Gui/ViewProviderExt.cpp b/src/Mod/Part/Gui/ViewProviderExt.cpp index 5e2a4cfa04..0c23016cd6 100644 --- a/src/Mod/Part/Gui/ViewProviderExt.cpp +++ b/src/Mod/Part/Gui/ViewProviderExt.cpp @@ -978,7 +978,6 @@ void ViewProviderPartExt::updateVisual() // create or use the mesh on the data structure Standard_Real AngDeflectionRads = AngularDeflection.getValue() / 180.0 * M_PI; -#if OCC_VERSION_HEX >= 0x070500 IMeshTools_Parameters meshParams; meshParams.Deflection = deflection; meshParams.Relative = Standard_False; @@ -987,9 +986,6 @@ void ViewProviderPartExt::updateVisual() meshParams.AllowQualityDecrease = Standard_True; BRepMesh_IncrementalMesh(cShape, meshParams); -#else - BRepMesh_IncrementalMesh(cShape, deflection, Standard_False, AngDeflectionRads, Standard_True); -#endif // We must reset the location here because the transformation data // are set in the placement property diff --git a/tests/src/Mod/Part/App/TopoShapeExpansion.cpp b/tests/src/Mod/Part/App/TopoShapeExpansion.cpp index 6524846570..81a2f4ee5a 100644 --- a/tests/src/Mod/Part/App/TopoShapeExpansion.cpp +++ b/tests/src/Mod/Part/App/TopoShapeExpansion.cpp @@ -124,9 +124,7 @@ TEST_F(TopoShapeExpansionTest, makeElementCompoundEmptyShapesReturnsEmptyCompoun // Assert EXPECT_EQ(TopAbs_ShapeEnum::TopAbs_COMPOUND, topoShape.getShape().ShapeType()); EXPECT_TRUE(topoShape.getMappedChildElements().empty()); -#if OCC_VERSION_HEX >= 0x070400 EXPECT_EQ(0, topoShape.getShape().TShape()->NbChildren()); -#endif } TEST_F(TopoShapeExpansionTest, makeElementCompoundTwoShapesGeneratesMap) @@ -1272,9 +1270,7 @@ TEST_F(TopoShapeExpansionTest, makeElementShellSingle) // Act TopoShape result = topoShape.makeElementShell(false, nullptr); // Assert -#if OCC_VERSION_HEX >= 0x070400 EXPECT_EQ(result.getShape().NbChildren(), 1); -#endif EXPECT_EQ(result.countSubElements("Vertex"), 4); EXPECT_EQ(result.countSubElements("Edge"), 4); EXPECT_EQ(result.countSubElements("Face"), 1); @@ -1300,9 +1296,7 @@ TEST_F(TopoShapeExpansionTest, makeElementShellOpen) // Act TopoShape result = topoShape.makeElementShell(true, nullptr); // Assert -#if OCC_VERSION_HEX >= 0x070400 EXPECT_EQ(result.getShape().NbChildren(), 2); -#endif EXPECT_EQ(result.countSubElements("Vertex"), 6); EXPECT_EQ(result.countSubElements("Edge"), 7); EXPECT_EQ(result.countSubElements("Face"), 2); @@ -1323,9 +1317,7 @@ TEST_F(TopoShapeExpansionTest, makeElementShellClosed) topoShape1.makeElementCompound(shapes, "D"); // Assert TopoShape result = topoShape1.makeElementShell(false, "SH1"); -#if OCC_VERSION_HEX >= 0x070400 EXPECT_EQ(result.getShape().NbChildren(), 6); -#endif EXPECT_EQ(result.countSubElements("Vertex"), 8); EXPECT_EQ(result.countSubElements("Edge"), 12); EXPECT_EQ(result.countSubElements("Face"), 6); @@ -1369,9 +1361,7 @@ TEST_F(TopoShapeExpansionTest, makeElementShellFromWires) topoShape1.makeElementCompound(shapes, "D"); // Assert TopoShape result = topoShape1.makeElementShellFromWires(shapes); -#if OCC_VERSION_HEX >= 0x070400 EXPECT_EQ(result.getShape().NbChildren(), 20); // Have a NbChildren method? -#endif EXPECT_EQ(result.countSubElements("Vertex"), 8); EXPECT_EQ(result.countSubElements("Edge"), 32); EXPECT_EQ(result.countSubElements("Face"), 20);