Salome HOME
It should not be possible to use the circle/arc line in the distance operation.
[modules/shaper.git] / src / PartSet / PartSet_Validators.cpp
index 8f026d712489af75f531e6150b3b844ec18a6627..69c488639f9e7287e05406cb7b1ba60b7f7e06ae 100644 (file)
 #include <ModelAPI_AttributeSelection.h>
 #include <ModelAPI_AttributeReference.h>
 
+#include <SketchPlugin_Sketch.h>
+
 #include <list>
+#ifdef _DEBUG
+#include <iostream>
+#endif
 
 int shapesNbPoints(const ModuleBase_ISelection* theSelection)
 {
@@ -55,7 +60,7 @@ int shapesNbLines(const ModuleBase_ISelection* theSelection)
 
 bool PartSet_DistanceValidator::isValid(const ModuleBase_ISelection* theSelection) const
 {
-  int aCount = shapesNbPoints(theSelection);
+  int aCount = shapesNbPoints(theSelection) + shapesNbLines(theSelection);
   return (aCount > 0) && (aCount < 3);
 }
 
@@ -98,7 +103,11 @@ bool PartSet_RadiusValidator::isValid(const ModuleBase_ISelection* theSelection)
   return (aCount > 0) && (aCount < 2);
 }
 
-
+bool PartSet_RigidValidator::isValid(const ModuleBase_ISelection* theSelection) const
+{
+  int aCount = shapesNbLines(theSelection);
+  return (aCount > 0) && (aCount < 2);
+}
 
 bool PartSet_DifferentObjectsValidator::isValid(const FeaturePtr& theFeature, 
                                                 const std::list<std::string>& theArguments,
@@ -163,4 +172,10 @@ bool PartSet_DifferentObjectsValidator::isValid(const AttributePtr& theAttribute
 {
   // not implemented
   return true;
-}
\ No newline at end of file
+}
+
+bool PartSet_SketchValidator::isValid(const ObjectPtr theObject) const
+{
+  FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
+  return aFeature->getKind() == SketchPlugin_Sketch::ID();
+}