SHAPER  9.12.0
PartSet_SketcherReentrantMgr Class Reference

It provides reentrant create operations in sketch, that is when all inputs are valid, automatic validation of the creation and switch the created entity to edit mode ('internal' edit operation), with the ability to simultaneously create the next entity of same type (re-entrance of the operation). More...

Inheritance diagram for PartSet_SketcherReentrantMgr:
Inheritance graph

Public Slots

void onAutoConstraints (bool isOn)
 The slot is called when user checks "Automatic constraints" button. More...
 

Public Member Functions

 PartSet_SketcherReentrantMgr (ModuleBase_IWorkshop *theWorkshop)
 Constructor. More...
 
bool isInternalEditActive () const
 Return true if the current edit operation is an internal. More...
 
void updateInternalEditActiveState ()
 Stop internal edit if the operation feature is invalid. More...
 
bool processEnter (const std::string &thePreviousAttributeID)
 if the internal flags allow it and the manager is active, it starts an internal edit operation for the created operation. More...
 
void operationStarted (ModuleBase_Operation *theOperation)
 Resets the internal flags. More...
 
bool operationCommitted (ModuleBase_Operation *theOperation)
 Resets the internal flags. More...
 
void operationAborted (ModuleBase_Operation *theOperation)
 Resets the internal flags. More...
 
bool processMouseMoved (ModuleBase_IViewWindow *theWnd, QMouseEvent *theEvent)
 Return true if the manager processes the mouse move event It happens if the current operation is an internal edit operation and the first control can be filled by the mouse move event. More...
 
bool processMousePressed (ModuleBase_IViewWindow *theWnd, QMouseEvent *theEvent)
 Return true if the manager processes the mouse press event. More...
 
bool processMouseReleased (ModuleBase_IViewWindow *theWnd, QMouseEvent *theEvent)
 Return true if the manager processes the mouse enter event It happens if the current operation is an internal edit operation. More...
 
bool canBeCommittedByPreselection ()
 It is called by the current operation filling with the preselection. More...
 
void setReentrantMessage (const std::shared_ptr< Events_Message > &theMessage)
 Fills reentrant message during restarting operation. More...
 
std::shared_ptr< Events_MessagereentrantMessage () const
 Returnss reentrant message. More...
 
void setReentrantPreSelection (const std::shared_ptr< Events_Message > &theMessage)
 Put current selection into reentrant message. More...
 
bool isAutoConstraints () const
 
bool isLastAutoConstraint (const ObjectPtr &theObj) const
 

Detailed Description

It provides reentrant create operations in sketch, that is when all inputs are valid, automatic validation of the creation and switch the created entity to edit mode ('internal' edit operation), with the ability to simultaneously create the next entity of same type (re-entrance of the operation).

OK valids the current edition and exits from the operation (no re-entrance). Cancel removes (undo) the entity currently edited and exits from the operation (no re-entrance).

Constructor & Destructor Documentation

◆ PartSet_SketcherReentrantMgr()

PartSet_SketcherReentrantMgr::PartSet_SketcherReentrantMgr ( ModuleBase_IWorkshop theWorkshop)

Constructor.

Parameters
theWorkshopa workshop instance

Member Function Documentation

◆ isInternalEditActive()

bool PartSet_SketcherReentrantMgr::isInternalEditActive ( ) const

Return true if the current edit operation is an internal.

◆ updateInternalEditActiveState()

void PartSet_SketcherReentrantMgr::updateInternalEditActiveState ( )

Stop internal edit if the operation feature is invalid.

◆ processEnter()

bool PartSet_SketcherReentrantMgr::processEnter ( const std::string &  thePreviousAttributeID)

if the internal flags allow it and the manager is active, it starts an internal edit operation for the created operation.

Parameters
thePreviousAttributeIDan index of the previous active attribute

◆ operationStarted()

void PartSet_SketcherReentrantMgr::operationStarted ( ModuleBase_Operation theOperation)

Resets the internal flags.

Parameters
theOperationa started operation

◆ operationCommitted()

bool PartSet_SketcherReentrantMgr::operationCommitted ( ModuleBase_Operation theOperation)

Resets the internal flags.

Parameters
theOperationa started operation
Returns
state whether the internal edit operation was active

◆ operationAborted()

void PartSet_SketcherReentrantMgr::operationAborted ( ModuleBase_Operation theOperation)

Resets the internal flags.

Parameters
theOperationa started operation

◆ processMouseMoved()

bool PartSet_SketcherReentrantMgr::processMouseMoved ( ModuleBase_IViewWindow theWnd,
QMouseEvent *  theEvent 
)

Return true if the manager processes the mouse move event It happens if the current operation is an internal edit operation and the first control can be filled by the mouse move event.

The operation is restarted.

Returns
true if operation is committed.

before restarting of operation we need to clear selection, as it may take part in new feature creation, e.g. tangent arc. But it is not necessary as it was processed by mouse release when the operation was restarted.

◆ processMousePressed()

bool PartSet_SketcherReentrantMgr::processMousePressed ( ModuleBase_IViewWindow theWnd,
QMouseEvent *  theEvent 
)

Return true if the manager processes the mouse press event.

Returns
true if the current operation is an internal edit operation.

◆ processMouseReleased()

bool PartSet_SketcherReentrantMgr::processMouseReleased ( ModuleBase_IViewWindow theWnd,
QMouseEvent *  theEvent 
)

Return true if the manager processes the mouse enter event It happens if the current operation is an internal edit operation.

The operation is restarted. If the first widget of the started operation is the point 2d, it processes this mouse event

Returns
true if operation is committed.

selection should be obtained from workshop before ask if the operation can be started as the canStartOperation method performs commit/abort of previous operation. Sometimes commit/abort may cause selection clear(Sketch operation) as a result it will be lost and is not used for preselection.

◆ canBeCommittedByPreselection()

bool PartSet_SketcherReentrantMgr::canBeCommittedByPreselection ( )

It is called by the current operation filling with the preselection.

Returns false if the reentrant mode of the operation is not empty.

◆ setReentrantMessage()

void PartSet_SketcherReentrantMgr::setReentrantMessage ( const std::shared_ptr< Events_Message > &  theMessage)
inline

Fills reentrant message during restarting operation.

Parameters
theMessagereentrant message

◆ reentrantMessage()

std::shared_ptr<Events_Message> PartSet_SketcherReentrantMgr::reentrantMessage ( ) const
inline

Returnss reentrant message.

◆ setReentrantPreSelection()

void PartSet_SketcherReentrantMgr::setReentrantPreSelection ( const std::shared_ptr< Events_Message > &  theMessage)

Put current selection into reentrant message.

Parameters
theMessagea message of reentrant operation

◆ onAutoConstraints

void PartSet_SketcherReentrantMgr::onAutoConstraints ( bool  isOn)
slot

The slot is called when user checks "Automatic constraints" button.

Parameters
isOna state of the check box