1 // Copyright (C) 2014-2019 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef ModelAPI_ResultField_H_
21 #define ModelAPI_ResultField_H_
23 #include "ModelAPI_Result.h"
24 #include <GeomAPI_Shape.h>
28 /**\class ModelAPI_ResultField
30 * \brief The fields result.
32 * Provides a compound of selected elements, without storage, one the fly.
34 class ModelAPI_ResultField : public ModelAPI_Result
38 class ModelAPI_FieldStep : public ModelAPI_Object
41 virtual ModelAPI_ResultField* field() const = 0;
43 virtual int id() const = 0;
45 /// Returns the group identifier of this result
46 inline static std::string group()
48 static std::string MY_GROUP = "FieldRersultStep";
52 /// Returns the group identifier of this object
53 virtual std::string groupName() { return group(); }
55 /// Request for initialization of data model of the object: adding all attributes
56 virtual void initAttributes() {}
58 /// Returns the feature is disabled or not.
59 virtual bool isDisabled() { return false; }
61 /// Returns true if object must be displayed in the viewer: flag is stored in the
62 /// data model, so on undo/redo, open/save or recreation of object by history-playing it keeps
63 /// the original state in the current transaction.
64 virtual bool isDisplayed() { return myIsDisplayed; }
66 /// Sets the displayed/hidden state of the object. If it is changed, sends the "redisplay"
68 MODELAPI_EXPORT virtual void setDisplayed(const bool theDisplay);
70 /// Returns a GUI name of this step
71 MODELAPI_EXPORT virtual std::string name() = 0;
74 /// This method is called just after creation of the object: it must initialize
75 /// all fields, normally initialized in the constructor
76 MODELAPI_EXPORT virtual void init() {}
82 MODELAPI_EXPORT virtual ~ModelAPI_ResultField();
83 /// Returns the group identifier of this result
84 MODELAPI_EXPORT virtual std::string groupName();
86 /// Returns the group identifier of this result
87 inline static std::string group()
89 static std::string MY_GROUP = "Fields";
93 /// default color for a result body
94 inline static const std::string& DEFAULT_COLOR()
96 static const std::string RESULT_GROUP_COLOR("150,150,180");
97 return RESULT_GROUP_COLOR;
100 /// Returns number of steps
101 virtual int stepsSize() const = 0;
103 /// Returns a text line by its number
104 /// \param theLine a number of line
105 virtual std::string textLine(int theLine) const = 0;
107 /// Returns step object
108 /// \param theId an id of the object
109 virtual std::shared_ptr<ModelAPI_ResultField::ModelAPI_FieldStep> step(int theId) const = 0;
111 /// Sets the displayed/hidden state of the object. If it is changed, sends the "redisplay"
113 MODELAPI_EXPORT virtual void setDisplayed(const bool theDisplay);
115 /// To refresh the steps of a field
116 MODELAPI_EXPORT virtual void updateSteps() = 0;
119 //! Pointer on feature object
120 typedef std::shared_ptr<ModelAPI_ResultField> ResultFieldPtr;
121 typedef std::shared_ptr<ModelAPI_ResultField::ModelAPI_FieldStep> FieldStepPtr;