]> OCCT Git - occt-copy.git/commitdiff
0030268: Inspectors - improvements in VInspector plugin
authornds <nds@opencascade.com>
Wed, 24 Apr 2019 08:15:41 +0000 (11:15 +0300)
committernds <nds@opencascade.com>
Wed, 24 Apr 2019 08:15:41 +0000 (11:15 +0300)
- items for OpenGl Context/Window classes,
- uncomment definition of reporting selection messages.

src/SelectMgr/SelectMgr_SelectableObjectSet.cxx
src/SelectMgr/SelectMgr_ViewerSelector.cxx
src/StdSelect/StdSelect_ViewerSelector3d.cxx
tools/VInspector/FILES
tools/VInspector/VInspector_ItemOpenGlContext.cxx [new file with mode: 0644]
tools/VInspector/VInspector_ItemOpenGlContext.hxx [new file with mode: 0644]
tools/VInspector/VInspector_ItemOpenGlWindow.cxx [new file with mode: 0644]
tools/VInspector/VInspector_ItemOpenGlWindow.hxx [new file with mode: 0644]

index b81e6a067fa957d3a3f5488e03214853ff5bc302..8fc2e178651b213f30ca17f7c13907e5c88069ad 100644 (file)
@@ -19,7 +19,7 @@
 #include <BVH_BinnedBuilder.hxx>
 #include <BVH_LinearBuilder.hxx>
 
-//#define REPORT_SELECTION_BUILD
+#define REPORT_SELECTION_BUILD
 #ifdef REPORT_SELECTION_BUILD
 #include <Message_Alerts.hxx>
 #include <Message_PerfMeter.hxx>
index 3b3d9dad9fb1bc39bf3a44a9b33b8d985f2351cf..8e1644e46d3a55b157160db2d8ae8d3af8b8e74b 100644 (file)
@@ -36,7 +36,7 @@
 
 #include <algorithm>
 
-//#define REPORT_SELECTION_BUILD
+#define REPORT_SELECTION_BUILD
 #ifdef REPORT_SELECTION_BUILD
 #include <Message_Alerts.hxx>
 #include <Message_PerfMeter.hxx>
@@ -280,6 +280,16 @@ void SelectMgr_ViewerSelector::checkOverlap (const Handle(SelectBasics_Sensitive
     return;
   }
 
+  if (!mySelectingVolumeMgr.ViewClipping().IsNull())
+  {
+    Standard_Real aDepth = /*aPickResult.HasPickedPoint() ?*+/ aPickResult.Depth();// :*/ aPickResult.DistToGeomCenter();
+    Standard_Boolean isClipped = mySelectingVolumeMgr.IsClipped (*mySelectingVolumeMgr.ViewClipping(),
+                                                                  aDepth);
+    if (isClipped)
+      return;
+    else
+      int aValue = 9;
+  }
   if (HasDepthClipping (anOwner)
   && !aSelectable.IsNull()
   &&  theMgr.GetActiveSelectionType() == SelectMgr_SelectingVolumeManager::Point)
index 19fc15a01dcdb27d5dca760bd289fa87d052bf54..a22fbf89621618edf0dc1c2ce42614871fdcb970 100644 (file)
@@ -69,7 +69,7 @@
 
 #include <OSD_Timer.hxx>
 
-//#define REPORT_SELECTION_BUILD
+#define REPORT_SELECTION_BUILD
 #ifdef REPORT_SELECTION_BUILD
 #include <Message_Alerts.hxx>
 #include <Message_PerfMeter.hxx>
@@ -175,6 +175,8 @@ void StdSelect_ViewerSelector3d::Pick (const Standard_Integer theXPMin,
   mySelectingVolumeMgr.BuildSelectingVolume (aMinMousePos,
                                              aMaxMousePos);
 
+  mySelectingVolumeMgr.SetViewClipping (theView->ClipPlanes());
+
   TraverseSensitives();
 }
 
@@ -193,6 +195,8 @@ void StdSelect_ViewerSelector3d::Pick (const TColgp_Array1OfPnt2d& thePolyline,
   mySelectingVolumeMgr.SetWindowSize (aWidth, aHeight);
   mySelectingVolumeMgr.BuildSelectingVolume (thePolyline);
 
+  mySelectingVolumeMgr.SetViewClipping (theView->ClipPlanes());
+
   TraverseSensitives();
 }
 
index 744181b067e42ca59f1dc121fd49e9ba7e3e2451..b0e3e015208c723262e902feaa4e1da5817112dc 100644 (file)
@@ -32,12 +32,16 @@ VInspector_ItemHistoryRoot.hxx
 VInspector_ItemHistoryType.cxx
 VInspector_ItemHistoryType.hxx
 VInspector_ItemHistoryTypeInfo.hxx
+VInspector_ItemOpenGlContext.cxx
+VInspector_ItemOpenGlContext.hxx
 VInspector_ItemOpenGlElement.cxx
 VInspector_ItemOpenGlElement.hxx
 VInspector_ItemOpenGlLayer.cxx
 VInspector_ItemOpenGlLayer.hxx
 VInspector_ItemOpenGlLayerList.cxx
 VInspector_ItemOpenGlLayerList.hxx
+VInspector_ItemOpenGlWindow.cxx
+VInspector_ItemOpenGlWindow.hxx
 VInspector_ItemPresentableObject.cxx
 VInspector_ItemPresentableObject.hxx
 VInspector_ItemPresentations.cxx
diff --git a/tools/VInspector/VInspector_ItemOpenGlContext.cxx b/tools/VInspector/VInspector_ItemOpenGlContext.cxx
new file mode 100644 (file)
index 0000000..6a83dd0
--- /dev/null
@@ -0,0 +1,216 @@
+// Created on: 2019-03-15
+// 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_ItemOpenGlContext.hxx>
+
+//#include <inspector/VInspector_ItemOpenGlContextList.hxx>
+#include <inspector/VInspector_Tools.hxx>
+#include <inspector/ViewControl_Tools.hxx>
+
+#include <AIS.hxx>
+#include <AIS_ListOfInteractive.hxx>
+#include <Aspect.hxx>
+#include <Graphic3d.hxx>
+#include <OpenGl_Layer.hxx>
+#include <OpenGl_Group.hxx>
+#include <OpenGl_PrimitiveArray.hxx>
+#include <OpenGl_Text.hxx>
+#include <SelectMgr.hxx>
+#include <SelectMgr_EntityOwner.hxx>
+
+#include <Standard_WarningsDisable.hxx>
+#include <QStringList>
+#include <Standard_WarningsRestore.hxx>
+
+// =======================================================================
+// function : Init
+// purpose :
+// =======================================================================
+void VInspector_ItemOpenGlContext::Init()
+{
+  //VInspector_ItemOpenGlContextListPtr aParentItem = itemDynamicCast<VInspector_ItemOpenGlContextList>(Parent());
+  //myLayer = aParentItem->GetLayer (Row(), myLayerId);
+
+  TreeModel_ItemBase::Init();
+}
+
+// =======================================================================
+// function : Reset
+// purpose :
+// =======================================================================
+void VInspector_ItemOpenGlContext::Reset()
+{
+  VInspector_ItemBase::Reset();
+  myLayer = NULL;
+}
+
+// =======================================================================
+// function : initItem
+// purpose :
+// =======================================================================
+void VInspector_ItemOpenGlContext::initItem() const
+{
+  if (IsInitialized())
+    return;
+  const_cast<VInspector_ItemOpenGlContext*>(this)->Init();
+}
+
+// =======================================================================
+// function : initRowCount
+// purpose :
+// =======================================================================
+int VInspector_ItemOpenGlContext::initRowCount() const
+{
+  if (Column() != 0)
+    return 0;
+
+  return 0;
+}
+
+// =======================================================================
+// function : initValue
+// purpose :
+// =======================================================================
+QVariant VInspector_ItemOpenGlContext::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(OpenGl_Layer) aLayer = GetLayer();
+  if (aLayer.IsNull())
+    return Column() == 0 ? "Empty element" : "";
+
+  switch (Column())
+  {
+    case 0:
+    {
+      TCollection_AsciiString aLayerId = Graphic3d::ZLayerIdToString (myLayerId);
+      if (aLayerId.IsEmpty())
+        aLayerId = TCollection_AsciiString (myLayerId);
+      return theItemRole == Qt::ToolTipRole ? QVariant ("")
+                                            : QVariant (QString("%1 (%2)")
+                                            .arg(aLayer->DynamicType()->Name())
+                                            .arg (aLayerId.ToCString()));
+    }
+    default:
+      break;
+  }
+  return QVariant();
+}
+
+// =======================================================================
+// function : GetTableRowCount
+// purpose :
+// =======================================================================
+int VInspector_ItemOpenGlContext::GetTableRowCount() const
+{
+  return 40;
+}
+
+// =======================================================================
+// function : GetTableData
+// purpose :
+// =======================================================================
+QVariant VInspector_ItemOpenGlContext::GetTableData (const int theRow, const int theColumn, const int theRole) const
+{
+  if (theRole != Qt::DisplayRole)
+    return QVariant();
+
+  Handle(OpenGl_Layer) aLayer = GetLayer();
+  if (aLayer.IsNull())
+    return QVariant();
+
+  bool isFirstColumn = theColumn == 0;
+
+  switch (theRow)
+  {
+    case 0: return isFirstColumn ? QVariant ("NbStructures") : QVariant (aLayer->NbStructures());
+    case 1: return isFirstColumn ? QVariant ("NbStructuresNotCulled") : QVariant (aLayer->NbStructuresNotCulled());
+    case 2: return isFirstColumn ? QVariant ("NbPriorities") : QVariant (aLayer->NbPriorities());
+
+    case 3: return isFirstColumn ? QVariant ("ArrayOfStructures") : QVariant (aLayer->ArrayOfStructures().Size());
+    case 4: return isFirstColumn ? QVariant ("IsCulled") : QVariant (aLayer->IsCulled());
+    case 5: return isFirstColumn ? QVariant ("NbOfTransformPersistenceObjects") : QVariant (aLayer->NbOfTransformPersistenceObjects());
+
+    case 6: return isFirstColumn ? QVariant ("CullableStructuresBVH") : QVariant (aLayer->CullableStructuresBVH().Size());
+    case 7: return isFirstColumn ? QVariant ("CullableTrsfPersStructuresBVH") : QVariant (aLayer->CullableTrsfPersStructuresBVH().Size());
+    case 8: return isFirstColumn ? QVariant ("NonCullableStructures") : QVariant (aLayer->NonCullableStructures().Size());
+
+    default:
+    break;
+  }
+
+  Standard_Integer aRow = theRow - 9;
+  return getLayerSettingsTableData (aRow, theColumn, theRole, aLayer->LayerSettings());
+}
+
+// =======================================================================
+// function : getLayerSettingsTableData
+// purpose :
+// =======================================================================
+QVariant VInspector_ItemOpenGlContext::getLayerSettingsTableData (const int theRow, const int theColumn, const int theRole,
+                                                                const Graphic3d_ZLayerSettings& theSettings) const
+{
+  bool isFirstColumn = theColumn == 0;
+
+  switch (theRow)
+  {
+    case 0: return isFirstColumn ? QVariant ("LayerSettings:") : QVariant();
+    case 1: return isFirstColumn ? QVariant ("Name") : QVariant (theSettings.Name().ToCString());
+    case 2: return isFirstColumn ? QVariant ("Lights") : QVariant (ViewControl_Tools::GetPointerInfo (theSettings.Lights()).ToCString());
+
+    case 3: return isFirstColumn ? QVariant ("Origin") : QVariant (ViewControl_Tools::ToString (theSettings.Origin()).ToCString());
+    case 4: return isFirstColumn ? QVariant ("OriginTransformation")
+      : QVariant (ViewControl_Tools::ToString (theSettings.OriginTransformation()).ToCString());
+
+    case 5: return isFirstColumn ? QVariant ("HasCullingDistance") : QVariant (theSettings.HasCullingDistance());
+    case 6: return isFirstColumn ? QVariant ("CullingDistance")
+      : QVariant (theSettings.HasCullingDistance() ? theSettings.CullingDistance() : 0);
+
+    case 7: return isFirstColumn ? QVariant ("HasCullingSize") : QVariant (theSettings.HasCullingSize());
+    case 8: return isFirstColumn ? QVariant ("CullingSize")
+      : QVariant (theSettings.HasCullingSize() ? theSettings.CullingSize() : 0);
+
+    case 9: return isFirstColumn ? QVariant ("IsImmediate") : QVariant (theSettings.IsImmediate());
+    case 10: return isFirstColumn ? QVariant ("UseEnvironmentTexture") : QVariant (theSettings.UseEnvironmentTexture());
+    case 11: return isFirstColumn ? QVariant ("ToEnableDepthTest") : QVariant (theSettings.ToEnableDepthTest());
+    case 12: return isFirstColumn ? QVariant ("ToEnableDepthWrite") : QVariant (theSettings.ToEnableDepthWrite());
+    case 13: return isFirstColumn ? QVariant ("ToClearDepth") : QVariant (theSettings.ToClearDepth());
+    case 14: return isFirstColumn ? QVariant ("ToRenderInDepthPrepass") : QVariant (theSettings.ToRenderInDepthPrepass());
+
+    case 15: return isFirstColumn ? QVariant ("PolygonOffset: Mode")
+      : QVariant (Aspect::PolygonOffsetModeToString (theSettings.PolygonOffset().Mode));
+    case 16: return isFirstColumn ? QVariant ("PolygonOffset: Factor") : QVariant (theSettings.PolygonOffset().Factor);
+    case 17: return isFirstColumn ? QVariant ("PolygonOffset: Units") : QVariant (theSettings.PolygonOffset().Units);
+
+    default: break;
+  }
+  return QVariant();
+}
+
+// =======================================================================
+// function : createChild
+// purpose :
+// =======================================================================
+TreeModel_ItemBasePtr VInspector_ItemOpenGlContext::createChild (int theRow, int theColumn)
+{
+  (void)theRow;
+  (void)theColumn;
+  return TreeModel_ItemBasePtr();
+}
diff --git a/tools/VInspector/VInspector_ItemOpenGlContext.hxx b/tools/VInspector/VInspector_ItemOpenGlContext.hxx
new file mode 100644 (file)
index 0000000..1f9d2e2
--- /dev/null
@@ -0,0 +1,110 @@
+// Created on: 2019-03-15
+// 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_ItemOpenGlContext_H
+#define VInspector_ItemOpenGlContext_H
+
+#include <Standard.hxx>
+#include <inspector/VInspector_ItemBase.hxx>
+
+#include <Graphic3d_ZLayerSettings.hxx>
+#include <OpenGl_Layer.hxx>
+
+class Graphic3d_Group;
+
+class VInspector_ItemOpenGlContext;
+typedef QExplicitlySharedDataPointer<VInspector_ItemOpenGlContext> VInspector_ItemOpenGlContextPtr;
+
+//! \class VInspector_ItemOpenGlContext
+//! Parent item, that corresponds to AIS_InteractiveContext
+//! Children of the item are:
+//! - "Property" item to show context attributes such as selection filters and drawer properties
+//! - presentation items to show all interactive elements displayed/erased in the context
+class VInspector_ItemOpenGlContext : public VInspector_ItemBase
+{
+public:
+
+  //! Creates an item wrapped by a shared pointer
+  static VInspector_ItemOpenGlContextPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
+  { return VInspector_ItemOpenGlContextPtr (new VInspector_ItemOpenGlContext (theParent, theRow, theColumn)); }
+
+  //! Destructor
+  virtual ~VInspector_ItemOpenGlContext() Standard_OVERRIDE {};
+
+  //! Returns data object of the item.
+  //! \return object
+  virtual Handle(Standard_Transient) GetObject() const { initItem(); return myLayer; }
+
+  //! Returns the current graphic3d group, init item if it was not initialized yet
+  //! \return graphic group
+  Standard_EXPORT Handle(OpenGl_Layer) GetLayer() const
+    { return Handle(OpenGl_Layer)::DownCast (GetObject());}
+
+  //! Inits the item, fills internal containers
+  Standard_EXPORT virtual void Init() Standard_OVERRIDE;
+
+  //! Resets cached values
+  Standard_EXPORT virtual void Reset() 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:
+
+  //! Initialize the current item. It creates a backup of the specific item information
+  //! Do nothing as context has been already set into item
+  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;
+
+protected:
+  //! Returns table presentation of layer settings
+  QVariant getLayerSettingsTableData (const int theRow, const int theColumn, const int theRole,
+                                      const Graphic3d_ZLayerSettings& theSettings) const;
+
+  //! 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_ItemOpenGlContext(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
+    : VInspector_ItemBase(theParent, theRow, theColumn) {}
+
+private:
+  Handle(OpenGl_Layer) myLayer; //! current layer
+  Graphic3d_ZLayerId myLayerId; //! current Z layer index in OpenGl_View
+};
+
+#endif
diff --git a/tools/VInspector/VInspector_ItemOpenGlWindow.cxx b/tools/VInspector/VInspector_ItemOpenGlWindow.cxx
new file mode 100644 (file)
index 0000000..a8d9063
--- /dev/null
@@ -0,0 +1,216 @@
+// Created on: 2019-03-15
+// 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_ItemOpenGlWindow.hxx>
+
+//#include <inspector/VInspector_ItemOpenGlWindowList.hxx>
+#include <inspector/VInspector_Tools.hxx>
+#include <inspector/ViewControl_Tools.hxx>
+
+#include <AIS.hxx>
+#include <AIS_ListOfInteractive.hxx>
+#include <Aspect.hxx>
+#include <Graphic3d.hxx>
+#include <OpenGl_Layer.hxx>
+#include <OpenGl_Group.hxx>
+#include <OpenGl_PrimitiveArray.hxx>
+#include <OpenGl_Text.hxx>
+#include <SelectMgr.hxx>
+#include <SelectMgr_EntityOwner.hxx>
+
+#include <Standard_WarningsDisable.hxx>
+#include <QStringList>
+#include <Standard_WarningsRestore.hxx>
+
+// =======================================================================
+// function : Init
+// purpose :
+// =======================================================================
+void VInspector_ItemOpenGlWindow::Init()
+{
+  //VInspector_ItemOpenGlWindowListPtr aParentItem = itemDynamicCast<VInspector_ItemOpenGlWindowList>(Parent());
+  //myLayer = aParentItem->GetLayer (Row(), myLayerId);
+
+  TreeModel_ItemBase::Init();
+}
+
+// =======================================================================
+// function : Reset
+// purpose :
+// =======================================================================
+void VInspector_ItemOpenGlWindow::Reset()
+{
+  VInspector_ItemBase::Reset();
+  myLayer = NULL;
+}
+
+// =======================================================================
+// function : initItem
+// purpose :
+// =======================================================================
+void VInspector_ItemOpenGlWindow::initItem() const
+{
+  if (IsInitialized())
+    return;
+  const_cast<VInspector_ItemOpenGlWindow*>(this)->Init();
+}
+
+// =======================================================================
+// function : initRowCount
+// purpose :
+// =======================================================================
+int VInspector_ItemOpenGlWindow::initRowCount() const
+{
+  if (Column() != 0)
+    return 0;
+
+  return 0;
+}
+
+// =======================================================================
+// function : initValue
+// purpose :
+// =======================================================================
+QVariant VInspector_ItemOpenGlWindow::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(OpenGl_Layer) aLayer = GetLayer();
+  if (aLayer.IsNull())
+    return Column() == 0 ? "Empty element" : "";
+
+  switch (Column())
+  {
+    case 0:
+    {
+      TCollection_AsciiString aLayerId = Graphic3d::ZLayerIdToString (myLayerId);
+      if (aLayerId.IsEmpty())
+        aLayerId = TCollection_AsciiString (myLayerId);
+      return theItemRole == Qt::ToolTipRole ? QVariant ("")
+                                            : QVariant (QString("%1 (%2)")
+                                            .arg(aLayer->DynamicType()->Name())
+                                            .arg (aLayerId.ToCString()));
+    }
+    default:
+      break;
+  }
+  return QVariant();
+}
+
+// =======================================================================
+// function : GetTableRowCount
+// purpose :
+// =======================================================================
+int VInspector_ItemOpenGlWindow::GetTableRowCount() const
+{
+  return 40;
+}
+
+// =======================================================================
+// function : GetTableData
+// purpose :
+// =======================================================================
+QVariant VInspector_ItemOpenGlWindow::GetTableData (const int theRow, const int theColumn, const int theRole) const
+{
+  if (theRole != Qt::DisplayRole)
+    return QVariant();
+
+  Handle(OpenGl_Layer) aLayer = GetLayer();
+  if (aLayer.IsNull())
+    return QVariant();
+
+  bool isFirstColumn = theColumn == 0;
+
+  switch (theRow)
+  {
+    case 0: return isFirstColumn ? QVariant ("NbStructures") : QVariant (aLayer->NbStructures());
+    case 1: return isFirstColumn ? QVariant ("NbStructuresNotCulled") : QVariant (aLayer->NbStructuresNotCulled());
+    case 2: return isFirstColumn ? QVariant ("NbPriorities") : QVariant (aLayer->NbPriorities());
+
+    case 3: return isFirstColumn ? QVariant ("ArrayOfStructures") : QVariant (aLayer->ArrayOfStructures().Size());
+    case 4: return isFirstColumn ? QVariant ("IsCulled") : QVariant (aLayer->IsCulled());
+    case 5: return isFirstColumn ? QVariant ("NbOfTransformPersistenceObjects") : QVariant (aLayer->NbOfTransformPersistenceObjects());
+
+    case 6: return isFirstColumn ? QVariant ("CullableStructuresBVH") : QVariant (aLayer->CullableStructuresBVH().Size());
+    case 7: return isFirstColumn ? QVariant ("CullableTrsfPersStructuresBVH") : QVariant (aLayer->CullableTrsfPersStructuresBVH().Size());
+    case 8: return isFirstColumn ? QVariant ("NonCullableStructures") : QVariant (aLayer->NonCullableStructures().Size());
+
+    default:
+    break;
+  }
+
+  Standard_Integer aRow = theRow - 9;
+  return getLayerSettingsTableData (aRow, theColumn, theRole, aLayer->LayerSettings());
+}
+
+// =======================================================================
+// function : getLayerSettingsTableData
+// purpose :
+// =======================================================================
+QVariant VInspector_ItemOpenGlWindow::getLayerSettingsTableData (const int theRow, const int theColumn, const int theRole,
+                                                                const Graphic3d_ZLayerSettings& theSettings) const
+{
+  bool isFirstColumn = theColumn == 0;
+
+  switch (theRow)
+  {
+    case 0: return isFirstColumn ? QVariant ("LayerSettings:") : QVariant();
+    case 1: return isFirstColumn ? QVariant ("Name") : QVariant (theSettings.Name().ToCString());
+    case 2: return isFirstColumn ? QVariant ("Lights") : QVariant (ViewControl_Tools::GetPointerInfo (theSettings.Lights()).ToCString());
+
+    case 3: return isFirstColumn ? QVariant ("Origin") : QVariant (ViewControl_Tools::ToString (theSettings.Origin()).ToCString());
+    case 4: return isFirstColumn ? QVariant ("OriginTransformation")
+      : QVariant (ViewControl_Tools::ToString (theSettings.OriginTransformation()).ToCString());
+
+    case 5: return isFirstColumn ? QVariant ("HasCullingDistance") : QVariant (theSettings.HasCullingDistance());
+    case 6: return isFirstColumn ? QVariant ("CullingDistance")
+      : QVariant (theSettings.HasCullingDistance() ? theSettings.CullingDistance() : 0);
+
+    case 7: return isFirstColumn ? QVariant ("HasCullingSize") : QVariant (theSettings.HasCullingSize());
+    case 8: return isFirstColumn ? QVariant ("CullingSize")
+      : QVariant (theSettings.HasCullingSize() ? theSettings.CullingSize() : 0);
+
+    case 9: return isFirstColumn ? QVariant ("IsImmediate") : QVariant (theSettings.IsImmediate());
+    case 10: return isFirstColumn ? QVariant ("UseEnvironmentTexture") : QVariant (theSettings.UseEnvironmentTexture());
+    case 11: return isFirstColumn ? QVariant ("ToEnableDepthTest") : QVariant (theSettings.ToEnableDepthTest());
+    case 12: return isFirstColumn ? QVariant ("ToEnableDepthWrite") : QVariant (theSettings.ToEnableDepthWrite());
+    case 13: return isFirstColumn ? QVariant ("ToClearDepth") : QVariant (theSettings.ToClearDepth());
+    case 14: return isFirstColumn ? QVariant ("ToRenderInDepthPrepass") : QVariant (theSettings.ToRenderInDepthPrepass());
+
+    case 15: return isFirstColumn ? QVariant ("PolygonOffset: Mode")
+      : QVariant (Aspect::PolygonOffsetModeToString (theSettings.PolygonOffset().Mode));
+    case 16: return isFirstColumn ? QVariant ("PolygonOffset: Factor") : QVariant (theSettings.PolygonOffset().Factor);
+    case 17: return isFirstColumn ? QVariant ("PolygonOffset: Units") : QVariant (theSettings.PolygonOffset().Units);
+
+    default: break;
+  }
+  return QVariant();
+}
+
+// =======================================================================
+// function : createChild
+// purpose :
+// =======================================================================
+TreeModel_ItemBasePtr VInspector_ItemOpenGlWindow::createChild (int theRow, int theColumn)
+{
+  (void)theRow;
+  (void)theColumn;
+  return TreeModel_ItemBasePtr();
+}
diff --git a/tools/VInspector/VInspector_ItemOpenGlWindow.hxx b/tools/VInspector/VInspector_ItemOpenGlWindow.hxx
new file mode 100644 (file)
index 0000000..bcc6f46
--- /dev/null
@@ -0,0 +1,110 @@
+// Created on: 2019-03-15
+// 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_ItemOpenGlWindow_H
+#define VInspector_ItemOpenGlWindow_H
+
+#include <Standard.hxx>
+#include <inspector/VInspector_ItemBase.hxx>
+
+#include <Graphic3d_ZLayerSettings.hxx>
+#include <OpenGl_Layer.hxx>
+
+class Graphic3d_Group;
+
+class VInspector_ItemOpenGlWindow;
+typedef QExplicitlySharedDataPointer<VInspector_ItemOpenGlWindow> VInspector_ItemOpenGlWindowPtr;
+
+//! \class VInspector_ItemOpenGlWindow
+//! Parent item, that corresponds to AIS_InteractiveContext
+//! Children of the item are:
+//! - "Property" item to show context attributes such as selection filters and drawer properties
+//! - presentation items to show all interactive elements displayed/erased in the context
+class VInspector_ItemOpenGlWindow : public VInspector_ItemBase
+{
+public:
+
+  //! Creates an item wrapped by a shared pointer
+  static VInspector_ItemOpenGlWindowPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
+  { return VInspector_ItemOpenGlWindowPtr (new VInspector_ItemOpenGlWindow (theParent, theRow, theColumn)); }
+
+  //! Destructor
+  virtual ~VInspector_ItemOpenGlWindow() Standard_OVERRIDE {};
+
+  //! Returns data object of the item.
+  //! \return object
+  virtual Handle(Standard_Transient) GetObject() const { initItem(); return myLayer; }
+
+  //! Returns the current graphic3d group, init item if it was not initialized yet
+  //! \return graphic group
+  Standard_EXPORT Handle(OpenGl_Layer) GetLayer() const
+    { return Handle(OpenGl_Layer)::DownCast (GetObject());}
+
+  //! Inits the item, fills internal containers
+  Standard_EXPORT virtual void Init() Standard_OVERRIDE;
+
+  //! Resets cached values
+  Standard_EXPORT virtual void Reset() 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:
+
+  //! Initialize the current item. It creates a backup of the specific item information
+  //! Do nothing as context has been already set into item
+  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;
+
+protected:
+  //! Returns table presentation of layer settings
+  QVariant getLayerSettingsTableData (const int theRow, const int theColumn, const int theRole,
+                                      const Graphic3d_ZLayerSettings& theSettings) const;
+
+  //! 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_ItemOpenGlWindow(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
+    : VInspector_ItemBase(theParent, theRow, theColumn) {}
+
+private:
+  Handle(OpenGl_Layer) myLayer; //! current layer
+  Graphic3d_ZLayerId myLayerId; //! current Z layer index in OpenGl_View
+};
+
+#endif