SHAPER  9.12.0
ModuleBase_OperationFeature Class Reference

Base class for all operations. More...

Inheritance diagram for ModuleBase_OperationFeature:
Inheritance graph

Public Slots

virtual bool start ()
 Starts operation Public slot. More...
 
void abort ()
 Aborts operation Public slot. More...
 
bool commit ()
 Commits operation Public slot. More...
 
virtual void postpone ()
 Deactivates current operation which can be resumed later. More...
 
virtual void resume ()
 Resumes operation Public slot. More...
 
void onValuesChanged ()
 Changes the modified flag of the operation. More...
 
void onValueStateChanged (int thePreviousState)
 Changes the modified flag of the operation if the current state of the widget is modified. More...
 

Signals

void beforeStarted ()
 The operation is started. More...
 
void started ()
 The operation is started. More...
 
void beforeAborted ()
 The operation is aborted. More...
 
void aborted ()
 The operation is aborted. More...
 
void beforeCommitted ()
 The operation is committed. More...
 
void committed ()
 The operation is committed. More...
 
void stopped ()
 The operation is aborted or committed. More...
 
void resumed ()
 The operation is resumed. More...
 
void postponed ()
 The operation is postponed. More...
 

Public Member Functions

 ModuleBase_OperationFeature (const QString &theId="", QObject *theParent=0)
 Constructor. More...
 
virtual ~ModuleBase_OperationFeature ()
 Destructor. More...
 
bool isEditOperation () const
 Returns True id the current operation is launched in editing mode. More...
 
void setEditOperation (const bool &isEditState)
 Change the operation mode from create to edit. More...
 
FeaturePtr feature () const
 Returns the operation feature. More...
 
virtual bool isValid () const
 Must return True if the operation's feature is valid. More...
 
void setFeature (FeaturePtr theFeature)
 Sets the operation feature. More...
 
virtual bool hasObject (ObjectPtr theObj) const
 Returns True if the current operation works with the given object (feature or result) More...
 
virtual bool isDisplayedOnStart (ObjectPtr theObject)
 Returns true if the object is displayed when the operation was started. More...
 
virtual void initSelection (const QList< std::shared_ptr< ModuleBase_ViewerPrs >> &thePreSelected)
 Initialisation of operation with preliminary selection. More...
 
void setPreselection (const QList< std::shared_ptr< ModuleBase_ViewerPrs >> &theValues)
 Fill internal map by preselection. More...
 
virtual void setPropertyPanel (ModuleBase_IPropertyPanel *theProp)
 Set property pane to the operation. More...
 
virtual ModuleBase_ModelWidgetactivateByPreselection (const std::string &theGreedAttributeId)
 Activates widgets by preselection if it is accepted. More...
 
void setParentFeature (CompositeFeaturePtr theParent)
 If the operation works with feature which is sub-feature of another one then this variable has to be initialised by parent feature before operation feature creating. More...
 
CompositeFeaturePtr parentFeature () const
 
void setPreviousCurrentFeature (const FeaturePtr &theFeature)
 Stores the previous to the operation current feature. More...
 
FeaturePtr previousCurrentFeature ()
 Returns the previous to the operation current feature. More...
 
void setNeedToBeAborted (const bool theState)
 Set whether the operation should be aborted. More...
 
bool isNeedToBeAborted () const
 Returns valid state of the operation. More...
 
void openTransactionOnResume ()
 Call this function on launch of a nested operation when transaction has to be reopened on resume of main operation By default transaction is not reopened on resuming. More...
 
ModuleBase_OperationDescriptiongetDescription () const
 Returns the operation description /returns the instance of the description class. More...
 
const QStringList & grantedOperationIds () const
 Returns list of granted operation indices. More...
 
void setGrantedOperationIds (const QStringList &theList)
 Sets list of operation indices, which can be started without the current operation stop. More...
 
virtual bool isGranted (QString theId) const
 Must return true if this operation can be launched as nested for any current operation and it is not necessary to check this operation on validity. More...
 
virtual bool isModified () const
 Returns True if data of its feature was modified during operation. More...
 
QString id () const
 Returns operations Id from it's description. More...
 
ModuleBase_IPropertyPanelpropertyPanel () const
 
QString helpFileName () const
 
void setHelpFileName (QString theName)
 
void setHideFacesVisible (bool isVisible)
 
bool isHideFacesVisible () const
 

Static Public Member Functions

static QString EditSuffix ()
 Appends to operation's history id, if it is an "edit" operation (myIsEditing == true) More...
 

Protected Member Functions

virtual void startOperation ()
 Displays the feature/results if it is hidden. It will be hided in stopOperation. More...
 
virtual void stopOperation ()
 Hide feature/results if they were hided on start. More...
 
virtual void resumeOperation ()
 Virtual method called after operation resume (see resume() method for more description) More...
 
virtual FeaturePtr createFeature (const bool theFlushMessage=true)
 Creates an operation new feature. More...
 
void clearPreselection ()
 Removes the preselection information and clears the map of preselection. More...
 
virtual void postponeOperation ()
 Implementation of specific steps on postpone operation. More...
 
virtual void abortOperation ()
 Virtual method called when operation aborted (see abort() method for more description) More...
 
virtual void commitOperation ()
 Virtual method called when operation committed (see commit() method for more description) More...
 
virtual void afterCommitOperation ()
 Virtual method called after operation committed (see commit() method for more description) More...
 
virtual bool canBeCommitted () const
 Verifies whether this operator can be commited. More...
 

Protected Attributes

FeaturePtr myFeature
 The operation feature to be handled. More...
 
std::set< ObjectPtr > myVisualizedObjects
 a list of hidden objects, whic are diplayed by operation start and should be hidden by operation stop More...
 
bool myIsEditing
 Editing feature flag. More...
 
bool myNeedToBeAborted
 State used only if the operation should not be commited. More...
 
QList< std::shared_ptr< ModuleBase_ViewerPrs > > myPreSelection
 List of pre-selected object. More...
 
CompositeFeaturePtr myParentFeature
 If the operation works with feature which is sub-feature of another one then this variable has to be initialised by parent feature before operation feature creating. More...
 
FeaturePtr myPreviousCurrentFeature
 Last current feature before editing operation. More...
 
bool myRestartTransactionOnResume
 

Detailed Description

Base class for all operations.

Base class for all operations. If you perform an action it is reasonable to create operation intended for this. This is a base class for all operations which provides mechanism for correct starting operations, starting operations above already started ones, committing operations and so on. To create own operation it is reasonable to inherit it from this class and redefines virtual methods to provide own behavior Main virtual methods are

Constructor & Destructor Documentation

◆ ModuleBase_OperationFeature()

ModuleBase_OperationFeature::ModuleBase_OperationFeature ( const QString &  theId = "",
QObject theParent = 0 
)

Constructor.

Parameters
theIdthe operation identifier
theParentthe QObject parent

◆ ~ModuleBase_OperationFeature()

ModuleBase_OperationFeature::~ModuleBase_OperationFeature ( )
virtual

Destructor.

Member Function Documentation

◆ EditSuffix()

static QString ModuleBase_OperationFeature::EditSuffix ( )
inlinestatic

Appends to operation's history id, if it is an "edit" operation (myIsEditing == true)

◆ isEditOperation()

bool ModuleBase_OperationFeature::isEditOperation ( ) const
inline

Returns True id the current operation is launched in editing mode.

◆ setEditOperation()

void ModuleBase_OperationFeature::setEditOperation ( const bool &  isEditState)

Change the operation mode from create to edit.

The transaction and the operation name in the model history of transaction are the same. It updates the edit state in the widgets of property panel

Parameters
isEditStateboolean state whether the operation should become editing or creating the new one is started

◆ feature()

FeaturePtr ModuleBase_OperationFeature::feature ( ) const

Returns the operation feature.

Returns
the feature

◆ isValid()

bool ModuleBase_OperationFeature::isValid ( ) const
virtual

Must return True if the operation's feature is valid.

Since IOperation does not have any feature returns false.

Reimplemented from ModuleBase_Operation.

◆ setFeature()

void ModuleBase_OperationFeature::setFeature ( FeaturePtr  theFeature)

Sets the operation feature.

◆ hasObject()

bool ModuleBase_OperationFeature::hasObject ( ObjectPtr  theObj) const
virtual

Returns True if the current operation works with the given object (feature or result)

◆ isDisplayedOnStart()

bool ModuleBase_OperationFeature::isDisplayedOnStart ( ObjectPtr  theObject)
virtual

Returns true if the object is displayed when the operation was started.

Parameters
theObjecta feature or result of the operation feature
Returns
boolean value whether the object display state was changed

◆ initSelection()

void ModuleBase_OperationFeature::initSelection ( const QList< std::shared_ptr< ModuleBase_ViewerPrs >> &  thePreSelected)
virtual

Initialisation of operation with preliminary selection.

Parameters
thePreSelecteda container of selected presentations

filtering of selection is not necessary

◆ setPreselection()

void ModuleBase_OperationFeature::setPreselection ( const QList< std::shared_ptr< ModuleBase_ViewerPrs >> &  theValues)

Fill internal map by preselection.

Parameters
theValuesa list of preselection

◆ setPropertyPanel()

void ModuleBase_OperationFeature::setPropertyPanel ( ModuleBase_IPropertyPanel theProp)
virtual

Set property pane to the operation.

Parameters
thePropa property panel instance

Reimplemented from ModuleBase_Operation.

◆ activateByPreselection()

ModuleBase_ModelWidget * ModuleBase_OperationFeature::activateByPreselection ( const std::string &  theGreedAttributeId)
virtual

Activates widgets by preselection if it is accepted.

Parameters
theGreedAttributeIda greed attribute id if there is in the current feature
Returns
last filled widget

◆ setParentFeature()

void ModuleBase_OperationFeature::setParentFeature ( CompositeFeaturePtr  theParent)

If the operation works with feature which is sub-feature of another one then this variable has to be initialised by parent feature before operation feature creating.

◆ parentFeature()

CompositeFeaturePtr ModuleBase_OperationFeature::parentFeature ( ) const
Returns
Installed parent feature (can be NULL)

◆ setPreviousCurrentFeature()

void ModuleBase_OperationFeature::setPreviousCurrentFeature ( const FeaturePtr &  theFeature)

Stores the previous to the operation current feature.

Parameters
theFeaturea feature

◆ previousCurrentFeature()

FeaturePtr ModuleBase_OperationFeature::previousCurrentFeature ( )

Returns the previous to the operation current feature.

Returns
theFeature a feature

◆ setNeedToBeAborted()

void ModuleBase_OperationFeature::setNeedToBeAborted ( const bool  theState)
inline

Set whether the operation should be aborted.

By default the state is false in operation

Parameters
theStateabort state

◆ isNeedToBeAborted()

bool ModuleBase_OperationFeature::isNeedToBeAborted ( ) const
inline

Returns valid state of the operation.

Returns
custom validity state (it is almost always true)

◆ openTransactionOnResume()

void ModuleBase_OperationFeature::openTransactionOnResume ( )
inline

Call this function on launch of a nested operation when transaction has to be reopened on resume of main operation By default transaction is not reopened on resuming.

◆ start

bool ModuleBase_OperationFeature::start ( )
virtualslot

Starts operation Public slot.

Verifies whether operation can be started and starts operation. This slot is not virtual and cannot be redefined. Redefine startOperation method to change behavior of operation. There is no point in using this method. It would be better to inherit own operator from base one and redefine startOperation method instead.

Returns
true if the start is successful

◆ abort

void ModuleBase_OperationFeature::abort ( )
slot

Aborts operation Public slot.

Aborts operation. This slot is not virtual and cannot be redefined. Redefine abortOperation method to change behavior of operation instead

◆ commit

bool ModuleBase_OperationFeature::commit ( )
slot

Commits operation Public slot.

Commits operation. This slot is not virtual and cannot be redefined. Redefine commitOperation method to change behavior of operation instead

◆ startOperation()

void ModuleBase_OperationFeature::startOperation ( )
protectedvirtual

Displays the feature/results if it is hidden. It will be hided in stopOperation.

Reimplemented from ModuleBase_Operation.

◆ stopOperation()

void ModuleBase_OperationFeature::stopOperation ( )
protectedvirtual

Hide feature/results if they were hided on start.

Reimplemented from ModuleBase_Operation.

◆ resumeOperation()

void ModuleBase_OperationFeature::resumeOperation ( )
protectedvirtual

Virtual method called after operation resume (see resume() method for more description)

Reimplemented from ModuleBase_Operation.

◆ createFeature()

FeaturePtr ModuleBase_OperationFeature::createFeature ( const bool  theFlushMessage = true)
protectedvirtual

Creates an operation new feature.

Parameters
theFlushMessagethe flag whether the create message should be flushed
Returns
the created feature

◆ clearPreselection()

void ModuleBase_OperationFeature::clearPreselection ( )
protected

Removes the preselection information and clears the map of preselection.

◆ getDescription()

ModuleBase_OperationDescription* ModuleBase_Operation::getDescription ( ) const
inlineinherited

Returns the operation description /returns the instance of the description class.

◆ grantedOperationIds()

const QStringList & ModuleBase_Operation::grantedOperationIds ( ) const
inherited

Returns list of granted operation indices.

◆ setGrantedOperationIds()

void ModuleBase_Operation::setGrantedOperationIds ( const QStringList &  theList)
inherited

Sets list of operation indices, which can be started without the current operation stop.

Parameters
theListan ids

◆ isGranted()

bool ModuleBase_Operation::isGranted ( QString  theId) const
virtualinherited

Must return true if this operation can be launched as nested for any current operation and it is not necessary to check this operation on validity.

By default the operation is not granted. The method has to be redefined for granted operations.

◆ isModified()

bool ModuleBase_Operation::isModified ( ) const
virtualinherited

Returns True if data of its feature was modified during operation.

◆ id()

QString ModuleBase_Operation::id ( ) const
inherited

Returns operations Id from it's description.

◆ propertyPanel()

ModuleBase_IPropertyPanel* ModuleBase_Operation::propertyPanel ( ) const
inlineinherited
Returns
Currently installed property panel

◆ beforeStarted

void ModuleBase_Operation::beforeStarted ( )
signalinherited

The operation is started.

◆ started

void ModuleBase_Operation::started ( )
signalinherited

The operation is started.

◆ beforeAborted

void ModuleBase_Operation::beforeAborted ( )
signalinherited

The operation is aborted.

◆ aborted

void ModuleBase_Operation::aborted ( )
signalinherited

The operation is aborted.

◆ beforeCommitted

void ModuleBase_Operation::beforeCommitted ( )
signalinherited

The operation is committed.

◆ committed

void ModuleBase_Operation::committed ( )
signalinherited

The operation is committed.

◆ stopped

void ModuleBase_Operation::stopped ( )
signalinherited

The operation is aborted or committed.

◆ resumed

void ModuleBase_Operation::resumed ( )
signalinherited

The operation is resumed.

◆ postponed

void ModuleBase_Operation::postponed ( )
signalinherited

The operation is postponed.

◆ postpone

void ModuleBase_Operation::postpone ( )
virtualslotinherited

Deactivates current operation which can be resumed later.

◆ resume

void ModuleBase_Operation::resume ( )
virtualslotinherited

Resumes operation Public slot.

Verifies whether operation can be started and starts operation. This slot is not virtual and cannot be redefined. Redefine startOperation method to change behavior of operation. There is no point in using this method. It would be better to inherit own operator from base one and redefine startOperation method instead.

◆ onValuesChanged

void ModuleBase_Operation::onValuesChanged ( )
slotinherited

Changes the modified flag of the operation.

◆ onValueStateChanged

void ModuleBase_Operation::onValueStateChanged ( int  thePreviousState)
slotinherited

Changes the modified flag of the operation if the current state of the widget is modified.

Parameters
thePreviousStatethe previous vlaue state of the widget

◆ postponeOperation()

virtual void ModuleBase_Operation::postponeOperation ( )
inlineprotectedvirtualinherited

Implementation of specific steps on postpone operation.

◆ abortOperation()

virtual void ModuleBase_Operation::abortOperation ( )
inlineprotectedvirtualinherited

Virtual method called when operation aborted (see abort() method for more description)

◆ commitOperation()

virtual void ModuleBase_Operation::commitOperation ( )
inlineprotectedvirtualinherited

Virtual method called when operation committed (see commit() method for more description)

◆ afterCommitOperation()

virtual void ModuleBase_Operation::afterCommitOperation ( )
inlineprotectedvirtualinherited

Virtual method called after operation committed (see commit() method for more description)

◆ canBeCommitted()

bool ModuleBase_Operation::canBeCommitted ( ) const
protectedvirtualinherited

Verifies whether this operator can be commited.

Returns
Returns TRUE if current operation can be committed, e.g. all parameters are filled

Field Documentation

◆ myFeature

FeaturePtr ModuleBase_OperationFeature::myFeature
protected

The operation feature to be handled.

◆ myVisualizedObjects

std::set<ObjectPtr> ModuleBase_OperationFeature::myVisualizedObjects
protected

a list of hidden objects, whic are diplayed by operation start and should be hidden by operation stop

◆ myIsEditing

bool ModuleBase_OperationFeature::myIsEditing
protected

Editing feature flag.

◆ myNeedToBeAborted

bool ModuleBase_OperationFeature::myNeedToBeAborted
protected

State used only if the operation should not be commited.

◆ myPreSelection

QList<std::shared_ptr<ModuleBase_ViewerPrs> > ModuleBase_OperationFeature::myPreSelection
protected

List of pre-selected object.

◆ myParentFeature

CompositeFeaturePtr ModuleBase_OperationFeature::myParentFeature
protected

If the operation works with feature which is sub-feature of another one then this variable has to be initialised by parent feature before operation feature creating.

◆ myPreviousCurrentFeature

FeaturePtr ModuleBase_OperationFeature::myPreviousCurrentFeature
protected

Last current feature before editing operation.

It is cashed when Edit operation is started in order to restore the document current feature on commit/abort this operation.