]> SALOME platform Git repositories - modules/shaper.git/blob - src/SketchPlugin/SketchPlugin_ConstraintSplit.h
Salome HOME
2cbf75fd73946650804913b6eb7a5e83a285d869
[modules/shaper.git] / src / SketchPlugin / SketchPlugin_ConstraintSplit.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
2
3 // File:    SketchPlugin_ConstraintSplit.h
4 // Created: 19 Mar 2015
5 // Author:  Artem ZHIDKOV
6
7 #ifndef SketchPlugin_ConstraintSplit_H_
8 #define SketchPlugin_ConstraintSplit_H_
9
10 #include "SketchPlugin.h"
11 #include <SketchPlugin_Sketch.h>
12 #include "SketchPlugin_ConstraintBase.h"
13
14 class GeomDataAPI_Point2D;
15 class ModelAPI_Feature;
16
17 /** \class SketchPlugin_ConstraintSplit
18  *  \ingroup Plugins
19  *  \brief Feature for creation of a new constraint filleting two objects which have coincident point
20  *
21  *  This constraint has three attributes:
22  *  SketchPlugin_Constraint::VALUE() contains reference object to be splitted
23  *  SketchPlugin_Constraint::ENTITY_A() and SketchPlugin_Constraint::ENTITY_B() for the points of split;
24  *
25  *  Also the constraint has attribute SketchPlugin_Constraint::ENTITY_C()
26  *  which contains created list objects forming the fillet
27  */
28 class SketchPlugin_ConstraintSplit : public SketchPlugin_ConstraintBase
29 {
30  public:
31    /*struct FilletFeatures {
32     std::list<std::pair<FeaturePtr, bool>> baseEdgesState; ///< list of objects the fillet is based and its states
33     std::list<FeaturePtr> resultEdges; ///< list of result edges
34     std::list<FeaturePtr> resultConstraints; ///< list of constraints provided by the fillet
35    };*/
36
37   /// Split constraint kind
38   inline static const std::string& ID()
39   {
40     static const std::string MY_CONSTRAINT_SPLIT_ID("SketchConstraintSplit");
41     return MY_CONSTRAINT_SPLIT_ID;
42   }
43   /// \brief Returns the kind of a feature
44   SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
45   {
46     static std::string MY_KIND = SketchPlugin_ConstraintSplit::ID();
47     return MY_KIND;
48   }
49
50   /// \brief Creates a new part document if needed
51   SKETCHPLUGIN_EXPORT virtual void execute();
52
53   /// \brief Request for initialization of data model of the feature: adding all attributes
54   SKETCHPLUGIN_EXPORT virtual void initAttributes();
55
56   /// Called on change of any argument-attribute of this object
57   /// \param theID identifier of changed attribute
58   SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID);
59
60   /// Returns the AIS preview
61   //SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious);
62
63   /// Reimplemented from ModelAPI_Feature::isMacro().
64   /// \returns true
65   SKETCHPLUGIN_EXPORT virtual bool isMacro() const;
66
67   /// \brief Use plugin manager for features creation
68   SketchPlugin_ConstraintSplit();
69
70   /// \return map of base points and features;
71   //SKETCHPLUGIN_EXPORT const std::map<AttributePtr, FilletFeatures> pointsFeaturesMap() const {
72   //  return myPointFeaturesMap;
73   //};
74
75 private:
76   /// Returns geom point attribute of the feature
77   /// \param theStartPoint
78   /// \return geometical point
79   std::shared_ptr<GeomDataAPI_Point2D> getFeaturePoint(const bool& theStartPoint);
80
81   /// Returns cast of attribute to geometrical point if the attribute is a ref attr attribute
82   /// \param theAttribute an attribute
83   /// \param geom point 2D or NULL
84   std::shared_ptr<GeomDataAPI_Point2D> getPointOfRefAttr(const AttributePtr& theAttribute);
85
86   /// Creates a new feature in the base shape type with bounding points given in parameters
87   /// \param theStartPointAttr an attribute of the start point
88   /// \param theEndPointAttr an attribute of the end point
89   std::shared_ptr<ModelAPI_Feature> createFeature(
90                                     const std::shared_ptr<GeomDataAPI_Point2D>& theStartPointAttr,
91                                     const std::shared_ptr<GeomDataAPI_Point2D>& theEndPointAttr);
92
93 private:
94   //std::set<AttributePtr> myNewPoints; ///< set of new points
95   //std::map<AttributePtr, FilletFeatures> myPointFeaturesMap; ///< map of point and features for fillet
96   //bool myListOfPointsChangedInCode; ///< flag to track that list of points changed in code
97   //bool myRadiusChangedByUser; ///< flag to track that radius changed by user
98   //bool myRadiusChangedInCode; ///< flag to track that radius changed in code
99   //bool myRadiusInitialized; /// < flag to track that radius initialized
100 };
101
102 #endif