]> OCCT Git - occt-copy.git/commitdiff
0029451: Information Message Alert to debug an algorithm or object functionality
authornds <nds@opencascade.com>
Wed, 17 Jul 2019 10:54:31 +0000 (13:54 +0300)
committernds <nds@opencascade.com>
Wed, 17 Jul 2019 10:54:31 +0000 (13:54 +0300)
Dump/Init implementation in OCCT object and parsing it in MessageView (VInspector later)

109 files changed:
src/BVH/BVH_Box.hxx
src/BVH/BVH_Tree.hxx
src/Bnd/Bnd_Box.cxx
src/Bnd/Bnd_Box.hxx
src/Bnd/Bnd_OBB.cxx
src/Bnd/Bnd_OBB.hxx
src/DRAWEXE/cmake_install.cmake [new file with mode: 0644]
src/Message/FILES
src/Message/Message_Alerts.hxx
src/Message/Message_AttributeObject.cxx
src/Message/Message_AttributeObject.hxx
src/Message/Message_AttributeStream.cxx [new file with mode: 0644]
src/Message/Message_AttributeStream.hxx [new file with mode: 0644]
src/Message/Message_AttributeVectorOfValues.cxx [deleted file]
src/Message/Message_AttributeVectorOfValues.hxx [deleted file]
src/Quantity/Quantity_Color.cxx
src/Quantity/Quantity_Color.hxx
src/Quantity/Quantity_ColorRGBA.cxx
src/Quantity/Quantity_ColorRGBA.hxx
src/SelectMgr/SelectMgr_ViewerSelector.cxx
src/Standard/FILES
src/Standard/Standard_DumpMask.hxx [new file with mode: 0644]
src/TCollection/TCollection.cxx
src/TCollection/TCollection.hxx
src/TCollection/TCollection_AsciiString.hxx
src/TopLoc/TopLoc_Datum3D.cxx
src/TopLoc/TopLoc_Datum3D.hxx
src/TopLoc/TopLoc_ItemLocation.cxx
src/TopLoc/TopLoc_ItemLocation.hxx
src/TopLoc/TopLoc_Location.cxx
src/TopLoc/TopLoc_Location.hxx
src/TopoDS/TopoDS_AlertAttribute.cxx
src/TopoDS/TopoDS_AlertAttribute.hxx
src/TopoDS/TopoDS_Shape.cxx
src/TopoDS/TopoDS_Shape.hxx
src/XCAFPrs/XCAFPrs_Style.cxx
src/XCAFPrs/XCAFPrs_Style.hxx
src/XmlDrivers/XmlDrivers_MessageReportStorage.cxx
src/gp/gp.cxx
src/gp/gp.hxx
src/gp/gp_Mat.cxx
src/gp/gp_Mat.hxx
src/gp/gp_Trsf.cxx
src/gp/gp_Trsf.hxx
src/gp/gp_XY.hxx
src/gp/gp_XY.lxx
src/gp/gp_XYZ.cxx
src/gp/gp_XYZ.hxx
src/gp/gp_XYZ.lxx
tools/Convert/Convert_Tools.cxx [new file with mode: 0644]
tools/Convert/Convert_Tools.hxx [new file with mode: 0644]
tools/Convert/Convert_TransientShape.cxx [new file with mode: 0644]
tools/Convert/Convert_TransientShape.hxx [new file with mode: 0644]
tools/Convert/FILES [new file with mode: 0644]
tools/MessageModel/FILES
tools/MessageModel/MessageModel_Actions.cxx
tools/MessageModel/MessageModel_Actions.hxx
tools/MessageModel/MessageModel_ItemAlert.cxx
tools/MessageModel/MessageModel_ItemPropertiesAttributeStream.cxx [new file with mode: 0644]
tools/MessageModel/MessageModel_ItemPropertiesAttributeStream.hxx [new file with mode: 0644]
tools/MessageModel/MessageModel_ItemPropertiesReport.cxx [new file with mode: 0644]
tools/MessageModel/MessageModel_ItemPropertiesReport.hxx [new file with mode: 0644]
tools/MessageModel/MessageModel_ItemReport.cxx
tools/MessageModel/MessageModel_ItemReportProperties.cxx [deleted file]
tools/MessageModel/MessageModel_ItemReportProperties.hxx [deleted file]
tools/MessageModel/MessageModel_TableModelValues.cxx [deleted file]
tools/MessageModel/MessageModel_TableModelValues.hxx [deleted file]
tools/MessageModel/MessageModel_Tools.cxx
tools/MessageView/MessageView_VisibilityState.cxx
tools/MessageView/MessageView_Window.cxx
tools/MessageView/MessageView_Window.hxx
tools/TInspectorEXE/TInspectorEXE.cxx
tools/TKTInspectorAPI/EXTERNLIB
tools/TKTInspectorAPI/PACKAGES
tools/TKView/EXTERNLIB
tools/TreeModel/TreeModel_ItemBase.cxx
tools/TreeModel/TreeModel_ItemProperties.cxx
tools/TreeModel/TreeModel_ItemProperties.hxx
tools/VInspector/FILES
tools/VInspector/VInspector_DisplayActionType.hxx [deleted file]
tools/VInspector/VInspector_ItemBVHTree.cxx
tools/VInspector/VInspector_ItemBVHTreeNode.cxx
tools/VInspector/VInspector_ItemPrs3dPresentation.cxx
tools/VInspector/VInspector_ItemSelect3DSensitiveSetItem.cxx
tools/VInspector/VInspector_ItemSelect3DSensitiveSetItem.hxx
tools/VInspector/VInspector_ItemSelectBasicsSensitiveEntity.cxx
tools/VInspector/VInspector_PreviewParameters.cxx [deleted file]
tools/VInspector/VInspector_PreviewParameters.hxx [deleted file]
tools/VInspector/VInspector_Tools.cxx
tools/VInspector/VInspector_Tools.hxx
tools/VInspector/VInspector_Window.cxx
tools/VInspector/VInspector_Window.hxx
tools/VInspectorPaneAIS/VInspectorPaneAIS_Shape.cxx
tools/View/FILES
tools/View/View_DisplayActionType.hxx [new file with mode: 0644]
tools/View/View_DisplayPreview.cxx [new file with mode: 0644]
tools/View/View_DisplayPreview.hxx [new file with mode: 0644]
tools/View/View_PreviewParameters.cxx [new file with mode: 0644]
tools/View/View_PreviewParameters.hxx [new file with mode: 0644]
tools/View/View_Widget.cxx
tools/ViewControl/FILES
tools/ViewControl/ViewControl_PropertiesStream.cxx
tools/ViewControl/ViewControl_Table.cxx
tools/ViewControl/ViewControl_Table.hxx
tools/ViewControl/ViewControl_TableModelValues.cxx
tools/ViewControl/ViewControl_Tools.cxx
tools/ViewControl/ViewControl_Tools.hxx
tools/ViewControl/ViewControl_TransientShape.cxx [deleted file]
tools/ViewControl/ViewControl_TransientShape.hxx [deleted file]

index 6bd67e4fe0f1620a219e551b59ac9de25532ff7d..47efa7fdecc28b88e58cd4167692570deec20b24 100644 (file)
@@ -20,6 +20,7 @@
 #include <BVH_Types.hxx>
 #include <Message_Alerts.hxx>
 #include <Standard_ShortReal.hxx>
+#include <TCollection.hxx>
 
 #include <limits>
 
@@ -115,10 +116,9 @@ public:
     DUMP_VALUES (OS, "BVH_Box", 2);
     DUMP_VALUES (OS, "IsValid", IsValid());
 
-    DUMP_VALUES (OS, "Bnd_Box", BVH::ToBndBox (CornerMin(), CornerMax()).ToString());
-
-    //DUMP_VALUES (OS, "CornerMin", BVH::ToString (CornerMin()));
-    //DUMP_VALUES (OS, "CornerMin", BVH::ToString (CornerMax()));
+    OS << "Bnd_Box" << TCollection::DumpSeparator();
+    BVH::ToBndBox (CornerMin(), CornerMax()).Dump (OS, Standard_DumpMask_SingleValue);
+    OS << TCollection::DumpSeparator();
   }
 
 public:
index 9209fbac8b7999c8ee1901a854f9a0b7a5d5460c..c17e3817f37b7c21e9cb6c13ee9a75cec73353a6 100644 (file)
@@ -211,7 +211,9 @@ public: //! @name methods for accessing serialized tree data
     DUMP_VALUES (OS, "BVH_TreeNode", 2);
     DUMP_VALUES (OS, "NodeIndex", theNodeIndex);
 
-    DUMP_VALUES (OS, "MinPoint - MaxPoint", BVH::ToBndBox (MinPoint (theNodeIndex), MaxPoint (theNodeIndex)).ToString());
+    OS << "Bnd_Box" << TCollection::DumpSeparator();
+    BVH::ToBndBox (MinPoint (theNodeIndex), MaxPoint (theNodeIndex)).Dump (OS, Standard_DumpMask_SingleValue);
+    OS << TCollection::DumpSeparator();
 
     DUMP_VALUES (OS, "BegPrimitive", BegPrimitive (theNodeIndex));
     DUMP_VALUES (OS, "EndPrimitive", EndPrimitive (theNodeIndex));
index d7e67d141ac86308f657d8217eb54235ea8feb99..cdd9dc9d7347503e46e7db6cb4003245a7474d9a 100644 (file)
 #include <gp_Pln.hxx>
 #include <gp_Pnt.hxx>
 #include <gp_Trsf.hxx>
+#include <NCollection_List.hxx>
 #include <Standard_ConstructionError.hxx>
+#include <TCollection.hxx>
+#include <TCollection_AsciiString.hxx>
 
 // set the flag to one
 #define ClearVoidFlag() ( Flags &= ~VoidMask )
@@ -980,39 +983,61 @@ TCollection_AsciiString PointsSeparator()
   return " - ";
 }
 
+
+const TCollection_AsciiString Bnd_Box_ClassName = "Bnd_Box";
+
 //=======================================================================
-//function : ToString
+//function : Dump
 //purpose  : 
 //=======================================================================
 
-TCollection_AsciiString Bnd_Box::ToString() const
+void Bnd_Box::Dump (Standard_OStream& OS, const Standard_Integer theMask) const
 {
-  return gp_XYZ (Xmin, Ymin, Zmin).ToString()
-        + PointsSeparator()
-        + gp_XYZ (Xmax, Ymax, Zmax).ToString();
+  DUMP_START_KEY (OS, Bnd_Box_ClassName);
+
+  DUMP_VALUES (OS, "Xmin", Xmin);
+  DUMP_VALUES (OS, "Ymin", Ymin);
+  DUMP_VALUES (OS, "Zmin", Zmin);
+  DUMP_VALUES (OS, "Xmax", Xmax);
+  DUMP_VALUES (OS, "Ymax", Ymax);
+  DUMP_VALUES (OS, "Zmax", Zmax);
+  DUMP_VALUES (OS, "Gap",  Gap);
+  DUMP_VALUES (OS, "Flags", Flags);
+
+  DUMP_STOP_KEY (OS, Bnd_Box_ClassName);
 }
 
 //=======================================================================
-//function : FromString
+//function : Init
 //purpose  : 
 //=======================================================================
 
-Standard_Boolean Bnd_Box::FromString (const TCollection_AsciiString& theValue)
+Standard_Boolean Bnd_Box::Init (const Standard_OStream& OS)
 {
-  TCollection_AsciiString aCurrentString = theValue;
-  Standard_Integer aPosition = aCurrentString.Search (PointsSeparator());
-  if (aPosition < 0)
-    return Standard_False;
+  NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString> aStreamValues;
+  Standard_SStream aSStream (OS);
+  TCollection::Split (aSStream, aStreamValues);
+
+  TCollection_AsciiString anXYZValue;
+  if (aStreamValues.Size() == 1)
+  {
+    TCollection_AsciiString aValueStr = aStreamValues.FindFromIndex (1);
+    Standard_Integer aPosition = aValueStr.Search (Bnd_Box_ClassName + TCollection::ClassNameSeparator());
+    if (aPosition < 1)
+      return Standard_False;
+    anXYZValue = aValueStr.Split (aPosition);
+  }
 
-  TCollection_AsciiString aLeftString = aCurrentString;
-  TCollection_AsciiString aRightString = aLeftString.Split (aPosition - 1);
-  aCurrentString = aRightString;
-  aRightString = aCurrentString.Split (PointsSeparator().Length());
+  NCollection_Vector<Standard_Real> aValues;
+  if (!TCollection::SplitReal (anXYZValue, TCollection::VectorSeparator(), aValues))
+    return Standard_False;
 
-  gp_XYZ aMinPoint, aMaxPoint;
-  if (!aMinPoint.FromString (aLeftString) || !aMaxPoint.FromString (aRightString))
+  if (aValues.Size() != 8)
     return Standard_False;
 
-  Update (aMinPoint.X(), aMinPoint.Y(), aMinPoint.Z(), aMaxPoint.X(), aMaxPoint.Y(), aMaxPoint.Z());
+  Update (aValues.Value (1), aValues.Value (2), aValues.Value (3), aValues.Value (4), aValues.Value (5), aValues.Value (6));
+  Gap = aValues.Value (7);
+  Flags = (Standard_Integer)aValues.Value (8);
+
   return Standard_True;
 }
index fcc9bbf082a4834633d9b58bcc471e0ec202bb67..30b41958e3c063c1161a8a033a16bf7006a55391 100644 (file)
@@ -19,6 +19,7 @@
 
 #include <Standard.hxx>
 #include <Standard_DefineAlloc.hxx>
+#include <Standard_DumpMask.hxx>
 #include <Standard_Handle.hxx>
 
 #include <Standard_Real.hxx>
@@ -308,13 +309,11 @@ public:
          && Xmax >= Xmin;
   }
 
-  //! Covers bounding box into string in format: (Xmin, Ymin, Zmin) - (Xmax, Ymax, Zmax)
-  //! \return the string value
-  Standard_EXPORT TCollection_AsciiString ToString() const;
+  //! Dumps the content of me on the stream <OS>.
+  Standard_EXPORT void Dump (Standard_OStream& OS, const Standard_Integer theMask = Standard_DumpMask_Whole) const;
 
-  //! Converts text value into parameters if possible, the string format is: (Xmin, Ymin, Zmin) - (Xmax, Ymax, Zmax)
-  //! \return true if conversion is done
-  Standard_EXPORT Standard_Boolean FromString (const TCollection_AsciiString& theValue);
+  //! Dumps the content of me on the stream <OS>.
+  Standard_EXPORT Standard_Boolean Init (const Standard_OStream& OS);
 
 protected:
 
index a37586bef669135b21e5c8542d27aa39a9d6b237..d59b0a058df90f674cdd00288bc1fcd7da403a9b 100644 (file)
@@ -17,6 +17,7 @@
 #include <Bnd_B3d.hxx>
 #include <NCollection_Array1.hxx>
 #include <Precision.hxx>
+#include <TCollection.hxx>
 #include <TColStd_Array1OfReal.hxx>
 
 class OBBTool
@@ -677,19 +678,79 @@ void Bnd_OBB::Add(const Bnd_OBB& theOther)
   ReBuild(TColgp_Array1OfPnt(aList[0], 0, 15));
 }
 
-// =======================================================================
-// function : Init
-// purpose  : 
-// =======================================================================
-Standard_Boolean Bnd_OBB::Init (const Standard_OStream&)
+const TCollection_AsciiString Bnd_OBB_ClassName = "Bnd_OBB";
+
+//=======================================================================
+//function : Dump
+//purpose  : 
+//=======================================================================
+
+void Bnd_OBB::Dump (Standard_OStream& OS, const Standard_Integer /*theMask*/) const
 {
-  return Standard_False;
+  DUMP_START_KEY (OS, Bnd_OBB_ClassName);
+  {
+    Standard_SStream aTmpStream;
+    myCenter.Dump (aTmpStream);
+    DUMP_VALUES (OS, "Center", TCollection::ToDumpString (aTmpStream));
+  }
+  {
+    Standard_SStream aTmpStream;
+    myAxes[0].Dump (aTmpStream);
+    DUMP_VALUES (OS, "XAxis", TCollection::ToDumpString (aTmpStream));
+  }
+  {
+    Standard_SStream aTmpStream;
+    myAxes[1].Dump (aTmpStream);
+    DUMP_VALUES (OS, "YAxis", TCollection::ToDumpString (aTmpStream));
+  }
+  {
+    Standard_SStream aTmpStream;
+    myAxes[2].Dump (aTmpStream);
+    DUMP_VALUES (OS, "ZAxis", TCollection::ToDumpString (aTmpStream));
+  }
+
+  DUMP_VALUES (OS, "XHSize", XHSize());
+  DUMP_VALUES (OS, "YHSize", YHSize());
+  DUMP_VALUES (OS, "ZHSize", ZHSize());
+  DUMP_VALUES (OS, "IsAABox", myIsAABox);
+
+  DUMP_STOP_KEY (OS, Bnd_OBB_ClassName);
 }
 
-// =======================================================================
-// function : Dump
-// purpose  : 
-// =======================================================================
-void Bnd_OBB::Dump (Standard_OStream&) const
+//=======================================================================
+//function : Init
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean Bnd_OBB::Init (const Standard_OStream& /*OS*/)
 {
+  //NCollection_DataMap<TCollection_AsciiString, TCollection_AsciiString> aStreamValues;
+  //Standard_SStream aSStream (OS);
+  //TCollection::Split (aSStream, aStreamValues);
+
+  //TCollection_AsciiString anXYZValue;
+  //if (aStreamValues.Size() == 1)
+  //{
+  //  NCollection_DataMap<TCollection_AsciiString, TCollection_AsciiString>::Iterator anIterator (aStreamValues);
+  //  TCollection_AsciiString aValueStr = anIterator.Value();
+  //  Standard_Integer aPosition = aValueStr.Search (Bnd_Box_ClassName + TCollection::ClassNameSeparator());
+  //  if (aPosition < 1)
+  //    return Standard_False;
+  //  anXYZValue = aValueStr.Split (aPosition);
+  //}
+
+  //NCollection_Vector<Standard_Real> aValues;
+  //if (!TCollection::SplitReal (anXYZValue, TCollection::VectorSeparator(), aValues))
+  //  return Standard_False;
+
+  //if (aValues.Size() != 8)
+  //  return Standard_False;
+
+  //Update (aValues.Value (1), aValues.Value (2), aValues.Value (3), aValues.Value (4), aValues.Value (5), aValues.Value (6));
+  //Gap = aValues.Value (7);
+  //Flags = (Standard_Integer)aValues.Value (8);
+
+  //return Standard_True;
+
+  return Standard_False;
 }
index 86da8d3bb1a3ebe0999ba110b3fd4cfb6e25c42c..0a3b2212cf6cb478dbda085180ee6cd304109b2e 100644 (file)
@@ -17,6 +17,7 @@
 
 #include <Standard.hxx>
 #include <Standard_DefineAlloc.hxx>
+#include <Standard_DumpMask.hxx>
 #include <Standard_Handle.hxx>
 #include <Standard_Real.hxx>
 #include <Standard_Boolean.hxx>
@@ -277,6 +278,12 @@ public:
   //! (which it was created from) and theP.
   Standard_EXPORT void Add(const gp_Pnt& theP);
 
+  //! Dumps the content of me on the stream <OS>.
+  Standard_EXPORT Standard_Boolean Init (const Standard_OStream& OS);
+
+  //! Dumps the content of me on the stream <OS>.
+  Standard_EXPORT void Dump (Standard_OStream& OS, const Standard_Integer = Standard_DumpMask_Whole) const;
+
 protected:
 
     void ProcessOnePoint(const gp_Pnt& theP)
@@ -289,12 +296,6 @@ protected:
       myCenter = theP.XYZ();
     }
 
-  //! Dumps the content of me on the stream <OS>.
-  Standard_EXPORT Standard_Boolean Init (const Standard_OStream& OS);
-
-  //! Dumps the content of me on the stream <OS>.
-  Standard_EXPORT void Dump (Standard_OStream& OS) const;
-
 private:
 
   //! Center of the OBB
diff --git a/src/DRAWEXE/cmake_install.cmake b/src/DRAWEXE/cmake_install.cmake
new file mode 100644 (file)
index 0000000..0a427f4
--- /dev/null
@@ -0,0 +1,54 @@
+# Install script for directory: F:/Projects/DMUReviewer/3rd-parties_prepared/occt_CR0_DMUReviewer_5/src/DRAWEXE\r
+\r
+# Set the install prefix\r
+if(NOT DEFINED CMAKE_INSTALL_PREFIX)\r
+  set(CMAKE_INSTALL_PREFIX "F:/Projects/DMUReviewer/Deps/3rd-parties_2019-06-18_Rina/occt-vc12-64")\r
+endif()\r
+string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")\r
+\r
+# Set the install configuration name.\r
+if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)\r
+  if(BUILD_TYPE)\r
+    string(REGEX REPLACE "^[^A-Za-z0-9_]+" ""\r
+           CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}")\r
+  else()\r
+    set(CMAKE_INSTALL_CONFIG_NAME "Release")\r
+  endif()\r
+  message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"")\r
+endif()\r
+\r
+# Set the component getting installed.\r
+if(NOT CMAKE_INSTALL_COMPONENT)\r
+  if(COMPONENT)\r
+    message(STATUS "Install component: \"${COMPONENT}\"")\r
+    set(CMAKE_INSTALL_COMPONENT "${COMPONENT}")\r
+  else()\r
+    set(CMAKE_INSTALL_COMPONENT)\r
+  endif()\r
+endif()\r
+\r
+# Is this installation the result of a crosscompile?\r
+if(NOT DEFINED CMAKE_CROSSCOMPILING)\r
+  set(CMAKE_CROSSCOMPILING "FALSE")\r
+endif()\r
+\r
+if("x${CMAKE_INSTALL_COMPONENT}x" STREQUAL "xUnspecifiedx" OR NOT CMAKE_INSTALL_COMPONENT)\r
+  if ("${CMAKE_INSTALL_CONFIG_NAME}" MATCHES "^([Rr][Ee][Ll][Ee][Aa][Ss][Ee])$")\r
+    set (OCCT_INSTALL_BIN_LETTER "")\r
+  elseif ("${CMAKE_INSTALL_CONFIG_NAME}" MATCHES "^([Rr][Ee][Ll][Ww][Ii][Tt][Hh][Dd][Ee][Bb][Ii][Nn][Ff][Oo])$")\r
+    set (OCCT_INSTALL_BIN_LETTER "i")\r
+  elseif ("${CMAKE_INSTALL_CONFIG_NAME}" MATCHES "^([Dd][Ee][Bb][Uu][Gg])$")\r
+    set (OCCT_INSTALL_BIN_LETTER "d")\r
+  endif()\r
+endif()\r
+\r
+if("x${CMAKE_INSTALL_COMPONENT}x" STREQUAL "xUnspecifiedx" OR NOT CMAKE_INSTALL_COMPONENT)\r
+  if("${CMAKE_INSTALL_CONFIG_NAME}" MATCHES "^([Rr][Ee][Ll][Ee][Aa][Ss][Ee])$")\r
+    file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/win64/vc12/bin${OCCT_INSTALL_BIN_LETTER}" TYPE EXECUTABLE FILES "F:/Projects/DMUReviewer/3rd-parties_prepared/occt_CR0_DMUReviewer_5/win64/vc12/bin/DRAWEXE.exe")\r
+  elseif("${CMAKE_INSTALL_CONFIG_NAME}" MATCHES "^([Dd][Ee][Bb][Uu][Gg])$")\r
+    file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/win64/vc12/bin${OCCT_INSTALL_BIN_LETTER}" TYPE EXECUTABLE FILES "F:/Projects/DMUReviewer/3rd-parties_prepared/occt_CR0_DMUReviewer_5/win64/vc12/bind/DRAWEXE.exe")\r
+  elseif("${CMAKE_INSTALL_CONFIG_NAME}" MATCHES "^([Rr][Ee][Ll][Ww][Ii][Tt][Hh][Dd][Ee][Bb][Ii][Nn][Ff][Oo])$")\r
+    file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/win64/vc12/bin${OCCT_INSTALL_BIN_LETTER}" TYPE EXECUTABLE FILES "F:/Projects/DMUReviewer/3rd-parties_prepared/occt_CR0_DMUReviewer_5/win64/vc12/bini/DRAWEXE.exe")\r
+  endif()\r
+endif()\r
+\r
index e52f824502d716fc99df88d1536f58ddf4fe26de..9ec78694e27243e6140974be744f4bebea7cdaf9 100755 (executable)
@@ -12,8 +12,8 @@ Message_Attribute.cxx
 Message_Attribute.hxx
 Message_AttributeObject.cxx
 Message_AttributeObject.hxx
-Message_AttributeVectorOfValues.cxx
-Message_AttributeVectorOfValues.hxx
+Message_AttributeStream.cxx
+Message_AttributeStream.hxx
 Message_CompositeAlerts.cxx
 Message_CompositeAlerts.hxx
 Message_ExecStatus.hxx
index d1789025b2f07ff7f4aba23dc334860e149ad73d..9f73a1f56c15921458861865163f915f55a79584 100644 (file)
@@ -19,7 +19,7 @@
 #include <Message.hxx>
 #include <Message_AlertExtended.hxx>
 #include <Message_AttributeObject.hxx>
-#include <Message_AttributeVectorOfValues.hxx>
+#include <Message_AttributeStream.hxx>
 #include <Message_Gravity.hxx>
 #include <Message_Report.hxx>
 
@@ -38,65 +38,65 @@ static Handle(Message_Alert) OCCT_Message_Alert;
     } \
   }
 
-#define MESSAGE_INFO_OBJECT(Object, Name, Description, PerfMeter, ParentAlert) \
+#define MESSAGE_INFO_OBJECT(Object, 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_AttributeObject (Object, Name, Description), PerfMeter, ParentAlert ); \
+        new Message_AttributeObject (Object, StreamValues, Name, Description), PerfMeter, ParentAlert ); \
     } \
   }
 
-#define MESSAGE_INFO_VALUES(StreamValues, Name, Description, PerfMeter, ParentAlert) \
+#define MESSAGE_INFO_STREAM(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 ); \
+        new Message_AttributeStream (StreamValues, Name, Description), PerfMeter, ParentAlert ); \
     } \
   }
 
-#define DUMP_VALUE(OS, Value) \
-  { \
-    OS << Value << Message::DumpSeparator(); \
-  }
-
-#define DUMP_VALUES_COLUMNS(OS, ObjectName, ColumnCount) \
-  { \
-    OS << ObjectName << Message::DumpSeparator() << ColumnCount << Message::DumpSeparator(); \
-  }
-
-#define DUMP_VALUES(OS, Value1, Value2) \
-  { \
-    OS << Value1 << Message::DumpSeparator() << Value2 << Message::DumpSeparator(); \
-  }
-
-#define DUMP_VEC_COLOR(Values, Value) \
-  { \
-    Value = Message::ColorVectorToString (aValues); \
-  }
-
-#define DUMP_VEC_COLOR_SPLIT(Value, Values) \
-  { \
-    Message::ColorVectorFromString (Value, Values); \
-  }
-
-#define DUMP_VEC_COORD(Values, Value) \
-  { \
-    Value = Message::CoordVectorToString (aValues); \
-  }
-
-#define DUMP_VEC_COORD_SPLIT(Value, Values) \
-  { \
-    Message::CoordVectorFromString (Value, Values); \
-  }
-
-
-#define DUMP_VALUES_SPLIT(OS, ColumnCount, Values) \
-  { \
-    Message::ConvertStream (OS, aColumnCount, aValues); \
-  }
+//#define DUMP_VALUE(OS, Value) \
+//  { \
+//    OS << Value << Message::DumpSeparator(); \
+//  }
+//
+//#define DUMP_VALUES_COLUMNS(OS, ObjectName, ColumnCount) \
+//  { \
+//    OS << ObjectName << Message::DumpSeparator() << ColumnCount << Message::DumpSeparator(); \
+//  }
+//
+//#define DUMP_VALUES(OS, Value1, Value2) \
+//  { \
+//    OS << Value1 << Message::DumpSeparator() << Value2 << Message::DumpSeparator(); \
+//  }
+//
+//#define DUMP_VEC_COLOR(Values, Value) \
+//  { \
+//    Value = Message::ColorVectorToString (aValues); \
+//  }
+//
+//#define DUMP_VEC_COLOR_SPLIT(Value, Values) \
+//  { \
+//    Message::ColorVectorFromString (Value, Values); \
+//  }
+//
+//#define DUMP_VEC_COORD(Values, Value) \
+//  { \
+//    Value = Message::CoordVectorToString (aValues); \
+//  }
+//
+//#define DUMP_VEC_COORD_SPLIT(Value, Values) \
+//  { \
+//    Message::CoordVectorFromString (Value, Values); \
+//  }
+//
+//
+//#define DUMP_VALUES_SPLIT(OS, ColumnCount, Values) \
+//  { \
+//    Message::ConvertStream (OS, aColumnCount, aValues); \
+//  }
 
 #endif // _Message_Alerts_HeaderFile
index 83788cacdbca095fe4ea744279126e3307a0284a..b31ad97cd0f3fd53781d33ec7bfb1369726062e8 100644 (file)
@@ -15,7 +15,7 @@
 
 #include <Message_AttributeObject.hxx>
 
-IMPLEMENT_STANDARD_RTTIEXT(Message_AttributeObject, Message_Attribute)
+IMPLEMENT_STANDARD_RTTIEXT(Message_AttributeObject, Message_AttributeStream)
 
 //=======================================================================
 //function : Message_AttributeObject
@@ -23,9 +23,10 @@ IMPLEMENT_STANDARD_RTTIEXT(Message_AttributeObject, Message_Attribute)
 //=======================================================================
 
 Message_AttributeObject::Message_AttributeObject (const Handle(Standard_Transient)& theObject,
+                                                  const Standard_SStream& theStream,
                                                   const TCollection_AsciiString& theName,
                                                   const TCollection_AsciiString& theDescription)
-: Message_Attribute (theName, theDescription)
+: Message_AttributeStream (theStream, theName, theDescription)
 {
   myObject = theObject;
 }
index bbf7afe727b9553f39800bfec63752a858b8ad3f..29e45e98ca0fb9d78efe47f9b7cd1c082711cd96 100644 (file)
 #ifndef _Message_AttributeObject_HeaderFile
 #define _Message_AttributeObject_HeaderFile
 
-#include <Message_Attribute.hxx>
+#include <Message_AttributeStream.hxx>
 #include <TCollection_AsciiString.hxx>
 
 //! Alert object storing Transient object in its field
-class Message_AttributeObject : public Message_Attribute
+class Message_AttributeObject : public Message_AttributeStream
 {
 public:
   //! Constructor with string argument
   Standard_EXPORT Message_AttributeObject (const Handle(Standard_Transient)& theObject,
+    const Standard_SStream& theStream,
     const TCollection_AsciiString& theName = TCollection_AsciiString(),
     const TCollection_AsciiString& theDescription = TCollection_AsciiString());
 
@@ -36,7 +37,7 @@ public:
   Handle(Standard_Transient) GetObject() const { return myObject; }
 
   // OCCT RTTI
-  DEFINE_STANDARD_RTTIEXT(Message_AttributeObject, Message_Attribute)
+  DEFINE_STANDARD_RTTIEXT(Message_AttributeObject, Message_AttributeStream)
 
 private:
   Handle(Standard_Transient) myObject;
diff --git a/src/Message/Message_AttributeStream.cxx b/src/Message/Message_AttributeStream.cxx
new file mode 100644 (file)
index 0000000..0e4ed5f
--- /dev/null
@@ -0,0 +1,47 @@
+// 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_AttributeStream.hxx>
+
+#include <Message.hxx>
+#include <Message_Msg.hxx>
+#include <Message_PerfMeter.hxx>
+#include <Message_Report.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(Message_AttributeStream, Message_Attribute)
+
+//=======================================================================
+//function : SetValues
+//purpose  : 
+//=======================================================================
+Message_AttributeStream::Message_AttributeStream (const Standard_SStream& theStream,
+                                                  const TCollection_AsciiString& theName,
+                                                  const TCollection_AsciiString& theDescription)
+: Message_Attribute(theName, theDescription)
+{
+  SetStream (theStream);
+}
+
+//=======================================================================
+//function : SetStream
+//purpose  : 
+//=======================================================================
+
+void Message_AttributeStream::SetStream (const Standard_SStream& theStream)
+{
+  TCollection_AsciiString aStreamStr (theStream.str().c_str());
+  myStream << aStreamStr;
+}
+
diff --git a/src/Message/Message_AttributeStream.hxx b/src/Message/Message_AttributeStream.hxx
new file mode 100644 (file)
index 0000000..c0a3218
--- /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.
+
+#ifndef _Message_AttributeStream_HeaderFile
+#define _Message_AttributeStream_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_AttributeStream : public Message_Attribute
+{
+public:
+
+  //! Constructor with string argument
+  Standard_EXPORT Message_AttributeStream (const Standard_SStream& theStream,
+                                           const TCollection_AsciiString& theName = TCollection_AsciiString(),
+                                           const TCollection_AsciiString& theDescription = TCollection_AsciiString());
+
+  //! Sets stream value
+  Standard_EXPORT void SetStream (const Standard_SStream& theStream);
+
+  //! Returns stream value
+  const Standard_SStream& GetStream() const { return myStream; }
+
+  // OCCT RTTI
+  DEFINE_STANDARD_RTTIEXT(Message_AttributeStream, Message_Attribute)
+
+private:
+  Standard_SStream myStream; //!< container of values
+};
+
+#endif // _Message_AttributeStream_HeaderFile
diff --git a/src/Message/Message_AttributeVectorOfValues.cxx b/src/Message/Message_AttributeVectorOfValues.cxx
deleted file mode 100644 (file)
index 3d389a1..0000000
+++ /dev/null
@@ -1,117 +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_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_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
deleted file mode 100644 (file)
index 369991d..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.
-
-#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 16b70496f511e2efad515c781fe207203313ed97..5ade8c2482cad14b6c2e616dd953b4f97da57e6e 100644 (file)
@@ -22,6 +22,7 @@
 #include <Quantity_ColorRGBA.hxx>
 #include <Standard_ErrorHandler.hxx>
 #include <Standard_OutOfRange.hxx>
+#include <TCollection.hxx>
 #include <TCollection_AsciiString.hxx>
 
 #include <string.h>
@@ -3928,40 +3929,59 @@ void call_rgbhls (float r, float g, float b, float& h, float& l, float& s)
        }
 }
 
+
+const TCollection_AsciiString Quantity_Color_ClassName = "Quantity_Color";
+
 //=======================================================================
-// function : ToString
-// purpose  :
+//function : Dump
+//purpose  : 
 //=======================================================================
-TCollection_AsciiString Quantity_Color::ToString() const
-{
-  NCollection_Vector<Standard_Real> aValues;
-  aValues.Append (MyRed);
-  aValues.Append (MyGreen);
-  aValues.Append (MyBlue);
 
-  Standard_SStream OS;
+void Quantity_Color::Dump (Standard_OStream& OS, const Standard_Integer theMask) const
+{
+  DUMP_START_KEY (OS, Quantity_Color_ClassName);
 
-  TCollection_AsciiString aValue;
-  DUMP_VEC_COLOR(aValues, aValue)
+  DUMP_VALUES (OS, "MyRed", MyRed);
+  DUMP_VALUES (OS, "MyGreen", MyGreen);
+  DUMP_VALUES (OS, "MyBlue", MyBlue);
 
-  return aValue;
+  DUMP_STOP_KEY (OS, Quantity_Color_ClassName);
 }
 
 //=======================================================================
-// function : FromString
-// purpose  :
+//function : Init
+//purpose  : 
 //=======================================================================
-Standard_Boolean Quantity_Color::FromString (const TCollection_AsciiString& theValue)
-{
-  NCollection_Vector<Standard_Real> aValues;
-  DUMP_VEC_COLOR_SPLIT (theValue, aValues)
 
-  if (aValues.Size() != 3)
-    return Standard_False;
-
-  MyRed = (Standard_ShortReal)aValues.Value (0);
-  MyGreen = (Standard_ShortReal)aValues.Value (1);
-  MyBlue = (Standard_ShortReal)aValues.Value (2);
+Standard_Boolean Quantity_Color::Init (const Standard_OStream& OS)
+{
+  //NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString> aStreamValues;
+  //Standard_SStream aSStream (OS);
+  //TCollection::Split (aSStream, aStreamValues);
+
+  //TCollection_AsciiString anXYZValue;
+  //if (!aStreamValues.FindFromKey (Quantity_Color_ClassName, anXYZValue))
+  //  anXYZValue = anXYZValue;
+  //else if (aStreamValues.Size() == 1)
+  //{
+  //  NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString>::Iterator anIterator (aStreamValues);
+  //  TCollection_AsciiString aValueStr = anIterator.Value();
+  //  Standard_Integer aPosition = aValueStr.Search (Quantity_Color_ClassName + TCollection::ClassNameSeparator());
+  //  if (aPosition < 1)
+  //    return Standard_False;
+  //  anXYZValue = aValueStr.Split (aPosition);
+  //}
+
+  //NCollection_Vector<Standard_Real> aValues;
+  //if (!TCollection::SplitReal (anXYZValue, TCollection::VectorSeparator(), aValues))
+  //  return Standard_False;
+
+  //if (aValues.Size() != 3)
+  //  return Standard_False;
+
+  //MyRed = (Standard_ShortReal)aValues.Value (1);
+  //MyGreen = (Standard_ShortReal)aValues.Value (2);
+  //MyBlue = (Standard_ShortReal)aValues.Value (3);
 
   return Standard_True;
 }
index 43de9e086479a4fb729e2e759d7d9d9db80d229e..f164e5a257e8e0f0fb7a56482574c86a540f74c6 100644 (file)
@@ -18,6 +18,7 @@
 
 #include <Standard.hxx>
 #include <Standard_DefineAlloc.hxx>
+#include <Standard_DumpMask.hxx>
 #include <Standard_Handle.hxx>
 
 #include <Standard_ShortReal.hxx>
@@ -265,13 +266,11 @@ Standard_Boolean operator == (const Quantity_Color& Other) const
   //! Internal test
   Standard_EXPORT static void Test();
 
-  //! Covers point into string in format: (X, Y, Z)
-  //! \return the string value
-  Standard_EXPORT TCollection_AsciiString ToString() const;
+  //! Dumps the content of me on the stream <OS>.
+  Standard_EXPORT void Dump (Standard_OStream& OS, const Standard_Integer theMask = Standard_DumpMask_Whole) const;
 
-  //! Converts text value into parameters if possible, the string format is: (X, Y, Z)
-  //! \return true if conversion is done
-  Standard_EXPORT Standard_Boolean FromString (const TCollection_AsciiString& theValue);
+  //! Dumps the content of me on the stream <OS>.
+  Standard_EXPORT Standard_Boolean Init (const Standard_OStream& OS);
 
 private:
 
index b7ade567a5a82adb7a65ae0e9f0848ba7667b90a..ddc623c5728058ddfcf5743deaaa37090ef804ff 100644 (file)
@@ -16,6 +16,7 @@
 #include <Quantity_ColorRGBA.hxx>
 
 #include <Graphic3d_Vec4.hxx>
+#include <TCollection.hxx>
 
 #include <algorithm>
 
@@ -198,3 +199,24 @@ bool Quantity_ColorRGBA::ColorFromHex (const char* const   theHexColorString,
   const ColorInteger aColorComponentBase = isShort ? THE_HEX_COLOR_COMPONENT_SHORT_BASE : THE_HEX_COLOR_COMPONENT_BASE;
   return convertIntegerToColorRGBA (aHexColorInteger, aColorComponentBase, hasAlphaComponent, theColor);
 }
+
+const TCollection_AsciiString Quantity_ColorRGBA_ClassName = "Quantity_ColorRGBA";
+
+//=======================================================================
+//function : Dump
+//purpose  : 
+//=======================================================================
+
+void Quantity_ColorRGBA::Dump (Standard_OStream& OS, const Standard_Integer /*theMask*/) const
+{
+  DUMP_START_KEY (OS, Quantity_ColorRGBA_ClassName);
+
+  DUMP_VALUES (OS, "Alpha", Alpha());
+  {
+    Standard_SStream aTmpStream;
+    myRgb.Dump (aTmpStream);
+    DUMP_VALUES (OS, "RGB", TCollection::ToDumpString (aTmpStream));
+  }
+
+  DUMP_STOP_KEY (OS, Quantity_ColorRGBA_ClassName);
+}
index c67cd524890249c6c1f4f06dde8e20cd17ba22b5..3dcc33b1cf9cdcd83c943c5fece6f78e3c76e85e 100644 (file)
@@ -121,6 +121,9 @@ public:
                                             Quantity_ColorRGBA& theColor,
                                             const bool          theAlphaComponentIsOff = false);
 
+  //! Dumps the content of me on the stream <OS>.
+  Standard_EXPORT void Dump (Standard_OStream& OS, const Standard_Integer theMask = Standard_DumpMask_Whole) const;
+
 private:
 
   static void myTestSize3() { Standard_STATIC_ASSERT (sizeof(float) * 3 == sizeof(Quantity_Color)); }
index 8f88db8b5be5587678a938078b66c260360b10bb..cc403b7632fac2221e14b35aeea550b47ebced7f 100644 (file)
@@ -219,7 +219,8 @@ void SelectMgr_ViewerSelector::checkOverlap (const Handle(Select3D_SensitiveEnti
 {
   #ifdef REPORT_SELECTION_BUILD
   Message_PerfMeter aPerfMeter;
-  MESSAGE_INFO_OBJECT (theEntity, "checkOverlap", "", &aPerfMeter, NULL);
+  Standard_SStream aStream;
+  MESSAGE_INFO_OBJECT (theEntity, aStream, "checkOverlap", "", &aPerfMeter, NULL);
   Handle(Message_Alert) aParentAlert = OCCT_Message_Alert;
   #endif
 
@@ -397,7 +398,8 @@ void SelectMgr_ViewerSelector::traverseObject (const Handle(SelectMgr_Selectable
 
   #ifdef REPORT_SELECTION_BUILD
   Message_PerfMeter aPerfMeter;
-  MESSAGE_INFO_OBJECT (theObject, "traverseObject", "", &aPerfMeter, NULL);
+  Standard_SStream aStream;
+  MESSAGE_INFO_OBJECT (theObject, aStream, "traverseObject", "", &aPerfMeter, NULL);
   Handle(Message_Alert) aParentAlert = OCCT_Message_Alert;
   #endif
 
@@ -616,7 +618,7 @@ void SelectMgr_ViewerSelector::TraverseSensitives()
 
   Standard_SStream aStream;
   Dump (aStream);
-  MESSAGE_INFO_VALUES (aStream, "Parameters", "", &aPerfMeter, aParentAlert);
+  MESSAGE_INFO_STREAM (aStream, "Parameters", "", &aPerfMeter, aParentAlert);
 #endif
 
   mystored.Clear();
@@ -770,7 +772,7 @@ void SelectMgr_ViewerSelector::TraverseSensitives()
 #ifdef REPORT_SELECTION_BUILD
   Standard_SStream aStreamDone;
   Dump (aStreamDone);
-  MESSAGE_INFO_VALUES (aStreamDone, "Parameters", "", &aPerfMeter, aParentAlert);
+  MESSAGE_INFO_STREAM (aStreamDone, "Parameters", "", &aPerfMeter, aParentAlert);
 #endif
 }
 
index 1199f5f973318facc5a00ec24ea861e0ceaec81c..79bcc5a515ed5786af8e5e537727ee6d435dd6bf 100755 (executable)
@@ -24,6 +24,7 @@ Standard_DimensionError.hxx
 Standard_DimensionMismatch.hxx
 Standard_DivideByZero.hxx
 Standard_DomainError.hxx
+Standard_DumpMask.hxx
 Standard_ErrorHandler.cxx
 Standard_ErrorHandler.hxx
 Standard_ExtCharacter.hxx
diff --git a/src/Standard/Standard_DumpMask.hxx b/src/Standard/Standard_DumpMask.hxx
new file mode 100644 (file)
index 0000000..5fe2355
--- /dev/null
@@ -0,0 +1,30 @@
+// 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 _Standard_DumpMask_HeaderFile
+#define _Standard_DumpMask_HeaderFile
+
+
+//! Sets how much information should be dumped in Dump of the object
+enum Standard_DumpMask
+{
+  Standard_DumpMask_Empty        = 0x0000, //! empty output
+  Standard_DumpMask_Fields       = 0x0001, //! only class fields value
+  Standard_DumpMask_Methods      = 0x0002, //! only methods result
+  Standard_DumpMask_ClassName    = 0x0004, //! the first row of Dump has class name
+  Standard_DumpMask_SingleValue  = 0x0008, //! dump is combined in one value
+  Standard_DumpMask_Whole = Standard_DumpMask_Fields | Standard_DumpMask_Methods,
+  Standard_DumpMask_WholeAndClassName = Standard_DumpMask_Whole | Standard_DumpMask_ClassName
+};
+
+#endif // _Standard_DumpMask_HeaderFile
index 667b058423180ba1c3c819f54cac1ce4f917b918..e07f8f7f4bfa22707fce319fc926091c909b3ceb 100644 (file)
@@ -17,6 +17,7 @@
 #include <TCollection.hxx>
 
 #include <Standard_OutOfRange.hxx>
+#include <TCollection_AsciiString.hxx>
 
 // The array of prime numbers used as consequtive steps for 
 // size of array of buckets in the map.
@@ -72,3 +73,288 @@ Standard_Integer TCollection::NextPrimeForMap(const Standard_Integer N)
   }
   throw Standard_OutOfRange ("TCollection::NextPrimeForMap() - requested too big size");
 }
+
+// =======================================================================
+// function : GetPointerInfo
+// purpose :
+// =======================================================================
+
+TCollection_AsciiString TCollection::GetPointerInfo (const Handle(Standard_Transient)& thePointer, const bool isShortInfo)
+{
+  if (thePointer.IsNull())
+    return TCollection_AsciiString();
+
+  return GetPointerInfo(thePointer.operator->(), isShortInfo);
+}
+
+// =======================================================================
+// function : GetPointerInfo
+// purpose :
+// =======================================================================
+
+TCollection_AsciiString TCollection::GetPointerInfo (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(GetPointerPrefix());
+      return anInfoPtr;
+    }
+  }
+  return aPtrStr.str().c_str();
+}
+
+// ----------------------------------------------------------------------------
+// Join
+// ----------------------------------------------------------------------------
+
+TCollection_AsciiString TCollection::Join (const NCollection_List<TCollection_AsciiString>& theValues,
+                                           const TCollection_AsciiString& theSeparator)
+{
+  TCollection_AsciiString aValue;
+  for (NCollection_List<TCollection_AsciiString>::Iterator anIterator (theValues); anIterator.More(); anIterator.Next())
+  {
+    if (!aValue.IsEmpty())
+      aValue += theSeparator;
+
+    aValue += anIterator.Value();
+  }
+
+  return aValue;
+}
+
+// ----------------------------------------------------------------------------
+// Split
+// ----------------------------------------------------------------------------
+
+void TCollection::Split (const Standard_SStream& theStream,
+  NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString>& theValues)
+{
+  TCollection_AsciiString aStreamStr (theStream.str().c_str());
+
+  NCollection_List<TCollection_AsciiString> aValues;
+  Split (aStreamStr, DumpSeparator(), aValues);
+
+  for (NCollection_List<TCollection_AsciiString>::Iterator anIterator (aValues); anIterator.More(); anIterator.Next())
+  {
+    TCollection_AsciiString aKey = anIterator.Value();
+    anIterator.Next();
+    if (!anIterator.More())
+      break;
+    theValues.Add (aKey, anIterator.Value());
+  }
+}
+
+
+// ----------------------------------------------------------------------------
+// Split
+// ----------------------------------------------------------------------------
+
+void TCollection::Split (const TCollection_AsciiString& theValue,
+                         const TCollection_AsciiString& theSeparator,
+                         NCollection_List<TCollection_AsciiString>& theValues)
+{
+  TCollection_AsciiString aCurrentString = theValue;
+
+  TCollection_AsciiString aSplitValue, aTailValue, aKey;
+  while (!aCurrentString.IsEmpty())
+  {
+    TCollection_AsciiString aValueString = aCurrentString;
+    if (SplitDumped (aValueString, aSplitValue, aTailValue, aKey))
+    {
+      aValueString = aSplitValue;
+      aCurrentString = aTailValue;
+    }
+    else
+    {
+      Standard_Integer aPosition = aValueString.Search (theSeparator);
+      if (aPosition < 0 )
+        break;
+      aCurrentString = aValueString.Split (aPosition - 1);
+    }
+    theValues.Append (aValueString);
+    if (aCurrentString.IsEmpty())
+      break;
+
+    aCurrentString = aCurrentString.Split (theSeparator.Length());
+  }
+
+  if (theValues.Size() == 1)
+  {
+    TCollection_AsciiString aKey, aValue;
+    if (!SplitKey (theValues.First(), aValue, aKey))
+      return;
+
+    theValues.Clear();
+    Split (aValue, DumpSeparator(), theValues);
+  }
+}
+
+// ----------------------------------------------------------------------------
+// SplitReal
+// ----------------------------------------------------------------------------
+
+Standard_Boolean TCollection::SplitReal (const TCollection_AsciiString& theValue,
+                                         const TCollection_AsciiString& theSeparator,
+                                         NCollection_Vector<Standard_Real>& theValues)
+{
+  TCollection_AsciiString aCurrentString = theValue;
+
+  while (!aCurrentString.IsEmpty())
+  {
+    TCollection_AsciiString aValueString = aCurrentString;
+    Standard_Integer aPosition = aValueString.Search (theSeparator);
+    if (aPosition < 0 )
+      break;
+
+    aCurrentString = aValueString.Split (aPosition);
+    if (!aValueString.IsRealValue())
+      return Standard_False;
+
+    theValues.Append (aValueString.RealValue());
+    aCurrentString = aCurrentString.Split (theSeparator.Length() + 1);
+  }
+
+  return !theValues.IsEmpty();
+}
+
+// ----------------------------------------------------------------------------
+// ToDumpString
+// ----------------------------------------------------------------------------
+
+TCollection_AsciiString TCollection::ToDumpString (const NCollection_List<TCollection_AsciiString>& theValues)
+{
+  return TCollection::Join (theValues, TCollection::VectorSeparator());
+}
+
+// ----------------------------------------------------------------------------
+// ToString
+// ----------------------------------------------------------------------------
+
+TCollection_AsciiString TCollection::ToDumpString (const Standard_SStream& theStream)
+{
+  return TCollection_AsciiString (theStream.str().c_str());
+}
+
+// ----------------------------------------------------------------------------
+// ConvertDumpToText
+// ----------------------------------------------------------------------------
+
+TCollection_AsciiString TCollection::ConvertDumpToText (const TCollection_AsciiString& theValue)
+{
+  TCollection_AsciiString aText = theValue;
+
+  //TCollection_AsciiString aCurrentString = theValue;
+  //while (!aCurrentString.IsEmpty())
+  //{
+  //  TCollection_AsciiString aValueString = aCurrentString;
+  //  Standard_Integer aPosition = aValueString.Search (theSeparator);
+  //  if (aPosition < 0 )
+  //    break;
+
+  //  aCurrentString = aValueString.Split (aPosition);
+  //  theValues.Append (aValueString);
+
+  //  aCurrentString = aCurrentString.Split (theSeparator.Length() + 1);
+  //}
+
+  //TCollection_AsciiString XMLBracketOpen() { return TCollection_AsciiString ("<"); }
+  //TCollection_AsciiString XMLBracketClose() { return TCollection_AsciiString (">"); }
+  //TCollection_AsciiString XMLFinishKey() { return TCollection_AsciiString ("\\"); }
+
+  return aText;
+}
+
+// ----------------------------------------------------------------------------
+// SplitDumped
+// ----------------------------------------------------------------------------
+
+Standard_Boolean TCollection::SplitDumped (const TCollection_AsciiString& theSourceValue,
+                                           TCollection_AsciiString& theSplitValue,
+                                           TCollection_AsciiString& theTailValue,
+                                           TCollection_AsciiString& theKey)
+{
+  Standard_Integer aBracketPosition = theSourceValue.Search (XMLBracketOpen());
+  // the first symbol is bracket
+  if (aBracketPosition != 1 || aBracketPosition >= theSourceValue.Length())
+    return Standard_False;
+
+  TCollection_AsciiString aValue = theSourceValue.SubString (aBracketPosition + 1, theSourceValue.Length());
+
+  aBracketPosition = aValue.Search (XMLBracketClose());
+  if (aBracketPosition <= 1 || aBracketPosition >= theSourceValue.Length())
+    return Standard_False;
+
+  theKey = aValue;
+
+  TCollection_AsciiString aTailValue = theKey.Split (aBracketPosition - 1);
+  aTailValue = aTailValue.SubString (2, aTailValue.Length()); // remove close bracket
+  TCollection_AsciiString aStopKey = StopKey (theKey);
+
+  aBracketPosition = theSourceValue.Search (aStopKey);
+
+  Standard_Integer aStopKeyLastPosition = aBracketPosition + aStopKey.Length() - 1;
+
+  //aBracketPosition = aTailValue.Search (aStopKey);
+  if (aBracketPosition <= 1 || aStopKeyLastPosition  > theSourceValue.Length())
+    return Standard_False;
+
+  theSplitValue = theSourceValue;
+  theTailValue = theSplitValue.Split (aStopKeyLastPosition);
+  //theSplitValue = aTailValue;
+  //aTailValue = theSplitValue.Split (aBracketPosition - 1);
+
+  //if (aTailValue.Length() < aStopKey.Length())
+  //  return Standard_False;
+
+  //if (aTailValue.Length() == aStopKey.Length())
+  //{
+  //  theTailValue = TCollection_AsciiString();
+  //  return Standard_True;
+  //}
+
+  //theTailValue = aTailValue.Split (aStopKey.Length());
+  return Standard_True;
+}
+
+// ----------------------------------------------------------------------------
+// SplitKey
+// ----------------------------------------------------------------------------
+
+Standard_Boolean TCollection::SplitKey (const TCollection_AsciiString& theSourceValue,
+                                        TCollection_AsciiString& theSplitValue,
+                                        TCollection_AsciiString& theKey)
+{
+  Standard_Integer aBracketPosition = theSourceValue.Search (XMLBracketOpen());
+  // the first symbol is bracket
+  if (aBracketPosition != 1 || aBracketPosition >= theSourceValue.Length())
+    return Standard_False;
+
+  TCollection_AsciiString aValue = theSourceValue.SubString (aBracketPosition + 1, theSourceValue.Length());
+
+  aBracketPosition = aValue.Search (XMLBracketClose());
+  if (aBracketPosition <= 1 || aBracketPosition >= theSourceValue.Length())
+    return Standard_False;
+
+  theKey = aValue;
+
+  TCollection_AsciiString aTailValue = theKey.Split (aBracketPosition - 1);
+  aTailValue = aTailValue.SubString (2, aTailValue.Length()); // remove close bracket
+  TCollection_AsciiString aStopKey = StopKey (theKey);
+
+  aBracketPosition = theSourceValue.Search (aStopKey);
+  if (aBracketPosition <= 1 || aBracketPosition  >= theSourceValue.Length())
+    return Standard_False;
+
+  theSplitValue = aTailValue;
+  aTailValue = theSplitValue.Split (aBracketPosition - 1);
+  return Standard_True;
+}
index 21fc27cd8cce466409e130ab316a7c460f2aa742..33f57f9852c26491576bef236806b9f9dcc4caeb 100644 (file)
 #include <Standard_Handle.hxx>
 
 #include <Standard_Integer.hxx>
-class TCollection_AsciiString;
+#include <TCollection_AsciiString.hxx>
+
+#include <NCollection_IndexedDataMap.hxx>
+#include <NCollection_List.hxx>
+#include <NCollection_Vector.hxx>
+
 class TCollection_ExtendedString;
 class TCollection_HAsciiString;
 class TCollection_HExtendedString;
@@ -66,6 +71,23 @@ public:
   DEFINE_STANDARD_ALLOC
 
   
+  //! 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
+  //! \return the string value
+  Standard_EXPORT static TCollection_AsciiString GetPointerInfo (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 GetPointerInfo (const void* thePointer,
+                                                                 const bool isShortInfo = true);
+
   //! Returns a  prime number greater than  <I> suitable
   //! to dimension a Map.  When  <I> becomes great there
   //! is  a  limit on  the  result (today  the  limit is
@@ -74,8 +96,69 @@ public:
   //! there will be more collisions  in  the map.
   Standard_EXPORT static Standard_Integer NextPrimeForMap (const Standard_Integer I);
 
+  //! Returns separator symbol of Dump information
+  static Standard_Character DumpSeparator() { return '\\'; }
+
+  //! Returns separator symbol of values vector union
+  static Standard_CString VectorSeparator() { return " ,"; }
+
+  //! Returns separator symbol of class name prefix
+  static inline Standard_CString ClassNameSeparator() { return " ,"; }
+
+  //! Unites list of string into one string using the separator
+  Standard_EXPORT static TCollection_AsciiString Join (const NCollection_List<TCollection_AsciiString>& theValues,
+                                                       const TCollection_AsciiString& theSeparator);
+
+  //! Converts stream to map of values where the key is each odd, value is each even value
+  //! \param theStream stream value
+  //! \param theValues [out] container of split values
+  Standard_EXPORT static void Split (const Standard_SStream& theStream,
+                                     NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString>& theValues);
+
+  //! Unites list of string into one string using the separator
+  Standard_EXPORT static void Split (const TCollection_AsciiString& theValue,
+                                     const TCollection_AsciiString& theSeparator,
+                                     NCollection_List<TCollection_AsciiString>& theValues);
+
+  //! Unites list of string into one string using the separator
+  Standard_EXPORT static Standard_Boolean SplitReal (const TCollection_AsciiString& theValue,
+                                                     const TCollection_AsciiString& theSeparator,
+                                                     NCollection_Vector<Standard_Real>& theValues);
+
+  //! Unites vector to string value using VectorSeparator.
+  Standard_EXPORT static TCollection_AsciiString ToDumpString (const NCollection_List<TCollection_AsciiString>& theValues);
+  //! Converts stream value to string value
+  Standard_EXPORT static TCollection_AsciiString ToDumpString (const Standard_SStream& theStream);
+
+  //! Converts stream value to string value
+  static TCollection_AsciiString StartKey (const TCollection_AsciiString& theValue)
+    { return XMLBracketOpen() + theValue + XMLBracketClose(); }
+
+  //! Converts stream value to string value
+  static TCollection_AsciiString StopKey (const TCollection_AsciiString& theValue)
+    { return XMLBracketOpen() + XMLFinishKey() + theValue + XMLBracketClose(); }
+
+  Standard_EXPORT static TCollection_AsciiString ConvertDumpToText (const TCollection_AsciiString& theValue);
+
+  //! Splits a AsciiString into two sub-strings using Dump keys.
+  //! Example:
+  //! aString contains "<key>abc</key>defg"
+  //! aString.SplitDumped() gives <me> = "abc" and returns "defg"
+  Standard_EXPORT static Standard_Boolean SplitDumped (const TCollection_AsciiString& theSourceValue,
+                                                       TCollection_AsciiString& theSplitValue,
+                                                       TCollection_AsciiString& theTailValue,
+                                                       TCollection_AsciiString& theKey);
+
+  //! Splits value that contains a key in form: <key>value</key>. In this case the values are:
+  //! theSplitValue = value, theKey = key.
+  Standard_EXPORT static Standard_Boolean SplitKey (const TCollection_AsciiString& theSourceValue,
+                                                    TCollection_AsciiString& theSplitValue,
+                                                    TCollection_AsciiString& theKey);
 
-
+protected:
+  static TCollection_AsciiString XMLBracketOpen() { return TCollection_AsciiString ("<"); }
+  static TCollection_AsciiString XMLBracketClose() { return TCollection_AsciiString (">"); }
+  static TCollection_AsciiString XMLFinishKey() { return TCollection_AsciiString ("\\"); }
 
 protected:
 
@@ -124,6 +207,13 @@ friend class TCollection_IndexedDataMapNode;
 
 };
 
+#define DUMP_VALUES(OS, Value1, Value2) \
+{ \
+  OS << Value1 << TCollection::DumpSeparator() << Value2 << TCollection::DumpSeparator(); \
+}
+
+#define DUMP_START_KEY(OS, Value1) { OS << TCollection::StartKey (Value1); }
+#define DUMP_STOP_KEY(OS, Value1)  { OS << TCollection::StopKey (Value1); }
 
 
 
index 4f7df1a6fe537fdc98fac0b86aa525b692958b40..82db097a70a8bb219b58e573a56197696a97cf4d 100644 (file)
@@ -17,6 +17,7 @@
 #ifndef _TCollection_AsciiString_HeaderFile
 #define _TCollection_AsciiString_HeaderFile
 
+
 #include <Standard.hxx>
 #include <Standard_DefineAlloc.hxx>
 #include <Standard_Handle.hxx>
@@ -624,7 +625,7 @@ friend Standard_EXPORT Standard_IStream& operator >> (Standard_IStream& astream,
   //! aString contains "abcdefg"
   //! aString.Split(3) gives <me> = "abc" and returns "defg"
   Standard_EXPORT TCollection_AsciiString Split (const Standard_Integer where);
-  
+
   //! Creation of a sub-string of the string <me>.
   //! The sub-string starts to the index Fromindex and ends
   //! to the index ToIndex.
index 50369d0d39d594274441798c71c3630b75eed966..19ad955b37a4cddcdd3aad9ae85d275a3385400d 100644 (file)
@@ -19,6 +19,7 @@
 #include <Standard_ConstructionError.hxx>
 #include <Standard_Stream.hxx>
 #include <Standard_Type.hxx>
+#include <TCollection.hxx>
 #include <TopLoc_Datum3D.hxx>
 
 IMPLEMENT_STANDARD_RTTIEXT(TopLoc_Datum3D,Standard_Transient)
@@ -41,6 +42,24 @@ TopLoc_Datum3D::TopLoc_Datum3D (const gp_Trsf& T) :
 {
 }
 
+const TCollection_AsciiString TopLoc_Datum3D_ClassName = "TopLoc_Datum3D";
+
+//=======================================================================
+//function : Dump
+//purpose  : 
+//=======================================================================
+
+void TopLoc_Datum3D::Dump (Standard_OStream& OS, const Standard_Integer theMask) const
+{
+  DUMP_START_KEY (OS, TopLoc_Datum3D_ClassName);
+
+  Standard_SStream aTmpStream;
+  myTrsf.Dump (aTmpStream);
+  DUMP_VALUES (OS, "Transformation", TCollection::ToDumpString (aTmpStream));
+
+  DUMP_START_KEY (OS, TopLoc_Datum3D_ClassName);
+}
+
 //=======================================================================
 //function : ShallowDump
 //purpose  : 
index b1f589d20126d80d33eade3e746b6d6ab998cd87..72830e6ffb3c920ccbeda033ec2caeb74e23448f 100644 (file)
@@ -53,6 +53,9 @@ public:
     const gp_Trsf& Transformation() const;
   
 
+  //! Dumps the content of me on the stream <OS>.
+  Standard_EXPORT void Dump (Standard_OStream& OS, const Standard_Integer theMask = Standard_DumpMask_Whole) const;
+
   //! Writes the contents of this Datum3D to the stream S.
   Standard_EXPORT void ShallowDump (Standard_OStream& S) const;
 
index c994bbd36af548ddaff3c3cdb322b47fee019b48..86c35c0f1929e342ccee47b947d50835b1acf858 100644 (file)
@@ -16,6 +16,7 @@
 
 
 #include <TopLoc_Datum3D.hxx>
+#include <TCollection.hxx>
 #include <TopLoc_ItemLocation.hxx>
 #include <TopLoc_Location.hxx>
 #include <TopLoc_SListOfItemLocation.hxx>
@@ -32,3 +33,30 @@ TopLoc_ItemLocation::TopLoc_ItemLocation
   myTrsf (D->Transformation().Powered (P))
 {
 }
+
+const TCollection_AsciiString TopLoc_ItemLocation_ClassName = "TopLoc_ItemLocation";
+
+//=======================================================================
+//function : Dump
+//purpose  : 
+//=======================================================================
+
+void TopLoc_ItemLocation::Dump (Standard_OStream& OS, const Standard_Integer theMask) const
+{
+  DUMP_START_KEY (OS, TopLoc_ItemLocation_ClassName);
+
+  DUMP_VALUES (OS, "Power", myPower);
+  {
+    Standard_SStream aTmpStream;
+    myTrsf.Dump (aTmpStream);
+    DUMP_VALUES (OS, "Trsf", TCollection::ToDumpString (aTmpStream));
+  }
+  {
+    Standard_SStream aTmpStream;
+    if (!myDatum.IsNull())
+      myDatum->Dump (aTmpStream);
+    DUMP_VALUES (OS, "Datum", TCollection::ToDumpString (aTmpStream));
+  }
+
+  DUMP_STOP_KEY (OS, TopLoc_ItemLocation_ClassName);
+}
index f2e117b3903239601df7f830018ab9f99ff9f932..e40fa8195e0de74d94ae267edf904b5a6ece76a3 100644 (file)
 
 #include <Standard.hxx>
 #include <Standard_DefineAlloc.hxx>
+#include <Standard_DumpMask.hxx>
 #include <Standard_Handle.hxx>
 
 #include <Standard_Integer.hxx>
+#include <Standard_OStream.hxx>
 #include <gp_Trsf.hxx>
 class TopLoc_Datum3D;
 class TopLoc_Location;
@@ -49,6 +51,9 @@ public:
   //! Sets the exponent to <P>
   Standard_EXPORT TopLoc_ItemLocation(const Handle(TopLoc_Datum3D)& D, const Standard_Integer P);
 
+  //! Dumps the content of me on the stream <OS>.
+  Standard_EXPORT void Dump (Standard_OStream& OS, const Standard_Integer theMask = Standard_DumpMask_Whole) const;
+
 
 friend class TopLoc_Location;
 friend class TopLoc_SListOfItemLocation;
index 7dbce0588b29dbc746246f0d07d10edd96b732db..00672c5b4d20a14d619ec406401ca61a3dfe0d99 100644 (file)
@@ -20,6 +20,7 @@
 #include <gp_Trsf.hxx>
 #include <Standard_ConstructionError.hxx>
 #include <Standard_NoSuchObject.hxx>
+#include <TCollection.hxx>
 #include <TopLoc_Datum3D.hxx>
 #include <TopLoc_ItemLocation.hxx>
 #include <TopLoc_Location.hxx>
@@ -230,6 +231,40 @@ Standard_Boolean TopLoc_Location::IsDifferent
   return !IsEqual(Other);
 }
 
+const TCollection_AsciiString TopLoc_Location_ClassName = "TopLoc_Location";
+
+//=======================================================================
+//function : Dump
+//purpose  : 
+//=======================================================================
+
+void TopLoc_Location::Dump (Standard_OStream& OS, const Standard_Integer theMask) const
+{
+  DUMP_START_KEY (OS, TopLoc_Location_ClassName);
+
+  DUMP_VALUES (OS, "IsIdentity", IsIdentity());
+  {
+    Standard_SStream aTmpStream;
+    Transformation().Dump (aTmpStream);
+    DUMP_VALUES (OS, "Transformation", TCollection::ToDumpString (aTmpStream));
+  }
+
+  TopLoc_SListOfItemLocation items = myItems;
+  if (!items.IsEmpty())
+  {
+    DUMP_VALUES (OS, "Items", "");
+    while (items.More())
+    {
+      Standard_SStream aTmpStream;
+      items.Value().Dump (aTmpStream);
+      DUMP_VALUES (OS, "Item", TCollection::ToDumpString (aTmpStream));
+
+      items.Next();
+    }
+  }
+  DUMP_STOP_KEY (OS, TopLoc_Location_ClassName);
+}
+
 //=======================================================================
 //function : ShallowDump
 //purpose  : 
index 0eec93b46b9c318759d3b002f7974cfbc54aa8db..20cc07834845bd68b728cda0acdcf29f16cf069c 100644 (file)
 
 #include <TopLoc_SListOfItemLocation.hxx>
 #include <Standard_Boolean.hxx>
+#include <Standard_DumpMask.hxx>
 #include <Standard_Integer.hxx>
 #include <Standard_OStream.hxx>
+
 class Standard_NoSuchObject;
 class Standard_ConstructionError;
 class gp_Trsf;
@@ -142,6 +144,9 @@ Standard_Boolean operator != (const TopLoc_Location& Other) const
   return IsDifferent(Other);
 }
   
+  //! Dumps the content of me on the stream <OS>.
+  Standard_EXPORT void Dump (Standard_OStream& OS, const Standard_Integer theMask = Standard_DumpMask_Whole) const;
+
   //! Prints the contents of <me> on the stream <s>.
   Standard_EXPORT void ShallowDump (Standard_OStream& S) const;
 
index 2a6f29f22de00610e30d4a2bc88e5a9354b96b6d..c33a1aeaaa34fd110cb073f9efe2a4cf9dd5d5e8 100644 (file)
 #include <Message_Msg.hxx>
 
 IMPLEMENT_STANDARD_RTTIEXT(TopoDS_AlertAttribute, Message_Attribute)
+
+//=======================================================================
+//function : TopoDS_AlertAttribute
+//purpose  : 
+//=======================================================================
+
+
+TopoDS_AlertAttribute::TopoDS_AlertAttribute (const TopoDS_Shape& theShape,
+  const TCollection_AsciiString& theName,
+  const TCollection_AsciiString& theDescription)
+: Message_AttributeStream (Standard_SStream(), theName, theDescription), myShape (theShape)
+{
+  Standard_SStream aStream;
+  theShape.Dump (aStream);
+
+  SetStream (aStream);
+}
index f0708407cd8821b2ec0ba664e3da4f62011a885e..ea347944e757b2e7e245c29f1ebac3ad9d7be21a 100644 (file)
 #ifndef _TopoDS_AlertAttribute_HeaderFile
 #define _TopoDS_AlertAttribute_HeaderFile
 
-#include <Message_Attribute.hxx>
+#include <Message_AttributeStream.hxx>
 #include <TopoDS_Shape.hxx>
 
 //! Alert attributre object storing TopoDS shape in its field
-class TopoDS_AlertAttribute : public Message_Attribute 
+class TopoDS_AlertAttribute : public Message_AttributeStream 
 {
 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; }
   
   // OCCT RTTI
-  DEFINE_STANDARD_RTTIEXT(TopoDS_AlertAttribute, Message_Attribute)
+  DEFINE_STANDARD_RTTIEXT(TopoDS_AlertAttribute, Message_AttributeStream)
 
 private:
   TopoDS_Shape myShape;
index 513703947c7fe770c703da26042d7eb96a9b78d8..b586afb5251d99a434f887b25905af791d0d745a 100644 (file)
@@ -19,6 +19,7 @@
 #include <Standard_DomainError.hxx>
 #include <Standard_NullObject.hxx>
 #include <Standard_TypeMismatch.hxx>
+#include <TCollection.hxx>
 #include <TopLoc_Location.hxx>
 #include <TopoDS_TShape.hxx>
 
@@ -33,3 +34,25 @@ Standard_Integer TopoDS_Shape::HashCode (const Standard_Integer theUpperBound) c
   const Standard_Integer aHL = myLocation.HashCode (theUpperBound);
   return ::HashCode (aHS ^ aHL, theUpperBound);
 }
+
+const TCollection_AsciiString TopoDS_Shape_ClassName = "TopoDS_Shape";
+
+//=======================================================================
+//function : Dump
+//purpose  : 
+//=======================================================================
+
+void TopoDS_Shape::Dump (Standard_OStream& OS, const Standard_Integer /*theMask*/) const
+{
+  DUMP_START_KEY (OS, TopoDS_Shape_ClassName);
+
+  DUMP_VALUES (OS, "TShape", TCollection::GetPointerInfo (myTShape));
+  DUMP_VALUES (OS, "Orientation", TopAbs::ShapeOrientationToString (myOrient));
+  {
+    Standard_SStream aTmpStream;
+    myLocation.Dump (aTmpStream);
+    DUMP_VALUES (OS, "Location", TCollection::ToDumpString (aTmpStream));
+  }
+
+  DUMP_STOP_KEY (OS, TopoDS_Shape_ClassName);
+}
index ea05cb600f27760b33ddb0257fd5b5ee4cdb0b70..d3173651afe751535d5a6bfe28b6b120aea315d4 100644 (file)
@@ -280,6 +280,9 @@ public:
 
   void TShape (const Handle(TopoDS_TShape)& theTShape) { myTShape = theTShape; }
 
+  //! Dumps the content of me on the stream <OS>.
+  Standard_EXPORT void Dump (Standard_OStream& OS, const Standard_Integer theMask = Standard_DumpMask_Whole) const;
+
 private:
 
   Handle(TopoDS_TShape) myTShape;
index 0a0c52f93365711ae0e57d3ef3f3987988ae461d..e643a814291da6a2fdb8ca84b949195740e1fb21 100644 (file)
@@ -15,6 +15,8 @@
 
 #include <XCAFPrs_Style.hxx>
 
+#include <TCollection.hxx>
+
 //=======================================================================
 //function : XCAFPrs_Style
 //purpose  :
@@ -67,3 +69,31 @@ void XCAFPrs_Style::UnSetColorCurv()
   myHasColorCurv = Standard_False;
   myColorCurv.SetValues (Quantity_NOC_YELLOW);
 }
+
+const TCollection_AsciiString XCAFPrs_Style_ClassName = "XCAFPrs_Style";
+
+//=======================================================================
+//function : Dump
+//purpose  : 
+//=======================================================================
+
+void XCAFPrs_Style::Dump (Standard_OStream& OS) const
+{
+  DUMP_START_KEY (OS, XCAFPrs_Style_ClassName);
+
+  DUMP_VALUES (OS, "HasColorSurf", myHasColorSurf);
+  {
+    Standard_SStream aTmpStream;
+    myColorSurf.Dump (aTmpStream);
+    DUMP_VALUES (OS, "ColorSurf", TCollection::ToDumpString (aTmpStream));
+  }
+  DUMP_VALUES (OS, "HasColorCurv", myHasColorCurv);
+  {
+    Standard_SStream aTmpStream;
+    myColorCurv.Dump (aTmpStream);
+    DUMP_VALUES (OS, "ColorCurv", TCollection::ToDumpString (aTmpStream));
+  }
+  DUMP_VALUES (OS, "IsVisible", myIsVisible);
+
+  DUMP_STOP_KEY (OS, XCAFPrs_Style_ClassName);
+}
index 214a0bdcfaaee593af6c7f9e82a782e875ae01db..79a82cc655b80908f1219efb9e1be9f602341c21 100644 (file)
@@ -121,6 +121,9 @@ public:
     return theS1.IsEqual (theS2);
   }
 
+  //! Dumps the content of me on the stream <OS>.
+  Standard_EXPORT void Dump (Standard_OStream& OS) const;
+
 protected:
 
   Quantity_ColorRGBA myColorSurf;
index 6ee08d2cbb2fc67e248619983537548744817898..4bb6d0108b84f930d9d3d284fe8291da56167ada 100644 (file)
 
 #include <Message.hxx>
 #include <Message_AlertExtended.hxx>
-#include <Message_AttributeVectorOfValues.hxx>
+#include <Message_AttributeStream.hxx>
 #include <Message_CompositeAlerts.hxx>
 #include <Message_Report.hxx>
 
+#include <TCollection.hxx>
 #include <TDataStd_AsciiString.hxx>
 #include <TDataStd_Comment.hxx>
 #include <TDataStd_Real.hxx>
@@ -249,18 +250,22 @@ void XmlDrivers_MessageReportStorage::exportAlertParameters (const Handle(Messag
     TDataStd_Comment::Set (theAlertLabel, anAttribute->GetDescription());
 
   Standard_CString aDynamicTypeName = anAttribute->DynamicType()->Name();
-  if (aDynamicTypeName == STANDARD_TYPE (Message_AttributeVectorOfValues)->Name())
+  if (aDynamicTypeName == STANDARD_TYPE (Message_AttributeStream)->Name())
   {
-    Handle(Message_AttributeVectorOfValues) aValuesArrayAlert = Handle(Message_AttributeVectorOfValues)::DownCast (anAttribute);
+    Handle(Message_AttributeStream) aValuesArrayAlert = Handle(Message_AttributeStream)::DownCast (anAttribute);
     // store values
-    const NCollection_Vector<TCollection_AsciiString>& anArrayValues = aValuesArrayAlert->GetValues();
-    // create real list attribute only if there are values in the attribute
-    if (anArrayValues.IsEmpty())
+    NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString> aValues;
+    TCollection::Split (aValuesArrayAlert->GetStream(), aValues);
+    if (aValues.IsEmpty())
       return;
-    int anArraySize = anArrayValues.Length();
+    int anArraySize = 2 * aValues.Size();
     Handle(TDataStd_ExtStringArray) aListAttribute = TDataStd_ExtStringArray::Set (theAlertLabel, 0, anArraySize - 1);
     for (int aValueId = 0; aValueId < anArraySize; aValueId++)
-      aListAttribute->SetValue (aValueId, anArrayValues.Value (aValueId));
+    {
+      TCollection_AsciiString aKey = aValues.FindKey (aValueId);
+      aListAttribute->SetValue (aValueId * 2, aKey);
+      aListAttribute->SetValue (aValueId * 2 + 1, aValues.FindFromKey (aKey));
+    }
   }
 }
 
@@ -291,7 +296,7 @@ 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_AttributeVectorOfValues)->Name())
+  else if (aDynamicTypeName == STANDARD_TYPE (Message_AttributeStream)->Name())
   {
     // values
     NCollection_Vector<TCollection_AsciiString> anArrayValues;
@@ -302,12 +307,15 @@ Handle(Message_Alert) XmlDrivers_MessageReportStorage::importAlertParameters (co
     if (aValuesAttribute.IsNull())
       return Handle(Message_Alert)();
 
-    for (int aValueId = aValuesAttribute->Lower(); aValueId <= aValuesAttribute->Upper(); aValueId++)
-      anArrayValues.Append (aValuesAttribute->Value (aValueId));
-
     Standard_SStream aStream;
-    Handle(Message_AttributeVectorOfValues) anAlert = new Message_AttributeVectorOfValues (aStream);
-    anAlert->SetValues (anArrayValues);
+    for (int aValueId = aValuesAttribute->Lower(); aValueId <= aValuesAttribute->Upper(); aValueId++)
+    {
+      TCollection_AsciiString aKey = aValuesAttribute->Value (aValueId++);
+      if (aValueId > aValuesAttribute->Upper())
+        break;
+      DUMP_VALUES (aStream, aKey, aValuesAttribute->Value (aValueId));
+    }
+    Handle(Message_AttributeStream) anAlert = new Message_AttributeStream (aStream);
     aMessageAttribute = anAlert;
   }
 
index e269c3bda7ca40f8b64d78aa75761ec1829a6049..c79086053944f9268ad9234948c4f921e2eea582 100644 (file)
 #include <gp_Pnt.hxx>
 #include <gp_Pnt2d.hxx>
 
+namespace
+{
+  static Standard_CString gp_Table_PrintTrsfForm[9] =
+  {
+    "IDENTITY", "ROTATION", "TRANSLATION", "PNTMIRROR", "AX1MIRROR", "AX2MIRROR",
+    "SCALE", "COMPOUNDSTRSF", "OTHER2"
+  };
+}
+
 //=======================================================================
 //function : Origin
 //purpose  : 
@@ -186,3 +195,32 @@ const gp_Ax2d&  gp::OY2d()
   return gp_OY2d;
 }
 
+//=======================================================================
+//function : TypeOfTrsfFormToString
+//purpose  :
+//=======================================================================
+Standard_CString gp::TrsfFormToString (gp_TrsfForm theType)
+{
+  return gp_Table_PrintTrsfForm[theType];
+}
+
+//=======================================================================
+//function : TrsfFormFromString
+//purpose  :
+//=======================================================================
+Standard_Boolean gp::TrsfFormFromString (Standard_CString theTypeString,
+                                         gp_TrsfForm& theType)
+{
+  TCollection_AsciiString aName (theTypeString);
+  aName.UpperCase();
+  for (Standard_Integer aTypeIter = gp_Identity; aTypeIter <= gp_Other; ++aTypeIter)
+  {
+    Standard_CString aTypeName = gp_Table_PrintTrsfForm[aTypeIter];
+    if (aName == aTypeName)
+    {
+      theType = gp_TrsfForm (aTypeIter);
+      return Standard_True;
+    }
+  }
+  return Standard_False;
+}
index f6914eb82f8111d29038feaeb369a7f5e6318b51..4b8bc4e4eaf718b9e665a1b5bb6426ad55294068 100644 (file)
@@ -17,6 +17,8 @@
 #ifndef _gp_HeaderFile
 #define _gp_HeaderFile
 
+#include <gp_TrsfForm.hxx>
+
 #include <Standard.hxx>
 #include <Standard_DefineAlloc.hxx>
 #include <Standard_Handle.hxx>
@@ -151,6 +153,27 @@ public:
   Standard_EXPORT static const gp_Ax2d& OY2d();
 
 
+  //! Returns the string name for a given type.
+  //! @param theType an enumeration type
+  //! @return string identifier from the enumeration list
+  Standard_EXPORT static Standard_CString TrsfFormToString (gp_TrsfForm theType);
+
+  //! Returns the orientation type from the given string identifier (using case-insensitive comparison).
+  //! @param theTypeString string identifier
+  //! @return enumeration type or gp_Identity if string identifier is invalid
+  static gp_TrsfForm TrsfFormFromString (Standard_CString theTypeString)
+  {
+    gp_TrsfForm aType = gp_Identity;
+    TrsfFormFromString (theTypeString, aType);
+    return aType;
+  }
+
+  //! Determines the type from the given string identifier (using case-insensitive comparison).
+  //! @param theTypeString string identifier
+  //! @param theType detected type
+  //! @return TRUE if string identifier is known
+  Standard_EXPORT static Standard_Boolean TrsfFormFromString (const Standard_CString theTypeString,
+                                                              gp_TrsfForm& theType);
 
 
 protected:
index cb106686fc8d86c931217dfc58d544bcf98d0cca..fd2d13dd30dd428437673ca1c3935ced2e899cf9 100644 (file)
 #include <gp_Mat.hxx>
 #include <gp_Trsf.hxx>
 #include <gp_XYZ.hxx>
+#include <NCollection_List.hxx>
 #include <Standard_ConstructionError.hxx>
 #include <Standard_OutOfRange.hxx>
+#include <TCollection.hxx>
+#include <TCollection_AsciiString.hxx>
 
 #define M00 ((Standard_Real*)M)[0]
 #define M01 ((Standard_Real*)M)[1]
@@ -268,3 +271,23 @@ void gp_Mat::Power (const Standard_Integer N)
   }
 }
 
+const TCollection_AsciiString gp_Map_ClassName = "gp_Mat";
+
+void gp_Mat::Dump (Standard_OStream& OS, const Standard_Integer theMask) const
+{
+  DUMP_START_KEY (OS, gp_Map_ClassName);
+
+  DUMP_VALUES (OS, "Mat00", Mat00);
+  DUMP_VALUES (OS, "Mat01", Mat01);
+  DUMP_VALUES (OS, "Mat02", Mat02);
+
+  DUMP_VALUES (OS, "Mat10", Mat10);
+  DUMP_VALUES (OS, "Mat11", Mat11);
+  DUMP_VALUES (OS, "Mat12", Mat12);
+
+  DUMP_VALUES (OS, "Mat20", Mat20);
+  DUMP_VALUES (OS, "Mat21", Mat21);
+  DUMP_VALUES (OS, "Mat22", Mat22);
+
+  DUMP_STOP_KEY (OS, gp_Map_ClassName);
+}
index 16fc2f2144719c108d519aaaf5096a50ed4d6131..4a0e36a01e386c9c1098dcc7d26b159768033ae3 100644 (file)
@@ -17,6 +17,7 @@
 
 #include <Standard.hxx>
 #include <Standard_DefineAlloc.hxx>
+#include <Standard_DumpMask.hxx>
 #include <Standard_Handle.hxx>
 
 #include <Standard_Real.hxx>
@@ -255,6 +256,9 @@ public:
   //! Transposes the matrix. A(j, i) -> A (i, j)
     Standard_NODISCARD gp_Mat Transposed() const;
 
+  //! Dumps the content of me on the stream <OS>.
+  Standard_EXPORT void Dump (Standard_OStream& OS, const Standard_Integer theMask = Standard_DumpMask_Whole) const;
+
 
 friend class gp_XYZ;
 friend class gp_Trsf;
index 64014935752759b02cb8081418da2f72b7f7eec5..98a83731fd201b6afa9df0e3d5b425cd247f50ce 100644 (file)
@@ -34,6 +34,7 @@
 #include <gp_XYZ.hxx>
 #include <Standard_ConstructionError.hxx>
 #include <Standard_OutOfRange.hxx>
+#include <TCollection.hxx>
 
 //=======================================================================
 //function : gp_Trsf
@@ -849,3 +850,30 @@ void gp_Trsf::Orthogonalize()
 
   matrix = aTM;
 }
+
+const TCollection_AsciiString gp_Trsf_ClassName = "gp_Trsf";
+
+//=======================================================================
+//function : Dump
+//purpose  : 
+//=======================================================================
+
+void gp_Trsf::Dump (Standard_OStream& OS, const Standard_Integer theMask) const
+{
+  DUMP_START_KEY (OS, gp_Trsf_ClassName);
+
+  DUMP_VALUES (OS, "Form", gp::TrsfFormToString (Form()));
+  {
+    Standard_SStream aTmpStream;
+    loc.Dump (aTmpStream);
+    DUMP_VALUES (OS, "TranslationPart", TCollection::ToDumpString (aTmpStream));
+  }
+  DUMP_VALUES (OS, "ScaleFactor", ScaleFactor());
+  {
+    Standard_SStream aTmpStream;
+    matrix.Dump (aTmpStream);
+    DUMP_VALUES (OS, "HVectorialPart", TCollection::ToDumpString (aTmpStream));
+  }
+
+  DUMP_STOP_KEY (OS, gp_Trsf_ClassName);
+}
index ebb05bfbd3c4508f59324466ece81a50e0b672bd..443eded074987125c8053994789f63c52eb54eec 100644 (file)
 #include <Standard.hxx>
 #include <Standard_Boolean.hxx>
 #include <Standard_DefineAlloc.hxx>
+#include <Standard_DumpMask.hxx>
 #include <Standard_Integer.hxx>
 #include <Standard_Handle.hxx>
+#include <Standard_OStream.hxx>
 #include <Standard_Real.hxx>
 
 class Standard_ConstructionError;
@@ -349,6 +351,9 @@ void operator *= (const gp_Trsf& T)
     theMat.SetValue (3, 3, static_cast<T> (1));
   }
 
+  //! Dumps the content of me on the stream <OS>.
+  Standard_EXPORT void Dump (Standard_OStream& OS, const Standard_Integer theMask = Standard_DumpMask_Whole) const;
+
 friend class gp_GTrsf;
 
 protected:
index ce9273a697bb8b1204a6a6751207502a92b337c4..170374d4be77550fc23475b65c9a3a953c3ef581 100644 (file)
@@ -273,17 +273,6 @@ public:
 
 
 
-  //! Covers point into string in format: (X, Y)
-  //! \return the string value
-  Standard_EXPORT TCollection_AsciiString ToString() const;
-
-
-  //! Converts text value into parameters if possible, the string format is: (X, Y)
-  //! \return true if conversion is done
-  Standard_EXPORT Standard_Boolean FromString (const TCollection_AsciiString& theValue);
-
-
-
 protected:
 
 
index 12fc78c19e8293cc6c73230703fa7e6115b5cdba..940b5b2af7347f4646aeedbb350eed0f50174376 100644 (file)
@@ -226,38 +226,3 @@ inline gp_XY operator* (const Standard_Real Scalar,
                        const gp_XY& Coord1) {
   return Coord1.Multiplied(Scalar);
 }
-
-inline TCollection_AsciiString gp_XY::ToString() const
-{
-  return TCollection_AsciiString ("(") + x + ", " + y + ")";
-}
-
-inline Standard_Boolean gp_XY::FromString (const TCollection_AsciiString& theValue)
-{
-  TCollection_AsciiString aCurrentString = theValue, aValueString;
-
-  Standard_Integer aPosition = aCurrentString.Search ("(");
-  if (aPosition != 1)
-    return Standard_False;
-
-  aCurrentString = aCurrentString.Split (aPosition);
-  Standard_Real aX, anY;
-  // x value
-  aPosition = aCurrentString.Search (", ");
-  if (aPosition < 0)
-    return Standard_False;
-  aCurrentString = aValueString.Split (aPosition);
-  aX = aValueString.RealValue();
-  aCurrentString = aCurrentString.Split (2);
-
-  // y value
-  aPosition = aCurrentString.Search (")");
-  if (aPosition < 0)
-    return Standard_False;
-  aCurrentString = aValueString.Split (aPosition);
-  anY = aValueString.RealValue();
-
-  x = aX;
-  y = anY;
-  return Standard_True;
-}
index 7bf550dcec417cf78011912014c1c2309bc1c958..c6ea78353be4fcd17ebbd8366918de9827468877 100644 (file)
 
 #include <gp_Mat.hxx>
 #include <gp_XYZ.hxx>
+#include <NCollection_List.hxx>
 #include <Standard_ConstructionError.hxx>
 #include <Standard_OutOfRange.hxx>
+#include <TCollection.hxx>
+#include <TCollection_AsciiString.hxx>
+
+#include <TCollection_AsciiString.hxx>
 
 Standard_Boolean gp_XYZ::IsEqual (const gp_XYZ& Other,
                                  const Standard_Real Tolerance) const {
@@ -33,3 +38,57 @@ Standard_Boolean gp_XYZ::IsEqual (const gp_XYZ& Other,
   return Standard_True;
 }
 
+const TCollection_AsciiString gp_XYZ_ClassName = "gp_XYZ";
+
+//=======================================================================
+//function : Dump
+//purpose  : 
+//=======================================================================
+
+void gp_XYZ::Dump (Standard_OStream& OS, const Standard_Integer theMask) const
+{
+  DUMP_START_KEY (OS, gp_XYZ_ClassName);
+
+  DUMP_VALUES (OS, "X", x);
+  DUMP_VALUES (OS, "Y", y);
+  DUMP_VALUES (OS, "Z", z);
+
+  DUMP_STOP_KEY (OS, gp_XYZ_ClassName);
+}
+
+//=======================================================================
+//function : Init
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean gp_XYZ::Init (const Standard_OStream& OS)
+{
+  /*NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString> aStreamValues;
+  Standard_SStream aSStream (OS);
+  TCollection::Split (aSStream, aStreamValues);
+
+  TCollection_AsciiString anXYZValue;
+  if (aStreamValues.FindFromKey (gp_XYZ_ClassName, anXYZValue))
+    anXYZValue = anXYZValue;
+  else if (aStreamValues.Size() == 1)
+  {
+    TCollection_AsciiString aValueStr = aStreamValues.FindFromIndex (1);
+    Standard_Integer aPosition = aValueStr.Search (gp_XYZ_ClassName + TCollection::ClassNameSeparator());
+    if (aPosition < 1)
+      return Standard_False;
+    anXYZValue = aValueStr.Split (aPosition);
+  }
+
+  NCollection_Vector<Standard_Real> aValues;
+  if (!TCollection::SplitReal (anXYZValue, TCollection::VectorSeparator(), aValues))
+    return Standard_False;
+
+  if (aValues.Size() != 3)
+    return Standard_False;
+
+  x = aValues.Value (1);
+  y = aValues.Value (2);
+  z = aValues.Value (3);
+  */
+  return Standard_True;
+}
index f551afd25ed5fda68d2486d1206998a7a3f686e5..b18e51cc40f194311d2eac471724f0d8645f914e 100644 (file)
@@ -23,7 +23,8 @@
 #include <Standard_Integer.hxx>
 #include <Standard_Boolean.hxx>
 
-#include <TCollection_AsciiString.hxx>
+#include <Standard_DumpMask.hxx>
+#include <Standard_OStream.hxx>
 
 class Standard_ConstructionError;
 class Standard_OutOfRange;
@@ -327,14 +328,11 @@ public:
     void SetLinearForm (const gp_XYZ& XYZ1, const gp_XYZ& XYZ2);
 
 
-  //! Covers point into string in format: (X, Y, Z)
-  //! \return the string value
-  Standard_EXPORT TCollection_AsciiString ToString() const;
+  //! Dumps the content of me on the stream <OS>.
+  Standard_EXPORT void Dump (Standard_OStream& OS, const Standard_Integer theMask = Standard_DumpMask_Whole) const;
 
-
-  //! Converts text value into parameters if possible, the string format is: (X, Y, Z)
-  //! \return true if conversion is done
-  Standard_EXPORT Standard_Boolean FromString (const TCollection_AsciiString& theValue);
+  //! Dumps the content of me on the stream <OS>.
+  Standard_EXPORT Standard_Boolean Init (const Standard_OStream& OS);
 
 
 
index e56f801ab27719e3ecbdb6f2d4a7046eb4aa25ec..5ba14317980804723d4aeaf1be0676e9f0c7d1d6 100644 (file)
@@ -306,50 +306,3 @@ inline gp_XYZ operator* (const Standard_Real Scalar, const gp_XYZ& Coord1) {
   return Coord1.Multiplied (Scalar);
 }
 
-inline TCollection_AsciiString gp_XYZ::ToString() const
-{
-  return TCollection_AsciiString ("(") + x + ", " + y + ", " + z + ")";
-}
-
-inline Standard_Boolean gp_XYZ::FromString (const TCollection_AsciiString& theValue)
-{
-  TCollection_AsciiString aCurrentString = theValue, aValueString;
-
-  Standard_Integer aPosition = aCurrentString.Search ("(");
-  if (aPosition != 1)
-    return Standard_False;
-
-  aCurrentString = aCurrentString.Split (aPosition);
-  Standard_Real aX, anY, aZ;
-  // x value
-  aPosition = aCurrentString.Search (", ");
-  if (aPosition < 0)
-    return Standard_False;
-  aValueString = aCurrentString;
-  aCurrentString = aValueString.Split (aPosition - 1);
-  aX = aValueString.RealValue();
-  aCurrentString = aCurrentString.Split (2);
-
-  // y value
-  aPosition = aCurrentString.Search (", ");
-  if (aPosition < 0)
-    return Standard_False;
-  aValueString = aCurrentString;
-  aCurrentString = aValueString.Split (aPosition - 1);
-  anY = aValueString.RealValue();
-  aCurrentString = aCurrentString.Split (2);
-
-  // z value
-  aPosition = aCurrentString.Search (")");
-  if (aPosition < 0)
-    return Standard_False;
-  aValueString = aCurrentString;
-  aCurrentString = aValueString.Split (aPosition);
-  aZ = aValueString.RealValue();
-
-  x = aX;
-  y = anY;
-  z = aZ;
-  return Standard_True;
-}
-
diff --git a/tools/Convert/Convert_Tools.cxx b/tools/Convert/Convert_Tools.cxx
new file mode 100644 (file)
index 0000000..178fdab
--- /dev/null
@@ -0,0 +1,126 @@
+// 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/Convert_Tools.hxx>
+
+#include <TColgp_Array1OfPnt.hxx>
+#include <TCollection.hxx>
+#include <BRep_Builder.hxx>
+#include <TopoDS_Compound.hxx>
+#include <BRepPrimAPI_MakeBox.hxx>
+#include <BRepBuilderAPI_MakeEdge.hxx>
+#include <BRepBuilderAPI_MakeVertex.hxx>
+
+//=======================================================================
+//function : CreateShape
+//purpose  :
+//=======================================================================
+TopoDS_Shape Convert_Tools::CreateShape (const Bnd_Box& theBoundingBox)
+{
+  if (theBoundingBox.IsVoid() || theBoundingBox.IsWhole())
+    return TopoDS_Shape();
+
+  Standard_Real aXmin, anYmin, aZmin, aXmax, anYmax, aZmax;
+  theBoundingBox.Get (aXmin, anYmin, aZmin, aXmax, anYmax, aZmax);
+
+  gp_Pnt aPntMin = gp_Pnt (aXmin, anYmin, aZmin);
+  gp_Pnt aPntMax = gp_Pnt (aXmax, anYmax, aZmax);
+
+  return CreateBoxShape (aPntMin, aPntMax);
+}
+
+//=======================================================================
+//function : CreateShape
+//purpose  :
+//=======================================================================
+TopoDS_Shape Convert_Tools::CreateShape (const Bnd_OBB& theBoundingBox)
+{
+  if (theBoundingBox.IsVoid())
+    return TopoDS_Shape();
+
+  TColgp_Array1OfPnt anArrPnts(0, 8);
+  theBoundingBox.GetVertex(&anArrPnts(0));
+
+  BRep_Builder aBuilder;
+  TopoDS_Compound aCompound;
+  aBuilder.MakeCompound (aCompound);
+
+  aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (gp_Pnt (anArrPnts.Value(0)), gp_Pnt (anArrPnts.Value(1))));
+  aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (gp_Pnt (anArrPnts.Value(0)), gp_Pnt (anArrPnts.Value(2))));
+  aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (gp_Pnt (anArrPnts.Value(1)), gp_Pnt (anArrPnts.Value(3))));
+  aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (gp_Pnt (anArrPnts.Value(2)), gp_Pnt (anArrPnts.Value(3))));
+
+  return aCompound;
+}
+
+//=======================================================================
+//function : CreateBoxShape
+//purpose  :
+//=======================================================================
+TopoDS_Shape Convert_Tools::CreateBoxShape (const gp_Pnt& thePntMin, const gp_Pnt& thePntMax)
+{
+  Standard_Boolean aThinOnX = fabs (thePntMin.X() - thePntMax.X()) < Precision::Confusion();
+  Standard_Boolean aThinOnY = fabs (thePntMin.Y() - thePntMax.Y()) < Precision::Confusion();
+  Standard_Boolean aThinOnZ = fabs (thePntMin.Z() - thePntMax.Z()) < Precision::Confusion();
+
+  if (((int)aThinOnX + (int)aThinOnY + (int)aThinOnZ) > 1) // thin box in several directions is a point
+  {
+    BRep_Builder aBuilder;
+    TopoDS_Compound aCompound;
+    aBuilder.MakeCompound (aCompound);
+    aBuilder.Add (aCompound, BRepBuilderAPI_MakeVertex (thePntMin));
+    return aCompound;
+  }
+
+  if (aThinOnX || aThinOnY || aThinOnZ)
+  {
+    gp_Pnt aPnt1, aPnt2, aPnt3, aPnt4 ;
+    if (aThinOnX)
+    {
+      aPnt1 = gp_Pnt(thePntMin.X(), thePntMin.Y(), thePntMin.Z());
+      aPnt2 = gp_Pnt(thePntMin.X(), thePntMax.Y(), thePntMin.Z());
+      aPnt3 = gp_Pnt(thePntMin.X(), thePntMax.Y(), thePntMax.Z());
+      aPnt4 = gp_Pnt(thePntMin.X(), thePntMin.Y(), thePntMax.Z());
+    }
+    else if (aThinOnY)
+    {
+      aPnt1 = gp_Pnt(thePntMin.X(), thePntMin.Y(), thePntMin.Z());
+      aPnt2 = gp_Pnt(thePntMax.X(), thePntMin.Y(), thePntMin.Z());
+      aPnt3 = gp_Pnt(thePntMax.X(), thePntMin.Y(), thePntMax.Z());
+      aPnt4 = gp_Pnt(thePntMin.X(), thePntMin.Y(), thePntMax.Z());
+    }
+    else if (aThinOnZ)
+    {
+      aPnt1 = gp_Pnt(thePntMin.X(), thePntMin.Y(), thePntMin.Z());
+      aPnt2 = gp_Pnt(thePntMax.X(), thePntMin.Y(), thePntMin.Z());
+      aPnt3 = gp_Pnt(thePntMax.X(), thePntMax.Y(), thePntMin.Z());
+      aPnt4 = gp_Pnt(thePntMin.X(), thePntMax.Y(), thePntMin.Z());
+    }
+    BRep_Builder aBuilder;
+    TopoDS_Compound aCompound;
+    aBuilder.MakeCompound (aCompound);
+    aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (aPnt1, aPnt2));
+    aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (aPnt2, aPnt3));
+    aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (aPnt3, aPnt4));
+    aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (aPnt4, aPnt1));
+
+    return aCompound;
+  }
+  else
+  {
+    BRepPrimAPI_MakeBox aBoxBuilder (thePntMin, thePntMax);
+    return aBoxBuilder.Shape();
+  }
+}
diff --git a/tools/Convert/Convert_Tools.hxx b/tools/Convert/Convert_Tools.hxx
new file mode 100644 (file)
index 0000000..146036c
--- /dev/null
@@ -0,0 +1,63 @@
+// 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 Convert_Tools_H
+#define Convert_Tools_H
+
+#include <gp_Dir.hxx>
+#include <gp_Pnt.hxx>
+#include <gp_Trsf.hxx>
+#include <gp_XYZ.hxx>
+#include <Bnd_Box.hxx>
+#include <Bnd_OBB.hxx>
+#include <Standard.hxx>
+#include <Standard_Macro.hxx>
+#include <TColgp_HArray1OfPnt.hxx>
+#include <TCollection.hxx>
+#include <TCollection_AsciiString.hxx>
+#include <TopLoc_Location.hxx>
+#include <TopoDS_Shape.hxx> 
+
+#include <Standard_WarningsDisable.hxx>
+#include <QString>
+#include <QVariant>
+#include <Standard_WarningsRestore.hxx>
+
+class Geom_Transformation;
+
+//! \class Convert_Tools
+//! \brief The tool that gives auxiliary methods for qt elements manipulation
+class Convert_Tools
+{
+public:
+  //! Creates box shape
+  //! \param theBoundingBox box shape parameters
+  //! \return created shape
+  Standard_EXPORT static TopoDS_Shape CreateShape (const Bnd_Box& theBoundingBox);
+
+  //! Creates box shape
+  //! \param theBoundingBox box shape parameters
+  //! \return created shape
+  Standard_EXPORT static TopoDS_Shape CreateShape (const Bnd_OBB& theBoundingBox);
+
+  //! Creates box shape
+  //! \param thePntMin minimum point on the bounding box
+  //! \param thePntMax maximum point on the bounding box
+  //! \return created shape
+  Standard_EXPORT static TopoDS_Shape CreateBoxShape (const gp_Pnt& thePntMin, const gp_Pnt& thePntMax);
+
+};
+
+#endif
diff --git a/tools/Convert/Convert_TransientShape.cxx b/tools/Convert/Convert_TransientShape.cxx
new file mode 100644 (file)
index 0000000..88b41fa
--- /dev/null
@@ -0,0 +1,18 @@
+// Created on: 2019-04-15
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2019 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement. 
+
+#include <inspector/Convert_TransientShape.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(Convert_TransientShape, Standard_Transient)
diff --git a/tools/Convert/Convert_TransientShape.hxx b/tools/Convert/Convert_TransientShape.hxx
new file mode 100644 (file)
index 0000000..b9aaae1
--- /dev/null
@@ -0,0 +1,53 @@
+// Created on: 2019-04-15
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2019 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement. 
+
+#ifndef Convert_TransientShape_H
+#define Convert_TransientShape_H
+
+#include <Standard.hxx>
+#include <Standard_Handle.hxx>
+#include <Standard_Macro.hxx>
+#include <Standard_Type.hxx>
+#include <Standard_Transient.hxx>
+
+#include <TopoDS_Shape.hxx>
+
+DEFINE_STANDARD_HANDLE (Convert_TransientShape, Standard_Transient)
+
+//! \class Convert_TransientShape
+//! \brief An interface to create custom panes by transient object name.
+class Convert_TransientShape : public Standard_Transient
+{
+public:
+
+  //! Constructor
+  Convert_TransientShape (const TopoDS_Shape& theShape) { SetShape (theShape); }
+
+  //! Destructor
+  virtual ~Convert_TransientShape() {}
+
+  //! Fills current shape
+  void SetShape (const TopoDS_Shape& theShape) { myShape = theShape; }
+
+  //! Returns current shape
+  const TopoDS_Shape GetShape() const { return myShape; }
+
+  DEFINE_STANDARD_RTTIEXT (Convert_TransientShape, Standard_Transient)
+
+private:
+  TopoDS_Shape myShape;
+};
+
+#endif 
diff --git a/tools/Convert/FILES b/tools/Convert/FILES
new file mode 100644 (file)
index 0000000..bbcae4a
--- /dev/null
@@ -0,0 +1,4 @@
+Convert_Tools.cxx
+Convert_Tools.hxx
+Convert_TransientShape.cxx
+Convert_TransientShape.hxx
index fb8efa0e506da348afefc96ed4b0f51555765ab7..3274a6ec51598c4bdfd2a77d49fdeb76b0bc8fc7 100644 (file)
@@ -6,16 +6,16 @@ MessageModel_ItemAlert.cxx
 MessageModel_ItemAlert.hxx
 MessageModel_ItemBase.cxx
 MessageModel_ItemBase.hxx
+MessageModel_ItemPropertiesAttributeStream.cxx
+MessageModel_ItemPropertiesAttributeStream.hxx
+MessageModel_ItemPropertiesReport.cxx
+MessageModel_ItemPropertiesReport.hxx
 MessageModel_ItemReport.cxx
 MessageModel_ItemReport.hxx
-MessageModel_ItemReportProperties.cxx
-MessageModel_ItemReportProperties.hxx
 MessageModel_ItemRoot.cxx
 MessageModel_ItemRoot.hxx
 MessageModel_ReportCallBack.cxx
 MessageModel_ReportCallBack.hxx
-MessageModel_TableModelValues.cxx
-MessageModel_TableModelValues.hxx
 MessageModel_Tools.cxx
 MessageModel_Tools.hxx
 MessageModel_TreeModel.cxx
index 140aaaf043c87163cf421eb9f4f7618e9a013cba..0914b8d004baadf324c79ef8c73e95a9cfb19f8e 100644 (file)
@@ -63,7 +63,9 @@ MessageModel_Actions::MessageModel_Actions (QWidget* theParent,
                     ViewControl_Tools::CreateAction (tr ("Export to ShapeView"), SLOT (OnExportToShapeView()), parent(), this));
 #ifdef DEBUG_ALERTS
   myActions.insert (MessageModel_ActionType_Test,
-                    ViewControl_Tools::CreateAction ("Test", SLOT (OnTestAlerts()), parent(), this));
+                    ViewControl_Tools::CreateAction ("Test <clock>", SLOT (OnTestClock()), parent(), this));
+  myActions.insert (MessageModel_ActionType_Test,
+                    ViewControl_Tools::CreateAction ("Test <PropertyPanel>", SLOT (OnTestPropetyPanel()), parent(), this));
 #endif
 }
 
@@ -266,12 +268,12 @@ void MessageModel_Actions::OnExportToShapeView()
 }
 
 // =======================================================================
-// function : OnTestAlerts
+// function : OnTestClock
 // purpose :
 // =======================================================================
 #include <OSD_Chronometer.hxx>
 #include <ctime>
-void MessageModel_Actions::OnTestAlerts()
+void MessageModel_Actions::OnTestClock()
 {
 #ifdef DEBUG_ALERTS
   QModelIndex aReportIndex;
@@ -294,11 +296,14 @@ void MessageModel_Actions::OnTestAlerts()
       aValue = (aValue * 2. + 3.) * 0.5 - 0.3 * 0.5;
 
       Standard_Real aValue3 = aValue + aValue2 * 0.2;
+      (void)aValue3;
       //MESSAGE_INFO ("Calculate", aValue, &aPerfMeter, NULL);
     }
   }
 
-  ((MessageModel_TreeModel*)mySelectionModel->model())->EmitLayoutChanged();
+  //((MessageModel_TreeModel*)mySelectionModel->model())->EmitLayoutChanged();
+
+  myTreeModel->UpdateTreeModel();
 
   //Standard_Real aSystemSeconds1, aCurrentSeconds1;
   //OSD_Chronometer::GetThreadCPU (aCurrentSeconds1, aSystemSeconds1);
@@ -311,3 +316,44 @@ void MessageModel_Actions::OnTestAlerts()
   std::cout << "clock() = " << end_time - start_time << std::endl;
 #endif
 }
+
+// =======================================================================
+// function : OnTestClock
+// purpose :
+// =======================================================================
+void MessageModel_Actions::OnTestPropetyPanel()
+{
+#ifdef DEBUG_ALERTS
+  QModelIndex aReportIndex;
+  Handle(Message_Report) aReport = getSelectedReport (aReportIndex);
+  if (aReport.IsNull())
+    return;
+
+  Message_PerfMeter aPerfMeter;
+  MESSAGE_INFO ("MessageModel_Actions::OnTestAlerts()", "", &aPerfMeter, NULL);
+
+  // gp_XYZ
+  {
+    gp_XYZ aCoords (1.3, 2.3, 3.4);
+    Standard_SStream aStream;
+    aCoords.Dump (aStream, Standard_DumpMask_SingleValue);
+    MESSAGE_INFO_STREAM(aStream, "gp_XYZ", "", &aPerfMeter, NULL);
+  }
+  // Bnd_Box
+  {
+    Bnd_Box aBox(20., 15., 10., 25., 20., 15.);
+    Standard_SStream aStream;
+    aBox.Dump (aStream, Standard_DumpMask_SingleValue);
+    MESSAGE_INFO_STREAM(aStream, "Bnd_Box", "", &aPerfMeter, NULL);
+  }
+  // Bnd_OBB
+  {
+    Bnd_OBB anOBB (gp_Pnt (-10., -15., -10.), gp_Dir (1., 0., 0.), gp_Dir (0., 1., 0.), gp_Dir (0., 0., 1.),
+                  5., 10., 5.);
+    Standard_SStream aStream;
+    anOBB.Dump (aStream, Standard_DumpMask_SingleValue);
+    MESSAGE_INFO_STREAM(aStream, "Bnd_OBB", "", &aPerfMeter, NULL);
+  }
+  myTreeModel->UpdateTreeModel();
+#endif
+}
index 71da2a093560b810661ade00ca209ba16569e041..7dea43fa339f77e51933ff93f2541a643558cc8c 100644 (file)
@@ -82,8 +82,11 @@ public slots:
   //! Exports the first selected shape into ShapeViewer plugin.
   void OnExportToShapeView();
 
-  //! Sending several alerts to check message-alert-tool mechanizm
-  void OnTestAlerts();
+  //! Sending several alerts to check time of message-alert-tool mechanizm
+  void OnTestClock();
+
+  //! Sending several alerts to check property panel/presentations of message-alert-tool mechanizm
+  void OnTestPropetyPanel();
 
 protected:
   //! Returns report of selected tree view item if a report item is selected
index b94e5ac006bf00ff298ec61da53516d3215bd988..56c8d6f55050d7152a0a42f2d6b17dda2685634d 100644 (file)
 
 #include <inspector/MessageModel_ItemAlert.hxx>
 
+#include <inspector/MessageModel_ItemPropertiesAttributeStream.hxx>
 #include <inspector/MessageModel_ItemRoot.hxx>
 #include <inspector/MessageModel_ItemReport.hxx>
 #include <inspector/MessageModel_Tools.hxx>
 #include <inspector/ViewControl_Tools.hxx>
-#include <inspector/ViewControl_TransientShape.hxx>
+#include <inspector/Convert_TransientShape.hxx>
 #include <inspector/TreeModel_Tools.hxx>
 
 #include <Message_AlertExtended.hxx>
 #include <Message_AttributeObject.hxx>
-#include <Message_AttributeVectorOfValues.hxx>
+#include <Message_AttributeStream.hxx>
 #include <Message_CompositeAlerts.hxx>
 
 #include <Bnd_Box.hxx>
@@ -76,7 +77,7 @@ QVariant MessageModel_ItemAlert::initValue (const int theRole) const
 
     if (anAttribute->IsKind (STANDARD_TYPE (TopoDS_AlertAttribute)))
       return QIcon (":/icons/item_shape.png");
-    else if (anAttribute->IsKind (STANDARD_TYPE (Message_AttributeVectorOfValues)))
+    else if (!Handle(Message_AttributeStream)::DownCast (anAttribute).IsNull())
       return QIcon (":/icons/item_vectorOfValues.png");
     else
       return QVariant();
@@ -218,17 +219,23 @@ void MessageModel_ItemAlert::Init()
   if (!anExtendedAlert.IsNull() && !anExtendedAlert->Attribute().IsNull())
   {
     Handle(Message_Attribute) anAttribute = anExtendedAlert->Attribute();
+
     if (!anAttribute.IsNull())
     {
-      if (anAttribute->IsKind (STANDARD_TYPE (Message_AttributeObject)))
-        myPresentations.Append (Handle(Message_AttributeObject)::DownCast (anAttribute)->GetObject());
-      if (anAttribute->IsKind (STANDARD_TYPE (TopoDS_AlertAttribute)))
-        myPresentations.Append (new ViewControl_TransientShape (Handle(TopoDS_AlertAttribute)::DownCast (anAttribute)->GetShape()));
+      if (!Handle(Message_AttributeStream)::DownCast(anAttribute).IsNull())
+      {
+        TreeModel_ItemBasePtr anItem = Parent()->Child (Row(), Column(), false);
+        SetProperties (new MessageModel_ItemPropertiesAttributeStream (anItem));
+      }
+      //if (anAttribute->IsKind (STANDARD_TYPE (Message_AttributeObject)))
+      //  myPresentations.Append (Handle(Message_AttributeObject)::DownCast (anAttribute)->GetObject());
+      //if (anAttribute->IsKind (STANDARD_TYPE (TopoDS_AlertAttribute)))
+      //  myPresentations.Append (new Convert_TransientShape (Handle(TopoDS_AlertAttribute)::DownCast (anAttribute)->GetShape()));
     }
-    TCollection_AsciiString aDescription = anExtendedAlert->Attribute()->GetDescription();
-    Bnd_Box aBox;
-    if (aBox.FromString (aDescription))
-      myPresentations.Append (new ViewControl_TransientShape (ViewControl_Tools::CreateShape (aBox)));
+    //TCollection_AsciiString aDescription = anExtendedAlert->Attribute()->GetDescription();
+    //Bnd_Box aBox;
+    //if (aBox.Init (Standard_SStream (aDescription.ToCString())))
+    //  myPresentations.Append (new Convert_TransientShape (Convert_Tools::CreateShape (aBox)));
   }
   MessageModel_ItemBase::Init();
 }
diff --git a/tools/MessageModel/MessageModel_ItemPropertiesAttributeStream.cxx b/tools/MessageModel/MessageModel_ItemPropertiesAttributeStream.cxx
new file mode 100644 (file)
index 0000000..f0f24c9
--- /dev/null
@@ -0,0 +1,126 @@
+// Created on: 2019-02-25
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2019 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement. 
+
+#include <inspector/MessageModel_ItemPropertiesAttributeStream.hxx>
+#include <inspector/MessageModel_ItemAlert.hxx>
+
+#include <inspector/ShapeView_ItemShape.hxx>
+#include <inspector/ShapeView_Tools.hxx>
+
+#include <inspector/ViewControl_Tools.hxx>
+#include <BRep_Tool.hxx>
+#include <Message_AlertExtended.hxx>
+#include <TCollection.hxx>
+#include <TopoDS.hxx>
+
+#include <Standard_WarningsDisable.hxx>
+#include <QApplication>
+#include <QFont>
+#include <Standard_WarningsRestore.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(MessageModel_ItemPropertiesAttributeStream, TreeModel_ItemProperties)
+
+// =======================================================================
+// function : Init
+// purpose :
+// =======================================================================
+
+void MessageModel_ItemPropertiesAttributeStream::Init()
+{
+  MessageModel_ItemAlertPtr anAlertItem = itemDynamicCast<MessageModel_ItemAlert>(getItem());
+  if (!anAlertItem)
+    return;
+
+  Handle(Message_AlertExtended) anExtendedAlert = Handle(Message_AlertExtended)::DownCast(anAlertItem->GetAlert());
+  if (anExtendedAlert.IsNull() || anExtendedAlert->Attribute().IsNull())
+    return;
+
+  Handle(Message_AttributeStream) anAttributeStream = Handle(Message_AttributeStream)::DownCast (anExtendedAlert->Attribute());
+  if (anAttributeStream.IsNull())
+    return;
+
+  TCollection::Split (anAttributeStream->GetStream(), myValues);
+
+  TreeModel_ItemProperties::Init();
+}
+
+// =======================================================================
+// function : Reset
+// purpose :
+// =======================================================================
+
+void MessageModel_ItemPropertiesAttributeStream::Reset()
+{
+  myValues.Clear();
+
+  TreeModel_ItemProperties::Reset();
+}
+
+// =======================================================================
+// function : RowCount
+// purpose :
+// =======================================================================
+
+int MessageModel_ItemPropertiesAttributeStream::GetTableRowCount() const
+{
+  const NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString>& aValues = GetValues();
+  return aValues.Size();
+}
+
+// =======================================================================
+// function : Data
+// purpose :
+// =======================================================================
+
+QVariant MessageModel_ItemPropertiesAttributeStream::GetTableData (const int theRow, const int theColumn, int theRole) const
+{
+  const NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString>& aValues = GetValues();
+
+  if (theRole == Qt::DisplayRole)
+  {
+    if (theColumn == 0) return aValues.FindKey (theRow + 1).ToCString();
+    else if (theColumn == 1) return aValues.FindFromIndex (theRow + 1).ToCString();
+  }
+  return QVariant();
+}
+
+// =======================================================================
+// function : GetTableEditType
+// purpose :
+// =======================================================================
+ViewControl_EditType MessageModel_ItemPropertiesAttributeStream::GetTableEditType (const int theRow, const int) const
+{
+  //switch (theRow)
+  //{
+  //  case 0: return ViewControl_EditType_Spin;
+  //  default: return ViewControl_EditType_None;
+  //}
+  return ViewControl_EditType_None;
+}
+
+// =======================================================================
+// function : SetTableData
+// purpose :
+// =======================================================================
+bool MessageModel_ItemPropertiesAttributeStream::SetTableData (const int theRow, const int theColumn, const QVariant& theValue)
+{
+  //Handle(Message_Report) aReport = getItemReport();
+  //switch (theRow)
+  //{
+  //  case 0:  aReport->SetLimit (theValue.toInt()); break;
+  //  default: break;
+  //}
+  return true;
+}
diff --git a/tools/MessageModel/MessageModel_ItemPropertiesAttributeStream.hxx b/tools/MessageModel/MessageModel_ItemPropertiesAttributeStream.hxx
new file mode 100644 (file)
index 0000000..96a86f6
--- /dev/null
@@ -0,0 +1,100 @@
+// Created on: 2019-02-25
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2019 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement. 
+
+#ifndef MessageModel_ItemReportProperties_H
+#define MessageModel_ItemReportProperties_H
+
+#include <Standard.hxx>
+#include <Message_AttributeStream.hxx>
+#include <NCollection_IndexedDataMap.hxx>
+#include <TCollection_AsciiString.hxx>
+
+
+#include <inspector/TreeModel_ItemProperties.hxx>
+#include <inspector/TreeModel_ItemBase.hxx>
+
+#include <Standard_WarningsDisable.hxx>
+#include <QAbstractTableModel>
+#include <QColor>
+#include <QList>
+#include <QModelIndexList>
+#include <QVariant>
+#include <Standard_WarningsRestore.hxx>
+
+class QItemDelegate;
+
+DEFINE_STANDARD_HANDLE (MessageModel_ItemPropertiesAttributeStream, TreeModel_ItemProperties)
+
+//! \class MessageModel_ItemPropertiesAttributeStream
+//! \brief This is an interace for ViewControl_TableModel to give real values of the model
+//! It should be filled or redefined.
+class MessageModel_ItemPropertiesAttributeStream : public TreeModel_ItemProperties
+{
+public:
+
+  //! Constructor
+  Standard_EXPORT MessageModel_ItemPropertiesAttributeStream (TreeModel_ItemBasePtr theItem)
+    : TreeModel_ItemProperties (theItem) {}
+
+  //! Destructor
+  virtual ~MessageModel_ItemPropertiesAttributeStream() {}
+
+  //! If me has internal values, it should be initialized here.
+  Standard_EXPORT virtual void Init();
+
+  //! If the item has internal values, there should be reseted here.
+  Standard_EXPORT virtual void Reset();
+
+  //! Returns number of rows, depending on orientation: myColumnCount or size of values container
+  //! \param theParent an index of the parent item
+  //! \return an integer value
+  Standard_EXPORT virtual int GetTableRowCount() const Standard_OVERRIDE;
+
+  //! Returns content of the model index for the given role, it is obtained from internal container of values
+  //! It returns value only for DisplayRole.
+  //! \param theRow a model index row
+  //! \param theColumn a model index column
+  //! \param theRole a view role
+  //! \return value intepreted depending on the given role
+  Standard_EXPORT virtual QVariant GetTableData (const int theRow, const int theColumn, const int theRole = Qt::DisplayRole) const Standard_OVERRIDE;
+
+  //! Returns type of edit control for the model index. By default, it is an empty control
+  //! \param theRow a model index row
+  //! \param theColumn a model index column
+  //! \return edit type
+  Standard_EXPORT virtual ViewControl_EditType GetTableEditType (const int theRow, const int theColumn) const Standard_OVERRIDE;
+
+  //! Sets the value into the table cell. Only 1st column value might be modified.
+  //! \param theRow a model index row
+  //! \param theColumn a model index column
+  //! \param theValue a new cell value
+  Standard_EXPORT virtual bool SetTableData (const int theRow, const int theColumn, const QVariant& theValue) Standard_OVERRIDE;
+
+  DEFINE_STANDARD_RTTIEXT (MessageModel_ItemPropertiesAttributeStream, TreeModel_ItemProperties)
+
+protected:
+  //! Returns attribute with stream value
+  const NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString>& GetValues() const
+  {
+    if (!IsInitialized())
+      const_cast<MessageModel_ItemPropertiesAttributeStream*>(this)->Init();
+    return myValues;
+  }
+
+protected:
+  NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString> myValues;
+};
+
+#endif
diff --git a/tools/MessageModel/MessageModel_ItemPropertiesReport.cxx b/tools/MessageModel/MessageModel_ItemPropertiesReport.cxx
new file mode 100644 (file)
index 0000000..5860f5e
--- /dev/null
@@ -0,0 +1,102 @@
+// Created on: 2019-02-25
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2019 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement. 
+
+#include <inspector/MessageModel_ItemPropertiesReport.hxx>
+#include <inspector/MessageModel_ItemReport.hxx>
+#include <inspector/ShapeView_ItemShape.hxx>
+#include <inspector/ShapeView_Tools.hxx>
+
+#include <inspector/ViewControl_Tools.hxx>
+#include <BRep_Tool.hxx>
+#include <TopoDS.hxx>
+
+#include <Standard_WarningsDisable.hxx>
+#include <QApplication>
+#include <QFont>
+#include <Standard_WarningsRestore.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(MessageModel_ItemPropertiesReport, TreeModel_ItemProperties)
+
+// =======================================================================
+// function : RowCount
+// purpose :
+// =======================================================================
+
+int MessageModel_ItemPropertiesReport::GetTableRowCount() const
+{
+  return 1;
+}
+
+// =======================================================================
+// function : Data
+// purpose :
+// =======================================================================
+
+QVariant MessageModel_ItemPropertiesReport::GetTableData (const int theRow, const int theColumn, int theRole) const
+{
+  if (theRole != Qt::DisplayRole)
+    return QVariant();
+
+  Handle(Message_Report) aReport = getItemReport();
+  switch (theRow)
+  {
+    case 0:  return theColumn == 0 ? QVariant ("Limit") : QVariant (aReport->GetLimit());
+    default: break;
+  }
+
+  return QVariant();
+}
+
+// =======================================================================
+// function : GetTableEditType
+// purpose :
+// =======================================================================
+ViewControl_EditType MessageModel_ItemPropertiesReport::GetTableEditType (const int theRow, const int) const
+{
+  switch (theRow)
+  {
+    case 0: return ViewControl_EditType_Spin;
+    default: return ViewControl_EditType_None;
+  }
+}
+
+// =======================================================================
+// function : SetTableData
+// purpose :
+// =======================================================================
+bool MessageModel_ItemPropertiesReport::SetTableData (const int theRow, const int theColumn, const QVariant& theValue)
+{
+  Handle(Message_Report) aReport = getItemReport();
+  switch (theRow)
+  {
+    case 0:  aReport->SetLimit (theValue.toInt()); break;
+    default: break;
+  }
+  return true;
+}
+
+// =======================================================================
+// function : getItemReport
+// purpose :
+// =======================================================================
+
+Handle(Message_Report) MessageModel_ItemPropertiesReport::getItemReport() const
+{
+  MessageModel_ItemReportPtr aReportItem = itemDynamicCast<MessageModel_ItemReport>(getItem());
+  if (!aReportItem)
+    return NULL;
+
+  return aReportItem->GetReport();
+}
diff --git a/tools/MessageModel/MessageModel_ItemPropertiesReport.hxx b/tools/MessageModel/MessageModel_ItemPropertiesReport.hxx
new file mode 100644 (file)
index 0000000..ce1b324
--- /dev/null
@@ -0,0 +1,83 @@
+// Created on: 2019-02-25
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2019 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement. 
+
+#ifndef MessageModel_ItemReportProperties_H
+#define MessageModel_ItemReportProperties_H
+
+#include <Standard.hxx>
+#include <Message_Report.hxx>
+
+#include <inspector/TreeModel_ItemProperties.hxx>
+#include <inspector/TreeModel_ItemBase.hxx>
+
+#include <Standard_WarningsDisable.hxx>
+#include <QAbstractTableModel>
+#include <QColor>
+#include <QList>
+#include <QModelIndexList>
+#include <QVariant>
+#include <Standard_WarningsRestore.hxx>
+
+class QItemDelegate;
+
+DEFINE_STANDARD_HANDLE (MessageModel_ItemPropertiesReport, TreeModel_ItemProperties)
+
+//! \class MessageModel_ItemPropertiesReport
+//! \brief This is an interace for ViewControl_TableModel to give real values of the model
+//! It should be filled or redefined.
+class MessageModel_ItemPropertiesReport : public TreeModel_ItemProperties
+{
+public:
+
+  //! Constructor
+  Standard_EXPORT MessageModel_ItemPropertiesReport (TreeModel_ItemBasePtr theItem)
+    : TreeModel_ItemProperties (theItem) {}
+
+  //! Destructor
+  virtual ~MessageModel_ItemPropertiesReport() {}
+
+  //! Returns number of rows, depending on orientation: myColumnCount or size of values container
+  //! \param theParent an index of the parent item
+  //! \return an integer value
+  Standard_EXPORT virtual int GetTableRowCount() const Standard_OVERRIDE;
+
+  //! Returns content of the model index for the given role, it is obtained from internal container of values
+  //! It returns value only for DisplayRole.
+  //! \param theRow a model index row
+  //! \param theColumn a model index column
+  //! \param theRole a view role
+  //! \return value intepreted depending on the given role
+  Standard_EXPORT virtual QVariant GetTableData (const int theRow, const int theColumn, const int theRole = Qt::DisplayRole) const Standard_OVERRIDE;
+
+  //! Returns type of edit control for the model index. By default, it is an empty control
+  //! \param theRow a model index row
+  //! \param theColumn a model index column
+  //! \return edit type
+  Standard_EXPORT virtual ViewControl_EditType GetTableEditType (const int theRow, const int theColumn) const Standard_OVERRIDE;
+
+  //! Sets the value into the table cell. Only 1st column value might be modified.
+  //! \param theRow a model index row
+  //! \param theColumn a model index column
+  //! \param theValue a new cell value
+  Standard_EXPORT virtual bool SetTableData (const int theRow, const int theColumn, const QVariant& theValue) Standard_OVERRIDE;
+
+  DEFINE_STANDARD_RTTIEXT (MessageModel_ItemPropertiesReport, TreeModel_ItemProperties)
+
+protected:
+  //! Returns report
+  Handle(Message_Report) getItemReport() const;
+};
+
+#endif
index a2af8df74ebd5617b146ce7835bb5ea573b3bd02..4f387e61c518f74a125946a6433b61131df229ef 100644 (file)
@@ -16,7 +16,7 @@
 #include <inspector/MessageModel_ItemReport.hxx>
 
 #include <inspector/MessageModel_ItemAlert.hxx>
-#include <inspector/MessageModel_ItemReportProperties.hxx>
+#include <inspector/MessageModel_ItemPropertiesReport.hxx>
 #include <inspector/MessageModel_ItemRoot.hxx>
 #include <inspector/MessageModel_Tools.hxx>
 
@@ -128,7 +128,7 @@ void MessageModel_ItemReport::Init()
   myReport = aRootItem ? aRootItem->GetReport (Row(), myDescription) : Handle(Message_Report)();
 
   TreeModel_ItemBasePtr anItem = Parent()->Child (Row(), Column(), false);
-  SetProperties (new MessageModel_ItemReportProperties(anItem));
+  SetProperties (new MessageModel_ItemPropertiesReport (anItem));
 
   MessageModel_ItemBase::Init();
 }
diff --git a/tools/MessageModel/MessageModel_ItemReportProperties.cxx b/tools/MessageModel/MessageModel_ItemReportProperties.cxx
deleted file mode 100644 (file)
index 4538856..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-// Created on: 2019-02-25
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2019 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement. 
-
-#include <inspector/MessageModel_ItemReportProperties.hxx>
-#include <inspector/MessageModel_ItemReport.hxx>
-#include <inspector/ShapeView_ItemShape.hxx>
-#include <inspector/ShapeView_Tools.hxx>
-
-#include <inspector/ViewControl_Tools.hxx>
-#include <BRep_Tool.hxx>
-#include <TopoDS.hxx>
-
-#include <Standard_WarningsDisable.hxx>
-#include <QApplication>
-#include <QFont>
-#include <Standard_WarningsRestore.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(MessageModel_ItemReportProperties, TreeModel_ItemProperties)
-
-// =======================================================================
-// function : RowCount
-// purpose :
-// =======================================================================
-
-int MessageModel_ItemReportProperties::GetTableRowCount() const
-{
-  return 1;
-}
-
-// =======================================================================
-// function : Data
-// purpose :
-// =======================================================================
-
-QVariant MessageModel_ItemReportProperties::GetTableData (const int theRow, const int theColumn, int theRole) const
-{
-  if (theRole != Qt::DisplayRole)
-    return QVariant();
-
-  Handle(Message_Report) aReport = getItemReport();
-  switch (theRow)
-  {
-    case 0:  return theColumn == 0 ? QVariant ("Limit") : QVariant (aReport->GetLimit());
-    default: break;
-  }
-
-  return QVariant();
-}
-
-// =======================================================================
-// function : GetTableEditType
-// purpose :
-// =======================================================================
-ViewControl_EditType MessageModel_ItemReportProperties::GetTableEditType (const int theRow, const int) const
-{
-  switch (theRow)
-  {
-    case 0: return ViewControl_EditType_Spin;
-    default: return ViewControl_EditType_None;
-  }
-}
-
-// =======================================================================
-// function : SetTableData
-// purpose :
-// =======================================================================
-bool MessageModel_ItemReportProperties::SetTableData (const int theRow, const int theColumn, const QVariant& theValue)
-{
-  Handle(Message_Report) aReport = getItemReport();
-  switch (theRow)
-  {
-    case 0:  aReport->SetLimit (theValue.toInt()); break;
-    default: break;
-  }
-  return true;
-}
-
-// =======================================================================
-// function : getItemReport
-// purpose :
-// =======================================================================
-
-Handle(Message_Report) MessageModel_ItemReportProperties::getItemReport() const
-{
-  MessageModel_ItemReportPtr aReportItem = itemDynamicCast<MessageModel_ItemReport>(getItem());
-  if (!aReportItem)
-    return NULL;
-
-  return aReportItem->GetReport();
-}
diff --git a/tools/MessageModel/MessageModel_ItemReportProperties.hxx b/tools/MessageModel/MessageModel_ItemReportProperties.hxx
deleted file mode 100644 (file)
index 2970397..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-// Created on: 2019-02-25
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2019 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement. 
-
-#ifndef MessageModel_ItemReportProperties_H
-#define MessageModel_ItemReportProperties_H
-
-#include <Standard.hxx>
-#include <Message_Report.hxx>
-
-#include <inspector/TreeModel_ItemProperties.hxx>
-#include <inspector/TreeModel_ItemBase.hxx>
-
-#include <Standard_WarningsDisable.hxx>
-#include <QAbstractTableModel>
-#include <QColor>
-#include <QList>
-#include <QModelIndexList>
-#include <QVariant>
-#include <Standard_WarningsRestore.hxx>
-
-class QItemDelegate;
-
-DEFINE_STANDARD_HANDLE (MessageModel_ItemReportProperties, TreeModel_ItemProperties)
-
-//! \class MessageModel_ItemReportProperties
-//! \brief This is an interace for ViewControl_TableModel to give real values of the model
-//! It should be filled or redefined.
-class MessageModel_ItemReportProperties : public TreeModel_ItemProperties
-{
-public:
-
-  //! Constructor
-  Standard_EXPORT MessageModel_ItemReportProperties (TreeModel_ItemBasePtr theItem)
-    : TreeModel_ItemProperties (theItem) {}
-
-  //! Destructor
-  virtual ~MessageModel_ItemReportProperties() {}
-
-  //! Returns number of rows, depending on orientation: myColumnCount or size of values container
-  //! \param theParent an index of the parent item
-  //! \return an integer value
-  Standard_EXPORT virtual int GetTableRowCount() const Standard_OVERRIDE;
-
-  //! Returns content of the model index for the given role, it is obtained from internal container of values
-  //! It returns value only for DisplayRole.
-  //! \param theRow a model index row
-  //! \param theColumn a model index column
-  //! \param theRole a view role
-  //! \return value intepreted depending on the given role
-  Standard_EXPORT virtual QVariant GetTableData (const int theRow, const int theColumn, const int theRole = Qt::DisplayRole) const Standard_OVERRIDE;
-
-  //! Returns type of edit control for the model index. By default, it is an empty control
-  //! \param theRow a model index row
-  //! \param theColumn a model index column
-  //! \return edit type
-  Standard_EXPORT virtual ViewControl_EditType GetTableEditType (const int theRow, const int theColumn) const Standard_OVERRIDE;
-
-  //! Sets the value into the table cell. Only 1st column value might be modified.
-  //! \param theRow a model index row
-  //! \param theColumn a model index column
-  //! \param theValue a new cell value
-  Standard_EXPORT virtual bool SetTableData (const int theRow, const int theColumn, const QVariant& theValue) Standard_OVERRIDE;
-
-  DEFINE_STANDARD_RTTIEXT (MessageModel_ItemReportProperties, TreeModel_ItemProperties)
-
-protected:
-  //! Returns report
-  Handle(Message_Report) getItemReport() const;
-};
-
-#endif
diff --git a/tools/MessageModel/MessageModel_TableModelValues.cxx b/tools/MessageModel/MessageModel_TableModelValues.cxx
deleted file mode 100644 (file)
index 9b295cf..0000000
+++ /dev/null
@@ -1,75 +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_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
deleted file mode 100644 (file)
index 85145e7..0000000
+++ /dev/null
@@ -1,57 +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_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 0adacedd377ffb2b92be61825dd36b7724d2bcfa..892f16528743da1b5a59ac30e75c6b67aa06980c 100644 (file)
@@ -15,7 +15,6 @@
 
 #include <inspector/MessageModel_Tools.hxx>
 #include <inspector/MessageModel_ItemAlert.hxx>
-#include <inspector/MessageModel_TableModelValues.hxx>
 
 #include <inspector/ViewControl_Table.hxx>
 #include <inspector/ViewControl_TableModelValues.hxx>
@@ -27,7 +26,7 @@
 #include <BRepTools.hxx>
 #include <Message_AlertExtended.hxx>
 #include <Message_AttributeObject.hxx>
-#include <Message_AttributeVectorOfValues.hxx>
+#include <Message_AttributeStream.hxx>
 
 #include <Precision.hxx>
 #include <TopoDS_AlertAttribute.hxx>
@@ -163,36 +162,36 @@ void MessageModel_Tools::GetPropertyTableValues (const TreeModel_ItemBasePtr& th
   if (anAttribute.IsNull())
     return;
 
-  if (anAttribute->IsKind (STANDARD_TYPE (Message_AttributeVectorOfValues)))
+  //if (anAttribute->IsKind (STANDARD_TYPE (Message_AttributeStream)))
+  //{
+    //int aSectionSize = 200;
+    //ViewControl_TableModelValues* aTableValues = new MessageModel_TableModelValues (anAttribute, aSectionSize);
+    //theTableValues.append (aTableValues);
+  //}
+  //else
+  //{
+  if (!anAttribute->GetDescription().IsEmpty())
   {
-    int aSectionSize = 200;
-    ViewControl_TableModelValues* aTableValues = new MessageModel_TableModelValues (anAttribute, aSectionSize);
+    ViewControl_TableModelValuesDefault* aTableValues = new ViewControl_TableModelValuesDefault();
+    QList<TreeModel_HeaderSection> aHeaderValues;
+    QVector<QVariant> aValues;
+    aHeaderValues << TreeModel_HeaderSection ("Description", -2);
+    aValues << anAttribute->GetDescription().ToCString();
+    aTableValues->SetHeaderValues (aHeaderValues, Qt::Horizontal);
+
+    QString aValueStr = anAttribute->GetDescription().ToCString();
+    QStringList aValueStrList = aValueStr.split ("\n");
+    int aNbRows = aValueStrList.size();
+
+    QFontMetrics aFontMetrics (qApp->font());
+    int aHeight = aFontMetrics.boundingRect(aValueStr).height();
+    aHeight = (aHeight + TreeModel_Tools::HeaderSectionMargin()) * aNbRows;
+    aTableValues->SetValues (aValues);
+    aTableValues->SetDefaultSectionSize(Qt::Vertical, aHeight);
+
     theTableValues.append (aTableValues);
   }
-  else
-  {
-    if (!anAttribute->GetDescription().IsEmpty())
-    {
-      ViewControl_TableModelValuesDefault* aTableValues = new ViewControl_TableModelValuesDefault();
-      QList<TreeModel_HeaderSection> aHeaderValues;
-      QVector<QVariant> aValues;
-      aHeaderValues << TreeModel_HeaderSection ("Description", -2);
-      aValues << anAttribute->GetDescription().ToCString();
-      aTableValues->SetHeaderValues (aHeaderValues, Qt::Horizontal);
-
-      QString aValueStr = anAttribute->GetDescription().ToCString();
-      QStringList aValueStrList = aValueStr.split ("\n");
-      int aNbRows = aValueStrList.size();
-
-      QFontMetrics aFontMetrics (qApp->font());
-      int aHeight = aFontMetrics.boundingRect(aValueStr).height();
-      aHeight = (aHeight + TreeModel_Tools::HeaderSectionMargin()) * aNbRows;
-      aTableValues->SetValues (aValues);
-      aTableValues->SetDefaultSectionSize(Qt::Vertical, aHeight);
-
-      theTableValues.append (aTableValues);
-    }
-  }
+  //}
 }
 
 // =======================================================================
index cec2d932df323d9cd738955b4d647e6058e0d3a1..5b7e5d415ff461c1d9bcdc1e409762f84e0e0016 100644 (file)
@@ -17,7 +17,7 @@
 #include <inspector/MessageModel_ItemAlert.hxx>
 
 #include <Message_AlertExtended.hxx>
-#include <Message_AttributeVectorOfValues.hxx>
+#include <Message_AttributeStream.hxx>
 
 #include <TopoDS_AlertAttribute.hxx>
 
@@ -133,7 +133,7 @@ bool MessageView_VisibilityState::hasTableValues (const QModelIndex& theIndex) c
   if (anAlert.IsNull())
     return false;
 
-  if (anAlert->IsKind (STANDARD_TYPE (Message_AttributeVectorOfValues)))
+  if (anAlert->IsKind (STANDARD_TYPE (Message_AttributeStream)))
     return true;
 
   return false;
index ad8895e831e3c72fa6124ade8e3772648922aab6..72b06db0adcdcc6cc0b9c369868ceda6216b6254 100644 (file)
@@ -30,7 +30,7 @@
 #include <inspector/ViewControl_PropertyView.hxx>
 #include <inspector/ViewControl_TableModelValues.hxx>
 #include <inspector/ViewControl_TreeView.hxx>
-#include <inspector/ViewControl_TransientShape.hxx>
+#include <inspector/Convert_TransientShape.hxx>
 
 #include <inspector/View_Tools.hxx>
 #include <inspector/View_Viewer.hxx>
@@ -361,7 +361,6 @@ void MessageView_Window::Init (NCollection_List<Handle(Standard_Transient)>& the
 
   if (!aContext.IsNull())
   {
-    myContext = aContext;
     myViewWindow->SetContext (View_ContextType_External, aContext);
   }
 
@@ -719,17 +718,16 @@ void MessageView_Window::updatePropertyPanelBySelection()
 // =======================================================================
 void MessageView_Window::updatePreviewPresentation (const NCollection_List<Handle(Standard_Transient)>& thePresentations)
 {
-  if (myContext.IsNull())
+  Handle(AIS_InteractiveContext) aContext = myViewWindow->GetViewToolBar()->GetCurrentContext();
+  if (aContext.IsNull())
     return;
 
-  Handle(AIS_InteractiveContext) aContext = myContext;
-
   if (!myPreviewPresentations.IsEmpty())
   {
     for (NCollection_List<Handle(Standard_Transient)>::Iterator aDisplayedIt (myPreviewPresentations); aDisplayedIt.More(); aDisplayedIt.Next())
     {
       Handle(AIS_InteractiveObject) aPrs = Handle(AIS_InteractiveObject)::DownCast (aDisplayedIt.Value());
-      if (!aPrs.IsNull())
+      if (!aPrs.IsNull() && aPrs->GetContext() == aContext)
         aContext->Remove (aPrs, Standard_True);
     }
   }
@@ -747,18 +745,20 @@ void MessageView_Window::updatePreviewPresentation (const NCollection_List<Handl
     Handle(AIS_InteractiveObject) aPrs = Handle(AIS_InteractiveObject)::DownCast (aDisplayedIt.Value());
     if (!aPrs.IsNull())
     {
+      if (!aPrs->GetContext().IsNull())
+        continue; // not possible to display one object in several contexts
       aContext->Display (aPrs, AIS_Shaded, -1/*do not participate in selection*/, Standard_True);
     }
-    else if (!Handle(ViewControl_TransientShape)::DownCast (aDisplayedIt.Value()).IsNull())
+    else if (!Handle(Convert_TransientShape)::DownCast (aDisplayedIt.Value()).IsNull())
     {
-      Handle(ViewControl_TransientShape) aShapeObject = Handle(ViewControl_TransientShape)::DownCast (aDisplayedIt.Value());
+      Handle(Convert_TransientShape) aShapeObject = Handle(Convert_TransientShape)::DownCast (aDisplayedIt.Value());
       aBuilder.Add (aCompound, aShapeObject->GetShape());
     }
   }
 
   if (aCompound.IsNull())
   {
-    if (!aContext.IsNull())
+    if (!aContext.IsNull() && myPreviewPresentation->GetContext() == aContext)
       aContext->Remove (myPreviewPresentation, Standard_True);
     myPreviewPresentation = NULL;
     return;
@@ -769,7 +769,7 @@ void MessageView_Window::updatePreviewPresentation (const NCollection_List<Handl
     if (myPreviewPresentation.IsNull())
     {
       myPreviewPresentation = new AIS_Shape (aCompound);
-      myPreviewPresentation->SetAttributes (GetPreviewAttributes(myContext));
+      myPreviewPresentation->SetAttributes (GetPreviewAttributes(aContext));
       //myPreviewPresentation->SetAttributes (myPreviewParameters->GetDrawer());
 
       //myPreviewPresentation->SetTransformPersistence(thePersistent);
@@ -780,7 +780,7 @@ void MessageView_Window::updatePreviewPresentation (const NCollection_List<Handl
     {
       Handle(AIS_Shape)::DownCast (myPreviewPresentation)->Set (aCompound);
       //myPreviewPresentation->SetTransformPersistence(thePersistent);
-      if (!aContext.IsNull())
+      if (!aContext.IsNull() && myPreviewPresentation->GetContext() == aContext)
         aContext->Redisplay (myPreviewPresentation, Standard_True);
     }
   }
index a4ace53694fd3795d3be77bbef56d7aa5ee49f91..d90555ad40f0f35218507f207661dfa339e0df72 100644 (file)
@@ -179,7 +179,6 @@ private:
   Handle(TInspectorAPI_PluginParameters) myParameters; //!< plugins parameters container
   Handle(Message_ReportCallBack) myCallBack; //! < message call back to update content of the view
 
-  Handle(AIS_InteractiveContext) myContext; //! current context
   Handle(AIS_InteractiveObject) myPreviewPresentation; //!< presentation of preview for a selected object
   NCollection_List<Handle(Standard_Transient)> myPreviewPresentations;
 };
index 5743c1e0d197cd85718f0b538a16d93e2e0559f5..75ccf87870548781dee166fdca169b8cde469863 100644 (file)
@@ -131,7 +131,8 @@ int main (int argc, char** argv)
     aReport->SetActive (Standard_True);//Standard_False);
     aPlugins.insert("TKMessageView");
 
-    anActivatedPluginName = "TKVInspector";
+    //anActivatedPluginName = "TKVInspector";
+    anActivatedPluginName = "TKMessageView";
   }
   else
     anActivatedPluginName = *aPlugins.rbegin();
index df0002f9afbd0fe4d4a95c77e1c51093a25cdeca..fd85421be9b192826a7531a5ed3cadf3c4a83bb9 100644 (file)
@@ -1,4 +1,7 @@
 TKG3d
 TKernel
 TKLCAF
-TKMath
\ No newline at end of file
+TKMath
+TKBRep
+TKTopAlgo
+TKPrim
index 7cb3cd210e16873a2bd23d2e3002969b3fa6949b..72bf985bdeda8bc00483f2506529db251ee40397 100644 (file)
@@ -1 +1,3 @@
+Convert
 TInspectorAPI
+
index b5f64414c04abc1fbee622a2aad729ba8071f5cc..72cf33304fd53133e63f80a04f682b53734f730b 100644 (file)
@@ -4,4 +4,5 @@ TKMath
 TKService
 TKOpenGl
 TKV3d
+TKTInspectorAPI
 CSF_QT
\ No newline at end of file
index 3efee94260e6d5b464796524c60a65efa76e83b7..af8dc1f860ac6470905d77e1052770ea7f936fbd 100644 (file)
@@ -52,7 +52,7 @@ Handle(TreeModel_ItemProperties) TreeModel_ItemBase::GetProperties() const
 }
 
 // =======================================================================
-// function :  reset
+// function :  Reset
 // purpose :
 // =======================================================================
 void TreeModel_ItemBase::Reset()
@@ -76,7 +76,7 @@ void TreeModel_ItemBase::Reset()
 // =======================================================================
 void TreeModel_ItemBase::Reset (int theRole)
 {
-  if (!myCachedValues.contains (theRole))  
+  if (!myCachedValues.contains (theRole))
     return;
 
   myCachedValues.remove (theRole);
index a16e3a2ca5981c23e8504b1c377b7fc025e194e2..fb7086f2549971dd2f6131e14b67521646673cd2 100644 (file)
 
 IMPLEMENT_STANDARD_RTTIEXT(TreeModel_ItemProperties, Standard_Transient)
 
+// =======================================================================
+// function :  Reset
+// purpose :
+// =======================================================================
+void TreeModel_ItemProperties::Reset()
+{
+  m_bInitialized = false;
+  myCachedValues.clear();
+}
+
 // =======================================================================
 // function : GetTableFlags
 // purpose :
@@ -31,3 +41,46 @@ Qt::ItemFlags TreeModel_ItemProperties::GetTableFlags (const int, const int theC
 
   return aFlags;
 }
+
+// =======================================================================
+// function : cachedValueRowCount
+// purpose :
+// =======================================================================
+
+int TreeModel_ItemProperties::cachedDimValue (const TreeModel_DimType theDimType) const
+{
+  if (myCachedDimValues.contains (theDimType))
+    return myCachedDimValues[theDimType].toInt();
+
+  QVariant aValueToCache;
+  switch (theDimType)
+  {
+    case TreeModel_DimType_Rows:    aValueToCache = GetTableRowCount(); break;
+    case TreeModel_DimType_Columns: aValueToCache = GetTableColumnCount(); break;
+  }
+
+  const_cast<TreeModel_ItemProperties*>(this)->myCachedDimValues.insert (theDimType, aValueToCache);
+  return myCachedDimValues.contains (theDimType) ? myCachedDimValues[theDimType].toInt() : 0;
+}
+
+// =======================================================================
+// function : cachedValue
+// purpose :
+// =======================================================================
+
+QVariant TreeModel_ItemProperties::cachedValue (const int theRow, const int theColumn, int theRole) const
+{
+  QPair<int, int> aPos = qMakePair (theRow, theColumn);
+  if (myCachedValues.contains (aPos) && myCachedValues[aPos].contains (theRole))
+    return myCachedValues[aPos][theRole];
+
+  QVariant aValueToCache = GetTableData (theRow, theColumn, theRole);
+
+  QMap<int, QVariant> aValuesToCache;
+  if (myCachedValues.contains(aPos))
+    aValuesToCache = myCachedValues[aPos];
+  aValuesToCache.insert (theRole, aValueToCache);
+
+  const_cast<TreeModel_ItemProperties*>(this)->myCachedValues.insert (aPos, aValuesToCache);
+  return aValueToCache;
+}
index a7a41282c6ed161a2734a098234bb6b3d0ef8b8e..8310cd3a617ba75a2ad7ebcb3ad3966445e0f7ee 100644 (file)
@@ -41,6 +41,13 @@ DEFINE_STANDARD_HANDLE (TreeModel_ItemProperties, Standard_Transient)
 //! Class to manipulate properties of tree item. The properties are organized in table structure
 class TreeModel_ItemProperties : public Standard_Transient
 {
+  //! enum defined the dimension type
+  enum TreeModel_DimType
+  {
+    TreeModel_DimType_Rows,   //! defines number of rows
+    TreeModel_DimType_Columns //! defines number of columns
+  };
+
 public:
   //! Constructor
   TreeModel_ItemProperties (const TreeModel_ItemBasePtr& theItem) : myItem (theItem) {}
@@ -48,11 +55,33 @@ public:
   //! Destructor
   ~TreeModel_ItemProperties() {}
 
+  //! Returns number of table rows. It uses cached value of GetTableRowCount(), Reset() to reinit it.
+  //! \return an integer value
+  int RowCount() const { return cachedDimValue (TreeModel_DimType_Rows); }
+
+  //! Returns number of table columns. It uses cached value of GetTableColumnCount(), Reset() to reinit it.
+  //! \return an integer value
+  int ColumnCount() const { return cachedDimValue (TreeModel_DimType_Columns); }
+
+  //! Returns content of the model index for the given role, it is obtained from internal container of values
+  //! It uses cached value of GetTableData(), Reset() to reinit it.
+  //! \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
+  QVariant Data (const int theRow, const int theColumn, int theRole = Qt::DisplayRole) const
+    { return cachedValue (theRow, theColumn, theRole); }
+
+  //! Gets whether the item is already initialized.The initialized state is thrown down
+  //! by the reset method and get back after the method Init().
+  //!  \return if the item is initialized
+  bool IsInitialized() const { return m_bInitialized; }
+
   //! If me has internal values, it should be initialized here.
-  virtual void Init() {}
+  virtual void Init() { m_bInitialized = true; }
 
   //! If the item has internal values, there should be reseted here.
-  Standard_EXPORT virtual void Reset() {}
+  Standard_EXPORT virtual void Reset();
 
   //! Returns number of item children
   //! \return an integer value, ZERO by default
@@ -114,15 +143,32 @@ public:
   //! \return flags
   Standard_EXPORT virtual Qt::ItemFlags GetTableFlags (const int theRow, const int theColumn) const;
 
-
   DEFINE_STANDARD_RTTIEXT (TreeModel_ItemProperties, Standard_Transient)
 
 protected:
   //! Returns current item
   TreeModel_ItemBasePtr getItem() const { return myItem; }
 
+private:
+  //! Returns the cached value for number of rows. Init the value if it is requested the first time.
+  //! \param theDimType dimension type
+  //! \return the value
+  Standard_EXPORT int cachedDimValue (const TreeModel_DimType theDimType) const;
+
+  //! Returns the cached value for the role. Init the value if it is requested the first time
+  //! By default, it calls initRowCount(TreeModel_ItemRole_RowCountRole) or initValue for the item role
+  //! \param theItemRole a value role
+  //! \return the value
+  Standard_EXPORT QVariant cachedValue (const int theRow, const int theColumn, int theRole) const;
+
 private:
   TreeModel_ItemBasePtr myItem; //! current item
+
+  QMap<TreeModel_DimType, QVariant> myCachedDimValues; //!< cached values, should be cleared by reset
+  QMap<QPair<int, int>, QMap<int, QVariant> > myCachedValues; //!< cached values, should be cleared by reset
+  QMap<QPair<int, int>, NCollection_List<Handle(Standard_Transient)> > myCachedPresentations; //!< cached values, should be cleared by reset
+
+  bool m_bInitialized; //!< the state whether the item content is already initialized
 };
 
 #endif
\ No newline at end of file
index 8768383993cb86ed2c98849a722c61c76e62535b..92141ceaf41b2aa4139553cb047600da25de11fd 100644 (file)
@@ -4,7 +4,6 @@ VInspector_CallBack.hxx
 VInspector_CallBackMode.hxx
 VInspector_Communicator.cxx
 VInspector_Communicator.hxx
-VInspector_DisplayActionType.hxx
 VInspector_ItemAspectWindow.cxx
 VInspector_ItemAspectWindow.hxx
 VInspector_ItemBase.cxx
@@ -85,8 +84,6 @@ VInspector_ItemV3dView.cxx
 VInspector_ItemV3dView.hxx
 VInspector_ItemV3dViewer.cxx
 VInspector_ItemV3dViewer.hxx
-VInspector_PreviewParameters.cxx
-VInspector_PreviewParameters.hxx
 VInspector_PropertiesCreator.cxx
 VInspector_PropertiesCreator.hxx
 VInspector_SelectionType.hxx
diff --git a/tools/VInspector/VInspector_DisplayActionType.hxx b/tools/VInspector/VInspector_DisplayActionType.hxx
deleted file mode 100644 (file)
index 0e39185..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-// Created on: 2018-08-19
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2018 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement. 
-
-#ifndef VInspector_DisplayActionType_H
-#define VInspector_DisplayActionType_H
-
-//! \enum VInspector_DisplayActionType
-enum VInspector_DisplayActionType
-{
-  VInspector_DisplayActionType_NoneId, //!< No action activated
-  VInspector_DisplayActionType_DisplayId, //!< Display action
-  VInspector_DisplayActionType_RedisplayId, //!< Redisplay action
-  VInspector_DisplayActionType_EraseId, //!< Erase action
-  VInspector_DisplayActionType_RemoveId //!< Remove action
-};
-
-#endif
index 8bcd7e328ee9785f6a371139986af39c0c6d03cf..01c8744aa2a90412621eebc35a900f641c7650b0 100644 (file)
@@ -21,6 +21,8 @@
 #include <inspector/VInspector_Tools.hxx>
 #include <inspector/ViewControl_PropertiesStream.hxx>
 
+#include <inspector/Convert_Tools.hxx>
+
 #include <Bnd_Box.hxx>
 #include <BRep_Builder.hxx>
 #include <TopoDS_Compound.hxx>
@@ -185,10 +187,10 @@ TopoDS_Shape VInspector_ItemBVHTree::buildPresentationShape()
 
       TCollection_AsciiString aValue = aValues.Value (aValueId);
       Bnd_Box aBox;
-      if (!aBox.FromString (aValue))
+      if (!aBox.Init (Standard_SStream (aValue.ToCString())))
         continue;
 
-      TopoDS_Shape aShape = VInspector_Tools::CreateShape (aBox);
+      TopoDS_Shape aShape = Convert_Tools::CreateShape (aBox);
       aBuilder.Add (aCompound, aShape);
     }
   }
index 061539e303742a1a0ed43728b2dff34f3dd2fa1e..d171da21b30a01e3e8d76777c66b52e7e4bd8fde 100644 (file)
@@ -20,6 +20,8 @@
 //
 #include <inspector/VInspector_Tools.hxx>
 
+#include <inspector/Convert_Tools.hxx>
+
 #include <BRep_Builder.hxx>
 #include <TopoDS_Compound.hxx>
 
@@ -137,10 +139,10 @@ TopoDS_Shape VInspector_ItemBVHTreeNode::buildPresentationShape()
 
       TCollection_AsciiString aValue = aValues.Value (aValueId);
       Bnd_Box aBox;
-      if (!aBox.FromString (aValue))
+      if (!aBox.Init (Standard_SStream (aValue.ToCString())))
         continue;
 
-      TopoDS_Shape aShape = VInspector_Tools::CreateShape (aBox);
+      TopoDS_Shape aShape = Convert_Tools::CreateShape (aBox);
       aBuilder.Add (aCompound, aShape);
     }
   }
index 0fbeac194093e1be0c9763ed3eb5f8d88205889b..a6c26dc8440aabcbd464fa22ea350a5be9dc0594 100644 (file)
@@ -21,6 +21,8 @@
 #include <inspector/ViewControl_Table.hxx>
 #include <inspector/ViewControl_Tools.hxx>
 
+#include <inspector/Convert_Tools.hxx>
+
 #include <Graphic3d.hxx>
 
 // =======================================================================
@@ -223,7 +225,7 @@ bool VInspector_ItemPrs3dPresentation::SetTableData (const int theRow, const int
 TopoDS_Shape VInspector_ItemPrs3dPresentation::buildPresentationShape()
 {
   if (!myPresentation.IsNull())
-    myPresentationShape = VInspector_Tools::CreateShape (myPresentation->MinMaxValues());
+    myPresentationShape = Convert_Tools::CreateShape (myPresentation->MinMaxValues());
 
   return TopoDS_Shape();
 }
index c865b83c04b96e6b59d6e2bff031136cb4d09c26..e4a7d8b691843f366c678a34a7f93087f42366a1 100644 (file)
@@ -54,6 +54,8 @@
 //#include <inspector/ViewControl_Table.hxx>
 //#include <inspector/ViewControl_Tools.hxx>
 //
+
+#include <inspector/Convert_Tools.hxx>
 #include <Standard_WarningsDisable.hxx>
 //#include <QStringList>
 #include <QColor>
index 8b164ed38dbd9d1810eb378d574b9fb693c4d4f3..9416896f41e4e37c8a027845da6849391fc68023 100644 (file)
@@ -101,7 +101,7 @@ protected:
   //! \param theColumn the child column position
   //! \return the created item
   virtual TreeModel_ItemBasePtr createChild (int theRow, int theColumn) Standard_OVERRIDE
-  { return TreeModel_ItemBasePtr(); }
+  { (void)theRow, (void)theColumn; return TreeModel_ItemBasePtr(); }
 
   //! Returns owner of the current sensitive entity
   //! \return owner
index af955e3a9827656d1bfc0c3e813f05fe2c7ac01b..b65f2d28ae9419ebff55158f97a132185f619833 100644 (file)
@@ -48,6 +48,8 @@
 #include <TopoDS_Shape.hxx>
 #include <TopoDS_Vertex.hxx>
 
+#include <inspector/Convert_Tools.hxx>
+
 #include <inspector/VInspector_ItemContext.hxx>
 #include <inspector/VInspector_ItemSelectBasicsEntityOwner.hxx>
 #include <inspector/VInspector_ItemSelectMgrSensitiveEntity.hxx>
@@ -205,7 +207,7 @@ void VInspector_ItemSelectBasicsSensitiveEntity::GetPresentations(NCollection_Li
   if (!myPresentation.IsNull())
     return;
 
-  Handle(Select3D_SensitiveEntity) aBaseEntity = Handle(Select3D_SensitiveEntity)::DownCast (GetSensitiveEntity());
+  Handle(Select3D_SensitiveEntity) aBaseEntity = GetSensitiveEntity();
   if (aBaseEntity.IsNull())
     return;
 
@@ -276,7 +278,6 @@ QVariant VInspector_ItemSelectBasicsSensitiveEntity::GetTableData (const int the
     case 10: return ViewControl_Table::SeparatorData();
     default: return getTableData (theRow, theColumn, theRole, anEntity->DynamicType()->Name());
   }
-  return QVariant();
 }
 
 // =======================================================================
@@ -308,7 +309,7 @@ QVariant VInspector_ItemSelectBasicsSensitiveEntity::getTableData (const int the
                                                                    const int,
                                                                    const TCollection_AsciiString& theEntityKind) const
 {
-  Handle(Select3D_SensitiveEntity) aBaseEntity = Handle(Select3D_SensitiveEntity)::DownCast (GetSensitiveEntity());
+  Handle(Select3D_SensitiveEntity) aBaseEntity = GetSensitiveEntity();
   if (aBaseEntity.IsNull())
     return QVariant();
 
@@ -428,7 +429,7 @@ QVariant VInspector_ItemSelectBasicsSensitiveEntity::getTableData (const int the
 TopoDS_Shape VInspector_ItemSelectBasicsSensitiveEntity::buildPresentationShape
   (const Handle(SelectBasics_SensitiveEntity)& theEntity)
 {
-  Handle(Select3D_SensitiveEntity) aBaseEntity = Handle(Select3D_SensitiveEntity)::DownCast (theEntity);
+  Handle(Select3D_SensitiveEntity) aBaseEntity = theEntity;
   if (aBaseEntity.IsNull())
     return TopoDS_Shape();
 
@@ -446,7 +447,7 @@ TopoDS_Shape VInspector_ItemSelectBasicsSensitiveEntity::buildPresentationShape
   if (aTypeName == STANDARD_TYPE (Select3D_SensitiveBox)->Name())
   {
     Handle(Select3D_SensitiveBox) anEntity = Handle(Select3D_SensitiveBox)::DownCast (aBaseEntity);
-    TopoDS_Shape aShape = VInspector_Tools::CreateShape(anEntity->Box());
+    TopoDS_Shape aShape = Convert_Tools::CreateShape(anEntity->Box());
     aBuilder.Add (aCompound, aShape);
   }
   else if (aTypeName == STANDARD_TYPE (Select3D_SensitiveFace)->Name())
diff --git a/tools/VInspector/VInspector_PreviewParameters.cxx b/tools/VInspector/VInspector_PreviewParameters.cxx
deleted file mode 100644 (file)
index 7b3f80c..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-// Created on: 2019-05-03
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2019 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement. 
-
-#include <inspector/VInspector_PreviewParameters.hxx>
-
-#include <Prs3d_Drawer.hxx>
-#include <Prs3d_PointAspect.hxx>
-#include <Prs3d_ShadingAspect.hxx>
-
-// =======================================================================
-// function : Constructor
-// purpose :
-// =======================================================================
-VInspector_PreviewParameters::VInspector_PreviewParameters()
-{
-  myDrawer = new Prs3d_Drawer();
-
-  Quantity_Color aColor(Quantity_NOC_TOMATO);//Quantity_NOC_GREENYELLOW));//Quantity_NOC_BLUE1));
-  Standard_ShortReal aTransparency = 0.8;
-
-  // point parameters
-  myDrawer->SetPointAspect (new Prs3d_PointAspect (Aspect_TOM_O_PLUS, aColor, 3.0));
-
-  // shading parameters
-  Graphic3d_MaterialAspect aShadingMaterial;
-  aShadingMaterial.SetReflectionModeOff (Graphic3d_TOR_SPECULAR);
-  aShadingMaterial.SetMaterialType (Graphic3d_MATERIAL_ASPECT);
-
-  myDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
-  myDrawer->ShadingAspect()->Aspect()->SetInteriorStyle (Aspect_IS_SOLID);
-  myDrawer->ShadingAspect()->SetColor (aColor);
-  myDrawer->ShadingAspect()->SetMaterial (aShadingMaterial);
-
-  myDrawer->ShadingAspect()->Aspect()->ChangeFrontMaterial().SetTransparency (aTransparency);
-  myDrawer->ShadingAspect()->Aspect()->ChangeBackMaterial() .SetTransparency (aTransparency);
-  myDrawer->SetTransparency (aTransparency);
-
-  // common parameters
-  myDrawer->SetZLayer (Graphic3d_ZLayerId_Topmost);
-}
-
-// =======================================================================
-// function : SaveState
-// purpose :
-// =======================================================================
-void VInspector_PreviewParameters::SaveState (VInspector_PreviewParameters* theParameters,
-                                              QMap<QString, QString>& theItems,
-                                              const QString& thePrefix)
-{
-  Handle(Prs3d_Drawer) aDrawer = theParameters->GetDrawer();
-
-  //Quantity_Color aColor = aDrawer->Color();
-  //Standard_ShortReal aTransparency = aDrawer->Transparency();
-
-  //// point parameters
-  //{
-  //  Standard_Boolean anOwnPointAspect = aDrawer->HasOwnPointAspect();
-  //  Standard_SStream OS;
-  //  if (anOwnPointAspect)
-  //    myDrawer->PointAspect()->Dump (OS);
-  //  TCollection_AsciiString aStream (OS.str().c_str());
-  //  theItems[thePrefix + "has_point_aspect"] = anOwnPointAspect;
-  //  theItems[thePrefix + "point_aspect"] = aStream.ToCString();
-  //}
-  //// shading parameters
-  //{
-  //  Standard_Boolean anOwnShadingAspect = aDrawer->HasOwnShadingAspect();
-  //  Standard_SStream OS;
-  //  if (anOwnShadingAspect)
-  //    myDrawer->ShadingAspect()->Dump (OS);
-  //  TCollection_AsciiString aStream (OS.str().c_str());
-  //  theItems[thePrefix + "has_shading_aspect"] = anOwnShadingAspect;
-  //  theItems[thePrefix + "shading_aspect"] = aStream.ToCString();
-  //}
-}
-
-// =======================================================================
-// function : RestoreState
-// purpose :
-// =======================================================================
-bool  VInspector_PreviewParameters::RestoreState (VInspector_PreviewParameters* theParameters,
-                                                  const QString& theKey, const QString& theValue,
-                                                  const QString& thePrefix)
-{
-  //if (theKey == thePrefix + "has_point_aspect") // point parameters
-  //{
-  //  myDrawer->SetOwnPointAspect (theValue.toBool());
-  //}
-  //else if (theKey == thePrefix + "point_aspect") // point parameters
-  //{
-  //  Standard_SStream aStream;
-  //  aStream << theValue.ToString().ToStdString();
-  //  myDrawer->PointAspect()->Init (aStream);
-  //}
-  //else if (theKey == thePrefix + "has_shading_aspect") // shading parameters
-  //{
-  //  myDrawer->SetOwnShadingAspect (theValue.toBool());
-  //}
-  //else if (theKey == thePrefix + "shading_aspect") // shading parameters
-  //{
-  //  Standard_SStream aStream;
-  //  aStream << theValue.ToString().ToStdString();
-  //  myDrawer->ShadingAspect()->Init (aStream);
-  //}
-  //else
-  //  return false;
-  return true;
-}
diff --git a/tools/VInspector/VInspector_PreviewParameters.hxx b/tools/VInspector/VInspector_PreviewParameters.hxx
deleted file mode 100644 (file)
index e98bea6..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-// Created on: 2019-05-03
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2019 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement. 
-
-#ifndef VInspector_PreviewParameters_H
-#define VInspector_PreviewParameters_H
-
-#include <Standard.hxx>
-#include <Standard_Macro.hxx>
-
-#include <Prs3d_Drawer.hxx>
-
-#include <Standard_WarningsDisable.hxx>
-#include <QMap>
-#include <QString>
-#include <Standard_WarningsRestore.hxx>
-
-//! \class VInspector_PreviewParameters
-//! Container of View tool bar actions
-class VInspector_PreviewParameters
-{
-public:
-
-  //! Constructor
-  Standard_EXPORT VInspector_PreviewParameters ();
-
-  //! Destructor
-  virtual ~VInspector_PreviewParameters() {}
-
-  //! Returns main control
-  const Handle(Prs3d_Drawer)& GetDrawer() const { return myDrawer; }
-
-    //! Save state of three view in a container in form: key, value. It saves:
-  //! - visibiblity of columns,
-  //! - columns width
-  //! \param theTreeView a view instance
-  //! \param theItems [out] properties
-  //! \param thePrefix peference item prefix
-  Standard_EXPORT static void SaveState (VInspector_PreviewParameters* theParameters,
-                                         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 (VInspector_PreviewParameters* theParameters,
-                                            const QString& theKey, const QString& theValue,
-                                            const QString& thePrefix = QString());
-
-private:
-
-  Handle(Prs3d_Drawer) myDrawer;
-};
-
-#endif
index d443f150bb224783db5e09de1f2f62732fb49385..9f28385816feede97d74eaa24102b3d63ef58009 100644 (file)
 #include <inspector/VInspector_Tools.hxx>
 
 #include <inspector/ViewControl_TableModelValues.hxx>
+#include <inspector/ViewControl_Tools.hxx>
 #include <inspector/VInspector_ItemFolderObject.hxx>
 #include <inspector/VInspector_TableModelValues.hxx>
 
+#include <inspector/Convert_Tools.hxx>
+
 #include <AIS_ListIteratorOfListOfInteractive.hxx>
 #include <AIS_ListOfInteractive.hxx>
 #include <Standard_Version.hxx>
@@ -138,9 +141,8 @@ bool VInspector_Tools::IsOwnerSelected (const Handle(AIS_InteractiveContext)& th
                                         const Handle(SelectBasics_EntityOwner)& theOwner)
 {
   bool anIsSelected = false;
-  Handle(SelectMgr_EntityOwner) anOwner = Handle(SelectMgr_EntityOwner)::DownCast (theOwner);
   for (theContext->InitSelected(); theContext->MoreSelected() && !anIsSelected; theContext->NextSelected())
-    anIsSelected = theContext->SelectedOwner() == anOwner;
+    anIsSelected = theContext->SelectedOwner() == theOwner;
   return anIsSelected;
 }
 
@@ -223,7 +225,7 @@ NCollection_List<Handle(SelectBasics_EntityOwner)> VInspector_Tools::ActiveOwner
   for (NCollection_List<Handle(SelectBasics_EntityOwner)>::Iterator anOwnersIt (anActiveOwners);
        anOwnersIt.More(); anOwnersIt.Next())
   {
-    anOwner = Handle(SelectMgr_EntityOwner)::DownCast (anOwnersIt.Value());
+    anOwner = anOwnersIt.Value();
     if (anOwner.IsNull())
       continue;
 
@@ -264,7 +266,7 @@ void VInspector_Tools::AddOrRemoveSelectedShapes (const Handle(AIS_InteractiveCo
   for (NCollection_List<Handle(SelectBasics_EntityOwner)>::Iterator anOwnersIt(theOwners);
        anOwnersIt.More(); anOwnersIt.Next())
   {
-    Handle(SelectMgr_EntityOwner) anOwner = Handle(SelectMgr_EntityOwner)::DownCast (anOwnersIt.Value());
+    Handle(SelectMgr_EntityOwner) anOwner = anOwnersIt.Value();
 #if OCC_VERSION_HEX > 0x060901
     theContext->AddOrRemoveSelected (anOwner, Standard_False);
 #else
@@ -546,7 +548,7 @@ namespace
 //function : DisplayActionTypeToString
 //purpose  :
 //=======================================================================
-Standard_CString VInspector_Tools::DisplayActionTypeToString (VInspector_DisplayActionType theType)
+Standard_CString VInspector_Tools::DisplayActionTypeToString (View_DisplayActionType theType)
 {
   return VInspector_Table_PrintDisplayActionType[theType];
 }
@@ -556,15 +558,15 @@ Standard_CString VInspector_Tools::DisplayActionTypeToString (VInspector_Display
 //purpose  :
 //=======================================================================
 Standard_Boolean VInspector_Tools::DisplayActionTypeFromString (Standard_CString theTypeString,
-                                                                VInspector_DisplayActionType& theType)
+                                                                View_DisplayActionType& theType)
 {
   TCollection_AsciiString aName (theTypeString);
-  for (Standard_Integer aTypeIter = 0; aTypeIter <= VInspector_DisplayActionType_RemoveId; ++aTypeIter)
+  for (Standard_Integer aTypeIter = 0; aTypeIter <= View_DisplayActionType_RemoveId; ++aTypeIter)
   {
     Standard_CString aTypeName = VInspector_Table_PrintDisplayActionType[aTypeIter];
     if (aName == aTypeName)
     {
-      theType = VInspector_DisplayActionType (aTypeIter);
+      theType = View_DisplayActionType (aTypeIter);
       return Standard_True;
     }
   }
@@ -582,48 +584,6 @@ QVariant VInspector_Tools::ToVariant (const Select3D_BndBox3d& theBoundingBox)
     .arg (theBoundingBox.CornerMax().x()).arg (theBoundingBox.CornerMax().y()).arg (theBoundingBox.CornerMax().z());
 }
 
-//=======================================================================
-//function : CreateShape
-//purpose  :
-//=======================================================================
-TopoDS_Shape VInspector_Tools::CreateShape (const Bnd_Box& theBoundingBox)
-{
-  if (theBoundingBox.IsVoid() || theBoundingBox.IsWhole())
-    return TopoDS_Shape();
-
-  Standard_Real aXmin, anYmin, aZmin, aXmax, anYmax, aZmax;
-  theBoundingBox.Get (aXmin, anYmin, aZmin, aXmax, anYmax, aZmax);
-
-  gp_Pnt aPntMin = gp_Pnt (aXmin, anYmin, aZmin);
-  gp_Pnt aPntMax = gp_Pnt (aXmax, anYmax, aZmax);
-
-  return CreateBoxShape (aPntMin, aPntMax);
-}
-
-//=======================================================================
-//function : CreateShape
-//purpose  :
-//=======================================================================
-TopoDS_Shape VInspector_Tools::CreateShape (const Bnd_OBB& theBoundingBox)
-{
-  if (theBoundingBox.IsVoid())
-    return TopoDS_Shape();
-
-  TColgp_Array1OfPnt anArrPnts(0, 8);
-  theBoundingBox.GetVertex(&anArrPnts(0));
-
-  BRep_Builder aBuilder;
-  TopoDS_Compound aCompound;
-  aBuilder.MakeCompound (aCompound);
-
-  aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (gp_Pnt (anArrPnts.Value(0)), gp_Pnt (anArrPnts.Value(1))));
-  aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (gp_Pnt (anArrPnts.Value(0)), gp_Pnt (anArrPnts.Value(2))));
-  aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (gp_Pnt (anArrPnts.Value(1)), gp_Pnt (anArrPnts.Value(3))));
-  aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (gp_Pnt (anArrPnts.Value(2)), gp_Pnt (anArrPnts.Value(3))));
-
-  return aCompound;
-}
-
 //=======================================================================
 //function : CreateShape
 //purpose  :
@@ -636,70 +596,9 @@ TopoDS_Shape VInspector_Tools::CreateShape (const Select3D_BndBox3d& theBounding
   gp_Pnt aPntMin = gp_Pnt (theBoundingBox.CornerMin().x(), theBoundingBox.CornerMin().y(), theBoundingBox.CornerMin().z());
   gp_Pnt aPntMax = gp_Pnt (theBoundingBox.CornerMax().x(), theBoundingBox.CornerMax().y(), theBoundingBox.CornerMax().z());
 
-  return CreateBoxShape (aPntMin, aPntMax);
+  return Convert_Tools::CreateBoxShape (aPntMin, aPntMax);
 }
 
-//=======================================================================
-//function : CreateBoxShape
-//purpose  :
-//=======================================================================
-TopoDS_Shape VInspector_Tools::CreateBoxShape (const gp_Pnt& thePntMin, const gp_Pnt& thePntMax)
-{
-  Standard_Boolean aThinOnX = fabs (thePntMin.X() - thePntMax.X()) < Precision::Confusion();
-  Standard_Boolean aThinOnY = fabs (thePntMin.Y() - thePntMax.Y()) < Precision::Confusion();
-  Standard_Boolean aThinOnZ = fabs (thePntMin.Z() - thePntMax.Z()) < Precision::Confusion();
-
-  if (((int)aThinOnX + (int)aThinOnY + (int)aThinOnZ) > 1) // thin box in several directions is a point
-  {
-    BRep_Builder aBuilder;
-    TopoDS_Compound aCompound;
-    aBuilder.MakeCompound (aCompound);
-    aBuilder.Add (aCompound, BRepBuilderAPI_MakeVertex (thePntMin));
-    return aCompound;
-  }
-
-  if (aThinOnX || aThinOnY || aThinOnZ)
-  {
-    gp_Pnt aPnt1, aPnt2, aPnt3, aPnt4 ;
-    if (aThinOnX)
-    {
-      aPnt1 = gp_Pnt(thePntMin.X(), thePntMin.Y(), thePntMin.Z());
-      aPnt2 = gp_Pnt(thePntMin.X(), thePntMax.Y(), thePntMin.Z());
-      aPnt3 = gp_Pnt(thePntMin.X(), thePntMax.Y(), thePntMax.Z());
-      aPnt4 = gp_Pnt(thePntMin.X(), thePntMin.Y(), thePntMax.Z());
-    }
-    else if (aThinOnY)
-    {
-      aPnt1 = gp_Pnt(thePntMin.X(), thePntMin.Y(), thePntMin.Z());
-      aPnt2 = gp_Pnt(thePntMax.X(), thePntMin.Y(), thePntMin.Z());
-      aPnt3 = gp_Pnt(thePntMax.X(), thePntMin.Y(), thePntMax.Z());
-      aPnt4 = gp_Pnt(thePntMin.X(), thePntMin.Y(), thePntMax.Z());
-    }
-    else if (aThinOnZ)
-    {
-      aPnt1 = gp_Pnt(thePntMin.X(), thePntMin.Y(), thePntMin.Z());
-      aPnt2 = gp_Pnt(thePntMax.X(), thePntMin.Y(), thePntMin.Z());
-      aPnt3 = gp_Pnt(thePntMax.X(), thePntMax.Y(), thePntMin.Z());
-      aPnt4 = gp_Pnt(thePntMin.X(), thePntMax.Y(), thePntMin.Z());
-    }
-    BRep_Builder aBuilder;
-    TopoDS_Compound aCompound;
-    aBuilder.MakeCompound (aCompound);
-    aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (aPnt1, aPnt2));
-    aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (aPnt2, aPnt3));
-    aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (aPnt3, aPnt4));
-    aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (aPnt4, aPnt1));
-
-    return aCompound;
-  }
-  else
-  {
-    BRepPrimAPI_MakeBox aBoxBuilder (thePntMin, thePntMax);
-    return aBoxBuilder.Shape();
-  }
-}
-
-
 //=======================================================================
 //function : ToVariant
 //purpose  :
@@ -736,7 +635,7 @@ QVariant VInspector_Tools::ToVariant (const Handle(Graphic3d_Buffer)& theBuffer)
 //function : ToVariant
 //purpose  :
 //=======================================================================
-QVariant VInspector_Tools::ToVariant (const Handle(Graphic3d_BoundBuffer)& theBoundBuffer)
+QVariant VInspector_Tools::ToVariant (const Handle(Graphic3d_BoundBuffer)& /*theBoundBuffer*/)
 {
   //const Handle(Graphic3d_Buffer)& aBuffer = theBoundBuffer;
   //Handle(Graphic3d_Buffer) aBuffer = Handle(Graphic3d_Buffer)::DownCast (theBoundBuffer);
index 4ca765d51736e6ec06f8b8bb008d4a010dab52a7..6911834d27a5ce5ff5e2de147e22bd14808ce70e 100644 (file)
@@ -32,7 +32,7 @@
 #include <TopoDS_Shape.hxx>
 
 #include <inspector/VInspector_CallBackMode.hxx>
-#include <inspector/VInspector_DisplayActionType.hxx>
+#include <inspector/View_DisplayActionType.hxx>
 #include <inspector/VInspector_SelectionType.hxx>
 
 #include <inspector/ViewControl_PaneCreator.hxx>
@@ -160,14 +160,14 @@ public:
   //! Returns the string name for a given type.
   //! @param theType action type
   //! @return string identifier from the display action type
-  Standard_EXPORT static Standard_CString DisplayActionTypeToString (VInspector_DisplayActionType theType);
+  Standard_EXPORT static Standard_CString DisplayActionTypeToString (View_DisplayActionType theType);
 
   //! Returns the enumeration type from the given string identifier (using case-insensitive comparison).
   //! @param theTypeString string identifier
   //! @return string identifier from the display action type
-  static VInspector_DisplayActionType DisplayActionTypeFromString (Standard_CString theTypeString)
+  static View_DisplayActionType DisplayActionTypeFromString (Standard_CString theTypeString)
   {
-    VInspector_DisplayActionType aType = VInspector_DisplayActionType_NoneId;
+    View_DisplayActionType aType = View_DisplayActionType_NoneId;
     DisplayActionTypeFromString (theTypeString, aType);
     return aType;
   }
@@ -177,29 +177,13 @@ public:
   //! @param theType detected action type
   //! @return TRUE if string identifier is known
   Standard_EXPORT static Standard_Boolean DisplayActionTypeFromString (const Standard_CString theTypeString,
-                                                                       VInspector_DisplayActionType& theType);
+                                                                       View_DisplayActionType& theType);
 
   //! Build string presentation of bounding box information in form: (xmin, ymin, zmin), (xmax, ymax, zmax)
   //! \param theBoundingBox bounding box
   //! \return string presentation
   Standard_EXPORT static QVariant ToVariant (const Select3D_BndBox3d& theBoundingBox);
 
-  //! Creates box shape
-  //! \param theBoundingBox box shape parameters
-  //! \return created shape
-  Standard_EXPORT static TopoDS_Shape CreateShape (const Bnd_Box& theBoundingBox);
-
-  //! Creates box shape
-  //! \param theBoundingBox box shape parameters
-  //! \return created shape
-  Standard_EXPORT static TopoDS_Shape CreateShape (const Bnd_OBB& theBoundingBox);
-
-  //! Creates box shape
-  //! \param thePntMin minimum point on the bounding box
-  //! \param thePntMax maximum point on the bounding box
-  //! \return created shape
-  Standard_EXPORT static TopoDS_Shape CreateBoxShape (const gp_Pnt& thePntMin, const gp_Pnt& thePntMax);
-
   //! Creates box shape
   //! \param theBoundingBox box shape parameters
   //! \return created shape
index cb0f36a9edde5957e5f35125f751fde0d204d2f6..cab89e4ec79d91bf754b9b06c88b237bf00df678 100644 (file)
 #include <AIS_ColoredShape.hxx>
 #include <AIS_Shape.hxx>
 #include <AIS_Trihedron.hxx>
-#include <BRep_Builder.hxx>
-#include <BRepBuilderAPI_MakeVertex.hxx>
-#include <BRepBuilderAPI_MakeEdge.hxx>
-#include <BRepBuilderAPI_MakeFace.hxx>
+//#include <BRep_Builder.hxx>
+//#include <BRepBuilderAPI_MakeVertex.hxx>
+//#include <BRepBuilderAPI_MakeEdge.hxx>
+//#include <BRepBuilderAPI_MakeFace.hxx>
 #include <Geom_Axis2Placement.hxx>
-#include <TopoDS_Compound.hxx>
+//#include <TopoDS_Compound.hxx>
 
 #include <TopExp_Explorer.hxx>
 
+#include <inspector/Convert_Tools.hxx>
+
 #include <inspector/TreeModel_ColumnType.hxx>
 #include <inspector/TreeModel_ContextMenu.hxx>
 #include <inspector/TreeModel_ItemProperties.hxx>
@@ -35,7 +37,7 @@
 #include <inspector/ViewControl_MessageDialog.hxx>
 #include <inspector/ViewControl_TableModel.hxx>
 #include <inspector/ViewControl_Tools.hxx>
-#include <inspector/ViewControl_TransientShape.hxx>
+#include <inspector/Convert_TransientShape.hxx>
 
 #include <inspector/VInspector_ToolBar.hxx>
 #include <inspector/VInspector_Tools.hxx>
@@ -46,7 +48,6 @@
 #include <inspector/VInspector_ItemSelectBasicsEntityOwner.hxx>
 #include <inspector/VInspector_ItemFolderObject.hxx>
 #include <inspector/VInspector_ItemPresentableObject.hxx>
-#include <inspector/VInspector_PreviewParameters.hxx>
 #include <inspector/VInspector_PropertiesCreator.hxx>
 #include <inspector/VInspector_TableModelValues.hxx>
 #include <inspector/VInspector_ToolBar.hxx>
@@ -61,6 +62,8 @@
 #include <inspector/ViewControl_TreeView.hxx>
 
 #include <inspector/View_Displayer.hxx>
+#include <inspector/View_DisplayPreview.hxx >
+#include <inspector/View_PreviewParameters.hxx>
 #include <inspector/View_Widget.hxx>
 #include <inspector/View_Window.hxx>
 
@@ -108,7 +111,7 @@ const int VINSPECTOR_DEFAULT_VIEW_POSITION_Y = 60; // TINSPECTOR_DEFAULT_POSITIO
 VInspector_Window::VInspector_Window()
 : myParent (0), myExportToShapeViewDialog (0), myViewWindow (0)
 {
-  myPreviewParameters = new VInspector_PreviewParameters();
+  myDisplayPreview = new View_DisplayPreview();
 
   myMainWindow = new QMainWindow (0);
 
@@ -251,8 +254,9 @@ void VInspector_Window::GetPreferences (TInspectorAPI_PreferencesDataMap& theIte
     theItem.Bind (anItemsIt.key().toStdString().c_str(), anItemsIt.value().toStdString().c_str());
   }
 
+
   anItems.clear();
-  VInspector_PreviewParameters::SaveState (myPreviewParameters, anItems, "preview_parameters_");
+  View_PreviewParameters::SaveState (myDisplayPreview->GetPreviewParameters(), anItems, "preview_parameters_");
   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());
 
@@ -286,8 +290,8 @@ void VInspector_Window::SetPreferences (const TInspectorAPI_PreferencesDataMap&
     else if (TreeModel_Tools::RestoreState (myHistoryView, anItemIt.Key().ToCString(), anItemIt.Value().ToCString(),
                                             "history_view_"))
       continue;
-    else if (VInspector_PreviewParameters::RestoreState (myPreviewParameters, anItemIt.Key().ToCString(), anItemIt.Value().ToCString(),
-                                            "preview_parameters_"))
+    else if (View_PreviewParameters::RestoreState (myDisplayPreview->GetPreviewParameters(), anItemIt.Key().ToCString(),
+      anItemIt.Value().ToCString(), "preview_parameters_"))
       continue;
   }
 }
@@ -382,6 +386,31 @@ NCollection_List<Handle(AIS_InteractiveObject)> VInspector_Window::GetSelectedPr
   return aSelectedPresentations;
 }
 
+// =======================================================================
+// function : GetSelectedShapes
+// purpose :
+// =======================================================================
+
+void VInspector_Window::GetSelectedShapes (NCollection_List<Handle(Standard_Transient)>& theSelPresentations)
+{
+  QModelIndexList theIndices = myTreeView->selectionModel()->selectedIndexes();
+
+  QList<TreeModel_ItemBasePtr> anItems = TreeModel_ModelBase::GetSelectedItems (theIndices);
+  for (QList<TreeModel_ItemBasePtr>::const_iterator anItemIt = anItems.begin(); anItemIt != anItems.end(); anItemIt++)
+  {
+    TreeModel_ItemBasePtr anItem = *anItemIt;
+    VInspector_ItemBasePtr aVItem = itemDynamicCast<VInspector_ItemBase>(anItem);
+    if (!aVItem /*|| aVItem->Row() == 0*/)
+      continue;
+
+    TopoDS_Shape aShape = aVItem->GetPresentationShape();
+    if (aShape.IsNull())
+      continue;
+
+    theSelPresentations.Append (new Convert_TransientShape (aShape));
+  }
+}
+
 // =======================================================================
 // function : GetSelectedShapes
 // purpose :
@@ -407,18 +436,20 @@ NCollection_List<TopoDS_Shape> VInspector_Window::GetSelectedShapes (const QMode
 
   // obtain selection from the property panel
   {
-    QList<ViewControl_Table*> aPropertyTables;
-    myPropertyView->GetActiveTables (aPropertyTables);
-    if (!aPropertyTables.isEmpty())
-    {
-      ViewControl_Table* aFirstTable = aPropertyTables[0]; // TODO: implement for several tables
+    //QList<ViewControl_Table*> aPropertyTables;
+    //myPropertyView->GetActiveTables (aPropertyTables);
+    //if (!aPropertyTables.isEmpty())
+    //{
+    //  ViewControl_Table* aFirstTable = aPropertyTables[0]; // TODO: implement for several tables
 
-      Handle(Graphic3d_TransformPers) aSelectedPersistent = GetSelectedTransformPers();
-      QModelIndexList aTreeViewSelected = myTreeView->selectionModel()->selectedIndexes();
-      GetSelectedPropertyPanelShapes(aTreeViewSelected,
-                                     aFirstTable->GetTableView()->selectionModel()->selectedIndexes(),
-                                     aSelectedShapes);
-    }
+    //  Handle(Graphic3d_TransformPers) aSelectedPersistent = GetSelectedTransformPers();
+
+    QModelIndex anIndex = TreeModel_ModelBase::SingleSelected (myTreeView->selectionModel()->selectedIndexes(), 0);
+    TreeModel_ItemBasePtr aTreeItem = TreeModel_ModelBase::GetItemByIndex (anIndex);
+
+    //QModelIndexList aTreeViewSelected = myTreeView->selectionModel()->selectedIndexes();
+    GetSelectedPropertyPanelShapes(aTreeItem, aSelectedShapes);
+    //}
   }
 
   return aSelectedShapes;
@@ -428,55 +459,75 @@ NCollection_List<TopoDS_Shape> VInspector_Window::GetSelectedShapes (const QMode
 // function : GetSelectedPropertyPanelShapes
 // purpose :
 // =======================================================================
-void VInspector_Window::GetSelectedPropertyPanelShapes (const QModelIndexList& theTreeViewIndices,
-                                                        const QModelIndexList& thePropertyPanelIndices,
+void VInspector_Window::GetSelectedPropertyPanelShapes (const TreeModel_ItemBasePtr& theTreeItem,
                                                         NCollection_List<TopoDS_Shape>& theShapes)
 {
-  QList<TreeModel_ItemBasePtr> anItems = TreeModel_ModelBase::GetSelectedItems (theTreeViewIndices);
-  NCollection_List<Handle(Standard_Transient)> aPropertyPresentations;
-  for (QList<TreeModel_ItemBasePtr>::const_iterator anItemIt = anItems.begin(); anItemIt != anItems.end(); anItemIt++)
-  {
-    TreeModel_ItemBasePtr anItem = *anItemIt;
-    if (!anItem || anItem->Column() != 0)
-      continue;
-
-    QList<ViewControl_TableModelValues*> aTableValues;
-    VInspector_Tools::GetPropertyTableValues (anItem, myPaneCreators, aTableValues);
-    if (aTableValues.isEmpty())
-      continue;
-
-    Handle(TreeModel_ItemProperties) anItemProperties = anItem->GetProperties();
-    for (int aTableIt = 0; aTableIt < aTableValues.size(); aTableIt++)
-    {
-      VInspector_TableModelValues* aTableVals = dynamic_cast<VInspector_TableModelValues*>(aTableValues[aTableIt]);
-      if (!aTableVals)
-        continue;
-
-      // default shape by NULL selection
-      aTableVals->GetPaneShapes (-1, -1, theShapes);
+  QList<ViewControl_Table*> aPropertyTables;
+  myPropertyView->GetActiveTables (aPropertyTables);
+  if (aPropertyTables.isEmpty())
+    return;
 
-      for (QModelIndexList::const_iterator anIndicesIt = thePropertyPanelIndices.begin(); anIndicesIt != thePropertyPanelIndices.end(); anIndicesIt++)
-      {
-        QModelIndex anIndex = *anIndicesIt;
-        aTableVals->GetPaneShapes (anIndex.row(), anIndex.column(), theShapes);
+  ViewControl_Table* aFirstTable = aPropertyTables[0]; // TODO: implement for several tables
+  if (!aFirstTable)
+    return;
 
-        if (!anItemProperties.IsNull())
-        {
-          anItemProperties->GetPresentations (anIndex.row(), anIndex.column(), aPropertyPresentations);
-        }
-      }
-    }
-  }
+  NCollection_List<Handle(Standard_Transient)> theSelPresentations;
+  aFirstTable->GetSelectedPresentations (theTreeItem, theSelPresentations);
 
-  if (!aPropertyPresentations.IsEmpty())
+  for (NCollection_List<Handle(Standard_Transient)>::Iterator anIterator (theSelPresentations); anIterator.More(); anIterator.Next())
   {
-    for (NCollection_List<Handle(Standard_Transient)>::Iterator aPrsIterator (aPropertyPresentations); aPrsIterator.More(); aPrsIterator.Next())
-    {
-      Handle(ViewControl_TransientShape) aShapePrs = Handle(ViewControl_TransientShape)::DownCast (aPrsIterator.Value());
-      if (!aShapePrs.IsNull())
-        theShapes.Append (aShapePrs->GetShape());
-    }
+    Handle(Convert_TransientShape) aShapePrs = Handle(Convert_TransientShape)::DownCast (anIterator.Value());
+    if (!aShapePrs.IsNull())
+      theShapes.Append (aShapePrs->GetShape());
   }
+
+  //QModelIndexList& thePropertyPanelIndices = aFirstTable->GetTableView()->selectionModel()->selectedIndexes(),
+
+  //QList<TreeModel_ItemBasePtr> anItems = TreeModel_ModelBase::GetSelectedItems (theTreeViewIndices);
+  //NCollection_List<Handle(Standard_Transient)> aPropertyPresentations;
+  //for (QList<TreeModel_ItemBasePtr>::const_iterator anItemIt = anItems.begin(); anItemIt != anItems.end(); anItemIt++)
+  //{
+  //  TreeModel_ItemBasePtr anItem = *anItemIt;
+  //  if (!anItem || anItem->Column() != 0)
+  //    continue;
+
+  //  QList<ViewControl_TableModelValues*> aTableValues;
+  //  VInspector_Tools::GetPropertyTableValues (anItem, myPaneCreators, aTableValues);
+  //  if (aTableValues.isEmpty())
+  //    continue;
+
+  //  Handle(TreeModel_ItemProperties) anItemProperties = anItem->GetProperties();
+  //  for (int aTableIt = 0; aTableIt < aTableValues.size(); aTableIt++)
+  //  {
+  //    VInspector_TableModelValues* aTableVals = dynamic_cast<VInspector_TableModelValues*>(aTableValues[aTableIt]);
+  //    if (!aTableVals)
+  //      continue;
+
+  //    // default shape by NULL selection
+  //    aTableVals->GetPaneShapes (-1, -1, theShapes);
+
+  //    for (QModelIndexList::const_iterator anIndicesIt = thePropertyPanelIndices.begin(); anIndicesIt != thePropertyPanelIndices.end(); anIndicesIt++)
+  //    {
+  //      QModelIndex anIndex = *anIndicesIt;
+  //      aTableVals->GetPaneShapes (anIndex.row(), anIndex.column(), theShapes);
+
+  //      if (!anItemProperties.IsNull())
+  //      {
+  //        anItemProperties->GetPresentations (anIndex.row(), anIndex.column(), aPropertyPresentations);
+  //      }
+  //    }
+  //  }
+  //}
+
+  //if (!aPropertyPresentations.IsEmpty())
+  //{
+  //  for (NCollection_List<Handle(Standard_Transient)>::Iterator aPrsIterator (aPropertyPresentations); aPrsIterator.More(); aPrsIterator.Next())
+  //  {
+  //    Handle(Convert_TransientShape) aShapePrs = Handle(Convert_TransientShape)::DownCast (aPrsIterator.Value());
+  //    if (!aShapePrs.IsNull())
+  //      theShapes.Append (aShapePrs->GetShape());
+  //  }
+  //}
 }
 
 // =======================================================================
@@ -581,7 +632,7 @@ void VInspector_Window::SetContext (const Handle(AIS_InteractiveContext)& theCon
   if (!myCallBack.IsNull())
     myCallBack->SetContext (theContext);
 
-  myPreviewParameters->GetDrawer()->Link (theContext->DefaultDrawer());
+  myDisplayPreview->SetContext (theContext);
 
   if (isFirst)
     onExportToMessageView();
@@ -657,8 +708,8 @@ void VInspector_Window::onTreeViewContextMenuRequested(const QPoint& thePosition
   }
 
   aMenu->addSeparator();
-  for (int aTypeId = (int)VInspector_DisplayActionType_DisplayId; aTypeId <= (int)VInspector_DisplayActionType_RemoveId; aTypeId++)
-    aMenu->addAction (ViewControl_Tools::CreateAction (VInspector_Tools::DisplayActionTypeToString ((VInspector_DisplayActionType) aTypeId),
+  for (int aTypeId = (int)View_DisplayActionType_DisplayId; aTypeId <= (int)View_DisplayActionType_RemoveId; aTypeId++)
+    aMenu->addAction (ViewControl_Tools::CreateAction (VInspector_Tools::DisplayActionTypeToString ((View_DisplayActionType) aTypeId),
                       SLOT (onDisplayActionTypeClicked()), GetMainWindow(), this));
   aMenu->addSeparator();
 
@@ -730,21 +781,34 @@ void VInspector_Window::onPropertyPanelShown (bool isToggled)
 // =======================================================================
 void VInspector_Window::onPropertyViewSelectionChanged()
 {
+  QModelIndex aTreeItemIndex = TreeModel_ModelBase::SingleSelected (myTreeView->selectionModel()->selectedIndexes(), 0);
+  TreeModel_ItemBasePtr aTreeItemSelected = TreeModel_ModelBase::GetItemByIndex (aTreeItemIndex);
+  if (!aTreeItemSelected)
+    return;
+
   QList<ViewControl_Table*> aPropertyTables;
   myPropertyView->GetActiveTables (aPropertyTables);
   if (aPropertyTables.isEmpty())
     return;
 
   ViewControl_Table* aFirstTable = aPropertyTables[0]; // TODO: implement for several tables
+  NCollection_List<Handle(Standard_Transient)> aSelPresentations;
+  aFirstTable->GetSelectedPresentations (aTreeItemSelected, aSelPresentations);
 
-  QMap<int, QList<int>> aSelectedIndices;
-  aFirstTable->GetSelectedIndices (aSelectedIndices);
+  //Handle(TreeModel_ItemProperties) anItemProperties = aTreeItemSelected->GetProperties();
 
-  ViewControl_TableModel* aTableModel = dynamic_cast<ViewControl_TableModel*>(aFirstTable->GetTableView()->model());
-  ViewControl_TableModelValues* aTableValues = aTableModel->GetModelValues();
+
+  //QMap<int, QList<int>> aSelectedIndices;
+  //aFirstTable->GetSelectedIndices (aSelectedIndices);
+
+  //ViewControl_TableModel* aTableModel = dynamic_cast<ViewControl_TableModel*>(aFirstTable->GetTableView()->model());
+  //ViewControl_TableModelValues* aTableValues = aTableModel->GetModelValues();
 
   QStringList aPointers;
-  for (QMap<int, QList<int>>::const_iterator aSelIt = aSelectedIndices.begin(); aSelIt != aSelectedIndices.end(); aSelIt++)
+  aFirstTable->GetSelectedPointers (aPointers);
+
+  //NCollection_List<Handle(Standard_Transient)> aSelPresentations;
+  /*for (QMap<int, QList<int>>::const_iterator aSelIt = aSelectedIndices.begin(); aSelIt != aSelectedIndices.end(); aSelIt++)
   {
     int aRowId = aSelIt.key();
     QList<int> aColIds = aSelIt.value();
@@ -757,19 +821,23 @@ void VInspector_Window::onPropertyViewSelectionChanged()
       QString aData = aTableValues->Data (aRowId, aSelectedColId, Qt::DisplayRole).toString();
       if (aData.contains (ViewControl_Tools::GetPointerPrefix().ToCString()))
         aPointers.append (aData);
+
+      if (anItemProperties)
+        anItemProperties->GetPresentations (aRowId, aColId, aSelPresentations);
     }
-  }
+  }*/
   highlightTreeViewItems (aPointers);
 
-  Handle(Graphic3d_TransformPers) aSelectedPersistent = GetSelectedTransformPers();
-  QModelIndexList aTreeViewSelected = myTreeView->selectionModel()->selectedIndexes();
-  NCollection_List<TopoDS_Shape> aSelectedShapes = GetSelectedShapes (aTreeViewSelected);
+  //Handle(Graphic3d_TransformPers) aSelectedPersistent = GetSelectedTransformPers();
+  //QModelIndexList aTreeViewSelected = myTreeView->selectionModel()->selectedIndexes();
+  //NCollection_List<TopoDS_Shape> aSelectedShapes = GetSelectedShapes (aTreeViewSelected);
 
-  GetSelectedPropertyPanelShapes(aTreeViewSelected,
-                                 aFirstTable->GetTableView()->selectionModel()->selectedIndexes(),
-                                 aSelectedShapes);
+  //GetSelectedPropertyPanelShapes(aTreeViewSelected,
+  //                               aFirstTable->GetTableView()->selectionModel()->selectedIndexes(),
+  //                               aSelectedShapes);
+  //updatePreviewPresentation(aSelectedShapes, aSelectedPersistent);
 
-  updatePreviewPresentation(aSelectedShapes, aSelectedPersistent);
+  myDisplayPreview->UpdatePreview (View_DisplayActionType_DisplayId, aSelPresentations);
 }
 
 // =======================================================================
@@ -789,10 +857,24 @@ void VInspector_Window::onTreeViewSelectionChanged (const QItemSelection&,
   if (myPropertyPanelWidget->toggleViewAction()->isChecked())
     updatePropertyPanelBySelection();
 
-  Handle(Graphic3d_TransformPers) aSelectedPersistent = GetSelectedTransformPers();
+  QModelIndex aTreeItemIndex = TreeModel_ModelBase::SingleSelected (myTreeView->selectionModel()->selectedIndexes(), 0);
+  TreeModel_ItemBasePtr aTreeItemSelected = TreeModel_ModelBase::GetItemByIndex (aTreeItemIndex);
+  if (!aTreeItemSelected)
+    return;
+
+  Handle(TreeModel_ItemProperties) anItemProperties = aTreeItemSelected->GetProperties();
+  NCollection_List<Handle(Standard_Transient)> aSelPresentations;
+  if (anItemProperties)
+    anItemProperties->GetPresentations (-1, -1, aSelPresentations);
+  else
+    GetSelectedShapes (aSelPresentations);
+  myDisplayPreview->UpdatePreview (View_DisplayActionType_DisplayId, aSelPresentations);
 
-  NCollection_List<TopoDS_Shape> aSelectedShapes = GetSelectedShapes (myTreeView->selectionModel()->selectedIndexes());
-  updatePreviewPresentation(aSelectedShapes, aSelectedPersistent);
+  //Handle(Graphic3d_TransformPers) aSelectedPersistent = GetSelectedTransformPers();
+
+  //NCollection_List<TopoDS_Shape> aSelectedShapes = GetSelectedShapes (myTreeView->selectionModel()->selectedIndexes());
+
+  //updatePreviewPresentation(aSelectedShapes, aSelectedPersistent);
 
   QApplication::restoreOverrideCursor();
 }
@@ -914,26 +996,7 @@ void VInspector_Window::onExportToShapeView()
 // =======================================================================
 void VInspector_Window::onDefaultPreview()
 {
-  VInspector_ViewModel* aViewModel = dynamic_cast<VInspector_ViewModel*> (myTreeView->model());
-  if (!aViewModel)
-    return;
-
-  Handle(AIS_InteractiveContext) aContext = aViewModel->GetContext();
-  if (aContext.IsNull())
-    return;
-
-  BRep_Builder aBuilder;
-  TopoDS_Compound aCompound;
-  aBuilder.MakeCompound (aCompound);
-  aBuilder.Add (aCompound, BRepBuilderAPI_MakeVertex (gp_Pnt(25., 10., 0.)));
-  aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (gp_Pnt(20., 20., 0.), gp_Pnt(30., 20., 10.)));
-  //aBuilder.Add (aCompound, BRepBuilderAPI_MakeFace (gp_Pln (gp_Pnt (20., 30., 0.), gp_Dir (1., 0., 0.))).Face());
-  aBuilder.Add (aCompound, VInspector_Tools::CreateBoxShape (gp_Pnt(20., 40., 0.), gp_Pnt(30., 60., 10.)));
-
-  Handle(AIS_Shape) aDefaultPreview = new AIS_Shape (aCompound);
-  aDefaultPreview->SetAttributes (myPreviewParameters->GetDrawer());
-  if (!aContext.IsNull())
-    aContext->Display (aDefaultPreview, AIS_Shaded, -1/*do not participate in selection*/, Standard_True);
+  myDisplayPreview->DisplayDefaultPreview();
 
   UpdateTreeModel();
 }
@@ -1085,7 +1148,7 @@ void VInspector_Window::updatePropertyPanelBySelection()
 // purpose :
 // =======================================================================
 
-void VInspector_Window::displaySelectedPresentations (const VInspector_DisplayActionType theType)
+void VInspector_Window::displaySelectedPresentations (const View_DisplayActionType theType)
 {
   VInspector_ViewModel* aViewModel = dynamic_cast<VInspector_ViewModel*> (myTreeView->model());
   if (!aViewModel)
@@ -1102,24 +1165,35 @@ void VInspector_Window::displaySelectedPresentations (const VInspector_DisplayAc
   NCollection_List<Handle(AIS_InteractiveObject)> aSelectedPresentations = GetSelectedPresentations (aSelectionModel);
   const QModelIndexList& aSelectedIndices = aSelectionModel->selectedIndexes();
 
-  bool aPreviewPresentationShown = !myPreviewPresentation.IsNull();
+  bool aPreviewPresentationShown = myDisplayPreview->HasPreview();
   // the order of objects returned by AIS_InteractiveContext is changed because the processed object is moved from
   // Erased to Displayed container or back
   aSelectionModel->clear();
 
   // redisplay preview presentation if exists
-  if (aPreviewPresentationShown && theType == VInspector_DisplayActionType_RedisplayId)
+  if (aPreviewPresentationShown && theType == View_DisplayActionType_RedisplayId)
   {
-    QList<TreeModel_ItemBasePtr> anItems = TreeModel_ModelBase::GetSelectedItems (aSelectedIndices);
-    for (QList<TreeModel_ItemBasePtr>::const_iterator anItemIt = anItems.begin(); anItemIt != anItems.end(); anItemIt++)
-    {
-      TreeModel_ItemBasePtr anItem = *anItemIt;
-      VInspector_ItemBasePtr aVItem = itemDynamicCast<VInspector_ItemBase>(anItem);
-      if (aVItem)
-        aVItem->UpdatePresentationShape();
-    }
-    NCollection_List<TopoDS_Shape> aSelectedShapes = GetSelectedShapes (aSelectedIndices);
-    updatePreviewPresentation(aSelectedShapes, GetSelectedTransformPers());
+    // REDISPLAY preview !
+
+    //QList<TreeModel_ItemBasePtr> anItems = TreeModel_ModelBase::GetSelectedItems (aSelectedIndices);
+    //NCollection_List<Handle(Standard_Transient)> aSelPresentations;
+
+    //for (QList<TreeModel_ItemBasePtr>::const_iterator anItemIt = anItems.begin(); anItemIt != anItems.end(); anItemIt++)
+    //{
+    //  TreeModel_ItemBasePtr anItem = *anItemIt;
+    //  VInspector_ItemBasePtr aVItem = itemDynamicCast<VInspector_ItemBase>(anItem);
+    //  if (!aVItem)
+    //    continue;
+    //  aVItem->UpdatePresentationShape();
+
+    //  Handle(TreeModel_ItemProperties) anItemProperties = aTreeItemSelected->GetProperties();
+    //  if (anItemProperties)
+    //    anItemProperties->GetPresentations (aRowId, aColId, aSelPresentations);
+    //}
+    //myDisplayPreview->UpdatePreview (theType, aSelPresentations);
+
+    //NCollection_List<TopoDS_Shape> aSelectedShapes = GetSelectedShapes (aSelectedIndices);
+    //updatePreviewPresentation(aSelectedShapes, GetSelectedTransformPers());
   }
 
   if (aSelectedPresentations.Extent() == 0)
@@ -1130,16 +1204,16 @@ void VInspector_Window::displaySelectedPresentations (const VInspector_DisplayAc
     Handle(AIS_InteractiveObject) aPresentation = anIOIt.Value();
     switch (theType)
     {
-      case VInspector_DisplayActionType_DisplayId:
+      case View_DisplayActionType_DisplayId:
       {
         aContext->Display(aPresentation, false);
         aContext->Load(aPresentation, -1);
       }
       break;
 
-      case VInspector_DisplayActionType_RedisplayId: aContext->Redisplay (aPresentation, false); break;
-      case VInspector_DisplayActionType_EraseId: aContext->Erase (aPresentation, false); break;
-      case VInspector_DisplayActionType_RemoveId: aContext->Remove (aPresentation, false); break;
+      case View_DisplayActionType_RedisplayId: aContext->Redisplay (aPresentation, false); break;
+      case View_DisplayActionType_EraseId: aContext->Erase (aPresentation, false); break;
+      case View_DisplayActionType_RemoveId: aContext->Remove (aPresentation, false); break;
       default: break;
     }
   }
@@ -1238,44 +1312,44 @@ Handle(AIS_InteractiveContext) VInspector_Window::createView()
 // function : updatePreviewPresentation
 // purpose :
 // =======================================================================
-void VInspector_Window::updatePreviewPresentation (const NCollection_List<TopoDS_Shape>& theShapes,
-                                                   const Handle(Graphic3d_TransformPers)& thePersistent)
-{
-  Handle(AIS_InteractiveContext) aContext;
-  VInspector_ViewModel* aViewModel = dynamic_cast<VInspector_ViewModel*> (myTreeView->model());
-  if (aViewModel)
-    aContext = aViewModel->GetContext();
-
-  if (theShapes.IsEmpty())
-  {
-    if (!aContext.IsNull())
-      aContext->Remove (myPreviewPresentation, Standard_True);
-    myPreviewPresentation = NULL;
-    return;
-  }
-
-  BRep_Builder aBuilder;
-  TopoDS_Compound aCompound;
-  aBuilder.MakeCompound (aCompound);
-  for (NCollection_List<TopoDS_Shape>::Iterator anIterator (theShapes); anIterator.More(); anIterator.Next())
-  {
-    aBuilder.Add (aCompound, anIterator.Value());
-  }
-
-  if (myPreviewPresentation.IsNull())
-  {
-    myPreviewPresentation = new AIS_Shape (aCompound);
-    myPreviewPresentation->SetAttributes (myPreviewParameters->GetDrawer());
-
-    myPreviewPresentation->SetTransformPersistence(thePersistent);
-    if (!aContext.IsNull())
-      aContext->Display (myPreviewPresentation, AIS_Shaded, -1/*do not participate in selection*/, Standard_True);
-  }
-  else
-  {
-    Handle(AIS_Shape)::DownCast (myPreviewPresentation)->Set (aCompound);
-    myPreviewPresentation->SetTransformPersistence(thePersistent);
-    if (!aContext.IsNull())
-      aContext->Redisplay (myPreviewPresentation, Standard_True);
-  }
-}
+//void VInspector_Window::updatePreviewPresentation (const NCollection_List<TopoDS_Shape>& theShapes,
+//                                                   const Handle(Graphic3d_TransformPers)& thePersistent)
+//{
+//  Handle(AIS_InteractiveContext) aContext;
+//  VInspector_ViewModel* aViewModel = dynamic_cast<VInspector_ViewModel*> (myTreeView->model());
+//  if (aViewModel)
+//    aContext = aViewModel->GetContext();
+//
+//  if (theShapes.IsEmpty())
+//  {
+//    if (!aContext.IsNull())
+//      aContext->Remove (myPreviewPresentation, Standard_True);
+//    myPreviewPresentation = NULL;
+//    return;
+//  }
+//
+//  BRep_Builder aBuilder;
+//  TopoDS_Compound aCompound;
+//  aBuilder.MakeCompound (aCompound);
+//  for (NCollection_List<TopoDS_Shape>::Iterator anIterator (theShapes); anIterator.More(); anIterator.Next())
+//  {
+//    aBuilder.Add (aCompound, anIterator.Value());
+//  }
+//
+//  if (myPreviewPresentation.IsNull())
+//  {
+//    myPreviewPresentation = new AIS_Shape (aCompound);
+//    myPreviewPresentation->SetAttributes (myPreviewParameters->GetDrawer());
+//
+//    myPreviewPresentation->SetTransformPersistence(thePersistent);
+//    if (!aContext.IsNull())
+//      aContext->Display (myPreviewPresentation, AIS_Shaded, -1/*do not participate in selection*/, Standard_True);
+//  }
+//  else
+//  {
+//    Handle(AIS_Shape)::DownCast (myPreviewPresentation)->Set (aCompound);
+//    myPreviewPresentation->SetTransformPersistence(thePersistent);
+//    if (!aContext.IsNull())
+//      aContext->Redisplay (myPreviewPresentation, Standard_True);
+//  }
+//}
index 94c4a2e03d5303326fd0143fc5e1864ebd32241a..74dfea9fb1c4344ae801c16f36105a26a9f227c3 100644 (file)
@@ -23,7 +23,7 @@
 
 #include <inspector/TInspectorAPI_PluginParameters.hxx>
 #include <inspector/VInspector_CallBack.hxx>
-#include <inspector/VInspector_DisplayActionType.hxx>
+#include <inspector/View_DisplayActionType.hxx>
 
 #include <inspector/ViewControl_PaneCreator.hxx>
 
 #include <QMainWindow>
 #include <Standard_WarningsRestore.hxx>
 
-class VInspector_PreviewParameters;
-
 class ViewControl_MessageDialog;
 class ViewControl_PropertyView;
 
 class VInspector_ToolBar;
 
+class View_DisplayPreview;
 class View_Window;
 
 class QAbstractItemModel;
@@ -101,6 +100,8 @@ public:
   //! \return container of presentations
   NCollection_List<Handle(AIS_InteractiveObject)> GetSelectedPresentations (QItemSelectionModel* theModel);
 
+  void GetSelectedShapes (NCollection_List<Handle(Standard_Transient)>& theSelPresentations);
+
   //! Returns selected shapes
   //! \param theModel selection model
   //! \return container of shapes
@@ -109,8 +110,7 @@ public:
   //! Returns selected shapes
   //! \param theModel selection model
   //! \return container of shapes
-  void GetSelectedPropertyPanelShapes (const QModelIndexList& theTreeViewIndices,
-                                       const QModelIndexList& thePropertyPanelIndices,
+  void GetSelectedPropertyPanelShapes (const TreeModel_ItemBasePtr& theTreeItem,
                                        NCollection_List<TopoDS_Shape>& theShapes);
 
   //! Returns the first not zero transform persistent of selected elements
@@ -214,7 +214,7 @@ private:
   //! Set selected in tree view presentations displayed or erased in the current context. Note that erased presentations
   //! still belongs to the current context until Remove is called.
   //! \param theType display action type
-  void displaySelectedPresentations (const VInspector_DisplayActionType theType);
+  void displaySelectedPresentations (const View_DisplayActionType theType);
 
   //! Set items of the pointers highlighted in tree view
   //! \param theType display action type
@@ -228,12 +228,6 @@ private:
   //! \return a context of created view.
   Handle(AIS_InteractiveContext) createView();
 
-  //!< Updates presentation of preview for parameter shapes. Creates a compound of the shapes
-  //!< \param theShape container of shapes
-  //!< \param thePersistent transform persistent to be used in preview presentation
-  void updatePreviewPresentation (const NCollection_List<TopoDS_Shape>& theShapes,
-                                  const Handle(Graphic3d_TransformPers)& thePersistent);
-
 private:
 
   QWidget* myParent; //!< widget, comes when Init window, the window control lays in the layout, updates window title
@@ -254,8 +248,8 @@ private:
   View_Window* myViewWindow; //!< temporary view window, it is created if Open is called but context is still NULL
 
   Handle(TInspectorAPI_PluginParameters) myParameters; //!< plugins parameters container
-  VInspector_PreviewParameters* myPreviewParameters; //!< drawer of preview presentation
-  Handle(AIS_InteractiveObject) myPreviewPresentation; //!< presentation of preview for a selected object
+
+  View_DisplayPreview* myDisplayPreview; //!< class for preview display
 
 #ifdef DEBUG_TWO_VIEWS
   Handle(View_CameraPositionPrs) myCameraPrs;
index f4378b68d865f8710e17a76cf5e36415addcb96d..52a32aa45a77a7b413d47be607543c7c065d06c3 100644 (file)
@@ -71,7 +71,6 @@ QVariant VInspectorPaneAIS_Shape::GetTableData (const Handle(Standard_Transient)
 
     default: return QVariant();
   }
-  return QVariant();
 }
 
 // =======================================================================
@@ -79,7 +78,7 @@ QVariant VInspectorPaneAIS_Shape::GetTableData (const Handle(Standard_Transient)
 // purpose :
 // =======================================================================
 ViewControl_PaneItem* VInspectorPaneAIS_Shape::GetSelected (const Handle(Standard_Transient)& theObject,
-                                                            const int theRow, const int theColumn)
+                                                            const int /*theRow*/, const int /*theColumn*/)
 {
   Handle(AIS_Shape) aPrs = GetPresentation (theObject);
   if (aPrs.IsNull())
index 0d5ff838ac568ccc16db09f6d8eba647f9c687c8..cb2e0735522cab783ebfc6261b690ceaede93cfb 100644 (file)
@@ -2,9 +2,14 @@ View.qrc
 View_CameraPositionPrs.cxx
 View_CameraPositionPrs.hxx
 View_ContextType.hxx
+View_DisplayActionType.hxx
 View_Displayer.cxx
 View_Displayer.hxx
+View_DisplayPreview.cxx
+View_DisplayPreview.hxx
 View_PresentationType.hxx
+View_PreviewParameters.cxx
+View_PreviewParameters.hxx
 View_ToolActionType.hxx
 View_ToolBar.cxx
 View_ToolBar.hxx
diff --git a/tools/View/View_DisplayActionType.hxx b/tools/View/View_DisplayActionType.hxx
new file mode 100644 (file)
index 0000000..7211c18
--- /dev/null
@@ -0,0 +1,29 @@
+// Created on: 2018-08-19
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2018 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 View_DisplayActionType_H
+#define View_DisplayActionType_H
+
+//! \enum View_DisplayActionType
+enum View_DisplayActionType
+{
+  View_DisplayActionType_NoneId, //!< No action activated
+  View_DisplayActionType_DisplayId, //!< Display action
+  View_DisplayActionType_RedisplayId, //!< Redisplay action
+  View_DisplayActionType_EraseId, //!< Erase action
+  View_DisplayActionType_RemoveId //!< Remove action
+};
+
+#endif
diff --git a/tools/View/View_DisplayPreview.cxx b/tools/View/View_DisplayPreview.cxx
new file mode 100644 (file)
index 0000000..5537faa
--- /dev/null
@@ -0,0 +1,127 @@
+// Created on: 2019-07-14
+// 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/View_DisplayPreview.hxx>
+#include <inspector/View_PreviewParameters.hxx>
+#include <inspector/View_Tools.hxx>
+
+#include <inspector/ViewControl_Tools.hxx>
+
+#include <inspector/Convert_Tools.hxx>
+#include <inspector/Convert_TransientShape.hxx>
+
+#include <AIS_InteractiveContext.hxx>
+#include <AIS_InteractiveObject.hxx>
+#include <AIS_Shape.hxx>
+
+#include <BRep_Builder.hxx>
+#include <BRepBuilderAPI_MakeVertex.hxx>
+#include <BRepBuilderAPI_MakeEdge.hxx>
+#include <BRepBuilderAPI_MakeFace.hxx>
+
+#include <Geom_Axis2Placement.hxx>
+#include <TopoDS_Compound.hxx>
+
+// =======================================================================
+// function : Constructor
+// purpose :
+// =======================================================================
+View_DisplayPreview::View_DisplayPreview()
+{
+  myPreviewParameters = new View_PreviewParameters();
+}
+
+// =======================================================================
+// function : SetContext
+// purpose :
+// =======================================================================
+void View_DisplayPreview::SetContext (const Handle(AIS_InteractiveContext)& theContext)
+{
+  if (myContext == theContext)
+    return;
+
+  // remove all preview presentations from the previous context, display it in the new 
+
+  myContext = theContext;
+  myPreviewParameters->GetDrawer()->Link (theContext->DefaultDrawer());
+}
+
+// =======================================================================
+// function : UpdatePreview
+// purpose :
+// =======================================================================
+void View_DisplayPreview::UpdatePreview (const View_DisplayActionType theType,
+                                         const NCollection_List<Handle(Standard_Transient)>& thePresentations)
+{
+  if (myContext.IsNull())
+    return;
+
+  if (thePresentations.IsEmpty())
+  {
+    myContext->Remove (myPreviewPresentation, Standard_True);
+    myPreviewPresentation = NULL;
+    return;
+  }
+
+  BRep_Builder aBuilder;
+  TopoDS_Compound aCompound;
+  aBuilder.MakeCompound (aCompound);
+  for (NCollection_List<Handle(Standard_Transient)>::Iterator anIterator (thePresentations); anIterator.More(); anIterator.Next())
+  {
+    Handle(Convert_TransientShape) aShapePtr = Handle(Convert_TransientShape)::DownCast (anIterator.Value());
+    if (aShapePtr.IsNull())
+      continue;
+
+    aBuilder.Add (aCompound, aShapePtr->GetShape());
+  }
+
+  if (myPreviewPresentation.IsNull())
+  {
+    myPreviewPresentation = new AIS_Shape (aCompound);
+    myPreviewPresentation->SetAttributes (myPreviewParameters->GetDrawer());
+
+    //myPreviewPresentation->SetTransformPersistence(thePersistent);
+    myContext->Display (myPreviewPresentation, AIS_Shaded, -1/*do not participate in selection*/, Standard_True);
+  }
+  else
+  {
+    Handle(AIS_Shape)::DownCast (myPreviewPresentation)->Set (aCompound);
+    //myPreviewPresentation->SetTransformPersistence(thePersistent);
+    myContext->Redisplay (myPreviewPresentation, Standard_True);
+  }
+}
+
+// =======================================================================
+// function : DisplayDefaultPreview
+// purpose :
+// =======================================================================
+
+void View_DisplayPreview::DisplayDefaultPreview()
+{
+  if (myContext.IsNull())
+    return;
+
+  BRep_Builder aBuilder;
+  TopoDS_Compound aCompound;
+  aBuilder.MakeCompound (aCompound);
+  aBuilder.Add (aCompound, BRepBuilderAPI_MakeVertex (gp_Pnt(25., 10., 0.)));
+  aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (gp_Pnt(20., 20., 0.), gp_Pnt(30., 20., 10.)));
+  //aBuilder.Add (aCompound, BRepBuilderAPI_MakeFace (gp_Pln (gp_Pnt (20., 30., 0.), gp_Dir (1., 0., 0.))).Face());
+  aBuilder.Add (aCompound, Convert_Tools::CreateBoxShape (gp_Pnt(20., 40., 0.), gp_Pnt(30., 60., 10.)));
+
+  Handle(AIS_Shape) aDefaultPreview = new AIS_Shape (aCompound);
+  aDefaultPreview->SetAttributes (myPreviewParameters->GetDrawer());
+  myContext->Display (aDefaultPreview, AIS_Shaded, -1/*do not participate in selection*/, Standard_True);
+}
diff --git a/tools/View/View_DisplayPreview.hxx b/tools/View/View_DisplayPreview.hxx
new file mode 100644 (file)
index 0000000..2d2d6bb
--- /dev/null
@@ -0,0 +1,85 @@
+// Created on: 2019-07-14
+// 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 View_DisplayPreview_H
+#define View_DisplayPreview_H
+
+#include <inspector/View_DisplayActionType.hxx>
+
+#include <AIS_InteractiveContext.hxx>
+#include <Standard.hxx>
+#include <Standard_Handle.hxx>
+#include <Standard_Macro.hxx>
+
+class AIS_InteractiveObject;
+class View_PreviewParameters;
+
+//! \class View_DisplayPreview
+//! \brief It is responsible for communication with AIS Interactive Context to:
+//! - display/erase presentations;
+//! - change display mode of visualized presentations (Shaded or WireFrame mode)
+//!
+//! It contains containers of visualized presentations to obtain presentations relating only to this displayer.
+//! Displayer is connected to AIS Interactive Context
+class View_DisplayPreview
+{
+public:
+
+  //! Constructor
+  Standard_EXPORT View_DisplayPreview();
+
+  //! Destructor
+  virtual ~View_DisplayPreview() {}
+
+  //! Stores the current context where the presentations will be displayed/erased.
+  //! Erases previuously displayd presentations if there were some displayed
+  //! \param theContext a context instance
+  Standard_EXPORT void SetContext (const Handle(AIS_InteractiveContext)& theContext);
+
+  //!< Returns preview parameters
+  View_PreviewParameters* GetPreviewParameters() const { return myPreviewParameters; }
+
+  //!< Updates visibility of the presentations for the display type
+  Standard_EXPORT void UpdatePreview (const View_DisplayActionType theType,
+                                      const NCollection_List<Handle(Standard_Transient)>& thePresentations);
+
+  //!< Returns true if preview presentation is shown
+  Standard_EXPORT Standard_Boolean HasPreview() const { return !myPreviewPresentation.IsNull(); }
+
+  //!< Displays default preview to set visualization properties
+  Standard_EXPORT void DisplayDefaultPreview();
+
+protected:
+
+  //!< Updates presentation of preview for parameter shapes. Creates a compound of the shapes
+  //!< \param theShape container of shapes
+  //!< \param thePersistent transform persistent to be used in preview presentation
+  //void updatePreviewPresentation (const NCollection_List<TopoDS_Shape>& theShapes,
+  //                                const Handle(Graphic3d_TransformPers)& thePersistent);
+
+private:
+
+  //! Returns the current context
+  const Handle(AIS_InteractiveContext)& GetContext() const { return myContext; }
+
+private:
+
+  Handle(AIS_InteractiveContext) myContext; //!< context, where the displayer works
+
+  View_PreviewParameters* myPreviewParameters; //!< drawer of preview presentation
+  Handle(AIS_InteractiveObject) myPreviewPresentation; //!< presentation of preview for a selected object
+};
+
+#endif
diff --git a/tools/View/View_PreviewParameters.cxx b/tools/View/View_PreviewParameters.cxx
new file mode 100644 (file)
index 0000000..30d0b47
--- /dev/null
@@ -0,0 +1,120 @@
+// Created on: 2019-05-03
+// 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/View_PreviewParameters.hxx>
+
+#include <Prs3d_Drawer.hxx>
+#include <Prs3d_PointAspect.hxx>
+#include <Prs3d_ShadingAspect.hxx>
+
+// =======================================================================
+// function : Constructor
+// purpose :
+// =======================================================================
+View_PreviewParameters::View_PreviewParameters()
+{
+  myDrawer = new Prs3d_Drawer();
+
+  Quantity_Color aColor(Quantity_NOC_TOMATO);//Quantity_NOC_GREENYELLOW));//Quantity_NOC_BLUE1));
+  Standard_ShortReal aTransparency = 0.8;
+
+  // point parameters
+  myDrawer->SetPointAspect (new Prs3d_PointAspect (Aspect_TOM_O_PLUS, aColor, 3.0));
+
+  // shading parameters
+  Graphic3d_MaterialAspect aShadingMaterial;
+  aShadingMaterial.SetReflectionModeOff (Graphic3d_TOR_SPECULAR);
+  aShadingMaterial.SetMaterialType (Graphic3d_MATERIAL_ASPECT);
+
+  myDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
+  myDrawer->ShadingAspect()->Aspect()->SetInteriorStyle (Aspect_IS_SOLID);
+  myDrawer->ShadingAspect()->SetColor (aColor);
+  myDrawer->ShadingAspect()->SetMaterial (aShadingMaterial);
+
+  myDrawer->ShadingAspect()->Aspect()->ChangeFrontMaterial().SetTransparency (aTransparency);
+  myDrawer->ShadingAspect()->Aspect()->ChangeBackMaterial() .SetTransparency (aTransparency);
+  myDrawer->SetTransparency (aTransparency);
+
+  // common parameters
+  myDrawer->SetZLayer (Graphic3d_ZLayerId_Topmost);
+}
+
+// =======================================================================
+// function : SaveState
+// purpose :
+// =======================================================================
+void View_PreviewParameters::SaveState (View_PreviewParameters* theParameters,
+                                              QMap<QString, QString>& theItems,
+                                              const QString& thePrefix)
+{
+  Handle(Prs3d_Drawer) aDrawer = theParameters->GetDrawer();
+
+  //Quantity_Color aColor = aDrawer->Color();
+  //Standard_ShortReal aTransparency = aDrawer->Transparency();
+
+  //// point parameters
+  //{
+  //  Standard_Boolean anOwnPointAspect = aDrawer->HasOwnPointAspect();
+  //  Standard_SStream OS;
+  //  if (anOwnPointAspect)
+  //    myDrawer->PointAspect()->Dump (OS);
+  //  TCollection_AsciiString aStream (OS.str().c_str());
+  //  theItems[thePrefix + "has_point_aspect"] = anOwnPointAspect;
+  //  theItems[thePrefix + "point_aspect"] = aStream.ToCString();
+  //}
+  //// shading parameters
+  //{
+  //  Standard_Boolean anOwnShadingAspect = aDrawer->HasOwnShadingAspect();
+  //  Standard_SStream OS;
+  //  if (anOwnShadingAspect)
+  //    myDrawer->ShadingAspect()->Dump (OS);
+  //  TCollection_AsciiString aStream (OS.str().c_str());
+  //  theItems[thePrefix + "has_shading_aspect"] = anOwnShadingAspect;
+  //  theItems[thePrefix + "shading_aspect"] = aStream.ToCString();
+  //}
+}
+
+// =======================================================================
+// function : RestoreState
+// purpose :
+// =======================================================================
+bool  View_PreviewParameters::RestoreState (View_PreviewParameters* theParameters,
+                                                  const QString& theKey, const QString& theValue,
+                                                  const QString& thePrefix)
+{
+  //if (theKey == thePrefix + "has_point_aspect") // point parameters
+  //{
+  //  myDrawer->SetOwnPointAspect (theValue.toBool());
+  //}
+  //else if (theKey == thePrefix + "point_aspect") // point parameters
+  //{
+  //  Standard_SStream aStream;
+  //  aStream << theValue.ToString().ToStdString();
+  //  myDrawer->PointAspect()->Init (aStream);
+  //}
+  //else if (theKey == thePrefix + "has_shading_aspect") // shading parameters
+  //{
+  //  myDrawer->SetOwnShadingAspect (theValue.toBool());
+  //}
+  //else if (theKey == thePrefix + "shading_aspect") // shading parameters
+  //{
+  //  Standard_SStream aStream;
+  //  aStream << theValue.ToString().ToStdString();
+  //  myDrawer->ShadingAspect()->Init (aStream);
+  //}
+  //else
+  //  return false;
+  return true;
+}
diff --git a/tools/View/View_PreviewParameters.hxx b/tools/View/View_PreviewParameters.hxx
new file mode 100644 (file)
index 0000000..c5931bf
--- /dev/null
@@ -0,0 +1,68 @@
+// Created on: 2019-05-03
+// 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 View_PreviewParameters_H
+#define View_PreviewParameters_H
+
+#include <Standard.hxx>
+#include <Standard_Macro.hxx>
+
+#include <Prs3d_Drawer.hxx>
+
+#include <Standard_WarningsDisable.hxx>
+#include <QMap>
+#include <QString>
+#include <Standard_WarningsRestore.hxx>
+
+//! \class View_PreviewParameters
+//! Container of View tool bar actions
+class View_PreviewParameters
+{
+public:
+
+  //! Constructor
+  Standard_EXPORT View_PreviewParameters ();
+
+  //! Destructor
+  virtual ~View_PreviewParameters() {}
+
+  //! Returns main control
+  const Handle(Prs3d_Drawer)& GetDrawer() const { return myDrawer; }
+
+    //! Save state of three view in a container in form: key, value. It saves:
+  //! - visibiblity of columns,
+  //! - columns width
+  //! \param theTreeView a view instance
+  //! \param theItems [out] properties
+  //! \param thePrefix peference item prefix
+  Standard_EXPORT static void SaveState (View_PreviewParameters* theParameters,
+                                         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 (View_PreviewParameters* theParameters,
+                                            const QString& theKey, const QString& theValue,
+                                            const QString& thePrefix = QString());
+
+private:
+
+  Handle(Prs3d_Drawer) myDrawer;
+};
+
+#endif
index 36628579679dc34a262bddf5ad6bfd5202cd3124..26a4f65577d76374eec9c9b658af5adbcdaf215e 100644 (file)
@@ -78,9 +78,9 @@ View_Widget::View_Widget (QWidget* theParent,
   {
     myViewer->InitViewer (myViewer->CreateStandardViewer());
 
-    Handle(AIS_Trihedron) aTrihedron = new AIS_Trihedron (new Geom_Axis2Placement (gp::XOY()));
-    aTrihedron->SetDatumDisplayMode (Prs3d_DM_Shaded);
-    myViewer->GetContext()->Display (aTrihedron, Standard_True);
+    //Handle(AIS_Trihedron) aTrihedron = new AIS_Trihedron (new Geom_Axis2Placement (gp::XOY()));
+    //aTrihedron->SetDatumDisplayMode (Prs3d_DM_Shaded);
+    //myViewer->GetContext()->Display (aTrihedron, Standard_True);
   }
 
   setAttribute (Qt::WA_PaintOnScreen);
index 8c21c99ce9c8fa7d26fc5bcad4c64d9548526670..eee2dd0d1726cba04656e3c6861df6fd2720437f 100644 (file)
@@ -26,6 +26,4 @@ ViewControl_TableModelValuesDefault.cxx
 ViewControl_TableModelValuesDefault.hxx
 ViewControl_Tools.cxx
 ViewControl_Tools.hxx
-ViewControl_TransientShape.cxx
-ViewControl_TransientShape.hxx
 ViewControl_TreeView.hxx
index fd5ac5a3f0eebc5522eaef94c0d8323102b08113..a07c7ffe27bd3c4505c0d047de5741a6f1e96bb3 100644 (file)
@@ -14,7 +14,6 @@
 // commercial license or contractual agreement. 
 
 #include <inspector/ViewControl_PropertiesStream.hxx>
-#include <inspector/ViewControl_TransientShape.hxx>
 
 #include <BRepBuilderAPI_MakeVertex.hxx>
 
@@ -108,8 +107,8 @@ void ViewControl_PropertiesStream::GetPresentations (const int theRow,
   TCollection_AsciiString aStrValue = aValue.toString().toStdString().c_str();
 
   gp_XYZ aPoint;
-  if (!aPoint.FromString (aStrValue))
+  if (!aPoint.Init (Standard_SStream (aStrValue.ToCString())))
     return;
 
-  thePresentations.Append (new ViewControl_TransientShape (BRepBuilderAPI_MakeVertex (aPoint)));
+  //thePresentations.Append (new Convert_TransientShape (BRepBuilderAPI_MakeVertex (aPoint)));
 }
index fee84d2c0618755be44cd3edfcc9bd0b78d54406..673d9f9de60210547dd6471a51463978bb3018be 100644 (file)
@@ -18,6 +18,7 @@
 #include <inspector/ViewControl_TableModel.hxx>
 #include <inspector/ViewControl_Tools.hxx>
 
+#include <inspector/TreeModel_ItemProperties.hxx>
 #include <inspector/TreeModel_Tools.hxx>
 
 #include <Standard_WarningsDisable.hxx>
@@ -106,7 +107,7 @@ void ViewControl_Table::Init (ViewControl_TableModelValues* theModelValues)
 // purpose :
 // =======================================================================
 
-void ViewControl_Table::GetSelectedIndices (QMap<int, QList<int>>& theSelectedIndices)
+void ViewControl_Table::GetSelectedIndices (QMap<int, QList<int>>& theSelectedIndices) const
 {
   QModelIndexList aSelected = myTableView->selectionModel()->selectedIndexes();
 
@@ -131,3 +132,64 @@ QString ViewControl_Table::SeparatorData()
 {
   return ViewControl_Tools::TableSeparator();
 }
+
+// =======================================================================
+// function : GetSelectedPresentations
+// purpose :
+// =======================================================================
+
+void ViewControl_Table::GetSelectedPresentations (const TreeModel_ItemBasePtr& theTreeItem,
+                                                  NCollection_List<Handle(Standard_Transient)>& theSelPresentations) const
+{
+  Handle(TreeModel_ItemProperties) anItemProperties = theTreeItem->GetProperties();
+  if (anItemProperties.IsNull())
+    return;
+
+  QMap<int, QList<int>> aSelectedIndices;
+  GetSelectedIndices (aSelectedIndices);
+
+  for (QMap<int, QList<int>>::const_iterator aSelIt = aSelectedIndices.begin(); aSelIt != aSelectedIndices.end(); aSelIt++)
+  {
+    int aRowId = aSelIt.key();
+    QList<int> aColIds = aSelIt.value();
+    for (int aColId = 0; aColId < aColIds.size(); aColId++)
+    {
+      int aSelectedColId = aColIds[aColId];
+      if (aSelectedColId != 1)
+        continue;
+
+      if (anItemProperties)
+        anItemProperties->GetPresentations (aRowId, aSelectedColId, theSelPresentations);
+    }
+  }
+}
+
+// =======================================================================
+// function : GetSelectedPointers
+// purpose :
+// =======================================================================
+
+void ViewControl_Table::GetSelectedPointers (QStringList& thePointers) const
+{
+  QMap<int, QList<int>> aSelectedIndices;
+  GetSelectedIndices (aSelectedIndices);
+
+  ViewControl_TableModel* aTableModel = dynamic_cast<ViewControl_TableModel*>(GetTableView()->model());
+  ViewControl_TableModelValues* aTableValues = aTableModel->GetModelValues();
+
+  for (QMap<int, QList<int>>::const_iterator aSelIt = aSelectedIndices.begin(); aSelIt != aSelectedIndices.end(); aSelIt++)
+  {
+    int aRowId = aSelIt.key();
+    QList<int> aColIds = aSelIt.value();
+    for (int aColId = 0; aColId < aColIds.size(); aColId++)
+    {
+      int aSelectedColId = aColIds[aColId];
+      if (aSelectedColId != 1)
+        continue;
+
+      QString aData = aTableValues->Data (aRowId, aSelectedColId, Qt::DisplayRole).toString();
+      if (aData.contains (ViewControl_Tools::GetPointerPrefix().ToCString()))
+        thePointers.append (aData);
+    }
+  }
+}
\ No newline at end of file
index 336f27744131cd16107cc30239422e6d59ea842f..3c7611ea513aee6f0eb1eeaa9f39755bcd5c0c69 100644 (file)
 #ifndef ViewControl_Table_H
 #define ViewControl_Table_H
 
+#include <NCollection_List.hxx>
+
 #include <Standard.hxx>
 #include <Standard_Macro.hxx>
+#include <Standard_Transient.hxx>
+
+#include <inspector/TreeModel_ItemBase.hxx>
 
 #include <Standard_WarningsDisable.hxx>
 #include <QItemSelection>
@@ -68,7 +73,14 @@ public:
 
   //! 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);
+  Standard_EXPORT void GetSelectedIndices (QMap<int, QList<int>>& aSelectedIndices) const;
+
+  //! Returns presentations by the property item of tree item for the selected cells
+  Standard_EXPORT void GetSelectedPresentations (const TreeModel_ItemBasePtr& theTreeItem,
+                                                 NCollection_List<Handle(Standard_Transient)>& theSelPresentations) const;
+
+  //! Returns pointers from selected cells
+  Standard_EXPORT void GetSelectedPointers (QStringList& thePointers) const;
 
   //! Returns text of separation row in table
   //! \return string value
index bccb3d24ec4816486be4988b5867fc7d94213c4b..166aedc51bef88299037914e2af63ac6b527ba8f 100644 (file)
@@ -28,7 +28,7 @@
 int ViewControl_TableModelValues::ColumnCount (const QModelIndex&) const
 {
   if (!GetProperties().IsNull())
-    return GetProperties()->GetTableColumnCount();
+    return GetProperties()->ColumnCount();
 
   return 0;
 }
@@ -42,7 +42,7 @@ int ViewControl_TableModelValues::ColumnCount (const QModelIndex&) const
 int ViewControl_TableModelValues::RowCount (const QModelIndex&) const
 {
   if (!GetProperties().IsNull())
-    return GetProperties()->GetTableRowCount();
+    return GetProperties()->RowCount();
 
   return 0;
 }
@@ -56,7 +56,7 @@ QVariant ViewControl_TableModelValues::Data (const int theRow, const int theColu
 {
   if (!GetProperties().IsNull())
   {
-    QVariant aValue = GetProperties()->GetTableData (theRow, theColumn, theRole);
+    QVariant aValue = GetProperties()->Data (theRow, theColumn, theRole);
     if (aValue.isValid())
       return aValue;
   }
index 273f805a5c0de9fbbf77996b6024123069ed8631..3d15c483aee3827ab19f48c614e691fc9cb419c0 100644 (file)
@@ -19,6 +19,7 @@
 #include <Geom_Transformation.hxx>
 
 #include <TColgp_Array1OfPnt.hxx>
+#include <TCollection.hxx>
 #include <BRep_Builder.hxx>
 #include <TopoDS_Compound.hxx>
 #include <BRepPrimAPI_MakeBox.hxx>
@@ -100,10 +101,11 @@ void ViewControl_Tools::SetDefaultHeaderSections(QTableView* theTableView, const
 // =======================================================================
 TCollection_AsciiString ViewControl_Tools::GetPointerInfo (const Handle(Standard_Transient)& thePointer, const bool isShortInfo)
 {
-  if (thePointer.IsNull())
+  return TCollection::GetPointerInfo (thePointer);
+  /*if (thePointer.IsNull())
     return TCollection_AsciiString();
 
-  return GetPointerInfo(thePointer.operator->(), isShortInfo);
+  return GetPointerInfo(thePointer.operator->(), isShortInfo);*/
 }
 
 // =======================================================================
@@ -112,6 +114,8 @@ TCollection_AsciiString ViewControl_Tools::GetPointerInfo (const Handle(Standard
 // =======================================================================
 TCollection_AsciiString ViewControl_Tools::GetPointerInfo (const void* thePointer, const bool isShortInfo)
 {
+  return TCollection::GetPointerInfo (thePointer);
+  /*
   std::ostringstream aPtrStr;
   aPtrStr << thePointer;
   if (!isShortInfo)
@@ -127,7 +131,7 @@ TCollection_AsciiString ViewControl_Tools::GetPointerInfo (const void* thePointe
       return anInfoPtr;
     }
   }
-  return aPtrStr.str().c_str();
+  return aPtrStr.str().c_str();*/
 }
 
 // =======================================================================
@@ -267,105 +271,3 @@ TCollection_AsciiString ViewControl_Tools::ToString (const TopLoc_Location& theL
 {
   return ToString (theLocation.Transformation());
 }
-
-//=======================================================================
-//function : CreateShape
-//purpose  :
-//=======================================================================
-TopoDS_Shape ViewControl_Tools::CreateShape (const Bnd_Box& theBoundingBox)
-{
-  if (theBoundingBox.IsVoid() || theBoundingBox.IsWhole())
-    return TopoDS_Shape();
-
-  Standard_Real aXmin, anYmin, aZmin, aXmax, anYmax, aZmax;
-  theBoundingBox.Get (aXmin, anYmin, aZmin, aXmax, anYmax, aZmax);
-
-  gp_Pnt aPntMin = gp_Pnt (aXmin, anYmin, aZmin);
-  gp_Pnt aPntMax = gp_Pnt (aXmax, anYmax, aZmax);
-
-  return CreateBoxShape (aPntMin, aPntMax);
-}
-
-//=======================================================================
-//function : CreateShape
-//purpose  :
-//=======================================================================
-TopoDS_Shape ViewControl_Tools::CreateShape (const Bnd_OBB& theBoundingBox)
-{
-  if (theBoundingBox.IsVoid())
-    return TopoDS_Shape();
-
-  TColgp_Array1OfPnt anArrPnts(0, 8);
-  theBoundingBox.GetVertex(&anArrPnts(0));
-
-  BRep_Builder aBuilder;
-  TopoDS_Compound aCompound;
-  aBuilder.MakeCompound (aCompound);
-
-  aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (gp_Pnt (anArrPnts.Value(0)), gp_Pnt (anArrPnts.Value(1))));
-  aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (gp_Pnt (anArrPnts.Value(0)), gp_Pnt (anArrPnts.Value(2))));
-  aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (gp_Pnt (anArrPnts.Value(1)), gp_Pnt (anArrPnts.Value(3))));
-  aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (gp_Pnt (anArrPnts.Value(2)), gp_Pnt (anArrPnts.Value(3))));
-
-  return aCompound;
-}
-
-//=======================================================================
-//function : CreateBoxShape
-//purpose  :
-//=======================================================================
-TopoDS_Shape ViewControl_Tools::CreateBoxShape (const gp_Pnt& thePntMin, const gp_Pnt& thePntMax)
-{
-  Standard_Boolean aThinOnX = fabs (thePntMin.X() - thePntMax.X()) < Precision::Confusion();
-  Standard_Boolean aThinOnY = fabs (thePntMin.Y() - thePntMax.Y()) < Precision::Confusion();
-  Standard_Boolean aThinOnZ = fabs (thePntMin.Z() - thePntMax.Z()) < Precision::Confusion();
-
-  if (((int)aThinOnX + (int)aThinOnY + (int)aThinOnZ) > 1) // thin box in several directions is a point
-  {
-    BRep_Builder aBuilder;
-    TopoDS_Compound aCompound;
-    aBuilder.MakeCompound (aCompound);
-    aBuilder.Add (aCompound, BRepBuilderAPI_MakeVertex (thePntMin));
-    return aCompound;
-  }
-
-  if (aThinOnX || aThinOnY || aThinOnZ)
-  {
-    gp_Pnt aPnt1, aPnt2, aPnt3, aPnt4 ;
-    if (aThinOnX)
-    {
-      aPnt1 = gp_Pnt(thePntMin.X(), thePntMin.Y(), thePntMin.Z());
-      aPnt2 = gp_Pnt(thePntMin.X(), thePntMax.Y(), thePntMin.Z());
-      aPnt3 = gp_Pnt(thePntMin.X(), thePntMax.Y(), thePntMax.Z());
-      aPnt4 = gp_Pnt(thePntMin.X(), thePntMin.Y(), thePntMax.Z());
-    }
-    else if (aThinOnY)
-    {
-      aPnt1 = gp_Pnt(thePntMin.X(), thePntMin.Y(), thePntMin.Z());
-      aPnt2 = gp_Pnt(thePntMax.X(), thePntMin.Y(), thePntMin.Z());
-      aPnt3 = gp_Pnt(thePntMax.X(), thePntMin.Y(), thePntMax.Z());
-      aPnt4 = gp_Pnt(thePntMin.X(), thePntMin.Y(), thePntMax.Z());
-    }
-    else if (aThinOnZ)
-    {
-      aPnt1 = gp_Pnt(thePntMin.X(), thePntMin.Y(), thePntMin.Z());
-      aPnt2 = gp_Pnt(thePntMax.X(), thePntMin.Y(), thePntMin.Z());
-      aPnt3 = gp_Pnt(thePntMax.X(), thePntMax.Y(), thePntMin.Z());
-      aPnt4 = gp_Pnt(thePntMin.X(), thePntMax.Y(), thePntMin.Z());
-    }
-    BRep_Builder aBuilder;
-    TopoDS_Compound aCompound;
-    aBuilder.MakeCompound (aCompound);
-    aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (aPnt1, aPnt2));
-    aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (aPnt2, aPnt3));
-    aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (aPnt3, aPnt4));
-    aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (aPnt4, aPnt1));
-
-    return aCompound;
-  }
-  else
-  {
-    BRepPrimAPI_MakeBox aBoxBuilder (thePntMin, thePntMax);
-    return aBoxBuilder.Shape();
-  }
-}
index a701d4df0aec93d87a031137a9d7927a149ae8d1..8af7a1dd8f3904130ec19c214da6c00a273b3321 100644 (file)
@@ -145,22 +145,6 @@ public:
   //! \return text value
   Standard_EXPORT static TCollection_AsciiString ToString (const TopLoc_Location& theLocation);
 
-  //! Creates box shape
-  //! \param theBoundingBox box shape parameters
-  //! \return created shape
-  Standard_EXPORT static TopoDS_Shape CreateShape (const Bnd_Box& theBoundingBox);
-
-  //! Creates box shape
-  //! \param theBoundingBox box shape parameters
-  //! \return created shape
-  Standard_EXPORT static TopoDS_Shape CreateShape (const Bnd_OBB& theBoundingBox);
-
-  //! Creates box shape
-  //! \param thePntMin minimum point on the bounding box
-  //! \param thePntMax maximum point on the bounding box
-  //! \return created shape
-  Standard_EXPORT static TopoDS_Shape CreateBoxShape (const gp_Pnt& thePntMin, const gp_Pnt& thePntMax);
-
 };
 
 #endif
diff --git a/tools/ViewControl/ViewControl_TransientShape.cxx b/tools/ViewControl/ViewControl_TransientShape.cxx
deleted file mode 100644 (file)
index fc537b0..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-// Created on: 2019-04-15
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2019 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement. 
-
-#include <inspector/ViewControl_TransientShape.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(ViewControl_TransientShape, Standard_Transient)
diff --git a/tools/ViewControl/ViewControl_TransientShape.hxx b/tools/ViewControl/ViewControl_TransientShape.hxx
deleted file mode 100644 (file)
index 5b28f7c..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-// Created on: 2019-04-15
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2019 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement. 
-
-#ifndef ViewControl_TransientShape_H
-#define ViewControl_TransientShape_H
-
-#include <Standard.hxx>
-#include <Standard_Handle.hxx>
-#include <Standard_Macro.hxx>
-#include <Standard_Type.hxx>
-#include <Standard_Transient.hxx>
-
-#include <TopoDS_Shape.hxx>
-
-DEFINE_STANDARD_HANDLE (ViewControl_TransientShape, Standard_Transient)
-
-//! \class ViewControl_TransientShape
-//! \brief An interface to create custom panes by transient object name.
-class ViewControl_TransientShape : public Standard_Transient
-{
-public:
-
-  //! Constructor
-  ViewControl_TransientShape (const TopoDS_Shape& theShape) { SetShape (theShape); }
-
-  //! Destructor
-  virtual ~ViewControl_TransientShape() {}
-
-  //! Fills current shape
-  void SetShape (const TopoDS_Shape& theShape) { myShape = theShape; }
-
-  //! Returns current shape
-  const TopoDS_Shape GetShape() const { return myShape; }
-
-  DEFINE_STANDARD_RTTIEXT (ViewControl_TransientShape, Standard_Transient)
-
-private:
-  TopoDS_Shape myShape;
-};
-
-#endif