+bool PartSet_ProjectionSelection::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;
+ }
+}
+
+bool PartSet_IntersectionSelection::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;
+ }
+}
+
+
+std::string PartSet_DifferentObjectsValidator::errorMessage(
+ const PartSet_DifferentObjectsValidator::ErrorType& theType,
+ const std::string& thEqualObject, const std::string& theFirstAttribute,
+ const std::string& theSecondAttribute) const
+{
+ std::string anError;
+ switch (theType) {
+ case EqualObjects:
+ anError = "The feature uses one " + thEqualObject + " object in " +
+ theFirstAttribute + " and " + theSecondAttribute + " attributes.";
+ break;
+ case EqualAttributes:
+ anError = "The feature uses reference to one " + thEqualObject + " attribute in " +
+ theFirstAttribute + " and " + theSecondAttribute + " attributes.";
+ break;
+ case EqualShapes:
+ anError = "The feature uses one shape in " +
+ theFirstAttribute + " and " + theSecondAttribute + " attributes.";
+ break;
+ case EmptyShapes:
+ anError = "The feature uses empty shapes in " +
+ theFirstAttribute + " and " + theSecondAttribute + " attributes.";
+ break;
+ break;
+ default:
+ break;
+ }
+ return anError;
+}
+
+bool PartSet_DifferentObjectsValidator::isValid(const AttributePtr& theAttribute,
+ const std::list<std::string>& theArguments,
+ Events_InfoMessage& theError) const