From 7d67c319eca93e16ec5544dcdcdebec6d19a0c04 Mon Sep 17 00:00:00 2001 From: "Zheng, Lei" Date: Tue, 16 Jan 2024 22:43:39 -0500 Subject: [PATCH] Restore RT hash code for OCC < 7.8.0 --- src/Mod/Part/App/TopoShapeMapper.h | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/Mod/Part/App/TopoShapeMapper.h b/src/Mod/Part/App/TopoShapeMapper.h index 736aebc21c..f7f4a8e92a 100644 --- a/src/Mod/Part/App/TopoShapeMapper.h +++ b/src/Mod/Part/App/TopoShapeMapper.h @@ -2,6 +2,7 @@ #include #include +#include #include #include #include "TopoShape.h" @@ -17,11 +18,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()); - // return TopTools_ShapeMapHasher{}(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()); @@ -37,13 +45,23 @@ struct ShapeHasher { seed ^= hasher(v) + 0x9e3779b9 + (seed<<6) + (seed>>2); } inline size_t operator()(const std::pair &s) const { +#if OCC_VERSION_HEX >= 0x070800 size_t res = std::hash {}(s.first.getShape()); hash_combine(res, std::hash {}(s.second.getShape())); +#else + size_t res = s.first.getShape().HashCode(INT_MAX); + hash_combine(res, s.second.getShape().HashCode(INT_MAX)); +#endif return res; } inline size_t operator()(const std::pair &s) const { +#if OCC_VERSION_HEX >= 0x070800 size_t res = std::hash {}(s.first); hash_combine(res, std::hash {}(s.second)); +#else + size_t res = s.first.HashCode(INT_MAX); + hash_combine(res, s.second.HashCode(INT_MAX)); +#endif return res; } inline bool operator()(const std::pair &a,