From: asozinov Date: Mon, 3 Apr 2023 11:25:46 +0000 (+0100) Subject: Try run TInspector with OCCT 7.7.0 (MessageView not working) X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=417abae573d87d9df83bb2ae5faeb0a5424f4646;p=modules%2Fshaper.git Try run TInspector with OCCT 7.7.0 (MessageView not working) --- diff --git a/CMakeCommon/FindTInspector.cmake b/CMakeCommon/FindTInspector.cmake index 223f6855b..7b36e9bf4 100644 --- a/CMakeCommon/FindTInspector.cmake +++ b/CMakeCommon/FindTInspector.cmake @@ -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) diff --git a/src/XGUI/XGUI_Displayer.cpp b/src/XGUI/XGUI_Displayer.cpp index 2a7b07c1d..01a0173b6 100644 --- a/src/XGUI/XGUI_Displayer.cpp +++ b/src/XGUI/XGUI_Displayer.cpp @@ -80,7 +80,17 @@ #include #ifdef TINSPECTOR +#if OCC_VERSION_LARGE < 0x07070000 #include +#else +#include +#include +#include +#include +#include +#include +#include +#endif #endif #include @@ -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& 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> aShapesToBeSelected; @@ -480,7 +506,12 @@ void XGUI_Displayer::setSelected(const QList& 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 aPresentations; @@ -488,7 +519,13 @@ void XGUI_Displayer::setSelected(const QList& 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& 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 } } diff --git a/src/XGUI/XGUI_Displayer.h b/src/XGUI/XGUI_Displayer.h index db0548b06..7eefb0318 100644 --- a/src/XGUI/XGUI_Displayer.h +++ b/src/XGUI/XGUI_Displayer.h @@ -41,6 +41,8 @@ #include #include +#include + 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 diff --git a/src/XGUI/XGUI_SelectionActivate.cpp b/src/XGUI/XGUI_SelectionActivate.cpp index 4149e8a6d..c4d31ed20 100644 --- a/src/XGUI/XGUI_SelectionActivate.cpp +++ b/src/XGUI/XGUI_SelectionActivate.cpp @@ -49,7 +49,17 @@ //#define DEBUG_DEACTIVATE_AIS #ifdef TINSPECTOR +#if OCC_VERSION_LARGE < 0x07070000 #include +#else +#include +#include +#include +#include +#include +#include +#include +#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 diff --git a/src/XGUI/XGUI_SelectionMgr.cpp b/src/XGUI/XGUI_SelectionMgr.cpp index 78694443a..273a621e8 100644 --- a/src/XGUI/XGUI_SelectionMgr.cpp +++ b/src/XGUI/XGUI_SelectionMgr.cpp @@ -53,7 +53,17 @@ #include #ifdef TINSPECTOR +#if OCC_VERSION_LARGE < 0x07070000 #include +#else +#include +#include +#include +#include +#include +#include +#include +#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 } } diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index 482fcb8e8..a06771616 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -160,11 +160,16 @@ #ifdef TINSPECTOR #include +#include #include #include +#if OCC_VERSION_LARGE < 0x07070000 #include -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