]> OCCT Git - occt-copy.git/commitdiff
0029451: Information Message Alert to debug an algorithm or object functionality
authornds <nds@opencascade.com>
Mon, 25 Feb 2019 08:19:56 +0000 (11:19 +0300)
committernds <nds@opencascade.com>
Mon, 25 Feb 2019 12:11:44 +0000 (15:11 +0300)
Modifications:
 - Message_AlertExtended to store additional parameters (attributes, composite alert container, performance meter)
 - Message_Attribute and inherited classes to store custom information about alert
 - Message_CompositeAlerts to have hierarchical structure of alerts
 - Message_PerfMeter to automatically calculate time between alerts adding into report
 - Message_ReportCall back to be able to react to message report filling.
 - Import/Export message report report. Currently it is implemented using XmlDrivers_MessageReportStorage
 - MessageView/MessageModel - Inspector plugin for GUI presentation of Message_Report

Sample of using alerts:
- BRepMesh_IncremetalMesh - till IMeshTools_ShapeExplorer::Accept() for model maps filling (debug of 0030497 issue)

DRAW case:
 - tools/messageview/A1

(cherry picked from commit 9dae9d43ba992a094fb387648bcd5503b487f698)

77 files changed:
src/Draw/Draw.cxx
src/Draw/Draw.hxx
src/Draw/Draw_Commands.cxx
src/Draw/Draw_MessageCommands.cxx [new file with mode: 0644]
src/Draw/Draw_Report.cxx [new file with mode: 0644]
src/Draw/Draw_Report.hxx [new file with mode: 0644]
src/Draw/FILES
src/Message/FILES
src/Message/Message.cxx
src/Message/Message.hxx
src/Message/Message_Alerts.hxx [new file with mode: 0644]
src/Message/Message_AttributeVectorOfReal.cxx [deleted file]
src/Message/Message_AttributeVectorOfReal.hxx [deleted file]
src/Message/Message_AttributeVectorOfRealVec3.cxx [deleted file]
src/Message/Message_AttributeVectorOfRealVec3.hxx [deleted file]
src/Message/Message_AttributeVectorOfValues.cxx [new file with mode: 0644]
src/Message/Message_AttributeVectorOfValues.hxx [new file with mode: 0644]
src/Message/Message_Report.cxx
src/Message/Message_Report.hxx
src/TopoDS/TopoDS_AlertAttribute.hxx
src/XmlDrivers/XmlDrivers_MessageReportStorage.cxx
tests/tools/grids.list
tests/tools/messageview/A1 [new file with mode: 0644]
tools/MessageModel/FILES
tools/MessageModel/MessageModel.qrc
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_ItemRoot.cxx
tools/MessageModel/MessageModel_ItemRoot.hxx
tools/MessageModel/MessageModel_TableModelRealValues.cxx [deleted file]
tools/MessageModel/MessageModel_TableModelRealValues.hxx [deleted file]
tools/MessageModel/MessageModel_TableModelRealVec3Values.cxx [deleted file]
tools/MessageModel/MessageModel_TableModelRealVec3Values.hxx [deleted file]
tools/MessageModel/MessageModel_TableModelValues.cxx [new file with mode: 0644]
tools/MessageModel/MessageModel_TableModelValues.hxx [new file with mode: 0644]
tools/MessageModel/MessageModel_Tools.cxx
tools/MessageModel/MessageModel_Tools.hxx
tools/MessageModel/MessageModel_TreeModel.cxx
tools/MessageModel/MessageModel_TreeModel.hxx
tools/MessageModel/icons/item_vectorOfValues.png [new file with mode: 0644]
tools/MessageModel/icons/item_vectorOfValues.svg [new file with mode: 0644]
tools/MessageView/MessageView_VisibilityState.cxx
tools/MessageView/MessageView_Window.cxx
tools/TreeModel/FILES
tools/TreeModel/TreeModel_ItemBase.hxx
tools/TreeModel/TreeModel_ItemProperties.cxx [new file with mode: 0644]
tools/TreeModel/TreeModel_ItemProperties.hxx [new file with mode: 0644]
tools/TreeModel/TreeModel_ModelBase.cxx
tools/TreeModel/TreeModel_ModelBase.hxx
tools/TreeModel/TreeModel_Tools.cxx
tools/TreeModel/TreeModel_Tools.hxx
tools/VInspector/VInspector_TableModelValues.cxx
tools/VInspector/VInspector_TableModelValues.hxx
tools/ViewControl/FILES
tools/ViewControl/ViewControl_ColorSelector.cxx
tools/ViewControl/ViewControl_EditType.hxx
tools/ViewControl/ViewControl_PropertyView.cxx
tools/ViewControl/ViewControl_PropertyView.hxx
tools/ViewControl/ViewControl_Table.cxx
tools/ViewControl/ViewControl_Table.hxx
tools/ViewControl/ViewControl_TableItemDelegate.cxx
tools/ViewControl/ViewControl_TableModel.cxx
tools/ViewControl/ViewControl_TableModel.hxx
tools/ViewControl/ViewControl_TableModelFilter.cxx [deleted file]
tools/ViewControl/ViewControl_TableModelFilter.hxx [deleted file]
tools/ViewControl/ViewControl_TableModelValues.cxx
tools/ViewControl/ViewControl_TableModelValues.hxx
tools/ViewControl/ViewControl_TableModelValuesDefault.cxx [new file with mode: 0644]
tools/ViewControl/ViewControl_TableModelValuesDefault.hxx [new file with mode: 0644]
tools/ViewControl/ViewControl_TableProperty.cxx [deleted file]
tools/ViewControl/ViewControl_TableProperty.hxx [deleted file]
tools/ViewControl/ViewControl_Tools.cxx
tools/ViewControl/ViewControl_Tools.hxx

index e6292aeb273677ec6e916cd7357fc356c0bd6cdb..cdd6c31b38f51f6713bf7735a597c2f0b8bd2c0e 100644 (file)
@@ -575,3 +575,26 @@ void Draw::Load(Draw_Interpretor& theDI, const TCollection_AsciiString& theKey,
   (*fp) (theDI);
 
 }
+//=======================================================================
+//function : ParseOnOff
+//purpose  :
+//=======================================================================
+Standard_Boolean Draw::ParseOnOff (Standard_CString  theArg,
+                                   Standard_Boolean& theIsOn)
+{
+  TCollection_AsciiString aFlag(theArg);
+  aFlag.LowerCase();
+  if (aFlag == "on"
+   || aFlag == "1")
+  {
+    theIsOn = Standard_True;
+    return Standard_True;
+  }
+  else if (aFlag == "off"
+        || aFlag == "0")
+  {
+    theIsOn = Standard_False;
+    return Standard_True;
+  }
+  return Standard_False;
+}
index e546d9890262aa115855a6ea3e90fa19d21f689f..06005f9c1d4f9f5516d6a659d3ec48768dd87513 100644 (file)
@@ -129,6 +129,13 @@ public:
   //! Defines Draw unit commands
   Standard_EXPORT static void UnitCommands (Draw_Interpretor& I);
 
+  //! Defines Draw message commands
+  Standard_EXPORT static void MessageCommands (Draw_Interpretor& I);
+
+  //! Parses boolean argument.
+  //! Handles either flag specified by 0|1 or on|off.
+  Standard_EXPORT static Standard_Boolean ParseOnOff (Standard_CString  theArg,
+                                                      Standard_Boolean& theIsOn);
 
 
 
index 6444f5d7220851544a3306c99259ac2b238ae218..32efe9fcd5f422684c89cc5e7b576989805bd776 100644 (file)
@@ -41,6 +41,7 @@ void Draw::Commands (Draw_Interpretor& theCommands)
   }
 
   Draw::BasicCommands(theCommands);
+  Draw::MessageCommands(theCommands);
   Draw::VariableCommands(theCommands);
   Draw::GraphicCommands(theCommands);
   Draw::PloadCommands(theCommands);
diff --git a/src/Draw/Draw_MessageCommands.cxx b/src/Draw/Draw_MessageCommands.cxx
new file mode 100644 (file)
index 0000000..52fb350
--- /dev/null
@@ -0,0 +1,104 @@
+// Created on: 2018-06-10
+// Created by: Natalia Ermolaeva
+// Copyright (c)  2017 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <Draw.hxx>
+#include <Message.hxx>
+#include <Message_Gravity.hxx>
+#include <Message_Report.hxx>
+#include <TCollection_AsciiString.hxx>
+
+//==============================================================================
+//function : ActivateReport
+//purpose  :
+//==============================================================================
+
+static Standard_Integer ActivateReport (Draw_Interpretor&, Standard_Integer theArgsNb, const char** theArgVec)
+{
+  bool isActiveMode = true;
+  bool isGravityDefined = false;
+  Standard_Integer aGravity = -1;
+  for (Standard_Integer anArgIt = 1; anArgIt < theArgsNb; ++anArgIt)
+  {
+    const TCollection_AsciiString anArg = theArgVec[anArgIt];
+    TCollection_AsciiString anArgCase = anArg;
+    anArgCase.LowerCase();
+    if (anArgCase == "-mode")
+    {
+      if (anArgIt + 1 < theArgsNb
+       && Draw::ParseOnOff (theArgVec[anArgIt + 1], isActiveMode))
+      {
+        ++anArgIt;
+      }
+    }
+    else if (anArgCase == "-gravity")
+    {
+      if (anArgIt + 1 < theArgsNb)
+      {
+        Message_Gravity aGravityType;
+        isGravityDefined = Message::GravityFromString (theArgVec[anArgIt + 1], aGravityType);
+        aGravity = (Standard_Integer)aGravityType;
+        ++anArgIt;
+      }
+    }
+    else
+    {
+      std::cout << "Syntax error: unknown argument " << anArg << ".\n";
+      return 1;
+    }
+  }
+
+  Handle(Message_Report) aCurrentReport = Message_Report::CurrentReport (isActiveMode);
+  if (!aCurrentReport.IsNull())
+    aCurrentReport->SetActive(isActiveMode, aGravity);
+
+  return 0;
+}
+
+//==============================================================================
+//function : ClearReport
+//purpose  :
+//==============================================================================
+
+static Standard_Integer ClearReport (Draw_Interpretor&, Standard_Integer, const char**)
+{
+  Handle(Message_Report) aCurrentReport = Message_Report::CurrentReport (Standard_False);
+  if (!aCurrentReport.IsNull())
+    aCurrentReport->Clear(); 
+
+  return 0;
+}
+
+//=======================================================================
+//function : PloadCommands
+//purpose  : 
+//=======================================================================
+
+void Draw::MessageCommands(Draw_Interpretor& theCommands)
+{
+  static Standard_Boolean Done = Standard_False;
+  if (Done) return;
+  Done = Standard_True;
+
+  const char* g =  "DRAW Message Commands";
+  
+  theCommands.Add("activateReport" ,
+                  "activateReport [-mode {-on|-off}=-on]"
+                                 "[-gravity {trace|info|warning|alarm|fail}]"
+                  "Activates default Message_Report object" ,
+                 __FILE__, ActivateReport, g);
+
+  theCommands.Add("clearReport" , "clearReport: Clears content of default Message_Report object" ,
+                 __FILE__, ClearReport, g);
+}
diff --git a/src/Draw/Draw_Report.cxx b/src/Draw/Draw_Report.cxx
new file mode 100644 (file)
index 0000000..b3535cc
--- /dev/null
@@ -0,0 +1,50 @@
+// Created on: 2018-06-10
+// Created by: Natalia Ermolaeva
+// Copyright (c) 2017 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <Draw_Report.hxx>
+
+#include <Draw_Display.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(Draw_Report,Draw_Drawable3D)
+
+//=======================================================================
+//function : Copy
+//purpose  :
+//=======================================================================
+Handle(Draw_Drawable3D)  Draw_Report::Copy()const 
+{
+  Handle(Draw_Report) aReport = new Draw_Report (myReport);
+  return aReport;
+}
+
+//=======================================================================
+//function : Dump
+//purpose  :
+//=======================================================================
+void  Draw_Report::Dump (Standard_OStream& S)const 
+{
+  (void)S;
+  //S << myReport;
+}
+
+
+//=======================================================================
+//function : Whatis
+//purpose  : 
+//=======================================================================
+void  Draw_Report::Whatis (Draw_Interpretor& S)const 
+{
+  S << "Draw_Report";
+}
diff --git a/src/Draw/Draw_Report.hxx b/src/Draw/Draw_Report.hxx
new file mode 100644 (file)
index 0000000..b099c54
--- /dev/null
@@ -0,0 +1,69 @@
+// Created on: 2018-06-10
+// Created by: Natalia Ermolaeva
+// Copyright (c)  2017 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _Draw_Report_HeaderFile
+#define _Draw_Report_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_Type.hxx>
+
+#include <Message_Report.hxx>
+#include <Draw_Drawable3D.hxx>
+#include <Standard_OStream.hxx>
+#include <Draw_Interpretor.hxx>
+
+#include <Draw_Display.hxx>
+
+class Draw_Report;
+DEFINE_STANDARD_HANDLE(Draw_Report, Draw_Drawable3D)
+
+//! To store nummbers in variables.
+class Draw_Report : public Draw_Drawable3D
+{
+
+public:
+
+  Standard_EXPORT Draw_Report (const Handle(Message_Report)& theReport) : myReport (theReport) {}
+  
+  Standard_EXPORT const Handle(Message_Report)& GetReport() const { return myReport; }
+  
+  Standard_EXPORT void SetReport (const Handle(Message_Report)& theReport) { myReport = theReport; }
+  
+  //! Does nothhing.
+  Standard_EXPORT void DrawOn (Draw_Display& dis) const Standard_OVERRIDE { (void)dis; }
+  
+  //! For variable copy.
+  Standard_EXPORT virtual Handle(Draw_Drawable3D) Copy() const Standard_OVERRIDE;
+  
+  //! For variable dump.
+  Standard_EXPORT virtual void Dump (Standard_OStream& S) const Standard_OVERRIDE;
+  
+  //! For variable whatis command. Set  as a result  the
+  //! type of the variable.
+  Standard_EXPORT virtual void Whatis (Draw_Interpretor& I) const Standard_OVERRIDE;
+
+  DEFINE_STANDARD_RTTIEXT(Draw_Report,Draw_Drawable3D)
+
+private:
+  Handle(Message_Report) myReport;
+};
+
+
+
+
+
+
+
+#endif // _Draw_Report_HeaderFile
index c43b33613f43e599cdfcdedc133bb35de457df48..568f2d351631a04553cc18b3782b75c500208ec0 100755 (executable)
@@ -43,6 +43,7 @@ Draw_Marker2D.hxx
 Draw_Marker3D.cxx
 Draw_Marker3D.hxx
 Draw_MarkerShape.hxx
+Draw_MessageCommands.cxx
 Draw_Number.cxx
 Draw_Number.hxx
 Draw_PInterp.hxx
@@ -53,6 +54,8 @@ Draw_Printer.hxx
 Draw_ProgressIndicator.cxx
 Draw_ProgressIndicator.hxx
 Draw_Replace.tcl
+Draw_Report.cxx
+Draw_Report.hxx
 Draw_Segment2D.cxx
 Draw_Segment2D.hxx
 Draw_Segment3D.cxx
index fe9884e26d4d29b08222bbf52804278e6360036a..e52f824502d716fc99df88d1536f58ddf4fe26de 100755 (executable)
@@ -4,17 +4,16 @@ Message_Alert.cxx
 Message_Alert.hxx
 Message_AlertExtended.cxx
 Message_AlertExtended.hxx
+Message_Alerts.hxx
 Message_Algorithm.cxx
 Message_Algorithm.hxx
 Message_Algorithm.lxx
-Message_Attribute.hxx
 Message_Attribute.cxx
-Message_AttributeObject.hxx
+Message_Attribute.hxx
 Message_AttributeObject.cxx
-Message_AttributeVectorOfReal.hxx
-Message_AttributeVectorOfReal.cxx
-Message_AttributeVectorOfRealVec3.hxx
-Message_AttributeVectorOfRealVec3.cxx
+Message_AttributeObject.hxx
+Message_AttributeVectorOfValues.cxx
+Message_AttributeVectorOfValues.hxx
 Message_CompositeAlerts.cxx
 Message_CompositeAlerts.hxx
 Message_ExecStatus.hxx
index cbaa47023149cc0870541d06296d788c77cb2f60..fe7d02c18078e8751ff8542797a4b12fdb5be085 100644 (file)
@@ -89,3 +89,39 @@ Standard_Boolean Message::GravityFromString (const Standard_CString theGravitySt
   }
   return Standard_False;
 }
+
+// =======================================================================
+// function : GetPointerInfo
+// purpose :
+// =======================================================================
+TCollection_AsciiString Message::TransientToString (const Handle(Standard_Transient)& thePointer, const bool isShortInfo)
+{
+  if (thePointer.IsNull())
+    return TCollection_AsciiString();
+
+  return PointerToString(thePointer.operator->(), isShortInfo);
+}
+
+// =======================================================================
+// function : GetPointerInfo
+// purpose :
+// =======================================================================
+TCollection_AsciiString Message::PointerToString (const void* thePointer, const bool isShortInfo)
+{
+  std::ostringstream aPtrStr;
+  aPtrStr << thePointer;
+  if (!isShortInfo)
+    return aPtrStr.str().c_str();
+
+  TCollection_AsciiString anInfoPtr (aPtrStr.str().c_str());
+  for (int aSymbolId = 1; aSymbolId < anInfoPtr.Length(); aSymbolId++)
+  {
+    if (anInfoPtr.Value(aSymbolId) != '0')
+    {
+      anInfoPtr = anInfoPtr.SubString(aSymbolId, anInfoPtr.Length());
+      anInfoPtr.Prepend("0x");
+      return anInfoPtr;
+    }
+  }
+  return aPtrStr.str().c_str();
+}
index 1d78005932a89964bb85f33bb820a7067f0e1893..96feb8de0d8f4d385f46fa1fa03c6fdb4ccb1e30 100644 (file)
@@ -83,7 +83,22 @@ public:
   Standard_EXPORT static Standard_Boolean GravityFromString (const Standard_CString theGravityString,
                                                              Message_Gravity& theGravity);
 
-
+  //! Returns separator symbol of Dump information
+  static Standard_Character DumpSeparator() { return '\\'; }
+
+  //! Convert handle pointer to string value
+  //! \param thePointer a pointer
+  //! \param isShortInfo if true, all '0' symbols in the beginning of the pointer are skipped
+  //! \return the string value
+  Standard_EXPORT static TCollection_AsciiString TransientToString (const Handle(Standard_Transient)& thePointer,
+                                                                    const bool isShortInfo = true);
+
+  //! Convert pointer to string value
+  //! \param thePointer a pointer
+  //! \param isShortInfo if true, all '0' symbols in the beginning of the pointer are skipped
+  //! \return the string value
+  Standard_EXPORT static TCollection_AsciiString PointerToString (const void* thePointer,
+                                                                  const bool isShortInfo = true);
 
 protected:
 
diff --git a/src/Message/Message_Alerts.hxx b/src/Message/Message_Alerts.hxx
new file mode 100644 (file)
index 0000000..9af6695
--- /dev/null
@@ -0,0 +1,69 @@
+// Created on: 2018-06-10
+// Created by: Natalia Ermolaeva
+// Copyright (c) 2017 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _Message_Alerts_HeaderFile
+#define _Message_Alerts_HeaderFile
+
+#include <Message.hxx>
+#include <Message_AlertExtended.hxx>
+#include <Message_AttributeObject.hxx>
+#include <Message_AttributeVectorOfValues.hxx>
+#include <Message_Gravity.hxx>
+#include <Message_Report.hxx>
+
+static Handle(Message_Alert) OCCT_Message_Alert;
+
+#define MESSAGE_INFO(Name, Description, PerfMeter, ParentAlert) \
+  { \
+    if (!Message_Report::CurrentReport().IsNull() && \
+         Message_Report::CurrentReport()->IsActive (Message_Info)) \
+    { \
+      OCCT_Message_Alert = Message_AlertExtended::AddAlert (Message_Report::CurrentReport(), \
+        new Message_Attribute (Name, Description), PerfMeter, ParentAlert); \
+    } \
+  }
+
+#define MESSAGE_INFO_OBJECT(Object, Name, Description, PerfMeter, ParentAlert) \
+  { \
+    if (!Message_Report::CurrentReport().IsNull() && \
+         Message_Report::CurrentReport()->IsActive (Message_Info)) \
+    { \
+      OCCT_Message_Alert = Message_AlertExtended::AddAlert (Message_Report::CurrentReport(), \
+        new Message_AttributeObject (Object, Name, Description), PerfMeter, ParentAlert ); \
+    } \
+  }
+
+#define MESSAGE_INFO_VALUES(StreamValues, Name, Description, PerfMeter, ParentAlert) \
+  { \
+    if (!Message_Report::CurrentReport().IsNull() && \
+         Message_Report::CurrentReport()->IsActive (Message_Info)) \
+    { \
+      OCCT_Message_Alert = Message_AlertExtended::AddAlert (Message_Report::CurrentReport(), \
+        new Message_AttributeVectorOfValues (StreamValues, Name, Description), PerfMeter, ParentAlert ); \
+    } \
+  }
+
+#define DUMP_VALUE(OS, Value) \
+  { \
+    OS << Value << Message::DumpSeparator(); \
+  }
+
+#define DUMP_VALUES(OS, Value1, Value2) \
+  { \
+    OS << Value1 << Message::DumpSeparator() << Value2 << Message::DumpSeparator(); \
+  }
+
+
+#endif // _Message_Alerts_HeaderFile
diff --git a/src/Message/Message_AttributeVectorOfReal.cxx b/src/Message/Message_AttributeVectorOfReal.cxx
deleted file mode 100644 (file)
index 0880b5b..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-// Created on: 2018-06-10
-// Created by: Natalia Ermolaeva
-// Copyright (c) 2017 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <Message_AttributeVectorOfReal.hxx>
-
-#include <Message_Msg.hxx>
-#include <Message_PerfMeter.hxx>
-
-#include <Message_Report.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(Message_AttributeVectorOfReal, Message_Attribute)
-
-//=======================================================================
-//function : Message_AttributeVectorOfReal
-//purpose  : 
-//=======================================================================
-
-Message_AttributeVectorOfReal::Message_AttributeVectorOfReal (const NCollection_Vector<Standard_Real>& theValues,
-                                                              const TCollection_AsciiString& theName,
-                                                              const TCollection_AsciiString& theDescription)
-: Message_Attribute(theName, theDescription)
-{
-  SetValues (theValues);
-}
-
-//=======================================================================
-//function : SetValues
-//purpose  : 
-//=======================================================================
-
-void Message_AttributeVectorOfReal::SetValues (const NCollection_Vector<Standard_Real>& theValues)
-{
-  myValues = theValues;
-
-  myCachedValue = TCollection_AsciiString ("[") + (Standard_Integer)myValues.Length() + "] : ";
-  if (myValues.Length() < 2)
-    return;
-
-  myCachedValue += myValues.First();
-  myCachedValue += " ... ";
-  myCachedValue += myValues.Last();
-}
-
-//=======================================================================
-//function : GetDescription
-//purpose  : 
-//=======================================================================
-
-const TCollection_AsciiString& Message_AttributeVectorOfReal::GetDescription() const
-{
-  if (!Message_Attribute::GetDescription().IsEmpty())
-    return Message_Attribute::GetDescription();
-
-  return myCachedValue;
-}
-
diff --git a/src/Message/Message_AttributeVectorOfReal.hxx b/src/Message/Message_AttributeVectorOfReal.hxx
deleted file mode 100644 (file)
index ec0fa52..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-// Created on: 2018-06-10
-// Created by: Natalia Ermolaeva
-// Copyright (c) 2017 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef _Message_AttributeVectorOfReal_HeaderFile
-#define _Message_AttributeVectorOfReal_HeaderFile
-
-#include <Message_Attribute.hxx>
-#include <TCollection_AsciiString.hxx>
-
-#include <NCollection_Vector.hxx>
-
-class Message_PerfMeter;
-class Message_Report;
-
-//! Alert object storing container of Standard_Real values in its field
-class Message_AttributeVectorOfReal : public Message_Attribute
-{
-public:
-
-  //! Constructor with string argument
-  Standard_EXPORT Message_AttributeVectorOfReal (const NCollection_Vector<Standard_Real>& theValues,
-                                                 const TCollection_AsciiString& theName = TCollection_AsciiString(),
-                                                 const TCollection_AsciiString& theDescription = TCollection_AsciiString());
-
-  //! Sets the values
-  //! @param theValues container of values
-  Standard_EXPORT void SetValues (const NCollection_Vector<Standard_Real>& theValues);
-
-  //! Returns values
-  //! @return values
-  const NCollection_Vector<Standard_Real>& GetValues() const { return myValues; }
-
-  //! Returns description of alert if it is set
-  //! @return alert description
-  virtual const TCollection_AsciiString& GetDescription() const;
-
-
-  // OCCT RTTI
-  DEFINE_STANDARD_RTTIEXT(Message_AttributeVectorOfReal, Message_Attribute)
-
-private:
-  NCollection_Vector<Standard_Real> myValues; //!< container of values
-  TCollection_AsciiString myCachedValue; //!< short description of the values in form: [size] : first ... last
-};
-
-#endif // _Message_AttributeVectorOfReal_HeaderFile
diff --git a/src/Message/Message_AttributeVectorOfRealVec3.cxx b/src/Message/Message_AttributeVectorOfRealVec3.cxx
deleted file mode 100644 (file)
index 36bb716..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-// Created on: 2018-06-10
-// Created by: Natalia Ermolaeva
-// Copyright (c) 2017 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <Message_AttributeVectorOfRealVec3.hxx>
-
-#include <Message_Msg.hxx>
-#include <Message_PerfMeter.hxx>
-#include <Message_Report.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(Message_AttributeVectorOfRealVec3, Message_Attribute)
-
-//=======================================================================
-//function : Message_AttributeVectorOfRealVec3
-//purpose  : 
-//=======================================================================
-
-Message_AttributeVectorOfRealVec3::Message_AttributeVectorOfRealVec3 (const NCollection_Vector<NCollection_Vec3<Standard_Real>>& theValues,
-                                                                      const TCollection_AsciiString& theName,
-                                                                      const TCollection_AsciiString& theDescription)
-: Message_Attribute (theName, theDescription)
-{
-  SetValues (theValues);
-}
-
-//=======================================================================
-//function : SetValues
-//purpose  : 
-//=======================================================================
-
-void Message_AttributeVectorOfRealVec3::SetValues (const NCollection_Vector<NCollection_Vec3<Standard_Real>>& theValues)
-{
-  myValues = theValues;
-
-  myCachedValue = TCollection_AsciiString ("[") + (Standard_Integer)myValues.Length() + "] : ";
-  if (myValues.Length() < 2)
-    return;
-
-  NCollection_Vec3<Standard_Real> aValue = myValues.First();
-  myCachedValue = myCachedValue + "(" + aValue.x() + "," + aValue.y() + "," + aValue.z() + ")";
-  myCachedValue += " ... ";
-  aValue = myValues.Last();
-  myCachedValue = myCachedValue + "(" + aValue.x() + "," + aValue.y() + "," + aValue.z() + ")";
-}
-
-//=======================================================================
-//function : GetDescription
-//purpose  : 
-//=======================================================================
-
-const TCollection_AsciiString& Message_AttributeVectorOfRealVec3::GetDescription() const
-{
-  if (!Message_Attribute::GetDescription().IsEmpty())
-    return Message_Attribute::GetDescription();
-
-  return myCachedValue;
-}
-
diff --git a/src/Message/Message_AttributeVectorOfRealVec3.hxx b/src/Message/Message_AttributeVectorOfRealVec3.hxx
deleted file mode 100644 (file)
index b47b80b..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-// Created on: 2018-06-10
-// Created by: Natalia Ermolaeva
-// Copyright (c) 2017 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef _Message_AttributeVectorOfRealVec3_HeaderFile
-#define _Message_AttributeVectorOfRealVec3_HeaderFile
-
-#include <Message_Attribute.hxx>
-#include <TCollection_AsciiString.hxx>
-
-#include <NCollection_Vector.hxx>
-#include <NCollection_Vec3.hxx>
-
-//! Alert object storing container of Standard_Real values in its field
-class Message_AttributeVectorOfRealVec3 : public Message_Attribute
-{
-public:
-
-  //! Constructor with string argument
-  Standard_EXPORT Message_AttributeVectorOfRealVec3 (const NCollection_Vector<NCollection_Vec3<Standard_Real>>& theValues,
-                                                     const TCollection_AsciiString& theName = TCollection_AsciiString(),
-                                                     const TCollection_AsciiString& theDescription = TCollection_AsciiString());
-
-  //! Sets the values
-  //! @param theValues container of values
-  Standard_EXPORT void SetValues (const NCollection_Vector<NCollection_Vec3<Standard_Real>>& theValues);
-
-  //! Returns values
-  //! @return values
-  const NCollection_Vector<NCollection_Vec3<Standard_Real>>& GetValues() const { return myValues; }
-
-  //! Returns description of alert if it is set
-  //! @return alert description
-  virtual const TCollection_AsciiString& GetDescription() const;
-
-  // OCCT RTTI
-  DEFINE_STANDARD_RTTIEXT(Message_AttributeVectorOfRealVec3, Message_Attribute)
-
-private:
-  NCollection_Vector<NCollection_Vec3<Standard_Real>> myValues; //!< container of values
-  TCollection_AsciiString myCachedValue;
-  TCollection_AsciiString myDescription; //!< short description of the values in form: [size] : first ... last
-};
-
-#endif // _Message_AttributeVectorOfRealVec3_HeaderFile
diff --git a/src/Message/Message_AttributeVectorOfValues.cxx b/src/Message/Message_AttributeVectorOfValues.cxx
new file mode 100644 (file)
index 0000000..fcbb2fc
--- /dev/null
@@ -0,0 +1,118 @@
+// Created on: 2018-06-10
+// Created by: Natalia Ermolaeva
+// Copyright (c) 2017 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <Message_AttributeVectorOfValues.hxx>
+
+#include <Message.hxx>
+#include <Message_Msg.hxx>
+#include <Message_PerfMeter.hxx>
+#include <Message_Report.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(Message_AttributeVectorOfValues, Message_Attribute)
+
+//=======================================================================
+//function : SetValues
+//purpose  : 
+//=======================================================================
+Message_AttributeVectorOfValues::Message_AttributeVectorOfValues (const Standard_SStream& theStream,
+                                                                  const TCollection_AsciiString& theName,
+                                                                  const TCollection_AsciiString& theDescription)
+: Message_Attribute(theName, theDescription)
+{
+  TCollection_AsciiString aStream (theStream.str().c_str());
+  Standard_Character aSeparator = Message::DumpSeparator();
+  Standard_Integer aColumnCount = 0;
+
+  TCollection_AsciiString aCurrentString = aStream;
+  Standard_Integer aPosition = aCurrentString.Search (aSeparator);
+  if (aPosition >= 1)
+  {
+    TCollection_AsciiString aTailString = aCurrentString.Split (aPosition);
+    Standard_Integer aRow = 0;
+    Standard_Boolean aClassNameFound = Standard_False;
+    while (!aCurrentString.IsEmpty())
+    {
+      TCollection_AsciiString aValueString = aCurrentString;
+      aPosition = aValueString.Search (aSeparator);
+      if (aPosition < 0 )
+        break;
+      aCurrentString = aValueString.Split (aPosition - 1);
+
+      if (!aColumnCount)
+      {
+        if (!aClassNameFound)
+          aClassNameFound = Standard_True;
+        else
+        {
+          if (!aValueString.IsIntegerValue())
+            break; // not correct Dump, in correct the first value is number of property columns
+          aColumnCount = aValueString.IntegerValue();
+        }
+      }
+      else
+        myValues.Append (aValueString);
+
+      if (aTailString.IsEmpty())
+        break;
+      aCurrentString = aTailString;
+      aPosition = aCurrentString.Search (aSeparator);
+      if (aPosition < 0 )
+      {
+        aCurrentString = aTailString;
+        aTailString = TCollection_AsciiString();
+      }
+      else
+        aTailString = aCurrentString.Split (aPosition);
+    }
+  }
+  myColumnCount = aColumnCount;
+}
+
+//=======================================================================
+//function : SetValues
+//purpose  : 
+//=======================================================================
+
+void Message_AttributeVectorOfValues::SetValues (const NCollection_Vector<TCollection_AsciiString>& theValues)
+{
+  myValues = theValues;
+
+  int aLength = (Standard_Integer)myValues.Length();
+  if (aLength < 2)
+    return;
+
+  if (myColumnCount <= 0)
+    myCachedValue = TCollection_AsciiString ("[") + aLength + "] : ";
+  else
+    myCachedValue = TCollection_AsciiString ("[") + (aLength / myColumnCount) +  ", " + myColumnCount + "] : ";
+
+  myCachedValue += myValues.First();
+  myCachedValue += " ... ";
+  myCachedValue += myValues.Last();
+}
+
+//=======================================================================
+//function : GetDescription
+//purpose  : 
+//=======================================================================
+
+const TCollection_AsciiString& Message_AttributeVectorOfValues::GetDescription() const
+{
+  if (!Message_Attribute::GetDescription().IsEmpty())
+    return Message_Attribute::GetDescription();
+
+  return myCachedValue;
+}
+
diff --git a/src/Message/Message_AttributeVectorOfValues.hxx b/src/Message/Message_AttributeVectorOfValues.hxx
new file mode 100644 (file)
index 0000000..369991d
--- /dev/null
@@ -0,0 +1,68 @@
+// Created on: 2018-06-10
+// Created by: Natalia Ermolaeva
+// Copyright (c) 2017 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _Message_AttributeVectorOfValues_HeaderFile
+#define _Message_AttributeVectorOfValues_HeaderFile
+
+#include <Message_Attribute.hxx>
+#include <TCollection_AsciiString.hxx>
+
+#include <NCollection_Vector.hxx>
+
+class Message_PerfMeter;
+class Message_Report;
+
+//! Alert object storing container of Standard_Real values in its field
+class Message_AttributeVectorOfValues : public Message_Attribute
+{
+public:
+
+  //! Constructor with string argument
+  Standard_EXPORT Message_AttributeVectorOfValues (const Standard_SStream& theStream,
+                                                   const TCollection_AsciiString& theName = TCollection_AsciiString(),
+                                                   const TCollection_AsciiString& theDescription = TCollection_AsciiString());
+
+  //! Sets the values
+  //! @param theValues container of values
+  Standard_EXPORT void SetValues (const NCollection_Vector<TCollection_AsciiString>& theValues);
+
+  //! Returns values
+  //! @return values
+  const NCollection_Vector<TCollection_AsciiString>& GetValues() const { return myValues; }
+
+  //! Returns description of alert if it is set
+  //! @return alert description
+  virtual const TCollection_AsciiString& GetDescription() const;
+
+
+  //! Sets value to present values in a table view
+  //! \param theValue value of division the values on sub-containers
+  void SetColumnCount (const Standard_Integer& theValue) { myColumnCount = theValue; }
+
+  //! Gets value to present values in a table view
+  //! \param theSubSize value of division the values on sub-containers
+  Standard_Integer GetColumnCount() const { return myColumnCount; }
+
+  // OCCT RTTI
+  DEFINE_STANDARD_RTTIEXT(Message_AttributeVectorOfValues, Message_Attribute)
+
+private:
+  NCollection_Vector<TCollection_AsciiString> myValues; //!< container of values
+  Standard_Integer myColumnCount; //!< value to present container of values into table
+
+  TCollection_AsciiString myCachedValue; //!< short description of the values in form: [size] : first ... last
+};
+
+#endif // _Message_AttributeVectorOfValues_HeaderFile
index ab3b9823d3bb7791e9993343fc1b67e2119b751f..38f3c3c8754c0e6a4e7570fd93692180ad79eea6 100644 (file)
@@ -26,6 +26,8 @@
 
 IMPLEMENT_STANDARD_RTTIEXT(Message_Report,Standard_Transient)
 
+static Handle(Message_Report) MyReport;
+
 //=======================================================================
 //function : Message_Report
 //purpose  :
@@ -37,6 +39,18 @@ Message_Report::Message_Report ()
   SetActive (Standard_True);
 }
 
+//=======================================================================
+//function : CurrentReport
+//purpose  :
+//=======================================================================
+Handle(Message_Report) Message_Report::CurrentReport(const Standard_Boolean theToCreate)
+{
+  if (MyReport.IsNull() && theToCreate)
+    MyReport = new Message_Report();
+
+  return MyReport;
+}
+
 //=======================================================================
 //function : AddAlert
 //purpose  :
index c3b8edf19aa4231628fcaadaebe14491c562b49e..d19c81aae891aecea6596704a8400fa6c15e0f09 100644 (file)
@@ -56,6 +56,11 @@ public:
   //! Empty constructor
   Standard_EXPORT Message_Report ();
   
+  //! returns the only one instance of Report
+  //! When theToCreate is true - automatically creates message report when not exist.
+  //! that has been created.
+  Standard_EXPORT static Handle(Message_Report) CurrentReport (const Standard_Boolean theToCreate = Standard_False);
+
   //! Add alert with specified gravity.
   //! This method is thread-safe, i.e. alerts can be added from parallel threads safely.
   Standard_EXPORT void AddAlert (Message_Gravity theGravity, const Handle(Message_Alert)& theAlert);
index ed82829e9131cf4a276bcd32c65498c4262d91ec..115a9ec28e86c6ca0a3d250d67d007be92b21bd9 100644 (file)
@@ -24,10 +24,9 @@ class TopoDS_AlertAttribute : public Message_Attribute
 {
 public:
   //! Constructor with shape argument
-  TopoDS_AlertAttribute (const TopoDS_Shape& theShape,
-                         const TCollection_AsciiString& theName = TCollection_AsciiString(),
-                         const TCollection_AsciiString& theDescription = TCollection_AsciiString())
-    : Message_Attribute (theName, theDescription), myShape (theShape) {}
+  Standard_EXPORT TopoDS_AlertAttribute (const TopoDS_Shape& theShape,
+                                         const TCollection_AsciiString& theName = TCollection_AsciiString(),
+                                         const TCollection_AsciiString& theDescription = TCollection_AsciiString());
 
   //! Returns contained shape
   const TopoDS_Shape& GetShape() const { return myShape; }
@@ -39,5 +38,14 @@ private:
   TopoDS_Shape myShape;
 };
 
+#define MESSAGE_INFO_SHAPE(Shape, Name, Description, PerfMeter, ParentAlert) \
+  { \
+    if (!Message_Report::CurrentReport().IsNull() && \
+         Message_Report::CurrentReport()->IsActive (Message_Info)) \
+    { \
+      OCCT_Message_Alert = Message_AlertExtended::AddAlert (Message_Report::CurrentReport(), \
+        new TopoDS_AlertAttribute (Shape, Name, Description), PerfMeter, ParentAlert); \
+    } \
+  }
 
 #endif // _TopoDS_AlertAttribute_HeaderFile
index 8a3512f1e59733f2db1ae9e9bb2fcbb5bb271190..6ee08d2cbb2fc67e248619983537548744817898 100644 (file)
@@ -17,8 +17,7 @@
 
 #include <Message.hxx>
 #include <Message_AlertExtended.hxx>
-#include <Message_AttributeVectorOfReal.hxx>
-#include <Message_AttributeVectorOfRealVec3.hxx>
+#include <Message_AttributeVectorOfValues.hxx>
 #include <Message_CompositeAlerts.hxx>
 #include <Message_Report.hxx>
 
@@ -26,7 +25,7 @@
 #include <TDataStd_Comment.hxx>
 #include <TDataStd_Real.hxx>
 #include <TDataStd_Name.hxx>
-#include <TDataStd_RealArray.hxx>
+#include <TDataStd_ExtStringArray.hxx>
 #include <TDF_ChildIterator.hxx>
 #include <TDocStd_Application.hxx>
 #include <TDocStd_Document.hxx>
@@ -250,36 +249,18 @@ void XmlDrivers_MessageReportStorage::exportAlertParameters (const Handle(Messag
     TDataStd_Comment::Set (theAlertLabel, anAttribute->GetDescription());
 
   Standard_CString aDynamicTypeName = anAttribute->DynamicType()->Name();
-  if (aDynamicTypeName == STANDARD_TYPE (Message_AttributeVectorOfReal)->Name())
+  if (aDynamicTypeName == STANDARD_TYPE (Message_AttributeVectorOfValues)->Name())
   {
-    Handle(Message_AttributeVectorOfReal) aRealArrayAlert = Handle(Message_AttributeVectorOfReal)::DownCast (anAttribute);
+    Handle(Message_AttributeVectorOfValues) aValuesArrayAlert = Handle(Message_AttributeVectorOfValues)::DownCast (anAttribute);
     // store values
-    const NCollection_Vector<double>& anArrayValues = aRealArrayAlert->GetValues();
+    const NCollection_Vector<TCollection_AsciiString>& anArrayValues = aValuesArrayAlert->GetValues();
     // create real list attribute only if there are values in the attribute
     if (anArrayValues.IsEmpty())
       return;
     int anArraySize = anArrayValues.Length();
-    Handle(TDataStd_RealArray) aRealListAttribute = TDataStd_RealArray::Set (theAlertLabel, 0, anArraySize - 1);
+    Handle(TDataStd_ExtStringArray) aListAttribute = TDataStd_ExtStringArray::Set (theAlertLabel, 0, anArraySize - 1);
     for (int aValueId = 0; aValueId < anArraySize; aValueId++)
-      aRealListAttribute->SetValue (aValueId, anArrayValues.Value (aValueId));
-  }
-  else if (aDynamicTypeName == STANDARD_TYPE (Message_AttributeVectorOfRealVec3)->Name())
-  {
-    Handle(Message_AttributeVectorOfRealVec3) aRealArrayAlert = Handle(Message_AttributeVectorOfRealVec3)::DownCast (anAttribute);
-    // store values
-    const NCollection_Vector<NCollection_Vec3<double>>& anArrayValues = aRealArrayAlert->GetValues();
-    // create real list attribute only if there are values in the attribute
-    if (anArrayValues.IsEmpty())
-      return;
-    int anArraySize = anArrayValues.Length();
-    Handle(TDataStd_RealArray) aRealListAttribute = TDataStd_RealArray::Set (theAlertLabel, 0, 3 * anArraySize - 1);
-    for (int aValueId = 0; aValueId < anArraySize; aValueId++)
-    {
-      NCollection_Vec3<double> aValue = anArrayValues.Value (aValueId);
-      aRealListAttribute->SetValue (3 * aValueId, aValue.x());
-      aRealListAttribute->SetValue (3 * aValueId + 1, aValue.y());
-      aRealListAttribute->SetValue (3 * aValueId + 2, aValue.z());
-    }
+      aListAttribute->SetValue (aValueId, anArrayValues.Value (aValueId));
   }
 }
 
@@ -310,42 +291,24 @@ Handle(Message_Alert) XmlDrivers_MessageReportStorage::importAlertParameters (co
   Handle(Message_Attribute) aMessageAttribute;
   if (aDynamicTypeName == STANDARD_TYPE (Message_Attribute)->Name())
     aMessageAttribute = new Message_Attribute();
-  else if (aDynamicTypeName == STANDARD_TYPE (Message_AttributeVectorOfReal)->Name())
+  else if (aDynamicTypeName == STANDARD_TYPE (Message_AttributeVectorOfValues)->Name())
   {
     // values
-    NCollection_Vector<double> anArrayValues;
-    if (!aParametersLabel.FindAttribute (TDataStd_RealArray::GetID(), anAttribute))
+    NCollection_Vector<TCollection_AsciiString> anArrayValues;
+    if (!aParametersLabel.FindAttribute (TDataStd_ExtStringArray::GetID(), anAttribute))
       return Handle(Message_Alert)();
 
-    Handle(TDataStd_RealArray) aValuesAttribute = Handle(TDataStd_RealArray)::DownCast (anAttribute);
+    Handle(TDataStd_ExtStringArray) aValuesAttribute = Handle(TDataStd_ExtStringArray)::DownCast (anAttribute);
     if (aValuesAttribute.IsNull())
       return Handle(Message_Alert)();
 
     for (int aValueId = aValuesAttribute->Lower(); aValueId <= aValuesAttribute->Upper(); aValueId++)
       anArrayValues.Append (aValuesAttribute->Value (aValueId));
 
-    aMessageAttribute = new Message_AttributeVectorOfReal (anArrayValues);
-  }
-  else if (aDynamicTypeName == STANDARD_TYPE (Message_AttributeVectorOfRealVec3)->Name())
-  {
-    // values
-    NCollection_Vector<NCollection_Vec3<double>> anArrayValues;
-    if (!aParametersLabel.FindAttribute(TDataStd_RealArray::GetID(), anAttribute))
-      return Handle(Message_Alert)();
-
-    Handle(TDataStd_RealArray) aValuesAttribute = Handle(TDataStd_RealArray)::DownCast (anAttribute);
-    if (aValuesAttribute.IsNull())
-      return Handle(Message_Alert)();
-
-    for (int aValueId = aValuesAttribute->Lower(); aValueId <= aValuesAttribute->Upper();
-         aValueId = aValueId + 3)
-    {
-      NCollection_Vec3<double> aValue (aValuesAttribute->Value (aValueId),
-                                       aValuesAttribute->Value (aValueId + 1),
-                                       aValuesAttribute->Value (aValueId + 2));
-      anArrayValues.Append (aValue);
-    }
-    aMessageAttribute = new Message_AttributeVectorOfRealVec3 (anArrayValues);
+    Standard_SStream aStream;
+    Handle(Message_AttributeVectorOfValues) anAlert = new Message_AttributeVectorOfValues (aStream);
+    anAlert->SetValues (anArrayValues);
+    aMessageAttribute = anAlert;
   }
 
   if (!aMessageAttribute.IsNull())
index c8ade14958b06ac2cecdc86136cda8774e294071..ee623aba26757e4ba08c09ca4f7f188dd666f4e0 100644 (file)
@@ -1,3 +1,4 @@
 001 dfbrowser
 001 shapeview
 001 vinspector
+001 messageview
diff --git a/tests/tools/messageview/A1 b/tests/tools/messageview/A1
new file mode 100644 (file)
index 0000000..7351c5f
--- /dev/null
@@ -0,0 +1,12 @@
+pload ALL INSPECTOR
+vinit
+
+activateReport -mode on -gravity info
+
+box s 200 100 120
+vdisplay s -dispmode 1
+vfit
+vselmode 2 1
+
+tinspector -plugins shapeview
+tinspector -plugins messageview
index 10dbf13fbe10c91818c5af3f092d7b34ef52cdee..bb44a4de71e39ed8ae1ebd48751850b7ef94cf5b 100644 (file)
@@ -12,10 +12,8 @@ MessageModel_ItemRoot.cxx
 MessageModel_ItemRoot.hxx
 MessageModel_ReportCallBack.cxx
 MessageModel_ReportCallBack.hxx
-MessageModel_TableModelRealValues.cxx
-MessageModel_TableModelRealValues.hxx
-MessageModel_TableModelRealVec3Values.cxx
-MessageModel_TableModelRealVec3Values.hxx
+MessageModel_TableModelValues.cxx
+MessageModel_TableModelValues.hxx
 MessageModel_Tools.cxx
 MessageModel_Tools.hxx
 MessageModel_TreeModel.cxx
index b8cc9bd31cf785640356509b1d7b70c371ca71e3..6862cafe7d440e26d625ba14a4217a3d3009bb12 100644 (file)
@@ -1,7 +1,6 @@
 <!DOCTYPE RCC><RCC version="1.0">
     <qresource>
         <file>icons/item_shape.png</file>
-        <file>icons/item_vectorOfReal.png</file>
-        <file>icons/item_vectorOfRealVec3.png</file>
+        <file>icons/item_vectorOfValues.png</file>
     </qresource>
 </RCC>
index 57fde16fa5359730ed89192c7783976f0207382c..1f6f26509cebe26656d12fb743cc1745e3725fe9 100644 (file)
 #include <inspector/TInspectorAPI_PluginParameters.hxx>
 #include <inspector/ViewControl_Tools.hxx>
 
+#include <Message_AlertExtended.hxx>
+
 #include <TCollection_AsciiString.hxx>
-#include <TopoDS_AlertWithShape.hxx>
+#include <TopoDS_AlertAttribute.hxx>
 
+#include <Standard_WarningsDisable.hxx>
 #include <QAction>
 #include <QFileDialog>
 #include <QItemSelectionModel>
 #include <QMenu>
 #include <QMessageBox>
 #include <QWidget>
+#include <Standard_WarningsRestore.hxx>
 
 // =======================================================================
 // function : Constructor
@@ -146,7 +150,7 @@ void MessageModel_Actions::OnDeactivateReport()
     return;
 
   aReport->SetActive (Standard_False);
-  ((MessageModel_TreeModel*)mySelectionModel)->EmitDataChanged (aReportIndex, aReportIndex);
+  ((MessageModel_TreeModel*)mySelectionModel->model())->EmitDataChanged (aReportIndex, aReportIndex);
 }
 
 // =======================================================================
@@ -161,7 +165,7 @@ void MessageModel_Actions::OnActivateReport()
     return;
 
   aReport->SetActive (Standard_True);
-  ((MessageModel_TreeModel*)mySelectionModel)->EmitDataChanged (aReportIndex, aReportIndex);
+  ((MessageModel_TreeModel*)mySelectionModel->model())->EmitDataChanged (aReportIndex, aReportIndex);
 }
 
 // =======================================================================
@@ -199,11 +203,18 @@ void MessageModel_Actions::OnExportToShapeView()
     if (anAlert.IsNull())
       continue;
 
-    Handle(TopoDS_AlertWithShape) aShapeAlert = Handle(TopoDS_AlertWithShape)::DownCast (anAlert);
-    if (aShapeAlert.IsNull() || aShapeAlert->GetShape().IsNull())
+    Handle(Message_AlertExtended) anExtAlert = Handle(Message_AlertExtended)::DownCast (anAlert);
+    if (anExtAlert.IsNull())
+      continue;
+
+    Handle(Message_Attribute) anAttribute = anExtAlert->Attribute();
+    if (anAttribute.IsNull())
+      continue;
+
+    if (!anAttribute->IsKind (STANDARD_TYPE (TopoDS_AlertAttribute)))
       continue;
 
-    const TopoDS_Shape aShape = aShapeAlert->GetShape();
+    const TopoDS_Shape aShape = Handle(TopoDS_AlertAttribute)::DownCast (anAttribute)->GetShape();
     if (aShape.IsNull())
       continue;
     aPluginParameters.Append (aShape.TShape());
index 3315a9f6521fb95f4cbf666a91bda4ae435818d6..2de60eca78ab881ef95a1eb987b6c526d9d3c371 100644 (file)
 #ifndef MessageModel_Actions_H
 #define MessageModel_Actions_H
 
-#ifdef _MSC_VER
-  #pragma warning(disable : 4127 4718) // conditional expression is constant, recursive call has no side effects
-#endif
-
 #include <Standard.hxx>
 #include <Standard_Transient.hxx>
 
 #include <inspector/MessageModel_ActionType.hxx>
 #include <inspector/TInspectorAPI_PluginParameters.hxx>
 
+#include <Standard_WarningsDisable.hxx>
 #include <QObject>
 #include <QMap>
 #include <QModelIndexList>
 #include <QPoint>
 #include <QString>
+#include <Standard_WarningsRestore.hxx>
 
 class Message_Report;
 class MessageModel_TreeModel;
index f149cf571154cff26f341e399abdc3d523b99ae4..c884a45e5374d59b48a7a8cd9b4483ff406085c7 100644 (file)
 #include <inspector/TreeModel_Tools.hxx>
 
 #include <Message_AlertExtended.hxx>
-#include <Message_AttributeVectorOfReal.hxx>
-#include <Message_AttributeVectorOfRealVec3.hxx>
+#include <Message_AttributeVectorOfValues.hxx>
 #include <Message_CompositeAlerts.hxx>
 
 #include <TCollection_AsciiString.hxx>
-#include <TopoDS_AlertWithShape.hxx>
+#include <TopoDS_AlertAttribute.hxx>
 
+#include <Standard_WarningsDisable.hxx>
 #include <QColor>
 #include <QIcon>
+#include <Standard_WarningsRestore.hxx>
 
 // =======================================================================
 // function : initValue
@@ -65,12 +66,16 @@ QVariant MessageModel_ItemAlert::initValue (const int theRole) const
   // if the alert is composite, process the real alert
   if (theRole == Qt::DecorationRole && Column() == 0)
   {
-    if (anAlert->IsKind (STANDARD_TYPE (TopoDS_AlertWithShape)))
+    Handle(Message_AlertExtended) anExtAttribute = Handle(Message_AlertExtended)::DownCast (anAlert);
+    if (anExtAttribute.IsNull())
+      return QVariant();
+
+    Handle(Message_Attribute) anAttribute = anExtAttribute->Attribute();
+
+    if (anAttribute->IsKind (STANDARD_TYPE (TopoDS_AlertAttribute)))
       return QIcon (":/icons/item_shape.png");
-    else if (anAlert->IsKind (STANDARD_TYPE (Message_AttributeVectorOfReal)))
-      return QIcon (":/icons/item_vectorOfReal.png");
-    else if (anAlert->IsKind (STANDARD_TYPE (Message_AttributeVectorOfRealVec3)))
-      return QIcon (":/icons/item_vectorOfRealVec3.png");
+    else if (anAttribute->IsKind (STANDARD_TYPE (Message_AttributeVectorOfValues)))
+      return QIcon (":/icons/item_vectorOfValues.png");
     else
       return QVariant();
   }
index 9fda8eeddc1f50e70772e6f18f41d25fe5348b64..3f338c1d0c1c60db79a073d6c25ee6511d5eb597 100644 (file)
 #include <Standard.hxx>
 #include <TopoDS_Shape.hxx>
 
+#include <Standard_WarningsDisable.hxx>
 #include <QMap>
 #include <QVariant>
+#include <Standard_WarningsRestore.hxx>
 
 #include <NCollection_Vector.hxx>
 
index 07bd1be492e810bcd66304003d98fe11cc93cf87..2ba14ae1c7621bfdf7a4c5adf5178a909e32eb93 100644 (file)
@@ -20,7 +20,9 @@
 
 #include <OSD_Path.hxx>
 
+#include <Standard_WarningsDisable.hxx>
 #include <QColor>
+#include <Standard_WarningsRestore.hxx>
 
 // =======================================================================
 // function : initValue
index 067861daec1e6a3a51d5ca3fc5404cc9a1c9dd6a..1c7c081fa72e23deadde002d75a0f152a60fefb3 100644 (file)
 #include <TCollection_AsciiString.hxx>
 #include <Message_Report.hxx>
 
+#include <Standard_WarningsDisable.hxx>
 #include <QMap>
 #include <QVariant>
+#include <Standard_WarningsRestore.hxx>
 
 class MessageModel_ItemReport;
 typedef QExplicitlySharedDataPointer<MessageModel_ItemReport> MessageModel_ItemReportPtr;
index 3d46c1f61c2188238eded8b5a20acf6348829cdd..616538414385156edaf3d3b65e847faf7a333546 100644 (file)
@@ -51,6 +51,21 @@ const Handle(Message_Report)& MessageModel_ItemRoot::GetReport (const int theRow
   return aReportsIt.Value().myReport;
 }
 
+// =======================================================================
+// function : HasReport
+// purpose :
+// =======================================================================
+Standard_Boolean MessageModel_ItemRoot::HasReport (const Handle(Message_Report)& theReport)
+{
+  NCollection_List<MessageModel_ReportInformation>::Iterator aReportsIt (myReports);
+  for (int aRowId = 0; aReportsIt.More(); aReportsIt.Next(), aRowId++)
+  {
+    if (aReportsIt.Value().myReport == theReport)
+      return Standard_True;
+  }
+  return Standard_False;
+}
+
 // =======================================================================
 // function : initValue
 // purpose :
index 337576e21d15a1e64f18aa53a404244620593e22..f98e31b3d4afcd3a6266caf88556bfe93c7084c5 100644 (file)
@@ -66,6 +66,11 @@ public:
   Standard_EXPORT void SetReport (const int theRowId, const Handle(Message_Report)& theReport,
     const TCollection_AsciiString& theReportDescription = "");
 
+  //! Returns true if report exists is in the list of the current reports
+  //! \param theReport a report instance
+  //! \return boolen value
+  Standard_EXPORT Standard_Boolean HasReport (const Handle(Message_Report)& theReport);
+
   //! Clears internal container of added reports
   void RemoveAllReports() { myReports.Clear(); }
 
diff --git a/tools/MessageModel/MessageModel_TableModelRealValues.cxx b/tools/MessageModel/MessageModel_TableModelRealValues.cxx
deleted file mode 100644 (file)
index 0e16f14..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement. 
-
-#include <inspector/MessageModel_TableModelRealValues.hxx>
-
-#include <inspector/ViewControl_TableModel.hxx>
-
-const int REAL_SIGNS = 16;
-
-// =======================================================================
-// function : Constructor
-// purpose :
-// =======================================================================
-
-MessageModel_TableModelRealValues::MessageModel_TableModelRealValues (const Handle(Message_Attribute)& theAttribute,
-  const int theSectionWidth)
- : myAttribute (Handle(Message_AttributeVectorOfReal)::DownCast (theAttribute))
-{
-  SetUseTableProperties (true);
-  SetUseTablePropertiesXStep (true, -1);
-
-  SetDefaultSectionSize (Qt::Horizontal, theSectionWidth);
-}
-
-// =======================================================================
-// function : ColumnCount
-// purpose :
-// =======================================================================
-
-int MessageModel_TableModelRealValues::ColumnCount (const QModelIndex&) const
-{
-  return myAttribute->GetValues().Length();
-}
-
-// =======================================================================
-// function : Data
-// purpose :
-// =======================================================================
-
-QVariant MessageModel_TableModelRealValues::Data (const int, const int theColumn, int theRole) const
-{
-  if (theRole == Qt::DisplayRole && theColumn < myAttribute->GetValues().Length())
-  {
-    return myAttribute->GetValues().Value(theColumn);
-  }
-
-  return QVariant();
-}
-
-// =======================================================================
-// function : GetRangeValues
-// purpose :
-// =======================================================================
-
-void MessageModel_TableModelRealValues::GetRangeValues (QString& theMinValue, QString& theMaxValue, const QModelIndexList& theSelected) const
-{
-  double aMinValue, aMaxValue;
-  aMinValue = DBL_MAX;
-  aMaxValue = DBL_MIN;
-
-  NCollection_Vector<double> aValues = myAttribute->GetValues();
-  int aValuesSize = aValues.Length();
-  if (aValuesSize < 1)
-    return;
-
-  if (theSelected.isEmpty())
-  {
-    aMinValue = aMaxValue = aValues.First();
-    for (int i = 1; i < aValuesSize; i++)
-    {
-      double aValue = aValues.Value (i);
-      if (aValue < aMinValue) aMinValue = aValue;
-      if (aValue > aMaxValue) aMaxValue = aValue;
-    }
-  }
-  else
-  {
-    ViewControl_TableModel* aModel = (ViewControl_TableModel*)theSelected[0].model();
-    int aRow, aColumn;
-    for (QModelIndexList::const_iterator aSelIt = theSelected.begin(); aSelIt != theSelected.end(); aSelIt++)
-    {
-      aModel->GetSourcePosition (*aSelIt, aRow, aColumn);
-      if (aColumn >= aValuesSize)
-        continue;
-
-      double aValue = aValues.Value (aColumn);
-      if (aValue < aMinValue) aMinValue = aValue;
-      if (aValue > aMaxValue) aMaxValue = aValue;
-    }
-  }
-
-  theMinValue = QString::number(aMinValue, 'g', REAL_SIGNS);
-  theMaxValue = QString::number(aMaxValue, 'g', REAL_SIGNS);
-}
diff --git a/tools/MessageModel/MessageModel_TableModelRealValues.hxx b/tools/MessageModel/MessageModel_TableModelRealValues.hxx
deleted file mode 100644 (file)
index 346b3bb..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement. 
-
-#ifndef MessageModel_TableModelRealValues_H
-#define MessageModel_TableModelRealValues_H
-
-#ifdef _MSC_VER
-  #pragma warning(disable : 4127 4718) // conditional expression is constant, recursive call has no side effects
-#endif
-
-#include <inspector/ViewControl_TableModelValues.hxx>
-
-#include <Message_AttributeVectorOfReal.hxx>
-
-//! \class MessageModel_TableModelRealValues
-//! \brief This is an implementation for ViewControl_TableModel to present Message_AttributeVectorOfReal object
-class MessageModel_TableModelRealValues : public ViewControl_TableModelValues
-{
-public:
-
-  //! Constructor
-  Standard_EXPORT MessageModel_TableModelRealValues (const Handle(Message_Attribute)& theAttribute, const int theSectionWidth);
-
-  //! Destructor
-  virtual ~MessageModel_TableModelRealValues() Standard_OVERRIDE {}
-
-  //! Returns number of columns, size of header values
-  //! \param theParent an index of the parent item
-  //! \return an integer value
-  Standard_EXPORT virtual int ColumnCount (const QModelIndex& theParent = QModelIndex()) const;
-
-  //! 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
-  virtual int RowCount (const QModelIndex& theParent = QModelIndex()) const { (void)theParent; return 1; }
-
-  //! 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 theIndex a model index
-  //! \param theRole a view role
-  //! \return value intepreted depending on the given role
-  Standard_EXPORT virtual QVariant Data (const int theRow, const int theColumn, int theRole = Qt::DisplayRole) const;
-
-  //! Returns minimum and maximum values of selected items or the table content (if selected list is empty)
-  //! \param theMinValue minimum
-  //! \param theMaxValue maximum
-  //! \param theSelected selected cells
-  virtual void GetRangeValues (QString& theMinValue, QString& theMaxValue, const QModelIndexList& theSelected) const;
-
-private:
-  Handle(Message_AttributeVectorOfReal) myAttribute; //!< alert attribute, container of table values
-};
-
-#endif
diff --git a/tools/MessageModel/MessageModel_TableModelRealVec3Values.cxx b/tools/MessageModel/MessageModel_TableModelRealVec3Values.cxx
deleted file mode 100644 (file)
index 1e653f0..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement. 
-
-
-#include <inspector/MessageModel_TableModelRealVec3Values.hxx>
-
-#include <inspector/ViewControl_TableModel.hxx>
-
-// =======================================================================
-// function : Constructor
-// purpose :
-// =======================================================================
-
-MessageModel_TableModelRealVec3Values::MessageModel_TableModelRealVec3Values (const Handle(Message_Attribute)& theAttribute,
-  const int theSectionWidth)
- : myAttribute (Handle(Message_AttributeVectorOfRealVec3)::DownCast (theAttribute))
-{
-  SetUseTableProperties (true);
-
-  SetDefaultSectionSize (Qt::Horizontal, theSectionWidth);
-}
-
-// =======================================================================
-// function : ColumnCount
-// purpose :
-// =======================================================================
-
-int MessageModel_TableModelRealVec3Values::ColumnCount (const QModelIndex&) const
-{
-  return myAttribute->GetValues().Length();
-}
-
-// =======================================================================
-// function : Data
-// purpose :
-// =======================================================================
-
-QVariant MessageModel_TableModelRealVec3Values::Data (const int, const int theColumn, int theRole) const
-{
-  if (theRole != Qt::DisplayRole || theColumn > myAttribute->GetValues().Length())
-    return QVariant();
-
-  NCollection_Vec3<double> aValue = myAttribute->GetValues().Value(theColumn);
-  return QString ("%1, %2, %3").arg (aValue.x()).arg (aValue.y()).arg (aValue.z());
-}
-
-// =======================================================================
-// function : GetRangeValues
-// purpose :
-// =======================================================================
-
-void MessageModel_TableModelRealVec3Values::GetRangeValues (QString& theMinValue, QString& theMaxValue,
-  const QModelIndexList& theSelected) const
-{
-  theMinValue = DBL_MAX;
-  theMaxValue = DBL_MIN;
-
-  QList<int> aValuePositions;
-  if (!theSelected.isEmpty())
-  {
-    ViewControl_TableModel* aModel = (ViewControl_TableModel*)theSelected[0].model();
-    int aRow, aColumn;
-    for (QModelIndexList::const_iterator aSelIt = theSelected.begin(); aSelIt != theSelected.end(); aSelIt++)
-    {
-      aModel->GetSourcePosition (*aSelIt, aRow, aColumn);
-      aValuePositions.append (aColumn);
-    }
-  }
-
-  NCollection_Vector<NCollection_Vec3<double>> aValues = myAttribute->GetValues();
-  int aValuesSize = aValues.Length();
-  if (aValuesSize < 1)
-    return;
-
-  double aXMinValue = aValues.First().x(), aXMaxValue = aValues.First().x();
-  NCollection_Vec3<double> aValue;
-  for (int i = 1; i < aValuesSize; i++)
-  {
-    if (!aValuePositions.empty() && !aValuePositions.contains (i))
-      continue;
-
-    aValue = aValues.Value (i);
-    if (aValue.x() < aXMinValue) aXMinValue = aValue.x();
-    if (aValue.x() > aXMaxValue) aXMaxValue = aValue.x();
-  }
-
-  double anYMinValue = aValues.First().y(), anYMaxValue = aValues.First().y();
-  for (int i = 1; i < aValuesSize; i++)
-  {
-    if (!aValuePositions.empty() && !aValuePositions.contains (i))
-      continue;
-
-    aValue = aValues.Value (i);
-    if (aValue.x() == aXMinValue && aValue.y() < anYMinValue) anYMinValue = aValue.y();
-    if (aValue.x() == aXMaxValue && aValue.y() > anYMaxValue) anYMaxValue = aValue.y();
-  }
-
-  double aZMinValue = aValues.First().z(), aZMaxValue = aValues.First().z();
-  for (int i = 1; i < aValuesSize; i++)
-  {
-    if (!aValuePositions.empty() && !aValuePositions.contains (i))
-      continue;
-    aValue = aValues.Value (i);
-    if (aValue.x() == aXMinValue && aValue.y() == anYMinValue && aValue.z() < aZMinValue) aZMinValue = aValue.z();
-    if (aValue.x() == aXMaxValue && aValue.y() == anYMaxValue && aValue.z() > aZMaxValue) aZMaxValue = aValue.z();
-  }
-
-  theMinValue = QString ("%1, %2, %3").arg (aXMinValue).arg (anYMinValue).arg (aZMinValue);
-  theMaxValue = QString ("%1, %2, %3").arg (aXMaxValue).arg (anYMaxValue).arg (aZMaxValue);
-}
diff --git a/tools/MessageModel/MessageModel_TableModelRealVec3Values.hxx b/tools/MessageModel/MessageModel_TableModelRealVec3Values.hxx
deleted file mode 100644 (file)
index d10a1de..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement. 
-
-#ifndef MessageModel_TableModelRealVec3Values_H
-#define MessageModel_TableModelRealVec3Values_H
-
-#ifdef _MSC_VER
-  #pragma warning(disable : 4127 4718) // conditional expression is constant, recursive call has no side effects
-#endif
-
-#include <inspector/ViewControl_TableModelValues.hxx>
-
-#include <Message_AttributeVectorOfRealVec3.hxx>
-
-//! \class MessageModel_TableModelRealVec3Values
-//! \brief This is an implementation for ViewControl_TableModel to present Message_AttributeVectorOfRealVec3 object
-class MessageModel_TableModelRealVec3Values : public ViewControl_TableModelValues
-{
-public:
-
-  //! Constructor
-  Standard_EXPORT MessageModel_TableModelRealVec3Values (const Handle(Message_Attribute)& theAttribute, const int theSectionWidth);
-
-  //! Destructor
-  virtual ~MessageModel_TableModelRealVec3Values() Standard_OVERRIDE {}
-
-  //! Returns number of columns, size of header values
-  //! \param theParent an index of the parent item
-  //! \return an integer value
-  Standard_EXPORT virtual int ColumnCount (const QModelIndex& theParent = QModelIndex()) const;
-
-  //! 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
-  virtual int RowCount (const QModelIndex& theParent = QModelIndex()) const { (void)theParent; return 1; }
-
-  //! 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 theIndex a model index
-  //! \param theRole a view role
-  //! \return value intepreted depending on the given role
-  Standard_EXPORT virtual QVariant Data (const int theRow, const int theColumn, int theRole = Qt::DisplayRole) const;
-
-  //! Returns minimum and maximum values of selected items or the table content (if selected list is empty)
-  //! It finds firstly Xmax, then Ymax, after that Zmax. The same for min values.
-  //! \param theMinValue minimum
-  //! \param theMaxValue maximum
-  //! \param theSelected selected cells
-  virtual void GetRangeValues (QString& theMinValue, QString& theMaxValue, const QModelIndexList& theSelected) const;
-
-private:
-  Handle(Message_AttributeVectorOfRealVec3) myAttribute; //!< alert attribute, container of table values
-};
-
-#endif
diff --git a/tools/MessageModel/MessageModel_TableModelValues.cxx b/tools/MessageModel/MessageModel_TableModelValues.cxx
new file mode 100644 (file)
index 0000000..9b295cf
--- /dev/null
@@ -0,0 +1,75 @@
+// Created on: 2017-06-16
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2017 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement. 
+
+#include <inspector/MessageModel_TableModelValues.hxx>
+
+#include <inspector/ViewControl_TableModel.hxx>
+
+#include <Message_AttributeVectorOfValues.hxx>
+
+const int REAL_SIGNS = 16;
+
+// =======================================================================
+// function : Constructor
+// purpose :
+// =======================================================================
+
+MessageModel_TableModelValues::MessageModel_TableModelValues (const Handle(Message_Attribute)& theAttribute,
+  const int theSectionWidth)
+ : myAttribute (Handle(Message_AttributeVectorOfValues)::DownCast (theAttribute))
+{
+  SetDefaultSectionSize (Qt::Horizontal, theSectionWidth);
+}
+
+// =======================================================================
+// function : ColumnCount
+// purpose :
+// =======================================================================
+
+int MessageModel_TableModelValues::ColumnCount (const QModelIndex&) const
+{
+  return myAttribute->GetColumnCount();
+}
+
+// =======================================================================
+// function : RowCount
+// purpose :
+// =======================================================================
+int MessageModel_TableModelValues::RowCount (const QModelIndex& theParent) const
+{
+  int aColumnCount = ColumnCount (theParent);
+  if (!aColumnCount)
+    return 0;
+
+  return myAttribute->GetValues().Length() / aColumnCount;
+}
+
+// =======================================================================
+// function : Data
+// purpose :
+// =======================================================================
+
+QVariant MessageModel_TableModelValues::Data (const int theRow, const int theColumn, int theRole) const
+{
+  int aColumnCount = ColumnCount (QModelIndex());
+  int anIndex = theRow * aColumnCount + theColumn;
+
+  if (theRole == Qt::DisplayRole && anIndex < myAttribute->GetValues().Length())
+  {
+    return myAttribute->GetValues().Value(anIndex).ToCString();
+  }
+
+  return QVariant();
+}
diff --git a/tools/MessageModel/MessageModel_TableModelValues.hxx b/tools/MessageModel/MessageModel_TableModelValues.hxx
new file mode 100644 (file)
index 0000000..85145e7
--- /dev/null
@@ -0,0 +1,57 @@
+// Created on: 2017-06-16
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2017 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement. 
+
+#ifndef MessageModel_TableModelValues_H
+#define MessageModel_TableModelValues_H
+
+#include <inspector/ViewControl_TableModelValues.hxx>
+
+#include <Message_Attribute.hxx>
+class Message_AttributeVectorOfValues;
+
+//! \class MessageModel_TableModelValues
+//! \brief This is an implementation for ViewControl_TableModel to present Message_AttributeVectorOfValues object
+class MessageModel_TableModelValues : public ViewControl_TableModelValues
+{
+public:
+
+  //! Constructor
+  Standard_EXPORT MessageModel_TableModelValues (const Handle(Message_Attribute)& theAttribute, const int theSectionWidth);
+
+  //! Destructor
+  virtual ~MessageModel_TableModelValues() Standard_OVERRIDE {}
+
+  //! Returns number of columns, size of header values
+  //! \param theParent an index of the parent item
+  //! \return an integer value
+  Standard_EXPORT virtual int ColumnCount (const QModelIndex& theParent = QModelIndex()) const;
+
+  //! Returns number of rows, depending on orientation: myColumnCount or size of values container
+  //! \param theParent an index of the parent item
+  //! \return an integer value
+  Standard_EXPORT virtual int RowCount (const QModelIndex& theParent) const;
+
+  //! 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 theIndex a model index
+  //! \param theRole a view role
+  //! \return value intepreted depending on the given role
+  Standard_EXPORT virtual QVariant Data (const int theRow, const int theColumn, int theRole = Qt::DisplayRole) const;
+
+private:
+  Handle(Message_AttributeVectorOfValues) myAttribute; //!< alert attribute, container of table values
+};
+
+#endif
index 569eabf937ec62570faad522488403f6105a509b..67ac9b5edf7f9db9033534ce769c5fe2b4127dfd 100644 (file)
 // commercial license or contractual agreement. 
 
 #include <inspector/MessageModel_Tools.hxx>
-#include <inspector/MessageModel_TableModelRealValues.hxx>
-#include <inspector/MessageModel_TableModelRealVec3Values.hxx>
+#include <inspector/MessageModel_TableModelValues.hxx>
 
 #include <inspector/ViewControl_Table.hxx>
 #include <inspector/ViewControl_TableModelValues.hxx>
+#include <inspector/ViewControl_TableModelValuesDefault.hxx>
 
 #include <BRep_Builder.hxx>
 #include <BRepBuilderAPI_MakeVertex.hxx>
 #include <BRepTools.hxx>
 #include <Message_AlertExtended.hxx>
 #include <Message_AttributeObject.hxx>
-#include <Message_AttributeVectorOfReal.hxx>
-#include <Message_AttributeVectorOfRealVec3.hxx>
+#include <Message_AttributeVectorOfValues.hxx>
+
 #include <Precision.hxx>
-#include <TopoDS_AlertWithShape.hxx>
+#include <TopoDS_AlertAttribute.hxx>
 #include <TopoDS_Edge.hxx>
 
 // =======================================================================
@@ -65,10 +65,18 @@ TCollection_AsciiString MessageModel_Tools::GetPointerInfo (const Handle(Standar
 // =======================================================================
 TCollection_AsciiString MessageModel_Tools::GetPointerAlertInfo (const Handle(Message_Alert)& theAlert)
 {
-  if (theAlert->IsKind (STANDARD_TYPE (TopoDS_AlertWithShape)))
-    return GetPointerInfo (Handle(TopoDS_AlertWithShape)::DownCast (theAlert)->GetShape().TShape());
-  else if (theAlert->IsKind (STANDARD_TYPE (Message_AttributeObject)))
-    return GetPointerInfo (Handle(Message_AttributeObject)::DownCast (theAlert)->GetObject());
+  Handle(Message_AlertExtended) anExtAlert = Handle(Message_AlertExtended)::DownCast (theAlert);
+  if (anExtAlert.IsNull())
+    return TCollection_AsciiString();
+
+  Handle(Message_Attribute) anAttribute = anExtAlert->Attribute();
+  if (anAttribute.IsNull())
+    return TCollection_AsciiString();
+
+  if (anAttribute->IsKind (STANDARD_TYPE (TopoDS_AlertAttribute)))
+    return GetPointerInfo (Handle(TopoDS_AlertAttribute)::DownCast (anAttribute)->GetShape().TShape());
+  else if (anAttribute->IsKind (STANDARD_TYPE (Message_AttributeObject)))
+    return GetPointerInfo (Handle(Message_AttributeObject)::DownCast (anAttribute)->GetObject());
   return TCollection_AsciiString();
 }
 
@@ -78,10 +86,17 @@ TCollection_AsciiString MessageModel_Tools::GetPointerAlertInfo (const Handle(Me
 // =======================================================================
 TCollection_AsciiString MessageModel_Tools::GetShapeTypeAlertInfo (const Handle(Message_Alert)& theAlert)
 {
-  TopoDS_Shape aShape;
+  Handle(Message_AlertExtended) anExtAlert = Handle(Message_AlertExtended)::DownCast (theAlert);
+  if (anExtAlert.IsNull())
+    return TCollection_AsciiString();
 
-  if (theAlert->IsKind (STANDARD_TYPE (TopoDS_AlertWithShape)))
-    aShape = Handle(TopoDS_AlertWithShape)::DownCast (theAlert)->GetShape();
+  Handle(Message_Attribute) anAttribute = anExtAlert->Attribute();
+  if (anAttribute.IsNull())
+    return TCollection_AsciiString();
+
+  TopoDS_Shape aShape;
+  if (anAttribute->IsKind (STANDARD_TYPE (TopoDS_AlertAttribute)))
+    aShape = Handle(TopoDS_AlertAttribute)::DownCast (anAttribute)->GetShape();
 
   if (aShape.IsNull())
     return TCollection_AsciiString();
@@ -98,11 +113,19 @@ TCollection_AsciiString MessageModel_Tools::GetShapeTypeAlertInfo (const Handle(
 // =======================================================================
 TCollection_AsciiString MessageModel_Tools::GetStandardTypeAlertInfo (const Handle(Message_Alert)& theAlert)
 {
+  Handle(Message_AlertExtended) anExtAlert = Handle(Message_AlertExtended)::DownCast (theAlert);
+  if (anExtAlert.IsNull())
+    return TCollection_AsciiString();
+
+  Handle(Message_Attribute) anAttribute = anExtAlert->Attribute();
+  if (anAttribute.IsNull())
+    return TCollection_AsciiString();
+
   Handle(Standard_Transient) aPointer;
-  if (theAlert->IsKind (STANDARD_TYPE (TopoDS_AlertWithShape)))
-    aPointer = Handle(TopoDS_AlertWithShape)::DownCast (theAlert)->GetShape().TShape();
-  else if (theAlert->IsKind (STANDARD_TYPE (Message_AttributeObject)))
-    aPointer = Handle(Message_AttributeObject)::DownCast (theAlert)->GetObject();
+  if (anAttribute->IsKind (STANDARD_TYPE (TopoDS_AlertAttribute)))
+    aPointer = Handle(TopoDS_AlertAttribute)::DownCast (anAttribute)->GetShape().TShape();
+  else if (anAttribute->IsKind (STANDARD_TYPE (Message_AttributeObject)))
+    aPointer = Handle(Message_AttributeObject)::DownCast (anAttribute)->GetObject();
 
   if (aPointer.IsNull())
     return TCollection_AsciiString();
@@ -117,8 +140,6 @@ TCollection_AsciiString MessageModel_Tools::GetStandardTypeAlertInfo (const Hand
 void MessageModel_Tools::GetPropertyTableValues (const Handle(Message_Alert)& theAlert,
                                                  QList<ViewControl_TableModelValues*>& theTableValues)
 {
-  ViewControl_TableModelValues* aTableValues = 0;
-
   Handle(Message_AlertExtended) anExtendedAlert = Handle(Message_AlertExtended)::DownCast(theAlert);
   if (anExtendedAlert.IsNull())
     return;
@@ -127,23 +148,17 @@ void MessageModel_Tools::GetPropertyTableValues (const Handle(Message_Alert)& th
   if (anAttribute.IsNull())
     return;
 
-  if (anAttribute->IsKind (STANDARD_TYPE (Message_AttributeVectorOfReal)))
-  {
-    int aSectionSize = 60;
-    aTableValues = new MessageModel_TableModelRealValues (anAttribute, aSectionSize);
-    theTableValues.append (aTableValues);
-  }
-  else if (anAttribute->IsKind (STANDARD_TYPE (Message_AttributeVectorOfRealVec3)))
+  if (anAttribute->IsKind (STANDARD_TYPE (Message_AttributeVectorOfValues)))
   {
-    int aSectionSize = 160;
-    aTableValues = new MessageModel_TableModelRealVec3Values (anAttribute, aSectionSize);
+    int aSectionSize = 200;
+    ViewControl_TableModelValues* aTableValues = new MessageModel_TableModelValues (anAttribute, aSectionSize);
     theTableValues.append (aTableValues);
   }
   else
   {
     if (!anAttribute->GetDescription().IsEmpty())
     {
-      aTableValues = new ViewControl_TableModelValues();
+      ViewControl_TableModelValuesDefault* aTableValues = new ViewControl_TableModelValuesDefault();
       QList<TreeModel_HeaderSection> aHeaderValues;
       QVector<QVariant> aValues;
       aHeaderValues << TreeModel_HeaderSection ("Description", -2);
@@ -164,76 +179,3 @@ void MessageModel_Tools::GetPropertyTableValues (const Handle(Message_Alert)& th
     }
   }
 }
-
-// =======================================================================
-// function : BuildShape
-// purpose :
-// =======================================================================
-TopoDS_Shape MessageModel_Tools::BuildShape (const Handle(Message_Alert)& theAlert, QList<int> theSelectedIndices, ViewControl_Table* theTable)
-{
-  if (theAlert.IsNull())
-    return TopoDS_Shape();
-
-  BRep_Builder aBuilder;
-  TopoDS_Compound aCompound;
-  aBuilder.MakeCompound(aCompound);
-
-  if (theAlert->IsKind (STANDARD_TYPE (Message_AttributeVectorOfReal)))
-  {
-    Handle(Message_AttributeVectorOfReal) aValuesAlert = Handle(Message_AttributeVectorOfReal)::DownCast (theAlert);
-    NCollection_Vector<double> aValues = aValuesAlert->GetValues();
-    int aValuesSize = aValues.Size();
-
-    gp_Pnt aPreviousPoint(0, 0, 0), aCurrentPoint(0, 0, 0);
-    double aXStep = theTable->GetProperty()->GetXStep();
-    if (aXStep < 0)
-      aXStep = 1;
-    double aCurrentXValue = 0;
-    for (QList<int>::const_iterator anIt = theSelectedIndices.begin(); anIt != theSelectedIndices.end(); anIt++)
-    {
-      if (*anIt >= aValuesSize)
-        continue;
-
-      if (aCurrentXValue == 0)
-      { //just define the previous point
-        aPreviousPoint.SetX (aCurrentXValue);
-        aPreviousPoint.SetY (aValues.Value (*anIt));
-        aCurrentXValue = aCurrentXValue + aXStep;
-        continue;
-      }
-      aCurrentPoint.SetX (aCurrentXValue);
-      aCurrentPoint.SetY (aValues.Value (*anIt));
-      if (aPreviousPoint.Distance (aCurrentPoint) < Precision::Confusion())
-        continue;
-
-      TopoDS_Edge anEdge = BRepBuilderAPI_MakeEdge (aPreviousPoint, aCurrentPoint);
-      aBuilder.Add (aCompound, anEdge);
-      aPreviousPoint = aCurrentPoint;
-      aCurrentXValue = aCurrentXValue + aXStep;
-    }
-  }
-  else if (theAlert->IsKind (STANDARD_TYPE (Message_AttributeVectorOfRealVec3)))
-  {
-    Handle(Message_AttributeVectorOfRealVec3) aValuesAlert = Handle(Message_AttributeVectorOfRealVec3)::DownCast (theAlert);
-    NCollection_Vector<NCollection_Vec3<double>> aValues = aValuesAlert->GetValues();
-    int aValuesSize = aValues.Size();
-
-    gp_Pnt aCurrentPoint(0, 0, 0);
-    NCollection_Vec3<double> aValue;
-    for (QList<int>::const_iterator anIt = theSelectedIndices.begin(); anIt != theSelectedIndices.end(); anIt++)
-    {
-      if (*anIt >= aValuesSize)
-        continue;
-
-      aValue = aValues.Value (*anIt);
-      aCurrentPoint.SetX (aValue.x());
-      aCurrentPoint.SetY (aValue.y());
-      aCurrentPoint.SetZ (aValue.z());
-
-      TopoDS_Vertex aVertex = BRepBuilderAPI_MakeVertex (aCurrentPoint);
-      aBuilder.Add (aCompound, aVertex);
-    }
-  }
-
-  return aCompound;
-}
index 58c86a601f817e60fc44a980d01d2020cfe124b4..2b63be0061edd7cea084dbfd5d45717a2e9b6272 100644 (file)
@@ -22,8 +22,9 @@
 #include <Standard_Transient.hxx>
 #include <TopoDS_Shape.hxx>
 
+#include <Standard_WarningsDisable.hxx>
 #include <QList>
-//#include <QColor>
+#include <Standard_WarningsRestore.hxx>
 
 class Message_Alert;
 class ViewControl_TableModelValues;
@@ -63,13 +64,6 @@ public:
   //! \param theTableValue container of values
   Standard_EXPORT static void GetPropertyTableValues (const Handle(Message_Alert)& theAlert,
                                                       QList<ViewControl_TableModelValues*>& theTableValues);
-
-  //! Creates TopoDS_Compound with TopoDS_Edge/Vertex on alert data
-  //! \param theAlert a message alert
-  //! \parm theSelectedIndices a container of indices
-  //! \param theTableView source view
-  Standard_EXPORT TopoDS_Shape static BuildShape (const Handle(Message_Alert)& theAlert, QList<int> aSelectedIndices,
-                                                  ViewControl_Table* theTableView);
 };
 
 #endif
index 84775c4186b20d11724dc7fd35c986fbb3af5391..7a96f35ff9f9dd3461e8a1392f6819f7869b5827 100644 (file)
@@ -56,6 +56,19 @@ void MessageModel_TreeModel::createRootItem (const int theColumnId)
       m_pRootItem = myRootItems[0];
 }
 
+// =======================================================================
+// function : HasShape
+// purpose :
+// =======================================================================
+Standard_Boolean MessageModel_TreeModel::HasReport (const Handle(Message_Report)& theReport)
+{
+  if (columnCount() == 0)
+    return Standard_False;
+
+  MessageModel_ItemRootPtr aRootItem = itemDynamicCast<MessageModel_ItemRoot> (RootItem (0));
+  return aRootItem && aRootItem->HasReport (theReport);
+}
+
 // =======================================================================
 // function : AddShape
 // purpose :
index 0769fd44733c55bdb16a80bf24310ca4fa2df788..df32bebb39a57cc9e4f0a5268746587ca6758709 100644 (file)
 #include <Message_Report.hxx>
 #include <inspector/TreeModel_ModelBase.hxx>
 
+#include <Standard_WarningsDisable.hxx>
 #include <QMap>
 #include <QObject>
+#include <Standard_WarningsRestore.hxx>
 
 class MessageModel_TreeModel;
 
@@ -39,6 +41,11 @@ public:
   //! Destructor
   virtual ~MessageModel_TreeModel() Standard_OVERRIDE {};
 
+  //! Returns true if parameter report was added into the model
+  //! \param theReport a report instance
+  //! \return boolen value
+  Standard_EXPORT Standard_Boolean HasReport (const Handle(Message_Report)& theReport);
+
   //! Add shape, append it to the model root item
   //! \param theReport a report instance
   //! \param theReportDescription an additional report information
diff --git a/tools/MessageModel/icons/item_vectorOfValues.png b/tools/MessageModel/icons/item_vectorOfValues.png
new file mode 100644 (file)
index 0000000..7181f94
Binary files /dev/null and b/tools/MessageModel/icons/item_vectorOfValues.png differ
diff --git a/tools/MessageModel/icons/item_vectorOfValues.svg b/tools/MessageModel/icons/item_vectorOfValues.svg
new file mode 100644 (file)
index 0000000..38b1032
--- /dev/null
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:osb="http://www.openswatchbook.org/uri/2009/osb"
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="20"
+   height="20"
+   viewBox="0 0 5.2916664 5.2916666"
+   version="1.1"
+   id="svg8"
+   inkscape:version="0.92.2 (5c3e80d, 2017-08-06)"
+   sodipodi:docname="item_vectorOfReal.svg"
+   inkscape:export-filename="D:\OCCT\master_CR29451_1\tools\MessageModel\icons\item_vectorOfRealVec3.png"
+   inkscape:export-xdpi="96"
+   inkscape:export-ydpi="96">
+  <defs
+     id="defs2">
+    <linearGradient
+       id="linearGradient4578"
+       osb:paint="solid">
+      <stop
+         style="stop-color:#000000;stop-opacity:1;"
+         offset="0"
+         id="stop4576" />
+    </linearGradient>
+    <inkscape:perspective
+       sodipodi:type="inkscape:persp3d"
+       inkscape:vp_x="-2.6544163 : -0.28690906 : 1"
+       inkscape:vp_y="0 : 1028.295 : 0"
+       inkscape:vp_z="9.504499 : -1.1228559 : 1"
+       inkscape:persp3d-origin="2.7661607 : -1.3768436 : 1"
+       id="perspective3711" />
+  </defs>
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="15.839192"
+     inkscape:cx="-10.548151"
+     inkscape:cy="10.279721"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="false"
+     fit-margin-top="0"
+     fit-margin-left="0"
+     fit-margin-right="0"
+     fit-margin-bottom="0"
+     inkscape:window-width="1446"
+     inkscape:window-height="838"
+     inkscape:window-x="1733"
+     inkscape:window-y="67"
+     inkscape:window-maximized="0"
+     units="px" />
+  <metadata
+     id="metadata5">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title />
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1"
+     transform="translate(71.966667,-93.642022)">
+    <rect
+       id="rect3769"
+       width="4.660512"
+       height="4.443356"
+       x="-71.632576"
+       y="94.056023"
+       style="opacity:1;fill:none;fill-opacity:1;stroke:#8c8c8c;stroke-width:0.26458332;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+    <rect
+       id="rect3769-3"
+       width="4.7041783"
+       height="2.2966287"
+       x="-71.676239"
+       y="96.202751"
+       style="opacity:1;fill:none;fill-opacity:1;stroke:#8c8c8c;stroke-width:0.19110738;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+    <rect
+       id="rect3769-9"
+       width="2.3560426"
+       height="4.4502382"
+       x="-71.617508"
+       y="94.071091"
+       style="opacity:1;fill:none;fill-opacity:1;stroke:#8c8c8c;stroke-width:0.18826659;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+  </g>
+</svg>
index db75105fc286a15d6243408dd8ff45e4c175d69f..8b4207b8fb74699b31d776b1e88db6736dedae27 100644 (file)
@@ -17,8 +17,7 @@
 #include <inspector/MessageModel_ItemAlert.hxx>
 
 #include <Message_AlertExtended.hxx>
-#include <Message_AttributeVectorOfReal.hxx>
-#include <Message_AttributeVectorOfRealVec3.hxx>
+#include <Message_AttributeVectorOfValues.hxx>
 
 #include <TopoDS_AlertAttribute.hxx>
 
@@ -125,7 +124,7 @@ bool MessageView_VisibilityState::hasTableValues (const QModelIndex& theIndex) c
   if (anAlert.IsNull())
     return false;
 
-  if (anAlert->IsKind (STANDARD_TYPE (Message_AttributeVectorOfReal)) || anAlert->IsKind (STANDARD_TYPE (Message_AttributeVectorOfRealVec3)))
+  if (anAlert->IsKind (STANDARD_TYPE (Message_AttributeVectorOfValues)))
     return true;
 
   return false;
index 1f778f488e9afb7eb21c6a5db095bcac43ccb47e..6f78e0ff91bc23c952f3263ebdd078dd6ec4bd1a 100644 (file)
@@ -29,7 +29,6 @@
 
 #include <inspector/ViewControl_PropertyView.hxx>
 #include <inspector/ViewControl_TableModelValues.hxx>
-#include <inspector/ViewControl_TableProperty.hxx>
 #include <inspector/ViewControl_TreeView.hxx>
 
 #include <inspector/View_Tools.hxx>
@@ -112,6 +111,7 @@ MessageView_Window::MessageView_Window (QWidget* theParent)
   ((ViewControl_TreeView*)myTreeView)->SetPredefinedSize (QSize (MESSAGEVIEW_DEFAULT_TREE_VIEW_WIDTH,
                                                                  MESSAGEVIEW_DEFAULT_TREE_VIEW_HEIGHT));
   MessageModel_TreeModel* aModel = new MessageModel_TreeModel (myTreeView);
+  //aModel->SetReversed (Standard_True);
   for (int i = 5; i <= 7; i++) // hide shape parameters columns
   {
     TreeModel_HeaderSection anItem = aModel->GetHeaderItem (i);
@@ -217,7 +217,6 @@ void MessageView_Window::GetPreferences (TInspectorAPI_PreferencesDataMap& theIt
   QMap<QString, QString> anItems;
   TreeModel_Tools::SaveState (myTreeView, anItems);
   View_Tools::SaveState (myViewWindow, anItems);
-  ViewControl_PropertyView::SaveState (myPropertyView, anItems);
 
   for (QMap<QString, QString>::const_iterator anItemsIt = anItems.begin(); anItemsIt != anItems.end(); anItemsIt++)
     theItem.Bind (anItemsIt.key().toStdString().c_str(), anItemsIt.value().toStdString().c_str());
@@ -243,8 +242,6 @@ void MessageView_Window::SetPreferences (const TInspectorAPI_PreferencesDataMap&
       continue;
     else if (View_Tools::RestoreState (myViewWindow, anItemIt.Key().ToCString(), anItemIt.Value().ToCString()))
       continue;
-    else if (ViewControl_PropertyView::RestoreState (myPropertyView, anItemIt.Key().ToCString(), anItemIt.Value().ToCString()))
-      continue;
   }
 }
 
@@ -274,6 +271,13 @@ void MessageView_Window::UpdateContent()
     myParameters->SetFileNames (aName, aNames);
     isUpdated = true;
   }
+  Handle(Message_Report) aDefaultReport = Message_Report::CurrentReport( Standard_False);
+  MessageModel_TreeModel* aViewModel = dynamic_cast<MessageModel_TreeModel*> (myTreeView->model());
+  if (!aDefaultReport.IsNull() && !aViewModel->HasReport (aDefaultReport))
+  {
+    aDefaultReport->SetCallBack (myCallBack);
+    addReport (aDefaultReport);
+  }
   // reload report of selected item
   onReloadReport();
 
@@ -484,7 +488,7 @@ void MessageView_Window::onPropertyViewSelectionChanged()
     return;
   }
 
-  TopoDS_Shape aShapeOfSelection = MessageModel_Tools::BuildShape (anAlertItem->GetAlert(), aSelectedIndices[0], aFirstTable);
+  /*TopoDS_Shape aShapeOfSelection = MessageModel_Tools::BuildShape (anAlertItem->GetAlert(), aSelectedIndices[0], aFirstTable);
   if (aShapeOfSelection.IsNull())
     return;
 
@@ -504,7 +508,7 @@ void MessageView_Window::onPropertyViewSelectionChanged()
   {
     anAlertItem->SetCustomShape (aShapeOfSelection);
     aVisibilityState->SetVisible (anIndex, true);
-  }
+  }*/
 }
 
 // =======================================================================
index 2eeab8f369def8c80428efd6c31210a6423d1db7..7bd7cdf3dfa6934cf46e3e49e02d4f9364798ec6 100644 (file)
@@ -6,6 +6,8 @@ TreeModel_ContextMenu.hxx
 TreeModel_HeaderSection.hxx
 TreeModel_ItemBase.cxx
 TreeModel_ItemBase.hxx
+TreeModel_ItemProperties.cxx
+TreeModel_ItemProperties.hxx
 TreeModel_ItemRole.hxx
 TreeModel_ModelBase.cxx
 TreeModel_ModelBase.hxx
index 82ba6dc360852223d811ddf764d788c6780848ab..b6c5e5668b8b390710e42d6d86ab7dc44d9fc57b 100644 (file)
@@ -19,6 +19,7 @@
 #include <Standard.hxx>
 #include <Standard_Macro.hxx>
 #include <inspector/TreeModel_ItemRole.hxx>
+#include <inspector/TreeModel_ItemProperties.hxx>
 
 #include <Standard_WarningsDisable.hxx>
 #include <QExplicitlySharedDataPointer>
@@ -127,6 +128,12 @@ public:
   //! \return the row count
   int rowCount() const { return cachedValue(TreeModel_ItemRole_RowCountRole).toInt(); }
 
+  //! Sets item table properties builder
+  void SetProperties (const Handle(TreeModel_ItemProperties)& theProperties) { myProperties = theProperties; }
+
+  //! Returns item table properties builder
+  Handle(TreeModel_ItemProperties) GetProperties() const { return myProperties; }
+
 protected:
 
   //! \param theParent the parent item
@@ -168,6 +175,8 @@ private:
   int m_iRow;          //!< the item row position in the parent item
   int m_iColumn;       //!< the item column position in the parent item
   bool m_bInitialized; //!< the state whether the item content is already initialized
+
+  Handle(TreeModel_ItemProperties) myProperties; //!< item properties
 };
 
 //! Returns an explicitly shared pointer to the pointer held by other, using a
diff --git a/tools/TreeModel/TreeModel_ItemProperties.cxx b/tools/TreeModel/TreeModel_ItemProperties.cxx
new file mode 100644 (file)
index 0000000..628ee67
--- /dev/null
@@ -0,0 +1,18 @@
+// 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/TreeModel_ItemProperties.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(TreeModel_ItemProperties, Standard_Transient)
diff --git a/tools/TreeModel/TreeModel_ItemProperties.hxx b/tools/TreeModel/TreeModel_ItemProperties.hxx
new file mode 100644 (file)
index 0000000..d9a05c5
--- /dev/null
@@ -0,0 +1,86 @@
+// 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 TreeModel_ItemProperties_H
+#define TreeModel_ItemProperties_H
+
+#include <Standard.hxx>
+#include <Standard_Handle.hxx>
+#include <Standard_Macro.hxx>
+#include <Standard_Type.hxx>
+#include <Standard_Transient.hxx>
+
+#include <inspector/ViewControl_EditType.hxx>
+
+#include <Standard_WarningsDisable.hxx>
+#include <QAbstractTableModel>
+#include <QColor>
+#include <QList>
+#include <QModelIndexList>
+#include <QVariant>
+#include <Standard_WarningsRestore.hxx>
+
+DEFINE_STANDARD_HANDLE (TreeModel_ItemProperties, Standard_Transient)
+
+//! \class TreeModel_ItemProperties
+//! Class to manipulate properties of tree item. The properties are organized in table structure
+class TreeModel_ItemProperties : public Standard_Transient
+{
+public:
+  //! Constructor
+  TreeModel_ItemProperties() {}
+
+  //! Destructor
+  ~TreeModel_ItemProperties() {}
+
+  //! Returns number of table rows
+  //! \return an integer value
+  virtual int GetTableColumnCount() const { return 2; }
+
+  //! Returns number of table rows
+  //! \return an integer value
+  virtual int GetTableRowCount() const { return 0; }
+
+  //! Returns type of edit control for the model index. By default, it is an empty control
+  //! \param theRow a model index row
+  //! \param theColumn a model index column
+  //! \return edit type
+  virtual ViewControl_EditType GetTableEditType (const int theRow, const int theColumn) const
+    { (void)theRow; (void)theColumn; return ViewControl_EditType_None; }
+
+  //! 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> 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(); }
+
+  //! Sets the value into the table cell. Only 1st column value might be modified.
+  //! \param theRow a model index row
+  //! \param theColumn a model index column
+  //! \param theValue a new cell value
+  virtual bool SetTableData (const int theRow, const int theColumn, const QVariant& theValue)
+    { (void)theRow; (void)theColumn; (void)theValue; return false; }
+
+  DEFINE_STANDARD_RTTIEXT (TreeModel_ItemProperties, Standard_Transient)
+};
+
+#endif
\ No newline at end of file
index abc31ab1b03ca435e514d777db00abbea945d2eb..2840fc829d33b53c4214b644d8b7dac27e9fe94d 100644 (file)
@@ -31,6 +31,8 @@ TreeModel_ModelBase::TreeModel_ModelBase (QObject* theParent)
 : QAbstractItemModel (theParent), m_pRootItem (0), m_pUseVisibilityColumn (false),
   myVisibilityState (0)
 {
+  myVisibleIcon = QIcon (":/icons/item_visible.png");
+  myInvisibleIcon = QIcon (":/icons/item_invisible.png");
 }
 
 // =======================================================================
@@ -104,14 +106,18 @@ QVariant TreeModel_ModelBase::data (const QModelIndex& theIndex, int theRole) co
     if (!myVisibilityState || !myVisibilityState->CanBeVisible (theIndex))
       return QVariant();
 
-    QVariant aValue = QIcon (myVisibilityState->IsVisible (theIndex) ? ":/icons/item_visible.png"
-                                                                     : ":/icons/item_invisible.png");
+    QVariant aValue = myVisibilityState->IsVisible (theIndex) ? myVisibleIcon : myInvisibleIcon;
     anItem->SetCustomData (aValue, theRole);
     return aValue;
   }
 
   TreeModel_ItemBasePtr anItem = GetItemByIndex (theIndex);
-  return anItem->data (theIndex, theRole);
+  QVariant anItemData = anItem->data (theIndex, theRole);
+
+  if (anItemData.isNull() && theRole == Qt::BackgroundRole && myHighlightedIndices.contains (theIndex))
+    anItemData = TreeModel_Tools::LightHighlightColor();
+
+  return anItemData;
 }
 
 // =======================================================================
index 61f0073068b6af18ca7412dc770476abe9ebf570..b2eb8bc23b56b73be76e04040c0313f38707e3d3 100644 (file)
@@ -84,6 +84,13 @@ public:
   //!< \return the checker interface
   TreeModel_VisibilityState* GetVisibilityState () const { return myVisibilityState; }
 
+  //! Returns true if the tree view model contains highlighted items. This highlight is set manually.
+  bool HasHighlighted() { return !myHighlightedIndices.isEmpty(); }
+
+  //! Sets items of the indices highlighted in the model.
+  //! \param theIndices a list of tree model indices
+  void SetHighlighted (const QModelIndexList& theIndices = QModelIndexList()) { myHighlightedIndices = theIndices; }
+
   //! Returns the index of the item in the model specified by the given row, column and parent index.
   //! Saves an internal pointer at the createIndex. This pointer is a shared pointer to the class,
   //! that realizes a base item interface. If the parent is invalid, a root item is used, otherwise a new item
@@ -187,6 +194,10 @@ protected:
 
   bool m_pUseVisibilityColumn; //!< the state whether column=0 is reserved for Visibility state
   TreeModel_VisibilityState* myVisibilityState; //!< the interface of item visibility
+  QIcon myVisibleIcon; //!< icon of visible state
+  QIcon myInvisibleIcon; //!< icon of invisible state
+
+  QModelIndexList myHighlightedIndices; //!< tree model indices that should be visualized as highlighted
 };
 
 #endif
index c1b217b529836955a55e08c3d6597d1c5e33730a..7c89df6902c9eab08209bbd6b00c1ed3c79f4e52 100644 (file)
@@ -211,3 +211,53 @@ QString TreeModel_Tools::CutString (const QString& theText, const int theWidth,
 
   return aLength < theText.length() ? theText.mid (0, aLength) + theTail : theText;
 }
+
+// =======================================================================
+// function : LightHighlightColor
+// purpose :
+// =======================================================================
+QColor TreeModel_Tools::LightHighlightColor()
+{
+  QWidget aWidget;
+  QPalette aPalette = aWidget.palette();
+  return aPalette.highlight().color().lighter();
+}
+
+// =======================================================================
+// function : SetExpandedTo
+// purpose :
+// =======================================================================
+void TreeModel_Tools::SetExpandedTo (QTreeView* theTreeView, const QModelIndex& theIndex)
+{
+  QAbstractItemModel* aModel = theTreeView->model();
+
+  QModelIndex aParent = aModel->parent (theIndex);
+  while (aParent.isValid())
+  {
+    theTreeView->setExpanded (aParent, true);
+    aParent = aModel->parent (aParent);
+  }
+}
+
+// =======================================================================
+// function : setExpanded
+// purpose :
+// =======================================================================
+void TreeModel_Tools::SetExpanded (QTreeView* theTreeView, const QModelIndex& theIndex, const bool isExpanded,
+                                   int& theLevels)
+{
+  bool isToExpand = theLevels == -1 || theLevels > 0;
+  if (!isToExpand)
+    return;
+
+  theTreeView->setExpanded (theIndex, isExpanded);
+  if (theLevels != -1)
+    theLevels--;
+
+  QAbstractItemModel* aModel = theTreeView->model();
+  for (int aRowId = 0, aRows = aModel->rowCount (theIndex); aRowId < aRows; aRowId++)
+  {
+    int aLevels = theLevels;
+    SetExpanded (theTreeView, aModel->index (aRowId, 0, theIndex), isExpanded, aLevels);
+  }
+}
index 39047a2f03c16fb497eafc3556977bbd3ca9c2a1..1f24f94ec1eeeb62a70a3c9be013812138a99592 100644 (file)
@@ -22,6 +22,7 @@
 #include <Standard_WarningsDisable.hxx>
 #include <QApplication>
 #include <QByteArray>
+#include <QColor>
 #include <QMap>
 #include <QString>
 #include <QStyle>
@@ -90,6 +91,24 @@ public:
   //! \param theWidth width value, if -1, default value is used
   //! \param theTail symbols added to the end of the cut string
   Standard_EXPORT static QString CutString (const QString& theText, const int theWidth = -1, const QString& theTail = "...");
+
+  //! Returns light highlight color
+  //! \returns Qt color
+  Standard_EXPORT static QColor LightHighlightColor();
+
+  //! Makes the view expanded fron the root till the index
+  Standard_EXPORT static void SetExpandedTo (QTreeView* theTreeView, const QModelIndex& theIndex);
+
+  //! Recursive items expanding in tree view staring from the index
+  //! \param theTreeView an OCAF tree view
+  //! \param theParentIndex an index which children should be expanded
+  //! \param isExpanded a boolean state if the item should be expanded or collapsed
+  //! \param theLevels a number of levels to be expanded, or -1 for all levels
+  Standard_EXPORT static void SetExpanded (QTreeView* theTreeView,
+                                           const QModelIndex& theIndex,
+                                           const bool isExpanded,
+                                           int& theLevels);
+
 };
 
 #endif
index 5a32b115f3c193693fc3c51bc960817708053846..bac85b01e8b2018fab532b108ff11c9a209d108c 100644 (file)
@@ -17,7 +17,6 @@
 
 #include <inspector/ViewControl_Pane.hxx>
 #include <inspector/ViewControl_TableModel.hxx>
-#include <inspector/ViewControl_TableModelFilter.hxx>
 #include <inspector/VInspector_Tools.hxx>
 
 #include <inspector/ViewControl_PaneCreator.hxx>
@@ -42,10 +41,6 @@ VInspector_TableModelValues::VInspector_TableModelValues (const TreeModel_ItemBa
 
   SetHeaderVisible(Qt::Horizontal, Standard_False);
   SetHeaderVisible(Qt::Vertical, Standard_False);
-
-  SetUseTableSeparateSize (false);
-  SetUseTableProperties (false);
-  SetUseTablePropertiesXStep (false, -1);
 }
 
 // =======================================================================
@@ -142,31 +137,6 @@ Qt::ItemFlags VInspector_TableModelValues::Flags (const QModelIndex& theIndex) c
   return aFlags;
 }
 
-// =======================================================================
-// function : GetRangeValues
-// purpose :
-// =======================================================================
-
-int VInspector_TableModelValues::GetValuesCount () const
-{
-  VInspector_ItemBasePtr anItem = GetItem();
-
-  int aRowCount = anItem->GetTableRowCount();
-  Handle(Standard_Transient) anObject = anItem->GetObject();
-  if (anObject.IsNull())
-    return aRowCount * 2;
-
-  for (NCollection_List<Handle(ViewControl_PaneCreator)>::Iterator anIterator (myCreators); anIterator.More(); anIterator.Next())
-  {
-    Handle(ViewControl_PaneCreator) aCreator = anIterator.Value();
-    ViewControl_Pane* aPane = aCreator->GetPane (anObject->DynamicType()->Name());
-    if (!aPane)
-      continue;
-    aRowCount += aPane->GetTableRowCount (anObject);
-  }
-  return aRowCount * 2;
-}
-
 // =======================================================================
 // function : GetEditType
 // purpose :
index bb5adc26a814d450d373c651697e54dd234e7d2c..fcc68c3cf4a41bef581e14736cd6f34ac313849c 100644 (file)
@@ -17,7 +17,6 @@
 #define VInspector_TableModelValues_H
 
 #include <inspector/ViewControl_TableModelValues.hxx>
-#include <inspector/ViewControl_TableModelFilter.hxx>
 #include <inspector/VInspector_ItemBase.hxx>
 #include <inspector/TreeModel_ItemBase.hxx>
 
@@ -66,11 +65,6 @@ public:
   //! \return flags
   virtual Qt::ItemFlags Flags (const QModelIndex& theIndex) const Standard_OVERRIDE;
 
-  //! 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
-  virtual int GetValuesCount () 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
index fea2316f18d7bfe09aeb0a2e00f9453ce151ae20..8efb5920cb9a3ad7d6d25bbebc749fdf3b7ffa35 100644 (file)
@@ -16,12 +16,10 @@ ViewControl_TableItemDelegate.cxx
 ViewControl_TableItemDelegate.hxx
 ViewControl_TableModel.cxx
 ViewControl_TableModel.hxx
-ViewControl_TableModelFilter.cxx
-ViewControl_TableModelFilter.hxx
 ViewControl_TableModelValues.cxx
 ViewControl_TableModelValues.hxx
-ViewControl_TableProperty.cxx
-ViewControl_TableProperty.hxx
+ViewControl_TableModelValuesDefault.cxx
+ViewControl_TableModelValuesDefault.hxx
 ViewControl_Tools.cxx
 ViewControl_Tools.hxx
 ViewControl_TreeView.hxx
index 5129c89d960761667952089758b145f29ce304ab..efaf5687949348efe4cb7240494c3abd3612d9fc 100644 (file)
@@ -20,7 +20,7 @@
 #include <inspector/ViewControl_Tools.hxx>
 #include <inspector/TreeModel_Tools.hxx>
 
-#include <Quantity.hxx>
+//#include <Quantity.hxx>
 
 #include <Standard_WarningsDisable.hxx>
 #include <QAbstractTableModel>
@@ -85,7 +85,7 @@ public:
           return QVariant ("Name");
         Quantity_NameOfColor aColorName;
         if (ViewControl_ColorSelector::IsExactColorName(myColor, aColorName))
-          return Quantity::NameOfColorToString (aColorName);
+          return "";//Quantity::NameOfColorToString (aColorName);
       }
       break;
       case 2: return isFirstColumn ? QVariant ("Red") : ViewControl_Tools::ToVariant (myColor.GetRGB().Red());
@@ -93,7 +93,7 @@ public:
       case 4: return isFirstColumn ? QVariant ("Blue") : ViewControl_Tools::ToVariant (myColor.GetRGB().Blue());
       case 5: return isFirstColumn ? QVariant ("Alpha") : ViewControl_Tools::ToVariant (myColor.Alpha());
       case 6: return isFirstColumn ? QVariant ("Near Name") 
-                                   : Quantity::NameOfColorToString (myColor.GetRGB().Name());
+                                   : "";//Quantity::NameOfColorToString (myColor.GetRGB().Name());
     }
     return QVariant();
   }
@@ -236,8 +236,8 @@ public:
       return QVariant();
 
     if (theRole == Qt::ToolTipRole)
-      return QString("%1 (%2)").arg(Quantity::NameOfColorToString (aNameOfColor))
-                               .arg (ViewControl_ColorSelector::ColorToString (Quantity_Color (aNameOfColor)));
+      return "";//QString("%1 (%2)").arg(Quantity::NameOfColorToString (aNameOfColor))
+                //               .arg (ViewControl_ColorSelector::ColorToString (Quantity_Color (aNameOfColor)));
     return QVariant();
   }
 
index 99e2229ba3e53a162331cbc631a3b02a1c05d85b..2a095c378a2805f267f5f335ed53c177b5897ba1 100644 (file)
@@ -26,7 +26,8 @@ enum ViewControl_EditType
   ViewControl_EditType_Double, //!< line edit widget used double validator
   ViewControl_EditType_Line, //!< line edit widget
   ViewControl_EditType_Spin, //!< spin box widget
-  ViewControl_EditType_DoubleVec3 //!< control to enter three double values
+  ViewControl_EditType_DoubleVec3, //!< control to enter three double values
+  ViewControl_EditType_DoAction //!< control to perform the row action
 };
 
 #endif
index e09527e53b29cf0a0443e1e1a2e51d1f1053d485..f2f20c92132b678ea6afdd8f0d59db754b22d321 100644 (file)
@@ -198,13 +198,6 @@ ViewControl_Table* ViewControl_PropertyView::findTable (const int theTableId, co
   connect (aTable->GetTableView()->selectionModel(),
           SIGNAL (selectionChanged (const QItemSelection&, const QItemSelection&)),
           this, SLOT(onTableSelectionChanged (const QItemSelection&, const QItemSelection&)));
-  connect (aTable->GetProperty(), SIGNAL (propertyChanged()), this, SIGNAL (propertyViewSelectionChanged()));
-
-  if (myXStepValues.size() > theTableId)
-    aTable->GetProperty()->SetXStep (myXStepValues[theTableId]);
-
-  if (myDivideValues.size() > theTableId)
-    aTable->GetProperty()->SetDivideSize (myDivideValues[theTableId]);
 
   myTableWidgetLayout->addWidget (aTable->GetControl());
 
@@ -224,58 +217,3 @@ void ViewControl_PropertyView::onTableSelectionChanged (const QItemSelection&, c
 
   emit propertyViewSelectionChanged();
 }
-
-// =======================================================================
-// function : SaveState
-// purpose :
-// =======================================================================
-void ViewControl_PropertyView::SaveState (ViewControl_PropertyView* theView,
-                                          QMap<QString, QString>& theItems,
-                                          const QString& thePrefix)
-{
-  QList<ViewControl_Table*> anActiveTables;
-  theView->GetActiveTables(anActiveTables);
-
-  if (anActiveTables.size() == 0)
-    return;
-
-  anActiveTables[0]->GetProperty()->GetXStep();
-  QStringList aDivideSizes, aXSteps;
-  for (int i = 0; i < anActiveTables.size(); i++)
-  {
-    aXSteps.append (QString::number (anActiveTables[i]->GetProperty()->GetXStep()));
-    aDivideSizes.append (QString::number (anActiveTables[i]->GetProperty()->GetDivideSize()));
-  }
-  theItems[thePrefix + "property_view_xstep_value"] = aXSteps.join (",");
-  theItems[thePrefix + "property_view_divide_value"] = aDivideSizes.join (",");
-}
-
-// =======================================================================
-// function : RestoreState
-// purpose :
-// =======================================================================
-bool ViewControl_PropertyView::RestoreState (ViewControl_PropertyView* theView,
-                                             const QString& theKey,
-                                             const QString& theValue,
-                                             const QString& thePrefix)
-{
-  if (theKey == thePrefix + "property_view_xstep_value")
-  {
-    QList<double> aXStepValues;
-    QStringList aValues = theValue.split (",", QString::SkipEmptyParts);
-    for (int aValueId = 0; aValueId < aValues.size(); aValueId++)
-      aXStepValues.append (aValues.at (aValueId).toDouble());
-    theView->SetXSteps (aXStepValues);
-  }
-  else if (theKey == thePrefix + "property_view_divide_value")
-  {
-    QList<int> aDivideValues;
-    QStringList aValues = theValue.split (",", QString::SkipEmptyParts);
-    for (int aValueId = 0; aValueId < aValues.size(); aValueId++)
-      aDivideValues.append (aValues.at (aValueId).toInt());
-    theView->SetDivideValues (aDivideValues);
-  }
-  else
-    return false;
-  return true;
-}
index 1a82c21817c8fed01f779c19ab52a2b56517a329..2cb6f753772420d0a846d48a73009793281a934d 100644 (file)
@@ -68,31 +68,6 @@ public:
   //! Clears selection in active tables
   Standard_EXPORT void ClearActiveTablesSelection();
 
-  //! Sets X steps values for table properties
-  //! \param container of values
-  void SetXSteps (const QList<double>& theValues) { myXStepValues = theValues; }
-
-  //! Sets divide values for table properties
-  //! \param container of values
-  void SetDivideValues (const QList<int>& theValues) { myDivideValues = theValues; }
-
-  //! Save state of three view in a container in form: key, value. It saves:
-  //! - XStep of property table
-  //! - divide values of property table
-  //! \param theTreeView a view instance
-  //! \param theItems [out] properties
-  //! \param thePrefix peference item prefix
-  Standard_EXPORT static void SaveState (ViewControl_PropertyView* theView, QMap<QString, QString>& theItems,
-                                         const QString& thePrefix = QString());
-  //! Restore state of three view by a container
-  //! \param theTreeView a view instance
-  //! \param theKey property key
-  //! \param theValue property value
-  //! \param thePrefix peference item prefix
-  //! \return boolean value whether the property is applyed to the tree view
-  Standard_EXPORT static bool RestoreState (ViewControl_PropertyView* theView, const QString& theKey, const QString& theValue,
-                                            const QString& thePrefix = QString());
-
 signals:
   void propertyViewSelectionChanged();
 
@@ -120,8 +95,5 @@ private:
   QVBoxLayout* myTableWidgetLayout; //! main view layout where tables or custom widgets are presented
   QList<ViewControl_Table*> myTables; //!< table view, shown only first tables filled in Init method
   QWidget* myCustomWidget; //!< custom view widget
-
-  QList<double> myXStepValues; //! predefined values for XStep in ViewControl_TableProperty
-  QList<int> myDivideValues; //! predefined values for divide value in ViewControl_TableProperty
 };
 #endif
index 9975924ebcea0b8e5337ce921502efed3c6dc382..19f866acfca87ee2c32978b3a986121e6ddd4f1d 100644 (file)
@@ -16,7 +16,7 @@
 #include <inspector/ViewControl_Table.hxx>
 #include <inspector/ViewControl_TableItemDelegate.hxx>
 #include <inspector/ViewControl_TableModel.hxx>
-#include <inspector/ViewControl_TableProperty.hxx>
+#include <inspector/ViewControl_Tools.hxx>
 
 #include <inspector/TreeModel_Tools.hxx>
 
@@ -44,9 +44,6 @@ ViewControl_Table::ViewControl_Table (QWidget* theParent)
   QGridLayout* aLayout = new QGridLayout (myMainWidget);
   aLayout->setContentsMargins (0, 0, 0, 0);
 
-  myProperty = new ViewControl_TableProperty(myMainWidget, this);
-  aLayout->addWidget (myProperty->GetControl());
-
   myTableView = new QTableView (myMainWidget);
   myTableView->setVerticalScrollMode (QAbstractItemView::ScrollPerPixel);
 
@@ -57,7 +54,6 @@ ViewControl_Table::ViewControl_Table (QWidget* theParent)
   aVHeader->setDefaultSectionSize (aDefCellSize);
 
   aLayout->addWidget (myTableView);
-  aLayout->addWidget (myProperty->GetInformationControl());
 }
 
 // =======================================================================
@@ -72,8 +68,6 @@ void ViewControl_Table::SetModel (QAbstractTableModel* theModel)
   myTableView->setSelectionMode(QAbstractItemView::ExtendedSelection);
   QItemSelectionModel* aSelectionModel = new QItemSelectionModel(theModel);
   myTableView->setSelectionModel (aSelectionModel);
-  connect(aSelectionModel, SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)),
-          this, SLOT(onTableSelectionChanged(const QItemSelection&, const QItemSelection&)));
 }
 
 // =======================================================================
@@ -88,9 +82,6 @@ void ViewControl_Table::Init (ViewControl_TableModelValues* theModelValues)
   ViewControl_TableModel* aModel = dynamic_cast<ViewControl_TableModel*> (myTableView->model());
   aModel->SetModelValues (theModelValues);
 
-  myProperty->SetActive (theModelValues->UseTableProperties());
-  myProperty->Init();
-
   ViewControl_TableItemDelegate* aDelegate = dynamic_cast<ViewControl_TableItemDelegate*>(myTableView->itemDelegate());
   aDelegate->SetModelValues (theModelValues);
 
@@ -123,8 +114,6 @@ void ViewControl_Table::GetSelectedIndices (QMap<int, QList<int>>& theSelectedIn
   int aRow, aColumn;
   for (QModelIndexList::const_iterator anIt = aSelected.begin(); anIt != aSelected.end(); anIt++)
   {
-    aModel->GetSourcePosition (*anIt, aRow, aColumn);
-
     if (!theSelectedIndices.contains (aRow))
       theSelectedIndices.insert (aRow, QList<int>());
     theSelectedIndices[aRow].append (aColumn);
@@ -132,13 +121,11 @@ void ViewControl_Table::GetSelectedIndices (QMap<int, QList<int>>& theSelectedIn
 }
 
 // =======================================================================
-// function : onTableSelectionChanged
+// function : SeparatorData
 // purpose :
 // =======================================================================
 
-void ViewControl_Table::onTableSelectionChanged(const QItemSelection&, const QItemSelection&)
+QString ViewControl_Table::SeparatorData()
 {
-  QModelIndexList aSelected = myTableView->selectionModel()->selectedIndexes();
-
-  myProperty->UpdateOnTableSelectionChanged();
+  return ViewControl_Tools::TableSeparator();
 }
index c4f93f26d0e3149d2d42dc227dafe9e06617f973..336f27744131cd16107cc30239422e6d59ea842f 100644 (file)
@@ -19,8 +19,6 @@
 #include <Standard.hxx>
 #include <Standard_Macro.hxx>
 
-#include <inspector/ViewControl_TableProperty.hxx>
-
 #include <Standard_WarningsDisable.hxx>
 #include <QItemSelection>
 #include <QObject>
@@ -68,24 +66,13 @@ public:
   //! \return the table view
   QTableView* GetTableView() const { return myTableView; }
 
-  //! Returns instance of table property control
-  //! \return property
-  ViewControl_TableProperty* GetProperty() const { return myProperty; }
-
   //! Retuns model indices of the selected cells in table view
   //! \param theSelectedIndices [out] a container of indices: row to list of columns
   Standard_EXPORT void GetSelectedIndices (QMap<int, QList<int>>& aSelectedIndices);
 
   //! Returns text of separation row in table
   //! \return string value
-  static QString SeparatorData() { return "---------------------------"; }
-
-protected slots:
-
-  //! Updates controls by selection change in table view
-  //! \param theSelected container of selected table cells
-  //! \param theDeselected container of selected table cells
-  void onTableSelectionChanged(const QItemSelection& theSelected, const QItemSelection& theDeselected);
+  Standard_EXPORT static QString SeparatorData();
 
 private:
   bool myIsActive; //!< true if the table is used in property view and visible
@@ -93,7 +80,5 @@ private:
   QWidget* myMainWidget; //!< parent of all controls
   bool myIsUseProperty; //!< boolean value whether the property control should be shown/hidden
   QTableView* myTableView; //!< table view
-
-  ViewControl_TableProperty* myProperty; //!< modifier of the table visual properties
 };
 #endif
index ba7558e0260cf737d1ad1f5ffde5cbbba396ee06..5696212d9d168c3b1b11f8b934fbee39d009257c 100644 (file)
@@ -24,6 +24,7 @@
 #include <QComboBox>
 #include <QDoubleValidator>
 #include <QLineEdit>
+#include <QPushButton>
 #include <QSpinBox>
 #include <Standard_WarningsRestore.hxx>
 
@@ -49,8 +50,8 @@ QWidget* ViewControl_TableItemDelegate::createEditor (QWidget* theParent,
   if (!myModelValues)
     return 0;
 
-  int aRow, aColumn;
-  myModelValues->GetSourcePosition (theIndex.row(), theIndex.column(), aRow, aColumn);
+  int aRow = theIndex.row();
+  int aColumn = theIndex.column();
   ViewControl_EditType anEditType = myModelValues->GetEditType (aRow, aColumn);
 
   QWidget* anEditor = createEditorControl (theParent, anEditType);
@@ -68,8 +69,8 @@ void ViewControl_TableItemDelegate::setEditorData (QWidget* theEditor, const QMo
   if (!myModelValues)
     return;
 
-  int aRow, aColumn;
-  myModelValues->GetSourcePosition (theIndex.row(), theIndex.column(), aRow, aColumn);
+  int aRow = theIndex.row();
+  int aColumn = theIndex.column();
   ViewControl_EditType anEditType = myModelValues->GetEditType (aRow, aColumn);
 
   setEditorValue (theEditor, anEditType, theIndex.model()->data(theIndex));
@@ -86,8 +87,8 @@ void ViewControl_TableItemDelegate::setModelData (QWidget* theEditor, QAbstractI
   if (!myModelValues)
     return;
 
-  int aRow, aColumn;
-  myModelValues->GetSourcePosition (theIndex.row(), theIndex.column(), aRow, aColumn);
+  int aRow = theIndex.row();
+  int aColumn = theIndex.column();
   ViewControl_EditType anEditType = myModelValues->GetEditType (aRow, aColumn);
 
   theModel->setData (theIndex, getEditorValue (theEditor, anEditType));
@@ -113,7 +114,13 @@ QWidget* ViewControl_TableItemDelegate::createEditorControl (QWidget* theParent,
       return aLineEdit;
     }
     case ViewControl_EditType_Line: return new QLineEdit (theParent);
-    case ViewControl_EditType_Spin: return new QSpinBox (theParent);
+    case ViewControl_EditType_Spin:
+    {
+      QSpinBox* aSpinBox = new QSpinBox (theParent);
+      aSpinBox->setRange (IntegerFirst(), IntegerLast());
+      return aSpinBox;
+    }
+    case ViewControl_EditType_DoAction: return new QPushButton (theParent);
 
     default: return 0;
   }
@@ -177,6 +184,7 @@ void ViewControl_TableItemDelegate::setEditorValue (QWidget* theEditor, const Vi
     case ViewControl_EditType_Double:
     case ViewControl_EditType_Line: (qobject_cast<QLineEdit*>(theEditor))->setText (theValue.toString()); break;
     case ViewControl_EditType_Spin: (qobject_cast<QSpinBox*>(theEditor))->setValue (theValue.toInt()); break;
+    case ViewControl_EditType_DoAction: (qobject_cast<QPushButton*>(theEditor))->setText ("UnSelect"); break;
 
     default: break;
   }
@@ -198,6 +206,7 @@ QVariant ViewControl_TableItemDelegate::getEditorValue (QWidget* theEditor, cons
     case ViewControl_EditType_Double:
     case ViewControl_EditType_Line: return (qobject_cast<QLineEdit*>(theEditor))->text();
     case ViewControl_EditType_Spin: return (qobject_cast<QSpinBox*>(theEditor))->value();
+    case ViewControl_EditType_DoAction: return QVariant ("Clicked");
 
     default: return QVariant();
   }
index 511d39f0133f5f8c67b43eec34e3e3ec3227e0d3..c3b43209b8fa84c72aebd93cc180242e59f39709 100644 (file)
@@ -25,7 +25,6 @@ void ViewControl_TableModel::SetModelValues (ViewControl_TableModelValues* theMo
     delete myModelValues;
 
   myModelValues = theModelValues;
-  SetFilter(0);
 }
 
 // =======================================================================
@@ -37,8 +36,7 @@ int ViewControl_TableModel::columnCount(const QModelIndex& theParent) const
   if (!myModelValues)
     return 0;
 
-  int aColumnCount = myModelValues->ColumnCount (theParent);
-  return isFilterActive() ? myFilter->ColumnCount (aColumnCount) : aColumnCount;
+  return myModelValues->ColumnCount (theParent);
 }
 
 // =======================================================================
@@ -50,8 +48,7 @@ int ViewControl_TableModel::rowCount(const QModelIndex& theParent ) const
   if (!myModelValues)
     return 0;
 
-  return isFilterActive() ? myFilter->RowCount (myModelValues->ColumnCount (theParent))
-                          : myModelValues->RowCount (theParent);
+  return myModelValues->RowCount (theParent);
 }
 
 // =======================================================================
@@ -64,9 +61,6 @@ QVariant ViewControl_TableModel::data (const QModelIndex& theIndex, int theRole)
     return QVariant();
 
   int aRow = theIndex.row(), aColumn = theIndex.column();
-  if (isFilterActive())
-    myFilter->GetSourcePosition (theIndex, aRow, aColumn);
-
   return myModelValues->Data (aRow, aColumn, theRole);
 }
 
@@ -80,20 +74,5 @@ bool ViewControl_TableModel::setData (const QModelIndex& theIndex, const QVarian
     return false;
 
   int aRow = theIndex.row(), aColumn = theIndex.column();
-  if (isFilterActive())
-    myFilter->GetSourcePosition (theIndex, aRow, aColumn);
-
   return myModelValues->SetData (aRow, aColumn, theValue, theRole);
 }
-
-// =======================================================================
-// function : GetSourcePosition
-// purpose :
-// =======================================================================
-void ViewControl_TableModel::GetSourcePosition (const QModelIndex& theIndex, int& theRow, int& theColumn)
-{
-  if (isFilterActive())
-    myFilter->GetSourcePosition (theIndex, theRow, theColumn);
-  else
-    myModelValues->GetSourcePosition (theIndex.row(), theIndex.column(), theRow, theColumn);
-}
index aff5e391197e8ea6dddbd4c6eb0229a6ef47a145..d0459ea68e274d0a6ea7d38f1557c7c27a1cce51 100644 (file)
@@ -18,7 +18,6 @@
 
 #include <Standard.hxx>
 
-#include <inspector/ViewControl_TableModelFilter.hxx>
 #include <inspector/ViewControl_TableModelValues.hxx>
 
 #include <Standard_WarningsDisable.hxx>
@@ -40,7 +39,7 @@ class ViewControl_TableModel : public QAbstractTableModel
 public:
 
   //! Constructor
-  ViewControl_TableModel (QObject* theParent = 0) : myModelValues (0), myFilter (0) { (void)theParent; }
+  ViewControl_TableModel (QObject* theParent = 0) : myModelValues (0) { (void)theParent; }
 
   //! Destructor
   virtual ~ViewControl_TableModel() {}
@@ -53,10 +52,6 @@ public:
   //! \return interface or NULL
   ViewControl_TableModelValues* GetModelValues() const { return myModelValues; }
 
-  //! Sets table values filter to rearrange values presentation
-  //! \param filter instance
-  void SetFilter (ViewControl_TableModelFilter* theFilter) { myFilter = theFilter; }
-
   //! Emits the layoutChanged signal from outside of this class
   void EmitLayoutChanged() { emit layoutChanged(); }
 
@@ -98,20 +93,8 @@ public:
   Qt::ItemFlags flags (const QModelIndex& theIndex) const
   { return myModelValues ? myModelValues->Flags (theIndex) : Qt::NoItemFlags; }
 
-  //! Returns source row and column values peforming conversion back from filter
-  //! \param theIndex a model index
-  //! \param theRow a model row
-  //! \param theColumn a model column
-  Standard_EXPORT void GetSourcePosition (const QModelIndex& theIndex, int& theRow, int& theColumn);
-
-protected:
-  //! Returns true if the filter is not NULL and active
-  //! \return true if active
-  Standard_Boolean isFilterActive() const { return myFilter && myFilter->IsActive(); }
-
 private:
   ViewControl_TableModelValues* myModelValues; //! interface to table values
-  ViewControl_TableModelFilter* myFilter; //! filter of values
 };
 
 #endif
diff --git a/tools/ViewControl/ViewControl_TableModelFilter.cxx b/tools/ViewControl/ViewControl_TableModelFilter.cxx
deleted file mode 100644 (file)
index 3389147..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement. 
-
-#include <inspector/ViewControl_TableModelFilter.hxx>
-
-// =======================================================================
-// function : ColumnCount
-// purpose :
-// =======================================================================
-
-int ViewControl_TableModelFilter::ColumnCount (const int theSourceColumnCount) const
-{
-  return myColumnCount <= 0 ? theSourceColumnCount : myColumnCount;
-}
-
-// =======================================================================
-// function : RowCount
-// purpose :
-// =======================================================================
-
-int ViewControl_TableModelFilter::RowCount (const int theSourceColumnCount) const
-{
-  if (myColumnCount <= 0)
-    return 1;
-
-  int aRows = (int) (theSourceColumnCount / myColumnCount);
-  if (myColumnCount > 0 && aRows * myColumnCount < theSourceColumnCount)
-    aRows++; /// row with left values, not fully filled
-
-  return aRows;
-}
-
-// =======================================================================
-// function : GetSourcePosition
-// purpose :
-// =======================================================================
-
-void ViewControl_TableModelFilter::GetSourcePosition (const QModelIndex& theIndex, int& theRow, int& theColumn) const
-{
-  GetSourcePosition (theIndex.row(), theIndex.column(), theRow, theColumn);
-}
-
-// =======================================================================
-// function : GetSourcePosition
-// purpose :
-// =======================================================================
-
-void ViewControl_TableModelFilter::GetSourcePosition (const int theSourceRow, const int theSourceColumn, int& theRow,
-                                                      int& theColumn) const
-{
-  theRow = 0;
-  theColumn = myColumnCount * theSourceRow + theSourceColumn;
-}
diff --git a/tools/ViewControl/ViewControl_TableModelFilter.hxx b/tools/ViewControl/ViewControl_TableModelFilter.hxx
deleted file mode 100644 (file)
index 3e3adc0..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement. 
-
-#ifndef ViewControl_TableModelFilter_H
-#define ViewControl_TableModelFilter_H
-
-#include <Standard.hxx>
-
-#include <inspector/ViewControl_TableModelValues.hxx>
-
-//! \class ViewControl_TableModelFilter
-//! \brief It provides separation of 1D container of values in 2D presentation depending on number of column value
-class ViewControl_TableModelFilter
-{
-public:
-
-  //! Constructor
-  Standard_EXPORT ViewControl_TableModelFilter(const Standard_Integer theColumnCount = -1)
-    : myIsActive (Standard_True), myColumnCount (theColumnCount) {}
-
-  //! Destructor
-  virtual ~ViewControl_TableModelFilter() {}
-
-  //! Activate/Deactivate filter
-  //! \param theActive state is the filter to be active or not
-  virtual void SetActive (const Standard_Boolean theActive) { myIsActive = theActive; }
-
-  //! Returns boolean state whether the filter is activated
-  //! \return true if active
-  virtual Standard_Boolean IsActive() const { return myIsActive; }
-
-  //! Sets number of columns
-  //! \param theColumnCount a column count
-  void SetColumnCount (const int theColumnCount) { myColumnCount = theColumnCount; }
-
-  //! Returns number of columns: parameter value
-  //! \param theSourceColumnCount number of columns in the source table
-  //! \return an integer value
-  Standard_EXPORT int ColumnCount (const int theSourceColumnCount) const;
-
-  //! Returns number of rows: whole number of columns is divided to the current column value
-  //! \param theSourceColumnCount number of columns in the source table
-  //! \return an integer value
-  Standard_EXPORT int RowCount (const int theSourceColumnCount) const;
-
-  //! Returns source row/column indices for the filtered model index
-  //! \param theIndex a model index
-  //! \param theRow [out] row number value
-  //! \param theColumn [out] column value
-  Standard_EXPORT void GetSourcePosition (const QModelIndex& theIndex, int& theRow, int& theColumn) const;
-
-  //! Returns source row/column indices for the filtered model index
-  //! \param theSourceRow model row index
-  //! \param theSourceColumn model column index
-  //! \param theRow [out] row number value
-  //! \param theColumn [out] column value
-  Standard_EXPORT void GetSourcePosition (const int theSourceRow, const int theSourceColumn, int& theRow, int& theColumn) const;
-
-private:
-  Standard_Boolean myIsActive; //!< active state of the filter
-  Standard_Integer myColumnCount; //!< number of table columns
-};
-
-#endif
index 8ac5e59e30470af8d181c3e8ea6fe3cea0597cb7..2017acc7eb6b57be22cefb7a1a9a50d06b48edfc 100644 (file)
 
 int ViewControl_TableModelValues::ColumnCount (const QModelIndex&) const
 {
-  Qt::Orientation anAdditionalOrientation = myOrientation == Qt::Vertical ? Qt::Horizontal : Qt::Vertical;
-  if (myHeaderValues[anAdditionalOrientation].size() > 0)
-    return myHeaderValues[anAdditionalOrientation].size();
+  if (!GetProperties().IsNull())
+    return GetProperties()->GetTableColumnCount();
 
-  return myValues.size();
+  return 0;
+}
+
+
+// =======================================================================
+// function : RowCount
+// purpose :
+// =======================================================================
+
+int ViewControl_TableModelValues::RowCount (const QModelIndex&) const
+{
+  if (!GetProperties().IsNull())
+    return GetProperties()->GetTableRowCount();
+
+  return 0;
 }
 
 // =======================================================================
@@ -41,8 +54,12 @@ int ViewControl_TableModelValues::ColumnCount (const QModelIndex&) const
 
 QVariant ViewControl_TableModelValues::Data (const int theRow, const int theColumn, int theRole) const
 {
-  if (theRole == Qt::DisplayRole)
-    return myValues.at ((int)getPosition (theRow, theColumn));
+  if (!GetProperties().IsNull())
+  {
+    QVariant aValue = GetProperties()->GetTableData (theRow, theColumn, theRole);
+    if (aValue.isValid())
+      return aValue;
+  }
 
   if (theRole == Qt::TextAlignmentRole) // for multi-lines text, align it to the top
     return Qt::AlignTop;
@@ -61,6 +78,19 @@ QVariant ViewControl_TableModelValues::Data (const int theRow, const int theColu
   return QVariant();
 }
 
+// =======================================================================
+// function : SetData
+// purpose :
+// =======================================================================
+
+bool ViewControl_TableModelValues::SetData (const int theRow, const int theColumn, const QVariant& theValue, int)
+{
+  if (!GetProperties().IsNull())
+    return GetProperties()->SetTableData (theRow, theColumn, theValue);
+
+  return false;
+}
+
 // =======================================================================
 // function : HeaderData
 // purpose :
@@ -88,4 +118,4 @@ bool ViewControl_TableModelValues::isItalicHeader (const int theRow, const int t
   int aCell = anOrientation == Qt::Horizontal ? theColumn : theRow;
 
   return GetHeaderItem (anOrientation, aCell).IsItalic();
-}
\ No newline at end of file
+}
index c0d8ac5c2d5b5a3aa8ab5ede7a3411bdc54fb38d..63e6a329671c7c4f40ca655ce6bf0b6376f845c8 100644 (file)
@@ -19,6 +19,7 @@
 #include <Standard.hxx>
 
 #include <inspector/TreeModel_HeaderSection.hxx>
+#include <inspector/TreeModel_ItemProperties.hxx>
 #include <inspector/ViewControl_EditType.hxx>
 
 #include <Standard_WarningsDisable.hxx>
@@ -40,21 +41,21 @@ public:
 
   //! Constructor
   Standard_EXPORT ViewControl_TableModelValues (const Qt::Orientation& theOrientation = Qt::Vertical)
-    : myUseTableProperties (false), myUseTableSeparateSize (true), myUseTablePropertiesXStep (false),
-      myUseTablePropertiesXStepValue (-1)
   { SetOrientation (theOrientation); }
 
   //! Destructor
   virtual ~ViewControl_TableModelValues() {}
 
+  //! Sets item table properties builder
+  void SetProperties (const Handle(TreeModel_ItemProperties)& theProperties) { myProperties = theProperties; }
+
+  //! Returns item table properties builder
+  Handle(TreeModel_ItemProperties) GetProperties() const { return myProperties; }
+
   //! Sets direction of the values applying, whether it should be placed by rows or by columns
   //! \param theOrientation if horizontal, the values are applyed by rows, otherwise by columns
   void SetOrientation (const Qt::Orientation& theOrientation) { myOrientation = theOrientation; }
 
-  //! Fills the model values.
-  //! \param theValues a container of table model values
-  void SetValues (const QVector<QVariant>& theValues) { myValues = theValues; }
-
   //! Fills the model header values for orientation.
   //! \param theValues a container of header text values
   //! \param theOrientation an orientation of header
@@ -94,34 +95,6 @@ public:
     return myDefaultSectionSize.contains (theOrientation);
   }
 
-  //! Stores whether the properties control of the table visible or not
-  //! \param theUseProperties boolean state
-  void SetUseTableProperties (const bool theUseProperties) { myUseTableProperties = theUseProperties; }
-
-  //! Returns true if the properties control of the table visible or not
-  //! \return boolean value
-  bool UseTableProperties() const { return myUseTableProperties; }
-
-  //! Stores whether the properties control of the table visible or not
-  //! \param theUseProperties boolean state
-  void SetUseTableSeparateSize (const bool theUseSize)
-  { myUseTableSeparateSize = theUseSize; }
-
-  //! Returns true if the properties control of the table visible or not
-  //! \return boolean value
-  bool UseTableSeparateSize() const
-  { return myUseTableSeparateSize; }
-
-  //! Stores whether the properties control of the table visible or not
-  //! \param theUseProperties boolean state
-  void SetUseTablePropertiesXStep (const bool theUseStep, const double theStep)
-  { myUseTablePropertiesXStep = theUseStep; myUseTablePropertiesXStepValue = theStep; }
-
-  //! Returns true if the properties control of the table visible or not
-  //! \return boolean value
-  double UseTablePropertiesXStep(bool& theUseStep) const
-  { theUseStep = myUseTablePropertiesXStep; return myUseTablePropertiesXStepValue; }
-
   //! Returns number of columns, size of header values
   //! \param theParent an index of the parent item
   //! \return an integer value
@@ -130,8 +103,7 @@ public:
   //! 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
-  virtual int RowCount (const QModelIndex& theParent = QModelIndex()) const
-  { return ColumnCount (theParent) > 0 ? GetValuesCount() / ColumnCount (theParent) : 0; }
+  Standard_EXPORT virtual int RowCount (const QModelIndex& theParent = QModelIndex()) const;
 
   //! Returns content of the model index for the given role, it is obtained from internal container of values
   //! It returns value only for DisplayRole.
@@ -147,8 +119,7 @@ public:
   //! \param theRole a view role
   //! \return true if the value is changed
   Standard_EXPORT virtual bool SetData (const int theRow, const int theColumn, const QVariant& theValue,
-                                        int theRole = Qt::DisplayRole)
-  { (void)theRow; (void)theColumn; (void)theValue; (void)theRole; return false; }
+                                        int theRole = Qt::DisplayRole);
 
   //! Returns content of the model index for the given role, it is obtainer from internal container of header values
   //! It returns value only for DisplayRole.
@@ -164,28 +135,6 @@ public:
   virtual Qt::ItemFlags Flags (const QModelIndex& theIndex) const
   { return theIndex.isValid() ? Qt::ItemIsEnabled | Qt::ItemIsSelectable : Qt::NoItemFlags; }
 
-  //! Returns minimum and maximum values of the table content
-  //! \param theMinValue minimum
-  //! \param theMaxValue maximum
-  virtual void GetRangeValues (QString& theMinValue, QString& theMaxValue, const QModelIndexList& theSelected) const
-  { (void)theMinValue; (void)theMaxValue; (void)theSelected; }
-
-  //! Returns additional info
-  virtual QString AdditionalInformation() const { return QString(); }
-
-  //! 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
-  virtual int GetValuesCount () const { return myValues.size(); }
-
-  //! Returns source row/column indices for the filtered model index for the given role
-  //! \param theSourceRow model row index
-  //! \param theSourceColumn model column index
-  //! \param theRow [out] row number value
-  //! \param theColumn [out] column value
-  Standard_EXPORT virtual void GetSourcePosition (const int theSourceRow, const int theSourceColumn, int& theRow, int& theColumn) const
-  { theRow = theSourceRow; theColumn = theSourceColumn; }
-
   //! Returns item delegate to provide cell editors. By default, it is empty
   //! \return delegate
   virtual QItemDelegate* GetItemDelegate() { return 0; }
@@ -209,11 +158,6 @@ public:
   static QColor EditCellColor() { return QColor (Qt::darkBlue); }
 
 protected:
-  //! Finds position in internal vector of values using the table column/row count
-  //! \param theRow a row of a table cell
-  //! \param theColumn a column of a table cell
-  size_t getPosition (const int theRow, const int theColumn) const { return ColumnCount() * theRow + theColumn; }
-
   //! Returns true if the header item is italic of the parameter index
   //! \param theRow a model index row
   //! \param theColumn a model index column
@@ -226,11 +170,8 @@ protected:
   QMap<Qt::Orientation, QList<TreeModel_HeaderSection> > myHeaderValues; //!< table header values
   QMap<Qt::Orientation, bool> myVisibleHeader; //! table header visibility
   QMap<Qt::Orientation, int> myDefaultSectionSize; //! table section default size
-  QVector<QVariant> myValues; //! cached container of table values
-  bool myUseTableProperties; //! state whether the table property control is visible
-  bool myUseTableSeparateSize; //! state whether table custom column size is possible
-  bool myUseTablePropertiesXStep; //! true if XStep value is used
-  double myUseTablePropertiesXStepValue; //! value to define OX step for 1D table, Z = 0
+
+  Handle(TreeModel_ItemProperties) myProperties; //!< item properties
 };
 
 #endif
diff --git a/tools/ViewControl/ViewControl_TableModelValuesDefault.cxx b/tools/ViewControl/ViewControl_TableModelValuesDefault.cxx
new file mode 100644 (file)
index 0000000..104bfbe
--- /dev/null
@@ -0,0 +1,48 @@
+// Created on: 2017-06-16
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2017 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement. 
+
+#include <inspector/ViewControl_TableModelValuesDefault.hxx>
+
+#include <Standard_WarningsDisable.hxx>
+#include <QApplication>
+#include <QFont>
+#include <Standard_WarningsRestore.hxx>
+
+// =======================================================================
+// function : ColumnCount
+// purpose :
+// =======================================================================
+
+int ViewControl_TableModelValuesDefault::ColumnCount (const QModelIndex&) const
+{
+  Qt::Orientation anAdditionalOrientation = myOrientation == Qt::Vertical ? Qt::Horizontal : Qt::Vertical;
+  if (myHeaderValues[anAdditionalOrientation].size() > 0)
+    return myHeaderValues[anAdditionalOrientation].size();
+
+  return myValues.size();
+}
+
+// =======================================================================
+// function : Data
+// purpose :
+// =======================================================================
+
+QVariant ViewControl_TableModelValuesDefault::Data (const int theRow, const int theColumn, int theRole) const
+{
+  if (theRole == Qt::DisplayRole)
+    return myValues.at ((int)getPosition (theRow, theColumn));
+
+  return ViewControl_TableModelValues::Data (theRow, theColumn, theRole);
+}
diff --git a/tools/ViewControl/ViewControl_TableModelValuesDefault.hxx b/tools/ViewControl/ViewControl_TableModelValuesDefault.hxx
new file mode 100644 (file)
index 0000000..bda3b94
--- /dev/null
@@ -0,0 +1,92 @@
+// Created on: 2017-06-16
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2017 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement. 
+
+#ifndef ViewControl_TableModelValuesDefault_H
+#define ViewControl_TableModelValuesDefault_H
+
+#include <Standard.hxx>
+
+#include <inspector/ViewControl_TableModelValues.hxx>
+
+#include <Standard_WarningsDisable.hxx>
+#include <QAbstractTableModel>
+#include <QColor>
+#include <QList>
+#include <QModelIndexList>
+#include <QVariant>
+#include <Standard_WarningsRestore.hxx>
+
+class QItemDelegate;
+
+//! \class ViewControl_TableModelValuesDefault
+//! \brief This is an interace for ViewControl_TableModel to give real values of the model
+//! It should be filled or redefined.
+class ViewControl_TableModelValuesDefault : public ViewControl_TableModelValues
+{
+public:
+
+  //! Constructor
+  Standard_EXPORT ViewControl_TableModelValuesDefault (const Qt::Orientation& theOrientation = Qt::Vertical)
+    : ViewControl_TableModelValues (theOrientation) {}
+
+  //! Destructor
+  virtual ~ViewControl_TableModelValuesDefault() {}
+
+  //! Fills the model values.
+  //! \param theValues a container of table model values
+  void SetValues (const QVector<QVariant>& theValues) { myValues = theValues; }
+
+  //! Returns number of columns, size of header values
+  //! \param theParent an index of the parent item
+  //! \return an integer value
+  Standard_EXPORT virtual int ColumnCount (const QModelIndex& theParent = QModelIndex()) const Standard_OVERRIDE;
+
+  //! 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
+  virtual int RowCount (const QModelIndex& theParent = QModelIndex()) const Standard_OVERRIDE
+  { return ColumnCount (theParent) > 0 ? GetValuesCount() / ColumnCount (theParent) : 0; }
+
+  //! Returns content of the model index for the given role, it is obtained from internal container of values
+  //! It returns value only for DisplayRole.
+  //! \param theRow a model index row
+  //! \param theColumn a model index column
+  //! \param theRole a view role
+  //! \return value intepreted depending on the given role
+  Standard_EXPORT virtual QVariant Data (const int theRow, const int theColumn, int theRole = Qt::DisplayRole) const Standard_OVERRIDE;
+
+  //! 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
+  virtual int GetValuesCount () const { return myValues.size(); }
+
+protected:
+  //! Finds position in internal vector of values using the table column/row count
+  //! \param theRow a row of a table cell
+  //! \param theColumn a column of a table cell
+  size_t getPosition (const int theRow, const int theColumn) const { return ColumnCount() * theRow + theColumn; }
+
+  //! Returns true if the header item is italic of the parameter index
+  //! \param theRow a model index row
+  //! \param theColumn a model index column
+  //! \param boolean value
+  bool isItalicHeader (const int theRow, const int theColumn) const;
+
+protected:
+
+  QVector<QVariant> myValues; //! cached container of table values
+};
+
+#endif
diff --git a/tools/ViewControl/ViewControl_TableProperty.cxx b/tools/ViewControl/ViewControl_TableProperty.cxx
deleted file mode 100644 (file)
index e3c3a08..0000000
+++ /dev/null
@@ -1,224 +0,0 @@
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement. 
-
-#include <inspector/ViewControl_TableProperty.hxx>
-#include <inspector/ViewControl_Table.hxx>
-#include <inspector/ViewControl_TableModel.hxx>
-#include <inspector/ViewControl_TableModelFilter.hxx>
-#include <inspector/ViewControl_TableModelValues.hxx>
-
-#include <inspector/TreeModel_Tools.hxx>
-
-#include <QAbstractItemModel>
-#include <QAction>
-#include <QGridLayout>
-#include <QHeaderView>
-#include <QLabel>
-#include <QLineEdit>
-#include <QMenu>
-#include <QPlainTextEdit>
-#include <QPushButton>
-#include <QSpinBox>
-#include <QTableView>
-#include <QWidget>
-
-#include <limits>
-
-const int DEFAULT_COLUMN_WIDTH = 60;
-
-// =======================================================================
-// function : Constructor
-// purpose :
-// =======================================================================
-
-ViewControl_TableProperty::ViewControl_TableProperty (QWidget* theParent, ViewControl_Table* theTable)
-: QObject (theParent), myTable (theTable), myIsActive (false)
-{
-  myFilter = new ViewControl_TableModelFilter();
-
-  myMainWidget = new QWidget (theParent);
-  QGridLayout* aMainLayout = new QGridLayout (myMainWidget);
-
-  QWidget* aProperties = new QWidget (myMainWidget);
-  aMainLayout->addWidget (aProperties);
-  QHBoxLayout* aPropertiesLayout = new QHBoxLayout (aProperties);
-  aPropertiesLayout->setContentsMargins (0, 0, 0, 0);
-
-  mySize = new QLabel ("", myMainWidget);
-  myDivideSize = new QLabel("Divide:", myMainWidget);
-  mySeparateSize = new QSpinBox (myMainWidget);
-  mySeparateSize->setRange (0, 100000);
-  myVisualizedSize = new QLabel ("", myMainWidget);
-
-  aPropertiesLayout->addWidget (mySize);
-  aPropertiesLayout->addWidget (myDivideSize);
-  aPropertiesLayout->addWidget (mySeparateSize);
-  aPropertiesLayout->addWidget (myVisualizedSize);
-
-  myXStepLabel = new QLabel ("XStep:");
-  myXStep = new QDoubleSpinBox (myMainWidget);
-  myXStep->setRange(1.e-12, 1.e+7);
-  myXStep->setDecimals (8);
-  myXStep->setValue(1.);
-
-  setXStepActive (false);
-
-  connect (myXStep, SIGNAL(editingFinished()), this, SIGNAL (propertyChanged()));
-
-  aPropertiesLayout->addWidget (myXStepLabel);
-  aPropertiesLayout->addWidget (myXStep);
-
-  myInformationWidget = new QWidget (theParent);
-  QGridLayout* anInfoLayout = new QGridLayout (myInformationWidget);
-
-  myModelInformation = new QPlainTextEdit (myInformationWidget);
-  myModelInformation->setVisible (false);
-  anInfoLayout->addWidget (myModelInformation, 2, 0, 1, 4);
-
-  myMinValue = new QPushButton ("Min", myInformationWidget);
-  myMaxValue = new QPushButton ("Max", myInformationWidget);
-  myMinSelectedValue = new QPushButton ("Min of selected", myInformationWidget);
-  myMaxSelectedValue = new QPushButton ("Max of selected", myInformationWidget);
-
-  anInfoLayout->addWidget (myMinValue, 3, 0);
-  anInfoLayout->addWidget (myMinSelectedValue, 3, 1);
-  anInfoLayout->addWidget (myMaxValue, 4, 0);
-  anInfoLayout->addWidget (myMaxSelectedValue, 4, 1);
-
-  connect (mySeparateSize, SIGNAL (valueChanged (int)),
-           this, SLOT (onSeparateSizeChanged (int)));
-}
-
-// =======================================================================
-// function : Init
-// purpose :
-// =======================================================================
-
-void ViewControl_TableProperty::Init()
-{
-  ViewControl_TableModel* aViewModel = dynamic_cast<ViewControl_TableModel*>(myTable->GetTableView()->model());
-  ViewControl_TableModelValues* aModelValues = aViewModel->GetModelValues();
-
-  bool aUseXStep;
-  double aXStep = aModelValues->UseTablePropertiesXStep (aUseXStep);
-  setXStepActive (aUseXStep, aXStep);
-
-  QString aMinValue = QString::number (DBL_MIN), aMaxValue = QString::number (DBL_MAX);
-  aModelValues->GetRangeValues (aMinValue, aMaxValue, QModelIndexList());
-  QString anInfo = aModelValues->AdditionalInformation();
-
-  bool aUseSeparateSize = aModelValues->UseTableSeparateSize();
-  mySize->setVisible (aUseSeparateSize);
-  myDivideSize->setVisible (aUseSeparateSize);
-  mySeparateSize->setVisible (aUseSeparateSize);
-  myVisualizedSize->setVisible (aUseSeparateSize);
-  myFilter->SetActive (aUseSeparateSize);
-  if (aUseSeparateSize && mySeparateSize->value() != 0)
-    myFilter->SetColumnCount(mySeparateSize->value());
-  
-  mySize->setText (QString("[ %1, %2 ]").arg (aViewModel->rowCount()).arg (aViewModel->columnCount()));
-
-  myVisualizedSize->setText (mySize->text());
-  myVisualizedSize->setToolTip (QString ("sqrt: (%1, %2)").arg (sqrt (aViewModel->rowCount())).arg (sqrt (aViewModel->columnCount())));
-  myModelInformation->setVisible(!anInfo.isEmpty());
-  if (!anInfo.isEmpty())
-    myModelInformation->setPlainText (anInfo);
-
-  myMinValue->setText (QString ("Min: ") + aMinValue);
-  myMaxValue->setText (QString ("Max: ") + aMaxValue);
-  myMinSelectedValue->setText (QString("Min of selected: ") + QString::number(0));
-  myMaxSelectedValue->setText (QString("Max of selected: ") + QString::number(0));
-}
-
-// =======================================================================
-// function : SetActive
-// purpose :
-// =======================================================================
-
-void ViewControl_TableProperty::SetActive (const bool theActive)
-{
-  GetControl()->setVisible (theActive);
-  GetInformationControl()->setVisible (theActive);
-
-  ViewControl_TableModel* aModel = dynamic_cast<ViewControl_TableModel*> (myTable->GetTableView()->model());
-  aModel->SetFilter (theActive ? GetFilter() : 0);
-}
-
-// =======================================================================
-// function : onSeparateSizeChanged
-// purpose :
-// =======================================================================
-
-void ViewControl_TableProperty::onSeparateSizeChanged (int theValue)
-{
-  myFilter->SetColumnCount(theValue);
-
-  myTable->GetTableView()->selectionModel()->clearSelection();
-
-  ViewControl_TableModel* aViewModel = dynamic_cast<ViewControl_TableModel*>(myTable->GetTableView()->model());
-  aViewModel->EmitLayoutChanged();
-
-  myVisualizedSize->setText (QString ("[ %1, %2 ]").arg (aViewModel->rowCount()).arg (aViewModel->columnCount()));
-}
-
-// =======================================================================
-// function : onToleranceSizeChanged
-// purpose :
-// =======================================================================
-
-void ViewControl_TableProperty::onToleranceSizeChanged (int theValue)
-{
-  (void)theValue;
-}
-
-// =======================================================================
-// function : onSeparateSizeChanged
-// purpose :
-// =======================================================================
-
-void ViewControl_TableProperty::UpdateOnTableSelectionChanged()
-{
-  QModelIndexList aSelected = myTable->GetTableView()->selectionModel()->selectedIndexes();
-  if (aSelected.isEmpty())
-  {
-    myMinSelectedValue->setText(QString("Min of selected:") + QString::number(0));
-    myMaxSelectedValue->setText(QString("Max of selected:") + QString::number(0));
-    return;
-  }
-
-  ViewControl_TableModel* aViewModel = dynamic_cast<ViewControl_TableModel*>(myTable->GetTableView()->model());
-  ViewControl_TableModelValues* aModelValues = aViewModel->GetModelValues();
-
-  QString aMinValue = QString::number (DBL_MIN), aMaxValue = QString::number (DBL_MAX);
-  aModelValues->GetRangeValues (aMinValue, aMaxValue, aSelected);
-
-  myMinSelectedValue->setText (QString ("Min of selected:") + aMinValue);
-  myMaxSelectedValue->setText (QString ("Max of selected:") + aMaxValue);
-}
-
-// =======================================================================
-// function : createAction
-// purpose :
-// =======================================================================
-void ViewControl_TableProperty::setXStepActive (const bool theState, const double theValue)
-{
-  myXStepActive = theState;
-
-  myXStepLabel->setVisible (myXStepActive);
-  myXStep->setVisible (myXStepActive);
-
-  if (theValue > 0)
-    myXStep->setValue (theValue);
-}
diff --git a/tools/ViewControl/ViewControl_TableProperty.hxx b/tools/ViewControl/ViewControl_TableProperty.hxx
deleted file mode 100644 (file)
index fbfa98c..0000000
+++ /dev/null
@@ -1,141 +0,0 @@
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement. 
-
-#ifndef ViewControl_TableProperty_H
-#define ViewControl_TableProperty_H
-
-#include <Standard.hxx>
-#include <Standard_Macro.hxx>
-
-#ifdef _MSC_VER
-#pragma warning(disable : 4127) // conditional expression is constant
-#endif
-
-#include <QDoubleSpinBox>
-#include <QObject>
-#include <QSpinBox>
-
-class ViewControl_Table;
-class ViewControl_TableModelFilter;
-
-class QContextMenuEvent;
-class QLabel;
-class QItemSelection;
-class QPlainTextEdit;
-class QPushButton;
-class QSpinBox;
-class QWidget;
-
-//! \class ViewControl_TableProperty
-//! \brief View to display table values with possibility to change table columns
-//! if the table has 1D dimension and Horizontal orientation
-class ViewControl_TableProperty : public QObject
-{
-  Q_OBJECT
-public:
-
-  //! Constructor
-  Standard_EXPORT ViewControl_TableProperty (QWidget* theParent, ViewControl_Table* theTable);
-
-  //! Destructor
-  virtual ~ViewControl_TableProperty() Standard_OVERRIDE {}
-
-  //! Fills table view and table size control by the model
-  Standard_EXPORT void Init();
-
-  //! Sets whether the properties pane is visible or not
-  //! \param theUseProperty boolean state
-  Standard_EXPORT void SetActive (const bool theActive);
-
-  //! Returns main control
-  //! \return widget
-  QWidget* GetControl() const { return myMainWidget; }
-
-  //! Returns information control
-  //! \return widget
-  QWidget* GetInformationControl() { return myInformationWidget; }
-
-  //! Returns table values filter to apply separation size
-  //! \return filter instance
-  ViewControl_TableModelFilter* GetFilter() { return myFilter; }
-
-  //! Returns X step or -1 if it is not used
-  //! \return double value
-  double GetXStep() const { return myXStepActive ? myXStep->value() : -1;};
-
-  //! Sets X step
-  //! \param theValue value
-  void SetXStep(const double theValue) const { myXStep->setValue (theValue); };
-
-  //! Returns divide valid
-  //! \return control value
-  int GetDivideSize() const { return mySeparateSize->value(); }
-
-  //! Sets separate size value
-  //! \param theValue new value
-  void SetDivideSize (const int theValue) { mySeparateSize->setValue (theValue); }
-
-signals:
-  //! Signals about header cell is clicked
-  //! \param theEvent context menu event
-  void headerContextMenuRequsted (QContextMenuEvent* theEvent);
-
-  //! Signals about the following properties are changed: XStep.
-  void propertyChanged();
-
-protected slots:
-  //! Reacts to the spin box value change, it divides table model values to has given number of columns
-  //! \param theValue a new value of spin box
-  void onSeparateSizeChanged (int theValue);
-
-  //! Reacts to the tolerance value change, it sets it into table model
-  //! \param theValue a new value of spin box
-  void onToleranceSizeChanged (int theValue);
-
-public:
-  //! Updates controls by selection change in table view
-  //! \param theSelected container of selected table cells
-  //! \param theDeselected container of selected table cells
-  void UpdateOnTableSelectionChanged();
-
-private:
-  //! Changes visibility of XStep control, if visible, set parameter value
-  //! \param theState if true, the control is visible
-  //! \param theValue the current for the control
-  void setXStepActive (const bool theState, const double theValue = -1);
-
-private:
-  bool myIsActive; //!< state whether the control is visible and used
-  QWidget* myMainWidget; //!< parent of all controls
-  QLabel* mySize; //!< control to visualize initial values size
-  QLabel* myDivideSize; //!< size of division table values to rows
-  QSpinBox* mySeparateSize; //!< control to divide table by given size if thable has only 1 dimension
-  QLabel* myVisualizedSize; //!< control to visualize current table size
-
-  bool myXStepActive; //!< state whether the XStep control is visible
-  QLabel* myXStepLabel; //!< label of X step
-  QDoubleSpinBox* myXStep; //!< control to enter X step
-
-  QWidget* myInformationWidget; //!< parent of all controls
-  QPlainTextEdit* myModelInformation; //!< control to visualize current table size
-  QPushButton* myMinValue; //!< minimum table value
-  QPushButton* myMaxValue; //!< maximum table value
-  QPushButton* myMinSelectedValue; //!< minimum value of selected table cells
-  QPushButton* myMaxSelectedValue; //!< maximum value of selected table cells
-
-  ViewControl_Table* myTable; //!< table control
-  ViewControl_TableModelFilter* myFilter; //!< table values filter to apply separation size
-};
-#endif
index 0b75af801e6ef4d6e4c2c184ea1239f4a8828c5b..dece84a49ee1f1b63aa54e97fc6255aa03b6f6a1 100644 (file)
@@ -114,7 +114,7 @@ TCollection_AsciiString ViewControl_Tools::GetPointerInfo (const void* thePointe
     if (anInfoPtr.Value(aSymbolId) != '0')
     {
       anInfoPtr = anInfoPtr.SubString(aSymbolId, anInfoPtr.Length());
-      anInfoPtr.Prepend("0x");
+      anInfoPtr.Prepend(GetPointerPrefix());
       return anInfoPtr;
     }
   }
index 069c5e5abc589780c58020ada56d29d457d3dfbc..08c779e46f4964c9e47cb5a15f5d9f5f34f9180f 100644 (file)
@@ -42,6 +42,9 @@ class QWidget;
 class ViewControl_Tools
 {
 public:
+  //! Returns text of separation row in table
+  //! \return string value
+  static QString TableSeparator() { return "---------------------------"; }
 
   //! Creates an action with the given text connected to the slot
   //! \param theText an action text value
@@ -61,6 +64,9 @@ public:
   //! \param theOrientation header orientation
   Standard_EXPORT static void SetDefaultHeaderSections (QTableView* theTableView, const Qt::Orientation theOrientation);
 
+  //! Returns default prefix added for each pointer info string
+  Standard_EXPORT static TCollection_AsciiString GetPointerPrefix() { return "0x"; }
+
   //! Convert handle pointer to string value
   //! \param thePointer a pointer
   //! \param isShortInfo if true, all '0' symbols in the beginning of the pointer are skipped