From: nds Date: Thu, 5 May 2016 09:29:04 +0000 (+0300) Subject: 1. Projection should be hidden in the viewer. Incorrect case: X-Git-Tag: V_2.3.0~19 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=54fad17a4c8aa6e7dd91f240ec76b0148920ac80;p=modules%2Fshaper.git 1. Projection should be hidden in the viewer. Incorrect case: 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. --- diff --git a/src/ModuleBase/ModuleBase_WidgetAction.cpp b/src/ModuleBase/ModuleBase_WidgetAction.cpp index c9cffda31..b0206a5a5 100755 --- a/src/ModuleBase/ModuleBase_WidgetAction.cpp +++ b/src/ModuleBase/ModuleBase_WidgetAction.cpp @@ -48,6 +48,11 @@ ModuleBase_WidgetAction::~ModuleBase_WidgetAction() { } +bool ModuleBase_WidgetAction::focusTo() +{ + return false; +} + QList ModuleBase_WidgetAction::getControls() const { QList aList; diff --git a/src/ModuleBase/ModuleBase_WidgetAction.h b/src/ModuleBase/ModuleBase_WidgetAction.h index 1e801b7e2..b6e8b72f0 100755 --- a/src/ModuleBase/ModuleBase_WidgetAction.h +++ b/src/ModuleBase/ModuleBase_WidgetAction.h @@ -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 getControls() const; diff --git a/src/PartSet/PartSet_SketcherMgr.cpp b/src/PartSet/PartSet_SketcherMgr.cpp index c897b72b5..c6746b0cd 100755 --- a/src/PartSet/PartSet_SketcherMgr.cpp +++ b/src/PartSet/PartSet_SketcherMgr.cpp @@ -1092,6 +1092,11 @@ bool PartSet_SketcherMgr::canDisplayObject(const ObjectPtr& theObject) const if (aFeature.get() != NULL && aFeature == activeSketch()) { aCanDisplay = false; } + std::shared_ptr aSketchFeature = + std::dynamic_pointer_cast(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 - (getCurrentOperation()); - if (aFOperation) { - FeaturePtr aFeature = aFOperation->feature(); - if (aFeature.get()) { - std::list aResults = aFeature->results(); - if (theObject == aFeature) - isObjectFound = true; - else { - std::list::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 + (getCurrentOperation()); + if (aFOperation) { + FeaturePtr aFeature = aFOperation->feature(); + if (aFeature.get()) { + std::list aResults = aFeature->results(); + if (theObject == aFeature) + isObjectFound = true; + else { + std::list::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(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(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 diff --git a/src/SketchPlugin/SketchPlugin_Feature.h b/src/SketchPlugin/SketchPlugin_Feature.h index 4d0aa22c8..8829f102f 100644 --- a/src/SketchPlugin/SketchPlugin_Feature.h +++ b/src/SketchPlugin/SketchPlugin_Feature.h @@ -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 diff --git a/src/SketchPlugin/SketchPlugin_Projection.h b/src/SketchPlugin/SketchPlugin_Projection.h index b9ae2611f..85c6a8fb6 100644 --- a/src/SketchPlugin/SketchPlugin_Projection.h +++ b/src/SketchPlugin/SketchPlugin_Projection.h @@ -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();