]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
#2027 Sketcher Trim feature - highlight should be cleared when the mouse is moved...
authornds <nds@opencascade.com>
Wed, 15 Mar 2017 04:32:18 +0000 (07:32 +0300)
committernds <nds@opencascade.com>
Wed, 15 Mar 2017 04:32:18 +0000 (07:32 +0300)
Debug tool TInspector replaces VInspector and DFBrowser.

15 files changed:
CMakeCommon/FindDFBrowser.cmake [deleted file]
CMakeCommon/FindTInspector.cmake [new file with mode: 0644]
CMakeCommon/FindVInspector.cmake [deleted file]
CMakeLists.txt
src/Model/CMakeLists.txt
src/Model/Model_Document.cpp
src/PartSet/PartSet_WidgetFeaturePointSelector.cpp
src/PartSet/PartSet_WidgetFeaturePointSelector.h
src/SketchPlugin/SketchPlugin_Trim.cpp
src/XGUI/CMakeLists.txt
src/XGUI/XGUI_ContextMenuMgr.cpp
src/XGUI/XGUI_Displayer.cpp
src/XGUI/XGUI_Displayer.h
src/XGUI/XGUI_SelectionMgr.cpp
src/XGUI/XGUI_Workshop.cpp

diff --git a/CMakeCommon/FindDFBrowser.cmake b/CMakeCommon/FindDFBrowser.cmake
deleted file mode 100644 (file)
index 74e5456..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-# - 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
-#=============================================================================
-
-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}")
-  IF(DFBrowserAPI)
-    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(DFBrowserAPI)
-
-ENDIF(EXISTS ${DFBROWSER_ROOT_DIR})
diff --git a/CMakeCommon/FindTInspector.cmake b/CMakeCommon/FindTInspector.cmake
new file mode 100644 (file)
index 0000000..b553776
--- /dev/null
@@ -0,0 +1,29 @@
+# - Try to  find TInspector
+# Once done this will define
+#
+#  TInspector - system has OCCT tool inspector
+#  TINSPECTOR_INCLUDE_DIRS - the tool inspector include directory
+#  TINSPECTOR_LIBRARIES - Link these to use TInspector
+
+#=============================================================================
+## Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+#=============================================================================
+
+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")
+
+  FIND_LIBRARY(TKTInspector TKTInspector "${TINSPECTOR_LIB_DIR}")
+  IF(TKTInspector)
+    SET(TKTInspector ${TKTInspector})
+    MESSAGE(STATUS "TInspector is found at ${TINSPECTOR_ROOT_DIR}")
+    MESSAGE(STATUS "TInspector include dir is ${TINSPECTOR_INCLUDE_DIR}")
+    MESSAGE(STATUS "TInspector lib dir is ${TINSPECTOR_LIB_DIR}")
+
+    FIND_LIBRARY(TKVInspector TKVInspector "${TINSPECTOR_LIB_DIR}")
+    SET(TKVInspector ${TKVInspector})
+
+  ENDIF(TKTInspector)
+
+ENDIF(EXISTS ${TINSPECTOR_ROOT_DIR})
diff --git a/CMakeCommon/FindVInspector.cmake b/CMakeCommon/FindVInspector.cmake
deleted file mode 100644 (file)
index c86abdf..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-# - 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
-#=============================================================================
-
-SET(VINSPECTOR_ROOT_DIR $ENV{VINSPECTOR_ROOT_DIR} CACHE PATH "Path to the VInspector directory")
-IF(EXISTS $ENV{VINSPECTOR_ROOT_DIR})
-  SET(VINSPECTOR_INCLUDE_DIR "$ENV{VINSPECTOR_ROOT_DIR}/include")
-  SET(VINSPECTOR_LIB_DIR "$ENV{VINSPECTOR_ROOT_DIR}/lib")
-
-  FIND_LIBRARY(VInspectorAPI VInspectorAPI "${VINSPECTOR_LIB_DIR}")
-  IF(VInspectorAPI)
-    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(VInspectorAPI)
-
-ENDIF(EXISTS $ENV{VINSPECTOR_ROOT_DIR})
index 01376442f89380ccedba5bed591af77dcb0ff778..73a4f4f0be7a77a9d7ca1f63e2be0f6a725f630a 100644 (file)
@@ -20,8 +20,7 @@ INCLUDE(FindPython)
 INCLUDE(FindSalome)
 INCLUDE(FindCAS)
 INCLUDE(FindSUIT)
-INCLUDE(FindDFBrowser)
-INCLUDE(FindVInspector)
+INCLUDE(FindTInspector)
 
 # Find LibXml2
 IF(DEFINED ENV{LIBXML2_ROOT_DIR})
index a737654e0b61bc060ac4fd81a2bb300e3c30bd77..181a51e75d304dfdb479911c878f851fa817af1e 100644 (file)
@@ -103,11 +103,8 @@ SET(PROJECT_INCLUDES
 )
 
 
-IF(DFBrowserAPI)
-    SET(PROJECT_LIBRARIES ${PROJECT_LIBRARIES} ${DFBrowserAPI})
-    SET(PROJECT_INCLUDES ${PROJECT_INCLUDES} ${DFBROWSER_INCLUDE_DIR})
-
-    ADD_DEFINITIONS(-DDFBROWSER)
+IF(TKTInspector)
+    ADD_DEFINITIONS(-DTINSPECTOR)
 ENDIF()
 
 ADD_DEFINITIONS(-DMODEL_EXPORTS ${CAS_DEFINITIONS})
index 59a3fcf4ab93879a7baa794782a3d2485e2f4c46..89c596d6d2026e2df305d0709adba247570732d2 100755 (executable)
@@ -78,7 +78,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 DFBROWSER
+#ifdef TINSPECTOR
   CDF_Session::CurrentSession()->Directory()->Add(myDoc);
 #endif
   myObjs = new Model_Objects(myDoc->Main());
index ed14ea8d6896a72b53a02f881e6c7b635386445b..78fcaf12acf32e4419c89bbfb999410a75e66147 100644 (file)
@@ -50,7 +50,7 @@
 PartSet_WidgetFeaturePointSelector::PartSet_WidgetFeaturePointSelector(QWidget* theParent,
                                                          ModuleBase_IWorkshop* theWorkshop,
                                                          const Config_WidgetAPI* theData)
-: ModuleBase_WidgetShapeSelector(theParent, theWorkshop, theData)
+: ModuleBase_WidgetShapeSelector(theParent, theWorkshop, theData), myBaseSelected(false)
 {
 }
 
@@ -66,51 +66,54 @@ bool PartSet_WidgetFeaturePointSelector::isValidSelection(
 }
 
 //********************************************************************
-void PartSet_WidgetFeaturePointSelector::activateCustom()
+bool PartSet_WidgetFeaturePointSelector::activateSelectionAndFilters(bool toActivate)
 {
-  ModuleBase_WidgetShapeSelector::activateCustom();
-
-  myWorkshop->module()->activateCustomPrs(myFeature,
-                            ModuleBase_IModule::CustomizeHighlightedObjects, true);
-
+#ifdef HIGHLIGHT_STAYS_PROBLEM
   Handle(AIS_InteractiveContext) aContext =
-                          XGUI_Tools::workshop(myWorkshop)->viewer()->AISContext();
+                            XGUI_Tools::workshop(myWorkshop)->viewer()->AISContext();
+  Quantity_Color aColor;
+  Handle(Graphic3d_HighlightStyle) aHStyle = aContext->HighlightStyle();
+  Handle(Graphic3d_HighlightStyle) aSStyle = aContext->SelectionStyle();
+  if (toActivate) {
+    std::vector<int> aColors;
+    aColors = Config_PropManager::color("Visualization", "sketch_entity_color",
+                                       SKETCH_ENTITY_COLOR);
+    aColor = Quantity_Color(aColors[0] / 255., aColors[1] / 255., aColors[2] / 255., Quantity_TOC_RGB);
 
-  std::vector<int> aColors;
-  aColors = Config_PropManager::color("Visualization", "sketch_entity_color",
-                                     SKETCH_ENTITY_COLOR);
-  Quantity_Color aColor(aColors[0] / 255., aColors[1] / 255., aColors[2] / 255., Quantity_TOC_RGB);
+    myHighlightColor = aHStyle->Color();
+    mySelectionColor = aSStyle->Color();
 
-#ifdef HIGHLIGHT_STAYS_PROBLEM
-  Handle(Graphic3d_HighlightStyle) aHStyle = aContext->HighlightStyle();
-  myHighlightColor = aHStyle->Color();
+    aHStyle->SetTransparency(0.5f);
+  }
+  else {
+    aColor = myHighlightColor;
+  }
   aHStyle->SetColor(aColor);
   aContext->SetHighlightStyle(aHStyle);
 
-  Handle(Graphic3d_HighlightStyle) aSStyle = aContext->SelectionStyle();
-  mySelectionColor = aSStyle->Color();
   aSStyle->SetColor(aColor);
   aContext->SetSelectionStyle(aSStyle);
+
 #endif
+
+  return ModuleBase_WidgetShapeSelector::activateSelectionAndFilters(toActivate);
 }
 
 //********************************************************************
-void PartSet_WidgetFeaturePointSelector::deactivate()
+void PartSet_WidgetFeaturePointSelector::activateCustom()
 {
-  ModuleBase_WidgetShapeSelector::deactivate();
+  ModuleBase_WidgetShapeSelector::activateCustom();
 
-  Handle(AIS_InteractiveContext) aContext =
-                          XGUI_Tools::workshop(myWorkshop)->viewer()->AISContext();
+  myBaseSelected = false;
 
-#ifdef HIGHLIGHT_STAYS_PROBLEM
-  Handle(Graphic3d_HighlightStyle) aHStyle = aContext->HighlightStyle();
-  aHStyle->SetColor(myHighlightColor);
-  aContext->SetHighlightStyle(aHStyle);
+  myWorkshop->module()->activateCustomPrs(myFeature,
+                            ModuleBase_IModule::CustomizeHighlightedObjects, true);
+}
 
-  Handle(Graphic3d_HighlightStyle) aSStyle = aContext->SelectionStyle();
-  aSStyle->SetColor(mySelectionColor);
-  aContext->SetSelectionStyle(aSStyle);
-#endif
+//********************************************************************
+void PartSet_WidgetFeaturePointSelector::deactivate()
+{
+  ModuleBase_WidgetShapeSelector::deactivate();
 }
 
 //********************************************************************
@@ -120,10 +123,8 @@ void PartSet_WidgetFeaturePointSelector::mouseMoved(ModuleBase_IViewWindow* theW
   ModuleBase_ISelection* aSelect = myWorkshop->selection();
   QList<ModuleBase_ViewerPrsPtr> aHighlighted = aSelect->getHighlighted();
 
-  if (!aHighlighted.empty()) {
-    ModuleBase_ViewerPrsPtr aPrs = aHighlighted.first();
-    fillFeature(aPrs, theWindow, theEvent);
-  }
+  ModuleBase_ViewerPrsPtr aPrs = !aHighlighted.empty() ? aHighlighted.first() : ModuleBase_ViewerPrsPtr();
+  fillFeature(aPrs, theWindow, theEvent);
 }
 
 //********************************************************************
@@ -134,6 +135,7 @@ void PartSet_WidgetFeaturePointSelector::mouseReleased(ModuleBase_IViewWindow* t
   if (theEvent->button() != Qt::LeftButton)
     return;
 
+  myBaseSelected = true;
   emit focusOutWidget(this);
   // we need to deselect base feature for better visibility of selected feature
   XGUI_Tools::workshop(myWorkshop)->displayer()->clearSelected(false);
@@ -146,30 +148,32 @@ bool PartSet_WidgetFeaturePointSelector::fillFeature(
                             QMouseEvent* theEvent)
 {
   bool aFilled = false;
-  if (theSelectedPrs.get() && theSelectedPrs->object().get()) {
-    ObjectPtr anObject = theSelectedPrs->object();
-    gp_Pnt aPnt = PartSet_Tools::convertClickToPoint(theEvent->pos(), theWindow->v3dView());
-    double aX, anY;
-    Handle(V3d_View) aView = theWindow->v3dView();
-    PartSet_Tools::convertTo2D(aPnt, mySketch, aView, aX, anY);
-
-    std::shared_ptr<ModelAPI_AttributeReference> aRef =
-                            std::dynamic_pointer_cast<ModelAPI_AttributeReference>(
-                            feature()->data()->attribute(SketchPlugin_Trim::BASE_OBJECT()));
-    aRef->setValue(anObject);
-
-    std::shared_ptr<GeomDataAPI_Point2D> anAttributePoint =
-                    std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
-                    feature()->data()->attribute(SketchPlugin_Trim::ENTITY_POINT()));
-    anAttributePoint->setValue(aX, anY);
-    // redisplay AIS presentation in viewer
+  ObjectPtr anObject;
+  if (theSelectedPrs.get() && theSelectedPrs->object().get())
+    anObject = theSelectedPrs->object();
+
+  gp_Pnt aPnt = PartSet_Tools::convertClickToPoint(theEvent->pos(), theWindow->v3dView());
+  double aX, anY;
+  Handle(V3d_View) aView = theWindow->v3dView();
+  PartSet_Tools::convertTo2D(aPnt, mySketch, aView, aX, anY);
+
+  std::shared_ptr<ModelAPI_AttributeReference> aRef =
+                          std::dynamic_pointer_cast<ModelAPI_AttributeReference>(
+                          feature()->data()->attribute(SketchPlugin_Trim::BASE_OBJECT()));
+  aRef->setValue(anObject);
+
+  std::shared_ptr<GeomDataAPI_Point2D> anAttributePoint =
+                  std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+                  feature()->data()->attribute(SketchPlugin_Trim::ENTITY_POINT()));
+  anAttributePoint->setValue(aX, anY);
+  // redisplay AIS presentation in viewer
 #ifndef HIGHLIGHT_STAYS_PROBLEM
-    // an attempt to clear highlighted item in the viewer: but of OCCT
-    XGUI_Tools::workshop(myWorkshop)->displayer()->clearSelected(true);
+  // an attempt to clear highlighted item in the viewer: but of OCCT
+  XGUI_Tools::workshop(myWorkshop)->displayer()->clearSelected(true);
 #endif
-    updateObject(feature());
-    aFilled = true;
-  }
+  updateObject(feature());
+  aFilled = true;
+
   return aFilled;
 }
 
@@ -179,6 +183,12 @@ QList<ModuleBase_ViewerPrsPtr> PartSet_WidgetFeaturePointSelector::getAttributeS
   return QList<ModuleBase_ViewerPrsPtr>();
 }
 
+//********************************************************************
+void PartSet_WidgetFeaturePointSelector::updateSelectionName()
+{
+  if (myBaseSelected)
+    ModuleBase_WidgetShapeSelector::updateSelectionName();
+}
 
 //********************************************************************
 bool PartSet_WidgetFeaturePointSelector::setSelection(
index cfb6329db434cfa06b72ef1f975dc0d7104fb75d..56c5105bbf0783e2617b18004b2c815b8096c743 100644 (file)
@@ -57,6 +57,10 @@ Q_OBJECT
   /// \return a boolean value
   virtual bool isValidSelection(const std::shared_ptr<ModuleBase_ViewerPrs>& theValue);
 
+  /// Activate or deactivate selection and selection filters
+  /// \return true if the selection filter of the widget is activated in viewer context
+  virtual bool activateSelectionAndFilters(bool toActivate);
+
   /// Set sketcher
   /// \param theSketch a sketcher object
   void setSketcher(CompositeFeaturePtr theSketch) { mySketch = theSketch; }
@@ -101,6 +105,9 @@ protected:
   /// a shape. If the attribute do not uses the shape, it is empty
   virtual QList<std::shared_ptr<ModuleBase_ViewerPrs>> getAttributeSelection() const;
 
+  /// Computes and updates name of selected object in the widget
+  virtual void updateSelectionName();
+
 protected:
   /// The methiod called when widget is activated
   virtual void activateCustom();
@@ -114,6 +121,7 @@ protected:
   CompositeFeaturePtr mySketch;
   Quantity_Color myHighlightColor;
   Quantity_Color mySelectionColor;
+  bool myBaseSelected;
 };
 
 #endif
\ No newline at end of file
index d57e409c5ce2fd60cf93d37976278d2421694236..d989afb3115b8666262fca9687f10512fef8c7f3 100644 (file)
@@ -335,7 +335,7 @@ AISObjectPtr SketchPlugin_Trim::getAISObject(AISObjectPtr thePrevious)
                                            data()->attribute(SketchPlugin_Trim::BASE_OBJECT()));
   ObjectPtr aBaseObject = aBaseObjectAttr->value();
   if (!aBaseObject.get())
-    return anAIS;
+    return AISObjectPtr();
   FeaturePtr aBaseFeature = ModelAPI_Feature::feature(aBaseObjectAttr->value());
 
   // point on feature
@@ -348,40 +348,44 @@ AISObjectPtr SketchPlugin_Trim::getAISObject(AISObjectPtr thePrevious)
   if (myCashedShapes.find(aBaseObject) == myCashedShapes.end())
     fillObjectShapes(aBaseObject);
 
+  GeomShapePtr aBaseShape;
+
   const std::set<GeomShapePtr>& aShapes = myCashedShapes[aBaseObject];
   if (!aShapes.empty()) {
     std::set<GeomShapePtr>::const_iterator anIt = aShapes.begin(), aLast = aShapes.end();
     for (; anIt != aLast; anIt++) {
-      GeomShapePtr aBaseShape = *anIt;
+      GeomShapePtr aShape = *anIt;
       std::shared_ptr<GeomAPI_Pnt> aProjectedPoint;
-      if (ModelGeomAlgo_Point2D::isPointOnEdge(aBaseShape, anAttributePnt, aProjectedPoint)) {
-        if (aBaseShape) {
-          if (!anAIS)
-            anAIS = AISObjectPtr(new GeomAPI_AISObject);
-          anAIS->createShape(aBaseShape);
-
-          std::shared_ptr<ModelAPI_AttributeBoolean> anAuxiliaryAttr =
-                 aBaseFeature->data()->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID());
-
-          bool isConstruction = anAuxiliaryAttr.get() != NULL && anAuxiliaryAttr->value();
-
-          std::vector<int> aColor;
-          aColor = Config_PropManager::color("Visualization", "operation_remove_feature_color",
-                                             OPERATION_REMOVE_FEATURE_COLOR());
-          double aWidth = SketchPlugin_SketchEntity::SKETCH_LINE_WIDTH();
-          int aLineStyle = SketchPlugin_SketchEntity::SKETCH_LINE_STYLE();
-          if (isConstruction) {
-            aWidth = SketchPlugin_SketchEntity::SKETCH_LINE_WIDTH_AUXILIARY();
-            aLineStyle = SketchPlugin_SketchEntity::SKETCH_LINE_STYLE_AUXILIARY();
-          }
-          anAIS->setColor(aColor[0], aColor[1], aColor[2]);
-          anAIS->setWidth(aWidth);
-          anAIS->setLineStyle(aLineStyle);
-          break;
-        }
-      }
+      if (ModelGeomAlgo_Point2D::isPointOnEdge(aShape, anAttributePnt, aProjectedPoint))
+        aBaseShape = aShape;
+    }
+  }
+
+  if (aBaseShape.get()) {
+    if (!anAIS)
+      anAIS = AISObjectPtr(new GeomAPI_AISObject);
+    anAIS->createShape(aBaseShape);
+
+    std::shared_ptr<ModelAPI_AttributeBoolean> anAuxiliaryAttr =
+            aBaseFeature->data()->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID());
+
+    bool isConstruction = anAuxiliaryAttr.get() != NULL && anAuxiliaryAttr->value();
+    std::vector<int> aColor;
+    aColor = Config_PropManager::color("Visualization", "operation_remove_feature_color",
+                                        OPERATION_REMOVE_FEATURE_COLOR());
+    double aWidth = SketchPlugin_SketchEntity::SKETCH_LINE_WIDTH();
+    int aLineStyle = SketchPlugin_SketchEntity::SKETCH_LINE_STYLE();
+    if (isConstruction) {
+      aWidth = SketchPlugin_SketchEntity::SKETCH_LINE_WIDTH_AUXILIARY();
+      aLineStyle = SketchPlugin_SketchEntity::SKETCH_LINE_STYLE_AUXILIARY();
     }
+    anAIS->setColor(aColor[0], aColor[1], aColor[2]);
+    // width is extened in several points in order to see this preview over highlight
+    anAIS->setWidth(aWidth + 2);
+    anAIS->setLineStyle(aLineStyle);
   }
+  else
+    anAIS = AISObjectPtr();
 
   return anAIS;
 }
index 41cb4c2eec324b9c5d1dc1bd3d9255c45ede47ee..f276b4f7a2f87a4015a29d2a12d5b0bbfa8013c1 100644 (file)
@@ -156,24 +156,16 @@ IF(${HAVE_SALOME})
   INCLUDE_DIRECTORIES(${SALOME_KERNEL_INCLUDE})
 ENDIF(${HAVE_SALOME})
 
-IF(VInspectorAPI)
-    message("VINSPECTOR is defined")
-    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})
 
-IF(DFBrowserAPI)
-    message("DFBROWSER is defined")
-    SET(PROJECT_LIBRARIES ${PROJECT_LIBRARIES} ${DFBrowserAPI})
-    SET(PROJECT_INCLUDES ${PROJECT_INCLUDES} ${DFBROWSER_INCLUDE_DIR})
+IF(TKTInspector)
+    message("TINSPECTOR is defined")
+    SET(PROJECT_LIBRARIES ${PROJECT_LIBRARIES} ${TKTInspector} ${TKVInspector})
+    SET(PROJECT_INCLUDES ${PROJECT_INCLUDES} ${TINSPECTOR_INCLUDE_DIR})
 
-    ADD_DEFINITIONS(-DDFBROWSER)
+    ADD_DEFINITIONS(-DTINSPECTOR)
 ENDIF()
 
 INCLUDE_DIRECTORIES(${PROJECT_INCLUDES})
index 72025823a4a3775c3900f16c43b90741f0c0fe64..a1fa3c468ae1314710e5d9d38b179e95976dd683 100644 (file)
@@ -151,13 +151,9 @@ void XGUI_ContextMenuMgr::createActions()
                                            tr("Select parent feature"), aDesktop);
   addAction("SHOW_FEATURE_CMD", aAction);
 
-#ifdef VINSPECTOR
-  aAction = ModuleBase_Tools::createAction(QIcon(), tr("Debug Visualization"), aDesktop);
-  addAction("VINSPECTOR_VIEW", aAction);
-#endif
-#ifdef DFBROWSER
-  aAction = ModuleBase_Tools::createAction(QIcon(), tr("DFBrowser"), aDesktop);
-  addAction("DFBROWSER_VIEW", aAction);
+#ifdef TINSPECTOR
+  aAction = ModuleBase_Tools::createAction(QIcon(), tr("TInspector"), aDesktop);
+  addAction("TINSPECTOR_VIEW", aAction);
 #endif
 
   buildObjBrowserMenu();
@@ -338,11 +334,8 @@ void XGUI_ContextMenuMgr::updateObjectBrowserMenu()
     action("DEFLECTION_CMD")->setEnabled(true);
 
   #ifdef _DEBUG
-    #ifdef VINSPECTOR
-      action("VINSPECTOR_VIEW")->setEnabled(true);
-    #endif
-    #ifdef DFBROWSER
-      action("DFBROWSER_VIEW")->setEnabled(true);
+    #ifdef TINSPECTOR
+      action("TINSPECTOR_VIEW")->setEnabled(true);
     #endif
   #endif
 
@@ -578,11 +571,8 @@ void XGUI_ContextMenuMgr::addObjBrowserMenu(QMenu* theMenu) const
   }
 #ifdef _DEBUG
   if (aSelected == 0) {
-    #ifdef VINSPECTOR
-    aActions.append(action("VINSPECTOR_VIEW"));
-    #endif
-    #ifdef DFBROWSER
-    aActions.append(action("DFBROWSER_VIEW"));
+    #ifdef TINSPECTOR
+    aActions.append(action("TINSPECTOR_VIEW"));
     #endif
   }
 #endif
index 004f9a96772d5d3354fd824c10dd37eec914d242..3970d8b32b2a6758e6e19fb8d6dd463ce2ec40a8 100644 (file)
 #include <AppElements_Viewer.h>
 #endif
 
-#ifdef VINSPECTOR
-#include <VInspectorAPI_Communicator.hxx>
-#ifndef HAVE_SALOME
-#include <AppElements_MainWindow.h>
-#endif
-static bool VInspector_FirstCall = true;
-#endif
-
 #include <ModelAPI_Document.h>
 #include <ModelAPI_Data.h>
 #include <ModelAPI_Object.h>
@@ -67,7 +59,7 @@ static bool VInspector_FirstCall = true;
 #include <TColStd_MapOfTransient.hxx>
 #include <TColStd_MapIteratorOfMapOfTransient.hxx>
 
-#ifdef VINSPECTOR
+#ifdef TINSPECTOR
 #include <VInspectorAPI_CallBack.hxx>
 #endif
 
@@ -136,9 +128,6 @@ XGUI_Displayer::XGUI_Displayer(XGUI_Workshop* theWorkshop)
   myIsTrihedronActive(true), myViewerBlockedRecursiveCount(0),
   myIsFirstAISContextUse(true)
 {
-  #ifdef VINSPECTOR
-  myCommunicator = 0;
-  #endif
   myCustomPrs = std::shared_ptr<GeomAPI_ICustomPrs>(new XGUI_CustomPrs(theWorkshop));
 }
 
@@ -270,7 +259,7 @@ bool XGUI_Displayer::display(ObjectPtr theObject, AISObjectPtr theAIS,
       anAISIO->Attributes()->SetFaceBoundaryDraw( Standard_True );
     anAISIO->SetDisplayMode(aDispMode);
     aContext->Display(anAISIO, aDispMode, 0, false, true, AIS_DS_Displayed);
-    #ifdef VINSPECTOR
+    #ifdef TINSPECTOR
     if (getCallBack()) getCallBack()->Display(anAISIO);
     #endif
     aDisplayed = true;
@@ -300,7 +289,7 @@ bool XGUI_Displayer::erase(ObjectPtr theObject, const bool theUpdateViewer)
     if (!anAIS.IsNull()) {
       emit beforeObjectErase(theObject, anObject);
       aContext->Remove(anAIS, false/*update viewer*/);
-      #ifdef VINSPECTOR
+      #ifdef TINSPECTOR
       if (getCallBack()) getCallBack()->Remove(anAIS);
       #endif
       aErased = true;
@@ -383,7 +372,7 @@ bool XGUI_Displayer::redisplay(ObjectPtr theObject, bool theUpdateViewer)
 #endif
       aContext->Redisplay(aAISIO, false);
 
-      #ifdef VINSPECTOR
+      #ifdef TINSPECTOR
       if (getCallBack()) getCallBack()->Redisplay(aAISIO);
       #endif
 
@@ -630,7 +619,7 @@ bool XGUI_Displayer::isActive(ObjectPtr theObject) const
 
   TColStd_ListOfInteger aModes;
   aContext->ActivatedModes(anAIS, aModes);
-  #ifdef VINSPECTOR
+  #ifdef TINSPECTOR
   if (getCallBack()) getCallBack()->ActivatedModes(anAIS, aModes);
   #endif
 
@@ -646,7 +635,7 @@ void XGUI_Displayer::setSelected(const  QList<ModuleBase_ViewerPrsPtr>& theValue
     return;
   aContext->UnhilightSelected(false);
   aContext->ClearSelected(false);
-  #ifdef VINSPECTOR
+  #ifdef TINSPECTOR
   if (getCallBack()) getCallBack()->ClearSelected();
   #endif
   NCollection_DataMap<TopoDS_Shape, NCollection_Map<Handle(AIS_InteractiveObject)>>
@@ -661,7 +650,7 @@ void XGUI_Displayer::setSelected(const  QList<ModuleBase_ViewerPrsPtr>& theValue
       // problem 2: IO is not specified, so the first found owner is selected, as a result
       // it might belong to another result
       aContext->AddOrRemoveSelected(aShape, false);
-      #ifdef VINSPECTOR
+      #ifdef TINSPECTOR
       if (getCallBack()) getCallBack()->AddOrRemoveSelected(aShape);
       #endif
 #else
@@ -686,7 +675,7 @@ void XGUI_Displayer::setSelected(const  QList<ModuleBase_ViewerPrsPtr>& theValue
           //aContext->SetSelected(anAIS, false);
           // The selection in the context was cleared, so the method sets the objects are selected
           aContext->AddOrRemoveSelected(anAIS, false);
-          #ifdef VINSPECTOR
+          #ifdef TINSPECTOR
           if (getCallBack()) getCallBack()->AddOrRemoveSelected(anAIS);
           #endif
         }
@@ -706,7 +695,7 @@ void XGUI_Displayer::clearSelected(const bool theUpdateViewer)
   if (!aContext.IsNull()) {
     aContext->UnhilightSelected(false);//UnhilightCurrents(false);
     aContext->ClearSelected(theUpdateViewer);
-    #ifdef VINSPECTOR
+    #ifdef TINSPECTOR
     if (getCallBack()) getCallBack()->ClearSelected();
     #endif
   }
@@ -724,7 +713,7 @@ bool XGUI_Displayer::eraseAll(const bool theUpdateViewer)
       if (!anIO.IsNull()) {
         emit beforeObjectErase(aObj, aAISObj);
         aContext->Remove(anIO, false/*update viewer*/);
-        #ifdef VINSPECTOR
+        #ifdef TINSPECTOR
         if (getCallBack()) getCallBack()->Remove(anIO);
         #endif
         aErased = true;
@@ -743,14 +732,14 @@ bool XGUI_Displayer::eraseAll(const bool theUpdateViewer)
 
 void deactivateObject(Handle(AIS_InteractiveContext) theContext,
                       Handle(AIS_InteractiveObject) theObject
-#ifdef VINSPECTOR
-                      , VInspectorAPI_CallBack* theCallBack
+#ifdef TINSPECTOR
+                      , Handle(VInspectorAPI_CallBack) theCallBack
 #endif
                       )
 {
   if (!theObject.IsNull()) {
     theContext->Deactivate(theObject);
-    #ifdef VINSPECTOR
+    #ifdef TINSPECTOR
     if (theCallBack) theCallBack->Deactivate(theObject);
     #endif
   }
@@ -763,7 +752,7 @@ void XGUI_Displayer::deactivateTrihedron(const bool theUpdateViewer) const
   if (!aTrihedron.IsNull() && aContext->IsDisplayed(aTrihedron)) {
     Handle(AIS_Trihedron) aTrie = Handle(AIS_Trihedron)::DownCast(aTrihedron);
     deactivateObject(aContext, aTrie
-    #ifdef VINSPECTOR
+    #ifdef TINSPECTOR
       , getCallBack()
     #endif
       );
@@ -771,38 +760,38 @@ void XGUI_Displayer::deactivateTrihedron(const bool theUpdateViewer) const
     /// #1136 hidden axis are selected in sketch
 #ifdef BEFORE_TRIHEDRON_PATCH
     deactivateObject(aContext, aTrie->XAxis()
-    #ifdef VINSPECTOR
+    #ifdef TINSPECTOR
       , getCallBack()
     #endif
     );
     deactivateObject(aContext, aTrie->YAxis()
-    #ifdef VINSPECTOR
+    #ifdef TINSPECTOR
       , getCallBack()
     #endif
     );
     deactivateObject(aContext, aTrie->Axis()
-    #ifdef VINSPECTOR
+    #ifdef TINSPECTOR
       , getCallBack()
     #endif
     );
     deactivateObject(aContext, aTrie->Position()
-    #ifdef VINSPECTOR
+    #ifdef TINSPECTOR
       , getCallBack()
     #endif
     );
 
     deactivateObject(aContext, aTrie->XYPlane()
-    #ifdef VINSPECTOR
+    #ifdef TINSPECTOR
       , getCallBack()
     #endif
     );
     deactivateObject(aContext, aTrie->XZPlane()
-    #ifdef VINSPECTOR
+    #ifdef TINSPECTOR
       , getCallBack()
     #endif
     );
     deactivateObject(aContext, aTrie->YZPlane()
-    #ifdef VINSPECTOR
+    #ifdef TINSPECTOR
       , getCallBack()
     #endif
     );
@@ -985,7 +974,7 @@ void XGUI_Displayer::activateAIS(const Handle(AIS_InteractiveObject)& theIO,
       aContext->Activate(theIO, theMode, false);
     } else
       aContext->Activate(theIO, theMode, false);
-    #ifdef VINSPECTOR
+    #ifdef TINSPECTOR
     if (getCallBack()) getCallBack()->Activate(theIO, theMode);
     #endif
 
@@ -1022,13 +1011,13 @@ void XGUI_Displayer::deactivateAIS(const Handle(AIS_InteractiveObject)& theIO,
   if (!aContext.IsNull()) {
     if (theMode == -1) {
       aContext->Deactivate(theIO);
-      #ifdef VINSPECTOR
+      #ifdef TINSPECTOR
       if (getCallBack()) getCallBack()->Deactivate(theIO);
       #endif
     }
     else {
       aContext->Deactivate(theIO, theMode);
-      #ifdef VINSPECTOR
+      #ifdef TINSPECTOR
       if (getCallBack()) getCallBack()->Deactivate(theIO, theMode);
       #endif
     }
@@ -1046,25 +1035,6 @@ Handle(AIS_InteractiveContext) XGUI_Displayer::AISContext() const
 {
   Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
   if (!aContext.IsNull() && myIsFirstAISContextUse/*&& !aContext->HasOpenedContext()*/) {
-#ifdef VINSPECTOR
-    if (VInspector_FirstCall) {
-      XGUI_Displayer* aDisplayer = (XGUI_Displayer*)this;
-
-      VInspectorAPI_Communicator* aCommunicator =
-                     VInspectorAPI_Communicator::loadPluginLibrary("TKVInspector.dll");
-      if (aCommunicator) {
-        aCommunicator->setContext(aContext);
-
-        aDisplayer->setCommunicator(aCommunicator);
-        #ifndef HAVE_SALOME
-        AppElements_Viewer* aViewer = myWorkshop->mainWindow()->viewer();
-        if (aViewer)
-          aViewer->setCallBack(aCommunicator->getCallBack());
-        #endif
-      }
-      VInspector_FirstCall = false;
-    }
-#endif
     XGUI_Displayer* aDisplayer = (XGUI_Displayer*)this;
     aDisplayer->myIsFirstAISContextUse = false;
     //aContext->OpenLocalContext();
@@ -1094,16 +1064,16 @@ bool XGUI_Displayer::displayAIS(AISObjectPtr theAIS, const bool toActivateInSele
   Handle(AIS_InteractiveObject) anAISIO = theAIS->impl<Handle(AIS_InteractiveObject)>();
   if (!aContext.IsNull() && !anAISIO.IsNull()) {
     aContext->Display(anAISIO, 0/*wireframe*/, 0, false/*update viewer*/, true, AIS_DS_Displayed);
-    #ifdef VINSPECTOR
+    #ifdef TINSPECTOR
     if (getCallBack()) getCallBack()->Display(anAISIO);
     #endif
     aDisplayed = true;
     aContext->Deactivate(anAISIO);
-    #ifdef VINSPECTOR
+    #ifdef TINSPECTOR
     if (getCallBack()) getCallBack()->Deactivate(anAISIO);
     #endif
     aContext->Load(anAISIO);
-    #ifdef VINSPECTOR
+    #ifdef TINSPECTOR
     if (getCallBack()) getCallBack()->Load(anAISIO);
     #endif
     if (toActivateInSelectionModes) {
@@ -1129,7 +1099,7 @@ bool XGUI_Displayer::eraseAIS(AISObjectPtr theAIS, const bool theUpdateViewer)
     Handle(AIS_InteractiveObject) anAISIO = theAIS->impl<Handle(AIS_InteractiveObject)>();
     if (!anAISIO.IsNull() && aContext->IsDisplayed(anAISIO)) {
       aContext->Remove(anAISIO, false/*update viewer*/);
-      #ifdef VINSPECTOR
+      #ifdef TINSPECTOR
       if (getCallBack()) getCallBack()->Remove(anAISIO);
       #endif
       aErased = true;
@@ -1310,7 +1280,7 @@ bool XGUI_Displayer::activate(const Handle(AIS_InteractiveObject)& theIO,
   // The result is the selection of the first IO is lost.
   TColStd_ListOfInteger aTColModes;
   aContext->ActivatedModes(theIO, aTColModes);
-  #ifdef VINSPECTOR
+  #ifdef TINSPECTOR
   if (getCallBack()) getCallBack()->ActivatedModes(theIO, aTColModes);
   #endif
   TColStd_ListIteratorOfListOfInteger itr( aTColModes );
@@ -1332,7 +1302,7 @@ bool XGUI_Displayer::activate(const Handle(AIS_InteractiveObject)& theIO,
   if (isDeactivated) {
     // the selection from the previous activation modes should be cleared manually (#26172)
     //theIO->ClearSelected();
-    //#ifdef VINSPECTOR
+    //#ifdef TINSPECTOR
     //if (getCallBack()) getCallBack()->ClearSelected(theIO);
     //#endif
 #ifndef CLEAR_OUTDATED_SELECTION_BEFORE_REDISPLAY
@@ -1355,7 +1325,7 @@ bool XGUI_Displayer::activate(const Handle(AIS_InteractiveObject)& theIO,
       aContext->SelectionManager()->Load(theIO);
     }
 
-    #ifdef VINSPECTOR
+    #ifdef TINSPECTOR
     if (getCallBack()) getCallBack()->Load(theIO);
     #endif
   }
@@ -1513,7 +1483,7 @@ void XGUI_Displayer::displayTrihedron(bool theToDisplay) const
                         Standard_True /* update viewer*/,
                         Standard_False /* allow decomposition */,
                         AIS_DS_Displayed /* xdisplay status */);
-    #ifdef VINSPECTOR
+    #ifdef TINSPECTOR
     if (getCallBack()) getCallBack()->Display(aTrihedron);
     #endif
 
@@ -1525,7 +1495,7 @@ void XGUI_Displayer::displayTrihedron(bool theToDisplay) const
     deactivateTrihedron(false);
 
     aContext->Erase(aTrihedron);
-    #ifdef VINSPECTOR
+    #ifdef TINSPECTOR
     if (getCallBack()) getCallBack()->Remove(aTrihedron);
     #endif
   }
@@ -1543,24 +1513,6 @@ QIntList XGUI_Displayer::activeSelectionModes() const
   return aModes;
 }
 
-#ifdef VINSPECTOR
-void XGUI_Displayer::setCommunicator(VInspectorAPI_Communicator* theCommunicator)
-{
-  myCommunicator = theCommunicator;
-}
-
-void XGUI_Displayer::setVInspectorVisible(const bool theVisible)
-{
-  if (myCommunicator)
-    myCommunicator->setVisible(true);
-}
-
-VInspectorAPI_CallBack* XGUI_Displayer::getCallBack() const
-{
-  return myCommunicator ? myCommunicator->getCallBack() : NULL;
-}
-#endif
-
 void XGUI_Displayer::AddOrRemoveSelectedShapes(Handle(AIS_InteractiveContext) theContext,
                            const NCollection_DataMap<TopoDS_Shape,
                            NCollection_Map<Handle(AIS_InteractiveObject)>>& theShapesToBeSelected)
index 6374f157bb1decc6f0ba01eba7c8572d5defedef..b4398e2e7118aaf1fcb5a6017b70d47f1671c9d8 100644 (file)
@@ -33,8 +33,7 @@ class ModuleBase_ViewerPrs;
 class ModelAPI_Feature;
 class XGUI_Workshop;
 
-#ifdef VINSPECTOR
-class VInspectorAPI_Communicator;
+#ifdef TINSPECTOR
 class VInspectorAPI_CallBack;
 #endif
 
@@ -259,12 +258,10 @@ class XGUI_EXPORT XGUI_Displayer: public QObject
   /// Selection modes will be returned according to TopAbs_ShapeEnum
   QIntList activeSelectionModes() const;
 
-#ifdef VINSPECTOR
-  void setVInspectorVisible(const bool theVisible);
-
-  void setCommunicator(VInspectorAPI_Communicator* theCommunicator);
-
-  VInspectorAPI_CallBack* getCallBack() const;
+#ifdef TINSPECTOR
+  void setCallBack(const Handle(VInspectorAPI_CallBack)& theCallBack)
+    { myVCallBack = theCallBack; }
+  Handle(VInspectorAPI_CallBack) getCallBack() const { return myVCallBack; }
 #endif
   /// Converts shape type (TopAbs_ShapeEnum) to selection mode
   /// \param theShapeType a shape type from TopAbs_ShapeEnum
@@ -360,8 +357,8 @@ private:
  protected:
    /// Reference to workshop
   XGUI_Workshop* myWorkshop;
-#ifdef VINSPECTOR
-  VInspectorAPI_Communicator* myCommunicator; ///< callback to debug display, show/hide it
+#ifdef TINSPECTOR
+  Handle(VInspectorAPI_CallBack) myVCallBack;
 #endif
   /// A container for selection filters
   Handle(SelectMgr_AndFilter) myAndFilter;
index df975ca9578ec657acc5aff23c8213248225ff67..6a85f224db60e5f455dc4ad2d355195ee09f9d72 100755 (executable)
@@ -26,7 +26,7 @@
 
 #include <SelectMgr_ListIteratorOfListOfFilter.hxx>
 
-#ifdef VINSPECTOR
+#ifdef TINSPECTOR
 #include <VInspectorAPI_CallBack.hxx>
 #endif
 
@@ -66,7 +66,7 @@ void XGUI_SelectionMgr::setSelectedOwners(const SelectMgr_IndexedMapOfOwner& the
       Handle(SelectMgr_EntityOwner) anOwner = theSelectedOwners(i);
 
       aContext->AddOrRemoveSelected(anOwner, isUpdateViewer);
-      #ifdef VINSPECTOR
+      #ifdef TINSPECTOR
       if (myWorkshop->displayer()->getCallBack())
         myWorkshop->displayer()->getCallBack()->AddOrRemoveSelected(anOwner);
       #endif
index a88f5a4caffc90bbe7f72ba6780264f25dcb322c..baa7594cb21d38702667a093818af4ab721a140b 100755 (executable)
 
 #include <iterator>
 
-#ifdef DFBROWSER
+#ifdef TINSPECTOR
 #include <CDF_Session.hxx>
 #include <CDF_Application.hxx>
-#include <DFBrowserAPI_Communicator.hxx>
-static bool DFBrowser_FirstCall = true;
+#include <TInspector_Communicator.hxx>
+#include <VInspector_CallBack.hxx>
+static TInspector_Communicator* MyTCommunicator;
+static Handle(VInspector_CallBack) MyVCallBack;
+
 #endif
 
 #ifdef _DEBUG
@@ -1372,24 +1375,35 @@ void XGUI_Workshop::onContextMenuCommand(const QString& theId, bool isChecked)
   } else if (theId == "SHOW_FEATURE_CMD") {
     highlightFeature(aObjects);
   }
-#ifdef VINSPECTOR
-  else if (theId == "VINSPECTOR_VIEW") {
-    displayer()->setVInspectorVisible(true);
-  }
-#endif
-#ifdef DFBROWSER
-  else if (theId == "DFBROWSER_VIEW") {
-    if (DFBrowser_FirstCall) {
-      Handle(CDF_Application) anApplication = CDF_Session::CurrentSession()->CurrentApplication();
-      DFBrowserAPI_Communicator* aCommunicator =
-                     DFBrowserAPI_Communicator::loadPluginLibrary("TKDFBrowser.dll");
-      if (aCommunicator) {
-        aCommunicator->setApplication(anApplication);
+#ifdef TINSPECTOR
+  else if (theId == "TINSPECTOR_VIEW") {
+    Handle(CDF_Application) anApplication = CDF_Session::CurrentSession()->CurrentApplication();
+    if (!anApplication.IsNull())
+    {
+      if (!MyTCommunicator)
+      {
+        MyTCommunicator = new TInspector_Communicator();
+
+        NCollection_List<Handle(Standard_Transient)> aParameters;
+        aParameters.Append(anApplication);
         Handle(AIS_InteractiveContext) aContext = viewer()->AISContext();
-        if (aContext)
-          aCommunicator->setContext(aContext);
+        if (!aContext.IsNull())
+          aParameters.Append(aContext);
+
+        MyVCallBack = new VInspector_CallBack();
+        myDisplayer->setCallBack(MyVCallBack);
+        #ifndef HAVE_SALOME
+        AppElements_Viewer* aViewer = mainWindow()->viewer();
+        if (aViewer)
+          aViewer->setCallBack(MyVCallBack);
+        #endif
+        aParameters.Append(MyVCallBack);
+
+        MyTCommunicator->init(aParameters);
+        MyTCommunicator->Activate("TKVInspector"); // to have filled callback by model
+        MyTCommunicator->Activate("TKDFBrowser");
       }
-      DFBrowser_FirstCall = false;
+      MyTCommunicator->setVisible(true);
     }
   }
 #endif