1 // File: PartSet_Validators.cpp
2 // Created: 09 July 2014
3 // Author: Vitaly SMETANNIKOV
5 #include "PartSet_Validators.h"
10 int shapesNb(const ModuleBase_ISelection* theSelection, TopAbs_ShapeEnum theType)
12 std::list<ModuleBase_ViewerPrs> aList = theSelection->getSelected();
13 std::list<ModuleBase_ViewerPrs>::iterator it;
14 ModuleBase_ViewerPrs aPrs;
16 for (it = aList.begin(); it != aList.end(); ++it) {
18 const TopoDS_Shape& aShape = aPrs.shape();
19 if (!aShape.IsNull()) {
20 if (aShape.ShapeType() == theType)
27 bool PartSet_DistanceValidator::isValid(const ModuleBase_ISelection* theSelection) const
29 int aCount = shapesNb(theSelection, TopAbs_VERTEX);
30 return (aCount > 0) && (aCount < 3);
33 bool PartSet_LengthValidator::isValid(const ModuleBase_ISelection* theSelection) const
35 int aCount = shapesNb(theSelection, TopAbs_EDGE);