aFactory->registerValidator("PartSet_MiddlePointSelection", new PartSet_MiddlePointSelection);
aFactory->registerValidator("PartSet_DifferentObjects", new PartSet_DifferentObjectsValidator);
aFactory->registerValidator("PartSet_CoincidentAttr", new PartSet_CoincidentAttr);
+ aFactory->registerValidator("PartSet_MultyTranslationSelection",
+ new PartSet_MultyTranslationSelection);
+ aFactory->registerValidator("PartSet_SplitSelection", new PartSet_SplitSelection);
+ aFactory->registerValidator("PartSet_ProjectionSelection", new PartSet_ProjectionSelection);
}
void PartSet_Module::registerFilters()
return shapesNbLines(theSelection) == 1 || shapesNbPoints(theSelection) == 1;
}
+bool PartSet_MultyTranslationSelection::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_SplitSelection::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_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;
+ }
+}
+
std::string PartSet_DifferentObjectsValidator::errorMessage(
const PartSet_DifferentObjectsValidator::ErrorType& theType,
theError = "There is no a common coincident point.";
return false;
}
-
ModuleBase_Operation* theOperation) const;
};
+//! \ingroup Validators
+//! A class to validate a selection for Middle point constraints operation
+class PartSet_MultyTranslationSelection : public ModuleBase_SelectionValidator
+{
+public:
+ PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection,
+ ModuleBase_Operation* theOperation) const;
+};
+
+//! \ingroup Validators
+//! A class to validate a selection for Middle point constraints operation
+class PartSet_SplitSelection : public ModuleBase_SelectionValidator
+{
+public:
+ PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection,
+ ModuleBase_Operation* theOperation) const;
+};
+
+//! \ingroup Validators
+//! A class to validate a selection for Middle point constraints operation
+class PartSet_ProjectionSelection : public ModuleBase_SelectionValidator
+{
+public:
+ PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection,
+ ModuleBase_Operation* theOperation) const;
+};
+
////////////// Attribute validators ////////////////
use_external="false">
<validator id="SketchPlugin_SplitValidator"/>
</sketch_sub_shape_selector>
+ <validator id="PartSet_SplitSelection"/>
</feature>
</group>
use_sketch_plane="false">
<validator id="SketchPlugin_ProjectionValidator"/>
</sketch_shape_selector>
+ <validator id="PartSet_ProjectionSelection"/>
</feature>
</group>
greed ="true">
<validator id="SketchPlugin_MirrorAttr" />
</sketch_multi_selector>
+ <validator id="PartSet_MultyTranslationSelection" />
</feature>
<!-- SketchMultiTranslation -->
default="2" min="2" use_reset="false">
<validator id="GeomValidators_Positive"/>
</integervalue>
+ <validator id="PartSet_MultyTranslationSelection" />
</feature>
<!-- SketchMultiRotation -->
default="2" min="2" use_reset="false">
<validator id="GeomValidators_Positive"/>
</integervalue>
+ <validator id="PartSet_MultyTranslationSelection" />
</feature>
</group>