1 // Copyright (C) 2014-2023 CEA, EDF
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef ModelAPI_Folder_H_
21 #define ModelAPI_Folder_H_
24 #include <ModelAPI_Object.h>
26 /**\class ModelAPI_Folder
28 * \brief Folder feature (groups the features).
30 class ModelAPI_Folder : public ModelAPI_Object
33 MODELAPI_EXPORT ModelAPI_Folder();
34 /// To virtually destroy the fields of successors
35 MODELAPI_EXPORT virtual ~ModelAPI_Folder();
38 static const std::string& ID()
40 static const std::string MY_FOLDER_ID("Folder");
44 /// Returns the group identifier of all features
45 inline static std::string group()
47 static std::string MY_GROUP = "Folders";
51 /// Returns the group identifier of this result
52 virtual std::string groupName()
57 /// Attribute referring first feature in the folder
58 static const std::string& FIRST_FEATURE_ID()
60 static const std::string MY_FIRST_FEATURE_ID("first_feature");
61 return MY_FIRST_FEATURE_ID;
64 /// Attribute referring last feature in the folder
65 static const std::string& LAST_FEATURE_ID()
67 static const std::string MY_LAST_FEATURE_ID("last_feature");
68 return MY_LAST_FEATURE_ID;
71 /// Request for initialization of data model of the object: adding all attributes
72 MODELAPI_EXPORT virtual void initAttributes();
74 /// Computes or recomputes the results
75 MODELAPI_EXPORT virtual void execute();
77 /// Returns the feature is disabled or not.
78 virtual bool isDisabled()
82 // Helper methods, aliases for data()->method()
83 // -----------------------------------------------------------------------------------------------
84 /// Returns the name stored in the attribute
85 inline std::wstring name()
87 return data()->name();
89 /// Returns the reference attribute by the identifier
90 inline std::shared_ptr<ModelAPI_AttributeReference> reference(const std::string& theID)
92 return data()->reference(theID);
95 /// Returns the last visible feature in the folder, passing through invisible,
96 /// that may appear as the last ones.
97 MODELAPI_EXPORT std::shared_ptr<ModelAPI_Feature> lastVisibleFeature();
100 /// This method is called just after creation of the object: it must initialize
101 /// all fields, normally initialized in the constructor
102 MODELAPI_EXPORT virtual void init();
105 //! Pointer on a folder object
106 typedef std::shared_ptr<ModelAPI_Folder> FolderPtr;