]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Provide dimensions edit
authorvsv <vitaly.smetannikov@opencascade.com>
Tue, 28 Oct 2014 17:30:12 +0000 (20:30 +0300)
committervsv <vitaly.smetannikov@opencascade.com>
Tue, 28 Oct 2014 17:30:12 +0000 (20:30 +0300)
src/ModuleBase/ModuleBase_Operation.cpp
src/ModuleBase/ModuleBase_ViewerFilters.cpp
src/PartSet/PartSet_OperationSketch.cpp

index b4c4c01d131bffa5cb51716a8d03e5cc06c2631d..3f29da13070d1ef9aa6ef8ed4783756aa21c6d26 100644 (file)
@@ -21,6 +21,7 @@
 #include <ModelAPI_Document.h>
 #include <ModelAPI_Events.h>
 #include <ModelAPI_Result.h>
+#include <ModelAPI_Object.h>
 #include <ModelAPI_Validator.h>
 
 #include <GeomAPI_Pnt2d.h>
@@ -279,7 +280,24 @@ bool ModuleBase_Operation::activateByPreselection()
 
 void ModuleBase_Operation::initSelection(ModuleBase_ISelection* theSelection)
 {
-  myPreSelection = theSelection->getSelected();
+  myPreSelection.clear();
+
+  // Check that the selected result are not results of operation feature
+  QList<ModuleBase_ViewerPrs> aSelected = theSelection->getSelected();
+  FeaturePtr aFeature = feature();
+  if (aFeature) {
+    std::list<ResultPtr> aResults = aFeature->results();
+    QList<ObjectPtr> aResList;
+    std::list<ResultPtr>::const_iterator aIt;
+    for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt)
+      aResList.append(*aIt);
+
+    foreach (ModuleBase_ViewerPrs aPrs, aSelected) {
+      if ((!aResList.contains(aPrs.object())) && (aPrs.object() != aFeature))
+        myPreSelection.append(aPrs);
+    }
+  } else
+    myPreSelection = aSelected;
 }
 
 void ModuleBase_Operation::onWidgetActivated(ModuleBase_ModelWidget* theWidget)
index 6d2209de55682358037e820fc66a94b06e34cef0..4b6e571dfb1aa6b4fc9f696ea8117da97e2f1138 100644 (file)
@@ -76,5 +76,6 @@ Standard_Boolean ModuleBase_ShapeInPlaneFilter::IsOk(const Handle(SelectMgr_Enti
       }
     }
   }
-  return Standard_False;
+  // This is not object controlled by the filter
+  return Standard_True;
 }
index 804086bbebf98de4a1020c86233783a39bb8aad9..331f7e63e24b2ea1b26a17e99d3870b7bf353cfc 100644 (file)
@@ -87,12 +87,13 @@ void PartSet_OperationSketch::mousePressed(QMouseEvent* theEvent, ModuleBase_IVi
 
 void PartSet_OperationSketch::selectionChanged(ModuleBase_ISelection* theSelection)
 {
-  if (hasSketchPlane())
+  if (hasSketchPlane()) 
     return;
 
   QList<ModuleBase_ViewerPrs> aSelected = theSelection->getSelected();
   if (!aSelected.empty()) {
     ModuleBase_ViewerPrs aPrs = aSelected.first();
+    // We have to select a plane before any operation
     const TopoDS_Shape& aShape = aPrs.shape();
     if (!aShape.IsNull())
       setSketchPlane(aShape);