]> OCCT Git - occt-copy.git/commitdiff
0030268: Inspectors - improvements in VInspector plugin
authornds <nds@opencascade.com>
Thu, 7 Mar 2019 13:21:25 +0000 (16:21 +0300)
committernds <nds@opencascade.com>
Thu, 7 Mar 2019 13:21:25 +0000 (16:21 +0300)
65 files changed:
src/SelectMgr/SelectMgr_ViewerSelector.cxx
src/SelectMgr/SelectMgr_ViewerSelector.hxx
src/StdSelect/StdSelect_ViewerSelector3d.cxx
tools/DFBrowser/DFBrowser_Window.cxx
tools/DFBrowser/DFBrowser_Window.hxx
tools/VInspector/FILES
tools/VInspector/VInspector_CallBack.cxx
tools/VInspector/VInspector_CallBack.hxx
tools/VInspector/VInspector_ItemAspectWindow.cxx
tools/VInspector/VInspector_ItemBase.cxx
tools/VInspector/VInspector_ItemBase.hxx
tools/VInspector/VInspector_ItemContext.cxx
tools/VInspector/VInspector_ItemFolderObject.cxx
tools/VInspector/VInspector_ItemGraphic3dCStructure.cxx
tools/VInspector/VInspector_ItemGraphic3dCView.cxx
tools/VInspector/VInspector_ItemGraphic3dCamera.cxx
tools/VInspector/VInspector_ItemGraphic3dClipPlane.cxx
tools/VInspector/VInspector_ItemGraphic3dGroup.cxx
tools/VInspector/VInspector_ItemGraphic3dTransformPers.cxx
tools/VInspector/VInspector_ItemHistoryElement.cxx
tools/VInspector/VInspector_ItemHistoryRoot.cxx
tools/VInspector/VInspector_ItemHistoryType.cxx
tools/VInspector/VInspector_ItemOpenGlElement.cxx
tools/VInspector/VInspector_ItemOpenGlElement.hxx
tools/VInspector/VInspector_ItemPresentableObject.cxx
tools/VInspector/VInspector_ItemPresentations.cxx
tools/VInspector/VInspector_ItemPrs3dAspect.cxx
tools/VInspector/VInspector_ItemPrs3dAspect.hxx
tools/VInspector/VInspector_ItemPrs3dDrawer.cxx
tools/VInspector/VInspector_ItemPrs3dPresentation.cxx
tools/VInspector/VInspector_ItemSelect3DSensitiveSetItem.cxx
tools/VInspector/VInspector_ItemSelectBasicsEntityOwner.cxx
tools/VInspector/VInspector_ItemSelectBasicsSensitiveEntity.cxx
tools/VInspector/VInspector_ItemSelectMgrBaseFrustum.cxx [new file with mode: 0644]
tools/VInspector/VInspector_ItemSelectMgrBaseFrustum.hxx [new file with mode: 0644]
tools/VInspector/VInspector_ItemSelectMgrFilter.cxx
tools/VInspector/VInspector_ItemSelectMgrSelectingVolumeManager.cxx [new file with mode: 0644]
tools/VInspector/VInspector_ItemSelectMgrSelectingVolumeManager.hxx [new file with mode: 0644]
tools/VInspector/VInspector_ItemSelectMgrSelection.cxx
tools/VInspector/VInspector_ItemSelectMgrSensitiveEntity.cxx
tools/VInspector/VInspector_ItemSelectMgrViewerSelector.cxx [new file with mode: 0644]
tools/VInspector/VInspector_ItemSelectMgrViewerSelector.hxx [new file with mode: 0644]
tools/VInspector/VInspector_ItemSelectMgrViewerSelectorPicked.cxx [new file with mode: 0644]
tools/VInspector/VInspector_ItemSelectMgrViewerSelectorPicked.hxx [new file with mode: 0644]
tools/VInspector/VInspector_ItemV3dView.cxx
tools/VInspector/VInspector_ItemV3dViewer.cxx
tools/VInspector/VInspector_TableModelValues.cxx
tools/VInspector/VInspector_TableModelValues.hxx
tools/VInspector/VInspector_Tools.cxx
tools/VInspector/VInspector_Tools.hxx
tools/VInspector/VInspector_ViewModel.cxx
tools/VInspector/VInspector_ViewModel.hxx
tools/VInspector/VInspector_Window.cxx
tools/VInspector/VInspector_Window.hxx
tools/VInspectorPaneAIS/FILES
tools/VInspectorPaneAIS/VInspectorPaneAIS_PaneCreator.cxx
tools/VInspectorPaneAIS/VInspectorPaneAIS_Shape.cxx
tools/VInspectorPaneAIS/VInspectorPaneAIS_Shape.hxx
tools/VInspectorPaneAIS/VInspectorPaneAIS_Trihedron.cxx [deleted file]
tools/VInspectorPaneAIS/VInspectorPaneAIS_Trihedron.hxx [deleted file]
tools/View/View_Displayer.cxx
tools/View/View_Tools.cxx
tools/View/View_Tools.hxx
tools/ViewControl/ViewControl_ColorSelector.cxx
tools/ViewControl/ViewControl_Table.cxx

index b0dfab611c28ad9f2103d7a9ad3fd83133f72787..0476e7fd6bf45d5e4032780d020c298b774548ed 100644 (file)
 
 #include <algorithm>
 
+//#define REPORT_SELECTION_BUILD
+#ifdef REPORT_SELECTION_BUILD
+#include <Message_Alerts.hxx>
+#include <Message_PerfMeter.hxx>
+#endif
+
 IMPLEMENT_STANDARD_RTTIEXT(SelectMgr_ViewerSelector, Standard_Transient)
 
 namespace {
@@ -199,6 +205,12 @@ void SelectMgr_ViewerSelector::checkOverlap (const Handle(SelectBasics_Sensitive
                                              const gp_GTrsf& theInversedTrsf,
                                              SelectMgr_SelectingVolumeManager& theMgr)
 {
+  #ifdef REPORT_SELECTION_BUILD
+  Message_PerfMeter aPerfMeter;
+  MESSAGE_INFO_OBJECT (theEntity, "checkOverlap", "", &aPerfMeter, NULL);
+  Handle(Message_Alert) aParentAlert = OCCT_Message_Alert;
+  #endif
+
   Handle(SelectMgr_EntityOwner) anOwner (Handle(SelectMgr_EntityOwner)::DownCast (theEntity->OwnerId()));
   Handle(SelectMgr_SelectableObject) aSelectable;
   Standard_Boolean toRestoresViewClipEnabled = Standard_False;
@@ -248,7 +260,13 @@ void SelectMgr_ViewerSelector::checkOverlap (const Handle(SelectBasics_Sensitive
   }
 
   SelectBasics_PickResult aPickResult;
+  #ifdef REPORT_SELECTION_BUILD
+  MESSAGE_INFO (TCollection_AsciiString ("Matches - start"), "", &aPerfMeter, aParentAlert);
+  #endif
   const Standard_Boolean isMatched = theEntity->Matches(theMgr, aPickResult);
+  #ifdef REPORT_SELECTION_BUILD
+  MESSAGE_INFO (TCollection_AsciiString ("Matches - end"), "", &aPerfMeter, aParentAlert);
+  #endif
   if (toRestoresViewClipEnabled)
   {
     theMgr.SetViewClippingEnabled (Standard_True);
@@ -356,6 +374,12 @@ void SelectMgr_ViewerSelector::traverseObject (const Handle(SelectMgr_Selectable
     return;
   }
 
+  #ifdef REPORT_SELECTION_BUILD
+  Message_PerfMeter aPerfMeter;
+  MESSAGE_INFO_OBJECT (theObject, "traverseObject", "", &aPerfMeter, NULL);
+  Handle(Message_Alert) aParentAlert = OCCT_Message_Alert;
+  #endif
+
   const opencascade::handle<BVH_Tree<Standard_Real, 3> >& aSensitivesTree = anEntitySet->BVH();
   gp_GTrsf aInversedTrsf;
   if (theObject->HasTransformation() || !theObject->TransformPersistence().IsNull())
@@ -403,6 +427,10 @@ void SelectMgr_ViewerSelector::traverseObject (const Handle(SelectMgr_Selectable
   Standard_Integer aHead = -1;
   for (;;)
   {
+    #ifdef REPORT_SELECTION_BUILD
+    MESSAGE_INFO (TCollection_AsciiString ("aNode") + aNode, "", &aPerfMeter, aParentAlert);
+    #endif
+
     if (!aSensitivesTree->IsOuter (aNode))
     {
       const Standard_Integer aLeftChildIdx  = aSensitivesTree->Child<0> (aNode);
@@ -496,6 +524,12 @@ void SelectMgr_ViewerSelector::traverseObject (const Handle(SelectMgr_Selectable
 //=======================================================================
 void SelectMgr_ViewerSelector::TraverseSensitives()
 {
+#ifdef REPORT_SELECTION_BUILD
+  Message_PerfMeter aPerfMeter;
+  MESSAGE_INFO ("TraverseSensitives", "", &aPerfMeter, NULL);
+  Handle(Message_Alert) aParentAlert = OCCT_Message_Alert;
+#endif
+
   mystored.Clear();
 
   Standard_Integer aWidth;
@@ -520,6 +554,11 @@ void SelectMgr_ViewerSelector::TraverseSensitives()
 
   for (Standard_Integer aBVHSetIt = 0; aBVHSetIt < SelectMgr_SelectableObjectSet::BVHSubsetNb; ++aBVHSetIt)
   {
+    #ifdef REPORT_SELECTION_BUILD
+    MESSAGE_INFO (TCollection_AsciiString ("aBVHSetIt") + aBVHSetIt, "", &aPerfMeter, aParentAlert);
+    Handle(Message_Alert) aParentAlertLevel1 = OCCT_Message_Alert;
+    #endif
+
     SelectMgr_SelectableObjectSet::BVHSubset aBVHSubset =
       static_cast<SelectMgr_SelectableObjectSet::BVHSubset> (aBVHSetIt);
 
@@ -578,6 +617,9 @@ void SelectMgr_ViewerSelector::TraverseSensitives()
     Standard_Integer aHead = -1;
     for (;;)
     {
+      #ifdef REPORT_SELECTION_BUILD
+      MESSAGE_INFO (TCollection_AsciiString ("aNode - ") + aNode, "", &aPerfMeter, aParentAlertLevel1);
+      #endif
       if (!aBVHTree->IsOuter (aNode))
       {
         const Standard_Integer aLeftChildIdx  = aBVHTree->Child<0> (aNode);
@@ -815,6 +857,12 @@ TCollection_AsciiString SelectMgr_ViewerSelector::Status (const Handle(SelectMgr
 //=======================================================================
 void SelectMgr_ViewerSelector::SortResult()
 {
+#ifdef REPORT_SELECTION_BUILD
+  Message_PerfMeter aPerfMeter;
+  MESSAGE_INFO ("SortResult", "", &aPerfMeter, NULL);
+  Handle(Message_Alert) aParentAlert = OCCT_Message_Alert;
+#endif
+
   if(mystored.IsEmpty()) return;
 
   const Standard_Integer anExtent = mystored.Extent();
index 78691625f81d3dd4388a1af7abefed079069b48d..953665ec8faf8a71da501e95a4a601a5ab0a440d 100644 (file)
@@ -109,6 +109,9 @@ public:
   //!   depth which is used to choose among objects of the same priority.
   void SetPickClosest (const Standard_Boolean theToPreferClosest) { preferclosest = theToPreferClosest; }
 
+  //! Return preference of selecting one object for OnePicked() method
+  Standard_Boolean IsPickClosest() const { return preferclosest; }
+
   //! Returns the number of detected owners.
   Standard_Integer NbPicked() const { return mystored.Extent(); }
 
index 3e6c6106d500490941f2958f46140bfc020a70de..19fc15a01dcdb27d5dca760bd289fa87d052bf54 100644 (file)
 
 #include <OSD_Timer.hxx>
 
+//#define REPORT_SELECTION_BUILD
+#ifdef REPORT_SELECTION_BUILD
+#include <Message_Alerts.hxx>
+#include <Message_PerfMeter.hxx>
+#endif
 
 IMPLEMENT_STANDARD_RTTIEXT(StdSelect_ViewerSelector3d,SelectMgr_ViewerSelector)
 
@@ -117,6 +122,11 @@ void StdSelect_ViewerSelector3d::Pick (const Standard_Integer theXPix,
                                        const Standard_Integer theYPix,
                                        const Handle(V3d_View)& theView)
 {
+#ifdef REPORT_SELECTION_BUILD
+  Message_PerfMeter aPerfMeter;
+  MESSAGE_INFO ("Pick", TCollection_AsciiString ("theXPix = ") + theXPix + ", theYPix = " + theYPix, &aPerfMeter, NULL);
+  Handle(Message_Alert) aParentAlert = OCCT_Message_Alert;
+#endif
   updateZLayers (theView);
   if(myToUpdateTolerance)
   {
@@ -131,6 +141,11 @@ void StdSelect_ViewerSelector3d::Pick (const Standard_Integer theXPix,
   mySelectingVolumeMgr.SetWindowSize (aWidth, aHeight);
   gp_Pnt2d aMousePos (static_cast<Standard_Real> (theXPix),
                       static_cast<Standard_Real> (theYPix));
+
+#ifdef REPORT_SELECTION_BUILD
+  MESSAGE_INFO ("Pick", TCollection_AsciiString ("aMousePos - X = ") + aMousePos.X() + ", Y = " + aMousePos.Y(), &aPerfMeter, aParentAlert);
+#endif
+
   mySelectingVolumeMgr.BuildSelectingVolume (aMousePos);
   mySelectingVolumeMgr.SetViewClipping (theView->ClipPlanes());
 
index 5801326f843a3cbb3992f00ac4ebb7932b627bdc..a34cd16f432414e18c0d7458d6ac738591f2feb7 100644 (file)
@@ -659,7 +659,7 @@ void DFBrowser_Window::onExpand()
   for (int aSelectedId = 0, aSize = aSelectedIndices.size(); aSelectedId < aSize; aSelectedId++)
   {
     int aLevels = 2;
-    setExpanded (myTreeView, aSelectedIndices[aSelectedId], true, aLevels);
+    TreeModel_Tools::SetExpanded (myTreeView, aSelectedIndices[aSelectedId], true, aLevels);
   }
   QApplication::restoreOverrideCursor();
 }
@@ -677,7 +677,7 @@ void DFBrowser_Window::onExpandAll()
   for (int  aSelectedId = 0, aSize = aSelectedIndices.size(); aSelectedId < aSize; aSelectedId++)
   {
     int aLevels = -1;
-    setExpanded (myTreeView, aSelectedIndices[aSelectedId], true, aLevels);
+    TreeModel_Tools::SetExpanded (myTreeView, aSelectedIndices[aSelectedId], true, aLevels);
   }
   QApplication::restoreOverrideCursor();
 }
@@ -692,7 +692,7 @@ void DFBrowser_Window::onCollapseAll()
   QModelIndexList aSelectedIndices = aSelectionModel->selectedIndexes();
   for (int aSelectedId = 0, aSize = aSelectedIndices.size(); aSelectedId < aSize; aSelectedId++) {
     int aLevels = -1;
-    setExpanded (myTreeView, aSelectedIndices[aSelectedId], false, aLevels);
+    TreeModel_Tools::SetExpanded (myTreeView, aSelectedIndices[aSelectedId], false, aLevels);
   }
 }
 
@@ -988,26 +988,3 @@ void DFBrowser_Window::findPresentations (const QModelIndexList& theIndices, AIS
     thePresentations.Append (aPresentation);
   }
 }
-
-// =======================================================================
-// function : setExpanded
-// purpose :
-// =======================================================================
-void DFBrowser_Window::setExpanded (QTreeView* theTreeView, const QModelIndex& theIndex, const bool isExpanded,
-                                    int& theLevels)
-{
-  bool isToExpand = theLevels == -1 || theLevels > 0;
-  if (!isToExpand)
-    return;
-
-  theTreeView->setExpanded (theIndex, isExpanded);
-  if (theLevels != -1)
-    theLevels--;
-
-  QAbstractItemModel* aModel = theTreeView->model();
-  for (int aRowId = 0, aRows = aModel->rowCount (theIndex); aRowId < aRows; aRowId++)
-  {
-    int aLevels = theLevels;
-    setExpanded (theTreeView, aModel->index (aRowId, 0, theIndex), isExpanded, aLevels);
-  }
-}
index 93fb3d7e0c18ba1121e4dc0000a1dc093360d3a0..66f3479735c2560ee8c3789d521fb1b598992e1e 100644 (file)
@@ -206,13 +206,6 @@ protected:
   //! \return container of presentations or NULL
   void findPresentations (const QModelIndexList& theIndices, AIS_ListOfInteractive& thePresentations);
 
-  //! Recursive items expanding in tree view staring from the index
-  //! \param theTreeView an OCAF tree view
-  //! \param theParentIndex an index which children should be expanded
-  //! \param isExpanded a boolean state if the item should be expanded or collapsed
-  //! \param theLevels a number of levels to be expanded, or -1 for all levels
-  static void setExpanded (QTreeView* theTreeView, const QModelIndex& theParentIndex, const bool isExpanded, int& theLevels);
-
 private:
 
   DFBrowser_Module* myModule; //!< current module
index 764cf39cdd8f41be6dfe646a9893cd755384fecb..bc4ca4a8c3cecbb4ab092e796836d2eab6c160f4 100644 (file)
@@ -50,8 +50,16 @@ VInspector_ItemSelectBasicsEntityOwner.cxx
 VInspector_ItemSelectBasicsEntityOwner.hxx
 VInspector_ItemSelectBasicsSensitiveEntity.cxx
 VInspector_ItemSelectBasicsSensitiveEntity.hxx
+VInspector_ItemSelectMgrViewerSelector.cxx
+VInspector_ItemSelectMgrViewerSelector.hxx
+VInspector_ItemSelectMgrViewerSelectorPicked.cxx
+VInspector_ItemSelectMgrViewerSelectorPicked.hxx
+VInspector_ItemSelectMgrBaseFrustum.cxx
+VInspector_ItemSelectMgrBaseFrustum.hxx
 VInspector_ItemSelectMgrFilter.cxx
 VInspector_ItemSelectMgrFilter.hxx
+VInspector_ItemSelectMgrSelectingVolumeManager.cxx
+VInspector_ItemSelectMgrSelectingVolumeManager.hxx
 VInspector_ItemSelectMgrSelection.cxx
 VInspector_ItemSelectMgrSelection.hxx
 VInspector_ItemSelectMgrSensitiveEntity.cxx
index 4fec137ba25954450db9d9a312c27e59bbce08ab..a42ff3b20876bc1e25d2bcf9cb76f384d31b55af 100644 (file)
@@ -38,6 +38,9 @@ IMPLEMENT_STANDARD_RTTIEXT(VInspector_CallBack, VInspectorAPI_CallBack)
 // =======================================================================
 void VInspector_CallBack::Activate (Handle(AIS_InteractiveObject) thePrs, const Standard_Integer theMode)
 {
+  if (!myHistoryModel)
+    return;
+
   QList<QVariant> anInfo;
   if (!thePrs.IsNull())
     anInfo = VInspector_Tools::GetInfo (thePrs);
@@ -57,6 +60,8 @@ void VInspector_CallBack::Activate (Handle(AIS_InteractiveObject) thePrs, const
 // =======================================================================
 void VInspector_CallBack::AddOrRemoveSelected (const TopoDS_Shape& theShape)
 {
+  if (!myHistoryModel)
+    return;
   QList<QVariant> aValues;
   aValues.append (""); // Name
   aValues.append (""); // Pointer
@@ -71,6 +76,8 @@ void VInspector_CallBack::AddOrRemoveSelected (const TopoDS_Shape& theShape)
 // =======================================================================
 void VInspector_CallBack::AddOrRemoveSelected (Handle(AIS_InteractiveObject) thePrs)
 {
+  if (!myHistoryModel)
+    return;
   QList<QVariant> aValues = VInspector_Tools::GetInfo (thePrs);
   aValues.append (VInspector_Tools::GetSelectedInfoPointers (myContext)); // SelectionInfo
   myHistoryModel->AddElement (VInspector_CallBackMode_AddOrRemoveSelected, aValues);
@@ -82,6 +89,8 @@ void VInspector_CallBack::AddOrRemoveSelected (Handle(AIS_InteractiveObject) the
 // =======================================================================
 void VInspector_CallBack::AddOrRemoveSelected (Handle(SelectMgr_EntityOwner) theOwner)
 {
+  if (!myHistoryModel)
+    return;
   QList<QVariant> aValues;
   aValues.append (""); // Name
   aValues.append (VInspector_Tools::GetPointerInfo (theOwner, true).ToCString()); // Pointer
@@ -97,6 +106,8 @@ void VInspector_CallBack::AddOrRemoveSelected (Handle(SelectMgr_EntityOwner) the
 // =======================================================================
 void VInspector_CallBack::ClearSelected()
 {
+  if (!myHistoryModel)
+    return;
   QList<QVariant> aValues;
   myHistoryModel->AddElement (VInspector_CallBackMode_ClearSelected, aValues);
 }
@@ -107,6 +118,8 @@ void VInspector_CallBack::ClearSelected()
 // =======================================================================
 void VInspector_CallBack::MoveTo (const Standard_Integer/* theXPix*/, const Standard_Integer/* theYPix*/)
 {
+  if (!myHistoryModel)
+    return;
   QList<QVariant> aValues;
   aValues = VInspector_Tools::GetHighlightInfo (myContext);
   myHistoryModel->AddElement (VInspector_CallBackMode_MoveTo, aValues);
@@ -118,6 +131,8 @@ void VInspector_CallBack::MoveTo (const Standard_Integer/* theXPix*/, const Stan
 // =======================================================================
 void VInspector_CallBack::Select()
 {
+  if (!myHistoryModel)
+    return;
   QList<QVariant> aValues;
   aValues = VInspector_Tools::GetSelectedInfo (myContext);
   myHistoryModel->AddElement (VInspector_CallBackMode_Select, aValues);
@@ -129,6 +144,8 @@ void VInspector_CallBack::Select()
 // =======================================================================
 void VInspector_CallBack::ShiftSelect()
 {
+  if (!myHistoryModel)
+    return;
   QList<QVariant> aValues;
   aValues = VInspector_Tools::GetSelectedInfo (myContext);
   myHistoryModel->AddElement (VInspector_CallBackMode_ShiftSelect, aValues);
index 57bdeae4ffd92dee5094497943e9df02ba3784d2..00290c73b51bd3479f5c6f069a5969ae63c6461c 100644 (file)
@@ -43,22 +43,22 @@ public:
   //! Appends displayed presentation into history model
   //! \param thePrs the presentation
   virtual void Display (Handle(AIS_InteractiveObject) thePrs) Standard_OVERRIDE
-  { myHistoryModel->AddElement (VInspector_CallBackMode_Display, VInspector_Tools::GetInfo (thePrs)); }
+  { if (myHistoryModel != 0) myHistoryModel->AddElement (VInspector_CallBackMode_Display, VInspector_Tools::GetInfo (thePrs)); }
 
   //! Appends redisplayed presentation into history model
   //! \param thePrs the presentation
   virtual void Redisplay (Handle(AIS_InteractiveObject) thePrs) Standard_OVERRIDE
-  { myHistoryModel->AddElement (VInspector_CallBackMode_Redisplay, VInspector_Tools::GetInfo (thePrs)); }
+  { if (myHistoryModel != 0) myHistoryModel->AddElement (VInspector_CallBackMode_Redisplay, VInspector_Tools::GetInfo (thePrs)); }
 
   //! Appends removed presentation into history model
   //! \param thePrs the presentation
   virtual void Remove (Handle(AIS_InteractiveObject) thePrs) Standard_OVERRIDE
-  { myHistoryModel->AddElement (VInspector_CallBackMode_Remove, VInspector_Tools::GetInfo (thePrs)); }
+  { if (myHistoryModel != 0) myHistoryModel->AddElement (VInspector_CallBackMode_Remove, VInspector_Tools::GetInfo (thePrs)); }
 
   //! Appends loaded presentation into history model
   //! \param thePrs the presentation
   virtual void Load (Handle(AIS_InteractiveObject) thePrs) Standard_OVERRIDE
-  { myHistoryModel->AddElement (VInspector_CallBackMode_Load, VInspector_Tools::GetInfo (thePrs)); }
+  { if (myHistoryModel != 0) myHistoryModel->AddElement (VInspector_CallBackMode_Load, VInspector_Tools::GetInfo (thePrs)); }
 
   //! Appends information about modes activation
   //! \param thePrs the presentation
@@ -75,13 +75,14 @@ public:
   //! Appends information about modes deactivation
   //! \param thePrs the presentation
   virtual void Deactivate (Handle(AIS_InteractiveObject) thePrs) Standard_OVERRIDE
-  { myHistoryModel->AddElement (VInspector_CallBackMode_Deactivate, VInspector_Tools::GetInfo (thePrs)); }
+  { if (myHistoryModel != 0) myHistoryModel->AddElement (VInspector_CallBackMode_Deactivate, VInspector_Tools::GetInfo (thePrs)); }
 
   //! Appends information about modes deactivation
   //! \param thePrs the presentation
   //! \param theMode the selection mode
   virtual void Deactivate (Handle(AIS_InteractiveObject) thePrs, const Standard_Integer theMode) Standard_OVERRIDE
-  { (void)theMode; myHistoryModel->AddElement (VInspector_CallBackMode_Deactivate, VInspector_Tools::GetInfo (thePrs)); }
+  { (void)theMode;
+    if (myHistoryModel != 0) myHistoryModel->AddElement (VInspector_CallBackMode_Deactivate, VInspector_Tools::GetInfo (thePrs)); }
 
   //! Appends information about selection change
   //! \param theShape the selected shape
@@ -101,7 +102,7 @@ public:
   //! Appends information about selection clear
   //! \param thePrs the selected presentation
   virtual void ClearSelected (Handle(AIS_InteractiveObject) thePrs) Standard_OVERRIDE
-  { myHistoryModel->AddElement (VInspector_CallBackMode_ClearSelected, VInspector_Tools::GetInfo (thePrs)); }
+  { if (myHistoryModel != 0) myHistoryModel->AddElement (VInspector_CallBackMode_ClearSelected, VInspector_Tools::GetInfo (thePrs)); }
 
   //! Appends information about moving to point
   //! \param theXPix a pixels on horizontal
@@ -111,7 +112,7 @@ public:
   //! Appends information about setting selection
   //! \param thePrs the selected presentation
   virtual void SetSelected (Handle(AIS_InteractiveObject) thePrs) Standard_OVERRIDE
-  { myHistoryModel->AddElement (VInspector_CallBackMode_SetSelected, VInspector_Tools::GetInfo (thePrs)); }
+  { if (myHistoryModel != 0) myHistoryModel->AddElement (VInspector_CallBackMode_SetSelected, VInspector_Tools::GetInfo (thePrs)); }
 
   //! Appends information about select
   Standard_EXPORT virtual void Select() Standard_OVERRIDE;
index 27e4ae28fa84651c9c06a7c0bf8f38c479296f5c..9a8a41a4ded2860715233fd140dda9a34a9ff2f3 100644 (file)
 // =======================================================================
 QVariant VInspector_ItemAspectWindow::initValue (int theItemRole) const
 {
+  QVariant aParentValue = VInspector_ItemBase::initValue (theItemRole);
+  if (aParentValue.isValid())
+    return aParentValue;
+
   if (theItemRole != Qt::DisplayRole && theItemRole != Qt::EditRole && theItemRole != Qt::ToolTipRole)
     return QVariant();
 
@@ -45,10 +49,6 @@ QVariant VInspector_ItemAspectWindow::initValue (int theItemRole) const
   {
     case 0: return theItemRole == Qt::DisplayRole ? aWindow->DynamicType()->Name()
                                                   : STANDARD_TYPE (Aspect_Window)->Name();
-    case 1:
-      return rowCount();
-    case 2:
-      return ViewControl_Tools::GetPointerInfo (aWindow, true).ToCString();
     default:
       break;
   }
index 2a29012bd73c5b7ee2b29234f0ae6a4d77336e90..56158a401804fe495c397fb57b0c27690c3a34af 100644 (file)
@@ -17,6 +17,8 @@
 #include <inspector/VInspector_ItemBase.hxx>
 #include <inspector/VInspector_ItemContext.hxx>
 
+#include <inspector/ViewControl_Tools.hxx>
+
 // =======================================================================
 // function : Reset
 // purpose :
@@ -27,6 +29,25 @@ void VInspector_ItemBase::Reset()
   TreeModel_ItemBase::Reset();
 }
 
+// =======================================================================
+// function : initValue
+// purpose :
+// =======================================================================
+QVariant VInspector_ItemBase::initValue (const int theItemRole) const
+{
+  if (theItemRole != Qt::DisplayRole && theItemRole != Qt::ToolTipRole)
+    return QVariant();
+
+  switch (Column())
+  {
+    case 1: { return rowCount(); }
+    case 2: return ViewControl_Tools::GetPointerInfo (GetObject(), true).ToCString();
+    case 3: { return Row(); }
+  }
+
+  return QVariant();
+}
+
 // =======================================================================
 // function : GetContext
 // purpose :
index 48b9922ba613333d5d0760196c440d84fee8953d..b5447aa3ec58d4daebc074d58d314b78ed54c4eb 100644 (file)
@@ -53,6 +53,11 @@ public:
   //! \return object
   virtual Handle(Standard_Transient) GetObject() const { return NULL; }
 
+  //! Returns item information for the given role. Fills internal container if it was not filled yet
+  //! \param theItemRole a value role
+  //! \return the value
+  Standard_EXPORT virtual QVariant initValue (const int theItemRole) const Standard_OVERRIDE;
+
   //! Returns presentation of the attribute to be visualized in the view
   //! \thePresentations [out] container of presentation handles to be visualized
   virtual void GetPresentations (NCollection_List<Handle(Standard_Transient)>& thePresentations)
index 57bf423e6d6912d8e279da5ae3a8473aa3a3fc3e..bb6dfbe9db478160a57b5362ade6f796667c9dc6 100644 (file)
@@ -88,6 +88,10 @@ int VInspector_ItemContext::initRowCount() const
 // =======================================================================
 QVariant VInspector_ItemContext::initValue (const int theItemRole) const
 {
+  QVariant aParentValue = VInspector_ItemBase::initValue (theItemRole);
+  if (aParentValue.isValid())
+    return aParentValue;
+
   if (theItemRole != Qt::DisplayRole && theItemRole != Qt::EditRole && theItemRole != Qt::ToolTipRole)
     return QVariant();
 
@@ -97,7 +101,6 @@ QVariant VInspector_ItemContext::initValue (const int theItemRole) const
   switch (Column())
   {
     case 0: return GetContext()->DynamicType()->Name();
-    case 1: return rowCount();
     case 4:
     {
       Handle(AIS_InteractiveObject) anEmptyIO;
index 2ec8394f8c8ea64416a6a37741e0d0f114aa3753..5e6c394258ad68cbda164f9aa7ee11c1214803c8 100644 (file)
@@ -20,6 +20,7 @@
 #include <inspector/VInspector_ItemPresentableObject.hxx>
 #include <inspector/VInspector_ItemPrs3dDrawer.hxx>
 #include <inspector/VInspector_ItemSelectMgrFilter.hxx>
+#include <inspector/VInspector_ItemSelectMgrViewerSelector.hxx>
 #include <inspector/VInspector_ItemV3dViewer.hxx>
 
 #include <AIS_InteractiveObject.hxx>
 // =======================================================================
 QVariant VInspector_ItemFolderObject::initValue (int theItemRole) const
 {
+  QVariant aParentValue = VInspector_ItemBase::initValue (theItemRole);
+  if (aParentValue.isValid())
+    return aParentValue;
+
   if (Column() != 0 || (theItemRole != Qt::DisplayRole && theItemRole != Qt::ToolTipRole))
     return QVariant();
 
@@ -55,7 +60,7 @@ int VInspector_ItemFolderObject::initRowCount() const
   {
     case ParentKind_ContextItem:
     {
-      int aNbChildren = 2; // Filters, Viewer
+      int aNbChildren = 3; // Filters, Viewer, MainSelector
       aNbChildren++; // DefaultDrawer
       for (int aTypeId = 0; aTypeId < Prs3d_TypeOfHighlight_NB; aTypeId++)
       {
@@ -91,6 +96,8 @@ TreeModel_ItemBasePtr VInspector_ItemFolderObject::createChild (int theRow, int
         return VInspector_ItemFolderObject::CreateItem (currentItem(), theRow, theColumn);
       else if (theRow == 1)
         return VInspector_ItemV3dViewer::CreateItem (currentItem(), theRow, theColumn);
+      else if (theRow == 2)
+        return VInspector_ItemSelectMgrViewerSelector::CreateItem (currentItem(), theRow, theColumn);
       else
         return VInspector_ItemPrs3dDrawer::CreateItem (currentItem(), theRow, theColumn);
     }
@@ -137,10 +144,10 @@ Handle(Prs3d_Drawer) VInspector_ItemFolderObject::GetPrs3dDrawer (const int theR
   {
     case ParentKind_ContextItem:
     {
-      if (theRow == 0 || theRow == 1) // "Filters", "Viewer"
+      if (theRow == 0 || theRow == 1 || theRow == 2) // "Filters", "Viewer", "Viewer Selector"
         return 0;
 
-      if (theRow == 2)
+      if (theRow == 3)
       {
         theName = "DefaultDrawer";
         return GetContext()->DefaultDrawer();
@@ -152,7 +159,7 @@ Handle(Prs3d_Drawer) VInspector_ItemFolderObject::GetPrs3dDrawer (const int theR
         const Handle(Prs3d_Drawer)& aDrawer = GetContext()->HighlightStyle (aType);
         if (aDrawer.IsNull())
           continue;
-        if (aCurId == theRow - 3)
+        if (aCurId == theRow - 4)
         {
           theName = TCollection_AsciiString ("HighlightStyle: ") + Prs3d::TypeOfHighlightToString (aType);
           return aDrawer;
index 447917b89ed5919fb3b93a6b4b6294701fed975a..a50f2d8ab9c744d6ea9c7240ed91d9ef6dcfdc1b 100644 (file)
@@ -107,6 +107,10 @@ int VInspector_ItemGraphic3dCStructure::initRowCount() const
 // =======================================================================
 QVariant VInspector_ItemGraphic3dCStructure::initValue (const int theItemRole) const
 {
+  QVariant aParentValue = VInspector_ItemBase::initValue (theItemRole);
+  if (aParentValue.isValid())
+    return aParentValue;
+
   if (theItemRole != Qt::DisplayRole && theItemRole != Qt::EditRole && theItemRole != Qt::ToolTipRole)
     return QVariant();
 
@@ -118,7 +122,6 @@ QVariant VInspector_ItemGraphic3dCStructure::initValue (const int theItemRole) c
   {
     case 0: return theItemRole == Qt::DisplayRole ? aCStructure->DynamicType()->Name()
                                                   : STANDARD_TYPE (Graphic3d_CStructure)->Name();
-    case 1: return rowCount();
     default:
       break;
   }
index 8799206529a47a2c974a899fd571d696408af078..5adef08ccc8aa1af920e869f21a58173f9747533 100644 (file)
@@ -106,6 +106,10 @@ int VInspector_ItemGraphic3dCView::initRowCount() const
 // =======================================================================
 QVariant VInspector_ItemGraphic3dCView::initValue (const int theItemRole) const
 {
+  QVariant aParentValue = VInspector_ItemBase::initValue (theItemRole);
+  if (aParentValue.isValid())
+    return aParentValue;
+
   if (theItemRole != Qt::DisplayRole && theItemRole != Qt::EditRole && theItemRole != Qt::ToolTipRole)
     return QVariant();
 
@@ -117,10 +121,6 @@ QVariant VInspector_ItemGraphic3dCView::initValue (const int theItemRole) const
   {
     case 0: return theItemRole == Qt::DisplayRole ? aCView->DynamicType()->Name()
                                                   : STANDARD_TYPE (Graphic3d_CView)->Name();
-    case 1:
-      return rowCount();
-    case 2:
-      return ViewControl_Tools::GetPointerInfo (aCView, true).ToCString();
     default:
       break;
   }
index e8ec58a51e01ea1c983bb37dec262c4c9e7a1f92..3467a2b309c22d465179c7b0d68e21440465d0fd 100644 (file)
@@ -90,6 +90,10 @@ int VInspector_ItemGraphic3dCamera::initRowCount() const
 // =======================================================================
 QVariant VInspector_ItemGraphic3dCamera::initValue (const int theItemRole) const
 {
+  QVariant aParentValue = VInspector_ItemBase::initValue (theItemRole);
+  if (aParentValue.isValid())
+    return aParentValue;
+
   if (theItemRole != Qt::DisplayRole && theItemRole != Qt::EditRole && theItemRole != Qt::ToolTipRole)
     return QVariant();
 
@@ -101,10 +105,6 @@ QVariant VInspector_ItemGraphic3dCamera::initValue (const int theItemRole) const
   {
     case 0: return theItemRole == Qt::DisplayRole ? aCamera->DynamicType()->Name()
                                                   : STANDARD_TYPE (Graphic3d_Camera)->Name();
-    case 1:
-      return rowCount();
-    case 2:
-      return ViewControl_Tools::GetPointerInfo (aCamera, true).ToCString();
     default:
       break;
   }
index ab5a882ac0a914120d96621ae90bd3225e949bf0..aa0af62ba040874c491c259625af1df802dae573 100644 (file)
@@ -48,6 +48,10 @@ int VInspector_ItemGraphic3dClipPlane::initRowCount() const
 // =======================================================================
 QVariant VInspector_ItemGraphic3dClipPlane::initValue (const int theItemRole) const
 {
+  QVariant aParentValue = VInspector_ItemBase::initValue (theItemRole);
+  if (aParentValue.isValid())
+    return aParentValue;
+
   if (theItemRole != Qt::DisplayRole && theItemRole != Qt::EditRole && theItemRole != Qt::ToolTipRole)
     return QVariant();
 
@@ -57,7 +61,6 @@ QVariant VInspector_ItemGraphic3dClipPlane::initValue (const int theItemRole) co
   switch (Column())
   {
     case 0: return GetClipPlane()->DynamicType()->Name();
-    case 1: return rowCount();
     default:
       break;
   }
index b841b224ba7e730a44d6c35a65821e59c44905dd..979cf4214e1be9f7ff0c3711a4a85c98bfda2244 100644 (file)
@@ -88,6 +88,10 @@ int VInspector_ItemGraphic3dGroup::initRowCount() const
 // =======================================================================
 QVariant VInspector_ItemGraphic3dGroup::initValue (const int theItemRole) const
 {
+  QVariant aParentValue = VInspector_ItemBase::initValue (theItemRole);
+  if (aParentValue.isValid())
+    return aParentValue;
+
   if (theItemRole != Qt::DisplayRole && theItemRole != Qt::EditRole && theItemRole != Qt::ToolTipRole)
     return QVariant();
 
index f66c620f05a7605bbc52728858578ce6edfeacdf..b4549b1cfbbb78f21f4adcd9d08598510e68476c 100644 (file)
@@ -86,6 +86,10 @@ int VInspector_ItemGraphic3dTransformPers::initRowCount() const
 // =======================================================================
 QVariant VInspector_ItemGraphic3dTransformPers::initValue (const int theItemRole) const
 {
+  QVariant aParentValue = VInspector_ItemBase::initValue (theItemRole);
+  if (aParentValue.isValid())
+    return aParentValue;
+
   if (theItemRole != Qt::DisplayRole && theItemRole != Qt::EditRole && theItemRole != Qt::ToolTipRole)
     return QVariant();
 
@@ -96,7 +100,6 @@ QVariant VInspector_ItemGraphic3dTransformPers::initValue (const int theItemRole
   switch (Column())
   {
     case 0: return aTransformPers->DynamicType()->Name();
-    case 1: return rowCount();
     default:
       break;
   }
index c7a4379ec60820f7ad87a77ae9cb3ebdb108358d..ef579927592eb69b64939b8a5d6a37d90f4fc5fd 100644 (file)
 // =======================================================================
 QVariant VInspector_ItemHistoryElement::initValue(const int theRole) const
 {
+  QVariant aParentValue = VInspector_ItemBase::initValue (theRole);
+  if (aParentValue.isValid())
+    return aParentValue;
+
   if (theRole != Qt::DisplayRole && theRole != Qt::EditRole && theRole != Qt::ToolTipRole)
     return QVariant();
 
index a39a4342ab52906bcb0bbd2497da02cffb70161b..77f9512140aa5eab4fb05e673006b0152c7cf6bd 100644 (file)
@@ -78,6 +78,10 @@ const VInspector_ItemHistoryTypeInfo& VInspector_ItemHistoryRoot::GetTypeInfo (c
 // =======================================================================
 QVariant VInspector_ItemHistoryRoot::initValue (const int theRole) const
 {
+  QVariant aParentValue = VInspector_ItemBase::initValue (theRole);
+  if (aParentValue.isValid())
+    return aParentValue;
+
   if (theRole != Qt::DisplayRole && theRole != Qt::EditRole && theRole != Qt::ToolTipRole)
     return QVariant();
  
index 9e68c960ea5e0bebd38686d2243699e783ad4bac..70ab2c90490268593560aee2c6d8b5c01a4cf076 100644 (file)
@@ -31,6 +31,8 @@ QString VInspector_ItemHistoryType::PointerInfo() const
 
   VInspector_ItemHistoryRootPtr aParentItem = itemDynamicCast<VInspector_ItemHistoryRoot>(Parent());
   const VInspector_ItemHistoryTypeInfo& aTypeInfo = aParentItem->GetTypeInfo(Row());
+  if (aTypeInfo.myElements.size() < rowCount())
+    return QString();
   QList<QVariant> anElements = aTypeInfo.myElements[rowCount() - 1]; // the last item
   return anElements.size() > 1 ? anElements[1].toString() : QString();
 }
@@ -46,6 +48,8 @@ QString VInspector_ItemHistoryType::OwnerInfo() const
 
   VInspector_ItemHistoryRootPtr aParentItem = itemDynamicCast<VInspector_ItemHistoryRoot>(Parent());
   const VInspector_ItemHistoryTypeInfo& aTypeInfo = aParentItem->GetTypeInfo(Row());
+  if ( aTypeInfo.myElements.size() < rowCount())
+    return QString();
   QList<QVariant> anElements = aTypeInfo.myElements[rowCount() - 1]; // the last item
   return anElements.size() > 3 ? anElements[3].toString() : QString();
 }
@@ -56,12 +60,19 @@ QString VInspector_ItemHistoryType::OwnerInfo() const
 // =======================================================================
 QVariant VInspector_ItemHistoryType::initValue(const int theRole) const
 {
+  QVariant aParentValue = VInspector_ItemBase::initValue (theRole);
+  if (aParentValue.isValid())
+    return aParentValue;
+
   if (theRole != Qt::DisplayRole && theRole != Qt::EditRole && theRole != Qt::ToolTipRole)
     return QVariant();
 
   VInspector_ItemHistoryRootPtr aParentItem = itemDynamicCast<VInspector_ItemHistoryRoot>(Parent());
   const VInspector_ItemHistoryTypeInfo& aTypeInfo = aParentItem->GetTypeInfo(Row());
   int aRowCount = rowCount();
+  if (aRowCount <= 0 || aTypeInfo.myElements.size() < aRowCount)
+    return QVariant();
+
   QList<QVariant> anElements = rowCount() > 0 ? aTypeInfo.myElements[rowCount() - 1] : QList<QVariant>(); // the last item
   int anInfoSize = anElements.size();
   switch (Column())
index 0ed0e648d40e8833180ad28fd74f73cb6cd099a0..bdaa9418b3ef148c48e2c85ffe2cd2d563812356 100644 (file)
@@ -83,6 +83,10 @@ int VInspector_ItemOpenGlElement::initRowCount() const
 // =======================================================================
 QVariant VInspector_ItemOpenGlElement::initValue (const int theItemRole) const
 {
+  QVariant aParentValue = VInspector_ItemBase::initValue (theItemRole);
+  if (aParentValue.isValid())
+    return aParentValue;
+
   if (theItemRole != Qt::DisplayRole && theItemRole != Qt::EditRole && theItemRole != Qt::ToolTipRole)
     return QVariant();
 
index 09476d2a1e6252112a9295eacd5ab8f95b9065f7..f41cbfbb59aafb303b168ec229e8b48f65591b72 100644 (file)
@@ -48,7 +48,8 @@ public:
 
   //! Returns the current graphic3d group, init item if it was not initialized yet
   //! \return graphic group
-  Handle(OpenGl_Element) GetElement() const { return Handle(OpenGl_Element)::DownCast (GetObject());}
+  Standard_EXPORT Handle(OpenGl_Element) GetElement() const
+    { return Handle(OpenGl_Element)::DownCast (GetObject());}
 
   //! Inits the item, fills internal containers
   Standard_EXPORT virtual void Init() Standard_OVERRIDE;
index 33fd3c7915728a1ad20269bbb047b7116a733a17..22083e4bdd7b362e31abef67401ebccaa03a9d3f 100644 (file)
 // =======================================================================
 QVariant VInspector_ItemPresentableObject::initValue (int theItemRole) const
 {
+  QVariant aParentValue = VInspector_ItemBase::initValue (theItemRole);
+  if (aParentValue.isValid())
+    return aParentValue;
+
   if (theItemRole == Qt::DisplayRole || theItemRole == Qt::ToolTipRole)
   {
     Handle(AIS_InteractiveObject) anIO = GetInteractiveObject();
@@ -68,14 +72,6 @@ QVariant VInspector_ItemPresentableObject::initValue (int theItemRole) const
           return theItemRole == Qt::ToolTipRole ? QVariant ("")
                                                 : QVariant (anIO->DynamicType()->Name());
       }
-      case 1:
-        return rowCount();
-      case 2:
-      {
-        if (!aNullIO)
-          return VInspector_Tools::GetPointerInfo (anIO, true).ToCString();
-        break;
-      }
       case 4:
       {
         int aNbSelected = VInspector_Tools::SelectedOwners (GetContext(), anIO, false);
index 043f64c0dfa2acc963e7bafadd019f9ad983af0c..28567f24c09ed10b13997426d9f0fdd294612089 100644 (file)
 // =======================================================================
 QVariant VInspector_ItemPresentations::initValue (int theItemRole) const
 {
+  QVariant aParentValue = VInspector_ItemBase::initValue (theItemRole);
+  if (aParentValue.isValid())
+    return aParentValue;
+
   if (Column() != 0 || (theItemRole != Qt::DisplayRole && theItemRole != Qt::ToolTipRole))
     return QVariant();
 
index 5fdb42f69591e91b34738f191fd34dacbb47e0b4..d85d5e08d19a98c78f53c975545931b2ff9bec32 100644 (file)
@@ -40,6 +40,8 @@
 #include <QColor>
 #include <Standard_WarningsRestore.hxx>
 
+int GetMaterialRows() { return 25; }
+
 // =======================================================================
 // function : initValue
 // purpose :
 
 QVariant VInspector_ItemPrs3dAspect::initValue (int theItemRole) const
 {
+  QVariant aParentValue = VInspector_ItemBase::initValue (theItemRole);
+  if (aParentValue.isValid())
+    return aParentValue;
+
   if (theItemRole == Qt::DisplayRole || theItemRole == Qt::ToolTipRole)
   {
     Handle(Prs3d_BasicAspect) anAspect = GetAspect();
@@ -59,14 +65,6 @@ QVariant VInspector_ItemPrs3dAspect::initValue (int theItemRole) const
           ? (aNullAspect ? QVariant("Prs3d_BasicAspect is empty") : QVariant (anAspect->DynamicType()->Name()))
           : QVariant (myName.ToCString());
       }
-      case 1:
-        return rowCount();
-      case 2:
-      {
-        if (!aNullAspect)
-          return VInspector_Tools::GetPointerInfo (anAspect, true).ToCString();
-        break;
-      }
       default: break;
     }
   }
@@ -343,7 +341,7 @@ int VInspector_ItemPrs3dAspect::getTableRowCount (const TCollection_AsciiString&
   else if (theAspectKind == STANDARD_TYPE (Prs3d_DimensionAspect)->Name())
     return 10;
   else if (theAspectKind == STANDARD_TYPE (Prs3d_ShadingAspect)->Name())
-    return 17; // TODO: Graphic3d_ShaderProgram, Graphic3d_TextureSet, Graphic3d_MaterialAspect
+    return 17 + 2 * GetMaterialRows(); // TODO: Graphic3d_ShaderProgram, Graphic3d_TextureSet, Graphic3d_MaterialAspect
 
   return 0;
 }
@@ -490,6 +488,20 @@ ViewControl_EditType VInspector_ItemPrs3dAspect::getTableEditType (const int the
       case 16: return ViewControl_EditType_Bool;
       default: break;
     }
+
+    Handle(Prs3d_ShadingAspect) aCustomAspect = Handle(Prs3d_ShadingAspect)::DownCast (anAspect);
+    Handle(Graphic3d_AspectFillArea3d) aFillAreaAspect = aCustomAspect->Aspect();
+
+    ViewControl_EditType aType = ViewControl_EditType_None;
+    // front material
+    aRow = aRow - 17;
+    if (getTableEditTypeMaterial (aRow, aType))
+      return aType;
+
+    // back material
+    aRow = aRow - GetMaterialRows();
+    if (getTableEditTypeMaterial (aRow, aType))
+      return aType;
   }
 
   return ViewControl_EditType_None;
@@ -840,7 +852,8 @@ QVariant VInspector_ItemPrs3dAspect::getTableData (const int theRow,
   else if (theAspectKind == STANDARD_TYPE (Prs3d_ShadingAspect)->Name())
   {
     if (theRole != Qt::DisplayRole && theRole != Qt::BackgroundRole ||
-       (theRole == Qt::BackgroundRole && (isFirstColumn || (aRow != 0 && theRow != 1 && theRow != 2))))
+       (theRole == Qt::BackgroundRole && (isFirstColumn || (aRow != 0 && theRow != 1 && theRow != 2
+                                                            && !isColorMaterialRow (theRow)))))
       return QVariant();
 
     Handle(Prs3d_ShadingAspect) aCustomAspect = Handle(Prs3d_ShadingAspect)::DownCast (anAspect);
@@ -873,10 +886,22 @@ QVariant VInspector_ItemPrs3dAspect::getTableData (const int theRow,
       case 14: return isFirstColumn ? QVariant ("ToDrawEdges") : anAspect->ToDrawEdges();
       case 15: return isFirstColumn ? QVariant ("ToSuppressBackFaces") : anAspect->ToSuppressBackFaces();
       case 16: return isFirstColumn ? QVariant ("ToMapTexture") : anAspect->ToMapTexture();
-      default: break;
+    default: break;
     }
+    // front material
+    aRow = aRow - 17;
+    const Graphic3d_MaterialAspect& aFrontMaterial = anAspect->FrontMaterial();
+    QVariant aValue = getMaterialValue (aRow, theColumn, theRole, aFrontMaterial, "FrontMaterial");
+    if (aValue.isValid())
+      return aValue;
+
+    // back material
+    aRow = aRow - GetMaterialRows();
+    const Graphic3d_MaterialAspect& aBackMaterial = anAspect->BackMaterial();
+    aValue = getMaterialValue (aRow, theColumn, theRole, aBackMaterial, "BackMaterial");
+    if (aValue.isValid())
+      return aValue;
   }
-
   return QVariant();
 }
 
@@ -1082,10 +1107,165 @@ bool VInspector_ItemPrs3dAspect::setTableData (const int theRow,
       case 16: anAspect->SetTextureMapOn (theValue.toBool()); break;
       default: break;
     }
+
+    // front material
+    aRow = aRow - 17;
+    Graphic3d_MaterialAspect& aFrontMaterial = anAspect->ChangeFrontMaterial();
+    if (setMaterialValue (aRow, aFrontMaterial, theValue))
+      return true;
+
+    // back material
+    aRow = aRow - GetMaterialRows();
+    Graphic3d_MaterialAspect& aBackMaterial = anAspect->ChangeBackMaterial();
+    if (setMaterialValue (aRow, aBackMaterial, theValue))
+      return true;
   }
   return true;
 }
 
+// =======================================================================
+// function : isColorMaterialRow
+// purpose :
+// =======================================================================
+Standard_Boolean VInspector_ItemPrs3dAspect::isColorMaterialRow (const int theRow) const
+{
+  // front material
+  int aRow = theRow - 17;
+  if (aRow >= 8 && aRow <= 12)
+    return Standard_True;
+
+  // back material
+  aRow = aRow - GetMaterialRows();
+  if (aRow >= 8 && aRow <= 12)
+    return Standard_True;
+
+  return Standard_False;
+}
+
+// =======================================================================
+// function : getTableEditTypeMaterial
+// purpose :
+// =======================================================================
+Standard_Boolean VInspector_ItemPrs3dAspect::getTableEditTypeMaterial (const int theRow,
+                                                                       ViewControl_EditType& theType) const
+{
+  theType = ViewControl_EditType_None;
+
+  switch (theRow)
+  {
+    case 6:
+    case 7: theType = ViewControl_EditType_Line; break;
+
+    case 8:
+    case 9:
+    case 10:
+    case 11:
+    case 12: theType = ViewControl_EditType_Color; break;
+
+    case 13:
+    case 14:
+    case 15:
+    case 16:
+    case 17: theType = ViewControl_EditType_Line; break;
+
+    case 18:
+    case 19:
+    case 20:
+    case 21: theType = ViewControl_EditType_Bool; break;
+
+    default: break;
+  }
+
+  return theRow < GetMaterialRows();
+}
+
+// =======================================================================
+// function : getMaterialValue
+// purpose :
+// =======================================================================
+QVariant VInspector_ItemPrs3dAspect::getMaterialValue (const int theRow,
+                                                       const int theColumn,
+                                                       const int theRole,
+                                                       const Graphic3d_MaterialAspect& theMaterial,
+                                                       const TCollection_AsciiString& theInfo) const
+{
+  bool isFirstColumn = theColumn == 0;
+
+  if ((theRole != Qt::DisplayRole && theRole != Qt::BackgroundRole) ||
+      (theRole == Qt::BackgroundRole && (isFirstColumn || (theRow < 8 || theRow > 12))))
+    return QVariant();
+
+  switch (theRow)
+  {
+    case 0: return ViewControl_Tools::TableSeparator();
+    case 1: return isFirstColumn ? QVariant (theInfo.ToCString()) : QVariant ("");
+    case 2: return ViewControl_Tools::TableSeparator();
+    
+    case 3: return isFirstColumn ? QVariant ("Name") : QVariant (theMaterial.Name()); //TODO
+    case 4: return isFirstColumn ? QVariant ("RequestedName") : QVariant (theMaterial.RequestedName()); // TODO
+    case 5: return isFirstColumn ? QVariant ("MaterialName") : QVariant (theMaterial.MaterialName());
+
+    case 6: return isFirstColumn ? QVariant ("Transparency") : QVariant (theMaterial.Transparency());
+    case 7: return isFirstColumn ? QVariant ("Alpha") : QVariant (theMaterial.Alpha());
+
+    case 8: return getColorData("Color", Quantity_ColorRGBA (theMaterial.Color()), isFirstColumn, theRole);
+    case 9: return getColorData("AmbientColor", Quantity_ColorRGBA (theMaterial.AmbientColor()), isFirstColumn, theRole);
+    case 10: return getColorData("DiffuseColor", Quantity_ColorRGBA (theMaterial.DiffuseColor()), isFirstColumn, theRole);
+    case 11: return getColorData("SpecularColor", Quantity_ColorRGBA (theMaterial.SpecularColor()), isFirstColumn, theRole);
+    case 12: return getColorData("EmissiveColor", Quantity_ColorRGBA (theMaterial.EmissiveColor()), isFirstColumn, theRole);
+
+    case 13: return isFirstColumn ? QVariant ("Ambient") : QVariant (theMaterial.Ambient());
+    case 14: return isFirstColumn ? QVariant ("Diffuse") : QVariant (theMaterial.Diffuse());
+    case 15: return isFirstColumn ? QVariant ("Specular") : QVariant (theMaterial.Specular());
+    case 16: return isFirstColumn ? QVariant ("Emissive") : QVariant (theMaterial.Emissive());
+
+    case 17: return isFirstColumn ? QVariant ("Shininess") : QVariant (theMaterial.Shininess());
+
+    case 18: return isFirstColumn ? QVariant ("ReflectionMode (Ambient)") : QVariant (theMaterial.ReflectionMode (Graphic3d_TOR_AMBIENT));
+    case 19: return isFirstColumn ? QVariant ("ReflectionMode (Diffuse)") : QVariant (theMaterial.ReflectionMode (Graphic3d_TOR_DIFFUSE));
+    case 20: return isFirstColumn ? QVariant ("ReflectionMode (Specular)") : QVariant (theMaterial.ReflectionMode (Graphic3d_TOR_SPECULAR));
+    case 21: return isFirstColumn ? QVariant ("ReflectionMode (Emissive)") : QVariant (theMaterial.ReflectionMode (Graphic3d_TOR_EMISSION));
+
+    case 22: return isFirstColumn ? QVariant ("RefractionIndex") : QVariant (theMaterial.RefractionIndex());
+    case 23: return isFirstColumn ? QVariant ("BSDF.FresnelCoat.FresnelType()") : QVariant (theMaterial.BSDF().FresnelCoat.FresnelType()); // TODO
+    case 24: return isFirstColumn ? QVariant ("BSDF.FresnelBase.FresnelType()") : QVariant (theMaterial.BSDF().FresnelBase.FresnelType()); // TODO
+  }
+  return QVariant();
+}
+
+// =======================================================================
+// function : setMaterialValue
+// purpose :
+// =======================================================================
+Standard_Boolean VInspector_ItemPrs3dAspect::setMaterialValue (const int theRow,
+                                                               Graphic3d_MaterialAspect& theMaterial,
+                                                               const QVariant& theValue) const
+{
+  switch (theRow)
+  {
+    case 6: theMaterial.SetTransparency (ViewControl_Tools::ToShortRealValue (theValue)); break;
+    case 7: theMaterial.SetAlpha (ViewControl_Tools::ToShortRealValue (theValue)); break;
+
+    case 8: theMaterial.SetColor (ViewControl_ColorSelector::StringToColor (theValue.toString())); break;
+    case 9: theMaterial.SetAmbientColor (ViewControl_ColorSelector::StringToColor (theValue.toString())); break;
+    case 10: theMaterial.SetDiffuseColor (ViewControl_ColorSelector::StringToColor (theValue.toString())); break;
+    case 11: theMaterial.SetSpecularColor (ViewControl_ColorSelector::StringToColor (theValue.toString())); break;
+    case 12: theMaterial.SetEmissiveColor (ViewControl_ColorSelector::StringToColor (theValue.toString())); break;
+
+    case 13: theMaterial.SetAmbient (ViewControl_Tools::ToShortRealValue (theValue)); break;
+    case 14: theMaterial.SetDiffuse (ViewControl_Tools::ToShortRealValue (theValue)); break;
+    case 15: theMaterial.SetSpecular (ViewControl_Tools::ToShortRealValue (theValue)); break;
+    case 16: theMaterial.SetEmissive (ViewControl_Tools::ToShortRealValue (theValue)); break;
+    case 17: theMaterial.SetShininess (ViewControl_Tools::ToShortRealValue (theValue)); break;
+
+    case 18: theMaterial.SetReflectionMode (Graphic3d_TOR_AMBIENT, theValue.toBool()); break;
+    case 19: theMaterial.SetReflectionMode (Graphic3d_TOR_DIFFUSE, theValue.toBool()); break;
+    case 20: theMaterial.SetReflectionMode (Graphic3d_TOR_SPECULAR, theValue.toBool()); break;
+    case 21: theMaterial.SetReflectionMode (Graphic3d_TOR_EMISSION, theValue.toBool()); break;
+  }
+  return theRow < GetMaterialRows();
+}
+
 // =======================================================================
 // function : getColorData
 // purpose :
@@ -1105,4 +1285,4 @@ QVariant VInspector_ItemPrs3dAspect::getColorData(const TCollection_AsciiString&
     return ViewControl_ColorSelector::ColorToString (theColor);
 
   return QVariant();
-}
\ No newline at end of file
+}
index 71f9226dbd6e10f004bd93f3b5160b164e6362c2..8f34f7ba50c7d40c311de5b8ba9aeecd7ce5b4c3 100644 (file)
@@ -160,6 +160,27 @@ private:
                      const int theStartRow,
                      const QVariant& theValue) const;
 
+  //! Returns true if the table value in the row is a color of a material
+  Standard_Boolean isColorMaterialRow (const int theRow) const;
+
+  //! Returns type of edit control for the material row
+  //! \param theRow a model index row
+  //! \param theColumn a model index column
+  //! \return edit type
+  Standard_Boolean getTableEditTypeMaterial (const int theRow,
+                                             ViewControl_EditType& theType) const;
+
+  //! Returns value of Graphic3d_MaterialAspect for the row
+  QVariant getMaterialValue (const int theRow,
+                             const int theColumn,
+                             const int theRole,
+                             const Graphic3d_MaterialAspect& theMaterial,
+                             const TCollection_AsciiString& theInfo) const;
+
+  Standard_Boolean setMaterialValue (const int theRow,
+                                     Graphic3d_MaterialAspect& theMaterial,
+                                     const QVariant& theValue) const;
+
   //! Returns color data depending on parameters
   //! \param theInfo information value if column is the first one
   //! \param theColor color value
index 8e9f6379c0c4ec97beff42b0e51e71a90cb0d72d..eb341d941f715659fcc757dd6dc829e8730dfa7e 100644 (file)
 
 QVariant VInspector_ItemPrs3dDrawer::initValue (int theItemRole) const
 {
+  QVariant aParentValue = VInspector_ItemBase::initValue (theItemRole);
+  if (aParentValue.isValid())
+    return aParentValue;
+
   Handle(Prs3d_Drawer) aDrawer = GetDrawer();
   bool aNullDrawer = aDrawer.IsNull();
   if (theItemRole == Qt::DisplayRole || theItemRole == Qt::ToolTipRole)
@@ -60,14 +64,6 @@ QVariant VInspector_ItemPrs3dDrawer::initValue (int theItemRole) const
           ? (aNullDrawer ? QVariant("Prs3d_Drawer is empty") : QVariant (aDrawer->DynamicType()->Name()))
           : QVariant (myName.ToCString());
       }
-      case 1:
-        return rowCount();
-      case 2:
-      {
-        if (!aNullDrawer)
-          return VInspector_Tools::GetPointerInfo (aDrawer, true).ToCString();
-        break;
-      }
       default: break;
     }
   }
index a66c4a4e2a766a151545e7b824b9ead7ea7ad974..0fbeac194093e1be0c9763ed3eb5f8d88205889b 100644 (file)
 // =======================================================================
 QVariant VInspector_ItemPrs3dPresentation::initValue (int theItemRole) const
 {
+  QVariant aParentValue = VInspector_ItemBase::initValue (theItemRole);
+  if (aParentValue.isValid())
+    return aParentValue;
+
   if (Column() != 0 || (theItemRole != Qt::DisplayRole && theItemRole != Qt::ToolTipRole))
     return QVariant();
 
index d6a07904871a8f3adeec4d8a6eeb51ca797c0e7b..c865b83c04b96e6b59d6e2bff031136cb4d09c26 100644 (file)
@@ -78,6 +78,10 @@ Handle(Standard_Transient) VInspector_ItemSelect3DSensitiveSetItem::GetObject()
 // =======================================================================
 QVariant VInspector_ItemSelect3DSensitiveSetItem::initValue (int theItemRole) const
 {
+  QVariant aParentValue = VInspector_ItemBase::initValue (theItemRole);
+  if (aParentValue.isValid())
+    return aParentValue;
+
   Handle(SelectBasics_SensitiveEntity) anEntity = GetSensitiveEntity();
   if (anEntity.IsNull())
     return QVariant();
index c8bc17cadcc53205ccf0978a13006643651a4884..312a658c8aebd6d8fa60b6c6918555be531f014e 100644 (file)
 // =======================================================================
 QVariant VInspector_ItemSelectBasicsEntityOwner::initValue(int theItemRole) const
 {
+  QVariant aParentValue = VInspector_ItemBase::initValue (theItemRole);
+  if (aParentValue.isValid())
+    return aParentValue;
+
   switch (theItemRole)
   { 
     case Qt::DisplayRole:
@@ -49,48 +53,7 @@ QVariant VInspector_ItemSelectBasicsEntityOwner::initValue(int theItemRole) cons
       switch (Column())
       {
         case 0: return anOwner->DynamicType()->Name();
-        case 2: return VInspector_Tools::GetPointerInfo (anOwner, true).ToCString();
-        //case 3:
-        //{
-        //  Handle(StdSelect_BRepOwner) BROwnr = Handle(StdSelect_BRepOwner)::DownCast (anOwner);
-        //  if (BROwnr.IsNull())
-        //    return QVariant();
-
-        //  const TopoDS_Shape& aShape = BROwnr->Shape();
-        //  if (aShape.IsNull())
-        //    return QVariant();
-
-        //  return VInspector_Tools::GetShapeTypeInfo (aShape.ShapeType()).ToCString();
-        //}
-        //case 17:
-        //case 18:
-        //case 19:
-        //  {
-        //  Handle(StdSelect_BRepOwner) BROwnr = Handle(StdSelect_BRepOwner)::DownCast (anOwner);
-        //  if (BROwnr.IsNull())
-        //    return QVariant();
-
-        //  const TopoDS_Shape& aShape = BROwnr->Shape();
-        //  if (aShape.IsNull())
-        //    return QVariant();
-
-        //  return Column() == 17 ? VInspector_Tools::GetPointerInfo (aShape.TShape(), true).ToCString()
-        //       : Column() == 18 ? VInspector_Tools::OrientationToName (aShape.Orientation()).ToCString()
-        //       :           /*19*/ ViewControl_Tools::ToString (aShape.Location()).ToCString();
-        //}
-        //case 21:
-        //  {
-        //  Handle(StdSelect_BRepOwner) BROwnr = Handle(StdSelect_BRepOwner)::DownCast (anOwner);
-        //  if (BROwnr.IsNull())
-        //    return QVariant();
-
-        //  //const TopoDS_Shape& aShape = BROwnr->Shape();
-        //  //if (aShape.IsNull())
-        //  //  return QVariant();
-
-        //  return ViewControl_Tools::ToString (BROwnr->Location()).ToCString();
-        //}
-        //default: break;
+        default: break;
       }
       break;
     }
index c316c3a5f54dade02e85a0b94bcd5fad25377230..af955e3a9827656d1bfc0c3e813f05fe2c7ac01b 100644 (file)
@@ -79,6 +79,10 @@ int VInspector_ItemSelectBasicsSensitiveEntity::initRowCount() const
 // =======================================================================
 QVariant VInspector_ItemSelectBasicsSensitiveEntity::initValue (int theItemRole) const
 {
+  QVariant aParentValue = VInspector_ItemBase::initValue (theItemRole);
+  if (aParentValue.isValid())
+    return aParentValue;
+
   Handle(SelectBasics_SensitiveEntity) anEntity = GetSensitiveEntity();
   if (anEntity.IsNull())
     return QVariant();
diff --git a/tools/VInspector/VInspector_ItemSelectMgrBaseFrustum.cxx b/tools/VInspector/VInspector_ItemSelectMgrBaseFrustum.cxx
new file mode 100644 (file)
index 0000000..e602f2b
--- /dev/null
@@ -0,0 +1,197 @@
+// Created on: 2019-02-04
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2019 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement. 
+
+#include <inspector/VInspector_ItemSelectMgrBaseFrustum.hxx>
+
+#include <inspector/VInspector_ItemSelectMgrSelectingVolumeManager.hxx>
+
+// =======================================================================
+// function : initRowCount
+// purpose :
+// =======================================================================
+int VInspector_ItemSelectMgrBaseFrustum::initRowCount() const
+{
+  if (Column() != 0)
+    return 0;
+
+  return 0;
+}
+
+// =======================================================================
+// function : initValue
+// purpose :
+// =======================================================================
+QVariant VInspector_ItemSelectMgrBaseFrustum::initValue (const int theItemRole) const
+{
+  QVariant aParentValue = VInspector_ItemBase::initValue (theItemRole);
+  if (aParentValue.isValid())
+    return aParentValue;
+
+  if (theItemRole != Qt::DisplayRole && theItemRole != Qt::EditRole && theItemRole != Qt::ToolTipRole)
+    return QVariant();
+
+  Handle (SelectMgr_BaseFrustum) aFrustum = GetFrustum();
+  if (aFrustum.IsNull())
+    return Column() == 0 ? "Empty frustum" : "";
+
+  switch (Column())
+  {
+    case 0: return aFrustum->DynamicType()->Name();
+    default:
+      break;
+  }
+  return QVariant();
+}
+
+// =======================================================================
+// function : Init
+// purpose :
+// =======================================================================
+
+void VInspector_ItemSelectMgrBaseFrustum::Init()
+{
+  VInspector_ItemSelectMgrSelectingVolumeManagerPtr aParentItem = itemDynamicCast<VInspector_ItemSelectMgrSelectingVolumeManager>(Parent());
+
+  Handle(SelectMgr_BaseFrustum) aFrustum;
+  if (aParentItem)
+  {
+    SelectMgr_SelectingVolumeManager aVolumeManager;
+    if (aParentItem->GetViewerSelector (aVolumeManager))
+    {
+      aFrustum = aVolumeManager.ActiveVolume();
+    }
+  }
+  setFrustum (aFrustum);
+
+  UpdatePresentationShape();
+  TreeModel_ItemBase::Init(); // to use getIO() without circling initialization
+}
+
+// =======================================================================
+// function : Reset
+// purpose :
+// =======================================================================
+
+void VInspector_ItemSelectMgrBaseFrustum::Reset()
+{
+  VInspector_ItemBase::Reset();
+
+  setFrustum (NULL);
+}
+
+// =======================================================================
+// function : initItem
+// purpose :
+// =======================================================================
+
+void VInspector_ItemSelectMgrBaseFrustum::initItem() const
+{
+  if (IsInitialized())
+    return;
+  const_cast<VInspector_ItemSelectMgrBaseFrustum*>(this)->Init();
+}
+
+// =======================================================================
+// function : GetTableRowCount
+// purpose :
+// =======================================================================
+int VInspector_ItemSelectMgrBaseFrustum::GetTableRowCount() const
+{
+  return 60;
+}
+
+// =======================================================================
+// function : GetTableData
+// purpose :
+// =======================================================================
+QVariant VInspector_ItemSelectMgrBaseFrustum::GetTableData (const int theRow, const int theColumn, const int theRole) const
+{
+  if (theRole != Qt::DisplayRole)
+    return QVariant();
+
+  Handle(SelectMgr_BaseFrustum) aView = GetFrustum();
+  if (aView.IsNull())
+    return QVariant();
+
+  //bool isFirstColumn = theColumn == 0;
+  //switch (theRow)
+  //{
+  //  case 0:
+  //  {
+  //    if (isFirstColumn)
+  //      return QVariant ("ImmediateUpdate");
+
+  //    Standard_Boolean aCurState = aView->SetImmediateUpdate (Standard_False);
+  //    aView->SetImmediateUpdate (aCurState);
+
+  //    return aCurState;
+  //  }
+  //  break;
+  //  case 1:
+  //  {
+  //    if (isFirstColumn)
+  //      return QVariant ("ActiveLights");
+
+  //    V3d_ListOfLightIterator aLightsIt = aView->ActiveLightIterator();
+  //    Standard_Integer aNbOfLights = 0;
+  //    while (aLightsIt.More())
+  //    {
+  //      aNbOfLights++;
+  //      aLightsIt.Next();
+  //    }
+  //    return aNbOfLights;
+  //  }
+  //  case 2:
+  //  {
+  //    if (isFirstColumn)
+  //      return QVariant ("Axis: origin");
+
+  //    Standard_Real aX, anY, aZ, aVx, aVy, aVz;
+  //    aView->Axis (aX, anY, aZ, aVx, aVy, aVz);
+
+  //    return ViewControl_Tools::ToString (gp_Pnt (aX, anY, aZ)).ToCString();
+  //  }
+  //  case 3:
+  //  {
+  //    if (isFirstColumn)
+  //      return QVariant ("Axis: direction");
+
+  //    Standard_Real aX, anY, aZ, aVx, aVy, aVz;
+  //    aView->Axis (aX, anY, aZ, aVx, aVy, aVz);
+
+  //    return ViewControl_Tools::ToString (gp_Dir (aVx, aVy, aVz)).ToCString();
+  //  }
+  //  case 4: return isFirstColumn ? QVariant ("ComputedMode") : QVariant (aView->ComputedMode());
+  //  case 5: return isFirstColumn ? QVariant ("AutoZFitMode") : QVariant (aView->AutoZFitMode());
+  //  case 6: return isFirstColumn ? QVariant ("AutoZFitScaleFactor") : QVariant (aView->AutoZFitScaleFactor());
+  //}
+  return QVariant();
+}
+
+// =======================================================================
+// function : createChild
+// purpose :
+// =======================================================================
+TreeModel_ItemBasePtr VInspector_ItemSelectMgrBaseFrustum::createChild (int theRow, int theColumn)
+{
+  //if (theRow == 0)
+  //  return VInspector_ItemGraphic3dCamera::CreateItem (currentItem(), theRow, theColumn);
+  //else if (theRow == 1)
+  //  return VInspector_ItemAspectWindow::CreateItem (currentItem(), theRow, theColumn);
+  //else if (theRow == 2)
+  //  return VInspector_ItemGraphic3dCView::CreateItem (currentItem(), theRow, theColumn);
+  //
+  return TreeModel_ItemBasePtr();
+}
diff --git a/tools/VInspector/VInspector_ItemSelectMgrBaseFrustum.hxx b/tools/VInspector/VInspector_ItemSelectMgrBaseFrustum.hxx
new file mode 100644 (file)
index 0000000..39079dd
--- /dev/null
@@ -0,0 +1,106 @@
+// Created on: 2019-02-04
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2019 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement. 
+
+#ifndef VInspector_ItemSelectMgrBaseFrustum_H
+#define VInspector_ItemSelectMgrBaseFrustum_H
+
+#include <Standard.hxx>
+#include <inspector/VInspector_ItemBase.hxx>
+
+#include <TopoDS_Shape.hxx>
+#include <SelectMgr_BaseFrustum.hxx>
+
+class VInspector_ItemSelectMgrBaseFrustum;
+typedef QExplicitlySharedDataPointer<VInspector_ItemSelectMgrBaseFrustum> VInspector_ItemSelectMgrBaseFrustumPtr;
+
+//! \class VInspector_ItemSelectMgrBaseFrustum
+//! Parent item, that corresponds Folder under the AIS_InteractiveContext
+//! Children of the item are: none
+class VInspector_ItemSelectMgrBaseFrustum : public VInspector_ItemBase
+{
+public:
+
+  //! Creates an item wrapped by a shared pointer
+  static VInspector_ItemSelectMgrBaseFrustumPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
+  { return VInspector_ItemSelectMgrBaseFrustumPtr (new VInspector_ItemSelectMgrBaseFrustum (theParent, theRow, theColumn)); }
+
+  //! Destructor
+  virtual ~VInspector_ItemSelectMgrBaseFrustum() Standard_OVERRIDE {};
+
+  //! Inits the item, fills internal containers
+  Standard_EXPORT virtual void Init() Standard_OVERRIDE;
+
+  //! Resets cached values
+  Standard_EXPORT virtual void Reset() Standard_OVERRIDE;
+
+  //! Returns data object of the item.
+  //! \return object
+  virtual Handle(Standard_Transient) GetObject() const { initItem(); return myFrustum; }
+
+  //! Returns current drawer, initialize the drawer if it was not initialized yet
+  Standard_EXPORT Handle(SelectMgr_BaseFrustum) GetFrustum() const
+  { return Handle(SelectMgr_BaseFrustum)::DownCast (GetObject()); }
+
+protected:
+  //! Initialize the current item. It is empty because Reset() is also empty.
+  virtual void initItem() const Standard_OVERRIDE;
+
+  //! Returns number of displayed presentations
+  //! \return rows count
+  Standard_EXPORT virtual int initRowCount() const Standard_OVERRIDE;
+
+  //! Returns item information for the given role. Fills internal container if it was not filled yet
+  //! \param theItemRole a value role
+  //! \return the value
+  Standard_EXPORT virtual QVariant initValue (const int theItemRole) const Standard_OVERRIDE;
+
+  //! Returns number of table rows
+  //! \return an integer value
+  virtual int GetTableRowCount() const Standard_OVERRIDE;
+
+  //! Returns table value for the row in form: <function name> <function value>
+  //! \param theRow a model index row
+  //! \param theColumn a model index column
+  virtual QVariant GetTableData (const int theRow, const int theColumn, const int theRole) const Standard_OVERRIDE;
+
+protected:
+
+  //! Creates a child item in the given position.
+  //! \param theRow the child row position
+  //! \param theColumn the child column position
+  //! \return the created item
+  virtual TreeModel_ItemBasePtr createChild (int theRow, int theColumn) Standard_OVERRIDE;
+
+private:
+
+  //! Set V3d viewer selector into the current field
+  //! \param theFrustum a viewer selector
+  void setFrustum (const Handle(SelectMgr_BaseFrustum)& theFrustum) { myFrustum = theFrustum; }
+
+private:
+
+  //! Constructor
+  //! param theParent a parent item
+  //! \param theRow the item row positition in the parent item
+  //! \param theColumn the item column positition in the parent item
+  VInspector_ItemSelectMgrBaseFrustum(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
+    : VInspector_ItemBase(theParent, theRow, theColumn) {}
+
+protected:
+
+  Handle(SelectMgr_BaseFrustum) myFrustum; //!< the current viewer selector
+};
+
+#endif
index f8a09377c53256bb5b044c82bdbf6778c98d2dbf..70bf35e55d3241a396e7fefefa64a089e81e73f2 100644 (file)
 // =======================================================================
 QVariant VInspector_ItemSelectMgrFilter::initValue (int theItemRole) const
 {
+  QVariant aParentValue = VInspector_ItemBase::initValue (theItemRole);
+  if (aParentValue.isValid())
+    return aParentValue;
+
   if (theItemRole == Qt::DisplayRole || theItemRole == Qt::ToolTipRole)
   {
     Handle(SelectMgr_Filter) aFilter = GetFilter();
@@ -37,8 +41,6 @@ QVariant VInspector_ItemSelectMgrFilter::initValue (int theItemRole) const
     {
       case 0: return theItemRole == Qt::ToolTipRole ? QVariant ("")
                                                     : QVariant (aFilter->DynamicType()->Name());
-      case 1: return rowCount() > 0 ? QVariant (rowCount()) : QVariant();
-      case 2: return VInspector_Tools::GetPointerInfo (aFilter, true).ToCString();
       default: break;
     }
   }
diff --git a/tools/VInspector/VInspector_ItemSelectMgrSelectingVolumeManager.cxx b/tools/VInspector/VInspector_ItemSelectMgrSelectingVolumeManager.cxx
new file mode 100644 (file)
index 0000000..8a08b48
--- /dev/null
@@ -0,0 +1,170 @@
+// Created on: 2019-02-04
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2019 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement. 
+
+#include <inspector/VInspector_ItemSelectMgrSelectingVolumeManager.hxx>
+
+#include <inspector/VInspector_ItemSelectMgrViewerSelector.hxx>
+#include <inspector/VInspector_ItemSelectMgrBaseFrustum.hxx>
+
+#include <inspector/ViewControl_Tools.hxx>
+
+// =======================================================================
+// function : initRowCount
+// purpose :
+// =======================================================================
+int VInspector_ItemSelectMgrSelectingVolumeManager::initRowCount() const
+{
+  if (Column() != 0)
+    return 0;
+
+  return 1;
+}
+
+// =======================================================================
+// function : initValue
+// purpose :
+// =======================================================================
+QVariant VInspector_ItemSelectMgrSelectingVolumeManager::initValue (const int theItemRole) const
+{
+  QVariant aParentValue = VInspector_ItemBase::initValue (theItemRole);
+  if (aParentValue.isValid())
+    return aParentValue;
+
+  if (theItemRole != Qt::DisplayRole && theItemRole != Qt::EditRole && theItemRole != Qt::ToolTipRole)
+    return QVariant();
+
+  SelectMgr_SelectingVolumeManager aVolumeManager;
+  if (!GetViewerSelector (aVolumeManager))
+    return Column() == 0 ? "Empty volume manager" : "";
+
+  switch (Column())
+  {
+    case 0: return "SelectMgr_SelectingVolumeManager";
+    default:
+      break;
+  }
+  return QVariant();
+}
+
+// =======================================================================
+// function : Init
+// purpose :
+// =======================================================================
+
+void VInspector_ItemSelectMgrSelectingVolumeManager::Init()
+{
+  //VInspector_ItemFolderObjectPtr aParentItem = itemDynamicCast<VInspector_ItemFolderObject>(Parent());
+  //Handle(SelectMgr_SelectingVolumeManager) aVolumeMgr;
+  //if (aParentItem)
+  //{
+  //  VInspector_ItemContextPtr aParentContextItem = itemDynamicCast<VInspector_ItemContext>(aParentItem->Parent());
+  //  if (aParentContextItem)
+  //  {
+  //    Handle(AIS_InteractiveContext) aContext = aParentContextItem->GetContext();
+  //    aVolumeMgr = aContext->MainSelector();
+  //  }
+  //}
+  //setViewerSelector (aVolumeMgr);
+
+  //UpdatePresentationShape();
+  TreeModel_ItemBase::Init(); // to use getIO() without circling initialization
+}
+
+// =======================================================================
+// function : Reset
+// purpose :
+// =======================================================================
+
+void VInspector_ItemSelectMgrSelectingVolumeManager::Reset()
+{
+  VInspector_ItemBase::Reset();
+}
+
+// =======================================================================
+// function : initItem
+// purpose :
+// =======================================================================
+
+void VInspector_ItemSelectMgrSelectingVolumeManager::initItem() const
+{
+  if (IsInitialized())
+    return;
+  const_cast<VInspector_ItemSelectMgrSelectingVolumeManager*>(this)->Init();
+}
+
+// =======================================================================
+// function : GetTableRowCount
+// purpose :
+// =======================================================================
+Standard_Boolean VInspector_ItemSelectMgrSelectingVolumeManager::GetViewerSelector (SelectMgr_SelectingVolumeManager& theVolumeManager) const
+{
+  VInspector_ItemSelectMgrViewerSelectorPtr aParentItem = itemDynamicCast<VInspector_ItemSelectMgrViewerSelector>(Parent());
+
+  if (!aParentItem || aParentItem->GetViewerSelector().IsNull())
+    return Standard_False;
+
+  theVolumeManager = aParentItem->GetViewerSelector()->GetManager();
+  return Standard_True;
+}
+
+// =======================================================================
+// function : GetTableRowCount
+// purpose :
+// =======================================================================
+int VInspector_ItemSelectMgrSelectingVolumeManager::GetTableRowCount() const
+{
+  return 60;
+}
+
+// =======================================================================
+// function : GetTableData
+// purpose :
+// =======================================================================
+QVariant VInspector_ItemSelectMgrSelectingVolumeManager::GetTableData (const int theRow, const int theColumn, const int theRole) const
+{
+  if (theRole != Qt::DisplayRole)
+    return QVariant();
+
+  SelectMgr_SelectingVolumeManager aVolumeMgr;
+  if (!GetViewerSelector (aVolumeMgr))
+    return QVariant();
+
+  bool isFirstColumn = theColumn == 0;
+  switch (theRow)
+  {
+    case 0: return isFirstColumn ? QVariant ("GetActiveSelectionType") : QVariant (aVolumeMgr.GetActiveSelectionType());
+    case 1: return isFirstColumn ? QVariant ("IsOverlapAllowed()") : QVariant (aVolumeMgr.IsOverlapAllowed());
+    case 2: return isFirstColumn ? "GetNearPickedPnt" : ViewControl_Tools::ToString (aVolumeMgr.GetNearPickedPnt()).ToCString();
+    case 3: return isFirstColumn ? "GetFarPickedPnt" : ViewControl_Tools::ToString (aVolumeMgr.GetFarPickedPnt()).ToCString();
+    default: break;
+  }
+  return QVariant();
+}
+
+// =======================================================================
+// function : createChild
+// purpose :
+// =======================================================================
+TreeModel_ItemBasePtr VInspector_ItemSelectMgrSelectingVolumeManager::createChild (int theRow, int theColumn)
+{
+  if (theRow == 0)
+    return VInspector_ItemSelectMgrBaseFrustum::CreateItem (currentItem(), theRow, theColumn);
+  //else if (theRow == 1)
+  //  return VInspector_ItemAspectWindow::CreateItem (currentItem(), theRow, theColumn);
+  //else if (theRow == 2)
+  //  return VInspector_ItemGraphic3dCView::CreateItem (currentItem(), theRow, theColumn);
+  //
+  return TreeModel_ItemBasePtr();
+}
diff --git a/tools/VInspector/VInspector_ItemSelectMgrSelectingVolumeManager.hxx b/tools/VInspector/VInspector_ItemSelectMgrSelectingVolumeManager.hxx
new file mode 100644 (file)
index 0000000..b08765e
--- /dev/null
@@ -0,0 +1,96 @@
+// Created on: 2019-02-04
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2019 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement. 
+
+#ifndef VInspector_ItemSelectMgrSelectingVolumeManager_H
+#define VInspector_ItemSelectMgrSelectingVolumeManager_H
+
+#include <Standard.hxx>
+#include <inspector/VInspector_ItemBase.hxx>
+
+#include <TopoDS_Shape.hxx>
+#include <SelectMgr_SelectingVolumeManager.hxx>
+
+class VInspector_ItemSelectMgrSelectingVolumeManager;
+typedef QExplicitlySharedDataPointer<VInspector_ItemSelectMgrSelectingVolumeManager> VInspector_ItemSelectMgrSelectingVolumeManagerPtr;
+
+//! \class VInspector_ItemSelectMgrSelectingVolumeManager
+//! Parent item, that corresponds Folder under the AIS_InteractiveContext
+//! Children of the item are: none
+class VInspector_ItemSelectMgrSelectingVolumeManager : public VInspector_ItemBase
+{
+public:
+
+  //! Creates an item wrapped by a shared pointer
+  static VInspector_ItemSelectMgrSelectingVolumeManagerPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
+  { return VInspector_ItemSelectMgrSelectingVolumeManagerPtr (new VInspector_ItemSelectMgrSelectingVolumeManager (theParent, theRow, theColumn)); }
+
+  //! Destructor
+  virtual ~VInspector_ItemSelectMgrSelectingVolumeManager() Standard_OVERRIDE {};
+
+  //! Inits the item, fills internal containers
+  Standard_EXPORT virtual void Init() Standard_OVERRIDE;
+
+  //! Resets cached values
+  Standard_EXPORT virtual void Reset() Standard_OVERRIDE;
+
+  //! Returns data object of the item.
+  //! \return object
+  virtual Handle(Standard_Transient) GetObject() const { initItem(); return NULL; }
+
+  //! Returns current drawer, initialize the drawer if it was not initialized yet
+  Standard_EXPORT Standard_Boolean GetViewerSelector (SelectMgr_SelectingVolumeManager& theVolumeManager) const;
+
+protected:
+  //! Initialize the current item. It is empty because Reset() is also empty.
+  virtual void initItem() const Standard_OVERRIDE;
+
+  //! Returns number of displayed presentations
+  //! \return rows count
+  Standard_EXPORT virtual int initRowCount() const Standard_OVERRIDE;
+
+  //! Returns item information for the given role. Fills internal container if it was not filled yet
+  //! \param theItemRole a value role
+  //! \return the value
+  Standard_EXPORT virtual QVariant initValue (const int theItemRole) const Standard_OVERRIDE;
+
+  //! Returns number of table rows
+  //! \return an integer value
+  virtual int GetTableRowCount() const Standard_OVERRIDE;
+
+  //! Returns table value for the row in form: <function name> <function value>
+  //! \param theRow a model index row
+  //! \param theColumn a model index column
+  virtual QVariant GetTableData (const int theRow, const int theColumn, const int theRole) const Standard_OVERRIDE;
+
+protected:
+
+  //! Creates a child item in the given position.
+  //! \param theRow the child row position
+  //! \param theColumn the child column position
+  //! \return the created item
+  virtual TreeModel_ItemBasePtr createChild (int theRow, int theColumn) Standard_OVERRIDE;
+
+private:
+
+  //! Constructor
+  //! param theParent a parent item
+  //! \param theRow the item row positition in the parent item
+  //! \param theColumn the item column positition in the parent item
+  VInspector_ItemSelectMgrSelectingVolumeManager(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
+    : VInspector_ItemBase(theParent, theRow, theColumn) {}
+
+};
+
+#endif
index 529de360d620d69ddfc429d84d5f4bb7da615344..c09ece65cdab84f2a7d8af2e0ce5dc9da272bb5e 100644 (file)
@@ -54,6 +54,10 @@ int VInspector_ItemSelectMgrSelection::initRowCount() const
 // =======================================================================
 QVariant VInspector_ItemSelectMgrSelection::initValue (int theItemRole) const
 {
+  QVariant aParentValue = VInspector_ItemBase::initValue (theItemRole);
+  if (aParentValue.isValid())
+    return aParentValue;
+
   switch (theItemRole)
   {
     case Qt::DisplayRole:
@@ -63,7 +67,6 @@ QVariant VInspector_ItemSelectMgrSelection::initValue (int theItemRole) const
       switch (Column())
       {
         case 0: return GetSelection()->DynamicType()->Name();
-        case 1: return rowCount();
         case 3:
         {
           if (theItemRole == Qt::ToolTipRole)
index 6a99f4a95d0deff175218b212bc08e1b1558aa1b..181ff57b6cc79e893ec64dc4cdb4d9060fd75b42 100644 (file)
@@ -55,6 +55,10 @@ int VInspector_ItemSelectMgrSensitiveEntity::initRowCount() const
 // =======================================================================
 QVariant VInspector_ItemSelectMgrSensitiveEntity::initValue (int theItemRole) const
 {
+  QVariant aParentValue = VInspector_ItemBase::initValue (theItemRole);
+  if (aParentValue.isValid())
+    return aParentValue;
+
   Handle(SelectMgr_SensitiveEntity) anEntity = GetSensitiveEntity();
   switch (theItemRole)
   {
diff --git a/tools/VInspector/VInspector_ItemSelectMgrViewerSelector.cxx b/tools/VInspector/VInspector_ItemSelectMgrViewerSelector.cxx
new file mode 100644 (file)
index 0000000..1f15cf5
--- /dev/null
@@ -0,0 +1,283 @@
+// Created on: 2019-02-04
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2019 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement. 
+
+#include <inspector/VInspector_ItemSelectMgrViewerSelector.hxx>
+
+#include <inspector/VInspector_ItemSelectMgrSelectingVolumeManager.hxx>
+#include <inspector/VInspector_ItemSelectMgrViewerSelectorPicked.hxx>
+
+#include <inspector/VInspector_ItemFolderObject.hxx>
+#include <inspector/VInspector_ItemContext.hxx>
+
+#include <inspector/ViewControl_Table.hxx>
+#include <inspector/View_Tools.hxx>
+
+#include <BRep_Builder.hxx>
+#include <BRepBuilderAPI_MakeVertex.hxx>
+#include <TopoDS_Compound.hxx>
+
+#include <StdSelect_ViewerSelector3d.hxx>
+
+// =======================================================================
+// function : Constructor
+// purpose :
+// =======================================================================
+VInspector_ItemSelectMgrViewerSelector::VInspector_ItemSelectMgrViewerSelector (TreeModel_ItemBasePtr theParent,
+                                                                                const int theRow, const int theColumn)
+: VInspector_ItemBase(theParent, theRow, theColumn),
+  myXPix (150), myYPix (350), myXMinPix (150), myYMinPix (350), myXMaxPix (200), myYMaxPix (400)
+{
+}
+
+// =======================================================================
+// function : initRowCount
+// purpose :
+// =======================================================================
+int VInspector_ItemSelectMgrViewerSelector::initRowCount() const
+{
+  if (Column() != 0)
+    return 0;
+
+  Standard_Integer aNbRows = GetFirstChildOfPicked(); // SelectMgr_SelectingVolumeManager
+
+  Handle(SelectMgr_ViewerSelector) aViewSelector = GetViewerSelector();
+  if (!aViewSelector.IsNull())
+  {
+    for (Standard_Integer aDetIter = 1; aDetIter <= aViewSelector->NbPicked(); ++aDetIter)
+    {
+      aNbRows++;
+      //Handle(SelectMgr_EntityOwner) anOwner = aViewSelector->->Picked (aDetIter);
+    }
+  }
+  return aNbRows;
+}
+
+// =======================================================================
+// function : initValue
+// purpose :
+// =======================================================================
+QVariant VInspector_ItemSelectMgrViewerSelector::initValue (const int theItemRole) const
+{
+  QVariant aParentValue = VInspector_ItemBase::initValue (theItemRole);
+  if (aParentValue.isValid())
+    return aParentValue;
+
+  if (theItemRole != Qt::DisplayRole && theItemRole != Qt::EditRole && theItemRole != Qt::ToolTipRole)
+    return QVariant();
+
+  if (GetViewerSelector().IsNull())
+    return Column() == 0 ? "Empty viewer selector" : "";
+
+  switch (Column())
+  {
+    case 0: return GetViewerSelector()->DynamicType()->Name();
+    default:
+      break;
+  }
+  return QVariant();
+}
+
+// =======================================================================
+// function : Init
+// purpose :
+// =======================================================================
+
+void VInspector_ItemSelectMgrViewerSelector::Init()
+{
+  VInspector_ItemFolderObjectPtr aParentItem = itemDynamicCast<VInspector_ItemFolderObject>(Parent());
+  Handle(SelectMgr_ViewerSelector) aViewerSelector;
+  if (aParentItem)
+  {
+    VInspector_ItemContextPtr aParentContextItem = itemDynamicCast<VInspector_ItemContext>(aParentItem->Parent());
+    if (aParentContextItem)
+    {
+      Handle(AIS_InteractiveContext) aContext = aParentContextItem->GetContext();
+      aViewerSelector = aContext->MainSelector();
+    }
+  }
+  setViewerSelector (aViewerSelector);
+
+  UpdatePresentationShape();
+  TreeModel_ItemBase::Init(); // to use getIO() without circling initialization
+}
+
+// =======================================================================
+// function : Reset
+// purpose :
+// =======================================================================
+
+void VInspector_ItemSelectMgrViewerSelector::Reset()
+{
+  VInspector_ItemBase::Reset();
+
+  setViewerSelector (NULL);
+}
+
+// =======================================================================
+// function : initItem
+// purpose :
+// =======================================================================
+
+void VInspector_ItemSelectMgrViewerSelector::initItem() const
+{
+  if (IsInitialized())
+    return;
+  const_cast<VInspector_ItemSelectMgrViewerSelector*>(this)->Init();
+}
+
+// =======================================================================
+// function : GetTableRowCount
+// purpose :
+// =======================================================================
+int VInspector_ItemSelectMgrViewerSelector::GetTableRowCount() const
+{
+  return 60;
+}
+
+// =======================================================================
+// function : GetTableData
+// purpose :
+// =======================================================================
+QVariant VInspector_ItemSelectMgrViewerSelector::GetTableData (const int theRow, const int theColumn, const int theRole) const
+{
+  if (theRole != Qt::DisplayRole)
+    return QVariant();
+
+  Handle(SelectMgr_ViewerSelector) aViewerSelector = GetViewerSelector();
+  if (aViewerSelector.IsNull())
+    return QVariant();
+
+  bool isFirstColumn = theColumn == 0;
+  switch (theRow)
+  {
+    case 0: return isFirstColumn ? QVariant ("Sensitivity") : QVariant (aViewerSelector->Sensitivity());
+    case 1: return isFirstColumn ? QVariant ("IsPickClosest") : QVariant (aViewerSelector->IsPickClosest());
+    case 2: return isFirstColumn ? QVariant ("NbPicked") : QVariant (aViewerSelector->NbPicked());
+
+    case 3: return ViewControl_Table::SeparatorData();
+    case 4: return isFirstColumn ? QVariant ("ClearPicked") : QVariant ("DO");
+
+    case 5: return ViewControl_Table::SeparatorData();
+    case 6: return isFirstColumn ? QVariant ("X (pixel)") : QVariant (myXPix);
+    case 7: return isFirstColumn ? QVariant ("Y (pixel)") : QVariant (myYPix);
+    case 8: return isFirstColumn ? QVariant ("Pick") : QVariant ("DO");
+
+    case 9: return ViewControl_Table::SeparatorData();
+    case 10: return isFirstColumn ? QVariant ("X Min (pixel)") : QVariant (myXMinPix);
+    case 11: return isFirstColumn ? QVariant ("Y Min (pixel)") : QVariant (myXMinPix);
+    case 12: return isFirstColumn ? QVariant ("X Max (pixel)") : QVariant (myXMaxPix);
+    case 13: return isFirstColumn ? QVariant ("Y Max (pixel)") : QVariant (myYMaxPix);
+    case 14: return isFirstColumn ? QVariant ("Pick") : QVariant ("DO");
+
+    default: break;
+  }
+  return QVariant();
+}
+
+// =======================================================================
+// function : GetTableEditType
+// purpose :
+// =======================================================================
+ViewControl_EditType VInspector_ItemSelectMgrViewerSelector::GetTableEditType (const int theRow, const int) const
+{
+  switch (theRow)
+  {
+    case 4: return ViewControl_EditType_DoAction;
+    case 6: return ViewControl_EditType_Spin;
+    case 7: return ViewControl_EditType_Spin;
+    case 8: return ViewControl_EditType_DoAction;
+    case 10: return ViewControl_EditType_Spin;
+    case 11: return ViewControl_EditType_Spin;
+    case 12: return ViewControl_EditType_Spin;
+    case 13: return ViewControl_EditType_Spin;
+    case 14: return ViewControl_EditType_DoAction;
+    default: return ViewControl_EditType_None;
+  }
+}
+
+// =======================================================================
+// function : SetTableData
+// purpose :
+// =======================================================================
+bool VInspector_ItemSelectMgrViewerSelector::SetTableData (const int theRow, const int, const QVariant& theValue)
+{
+  Handle(SelectMgr_ViewerSelector) aViewerSelector = GetViewerSelector();
+  if (aViewerSelector.IsNull())
+    return Standard_False;
+
+  switch (theRow)
+  {
+    case 4: aViewerSelector->ClearPicked(); break;
+    case 6: myXPix = theValue.toInt();
+    case 7: myYPix = theValue.toInt();
+    case 8:
+    {
+      Handle(StdSelect_ViewerSelector3d) aSelector3d = Handle(StdSelect_ViewerSelector3d)::DownCast(aViewerSelector);
+      if (!aSelector3d.IsNull())
+        aSelector3d->Pick (myXPix, myYPix, View_Tools::FindActiveView (GetContext()));
+      break;
+    }
+    case 10: myXMinPix = theValue.toInt();
+    case 11: myXMinPix = theValue.toInt();
+    case 12: myXMaxPix = theValue.toInt();
+    case 13: myYMaxPix = theValue.toInt();
+    case 14:
+    {
+      Handle(StdSelect_ViewerSelector3d) aSelector3d = Handle(StdSelect_ViewerSelector3d)::DownCast(aViewerSelector);
+      if (!aSelector3d.IsNull())
+        aSelector3d->Pick (myXMinPix, myYMinPix, myXMaxPix, myYMaxPix, View_Tools::FindActiveView (GetContext()));
+      break;
+    }
+    default: break;
+  }
+  return Standard_True;
+}
+
+// =======================================================================
+// function : buildPresentationShape
+// purpose :
+// =======================================================================
+TopoDS_Shape VInspector_ItemSelectMgrViewerSelector::buildPresentationShape (const Handle(SelectMgr_ViewerSelector)& theViewSelector)
+{
+  if (theViewSelector.IsNull() || theViewSelector->NbPicked() == 0)
+    return TopoDS_Shape();
+
+  BRep_Builder aBuilder;
+  TopoDS_Compound aCompound;
+  aBuilder.MakeCompound (aCompound);
+
+  for (Standard_Integer aRankId = 1; aRankId <= theViewSelector->NbPicked(); ++aRankId)
+    aBuilder.Add (aCompound, BRepBuilderAPI_MakeVertex (theViewSelector->PickedPoint (aRankId)));
+
+  return aCompound;
+}
+
+// =======================================================================
+// function : createChild
+// purpose :
+// =======================================================================
+TreeModel_ItemBasePtr VInspector_ItemSelectMgrViewerSelector::createChild (int theRow, int theColumn)
+{
+  if (theRow == 0)
+    return VInspector_ItemSelectMgrSelectingVolumeManager::CreateItem (currentItem(), theRow, theColumn);
+  else
+    return VInspector_ItemSelectMgrViewerSelectorPicked::CreateItem (currentItem(), theRow, theColumn);
+  //else if (theRow == 1)
+  //  return VInspector_ItemAspectWindow::CreateItem (currentItem(), theRow, theColumn);
+  //else if (theRow == 2)
+  //  return VInspector_ItemGraphic3dCView::CreateItem (currentItem(), theRow, theColumn);
+  //
+  return TreeModel_ItemBasePtr();
+}
diff --git a/tools/VInspector/VInspector_ItemSelectMgrViewerSelector.hxx b/tools/VInspector/VInspector_ItemSelectMgrViewerSelector.hxx
new file mode 100644 (file)
index 0000000..978a70b
--- /dev/null
@@ -0,0 +1,140 @@
+// Created on: 2019-02-04
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2019 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement. 
+
+#ifndef VInspector_ItemSelectMgrViewerSelector_H
+#define VInspector_ItemSelectMgrViewerSelector_H
+
+#include <Standard.hxx>
+#include <inspector/VInspector_ItemBase.hxx>
+
+#include <TopoDS_Shape.hxx>
+#include <SelectMgr_ViewerSelector.hxx>
+
+class VInspector_ItemSelectMgrViewerSelector;
+typedef QExplicitlySharedDataPointer<VInspector_ItemSelectMgrViewerSelector> VInspector_ItemSelectMgrViewerSelectorPtr;
+
+//! \class VInspector_ItemSelectMgrViewerSelector
+//! Parent item, that corresponds Folder under the AIS_InteractiveContext
+//! Children of the item are: none
+class VInspector_ItemSelectMgrViewerSelector : public VInspector_ItemBase
+{
+public:
+
+  //! Creates an item wrapped by a shared pointer
+  static VInspector_ItemSelectMgrViewerSelectorPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
+  { return VInspector_ItemSelectMgrViewerSelectorPtr (new VInspector_ItemSelectMgrViewerSelector (theParent, theRow, theColumn)); }
+
+  //! Destructor
+  virtual ~VInspector_ItemSelectMgrViewerSelector() Standard_OVERRIDE {};
+
+  //! Inits the item, fills internal containers
+  Standard_EXPORT virtual void Init() Standard_OVERRIDE;
+
+  //! Resets cached values
+  Standard_EXPORT virtual void Reset() Standard_OVERRIDE;
+
+  //! Returns data object of the item.
+  //! \return object
+  virtual Handle(Standard_Transient) GetObject() const { initItem(); return myViewerSelector; }
+
+  //! Returns current drawer, initialize the drawer if it was not initialized yet
+  Standard_EXPORT Handle(SelectMgr_ViewerSelector) GetViewerSelector() const
+  { return Handle(SelectMgr_ViewerSelector)::DownCast (GetObject()); }
+
+  //! Returns the span from the 0 row to the first item corresponded to the picked item
+  //! the 0 item is SelectMgr_SelectingVolumeManager
+  Standard_Integer GetFirstChildOfPicked() const { return 1; }
+protected:
+  //! Initialize the current item. It is empty because Reset() is also empty.
+  virtual void initItem() const Standard_OVERRIDE;
+
+  //! Returns number of displayed presentations
+  //! \return rows count
+  Standard_EXPORT virtual int initRowCount() const Standard_OVERRIDE;
+
+  //! Returns item information for the given role. Fills internal container if it was not filled yet
+  //! \param theItemRole a value role
+  //! \return the value
+  Standard_EXPORT virtual QVariant initValue (const int theItemRole) const Standard_OVERRIDE;
+
+  //! Returns number of table rows
+  //! \return an integer value
+  virtual int GetTableRowCount() const Standard_OVERRIDE;
+
+  //! Returns table value for the row in form: <function name> <function value>
+  //! \param theRow a model index row
+  //! \param theColumn a model index column
+  virtual QVariant GetTableData (const int theRow, const int theColumn, const int theRole) const Standard_OVERRIDE;
+
+  //! Returns type of edit control for the model index. By default, it is an empty control
+  //! \param theRow a model index row
+  //! \param theColumn a model index column
+  //! \return edit type
+  virtual ViewControl_EditType GetTableEditType (const int theRow, const int theColumn) const Standard_OVERRIDE;
+
+  //! Sets the value into the table cell. Only 1st column value might be modified.
+  //! \param theRow a model index row
+  //! \param theColumn a model index column
+  //! \param theValue a new cell value
+  virtual bool SetTableData (const int theRow, const int theColumn, const QVariant& theValue) Standard_OVERRIDE;
+
+protected:
+
+  //! Build presentation shape
+  //! \return generated shape of the item parameters
+  virtual TopoDS_Shape buildPresentationShape() Standard_OVERRIDE { return buildPresentationShape (myViewerSelector); }
+
+    //! Creates shape for the 3d viewer selector parameters
+  //! \param theViewerSelector current viewer selector
+  //! \return shape or NULL
+  static TopoDS_Shape buildPresentationShape (const Handle(SelectMgr_ViewerSelector)& theViewerSelector);
+
+protected:
+
+  //! Creates a child item in the given position.
+  //! \param theRow the child row position
+  //! \param theColumn the child column position
+  //! \return the created item
+  virtual TreeModel_ItemBasePtr createChild (int theRow, int theColumn) Standard_OVERRIDE;
+
+private:
+
+  //! Set V3d viewer selector into the current field
+  //! \param theViewerSelector a viewer selector
+  void setViewerSelector (const Handle(SelectMgr_ViewerSelector)& theViewerSelector) { myViewerSelector = theViewerSelector; }
+
+private:
+
+  //! Constructor
+  //! param theParent a parent item
+  //! \param theRow the item row positition in the parent item
+  //! \param theColumn the item column positition in the parent item
+  VInspector_ItemSelectMgrViewerSelector(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn);
+
+private:
+
+  Handle(SelectMgr_ViewerSelector) myViewerSelector; //!< the current viewer selector
+
+  Standard_Integer myXPix; //!< cached value for picked X
+  Standard_Integer myYPix; //!< cached value for picked Y
+
+  Standard_Integer myXMinPix; //!< cached value for min value of picked X
+  Standard_Integer myYMinPix; //!< cached value for min value of picked Y
+
+  Standard_Integer myXMaxPix; //!< cached value for max value of picked X
+  Standard_Integer myYMaxPix; //!< cached value for max value of picked Y
+};
+
+#endif
diff --git a/tools/VInspector/VInspector_ItemSelectMgrViewerSelectorPicked.cxx b/tools/VInspector/VInspector_ItemSelectMgrViewerSelectorPicked.cxx
new file mode 100644 (file)
index 0000000..d0fbe4c
--- /dev/null
@@ -0,0 +1,238 @@
+// Created on: 2019-02-04
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2019 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement. 
+
+#include <inspector/VInspector_ItemSelectMgrViewerSelectorPicked.hxx>
+
+#include <inspector/VInspector_ItemSelectMgrViewerSelector.hxx>
+#include <inspector/VInspector_Tools.hxx>
+#include <inspector/ViewControl_Tools.hxx>
+
+#include <BRepBuilderAPI_MakeVertex.hxx>
+#include <BRep_Builder.hxx>
+#include <TopoDS_Compound.hxx>
+
+// =======================================================================
+// function : initRowCount
+// purpose :
+// =======================================================================
+int VInspector_ItemSelectMgrViewerSelectorPicked::initRowCount() const
+{
+  if (Column() != 0)
+    return 0;
+
+  return 0;
+}
+
+// =======================================================================
+// function : initValue
+// purpose :
+// =======================================================================
+QVariant VInspector_ItemSelectMgrViewerSelectorPicked::initValue (const int theItemRole) const
+{
+  QVariant aParentValue = VInspector_ItemBase::initValue (theItemRole);
+  if (aParentValue.isValid())
+    return aParentValue;
+
+  if (theItemRole != Qt::DisplayRole && theItemRole != Qt::EditRole && theItemRole != Qt::ToolTipRole)
+    return QVariant();
+
+  Standard_Integer aRankId;
+  Handle(SelectMgr_ViewerSelector) aViewerSelector = GetViewerSelector (aRankId);
+  if (aViewerSelector.IsNull())
+    return Column() == 0 ? "Empty viewer selector" : "";
+
+  switch (Column())
+  {
+    case 0:
+    {
+      TCollection_AsciiString aValue = TCollection_AsciiString (aRankId) + " - " +
+                                       VInspector_Tools::GetPointerInfo (aViewerSelector->Picked (aRankId));
+      return aValue.ToCString();
+    }
+    default:
+      break;
+  }
+  return QVariant();
+}
+
+// =======================================================================
+// function : Init
+// purpose :
+// =======================================================================
+
+void VInspector_ItemSelectMgrViewerSelectorPicked::Init()
+{
+  UpdatePresentationShape();
+  TreeModel_ItemBase::Init(); // to use getIO() without circling initialization
+}
+
+// =======================================================================
+// function : Reset
+// purpose :
+// =======================================================================
+
+void VInspector_ItemSelectMgrViewerSelectorPicked::Reset()
+{
+  VInspector_ItemBase::Reset();
+}
+
+// =======================================================================
+// function : initItem
+// purpose :
+// =======================================================================
+
+void VInspector_ItemSelectMgrViewerSelectorPicked::initItem() const
+{
+  if (IsInitialized())
+    return;
+  const_cast<VInspector_ItemSelectMgrViewerSelectorPicked*>(this)->Init();
+}
+
+// =======================================================================
+// function : GetTableRowCount
+// purpose :
+// =======================================================================
+Handle(SelectMgr_ViewerSelector) VInspector_ItemSelectMgrViewerSelectorPicked::GetViewerSelector (Standard_Integer& theRankId) const
+{
+  VInspector_ItemSelectMgrViewerSelectorPtr aParentItem = itemDynamicCast<VInspector_ItemSelectMgrViewerSelector>(Parent());
+  if (!aParentItem)
+    return NULL;
+
+  Handle(SelectMgr_ViewerSelector) aViewerSelector = aParentItem->GetViewerSelector();
+  theRankId = Row() + 1 - aParentItem->GetFirstChildOfPicked();
+  if (theRankId > aViewerSelector->NbPicked())
+    return NULL;
+
+  return aViewerSelector;
+}
+
+// =======================================================================
+// function : GetTableRowCount
+// purpose :
+// =======================================================================
+int VInspector_ItemSelectMgrViewerSelectorPicked::GetTableRowCount() const
+{
+  return 60;
+}
+
+// =======================================================================
+// function : GetTableData
+// purpose :
+// =======================================================================
+QVariant VInspector_ItemSelectMgrViewerSelectorPicked::GetTableData (const int theRow, const int theColumn, const int theRole) const
+{
+  if (theRole != Qt::DisplayRole && theRole != Qt::ToolTipRole)
+    return QVariant();
+
+  Standard_Integer aRankId;
+  Handle(SelectMgr_ViewerSelector) aViewerSelector = GetViewerSelector (aRankId);
+  if (aViewerSelector.IsNull())
+    return QVariant();
+
+  bool isFirstColumn = theColumn == 0;
+  switch (theRow)
+  {
+    case 0: return isFirstColumn ? "Picked" : 
+      (theRole == Qt::DisplayRole ? VInspector_Tools::GetPointerInfo (aViewerSelector->Picked (aRankId)).ToCString()
+                                  : aViewerSelector->Picked (aRankId)->DynamicType()->Name());
+    case 1: return isFirstColumn ? "PickedEntity" :
+      (theRole == Qt::DisplayRole ? VInspector_Tools::GetPointerInfo (aViewerSelector->PickedEntity (aRankId)).ToCString()
+                                  : aViewerSelector->PickedEntity (aRankId)->DynamicType()->Name());
+    case 2: return isFirstColumn ? "PickedPoint" : ViewControl_Tools::ToString (aViewerSelector->PickedPoint (aRankId)).ToCString();
+
+    default: break;
+  }
+  Standard_Integer aLastIndex = 2;
+
+  if (theRow > aLastIndex)
+    return getTableSortCriterionData (theRow - (aLastIndex + 1), theColumn, theRole);
+
+  return QVariant();
+}
+
+// =======================================================================
+// function : getTableSortCriterionData
+// purpose :
+// =======================================================================
+QVariant VInspector_ItemSelectMgrViewerSelectorPicked::getTableSortCriterionData (const Standard_Integer theIndex,
+                                                                                  const int theColumn, const int theRole) const
+{
+  Standard_Integer aRankId;
+  Handle(SelectMgr_ViewerSelector) aViewerSelector = GetViewerSelector (aRankId);
+  if (aViewerSelector.IsNull())
+    return QVariant();
+
+  const SelectMgr_SortCriterion& aCriterion = aViewerSelector->PickedData (aRankId);
+  bool isFirstColumn = theColumn == 0;
+  switch (theIndex)
+  {
+    case 0: return isFirstColumn ? QVariant ("Depth") : QVariant (aCriterion.Depth);
+    case 1: return isFirstColumn ? QVariant ("MinDist") : QVariant (aCriterion.MinDist);
+    case 2: return isFirstColumn ? QVariant ("Tolerance") : QVariant (aCriterion.Tolerance);
+    case 3: return isFirstColumn ? QVariant ("Priority") : QVariant (aCriterion.Priority);
+    case 4: return isFirstColumn ? QVariant ("ZLayerPosition") : QVariant (aCriterion.ZLayerPosition);
+    case 5: return isFirstColumn ? QVariant ("NbOwnerMatches") : QVariant (aCriterion.NbOwnerMatches);
+    case 6: return isFirstColumn ? QVariant ("ToPreferClosest") : QVariant (aCriterion.ToPreferClosest);
+    default: break;
+  }
+  return QVariant();
+}
+
+// =======================================================================
+// function : buildPresentationShape
+// purpose :
+// =======================================================================
+TopoDS_Shape VInspector_ItemSelectMgrViewerSelectorPicked::buildPresentationShape()
+{
+  Standard_Integer aRankId;
+  Handle(SelectMgr_ViewerSelector) aViewerSelector = GetViewerSelector (aRankId);
+  return buildPresentationShape (aViewerSelector, aRankId);
+}
+
+// =======================================================================
+// function : buildPresentationShape
+// purpose :
+// =======================================================================
+TopoDS_Shape VInspector_ItemSelectMgrViewerSelectorPicked::buildPresentationShape (const Handle(SelectMgr_ViewerSelector)& theViewSelector,
+                                                                                   const Standard_Integer theRowId)
+{
+  if (theViewSelector.IsNull() || theRowId + 1 > theViewSelector->NbPicked())
+    return TopoDS_Shape();
+
+  BRep_Builder aBuilder;
+  TopoDS_Compound aCompound;
+  aBuilder.MakeCompound (aCompound);
+
+  Standard_Integer aRankId = theRowId + 1;
+  aBuilder.Add (aCompound, BRepBuilderAPI_MakeVertex (theViewSelector->PickedPoint (aRankId)));
+
+  return aCompound;
+}
+
+// =======================================================================
+// function : createChild
+// purpose :
+// =======================================================================
+TreeModel_ItemBasePtr VInspector_ItemSelectMgrViewerSelectorPicked::createChild (int, int)
+{
+  //if (theRow == 0)
+  //  return VInspector_ItemGraphic3dCamera::CreateItem (currentItem(), theRow, theColumn);
+  //else if (theRow == 1)
+  //  return VInspector_ItemAspectWindow::CreateItem (currentItem(), theRow, theColumn);
+  //else if (theRow == 2)
+  //  return VInspector_ItemGraphic3dCView::CreateItem (currentItem(), theRow, theColumn);
+  //
+  return TreeModel_ItemBasePtr();
+}
diff --git a/tools/VInspector/VInspector_ItemSelectMgrViewerSelectorPicked.hxx b/tools/VInspector/VInspector_ItemSelectMgrViewerSelectorPicked.hxx
new file mode 100644 (file)
index 0000000..5262394
--- /dev/null
@@ -0,0 +1,113 @@
+// Created on: 2019-02-04
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2019 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement. 
+
+#ifndef VInspector_ItemSelectMgrViewerSelectorPicked_H
+#define VInspector_ItemSelectMgrViewerSelectorPicked_H
+
+#include <Standard.hxx>
+#include <inspector/VInspector_ItemBase.hxx>
+
+#include <TopoDS_Shape.hxx>
+#include <SelectMgr_ViewerSelector.hxx>
+
+class VInspector_ItemSelectMgrViewerSelectorPicked;
+typedef QExplicitlySharedDataPointer<VInspector_ItemSelectMgrViewerSelectorPicked> VInspector_ItemSelectMgrViewerSelectorPickedPtr;
+
+//! \class VInspector_ItemSelectMgrViewerSelectorPicked
+//! Parent item, that corresponds Folder under the AIS_InteractiveContext
+//! Children of the item are: none
+class VInspector_ItemSelectMgrViewerSelectorPicked : public VInspector_ItemBase
+{
+public:
+
+  //! Creates an item wrapped by a shared pointer
+  static VInspector_ItemSelectMgrViewerSelectorPickedPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
+  { return VInspector_ItemSelectMgrViewerSelectorPickedPtr (new VInspector_ItemSelectMgrViewerSelectorPicked (theParent, theRow, theColumn)); }
+
+  //! Destructor
+  virtual ~VInspector_ItemSelectMgrViewerSelectorPicked() Standard_OVERRIDE {};
+
+  //! Inits the item, fills internal containers
+  Standard_EXPORT virtual void Init() Standard_OVERRIDE;
+
+  //! Resets cached values
+  Standard_EXPORT virtual void Reset() Standard_OVERRIDE;
+
+  //! Returns data object of the item.
+  //! \return object
+  virtual Handle(Standard_Transient) GetObject() const { initItem(); return NULL; }
+
+  //! Returns viewer selector of the parent and index of rank inside the parent
+  //! \param theRankId rank of the item inside viewer selector
+  Standard_EXPORT Handle(SelectMgr_ViewerSelector) GetViewerSelector (Standard_Integer& theRankId) const;
+
+protected:
+  //! Initialize the current item. It is empty because Reset() is also empty.
+  virtual void initItem() const Standard_OVERRIDE;
+
+  //! Returns number of displayed presentations
+  //! \return rows count
+  Standard_EXPORT virtual int initRowCount() const Standard_OVERRIDE;
+
+  //! Returns item information for the given role. Fills internal container if it was not filled yet
+  //! \param theItemRole a value role
+  //! \return the value
+  Standard_EXPORT virtual QVariant initValue (const int theItemRole) const Standard_OVERRIDE;
+
+  //! Returns number of table rows
+  //! \return an integer value
+  virtual int GetTableRowCount() const Standard_OVERRIDE;
+
+  //! Returns table value for the row in form: <function name> <function value>
+  //! \param theRow a model index row
+  //! \param theColumn a model index column
+  virtual QVariant GetTableData (const int theRow, const int theColumn, const int theRole) const Standard_OVERRIDE;
+
+protected:
+  //! Returns table value of SelectMgr_SortCriterion
+  QVariant getTableSortCriterionData (const Standard_Integer theIndex, const int theColumn, const int theRole) const;
+
+  //! Build presentation shape
+  //! \return generated shape of the item parameters
+  virtual TopoDS_Shape buildPresentationShape() Standard_OVERRIDE;
+
+  //! Creates shape for the 3d viewer selector parameters
+  //! \param theViewerSelector current viewer selector
+  //! \param theRowId index of the item row, theRank - 1 value inside viewer selector
+  //! \return shape or NULL
+  static TopoDS_Shape buildPresentationShape (const Handle(SelectMgr_ViewerSelector)& theViewerSelector,
+                                              const Standard_Integer theRowId);
+
+protected:
+
+  //! Creates a child item in the given position.
+  //! \param theRow the child row position
+  //! \param theColumn the child column position
+  //! \return the created item
+  virtual TreeModel_ItemBasePtr createChild (int theRow, int theColumn) Standard_OVERRIDE;
+
+private:
+
+private:
+
+  //! Constructor
+  //! param theParent a parent item
+  //! \param theRow the item row positition in the parent item
+  //! \param theColumn the item column positition in the parent item
+  VInspector_ItemSelectMgrViewerSelectorPicked(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
+    : VInspector_ItemBase(theParent, theRow, theColumn) {}
+};
+
+#endif
index 3583e74a8b68031341da520d6488c9751c1a57f4..beb64c9555bcbafa5668af7521130f880b8f2386 100644 (file)
@@ -55,6 +55,10 @@ int VInspector_ItemV3dView::initRowCount() const
 // =======================================================================
 QVariant VInspector_ItemV3dView::initValue (const int theItemRole) const
 {
+  QVariant aParentValue = VInspector_ItemBase::initValue (theItemRole);
+  if (aParentValue.isValid())
+    return aParentValue;
+
   if (theItemRole != Qt::DisplayRole && theItemRole != Qt::EditRole && theItemRole != Qt::ToolTipRole)
     return QVariant();
 
@@ -64,7 +68,6 @@ QVariant VInspector_ItemV3dView::initValue (const int theItemRole) const
   switch (Column())
   {
     case 0: return GetView()->DynamicType()->Name();
-    case 1: return rowCount();
     default:
       break;
   }
index 114eda6cd92d4d3373b6cae10beda2e351c747b3..0cfc80edc50fb00a57dc69c5943f75f59dbf152d 100644 (file)
@@ -73,6 +73,10 @@ int VInspector_ItemV3dViewer::initRowCount() const
 // =======================================================================
 QVariant VInspector_ItemV3dViewer::initValue (const int theItemRole) const
 {
+  QVariant aParentValue = VInspector_ItemBase::initValue (theItemRole);
+  if (aParentValue.isValid())
+    return aParentValue;
+
   if (theItemRole != Qt::DisplayRole && theItemRole != Qt::EditRole && theItemRole != Qt::ToolTipRole)
     return QVariant();
 
@@ -82,7 +86,6 @@ QVariant VInspector_ItemV3dViewer::initValue (const int theItemRole) const
   switch (Column())
   {
     case 0: return GetViewer()->DynamicType()->Name();
-    case 1: return rowCount();
     default:
       break;
   }
index bac85b01e8b2018fab532b108ff11c9a209d108c..a94b4d5e1725f77e369e5bb87184d7db61d134be 100644 (file)
@@ -16,6 +16,7 @@
 #include <inspector/VInspector_TableModelValues.hxx>
 
 #include <inspector/ViewControl_Pane.hxx>
+#include <inspector/ViewControl_PaneItem.hxx>
 #include <inspector/ViewControl_TableModel.hxx>
 #include <inspector/VInspector_Tools.hxx>
 
@@ -137,6 +138,31 @@ Qt::ItemFlags VInspector_TableModelValues::Flags (const QModelIndex& theIndex) c
   return aFlags;
 }
 
+// =======================================================================
+// function : RowCount
+// purpose :
+// =======================================================================
+
+int VInspector_TableModelValues::RowCount (const QModelIndex& theParent) const
+{
+  VInspector_ItemBasePtr anItem = GetItem();
+
+  int aRowCount = anItem->GetTableRowCount();
+  Handle(Standard_Transient) anObject = anItem->GetObject();
+  if (anObject.IsNull())
+    return aRowCount;
+
+  for (NCollection_List<Handle(ViewControl_PaneCreator)>::Iterator anIterator (myCreators); anIterator.More(); anIterator.Next())
+  {
+    Handle(ViewControl_PaneCreator) aCreator = anIterator.Value();
+    ViewControl_Pane* aPane = aCreator->GetPane (anObject->DynamicType()->Name());
+    if (!aPane)
+      continue;
+    aRowCount += aPane->GetTableRowCount (anObject);
+  }
+  return aRowCount;
+}
+
 // =======================================================================
 // function : GetEditType
 // purpose :
@@ -197,6 +223,31 @@ QList<QVariant> VInspector_TableModelValues::GetEnumValues (const int theRow, co
   return anItem->GetTableEnumValues (aCurrentRow, theColumn);
 }
 
+// =======================================================================
+// function : GetPaneShapes
+// purpose :
+// =======================================================================
+
+void VInspector_TableModelValues::GetPaneShapes (const int theRow, const int theColumn, NCollection_List<TopoDS_Shape>& theShapes)
+{
+  VInspector_ItemBasePtr anItem = GetItem();
+  Handle(Standard_Transient) anObject = anItem->GetObject();
+  if (anObject.IsNull())
+    return;
+
+  for (NCollection_List<Handle(ViewControl_PaneCreator)>::Iterator anIterator (myCreators); anIterator.More(); anIterator.Next())
+  {
+    Handle(ViewControl_PaneCreator) aCreator = anIterator.Value();
+    ViewControl_Pane* aPane = aCreator->GetPane (anObject->DynamicType()->Name());
+    if (!aPane)
+      continue;
+
+    ViewControl_PaneItem* anItem = aPane->GetSelected (anObject, theRow, theColumn);
+    if (anItem && !anItem->GetShape().IsNull())
+      theShapes.Append (anItem->GetShape());
+  }
+}
+
 // =======================================================================
 // function : GetItem
 // purpose :
index fcc68c3cf4a41bef581e14736cd6f34ac313849c..fb917187ec2ba949861e45f5bfb0fcaa761f1568 100644 (file)
@@ -40,16 +40,21 @@ public:
   //! Returns number of columns. It has two columns: <funciton name> <function value>
   //! \param theParent an index of the parent item
   //! \return an integer value
-  Standard_EXPORT virtual int ColumnCount (const QModelIndex& theParent = QModelIndex()) const
+  Standard_EXPORT virtual int ColumnCount (const QModelIndex& theParent = QModelIndex()) const Standard_OVERRIDE
   { (void)theParent; return 2; }
 
+  //! Returns number of rows, depending on orientation: myColumnCount or size of values container
+  //! \param theParent an index of the parent item
+  //! \return an integer value
+  Standard_EXPORT virtual int RowCount (const QModelIndex& theParent = QModelIndex()) const Standard_OVERRIDE;
+
   //! Returns content of the model index for the given role, it is obtained from internal container of values
   //! It returns value only for DisplayRole.
   //! \param theRow a model index row
   //! \param theColumn a model index column
   //! \param theRole a view role
   //! \return value intepreted depending on the given role
-  Standard_EXPORT virtual QVariant Data (const int theRow, const int theColumn, int theRole = Qt::DisplayRole) const;
+  Standard_EXPORT virtual QVariant Data (const int theRow, const int theColumn, int theRole = Qt::DisplayRole) const Standard_OVERRIDE;
 
   //! Sets content of the model index for the given role, it is applyed to internal container of values
   //! \param theRow a model index row
@@ -57,7 +62,7 @@ public:
   //! \param theRole a view role
   //! \return true if the value is changed
   Standard_EXPORT virtual bool SetData (const int theRow, const int theColumn, const QVariant& theValue,
-                                        int theRole = Qt::DisplayRole);
+                                        int theRole = Qt::DisplayRole) Standard_OVERRIDE;
 
   //! Returns flags for the item: ItemIsEnabled | Qt::ItemIsSelectable.
   //! Additional flag for the column 1 is Qt::ItemIsEditable.
@@ -77,6 +82,12 @@ public:
   //! \return string values for the enumeration presented in the row or an empty container
   virtual QList<QVariant> GetEnumValues (const int theRow, const int theColumn) const Standard_OVERRIDE;
 
+  //! Returns container of pane shapes
+  //! \param theRow table model row index
+  //! \param theColumn a model index column
+  //! \param [out] output container of shapes to add pane new shapes if found
+  Standard_EXPORT void GetPaneShapes (const int theRow, const int theColumn, NCollection_List<TopoDS_Shape>& theShapes);
+
 private:
 
   //!< Returns source item base
index 1d1f575c5b08f839b7550b07e300602ee6829881..a44046decdd0f6478f0ba09ab5ecdbad93b66576 100644 (file)
@@ -69,6 +69,9 @@ TCollection_AsciiString VInspector_Tools::GetShapeTypeInfo (const TopAbs_ShapeEn
 // =======================================================================
 TCollection_AsciiString VInspector_Tools::GetPointerInfo (const Handle(Standard_Transient)& thePointer, const bool isShortInfo)
 {
+  if (!thePointer.operator->())
+    return "";
+
   std::ostringstream aPtrStr;
   aPtrStr << thePointer.operator->();
   if (!isShortInfo)
@@ -585,14 +588,16 @@ QVariant VInspector_Tools::ToVariant (const Select3D_BndBox3d& theBoundingBox)
 //=======================================================================
 TopoDS_Shape VInspector_Tools::CreateShape (const Bnd_Box& theBoundingBox)
 {
-  if (theBoundingBox.IsVoid() || theBoundingBox.IsWhole() ||
-      theBoundingBox.IsXThin (Precision::Confusion()) ||
-      theBoundingBox.IsYThin (Precision::Confusion()) ||
-      theBoundingBox.IsZThin (Precision::Confusion()))
-    return TopoDS_Shape(); // TODO: display shape for thin box, like in the same method for Select3D_BndBox3d
-
-  BRepPrimAPI_MakeBox aBoxBuilder(theBoundingBox.CornerMin(), theBoundingBox.CornerMax());
-  return aBoxBuilder.Shape();
+  if (theBoundingBox.IsVoid() || theBoundingBox.IsWhole())
+    return TopoDS_Shape();
+
+  Standard_Real aXmin, anYmin, aZmin, aXmax, anYmax, aZmax;
+  theBoundingBox.Get (aXmin, anYmin, aZmin, aXmax, anYmax, aZmax);
+
+  gp_Pnt aPntMin = gp_Pnt (aXmin, anYmin, aZmin);
+  gp_Pnt aPntMax = gp_Pnt (aXmax, anYmax, aZmax);
+
+  return CreateBoxShape (aPntMin, aPntMax);
 }
 
 //=======================================================================
@@ -607,16 +612,25 @@ TopoDS_Shape VInspector_Tools::CreateShape (const Select3D_BndBox3d& theBounding
   gp_Pnt aPntMin = gp_Pnt (theBoundingBox.CornerMin().x(), theBoundingBox.CornerMin().y(), theBoundingBox.CornerMin().z());
   gp_Pnt aPntMax = gp_Pnt (theBoundingBox.CornerMax().x(), theBoundingBox.CornerMax().y(), theBoundingBox.CornerMax().z());
 
-  Standard_Boolean aThinOnX = fabs (aPntMin.X() - aPntMax.X()) < Precision::Confusion();
-  Standard_Boolean aThinOnY = fabs (aPntMin.Y() - aPntMax.Y()) < Precision::Confusion();
-  Standard_Boolean aThinOnZ = fabs (aPntMin.Z() - aPntMax.Z()) < Precision::Confusion();
+  return CreateBoxShape (aPntMin, aPntMax);
+}
+
+//=======================================================================
+//function : CreateBoxShape
+//purpose  :
+//=======================================================================
+TopoDS_Shape VInspector_Tools::CreateBoxShape (const gp_Pnt& thePntMin, const gp_Pnt& thePntMax)
+{
+  Standard_Boolean aThinOnX = fabs (thePntMin.X() - thePntMax.X()) < Precision::Confusion();
+  Standard_Boolean aThinOnY = fabs (thePntMin.Y() - thePntMax.Y()) < Precision::Confusion();
+  Standard_Boolean aThinOnZ = fabs (thePntMin.Z() - thePntMax.Z()) < Precision::Confusion();
 
   if (((int)aThinOnX + (int)aThinOnY + (int)aThinOnZ) > 1) // thin box in several directions is a point
   {
     BRep_Builder aBuilder;
     TopoDS_Compound aCompound;
     aBuilder.MakeCompound (aCompound);
-    aBuilder.Add (aCompound, BRepBuilderAPI_MakeVertex (aPntMin));
+    aBuilder.Add (aCompound, BRepBuilderAPI_MakeVertex (thePntMin));
     return aCompound;
   }
 
@@ -625,24 +639,24 @@ TopoDS_Shape VInspector_Tools::CreateShape (const Select3D_BndBox3d& theBounding
     gp_Pnt aPnt1, aPnt2, aPnt3, aPnt4 ;
     if (aThinOnX)
     {
-      aPnt1 = gp_Pnt(aPntMin.X(), aPntMin.Y(), aPntMin.Z());
-      aPnt2 = gp_Pnt(aPntMin.X(), aPntMax.Y(), aPntMin.Z());
-      aPnt3 = gp_Pnt(aPntMin.X(), aPntMax.Y(), aPntMax.Z());
-      aPnt4 = gp_Pnt(aPntMin.X(), aPntMin.Y(), aPntMax.Z());
+      aPnt1 = gp_Pnt(thePntMin.X(), thePntMin.Y(), thePntMin.Z());
+      aPnt2 = gp_Pnt(thePntMin.X(), thePntMax.Y(), thePntMin.Z());
+      aPnt3 = gp_Pnt(thePntMin.X(), thePntMax.Y(), thePntMax.Z());
+      aPnt4 = gp_Pnt(thePntMin.X(), thePntMin.Y(), thePntMax.Z());
     }
     else if (aThinOnY)
     {
-      aPnt1 = gp_Pnt(aPntMin.X(), aPntMin.Y(), aPntMin.Z());
-      aPnt2 = gp_Pnt(aPntMax.X(), aPntMin.Y(), aPntMin.Z());
-      aPnt3 = gp_Pnt(aPntMax.X(), aPntMin.Y(), aPntMax.Z());
-      aPnt4 = gp_Pnt(aPntMin.X(), aPntMin.Y(), aPntMax.Z());
+      aPnt1 = gp_Pnt(thePntMin.X(), thePntMin.Y(), thePntMin.Z());
+      aPnt2 = gp_Pnt(thePntMax.X(), thePntMin.Y(), thePntMin.Z());
+      aPnt3 = gp_Pnt(thePntMax.X(), thePntMin.Y(), thePntMax.Z());
+      aPnt4 = gp_Pnt(thePntMin.X(), thePntMin.Y(), thePntMax.Z());
     }
     else if (aThinOnZ)
     {
-      aPnt1 = gp_Pnt(aPntMin.X(), aPntMin.Y(), aPntMin.Z());
-      aPnt2 = gp_Pnt(aPntMax.X(), aPntMin.Y(), aPntMin.Z());
-      aPnt3 = gp_Pnt(aPntMax.X(), aPntMax.Y(), aPntMin.Z());
-      aPnt4 = gp_Pnt(aPntMin.X(), aPntMax.Y(), aPntMin.Z());
+      aPnt1 = gp_Pnt(thePntMin.X(), thePntMin.Y(), thePntMin.Z());
+      aPnt2 = gp_Pnt(thePntMax.X(), thePntMin.Y(), thePntMin.Z());
+      aPnt3 = gp_Pnt(thePntMax.X(), thePntMax.Y(), thePntMin.Z());
+      aPnt4 = gp_Pnt(thePntMin.X(), thePntMax.Y(), thePntMin.Z());
     }
     BRep_Builder aBuilder;
     TopoDS_Compound aCompound;
@@ -656,9 +670,7 @@ TopoDS_Shape VInspector_Tools::CreateShape (const Select3D_BndBox3d& theBounding
   }
   else
   {
-    BRepPrimAPI_MakeBox aBoxBuilder (
-      gp_Pnt (theBoundingBox.CornerMin().x(), theBoundingBox.CornerMin().y(), theBoundingBox.CornerMin().z()),
-      gp_Pnt (theBoundingBox.CornerMax().x(), theBoundingBox.CornerMax().y(), theBoundingBox.CornerMax().z()));
+    BRepPrimAPI_MakeBox aBoxBuilder (thePntMin, thePntMax);
     return aBoxBuilder.Shape();
   }
 }
index fc8790bd2cfbf4de5f436284c370523274d9ba80..add7d38fdc1533e813a67314dc2339b7321c3473 100644 (file)
@@ -193,6 +193,12 @@ public:
   //! \return created shape
   Standard_EXPORT static TopoDS_Shape CreateShape (const Select3D_BndBox3d& theBoundingBox);
 
+  //! Creates box shape
+  //! \param thePntMin minimum point on the bounding box
+  //! \param thePntMax maximum point on the bounding box
+  //! \return created shape
+  Standard_EXPORT static TopoDS_Shape CreateBoxShape (const gp_Pnt& thePntMin, const gp_Pnt& thePntMax);
+
   //! Build string presentation of Graphic3D index buffer
   //! \param theIndexBuffer index buffer
   //! \return string presentation
index b008f6066361df175e2717c63f0eebb938227b64..ea7fac8a5f3bd21267ea72e0280263153566c3cc 100644 (file)
@@ -20,6 +20,9 @@
 #include <inspector/VInspector_ItemSelectBasicsEntityOwner.hxx>
 #include <inspector/VInspector_ItemPresentableObject.hxx>
 #include <inspector/VInspector_ItemSelectMgrSensitiveEntity.hxx>
+
+#include <inspector/ViewControl_Tools.hxx>
+
 #include <SelectBasics_EntityOwner.hxx>
 
 #include <Standard_WarningsDisable.hxx>
@@ -42,30 +45,30 @@ VInspector_ViewModel::VInspector_ViewModel (QObject* theParent)
   SetHeaderItem (0, TreeModel_HeaderSection ("Name", COLUMN_NAME_WIDTH));
   SetHeaderItem (1, TreeModel_HeaderSection ("Size", COLUMN_SIZE_WIDTH));
   SetHeaderItem (2, TreeModel_HeaderSection ("Pointer", COLUMN_POINTER_WIDTH));
-  SetHeaderItem (3, TreeModel_HeaderSection ("ShapeType", COLUMN_SHAPE_TYPE_WIDTH)); // ItemPresentableObject, ItemSelection
+  SetHeaderItem (3, TreeModel_HeaderSection ("Row", COLUMN_SIZE_WIDTH));
   SetHeaderItem (4, TreeModel_HeaderSection ("SelectedOwners", -1)); // ItemContext, ItemPresentableObject, ItemSelection
-  SetHeaderItem (5, TreeModel_HeaderSection ("ActivatedModes", -1)); // ItemPresentableObject
-  SetHeaderItem (6, TreeModel_HeaderSection ("DeviationCoefficient", -1, true)); // ItemContext, ItemPresentableObject
-  SetHeaderItem (7, TreeModel_HeaderSection ("Deflection", -1, true)); // ItemPresentableObject
-  SetHeaderItem (8, TreeModel_HeaderSection ("IsAutoTriangulation", -1, true)); // ItemPresentableObject
+  //SetHeaderItem (5, TreeModel_HeaderSection ("ActivatedModes", -1)); // ItemPresentableObject
+  //SetHeaderItem (6, TreeModel_HeaderSection ("DeviationCoefficient", -1, true)); // ItemContext, ItemPresentableObject
+  //SetHeaderItem (7, TreeModel_HeaderSection ("Deflection", -1, true)); // ItemPresentableObject
+  //SetHeaderItem (8, TreeModel_HeaderSection ("IsAutoTriangulation", -1, true)); // ItemPresentableObject
 
-  SetHeaderItem (9, TreeModel_HeaderSection ("SelectionState", -1)); // ItemSelection
-  SetHeaderItem (10, TreeModel_HeaderSection ("Sensitivity", -1, true)); // ItemSelection
-  SetHeaderItem (11, TreeModel_HeaderSection ("UpdateStatus", -1, true)); // ItemSelection
-  SetHeaderItem (12, TreeModel_HeaderSection ("BVHUpdateStatus", -1, true)); // ItemSelection
+  //SetHeaderItem (9, TreeModel_HeaderSection ("SelectionState", -1)); // ItemSelection
+  //SetHeaderItem (10, TreeModel_HeaderSection ("Sensitivity", -1, true)); // ItemSelection
+  //SetHeaderItem (11, TreeModel_HeaderSection ("UpdateStatus", -1, true)); // ItemSelection
+  //SetHeaderItem (12, TreeModel_HeaderSection ("BVHUpdateStatus", -1, true)); // ItemSelection
 
-  SetHeaderItem (13, TreeModel_HeaderSection ("IsActiveForSelection", -1, true)); // ItemSensitiveEntity
-  SetHeaderItem (14, TreeModel_HeaderSection ("SensitivityFactor", -1, true)); // ItemSensitiveEntity
-  SetHeaderItem (15, TreeModel_HeaderSection ("NbSubElements", -1, true)); // ItemSensitiveEntity
-  SetHeaderItem (16, TreeModel_HeaderSection ("Priority", -1, true)); // ItemSensitiveEntity
+  //SetHeaderItem (13, TreeModel_HeaderSection ("IsActiveForSelection", -1, true)); // ItemSensitiveEntity
+  //SetHeaderItem (14, TreeModel_HeaderSection ("SensitivityFactor", -1, true)); // ItemSensitiveEntity
+  //SetHeaderItem (15, TreeModel_HeaderSection ("NbSubElements", -1, true)); // ItemSensitiveEntity
+  //SetHeaderItem (16, TreeModel_HeaderSection ("Priority", -1, true)); // ItemSensitiveEntity
 
-  SetHeaderItem (17, TreeModel_HeaderSection ("TShape", COLUMN_POINTER_WIDTH, true)); // ItemEntityOwner
-  SetHeaderItem (18, TreeModel_HeaderSection ("Orientation", -1, true)); // ItemEntityOwner
-  SetHeaderItem (19, TreeModel_HeaderSection ("Location", -1, true)); // ItemEntityOwner
+  //SetHeaderItem (17, TreeModel_HeaderSection ("TShape", COLUMN_POINTER_WIDTH, true)); // ItemEntityOwner
+  //SetHeaderItem (18, TreeModel_HeaderSection ("Orientation", -1, true)); // ItemEntityOwner
+  //SetHeaderItem (19, TreeModel_HeaderSection ("Location", -1, true)); // ItemEntityOwner
 
-  SetHeaderItem (20, TreeModel_HeaderSection ("Color", -1)); // ItemPresentableObject
+  //SetHeaderItem (20, TreeModel_HeaderSection ("Color", -1)); // ItemPresentableObject
 
-  SetHeaderItem (21, TreeModel_HeaderSection ("Owner Location", -1, true)); // ItemEntityOwner
+  //SetHeaderItem (21, TreeModel_HeaderSection ("Owner Location", -1, true)); // ItemEntityOwner
 }
 
 // =======================================================================
@@ -105,22 +108,29 @@ void VInspector_ViewModel::SetContext (const Handle(AIS_InteractiveContext)& the
 // function : FindPointers
 // purpose :
 // =======================================================================
-QModelIndexList VInspector_ViewModel::FindPointers (const QStringList& thePointers)
+void VInspector_ViewModel::FindPointers (const QStringList& thePointers,
+                                         const QModelIndex& theParent,
+                                         QModelIndexList& theFoundIndices)
 {
-  QModelIndexList anIndices;
-  QModelIndex aParentIndex = index (0, 0);
+  if (thePointers.isEmpty())
+    return;
+
+  QModelIndex aParentIndex = theParent.isValid() ? theParent : index (0, 0);
   TreeModel_ItemBasePtr aParentItem = TreeModel_ModelBase::GetItemByIndex (aParentIndex); // context item
   for (int aRowId = 0, aCount = aParentItem->rowCount(); aRowId < aCount; aRowId++)
   {
     QModelIndex anIndex = index (aRowId, 0, aParentIndex);
     TreeModel_ItemBasePtr anItemBase = TreeModel_ModelBase::GetItemByIndex (anIndex);
-    VInspector_ItemPresentableObjectPtr anItemPrs = itemDynamicCast<VInspector_ItemPresentableObject>(anItemBase);
-    if (!anItemPrs)
+    VInspector_ItemBasePtr aVItem = itemDynamicCast<VInspector_ItemBase>(anItemBase);
+    if (!aVItem)
       continue;
-    if (thePointers.contains (anItemPrs->PointerInfo()))
-      anIndices.append (anIndex);
+    Handle(Standard_Transient) anObject = aVItem->GetObject();
+    TCollection_AsciiString aPointerInfo = ViewControl_Tools::GetPointerInfo (anObject);
+    if (thePointers.contains (aPointerInfo.ToCString()))
+      theFoundIndices.append (anIndex);
+
+    FindPointers (thePointers, anIndex, theFoundIndices);
   }
-  return anIndices;
 }
 
 // =======================================================================
index 2f58f57a1c0baeb163bb2d80d13f84b4795128f4..55bbecf99627ebfb890dea79b37366f47de0cc91 100644 (file)
@@ -59,8 +59,11 @@ public:
 
   //! Returns tree view indices for the given pointers of presentable object
   //! \param thePointers a list of presentation pointers
-  //! \return container of indices
-  Standard_EXPORT QModelIndexList FindPointers (const QStringList& thePointers);
+  //! \param theParent an index of the parent item
+  //! \param [out] container of indices
+  Standard_EXPORT void FindPointers (const QStringList& thePointers,
+                                     const QModelIndex& theParent,
+                                     QModelIndexList& theFoundIndices);
 
   //! Returns tree model index of the presentation item in the tree view.
   //! \param thePresentation a presentation
index 4814fa251fe3e29b24194709f6425502713714bc..39c8bba3e9e54f84115159bce5010be2dfa231ad 100644 (file)
@@ -26,6 +26,7 @@
 #include <inspector/TreeModel_Tools.hxx>
 
 #include <inspector/ViewControl_MessageDialog.hxx>
+#include <inspector/ViewControl_TableModel.hxx>
 #include <inspector/ViewControl_Tools.hxx>
 
 #include <inspector/VInspector_ToolBar.hxx>
@@ -39,6 +40,7 @@
 #include <inspector/VInspector_ItemOpenGlElement.hxx>
 #include <inspector/VInspector_ItemPresentableObject.hxx>
 #include <inspector/VInspector_PrsOpenGlElement.hxx>
+#include <inspector/VInspector_TableModelValues.hxx>
 #include <inspector/VInspector_ToolBar.hxx>
 #include <inspector/VInspector_Tools.hxx>
 #include <inspector/VInspector_ViewModel.hxx>
@@ -49,6 +51,7 @@
 #include <inspector/ViewControl_PropertyView.hxx>
 #include <inspector/ViewControl_TreeView.hxx>
 
+#include <inspector/View_Displayer.hxx>
 #include <inspector/View_Widget.hxx>
 #include <inspector/View_Window.hxx>
 
@@ -369,7 +372,7 @@ NCollection_List<TopoDS_Shape> VInspector_Window::GetSelectedShapes (const QMode
   {
     TreeModel_ItemBasePtr anItem = *anItemIt;
     VInspector_ItemBasePtr aVItem = itemDynamicCast<VInspector_ItemBase>(anItem);
-    if (!aVItem)
+    if (!aVItem && aVItem->Row() == 0)
       continue;
 
     TopoDS_Shape aShape = aVItem->GetPresentationShape();
@@ -378,9 +381,65 @@ NCollection_List<TopoDS_Shape> VInspector_Window::GetSelectedShapes (const QMode
 
     aSelectedShapes.Append (aShape);
   }
+
+  // obtain selection from the property panel
+  {
+    QList<ViewControl_Table*> aPropertyTables;
+    myPropertyView->GetActiveTables (aPropertyTables);
+    if (!aPropertyTables.isEmpty())
+    {
+      ViewControl_Table* aFirstTable = aPropertyTables[0]; // TODO: implement for several tables
+
+      Handle(Graphic3d_TransformPers) aSelectedPersistent = GetSelectedTransformPers();
+      QModelIndexList aTreeViewSelected = myTreeView->selectionModel()->selectedIndexes();
+      GetSelectedPropertyPanelShapes(aTreeViewSelected,
+                                     aFirstTable->GetTableView()->selectionModel()->selectedIndexes(),
+                                     aSelectedShapes);
+    }
+  }
+
   return aSelectedShapes;
 }
 
+// =======================================================================
+// function : GetSelectedPropertyPanelShapes
+// purpose :
+// =======================================================================
+void VInspector_Window::GetSelectedPropertyPanelShapes (const QModelIndexList& theTreeViewIndices,
+                                                        const QModelIndexList& thePropertyPanelIndices,
+                                                        NCollection_List<TopoDS_Shape>& theShapes)
+{
+  QList<TreeModel_ItemBasePtr> anItems = TreeModel_ModelBase::GetSelectedItems (theTreeViewIndices);
+  for (QList<TreeModel_ItemBasePtr>::const_iterator anItemIt = anItems.begin(); anItemIt != anItems.end(); anItemIt++)
+  {
+    TreeModel_ItemBasePtr anItem = *anItemIt;
+    VInspector_ItemBasePtr aVItem = itemDynamicCast<VInspector_ItemBase>(anItem);
+    if (!aVItem || aVItem->Column() != 0)
+      continue;
+
+    QList<ViewControl_TableModelValues*> aTableValues;
+    VInspector_Tools::GetPropertyTableValues (aVItem, myPaneCreators, aTableValues);
+    if (aTableValues.isEmpty())
+      continue;
+
+    for (int aTableIt = 0; aTableIt < aTableValues.size(); aTableIt++)
+    {
+      VInspector_TableModelValues* aTableVals = dynamic_cast<VInspector_TableModelValues*>(aTableValues[aTableIt]);
+      if (!aTableVals)
+        continue;
+
+      // default shape by NULL selection
+      aTableVals->GetPaneShapes (-1, -1, theShapes);
+
+      for (QModelIndexList::const_iterator anIndicesIt = thePropertyPanelIndices.begin(); anIndicesIt != thePropertyPanelIndices.end(); anIndicesIt++)
+      {
+        QModelIndex anIndex = *anIndicesIt;
+        aTableVals->GetPaneShapes (anIndex.row(), anIndex.column(), theShapes);
+      }
+    }
+  }
+}
+
 // =======================================================================
 // function : GetSelectedElements
 // purpose :
@@ -463,6 +522,13 @@ bool VInspector_Window::Init (const NCollection_List<Handle(Standard_Transient)>
 
     if (aCallBack.IsNull())
       aCallBack = Handle(VInspector_CallBack)::DownCast (anObject);
+
+    if (!Handle(ViewControl_PaneCreator)::DownCast (anObject).IsNull())
+    {
+      Handle(ViewControl_PaneCreator) aPaneCreator = Handle(ViewControl_PaneCreator)::DownCast (anObject);
+      if (!myPaneCreators.Contains (aPaneCreator))
+        myPaneCreators.Append (aPaneCreator);
+    }
   }
   if (aContext.IsNull())
     return false;
@@ -521,8 +587,12 @@ bool VInspector_Window::OpenFile(const TCollection_AsciiString& theFileName)
     return isModelUpdated;
 
   Handle(AIS_Shape) aPresentation = new AIS_Shape (aShape);
-  aContext->Display (aPresentation, false);
-  aContext->Load (aPresentation, -1/*selection mode*/);
+
+  View_Displayer* aDisplayer = myViewWindow->GetDisplayer();
+  aDisplayer->DisplayPresentation (aPresentation);
+
+  //aContext->Display (aPresentation, false);
+  //aContext->Load (aPresentation, -1/*selection mode*/);
   aContext->UpdateCurrentViewer();
 
   UpdateTreeModel();
@@ -544,6 +614,11 @@ void VInspector_Window::onTreeViewContextMenuRequested(const QPoint& thePosition
     aMenu->addAction (ViewControl_Tools::CreateAction (VInspector_Tools::DisplayActionTypeToString ((VInspector_DisplayActionType) aTypeId),
                       SLOT (onDisplayActionTypeClicked()), GetMainWindow(), this));
   aMenu->addSeparator();
+
+  aMenu->addAction (ViewControl_Tools::CreateAction (tr ("Expand"), SLOT (onExpand()), GetMainWindow(), this));
+  aMenu->addAction (ViewControl_Tools::CreateAction (tr ("Expand All"), SLOT (onExpandAll()), GetMainWindow(), this));
+  aMenu->addAction (ViewControl_Tools::CreateAction (tr ("Collapse All"), SLOT (onCollapseAll()), GetMainWindow(), this));
+
   QPoint aPoint = myTreeView->mapToGlobal (thePosition);
   aMenu->exec(aPoint);
 }
@@ -608,19 +683,6 @@ void VInspector_Window::onPropertyPanelShown (bool isToggled)
 // =======================================================================
 void VInspector_Window::onPropertyViewSelectionChanged()
 {
-  /*QItemSelectionModel* aModel = myTreeView->selectionModel();
-  if (!aModel)
-    return;
-  QModelIndex aSelectedIndex = TreeModel_ModelBase::SingleSelected (aModel->selectedIndexes(), 0);
-  QModelIndex anIndex = myTreeView->model()->index (aSelectedIndex.row(), TreeModel_ColumnType_Visibility, aSelectedIndex.parent());
-
-  TreeModel_ItemBasePtr anItemBase = TreeModel_ModelBase::GetItemByIndex (anIndex);
-  if (!anItemBase)
-    return;
-  MessageModel_ItemAlertPtr anAlertItem = itemDynamicCast<MessageModel_ItemAlert>(anItemBase);
-  if (!anAlertItem)
-    return;
-
   QList<ViewControl_Table*> aPropertyTables;
   myPropertyView->GetActiveTables (aPropertyTables);
   if (aPropertyTables.isEmpty())
@@ -631,37 +693,36 @@ void VInspector_Window::onPropertyViewSelectionChanged()
   QMap<int, QList<int>> aSelectedIndices;
   aFirstTable->GetSelectedIndices (aSelectedIndices);
 
-  // clear presentation if selection is empty
-  MessageModel_TreeModel* aTreeModel = dynamic_cast<MessageModel_TreeModel*> (myTreeView->model());
-  TreeModel_VisibilityState* aVisibilityState = aTreeModel->GetVisibilityState();
-  if (aSelectedIndices.isEmpty() && aVisibilityState->IsVisible (anIndex))
-  {
-    aVisibilityState->SetVisible (anIndex, false, true);
-    anAlertItem->SetCustomShape (TopoDS_Shape());
-    return;
-  }
-
-  TopoDS_Shape aShapeOfSelection = MessageModel_Tools::BuildShape (anAlertItem->GetAlert(), aSelectedIndices[0], aFirstTable);
-  if (aShapeOfSelection.IsNull())
-    return;
+  ViewControl_TableModel* aTableModel = dynamic_cast<ViewControl_TableModel*>(aFirstTable->GetTableView()->model());
+  ViewControl_TableModelValues* aTableValues = aTableModel->GetModelValues();
 
-  if (aVisibilityState->IsVisible (anIndex))
+  QStringList aPointers;
+  for (QMap<int, QList<int>>::const_iterator aSelIt = aSelectedIndices.begin(); aSelIt != aSelectedIndices.end(); aSelIt++)
   {
-    View_Displayer* aDisplayer = myViewWindow->GetDisplayer();
+    int aRowId = aSelIt.key();
+    QList<int> aColIds = aSelIt.value();
+    for (int aColId = 0; aColId < aColIds.size(); aColId++)
+    {
+      int aSelectedColId = aColIds[aColId];
+      if (aSelectedColId != 1)
+        continue;
+
+      QString aData = aTableValues->Data (aRowId, aSelectedColId, Qt::DisplayRole).toString();
+      if (aData.contains (ViewControl_Tools::GetPointerPrefix().ToCString()))
+        aPointers.append (aData);
+    }
+  }
+  highlightTreeViewItems (aPointers);
 
-    Handle(AIS_InteractiveObject) aPresentation = myViewWindow->GetDisplayer()->FindPresentation (anAlertItem->GetCustomShape());
+  Handle(Graphic3d_TransformPers) aSelectedPersistent = GetSelectedTransformPers();
+  QModelIndexList aTreeViewSelected = myTreeView->selectionModel()->selectedIndexes();
+  NCollection_List<TopoDS_Shape> aSelectedShapes = GetSelectedShapes (aTreeViewSelected);
 
-    Handle(AIS_Shape) aShapePresentation = Handle(AIS_Shape)::DownCast (aPresentation);
-    aShapePresentation->Set (aShapeOfSelection);
+  GetSelectedPropertyPanelShapes(aTreeViewSelected,
+                                 aFirstTable->GetTableView()->selectionModel()->selectedIndexes(),
+                                 aSelectedShapes);
 
-    aDisplayer->RedisplayPresentation (aPresentation);
-    anAlertItem->SetCustomShape (aShapeOfSelection);
-  }
-  else
-  {
-    anAlertItem->SetCustomShape (aShapeOfSelection);
-    aVisibilityState->SetVisible (anIndex, true);
-  }*/
+  updatePreviewPresentation(aSelectedShapes, aSelectedPersistent);
 }
 
 // =======================================================================
@@ -682,6 +743,7 @@ void VInspector_Window::onTreeViewSelectionChanged (const QItemSelection&,
     updatePropertyPanelBySelection();
 
   Handle(Graphic3d_TransformPers) aSelectedPersistent = GetSelectedTransformPers();
+
   NCollection_List<TopoDS_Shape> aSelectedShapes = GetSelectedShapes (myTreeView->selectionModel()->selectedIndexes());
   updatePreviewPresentation(aSelectedShapes, aSelectedPersistent);
 
@@ -707,20 +769,7 @@ void VInspector_Window::onHistoryViewSelectionChanged (const QItemSelection& the
 
   QModelIndexList aSelectedIndices = theSelected.indexes();
   QStringList aPointers = aHistoryModel->GetSelectedPointers(aSelectedIndices.first());
-
-  VInspector_ViewModel* aTreeModel = dynamic_cast<VInspector_ViewModel*> (myTreeView->model());
-  if (!aTreeModel)
-    return;
-
-  QModelIndexList anIndices = aTreeModel->FindPointers (aPointers);
-  QItemSelectionModel* aSelectionModel = myTreeView->selectionModel();
-  aSelectionModel->clear();
-  for (int anIndicesId = 0, aSize = anIndices.size(); anIndicesId < aSize; anIndicesId++)
-  {
-    QModelIndex anIndex = anIndices[anIndicesId];
-    myTreeView->setExpanded (aTreeModel->parent (anIndex), true);
-    aSelectionModel->select (anIndex, QItemSelectionModel::Select);
-  }
+  selectTreeViewItems (aPointers);
 }
 
 // =======================================================================
@@ -783,6 +832,57 @@ void VInspector_Window::onDisplayActionTypeClicked()
   displaySelectedPresentations (VInspector_Tools::DisplayActionTypeFromString (anAction->text().toStdString().c_str()));
 }
 
+// =======================================================================
+// function : onExpand
+// purpose :
+// =======================================================================
+void VInspector_Window::onExpand()
+{
+  QApplication::setOverrideCursor (Qt::WaitCursor);
+
+  QItemSelectionModel* aSelectionModel = myTreeView->selectionModel();
+  QModelIndexList aSelectedIndices = aSelectionModel->selectedIndexes();
+  for (int aSelectedId = 0, aSize = aSelectedIndices.size(); aSelectedId < aSize; aSelectedId++)
+  {
+    int aLevels = 2;
+    TreeModel_Tools::SetExpanded (myTreeView, aSelectedIndices[aSelectedId], true, aLevels);
+  }
+  QApplication::restoreOverrideCursor();
+}
+
+// =======================================================================
+// function : onExpandAll
+// purpose :
+// =======================================================================
+void VInspector_Window::onExpandAll()
+{
+  QApplication::setOverrideCursor (Qt::WaitCursor);
+
+  QItemSelectionModel* aSelectionModel = myTreeView->selectionModel();
+  QModelIndexList aSelectedIndices = aSelectionModel->selectedIndexes();
+  for (int  aSelectedId = 0, aSize = aSelectedIndices.size(); aSelectedId < aSize; aSelectedId++)
+  {
+    int aLevels = -1;
+    TreeModel_Tools::SetExpanded (myTreeView, aSelectedIndices[aSelectedId], true, aLevels);
+  }
+  QApplication::restoreOverrideCursor();
+}
+
+// =======================================================================
+// function : onCollapseAll
+// purpose :
+// =======================================================================
+void VInspector_Window::onCollapseAll()
+{
+  QItemSelectionModel* aSelectionModel = myTreeView->selectionModel();
+  QModelIndexList aSelectedIndices = aSelectionModel->selectedIndexes();
+  for (int aSelectedId = 0, aSize = aSelectedIndices.size(); aSelectedId < aSize; aSelectedId++)
+  {
+    int aLevels = -1;
+    TreeModel_Tools::SetExpanded (myTreeView, aSelectedIndices[aSelectedId], false, aLevels);
+  }
+}
+
 #ifdef DEBUG_TWO_VIEWS
 // =======================================================================
 // function : onViewLeftButtonDown
@@ -931,6 +1031,51 @@ void VInspector_Window::displaySelectedPresentations (const VInspector_DisplayAc
   UpdateTreeModel();
 }
 
+// =======================================================================
+// function : highlightTreeViewItems
+// purpose :
+// =======================================================================
+void VInspector_Window::highlightTreeViewItems (const QStringList& thePointers)
+{
+  VInspector_ViewModel* aTreeModel = dynamic_cast<VInspector_ViewModel*> (myTreeView->model());
+  if (!aTreeModel)
+    return;
+
+  QModelIndexList anIndices;
+  aTreeModel->FindPointers (thePointers, QModelIndex(), anIndices);
+  for (int anIndicesId = 0, aSize = anIndices.size(); anIndicesId < aSize; anIndicesId++)
+  {
+    QModelIndex anIndex = anIndices[anIndicesId];
+    TreeModel_Tools::SetExpandedTo (myTreeView, anIndex);
+  }
+  aTreeModel->SetHighlighted (anIndices);
+
+  if (!anIndices.isEmpty())
+    myTreeView->scrollTo (anIndices.last());
+}
+
+// =======================================================================
+// function : selectTreeViewItems
+// purpose :
+// =======================================================================
+void VInspector_Window::selectTreeViewItems (const QStringList& thePointers)
+{
+  VInspector_ViewModel* aTreeModel = dynamic_cast<VInspector_ViewModel*> (myTreeView->model());
+  if (!aTreeModel)
+    return;
+  
+  QModelIndexList anIndices;
+  aTreeModel->FindPointers (thePointers, QModelIndex(), anIndices);
+  QItemSelectionModel* aSelectionModel = myTreeView->selectionModel();
+  aSelectionModel->clear();
+  for (int anIndicesId = 0, aSize = anIndices.size(); anIndicesId < aSize; anIndicesId++)
+  {
+    QModelIndex anIndex = anIndices[anIndicesId];
+    TreeModel_Tools::SetExpandedTo (myTreeView, anIndex);
+    aSelectionModel->select (anIndex, QItemSelectionModel::Select);
+  }
+}
+
 // =======================================================================
 // function : createView
 // purpose :
@@ -1003,12 +1148,12 @@ void VInspector_Window::updatePreviewPresentation (const NCollection_List<TopoDS
   if (myPreviewPresentation.IsNull())
   {
     myPreviewPresentation = new AIS_Shape (aCompound);
-    myPreviewPresentation->SetColor (Quantity_Color (Quantity_NOC_BLUE1));
+    myPreviewPresentation->SetColor (Quantity_Color (Quantity_NOC_TOMATO));//Quantity_NOC_GREENYELLOW));//Quantity_NOC_BLUE1));
     myPreviewPresentation->SetZLayer (Graphic3d_ZLayerId_Topmost);
 
     myPreviewPresentation->SetTransformPersistence(thePersistent);
     if (!aContext.IsNull())
-      aContext->Display (myPreviewPresentation, Standard_True);
+      aContext->Display (myPreviewPresentation, AIS_Shaded, -1/*do not participate in selection*/, Standard_True);
   }
   else
   {
index f82d2f9eb5e9c3b6bb56b3f92250767ead67a779..b806e925183039b9e3c10ac89cf1f94e9180eae8 100644 (file)
@@ -107,6 +107,13 @@ public:
   //! \return container of shapes
   NCollection_List<TopoDS_Shape> GetSelectedShapes (const QModelIndexList& theIndices);
 
+  //! Returns selected shapes
+  //! \param theModel selection model
+  //! \return container of shapes
+  void GetSelectedPropertyPanelShapes (const QModelIndexList& theTreeViewIndices,
+                                       const QModelIndexList& thePropertyPanelIndices,
+                                       NCollection_List<TopoDS_Shape>& theShapes);
+
   //! Returns selected elements
   //! \param theModel selection model
   //! \return container of OpenGl elements
@@ -163,6 +170,15 @@ private slots:
   //! Apply activated display action
   void onDisplayActionTypeClicked();
 
+  //! Expand two next levels for all selected item
+  void onExpand();
+
+  //! Expand all levels for all selected items
+  void onExpandAll();
+
+  //! Collapse all levels for all selected items
+  void onCollapseAll();
+
 #ifdef DEBUG_TWO_VIEWS
   //! Processing mouse down in the view
   //! \param theX X mouse position in pixels
@@ -200,6 +216,14 @@ private:
   //! \param theType display action type
   void displaySelectedPresentations (const VInspector_DisplayActionType theType);
 
+  //! Set items of the pointers highlighted in tree view
+  //! \param theType display action type
+  void highlightTreeViewItems (const QStringList& thePointers);
+
+  //! Set items of the pointers selected in tree view
+  //! \param theType display action type
+  void selectTreeViewItems (const QStringList& thePointers);
+
   //! Creates an istance of 3D view to initialize context.
   //! \return a context of created view.
   Handle(AIS_InteractiveContext) createView();
index c1faaa5dfae89bf3f71e00c370052f2fabec097b..310e98b5ae4dfd98ae0480bb172d12120b4d5a1a 100644 (file)
@@ -1,6 +1,4 @@
 VInspectorPaneAIS_PaneCreator.cxx
 VInspectorPaneAIS_PaneCreator.hxx
 VInspectorPaneAIS_Shape.cxx
-VInspectorPaneAIS_Shape.hxx
-VInspectorPaneAIS_Trihedron.cxx
-VInspectorPaneAIS_Trihedron.hxx
\ No newline at end of file
+VInspectorPaneAIS_Shape.hxx
\ No newline at end of file
index c19e361fd0def03ffa9d0489e9daa5145f08aff3..7bde9e2398a2d54516a7e43d265d8930dcadfe6d 100644 (file)
 
 #include <inspector/VInspectorPaneAIS_PaneCreator.hxx>
 #include <inspector/VInspectorPaneAIS_Shape.hxx>
-#include <inspector/VInspectorPaneAIS_Trihedron.hxx>
 
 #include <AIS_Shape.hxx>
-#include <AIS_Trihedron.hxx>
 
-IMPLEMENT_STANDARD_RTTIEXT(VInspectorPaneAIS_PaneCreator, VInspectorAPI_CallBack)
+IMPLEMENT_STANDARD_RTTIEXT(VInspectorPaneAIS_PaneCreator, ViewControl_PaneCreator)
 
 // =======================================================================
 // function : createPane
@@ -30,8 +28,6 @@ ViewControl_Pane* VInspectorPaneAIS_PaneCreator::createPane (const Standard_CStr
 {
   if (theName == STANDARD_TYPE (AIS_Shape)->Name())
     return new VInspectorPaneAIS_Shape();
-  //else if (theName == STANDARD_TYPE (AIS_Trihedron)->Name())
-  //  return new VInspectorPaneAIS_Trihedron();
 
   return NULL;
 }
index f57d3556609ac7fe696a2f3427299291a4d152b4..f4378b68d865f8710e17a76cf5e36415addcb96d 100644 (file)
 
 #include <inspector/VInspectorPaneAIS_Shape.hxx>
 
-//#include <AIS_Shape.hxx>
-//#include <AIS_ListOfInteractive.hxx>
-//#include <AIS_ListIteratorOfListOfInteractive.hxx>
-//#include <Aspect.hxx>
-//
-//#include <inspector/VInspector_ItemContext.hxx>
-//#include <inspector/VInspector_ItemSelectBasicsEntityOwner.hxx>
-//#include <inspector/VInspector_ItemFolderObject.hxx>
-//#include <inspector/VInspector_ItemPresentations.hxx>
-//#include <inspector/VInspector_ItemSelectMgrSelection.hxx>
 #include <inspector/ViewControl_Table.hxx>
 #include <inspector/ViewControl_Tools.hxx>
 #include <inspector/VInspector_Tools.hxx>
-//#include <inspector/VInspector_ViewModel.hxx>
 
 #include <inspector/ViewControl_PaneItem.hxx>
 
 #include <Prs3d.hxx>
 #include <TopAbs.hxx>
-//
-//#include <Graphic3d.hxx>
-//#include <NCollection_List.hxx>
-//#include <Prs3d.hxx>
-//#include <Prs3d_Drawer.hxx>
-//#include <PrsMgr.hxx>
-//#include <SelectBasics_EntityOwner.hxx>
-//#include <StdSelect_BRepOwner.hxx>
-//#include <Standard_Version.hxx>
-//
-//#include <Standard_WarningsDisable.hxx>
-//#include <QColor>
-//#include <QItemSelectionModel>
-//#include <Standard_WarningsRestore.hxx>
 
 // =======================================================================
 // function : GetTableRowCount
@@ -99,105 +74,6 @@ QVariant VInspectorPaneAIS_Shape::GetTableData (const Handle(Standard_Transient)
   return QVariant();
 }
 
-// =======================================================================
-// function : GetTableEditType
-// purpose :
-// =======================================================================
-ViewControl_EditType VInspectorPaneAIS_Shape::GetTableEditType (const Handle(Standard_Transient)& theObject,
-                                                                const int theRow, const int) const
-{
-  Handle(AIS_Shape) aPrs = GetPresentation (theObject);
-  if (aPrs.IsNull())
-    return ViewControl_EditType_None;
-
-  switch (theRow)
-  {
-    //case 4: return ViewControl_EditType_Line;
-    //case 5: return ViewControl_EditType_Combo;
-    //case 6: return ViewControl_EditType_Bool;
-    //case 12: return ViewControl_EditType_Bool;
-    //case 17: return ViewControl_EditType_Combo;
-    //case 18: return ViewControl_EditType_Bool;
-    //case 20: return ViewControl_EditType_Combo;
-    //case 23: return ViewControl_EditType_Bool;
-    default: return ViewControl_EditType_None;
-  }
-}
-
-// =======================================================================
-// function : GetTableEnumValues
-// purpose :
-// =======================================================================
-QList<QVariant> VInspectorPaneAIS_Shape::GetTableEnumValues (const Handle(Standard_Transient)& theObject,
-                                                             const int theRow, const int) const
-{
-  Handle(AIS_Shape) aPrs = GetPresentation (theObject);
-  if (aPrs.IsNull())
-    return QList<QVariant>();
-
-  QList<QVariant> aValues;
-  switch (theRow)
-  {
-    //case 5:
-    //{
-    //  for (int i = 0; i <= Aspect_TOFM_FRONT_SIDE; i++)
-    //    aValues.append (Aspect::TypeOfFacingModelToString((Aspect_TypeOfFacingModel)i));
-    //}
-    //break;
-    //case 17:
-    //{
-    //  for (int i = 0; i <= PrsMgr_TOP_ProjectorDependant; i++)
-    //    aValues.append (PrsMgr::TypeOfPresentation3dToString ((PrsMgr_TypeOfPresentation3d)i));
-    //}
-    //break;
-    //case 20:
-    //{
-    //  aValues.append (Graphic3d::ZLayerIdToString (Graphic3d_ZLayerId_UNKNOWN));
-    //  aValues.append (Graphic3d::ZLayerIdToString (Graphic3d_ZLayerId_Default));
-    //  aValues.append (Graphic3d::ZLayerIdToString (Graphic3d_ZLayerId_Top));
-    //  aValues.append (Graphic3d::ZLayerIdToString (Graphic3d_ZLayerId_Topmost));
-    //  aValues.append (Graphic3d::ZLayerIdToString (Graphic3d_ZLayerId_TopOSD));
-    //  aValues.append (Graphic3d::ZLayerIdToString (Graphic3d_ZLayerId_BotOSD));
-    //}
-    //break;
-    default: break;
-  }
-  return aValues;
-}
-
-// =======================================================================
-// function : SetTableData
-// purpose :
-// =======================================================================
-bool VInspectorPaneAIS_Shape::SetTableData (const Handle(Standard_Transient)& theObject,
-                                            const int theRow, const int, const QVariant& theValue)
-{
-  Handle(AIS_Shape) aPrs = GetPresentation (theObject);
-  if (aPrs.IsNull())
-    return false;
-
-  //Handle(AIS_InteractiveObject) aPrs = GetInteractiveObject();
-  switch (theRow)
-  {
-    //case 4:
-    //{
-    //  double aValue = theValue.toDouble();
-    //  if (aValue > 0) aPrs->SetWidth (aValue);
-    //  else aPrs->UnsetWidth();
-    //}
-    //break;
-    //case 5: aPrs->SetCurrentFacingModel (Aspect::TypeOfFacingModelFromString (theValue.toString().toStdString().c_str()));
-    //case 6: aPrs->SetInfiniteState (theValue.toBool());
-    //case 12: aPrs->SetAutoHilight(theValue.toBool());
-    //case 17: aPrs->SetTypeOfPresentation (PrsMgr::TypeOfPresentation3dFromString (theValue.toString().toStdString().c_str()));
-    //case 18: aPrs->SetMutable (theValue.toBool());
-    //case 20: aPrs->SetZLayer (Graphic3d::ZLayerIdFromString (theValue.toString().toStdString().c_str()));
-    //case 23: if (!theValue.toBool()) aPrs->ResetTransformation();
-    default: return false;
-  }
-  return true;
-}
-
 // =======================================================================
 // function : GetSelected
 // purpose :
index 9fad94bb120ac5e607df4ac09ac8f71134ddf676..eb8ceeca080139d9c8cd4702df0d4efeb48aacf0 100644 (file)
@@ -42,35 +42,17 @@ public:
   //! \param theRow a model index row
   //! \param theColumn a model index column
   Standard_EXPORT virtual QVariant GetTableData (const Handle(Standard_Transient)& theObject,
-    const int theRow, const int theColumn, const int theRole) const Standard_OVERRIDE;
-
-  //! Returns type of edit control for the model index. By default, it is an empty control
-  //! \param theRow a model index row
-  //! \param theColumn a model index column
-  //! \return edit type
-  Standard_EXPORT virtual ViewControl_EditType GetTableEditType (const Handle(Standard_Transient)& theObject,
-    const int theRow, const int theColumn) const Standard_OVERRIDE;
-
-  //! Returns container of string values for enumeration in the model row
-  //! \param theRow table model row index
-  //! \param theColumn a model index column
-  //! \return string values for the enumeration presented in the row or an empty container
-  Standard_EXPORT virtual QList<QVariant> GetTableEnumValues (const Handle(Standard_Transient)& theObject,
-    const int theRow, const int theColumn) const Standard_OVERRIDE;
-
-  //! Sets the value into the table cell. Only 1st column value might be modified.
-  //! \param theRow a model index row
-  //! \param theColumn a model index column
-  //! \param theValue a new cell value
-  Standard_EXPORT virtual bool SetTableData (const Handle(Standard_Transient)& theObject,
-    const int theRow, const int theColumn, const QVariant& theValue) Standard_OVERRIDE;
+                                                 const int theRow,
+                                                 const int theColumn,
+                                                 const int theRole) const Standard_OVERRIDE;
 
   //! Return selected element in the pane cell
   //! \param theObject current pane object
   //! \param theRow a model index row
   //! \param theColumn a model index column
   Standard_EXPORT virtual ViewControl_PaneItem* GetSelected (const Handle(Standard_Transient)& theObject,
-    const int theRow, const int theColumn) Standard_OVERRIDE;
+                                                             const int theRow,
+                                                             const int theColumn) Standard_OVERRIDE;
 
 protected:
   //! Converts transient object to custom presentation type
diff --git a/tools/VInspectorPaneAIS/VInspectorPaneAIS_Trihedron.cxx b/tools/VInspectorPaneAIS/VInspectorPaneAIS_Trihedron.cxx
deleted file mode 100644 (file)
index 35c0169..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-// Created on: 2018-12-08
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement. 
-
-#include <inspector/VInspectorPaneAIS_Trihedron.hxx>
-
diff --git a/tools/VInspectorPaneAIS/VInspectorPaneAIS_Trihedron.hxx b/tools/VInspectorPaneAIS/VInspectorPaneAIS_Trihedron.hxx
deleted file mode 100644 (file)
index 33ea153..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-// Created on: 2018-12-08
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement. 
-
-#ifndef VInspectorPaneAIS_Trihedron_H
-#define VInspectorPaneAIS_Trihedron_H
-
-#include <Standard.hxx>
-#include <inspector/ViewControl_Pane.hxx>
-
-//! \class VInspectorPaneAIS_Trihedron
-//! Item presents information about AIS_InteractiveObject.
-//! Parent is item context, children are item selections.
-class VInspectorPaneAIS_Trihedron : public ViewControl_Pane
-{
-};
-
-#endif
index e218cae80e52a414de70a28dbf5ba1da46f54b9a..49fa7908287e4456a74f34d809038778ef8b5541 100644 (file)
 #include <Prs3d_PointAspect.hxx>
 #include <V3d_View.hxx>
 #include <V3d_Viewer.hxx>
+
 #include <inspector/View_Viewer.hxx>
 #include <inspector/View_Widget.hxx>
+#include <inspector/View_Tools.hxx>
 
 // =======================================================================
 // function : Constructor
@@ -277,18 +279,7 @@ void View_Displayer::DisplayedPresentations (NCollection_Shared<AIS_ListOfIntera
 // =======================================================================
 Handle(V3d_View) View_Displayer::GetView() const
 {
-  Handle(V3d_View) aView;
-  if (GetContext().IsNull())
-    return aView;
-
-  const Handle(V3d_Viewer)& aViewer = GetContext()->CurrentViewer();
-  if (!aViewer.IsNull())
-  {
-    aViewer->InitActiveViews();
-    if (aViewer->MoreActiveViews())
-      aView = aViewer->ActiveView();
-  }
-  return aView;
+  return View_Tools::FindActiveView (GetContext());
 }
 
 // =======================================================================
index 3ecb175c22442cc874806a0b18a9a7f8d8550baa..3ed8a92f5e54198d4d04140e840b0f78611e5f54 100644 (file)
@@ -36,6 +36,26 @@ QAction* View_Tools::CreateAction (const QString& theText, const char* theSlot,
   return anAction;
 }
 
+// =======================================================================
+// function : GetView
+// purpose :
+// =======================================================================
+Handle(V3d_View) View_Tools::FindActiveView (const Handle(AIS_InteractiveContext)& theContext)
+{
+  if (theContext.IsNull())
+    return NULL;
+
+  const Handle(V3d_Viewer)& aViewer = theContext->CurrentViewer();
+  if (aViewer.IsNull())
+    return NULL;
+
+  aViewer->InitActiveViews();
+  if (!aViewer->MoreActiveViews())
+    return NULL;
+
+  return aViewer->ActiveView();
+}
+
 // =======================================================================
 // function : SaveState
 // purpose :
index 2c105f7ed6f8d8e3c5804c2d95d1b70118d5dd94..b3c49a76e0132d736930573f8a5bb726c257242a 100644 (file)
@@ -24,6 +24,9 @@
 #include <QString>
 #include <Standard_WarningsRestore.hxx>
 
+#include <V3d_View.hxx>
+#include <AIS_InteractiveContext.hxx>
+
 class View_Window;
 
 class QAction;
@@ -44,6 +47,11 @@ public:
   Standard_EXPORT static QAction* CreateAction (const QString& theText, const char* theSlot,
                                                 QObject* theParent, QObject* theContext);
 
+
+  //! Gets current viewer from the context and returns active view of the viewer
+  //! \return view or NULL
+  Standard_EXPORT static Handle(V3d_View) FindActiveView (const Handle(AIS_InteractiveContext)& theContext);
+
   //! Save state of three view in a container in form: key, value. It saves:
   //! - visibiblity of columns,
   //! - columns width
index efaf5687949348efe4cb7240494c3abd3612d9fc..5129c89d960761667952089758b145f29ce304ab 100644 (file)
@@ -20,7 +20,7 @@
 #include <inspector/ViewControl_Tools.hxx>
 #include <inspector/TreeModel_Tools.hxx>
 
-//#include <Quantity.hxx>
+#include <Quantity.hxx>
 
 #include <Standard_WarningsDisable.hxx>
 #include <QAbstractTableModel>
@@ -85,7 +85,7 @@ public:
           return QVariant ("Name");
         Quantity_NameOfColor aColorName;
         if (ViewControl_ColorSelector::IsExactColorName(myColor, aColorName))
-          return "";//Quantity::NameOfColorToString (aColorName);
+          return Quantity::NameOfColorToString (aColorName);
       }
       break;
       case 2: return isFirstColumn ? QVariant ("Red") : ViewControl_Tools::ToVariant (myColor.GetRGB().Red());
@@ -93,7 +93,7 @@ public:
       case 4: return isFirstColumn ? QVariant ("Blue") : ViewControl_Tools::ToVariant (myColor.GetRGB().Blue());
       case 5: return isFirstColumn ? QVariant ("Alpha") : ViewControl_Tools::ToVariant (myColor.Alpha());
       case 6: return isFirstColumn ? QVariant ("Near Name") 
-                                   : "";//Quantity::NameOfColorToString (myColor.GetRGB().Name());
+                                   : Quantity::NameOfColorToString (myColor.GetRGB().Name());
     }
     return QVariant();
   }
@@ -236,8 +236,8 @@ public:
       return QVariant();
 
     if (theRole == Qt::ToolTipRole)
-      return "";//QString("%1 (%2)").arg(Quantity::NameOfColorToString (aNameOfColor))
-                //               .arg (ViewControl_ColorSelector::ColorToString (Quantity_Color (aNameOfColor)));
+      return QString("%1 (%2)").arg(Quantity::NameOfColorToString (aNameOfColor))
+                               .arg (ViewControl_ColorSelector::ColorToString (Quantity_Color (aNameOfColor)));
     return QVariant();
   }
 
index 19f866acfca87ee2c32978b3a986121e6ddd4f1d..fee84d2c0618755be44cd3edfcc9bd0b78d54406 100644 (file)
@@ -109,11 +109,13 @@ void ViewControl_Table::Init (ViewControl_TableModelValues* theModelValues)
 void ViewControl_Table::GetSelectedIndices (QMap<int, QList<int>>& theSelectedIndices)
 {
   QModelIndexList aSelected = myTableView->selectionModel()->selectedIndexes();
-  ViewControl_TableModel* aModel = dynamic_cast<ViewControl_TableModel*> (myTableView->model());
 
   int aRow, aColumn;
   for (QModelIndexList::const_iterator anIt = aSelected.begin(); anIt != aSelected.end(); anIt++)
   {
+    QModelIndex anIndex = *anIt;
+    aRow = anIndex.row();
+    aColumn = anIndex.column();
     if (!theSelectedIndices.contains (aRow))
       theSelectedIndices.insert (aRow, QList<int>());
     theSelectedIndices[aRow].append (aColumn);