]> SALOME platform Git repositories - modules/shaper.git/blob - src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.h
Salome HOME
7f0a9e9ce6b0ffc0c2bd0cd136a81ba81aa98ca2
[modules/shaper.git] / src / FeaturesPlugin / FeaturesPlugin_CompositeSketch.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        FeaturesPlugin_CompositeSketch.h
4 // Created:     11 September 2015
5 // Author:      Dmitry Bobylev
6
7 #ifndef FeaturesPlugin_CompositeSketch_H_
8 #define FeaturesPlugin_CompositeSketch_H_
9
10 #include <FeaturesPlugin.h>
11
12 #include <ModelAPI_CompositeFeature.h>
13
14 #include <GeomAlgoAPI_Boolean.h>
15
16 /** \class FeaturesPlugin_CompositeSketch
17  *  \ingroup Plugins
18  *  \brief Interface for the composite sketch feature.
19  */
20 class FeaturesPlugin_CompositeSketch : public ModelAPI_CompositeFeature
21 {
22  public:
23   /// Attribute name of sketch feature.
24   inline static const std::string& SKETCH_OBJECT_ID()
25   {
26     static const std::string MY_SKETCH_OBJECT_ID("sketch");
27     return MY_SKETCH_OBJECT_ID;
28   }
29
30   /// Attribute name of sketch feature selection: needed for naming of the selected sketch.
31   inline static const std::string& SKETCH_SELECTION_ID()
32   {
33     static const std::string MY_SKETCH_SELECTION_ID("sketch_selection");
34     return MY_SKETCH_SELECTION_ID;
35   }
36
37   /// attribute name of references sketch entities list, it should contain a sketch result or
38   /// a pair a sketch result to sketch face
39   inline static const std::string& LIST_ID()
40   {
41     static const std::string MY_GROUP_LIST_ID("base");
42     return MY_GROUP_LIST_ID;
43   }
44
45   /// Creates a new part document if needed.
46   FEATURESPLUGIN_EXPORT virtual void execute();
47
48   /// Request for initialization of data model of the feature: adding all attributes.
49   FEATURESPLUGIN_EXPORT virtual void initAttributes();
50
51   /// Appends a feature to the sketch sub-elements container.
52   FEATURESPLUGIN_EXPORT virtual std::shared_ptr<ModelAPI_Feature> addFeature(std::string theID);
53
54   /// \return the number of sub-elements.
55   FEATURESPLUGIN_EXPORT virtual int numberOfSubs(bool forTree = false) const;
56
57   /// \return the sub-feature by zero-base index.
58   FEATURESPLUGIN_EXPORT virtual std::shared_ptr<ModelAPI_Feature> subFeature(const int theIndex, bool forTree = false);
59
60   /// \return the sub-feature unique identifier in this composite feature by zero-base index.
61   FEATURESPLUGIN_EXPORT virtual int subFeatureId(const int theIndex) const;
62
63   /// \return true if feature or result belong to this composite feature as subs.
64   FEATURESPLUGIN_EXPORT virtual bool isSub(ObjectPtr theObject) const;
65
66   /// This method to inform that sub-feature is removed and must be removed from the internal data
67   /// structures of the owner (the remove from the document will be done outside just after)
68   FEATURESPLUGIN_EXPORT virtual void removeFeature(std::shared_ptr<ModelAPI_Feature> theFeature);
69
70   /// removes also all sub-sketch
71   FEATURESPLUGIN_EXPORT virtual void erase();
72
73 protected:
74   FeaturesPlugin_CompositeSketch(){};
75
76   /// Define this function to init attributes for extrusion/revolution.
77   //virtual void initMakeSolidsAttributes() {};
78
79   /// Define this function to create solids from faces with extrusion/revolution.
80   virtual void makeSolid(const std::shared_ptr<GeomAPI_Shape> theFace,
81                          std::shared_ptr<GeomAlgoAPI_MakeShape>& theMakeShape) {};
82
83   /// Results naming.
84   void loadNamingDS(std::shared_ptr<ModelAPI_ResultBody> theResultBody,
85                     const std::shared_ptr<GeomAPI_Shape>& theBaseShape,
86                     const std::shared_ptr<GeomAlgoAPI_MakeShape>& theMakeShape);
87
88   /// Set the sub-object to list of exturusion base.
89   void setSketchObjectToList();
90
91 };
92
93 #endif