1 // File: SketchPlugin_Validators.cpp
2 // Created: 01 Aug 2014
3 // Author: Vitaly SMETANNIKOV
5 #include "SketchPlugin_Validators.h"
6 #include "SketchPlugin_ConstraintDistance.h"
7 #include <ModelAPI_Data.h>
8 #include <ModelAPI_Validator.h>
9 #include <ModelAPI_ResultValidator.h>
10 #include <GeomDataAPI_Point2D.h>
13 bool SketchPlugin_DistanceAttrValidator::isValid(const FeaturePtr& theFeature,
14 const std::list<std::string>& theArguments,
15 const ObjectPtr& theObject) const
17 std::string aParamA = theArguments.front();
18 PluginManagerPtr aMgr = ModelAPI_PluginManager::get();
19 ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
21 // If the object is not a line then it is accepted
22 const ModelAPI_ResultValidator* aLineValidator = dynamic_cast<const ModelAPI_ResultValidator*>(
23 aFactory->validator("Model_ResultLineValidator"));
24 if (!aLineValidator->isValid(theObject))
27 // If it is a line then we have to check that first attribute id not a line
28 boost::shared_ptr<GeomDataAPI_Point2D> aPoint = getFeaturePoint(theFeature->data(), aParamA);