#include <SMESHGUI_SelectionOp.h>

Public Types | |
| typedef QList< int > | IdList |
Public Member Functions | |
| SMESHGUI_SelectionOp (const Selection_Mode=ActorSelection) | |
| List of node or element ids. | |
| virtual | ~SMESHGUI_SelectionOp () |
Static Public Member Functions | |
| static void | extractIds (const QStringList &, IdList &, const QChar) |
Protected Types | |
| enum | EntityType { Object, MeshNode, MeshElement } |
Protected Slots | |
| virtual void | onActivateObject (int) |
| Installs filter corresponding to certain object selection widget. | |
| virtual void | onDeactivateObject (int) |
| Removes filter corresponding to certain object selection widget. | |
| virtual void | onSelectionChanged (int) |
| Empty default implementation. | |
| virtual void | onTextChanged (int, const QStringList &) |
| Default implementation allowing user to edit selected ids "by hands". | |
| virtual void | onOk () |
| virtual bool | onApply () |
| virtual void | onCancel () |
| void | onHelp () |
Protected Member Functions | |
| virtual void | startOperation () |
| This enumeration is used in typeById method to distinguish objects, mesh nodes and mesh elements, because node end element ids may overlap. | |
| virtual void | commitOperation () |
| virtual void | abortOperation () |
| virtual void | selectionDone () |
| virtual void | initDialog () |
| sets the dialog widgets to state just after operation start | |
| virtual SUIT_SelectionFilter * | createFilter (const int) const |
| Creates filter being used when certain object selection widget is active If no filter must be used, then function must return 0 if id is negative, then function must return filter for common using independently of active widget. | |
| void | removeCustomFilters () |
| Remove only filters set by this operation (they are in map myFilters ) | |
| Selection_Mode | selectionMode () const |
| Return what selection mode is set in VTK viewer. | |
| void | setSelectionMode (const Selection_Mode) |
| Set selection mode in VTK viewer. | |
| void | highlight (const Handle(SALOME_InteractiveObject)&, const bool, const bool=true) |
| Hilight object in VTK viewer. | |
| void | addOrRemoveIndex (const Handle(SALOME_InteractiveObject)&, const TColStd_MapOfInteger &, const bool isModeShift) |
| Select some nodes or elements in VTK. | |
| SVTK_ViewWindow * | viewWindow () const |
| SVTK_Selector * | selector () const |
| virtual void | selected (QStringList &, SMESHGUI_Dialog::TypesList &, QStringList &) const |
| Get names, types and ids of selected objects. | |
| virtual int | typeById (const QString &, const EntityType) const |
| Find type by id. | |
| virtual QChar | idChar () const |
| Char using to divide <entry> and <id> in string id representation. By default, '#'. | |
| void | selectedIds (const int, IdList &) const |
| Try to find in certain object selection widget selected node or element ids and return it. | |
| void | extractIds (const QStringList &, IdList &) const |
| Find in QStringList correct node or element ids representation and append integer(id) to IdList. | |
| SMESH::SMESH_Mesh_var | mesh () const |
| Return selected mesh if selection mode isn't ActorSelection and only one object is selected. | |
| SMESH_Actor * | actor () const |
| Return actor according to selected mesh if selection mode isn't ActorSelection. | |
| virtual bool | isReadyToStart () const |
| virtual void | setIsApplyAndClose (const bool theFlag) |
| virtual bool | isApplyAndClose () const |
| virtual void | setDialogActive (const bool) |
| Set according dialog active or inactive. | |
| SMESHGUI * | getSMESHGUI () const |
| bool | isStudyLocked (const bool=true) const |
| Verifies whether study of operation is locked. | |
| _PTR (Study) studyDS() const | |
| virtual bool | isValid (SUIT_Operation *) const |
| Verifies whether given operator is valid for this one. | |
Protected Attributes | |
| QString | myHelpFileName |
| bool | myIsApplyAndClose |
Private Types | |
| typedef QMap< int, SUIT_SelectionFilter * > | Filters |
Private Attributes | |
| Filters | myFilters |
| Selection_Mode | myDefSelectionMode |
| Selection_Mode | myOldSelectionMode |
Definition at line 54 of file SMESHGUI_SelectionOp.h.
typedef QMap<int, SUIT_SelectionFilter*> SMESHGUI_SelectionOp.Filters [private] |
Definition at line 161 of file SMESHGUI_SelectionOp.h.
| typedef QList<int> SMESHGUI_SelectionOp.IdList |
Definition at line 59 of file SMESHGUI_SelectionOp.h.
enum SMESHGUI_SelectionOp::EntityType [protected] |
Definition at line 68 of file SMESHGUI_SelectionOp.h.
{
Object,
MeshNode,
MeshElement
} EntityType;
| SMESHGUI_SelectionOp::SMESHGUI_SelectionOp | ( | const Selection_Mode | mode = ActorSelection | ) |
List of node or element ids.
Definition at line 61 of file SMESHGUI_SelectionOp.cxx.
: SMESHGUI_Operation(), myDefSelectionMode( mode ) { }
| SMESHGUI_SelectionOp::~SMESHGUI_SelectionOp | ( | ) | [virtual] |
Definition at line 71 of file SMESHGUI_SelectionOp.cxx.
References removeCustomFilters().
{
removeCustomFilters();
}
| SMESHGUI_Operation._PTR | ( | Study | ) | const [protected, inherited] |
Referenced by SMESHGUI_ShapeByMeshOp.commitOperation(), SMESHGUI_Make2DFrom3DOp.compute2DMesh(), SMESHGUI_BaseComputeOp.computeMesh(), SMESHGUI_ConvToQuadOp.ConnectRadioButtons(), SMESHGUI_BaseComputeOp.evaluateMesh(), SMESHGUI_PrecomputeOp.getAssignedAlgos(), SMESHGUI_PrecomputeOp.initDialog(), SMESHGUI_Make2DFrom3DOp.isValid(), SMESHGUI_GroupOnShapeOp.onApply(), SMESHGUI_ConvToQuadOp.onApply(), SMESHGUI_PrecomputeOp.onPreview(), SMESHGUI_FindElemByPointOp.onSelectionDone(), selected(), SMESHGUI_Make2DFrom3DOp.selectionDone(), SMESHGUI_GroupOnShapeOp.selectionDone(), SMESHGUI_ConvToQuadOp.selectionDone(), SMESHGUI_ShapeByMeshOp.SetMesh(), and typeById().
| void SMESHGUI_SelectionOp::abortOperation | ( | ) | [protected, virtual] |
Definition at line 133 of file SMESHGUI_SelectionOp.cxx.
References myOldSelectionMode, removeCustomFilters(), and setSelectionMode().
| SMESH_Actor * SMESHGUI_SelectionOp::actor | ( | ) | const [protected] |
Return actor according to selected mesh if selection mode isn't ActorSelection.
Definition at line 464 of file SMESHGUI_SelectionOp.cxx.
References SMESH.FindActorByObject(), ex30_tepal.m, and mesh().
Referenced by SMESHGUI_Make2DFrom3DOp.compute2DMesh(), SMESHGUI_ShapeByMeshOp.onElemIdChanged(), and onTextChanged().
{
SMESH::SMESH_Mesh_var m = mesh();
if( !m->_is_nil() )
return SMESH::FindActorByObject( m.in() );
else
return 0;
}
| void SMESHGUI_SelectionOp::addOrRemoveIndex | ( | const Handle(SALOME_InteractiveObject)& | obj, |
| const TColStd_MapOfInteger & | indices, | ||
| const bool | isModeShift | ||
| ) | [protected] |
Select some nodes or elements in VTK.
Definition at line 265 of file SMESHGUI_SelectionOp.cxx.
References selector().
Referenced by SMESHGUI_FindElemByPointOp.onElemSelected().
{
SVTK_Selector* sel = selector();
if( sel )
sel->AddOrRemoveIndex( obj, indices, isModeShift );
}
| void SMESHGUI_SelectionOp::commitOperation | ( | ) | [protected, virtual] |
Reimplemented in SMESHGUI_MeshOp, and SMESHGUI_ShapeByMeshOp.
Definition at line 122 of file SMESHGUI_SelectionOp.cxx.
References myOldSelectionMode, removeCustomFilters(), and setSelectionMode().
| SUIT_SelectionFilter * SMESHGUI_SelectionOp::createFilter | ( | const int | ) | const [protected, virtual] |
Creates filter being used when certain object selection widget is active If no filter must be used, then function must return 0 if id is negative, then function must return filter for common using independently of active widget.
Reimplemented in SMESHGUI_ConvToQuadOp, SMESHGUI_GroupOnShapeOp, SMESHGUI_Make2DFrom3DOp, and SMESHGUI_MeshOp.
Definition at line 171 of file SMESHGUI_SelectionOp.cxx.
Referenced by onActivateObject().
{
return 0;
}
| void SMESHGUI_SelectionOp::extractIds | ( | const QStringList & | ids, |
| IdList & | list | ||
| ) | const [protected] |
Find in QStringList correct node or element ids representation and append integer(id) to IdList.
Definition at line 545 of file SMESHGUI_SelectionOp.cxx.
References extractIds(), and idChar().
{
extractIds( ids, list, idChar() );
}
| void SMESHGUI_SelectionOp::extractIds | ( | const QStringList & | ids, |
| IdList & | list, | ||
| const QChar | idchar | ||
| ) | [static] |
Definition at line 523 of file SMESHGUI_SelectionOp.cxx.
Referenced by extractIds(), onTextChanged(), and selectedIds().
| SMESHGUI * SMESHGUI_Operation::getSMESHGUI | ( | ) | const [protected, inherited] |
Definition at line 70 of file SMESHGUI_Operation.cxx.
Referenced by SMESHGUI_BaseComputeOp.computeMesh(), SMESHGUI_BaseComputeOp.evaluateMesh(), SMESHGUI_Operation.isReadyToStart(), SMESHGUI_MeshOp.onGeomSelectionByMesh(), SMESHGUI_Operation.onHelp(), SMESHGUI_PrecomputeOp.onPreview(), SMESHGUI_BaseComputeOp.onPublishShape(), SMESHGUI_BaseComputeOp.onShowBadMesh(), SMESHGUI_MakeNodeAtPointOp.startOperation(), SMESHGUI_FindElemByPointOp.startOperation(), and viewWindow().
{
return dynamic_cast<SMESHGUI*>( module() );
}
| void SMESHGUI_SelectionOp::highlight | ( | const Handle(SALOME_InteractiveObject)& | obj, |
| const bool | hilight, | ||
| const bool | immediately = true |
||
| ) | [protected] |
Hilight object in VTK viewer.
Definition at line 253 of file SMESHGUI_SelectionOp.cxx.
References viewWindow().
Referenced by onTextChanged().
{
SVTK_ViewWindow* wnd = viewWindow();
if( wnd )
wnd->highlight( obj, hilight, immediately );
}
| QChar SMESHGUI_SelectionOp::idChar | ( | ) | const [protected, virtual] |
Char using to divide <entry> and <id> in string id representation. By default, '#'.
Definition at line 439 of file SMESHGUI_SelectionOp.cxx.
Referenced by extractIds(), selected(), and typeById().
{
return '#';
}
| void SMESHGUI_SelectionOp::initDialog | ( | ) | [protected, virtual] |
sets the dialog widgets to state just after operation start
Reimplemented from SMESHGUI_Operation.
Definition at line 208 of file SMESHGUI_SelectionOp.cxx.
{
if( dlg() )
{
dlg()->clearSelection();
dlg()->deactivateAll();
}
}
| bool SMESHGUI_Operation::isApplyAndClose | ( | ) | const [protected, virtual, inherited] |
Definition at line 234 of file SMESHGUI_Operation.cxx.
References SMESHGUI_Operation.myIsApplyAndClose.
Referenced by SMESHGUI_MeshOp.onApply(), SMESHGUI_Make2DFrom3DOp.onApply(), and SMESHGUI_GroupOnShapeOp.onApply().
{
return myIsApplyAndClose;
}
| bool SMESHGUI_Operation::isReadyToStart | ( | ) | const [protected, virtual, inherited] |
Definition at line 115 of file SMESHGUI_Operation.cxx.
References SMESHGUI_Operation.getSMESHGUI(), and SMESHGUI_Operation.isStudyLocked().
{
if ( !LightApp_Operation::isReadyToStart() )
return false;
else if ( getSMESHGUI() == 0 )
{
SUIT_MessageBox::warning( desktop(), tr( "SMESH_WRN_WARNING" ),
tr( "NO_MODULE" ) );
return false;
}
else if ( isStudyLocked() )
return false;
return true;
}
Verifies whether study of operation is locked.
| theMess | - specifies whether message box must be shown if study is locked |
Verifies whether study of operation is locked. If second parameter is TRUE and study is locked when corresponding message box appears
Definition at line 247 of file SMESHGUI_Operation.cxx.
References SMESHGUI.desktop().
Referenced by SMESHGUI_Operation.isReadyToStart(), SMESHGUI_MeshOp.onApply(), SMESHGUI_MakeNodeAtPointOp.onApply(), SMESHGUI_Make2DFrom3DOp.onApply(), and SMESHGUI_GroupOnShapeOp.onApply().
{
if ( studyDS() )
{
if ( studyDS()->GetProperties()->IsLocked() )
{
if ( theMess )
SUIT_MessageBox::warning( SMESHGUI::desktop(), tr( "WRN_WARNING" ),
tr( "WRN_STUDY_LOCKED" ) );
return true;
}
}
return false;
}
| bool SMESHGUI_Operation::isValid | ( | SUIT_Operation * | theOtherOp | ) | const [protected, virtual, inherited] |
Verifies whether given operator is valid for this one.
| theOtherOp | - other operation |
Virtual method redefined from base class verifies whether given operator is valid for this one (i.e. can be started "above" this operator). In current implementation method retuns false if theOtherOp operation is not intended for deleting objects or mesh elements.
Reimplemented in SMESHGUI_BaseComputeOp, and SMESHGUI_MeshOp.
Definition at line 273 of file SMESHGUI_Operation.cxx.
{
static QStringList anOps;
if ( anOps.count() == 0 )
{
anOps.append( "SMESHGUI_DeleteOp" );
// to do add other operations here
}
return ( theOtherOp &&
( ( theOtherOp->inherits("SMESHGUI_Operation") && ( !anOps.contains(theOtherOp->metaObject()->className() ) || anOps.contains(metaObject()->className()) ) ) ||
( theOtherOp->inherits("LightApp_ShowHideOp") ) ) );
return true;
}
| SMESH::SMESH_Mesh_var SMESHGUI_SelectionOp::mesh | ( | ) | const [protected] |
Return selected mesh if selection mode isn't ActorSelection and only one object is selected.
Definition at line 448 of file SMESHGUI_SelectionOp.cxx.
References SMESH.GetMeshByIO(), and selectionMode().
Referenced by actor(), SMESHGUI_ConvToQuadOp.ConnectRadioButtons(), SMESHGUI_MeshOp.isSubshapeOk(), SMESHGUI_GroupOnShapeOp.onApply(), SMESHGUI_ConvToQuadOp.onApply(), SMESHGUI_MeshOp.selectionDone(), SMESHGUI_ConvToQuadOp.selectionDone(), and typeById().
{
if( selectionMode()==ActorSelection )
return SMESH::SMESH_Mesh::_nil();
SALOME_ListIO sel; selectionMgr()->selectedObjects( sel, SVTK_Viewer::Type() );
if( sel.Extent()==1 )
return SMESH::GetMeshByIO( sel.First() );
else
return SMESH::SMESH_Mesh::_nil();
}
| void SMESHGUI_SelectionOp::onActivateObject | ( | int | id | ) | [protected, virtual, slot] |
Installs filter corresponding to certain object selection widget.
Definition at line 180 of file SMESHGUI_SelectionOp.cxx.
References createFilter(), myFilters, and selectionDone().
Referenced by SMESHGUI_GroupOnShapeOp.init(), SMESHGUI_GroupOnShapeOp.onButtonClick(), SMESHGUI_MeshOp.onHypoCreated(), SMESHGUI_MeshOp.onHypoEdited(), and startOperation().
{
LightApp_SelectionMgr* mgr = selectionMgr();
if( !mgr )
return;
if( !myFilters.contains( id ) )
myFilters[ id ] = createFilter( id );
if( myFilters[ id ] )
mgr->installFilter( myFilters[ id ] );
selectionDone();
}
| bool SMESHGUI_Operation::onApply | ( | ) | [protected, virtual, slot, inherited] |
Reimplemented in SMESHGUI_BaseComputeOp, SMESHGUI_ConvToQuadOp, SMESHGUI_FindElemByPointOp, SMESHGUI_GroupOnShapeOp, SMESHGUI_Make2DFrom3DOp, SMESHGUI_MakeNodeAtPointOp, SMESHGUI_MeshOp, SMESHGUI_MeshOrderOp, and SMESHGUI_ShapeByMeshOp.
Definition at line 173 of file SMESHGUI_Operation.cxx.
Referenced by SMESHGUI_Operation.onOk(), and SMESHGUI_Operation.startOperation().
{
return false;
}
| void SMESHGUI_Operation::onCancel | ( | ) | [protected, virtual, slot, inherited] |
Reimplemented in SMESHGUI_PrecomputeOp, and SMESHGUI_MeshOrderOp.
Definition at line 182 of file SMESHGUI_Operation.cxx.
Referenced by SMESHGUI_Operation.startOperation(), and SMESHGUI_BaseComputeOp.startOperation().
{
abort();
}
| void SMESHGUI_SelectionOp::onDeactivateObject | ( | int | id | ) | [protected, virtual, slot] |
Removes filter corresponding to certain object selection widget.
Definition at line 199 of file SMESHGUI_SelectionOp.cxx.
References removeCustomFilters().
Referenced by startOperation().
{
removeCustomFilters();
}
| void SMESHGUI_Operation::onHelp | ( | ) | [protected, slot, inherited] |
Definition at line 191 of file SMESHGUI_Operation.cxx.
References SMESHGUI_Operation.getSMESHGUI(), and SMESHGUI_Operation.myHelpFileName.
Referenced by SMESHGUI_Operation.startOperation(), and SMESHGUI_PrecomputeOp.startOperation().
{
LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
if (app)
app->onHelpContextModule(getSMESHGUI() ? app->moduleName(getSMESHGUI()->moduleName()) : QString(""), myHelpFileName);
else {
QString platform;
#ifdef WIN32
platform = "winapplication";
#else
platform = "application";
#endif
SUIT_MessageBox::warning( desktop(), tr("WRN_WARNING"),
tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
arg(app->resourceMgr()->stringValue("ExternalBrowser",
platform)).
arg(myHelpFileName) );
}
}
| void SMESHGUI_Operation::onOk | ( | ) | [protected, virtual, slot, inherited] |
Definition at line 159 of file SMESHGUI_Operation.cxx.
References SMESHGUI_Operation.onApply(), and SMESHGUI_Operation.setIsApplyAndClose().
Referenced by SMESHGUI_Operation.startOperation(), and SMESHGUI_PrecomputeOp.startOperation().
{
setIsApplyAndClose( true );
if( onApply() )
commit();
setIsApplyAndClose( false );
//else
// abort();
}
| void SMESHGUI_SelectionOp::onSelectionChanged | ( | int | ) | [protected, virtual, slot] |
Empty default implementation.
In successors it may be used for more advanced selection checking. This slot is connected to signal when the selection changed in some object selection widget
Definition at line 221 of file SMESHGUI_SelectionOp.cxx.
Referenced by startOperation().
{
}
| void SMESHGUI_SelectionOp::onTextChanged | ( | int | , |
| const QStringList & | list | ||
| ) | [protected, virtual, slot] |
Default implementation allowing user to edit selected ids "by hands".
In order to run default mechanism, you must set for some object selection widget the "name indication" to "ListOfNames", "read only" state to false and connect the dialog's signal "objectChanged" to this slot Warning: this mechanism can process only integer ids, NOT MESH OR GROUP NAMES!!!
Definition at line 477 of file SMESHGUI_SelectionOp.cxx.
References actor(), extractIds(), SMDS_Mesh.FindNode(), SMESH_Actor.GetObject(), highlight(), SMESH_test.ids, SMESH_reg.names, selected(), and selector().
{
if( !dlg() )
return;
TColStd_MapOfInteger newIndices;
SALOME_ListIO sel; selectionMgr()->selectedObjects( sel );
SMESH_Actor* anActor = actor();
if( sel.Extent()==0 || !anActor )
return;
SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh();
IdList ids; extractIds( list, ids, '\0' );
IdList::const_iterator anIt = ids.begin(),
aLast = ids.end();
for( ; anIt!=aLast; anIt++ )
if( const SMDS_MeshNode * n = aMesh->FindNode( *anIt ) )
newIndices.Add( n->GetID() );
selector()->AddOrRemoveIndex( sel.First(), newIndices, false );
highlight( sel.First(), true, true );
QStringList names, _ids; LightApp_Dialog::TypesList types;
selected( names, types, _ids );
dlg()->selectObject( names, types, _ids, false );
}
| void SMESHGUI_SelectionOp::removeCustomFilters | ( | ) | [protected] |
Remove only filters set by this operation (they are in map myFilters )
Definition at line 101 of file SMESHGUI_SelectionOp.cxx.
References myFilters.
Referenced by abortOperation(), commitOperation(), SMESHGUI_MeshOp.createHypothesis(), SMESHGUI_GroupOnShapeOp.init(), SMESHGUI_GroupOnShapeOp.onApply(), SMESHGUI_GroupOnShapeOp.onButtonClick(), onDeactivateObject(), SMESHGUI_MeshOp.onEditHyp(), and ~SMESHGUI_SelectionOp().
| void SMESHGUI_SelectionOp::selected | ( | QStringList & | , |
| SMESHGUI_Dialog::TypesList & | , | ||
| QStringList & | |||
| ) | const [protected, virtual] |
Get names, types and ids of selected objects.
Definition at line 359 of file SMESHGUI_SelectionOp.cxx.
References SMESHGUI_Operation._PTR(), idChar(), MeshElement, MeshNode, Object, selectionMode(), and typeById().
Referenced by onTextChanged(), SMESHGUI_BoundingBox.selectionChanged(), SMESHGUI_MinDistance.selectionChanged(), selectionDone(), SMESHGUI_Make2DFrom3DOp.selectionDone(), and SMESHGUI_GroupOnShapeOp.selectionDone().
{
/* SUIT_DataOwnerPtrList list; selectionMgr()->selected( list );
SUIT_DataOwnerPtrList::const_iterator anIt = list.begin(),
aLast = list.end();
for( ; anIt!=aLast; anIt++ )
{
LightApp_DataOwner* owner = dynamic_cast<LightApp_DataOwner*>( (*anIt).operator->() );
LightApp_SVTKDataOwner* vtkowner = dynamic_cast<LightApp_SVTKDataOwner*>( (*anIt).operator->() );
if( vtkowner )
{
QString id_str = QString( "%1%2%3" ).arg( vtkowner->entry() ).arg( idChar() ), current_id_str;
Selection_Mode mode = vtkowner->GetMode();
EntityType objtype = mode == NodeSelection ? MeshNode : MeshElement;
const TColStd_IndexedMapOfInteger& ownerids = vtkowner->GetIds();
for( int i=1, n=ownerids.Extent(); i<=n; i++ )
{
int curid = ownerids( i );
current_id_str = id_str.arg( curid );
ids.append( current_id_str );
types.append( typeById( current_id_str, objtype ) );
names.append( QString( "%1" ).arg( curid ) );
}
}
else if( owner )
{
QString id = owner->entry();
ids.append( id );
types.append( typeById( id, Object ) );
names.append( owner->IO()->getName() );
}
}*/
SALOME_ListIO selObjs;
TColStd_IndexedMapOfInteger selIndices;
selectionMgr()->selectedObjects( selObjs );
Selection_Mode mode = selectionMode();
EntityType objtype = mode == NodeSelection ? MeshNode : MeshElement;
for( SALOME_ListIteratorOfListIO anIt( selObjs ); anIt.More(); anIt.Next() )
{
selIndices.Clear();
selectionMgr()->GetIndexes( anIt.Value(), selIndices );
if( selIndices.Extent() > 0 )
{
QString id_str = QString( "%1%2%3" ).arg( anIt.Value()->getEntry() ).arg( idChar() ), current_id_str;
for( int i=1, n=selIndices.Extent(); i<=n; i++ )
{
int curid = selIndices( i );
current_id_str = id_str.arg( curid );
ids.append( current_id_str );
types.append( typeById( current_id_str, objtype ) );
names.append( QString( "%1" ).arg( curid ) );
}
}
else
{
QString id = anIt.Value()->getEntry();
ids.append( id );
types.append( typeById( id, Object ) );
SalomeApp_Study* _study = dynamic_cast<SalomeApp_Study*>( study() );
if( _study )
{
_PTR(SObject) obj = _study->studyDS()->FindObjectID( anIt.Value()->getEntry() );
if( obj )
names.append( obj->GetName().c_str() );
}
}
}
}
Try to find in certain object selection widget selected node or element ids and return it.
Definition at line 510 of file SMESHGUI_SelectionOp.cxx.
References extractIds(), and SMESH_test.ids.
{
if( !dlg() )
return;
QStringList ids; dlg()->selectedObject( id, ids );
extractIds( ids, list );
}
| void SMESHGUI_SelectionOp::selectionDone | ( | ) | [protected, virtual] |
Reimplemented in SMESHGUI_ConvToQuadOp, SMESHGUI_GroupOnShapeOp, SMESHGUI_Make2DFrom3DOp, and SMESHGUI_MeshOp.
Definition at line 144 of file SMESHGUI_SelectionOp.cxx.
References SMESH_test.ids, SMESH_reg.names, selected(), and selectionMode().
Referenced by onActivateObject().
{
if( !dlg() )
return;
if( selectionMode()!=ActorSelection )
{
SALOME_ListIO aList;
selectionMgr()->selectedObjects( aList, SVTK_Viewer::Type() );
if( aList.Extent() != 1 ) //we can select nodes or elements only within one mesh
{
dlg()->clearSelection();
return;
}
}
QStringList names, ids;
LightApp_Dialog::TypesList types;
selected( names, types, ids );
dlg()->selectObject( names, types, ids );
}
| Selection_Mode SMESHGUI_SelectionOp::selectionMode | ( | ) | const [protected] |
Return what selection mode is set in VTK viewer.
Definition at line 229 of file SMESHGUI_SelectionOp.cxx.
References viewWindow().
Referenced by SMESHGUI_ShapeByMeshOp.activateSelection(), mesh(), SMESHGUI_FindElemByPointOp.onElemSelected(), SMESHGUI_FindElemByPointOp.onElemTypeChange(), selected(), selectionDone(), and startOperation().
{
SVTK_ViewWindow* wnd = viewWindow();
if( wnd )
return wnd->SelectionMode();
else
return ActorSelection;
}
| SVTK_Selector * SMESHGUI_SelectionOp::selector | ( | ) | const [protected] |
Definition at line 287 of file SMESHGUI_SelectionOp.cxx.
References viewWindow().
Referenced by addOrRemoveIndex(), SMESHGUI_MinDistance.firstEdited(), SMESHGUI_ShapeByMeshOp.onElemIdChanged(), SMESHGUI_ShapeByMeshOp.onSelectionDone(), SMESHGUI_MakeNodeAtPointOp.onSelectionDone(), onTextChanged(), SMESHGUI_MinDistance.secondEdited(), SMESHGUI_BoundingBox.selectionChanged(), SMESHGUI_MinDistance.selectionChanged(), and SMESHGUI_BoundingBox.sourceEdited().
{
SVTK_ViewWindow* wnd = viewWindow();
return wnd ? wnd->GetSelector() : 0;
}
| void SMESHGUI_Operation::setDialogActive | ( | const bool | active | ) | [protected, virtual, inherited] |
Set according dialog active or inactive.
Definition at line 135 of file SMESHGUI_Operation.cxx.
References ex13_hole1partial.d, and SMESHGUI_Dialog.setContentActive().
{
LightApp_Operation::setDialogActive( active );
SMESHGUI_Dialog* d = dynamic_cast<SMESHGUI_Dialog*>( dlg() );
if( d )
d->setContentActive( active );
}
| void SMESHGUI_Operation::setIsApplyAndClose | ( | const bool | theFlag | ) | [protected, virtual, inherited] |
Definition at line 224 of file SMESHGUI_Operation.cxx.
References SMESHGUI_Operation.myIsApplyAndClose.
Referenced by SMESHGUI_Operation.onOk().
{
myIsApplyAndClose = theFlag;
}
| void SMESHGUI_SelectionOp::setSelectionMode | ( | const Selection_Mode | mode | ) | [protected] |
Set selection mode in VTK viewer.
Definition at line 242 of file SMESHGUI_SelectionOp.cxx.
References viewWindow().
Referenced by abortOperation(), SMESHGUI_ShapeByMeshOp.activateSelection(), SMESHGUI_MakeNodeAtPointOp.activateSelection(), commitOperation(), SMESHGUI_FindElemByPointOp.onElemSelected(), SMESHGUI_FindElemByPointOp.onElemTypeChange(), and startOperation().
{
SVTK_ViewWindow* wnd = viewWindow();
if( wnd )
wnd->SetSelectionMode( mode );
}
| void SMESHGUI_SelectionOp::startOperation | ( | ) | [protected, virtual] |
This enumeration is used in typeById method to distinguish objects, mesh nodes and mesh elements, because node end element ids may overlap.
Reimplemented from SMESHGUI_Operation.
Reimplemented in SMESHGUI_ConvToQuadOp, SMESHGUI_FindElemByPointOp, SMESHGUI_GroupOnShapeOp, SMESHGUI_Make2DFrom3DOp, SMESHGUI_MakeNodeAtPointOp, SMESHGUI_MeshOp, and SMESHGUI_ShapeByMeshOp.
Definition at line 80 of file SMESHGUI_SelectionOp.cxx.
References myDefSelectionMode, myOldSelectionMode, onActivateObject(), onDeactivateObject(), onSelectionChanged(), selectionMode(), and setSelectionMode().
{
myOldSelectionMode = selectionMode();
setSelectionMode( myDefSelectionMode );
SMESHGUI_Operation::startOperation();
if( dlg() )
{
disconnect( dlg(), SIGNAL( objectActivated( int ) ), this, SLOT( onActivateObject( int ) ) );
disconnect( dlg(), SIGNAL( objectDeactivated( int ) ), this, SLOT( onDeactivateObject( int ) ) );
disconnect( dlg(), SIGNAL( selectionChanged( int ) ), this, SLOT( onSelectionChanged( int ) ) );
connect( dlg(), SIGNAL( objectActivated( int ) ), this, SLOT( onActivateObject( int ) ) );
connect( dlg(), SIGNAL( objectDeactivated( int ) ), this, SLOT( onDeactivateObject( int ) ) );
connect( dlg(), SIGNAL( selectionChanged( int ) ), this, SLOT( onSelectionChanged( int ) ) );
}
}
| int SMESHGUI_SelectionOp::typeById | ( | const QString & | str, |
| const EntityType | objtype | ||
| ) | const [protected, virtual] |
Find type by id.
Definition at line 297 of file SMESHGUI_SelectionOp.cxx.
References SMESHGUI_Operation._PTR(), idChar(), mesh(), MeshElement, Object, SMESHGUI_Dialog.prefix(), SMESH_AdvancedEditor.res, SMESH_test4.submesh, and SMESHGUI_Selection.type().
Referenced by selected().
{
SalomeApp_Study* _study = dynamic_cast<SalomeApp_Study*>( study() );
if( !_study )
return -1;
_PTR( Study ) st = _study->studyDS();
int res = -1;
if( objtype == Object )
{
SalomeApp_Study* _study = dynamic_cast<SalomeApp_Study*>( study() );
if( _study )
{
int t = SMESHGUI_Selection::type( str, _study->studyDS() );
if( t<0 )
{
//try to get GEOM type
_PTR( SObject ) sobj = st->FindObjectID( str.toLatin1().data() );
if( sobj )
{
GEOM::GEOM_Object_var obj = GEOM::GEOM_Object::_narrow(
dynamic_cast<SALOMEDS_SObject*>( sobj.get() )->GetObject() );
if( !CORBA::is_nil( obj ) )
res = SMESHGUI_Dialog::prefix( "GEOM" ) + obj->GetType();
}
}
else
res = SMESHGUI_Dialog::prefix( "SMESH" ) + t;
}
}
else
{
int pos = str.indexOf( idChar() );
QString entry = str.left( pos ),
_id = str.mid( pos+1 );
bool ok;
int id = _id.toInt( &ok );
if( ok )
{
_PTR( SObject ) sobj = st->FindObjectID( entry.toLatin1().data() );
SMESH::SMESH_Mesh_var mesh = SMESH::SMESH_Mesh::_narrow(
dynamic_cast<SALOMEDS_SObject*>( sobj.get() )->GetObject() );
SMESH::SMESH_subMesh_var submesh = SMESH::SMESH_subMesh::_narrow(
dynamic_cast<SALOMEDS_SObject*>( sobj.get() )->GetObject() );
if( !CORBA::is_nil( mesh ) )
res = SMESHGUI_Dialog::prefix( "SMESH element" ) +
mesh->GetElementType( id, objtype==MeshElement );
else if( !CORBA::is_nil( submesh ) )
res = SMESHGUI_Dialog::prefix( "SMESH element" ) +
submesh->GetElementType( id, objtype==MeshElement );
}
}
return res;
}
| SVTK_ViewWindow * SMESHGUI_SelectionOp::viewWindow | ( | ) | const [protected] |
Definition at line 278 of file SMESHGUI_SelectionOp.cxx.
References SMESHGUI_Operation.getSMESHGUI(), and SMESH.GetViewWindow().
Referenced by highlight(), SMESHGUI_ShapeByMeshOp.onElemIdChanged(), selectionMode(), selector(), and setSelectionMode().
{
return SMESH::GetViewWindow( getSMESHGUI() );
}
Selection_Mode SMESHGUI_SelectionOp.myDefSelectionMode [private] |
Definition at line 165 of file SMESHGUI_SelectionOp.h.
Referenced by startOperation().
Filters SMESHGUI_SelectionOp.myFilters [private] |
Definition at line 164 of file SMESHGUI_SelectionOp.h.
Referenced by onActivateObject(), and removeCustomFilters().
QString SMESHGUI_Operation.myHelpFileName [protected, inherited] |
Definition at line 74 of file SMESHGUI_Operation.h.
Referenced by SMESHGUI_Operation.onHelp(), SMESHGUI_BaseComputeOp.SMESHGUI_BaseComputeOp(), SMESHGUI_FindElemByPointOp.SMESHGUI_FindElemByPointOp(), SMESHGUI_GroupOnShapeOp.SMESHGUI_GroupOnShapeOp(), SMESHGUI_MakeNodeAtPointOp.SMESHGUI_MakeNodeAtPointOp(), SMESHGUI_MeshOrderOp.SMESHGUI_MeshOrderOp(), SMESHGUI_Operation.SMESHGUI_Operation(), SMESHGUI_PrecomputeOp.SMESHGUI_PrecomputeOp(), SMESHGUI_MeshOp.startOperation(), SMESHGUI_Make2DFrom3DOp.startOperation(), and SMESHGUI_ConvToQuadOp.startOperation().
bool SMESHGUI_Operation.myIsApplyAndClose [protected, inherited] |
Definition at line 75 of file SMESHGUI_Operation.h.
Referenced by SMESHGUI_Operation.isApplyAndClose(), and SMESHGUI_Operation.setIsApplyAndClose().
Selection_Mode SMESHGUI_SelectionOp.myOldSelectionMode [private] |
Definition at line 165 of file SMESHGUI_SelectionOp.h.
Referenced by abortOperation(), commitOperation(), and startOperation().