SHAPER  9.12.0
ModelAPI_ResultField.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_ResultField_H_
21 #define ModelAPI_ResultField_H_
22 
23 #include "ModelAPI_Result.h"
24 #include <GeomAPI_Shape.h>
25 #include <memory>
26 #include <string>
27 
35 {
36 public:
37 
39  {
40  public:
41  virtual ModelAPI_ResultField* field() const = 0;
42 
43  virtual int id() const = 0;
44 
46  inline static std::string group()
47  {
48  static std::string MY_GROUP = "FieldRersultStep";
49  return MY_GROUP;
50  }
51 
53  virtual std::string groupName() { return group(); }
54 
56  virtual void initAttributes() {}
57 
59  virtual bool isDisabled() { return false; }
60 
64  virtual bool isDisplayed() { return myIsDisplayed; }
65 
68  MODELAPI_EXPORT virtual void setDisplayed(const bool theDisplay);
69 
71  MODELAPI_EXPORT virtual std::wstring name() = 0;
72 
73  protected:
76  MODELAPI_EXPORT virtual void init() {}
77 
78  private:
79  bool myIsDisplayed;
80  };
81 
82  MODELAPI_EXPORT virtual ~ModelAPI_ResultField();
84  MODELAPI_EXPORT virtual std::string groupName();
85 
87  inline static std::string group()
88  {
89  static std::string MY_GROUP = "Fields";
90  return MY_GROUP;
91  }
92 
94  inline static const std::string& DEFAULT_COLOR()
95  {
96  static const std::string RESULT_GROUP_COLOR("150,150,180");
97  return RESULT_GROUP_COLOR;
98  }
99 
101  virtual int stepsSize() const = 0;
102 
105  virtual std::string textLine(int theLine) const = 0;
106 
109  virtual std::shared_ptr<ModelAPI_ResultField::ModelAPI_FieldStep> step(int theId) const = 0;
110 
113  MODELAPI_EXPORT virtual void setDisplayed(const bool theDisplay);
114 
116  MODELAPI_EXPORT virtual void updateSteps() = 0;
117 };
118 
120 typedef std::shared_ptr<ModelAPI_ResultField> ResultFieldPtr;
121 typedef std::shared_ptr<ModelAPI_ResultField::ModelAPI_FieldStep> FieldStepPtr;
122 
123 #endif
Represents any object in the data model and in the object browser.
Definition: ModelAPI_Object.h:45
Definition: ModelAPI_ResultField.h:39
virtual std::string groupName()
Returns the group identifier of this object.
Definition: ModelAPI_ResultField.h:53
virtual void setDisplayed(const bool theDisplay)
Sets the displayed/hidden state of the object.
Definition: ModelAPI_ResultField.cpp:35
static std::string group()
Returns the group identifier of this result.
Definition: ModelAPI_ResultField.h:46
virtual void init()
This method is called just after creation of the object: it must initialize all fields,...
Definition: ModelAPI_ResultField.h:76
virtual std::wstring name()=0
Returns a GUI name of this step.
virtual void initAttributes()
Request for initialization of data model of the object: adding all attributes.
Definition: ModelAPI_ResultField.h:56
virtual bool isDisplayed()
Returns true if object must be displayed in the viewer: flag is stored in the data model,...
Definition: ModelAPI_ResultField.h:64
virtual bool isDisabled()
Returns the feature is disabled or not.
Definition: ModelAPI_ResultField.h:59
The fields result.
Definition: ModelAPI_ResultField.h:35
static const std::string & DEFAULT_COLOR()
default color for a result body
Definition: ModelAPI_ResultField.h:94
virtual int stepsSize() const =0
Returns number of steps.
virtual std::string textLine(int theLine) const =0
Returns a text line by its number.
virtual std::string groupName()
Returns the group identifier of this result.
Definition: ModelAPI_ResultField.cpp:29
virtual void updateSteps()=0
To refresh the steps of a field.
virtual std::shared_ptr< ModelAPI_ResultField::ModelAPI_FieldStep > step(int theId) const =0
Returns step object.
static std::string group()
Returns the group identifier of this result.
Definition: ModelAPI_ResultField.h:87
virtual void setDisplayed(const bool theDisplay)
Sets the displayed/hidden state of the object.
Definition: ModelAPI_ResultField.cpp:56
The result of a feature.
Definition: ModelAPI_Result.h:35