Salome HOME
0ec63f8ae7a33cce9426e3e04c6e101d33657360
[modules/shaper.git] / src / CollectionPlugin / CollectionPlugin_Field.h
1 // Copyright (C) 2014-2023  CEA/DEN, EDF R&D
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 COLLECTIONPLUGIN_FIELD_H_
21 #define COLLECTIONPLUGIN_FIELD_H_
22
23 #include "CollectionPlugin.h"
24 #include <ModelAPI_Feature.h>
25 #include <GeomAPI_Shape.h>
26
27 /**\class CollectionPlugin_Field
28  * \ingroup Plugins
29  * \brief Feature for selection of sub-shapes of some shapes and assigning data on them.
30  *
31  * There is a set of containers that contains the following data that may be inserted by the user:
32  * 
33  * Selected sub-shapes (like in Groups).
34  * Number of components for each selection.
35  * Components names
36  * Type of values: Boolean, Integer, Double or String.
37  * Number of steps: for each step (indexes are zero-based) the values below are multiplied.
38  * Stamp: integer identifier per each step
39  * Defaul values for each components
40  * Values for each component and each selected sub-shape: all are of specific type.
41  */
42 class CollectionPlugin_Field : public ModelAPI_Feature
43 {
44  public:
45   /// Feature kind
46   inline static const std::string& ID()
47   {
48     static const std::string MY_FIELD_ID("Field");
49     return MY_FIELD_ID;
50   }
51   /// attribute name of selected entities list
52   inline static const std::string& SELECTED_ID()
53   {
54     static const std::string MY_SELECTED_ID("selected");
55     return MY_SELECTED_ID;
56   }
57   /// attribute name of componenets titles array
58   inline static const std::string& COMPONENTS_NAMES_ID()
59   {
60     static const std::string MY_COMPONENTS_NAMES_ID("components_names");
61     return MY_COMPONENTS_NAMES_ID;
62   }
63   /// attribute name of stamps integer array
64   inline static const std::string& STAMPS_ID()
65   {
66     static const std::string MY_STAMPS_ID("stamps");
67     return MY_STAMPS_ID;
68   }
69   /// attribute name of list of tables that contain deafult values (row 0) and the custom values
70   inline static const std::string& VALUES_ID()
71   {
72     static const std::string MY_VALUES_ID("values");
73     return MY_VALUES_ID;
74   }
75
76   /// Returns the kind of a feature
77   COLLECTIONPLUGIN_EXPORT virtual const std::string& getKind()
78   {
79     static std::string MY_KIND = CollectionPlugin_Field::ID();
80     return MY_KIND;
81   }
82
83   /// Creates a new field result if needed
84   COLLECTIONPLUGIN_EXPORT virtual void execute();
85
86   /// Request for initialization of data model of the feature: adding all attributes
87   COLLECTIONPLUGIN_EXPORT virtual void initAttributes();
88
89   /// Result of fields is created on the fly and don't stored to the document
90   COLLECTIONPLUGIN_EXPORT virtual bool isPersistentResult() {return false;}
91
92   /// Use plugin manager for features creation
93   CollectionPlugin_Field();
94
95 };
96
97 #endif