diff --git a/cMake/FindOCC.cmake b/cMake/FindOCC.cmake index 48e5c98750d4..90ab1af07cf2 100644 --- a/cMake/FindOCC.cmake +++ b/cMake/FindOCC.cmake @@ -127,8 +127,6 @@ if(OCC_FOUND) TKG2d TKG3d TKMath - TKIGES - TKSTL TKShHealing TKXSBase TKBool @@ -139,10 +137,6 @@ if(OCC_FOUND) TKGeomBase TKOffset TKPrim - TKSTEPBase - TKSTEPAttr - TKSTEP209 - TKSTEP TKHLR TKFeat ) @@ -154,8 +148,6 @@ if(OCC_FOUND) TKLCAF TKVCAF TKCDF - TKXDESTEP - TKXDEIGES TKMeshVS TKService TKV3d @@ -165,6 +157,12 @@ if(OCC_FOUND) elseif(NOT OCC_VERSION_STRING VERSION_LESS 7.5.0) list(APPEND OCC_OCAF_LIBRARIES TKRWMesh) endif(OCC_VERSION_STRING VERSION_LESS 6.7.3) + 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) + else(OCC_VERSION_STRING VERSION_LESS 7.8.0) + list(APPEND OCC_LIBRARIES TKDESTEP TKDEIGES TKDEGLTF TKDESTL) + endif(OCC_VERSION_STRING VERSION_LESS 7.8.0) message(STATUS "-- Found OCE/OpenCASCADE version: ${OCC_VERSION_STRING}") message(STATUS "-- OCE/OpenCASCADE include directory: ${OCC_INCLUDE_DIR}") message(STATUS "-- OCE/OpenCASCADE shared libraries directory: ${OCC_LIBRARY_DIR}") diff --git a/src/3rdParty/salomesmesh/inc/SMESHDS_DataMapOfShape.hxx b/src/3rdParty/salomesmesh/inc/SMESHDS_DataMapOfShape.hxx index 3e083cd84d78..67e9f91cde88 100644 --- a/src/3rdParty/salomesmesh/inc/SMESHDS_DataMapOfShape.hxx +++ b/src/3rdParty/salomesmesh/inc/SMESHDS_DataMapOfShape.hxx @@ -29,13 +29,26 @@ #include +#include + /* * This method needed for instance NCollection_DataMap with TopoDS_Shape as key */ +#if OCC_VERSION_HEX >= 0x070800 +struct SMESHDS_Hasher +{ + size_t operator()(const TopoDS_Shape& S) const noexcept { + return std::hash{}(S); + } + size_t operator()(const TopoDS_Shape& S1, const TopoDS_Shape& S2) const noexcept { + return S1.IsSame(S2); + } +}; +#else struct SMESHDS_Hasher { static inline Standard_Boolean IsEqual(const TopoDS_Shape& S1, - const TopoDS_Shape& S2) + const TopoDS_Shape& S2) { return S1.IsSame(S2); } @@ -45,6 +58,6 @@ struct SMESHDS_Hasher return ::HashCode( S, Upper); } }; - +#endif #endif diff --git a/src/3rdParty/salomesmesh/inc/SMESH_MeshVSLink.hxx b/src/3rdParty/salomesmesh/inc/SMESH_MeshVSLink.hxx index 3bc552eb23d3..6155e2053999 100644 --- a/src/3rdParty/salomesmesh/inc/SMESH_MeshVSLink.hxx +++ b/src/3rdParty/salomesmesh/inc/SMESH_MeshVSLink.hxx @@ -57,9 +57,6 @@ #ifndef _MeshVS_EntityType_HeaderFile #include #endif -#ifndef _Standard_Address_HeaderFile -#include -#endif #ifndef _TColStd_HArray1OfInteger_HeaderFile #include #endif diff --git a/src/3rdParty/salomesmesh/inc/SMESH_SMESH.hxx b/src/3rdParty/salomesmesh/inc/SMESH_SMESH.hxx index 1094aed0dfdd..a8fe257ea70f 100644 --- a/src/3rdParty/salomesmesh/inc/SMESH_SMESH.hxx +++ b/src/3rdParty/salomesmesh/inc/SMESH_SMESH.hxx @@ -37,4 +37,5 @@ #define SMESH_EXPORT #endif +#include #endif diff --git a/src/3rdParty/salomesmesh/inc/SMESH_SequenceOfNode.hxx b/src/3rdParty/salomesmesh/inc/SMESH_SequenceOfNode.hxx index ada6c8b98bf3..33c7203cc8d6 100644 --- a/src/3rdParty/salomesmesh/inc/SMESH_SequenceOfNode.hxx +++ b/src/3rdParty/salomesmesh/inc/SMESH_SequenceOfNode.hxx @@ -28,10 +28,11 @@ #include "SMESH_SMESH.hxx" -#include #if OCC_VERSION_HEX >= 0x060703 #include #include +#else +#include #endif typedef const SMDS_MeshNode* SMDS_MeshNodePtr; diff --git a/src/3rdParty/salomesmesh/inc/SMESH_TypeDefs.hxx b/src/3rdParty/salomesmesh/inc/SMESH_TypeDefs.hxx index ac7aa480d80b..7090537c466c 100644 --- a/src/3rdParty/salomesmesh/inc/SMESH_TypeDefs.hxx +++ b/src/3rdParty/salomesmesh/inc/SMESH_TypeDefs.hxx @@ -185,11 +185,18 @@ typedef std::vector< UVPtStruct > UVPtStructVec; // -------------------------------------------------------------------------------- // class SMESH_SequenceOfElemPtr +#include +#if OCC_VERSION_HEX >= 0x060703 +#include +#else #include +#endif class SMDS_MeshElement; typedef const SMDS_MeshElement* SMDS_MeshElementPtr; +#define DEFINE_SEQUENCE(_ClassName_, _BaseCollection_, TheItemType) \ +typedef NCollection_Sequence _ClassName_; DEFINE_SEQUENCE (SMESH_SequenceOfElemPtr, SMESH_BaseCollectionElemPtr, SMDS_MeshElementPtr) diff --git a/src/3rdParty/salomesmesh/src/DriverSTL/DriverSTL_R_SMDS_Mesh.cpp b/src/3rdParty/salomesmesh/src/DriverSTL/DriverSTL_R_SMDS_Mesh.cpp index ec3ea2e8e394..4b3791292a74 100644 --- a/src/3rdParty/salomesmesh/src/DriverSTL/DriverSTL_R_SMDS_Mesh.cpp +++ b/src/3rdParty/salomesmesh/src/DriverSTL/DriverSTL_R_SMDS_Mesh.cpp @@ -33,10 +33,33 @@ #include "SMDS_MeshNode.hxx" #include "SMESH_File.hxx" +#include + namespace { struct Hasher { +#if OCC_VERSION_HEX >= 0x070800 + size_t operator()(const gp_Pnt& point) const noexcept + { + union + { + Standard_Real R[3]; + Standard_Integer I[6]; + } U; + + point.Coord( U.R[0], U.R[1], U.R[2] ); + return std::hash{}(U.I[0]/23+U.I[1]/19+U.I[2]/17+U.I[3]/13+U.I[4]/11+U.I[5]/7); + } + + size_t operator()(const gp_Pnt& point1, const gp_Pnt& point2) const noexcept + { + static Standard_Real tab1[3], tab2[3]; + point1.Coord(tab1[0],tab1[1],tab1[2]); + point2.Coord(tab2[0],tab2[1],tab2[2]); + return (memcmp(tab1,tab2,sizeof(tab1)) == 0); + } +#else //======================================================================= //function : HashCode //purpose : @@ -51,9 +74,9 @@ namespace } U; point.Coord( U.R[0], U.R[1], U.R[2] ); - - return ::HashCode(U.I[0]/23+U.I[1]/19+U.I[2]/17+U.I[3]/13+U.I[4]/11+U.I[5]/7,Upper); + return std::hash{}(U.I[0]/23+U.I[1]/19+U.I[2]/17+U.I[3]/13+U.I[4]/11+U.I[5]/7); } + //======================================================================= //function : IsEqual //purpose : @@ -66,7 +89,9 @@ namespace point2.Coord(tab2[0],tab2[1],tab2[2]); return (memcmp(tab1,tab2,sizeof(tab1)) == 0); } +#endif }; + typedef NCollection_DataMap TDataMapOfPntNodePtr; const int HEADER_SIZE = 84; diff --git a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_Quadrangle_2D.cpp b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_Quadrangle_2D.cpp index 5d5c15c36612..5ebf9dbfb43c 100644 --- a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_Quadrangle_2D.cpp +++ b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_Quadrangle_2D.cpp @@ -48,7 +48,6 @@ #include #include #include -#include #include #include #include diff --git a/src/Mod/Fem/Gui/PreCompiled.h b/src/Mod/Fem/Gui/PreCompiled.h index 5f43e9f3cb9e..770895b32705 100644 --- a/src/Mod/Fem/Gui/PreCompiled.h +++ b/src/Mod/Fem/Gui/PreCompiled.h @@ -64,7 +64,6 @@ // OCC #include #include -#include #include #include diff --git a/src/Mod/Fem/Gui/TaskCreateNodeSet.cpp b/src/Mod/Fem/Gui/TaskCreateNodeSet.cpp index 4e69796b26fe..c1fb166ad143 100644 --- a/src/Mod/Fem/Gui/TaskCreateNodeSet.cpp +++ b/src/Mod/Fem/Gui/TaskCreateNodeSet.cpp @@ -26,9 +26,8 @@ # include # include -# include -# include -# include +#include +#include #endif #include diff --git a/src/Mod/Import/App/ImportOCAF.cpp b/src/Mod/Import/App/ImportOCAF.cpp index 12c3716910d2..13337a23bdb7 100644 --- a/src/Mod/Import/App/ImportOCAF.cpp +++ b/src/Mod/Import/App/ImportOCAF.cpp @@ -147,8 +147,12 @@ void ImportOCAF::loadShapes(const TDF_Label& label, const TopLoc_Location& loc, std::vector localValue; - if (aShapeTool->GetShape(label,aShape)) { + if (aShapeTool->GetShape(label, aShape)) { +#if OCC_VERSION_HEX >= 0x070800 + hash = std::hash {}(aShape); +#else hash = aShape.HashCode(HashUpper); +#endif } Handle(TDataStd_Name) name; @@ -217,8 +221,13 @@ void ImportOCAF::loadShapes(const TDF_Label& label, const TopLoc_Location& loc, if (isRef || myRefShapes.find(hash) == myRefShapes.end()) { TopoDS_Shape aShape; - if (isRef && aShapeTool->GetShape(label, aShape)) + if (isRef && aShapeTool->GetShape(label, aShape)) { +#if OCC_VERSION_HEX >= 0x070800 + myRefShapes.insert(std::hash {}(aShape)); +#else myRefShapes.insert(aShape.HashCode(HashUpper)); +#endif + } if (aShapeTool->IsSimpleShape(label) && (isRef || aShapeTool->IsFree(label))) { if (!asm_name.empty()) @@ -532,7 +541,11 @@ void ImportXCAF::createShape(const TopoDS_Shape& shape, bool perface, bool setna part->Label.setValue(default_name); part->Shape.setValue(shape); std::map::const_iterator jt; +#if OCC_VERSION_HEX >= 0x070800 + jt = myColorMap.find(std::hash {}(shape)); +#else jt = myColorMap.find(shape.HashCode(INT_MAX)); +#endif App::Color partColor(0.8f,0.8f,0.8f); #if 0//TODO @@ -553,7 +566,11 @@ void ImportXCAF::createShape(const TopoDS_Shape& shape, bool perface, bool setna // set label name if defined if (setname && !myNameMap.empty()) { std::map::const_iterator jt; +#if OCC_VERSION_HEX >= 0x070800 + jt = myNameMap.find(std::hash {}(shape)); +#else jt = myNameMap.find(shape.HashCode(INT_MAX)); +#endif if (jt != myNameMap.end()) { part->Label.setValue(jt->second); } @@ -573,7 +590,11 @@ void ImportXCAF::createShape(const TopoDS_Shape& shape, bool perface, bool setna faceColors.resize(faces.Extent(), partColor); xp.Init(shape,TopAbs_FACE); while (xp.More()) { +#if OCC_VERSION_HEX >= 0x070800 + jt = myColorMap.find(std::hash {}(xp.Current())); +#else jt = myColorMap.find(xp.Current().HashCode(INT_MAX)); +#endif if (jt != myColorMap.end()) { int index = faces.FindIndex(xp.Current()); faceColors[index-1] = convertColor(jt->second); @@ -607,24 +628,59 @@ void ImportXCAF::loadShapes(const TDF_Label& label) int ctSolids = 0, ctShells = 0, ctComps = 0; // add the shapes TopExp_Explorer xp; - for (xp.Init(aShape, TopAbs_SOLID); xp.More(); xp.Next(), ctSolids++) + for (xp.Init(aShape, TopAbs_SOLID); xp.More(); xp.Next(), ctSolids++) { +#if OCC_VERSION_HEX >= 0x070800 + this->mySolids[std::hash {}(xp.Current())] = (xp.Current()); +#else this->mySolids[xp.Current().HashCode(INT_MAX)] = (xp.Current()); - for (xp.Init(aShape, TopAbs_SHELL, TopAbs_SOLID); xp.More(); xp.Next(), ctShells++) +#endif + } + for (xp.Init(aShape, TopAbs_SHELL, TopAbs_SOLID); xp.More(); xp.Next(), ctShells++) { +#if OCC_VERSION_HEX >= 0x070800 + this->myShells[std::hash {}(xp.Current())] = (xp.Current()); +#else this->myShells[xp.Current().HashCode(INT_MAX)] = (xp.Current()); +#endif + } // if no solids and no shells were found then go for compounds if (ctSolids == 0 && ctShells == 0) { - for (xp.Init(aShape, TopAbs_COMPOUND); xp.More(); xp.Next(), ctComps++) + for (xp.Init(aShape, TopAbs_COMPOUND); xp.More(); xp.Next(), ctComps++) { +#if OCC_VERSION_HEX >= 0x070800 + this->myCompds[std::hash {}(xp.Current())] = (xp.Current()); +#else this->myCompds[xp.Current().HashCode(INT_MAX)] = (xp.Current()); +#endif + } } if (ctComps == 0) { - for (xp.Init(aShape, TopAbs_FACE, TopAbs_SHELL); xp.More(); xp.Next()) + for (xp.Init(aShape, TopAbs_FACE, TopAbs_SHELL); xp.More(); xp.Next()) { +#if OCC_VERSION_HEX >= 0x070800 + this->myShapes[std::hash {}(xp.Current())] = (xp.Current()); +#else this->myShapes[xp.Current().HashCode(INT_MAX)] = (xp.Current()); - for (xp.Init(aShape, TopAbs_WIRE, TopAbs_FACE); xp.More(); xp.Next()) +#endif + } + for (xp.Init(aShape, TopAbs_WIRE, TopAbs_FACE); xp.More(); xp.Next()) { +#if OCC_VERSION_HEX >= 0x070800 + this->myShapes[std::hash {}(xp.Current())] = (xp.Current()); +#else this->myShapes[xp.Current().HashCode(INT_MAX)] = (xp.Current()); - for (xp.Init(aShape, TopAbs_EDGE, TopAbs_WIRE); xp.More(); xp.Next()) +#endif + } + for (xp.Init(aShape, TopAbs_EDGE, TopAbs_WIRE); xp.More(); xp.Next()) { +#if OCC_VERSION_HEX >= 0x070800 + this->myShapes[std::hash {}(xp.Current())] = (xp.Current()); +#else this->myShapes[xp.Current().HashCode(INT_MAX)] = (xp.Current()); - for (xp.Init(aShape, TopAbs_VERTEX, TopAbs_EDGE); xp.More(); xp.Next()) +#endif + } + for (xp.Init(aShape, TopAbs_VERTEX, TopAbs_EDGE); xp.More(); xp.Next()) { +#if OCC_VERSION_HEX >= 0x070800 + this->myShapes[std::hash {}(xp.Current())] = (xp.Current()); +#else this->myShapes[xp.Current().HashCode(INT_MAX)] = (xp.Current()); +#endif + } } } @@ -634,7 +690,11 @@ void ImportXCAF::loadShapes(const TDF_Label& label) hColors->GetColor(label, XCAFDoc_ColorSurf, col) || hColors->GetColor(label, XCAFDoc_ColorCurv, col)) { // add defined color +#if OCC_VERSION_HEX >= 0x070800 + myColorMap[std::hash {}(aShape)] = col; +#else myColorMap[aShape.HashCode(INT_MAX)] = col; +#endif } else { // http://www.opencascade.org/org/forum/thread_17107/ @@ -644,7 +704,11 @@ void ImportXCAF::loadShapes(const TDF_Label& label) hColors->GetColor(it.Value(), XCAFDoc_ColorSurf, col) || hColors->GetColor(it.Value(), XCAFDoc_ColorCurv, col)) { // add defined color +#if OCC_VERSION_HEX >= 0x070800 + myColorMap[std::hash {}(it.Value())] = col; +#else myColorMap[it.Value().HashCode(INT_MAX)] = col; +#endif } } } @@ -656,9 +720,14 @@ void ImportXCAF::loadShapes(const TDF_Label& label) char* str = new char[extstr.LengthOfCString()+1]; extstr.ToUTF8CString(str); std::string labelName(str); - if (!labelName.empty()) + if (!labelName.empty()) { +#if OCC_VERSION_HEX >= 0x070800 + myNameMap[std::hash {}(aShape)] = labelName; +#else myNameMap[aShape.HashCode(INT_MAX)] = labelName; - delete [] str; +#endif + } + delete[] str; } #if 0 diff --git a/src/Mod/Import/App/ImportOCAF2.h b/src/Mod/Import/App/ImportOCAF2.h index e12ea6473629..98bb3cc4771b 100644 --- a/src/Mod/Import/App/ImportOCAF2.h +++ b/src/Mod/Import/App/ImportOCAF2.h @@ -30,7 +30,6 @@ #include #include -#include #include #include #include @@ -58,13 +57,21 @@ namespace Import { struct ShapeHasher { std::size_t operator()(const TopoDS_Shape &s) const { +#if OCC_VERSION_HEX >= 0x070800 + return std::hash{}(s); +#else return s.HashCode(INT_MAX); +#endif } }; struct LabelHasher { std::size_t operator()(const TDF_Label &l) const { +#if OCC_VERSION_HEX >= 0x070800 + return std::hash{}(l); +#else return TDF_LabelMapHasher::HashCode(l,INT_MAX); +#endif } }; diff --git a/src/Mod/MeshPart/App/CurveProjector.h b/src/Mod/MeshPart/App/CurveProjector.h index 4fb0d5ff375b..d9212a7e702a 100644 --- a/src/Mod/MeshPart/App/CurveProjector.h +++ b/src/Mod/MeshPart/App/CurveProjector.h @@ -32,6 +32,7 @@ #include #include +#include namespace MeshCore { @@ -60,16 +61,22 @@ class MeshPartExport CurveProjector Base::Vector3f p1,p2; }; - template - struct TopoDSLess { - bool operator()(const T& x, const T& y) const { - return x.HashCode(INT_MAX-1) < y.HashCode(INT_MAX-1); - } + template + struct TopoDSLess + { + bool operator()(const T& x, const T& y) const + { +#if OCC_VERSION_HEX >= 0x070800 + std::hash hasher; + return hasher(x) < hasher(y); +#else + return x.HashCode(INT_MAX - 1) < y.HashCode(INT_MAX - 1); +#endif + } }; using result_type = std::map,TopoDSLess >; - result_type &result() {return mvEdgeSplitPoints;} void writeIntersectionPointsToFile(const char *name="export_pts.asc"); @@ -79,7 +86,6 @@ class MeshPartExport CurveProjector const TopoDS_Shape &_Shape; const MeshKernel &_Mesh; result_type mvEdgeSplitPoints; - }; diff --git a/src/Mod/Part/App/AppPartPy.cpp b/src/Mod/Part/App/AppPartPy.cpp index fe14122395fc..67a67565702d 100644 --- a/src/Mod/Part/App/AppPartPy.cpp +++ b/src/Mod/Part/App/AppPartPy.cpp @@ -352,7 +352,11 @@ Standard_Boolean showTopoShape(const char *key, const TopoDS_Shape &s, const cha } if (!s.IsNull()) { char _name[256]; +#if OCC_VERSION_HEX >= 0x070800 + snprintf(_name, sizeof(_name), "%s_%x_", name, std::hash{}(s)); +#else snprintf(_name, sizeof(_name), "%s_%x_", name, s.HashCode(0xffff)); +#endif auto obj = Part::Feature::create(s, name); obj->Label.setValue(_name); } diff --git a/src/Mod/Part/App/ImportStep.cpp b/src/Mod/Part/App/ImportStep.cpp index 2d2c8a873873..b7314e1e87a2 100644 --- a/src/Mod/Part/App/ImportStep.cpp +++ b/src/Mod/Part/App/ImportStep.cpp @@ -141,7 +141,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 hasher; + std::map::iterator it = hash_col.find(hasher(aSolid)); +#else std::map::iterator it = hash_col.find(aSolid.HashCode(INT_MAX)); +#endif if (it != hash_col.end()) { try { Py::Object obj(pcFeature->getPyObject(), true); diff --git a/src/Mod/Part/App/OpenCascadeAll.h b/src/Mod/Part/App/OpenCascadeAll.h index 390dd55c80af..d393dc66c0c7 100644 --- a/src/Mod/Part/App/OpenCascadeAll.h +++ b/src/Mod/Part/App/OpenCascadeAll.h @@ -27,7 +27,6 @@ // Standard* #include -#include #include #include #include @@ -50,7 +49,6 @@ #include #include #include -#include #include #include #include diff --git a/src/Mod/Part/App/TopoShape.h b/src/Mod/Part/App/TopoShape.h index 4b0ed26875b3..d6cf6bc88813 100644 --- a/src/Mod/Part/App/TopoShape.h +++ b/src/Mod/Part/App/TopoShape.h @@ -45,6 +45,7 @@ #include #include +#include class BRepBuilderAPI_MakeShape; class BRepTools_History; @@ -2552,7 +2553,6 @@ class PartExport TopoShape : public Data::ComplexGeoData Standard_Boolean operator == (const TopoDS_Shape& other) const { return _Shape == other; } Standard_Boolean IsNotEqual (const TopoDS_Shape& other) const { return _Shape.IsNotEqual(other); } Standard_Boolean operator != (const TopoDS_Shape& other) const { return _Shape != other; } - Standard_Integer HashCode (const Standard_Integer Upper) const { return _Shape.HashCode(Upper); } TopoDS_Shape EmptyCopied() const { return _Shape.EmptyCopied(); } // Flag setters, probably not going to affect element map or cache. Pass @@ -2643,16 +2643,11 @@ struct hash { typedef Part::TopoShape argument_type; typedef std::size_t result_type; inline result_type operator()(argument_type const& s) const { +#if OCC_VERSION_HEX >= 0x070800 + return std::hash {}(s.getShape()); +#else return s.getShape().HashCode(INT_MAX); - } -}; - -template<> -struct hash { - typedef TopoDS_Shape argument_type; - typedef std::size_t result_type; - inline result_type operator()(argument_type const& s) const { - return s.HashCode(INT_MAX); +#endif } }; @@ -2664,10 +2659,18 @@ namespace Part { /// Shape hasher that ignore orientation struct ShapeHasher { inline size_t operator()(const TopoShape &s) const { +#if OCC_VERSION_HEX >= 0x070800 + return std::hash {}(s.getShape()); +#else return s.getShape().HashCode(INT_MAX); +#endif } inline size_t operator()(const TopoDS_Shape &s) const { +#if OCC_VERSION_HEX >= 0x070800 + return std::hash {}(s); +#else return s.HashCode(INT_MAX); +#endif } inline bool operator()(const TopoShape &a, const TopoShape &b) const { return a.getShape().IsSame(b.getShape()); @@ -2676,14 +2679,28 @@ struct ShapeHasher { return a.IsSame(b); } inline size_t operator()(const std::pair &s) const { +#if OCC_VERSION_HEX >= 0x070800 + std::hash hasher; + size_t res = hasher(s.first.getShape()); + Base::hash_combine(res, hasher(s.second.getShape())); + return res; +#else size_t res = s.first.getShape().HashCode(INT_MAX); Base::hash_combine(res, s.second.getShape().HashCode(INT_MAX)); return res; +#endif } inline size_t operator()(const std::pair &s) const { +#if OCC_VERSION_HEX >= 0x070800 + std::hash hasher; + size_t res = hasher(s.first); + Base::hash_combine(res, hasher(s.second)); + return res; +#else size_t res = s.first.HashCode(INT_MAX); Base::hash_combine(res, s.second.HashCode(INT_MAX)); return res; +#endif } inline bool operator()(const std::pair &a, const std::pair &b) const { diff --git a/src/Mod/Part/App/TopoShapeEx.cpp b/src/Mod/Part/App/TopoShapeEx.cpp index e206afcf436b..7fcf7d478642 100644 --- a/src/Mod/Part/App/TopoShapeEx.cpp +++ b/src/Mod/Part/App/TopoShapeEx.cpp @@ -2147,7 +2147,7 @@ void GenericShapeMapper::init(const TopoShape &src, const TopoDS_Shape &dst) if (src.findShape(dstFace)) continue; - std::unordered_map map; + std::unordered_map map; bool found = false; // Try to find a face in the src that shares at least two edges (or one @@ -5792,7 +5792,7 @@ TopoShape & TopoShape::makEBSplineFace(const std::vector &input, } static std::size_t -TopoShape_RefCountShapes(std::unordered_set &shapeSet, +TopoShape_RefCountShapes(std::unordered_set &shapeSet, const TopoDS_Shape& aShape) { std::size_t size = sizeof(Base::Placement); // rough estimate of location size @@ -5818,7 +5818,7 @@ std::size_t TopoShape::Cache::getMemSize() if (this->memsize || this->shape.IsNull()) return this->memsize; - std::unordered_set shapeSet; + std::unordered_set shapeSet; this->memsize = TopoShape_RefCountShapes(shapeSet, this->shape); for (const auto & shape : shapeSet) { diff --git a/src/Mod/Part/App/TopoShapePyImp.cpp b/src/Mod/Part/App/TopoShapePyImp.cpp index 866a243d3aeb..6fb903f5068c 100644 --- a/src/Mod/Part/App/TopoShapePyImp.cpp +++ b/src/Mod/Part/App/TopoShapePyImp.cpp @@ -127,7 +127,12 @@ static Py_hash_t _TopoShapeHash(PyObject *self) { PyErr_SetString(PyExc_ReferenceError, "This object is already deleted most likely through closing a document. This reference is no longer valid!"); return 0; } + +#if OCC_VERSION_HEX >= 0x070800 + return std::hash{}(static_cast(self)->getTopoShapePtr()->getShape()); +#else return static_cast(self)->getTopoShapePtr()->getShape().HashCode(INT_MAX); +#endif } struct TopoShapePyInit { @@ -159,7 +164,7 @@ int TopoShapePy::PyInit(PyObject* args, PyObject *keywds) PyObject *pyHasher = 0; const char *op = 0; PyObject *pcObj=0; - if (!PyArg_ParseTupleAndKeywords(args, keywds, "|OsiO!", + if (!PyArg_ParseTupleAndKeywords(args, keywds, "|OsiO!", kwlist,&pcObj,&op,&tag,&App::StringHasherPy::Type,&pyHasher)) return -1; auto &self = *getTopoShapePtr(); @@ -172,8 +177,8 @@ int TopoShapePy::PyInit(PyObject* args, PyObject *keywds) auto s = shapes.front(); if(self.Tag) { if((s.Tag && self.Tag!=s.Tag) - || (self.Hasher - && s.getElementMapSize() + || (self.Hasher + && s.getElementMapSize() && self.Hasher!=s.Hasher)) { s.reTagElementMap(self.Tag,self.Hasher); @@ -1294,7 +1299,11 @@ PyObject* TopoShapePy::ancestorsOfType(PyObject *args) std::vector shapes; for (; it.More(); it.Next()) { // make sure to avoid duplicates +#if OCC_VERSION_HEX >= 0x070800 + const size_t code = std::hash{}(static_cast(it.Value())); +#else Standard_Integer code = it.Value().HashCode(INT_MAX); +#endif if (hashes.find(code) == hashes.end()) { shapes.emplace_back(it.Value()); hashes.insert(code); @@ -1669,7 +1678,7 @@ PyObject* TopoShapePy::makeThickness(PyObject *args) try { #ifndef FC_NO_ELEMENT_MAP return Py::new_reference_to(shape2pyshape(getTopoShapePtr()->makEThickSolid( - getPyShapes(obj),offset,tolerance, PyObject_IsTrue(inter) ? true : false, + getPyShapes(obj),offset,tolerance, PyObject_IsTrue(inter) ? true : false, PyObject_IsTrue(self_inter) ? true : false, offsetMode, static_cast(join)))); #else TopTools_ListOfShape facesToRemove; @@ -1947,7 +1956,11 @@ PyObject* TopoShapePy::hashCode(PyObject *args) if (!PyArg_ParseTuple(args, "|i",&upper)) return nullptr; +#if OCC_VERSION_HEX >= 0x070800 + int hc = std::hash{}(getTopoShapePtr()->getShape()); +#else int hc = getTopoShapePtr()->getShape().HashCode(upper); +#endif return Py_BuildValue("i", hc); } diff --git a/src/Mod/Part/App/WireJoiner.cpp b/src/Mod/Part/App/WireJoiner.cpp index c36932082310..5d0cfb1af40b 100644 --- a/src/Mod/Part/App/WireJoiner.cpp +++ b/src/Mod/Part/App/WireJoiner.cpp @@ -653,8 +653,13 @@ class WireJoiner::WireJoinerP { for (auto vit=vmap.qbegin(bgi::nearest(p1,INT_MAX));vit!=vmap.qend();++vit) { auto &vinfo = *vit; - if (canShowShape()) + if (canShowShape()) { +#if OCC_VERSION_HEX >= 0x070800 + FC_MSG("addcheck " << std::hash{}(vinfo.edge())); +#else FC_MSG("addcheck " << vinfo.edge().HashCode(INT_MAX)); +#endif + } double d1 = vinfo.pt().SquareDistance(p1); if (d1 >= tol) break; @@ -2070,8 +2075,13 @@ class WireJoiner::WireJoinerP { if (FC_LOG_INSTANCE.level()>FC_LOGLEVEL_TRACE+1) { FC_MSG("init:"); - for (const auto &s : sourceEdges) + for (const auto &s : sourceEdges) { +#if OCC_VERSION_HEX >= 0x070800 + FC_MSG(s.getShape().TShape().get() << ", " << std::hash{}(s.getShape())); +#else FC_MSG(s.getShape().TShape().get() << ", " << s.getShape().HashCode(INT_MAX)); +#endif + } printHistory(aHistory, sourceEdges); printHistory(newHistory, inputEdges); } @@ -2083,7 +2093,11 @@ class WireJoiner::WireJoinerP { FC_MSG("final:"); for (int i=1; i<=wireData->NbEdges(); ++i) { auto s = wireData->Edge(i); +#if OCC_VERSION_HEX >= 0x070800 + FC_MSG(s.TShape().get() << ", " << std::hash{}(s)); +#else FC_MSG(s.TShape().get() << ", " << s.HashCode(INT_MAX)); +#endif } } return result; @@ -2095,8 +2109,13 @@ class WireJoiner::WireJoinerP { FC_MSG("\nHistory:\n"); for (const auto &s : input) { for(TopTools_ListIteratorOfListOfShape it(hist->Modified(s.getShape())); it.More(); it.Next()) { +#if OCC_VERSION_HEX >= 0x070800 + FC_MSG(s.getShape().TShape().get() << ", " << std::hash{}(s.getShape()) + << " -> " << it.Value().TShape().get() << ", " << std::hash{}(it.Value())); +#else FC_MSG(s.getShape().TShape().get() << ", " << s.getShape().HashCode(INT_MAX) << " -> " << it.Value().TShape().get() << ", " << it.Value().HashCode(INT_MAX)); +#endif } } } diff --git a/src/Mod/Part/Gui/AppPartGui.cpp b/src/Mod/Part/Gui/AppPartGui.cpp index e1846a1a2e65..0becbc2cfb8b 100644 --- a/src/Mod/Part/Gui/AppPartGui.cpp +++ b/src/Mod/Part/Gui/AppPartGui.cpp @@ -24,7 +24,6 @@ #include "PreCompiled.h" #ifndef _PreComp_ -# include #endif #include diff --git a/src/Mod/Part/Gui/Command.cpp b/src/Mod/Part/Gui/Command.cpp index a5cb171aab4c..34830609036f 100644 --- a/src/Mod/Part/Gui/Command.cpp +++ b/src/Mod/Part/Gui/Command.cpp @@ -26,7 +26,6 @@ # include # include # include -# include # include # include # include diff --git a/src/Mod/Part/Gui/CommandSimple.cpp b/src/Mod/Part/Gui/CommandSimple.cpp index dcecfa8bf2a6..74798aac53ca 100644 --- a/src/Mod/Part/Gui/CommandSimple.cpp +++ b/src/Mod/Part/Gui/CommandSimple.cpp @@ -23,7 +23,6 @@ #include "PreCompiled.h" #ifndef _PreComp_ -# include # include #endif diff --git a/src/Mod/Part/Gui/CrossSections.cpp b/src/Mod/Part/Gui/CrossSections.cpp index fb686f784a3a..856a43cd2f5c 100644 --- a/src/Mod/Part/Gui/CrossSections.cpp +++ b/src/Mod/Part/Gui/CrossSections.cpp @@ -28,7 +28,6 @@ # include # include -# include # include # include diff --git a/src/Mod/Part/Gui/ViewProvider2DObject.cpp b/src/Mod/Part/Gui/ViewProvider2DObject.cpp index 320feeff63b6..c9984a9adb8d 100644 --- a/src/Mod/Part/Gui/ViewProvider2DObject.cpp +++ b/src/Mod/Part/Gui/ViewProvider2DObject.cpp @@ -25,7 +25,6 @@ #ifndef _PreComp_ # include -# include # include # include diff --git a/src/Mod/Part/Gui/ViewProviderExt.h b/src/Mod/Part/Gui/ViewProviderExt.h index c31fd8be3114..650b048b0043 100644 --- a/src/Mod/Part/Gui/ViewProviderExt.h +++ b/src/Mod/Part/Gui/ViewProviderExt.h @@ -24,7 +24,6 @@ #define PARTGUI_VIEWPROVIDERPARTEXT_H #include -#include #include #include diff --git a/src/Mod/Part/Gui/ViewProviderMirror.cpp b/src/Mod/Part/Gui/ViewProviderMirror.cpp index 882ccfee8223..cd64bd4f86b8 100644 --- a/src/Mod/Part/Gui/ViewProviderMirror.cpp +++ b/src/Mod/Part/Gui/ViewProviderMirror.cpp @@ -27,7 +27,6 @@ # include # include -# include # include # include diff --git a/src/Mod/Part/Gui/ViewProviderPython.cpp b/src/Mod/Part/Gui/ViewProviderPython.cpp index e7fa75fe1ba3..1b6a1ff8d409 100644 --- a/src/Mod/Part/Gui/ViewProviderPython.cpp +++ b/src/Mod/Part/Gui/ViewProviderPython.cpp @@ -22,7 +22,6 @@ #include "PreCompiled.h" -#include #ifndef _PreComp_ # include #endif diff --git a/src/Mod/Part/Gui/ViewProviderReference.h b/src/Mod/Part/Gui/ViewProviderReference.h index b7a0219b3b23..af40af2fae65 100644 --- a/src/Mod/Part/Gui/ViewProviderReference.h +++ b/src/Mod/Part/Gui/ViewProviderReference.h @@ -24,7 +24,6 @@ #ifndef PARTGUI_ViewProviderPartReference_H #define PARTGUI_ViewProviderPartReference_H -#include #include #include #include diff --git a/src/Mod/Path/App/Voronoi.cpp b/src/Mod/Path/App/Voronoi.cpp index 27a509c20c07..443b7475075a 100644 --- a/src/Mod/Path/App/Voronoi.cpp +++ b/src/Mod/Path/App/Voronoi.cpp @@ -22,7 +22,8 @@ #include "PreCompiled.h" #ifndef _PreComp_ -# include +#define _USE_MATH_DEFINES +# include #endif #include diff --git a/src/Mod/Path/Gui/PreCompiled.h b/src/Mod/Path/Gui/PreCompiled.h index c5e557f9ad60..b8537bd58648 100644 --- a/src/Mod/Path/Gui/PreCompiled.h +++ b/src/Mod/Path/Gui/PreCompiled.h @@ -38,8 +38,6 @@ # define PathGuiExport #endif -#include - #ifdef _MSC_VER # pragma warning( disable : 4273 ) #endif diff --git a/src/Mod/Robot/Gui/PreCompiled.h b/src/Mod/Robot/Gui/PreCompiled.h index eb2a061446e4..e5496201ecec 100644 --- a/src/Mod/Robot/Gui/PreCompiled.h +++ b/src/Mod/Robot/Gui/PreCompiled.h @@ -38,8 +38,6 @@ # define RobotGuiExport #endif -#include - #ifdef _MSC_VER # pragma warning(disable : 4005) # pragma warning(disable : 4273) diff --git a/src/Mod/Sandbox/Gui/AppSandboxGui.cpp b/src/Mod/Sandbox/Gui/AppSandboxGui.cpp index 14664b6ae916..049873c93219 100644 --- a/src/Mod/Sandbox/Gui/AppSandboxGui.cpp +++ b/src/Mod/Sandbox/Gui/AppSandboxGui.cpp @@ -24,7 +24,6 @@ #include "PreCompiled.h" #ifndef _PreComp_ # include -# include # include # include # include diff --git a/src/Mod/Sketcher/Gui/EditDatumDialog.cpp b/src/Mod/Sketcher/Gui/EditDatumDialog.cpp index aab3dcb78b94..60d78720103f 100644 --- a/src/Mod/Sketcher/Gui/EditDatumDialog.cpp +++ b/src/Mod/Sketcher/Gui/EditDatumDialog.cpp @@ -23,7 +23,6 @@ #include "PreCompiled.h" #ifndef _PreComp_ -# include /// Qt Include Files # include # include diff --git a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp index 97eccec2d54d..bbdc498da4ed 100755 --- a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp +++ b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp @@ -27,7 +27,6 @@ #ifndef _PreComp_ # include # include -# include # include # include # include