]> SALOME platform Git repositories - modules/shaper.git/blob - src/ModelAPI/ModelAPI_AttributeSelectionList.h
Salome HOME
Added removeLast method in the list to optimize the selection algorithm further
[modules/shaper.git] / src / ModelAPI / ModelAPI_AttributeSelectionList.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        ModelAPI_AttributeSelectionList.h
4 // Created:     22 Oct 2014
5 // Author:      Mikhail PONIKAROV
6
7 #ifndef ModelAPI_AttributeSelectionList_H_
8 #define ModelAPI_AttributeSelectionList_H_
9
10 #include "ModelAPI_AttributeSelection.h"
11 #include <ModelAPI_Result.h>
12
13 /**\class ModelAPI_AttributeSelectionList
14  * \ingroup DataModel
15  * \brief Attribute that contains list of references to the sub-shapes with
16  * possibility to manage them.
17  */
18
19 class ModelAPI_AttributeSelectionList : public ModelAPI_Attribute
20 {
21  public:
22   /// Adds the new reference to the end of the list
23   virtual void append(const ResultPtr& theContext,
24                       const GeomShapePtr& theSubShape) = 0;
25
26   /// Adds the new reference to the end of the list by the naming name of the selected shape
27   /// The type of shape is taken from the current selection type
28   virtual void append(std::string theNamingName) = 0;
29
30   /// Removes the last element in the list
31   virtual void removeLast() = 0;
32
33   /// Returns the number of selection attributes in the list
34   virtual int size() = 0;
35
36   /// The type of all elements selection
37   /// \returns the index of the enumeration of the type of shape
38   virtual const std::string selectionType() const = 0;
39
40   /// Sets the type of all elements selection
41   /// \param theType the index of the enumeration of the type of shape
42   virtual void setSelectionType(const std::string& theType) = 0;
43
44   /// Returns the attribute selection by the index (zero based)
45   virtual std::shared_ptr<ModelAPI_AttributeSelection> value(const int theIndex) = 0;
46
47   /// Returns all attributes
48   virtual void clear() = 0;
49
50   /// Returns the type of this class of attributes
51   static std::string typeId()
52   {
53     return "SelectionList";
54   }
55
56   /// Returns the type of this class of attributes, not static method
57   MODELAPI_EXPORT virtual std::string attributeType();
58
59   /// To virtually destroy the fields of successors
60   MODELAPI_EXPORT virtual ~ModelAPI_AttributeSelectionList();
61
62  protected:
63   /// Objects are created for features automatically
64   MODELAPI_EXPORT ModelAPI_AttributeSelectionList();
65 };
66
67 //! Pointer on double attribute
68 typedef std::shared_ptr<ModelAPI_AttributeSelectionList> AttributeSelectionListPtr;
69
70 #endif