SHAPER  9.15.0
ModelAPI_Result.h
1 // Copyright (C) 2014-2025 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_Result_H_
21 #define ModelAPI_Result_H_
22 
23 #include "ModelAPI_Object.h"
24 
25 class GeomAPI_Shape;
26 class ModelAPI_Feature;
27 
28 typedef std::list<std::shared_ptr<GeomAPI_Shape> > ListOfShape;
29 
37 {
38  bool myIsConcealed;
39  protected:
40  bool myIsDisabled;
41  public:
42 
46  inline static const std::string& COLOR_ID()
47  {
48  static const std::string MY_COLOR_ID("Color");
49  return MY_COLOR_ID;
50  }
51 
54  inline static const std::string& DEFLECTION_ID()
55  {
56  static const std::string MY_DEFLECTION_ID("Deflection");
57  return MY_DEFLECTION_ID;
58  }
59 
62  inline static const std::string& TRANSPARENCY_ID()
63  {
64  static const std::string MY_TRANSPARENCY_ID("Transparency");
65  return MY_TRANSPARENCY_ID;
66  }
67 
70  inline static const std::string& ISO_LINES_ID()
71  {
72  static const std::string MY_ISO_LINES_ID("Iso_lines");
73  return MY_ISO_LINES_ID;
74  }
75 
78  inline static const std::string& SHOW_ISO_LINES_ID()
79  {
80  static const std::string MY_SHOW_ISO_LINES_ID("Show_Iso_lines");
81  return MY_SHOW_ISO_LINES_ID;
82  }
83 
86  inline static const std::string& SHOW_EDGES_DIRECTION_ID()
87  {
88  static const std::string MY_SHOW_EDGES_DIRECTION_ID("Show_Edges_direction");
89  return MY_SHOW_EDGES_DIRECTION_ID;
90  }
91 
94  inline static const std::string& BRING_TO_FRONT_ID()
95  {
96  static const std::string MY_BRING_TO_FRONT_ID("Bring_To_Front");
97  return MY_BRING_TO_FRONT_ID;
98  }
99 
101  MODELAPI_EXPORT virtual bool isConcealed();
102 
104  MODELAPI_EXPORT virtual void setIsConcealed(const bool theValue, const bool theForced = false);
105 
112  MODELAPI_EXPORT virtual bool setDisabled(std::shared_ptr<ModelAPI_Result> theThis,
113  const bool theFlag);
114 
116  MODELAPI_EXPORT virtual bool isDisabled();
117 
119  MODELAPI_EXPORT virtual void initAttributes();
120 
122  MODELAPI_EXPORT virtual ~ModelAPI_Result();
123 
125  MODELAPI_EXPORT virtual std::shared_ptr<GeomAPI_Shape> shape();
126 
128  MODELAPI_EXPORT virtual ListOfShape
129  vertices(const bool theOnlyUnique = false);
130 
132  MODELAPI_EXPORT virtual ListOfShape
133  edges(const bool theOnlyUnique = false);
134 
136  MODELAPI_EXPORT virtual ListOfShape
137  wires(const bool theOnlyUnique = false);
138 
140  MODELAPI_EXPORT virtual ListOfShape
141  faces(const bool theOnlyUnique = false);
142 
144  MODELAPI_EXPORT virtual ListOfShape
145  shells(const bool theOnlyUnique = false);
146 
148  MODELAPI_EXPORT virtual ListOfShape
149  solids(const bool theOnlyUnique = false);
150 
153  MODELAPI_EXPORT virtual void attributeChanged(const std::string& theID);
154 
155 private:
157  void showErrorMessage();
158 
159 protected:
162  MODELAPI_EXPORT virtual void init();
163 
164 friend class Model_Objects;
165 };
166 
168 typedef std::shared_ptr<ModelAPI_Result> ResultPtr;
169 
170 #endif
Interface to the topological shape object.
Definition: GeomAPI_Shape.h:43
Feature function that represents the particular functionality of this operation.
Definition: ModelAPI_Feature.h:41
Represents any object in the data model and in the object browser.
Definition: ModelAPI_Object.h:45
The result of a feature.
Definition: ModelAPI_Result.h:37
static const std::string & BRING_TO_FRONT_ID()
Reference to the BringToFront flag of the result.
Definition: ModelAPI_Result.h:94
static const std::string & COLOR_ID()
Reference to the color of the result.
Definition: ModelAPI_Result.h:46
virtual void init()
This method is called just after creation of the object: it must initialize all fields,...
Definition: ModelAPI_Result.cpp:197
virtual ListOfShape vertices(const bool theOnlyUnique=false)
Returns all the vertices of this result.
Definition: ModelAPI_Result.cpp:129
virtual ListOfShape edges(const bool theOnlyUnique=false)
Returns all the edges of this result.
Definition: ModelAPI_Result.cpp:139
virtual ListOfShape faces(const bool theOnlyUnique=false)
Returns all the faces of this result.
Definition: ModelAPI_Result.cpp:159
virtual bool isConcealed()
Returns true if the result is concealed from the data tree (referenced by other objects)
Definition: ModelAPI_Result.cpp:89
virtual bool isDisabled()
Returns the result is disabled or not.
Definition: ModelAPI_Result.cpp:81
virtual bool setDisabled(std::shared_ptr< ModelAPI_Result > theThis, const bool theFlag)
Enables/disables the result.
Definition: ModelAPI_Result.cpp:57
virtual void initAttributes()
Request for initialization of data model of the result: adding all attributes.
Definition: ModelAPI_Result.cpp:42
static const std::string & DEFLECTION_ID()
Reference to the deflection of the result.
Definition: ModelAPI_Result.h:54
virtual ~ModelAPI_Result()
To virtually destroy the fields of successors.
Definition: ModelAPI_Result.cpp:38
bool myIsDisabled
the result is disabled: removed for the user, but keeps the general info
Definition: ModelAPI_Result.h:40
static const std::string & SHOW_EDGES_DIRECTION_ID()
Reference to the transparency of the result.
Definition: ModelAPI_Result.h:86
virtual void attributeChanged(const std::string &theID)
On change of attribute of the result update presentation of this result: for the current moment there...
Definition: ModelAPI_Result.cpp:189
virtual std::shared_ptr< GeomAPI_Shape > shape()
Returns the shape-result produced by this feature (or null if no shapes)
Definition: ModelAPI_Result.cpp:112
static const std::string & TRANSPARENCY_ID()
Reference to the transparency of the result.
Definition: ModelAPI_Result.h:62
virtual ListOfShape solids(const bool theOnlyUnique=false)
Returns all the solids of this result.
Definition: ModelAPI_Result.cpp:179
virtual ListOfShape wires(const bool theOnlyUnique=false)
Returns all the wires of this result.
Definition: ModelAPI_Result.cpp:149
static const std::string & SHOW_ISO_LINES_ID()
Reference to the transparency of the result.
Definition: ModelAPI_Result.h:78
static const std::string & ISO_LINES_ID()
Reference to the transparency of the result.
Definition: ModelAPI_Result.h:70
virtual ListOfShape shells(const bool theOnlyUnique=false)
Returns all the shells of this result.
Definition: ModelAPI_Result.cpp:169
virtual void setIsConcealed(const bool theValue, const bool theForced=false)
Sets the result as concealed in the data tree (referenced by other objects)
Definition: ModelAPI_Result.cpp:94
Manager of objects of the document.
Definition: Model_Objects.h:46