SHAPER 9.16.0
ModuleBase_OperationFeature.h
1// Copyright (C) 2014-2026 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 ModuleBase_OperationFeature_H
21#define ModuleBase_OperationFeature_H
22
23#include <ModuleBase.h>
24#include <ModuleBase_Operation.h>
25
26#include <ModelAPI_Object.h>
27#include <ModelAPI_CompositeFeature.h>
28
29#include <QObject>
30#include <QString>
31#include <QStringList>
32
33#include <set>
34
40
41class QKeyEvent;
42
60class MODULEBASE_EXPORT ModuleBase_OperationFeature : public ModuleBase_Operation
61{
62Q_OBJECT
63
64 public:
65
67 static QString EditSuffix() { return "_E"; }
71 ModuleBase_OperationFeature(const QString& theId = "", QObject* theParent = 0);
74
76 bool isEditOperation() const { return myIsEditing; }
77
82 // \param theRestartTransaction if true, the current model transaction is committed and
84 void setEditOperation(const bool& isEditState/*const bool theRestartTransaction*/);
85
88 FeaturePtr feature() const;
89
92 virtual bool isValid() const;
93
95 void setFeature(FeaturePtr theFeature);
96
98 virtual bool hasObject(ObjectPtr theObj) const;
99
103 virtual bool isDisplayedOnStart(ObjectPtr theObject);
104
107 virtual void initSelection(
108 const QList<std::shared_ptr<ModuleBase_ViewerPrs>>& thePreSelected);
109
112 void setPreselection(const QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues);
113
116 virtual void setPropertyPanel(ModuleBase_IPropertyPanel* theProp);
117
118 // \return Currently installed property panel
119 //ModuleBase_IPropertyPanel* propertyPanel() const { return myPropertyPanel; }
120
124 virtual ModuleBase_ModelWidget* activateByPreselection(const std::string& theGreedAttributeId);
125
129 void setParentFeature(CompositeFeaturePtr theParent);
130
132 CompositeFeaturePtr parentFeature() const;
133
136 void setPreviousCurrentFeature(const FeaturePtr& theFeature);
137
140 FeaturePtr previousCurrentFeature();
141
144 void setNeedToBeAborted(const bool theState) { myNeedToBeAborted = theState; }
145
148 bool isNeedToBeAborted() const { return myNeedToBeAborted; }
149
153 void openTransactionOnResume() { myRestartTransactionOnResume = true; }
154
155 public slots:
163 virtual bool start();
164
168 void abort();
169
173 bool commit();
174
175 protected:
177 virtual void startOperation();
178
180 virtual void stopOperation();
181
183 virtual void resumeOperation();
184
188 virtual FeaturePtr createFeature(const bool theFlushMessage = true);
189
191 void clearPreselection();
192
193 protected:
195 FeaturePtr myFeature;
196
199 std::set<ObjectPtr> myVisualizedObjects;
200
203
206
208 QList<std::shared_ptr<ModuleBase_ViewerPrs>> myPreSelection;
209
213 CompositeFeaturePtr myParentFeature;
214
218
219 bool myRestartTransactionOnResume;
220};
221
222#endif
A class for Property panel object definition.
Definition: ModuleBase_IPropertyPanel.h:35
A class which provides access to selection.
Definition: ModuleBase_ISelection.h:44
A Base object for definition of connector object to Salome Viewer.
Definition: ModuleBase_IViewer.h:47
Class which provides access to Workshop object services.
Definition: ModuleBase_IWorkshop.h:48
An abstract custom widget class.
Definition: ModuleBase_ModelWidget.h:60
Base class for all operations.
Definition: ModuleBase_OperationFeature.h:61
static QString EditSuffix()
Appends to operation's history id, if it is an "edit" operation (myIsEditing == true)
Definition: ModuleBase_OperationFeature.h:67
void openTransactionOnResume()
Call this function on launch of a nested operation when transaction has to be reopened on resume of m...
Definition: ModuleBase_OperationFeature.h:153
QList< std::shared_ptr< ModuleBase_ViewerPrs > > myPreSelection
List of pre-selected object.
Definition: ModuleBase_OperationFeature.h:208
void setNeedToBeAborted(const bool theState)
Set whether the operation should be aborted.
Definition: ModuleBase_OperationFeature.h:144
FeaturePtr myFeature
The operation feature to be handled.
Definition: ModuleBase_OperationFeature.h:195
CompositeFeaturePtr myParentFeature
If the operation works with feature which is sub-feature of another one then this variable has to be ...
Definition: ModuleBase_OperationFeature.h:213
bool myNeedToBeAborted
State used only if the operation should not be committed.
Definition: ModuleBase_OperationFeature.h:205
bool isNeedToBeAborted() const
Returns valid state of the operation.
Definition: ModuleBase_OperationFeature.h:148
FeaturePtr myPreviousCurrentFeature
Last current feature before editing operation.
Definition: ModuleBase_OperationFeature.h:217
std::set< ObjectPtr > myVisualizedObjects
a list of hidden objects, which are displayed by operation start and should be hidden by operation st...
Definition: ModuleBase_OperationFeature.h:199
bool isEditOperation() const
Returns True id the current operation is launched in editing mode.
Definition: ModuleBase_OperationFeature.h:76
bool myIsEditing
Editing feature flag.
Definition: ModuleBase_OperationFeature.h:202
Base class for all operations.
Definition: ModuleBase_Operation.h:53
virtual void abort()
Aborts operation Public slot.
Definition: ModuleBase_Operation.cpp:115
virtual void setPropertyPanel(ModuleBase_IPropertyPanel *theProp)
Set property pane to the operation.
Definition: ModuleBase_Operation.cpp:173
virtual bool start()
Starts operation Public slot.
Definition: ModuleBase_Operation.cpp:91
virtual bool isValid() const
Must return True if the operation's feature is valid.
Definition: ModuleBase_Operation.cpp:81
virtual bool commit()
Commits operation Public slot.
Definition: ModuleBase_Operation.cpp:135
virtual void resumeOperation()
Virtual method called after operation resume (see resume() method for more description)
Definition: ModuleBase_Operation.h:193
virtual void stopOperation()
Virtual method called when operation stopped - committed or aborted.
Definition: ModuleBase_Operation.h:181
virtual void startOperation()
Virtual method called when operation started (see start() method for more description) Default impl c...
Definition: ModuleBase_Operation.h:175
Presentation.
Definition: ModuleBase_ViewerPrs.h:37