SHAPER  9.12.0
ModelAPI_Folder.h
1 // Copyright (C) 2014-2023 CEA, EDF
2 //
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.
7 //
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 
20 #ifndef ModelAPI_Folder_H_
21 #define ModelAPI_Folder_H_
22 
23 #include <ModelAPI.h>
24 #include <ModelAPI_Object.h>
25 
31 {
32 public:
33  MODELAPI_EXPORT ModelAPI_Folder();
35  MODELAPI_EXPORT virtual ~ModelAPI_Folder();
36 
38  static const std::string& ID()
39  {
40  static const std::string MY_FOLDER_ID("Folder");
41  return MY_FOLDER_ID;
42  }
43 
45  inline static std::string group()
46  {
47  static std::string MY_GROUP = "Folders";
48  return MY_GROUP;
49  }
50 
52  virtual std::string groupName()
53  {
54  return group();
55  }
56 
58  static const std::string& FIRST_FEATURE_ID()
59  {
60  static const std::string MY_FIRST_FEATURE_ID("first_feature");
61  return MY_FIRST_FEATURE_ID;
62  }
63 
65  static const std::string& LAST_FEATURE_ID()
66  {
67  static const std::string MY_LAST_FEATURE_ID("last_feature");
68  return MY_LAST_FEATURE_ID;
69  }
70 
72  MODELAPI_EXPORT virtual void initAttributes();
73 
75  MODELAPI_EXPORT virtual void execute();
76 
78  virtual bool isDisabled()
79  { return false; }
80 
81  //
82  // Helper methods, aliases for data()->method()
83  // -----------------------------------------------------------------------------------------------
85  inline std::wstring name()
86  {
87  return data()->name();
88  }
90  inline std::shared_ptr<ModelAPI_AttributeReference> reference(const std::string& theID)
91  {
92  return data()->reference(theID);
93  }
94 
97  MODELAPI_EXPORT std::shared_ptr<ModelAPI_Feature> lastVisibleFeature();
98 
99 protected:
102  MODELAPI_EXPORT virtual void init();
103 };
104 
106 typedef std::shared_ptr<ModelAPI_Folder> FolderPtr;
107 
108 #endif
Folder feature (groups the features).
Definition: ModelAPI_Folder.h:31
static std::string group()
Returns the group identifier of all features.
Definition: ModelAPI_Folder.h:45
static const std::string & FIRST_FEATURE_ID()
Attribute referring first feature in the folder.
Definition: ModelAPI_Folder.h:58
virtual MODELAPI_EXPORT void initAttributes()
Request for initialization of data model of the object: adding all attributes.
Definition: ModelAPI_Folder.cpp:36
static const std::string & LAST_FEATURE_ID()
Attribute referring last feature in the folder.
Definition: ModelAPI_Folder.h:65
virtual MODELAPI_EXPORT void execute()
Computes or recomputes the results.
Definition: ModelAPI_Folder.cpp:42
virtual std::string groupName()
Returns the group identifier of this result.
Definition: ModelAPI_Folder.h:52
static const std::string & ID()
Folder feature ID.
Definition: ModelAPI_Folder.h:38
MODELAPI_EXPORT std::shared_ptr< ModelAPI_Feature > lastVisibleFeature()
Returns the last visible feature in the folder, passing through invisible, that may appear as the las...
Definition: ModelAPI_Folder.cpp:46
std::wstring name()
Returns the name stored in the attribute.
Definition: ModelAPI_Folder.h:85
virtual MODELAPI_EXPORT ~ModelAPI_Folder()
To virtually destroy the fields of successors.
Definition: ModelAPI_Folder.cpp:28
virtual bool isDisabled()
Returns the feature is disabled or not.
Definition: ModelAPI_Folder.h:78
virtual MODELAPI_EXPORT void init()
This method is called just after creation of the object: it must initialize all fields,...
Definition: ModelAPI_Folder.cpp:32
std::shared_ptr< ModelAPI_AttributeReference > reference(const std::string &theID)
Returns the reference attribute by the identifier.
Definition: ModelAPI_Folder.h:90
Represents any object in the data model and in the object browser.
Definition: ModelAPI_Object.h:45
virtual std::shared_ptr< ModelAPI_Data > data() const
Returns the data manager of this object: attributes.
Definition: ModelAPI_Object.cpp:45