]> OCCT Git - occt-copy.git/commitdiff
0030641: Visualization - possibility to select in predefined ZLayers only - debug...
authornds <nds@opencascade.com>
Tue, 9 Apr 2019 09:15:47 +0000 (12:15 +0300)
committernds <nds@opencascade.com>
Tue, 9 Apr 2019 09:15:47 +0000 (12:15 +0300)
src/SelectMgr/SelectMgr_SelectableObjectSet.cxx
src/SelectMgr/SelectMgr_ViewerSelector.cxx
src/SelectMgr/SelectMgr_ViewerSelector.hxx

index 58aa8895d012aabee64ceb3bb7787501cc7552b4..b81e6a067fa957d3a3f5488e03214853ff5bc302 100644 (file)
 #include <BVH_BinnedBuilder.hxx>
 #include <BVH_LinearBuilder.hxx>
 
+//#define REPORT_SELECTION_BUILD
+#ifdef REPORT_SELECTION_BUILD
+#include <Message_Alerts.hxx>
+#include <Message_PerfMeter.hxx>
+#endif
+
 namespace
 {
   //! Short-cut definition of indexed data map of selectable objects
@@ -46,6 +52,18 @@ namespace
       if (!anObject.IsNull() && myDisabledZLayers.Contains (anObject->ZLayer()))
         return Select3D_BndBox3d();
 
+#ifdef REPORT_SELECTION_BUILD
+      Message_PerfMeter aPerfMeter;
+      if (anObject->ZLayer() == Graphic3d_ZLayerId_Default)
+      {
+        MESSAGE_INFO_OBJECT (anObject, "BVHBuilderAdaptorRegular: default layer", "", &aPerfMeter, NULL);
+      }
+      else
+      {
+        MESSAGE_INFO_OBJECT (anObject, "BVHBuilderAdaptorRegular", anObject->ZLayer(), &aPerfMeter, NULL);
+      }
+#endif
+
       Bnd_Box aBox;
       anObject->BoundingBox (aBox);
       if (aBox.IsVoid())
@@ -134,6 +152,18 @@ namespace
           continue;
         }
 
+      #ifdef REPORT_SELECTION_BUILD
+      Message_PerfMeter aPerfMeter;
+      if (anObject->ZLayer() == Graphic3d_ZLayerId_Default)
+      {
+        MESSAGE_INFO_OBJECT (anObject, "BVHBuilderAdaptorPersistent: default layer", "", &aPerfMeter, NULL);
+      }
+      else
+      {
+        MESSAGE_INFO_OBJECT (anObject, "BVHBuilderAdaptorPersistent", anObject->ZLayer(), &aPerfMeter, NULL);
+      }
+      #endif
+
         Bnd_Box aBoundingBox;
         anObject->BoundingBox (aBoundingBox);
         if (aBoundingBox.IsVoid()
index f6d0ea3df79c86e7018db94ea6f351f7d42132f0..3b3d9dad9fb1bc39bf3a44a9b33b8d985f2351cf 100644 (file)
 // commercial license or contractual agreement.
 
 #include <SelectMgr_ViewerSelector.hxx>
+#include <SelectMgr.hxx>
 
 #include <BVH_Tree.hxx>
 #include <gp_GTrsf.hxx>
 #include <gp_Pnt.hxx>
+#include <Message_Alerts.hxx>
 #include <OSD_Environment.hxx>
 #include <Precision.hxx>
 #include <SelectBasics_EntityOwner.hxx>
@@ -371,6 +373,17 @@ void SelectMgr_ViewerSelector::traverseObject (const Handle(SelectMgr_Selectable
   if (!theObject.IsNull() && myDisabledZLayers.Contains (theObject->ZLayer()))
     return;
 
+#ifdef REPORT_SELECTION_BUILD
+  Message_PerfMeter aPerfMeter;
+  if (theObject->ZLayer() == Graphic3d_ZLayerId_Default)
+  {
+    MESSAGE_INFO_OBJECT (theObject, "traverseObject: default layer", "", &aPerfMeter, NULL);
+  }
+  else
+  {
+    MESSAGE_INFO_OBJECT (theObject, "BVHBuilderAdaptorRegular", theObject->ZLayer(), &aPerfMeter, NULL);
+  }
+#endif
   Handle(SelectMgr_SensitiveEntitySet)& anEntitySet = myMapOfObjectSensitives.ChangeFind (theObject);
   if (anEntitySet->Size() == 0)
   {
@@ -378,7 +391,6 @@ void SelectMgr_ViewerSelector::traverseObject (const Handle(SelectMgr_Selectable
   }
 
   #ifdef REPORT_SELECTION_BUILD
-  Message_PerfMeter aPerfMeter;
   MESSAGE_INFO_OBJECT (theObject, "traverseObject", "", &aPerfMeter, NULL);
   Handle(Message_Alert) aParentAlert = OCCT_Message_Alert;
   #endif
@@ -528,9 +540,13 @@ void SelectMgr_ViewerSelector::traverseObject (const Handle(SelectMgr_Selectable
 void SelectMgr_ViewerSelector::TraverseSensitives()
 {
 #ifdef REPORT_SELECTION_BUILD
-  Message_PerfMeter aPerfMeter;
+  Message_PerfMeter aPerfMeter; 
   MESSAGE_INFO ("TraverseSensitives", "", &aPerfMeter, NULL);
   Handle(Message_Alert) aParentAlert = OCCT_Message_Alert;
+
+  Standard_SStream aStream;
+  Dump (aStream);
+  MESSAGE_INFO_VALUES (aStream, "Parameters", "", &aPerfMeter, aParentAlert);
 #endif
 
   mystored.Clear();
@@ -677,6 +693,11 @@ void SelectMgr_ViewerSelector::TraverseSensitives()
   }
 
   SortResult();
+#ifdef REPORT_SELECTION_BUILD
+  Standard_SStream aStreamDone;
+  Dump (aStreamDone);
+  MESSAGE_INFO_VALUES (aStreamDone, "Parameters", "", &aPerfMeter, aParentAlert);
+#endif
 }
 
 //==================================================
@@ -1073,3 +1094,35 @@ void SelectMgr_ViewerSelector::SetDisabledZLayers (const NCollection_Map<Graphic
   myDisabledZLayers = theLayers;
   mySelectableObjects.SetDisabledZLayers (theLayers);
 }
+
+//=======================================================================
+//function : Dump
+//purpose  : 
+//=======================================================================
+void SelectMgr_ViewerSelector::Dump(Standard_OStream& OS)const 
+{
+  DUMP_VALUES (OS, "SelectMgr_ViewerSelector", 2);
+
+  DUMP_VALUES (OS, "IsPickClosest", IsPickClosest());
+  DUMP_VALUES (OS, "ToUpdateTolerance", myToUpdateTolerance);
+  DUMP_VALUES (OS, "mystored", mystored.Extent());
+  //DUMP_VALUES (OS, "mySelectingVolumeMgr", mySelectingVolumeMgr);
+
+  Standard_Integer aNbOfSelected = 0;
+  for (SelectMgr_SelectableObjectSet::Iterator aSelectableIt (mySelectableObjects); aSelectableIt.More(); aSelectableIt.Next())
+  {
+    aNbOfSelected++;
+  }
+  DUMP_VALUES (OS, "mySelectableObjects", aNbOfSelected);
+  DUMP_VALUES (OS, "myTolerances.Tolerance()", myTolerances.Tolerance());
+  DUMP_VALUES (OS, "myTolerances.CustomTolerance()", myTolerances.CustomTolerance());
+  DUMP_VALUES (OS, "myZLayerOrderMap", myZLayerOrderMap.Size());
+
+  TCollection_AsciiString aDisabledLayers;
+  for (NCollection_Map<Graphic3d_ZLayerId>::Iterator anIterator (myDisabledZLayers); anIterator.More(); anIterator.Next())
+  {
+    aDisabledLayers += anIterator.Value();
+    aDisabledLayers += " ";
+  }
+  DUMP_VALUES (OS, "myDisabledZLayers", aDisabledLayers);
+}
index 68f1bcf3fb27e3142ad2a49b5d400d1850f07015..753d3f9e5a0c68959ab5240f50e410ccb12da604 100644 (file)
@@ -216,6 +216,9 @@ public:
   //! Sets container of Z layers, that should not be processed by selection
   Standard_EXPORT void SetDisabledZLayers (const NCollection_Map<Graphic3d_ZLayerId>& theLayers);
 
+  //! Dumps the content of me on the stream <OS>.
+  Standard_EXPORT void Dump (Standard_OStream& OS) const;
+
 public:
 
   //! Begins an iteration scanning for the owners detected at a position in the view.