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