From: vsv Date: Tue, 30 Dec 2014 10:17:50 +0000 (+0300) Subject: Issue #338: Provide sketch validator for extrusion X-Git-Tag: V_0.7.0_rc1~8 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=99533173636470077fa168a0e35fc37163b043c1;p=modules%2Fshaper.git Issue #338: Provide sketch validator for extrusion --- diff --git a/src/FeaturesPlugin/extrusion_widget.xml b/src/FeaturesPlugin/extrusion_widget.xml index d37d8da99..6f2ea7d18 100644 --- a/src/FeaturesPlugin/extrusion_widget.xml +++ b/src/FeaturesPlugin/extrusion_widget.xml @@ -1,14 +1,15 @@ - + object_types="construction"> + + registerValidator("PartSet_RadiusValidator", new PartSet_RadiusValidator); aFactory->registerValidator("PartSet_RigidValidator", new PartSet_RigidValidator); aFactory->registerValidator("PartSet_DifferentObjects", new PartSet_DifferentObjectsValidator); + aFactory->registerValidator("PartSet_SketchValidator", new PartSet_SketchValidator); } void PartSet_Module::registerFilters() diff --git a/src/PartSet/PartSet_Validators.cpp b/src/PartSet/PartSet_Validators.cpp index fa7ac518f..69c488639 100644 --- a/src/PartSet/PartSet_Validators.cpp +++ b/src/PartSet/PartSet_Validators.cpp @@ -17,6 +17,8 @@ #include #include +#include + #include #ifdef _DEBUG #include @@ -171,3 +173,9 @@ bool PartSet_DifferentObjectsValidator::isValid(const AttributePtr& theAttribute // not implemented return true; } + +bool PartSet_SketchValidator::isValid(const ObjectPtr theObject) const +{ + FeaturePtr aFeature = ModelAPI_Feature::feature(theObject); + return aFeature->getKind() == SketchPlugin_Sketch::ID(); +} diff --git a/src/PartSet/PartSet_Validators.h b/src/PartSet/PartSet_Validators.h index d0829b586..eb44d6daa 100644 --- a/src/PartSet/PartSet_Validators.h +++ b/src/PartSet/PartSet_Validators.h @@ -12,6 +12,7 @@ #include #include #include +#include /* * Selector validators @@ -72,5 +73,14 @@ class PartSet_DifferentObjectsValidator : public ModelAPI_RefAttrValidator const std::list& theArguments) const; }; +/** +* aValidator which validates tha selected object is a Sketch +*/ +class PartSet_SketchValidator : public ModelAPI_ResultValidator +{ + public: + virtual bool isValid(const ObjectPtr theObject) const; +}; + #endif