Salome HOME
1. Projection should be hidden in the viewer. Incorrect case:
authornds <nds@opencascade.com>
Thu, 5 May 2016 09:29:04 +0000 (12:29 +0300)
committernds <nds@opencascade.com>
Thu, 5 May 2016 09:29:33 +0000 (12:29 +0300)
create sketch with line/arc;
create new sketch in another plane, build projection of a line from the first sketch;
create a line in the 2nd sketch, Apply
edit 2nd sketch, create coincidence between line of projection feature and point of the sketch line
Error: crash in solver
2. Action button should not accept focus.

src/ModuleBase/ModuleBase_WidgetAction.cpp
src/ModuleBase/ModuleBase_WidgetAction.h
src/PartSet/PartSet_SketcherMgr.cpp
src/SketchPlugin/SketchPlugin_Feature.h
src/SketchPlugin/SketchPlugin_Projection.h

index c9cffda3158404a4df56651b506c49c9e4aa3f3f..b0206a5a5a0921e924ee2dccbe4e35e3fb08ea47 100755 (executable)
@@ -48,6 +48,11 @@ ModuleBase_WidgetAction::~ModuleBase_WidgetAction()
 {
 }
 
+bool ModuleBase_WidgetAction::focusTo()
+{
+  return false;
+}
+
 QList<QWidget*> ModuleBase_WidgetAction::getControls() const
 {
   QList<QWidget*> aList;
index 1e801b7e23c8994474ea39eb1e5b6bbadadef13d..b6e8b72f0614e427f1e71b64f9e73da38beec85a 100755 (executable)
@@ -29,6 +29,9 @@ Q_OBJECT
 
   virtual ~ModuleBase_WidgetAction();
 
+  /// Do not accept focus, returns false
+  virtual bool focusTo();
+
   /// Returns list of widget controls
   /// \return a control list
   virtual QList<QWidget*> getControls() const;
index c897b72b5e1a240e992b5ed9f51aa2546291d8a0..c6746b0cd3b79cda4df7b8ad20e7ebd6f85b04a3 100755 (executable)
@@ -1092,6 +1092,11 @@ bool PartSet_SketcherMgr::canDisplayObject(const ObjectPtr& theObject) const
     if (aFeature.get() != NULL && aFeature == activeSketch()) {
       aCanDisplay = false;
     }
+    std::shared_ptr<SketchPlugin_Feature> aSketchFeature =
+                            std::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
+    /// some sketch entities should be never shown, e.g. projection feature
+    if (aSketchFeature.get())
+      aCanDisplay = aSketchFeature->canBeDisplayed();
   }
   else { // there are no an active sketch
     // 2. sketch sub-features should not be visualized if the sketch operation is not active
@@ -1107,43 +1112,45 @@ bool PartSet_SketcherMgr::canDisplayObject(const ObjectPtr& theObject) const
 
   // 3. the method should not filter the objects, which are not related to the current operation.
   // The object is filtered just if it is a current operation feature or this feature result
-  bool isObjectFound = false;
-  ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
-                                                               (getCurrentOperation());
-  if (aFOperation) {
-    FeaturePtr aFeature = aFOperation->feature();
-    if (aFeature.get()) {
-      std::list<ResultPtr> aResults = aFeature->results();
-      if (theObject == aFeature)
-        isObjectFound = true;
-      else {
-        std::list<ResultPtr>::const_iterator anIt = aResults.begin(), aLast = aResults.end();
-        for (; anIt != aLast && !isObjectFound; anIt++) {
-          isObjectFound = *anIt == theObject;
+  if (aCanDisplay) {
+    bool isObjectFound = false;
+    ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
+                                                                 (getCurrentOperation());
+    if (aFOperation) {
+      FeaturePtr aFeature = aFOperation->feature();
+      if (aFeature.get()) {
+        std::list<ResultPtr> aResults = aFeature->results();
+        if (theObject == aFeature)
+          isObjectFound = true;
+        else {
+          std::list<ResultPtr>::const_iterator anIt = aResults.begin(), aLast = aResults.end();
+          for (; anIt != aLast && !isObjectFound; anIt++) {
+            isObjectFound = *anIt == theObject;
+          }
         }
       }
     }
-  }
-  if (isObjectFound) {
-    // 4. 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
-    #ifndef DEBUG_DO_NOT_BY_ENTER
-    if (aCanDisplay && isNestedCreateOperation(getCurrentOperation())) {
-      ModuleBase_ModelWidget* anActiveWidget = getActiveWidget();
-      ModuleBase_WidgetEditor* anEditorWdg = anActiveWidget ? dynamic_cast<ModuleBase_WidgetEditor*>(anActiveWidget) : 0;
-      // the active widget editor should not influence here. The presentation should be visible always
-      // when this widget is active.
-      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 = canDisplayCurrentCreatedFeature();
+    if (isObjectFound) {
+      // 4. 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
+      #ifndef DEBUG_DO_NOT_BY_ENTER
+      if (isNestedCreateOperation(getCurrentOperation())) {
+        ModuleBase_ModelWidget* anActiveWidget = getActiveWidget();
+        ModuleBase_WidgetEditor* anEditorWdg = anActiveWidget ? dynamic_cast<ModuleBase_WidgetEditor*>(anActiveWidget) : 0;
+        // the active widget editor should not influence here. The presentation should be visible always
+        // when this widget is active.
+        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 = canDisplayCurrentCreatedFeature();
+        }
       }
+      #endif
     }
-    #endif
   }
 
   // checks the sketcher constraints visibility according to active sketch check box states
index 4d0aa22c871d4acf5c8eac69fc2c8e55237b0606..8829f102f5f9ea007d555b0fda4c71fb8dcd41b6 100644 (file)
@@ -45,6 +45,13 @@ class SketchPlugin_Feature : public ModelAPI_Feature
     return false;
   }
 
+  /// Returns true if the feature and the feature results can be displayed
+  /// \return true
+  SKETCHPLUGIN_EXPORT virtual bool canBeDisplayed() const
+  {
+    return true;
+  }
+
   /// Moves the feature
   /// \param theDeltaX the delta for X coordinate is moved
   /// \param theDeltaY the delta for Y coordinate is moved
index b9ae2611f049a1269254581afb075e1c52ef105b..85c6a8fb6b406cad280d01d01a435b058e2c1e9e 100644 (file)
@@ -45,9 +45,12 @@ public:
   virtual bool isFixed()
   { return true; }
 
-  /// Returns true if object must be displayed in the viewer
-  virtual bool isDisplayed()
-  { return false; }
+  /// Returns true if the feature and the feature results can be displayed.
+  /// \return false
+  SKETCHPLUGIN_EXPORT virtual bool canBeDisplayed() const
+  {
+    return false;
+  }
 
   /// Creates a new part document if needed
   SKETCHPLUGIN_EXPORT virtual void execute();