From 0cb3c0f823f35b3a268fbe032550deb2403780e8 Mon Sep 17 00:00:00 2001 From: nds Date: Mon, 28 Nov 2016 15:00:00 +0300 Subject: [PATCH] Debug information to check selection with SHIFT: group, selection of edges on created extrusion --- CMakeCommon/FindDFBrowser.cmake | 27 +++++++++++++++++++++++++++ CMakeCommon/FindVInspector.cmake | 27 +++++++++++++++++++++++++++ CMakeLists.txt | 2 ++ src/Model/CMakeLists.txt | 6 +++--- src/Model/Model_Application.cpp | 17 +++++++++-------- src/Model/Model_Document.cpp | 2 +- src/XGUI/CMakeLists.txt | 7 +++++++ src/XGUI/XGUI_ViewerProxy.cpp | 23 +++++++++++++++++++++-- 8 files changed, 97 insertions(+), 14 deletions(-) create mode 100644 CMakeCommon/FindDFBrowser.cmake create mode 100644 CMakeCommon/FindVInspector.cmake diff --git a/CMakeCommon/FindDFBrowser.cmake b/CMakeCommon/FindDFBrowser.cmake new file mode 100644 index 000000000..2cf5e9a34 --- /dev/null +++ b/CMakeCommon/FindDFBrowser.cmake @@ -0,0 +1,27 @@ +# - Try to find DFBrowser +# Once done this will define +# +# DBROWSER_FOUND - system has DFBrowser +# DFBROWSER_INCLUDE_DIRS - the DFBrowser include directory +# DFBROWSER_LIBRARIES - Link these to use DFBrowser + +#============================================================================= +## Copyright (C) 2014-20xx CEA/DEN, EDF R&D +#============================================================================= + +IF(NOT DFBROWSER_FIND_QUIETLY) + MESSAGE(STATUS "Try to find DFBrowser at $ENV{DFBROWSER_ROOT_DIR}...") +ENDIF() + +SET(DFBROWSER_ROOT_DIR $ENV{DFBROWSER_ROOT_DIR} CACHE PATH "Path to the DFBrowser directory") +IF(EXISTS ${DFBROWSER_ROOT_DIR}) + SET(DFBROWSER_INCLUDE_DIR "${DFBROWSER_ROOT_DIR}/include") + SET(DFBROWSER_LIB_DIR "${DFBROWSER_ROOT_DIR}/lib") + + FIND_LIBRARY(DFBrowserAPI DFBrowserAPI "${DFBROWSER_LIB_DIR}") + SET(DFBrowserAPI ${DFBrowserAPI}) + + MESSAGE(STATUS "DFBrowser found at ${DFBROWSER_ROOT_DIR}") + MESSAGE(STATUS "DFBrowser include dir at ${DFBROWSER_INCLUDE_DIR}") + MESSAGE(STATUS "DFBrowser lib dir at ${DFBROWSER_LIB_DIR}") +ENDIF(EXISTS ${DFBROWSER_ROOT_DIR}) diff --git a/CMakeCommon/FindVInspector.cmake b/CMakeCommon/FindVInspector.cmake new file mode 100644 index 000000000..f88ff79dc --- /dev/null +++ b/CMakeCommon/FindVInspector.cmake @@ -0,0 +1,27 @@ +# - Try to find VInspector +# Once done this will define +# +# VINSPECTOR_FOUND - system has VInspector +# VINSPECTOR_INCLUDE_DIRS - the VInspector include directory +# VINSPECTOR_LIBRARIES - Link these to use VInspector + +#============================================================================= +## Copyright (C) 2014-20xx CEA/DEN, EDF R&D +#============================================================================= + +IF(NOT VINSPECTOR_FIND_QUIETLY) + MESSAGE(STATUS "Try to find VInspector at $ENV{VINSPECTOR_ROOT_DIR}...") +ENDIF() + +SET(VINSPECTOR_ROOT_DIR $ENV{VINSPECTOR_ROOT_DIR} CACHE PATH "Path to the VInspector directory") +IF(EXISTS ${VINSPECTOR_ROOT_DIR}) + SET(VINSPECTOR_INCLUDE_DIR "${VINSPECTOR_ROOT_DIR}/include") + SET(VINSPECTOR_LIB_DIR "${VINSPECTOR_ROOT_DIR}/lib") + + FIND_LIBRARY(VInspectorAPI VInspectorAPI "${VINSPECTOR_LIB_DIR}") + SET(VInspectorAPI ${VInspectorAPI}) + + MESSAGE(STATUS "VInspector found at ${VINSPECTOR_ROOT_DIR}") + MESSAGE(STATUS "VInspector include dir at ${VINSPECTOR_INCLUDE_DIR}") + MESSAGE(STATUS "VInspector lib dir at ${VINSPECTOR_LIB_DIR}") +ENDIF(EXISTS ${VINSPECTOR_ROOT_DIR}) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7a2007df6..561697239 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,6 +12,8 @@ INCLUDE(FindPython) INCLUDE(FindSalome) INCLUDE(FindCAS) INCLUDE(FindSUIT) +INCLUDE(FindDFBrowser) +INCLUDE(FindVInspector) # Find LibXml2 IF(DEFINED ENV{LIBXML2_ROOT_DIR}) diff --git a/src/Model/CMakeLists.txt b/src/Model/CMakeLists.txt index fe49abf6a..f4649c67c 100644 --- a/src/Model/CMakeLists.txt +++ b/src/Model/CMakeLists.txt @@ -103,11 +103,11 @@ SET(PROJECT_INCLUDES ) -IF(EXISTS ${OCAFBROWSER_ROOT_DIR}) +IF(EXISTS ${DFBROWSER_ROOT_DIR}) SET(PROJECT_LIBRARIES ${PROJECT_LIBRARIES} ${DFBrowserAPI}) - SET(PROJECT_INCLUDES ${PROJECT_INCLUDES} ${OCAFBROWSER_INCLUDE_DIR}) + SET(PROJECT_INCLUDES ${PROJECT_INCLUDES} ${DFBROWSER_INCLUDE_DIR}) - ADD_DEFINITIONS(-DOCAFBROWSER) + ADD_DEFINITIONS(-DDFBROWSER) ENDIF() ADD_DEFINITIONS(-DMODEL_EXPORTS ${CAS_DEFINITIONS}) diff --git a/src/Model/Model_Application.cpp b/src/Model/Model_Application.cpp index 287989715..ac84508a2 100644 --- a/src/Model/Model_Application.cpp +++ b/src/Model/Model_Application.cpp @@ -9,9 +9,8 @@ #include -#ifdef OCAFBROWSER -#include -#include +#ifdef DFBROWSER +#include static bool FirstCall = true; #endif @@ -24,11 +23,13 @@ static Handle_Model_Application TheApplication = new Model_Application; //======================================================================= Handle(Model_Application) Model_Application::getApplication() { -#ifdef OCAFBROWSER - if (FirstCall) { - DFBrowserAPI_PluginMgr::activateBrowser("OCAFBrowser.dll", TheApplication); - FirstCall = false; - } +#ifdef DFBROWSER + if (FirstCall) { + DFBrowserAPI_Communicator* aCommunicator = + DFBrowserAPI_Communicator::loadPluginLibrary("DFBrowser.dll"); + aCommunicator->setApplication(TheApplication); + FirstCall = false; + } #endif return TheApplication; } diff --git a/src/Model/Model_Document.cpp b/src/Model/Model_Document.cpp index 79febfc4e..d47d1ec0b 100755 --- a/src/Model/Model_Document.cpp +++ b/src/Model/Model_Document.cpp @@ -76,7 +76,7 @@ Model_Document::Model_Document(const int theID, const std::string theKind) : myID(theID), myKind(theKind), myIsActive(false), myDoc(new TDocStd_Document("BinOcaf")) // binary OCAF format { -#ifdef OCAFBROWSER +#ifdef DFBROWSER CDF_Session::CurrentSession()->Directory()->Add(myDoc); #endif myObjs = new Model_Objects(myDoc->Main()); diff --git a/src/XGUI/CMakeLists.txt b/src/XGUI/CMakeLists.txt index 222f5d2aa..ca942c29c 100644 --- a/src/XGUI/CMakeLists.txt +++ b/src/XGUI/CMakeLists.txt @@ -129,6 +129,13 @@ SET(PROJECT_INCLUDES ${CAS_INCLUDE_DIRS} ${SUIT_INCLUDE}) +IF(EXISTS ${VINSPECTOR_ROOT_DIR}) + SET(PROJECT_LIBRARIES ${PROJECT_LIBRARIES} ${VInspectorAPI}) + SET(PROJECT_INCLUDES ${PROJECT_INCLUDES} ${VINSPECTOR_INCLUDE_DIR}) + + ADD_DEFINITIONS(-DVINSPECTOR) +ENDIF() + IF(NOT ${HAVE_SALOME}) SET(PROJECT_INCLUDES ${PROJECT_INCLUDES} ${APPELEMENTS_INCLUDE_DIR}) ENDIF(NOT ${HAVE_SALOME}) diff --git a/src/XGUI/XGUI_ViewerProxy.cpp b/src/XGUI/XGUI_ViewerProxy.cpp index aad07467f..a504708cf 100644 --- a/src/XGUI/XGUI_ViewerProxy.cpp +++ b/src/XGUI/XGUI_ViewerProxy.cpp @@ -12,6 +12,14 @@ #include #endif +#ifdef VINSPECTOR +#include +#include + +static bool FirstCall = true; + +#endif + #include #include @@ -35,11 +43,22 @@ void XGUI_ViewerProxy::connectViewProxy() Handle(AIS_InteractiveContext) XGUI_ViewerProxy::AISContext() const { + Handle(AIS_InteractiveContext) aContext; #ifdef HAVE_SALOME - return myWorkshop->salomeConnector()->viewer()->AISContext(); + aContext = myWorkshop->salomeConnector()->viewer()->AISContext(); #else - return myWorkshop->mainWindow()->viewer()->AISContext(); + aContext = myWorkshop->mainWindow()->viewer()->AISContext(); #endif + +#ifdef VINSPECTOR + if (FirstCall) { + VInspectorAPI_PluginMgr::activateVInspector("VInspector.dll", aContext); + FirstCall = false; + } +#endif + + + return aContext; } Handle(AIS_Trihedron) XGUI_ViewerProxy::trihedron() const -- 2.39.2