From 90692499dff781ec27b27e66e356c7288efe83ef Mon Sep 17 00:00:00 2001 From: nds Date: Tue, 9 Apr 2019 12:15:47 +0300 Subject: [PATCH] 0030641: Visualization - possibility to select in predefined ZLayers only - debug messages --- .../SelectMgr_SelectableObjectSet.cxx | 30 ++++++++++ src/SelectMgr/SelectMgr_ViewerSelector.cxx | 57 ++++++++++++++++++- src/SelectMgr/SelectMgr_ViewerSelector.hxx | 3 + 3 files changed, 88 insertions(+), 2 deletions(-) diff --git a/src/SelectMgr/SelectMgr_SelectableObjectSet.cxx b/src/SelectMgr/SelectMgr_SelectableObjectSet.cxx index 58aa8895d0..b81e6a067f 100644 --- a/src/SelectMgr/SelectMgr_SelectableObjectSet.cxx +++ b/src/SelectMgr/SelectMgr_SelectableObjectSet.cxx @@ -19,6 +19,12 @@ #include #include +//#define REPORT_SELECTION_BUILD +#ifdef REPORT_SELECTION_BUILD +#include +#include +#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() diff --git a/src/SelectMgr/SelectMgr_ViewerSelector.cxx b/src/SelectMgr/SelectMgr_ViewerSelector.cxx index f6d0ea3df7..3b3d9dad9f 100644 --- a/src/SelectMgr/SelectMgr_ViewerSelector.cxx +++ b/src/SelectMgr/SelectMgr_ViewerSelector.cxx @@ -15,10 +15,12 @@ // commercial license or contractual agreement. #include +#include #include #include #include +#include #include #include #include @@ -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::Iterator anIterator (myDisabledZLayers); anIterator.More(); anIterator.Next()) + { + aDisabledLayers += anIterator.Value(); + aDisabledLayers += " "; + } + DUMP_VALUES (OS, "myDisabledZLayers", aDisabledLayers); +} diff --git a/src/SelectMgr/SelectMgr_ViewerSelector.hxx b/src/SelectMgr/SelectMgr_ViewerSelector.hxx index 68f1bcf3fb..753d3f9e5a 100644 --- a/src/SelectMgr/SelectMgr_ViewerSelector.hxx +++ b/src/SelectMgr/SelectMgr_ViewerSelector.hxx @@ -216,6 +216,9 @@ public: //! Sets container of Z layers, that should not be processed by selection Standard_EXPORT void SetDisabledZLayers (const NCollection_Map& theLayers); + //! Dumps the content of me on the stream . + Standard_EXPORT void Dump (Standard_OStream& OS) const; + public: //! Begins an iteration scanning for the owners detected at a position in the view. -- 2.39.5