]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #2156 Impossible to valid the sketch: better debug information about store...
authornds <nds@opencascade.com>
Thu, 11 May 2017 06:49:09 +0000 (09:49 +0300)
committernds <nds@opencascade.com>
Thu, 11 May 2017 06:49:32 +0000 (09:49 +0300)
src/ModuleBase/ModuleBase_Tools.cpp
src/ModuleBase/ModuleBase_Tools.h
src/XGUI/XGUI_OperationMgr.cpp

index 53ee5334769371849e24d90a0e1a81ee7ed454e6..c505732941a6984b43cc223c2269e7a34b7f6ec8 100755 (executable)
@@ -267,6 +267,14 @@ QAction* createAction(const QIcon& theIcon, const QString& theText,
 }
 
 #ifdef _DEBUG
+QString objectName(const ObjectPtr& theObj)
+{
+  if (!theObj.get())
+    return "";
+
+  return theObj->data()->name().c_str();
+}
+
 QString objectInfo(const ObjectPtr& theObj, const bool isUseAttributesInfo)
 {
   QString aFeatureStr = "feature";
index 5b9e658d0a8e9fbc63f4985378e543641aa6c302..c99254696d4be43fa98d060ca7cb29bd0bea869b 100755 (executable)
@@ -132,6 +132,11 @@ MODULEBASE_EXPORT QAction* createAction(const QIcon& theIcon, const QString& the
                                         const QString& theStatusTip = QString());
 
 #ifdef _DEBUG
+/// Returns name of data of the object if it is not NULL
+/// \param theObj an object
+/// \return a string
+MODULEBASE_EXPORT QString objectName(const ObjectPtr& theObj);
+
 /// 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
index 61adc99ea80937249f3c07a803ca494ad3c98561..ac99247118721ec8df39363c731c581975ab0851 100644 (file)
@@ -351,6 +351,12 @@ void XGUI_OperationMgr::setCurrentFeature(const FeaturePtr& theFeature)
     aMgr->startOperation(QString("Set current feature: %1")
     .arg(theFeature->getKind().c_str()).toStdString());
   aDoc->setCurrentFeature(theFeature, false);
+#ifdef DEBUG_CURRENT_FEATURE
+  qDebug(QString("   document->setCurrentFeature(false) = %1    SET").arg(
+         ModuleBase_Tools::objectName(
+         ModelAPI_Session::get()->activeDocument()->currentFeature(false))).toStdString().c_str());
+#endif
+
   if (!aIsOp)
     aMgr->finishOperation();
 }
@@ -456,12 +462,12 @@ void XGUI_OperationMgr::onBeforeOperationStarted()
 #ifdef DEBUG_CURRENT_FEATURE
     FeaturePtr aFeature = aFOperation->feature();
     QString aKind = aFeature ? aFeature->getKind().c_str() : "";
-    qDebug(QString("onBeforeOperationStarted(), edit operation = %1, feature = %2")
+    qDebug("");
+    qDebug(QString("onBeforeOperationStarted() isEditOperation = %1, feature = %2")
             .arg(aFOperation->isEditOperation())
-            .arg(ModuleBase_Tools::objectInfo(aFeature)).toStdString().c_str());
-
-    qDebug(QString("\tdocument->currentFeature(false) = %1").arg(
-            ModuleBase_Tools::objectInfo(
+            .arg(ModuleBase_Tools::objectName(aFeature)).toStdString().c_str());
+    qDebug(QString("   document->currentFeature(false) = %1 : DO: setPreviousCurrentFeature").arg(
+            ModuleBase_Tools::objectName(
             ModelAPI_Session::get()->activeDocument()->currentFeature(false)))
             .toStdString().c_str());
 #endif
@@ -469,6 +475,11 @@ void XGUI_OperationMgr::onBeforeOperationStarted()
     if (aFOperation->isEditOperation()) {// it should be performed by the feature edit only
       // in create operation, the current feature is changed by addFeature()
       aDoc->setCurrentFeature(aFOperation->feature(), false);
+#ifdef DEBUG_CURRENT_FEATURE
+      qDebug(QString("   document->setCurrentFeature(false) = %1").arg(
+             ModuleBase_Tools::objectName(
+             ModelAPI_Session::get()->activeDocument()->currentFeature(false))).toStdString().c_str());
+#endif
       // this is the only place where flushes must be called after setCurrentFeature for the
       // current moment: after this the opertion is not finished, so, the ObjectBrowser
       // state may be corrupted (issue #1457)
@@ -478,14 +489,6 @@ void XGUI_OperationMgr::onBeforeOperationStarted()
       static Events_ID aDeleteEvent = aLoop->eventByName(EVENT_OBJECT_DELETED);
       aLoop->flush(aDeleteEvent);
     }
-
-#ifdef DEBUG_CURRENT_FEATURE
-    qDebug("\tdocument->setCurrentFeature");
-    qDebug(QString("\tdocument->currentFeature(false) = %1").arg(
-            ModuleBase_Tools::objectInfo(
-            ModelAPI_Session::get()->activeDocument()->currentFeature(false)))
-            .toStdString().c_str());
-#endif
   }
 }
 
@@ -520,12 +523,11 @@ void XGUI_OperationMgr::onBeforeOperationCommitted()
   if (aFOperation) {
 #ifdef DEBUG_CURRENT_FEATURE
     QString aKind = aFOperation->feature()->getKind().c_str();
-    qDebug(QString("onBeforeOperationCommitted(), edit operation = %1, feature = %2")
+    qDebug(QString("onBeforeOperationCommitted() isEditOperation = %1, feature = %2")
             .arg(aFOperation->isEditOperation())
-            .arg(ModuleBase_Tools::objectInfo(aFOperation->feature())).toStdString().c_str());
-
-    qDebug(QString("\tdocument->currentFeature(false) = %1").arg(
-            ModuleBase_Tools::objectInfo(
+            .arg(ModuleBase_Tools::objectName(aFOperation->feature())).toStdString().c_str());
+    qDebug(QString("   document->currentFeature(false) = %1").arg(
+            ModuleBase_Tools::objectName(
             ModelAPI_Session::get()->activeDocument()->currentFeature(false)))
             .toStdString().c_str());
 #endif
@@ -543,13 +545,6 @@ void XGUI_OperationMgr::onBeforeOperationCommitted()
       if (myOperations.front() != aFOperation)
         setCurrentFeature(aFOperation->previousCurrentFeature());
     }
-#ifdef DEBUG_CURRENT_FEATURE
-    qDebug("\tdocument->setCurrentFeature");
-    qDebug(QString("\tdocument->currentFeature(false) = %1").arg(
-           ModuleBase_Tools::objectInfo(
-           ModelAPI_Session::get()->activeDocument()->currentFeature(false)))
-           .toStdString().c_str());
-#endif
     ModuleBase_IModule* aModule = myWorkshop->module();
     if (aModule)
       aModule->beforeOperationStopped(aFOperation);