Salome HOME
The bug about sketch sub-entities with constraints visualized after open a document.
authornds <natalia.donis@opencascade.com>
Thu, 2 Apr 2015 14:07:49 +0000 (17:07 +0300)
committernds <natalia.donis@opencascade.com>
Thu, 2 Apr 2015 14:07:49 +0000 (17:07 +0300)
src/PartSet/PartSet_Module.cpp
src/PartSet/PartSet_SketcherMgr.cpp

index f62c677a27b352e96ede8d12f2f7b523d5b90a8b..be788bd5a89253f0b1c3ab76528bc7d41abb5e8b 100644 (file)
@@ -280,14 +280,8 @@ bool PartSet_Module::canRedo() const
 
 bool PartSet_Module::canDisplayObject(const ObjectPtr& theObject) const
 {
-  // the display should be possible almost always, with exception of some specific cases
-
-  bool aCanDisplay = true;
-
-  if (mySketchMgr->activeSketch()) {
-    aCanDisplay = mySketchMgr->canDisplayObject(theObject);
-  }
-  return aCanDisplay;
+  // the sketch manager put the restriction to the objects display
+  return mySketchMgr->canDisplayObject(theObject);
 }
 
 bool PartSet_Module::addViewerItems(QMenu* theMenu, const QMap<QString, QAction*>& theStdActions) const
index 10a008fee15c704a0984a6c693dbbedf449301ed..05cf9b550dc68ebb35a7d272212e2a4899e98d69 100644 (file)
@@ -776,42 +776,45 @@ bool PartSet_SketcherMgr::canRedo() const
 bool PartSet_SketcherMgr::canDisplayObject(const ObjectPtr& theObject) const
 {
   bool aCanDisplay = true;
-  // 1. the sketch feature should not be displayed during the sketch active operation
-  // it is hidden by a sketch operation start and shown by a sketch stop, just the sketch 
-  // nested features can be visualized
-  CompositeFeaturePtr aSketchFeature = activeSketch();
-  if (aSketchFeature.get() != NULL) {
+
+  bool aHasActiveSketch = activeSketch().get() != NULL;
+  if (aHasActiveSketch) {
+    // 1. the sketch feature should not be displayed during the sketch active operation
+    // it is hidden by a sketch operation start and shown by a sketch stop, just the sketch 
+    // nested features can be visualized
     FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
-    if (aFeature.get() != NULL && aFeature == aSketchFeature)
+    if (aFeature.get() != NULL && aFeature == activeSketch())
       aCanDisplay = false;
   }
-  // 2. For created nested feature operation do not display the created feature if
+  else { // there are no an active sketch
+    // 2. sketch sub-features should not visualized if the sketch operatio is not active
+    FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
+    if (aFeature.get() != NULL) {
+      std::shared_ptr<SketchPlugin_Feature> aSketchFeature =
+                              std::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
+      if (aSketchFeature.get() == NULL)
+        aCanDisplay = false;
+    }
+  }
+
+  // 3. For created nested feature operation do not display the created feature if
   // the mouse curstor leaves the OCC window.
   // The correction cases, which ignores this condition:
   // a. the property panel values modification
   // b. the popup menu activated
   // c. widget editor control
-  if (aCanDisplay) {
-    if (!isNestedCreateOperation(getCurrentOperation()))
-      return aCanDisplay;
-
+  if (aCanDisplay && isNestedCreateOperation(getCurrentOperation())) {
     ModuleBase_Operation* aOperation = getCurrentOperation();
     ModuleBase_IPropertyPanel* aPanel = aOperation->propertyPanel();
     ModuleBase_ModelWidget* anActiveWdg = aPanel ? aPanel->activeWidget() : 0;
+    ModuleBase_WidgetEditor* anEditorWdg = anActiveWdg ? dynamic_cast<ModuleBase_WidgetEditor*>(anActiveWdg) : 0;
     // the active widget editor should not influence here. The presentation should be visible always
     // when this widget is active.
-    if (anActiveWdg) {
-      ModuleBase_WidgetEditor* anEditorWdg = dynamic_cast<ModuleBase_WidgetEditor*>(anActiveWdg);
-      if (anEditorWdg) {
-        return aCanDisplay;
-      }
+    if (!anEditorWdg && !myIsPopupMenuActive) {
+      // during a nested create operation, the feature is redisplayed only if the mouse over view
+      // of there was a value modified in the property panel after the mouse left the view
+      aCanDisplay = myIsPropertyPanelValueChanged || myIsMouseOverWindow;
     }
-    if (myIsPopupMenuActive)
-      return aCanDisplay;
-
-    // during a nested create operation, the feature is redisplayed only if the mouse over view
-    // of there was a value modified in the property panel after the mouse left the view
-    aCanDisplay = myIsPropertyPanelValueChanged || myIsMouseOverWindow;
   }
   return aCanDisplay;
 }