Salome HOME
315484297c90d9c5cd4fc7baccac46e402b6f20c
[modules/shaper.git] / src / Model / Model_ResultField.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        Model_ResultField.h
4 // Created:     16 Nov 2016
5 // Author:      Mikhail PONIKAROV
6
7 #ifndef Model_ResultField_H_
8 #define Model_ResultField_H_
9
10 #include "Model.h"
11 #include <ModelAPI_ResultField.h>
12 #include <vector>
13
14 /**\class Model_ResultField
15  * \ingroup DataModel
16  * \brief The fields result.
17  *
18  * Provides a compound of selected elements, without storage, one the fly.
19  */
20 class Model_ResultField : public ModelAPI_ResultField
21 {
22   std::shared_ptr<ModelAPI_Data> myOwnerData;  ///< data of owner of this result
23 public:
24
25   class Model_FieldStep : public ModelAPI_ResultField::ModelAPI_FieldStep
26   {
27   public:
28     Model_FieldStep(ModelAPI_ResultField* theParent, int theId) 
29       : myParent(theParent), myId(theId) {};
30
31     virtual ModelAPI_ResultField* field() const { return myParent; }
32
33     virtual int id() const { return myId; }
34
35   private:
36     ModelAPI_ResultField* myParent;
37     int myId;
38   };
39
40   /// Retuns the parameters of color definition in the resources config manager
41   MODEL_EXPORT virtual void colorConfigInfo(std::string& theSection, std::string& theName,
42                                             std::string& theDefault);
43
44   /// Returns the compound of selected entities
45   MODEL_EXPORT virtual std::shared_ptr<GeomAPI_Shape> shape();
46
47   /// Returns number of steps
48   MODEL_EXPORT virtual int stepsSize() const;
49
50   /// Returns a text line by its number
51   /// \param theLine a number of line
52   MODEL_EXPORT virtual std::string textLine(int theLine) const;
53
54   /// Returns step object
55   /// \param theId an id of the object
56   MODEL_EXPORT virtual ModelAPI_ResultField::ModelAPI_FieldStep* step(int theId) const;
57
58   /// Removes the stored builders
59   MODEL_EXPORT virtual ~Model_ResultField();
60
61 protected:
62   /// Makes a body on the given feature data
63   Model_ResultField(std::shared_ptr<ModelAPI_Data> theOwnerData);
64
65   friend class Model_Objects;
66
67 private:
68   void updateSteps();
69
70   std::vector<ModelAPI_FieldStep*> mySteps;
71 };
72
73 #endif