]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Remove selection debug information as this information is available through VInspecto...
authornds <nds@opencascade.com>
Mon, 12 Dec 2016 10:14:30 +0000 (13:14 +0300)
committernds <nds@opencascade.com>
Mon, 12 Dec 2016 10:14:30 +0000 (13:14 +0300)
src/ModuleBase/ModuleBase_FilterValidated.cpp
src/ModuleBase/ModuleBase_Tools.cpp
src/ModuleBase/ModuleBase_Tools.h
src/XGUI/XGUI_Displayer.cpp
src/XGUI/XGUI_SelectionMgr.cpp

index 21fe81e3a746e803c41ab3a546310c81d02b0332..2a9debb0bdd38f9a1acddef00d820775fcf51bce 100644 (file)
@@ -29,8 +29,6 @@ Standard_Boolean ModuleBase_FilterValidated::
     ModuleBase_IViewer* aViewer = myWorkshop->viewer();
     Handle(AIS_InteractiveContext) aContext = aViewer->AISContext();
 
-    ModuleBase_Tools::selectionInfo(aContext, "ModuleBase_FilterValidated::IsOk");
-
     ModuleBase_IPropertyPanel* aPanel = anOperation->propertyPanel();
     ModuleBase_ModelWidget* aCurrentWidget = aPanel->preselectionWidget();
     if (!aCurrentWidget)
index 41b19a1f4d5c6600bbeaa4d8d6a24f63f853d2cc..0114238db64c52e8c18e35f2d88954a3a2bb71e3 100755 (executable)
@@ -73,23 +73,6 @@ const double DEFAULT_DEVIATION_COEFFICIENT = 1.e-4;
 
 //#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
 
 #ifdef WIN32
 # define FSEP "\\"
@@ -327,196 +310,6 @@ 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;
-    case ModuleBase_ResultPrs::Sel_Result:
-                           anInfo = "result_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, int> ShapeTypes;
 static ShapeTypes myShapeTypes;
 
index ab5b63073466ece1c3f9187527356f72f12f75c9..fedc9d206f91da115ae12c291468ef59a4fc6db2 100755 (executable)
@@ -133,18 +133,14 @@ MODULEBASE_EXPORT QAction* createAction(const QIcon& theIcon, const QString& the
                                         const QString& theToolTip = QString(),
                                         const QString& theStatusTip = QString());
 
+//#ifdef _DEBUG
 /// Converts the object to the feature or a result and generate information string
 /// \param theObj an object
 /// \param isUseAttributesInfo a flag whether the attribute values information is used
 /// \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);
+//#endif
 
 /// Converts string value (name of shape type) to shape enum value
 /// \param theType - string with shape type name
index 15d4e4b7891f863ff07a9a97da33f5ec1ce5baa8..d7f38e04d5b231e113c7293729dc8ffc641f82a5 100644 (file)
@@ -288,7 +288,6 @@ bool XGUI_Displayer::erase(ObjectPtr theObject, const bool theUpdateViewer)
       #ifdef VINSPECTOR
       if (myContextCallBack) myContextCallBack->Remove(anAIS);
       #endif
-      ModuleBase_Tools::selectionInfo(aContext, "XGUI_Displayer::erase -- Remove");
       aErased = true;
     }
   }
@@ -379,7 +378,6 @@ bool XGUI_Displayer::redisplay(ObjectPtr theObject, bool theUpdateViewer)
       #ifdef VINSPECTOR
       if (myContextCallBack) myContextCallBack->Redisplay(aAISIO);
       #endif
-      ModuleBase_Tools::selectionInfo(aContext, "XGUI_Displayer::redisplay -- Redisplay");
 
       if (aNeedToRestoreSelection)
         myWorkshop->module()->restoreSelection();
@@ -428,8 +426,6 @@ void XGUI_Displayer::deactivate(ObjectPtr theObject, const bool theUpdateViewer)
     #ifdef VINSPECTOR
     if (myContextCallBack) myContextCallBack->ClearOutdatedSelection(anAIS);
     #endif
-    ModuleBase_Tools::selectionInfo(aContext,
-      "XGUI_Displayer::deactivate -- ClearOutdatedSelection");
     if (theUpdateViewer)
       updateViewer();
   }
@@ -707,8 +703,6 @@ void XGUI_Displayer::setSelected(const  QList<ModuleBase_ViewerPrsPtr>& theValue
       }
     }
   }
-  ModuleBase_Tools::selectionInfo(aContext,
-    "XGUI_Displayer::setSelected -- AddOrRemoveSelected/UnhilightCurrents(no local context)");
   if (theUpdateViewer)
     updateViewer();
 }
@@ -746,7 +740,6 @@ 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");
@@ -767,7 +760,6 @@ void deactivateObject(Handle(AIS_InteractiveContext) theContext,
     #ifdef VINSPECTOR
     if (theCallBack) theCallBack->Deactivate(theObject);
     #endif
-    ModuleBase_Tools::selectionInfo(theContext, "XGUI_Displayer::deactivateObject -- Deactivate");
     //if (theClear) {
       //theObject->ClearSelected();
       //  theContext->LocalContext()->ClearOutdatedSelection(theObject, true);
@@ -1023,7 +1015,6 @@ void XGUI_Displayer::activateAIS(const Handle(AIS_InteractiveObject)& theIO,
                                                               "edge-selection-sensitivity", 2);
       aContext->SetSelectionSensitivity(theIO, theMode, aPrecision);
     }
-    ModuleBase_Tools::selectionInfo(aContext, "XGUI_Displayer::activateAIS -- Activate");
 
 #ifdef DEBUG_ACTIVATE_AIS
     ObjectPtr anObject = getObject(theIO);
@@ -1053,7 +1044,6 @@ void XGUI_Displayer::deactivateAIS(const Handle(AIS_InteractiveObject)& theIO,
       if (myContextCallBack) myContextCallBack->Deactivate(theIO, theMode);
       #endif
     }
-    ModuleBase_Tools::selectionInfo(aContext, "XGUI_Displayer::deactivateAIS -- Deactivate");
 
 #ifdef DEBUG_DEACTIVATE_AIS
     ObjectPtr anObject = getObject(theIO);
@@ -1135,7 +1125,6 @@ bool XGUI_Displayer::eraseAIS(AISObjectPtr theAIS, const bool theUpdateViewer)
       #ifdef VINSPECTOR
       if (myContextCallBack) myContextCallBack->Remove(anAISIO);
       #endif
-      ModuleBase_Tools::selectionInfo(aContext, "XGUI_Displayer::eraseAIS -- Remove");
       aErased = true;
     }
   }
@@ -1341,8 +1330,6 @@ bool XGUI_Displayer::activate(const Handle(AIS_InteractiveObject)& theIO,
     #ifdef VINSPECTOR
     if (myContextCallBack) myContextCallBack->ClearOutdatedSelection(theIO);
     #endif
-    ModuleBase_Tools::selectionInfo(aContext,
-            "XGUI_Displayer::activate -- ClearSelected/ClearOutdatedSelection");
     // For performance issues
     //if (theUpdateViewer)
     //  updateViewer();
index 894198d3dc5e0a8ddd4ea0e7baa5d238c35af70b..d126f49ced8fd49a5cc3527160d5f2e8524560b3 100755 (executable)
@@ -73,8 +73,6 @@ void XGUI_SelectionMgr::setSelectedOwners(const SelectMgr_IndexedMapOfOwner& the
       #endif
     }
   }
-  ModuleBase_Tools::selectionInfo(aContext,
-                                  "XGUI_SelectionMgr::setSelectedOwners -- AddOrRemoveSelected");
 }
 
 //**************************************************************