]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Try run TInspector with OCCT 7.7.0 (MessageView not working) TInspector_with_OCCT_7.7.0
authorasozinov <alexey.sozinov@opencascade.com>
Mon, 3 Apr 2023 11:25:46 +0000 (12:25 +0100)
committerasozinov <alexey.sozinov@opencascade.com>
Mon, 3 Apr 2023 11:25:46 +0000 (12:25 +0100)
CMakeCommon/FindTInspector.cmake
src/XGUI/XGUI_Displayer.cpp
src/XGUI/XGUI_Displayer.h
src/XGUI/XGUI_SelectionActivate.cpp
src/XGUI/XGUI_SelectionMgr.cpp
src/XGUI/XGUI_Workshop.cpp

index 223f6855b8f12bee0c3ec43b922ca04067e3d686..7b36e9bf44b23284604eb44a92c9f3fefecdc064 100644 (file)
@@ -27,7 +27,7 @@
 SET(TINSPECTOR_ROOT_DIR $ENV{TINSPECTOR_ROOT_DIR} CACHE PATH "Path to the TInspector directory")
 IF(EXISTS ${TINSPECTOR_ROOT_DIR})
   SET(TINSPECTOR_INCLUDE_DIR "${TINSPECTOR_ROOT_DIR}/inc")
-  SET(TINSPECTOR_LIB_DIR "${TINSPECTOR_ROOT_DIR}/lib")
+  SET(TINSPECTOR_LIB_DIR "${TINSPECTOR_ROOT_DIR}/win64/vc14/lib")
 
   FIND_LIBRARY(TKTInspector TKTInspector "${TINSPECTOR_LIB_DIR}")
   IF(TKTInspector)
index 2a7b07c1d0b7923a925a68449cb331b88c4fe18b..01a0173b6791475bebde96813d1d99ea2ef09456 100644 (file)
 #include <Standard_Version.hxx>
 
 #ifdef TINSPECTOR
+#if OCC_VERSION_LARGE < 0x07070000
 #include <inspector/VInspectorAPI_CallBack.hxx>
+#else
+#include <inspector/MessageView_Communicator.hxx>
+#include <inspector/MessageView_ActionsTest.hxx>
+#include <inspector/MessageView_MetricStatisticModel.hxx>
+#include <inspector/MessageView_VisibilityState.hxx>
+#include <inspector/MessageView_Window.hxx>
+#include <Message_Msg.hxx>
+#include <Message_Report.hxx>
+#endif
 #endif
 
 #include <Events_Loop.h>
@@ -230,7 +240,11 @@ bool XGUI_Displayer::display(ObjectPtr theObject, AISObjectPtr theAIS,
       aContext->SetDisplayPriority(anAISIO, FRONT_DISPLAY_PRIORITY);
     }
     #ifdef TINSPECTOR
+    #if OCC_VERSION_LARGE < 0x07070000
     if (getCallBack()) getCallBack()->Display(anAISIO);
+    #else
+    if (getCallBack()) getCallBack()->Send("Display", Message_Info);
+    #endif
     #endif
     aDisplayed = true;
 
@@ -262,7 +276,11 @@ bool XGUI_Displayer::erase(ObjectPtr theObject, const bool theUpdateViewer)
       emit beforeObjectErase(theObject, anObject);
       aContext->Remove(anAIS, false/*update viewer*/);
       #ifdef TINSPECTOR
+      #if OCC_VERSION_LARGE < 0x07070000
       if (getCallBack()) getCallBack()->Remove(anAIS);
+      #else
+      if (getCallBack()) getCallBack()->Send("Remove", Message_Info);
+      #endif
       #endif
       aErased = true;
     }
@@ -363,7 +381,11 @@ bool XGUI_Displayer::redisplay(ObjectPtr theObject, bool theUpdateViewer)
       aContext->Display(aAISIO, false);
     }
       #ifdef TINSPECTOR
-      if (getCallBack()) getCallBack()->Redisplay(aAISIO);
+    #if OCC_VERSION_LARGE < 0x07070000
+    if (getCallBack()) getCallBack()->Redisplay(aAISIO);
+    #else
+    if (getCallBack()) getCallBack()->Send("Redisplay", Message_Info);
+    #endif
       #endif
 
       //if (aNeedToRestoreSelection)
@@ -465,7 +487,11 @@ void XGUI_Displayer::setSelected(const  QList<ModuleBase_ViewerPrsPtr>& theValue
   aContext->UnhilightSelected(false);
   aContext->ClearSelected(false);
   #ifdef TINSPECTOR
+  #if OCC_VERSION_LARGE < 0x07070000
   if (getCallBack()) getCallBack()->ClearSelected();
+  #else
+  if (getCallBack()) getCallBack()->Send("ClearSelected", Message_Info);
+  #endif
   #endif
   NCollection_DataMap<TopoDS_Shape, NCollection_Map<Handle(AIS_InteractiveObject)>>
     aShapesToBeSelected;
@@ -480,7 +506,12 @@ void XGUI_Displayer::setSelected(const  QList<ModuleBase_ViewerPrsPtr>& theValue
       // it might belong to another result
       aContext->AddOrRemoveSelected(aShape, false);
       #ifdef TINSPECTOR
+
+      #if OCC_VERSION_LARGE < 0x07070000
       if (getCallBack()) getCallBack()->AddOrRemoveSelected(aShape);
+      #else
+      if (getCallBack()) getCallBack()->Send("AddOrRemoveSelected", Message_Info);
+      #endif
       #endif
 #else
       NCollection_Map<Handle(AIS_InteractiveObject)> aPresentations;
@@ -488,7 +519,13 @@ void XGUI_Displayer::setSelected(const  QList<ModuleBase_ViewerPrsPtr>& theValue
         aPresentations = aShapesToBeSelected.Find(aShape);
       ObjectPtr anObject = aPrs->object();
       getPresentations(anObject, aPresentations);
-
+#ifdef TINSPECTOR
+      #if OCC_VERSION_LARGE < 0x07070000
+      if (getCallBack()) getCallBack()->AddOrRemoveSelected(aShape);
+      #else
+      if (getCallBack()) getCallBack()->Send("AddOrRemoveSelected", Message_Info);
+      #endif
+#endif
       aShapesToBeSelected.Bind(aShape, aPresentations);
 #endif
     } else {
@@ -505,7 +542,11 @@ void XGUI_Displayer::setSelected(const  QList<ModuleBase_ViewerPrsPtr>& theValue
           // The selection in the context was cleared, so the method sets the objects are selected
           aContext->AddOrRemoveSelected(anAIS, false);
           #ifdef TINSPECTOR
+          #if OCC_VERSION_LARGE < 0x07070000
           if (getCallBack()) getCallBack()->AddOrRemoveSelected(anAIS);
+          #else
+          if (getCallBack()) getCallBack()->Send("AddOrRemoveSelected", Message_Info);
+          #endif
           #endif
         }
       }
@@ -526,7 +567,11 @@ void XGUI_Displayer::clearSelected(const bool theUpdateViewer)
     aContext->UnhilightSelected(false);//UnhilightCurrents(false);
     aContext->ClearSelected(theUpdateViewer);
     #ifdef TINSPECTOR
+    #if OCC_VERSION_LARGE < 0x07070000
     if (getCallBack()) getCallBack()->ClearSelected();
+    #else
+    if (getCallBack()) getCallBack()->Send("ClearSelected", Message_Info);
+    #endif
     #endif
   }
 }
@@ -550,7 +595,11 @@ bool XGUI_Displayer::eraseAll(const bool theUpdateViewer)
         emit beforeObjectErase(aObj, aAISObj);
         aContext->Remove(anIO, false/*update viewer*/);
         #ifdef TINSPECTOR
+        #if OCC_VERSION_LARGE < 0x07070000
         if (getCallBack()) getCallBack()->Remove(anIO);
+        #else
+        if (getCallBack()) getCallBack()->Send("Remove", Message_Info);
+        #endif
         #endif
         aErased = true;
       }
@@ -725,17 +774,32 @@ bool XGUI_Displayer::displayAIS(AISObjectPtr theAIS, const bool toActivateInSele
   if (!aContext.IsNull() && !anAISIO.IsNull()) {
     aContext->Display(anAISIO, theDisplayMode, 0, false/*update viewer*/, AIS_DS_Displayed);
     #ifdef TINSPECTOR
+    #if OCC_VERSION_LARGE < 0x07070000
     if (getCallBack()) getCallBack()->Display(anAISIO);
+    #else
+    if (getCallBack()) getCallBack()->Send("Display", Message_Info);
     #endif
+    #endif
+
     aDisplayed = true;
     aContext->Deactivate(anAISIO);
     #ifdef TINSPECTOR
+    #if OCC_VERSION_LARGE < 0x07070000
     if (getCallBack()) getCallBack()->Deactivate(anAISIO);
+    #else
+    if (getCallBack()) getCallBack()->Send("Deactivate", Message_Info);
+    #endif
     #endif
+
     aContext->Load(anAISIO);
     #ifdef TINSPECTOR
+    #if OCC_VERSION_LARGE < 0x07070000
     if (getCallBack()) getCallBack()->Load(anAISIO);
+    #else
+    if (getCallBack()) getCallBack()->Send("Load", Message_Info);
+    #endif
     #endif
+
     if (toActivateInSelectionModes)
       myWorkshop->selectionActivate()->activateOnDisplay(anAISIO, theUpdateViewer);
 
@@ -755,7 +819,11 @@ bool XGUI_Displayer::eraseAIS(AISObjectPtr theAIS, const bool theUpdateViewer)
     if (!anAISIO.IsNull() && aContext->IsDisplayed(anAISIO)) {
       aContext->Remove(anAISIO, false/*update viewer*/);
       #ifdef TINSPECTOR
+      #if OCC_VERSION_LARGE < 0x07070000
       if (getCallBack()) getCallBack()->Remove(anAISIO);
+      #else
+      if (getCallBack()) getCallBack()->Send("Remove", Message_Info);
+      #endif
       #endif
       aErased = true;
     }
@@ -1048,7 +1116,11 @@ void XGUI_Displayer::displayTrihedron(bool theToDisplay) const
                         Standard_True /* update viewer*/,
                         AIS_DS_Displayed /* xdisplay status */);
     #ifdef TINSPECTOR
+    #if OCC_VERSION_LARGE < 0x07070000
     if (getCallBack()) getCallBack()->Display(aTrihedron);
+    #else
+    if (getCallBack()) getCallBack()->Send("Display", Message_Info);
+    #endif
     #endif
 
     if (!aSelectionActive->isTrihedronActive())
@@ -1060,7 +1132,11 @@ void XGUI_Displayer::displayTrihedron(bool theToDisplay) const
 
     aContext->Erase(aTrihedron, Standard_True);
     #ifdef TINSPECTOR
+    #if OCC_VERSION_LARGE < 0x07070000
     if (getCallBack()) getCallBack()->Remove(aTrihedron);
+    #else
+    if (getCallBack()) getCallBack()->Send("Remove", Message_Info);
+    #endif
     #endif
   }
 }
index db0548b067509cc62debcc23f6146b7ff8ca9f8e..7eefb03181aa4149555247eaa9029b5693849795 100644 (file)
@@ -41,6 +41,8 @@
 #include <QObject>
 #include <QString>
 
+#include <Basics_OCCTVersion.hxx>
+
 class ModuleBase_ViewerPrs;
 class ModelAPI_Feature;
 class XGUI_SelectionActivate;
@@ -49,7 +51,11 @@ class XGUI_Workshop;
 #define OPTIMIZE_PRS
 
 #ifdef TINSPECTOR
+#if OCC_VERSION_LARGE < 0x07070000
 class VInspectorAPI_CallBack;
+#else
+class Message_Messenger;
+#endif
 #endif
 
 
@@ -358,9 +364,17 @@ public:
   void displayTrihedron(bool theToDisplay) const;
 
 #ifdef TINSPECTOR
+#if OCC_VERSION_LARGE < 0x07070000
   void setCallBack(const Handle(VInspectorAPI_CallBack)& theCallBack)
     { myVCallBack = theCallBack; }
   Handle(VInspectorAPI_CallBack) getCallBack() const { return myVCallBack; }
+#else
+  void setCallBack(const Handle(Message_Messenger)& theCallBack)
+  {
+    myVCallBack = theCallBack;
+  }
+  Handle(Message_Messenger) getCallBack() const { return myVCallBack; }
+#endif
 #endif
 
   /// Return true if the object is visible. If the object is feature, it returns true
@@ -455,7 +469,11 @@ private:
 private:
   XGUI_Workshop* myWorkshop; ///< Reference to workshop
 #ifdef TINSPECTOR
+#if OCC_VERSION_LARGE < 0x07070000
   Handle(VInspectorAPI_CallBack) myVCallBack;
+#else
+  Handle(Message_Messenger) myVCallBack;
+#endif
 #endif
   Handle(SelectMgr_AndFilter) myAndFilter; ///< A container for selection filters
 
index 4149e8a6dc108934a1ebbc7db78901ded1a7ec3c..c4d31ed20d13746695c333b08b36e8c302043d33 100644 (file)
 //#define DEBUG_DEACTIVATE_AIS
 
 #ifdef TINSPECTOR
+#if OCC_VERSION_LARGE < 0x07070000
 #include <inspector/VInspectorAPI_CallBack.hxx>
+#else
+#include <inspector/MessageView_Communicator.hxx>
+#include <inspector/MessageView_ActionsTest.hxx>
+#include <inspector/MessageView_MetricStatisticModel.hxx>
+#include <inspector/MessageView_VisibilityState.hxx>
+#include <inspector/MessageView_Window.hxx>
+#include <Message_Msg.hxx>
+#include <Message_Report.hxx>
+#endif
 #endif
 
 #define CLEAR_OUTDATED_SELECTION_BEFORE_REDISPLAY
@@ -347,13 +357,21 @@ void XGUI_SelectionActivate::activateAIS(const Handle(AIS_InteractiveObject)& th
       //int aMode = (theMode > 8)? theMode : AIS_Shape::SelectionType(theMode);
       aContext->Activate(theIO, theMode, false);
 #ifdef TINSPECTOR
+#if OCC_VERSION_LARGE < 0x07070000
       if (getDisplayer()->getCallBack()) getDisplayer()->getCallBack()->Activate(theIO, theMode);
+#else
+      if (getDisplayer()->getCallBack()) getDisplayer()->getCallBack()->Send("Activate", Message_Info);
+#endif
 #endif
     }
     else {
       aContext->Activate(theIO, theMode, false);
 #ifdef TINSPECTOR
+#if OCC_VERSION_LARGE < 0x07070000
       if (getDisplayer()->getCallBack()) getDisplayer()->getCallBack()->Activate(theIO, theMode);
+#else
+      if (getDisplayer()->getCallBack()) getDisplayer()->getCallBack()->Send("Activate", Message_Info);
+#endif
 #endif
     }
     // the fix from VPA for more suitable selection of sketcher lines
index 78694443ad481aeb8f833cc4f8373e458f70395c..273a621e82c727e15d64504c42ccbe3b409d8855 100644 (file)
 #include <TopTools_MapOfShape.hxx>
 
 #ifdef TINSPECTOR
+#if OCC_VERSION_LARGE < 0x07070000
 #include <inspector/VInspectorAPI_CallBack.hxx>
+#else
+#include <inspector/MessageView_Communicator.hxx>
+#include <inspector/MessageView_ActionsTest.hxx>
+#include <inspector/MessageView_MetricStatisticModel.hxx>
+#include <inspector/MessageView_VisibilityState.hxx>
+#include <inspector/MessageView_Window.hxx>
+#include <Message_Msg.hxx>
+#include <Message_Report.hxx>
+#endif
 #endif
 
 #ifdef WIN32
@@ -100,8 +110,13 @@ void XGUI_SelectionMgr::setSelectedOwners(const SelectMgr_IndexedMapOfOwner& the
 
       aContext->AddOrRemoveSelected(anOwner, isUpdateViewer);
       #ifdef TINSPECTOR
+      #if OCC_VERSION_LARGE < 0x07070000
       if (myWorkshop->displayer()->getCallBack())
         myWorkshop->displayer()->getCallBack()->AddOrRemoveSelected(anOwner);
+      #else
+      if (myWorkshop->displayer()->getCallBack())
+        myWorkshop->displayer()->getCallBack()->Send("AddOrRemoveSelected", Message_Info);
+#endif
       #endif
     }
   }
index 482fcb8e840b026e178883cc7fca434e45f6a8ae..a06771616b418944984e88c6d534140fd86940d1 100644 (file)
 
 #ifdef TINSPECTOR
 #include <Model_Session.h>
+#include <Message_Report.hxx>
 #include <TDocStd_Application.hxx>
 #include <inspector/TInspector_Communicator.hxx>
+#if OCC_VERSION_LARGE < 0x07070000
 #include <inspector/VInspector_CallBack.hxx>
-static TInspector_Communicator* MyTCommunicator;
 static Handle(VInspector_CallBack) MyVCallBack;
+#else
+static Handle(Message_Messenger) aMessenger;
+#endif
+static TInspector_Communicator* MyTCommunicator;
 #endif
 
 #ifdef _DEBUG
@@ -1903,19 +1908,28 @@ void XGUI_Workshop::onContextMenuCommand(const QString& theId, bool isChecked)
         if (!aContextReport.IsNull())
           aParameters.Append(aContextReport);
 #endif
+#if OCC_VERSION_LARGE < 0x07070000
         MyVCallBack = new VInspector_CallBack();
         myDisplayer->setCallBack(MyVCallBack);
+#else
+        aMessenger = new Message_Messenger();
+        myDisplayer->setCallBack(aMessenger);
+#endif
         #ifndef HAVE_SALOME
         AppElements_Viewer* aViewer = mainWindow()->viewer();
         if (aViewer)
           aViewer->setCallBack(MyVCallBack);
         #endif
+#if OCC_VERSION_LARGE < 0x07070000
         aParameters.Append(MyVCallBack);
+#else
+        aParameters.Append(aMessenger);
+#endif
 
         MyTCommunicator->RegisterPlugin("TKDFBrowser");
         MyTCommunicator->RegisterPlugin("TKShapeView");
         MyTCommunicator->RegisterPlugin("TKVInspector");
-#ifdef DEBUG_WITH_MESSAGE_REPORT
+#ifndef DEBUG_WITH_MESSAGE_REPORT
         MyTCommunicator->RegisterPlugin("TKMessageView");
 #endif
         //MyTCommunicator->RegisterPlugin("SMBrowser"); // custom plugin to view ModelAPI