From e8fce5fe73fee1a8ea2929934a7e6f71bd1e3eb5 Mon Sep 17 00:00:00 2001 From: Artem Zhidkov Date: Sun, 18 Apr 2021 22:50:31 +0300 Subject: [PATCH] Update to use the latest version of TInspector (OCCT 7.5.3) --- src/Model/Model_Document.cpp | 3 +-- src/Model/Model_Session.h | 10 ++++++++++ src/ModelAPI/CMakeLists.txt | 5 +++++ src/ModelAPI/ModelAPI_Session.h | 9 +++++++++ src/XGUI/XGUI_Workshop.cpp | 6 ++---- 5 files changed, 27 insertions(+), 6 deletions(-) diff --git a/src/Model/Model_Document.cpp b/src/Model/Model_Document.cpp index 94903c205..505b77f36 100644 --- a/src/Model/Model_Document.cpp +++ b/src/Model/Model_Document.cpp @@ -75,7 +75,6 @@ #include #ifdef TINSPECTOR -#include #include #endif @@ -117,7 +116,7 @@ Model_Document::Model_Document(const int theID, const std::string theKind) myIsSetCurrentFeature(false) { #ifdef TINSPECTOR - CDF_Session::CurrentSession()->Directory()->Add(myDoc); + ModelAPI_Session::get()->application()->NewDocument("BinOcaf", myDoc); #endif myObjs = new Model_Objects(myDoc->Main()); myDoc->SetUndoLimit(UNDO_LIMIT); diff --git a/src/Model/Model_Session.h b/src/Model/Model_Session.h index af4705123..218659d5a 100644 --- a/src/Model/Model_Session.h +++ b/src/Model/Model_Session.h @@ -27,6 +27,10 @@ #include #include +#ifdef TINSPECTOR +#include "Model_Application.h" +#endif + class Model_Document; /**\class Model_Session @@ -155,6 +159,12 @@ class Model_Session : public ModelAPI_Session, public Events_Listener /// Set state of the auto-update of features result in the application MODEL_EXPORT virtual void blockAutoUpdate(const bool theBlock); +#ifdef TINSPECTOR + MODEL_EXPORT virtual Handle(TDocStd_Application) application() { + return Model_Application::getApplication(); + } +#endif + protected: /// Loads (if not done yet) the information about the features and plugins void LoadPluginsInfo(); diff --git a/src/ModelAPI/CMakeLists.txt b/src/ModelAPI/CMakeLists.txt index c6a298461..d2d565eee 100644 --- a/src/ModelAPI/CMakeLists.txt +++ b/src/ModelAPI/CMakeLists.txt @@ -122,6 +122,10 @@ SET(PROJECT_LIBRARIES SET(CMAKE_SWIG_FLAGS -threads -w325,321,362,383,302,403,451,473) ADD_DEFINITIONS(-DMODELAPI_EXPORTS) +IF(TKTInspector) + ADD_DEFINITIONS(-DTINSPECTOR) +ENDIF() + ADD_LIBRARY(ModelAPI SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS}) SET_TARGET_PROPERTIES(ModelAPI PROPERTIES LINKER_LANGUAGE CXX) TARGET_LINK_LIBRARIES(ModelAPI ${PROJECT_LIBRARIES}) @@ -131,6 +135,7 @@ INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/src/Config ${PROJECT_SOURCE_DIR}/src/GeomAPI ${PROJECT_SOURCE_DIR}/src/GeomAlgoAPI ${PROJECT_SOURCE_DIR}/src/Locale + ${OpenCASCADE_INCLUDE_DIR} ) diff --git a/src/ModelAPI/ModelAPI_Session.h b/src/ModelAPI/ModelAPI_Session.h index e5db16f75..339263fb0 100644 --- a/src/ModelAPI/ModelAPI_Session.h +++ b/src/ModelAPI/ModelAPI_Session.h @@ -25,6 +25,11 @@ #include #include +#ifdef TINSPECTOR +#include +#include +#endif + class ModelAPI_Feature; class ModelAPI_Plugin; class ModelAPI_Document; @@ -138,6 +143,10 @@ class MODELAPI_EXPORT ModelAPI_Session /// Set state of the auto-update of features result in the application virtual void blockAutoUpdate(const bool theBlock) = 0; +#ifdef TINSPECTOR + virtual Handle(TDocStd_Application) application() = 0; +#endif + protected: /// Sets the session interface implementation (once per application launch) static void setSession(std::shared_ptr theManager); diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index e68c986e6..14756f934 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -157,13 +157,11 @@ #include #ifdef TINSPECTOR -#include -#include +#include #include #include static TInspector_Communicator* MyTCommunicator; static Handle(VInspector_CallBack) MyVCallBack; - #endif #ifdef _DEBUG @@ -1824,7 +1822,7 @@ void XGUI_Workshop::onContextMenuCommand(const QString& theId, bool isChecked) } #ifdef TINSPECTOR else if (theId == "TINSPECTOR_VIEW") { - Handle(CDF_Application) anApplication = CDF_Session::CurrentSession()->CurrentApplication(); + Handle(TDocStd_Application) anApplication = ModelAPI_Session::get()->application(); if (!anApplication.IsNull()) { if (!MyTCommunicator) -- 2.39.2