1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: Model_AttributeSelectionList.h
4 // Created: 22 Oct 2014
5 // Author: Mikhail PONIKAROV
7 #ifndef Model_AttributeSelectionList_H_
8 #define Model_AttributeSelectionList_H_
11 #include "Model_AttributeSelection.h"
12 #include <ModelAPI_AttributeSelectionList.h>
13 #include <TDataStd_Integer.hxx>
14 #include <TDataStd_Comment.hxx>
17 /**\class Model_AttributeSelectionList
19 * \brief Attribute that contains list of references to the sub-shapes with
20 * possibility to manage them.
23 class Model_AttributeSelectionList : public ModelAPI_AttributeSelectionList
25 Handle(TDataStd_Integer) mySize; ///< Contains size of this list
26 Handle(TDataStd_Comment) mySelectionType; ///< Contains current type name (same as selection attribute)
28 /// Adds the new reference to the end of the list
29 /// \param theContext object where the sub-shape was selected
30 /// \param theSubShape selected sub-shape (if null, the whole context is selected)
31 /// \param theTemporarily if it is true, do not store and name the added in the data framework
32 /// (used to remove immideately, without the following updates)
33 MODEL_EXPORT virtual void append(
34 const ResultPtr& theContext, const std::shared_ptr<GeomAPI_Shape>& theSubShape,
35 const bool theTemporarily = false);
37 /// Adds the new reference to the end of the list by the naming name of the selected shape
38 /// The type of shape is taken from the current selection type
39 MODEL_EXPORT virtual void append(std::string theNamingName);
41 /// Removes the last element in the list
42 MODEL_EXPORT virtual void removeLast();
44 /// Returns the number ofselection attributes in the list
45 MODEL_EXPORT virtual int size();
47 /// The type of all elements selection
48 /// \returns the index of the OCCT enumeration of the type of shape
49 MODEL_EXPORT virtual const std::string selectionType() const;
51 /// Sets the type of all elements selection
52 /// \param theType the index of the OCCT enumeration of the type of shape
53 MODEL_EXPORT virtual void setSelectionType(const std::string& theType);
55 /// Returns the attribute selection by the index (zero based)
56 MODEL_EXPORT virtual std::shared_ptr<ModelAPI_AttributeSelection> value(const int theIndex);
58 /// Returns all attributes
59 MODEL_EXPORT virtual void clear();
61 /// Returns true if attribute was initialized by some value
62 MODEL_EXPORT virtual bool isInitialized();
65 /// Objects are created for features automatically
66 MODEL_EXPORT Model_AttributeSelectionList(TDF_Label& theLabel);
68 friend class Model_Data;