]> SALOME platform Git repositories - modules/shaper.git/blob - src/SketchPlugin/SketchPlugin_ConstraintFillet.h
Salome HOME
Documentation update
[modules/shaper.git] / src / SketchPlugin / SketchPlugin_ConstraintFillet.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
2
3 // File:    SketchPlugin_ConstraintFillet.h
4 // Created: 19 Mar 2015
5 // Author:  Artem ZHIDKOV
6
7 #ifndef SketchPlugin_ConstraintFillet_H_
8 #define SketchPlugin_ConstraintFillet_H_
9
10 #include "SketchPlugin.h"
11 #include <SketchPlugin_Sketch.h>
12 #include "SketchPlugin_ConstraintBase.h"
13
14 /** \class SketchPlugin_ConstraintFillet
15  *  \ingroup Plugins
16  *  \brief Feature for creation of a new constraint filleting two objects which have coincident point
17  *
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
21  *
22  *  Also the constraint has attribute SketchPlugin_Constraint::ENTITY_C()
23  *  which contains created list objects forming the fillet
24  */
25 class SketchPlugin_ConstraintFillet : public SketchPlugin_ConstraintBase
26 {
27  public:
28    /// \struct Struct to store base edges with states, result edges and constraints.
29    struct FilletFeatures {
30     std::list<std::pair<FeaturePtr, bool>> baseEdgesState; ///< list of objects the fillet is based and its states
31     std::list<FeaturePtr> resultEdges; ///< list of result edges
32     std::list<FeaturePtr> resultConstraints; ///< list of constraints provided by the fillet
33    };
34
35   /// Fillet constraint kind
36   inline static const std::string& ID()
37   {
38     static const std::string MY_CONSTRAINT_FILLET_ID("SketchConstraintFillet");
39     return MY_CONSTRAINT_FILLET_ID;
40   }
41   /// \brief Returns the kind of a feature
42   SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
43   {
44     static std::string MY_KIND = SketchPlugin_ConstraintFillet::ID();
45     return MY_KIND;
46   }
47
48   /// \brief Creates a new part document if needed
49   SKETCHPLUGIN_EXPORT virtual void execute();
50
51   /// \brief Request for initialization of data model of the feature: adding all attributes
52   SKETCHPLUGIN_EXPORT virtual void initAttributes();
53
54   /// Called on change of any argument-attribute of this object
55   /// \param theID identifier of changed attribute
56   SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID);
57
58   /// Returns the AIS preview
59   SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious);
60
61   /// Reimplemented from ModelAPI_Feature::isMacro().
62   /// \returns true
63   SKETCHPLUGIN_EXPORT virtual bool isMacro() const;
64
65   /// \brief Use plugin manager for features creation
66   SketchPlugin_ConstraintFillet();
67
68   /// \return map of base points and features;
69   SKETCHPLUGIN_EXPORT const std::map<AttributePtr, FilletFeatures> pointsFeaturesMap() const {
70     return myPointFeaturesMap;
71   };
72
73 private:
74   /// \ Removes all produced features and restore base edges.
75   void clearResults();
76
77 private:
78   std::set<AttributePtr> myNewPoints; ///< set of new points
79   std::map<AttributePtr, FilletFeatures> myPointFeaturesMap; ///< map of point and features for fillet
80   bool myListOfPointsChangedInCode; ///< flag to track that list of points changed in code
81   bool myRadiusChangedByUser; ///< flag to track that radius changed by user
82   bool myRadiusChangedInCode; ///< flag to track that radius changed in code
83   bool myRadiusInitialized; /// < flag to track that radius initialized
84 };
85
86 #endif