1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
3 // File: Model_ResultValidators.cpp
4 // Created: 23 July 2014
5 // Author: Vitaly SMETANNIKOV
7 #include "SketchPlugin_ResultValidators.h"
9 #include <ModelAPI_Result.h>
10 #include <ModelAPI_Tools.h>
11 #include <GeomAPI_Curve.h>
13 ResultPtr result(const ObjectPtr theObject)
15 return std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
18 bool SketchPlugin_ResultPointValidator::isValid(const ObjectPtr theObject) const
20 ResultPtr aResult = result(theObject);
23 std::shared_ptr<GeomAPI_Shape> aShape = ModelAPI_Tools::shape(aResult);
24 return aShape && aShape->isVertex();
27 bool SketchPlugin_ResultLineValidator::isValid(const ObjectPtr theObject) const
29 ResultPtr aResult = result(theObject);
32 std::shared_ptr<GeomAPI_Shape> aShape = ModelAPI_Tools::shape(aResult);
33 return aShape && aShape->isEdge() && GeomAPI_Curve(aShape).isLine();
36 bool SketchPlugin_ResultArcValidator::isValid(const ObjectPtr theObject) const
38 ResultPtr aResult = result(theObject);
41 std::shared_ptr<GeomAPI_Shape> aShape = ModelAPI_Tools::shape(aResult);
42 return aShape && aShape->isEdge() && GeomAPI_Curve(aShape).isCircle();