]> OCCT Git - occt-copy.git/commitdiff
0029451: Information Message Alert to debug an algorithm or object functionality...
authornds <nds@opencascade.com>
Tue, 2 Apr 2019 03:22:28 +0000 (06:22 +0300)
committernds <nds@opencascade.com>
Tue, 2 Apr 2019 03:22:28 +0000 (06:22 +0300)
50 files changed:
src/Graphic3d/Graphic3d.cxx
src/Message/Message_Alerts.hxx
src/Message/Message_Report.cxx
src/OpenGl/FILES
src/OpenGl/OpenGl.cxx [new file with mode: 0644]
src/OpenGl/OpenGl.hxx [new file with mode: 0644]
src/OpenGl/OpenGl_GraduatedTrihedron.hxx
src/OpenGl/OpenGl_LayerList.hxx
src/OpenGl/OpenGl_MatrixState.hxx
src/OpenGl/OpenGl_StencilTest.hxx
src/OpenGl/OpenGl_Text.hxx
src/OpenGl/OpenGl_Vec.hxx
tools/DFBrowser/DFBrowser_Window.cxx
tools/MessageModel/FILES
tools/MessageModel/MessageModel_ActionType.hxx
tools/MessageModel/MessageModel_Actions.cxx
tools/MessageModel/MessageModel_Actions.hxx
tools/MessageModel/MessageModel_ItemAlert.cxx
tools/MessageModel/MessageModel_ItemAlert.hxx
tools/MessageModel/MessageModel_ItemReport.cxx
tools/MessageModel/MessageModel_ItemReport.hxx
tools/MessageModel/MessageModel_ItemReportProperties.cxx [new file with mode: 0644]
tools/MessageModel/MessageModel_ItemReportProperties.hxx [new file with mode: 0644]
tools/MessageModel/MessageModel_ReportCallBack.hxx
tools/MessageModel/MessageModel_Tools.cxx
tools/MessageModel/MessageModel_Tools.hxx
tools/MessageView/MessageView_Window.cxx
tools/MessageView/MessageView_Window.hxx
tools/TInspectorEXE/TInspectorEXE.cxx
tools/ToolsDraw/ToolsDraw.cxx
tools/ToolsDraw/ToolsDraw.hxx
tools/TreeModel/TreeModel_ItemProperties.cxx
tools/TreeModel/TreeModel_ItemProperties.hxx
tools/VInspector/FILES
tools/VInspector/VInspector_ItemGraphic3dCStructure.cxx
tools/VInspector/VInspector_ItemGraphic3dCView.cxx
tools/VInspector/VInspector_ItemGraphic3dCView.hxx
tools/VInspector/VInspector_ItemOpenGlLayer.cxx [new file with mode: 0644]
tools/VInspector/VInspector_ItemOpenGlLayer.hxx [new file with mode: 0644]
tools/VInspector/VInspector_ItemOpenGlLayerArray.cxx [new file with mode: 0644]
tools/VInspector/VInspector_ItemOpenGlLayerArray.hxx [new file with mode: 0644]
tools/VInspector/VInspector_ItemOpenGlLayerList.cxx [new file with mode: 0644]
tools/VInspector/VInspector_ItemOpenGlLayerList.hxx [new file with mode: 0644]
tools/VInspector/VInspector_ItemOpenGlLayerStructure.cxx [new file with mode: 0644]
tools/VInspector/VInspector_ItemOpenGlLayerStructure.hxx [new file with mode: 0644]
tools/VInspector/VInspector_ItemPresentableObject.cxx
tools/ViewControl/ViewControl_TableModelValues.cxx
tools/ViewControl/ViewControl_TableModelValues.hxx
tools/ViewControl/ViewControl_Tools.cxx
tools/ViewControl/ViewControl_Tools.hxx

index 10bfca243d9970a39bd6ecc0a53f0c1c51fabc75..19e05b2e8f94002e8d20b65eae8742fb2747fada 100644 (file)
@@ -130,6 +130,13 @@ Standard_Boolean Graphic3d::ZLayerIdFromString (Standard_CString theTypeString,
       return Standard_True;
     }
   }
+
+  if (aName.IsIntegerValue())
+  {
+    theType = aName.IntegerValue();
+    return Standard_True;
+  }
+
   return Standard_False;
 }
 
index 9af669503170dfd9a99c6160d9054e50303de66f..267cc8c8e17f0b92b6965567e876a58c6094c7c3 100644 (file)
@@ -60,6 +60,11 @@ static Handle(Message_Alert) OCCT_Message_Alert;
     OS << Value << Message::DumpSeparator(); \
   }
 
+#define DUMP_VALUES_COLUMNS(OS, ObjectName, ColumnCount) \
+  { \
+    OS << ObjectName << Message::DumpSeparator() << ColumnCount << Message::DumpSeparator(); \
+  }
+
 #define DUMP_VALUES(OS, Value1, Value2) \
   { \
     OS << Value1 << Message::DumpSeparator() << Value2 << Message::DumpSeparator(); \
index 38f3c3c8754c0e6a4e7570fd93692180ad79eea6..c56de714e0733da8c123cc5792a2d21f4bd7e3df 100644 (file)
@@ -132,7 +132,7 @@ void Message_Report::AddAlert (const Message_Gravity theGravity, const Handle(Me
   // if not merged, just add to the list
   aList.Append (theAlert);
   // remove alerts under the report only
-  if (theParentAlert.IsNull() && aParentAlert.IsNull() && myLimit > 0 && aList.Extent() >= myLimit)
+  if (theParentAlert.IsNull() && aParentAlert.IsNull() && myLimit > 0 && aList.Extent() > myLimit)
     aList.RemoveFirst();
 
   if (thePerfMeter)
@@ -207,8 +207,8 @@ Handle(Message_Alert) Message_Report::getLastAlert (const Message_Gravity theGra
   anExtendedAlert = Handle(Message_AlertExtended)::DownCast (aLastAlert);
   if (anExtendedAlert.IsNull())
     return aLastAlert;
-  if (anExtendedAlert->GetPerfMeter())
-    aLastAlert = anExtendedAlert->GetPerfMeter()->GetAlert();
+  //if (anExtendedAlert->GetPerfMeter())
+  //  aLastAlert = anExtendedAlert->GetPerfMeter()->GetAlert();
 
   return aLastAlert;
 }
index 52c91655849999e3f72df3bcae7051396476fed2..c74e15c90b4a58b80b84ba1171a7074f55b0fa6c 100755 (executable)
@@ -1,4 +1,6 @@
 glext.h
+OpenGl.cxx
+OpenGl.hxx
 OpenGl_ArbDbg.hxx
 OpenGl_ArbFBO.hxx
 OpenGl_ArbIns.hxx
diff --git a/src/OpenGl/OpenGl.cxx b/src/OpenGl/OpenGl.cxx
new file mode 100644 (file)
index 0000000..a162a93
--- /dev/null
@@ -0,0 +1,56 @@
+// Created on: 2019-03-16
+// 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 <OpenGl.hxx>
+
+#include <TCollection_AsciiString.hxx>
+
+namespace
+{
+  static Standard_CString OpenGl_Table_PrintLayerFilter[4] =
+  {
+    "ALL", "UPPER", "BOTTOM", "DEFAULT"
+  };
+}
+
+//=======================================================================
+//function : LayerFilterToString
+//purpose  :
+//=======================================================================
+Standard_CString OpenGl::LayerFilterToString (const OpenGl_LayerFilter theType)
+{
+  return OpenGl_Table_PrintLayerFilter[theType];
+}
+
+//=======================================================================
+//function : LayerFilterFromString
+//purpose  :
+//=======================================================================
+Standard_Boolean OpenGl::LayerFilterFromString (const Standard_CString theTypeString,
+                                                OpenGl_LayerFilter& theType)
+{
+  TCollection_AsciiString aName (theTypeString);
+  aName.UpperCase();
+  for (Standard_Integer aTypeIter = 0; aTypeIter <= OpenGl_LF_Default; ++aTypeIter)
+  {
+    Standard_CString aTypeName = OpenGl_Table_PrintLayerFilter[aTypeIter];
+    if (aName == aTypeName)
+    {
+      theType = OpenGl_LayerFilter (aTypeIter);
+      return Standard_True;
+    }
+  }
+  return Standard_False;
+}
diff --git a/src/OpenGl/OpenGl.hxx b/src/OpenGl/OpenGl.hxx
new file mode 100644 (file)
index 0000000..159c982
--- /dev/null
@@ -0,0 +1,57 @@
+// Created on: 2019-03-16
+// 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 _OpenGl_H__
+#define _OpenGl_H__
+
+#include <OpenGl_LayerFilter.hxx>
+
+#include <Standard_DefineAlloc.hxx>
+#include <Standard_Macro.hxx>
+#include <Standard_Type.hxx>
+
+//! Provides methods to cast enumerations of package to string value
+class OpenGl
+{
+
+public:
+
+  DEFINE_STANDARD_ALLOC
+  
+  //! Returns the string name for a given type.
+  //! @param theType an enumeration type
+  //! @return string identifier from the enumeration list
+  Standard_EXPORT static Standard_CString LayerFilterToString (const OpenGl_LayerFilter theType);
+
+  //! Returns the orientation type from the given string identifier (using case-insensitive comparison).
+  //! @param theTypeString string identifier
+  //! @return enumeration type or OpenGl_LF_All if string identifier is invalid
+  static OpenGl_LayerFilter LayerFilterFromString (const Standard_CString theTypeString)
+  {
+    OpenGl_LayerFilter aType = OpenGl_LF_All;
+    LayerFilterFromString (theTypeString, aType);
+    return aType;
+  }
+
+  //! Determines the type from the given string identifier (using case-insensitive comparison).
+  //! @param theTypeString string identifier
+  //! @param theType detected type
+  //! @return TRUE if string identifier is known
+  Standard_EXPORT static Standard_Boolean LayerFilterFromString (const Standard_CString theTypeString,
+                                                                 OpenGl_LayerFilter& theType);
+
+};
+
+#endif // _OpenGl_H__
index cf33b3f76d78b420de91fa77cdf2091332a3d412..e70c1d85d62e028c41f485a3fe5c1f04477095a3 100755 (executable)
@@ -51,7 +51,7 @@ public:
   virtual void Render  (const Handle(OpenGl_Workspace)& theWorkspace) const;
 
   //! Release OpenGL resources.
-  virtual void Release (OpenGl_Context* theCtx);
+  virtual void Release (OpenGl_Context* theCtx) Standard_OVERRIDE;
 
   //! Setup configuration.
   void SetValues (const Graphic3d_GraduatedTrihedron& theData);
index 370160773436198e58733600e59d9970b4c1cc91..2589e6136ae708407ab9bd75193c2d76c5bf2710 100644 (file)
@@ -35,10 +35,10 @@ class OpenGl_LayerList
 public:
 
   //! Constructor
-  OpenGl_LayerList (const Standard_Integer theNbPriorities);
+  Standard_EXPORT OpenGl_LayerList (const Standard_Integer theNbPriorities);
 
   //! Destructor
-  virtual ~OpenGl_LayerList();
+  virtual ~OpenGl_LayerList() {}
 
   //! Method returns the number of available priorities
   Standard_Integer NbPriorities() const { return myNbPriorities; }
@@ -79,10 +79,10 @@ public:
                        const Standard_Integer   theNewPriority);
 
   //! Returns reference to the layer with given ID.
-  OpenGl_Layer& Layer (const Graphic3d_ZLayerId theLayerId);
+  Standard_EXPORT  OpenGl_Layer& Layer (const Graphic3d_ZLayerId theLayerId);
 
   //! Returns reference to the layer with given ID.
-  const OpenGl_Layer& Layer (const Graphic3d_ZLayerId theLayerId) const;
+  Standard_EXPORT const OpenGl_Layer& Layer (const Graphic3d_ZLayerId theLayerId) const;
 
   //! Assign new settings to the layer.
   void SetLayerSettings (const Graphic3d_ZLayerId        theLayerId,
index 00f16d0d09f45e7746fb7c880f38d337902697ef..7a0ecd3718839f9562b923e72499d97b1ce1638b 100644 (file)
@@ -54,26 +54,26 @@ public:
   }
 
   //! @return current matrix.
-  const typename OpenGl::MatrixType<T>::Mat4& Current()
+  const typename OpenGl_Vec::MatrixType<T>::Mat4& Current()
   {
     return myCurrent;
   }
 
   //! Sets given matrix as current.
-  void SetCurrent (const typename OpenGl::MatrixType<T>::Mat4& theNewCurrent)
+  void SetCurrent (const typename OpenGl_Vec::MatrixType<T>::Mat4& theNewCurrent)
   {
     myCurrent = theNewCurrent;
   }
 
   //! Change current matrix.
-  typename OpenGl::MatrixType<T>::Mat4& ChangeCurrent()
+  typename OpenGl_Vec::MatrixType<T>::Mat4& ChangeCurrent()
   {
     return myCurrent;
   }
 
   //! Sets given matrix as current.
   template <typename Other_t>
-  void SetCurrent (const typename OpenGl::MatrixType<Other_t>::Mat4& theNewCurrent)
+  void SetCurrent (const typename OpenGl_Vec::MatrixType<Other_t>::Mat4& theNewCurrent)
   {
     myCurrent.Convert (theNewCurrent);
   }
@@ -81,14 +81,14 @@ public:
   //! Sets current matrix to identity.
   void SetIdentity()
   {
-    myCurrent = typename OpenGl::MatrixType<T>::Mat4();
+    myCurrent = typename OpenGl_Vec::MatrixType<T>::Mat4();
   }
 
 private:
 
-  NCollection_Vector<typename OpenGl::MatrixType<T>::Mat4> myStack;     //!< Collection used to maintenance matrix stack
-  typename OpenGl::MatrixType<T>::Mat4                     myCurrent;   //!< Current matrix
-  Standard_Integer                                         myStackHead; //!< Index of stack head
+  NCollection_Vector<typename OpenGl_Vec::MatrixType<T>::Mat4> myStack;     //!< Collection used to maintenance matrix stack
+  typename OpenGl_Vec::MatrixType<T>::Mat4                     myCurrent;   //!< Current matrix
+  Standard_Integer                                             myStackHead; //!< Index of stack head
 };
 
 #endif // _OpenGl_MatrixState_H__
index 5771d1086eba02553025a992bd077f3249bd1373..e1bd1f18495d32ef9137acc5c0d51b3e504c32ba 100755 (executable)
@@ -29,7 +29,7 @@ public:
   //! Render primitives to the window
   virtual void Render  (const Handle(OpenGl_Workspace)& theWorkspace) const;
 
-  virtual void Release (OpenGl_Context* theContext);
+  virtual void Release (OpenGl_Context* theContext) Standard_OVERRIDE;
 
   void SetOptions (const Standard_Boolean theIsEnabled);
 
index 4da269760a390882857cdb0f8e5b5691ec767c6d..b8e0cd362a073fbfd57b8d255e4124f2fd53ed4e 100755 (executable)
@@ -76,7 +76,7 @@ public:
                                     const Standard_Integer        theFontSize);
 
   Standard_EXPORT virtual void Render  (const Handle(OpenGl_Workspace)& theWorkspace) const;
-  Standard_EXPORT virtual void Release (OpenGl_Context* theContext);
+  Standard_EXPORT virtual void Release (OpenGl_Context* theContext) Standard_OVERRIDE;
 
   //! Return defined text.
   const NCollection_String& Text() const { return myString; }
index cb4cf962c44164c05e9e2a5573c973a5bccb472c..8e50a2da88311e909d23c027bfe8a354ca13bf47 100755 (executable)
@@ -45,7 +45,7 @@ typedef Graphic3d_Vec4d  OpenGl_Vec4d;
 typedef Graphic3d_Mat4   OpenGl_Mat4;
 typedef Graphic3d_Mat4d  OpenGl_Mat4d;
 
-namespace OpenGl
+namespace OpenGl_Vec
 {
   //! Tool class for selecting appropriate vector type.
   //! \tparam T Numeric data type
index a34cd16f432414e18c0d7458d6ac738591f2feb7..cad3f7c1d4c607b72551b4c2c7bc4ecff8729da6 100644 (file)
@@ -420,6 +420,11 @@ void DFBrowser_Window::Init (const NCollection_List<Handle(Standard_Transient)>&
     }
     return;
   }
+  else
+  {
+    if (anApplication.IsNull() && CDF_Session::Exists())
+      anApplication = Handle(TDocStd_Application)::DownCast (CDF_Session::CurrentSession()->CurrentApplication());
+  }
 
   myModule = new DFBrowser_Module();
   myModule->CreateViewModel (myMainWindow);
index bb44a4de71e39ed8ae1ebd48751850b7ef94cf5b..fb8efa0e506da348afefc96ed4b0f51555765ab7 100644 (file)
@@ -8,6 +8,8 @@ MessageModel_ItemBase.cxx
 MessageModel_ItemBase.hxx
 MessageModel_ItemReport.cxx
 MessageModel_ItemReport.hxx
+MessageModel_ItemReportProperties.cxx
+MessageModel_ItemReportProperties.hxx
 MessageModel_ItemRoot.cxx
 MessageModel_ItemRoot.hxx
 MessageModel_ReportCallBack.cxx
index d5092aa08ef8089c6eddaccd86257e0a2b0b07de..de036fefd4c69ccb2b9e5a3d7499b0a595a12d7a 100644 (file)
@@ -21,7 +21,9 @@ enum MessageModel_ActionType
 {
   MessageModel_ActionType_Activate, //!< set Message_Report active
   MessageModel_ActionType_Deactivate, //!< set Message_Report not active
-  MessageModel_ActionType_ExportToShapeView //!< export TopoDS_Shape of selected item into TKShapeView plugin
+  MessageModel_ActionType_Clear, //!< clear Message_Report alerts
+  MessageModel_ActionType_ExportToShapeView, //!< export TopoDS_Shape of selected item into TKShapeView plugin
+  MessageModel_ActionType_Test //!< test alerts
 };
 
 #endif
index 1f6f26509cebe26656d12fb743cc1745e3725fe9..4a587b55910e4acbb74627bf1145dacc05e5c39a 100644 (file)
 #include <QWidget>
 #include <Standard_WarningsRestore.hxx>
 
+#define DEBUG_ALERTS
+
+#ifdef DEBUG_ALERTS
+#include <Message_Alerts.hxx>
+#include <Message_PerfMeter.hxx>
+#endif
+
 // =======================================================================
 // function : Constructor
 // purpose :
@@ -50,8 +57,14 @@ MessageModel_Actions::MessageModel_Actions (QWidget* theParent,
                     ViewControl_Tools::CreateAction ("Deactivate", SLOT (OnDeactivateReport()), parent(), this));
   myActions.insert (MessageModel_ActionType_Activate,
                     ViewControl_Tools::CreateAction ("Activate", SLOT (OnActivateReport()), parent(), this));
+  myActions.insert (MessageModel_ActionType_Clear,
+                    ViewControl_Tools::CreateAction ("Clear", SLOT (OnClearReport()), parent(), this));
   myActions.insert (MessageModel_ActionType_ExportToShapeView,
                     ViewControl_Tools::CreateAction (tr ("Export to ShapeView"), SLOT (OnExportToShapeView()), parent(), this));
+#ifdef DEBUG_ALERTS
+  myActions.insert (MessageModel_ActionType_Test,
+                    ViewControl_Tools::CreateAction ("Test", SLOT (OnTestAlerts()), parent(), this));
+#endif
 }
 
 // =======================================================================
@@ -102,6 +115,10 @@ void MessageModel_Actions::AddMenuActions (const QModelIndexList& theSelectedInd
   {
     theMenu->addAction (myActions[MessageModel_ActionType_Deactivate]);
     theMenu->addAction (myActions[MessageModel_ActionType_Activate]);
+    theMenu->addAction (myActions[MessageModel_ActionType_Clear]);
+#ifdef DEBUG_ALERTS
+    theMenu->addAction (myActions[MessageModel_ActionType_Test]);
+#endif
   }
   else if (anAlertItem)
     theMenu->addAction (myActions[MessageModel_ActionType_ExportToShapeView]);
@@ -168,6 +185,21 @@ void MessageModel_Actions::OnActivateReport()
   ((MessageModel_TreeModel*)mySelectionModel->model())->EmitDataChanged (aReportIndex, aReportIndex);
 }
 
+// =======================================================================
+// function : OnClearReport
+// purpose :
+// =======================================================================
+void MessageModel_Actions::OnClearReport()
+{
+  QModelIndex aReportIndex;
+  Handle(Message_Report) aReport = getSelectedReport (aReportIndex);
+  if (aReport.IsNull())
+    return;
+
+  aReport->Clear();
+  ((MessageModel_TreeModel*)mySelectionModel->model())->EmitDataChanged (aReportIndex, aReportIndex);
+}
+
 // =======================================================================
 // function : OnExportToShapeView
 // purpose :
@@ -230,3 +262,50 @@ void MessageModel_Actions::OnExportToShapeView()
   QMessageBox::information (0, "Information", QString ("TShapes '%1' are sent to %2 tool.")
     .arg (anExportedPointers.join (", ")).arg (QString (aPluginName.ToCString())));
 }
+
+// =======================================================================
+// function : OnTestAlerts
+// purpose :
+// =======================================================================
+#include <OSD_Chronometer.hxx>
+#include <ctime>
+void MessageModel_Actions::OnTestAlerts()
+{
+#ifdef DEBUG_ALERTS
+  QModelIndex aReportIndex;
+  Handle(Message_Report) aReport = getSelectedReport (aReportIndex);
+  if (aReport.IsNull())
+    return;
+
+  Message_PerfMeter aPerfMeter;
+  MESSAGE_INFO ("MessageModel_Actions::OnTestAlerts()", "", &aPerfMeter, NULL);
+  unsigned int start_time =  clock();
+  //Standard_Real aSystemSeconds, aCurrentSeconds;
+  //OSD_Chronometer::GetThreadCPU (aCurrentSeconds, aSystemSeconds);
+
+  Standard_Integer aCounter = 50000;
+  Standard_Real aValue = 0., aValue2 = 0.1;
+  for (int j = 0; j < aCounter; j++)
+  {
+    for (int i = 0; i < aCounter; i++)
+    {
+      aValue = (aValue * 2. + 3.) * 0.5 - 0.3 * 0.5;
+
+      Standard_Real aValue3 = aValue + aValue2 * 0.2;
+      //MESSAGE_INFO ("Calculate", aValue, &aPerfMeter, NULL);
+    }
+  }
+
+  ((MessageModel_TreeModel*)mySelectionModel->model())->EmitLayoutChanged();
+
+  //Standard_Real aSystemSeconds1, aCurrentSeconds1;
+  //OSD_Chronometer::GetThreadCPU (aCurrentSeconds1, aSystemSeconds1);
+
+  //std::cout << aValue << std::endl;
+  //std::cout << "user time = " << aCurrentSeconds1 - aCurrentSeconds
+  //          << ",  system time = " << aSystemSeconds1 - aSystemSeconds << std::endl;
+
+  unsigned int end_time = clock();
+  std::cout << "clock() = " << end_time - start_time << std::endl;
+#endif
+}
index 2de60eca78ab881ef95a1eb987b6c526d9d3c371..71da2a093560b810661ade00ca209ba16569e041 100644 (file)
@@ -76,9 +76,15 @@ public slots:
   //! Set selected report active
   void OnActivateReport();
 
+  //! Clears container of alerts of selected report
+  void OnClearReport();
+
   //! Exports the first selected shape into ShapeViewer plugin.
   void OnExportToShapeView();
 
+  //! Sending several alerts to check message-alert-tool mechanizm
+  void OnTestAlerts();
+
 protected:
   //! Returns report of selected tree view item if a report item is selected
   //! \param theReportIndex tree model index of the found report
index c884a45e5374d59b48a7a8cd9b4483ff406085c7..c05a71b800c95ae2f8d5056c791c428c58005c60 100644 (file)
@@ -60,9 +60,6 @@ QVariant MessageModel_ItemAlert::initValue (const int theRole) const
   }
 
   Handle(Message_Alert) anAlert = getAlert();
-  if (anAlert.IsNull())
-    return QVariant();
-
   // if the alert is composite, process the real alert
   if (theRole == Qt::DecorationRole && Column() == 0)
   {
@@ -145,17 +142,26 @@ int MessageModel_ItemAlert::initRowCount() const
   if (aCompositeAlert.IsNull())
     return GetUnitedAlerts().Size();
 
-  int aRowCount = 0;
-  NCollection_Vector<Message_ListOfAlert> aUnitedAlerts;
+  MessageModel_ItemAlert* aCurrentItem = (MessageModel_ItemAlert*)this;
   for (int aGravityId = Message_Trace; aGravityId <= Message_Fail; aGravityId++)
   {
     const Message_ListOfAlert& anAlerts  = aCompositeAlert->GetAlerts ((Message_Gravity)aGravityId);
     if (isUniteAlerts())
-      GetUnitedAlerts (anAlerts, aUnitedAlerts);
+    {
+      MessageModel_Tools::GetUnitedAlerts (anAlerts, aCurrentItem->myChildAlerts);
+    }
     else
-      aRowCount += anAlerts.Size();
+    {
+      for (Message_ListOfAlert::Iterator anIt(anAlerts); anIt.More(); anIt.Next())
+      {
+        Message_ListOfAlert aCurAlerts;
+        aCurAlerts.Append (anIt.Value());
+        aCurrentItem->myChildAlerts.Bind(myChildAlerts.Size(), aCurAlerts);
+      }
+    }
   }
-  return isUniteAlerts() ? aUnitedAlerts.Size() : aRowCount;
+
+  return aCurrentItem->myChildAlerts.Size();
 }
 
 // =======================================================================
@@ -175,90 +181,34 @@ void MessageModel_ItemAlert::Init()
 {
   MessageModel_ItemReportPtr aReportItem = itemDynamicCast<MessageModel_ItemReport> (Parent());
   MessageModel_ItemAlertPtr anAlertItem;
-  Handle(Message_Report) aReport;
   Handle(Message_Alert) anAlert;
   if (aReportItem)
-    aReport = aReportItem->GetReport();
-  else
-  {
-    anAlertItem = itemDynamicCast<MessageModel_ItemAlert> (Parent());
-    if (anAlertItem)
-      anAlert = anAlertItem->GetAlert();
-  }
-  if (aReport.IsNull() && anAlert.IsNull() && !anAlertItem)
-    return;
-
-  if (anAlert.IsNull() && anAlertItem) // union folder item
   {
-    int aCurrentSubId = 0;
-    for (Message_ListOfAlert::Iterator anAlertsIt (anAlertItem->GetUnitedAlerts()); anAlertsIt.More();
-         anAlertsIt.Next(), aCurrentSubId++)
+    Message_ListOfAlert anAlerts;
+    if (aReportItem->GetChildAlerts (Row(), anAlerts))
     {
-      if (aCurrentSubId != Row())
-        continue;
-      myAlert = anAlertsIt.Value();
-      MessageModel_ItemBase::Init();
-      return;
+      if (anAlerts.Size() == 1)
+        myAlert = anAlerts.First();
+      else
+        myUnitedAlerts = anAlerts;
     }
-    return;
   }
-
-  // iterates through all gravity types, skip types where report is empty, if report is not empty, increment
-  // current index until it equal to the current row index
-  Message_ListOfAlert anAlerts;
-  NCollection_Vector<Message_ListOfAlert> aUnitedAlerts;
-  int aRowId = Row();
-  int aPreviousAlertsCount = 0;
-  for (int aGravityId = Message_Trace; aGravityId <= Message_Fail; aGravityId++)
+  else
   {
-    if (!aReport.IsNull())
-      anAlerts = aReport->GetAlerts ((Message_Gravity)aGravityId);
-    else if (!anAlert.IsNull())
-    {
-      Handle(Message_AlertExtended) anExtendedAlert = Handle(Message_AlertExtended)::DownCast(anAlert);
-      Handle(Message_CompositeAlerts) aCompositeAlert = !anExtendedAlert.IsNull() ? anExtendedAlert->GetCompositeAlerts()
-        : Handle(Message_CompositeAlerts)();
-      if (!aCompositeAlert.IsNull())
-        anAlerts = aCompositeAlert->GetAlerts ((Message_Gravity)aGravityId);
-    }
-
-    if (isReversed())
-      anAlerts.Reverse();
-
-    if (isUniteAlerts())
+    anAlertItem = itemDynamicCast<MessageModel_ItemAlert> (Parent());
+    if (anAlertItem)
     {
-      GetUnitedAlerts (anAlerts, aUnitedAlerts);
-      if (aRowId < aUnitedAlerts.Size())
+      Message_ListOfAlert anAlerts;
+      if (anAlertItem->GetChildAlerts (Row(), anAlerts))
       {
-        anAlerts = aUnitedAlerts.Value (aRowId);
-
         if (anAlerts.Size() == 1)
           myAlert = anAlerts.First();
         else
           myUnitedAlerts = anAlerts;
-
-        MessageModel_ItemBase::Init();
-        return;
-      }
-    }
-    else
-    {
-      if (aRowId < aPreviousAlertsCount + anAlerts.Size())
-      {
-        aRowId = aRowId - aPreviousAlertsCount;
-        int aCurrentId = 0;
-        for (Message_ListOfAlert::Iterator anAlertsIt (anAlerts); anAlertsIt.More(); anAlertsIt.Next(), aCurrentId++)
-        {
-          if (aCurrentId != Row())
-            continue;
-          myAlert = anAlertsIt.Value();
-          MessageModel_ItemBase::Init();
-          return;
-        }
       }
-      aPreviousAlertsCount += anAlerts.Size();
     }
   }
+  MessageModel_ItemBase::Init();
 }
 
 // =======================================================================
@@ -270,6 +220,7 @@ void MessageModel_ItemAlert::Reset()
   MessageModel_ItemBase::Reset();
   myAlert = Handle(Message_Alert)();
   myUnitedAlerts.Clear();
+  myChildAlerts.Clear();
 }
 
 // =======================================================================
@@ -319,29 +270,3 @@ double MessageModel_ItemAlert::AmountElapsedTime(const Handle(Message_Alert)& th
 
   return anAmountTime;
 }
-
-// =======================================================================
-// function : GetUnitedAlerts
-// purpose :
-// =======================================================================
-void MessageModel_ItemAlert::GetUnitedAlerts(const Message_ListOfAlert& theAlerts,
-                       NCollection_Vector<Message_ListOfAlert>& theUnitedAlerts)
-{
-  //theUnitedAlerts.Clear();
-  TCollection_AsciiString anAlertMessageKey;
-  for (Message_ListOfAlert::Iterator anAlertsIt (theAlerts); anAlertsIt.More(); anAlertsIt.Next())
-  {
-    Handle(Message_Alert) anAlert = anAlertsIt.Value();
-    if (anAlertMessageKey.IsEqual (anAlert->GetMessageKey())) {
-      Message_ListOfAlert anAlerts = theUnitedAlerts.Last();
-      anAlerts.Append (anAlert);
-      theUnitedAlerts.SetValue(theUnitedAlerts.Size()-1, anAlerts);
-    }
-    else {
-      Message_ListOfAlert anAlerts;
-      anAlerts.Append (anAlert);
-      theUnitedAlerts.Append (anAlerts);
-      anAlertMessageKey = anAlert->GetMessageKey();
-    }
-  }
-}
index 3f338c1d0c1c60db79a073d6c25ee6511d5eb597..f32df889d781ee4da510e259b8a99d26692b479e 100644 (file)
@@ -20,6 +20,7 @@
 #include <Message_Alert.hxx>
 #include <Message_ListOfAlert.hxx>
 #include <Message_Report.hxx>
+#include <NCollection_DataMap.hxx>
 #include <Standard.hxx>
 #include <TopoDS_Shape.hxx>
 
@@ -55,6 +56,9 @@ public:
   //! Returns the current shape
   const Handle(Message_Alert)& GetAlert() const { return myAlert; }
 
+  //! Returns alert of the report for the parameter row
+  Standard_Boolean GetChildAlerts (const int theRow, Message_ListOfAlert& theAlerts) const { return myChildAlerts.Find(theRow, theAlerts); }
+
   //! Returns united alerts or empty list
   const Message_ListOfAlert& GetUnitedAlerts() const { return myUnitedAlerts; }
 
@@ -85,12 +89,6 @@ public:
   //! \return double value
   Standard_EXPORT static double AmountElapsedTime (const Handle(Message_Alert)& theAlert);
 
-  //! Returns alerts united by Message Key
-  //! \param theAlerts source message alert
-  //! \param theUnitedAlerts arranged source message alerts
-  Standard_EXPORT static void GetUnitedAlerts (const Message_ListOfAlert& theAlerts,
-                                               NCollection_Vector<Message_ListOfAlert> & theUnitedAlerts);
-
 protected:
 
   //! Initialize the current item. It is empty because Reset() is also empty.
@@ -124,6 +122,9 @@ private:
 private:
   Handle(Message_Alert) myAlert;
   Message_ListOfAlert myUnitedAlerts;
+
+  NCollection_DataMap<Standard_Integer, Message_ListOfAlert> myChildAlerts; //!< container of child alerts
+
   TopoDS_Shape myCustomShape;
 };
 
index 2ba14ae1c7621bfdf7a4c5adf5178a909e32eb93..bc4c4877e44a8701cad3b416dc79e0862ac9bf80 100644 (file)
 
 #include <inspector/MessageModel_ItemReport.hxx>
 
-#include <inspector/MessageModel_ItemRoot.hxx>
 #include <inspector/MessageModel_ItemAlert.hxx>
+#include <inspector/MessageModel_ItemReportProperties.hxx>
+#include <inspector/MessageModel_ItemRoot.hxx>
+#include <inspector/MessageModel_Tools.hxx>
 
 #include <OSD_Path.hxx>
 
@@ -86,20 +88,25 @@ int MessageModel_ItemReport::initRowCount() const
   if (aReport.IsNull())
     return 0;
 
-  int aRowCount = 0;
-  NCollection_Vector<Message_ListOfAlert> aUnitedAlerts;
+  MessageModel_ItemReport* aCurrentItem = (MessageModel_ItemReport*)this;
   for (int aGravityId = Message_Trace; aGravityId <= Message_Fail; aGravityId++)
   {
     const Message_ListOfAlert& anAlerts = aReport->GetAlerts ((Message_Gravity)aGravityId);
     if (isUniteAlerts())
     {
-      MessageModel_ItemAlert::GetUnitedAlerts (anAlerts, aUnitedAlerts);
-      aRowCount += aUnitedAlerts.Size();
+      MessageModel_Tools::GetUnitedAlerts (anAlerts, aCurrentItem->myChildAlerts);
     }
     else
-      aRowCount += anAlerts.Size();
+    {
+      for (Message_ListOfAlert::Iterator anIt(anAlerts); anIt.More(); anIt.Next())
+      {
+        Message_ListOfAlert aCurAlerts;
+        aCurAlerts.Append (anIt.Value());
+        aCurrentItem->myChildAlerts.Bind(myChildAlerts.Size(), aCurAlerts);
+      }
+    }
   }
-  return isUniteAlerts() ? aUnitedAlerts.Size() : aRowCount;
+  return aCurrentItem->myChildAlerts.Size();
 }
 
 // =======================================================================
@@ -119,6 +126,11 @@ void MessageModel_ItemReport::Init()
 {
   MessageModel_ItemRootPtr aRootItem = itemDynamicCast<MessageModel_ItemRoot> (Parent());
   myReport = aRootItem ? aRootItem->GetReport (Row(), myDescription) : Handle(Message_Report)();
+
+  TreeModel_ItemBasePtr anItem = Parent()->Child (Row(), Column(), false);
+  SetProperties (new MessageModel_ItemReportProperties(anItem));
+
+  MessageModel_ItemBase::Init();
 }
 
 // =======================================================================
@@ -139,6 +151,7 @@ void MessageModel_ItemReport::Reset()
 {
   MessageModel_ItemBase::Reset();
   myReport = Handle(Message_Report)();
+  myChildAlerts.Clear();
 }
 
 // =======================================================================
index 1c7c081fa72e23deadde002d75a0f152a60fefb3..c6ce246fc2eb2c47b4ddc7870d56cb630c4f888d 100644 (file)
@@ -19,7 +19,9 @@
 #include <inspector/MessageModel_ItemBase.hxx>
 #include <Standard.hxx>
 #include <TCollection_AsciiString.hxx>
+#include <Message_Alert.hxx>
 #include <Message_Report.hxx>
+#include <NCollection_DataMap.hxx>
 
 #include <Standard_WarningsDisable.hxx>
 #include <QMap>
@@ -49,6 +51,10 @@ public:
   //! Returns the current shape
   const Handle(Message_Report)& GetReport() const { return myReport; }
 
+  //! Returns alert of the report for the parameter row
+  Standard_Boolean GetChildAlerts (const int theRow, Message_ListOfAlert& theAlerts) const { return myChildAlerts.Find(theRow, theAlerts); }
+
+  //! Returns the report description or NULL
   const TCollection_AsciiString& GetDescription() const { return myDescription; }
 
   //! Inits the item, fills internal containers
@@ -101,6 +107,8 @@ private:
 
 private:
 
+  NCollection_DataMap<Standard_Integer, Message_ListOfAlert> myChildAlerts; //!< container of child alerts
+
   Handle(Message_Report) myReport; //!< current report
   TCollection_AsciiString myDescription; //!< description
 };
diff --git a/tools/MessageModel/MessageModel_ItemReportProperties.cxx b/tools/MessageModel/MessageModel_ItemReportProperties.cxx
new file mode 100644 (file)
index 0000000..f1337a4
--- /dev/null
@@ -0,0 +1,102 @@
+// Created on: 2019-02-25
+// 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/MessageModel_ItemReportProperties.hxx>
+#include <inspector/MessageModel_ItemReport.hxx>
+#include <inspector/ShapeView_ItemShape.hxx>
+#include <inspector/ShapeView_Tools.hxx>
+
+#include <inspector/ViewControl_Tools.hxx>
+#include <BRep_Tool.hxx>
+#include <TopoDS.hxx>
+
+#include <Standard_WarningsDisable.hxx>
+#include <QApplication>
+#include <QFont>
+#include <Standard_WarningsRestore.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(MessageModel_ItemReportProperties, TreeModel_ItemProperties)
+
+// =======================================================================
+// function : RowCount
+// purpose :
+// =======================================================================
+
+int MessageModel_ItemReportProperties::GetTableRowCount() const
+{
+  return 1;
+}
+
+// =======================================================================
+// function : Data
+// purpose :
+// =======================================================================
+
+QVariant MessageModel_ItemReportProperties::GetTableData (const int theRow, const int theColumn, int theRole) const
+{
+  if (theRole != Qt::DisplayRole)
+    return QVariant();
+
+  Handle(Message_Report) aReport = getItemReport();
+  switch (theRow)
+  {
+    case 0:  return theColumn == 0 ? QVariant ("Limit") : QVariant (aReport->GetLimit());
+    default: break;
+  }
+
+  return QVariant();
+}
+
+// =======================================================================
+// function : GetTableEditType
+// purpose :
+// =======================================================================
+ViewControl_EditType MessageModel_ItemReportProperties::GetTableEditType (const int theRow, const int theColumn) const
+{
+  switch (theRow)
+  {
+    case 0: return ViewControl_EditType_Spin;
+    default: return ViewControl_EditType_None;
+  }
+}
+
+// =======================================================================
+// function : SetTableData
+// purpose :
+// =======================================================================
+bool MessageModel_ItemReportProperties::SetTableData (const int theRow, const int theColumn, const QVariant& theValue)
+{
+  Handle(Message_Report) aReport = getItemReport();
+  switch (theRow)
+  {
+    case 0:  aReport->SetLimit (theValue.toInt()); break;
+    default: break;
+  }
+  return true;
+}
+
+// =======================================================================
+// function : getItemReport
+// purpose :
+// =======================================================================
+
+Handle(Message_Report) MessageModel_ItemReportProperties::getItemReport() const
+{
+  MessageModel_ItemReportPtr aReportItem = itemDynamicCast<MessageModel_ItemReport>(myItem);
+  if (!aReportItem)
+    return NULL;
+
+  return aReportItem->GetReport();
+}
diff --git a/tools/MessageModel/MessageModel_ItemReportProperties.hxx b/tools/MessageModel/MessageModel_ItemReportProperties.hxx
new file mode 100644 (file)
index 0000000..65e1592
--- /dev/null
@@ -0,0 +1,87 @@
+// Created on: 2019-02-25
+// 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 MessageModel_ItemReportProperties_H
+#define MessageModel_ItemReportProperties_H
+
+#include <Standard.hxx>
+#include <Message_Report.hxx>
+
+#include <inspector/TreeModel_ItemProperties.hxx>
+#include <inspector/TreeModel_ItemBase.hxx>
+
+#include <Standard_WarningsDisable.hxx>
+#include <QAbstractTableModel>
+#include <QColor>
+#include <QList>
+#include <QModelIndexList>
+#include <QVariant>
+#include <Standard_WarningsRestore.hxx>
+
+class QItemDelegate;
+
+DEFINE_STANDARD_HANDLE (MessageModel_ItemReportProperties, TreeModel_ItemProperties)
+
+//! \class MessageModel_ItemReportProperties
+//! \brief This is an interace for ViewControl_TableModel to give real values of the model
+//! It should be filled or redefined.
+class MessageModel_ItemReportProperties : public TreeModel_ItemProperties
+{
+public:
+
+  //! Constructor
+  Standard_EXPORT MessageModel_ItemReportProperties (TreeModel_ItemBasePtr theItem)
+    : TreeModel_ItemProperties(), myItem (theItem) {}
+
+  //! Destructor
+  virtual ~MessageModel_ItemReportProperties() {}
+
+  //! 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 GetTableRowCount() 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 GetTableData (const int theRow, const int theColumn, const int theRole = Qt::DisplayRole) 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 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 int theRow, const int theColumn, const QVariant& theValue) Standard_OVERRIDE;
+
+  DEFINE_STANDARD_RTTIEXT (MessageModel_ItemReportProperties, TreeModel_ItemProperties)
+
+protected:
+  //! Returns report
+  Handle(Message_Report) getItemReport() const;
+
+protected:
+
+  TreeModel_ItemBasePtr myItem; //!< source item base
+};
+
+#endif
index d59fea8ba23328d48d442c1aa3ebb2196363ffa8..be5d7c98f3e779730fb7dbf72f8c8bd42407230e 100644 (file)
@@ -36,7 +36,7 @@ public:
 
   // Interface to be implemented in the child to process the message report event
   // \theAlert updated alert
-  virtual void Update(const Handle(Message_Alert)& theAlert) { (void)theAlert; myCommunicator->UpdateContent(); }
+  virtual void Update(const Handle(Message_Alert)& theAlert) { (void)theAlert; /*myCommunicator->UpdateContent();*/ }
 
   // OCCT RTTI
   DEFINE_STANDARD_RTTIEXT(MessageModel_ReportCallBack, Message_ReportCallBack)
index 67ac9b5edf7f9db9033534ce769c5fe2b4127dfd..0adacedd377ffb2b92be61825dd36b7724d2bcfa 100644 (file)
@@ -14,6 +14,7 @@
 // commercial license or contractual agreement. 
 
 #include <inspector/MessageModel_Tools.hxx>
+#include <inspector/MessageModel_ItemAlert.hxx>
 #include <inspector/MessageModel_TableModelValues.hxx>
 
 #include <inspector/ViewControl_Table.hxx>
@@ -137,10 +138,24 @@ TCollection_AsciiString MessageModel_Tools::GetStandardTypeAlertInfo (const Hand
 // function : GetPropertyTableValues
 // purpose :
 // =======================================================================
-void MessageModel_Tools::GetPropertyTableValues (const Handle(Message_Alert)& theAlert,
+void MessageModel_Tools::GetPropertyTableValues (const TreeModel_ItemBasePtr& theItem,
                                                  QList<ViewControl_TableModelValues*>& theTableValues)
 {
-  Handle(Message_AlertExtended) anExtendedAlert = Handle(Message_AlertExtended)::DownCast(theAlert);
+  Handle(TreeModel_ItemProperties) anItemProperties = theItem->GetProperties();
+  if (!anItemProperties.IsNull())
+  {
+    ViewControl_TableModelValues* aTableValues = new ViewControl_TableModelValues();
+    aTableValues->SetProperties (anItemProperties);
+    theTableValues.append (aTableValues);
+    return;
+  }
+
+  MessageModel_ItemAlertPtr anAlertItem = itemDynamicCast<MessageModel_ItemAlert>(theItem);
+  if (!anAlertItem)
+    return;
+
+  const Handle(Message_Alert)& anAlert = anAlertItem->GetAlert();
+  Handle(Message_AlertExtended) anExtendedAlert = Handle(Message_AlertExtended)::DownCast(anAlert);
   if (anExtendedAlert.IsNull())
     return;
 
@@ -179,3 +194,33 @@ void MessageModel_Tools::GetPropertyTableValues (const Handle(Message_Alert)& th
     }
   }
 }
+
+// =======================================================================
+// function : GetUnitedAlerts
+// purpose :
+// =======================================================================
+void MessageModel_Tools::GetUnitedAlerts(const Message_ListOfAlert& theAlerts,
+  NCollection_DataMap<Standard_Integer, Message_ListOfAlert>& theUnitedAlerts)
+{
+  //theUnitedAlerts.Clear();
+  TCollection_AsciiString anAlertMessageKey;
+  Standard_Integer aRowIndex = 0;
+  Standard_Integer aCurIndex = 0;
+  for (Message_ListOfAlert::Iterator anAlertsIt (theAlerts); anAlertsIt.More(); anAlertsIt.Next())
+  {
+    aCurIndex++;
+    Handle(Message_Alert) anAlert = anAlertsIt.Value();
+    if (anAlertMessageKey.IsEqual (anAlert->GetMessageKey())) {
+      Message_ListOfAlert anAlerts = theUnitedAlerts.Find(aRowIndex-1); // already in the map
+      anAlerts.Append (anAlert);
+      theUnitedAlerts.Bind(aRowIndex-1, anAlerts);
+    }
+    else {
+      Message_ListOfAlert anAlerts;
+      anAlerts.Append (anAlert);
+      theUnitedAlerts.Bind(aRowIndex, anAlerts);
+      aRowIndex++;
+      anAlertMessageKey = anAlert->GetMessageKey();
+    }
+  }
+}
index 2b63be0061edd7cea084dbfd5d45717a2e9b6272..22ca579856b7a572d26e65a22e9cf9c1d924d2c3 100644 (file)
 #include <Standard.hxx>
 
 #include <TCollection_AsciiString.hxx>
+#include <Message_ListOfAlert.hxx>
+#include <NCollection_DataMap.hxx>
+#include <NCollection_Vector.hxx>
 #include <Standard_Transient.hxx>
 #include <TopoDS_Shape.hxx>
 
+#include <inspector/TreeModel_ItemBase.hxx>
+
 #include <Standard_WarningsDisable.hxx>
 #include <QList>
 #include <Standard_WarningsRestore.hxx>
@@ -62,8 +67,14 @@ public:
   //! Fills container of table values
   //! \param theAlert a message alert
   //! \param theTableValue container of values
-  Standard_EXPORT static void GetPropertyTableValues (const Handle(Message_Alert)& theAlert,
+  Standard_EXPORT static void GetPropertyTableValues (const TreeModel_ItemBasePtr& theItem,
                                                       QList<ViewControl_TableModelValues*>& theTableValues);
+
+  //! Returns alerts united by Message Key
+  //! \param theAlerts source message alert
+  //! \param theUnitedAlerts arranged source message alerts
+  Standard_EXPORT static void GetUnitedAlerts(const Message_ListOfAlert& theAlerts,
+    NCollection_DataMap<Standard_Integer, Message_ListOfAlert>& theUnitedAlerts);
 };
 
 #endif
index 6f78e0ff91bc23c952f3263ebdd078dd6ec4bd1a..c0c0aebf39afc4350ced56094bd35ba139832e60 100644 (file)
@@ -417,7 +417,16 @@ void MessageView_Window::onTreeViewContextMenuRequested (const QPoint& thePositi
       break;
   }
   if (aRootItem)
+  {
     aMenu->addAction (ViewControl_Tools::CreateAction (tr ("Import Report"), SLOT (onImportReport()), myMainWindow, this));
+    // unite
+    MessageModel_TreeModel* aTreeModel = dynamic_cast<MessageModel_TreeModel*> (myTreeView->model());
+    aMenu->addAction (ViewControl_Tools::CreateAction (aTreeModel->IsUniteAlerts() ? tr ("SetUniteAlerts - OFF") : tr ("SetUniteAlerts - ON"),
+                      SLOT (onUniteAlerts()), myMainWindow, this));
+    // reversed
+    //aMenu->addAction (ViewControl_Tools::CreateAction (aTreeModel->IsReversed() ? tr ("SetReversed - OFF") : tr ("SetReversed - ON"),
+    //                  SLOT (onSetReversedAlerts()), myMainWindow, this));
+  }
   else if (aReportItem)
   {
     aMenu->addAction (ViewControl_Tools::CreateAction (tr ("Export Report"), SLOT (onExportReport()), myMainWindow, this));
@@ -563,6 +572,31 @@ void MessageView_Window::onImportReport()
   openFile (TCollection_AsciiString (aFileName.toStdString().c_str()));
 }
 
+// =======================================================================
+// function : onImportReport
+// purpose :
+// =======================================================================
+void MessageView_Window::onUniteAlerts()
+{
+  MessageModel_TreeModel* aTreeModel = dynamic_cast<MessageModel_TreeModel*> (myTreeView->model());
+  Standard_Boolean isUniteAlerts = aTreeModel->IsUniteAlerts();
+
+  aTreeModel->SetUniteAlerts (!isUniteAlerts);
+}
+
+// =======================================================================
+// function : onSetReversedAlerts
+// purpose :
+// =======================================================================
+void MessageView_Window::onSetReversedAlerts()
+{
+  MessageModel_TreeModel* aTreeModel = dynamic_cast<MessageModel_TreeModel*> (myTreeView->model());
+  Standard_Boolean isReversed = aTreeModel->IsReversed();
+
+  aTreeModel->SetReversed (!isReversed);
+}
+
+
 // =======================================================================
 // function : onReloadReport
 // purpose :
@@ -608,12 +642,8 @@ void MessageView_Window::updatePropertyPanelBySelection()
   if (!anItemBase)
     return;
 
-  MessageModel_ItemAlertPtr anAlertItem = itemDynamicCast<MessageModel_ItemAlert>(anItemBase);
-  if (!anAlertItem)
-    return;
-
   QList<ViewControl_TableModelValues*> aTableValues;
-  MessageModel_Tools::GetPropertyTableValues (anAlertItem->GetAlert(), aTableValues);
+  MessageModel_Tools::GetPropertyTableValues (anItemBase, aTableValues);
 
   myPropertyView->Init (aTableValues);
 }
index 470ba790546849d79f39c45c34426f864233b319..31d5b4ce7b208e417d01680c03cfa19fa5e7f6c0 100644 (file)
@@ -145,6 +145,12 @@ protected slots:
   //! Import report into document
   void onImportReport();
 
+  //! Unite alerts in view model
+  void onUniteAlerts();
+
+  //! Sets report reversed 
+  void onSetReversedAlerts();
+
   //! Reads if possible report of a selected item and updates this report in tree view
   void onReloadReport();
 
index 36ce63c639891ac40544d8190de4846b77d47567..3d3fd453040f1cec2d233763c25dc6439cd9e2b4 100644 (file)
@@ -18,6 +18,7 @@
 
 #include <inspector/TInspector_Communicator.hxx>
 
+#include <Message_Report.hxx>
 #include <OSD_Environment.hxx>
 
 #include <Standard_WarningsDisable.hxx>
@@ -103,6 +104,9 @@ int main (int argc, char** argv)
 
     if (!strcmp (argv[anArgId], "vinspector"))
       aPlugins.insert ("TKVInspector");
+
+    if (!strcmp (argv[anArgId], "messageview"))
+      aPlugins.insert ("TKMessageView");
   }
   NCollection_List<Handle(Standard_Transient)> aParameters;
 
@@ -122,6 +126,11 @@ int main (int argc, char** argv)
     aPlugins.insert("TKShapeView");
     aPlugins.insert("TKVInspector");
 
+    Handle(Message_Report) aReport = Message_Report::CurrentReport (Standard_True);
+    aReport->SetLimit(30);
+    aReport->SetActive (Standard_False);
+    aPlugins.insert("TKMessageView");
+
     anActivatedPluginName = "TKVInspector";
   }
   else
index ca4b96c779e99a2fc5a72c62979ad821196adc15..8eddf24029aadc34de3ee70009c46205506707fe 100644 (file)
@@ -40,6 +40,15 @@ Standard_EXPORT ViewerTest_DoubleMapOfInteractiveAndName& GetMapOfAIS();
 
 static TInspector_Communicator* MyCommunicator;
 
+// =======================================================================
+// function : GetCommunicator
+// purpose  : defines plugin library name by the command argument
+// =======================================================================
+TInspector_Communicator* ToolsDraw::GetCommunicator()
+{
+  return MyCommunicator;
+}
+
 // =======================================================================
 // function : convertToPluginName
 // purpose  : defines plugin library name by the command argument
index b004ad50dfff3c3b0aa08c895dda28c972bbf780..376361289fcee5689f192447385e19f6d337f467 100644 (file)
@@ -20,6 +20,8 @@
 #include <Draw_Interpretor.hxx>
 #include <Standard.hxx>
 
+class TInspector_Communicator;
+
 //! \class ToolsDraw
 //! \brief Registers DRAW commands to connect to TInspector tools
 class ToolsDraw
@@ -36,6 +38,8 @@ public:
   //! \param theCommands
   Standard_EXPORT static void Commands (Draw_Interpretor& theCommands);
 
+  Standard_EXPORT static TInspector_Communicator* GetCommunicator();
+
 private:
 };
 
index 628ee6748c4eaee8b32543e6f003f63f92286fde..a16e3a2ca5981c23e8504b1c377b7fc025e194e2 100644 (file)
 #include <inspector/TreeModel_ItemProperties.hxx>
 
 IMPLEMENT_STANDARD_RTTIEXT(TreeModel_ItemProperties, Standard_Transient)
+
+// =======================================================================
+// function : GetTableFlags
+// purpose :
+// =======================================================================
+
+Qt::ItemFlags TreeModel_ItemProperties::GetTableFlags (const int, const int theColumn) const
+{
+  Qt::ItemFlags aFlags = Qt::ItemIsEnabled | Qt::ItemIsSelectable;
+
+  if (theColumn == 1)
+    aFlags = aFlags | Qt::ItemIsEditable;
+
+  return aFlags;
+}
index d9a05c5484031f163c35ffad4748b611c98aaabc..9364ac487e6b8a7eaa0326291d75ec20472f6b76 100644 (file)
@@ -53,6 +53,12 @@ public:
   //! \return an integer value
   virtual int GetTableRowCount() const { return 0; }
 
+  //! 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
+  {  (void)theRow; (void)theColumn; (void)theRole; return QVariant(); }
+
   //! 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
@@ -67,11 +73,11 @@ public:
   virtual QList<QVariant> GetTableEnumValues (const int theRow, const int theColumn) const
     { (void)theRow; (void)theColumn; return QList<QVariant>(); }
 
-  //! 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
-  {  (void)theRow; (void)theColumn; (void)theRole; return QVariant(); }
+  //! Returns flags for the item: ItemIsEnabled | Qt::ItemIsSelectable.
+  //! Additional flag for the column 1 is Qt::ItemIsEditable.
+  //! \param theIndex a model index
+  //! \return flags
+  Standard_EXPORT virtual Qt::ItemFlags GetTableFlags (const int theRow, const int theColumn) const;
 
   //! Sets the value into the table cell. Only 1st column value might be modified.
   //! \param theRow a model index row
index bc4ca4a8c3cecbb4ab092e796836d2eab6c160f4..744181b067e42ca59f1dc121fd49e9ba7e3e2451 100644 (file)
@@ -34,6 +34,10 @@ VInspector_ItemHistoryType.hxx
 VInspector_ItemHistoryTypeInfo.hxx
 VInspector_ItemOpenGlElement.cxx
 VInspector_ItemOpenGlElement.hxx
+VInspector_ItemOpenGlLayer.cxx
+VInspector_ItemOpenGlLayer.hxx
+VInspector_ItemOpenGlLayerList.cxx
+VInspector_ItemOpenGlLayerList.hxx
 VInspector_ItemPresentableObject.cxx
 VInspector_ItemPresentableObject.hxx
 VInspector_ItemPresentations.cxx
index a50f2d8ab9c744d6ea9c7240ed91d9ef6dcfdc1b..24ec1c317413bdb05b863d38bcfa7bbe3c162ac3 100644 (file)
@@ -182,8 +182,7 @@ QVariant VInspector_ItemGraphic3dCStructure::GetTableData (const int theRow, con
       : QVariant (ViewControl_Tools::GetPointerInfo (aCStructure->GraphicDriver()).ToCString());
     case 1: return isFirstColumn ? QVariant ("Groups") : QVariant (aCStructure->Groups().Length());
     case 2: return isFirstColumn ? QVariant ("Transformation")
-      : (!aCStructure->Transformation().IsNull() ?
-         QVariant (ViewControl_Tools::ToString (aCStructure->Transformation()->Trsf()).ToCString()) : QVariant());
+      : QVariant (ViewControl_Tools::ToString (aCStructure->Transformation()).ToCString());
     case 3: return isFirstColumn ? QVariant ("TransformPersistence")
                                  : QVariant (ViewControl_Tools::GetPointerInfo (aCStructure->TransformPersistence()).ToCString());
     case 4: return isFirstColumn ? QVariant ("ClipPlanes")
index 5adef08ccc8aa1af920e869f21a58173f9747533..414a0652ea2247b0b2fc7fd657f0876b72796862 100644 (file)
 #include <inspector/VInspector_ItemV3dView.hxx>
 #include <inspector/VInspector_ItemGraphic3dCamera.hxx>
 #include <inspector/VInspector_ItemGraphic3dClipPlane.hxx>
+#include <inspector/VInspector_ItemOpenGlLayerList.hxx>
 #include <inspector/VInspector_Tools.hxx>
 #include <inspector/ViewControl_Tools.hxx>
 
 #include <AIS.hxx>
 #include <Graphic3d_CView.hxx>
+#include <OpenGl_View.hxx>
 
 #include <Standard_WarningsDisable.hxx>
 #include <QStringList>
 #include <Standard_WarningsRestore.hxx>
 
+// =======================================================================
+// function : GetLayerList
+// purpose :
+// =======================================================================
+const OpenGl_LayerList& VInspector_ItemGraphic3dCView::GetLayerList (Standard_Boolean& isDefault) const
+{
+  isDefault = Standard_True;
+
+  Handle(Graphic3d_CView) aCView = GetCView();
+  if (aCView.IsNull())
+    return myDefaultLayer;
+
+  Handle(OpenGl_View) aOpenGlView = Handle(OpenGl_View)::DownCast (aCView);
+  if (aOpenGlView.IsNull())
+    return myDefaultLayer;
+
+  isDefault = Standard_False;
+  return aOpenGlView->LayerList();
+}
+
 // =======================================================================
 // function : GetClipPlane
 // purpose :
@@ -90,7 +112,7 @@ int VInspector_ItemGraphic3dCView::initRowCount() const
   if (Column() != 0)
     return 0;
 
-  int aNbElements = 1; // Camera
+  int aNbElements = 2; // Camera, OpenGl_LayerList
 
   Handle(Graphic3d_CView) aCView = GetCView();
   const Handle(Graphic3d_SequenceOfHClipPlane)& aClipPlanes = aCView->ClipPlanes();
@@ -268,6 +290,8 @@ TreeModel_ItemBasePtr VInspector_ItemGraphic3dCView::createChild (int theRow, in
 {
   if (theRow == 0)
     return VInspector_ItemGraphic3dCamera::CreateItem (currentItem(), theRow, theColumn);
+  else if (theRow == 1)
+    return VInspector_ItemOpenGlLayerList::CreateItem (currentItem(), theRow, theColumn);
   else
     return VInspector_ItemGraphic3dClipPlane::CreateItem (currentItem(), theRow, theColumn);
 }
index 4e56cf2ba5fefe914b9f10120aa6af48a4852bbf..662cdc6ef63ac13aa2fd34c192bead7fec92ffa6 100644 (file)
@@ -19,6 +19,8 @@
 #include <Standard.hxx>
 #include <inspector/VInspector_ItemBase.hxx>
 
+#include <OpenGl_LayerList.hxx>
+
 class Graphic3d_CView;
 
 class VInspector_ItemGraphic3dCView;
@@ -48,6 +50,10 @@ public:
   Standard_EXPORT Handle(Graphic3d_CView) GetCView() const
   { return Handle(Graphic3d_CView)::DownCast (GetObject()); }
 
+  //! Returns layer list if the View is OpenGl_View
+  //! \param isDefault flag is true if the layer is absent and the default value of this class is used
+  Standard_EXPORT const OpenGl_LayerList& GetLayerList (Standard_Boolean& isDefault) const;
+
   //! Returns clip plane of the row if possible
   //! \param theRow child row index
   Standard_EXPORT Handle(Graphic3d_ClipPlane) GetClipPlane(const int theRow);
@@ -115,10 +121,11 @@ private:
   //! \param theRow the item row positition in the parent item
   //! \param theColumn the item column positition in the parent item
   VInspector_ItemGraphic3dCView(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
-    : VInspector_ItemBase(theParent, theRow, theColumn) {}
+    : VInspector_ItemBase(theParent, theRow, theColumn),  myDefaultLayer (1) {}
 
 private:
   Handle(Graphic3d_CView) myCView; //! current graphical CView
+  OpenGl_LayerList myDefaultLayer; //! default layer if the view is not OpenGl
 };
 
 #endif
diff --git a/tools/VInspector/VInspector_ItemOpenGlLayer.cxx b/tools/VInspector/VInspector_ItemOpenGlLayer.cxx
new file mode 100644 (file)
index 0000000..b9697ca
--- /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_ItemOpenGlLayer.hxx>
+
+#include <inspector/VInspector_ItemOpenGlLayerList.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_ItemOpenGlLayer::Init()
+{
+  VInspector_ItemOpenGlLayerListPtr aParentItem = itemDynamicCast<VInspector_ItemOpenGlLayerList>(Parent());
+  myLayer = aParentItem->GetLayer (Row(), myLayerId);
+
+  TreeModel_ItemBase::Init();
+}
+
+// =======================================================================
+// function : Reset
+// purpose :
+// =======================================================================
+void VInspector_ItemOpenGlLayer::Reset()
+{
+  VInspector_ItemBase::Reset();
+  myLayer = NULL;
+}
+
+// =======================================================================
+// function : initItem
+// purpose :
+// =======================================================================
+void VInspector_ItemOpenGlLayer::initItem() const
+{
+  if (IsInitialized())
+    return;
+  const_cast<VInspector_ItemOpenGlLayer*>(this)->Init();
+}
+
+// =======================================================================
+// function : initRowCount
+// purpose :
+// =======================================================================
+int VInspector_ItemOpenGlLayer::initRowCount() const
+{
+  if (Column() != 0)
+    return 0;
+
+  return 0;
+}
+
+// =======================================================================
+// function : initValue
+// purpose :
+// =======================================================================
+QVariant VInspector_ItemOpenGlLayer::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_ItemOpenGlLayer::GetTableRowCount() const
+{
+  return 40;
+}
+
+// =======================================================================
+// function : GetTableData
+// purpose :
+// =======================================================================
+QVariant VInspector_ItemOpenGlLayer::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_ItemOpenGlLayer::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_ItemOpenGlLayer::createChild (int theRow, int theColumn)
+{
+  (void)theRow;
+  (void)theColumn;
+  return TreeModel_ItemBasePtr();
+}
diff --git a/tools/VInspector/VInspector_ItemOpenGlLayer.hxx b/tools/VInspector/VInspector_ItemOpenGlLayer.hxx
new file mode 100644 (file)
index 0000000..b2c9546
--- /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_ItemOpenGlLayer_H
+#define VInspector_ItemOpenGlLayer_H
+
+#include <Standard.hxx>
+#include <inspector/VInspector_ItemBase.hxx>
+
+#include <Graphic3d_ZLayerSettings.hxx>
+#include <OpenGl_Layer.hxx>
+
+class Graphic3d_Group;
+
+class VInspector_ItemOpenGlLayer;
+typedef QExplicitlySharedDataPointer<VInspector_ItemOpenGlLayer> VInspector_ItemOpenGlLayerPtr;
+
+//! \class VInspector_ItemOpenGlLayer
+//! 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_ItemOpenGlLayer : public VInspector_ItemBase
+{
+public:
+
+  //! Creates an item wrapped by a shared pointer
+  static VInspector_ItemOpenGlLayerPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
+  { return VInspector_ItemOpenGlLayerPtr (new VInspector_ItemOpenGlLayer (theParent, theRow, theColumn)); }
+
+  //! Destructor
+  virtual ~VInspector_ItemOpenGlLayer() 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_ItemOpenGlLayer(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_ItemOpenGlLayerArray.cxx b/tools/VInspector/VInspector_ItemOpenGlLayerArray.cxx
new file mode 100644 (file)
index 0000000..9836ba0
--- /dev/null
@@ -0,0 +1,217 @@
+// 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_ItemOpenGlLayer.hxx>
+
+#include <inspector/VInspector_ItemOpenGlLayerList.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_ItemOpenGlLayer::Init()
+{
+  VInspector_ItemOpenGlLayerListPtr aParentItem = itemDynamicCast<VInspector_ItemOpenGlLayerList>(Parent());
+  myLayer = aParentItem->GetLayer (Row(), myLayerId);
+
+  TreeModel_ItemBase::Init();
+}
+
+// =======================================================================
+// function : Reset
+// purpose :
+// =======================================================================
+void VInspector_ItemOpenGlLayer::Reset()
+{
+  VInspector_ItemBase::Reset();
+  myLayer = NULL;
+}
+
+// =======================================================================
+// function : initItem
+// purpose :
+// =======================================================================
+void VInspector_ItemOpenGlLayer::initItem() const
+{
+  if (IsInitialized())
+    return;
+  const_cast<VInspector_ItemOpenGlLayer*>(this)->Init();
+}
+
+// =======================================================================
+// function : initRowCount
+// purpose :
+// =======================================================================
+int VInspector_ItemOpenGlLayer::initRowCount() const
+{
+  if (Column() != 0)
+    return 0;
+
+  return 0;
+}
+
+// =======================================================================
+// function : initValue
+// purpose :
+// =======================================================================
+QVariant VInspector_ItemOpenGlLayer::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_ItemOpenGlLayer::GetTableRowCount() const
+{
+  return 40;
+}
+
+// =======================================================================
+// function : GetTableData
+// purpose :
+// =======================================================================
+QVariant VInspector_ItemOpenGlLayer::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_ItemOpenGlLayer::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_ItemOpenGlLayer::createChild (int theRow, int theColumn)
+{
+  (void)theRow;
+  (void)theColumn;
+
+  return TreeModel_ItemBasePtr();
+}
diff --git a/tools/VInspector/VInspector_ItemOpenGlLayerArray.hxx b/tools/VInspector/VInspector_ItemOpenGlLayerArray.hxx
new file mode 100644 (file)
index 0000000..b2c9546
--- /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_ItemOpenGlLayer_H
+#define VInspector_ItemOpenGlLayer_H
+
+#include <Standard.hxx>
+#include <inspector/VInspector_ItemBase.hxx>
+
+#include <Graphic3d_ZLayerSettings.hxx>
+#include <OpenGl_Layer.hxx>
+
+class Graphic3d_Group;
+
+class VInspector_ItemOpenGlLayer;
+typedef QExplicitlySharedDataPointer<VInspector_ItemOpenGlLayer> VInspector_ItemOpenGlLayerPtr;
+
+//! \class VInspector_ItemOpenGlLayer
+//! 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_ItemOpenGlLayer : public VInspector_ItemBase
+{
+public:
+
+  //! Creates an item wrapped by a shared pointer
+  static VInspector_ItemOpenGlLayerPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
+  { return VInspector_ItemOpenGlLayerPtr (new VInspector_ItemOpenGlLayer (theParent, theRow, theColumn)); }
+
+  //! Destructor
+  virtual ~VInspector_ItemOpenGlLayer() 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_ItemOpenGlLayer(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_ItemOpenGlLayerList.cxx b/tools/VInspector/VInspector_ItemOpenGlLayerList.cxx
new file mode 100644 (file)
index 0000000..3812a28
--- /dev/null
@@ -0,0 +1,197 @@
+// 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_ItemOpenGlLayerList.hxx>
+
+#include <inspector/VInspector_ItemGraphic3dGroup.hxx>
+#include <inspector/VInspector_ItemGraphic3dCView.hxx>
+#include <inspector/VInspector_ItemOpenGlLayer.hxx>
+#include <inspector/VInspector_Tools.hxx>
+#include <inspector/ViewControl_Tools.hxx>
+
+#include <AIS.hxx>
+#include <AIS_ListOfInteractive.hxx>
+#include <OpenGl_Element.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_ItemOpenGlLayerList::Init()
+{
+  TreeModel_ItemBase::Init();
+}
+
+// =======================================================================
+// function : Reset
+// purpose :
+// =======================================================================
+void VInspector_ItemOpenGlLayerList::Reset()
+{
+  VInspector_ItemBase::Reset();
+}
+
+// =======================================================================
+// function : GetLayerList
+// purpose :
+// =======================================================================
+const OpenGl_LayerList& VInspector_ItemOpenGlLayerList::GetLayerList (Standard_Boolean& isDefault) const
+{
+  VInspector_ItemGraphic3dCViewPtr aParentItem = itemDynamicCast<VInspector_ItemGraphic3dCView>(Parent());
+  return aParentItem->GetLayerList (isDefault);
+}
+
+// =======================================================================
+// function : GetLayer
+// purpose :
+// =======================================================================
+Handle(OpenGl_Layer) VInspector_ItemOpenGlLayerList::GetLayer (const int theRow, Graphic3d_ZLayerId& theLayerId) const
+{
+  Standard_Boolean isDefault;
+  const OpenGl_LayerList& aLayerList = GetLayerList (isDefault);
+
+  if (isDefault)
+    return NULL;
+
+  Standard_Integer aLayerIndex = (int)theRow + 1;
+  Handle(OpenGl_Layer) aLayer = aLayerList.Layers().Value (aLayerIndex); // OpenGl_LayerSeqIds range is in [1...N]
+  if (aLayer.IsNull())
+    return NULL;
+
+  const OpenGl_LayerSeqIds& aLayerIDs = aLayerList.LayerIDs();
+  for (OpenGl_LayerSeqIds::Iterator aMapIt (aLayerIDs); aMapIt.More(); aMapIt.Next())
+  {
+    Standard_Integer anIndex = aMapIt.Value();
+    if (anIndex != aLayerIndex)
+      continue;
+
+    theLayerId = aMapIt.Key();
+  }
+
+  return aLayer;
+}
+
+// =======================================================================
+// function : initItem
+// purpose :
+// =======================================================================
+void VInspector_ItemOpenGlLayerList::initItem() const
+{
+  if (IsInitialized())
+    return;
+  const_cast<VInspector_ItemOpenGlLayerList*>(this)->Init();
+}
+
+// =======================================================================
+// function : initRowCount
+// purpose :
+// =======================================================================
+int VInspector_ItemOpenGlLayerList::initRowCount() const
+{
+  if (Column() != 0)
+    return 0;
+
+  Standard_Boolean isDefault;
+  const OpenGl_LayerList& aListOfLayers = GetLayerList (isDefault);
+  if (isDefault)
+    return 0;
+
+  return aListOfLayers.Layers().Length();
+}
+
+// =======================================================================
+// function : initValue
+// purpose :
+// =======================================================================
+QVariant VInspector_ItemOpenGlLayerList::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();
+
+
+  switch (Column())
+  {
+    case 0:
+    {
+      Standard_Boolean isDefault;
+      GetLayerList (isDefault);
+      if (isDefault)
+        return 0;
+
+      return isDefault ? "Empty layer list" : "OpenGl_LayerList";
+    }
+    default:
+      break;
+  }
+  return QVariant();
+}
+
+// =======================================================================
+// function : GetTableRowCount
+// purpose :
+// =======================================================================
+int VInspector_ItemOpenGlLayerList::GetTableRowCount() const
+{
+  return 3;
+}
+
+// =======================================================================
+// function : GetTableData
+// purpose :
+// =======================================================================
+QVariant VInspector_ItemOpenGlLayerList::GetTableData (const int theRow, const int theColumn, const int theRole) const
+{
+  if (theRole != Qt::DisplayRole)
+    return QVariant();
+
+  Standard_Boolean isDefault;
+  const OpenGl_LayerList& aListOfLayers = GetLayerList (isDefault);
+  if (isDefault)
+    return QVariant();
+
+  bool isFirstColumn = theColumn == 0;
+  switch (theRow)
+  {
+    case 0: return isFirstColumn ? QVariant ("NbPriorities") : QVariant (aListOfLayers.NbPriorities());
+    case 1: return isFirstColumn ? QVariant ("NbStructures") : QVariant (aListOfLayers.NbStructures());
+    case 2: return isFirstColumn ? QVariant ("NbImmediateStructures") : QVariant (aListOfLayers.NbImmediateStructures());
+
+    default: return QVariant();
+  }
+
+  return QVariant();
+}
+
+// =======================================================================
+// function : createChild
+// purpose :
+// =======================================================================
+TreeModel_ItemBasePtr VInspector_ItemOpenGlLayerList::createChild (int theRow, int theColumn)
+{
+  return VInspector_ItemOpenGlLayer::CreateItem (currentItem(), theRow, theColumn);
+}
diff --git a/tools/VInspector/VInspector_ItemOpenGlLayerList.hxx b/tools/VInspector/VInspector_ItemOpenGlLayerList.hxx
new file mode 100644 (file)
index 0000000..d08f3d8
--- /dev/null
@@ -0,0 +1,102 @@
+// 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_ItemOpenGlLayerList_H
+#define VInspector_ItemOpenGlLayerList_H
+
+#include <Standard.hxx>
+#include <inspector/VInspector_ItemBase.hxx>
+
+#include <OpenGl_LayerList.hxx>
+
+class VInspector_ItemOpenGlLayerList;
+typedef QExplicitlySharedDataPointer<VInspector_ItemOpenGlLayerList> VInspector_ItemOpenGlLayerListPtr;
+
+//! \class VInspector_ItemOpenGlLayerList
+//! Parent item, that corresponds to OpenGl_LayerList
+//! Children of the item are:
+//! - OpenGl_Layer items 
+class VInspector_ItemOpenGlLayerList : public VInspector_ItemBase
+{
+public:
+
+  //! Creates an item wrapped by a shared pointer
+  static VInspector_ItemOpenGlLayerListPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
+  { return VInspector_ItemOpenGlLayerListPtr (new VInspector_ItemOpenGlLayerList (theParent, theRow, theColumn)); }
+
+  //! Destructor
+  virtual ~VInspector_ItemOpenGlLayerList() Standard_OVERRIDE {};
+
+  //! Returns data object of the item.
+  //! \return object
+  virtual Handle(Standard_Transient) GetObject() const { initItem(); return NULL; }
+
+  //! Inits the item, fills internal containers
+  Standard_EXPORT virtual void Init() Standard_OVERRIDE;
+
+  //! Resets cached values
+  Standard_EXPORT virtual void Reset() Standard_OVERRIDE;
+
+  //! Returns layer list if the View is OpenGl_View
+  //! \param isDefault flag is true if the layer is absent and the default value of this class is used
+  Standard_EXPORT const OpenGl_LayerList& GetLayerList (Standard_Boolean& isDefault) const;
+
+  //! Returns layer list if the View is OpenGl_View
+  //! \param theLayerId index of the layer
+  Standard_EXPORT Handle(OpenGl_Layer) GetLayer (const int theRow, Graphic3d_ZLayerId& theLayerId) const;
+
+  //! 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:
+
+  //! 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_ItemOpenGlLayerList(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
+    : VInspector_ItemBase(theParent, theRow, theColumn) {}
+};
+
+#endif
diff --git a/tools/VInspector/VInspector_ItemOpenGlLayerStructure.cxx b/tools/VInspector/VInspector_ItemOpenGlLayerStructure.cxx
new file mode 100644 (file)
index 0000000..9836ba0
--- /dev/null
@@ -0,0 +1,217 @@
+// 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_ItemOpenGlLayer.hxx>
+
+#include <inspector/VInspector_ItemOpenGlLayerList.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_ItemOpenGlLayer::Init()
+{
+  VInspector_ItemOpenGlLayerListPtr aParentItem = itemDynamicCast<VInspector_ItemOpenGlLayerList>(Parent());
+  myLayer = aParentItem->GetLayer (Row(), myLayerId);
+
+  TreeModel_ItemBase::Init();
+}
+
+// =======================================================================
+// function : Reset
+// purpose :
+// =======================================================================
+void VInspector_ItemOpenGlLayer::Reset()
+{
+  VInspector_ItemBase::Reset();
+  myLayer = NULL;
+}
+
+// =======================================================================
+// function : initItem
+// purpose :
+// =======================================================================
+void VInspector_ItemOpenGlLayer::initItem() const
+{
+  if (IsInitialized())
+    return;
+  const_cast<VInspector_ItemOpenGlLayer*>(this)->Init();
+}
+
+// =======================================================================
+// function : initRowCount
+// purpose :
+// =======================================================================
+int VInspector_ItemOpenGlLayer::initRowCount() const
+{
+  if (Column() != 0)
+    return 0;
+
+  return 0;
+}
+
+// =======================================================================
+// function : initValue
+// purpose :
+// =======================================================================
+QVariant VInspector_ItemOpenGlLayer::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_ItemOpenGlLayer::GetTableRowCount() const
+{
+  return 40;
+}
+
+// =======================================================================
+// function : GetTableData
+// purpose :
+// =======================================================================
+QVariant VInspector_ItemOpenGlLayer::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_ItemOpenGlLayer::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_ItemOpenGlLayer::createChild (int theRow, int theColumn)
+{
+  (void)theRow;
+  (void)theColumn;
+
+  return TreeModel_ItemBasePtr();
+}
diff --git a/tools/VInspector/VInspector_ItemOpenGlLayerStructure.hxx b/tools/VInspector/VInspector_ItemOpenGlLayerStructure.hxx
new file mode 100644 (file)
index 0000000..b2c9546
--- /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_ItemOpenGlLayer_H
+#define VInspector_ItemOpenGlLayer_H
+
+#include <Standard.hxx>
+#include <inspector/VInspector_ItemBase.hxx>
+
+#include <Graphic3d_ZLayerSettings.hxx>
+#include <OpenGl_Layer.hxx>
+
+class Graphic3d_Group;
+
+class VInspector_ItemOpenGlLayer;
+typedef QExplicitlySharedDataPointer<VInspector_ItemOpenGlLayer> VInspector_ItemOpenGlLayerPtr;
+
+//! \class VInspector_ItemOpenGlLayer
+//! 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_ItemOpenGlLayer : public VInspector_ItemBase
+{
+public:
+
+  //! Creates an item wrapped by a shared pointer
+  static VInspector_ItemOpenGlLayerPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
+  { return VInspector_ItemOpenGlLayerPtr (new VInspector_ItemOpenGlLayer (theParent, theRow, theColumn)); }
+
+  //! Destructor
+  virtual ~VInspector_ItemOpenGlLayer() 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_ItemOpenGlLayer(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
index 22083e4bdd7b362e31abef67401ebccaa03a9d3f..a66255ca63d4aba1de9dd547ceff924057c8caa4 100644 (file)
@@ -428,8 +428,7 @@ QVariant VInspector_ItemPresentableObject::GetTableData (const int theRow, const
     case 31: return isFirstColumn ? QVariant ("HasOwnPresentations") : QVariant (aPrs->HasOwnPresentations());
     case 32: return isFirstColumn ? QVariant ("ZLayer") : QVariant (Graphic3d::ZLayerIdToString (aPrs->ZLayer()));
     case 33: return isFirstColumn ? QVariant ("TransformationGeom")
-      : (!aPrs->TransformationGeom().IsNull()
-        ? QVariant (ViewControl_Tools::ToString(aPrs->TransformationGeom()->Trsf()).ToCString()) : QVariant());
+      : QVariant (ViewControl_Tools::ToString(aPrs->TransformationGeom()).ToCString());
     case 34: return isFirstColumn ? QVariant ("LocalTransformationGeom")
       : (!aPrs->LocalTransformationGeom().IsNull()
         ? QVariant (ViewControl_Tools::ToString(aPrs->LocalTransformationGeom()->Trsf()).ToCString()) : QVariant());
index 2017acc7eb6b57be22cefb7a1a9a50d06b48edfc..d5274b7a1ab795e153c9c86f07a090063b22ca22 100644 (file)
@@ -107,11 +107,49 @@ QVariant ViewControl_TableModelValues::HeaderData (int theSection, Qt::Orientati
   return QVariant();
 }
 
+// =======================================================================
+// function : GetEditType
+// purpose :
+// =======================================================================
+ViewControl_EditType ViewControl_TableModelValues::GetEditType (const int theRow, const int theColumn) const
+{
+  if (!GetProperties().IsNull())
+  {
+    return GetProperties()->GetTableEditType (theRow, theColumn);
+  }
+  return ViewControl_EditType_None;
+}
+
+// =======================================================================
+// function : GetEnumValues
+// purpose :
+// =======================================================================
+QList<QVariant> ViewControl_TableModelValues::GetEnumValues (const int theRow, const int theColumn) const
+{
+  if (!GetProperties().IsNull())
+  {
+    return GetProperties()->GetTableEnumValues (theRow, theColumn);
+  }
+  return QList<QVariant>();
+}
+
 // =======================================================================
 // function : isItalicHeader
 // purpose :
 // =======================================================================
+Qt::ItemFlags ViewControl_TableModelValues::Flags (const QModelIndex& theIndex) const
+{
+  if (!GetProperties().IsNull())
+  {
+    return GetProperties()->GetTableFlags (theIndex.row(), theIndex.column());
+  }
+  return Qt::NoItemFlags;
+}
 
+// =======================================================================
+// function : isItalicHeader
+// purpose :
+// =======================================================================
 bool ViewControl_TableModelValues::isItalicHeader (const int theRow, const int theColumn) const
 {
   Qt::Orientation anOrientation = myOrientation == Qt::Vertical ? Qt::Horizontal : Qt::Vertical;
index 63e6a329671c7c4f40ca655ce6bf0b6376f845c8..5250635cd10402641920b76f3d5c99f9a9added3 100644 (file)
@@ -132,8 +132,7 @@ public:
   //! Returns flags for the item: ItemIsEnabled | Qt::ItemIsSelectable
   //! \param theIndex a model index
   //! \return flags
-  virtual Qt::ItemFlags Flags (const QModelIndex& theIndex) const
-  { return theIndex.isValid() ? Qt::ItemIsEnabled | Qt::ItemIsSelectable : Qt::NoItemFlags; }
+  Standard_EXPORT virtual Qt::ItemFlags Flags (const QModelIndex& theIndex) const;
 
   //! Returns item delegate to provide cell editors. By default, it is empty
   //! \return delegate
@@ -143,15 +142,13 @@ public:
   //! \param theRow a model index row
   //! \param theColumn a model index column
   //! \return edit type
-  virtual ViewControl_EditType GetEditType (const int theRow, const int theColumn) const
-  { (void)theRow; (void)theColumn; return ViewControl_EditType_None; }
+  Standard_EXPORT virtual ViewControl_EditType GetEditType (const int theRow, const int theColumn) const;
 
   //! 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
-  virtual QList<QVariant> GetEnumValues (const int theRow, const int theColumn) const
-  { (void)theRow; (void)theColumn; return QList<QVariant>(); }
+  Standard_EXPORT virtual QList<QVariant> GetEnumValues (const int theRow, const int theColumn) const;
 
   //! Returns default color for editable cell
   //! \return color value
index dece84a49ee1f1b63aa54e97fc6255aa03b6f6a1..1bcf999a3729fbd51f1b0003155b4bc40597822a 100644 (file)
@@ -16,6 +16,8 @@
 #include <inspector/ViewControl_Tools.hxx>
 #include <inspector/ViewControl_TableModel.hxx>
 
+#include <Geom_Transformation.hxx>
+
 #include <Standard_WarningsDisable.hxx>
 #include <QAction>
 #include <QHeaderView>
@@ -157,6 +159,18 @@ Standard_Real ViewControl_Tools::ToRealValue (const QVariant& theValue)
   return QLocale().toDouble (theValue.toString());
 }
 
+// =======================================================================
+// function : ToString
+// purpose :
+// =======================================================================
+TCollection_AsciiString ViewControl_Tools::ToString (const Handle(Geom_Transformation)& theValue)
+{
+  if (theValue.IsNull())
+    return TCollection_AsciiString();
+
+  return ViewControl_Tools::ToString (theValue->Trsf());
+}
+
 // =======================================================================
 // function : ToString
 // purpose :
index 08c779e46f4964c9e47cb5a15f5d9f5f34f9180f..7a9b90a3a4565acd9d89538f261dff3b72b1f9ac 100644 (file)
@@ -32,6 +32,8 @@
 #include <QVariant>
 #include <Standard_WarningsRestore.hxx>
 
+class Geom_Transformation;
+
 class QAction;
 class QObject;
 class QTableView;
@@ -101,6 +103,11 @@ public:
   //! \return the real value
   Standard_EXPORT static Standard_Real ToRealValue (const QVariant& theValue);
 
+  //! Returns text of orientation
+  //! \param theLocation a location value
+  //! \return text value
+  Standard_EXPORT static TCollection_AsciiString ToString (const Handle(Geom_Transformation)& theValue);
+
   //! Returns text of orientation
   //! \param theLocation a location value
   //! \return text value