Salome HOME
bf513f3a5931de38c709446cb594ac6031988767
[modules/shaper.git] / src / CollectionAPI / CollectionAPI_Field.h
1 // Copyright (C) 2014-2021  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 CollectionAPI_Field_H_
21 #define CollectionAPI_Field_H_
22
23 #include "CollectionAPI.h"
24
25 #include <CollectionPlugin_Field.h>
26
27 #include <ModelHighAPI_Interface.h>
28 #include <ModelHighAPI_Macro.h>
29
30 class ModelHighAPI_Dumper;
31 class ModelHighAPI_Selection;
32 class ModelHighAPI_Integer;
33 class ModelHighAPI_ComponentValue;
34
35 /// \class CollectionAPI_Field
36 /// \inField CPPHighAPI
37 /// \brief Interface for Field feature.
38 class CollectionAPI_Field: public ModelHighAPI_Interface
39 {
40 public:
41   /// Constructor without values.
42   COLLECTIONAPI_EXPORT
43   explicit CollectionAPI_Field(const std::shared_ptr<ModelAPI_Feature>& theFeature);
44
45   /// Destructor.
46   COLLECTIONAPI_EXPORT
47   virtual ~CollectionAPI_Field();
48
49   INTERFACE_4(CollectionPlugin_Field::ID(),
50     selection, CollectionPlugin_Field::SELECTED_ID(),
51     ModelAPI_AttributeSelectionList, /** Field selection list*/,
52     componentsNames, CollectionPlugin_Field::COMPONENTS_NAMES_ID(),
53     ModelAPI_AttributeStringArray, /** Names of components list of strings */,
54     stamps, CollectionPlugin_Field::STAMPS_ID(),
55     ModelAPI_AttributeIntArray, /** Identifiers of stamps */,
56     values, CollectionPlugin_Field::VALUES_ID(), ModelAPI_AttributeTables /** Table of values */,
57     )
58
59   /// Set selected objects.
60   COLLECTIONAPI_EXPORT
61   void setSelection(const std::list<ModelHighAPI_Selection>& theFieldList);
62   /// Set names of components
63   COLLECTIONAPI_EXPORT
64   void setComponentsNames(const std::list<std::string>& theNames);
65   /// Set type of values
66   COLLECTIONAPI_EXPORT
67   void setValuesType(const std::string& theType);
68   /// Set number of steps
69   COLLECTIONAPI_EXPORT
70   void setStepsNum(const ModelHighAPI_Integer& theSteps);
71   /// Set stamps identifiers
72   COLLECTIONAPI_EXPORT
73   void setStamps(const std::list<ModelHighAPI_Integer>& theStamps);
74   /// Sets the double values of specific step
75   COLLECTIONAPI_EXPORT
76   void addStep(const ModelHighAPI_Integer& theStepNum, const ModelHighAPI_Integer& theStamp,
77     const std::list<std::list<double> >& theComponents);
78   /// Sets the integer values of specific step
79   COLLECTIONAPI_EXPORT
80   void addStep(const ModelHighAPI_Integer& theStepNum, const ModelHighAPI_Integer& theStamp,
81     const std::list<std::list<int> >& theComponents);
82   /// Sets the string values of specific step
83   COLLECTIONAPI_EXPORT
84   void addStep(const ModelHighAPI_Integer& theStepNum, const ModelHighAPI_Integer& theStamp,
85     const std::list<std::list<std::string> >& theComponents);
86   /// Sets the boolean values of specific step
87   COLLECTIONAPI_EXPORT
88   void addStep(const ModelHighAPI_Integer& theStepNum, const ModelHighAPI_Integer& theStamp,
89     const std::list<std::list<bool> >& theComponents);
90
91   /// Dump wrapped feature
92   COLLECTIONAPI_EXPORT
93   virtual void dump(ModelHighAPI_Dumper& theDumper) const;
94
95   /// Returns the internal values tables
96   COLLECTIONAPI_EXPORT
97   std::shared_ptr<ModelAPI_AttributeTables> tableValues();
98
99 };
100
101 /// Pointer on Field object.
102 typedef std::shared_ptr<CollectionAPI_Field> FieldPtr;
103
104 /// \inField CPPHighAPI
105 /// \brief Create Field feature.
106 COLLECTIONAPI_EXPORT
107 FieldPtr addField(const std::shared_ptr<ModelAPI_Document>& thePart,
108                   const ModelHighAPI_Integer& theStepsNum,
109                   const std::string& theComponentType,
110                   const int theComponentsNum,
111                   const std::list<std::string>& theComponentNames,
112                   const std::list<ModelHighAPI_Selection>& theSelectionList);
113
114 #endif // CollectionAPI_Field_H_