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
This commit is contained in:
mosfet80
2025-03-21 13:06:47 +01:00
committed by GitHub
parent 1c58b47f9b
commit 3026bd413d
25 changed files with 15 additions and 422 deletions

View File

@@ -42,9 +42,8 @@
#include <XCAFDoc_DocumentTool.hxx>
#include <XSControl_TransferReader.hxx>
#include <XSControl_WorkSession.hxx>
#if OCC_VERSION_HEX >= 0x070500
#include <Message_ProgressRange.hxx>
#endif
#if defined(__clang__)
#pragma clang diagnostic pop
#endif
@@ -62,7 +61,6 @@
#include <Mod/Part/App/Interface.h>
#include <Mod/Part/App/OCAF/ImportExportSettings.h>
#include <Mod/Part/App/PartFeaturePy.h>
#include <Mod/Part/App/ProgressIndicator.h>
#include <Mod/Part/App/TopoShapePy.h>
#include <Mod/Part/App/encodeFilename.h>

View File

@@ -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)

View File

@@ -26,7 +26,6 @@
#ifndef _PreComp_
#include <boost/core/ignore_unused.hpp>
#include <Standard_Version.hxx>
#if OCC_VERSION_HEX >= 0x070500
#include <BRep_Builder.hxx>
#include <Message_ProgressRange.hxx>
#include <Quantity_ColorRGBA.hxx>
@@ -39,7 +38,6 @@
#include <XCAFDoc_VisMaterial.hxx>
#include <XCAFDoc_VisMaterialTool.hxx>
#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)};
}

View File

@@ -39,7 +39,6 @@
#include <Base/Exception.h>
#include <App/Application.h>
#include <Mod/Part/App/encodeFilename.h>
#include <Mod/Part/App/ProgressIndicator.h>
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);

View File

@@ -34,7 +34,6 @@
#include "ReaderStep.h"
#include <Base/Exception.h>
#include <Mod/Part/App/encodeFilename.h>
#include <Mod/Part/App/ProgressIndicator.h>
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
}

View File

@@ -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;
}

View File

@@ -35,12 +35,8 @@
#include <Base/Console.h>
#include <Mod/Part/App/TopoShape.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)

View File

@@ -27,11 +27,9 @@
#include <boost/core/ignore_unused.hpp>
#include <Standard_Version.hxx>
#include <TColStd_IndexedDataMapOfStringString.hxx>
#if OCC_VERSION_HEX >= 0x070500
#include <Message_ProgressRange.hxx>
#include <RWGltf_CafWriter.hxx>
#endif
#endif
#include "WriterGltf.h"
#include <Base/Exception.h>
@@ -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
}

View File

@@ -71,7 +71,6 @@
#include <Mod/Part/App/ImportStep.h>
#include <Mod/Part/App/Interface.h>
#include <Mod/Part/App/OCAF/ImportExportSettings.h>
#include <Mod/Part/App/ProgressIndicator.h>
#include <Mod/Part/App/encodeFilename.h>
#include <Mod/Part/Gui/DlgExportStep.h>
#include <Mod/Part/Gui/DlgImportStep.h>