]> SALOME platform Git repositories - modules/shaper.git/blob - src/Model/Model_AttributeSelectionList.h
Salome HOME
e0eba6b710f751af189c82a39235dc66b6aff742
[modules/shaper.git] / src / Model / Model_AttributeSelectionList.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        Model_AttributeSelectionList.h
4 // Created:     22 Oct 2014
5 // Author:      Mikhail PONIKAROV
6
7 #ifndef Model_AttributeSelectionList_H_
8 #define Model_AttributeSelectionList_H_
9
10 #include "Model.h"
11 #include "Model_AttributeSelection.h"
12 #include <ModelAPI_AttributeSelectionList.h>
13 #include <TDataStd_Integer.hxx>
14 #include <TDataStd_Comment.hxx>
15 #include <vector>
16
17 /**\class Model_AttributeSelectionList
18  * \ingroup DataModel
19  * \brief Attribute that contains list of references to the sub-shapes with
20  * possibility to manage them.
21  */
22
23 class Model_AttributeSelectionList : public ModelAPI_AttributeSelectionList
24 {
25   Handle(TDataStd_Integer) mySize;  ///< Contains size of this list
26   Handle(TDataStd_Comment) mySelectionType;  ///< Contains current type name (same as selection attribute)
27 public:
28   /// Adds the new reference to the end of the list
29   MODEL_EXPORT virtual void append(
30     const ResultPtr& theContext, const std::shared_ptr<GeomAPI_Shape>& theSubShape);
31
32   /// Adds the new reference to the end of the list by the naming name of the selected shape
33   /// The type of shape is taken from the current selection type
34   MODEL_EXPORT virtual void append(std::string theNamingName);
35
36   /// Removes the last element in the list
37   MODEL_EXPORT virtual void removeLast();
38
39   /// Returns the number ofselection attributes in the list
40   MODEL_EXPORT virtual int size();
41
42   /// The type of all elements selection
43   /// \returns the index of the OCCT enumeration of the type of shape
44   MODEL_EXPORT virtual const std::string selectionType() const;
45
46   /// Sets the type of all elements selection
47   /// \param theType the index of the OCCT enumeration of the type of shape
48   MODEL_EXPORT virtual void setSelectionType(const std::string& theType);
49
50   /// Returns the attribute selection by the index (zero based)
51   MODEL_EXPORT virtual std::shared_ptr<ModelAPI_AttributeSelection> value(const int theIndex);
52
53   /// Returns all attributes
54   MODEL_EXPORT virtual void clear();
55
56   /// Returns true if attribute was  initialized by some value
57   MODEL_EXPORT virtual bool isInitialized();
58
59 protected:
60   /// Objects are created for features automatically
61   MODEL_EXPORT Model_AttributeSelectionList(TDF_Label& theLabel);
62
63   friend class Model_Data;
64 };
65
66 #endif