1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
3 // File: SketchPlugin_ConstraintFillet.h
4 // Created: 19 Mar 2015
5 // Author: Artem ZHIDKOV
7 #ifndef SketchPlugin_ConstraintFillet_H_
8 #define SketchPlugin_ConstraintFillet_H_
10 #include "SketchPlugin.h"
11 #include <SketchPlugin_Sketch.h>
12 #include "SketchPlugin_ConstraintBase.h"
14 /** \class SketchPlugin_ConstraintFillet
16 * \brief Feature for creation of a new constraint filleting two objects which have coincident point
18 * This constraint has three attributes:
19 * SketchPlugin_Constraint::ENTITY_A() and SketchPlugin_Constraint::ENTITY_B() for the filleting objects;
20 * SketchPlugin_Constraint::VALUE() contains radius of filleting circular arc
22 * Also the constraint has attribute SketchPlugin_Constraint::ENTITY_C()
23 * which contains created list objects forming the fillet
25 class SketchPlugin_ConstraintFillet : public SketchPlugin_ConstraintBase
28 struct FilletFeatures {
29 std::list<std::pair<FeaturePtr, bool>> baseEdgesState; ///< list of objects the fillet is based and its states
30 std::list<FeaturePtr> resultEdges; ///< list of result edges
31 std::list<FeaturePtr> resultConstraints; ///< list of constraints provided by the fillet
34 /// Fillet constraint kind
35 inline static const std::string& ID()
37 static const std::string MY_CONSTRAINT_FILLET_ID("SketchConstraintFillet");
38 return MY_CONSTRAINT_FILLET_ID;
40 /// \brief Returns the kind of a feature
41 SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
43 static std::string MY_KIND = SketchPlugin_ConstraintFillet::ID();
47 /// \brief Creates a new part document if needed
48 SKETCHPLUGIN_EXPORT virtual void execute();
50 /// \brief Request for initialization of data model of the feature: adding all attributes
51 SKETCHPLUGIN_EXPORT virtual void initAttributes();
53 /// Called on change of any argument-attribute of this object
54 /// \param theID identifier of changed attribute
55 SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID);
57 /// Returns the AIS preview
58 SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious);
60 /// Reimplemented from ModelAPI_Feature::isMacro().
62 SKETCHPLUGIN_EXPORT virtual bool isMacro() const;
64 /// \brief Use plugin manager for features creation
65 SketchPlugin_ConstraintFillet();
67 /// \return map of base points and features;
68 SKETCHPLUGIN_EXPORT const std::map<AttributePtr, FilletFeatures> pointsFeaturesMap() const {
69 return myPointFeaturesMap;
73 /// \ Removes all produced features and restore base edges.
77 std::set<AttributePtr> myNewPoints; ///< set of new points
78 std::map<AttributePtr, FilletFeatures> myPointFeaturesMap; ///< map of point and features for fillet
79 bool myListOfPointsChangedInCode; ///< flag to track that list of points changed in code
80 bool myRadiusChangedByUser; ///< flag to track that radius changed by user
81 bool myRadiusChangedInCode; ///< flag to track that radius changed in code
82 bool myRadiusInitialized; /// < flag to track that radius initialized