]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Porting to OCCT 7.8.0
authorjfa <jfa@opencascade.com>
Mon, 15 Jan 2024 13:35:35 +0000 (13:35 +0000)
committerNabil Ghodbane <nabil.ghodbane@cea.fr>
Tue, 21 May 2024 11:56:06 +0000 (13:56 +0200)
src/DDS/DDS.h
src/DDS/DDS_DicItem.h
src/LightApp/LightApp_Application.cxx
src/OCCViewer/OCCViewer_VService.h
src/OCCViewer/OCCViewer_ViewPort3d.cxx
src/SALOME_PY/SalomePy.cxx
src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx
src/SVTK/SVTK_Hash.h
src/SalomeApp/SalomeApp_Application.cxx

index e66c62c4095d4d4c05b06c22bcde8a74ee68bfb5..237e3c3a95e29b759294fef78adb4d2aa3769486 100644 (file)
@@ -24,7 +24,6 @@
 #define DDS_H
 
 #include <TCollection_AsciiString.hxx>
-#include <NCollection_DefineDataMap.hxx>
 
 #define UNIT_SYSTEM_SI "SI"
 
index 49a51e50c2d1252aee544a5becc147884ba54304..8fb19463bd24fc248c835461d7ea9f27cd378297 100644 (file)
@@ -33,7 +33,7 @@
 #include <TColStd_HArray1OfExtendedString.hxx>
 
 #include <NCollection_DataMap.hxx>
-#include <NCollection_DefineIndexedDataMap.hxx>
+#include <NCollection_IndexedDataMap.hxx>
 
 #include <TColStd_MapOfReal.hxx>
 #include <TColStd_SequenceOfInteger.hxx>
index c897f7930603076da90bf0236e4c387d4ac5a7a6..63e2510f38625963a814844a08b7959a1111e5e1 100644 (file)
@@ -27,7 +27,7 @@
 // E.A. : On windows with python 2.6, there is a conflict
 // E.A. : between pymath.h and Standard_math.h which define
 // E.A. : some same symbols : acosh, asinh, ...
-  #include <Standard_math.hxx>
+  #include <Standard_Real.hxx>
   #ifndef DISABLE_PYCONSOLE
     #include <Python.h>
     #include <pymath.h>
index 9afe8d5edadd548f562aa9094afd391b692b1bb0..cd24387ae04c8bd3bb2f6a00abf14b0b9a15c0e9 100644 (file)
@@ -28,7 +28,6 @@
 #include <V3d_Viewer.hxx>
 #include <Standard_Boolean.hxx>
 #include <Standard_CString.hxx>
-#include <Standard_ExtString.hxx>
 #include <V3d_TypeOfOrientation.hxx>
 
 #include <QWidget>
index 23cf8b4ede411af4bcffb8d973a847381e0c6647..7e7b26c13ed1edfb8f7dd308528b4954d7839ea1 100644 (file)
@@ -58,7 +58,7 @@ static int sx = 0;
 static int sy = 0;
 static Standard_Boolean zRotation = Standard_False;
 
-//#include <Standard_Version.hxx>
+#include <Basics_OCCTVersion.hxx>
 
 /*!
   Constructor
@@ -324,28 +324,28 @@ void OCCViewer_ViewPort3d::updateBackground()
        activeView()->SetBgImageStyle( Aspect_FM_NONE );    // cancel texture background
        switch ( type ) {
        case OCCViewer_Viewer::HorizontalGradient:
-         activeView()->SetBgGradientColors( qCol1, qCol2, Aspect_GFM_HOR, Standard_True );
+         activeView()->SetBgGradientColors( qCol1, qCol2, Aspect_GradientFillMethod_Horizontal, Standard_True );
          break;
        case OCCViewer_Viewer::VerticalGradient:
-         activeView()->SetBgGradientColors( qCol1, qCol2, Aspect_GFM_VER, Standard_True );
+         activeView()->SetBgGradientColors( qCol1, qCol2, Aspect_GradientFillMethod_Vertical, Standard_True );
          break;
        case OCCViewer_Viewer::Diagonal1Gradient:
-         activeView()->SetBgGradientColors( qCol1, qCol2, Aspect_GFM_DIAG1, Standard_True );
+         activeView()->SetBgGradientColors( qCol1, qCol2, Aspect_GradientFillMethod_Diagonal1, Standard_True );
          break;
        case OCCViewer_Viewer::Diagonal2Gradient:
-         activeView()->SetBgGradientColors( qCol1, qCol2, Aspect_GFM_DIAG2, Standard_True );
+         activeView()->SetBgGradientColors( qCol1, qCol2, Aspect_GradientFillMethod_Diagonal2, Standard_True );
          break;
        case OCCViewer_Viewer::Corner1Gradient:
-         activeView()->SetBgGradientColors( qCol1, qCol2, Aspect_GFM_CORNER1, Standard_True );
+         activeView()->SetBgGradientColors( qCol1, qCol2, Aspect_GradientFillMethod_Corner1, Standard_True );
          break;
        case OCCViewer_Viewer::Corner2Gradient:
-         activeView()->SetBgGradientColors( qCol1, qCol2, Aspect_GFM_CORNER2, Standard_True );
+         activeView()->SetBgGradientColors( qCol1, qCol2, Aspect_GradientFillMethod_Corner2, Standard_True );
          break;
        case OCCViewer_Viewer::Corner3Gradient:
-         activeView()->SetBgGradientColors( qCol1, qCol2, Aspect_GFM_CORNER3, Standard_True );
+         activeView()->SetBgGradientColors( qCol1, qCol2, Aspect_GradientFillMethod_Corner3, Standard_True );
          break;
        case OCCViewer_Viewer::Corner4Gradient:
-         activeView()->SetBgGradientColors( qCol1, qCol2, Aspect_GFM_CORNER4, Standard_True );
+         activeView()->SetBgGradientColors( qCol1, qCol2, Aspect_GradientFillMethod_Corner4, Standard_True );
          break;
        default:
          break;
@@ -760,6 +760,26 @@ void OCCViewer_ViewPort3d::attachWindow( const Handle(V3d_View)& view,
                                          const Handle(Aspect_Window)& window)
 {
   if (!view.IsNull()) {
+#if OCC_VERSION_LARGE > 0x07070000
+    // Workaround for OCCT bug 33647 (porting to OCCT 7.8.0 regression).
+    if (myBackground.isValid()) {
+      if (myBackground.mode() == Qtx::SimpleGradientBackground) {
+        QColor c1, c2;
+        int type = myBackground.gradient(c1, c2);
+        if (type >= OCCViewer_Viewer::Corner1Gradient &&
+            type <= OCCViewer_Viewer::Corner4Gradient) {
+          if (!c2.isValid()) c2 = c1;
+          Quantity_Color qCol1 (c1.red()/255., c1.green()/255., c1.blue()/255., Quantity_TOC_RGB);
+          Quantity_Color qCol2 (c2.red()/255., c2.green()/255., c2.blue()/255., Quantity_TOC_RGB);
+          view->SetBgImageStyle(Aspect_FM_NONE);    // cancel texture background
+          // Set first horizontal gradient background, as first
+          // initialization with corner gradient leads to a bug.
+         //view->SetBgGradientColors(qCol1, qCol2, Aspect_GradientFillMethod_Horizontal, Standard_True);
+         view->SetBgGradientColors(qCol1, qCol2, Aspect_GradientFillMethod_Horizontal);
+        }
+      }
+    }
+#endif
     view->SetWindow( window );
     updateBackground();
   }
index 7e9138f12e10bdc306ff25693fd5c4cd7dd7fd13..fae147331eda48cd3045429425c50552588f4382 100644 (file)
 // E.A. : On windows with python 2.6, there is a conflict
 // E.A. : between pymath.h and Standard_math.h which define
 // E.A. : some same symbols : acosh, asinh, ...
-#include <Standard_math.hxx>
- #include <Python.h>
- #include <pymath.h>
+#include <Standard_Real.hxx>
+#include <Python.h>
+#include <pymath.h>
 #endif
 
-#include <Python.h>
 #include <vtkPythonUtil.h>
 
 #include <vtkVersion.h>
index 322b4323b2073c2fcb1da725159db99848d0a7f4..14ecb3ac1cbf588841bc652419072000a4d03295 100644 (file)
@@ -27,7 +27,7 @@
 // E.A. : On windows with python 2.6, there is a conflict
 // E.A. : between pymath.h and Standard_math.h which define
 // E.A. : some same symbols : acosh, asinh, ...
-#include <Standard_math.hxx>
+#include <Standard_Real.hxx>
  #include <Python.h>
  #include <pymath.h>
 #endif
index 990848bf900587b2fa51f4a976b8077c0b76134f..5d65de6b052c9fbb47e225c3091008d899da410b 100644 (file)
 #include <vtkType.h>
 #include <limits>
 
+#include <Basics_OCCTVersion.hxx>
+
 typedef std::vector<Standard_Integer> SVTK_ListOfInteger;
 typedef std::vector<vtkIdType> 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<Standard_Integer> 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<vtkIdType> 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<vtkIdType>::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<vtkIdType>::max)());
+  }
+
+  bool operator()(const vtkIdType& id1, const vtkIdType& id2) const
+  {
+    return id1 == id2;
+  }
+};
+
+#endif // OCC_VERSION_LARGE < 0x07080000
+
 typedef NCollection_IndexedMap<SVTK_ListOfInteger,SVTK_Hasher> SVTK_IndexedMapOfIds;
 typedef NCollection_IndexedMap<SVTK_ListOfVtk, SVTK_vtkHasher> SVTK_IndexedMapOfVtkIds;
 typedef NCollection_Map< vtkIdType, svtkIdHasher > SVTK_TVtkIDsMap;
index a8300ea62c7789956cb0aa22830b6fc367cd68bf..6a5847fd431e1be8e175032219eb191ac1281e78 100644 (file)
@@ -28,7 +28,7 @@
   // E.A. : On windows with python 2.6, there is a conflict
   // E.A. : between pymath.h and Standard_math.h which define
   // E.A. : some same symbols : acosh, asinh, ...
-  #include <Standard_math.hxx>
+  #include <Standard_Real.hxx>
   #ifndef DISABLE_PYCONSOLE
     #include <Python.h>
     #include <pymath.h>