+ return (aCount == 1);
+ }
+}
+
+
+bool PartSet_CoincidentSelection::isValid(const ModuleBase_ISelection* theSelection,
+ ModuleBase_Operation* theOperation) const
+{
+ if (theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0) {
+ return isEmptySelectionValid(theOperation);
+ } else {
+ // Coincident can be applied to points and to lines
+ int aNbPoints = shapesNbPoints(theSelection);
+ ShapeQuantity aShapes;
+ int aNbEdges = shapesNbEdges(theSelection, aShapes);
+ return (aNbPoints >= 0 && aNbPoints < 3) && (aNbEdges >= 0 && aNbEdges < 2);
+ }
+}
+
+bool PartSet_HVDirSelection::isValid(const ModuleBase_ISelection* theSelection,
+ ModuleBase_Operation* theOperation) const
+{
+ if (theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0) {
+ return isEmptySelectionValid(theOperation);
+ } else {
+ int aNbPoints = shapesNbPoints(theSelection);
+ ShapeQuantity aShapes;
+ int aNbEdges = shapesNbEdges(theSelection, aShapes);
+ return aNbPoints == 0 && (aShapes[GeomAbs_Line] == aNbEdges && aNbEdges == 1);
+ }
+}
+
+bool PartSet_FilletSelection::isValid(const ModuleBase_ISelection* theSelection,
+ ModuleBase_Operation* theOperation) const
+{
+ if (theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0) {
+ return isEmptySelectionValid(theOperation);
+ } else {
+ int aCount = shapesNbPoints(theSelection);
+ ShapeQuantity aShapes;
+ int aNbEdges = shapesNbEdges(theSelection, aShapes);
+ return aCount > 1 && aNbEdges == 0;
+ }
+}
+
+bool PartSet_TangentSelection::isValid(const ModuleBase_ISelection* theSelection,
+ ModuleBase_Operation* theOperation) const
+{
+ if (theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0) {
+ return isEmptySelectionValid(theOperation);
+ } else {
+ int aNbPoints = shapesNbPoints(theSelection);
+ ShapeQuantity aShapes;
+ int aNbEdges = shapesNbEdges(theSelection, aShapes);
+ return aNbPoints == 0 && (aNbEdges == 1 || (aNbEdges == 2 && aShapes[GeomAbs_Line] == 1));
+ }
+}
+
+bool PartSet_AngleSelection::isValid(const ModuleBase_ISelection* theSelection,
+ ModuleBase_Operation* theOperation) const
+{
+ if (theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0) {
+ return isEmptySelectionValid(theOperation);
+ } else {
+ int aNbPoints = shapesNbPoints(theSelection);
+ ShapeQuantity aShapes;
+ int aNbEdges = shapesNbEdges(theSelection, aShapes);
+ return aNbPoints == 0 && aShapes[GeomAbs_Line] == aNbEdges && aNbEdges > 0 && aNbEdges < 3;
+ }
+}
+
+bool PartSet_EqualSelection::isValid(const ModuleBase_ISelection* theSelection,
+ ModuleBase_Operation* theOperation) const
+{
+ if (theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0) {
+ return isEmptySelectionValid(theOperation);
+ } else {
+ int aNbPoints = shapesNbPoints(theSelection);
+ ShapeQuantity aShapes;
+ int aNbEdges = shapesNbEdges(theSelection, aShapes);
+ return aNbPoints == 0 && (aNbEdges > 0 && aNbEdges < 3) &&
+ (aShapes[GeomAbs_Line] == aNbEdges ||
+ aShapes[GeomAbs_Circle] == aNbEdges ||
+ aShapes[GeomAbs_Ellipse] == aNbEdges);
+ }
+}
+
+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 aNbPoints = shapesNbPoints(theSelection);
+ ShapeQuantity aShapes;
+ int aNbEdges = shapesNbEdges(theSelection, aShapes);
+ return aNbPoints == 0 && aShapes[GeomAbs_Line] == aNbEdges && aNbEdges > 0 && aNbEdges < 3;