SHAPER  9.12.0
PartSet_SketcherMgr Class Reference

A class for management of sketch operations At the time of the sketcher operation active, only the sketch sub-feature results are displayed in the viewer. More...

Inheritance diagram for PartSet_SketcherMgr:
Inheritance graph

Data Structures

struct  SelectionInfo
 Struct to define selection model information to store/restore selection. More...
 

Public Types

enum  SelectionType { ST_HighlightType , ST_SelectType , ST_SelectAndHighlightType }
 Enumeration for selection mode used. More...
 
typedef QMap< FeaturePtr, SelectionInfoFeatureToSelectionMap
 

Public Slots

void onPlaneSelected (const std::shared_ptr< GeomAPI_Pln > &thePln)
 Process sketch plane selected event. More...
 
void onShowPoints (bool toShow)
 The slot is called when user checks "Show free points" button. More...
 

Public Member Functions

 PartSet_SketcherMgr (PartSet_Module *theModule)
 Constructor. More...
 
bool isNestedSketchOperation (ModuleBase_Operation *theOperation) const
 Returns true if the operation feature belongs to list of granted features of Sketch operation. More...
 
bool isNestedSketchFeature (const QString &theFeatureKind) const
 Returns true if the feature kind belongs to list of granted features of Sketch operation. More...
 
bool isNestedCreateOperation (ModuleBase_Operation *theOperation, const CompositeFeaturePtr &) const
 Returns true if the operation is a create and nested sketch operationn. More...
 
bool isNestedEditOperation (ModuleBase_Operation *theOperation, const CompositeFeaturePtr &) const
 Returns true if the operation is an edit nested feature one. More...
 
bool isMouseOverWindow ()
 Returns true if a mouse cursor is over viewer window. More...
 
CompositeFeaturePtr activeSketch () const
 Returns current Sketch feature/ Returns NULL if there is no launched sketch operation. More...
 
PartSet_PreviewSketchPlanepreviewSketchPlane () const
 Returns help class to visualize sketcher plane. More...
 
void startSketch (ModuleBase_Operation *)
 Starts sketch operation. More...
 
void stopSketch (ModuleBase_Operation *)
 Stops sketch operation. More...
 
void startNestedSketch (ModuleBase_Operation *theOperation)
 Starts sketch operation, connects to the opeation property panel. More...
 
void stopNestedSketch (ModuleBase_Operation *theOperation)
 Stop sketch operation, disconnects from the opeation property panel. More...
 
void commitNestedSketch (ModuleBase_Operation *theOperation)
 Visualizes the operation feature if it is a creation nested feature operation. More...
 
bool sketchSelectionFilter (const ModuleBase_SelectionFilterType theFilterType)
 Returns true if the filter is created by the sketch manager. More...
 
void registerSelectionFilter (const ModuleBase_SelectionFilterType theFilterType, const Handle &&theFilter)
 Append selection filter into the module and type of the filter in internal container. More...
 
bool operationActivatedByPreselection ()
 Commit the operation if it is possible. More...
 
bool canUndo () const
 Returns True if there are available Undos and the sketch manager allows undo. More...
 
bool canRedo () const
 Returns True if there are available Redos and the sketch manager allows redo. More...
 
bool canEraseObject (const ObjectPtr &theObject) const
 Returns False only if the sketch creating feature can not be visualized. More...
 
bool canDisplayObject (const ObjectPtr &theObject) const
 Returns whether the object can be displayed at the bounds of the active operation. More...
 
bool canDisplayConstraint (const FeaturePtr &theObject, const PartSet_Tools::ConstraintVisibleState &theState, bool &isProcessed) const
 Returns whether the constraint object can be displayed. More...
 
bool canDisplayCurrentCreatedFeature () const
 Check the given objects either there are some results of the current sketch. More...
 
bool canChangeCursor (ModuleBase_Operation *theOperation) const
 Returns true if the current operation is nested creation or internal reentrant edit. More...
 
const QMap< PartSet_Tools::ConstraintVisibleState, bool > & showConstraintStates ()
 Returns state of constraints showing flag. More...
 
bool isObjectOfSketch (const ObjectPtr &theObject) const
 Returns true if the object is a current sketch sub feature of a result of the feature. More...
 
void storeSelection (const SelectionType theType, FeatureToSelectionMap &theCurrentSelection)
 Saves the current selection in the viewer into an internal container It obtains the selected attributes. More...
 
void restoreSelection (FeatureToSelectionMap &theCurrentSelection)
 Restores previously saved selection state. More...
 
bool sketchSolverError ()
 Return error state of the sketch feature, true if the error has happened. More...
 
QString getFeatureError (const FeaturePtr &theFeature)
 Returns the feature error if the current state of the feature in the sketch is not correct If the feature is correct, it returns an empty value Incorrect states: the feature is sketch, the solver error value The feature value is reset, this is the flag of sketch mgr. More...
 
void clearClickedFlags ()
 It nullify internal flags concerned to clicked mouse event. More...
 
 HandleccreatePresentation (const ObjectPtr &theResult)
 Create specific for the module presentation. More...
 
void connectToPropertyPanel (ModuleBase_ModelWidget *theWidget, const bool isToConnect)
 Connects or disconnects to the value changed signal of the property panel widgets. More...
 
void widgetStateChanged (int thePreviousState)
 Visualize the operation feature if the previous state is modified value in property panel. More...
 
void customizeSketchPresentation (const ObjectPtr &theObject, const AISObjectPtr &thePrs) const
 If the current operation is a dimention one, the style of dimension visualization is send for the current object. More...
 
void updateBySketchParameters (const PartSet_Tools::ConstraintVisibleState &theType, bool theState)
 Update sketch presentations according to the the state. More...
 
bool isShowFreePointsShown () const
 
PartSet_Modulemodule () const
 
virtual void processEvent (const std::shared_ptr< Events_Message > &theMessage)
 Implementation of Event Listener method. More...
 
bool isDragModeCreation () const
 Returns true if current mode of objects creation is by drag mouse. More...
 
virtual EVENTS_EXPORT bool groupMessages ()
 Listener that needs mostly grouped messages received returns true in this method. More...
 

Static Public Member Functions

static bool isSketchOperation (ModuleBase_Operation *theOperation)
 Returns true if the operation is the sketch. More...
 
static bool isEntity (const std::string &theId)
 Returns whether the current operation is a sketch entity - line, point, arc or circle. More...
 
static bool isExternalFeature (const FeaturePtr &theFeature)
 Returns whether the feature has external attribute filled with 'true' value. More...
 
static bool isDistanceOperation (ModuleBase_Operation *theOperation)
 Returns whether the current operation is a sketch distance - lenght, distance or radius. More...
 
static bool isDistanceKind (std::string &theKind)
 Returns whether the feature kind is a sketch distance - lenght, distance or radius. More...
 
static const QStringList & replicationsIdList ()
 Returns list of strings which contains id's of sketch replication operations. More...
 
static const QStringList & constraintsIdList ()
 Returns list of strings which contains id's of constraints operations. More...
 
static void sketchSelectionModes (const CompositeFeaturePtr &theSketch, QIntList &theModes)
 Returns a list of modes, where the AIS objects should be activated. More...
 

Protected Member Functions

void groupWhileFlush (const std::shared_ptr< Events_Message > &theMessage)
 Allows to group messages while they are flushed (for flush for groupMessages=true listeners) More...
 
EVENTS_EXPORT void flushGrouped (const Events_ID &theID)
 Sends myGroups on flush finish. More...
 

Detailed Description

A class for management of sketch operations At the time of the sketcher operation active, only the sketch sub-feature results are displayed in the viewer.

After the sketch create/edit operation is finished, the sub-feature are hidden, the sketch feature result is displayed

Member Enumeration Documentation

◆ SelectionType

Enumeration for selection mode used.

Enumerator
ST_SelectType 

Only highlighted objects.

ST_SelectAndHighlightType 

Only selected objects.

Both, highlighted and selected objects

Constructor & Destructor Documentation

◆ PartSet_SketcherMgr()

PartSet_SketcherMgr::PartSet_SketcherMgr ( PartSet_Module theModule)

Constructor.

Parameters
theModulea pointer to PartSet module

Member Function Documentation

◆ isSketchOperation()

bool PartSet_SketcherMgr::isSketchOperation ( ModuleBase_Operation theOperation)
static

Returns true if the operation is the sketch.

Parameters
theOperationan operation
Returns
the boolean result

◆ isNestedSketchOperation()

bool PartSet_SketcherMgr::isNestedSketchOperation ( ModuleBase_Operation theOperation) const

Returns true if the operation feature belongs to list of granted features of Sketch operation.

An operation of a sketch should be started before.

Parameters
theOperationan operation
Returns
the boolean result

◆ isNestedSketchFeature()

bool PartSet_SketcherMgr::isNestedSketchFeature ( const QString &  theFeatureKind) const

Returns true if the feature kind belongs to list of granted features of Sketch operation.

An operation of a sketch should be started before.

Parameters
theOperationan operation
Returns
the boolean result

◆ isNestedCreateOperation()

bool PartSet_SketcherMgr::isNestedCreateOperation ( ModuleBase_Operation theOperation,
const CompositeFeaturePtr &  theSketch 
) const

Returns true if the operation is a create and nested sketch operationn.

Parameters
theOperationa checked operation
theSketcha sketch feature

◆ isNestedEditOperation()

bool PartSet_SketcherMgr::isNestedEditOperation ( ModuleBase_Operation theOperation,
const CompositeFeaturePtr &  theSketch 
) const

Returns true if the operation is an edit nested feature one.

Parameters
theOperationa checked operation

◆ isEntity()

bool PartSet_SketcherMgr::isEntity ( const std::string &  theId)
static

Returns whether the current operation is a sketch entity - line, point, arc or circle.

Parameters
theIdis an id of object
Returns
a boolean value

◆ isExternalFeature()

bool PartSet_SketcherMgr::isExternalFeature ( const FeaturePtr &  theFeature)
static

Returns whether the feature has external attribute filled with 'true' value.

Parameters
theFeaturea feature object
Returns
a boolean value

◆ isDistanceOperation()

bool PartSet_SketcherMgr::isDistanceOperation ( ModuleBase_Operation theOperation)
static

Returns whether the current operation is a sketch distance - lenght, distance or radius.

Parameters
theOperationthe operation
Returns
a boolean value

◆ isDistanceKind()

bool PartSet_SketcherMgr::isDistanceKind ( std::string &  theKind)
static

Returns whether the feature kind is a sketch distance - lenght, distance or radius.

Parameters
theKindthe feature kind
Returns
a boolean value

◆ isMouseOverWindow()

bool PartSet_SketcherMgr::isMouseOverWindow ( )
inline

Returns true if a mouse cursor is over viewer window.

◆ activeSketch()

CompositeFeaturePtr PartSet_SketcherMgr::activeSketch ( ) const
inline

Returns current Sketch feature/ Returns NULL if there is no launched sketch operation.

◆ previewSketchPlane()

PartSet_PreviewSketchPlane* PartSet_SketcherMgr::previewSketchPlane ( ) const
inline

Returns help class to visualize sketcher plane.

Returns
a preview plane

◆ startSketch()

void PartSet_SketcherMgr::startSketch ( ModuleBase_Operation theOperation)

Starts sketch operation.

◆ stopSketch()

void PartSet_SketcherMgr::stopSketch ( ModuleBase_Operation theOperation)

Stops sketch operation.

◆ startNestedSketch()

void PartSet_SketcherMgr::startNestedSketch ( ModuleBase_Operation theOperation)

Starts sketch operation, connects to the opeation property panel.

Parameters
theOperationa committed operation

◆ stopNestedSketch()

void PartSet_SketcherMgr::stopNestedSketch ( ModuleBase_Operation theOperation)

Stop sketch operation, disconnects from the opeation property panel.

Parameters
theOperationa stopped operation

improvement to deselect automatically all eventual selected objects, when

◆ commitNestedSketch()

void PartSet_SketcherMgr::commitNestedSketch ( ModuleBase_Operation theOperation)

Visualizes the operation feature if it is a creation nested feature operation.

Parameters
theOperationa committed operation

◆ sketchSelectionFilter()

bool PartSet_SketcherMgr::sketchSelectionFilter ( const ModuleBase_SelectionFilterType  theFilterType)

Returns true if the filter is created by the sketch manager.

Parameters
theFilterTypea checked type
Returns
boolean value

◆ registerSelectionFilter()

void PartSet_SketcherMgr::registerSelectionFilter ( const ModuleBase_SelectionFilterType  theFilterType,
const Handle &&  theFilter 
)

Append selection filter into the module and type of the filter in internal container.

Parameters
theFilterTypeselection filter type
theFilteradded filter

◆ operationActivatedByPreselection()

bool PartSet_SketcherMgr::operationActivatedByPreselection ( )

Commit the operation if it is possible.

If the operation is dimention constraint, it gives widget editor to input dimention value

Returns
true if the operation is stopped after activation

Commit sketcher operations automatically distance operation are able to show popup editor to modify the distance value after entering the value, the operation should be committed/aborted(by Esc key)

◆ canUndo()

bool PartSet_SketcherMgr::canUndo ( ) const

Returns True if there are available Undos and the sketch manager allows undo.

Returns
the boolean result

◆ canRedo()

bool PartSet_SketcherMgr::canRedo ( ) const

Returns True if there are available Redos and the sketch manager allows redo.

Returns
the boolean result

◆ canEraseObject()

bool PartSet_SketcherMgr::canEraseObject ( const ObjectPtr &  theObject) const

Returns False only if the sketch creating feature can not be visualized.

Returns
a boolean value Returns whether the object can be erased at the bounds of the active operation. Sketch sub-entities can not be erased during the sketch operation
Parameters
theObjecta model object

◆ canDisplayObject()

bool PartSet_SketcherMgr::canDisplayObject ( const ObjectPtr &  theObject) const

Returns whether the object can be displayed at the bounds of the active operation.

Display only current operation results for usual operation and ask the sketcher manager if it is a sketch operation

Parameters
theObjecta model object

some sketch entities should be never shown, e.g. projection feature

◆ canDisplayConstraint()

bool PartSet_SketcherMgr::canDisplayConstraint ( const FeaturePtr &  theObject,
const PartSet_Tools::ConstraintVisibleState theState,
bool &  isProcessed 
) const

Returns whether the constraint object can be displayed.

It depends on the sketch check box states

Parameters
theObjecta model object
theStatethe constraint visible state state to be checked
isProcessedan output parameter if it is processed
Returns
result value

◆ canDisplayCurrentCreatedFeature()

bool PartSet_SketcherMgr::canDisplayCurrentCreatedFeature ( ) const

Check the given objects either there are some results of the current sketch.

If so, it suggests to delete them as there are no functionality to show back hidden sketch objects

Parameters
theObjectsa list of hidden objects Returns true if the mouse is over viewer or property panel value is changed
Returns
boolean result

◆ canChangeCursor()

bool PartSet_SketcherMgr::canChangeCursor ( ModuleBase_Operation theOperation) const

Returns true if the current operation is nested creation or internal reentrant edit.

Parameters
theOperationan operation

◆ showConstraintStates()

const QMap< PartSet_Tools::ConstraintVisibleState, bool > & PartSet_SketcherMgr::showConstraintStates ( )

Returns state of constraints showing flag.

◆ isObjectOfSketch()

bool PartSet_SketcherMgr::isObjectOfSketch ( const ObjectPtr &  theObject) const

Returns true if the object is a current sketch sub feature of a result of the feature.

Parameters
theObjectan object
Returns
boolean value

◆ storeSelection()

void PartSet_SketcherMgr::storeSelection ( const SelectionType  theType,
PartSet_SketcherMgr::FeatureToSelectionMap &  theCurrentSelection 
)

Saves the current selection in the viewer into an internal container It obtains the selected attributes.

The highlighted objects can be processes as the selected ones

Parameters
theHighlightedOnlya boolean flag
theCurrentSelectiona container filled by the current selection

◆ restoreSelection()

void PartSet_SketcherMgr::restoreSelection ( PartSet_SketcherMgr::FeatureToSelectionMap &  theCurrentSelection)

Restores previously saved selection state.

Parameters
theCurrentSelectiona container filled by the current selection

◆ sketchSolverError()

bool PartSet_SketcherMgr::sketchSolverError ( )

Return error state of the sketch feature, true if the error has happened.

Returns
boolean value

◆ getFeatureError()

QString PartSet_SketcherMgr::getFeatureError ( const FeaturePtr &  theFeature)

Returns the feature error if the current state of the feature in the sketch is not correct If the feature is correct, it returns an empty value Incorrect states: the feature is sketch, the solver error value The feature value is reset, this is the flag of sketch mgr.

Returns
string value

◆ clearClickedFlags()

void PartSet_SketcherMgr::clearClickedFlags ( )

It nullify internal flags concerned to clicked mouse event.

◆ replicationsIdList()

const QStringList & PartSet_SketcherMgr::replicationsIdList ( )
static

Returns list of strings which contains id's of sketch replication operations.

◆ constraintsIdList()

const QStringList & PartSet_SketcherMgr::constraintsIdList ( )
static

Returns list of strings which contains id's of constraints operations.

◆ sketchSelectionModes()

void PartSet_SketcherMgr::sketchSelectionModes ( const CompositeFeaturePtr &  theSketch,
QIntList &  theModes 
)
static

Returns a list of modes, where the AIS objects should be activated.

Parameters
theSketcha sketch object, modes are empty if sketch plane is not defined yet
theModesa list of modes

◆ HandleccreatePresentation()

PartSet_SketcherMgr::HandleccreatePresentation ( const ObjectPtr &  theResult)

Create specific for the module presentation.

Parameters
theResultan object for presentation
Returns
created presentation or NULL(default value)

◆ connectToPropertyPanel()

void PartSet_SketcherMgr::connectToPropertyPanel ( ModuleBase_ModelWidget theWidget,
const bool  isToConnect 
)

Connects or disconnects to the value changed signal of the property panel widgets.

Parameters
theWidgeta property contol widget
isToConnecta boolean value whether connect or disconnect

◆ widgetStateChanged()

void PartSet_SketcherMgr::widgetStateChanged ( int  thePreviousState)

Visualize the operation feature if the previous state is modified value in property panel.

Parameters
thePreviousStatethe previous widget value state

◆ customizeSketchPresentation()

void PartSet_SketcherMgr::customizeSketchPresentation ( const ObjectPtr &  theObject,
const AISObjectPtr &  thePrs 
) const

If the current operation is a dimention one, the style of dimension visualization is send for the current object.

Parameters
theObjectan object to be customized

◆ updateBySketchParameters()

void PartSet_SketcherMgr::updateBySketchParameters ( const PartSet_Tools::ConstraintVisibleState theType,
bool  theState 
)

Update sketch presentations according to the the state.

Parameters
theTypea type of sketch visualization style
theStatea boolean state

call all sketch features redisplay, the expression state will be corrected in customize of distance presentation

◆ processEvent()

void PartSet_SketcherMgr::processEvent ( const std::shared_ptr< Events_Message > &  theMessage)
virtual

Implementation of Event Listener method.

Parameters
[in]theMessagethe data of the event

Implements Events_Listener.

◆ isDragModeCreation()

bool PartSet_SketcherMgr::isDragModeCreation ( ) const

Returns true if current mode of objects creation is by drag mouse.

◆ onPlaneSelected

void PartSet_SketcherMgr::onPlaneSelected ( const std::shared_ptr< GeomAPI_Pln > &  thePln)
slot

Process sketch plane selected event.

◆ onShowPoints

void PartSet_SketcherMgr::onShowPoints ( bool  toShow)
slot

The slot is called when user checks "Show free points" button.

Parameters
toShowa state of the check box

◆ groupMessages()

virtual EVENTS_EXPORT bool Events_Listener::groupMessages ( )
inlinevirtualinherited

Listener that needs mostly grouped messages received returns true in this method.

In this case during the message is flushed, all the new messages are grouped, not sended immideately and then sent in the end of flush.

Reimplemented in SketchSolver_Manager, and SketchPlugin_OverConstraintsResolver.

◆ groupWhileFlush()

void Events_Listener::groupWhileFlush ( const std::shared_ptr< Events_Message > &  theMessage)
protectedinherited

Allows to group messages while they are flushed (for flush for groupMessages=true listeners)

◆ flushGrouped()

void Events_Listener::flushGrouped ( const Events_ID theID)
protectedinherited

Sends myGroups on flush finish.