From ae1fb6e262c9856bed693d8ceb89586dfd28dde3 Mon Sep 17 00:00:00 2001 From: jfa Date: Mon, 15 Jan 2024 13:35:35 +0000 Subject: [PATCH] Porting to OCCT 7.8.0 --- src/DDS/DDS.h | 1 - src/DDS/DDS_DicItem.h | 2 +- src/OCCViewer/OCCViewer_VService.h | 1 - src/SVTK/SVTK_Hash.h | 56 ++++++++++++++++++++++++++++++ 4 files changed, 57 insertions(+), 3 deletions(-) diff --git a/src/DDS/DDS.h b/src/DDS/DDS.h index c678aa002..bcd657483 100644 --- a/src/DDS/DDS.h +++ b/src/DDS/DDS.h @@ -24,7 +24,6 @@ #define DDS_H #include -#include #define UNIT_SYSTEM_SI "SI" diff --git a/src/DDS/DDS_DicItem.h b/src/DDS/DDS_DicItem.h index 0e4e27fa3..80e6a8594 100644 --- a/src/DDS/DDS_DicItem.h +++ b/src/DDS/DDS_DicItem.h @@ -33,7 +33,7 @@ #include #include -#include +#include #include #include diff --git a/src/OCCViewer/OCCViewer_VService.h b/src/OCCViewer/OCCViewer_VService.h index b72ae1c06..dc45788a7 100644 --- a/src/OCCViewer/OCCViewer_VService.h +++ b/src/OCCViewer/OCCViewer_VService.h @@ -28,7 +28,6 @@ #include #include #include -#include #include #include diff --git a/src/SVTK/SVTK_Hash.h b/src/SVTK/SVTK_Hash.h index 081ddbf79..a6e258ff4 100644 --- a/src/SVTK/SVTK_Hash.h +++ b/src/SVTK/SVTK_Hash.h @@ -34,9 +34,12 @@ #include #include +#include + typedef std::vector SVTK_ListOfInteger; typedef std::vector SVTK_ListOfVtk; +#if OCC_VERSION_LARGE < 0x07080000 class SVTK_Hasher { public: @@ -90,6 +93,59 @@ struct svtkIdHasher } }; +#else + +class SVTK_Hasher { + +public: + size_t operator()(const std::vector ids) const + { + Standard_Integer seed = (Standard_Integer)ids.size(); + for ( Standard_Integer v : ids ) + seed ^= v + 0x9e3779b9 + ( seed << 6 ) + ( seed >> 2 ); + return (size_t)(seed & IntegerLast()); + } + + bool operator()(const SVTK_ListOfInteger& theKey1, + const SVTK_ListOfInteger& theKey2) const + { + return theKey1 == theKey2; + } +}; + +class SVTK_vtkHasher { + +public: + size_t operator()(const std::vector ids) const + { + vtkIdType seed = (vtkIdType)ids.size(); + for ( vtkIdType v : ids ) + seed ^= v + 0x9e3779b97f4a7c15 + ( seed << 6 ) + ( seed >> 2 ); + return (size_t)(seed & (std::numeric_limits::max)()); + } + + bool operator()(const SVTK_ListOfVtk& theKey1, + const SVTK_ListOfVtk& theKey2) const + { + return theKey1 == theKey2; + } +}; + +struct svtkIdHasher +{ + size_t operator()(const vtkIdType theValue) const + { + return (size_t)(theValue & (std::numeric_limits::max)()); + } + + bool operator()(const vtkIdType& id1, const vtkIdType& id2) const + { + return id1 == id2; + } +}; + +#endif // OCC_VERSION_LARGE < 0x07080000 + typedef NCollection_IndexedMap SVTK_IndexedMapOfIds; typedef NCollection_IndexedMap SVTK_IndexedMapOfVtkIds; typedef NCollection_Map< vtkIdType, svtkIdHasher > SVTK_TVtkIDsMap; -- 2.39.2