Salome HOME
Compsolid visualization debug.
authornds <natalia.donis@opencascade.com>
Wed, 19 Aug 2015 07:35:36 +0000 (10:35 +0300)
committernds <natalia.donis@opencascade.com>
Wed, 19 Aug 2015 07:36:08 +0000 (10:36 +0300)
src/PartSet/PartSet_Module.cpp
src/XGUI/XGUI_WorkshopListener.cpp

index c4410ee7514d49f9a49c225547aab1708d9b9ec3..af416570fbdbd610607ceaf1f78f2ed3c765ce44 100644 (file)
@@ -4,7 +4,6 @@
 #include "PartSet_WidgetSketchLabel.h"
 #include "PartSet_Validators.h"
 #include "PartSet_Tools.h"
-#include "ModuleBase_WidgetValidated.h"
 #include "PartSet_WidgetPoint2d.h"
 #include "PartSet_WidgetPoint2dDistance.h"
 #include "PartSet_WidgetShapeSelector.h"
@@ -30,6 +29,7 @@
 #include <ModuleBase_IViewWindow.h>
 #include <ModuleBase_IPropertyPanel.h>
 #include <ModuleBase_WidgetEditor.h>
+#include <ModuleBase_WidgetValidated.h>
 #include <ModuleBase_FilterFactory.h>
 #include <ModuleBase_Tools.h>
 #include <GeomValidators_ShapeType.h>
@@ -48,6 +48,7 @@
 #include <ModelAPI_Session.h>
 #include <ModelAPI_ShapeValidator.h>
 #include <ModelAPI_ResultBody.h>
+#include <ModelAPI_ResultCompSolid.h>
 
 #include <GeomDataAPI_Point2D.h>
 #include <GeomDataAPI_Point.h>
 #include <QDebug>
 #endif
 
+//#define DEBUG_COMPOSOLID
 
 
 /*!Create and return new instance of XGUI_Module*/
@@ -357,6 +359,13 @@ bool PartSet_Module::canCommitOperation() const
 
 bool PartSet_Module::canDisplayObject(const ObjectPtr& theObject) const
 {
+#ifdef DEBUG_COMPOSOLID
+  ResultCompSolidPtr aCompSolid = std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>
+                                                                         (theObject);
+  if (aCompSolid.get() && aCompSolid->numberOfSubs() > 0)
+    return false;
+#endif
+
   // the sketch manager put the restriction to the objects display
   return mySketchMgr->canDisplayObject(theObject);
 }
index 27054bd3dcd80ec9f9dbfa5150047a187149b9a7..bc201061f9484ad4ba82eb40ac9b131e6f63a106 100755 (executable)
@@ -26,6 +26,7 @@
 #include <ModelAPI_Feature.h>
 #include <ModelAPI_Data.h>
 #include <ModelAPI_ResultBody.h>
+#include <ModelAPI_ResultCompSolid.h>
 
 #include <Events_Loop.h>
 #include <Events_Error.h>
@@ -53,6 +54,7 @@
 #include <iostream>
 #endif
 
+//#define DEBUG_CANDISPLAY
 //#define DEBUG_FEATURE_CREATED
 //#define DEBUG_FEATURE_REDISPLAY
 
@@ -239,21 +241,28 @@ void XGUI_WorkshopListener::onFeatureRedisplayMsg(const std::shared_ptr<ModelAPI
       ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(aObj);
       aHide = aRes && aRes->isConcealed();
     }
-    if (aHide)
+    if (aHide) {
       aDisplayer->erase(aObj, false);
+      #ifdef DEBUG_FEATURE_REDISPLAY
+        // Redisplay the visible object or the object of the current operation
+        bool isVisibleObject = aDisplayer->isVisible(aObj);
+
+        QString anObjInfo = ModuleBase_Tools::objectInfo((aObj));
+        qDebug(QString("visible=%1 : erase  = %2").arg(isVisibleObject).arg(anObjInfo).toStdString().c_str());
+      #endif
+    }
     else {
       // Redisplay the visible object or the object of the current operation
       bool isVisibleObject = aDisplayer->isVisible(aObj);
       #ifdef DEBUG_FEATURE_REDISPLAY
-      QString anObjInfo = ModuleBase_Tools::objectInfo((aObj));
-      qDebug(QString("visible=%1 : display= %2").arg(isVisibleObject).arg(anObjInfo).toStdString().c_str());
-
-      FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObj);
-      if (aFeature.get()) {
-        std::string aKind = aFeature->getKind();
-        if (aKind == "SketchMultiRotation")
-          bool aValue = true;
-      }
+        QString anObjInfo = ModuleBase_Tools::objectInfo((aObj));
+        qDebug(QString("visible=%1 : display= %2").arg(isVisibleObject).arg(anObjInfo).toStdString().c_str());
+        /*FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObj);
+        if (aFeature.get()) {
+          std::string aKind = aFeature->getKind();
+          if (aKind == "SketchMultiRotation")
+            bool aValue = true;
+        }*/
       #endif
 
       if (isVisibleObject)  { // redisplay visible object
@@ -261,6 +270,12 @@ void XGUI_WorkshopListener::onFeatureRedisplayMsg(const std::shared_ptr<ModelAPI
         // in order to avoid the check whether the object can be redisplayed, the exact method
         // of redisplay is called. This modification is made in order to have the line is updated
         // by creation of a horizontal constraint on the line by preselection
+        /*ResultCompSolidPtr aCompSolid = std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>
+                                                                                   (aObj);
+        if (aCompSolid.get() && aCompSolid->numberOfSubs() > 0) {
+          aDisplayer->erase(aObj, false);
+        }*/
+
         aDisplayer->redisplay(aObj, false);
         // Deactivate object of current operation from selection
         aWorkshop->deactivateActiveObject(aObj, false);
@@ -301,9 +316,15 @@ void XGUI_WorkshopListener::onFeatureCreatedMsg(const std::shared_ptr<ModelAPI_O
     if (!aHide) {
       // setDisplayed has to be called in order to synchronize internal state of the object 
       // with list of displayed objects
+#ifdef DEBUG_CANDISPLAY
+      if (displayObject(anObject)/*myWorkshop->module()->canDisplayObject(anObject)*/) {
+        anObject->setDisplayed(true);
+        //isDisplayed = displayObject(anObject);
+#else
       if (myWorkshop->module()->canDisplayObject(anObject)) {
         anObject->setDisplayed(true);
-        isDisplayed = displayObject(*aIt);
+        isDisplayed = displayObject(anObject);
+#endif
       } else 
         anObject->setDisplayed(false);
     }