Add support for OCCT 7.8.0 (#11909)

This commit is contained in:
bgbsww
2024-01-09 20:47:25 -05:00
committed by GitHub
parent b1ee268d98
commit bd1fc0fc03
29 changed files with 161 additions and 35 deletions

View File

@@ -137,7 +137,12 @@ int Part::ImportStepParts(App::Document *pcDoc, const char* Name)
// This is a trick to access the GUI via Python and set the color property
// of the associated view provider. If no GUI is up an exception is thrown
// and cleared immediately
#if OCC_VERSION_HEX >= 0x070800
std::hash<TopoDS_Solid> hasher;
std::map<int, Quantity_Color>::iterator it = hash_col.find(hasher(aSolid));
#else
std::map<int, Quantity_Color>::iterator it = hash_col.find(aSolid.HashCode(INT_MAX));
#endif
if (it != hash_col.end()) {
try {
Py::Object obj(pcFeature->getPyObject(), true);

View File

@@ -1306,7 +1306,11 @@ PyObject* TopoShapePy::ancestorsOfType(PyObject *args)
TopTools_ListIteratorOfListOfShape it(ancestors);
for (; it.More(); it.Next()) {
// make sure to avoid duplicates
#if OCC_VERSION_HEX >= 0x070800
const size_t code = std::hash<TopoDS_Shape>{}(static_cast<TopoDS_Shape>(it.Value()));
#else
Standard_Integer code = it.Value().HashCode(INT_MAX);
#endif
if (hashes.find(code) == hashes.end()) {
list.append(shape2pyshape(it.Value()));
hashes.insert(code);
@@ -1928,7 +1932,11 @@ PyObject* TopoShapePy::hashCode(PyObject *args)
if (!PyArg_ParseTuple(args, "|i",&upper))
return nullptr;
#if OCC_VERSION_HEX >= 0x070800
int hc = std::hash<TopoDS_Shape>{}(getTopoShapePtr()->getShape());
#else
int hc = getTopoShapePtr()->getShape().HashCode(upper);
#endif
return Py_BuildValue("i", hc);
}

View File

@@ -24,7 +24,6 @@
#include "PreCompiled.h"
#ifndef _PreComp_
# include <Standard_math.hxx>
#endif
#include <Base/Console.h>

View File

@@ -26,7 +26,6 @@
# include <QFileInfo>
# include <QPointer>
# include <QString>
# include <Standard_math.hxx>
# include <Standard_Version.hxx>
# include <TopExp_Explorer.hxx>
# include <TopoDS_Shape.hxx>

View File

@@ -23,7 +23,6 @@
#include "PreCompiled.h"
#ifndef _PreComp_
# include <Standard_math.hxx>
# include <QInputDialog>
#endif

View File

@@ -28,7 +28,6 @@
# include <QKeyEvent>
# include <BRep_Builder.hxx>
# include <Standard_math.hxx>
# include <TopoDS.hxx>
# include <TopoDS_Compound.hxx>

View File

@@ -25,7 +25,6 @@
#ifndef _PreComp_
# include <cfloat>
# include <Standard_math.hxx>
# include <Inventor/nodes/SoAnnotation.h>
# include <Inventor/nodes/SoBaseColor.h>

View File

@@ -982,7 +982,11 @@ void ViewProviderPartExt::updateVisual()
TopExp_Explorer xp;
for (xp.Init(faceMap(i),TopAbs_EDGE);xp.More();xp.Next())
#if OCC_VERSION_HEX >= 0x070800
faceEdges.insert(std::hash<TopoDS_Shape>{}(xp.Current()));
#else
faceEdges.insert(xp.Current().HashCode(INT_MAX));
#endif
numFaces++;
}
@@ -1010,7 +1014,11 @@ void ViewProviderPartExt::updateVisual()
// So, we have to store the hashes of the edges associated to a face.
// If the hash of a given edge is not in this list we know it's really
// a free edge.
#if OCC_VERSION_HEX >= 0x070800
int hash = std::hash<TopoDS_Shape>{}(aEdge);
#else
int hash = aEdge.HashCode(INT_MAX);
#endif
if (faceEdges.find(hash) == faceEdges.end()) {
Handle(Poly_Polygon3D) aPoly = Part::Tools::polygonOfEdge(aEdge, aLoc);
if (!aPoly.IsNull()) {
@@ -1209,7 +1217,11 @@ void ViewProviderPartExt::updateVisual()
TopLoc_Location aLoc;
// handling of the free edge that are not associated to a face
#if OCC_VERSION_HEX >= 0x070800
int hash = std::hash<TopoDS_Shape>{}(aEdge);
#else
int hash = aEdge.HashCode(INT_MAX);
#endif
if (faceEdges.find(hash) == faceEdges.end()) {
Handle(Poly_Polygon3D) aPoly = Part::Tools::polygonOfEdge(aEdge, aLoc);
if (!aPoly.IsNull()) {

View File

@@ -24,7 +24,6 @@
#define PARTGUI_VIEWPROVIDERPARTEXT_H
#include <map>
#include <Standard_math.hxx>
#include <App/PropertyUnits.h>
#include <Gui/ViewProviderGeometryObject.h>

View File

@@ -27,7 +27,6 @@
# include <QMenu>
# include <QTimer>
# include <Standard_math.hxx>
# include <TopExp.hxx>
# include <TopTools_IndexedMapOfShape.hxx>

View File

@@ -22,7 +22,6 @@
#include "PreCompiled.h"
#include <Standard_math.hxx>
#ifndef _PreComp_
# include <Inventor/nodes/SoSeparator.h>
#endif

View File

@@ -24,7 +24,6 @@
#ifndef PARTGUI_ViewProviderPartReference_H
#define PARTGUI_ViewProviderPartReference_H
#include <Standard_math.hxx>
#include <Standard_Boolean.hxx>
#include <TopoDS_Shape.hxx>
#include <Gui/ViewProviderGeometryObject.h>