Salome HOME
Issue #1535 crash when mirror: debug information
authornds <nds@opencascade.com>
Thu, 2 Jun 2016 05:54:05 +0000 (08:54 +0300)
committernds <nds@opencascade.com>
Thu, 2 Jun 2016 05:54:31 +0000 (08:54 +0300)
src/ModuleBase/ModuleBase_ModelWidget.cpp
src/ModuleBase/ModuleBase_ModelWidget.h
src/ModuleBase/ModuleBase_OperationFeature.cpp
src/ModuleBase/ModuleBase_Tools.cpp
src/ModuleBase/ModuleBase_Tools.h
src/PartSet/PartSet_OperationPrs.cpp
src/PartSet/PartSet_SketcherMgr.cpp
src/XGUI/XGUI_Displayer.cpp
src/XGUI/XGUI_SelectionMgr.cpp

index 01bb7f33e64e7fd4b50177aa4ea130e6c8c23ea8..d82016eacb5c55c5b84c8bf190292627a6699545 100644 (file)
@@ -26,6 +26,8 @@
 
 //#define DEBUG_VALUE_STATE
 
+//#define DEBUG_WIDGET_INSTANCE
+
 ModuleBase_ModelWidget::ModuleBase_ModelWidget(QWidget* theParent,
                                                const Config_WidgetAPI* theData)
     : QWidget(theParent),
@@ -35,6 +37,10 @@ ModuleBase_ModelWidget::ModuleBase_ModelWidget(QWidget* theParent,
       myFlushUpdateBlocked(false),
       myWidgetValidator(0)
 {
+#ifdef DEBUG_WIDGET_INSTANCE
+  qDebug("ModuleBase_ModelWidget::ModuleBase_ModelWidget");
+#endif
+
   myIsInternal = theData->getBooleanAttribute(ATTR_INTERNAL, false);
 
   myDefaultValue = theData->getProperty(ATTR_DEFAULT);
@@ -47,6 +53,13 @@ ModuleBase_ModelWidget::ModuleBase_ModelWidget(QWidget* theParent,
   connect(this, SIGNAL(valuesModified()), this, SLOT(onWidgetValuesModified()));
 }
 
+ModuleBase_ModelWidget::~ModuleBase_ModelWidget()
+{
+#ifdef DEBUG_WIDGET_INSTANCE
+  qDebug("ModuleBase_ModelWidget::~ModuleBase_ModelWidget");
+#endif
+}
+
 bool ModuleBase_ModelWidget::reset()
 {
   bool aResult = resetCustom();
@@ -159,6 +172,9 @@ void ModuleBase_ModelWidget::setFeature(const FeaturePtr& theFeature, const bool
 
 bool ModuleBase_ModelWidget::focusTo()
 {
+#ifdef DEBUG_WIDGET_INSTANCE
+  qDebug("ModuleBase_ModelWidget::focusTo");
+#endif
   QList<QWidget*> aControls = getControls();
   QList<QWidget*>::const_iterator anIt = aControls.begin(), aLast = aControls.end();
   bool isFocusAccepted = false;
@@ -174,6 +190,9 @@ bool ModuleBase_ModelWidget::focusTo()
 
 void ModuleBase_ModelWidget::activate()
 {
+#ifdef DEBUG_WIDGET_INSTANCE
+  qDebug("ModuleBase_ModelWidget::activate");
+#endif
   // the control value is stored to the mode by the focus in on the widget
   // we need the value is initialized in order to enable the apply button in the property panel.
   // It should happens in the creation mode only because all fields are filled in the edition mode
@@ -191,6 +210,9 @@ void ModuleBase_ModelWidget::activate()
 
 void ModuleBase_ModelWidget::deactivate()
 {
+#ifdef DEBUG_WIDGET_INSTANCE
+  qDebug("ModuleBase_ModelWidget::deactivate");
+#endif
   myIsValueStateBlocked = false;
   myState = Stored;
   if (myWidgetValidator)
@@ -297,6 +319,9 @@ bool ModuleBase_ModelWidget::restoreValue()
 void ModuleBase_ModelWidget::updateObject(ObjectPtr theObject)
 {
   if (!myFlushUpdateBlocked) {
+#ifdef DEBUG_WIDGET_INSTANCE
+    qDebug("ModuleBase_ModelWidget::updateObject");
+#endif
     ModuleBase_Tools::flushUpdated(theObject);
     emit objectUpdated();
   }
@@ -305,6 +330,9 @@ void ModuleBase_ModelWidget::updateObject(ObjectPtr theObject)
 void ModuleBase_ModelWidget::moveObject(ObjectPtr theObj)
 {
   //blockUpdateViewer(true);
+#ifdef DEBUG_WIDGET_INSTANCE
+  qDebug("ModuleBase_ModelWidget::moveObject");
+#endif
 
   static Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_MOVED);
   ModelAPI_EventCreator::get()->sendUpdated(theObj, anEvent);
index c21ef7e8a294424d050639b0321b3aea7337b956..b8417dd6e8d8af7daa229f57a14d5bfe7f76e55b 100644 (file)
@@ -46,9 +46,7 @@ Q_OBJECT
   /// a low-level API for reading xml definitions of widgets
   ModuleBase_ModelWidget(QWidget* theParent, const Config_WidgetAPI* theData);
   /// Destructor
-  virtual ~ModuleBase_ModelWidget()
-  {
-  }
+  virtual ~ModuleBase_ModelWidget();
 
   /// Fills the widget with default values. It calls the resetCustom method and change
   /// the widget state to Reset if the reset is performed.
index 8194f09bb6d12db9ff14a9f85b9553e970b3f6ee..79d72de89761f36cc450988892111de81e249fbf 100755 (executable)
@@ -42,6 +42,8 @@
 #include <ModelAPI_AttributeRefList.h>
 #endif
 
+//#define DEBUG_OPERATION_START
+
 #ifdef _DEBUG
 #include <QDebug>
 #endif
@@ -231,6 +233,9 @@ bool ModuleBase_OperationFeature::isDisplayedOnStart(ObjectPtr theObject)
 
 bool ModuleBase_OperationFeature::start()
 {
+#ifdef DEBUG_OPERATION_START
+  qDebug("ModuleBase_OperationFeature::start -- begin");
+#endif
   setIsModified(false);
   QString anId = getDescription()->operationId();
   if (myIsEditing) {
@@ -249,16 +254,26 @@ bool ModuleBase_OperationFeature::start()
       // in order to update commands status in the workshop, to be exact the feature action
       // to be unchecked
       abort();
+#ifdef DEBUG_OPERATION_START
+  qDebug("ModuleBase_OperationFeature::start -- end : IMPOSSIBLE to start");
+#endif
       return false;
     }
   }
   //Already called startOperation();
   emit started();
+#ifdef DEBUG_OPERATION_START
+  qDebug("ModuleBase_OperationFeature::start -- end");
+#endif
   return true;
 }
 
 void ModuleBase_OperationFeature::abort()
 {
+#ifdef DEBUG_OPERATION_START
+  qDebug("ModuleBase_OperationFeature::abort -- begin");
+#endif
+
   emit beforeAborted();
 
   // the viewer update should be blocked in order to avoid the features blinking before they are
@@ -293,10 +308,16 @@ void ModuleBase_OperationFeature::abort()
   Events_Loop::loop()->send(aMsg);
 
   emit aborted();
+#ifdef DEBUG_OPERATION_START
+  qDebug("ModuleBase_OperationFeature::abort -- end");
+#endif
 }
 
 bool ModuleBase_OperationFeature::commit()
 {
+#ifdef DEBUG_OPERATION_START
+  qDebug("ModuleBase_OperationFeature::commit -- begin");
+#endif
   ModuleBase_IPropertyPanel* aPanel = propertyPanel();
   if (aPanel) {
     ModuleBase_ModelWidget* anActiveWidget = aPanel->activeWidget();
@@ -328,8 +349,14 @@ bool ModuleBase_OperationFeature::commit()
     emit committed();
 
     afterCommitOperation();
+#ifdef DEBUG_OPERATION_START
+  qDebug("ModuleBase_OperationFeature::commit -- end : IMPOSSIBLE to commit");
+#endif
     return true;
   }
+#ifdef DEBUG_OPERATION_START
+  qDebug("ModuleBase_OperationFeature::commit -- end");
+#endif
   return false;
 }
 
index 043709e8f24a3443941b9d1c63515ae28d93c919..012ebb0b584eaba717e4c250fdcb339dd7a69512 100755 (executable)
@@ -56,6 +56,23 @@ const double tolerance = 1e-7;
 
 //#define DEBUG_ACTIVATE_WINDOW
 //#define DEBUG_SET_FOCUS
+//#define DEBUG_SELECTION_INFO
+
+#ifdef DEBUG_SELECTION_INFO
+#include <ModuleBase_ISelection.h>
+#include <ModuleBase_ViewerPrs.h>
+
+#include <AIS_InteractiveContext.hxx>
+#include <AIS_ListOfInteractive.hxx>
+#include <AIS_ListIteratorOfListOfInteractive.hxx>
+#include <AIS_Shape.hxx>
+#include <TopoDS_Shape.hxx>
+#include <AIS_LocalContext.hxx>
+#include <NCollection_List.hxx>
+#include <StdSelect_BRepOwner.hxx>
+#include <TColStd_ListOfInteger.hxx>
+#include <TColStd_ListIteratorOfListOfInteger.hxx>
+#endif
 
 namespace ModuleBase_Tools {
 
@@ -301,6 +318,191 @@ QString objectInfo(const ObjectPtr& theObj, const bool isUseAttributesInfo)
   return aFeatureStr;
 }
 
+#ifdef DEBUG_SELECTION_INFO
+QString getShapeTypeInfo(const int theType)
+{
+  QString anInfo = "Undefined";
+  switch(theType) {
+    case TopAbs_COMPOUND:  anInfo = "compound"; break;
+    case TopAbs_COMPSOLID: anInfo = "compsolid"; break;
+    case TopAbs_SOLID:     anInfo = "solid"; break;
+    case TopAbs_SHELL:     anInfo = "shell"; break;
+    case TopAbs_FACE:      anInfo = "face"; break;
+    case TopAbs_WIRE:      anInfo = "wire"; break;
+    case TopAbs_EDGE:      anInfo = "edge"; break;
+    case TopAbs_VERTEX:    anInfo = "vertex"; break;
+    case TopAbs_SHAPE:     anInfo = "shape"; break;
+    default: break;
+  }
+  return anInfo;
+}
+
+QString getModeInfo(const int theMode)
+{
+  QString anInfo = "Undefined";
+  switch(theMode) {
+    case 0: anInfo = "SHAPE(0)"; break;
+    case 1: anInfo = "VERTEX(1)"; break;
+    case 2: anInfo = "EDGE(2)"; break;
+    case 3: anInfo = "WIRE(3)"; break;
+    case 4: anInfo = "FACE(4)"; break;
+    case 5: anInfo = "SHELL(5)"; break;
+    case 6: anInfo = "SOLID(6)"; break;
+    case 7: anInfo = "COMPSOLID(7)"; break;
+    case 8: anInfo = "COMPOUND(8)"; break;
+    case 100: anInfo = "Sel_Mode_First(100)"; break; //SketcherPrs_Tools
+    case 101: anInfo = "Sel_Constraint(101)"; break;
+    case 102: anInfo = "Sel_Dimension_All(102)"; break;
+    case 103: anInfo = "Sel_Dimension_Line(103)"; break;
+    case 104: anInfo = "Sel_Dimension_Text(104)"; break;
+    default: break;
+  }
+  return anInfo;
+}
+
+QString displayedInteractiveObjects(Handle(AIS_InteractiveContext)& theContext,
+                                    const bool theShapeInfoOnly = true)
+{
+  if (theContext.IsNull())
+    return "";
+  AIS_ListOfInteractive aListOfIO;
+  theContext->DisplayedObjects(aListOfIO, false);
+  QStringList anObjects;
+  AIS_ListIteratorOfListOfInteractive aIt;
+  for (aIt.Initialize(aListOfIO); aIt.More(); aIt.Next()) {
+    Handle(AIS_InteractiveObject) anAISIO = aIt.Value();
+    Handle(AIS_Shape) aShapePrs = Handle(AIS_Shape)::DownCast(anAISIO);
+    if (theShapeInfoOnly && aShapePrs.IsNull())
+      continue;
+
+    QString anInfo = "IO";
+    std::ostringstream aPtrStr;
+    aPtrStr << "[" << anAISIO.Access() << "]";
+    anInfo += aPtrStr.str().c_str();
+
+    if (!aShapePrs.IsNull()) {
+      const TopoDS_Shape& aShape = aShapePrs->Shape();
+      if (aShape.IsNull())
+        Events_Error::throwException("An empty AIS presentation");
+      else
+        anInfo += QString(", shape type: %1").arg(getShapeTypeInfo(aShape.ShapeType()));
+    }
+    TColStd_ListOfInteger aTColModes;
+    theContext->ActivatedModes(anAISIO, aTColModes);
+    TColStd_ListIteratorOfListOfInteger itr( aTColModes );
+    QIntList aModesActivatedForIO;
+    bool isDeactivated = false;
+    QStringList aModes;
+    for (; itr.More(); itr.Next() ) {
+      Standard_Integer aMode = itr.Value();
+      aModes.append(getModeInfo(aMode));
+      //int aShapeMode = (aMode > 8)? aMode : AIS_Shape::SelectionType(aMode);
+    }
+    if (aModes.size() > 0)
+      anInfo += QString(", activated modes: %1").arg(aModes.join(", "));
+
+    anObjects += anInfo;
+  }
+  QString aValue = QString("displayedIO[%1]").arg(anObjects.size());
+  if (anObjects.size() > 0)
+    aValue += QString(":\n  %1").arg(anObjects.join("\n  "));
+  return aValue;
+}
+
+QString activeOwners(Handle(AIS_InteractiveContext)& theContext, const bool theShapeInfoOnly = true)
+{
+  if (theContext.IsNull())
+    return "";
+  Handle(AIS_LocalContext) aLContext = theContext->LocalContext();
+  TCollection_AsciiString aSelectionName = aLContext->SelectionName();
+  aLContext->UnhilightPicked(Standard_False);
+
+  NCollection_List<Handle(SelectBasics_EntityOwner)> anActiveOwners;
+  aLContext->MainSelector()->ActiveOwners(anActiveOwners);
+  NCollection_List<Handle(SelectBasics_EntityOwner)>::Iterator anOwnersIt (anActiveOwners);
+  Handle(SelectMgr_EntityOwner) anOwner;
+  QStringList anObjects;
+  for (; anOwnersIt.More(); anOwnersIt.Next()) {
+    anOwner = Handle(SelectMgr_EntityOwner)::DownCast (anOwnersIt.Value());
+    Handle(StdSelect_BRepOwner) BROwnr = Handle(StdSelect_BRepOwner)::DownCast(anOwner);
+    if (theShapeInfoOnly && BROwnr.IsNull())
+      continue;
+
+    QString anInfo = "Owner";
+    std::ostringstream aPtrStr;
+    aPtrStr << "[" << anOwner.Access() << "]";
+    anInfo += aPtrStr.str().c_str();
+
+    Handle(AIS_InteractiveObject) aAISObj = 
+          Handle(AIS_InteractiveObject)::DownCast(anOwner->Selectable());
+    if (!aAISObj.IsNull()) {
+      std::ostringstream aPtrStr;
+      aPtrStr << "[" << aAISObj.Access() << "]";
+      anInfo += QString(", selectable(IO): %1").arg(aPtrStr.str().c_str());
+    }
+
+    if (!BROwnr.IsNull() && BROwnr->HasShape()) {
+      const TopoDS_Shape& aShape = BROwnr->Shape();
+      if (aShape.IsNull())
+        Events_Error::throwException("An empty AIS presentation");
+      else
+        anInfo += QString(", shape type: %1").arg(getShapeTypeInfo(aShape.ShapeType()));
+    }
+    anObjects += anInfo;
+  }
+  QString aValue = QString("activeOwners[%1]").arg(anObjects.size());
+  if (anObjects.size() > 0)
+    aValue += QString(":\n  %1").arg(anObjects.join("\n  "));
+  return aValue;
+}
+
+QString selectedOwners(Handle(AIS_InteractiveContext)& theContext, const bool theShapeInfoOnly = true)
+{
+  QStringList anObjects;
+  if (theContext.IsNull())
+    return "";
+
+  QList<long> aSelectedIds; // Remember of selected address in order to avoid duplicates
+  for (theContext->InitSelected(); theContext->MoreSelected(); theContext->NextSelected()) {
+    Handle(SelectMgr_EntityOwner) anOwner = theContext->SelectedOwner();
+    Handle(StdSelect_BRepOwner) BROwnr = Handle(StdSelect_BRepOwner)::DownCast(anOwner);
+    if (theShapeInfoOnly && BROwnr.IsNull())
+      continue;
+
+    if (aSelectedIds.contains((long)anOwner.Access()))
+      continue;
+    aSelectedIds.append((long)anOwner.Access());
+
+    QString anInfo = "Owner";
+    std::ostringstream aPtrStr;
+    aPtrStr << "[" << anOwner.Access() << "]";
+    anInfo += aPtrStr.str().c_str();
+
+    if (!BROwnr.IsNull() && BROwnr->HasShape()) {
+      const TopoDS_Shape& aShape = BROwnr->Shape();
+      anInfo += QString(", shape type = %1").arg(getShapeTypeInfo(aShape.ShapeType()));
+    }
+    anObjects += anInfo;
+  }
+  QString aValue = QString("selectedOwners[%1]").arg(anObjects.size());
+  if (anObjects.size() > 0)
+    aValue += QString(":\n  %1").arg(anObjects.join("\n  "));
+  return aValue;
+}
+#endif
+
+void selectionInfo(Handle(AIS_InteractiveContext)& theContext, const std::string& thePrefix)
+{
+#ifdef DEBUG_SELECTION_INFO
+  QString aValue = QString("\n\n\nDEBUG_SELECTION_INFO for '%1'\n%2\n%3\n%4")
+                                              .arg(thePrefix.c_str())
+                                              .arg(displayedInteractiveObjects(theContext))
+                                              .arg(activeOwners(theContext))
+                                              .arg(selectedOwners(theContext));
+  qDebug(aValue.toStdString().c_str());
+#endif
+}
+
 typedef QMap<QString, TopAbs_ShapeEnum> ShapeTypes;
 static ShapeTypes myShapeTypes;
 
index b50ec66a1116581d3bef2dfe9b229f183da16085..cdc4121b13e10d486a97252b29b5afe50a4c8d53 100755 (executable)
@@ -24,6 +24,8 @@
 
 #include <map>
 
+class Handle_AIS_InteractiveContext;
+
 class QWidget;
 class QLayout;
 class QDoubleSpinBox;
@@ -140,6 +142,12 @@ MODULEBASE_EXPORT QAction* createAction(const QIcon& theIcon, const QString& the
 /// \return a string
 MODULEBASE_EXPORT QString objectInfo(const ObjectPtr& theObj, const bool isUseAttributesInfo = false);
 
+/// Converts the AIS context information in a string information.
+/// \param theContext a viewer context
+/// \param thePrefix additional information where the method is called
+MODULEBASE_EXPORT void selectionInfo(Handle_AIS_InteractiveContext& theContext,
+                                     const std::string& thePrefix);
+
 /// Converts string value (name of shape type) to shape enum value
 /// \param theType - string with shape type name
 /// \return TopAbs_ShapeEnum value
index 7102e16c03cce8ce8045d3722e2abfb0309affa5..3ede14b4d2db5ddba9b0ec7ab4d55f1c7a5af37a 100755 (executable)
 #include <gp_Pnt.hxx>
 #include <TopoDS_Vertex.hxx>
 #include <BRepBuilderAPI_MakeVertex.hxx>
+#include <BRep_Builder.hxx>
+#include <TopoDS_Compound.hxx>
 
 //#define DEBUG_EMPTY_SHAPE
+#define DEBUG_OPERATION_PRS
 
 // multi-rotation/translation operation
 //#define DEBUG_HIDE_COPY_ATTRIBUTE
@@ -58,6 +61,9 @@ IMPLEMENT_STANDARD_RTTIEXT(PartSet_OperationPrs, ViewerData_AISShape);
 PartSet_OperationPrs::PartSet_OperationPrs(ModuleBase_IWorkshop* theWorkshop)
 : ViewerData_AISShape(TopoDS_Shape()), myWorkshop(theWorkshop), myUseAISWidth(false)
 {
+#ifdef DEBUG_OPERATION_PRS
+  qDebug("PartSet_OperationPrs::PartSet_OperationPrs");
+#endif
   myShapeColor = Quantity_Color(1, 1, 1, Quantity_TOC_RGB);
 
   // first presentation for having correct Compute until presentation with shapes are set
@@ -86,6 +92,10 @@ void PartSet_OperationPrs::Compute(const Handle(PrsMgr_PresentationManager3d)& t
                                    const Handle(Prs3d_Presentation)& thePresentation, 
                                    const Standard_Integer theMode)
 {
+#ifdef DEBUG_OPERATION_PRS
+  qDebug("PartSet_OperationPrs::Compute -- begin");
+#endif
+
   SetColor(myShapeColor);
   thePresentation->Clear();
   bool aReadyToDisplay = !myShapeToPrsMap.IsEmpty();
@@ -93,9 +103,13 @@ void PartSet_OperationPrs::Compute(const Handle(PrsMgr_PresentationManager3d)& t
   XGUI_Displayer* aDisplayer = XGUI_Tools::workshop(myWorkshop)->displayer();
   Handle(Prs3d_Drawer) aDrawer = Attributes();
   // create presentations on the base of the shapes
+  BRep_Builder aBuilder;
+  TopoDS_Compound aComp;
+  aBuilder.MakeCompound(aComp);
   for(NCollection_DataMap<TopoDS_Shape, Handle(AIS_InteractiveObject)>::Iterator anIter(myShapeToPrsMap);
       anIter.More(); anIter.Next()) {
     const TopoDS_Shape& aShape = anIter.Key();
+    aBuilder.Add(aComp, aShape);
     // change deviation coefficient to provide more precise circle
     ModuleBase_Tools::setDefaultDeviationCoefficient(aShape, aDrawer);
 
@@ -113,13 +127,16 @@ void PartSet_OperationPrs::Compute(const Handle(PrsMgr_PresentationManager3d)& t
     }
     StdPrs_WFDeflectionShape::Add(thePresentation, aShape, aDrawer);
   }
-
+  Set(aComp);
   if (!aReadyToDisplay) {
     Events_Error::throwException("An empty AIS presentation: PartSet_OperationPrs");
     std::shared_ptr<Events_Message> aMsg = std::shared_ptr<Events_Message>(
                 new Events_Message(Events_Loop::eventByName(EVENT_EMPTY_OPERATION_PRESENTATION)));
     Events_Loop::loop()->send(aMsg);
   }
+#ifdef DEBUG_OPERATION_PRS
+  qDebug("PartSet_OperationPrs::Compute -- end");
+#endif
 }
 
 void PartSet_OperationPrs::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
index 1a07384b7fa79a6b0f58f12322f1cd4f67b65fd7..49b111759ae47707395f05f6c5a29ed1e2d20d71 100755 (executable)
@@ -37,6 +37,7 @@
 #include <ModuleBase_Operation.h>
 #include <ModuleBase_WidgetEditor.h>
 #include <ModuleBase_ViewerPrs.h>
+#include <ModuleBase_Tools.h>
 
 #include <GeomDataAPI_Point2D.h>
 
@@ -386,6 +387,7 @@ void PartSet_SketcherMgr::onMousePressed(ModuleBase_IViewWindow* theWnd, QMouseE
     if (!aContext.IsNull()) {
       // MoveTo in order to highlight current object
       aContext->MoveTo(theEvent->x(), theEvent->y(), theWnd->v3dView());
+      ModuleBase_Tools::selectionInfo(aContext, "PartSet_SketcherMgr::onMousePressed -- MoveTo");
     }
     // Remember highlighted objects for editing
     ModuleBase_ISelection* aSelect = aWorkshop->selection();
index 2b3b043e43e6ea506b533149e2a585c6befcd0ec..95d58996690c83bd5a5147984df7d7556a5b64d0 100644 (file)
@@ -260,6 +260,7 @@ bool XGUI_Displayer::erase(ObjectPtr theObject, const bool theUpdateViewer)
     if (!anAIS.IsNull()) {
       emit beforeObjectErase(theObject, anObject);
       aContext->Remove(anAIS, false/*update viewer*/);
+      ModuleBase_Tools::selectionInfo(aContext, "XGUI_Displayer::erase -- Remove");
       aErased = true;
     }
   }
@@ -346,6 +347,8 @@ bool XGUI_Displayer::redisplay(ObjectPtr theObject, bool theUpdateViewer)
         aContext->Deactivate(aAISIO, 0);
 #endif
 
+      ModuleBase_Tools::selectionInfo(aContext, "XGUI_Displayer::redisplay -- Redisplay");
+
       if (aNeedToRestoreSelection)
         myWorkshop->module()->restoreSelection();
 
@@ -390,6 +393,7 @@ void XGUI_Displayer::deactivate(ObjectPtr theObject, const bool theUpdateViewer)
     deactivateAIS(anAIS);
     // the selection from the previous activation modes should be cleared manually (#26172)
     aContext->LocalContext()->ClearOutdatedSelection(anAIS, true);
+    ModuleBase_Tools::selectionInfo(aContext, "XGUI_Displayer::deactivate -- ClearOutdatedSelection");
     if (theUpdateViewer)
       updateViewer();
   }
@@ -631,7 +635,7 @@ void XGUI_Displayer::setSelected(const  QList<ModuleBase_ViewerPrsPtr>& theValue
     }
     if (!aShapesToBeSelected.IsEmpty())
       XGUI_Displayer::AddOrRemoveSelectedShapes(aContext, aShapesToBeSelected);
-  } else {
+  } else { // it seems the next code is obsolete as the context is always opened in SHAPER
     aContext->UnhilightCurrents(false);
     aContext->ClearCurrents(false);
     foreach (ModuleBase_ViewerPrsPtr aPrs, theValues) {
@@ -645,6 +649,7 @@ void XGUI_Displayer::setSelected(const  QList<ModuleBase_ViewerPrsPtr>& theValue
       }
     }
   }
+  ModuleBase_Tools::selectionInfo(aContext, "XGUI_Displayer::setSelected -- AddOrRemoveSelected/UnhilightCurrents(no local context)");
   if (theUpdateViewer)
     updateViewer();
 }
@@ -676,6 +681,7 @@ bool XGUI_Displayer::eraseAll(const bool theUpdateViewer)
     if (theUpdateViewer)
       updateViewer();
   }
+  ModuleBase_Tools::selectionInfo(aContext, "XGUI_Displayer::eraseAll -- Remove");
   myResult2AISObjectMap.clear();
 #ifdef DEBUG_DISPLAY
   qDebug("eraseAll");
@@ -690,6 +696,7 @@ void deactivateObject(Handle(AIS_InteractiveContext) theContext,
 {
   if (!theObject.IsNull()) {
     theContext->Deactivate(theObject);
+    ModuleBase_Tools::selectionInfo(theContext, "XGUI_Displayer::deactivateObject -- Deactivate");
     //if (theClear) {
       //theObject->ClearSelected();
       //  theContext->LocalContext()->ClearOutdatedSelection(theObject, true);
@@ -891,6 +898,8 @@ void XGUI_Displayer::activateAIS(const Handle(AIS_InteractiveObject)& theIO,
     } else
       aContext->Activate(theIO, theMode, false);
 
+    ModuleBase_Tools::selectionInfo(aContext, "XGUI_Displayer::activateAIS -- Activate");
+
 #ifdef DEBUG_ACTIVATE_AIS
     ObjectPtr anObject = getObject(theIO);
     anInfo.append(ModuleBase_Tools::objectInfo((*anIt)));
@@ -909,6 +918,7 @@ void XGUI_Displayer::deactivateAIS(const Handle(AIS_InteractiveObject)& theIO, c
       aContext->Deactivate(theIO);
     else 
       aContext->Deactivate(theIO, theMode);
+    ModuleBase_Tools::selectionInfo(aContext, "XGUI_Displayer::deactivateAIS -- Deactivate");
    
 #ifdef DEBUG_DEACTIVATE_AIS
     ObjectPtr anObject = getObject(theIO);
@@ -977,6 +987,7 @@ bool XGUI_Displayer::eraseAIS(AISObjectPtr theAIS, const bool theUpdateViewer)
     Handle(AIS_InteractiveObject) anAISIO = theAIS->impl<Handle(AIS_InteractiveObject)>();
     if (!anAISIO.IsNull() && aContext->IsDisplayed(anAISIO)) {
       aContext->Remove(anAISIO, false/*update viewer*/);
+      ModuleBase_Tools::selectionInfo(aContext, "XGUI_Displayer::eraseAIS -- Remove");
       aErased = true;
     }
   }
@@ -1171,6 +1182,7 @@ bool XGUI_Displayer::activate(const Handle(AIS_InteractiveObject)& theIO,
     // the selection from the previous activation modes should be cleared manually (#26172)
     theIO->ClearSelected();
     aContext->LocalContext()->ClearOutdatedSelection(theIO, true);
+    ModuleBase_Tools::selectionInfo(aContext, "XGUI_Displayer::activate -- ClearSelected/ClearOutdatedSelection");
     // For performance issues
     //if (theUpdateViewer)
     //  updateViewer();
index 8bc012412bb24d5698abd829cfc058d8c4b1709a..0d9b701f69cc71de1a2377c56eadfd91c1d533f5 100755 (executable)
@@ -22,6 +22,7 @@
 #include <ModelAPI_ResultCompSolid.h>
 
 #include <ModuleBase_ViewerPrs.h>
+#include <ModuleBase_Tools.h>
 
 #include <SelectMgr_ListIteratorOfListOfFilter.hxx>
 
@@ -64,6 +65,7 @@ void XGUI_SelectionMgr::setSelectedOwners(const SelectMgr_IndexedMapOfOwner& the
       aContext->AddOrRemoveSelected(anOwner, isUpdateViewer);
     }
   }
+  ModuleBase_Tools::selectionInfo(aContext, "XGUI_SelectionMgr::setSelectedOwners -- AddOrRemoveSelected");
 }
 
 //**************************************************************