Salome HOME
Issue #1774: Can't select edge for tangent constraint creation
[modules/shaper.git] / src / PartSet / PartSet_SketcherReetntrantMgr.cpp
index 4674f43b1a4b5fca8c21570ffc36c730a64b7c8e..4cfcf167d8f49f9726c1ca2cb94d447d257c2013 100755 (executable)
 #include <SketchPlugin_Line.h>
 #include <SketchPlugin_Arc.h>
 #include <SketchPlugin_Circle.h>
+#include <SketchPlugin_Point.h>
 
 #include <XGUI_Workshop.h>
 #include <XGUI_ModuleConnector.h>
 #include <XGUI_OperationMgr.h>
 #include <XGUI_PropertyPanel.h>
 #include <XGUI_ErrorMgr.h>
+#include <XGUI_SelectionMgr.h>
 
 #include <QToolButton>
 
@@ -86,7 +88,6 @@ void PartSet_SketcherReetntrantMgr::updateInternalEditActiveState()
       if (!anError.isEmpty()) {
         aFOperation->setEditOperation(false);
         //workshop()->operationMgr()->updateApplyOfOperations();
-        beforeStopInternalEdit();
         myIsInternalEditOperation = false;
         updateAcceptAllAction();
       }
@@ -157,6 +158,11 @@ bool PartSet_SketcherReetntrantMgr::processMouseMoved(ModuleBase_IViewWindow* th
       }
       bool aCanBeActivatedByMove = isLineFeature || isArcFeature;
       if (aCanBeActivatedByMove) {
+        /// before restarting of operation we need to clear selection, as it may take part in
+        /// new feature creation, e.g. tangent arc. But it is not necessary as it was processed
+        /// by mouse release when the operation was restarted.
+        workshop()->selector()->clearSelection();\r
+
         myPreviousFeature = aFOperation->feature();
         restartOperation();
         myPreviousFeature = FeaturePtr();
@@ -560,7 +566,8 @@ bool PartSet_SketcherReetntrantMgr::copyReetntrantAttributes(const FeaturePtr& t
                                                              const bool isTemporary)
 {
   bool aChanged = false;
-  if (!theSourceFeature.get())
+  if (!theSourceFeature.get() || !theSourceFeature->data().get() ||
+      !theSourceFeature->data()->isValid())
     return aChanged;
 
   std::string aFeatureKind = theSourceFeature->getKind();