Salome HOME
#1119 Confirmation box for deleting parts
[modules/shaper.git] / src / PartSet / PartSet_Validators.cpp
index b446bab1642528b4922b8ce7e84956f677309445..163063bd0b514ba46ac4bb844ae5dc0701230762 100755 (executable)
@@ -314,6 +314,24 @@ bool PartSet_EqualSelection::isValid(const ModuleBase_ISelection* theSelection,
   }
 }
 
+bool PartSet_CollinearSelection::isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const
+{
+  if (theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0) {
+    return isEmptySelectionValid(theOperation);
+  } else {
+    int aCount = shapesNbLines(theSelection);
+    return (aCount > 0) && (aCount < 3);
+  }
+}
+
+bool PartSet_MiddlePointSelection::isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const
+{
+  if (theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0)
+    return isEmptySelectionValid(theOperation);
+  else
+    return shapesNbLines(theSelection) == 1 && shapesNbPoints(theSelection) == 1;
+}
+
 
 std::string PartSet_DifferentObjectsValidator::errorMessage(
                          const PartSet_DifferentObjectsValidator::ErrorType& theType,