Salome HOME
Issue #1860: fix end lines with spaces
[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 <ModelAPI_ResultBody.h>
15
16 /// \class FeaturesPlugin_CompositeSketch
17 /// \ingroup Plugins
18 /// \brief Interface for the composite sketch feature.
19 class FeaturesPlugin_CompositeSketch : public ModelAPI_CompositeFeature
20 {
21 public:
22   /// Attribute name of sketch feature.
23   inline static const std::string& SKETCH_ID()
24   {
25     static const std::string MY_SKETCH_ID("sketch");
26     return MY_SKETCH_ID;
27   }
28
29   /// Attribute name of base objects.
30   inline static const std::string& BASE_OBJECTS_ID()
31   {
32     static const std::string MY_BASE_OBJECTS_ID("base");
33     return MY_BASE_OBJECTS_ID;
34   }
35
36   /// Appends a feature to the sketch sub-elements container.
37   FEATURESPLUGIN_EXPORT virtual std::shared_ptr<ModelAPI_Feature> addFeature(std::string theID);
38
39   /// \return the number of sub-elements.
40   FEATURESPLUGIN_EXPORT virtual int numberOfSubs(bool forTree = false) const;
41
42   /// \return the sub-feature by zero-base index.
43   FEATURESPLUGIN_EXPORT virtual
44     std::shared_ptr<ModelAPI_Feature> subFeature(const int theIndex, bool forTree = false);
45
46   /// \return the sub-feature unique identifier in this composite feature by zero-base index.
47   FEATURESPLUGIN_EXPORT virtual int subFeatureId(const int theIndex) const;
48
49   /// \return true if feature or result belong to this composite feature as subs.
50   FEATURESPLUGIN_EXPORT virtual bool isSub(ObjectPtr theObject) const;
51
52   /// This method to inform that sub-feature is removed and must be removed from the internal data
53   /// structures of the owner (the remove from the document will be done outside just after).
54   FEATURESPLUGIN_EXPORT virtual void removeFeature(std::shared_ptr<ModelAPI_Feature> theFeature);
55
56 protected:
57   enum InitFlags {
58     InitSketchLauncher   = 1 << 0,
59     InitBaseObjectsList  = 1 << 1
60   };
61
62   FeaturesPlugin_CompositeSketch(){};
63
64   /// Initializes composite sketch attributes.
65   void initCompositeSketchAttribtues(const int theInitFlags);
66
67   /// \brief Returns list of base shapes.
68   /// \param[out] theBaseShapesList list of base shapes (warning: list not cleared).
69   /// \param[in] theIsMakeShells if true make shells from faces with shared edges.
70   void getBaseShapes(ListOfShape& theBaseShapesList, const bool theIsMakeShells = true);
71
72   /// Checks make shape algo.
73   bool isMakeShapeValid(const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape);
74
75   /// Stores result of generation.
76   void storeResult(const GeomShapePtr theBaseShape,
77                    const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape,
78                    const int theIndex = 0);
79
80   /// Stores generation history.
81   void storeGenerationHistory(ResultBodyPtr theResultBody,
82                               const GeomShapePtr theBaseShape,
83                               const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape,
84                               int& theTag);
85
86   /// Used to store from and to shapes.
87   void storeShapes(ResultBodyPtr theResultBody,
88                    const GeomAPI_Shape::ShapeType theBaseShapeType,
89                    const std::shared_ptr<GeomAPI_DataMapOfShapeShape> theMapOfSubShapes,
90                    const ListOfShape& theShapes,
91                    const std::string theName,
92                    int& theTag);
93
94 };
95
96 #endif