1 // File: Model_ResultValidators.cpp
2 // Created: 23 July 2014
3 // Author: Vitaly SMETANNIKOV
5 #include "SketchPlugin_ResultValidators.h"
7 #include <ModelAPI_Result.h>
8 #include <ModelAPI_Tools.h>
9 #include <GeomAPI_Curve.h>
11 ResultPtr result(const ObjectPtr theObject)
13 return boost::dynamic_pointer_cast<ModelAPI_Result>(theObject);
16 bool SketchPlugin_ResultPointValidator::isValid(const ObjectPtr theObject) const
18 ResultPtr aResult = result(theObject);
21 boost::shared_ptr<GeomAPI_Shape> aShape = ModelAPI_Tools::shape(aResult);
22 return aShape && aShape->isVertex();
25 bool SketchPlugin_ResultLineValidator::isValid(const ObjectPtr theObject) const
27 ResultPtr aResult = result(theObject);
30 boost::shared_ptr<GeomAPI_Shape> aShape = ModelAPI_Tools::shape(aResult);
31 return aShape && aShape->isEdge() && GeomAPI_Curve(aShape).isLine();
34 bool SketchPlugin_ResultArcValidator::isValid(const ObjectPtr theObject) const
36 ResultPtr aResult = result(theObject);
39 boost::shared_ptr<GeomAPI_Shape> aShape = ModelAPI_Tools::shape(aResult);
40 return aShape && aShape->isEdge() && GeomAPI_Curve(aShape).isCircle();