#include <SMESHGUI_GroupOnShapeDlg.h>

Public Types | |
| typedef QList< int > | IdList |
Public Member Functions | |
| SMESHGUI_GroupOnShapeOp () | |
| operation constructor | |
| ~SMESHGUI_GroupOnShapeOp () | |
| virtual LightApp_Dialog * | dlg () const |
| Gets dialog of this operation. | |
Static Public Member Functions | |
| static QString | GetDefaultName (const QString &theOperation) |
| 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 void | onCancel () |
| void | onHelp () |
Protected Member Functions | |
| virtual void | startOperation () |
| start operation | |
| virtual void | selectionDone () |
| Updates dialog's look and feel. | |
| virtual SUIT_SelectionFilter * | createFilter (const int) const |
| Creates selection filter. | |
| void | extractIds (const QStringList &, IdList &) const |
| Find in QStringList correct node or element ids representation and append integer(id) to IdList. | |
| virtual void | commitOperation () |
| virtual void | abortOperation () |
| virtual void | initDialog () |
| sets the dialog widgets to state just after operation start | |
| 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. | |
| 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 Slots | |
| bool | onApply () |
| create groups | |
| void | onButtonClick () |
| slot connected to selection buttons | |
Private Member Functions | |
| void | init () |
| initialization | |
Private Attributes | |
| SMESHGUI_GroupOnShapeDlg * | myDlg |
| QString | myMeshID |
| QStringList | myElemGeoIDs |
| QStringList | myNodeGeoIDs |
Definition at line 42 of file SMESHGUI_GroupOnShapeDlg.h.
typedef QList<int> SMESHGUI_SelectionOp.IdList [inherited] |
Definition at line 59 of file SMESHGUI_SelectionOp.h.
enum SMESHGUI_SelectionOp::EntityType [protected, inherited] |
Definition at line 68 of file SMESHGUI_SelectionOp.h.
{
Object,
MeshNode,
MeshElement
} EntityType;
| SMESHGUI_GroupOnShapeOp::SMESHGUI_GroupOnShapeOp | ( | ) |
operation constructor
Definition at line 177 of file SMESHGUI_GroupOnShapeDlg.cxx.
References SMESHGUI_Operation.myHelpFileName.
: SMESHGUI_SelectionOp(ActorSelection), myDlg( 0 ) { myHelpFileName = "create_groups_from_geometry_page.html"; }
| SMESHGUI_GroupOnShapeOp::~SMESHGUI_GroupOnShapeOp | ( | ) |
Definition at line 184 of file SMESHGUI_GroupOnShapeDlg.cxx.
References myDlg.
| 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(), onApply(), SMESHGUI_ConvToQuadOp.onApply(), SMESHGUI_PrecomputeOp.onPreview(), SMESHGUI_FindElemByPointOp.onSelectionDone(), SMESHGUI_SelectionOp.selected(), SMESHGUI_Make2DFrom3DOp.selectionDone(), selectionDone(), SMESHGUI_ConvToQuadOp.selectionDone(), SMESHGUI_ShapeByMeshOp.SetMesh(), and SMESHGUI_SelectionOp.typeById().
| void SMESHGUI_SelectionOp::abortOperation | ( | ) | [protected, virtual, inherited] |
Definition at line 133 of file SMESHGUI_SelectionOp.cxx.
References SMESHGUI_SelectionOp.myOldSelectionMode, SMESHGUI_SelectionOp.removeCustomFilters(), and SMESHGUI_SelectionOp.setSelectionMode().
| SMESH_Actor * SMESHGUI_SelectionOp::actor | ( | ) | const [protected, inherited] |
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 SMESHGUI_SelectionOp.mesh().
Referenced by SMESHGUI_Make2DFrom3DOp.compute2DMesh(), SMESHGUI_ShapeByMeshOp.onElemIdChanged(), and SMESHGUI_SelectionOp.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, inherited] |
Select some nodes or elements in VTK.
Definition at line 265 of file SMESHGUI_SelectionOp.cxx.
References SMESHGUI_SelectionOp.selector().
Referenced by SMESHGUI_FindElemByPointOp.onElemSelected().
{
SVTK_Selector* sel = selector();
if( sel )
sel->AddOrRemoveIndex( obj, indices, isModeShift );
}
| void SMESHGUI_SelectionOp::commitOperation | ( | ) | [protected, virtual, inherited] |
Reimplemented in SMESHGUI_MeshOp, and SMESHGUI_ShapeByMeshOp.
Definition at line 122 of file SMESHGUI_SelectionOp.cxx.
References SMESHGUI_SelectionOp.myOldSelectionMode, SMESHGUI_SelectionOp.removeCustomFilters(), and SMESHGUI_SelectionOp.setSelectionMode().
| SUIT_SelectionFilter * SMESHGUI_GroupOnShapeOp::createFilter | ( | const int | theId | ) | const [protected, virtual] |
Creates selection filter.
| theId | - identifier of current selection widget |
| SUIT_SelectionFilter* | - pointer to the created filter or null |
Creates selection filter in accordance with identifier of current selection widget
Reimplemented from SMESHGUI_SelectionOp.
Definition at line 417 of file SMESHGUI_GroupOnShapeDlg.cxx.
References _ELEM_GEOM, _MESH, and _NODE_GEOM.
{
if ( theId == _ELEM_GEOM || theId == _NODE_GEOM )
return new GEOM_SelectionFilter( (SalomeApp_Study*)study(), true );
else if ( theId == _MESH )
return new SMESH_TypeFilter( MESH );
else
return ( SUIT_SelectionFilter*) 0;
}
| LightApp_Dialog * SMESHGUI_GroupOnShapeOp::dlg | ( | ) | const [virtual] |
Gets dialog of this operation.
| LightApp_Dialog* | - pointer to dialog of this operation |
Definition at line 196 of file SMESHGUI_GroupOnShapeDlg.cxx.
References myDlg.
{
return myDlg;
}
| void SMESHGUI_SelectionOp::extractIds | ( | const QStringList & | ids, |
| IdList & | list, | ||
| const QChar | idchar | ||
| ) | [static, inherited] |
Definition at line 523 of file SMESHGUI_SelectionOp.cxx.
Referenced by SMESHGUI_SelectionOp.extractIds(), SMESHGUI_SelectionOp.onTextChanged(), and SMESHGUI_SelectionOp.selectedIds().
| void SMESHGUI_SelectionOp::extractIds | ( | const QStringList & | ids, |
| IdList & | list | ||
| ) | const [protected, inherited] |
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 SMESHGUI_SelectionOp.extractIds(), and SMESHGUI_SelectionOp.idChar().
{
extractIds( ids, list, idChar() );
}
| static QString SMESHGUI_GroupOnShapeOp.GetDefaultName | ( | const QString & | theOperation | ) | [static] |
| 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 SMESHGUI_SelectionOp.viewWindow().
{
return dynamic_cast<SMESHGUI*>( module() );
}
| void SMESHGUI_SelectionOp::highlight | ( | const Handle(SALOME_InteractiveObject)& | obj, |
| const bool | hilight, | ||
| const bool | immediately = true |
||
| ) | [protected, inherited] |
Hilight object in VTK viewer.
Definition at line 253 of file SMESHGUI_SelectionOp.cxx.
References SMESHGUI_SelectionOp.viewWindow().
Referenced by SMESHGUI_SelectionOp.onTextChanged().
{
SVTK_ViewWindow* wnd = viewWindow();
if( wnd )
wnd->highlight( obj, hilight, immediately );
}
| QChar SMESHGUI_SelectionOp::idChar | ( | ) | const [protected, virtual, inherited] |
Char using to divide <entry> and <id> in string id representation. By default, '#'.
Definition at line 439 of file SMESHGUI_SelectionOp.cxx.
Referenced by SMESHGUI_SelectionOp.extractIds(), SMESHGUI_SelectionOp.selected(), and SMESHGUI_SelectionOp.typeById().
{
return '#';
}
| void SMESHGUI_GroupOnShapeOp::init | ( | ) | [private] |
initialization
Definition at line 254 of file SMESHGUI_GroupOnShapeDlg.cxx.
References _MESH, SMESHGUI_GroupOnShapeDlg.init(), myDlg, myElemGeoIDs, myMeshID, myNodeGeoIDs, SMESHGUI_SelectionOp.onActivateObject(), and SMESHGUI_SelectionOp.removeCustomFilters().
Referenced by startOperation().
{
myMeshID="";
myElemGeoIDs.clear();
myNodeGeoIDs.clear();
myDlg->init();
removeCustomFilters();
onActivateObject( _MESH ); // install filter
}
| void SMESHGUI_SelectionOp::initDialog | ( | ) | [protected, virtual, inherited] |
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 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 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, inherited] |
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 SMESHGUI_SelectionOp.selectionMode().
Referenced by SMESHGUI_SelectionOp.actor(), SMESHGUI_ConvToQuadOp.ConnectRadioButtons(), SMESHGUI_MeshOp.isSubshapeOk(), onApply(), SMESHGUI_ConvToQuadOp.onApply(), SMESHGUI_MeshOp.selectionDone(), SMESHGUI_ConvToQuadOp.selectionDone(), and SMESHGUI_SelectionOp.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, inherited] |
Installs filter corresponding to certain object selection widget.
Definition at line 180 of file SMESHGUI_SelectionOp.cxx.
References SMESHGUI_SelectionOp.createFilter(), SMESHGUI_SelectionOp.myFilters, and SMESHGUI_SelectionOp.selectionDone().
Referenced by init(), onButtonClick(), SMESHGUI_MeshOp.onHypoCreated(), SMESHGUI_MeshOp.onHypoEdited(), and SMESHGUI_SelectionOp.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_GroupOnShapeOp::onApply | ( | ) | [private, virtual, slot] |
create groups
Reimplemented from SMESHGUI_Operation.
Definition at line 293 of file SMESHGUI_GroupOnShapeDlg.cxx.
References SMESHGUI_Operation._PTR(), SMESH.ALL, elementType(), SMESH_box.geom, ex21_lamp.group, SMESHGUI_Operation.isApplyAndClose(), SMESHGUI_Operation.isStudyLocked(), SMESHGUI_SelectionOp.mesh(), SMESHGUI.Modified(), myDlg, myElemGeoIDs, SMESHGUI_GroupOnShapeDlg.myElemGeomBtn, SMESHGUI_GroupOnShapeDlg.myElemGeomList, myMeshID, myNodeGeoIDs, SMESHGUI_GroupOnShapeDlg.myNodeGeomBtn, SMESHGUI_GroupOnShapeDlg.myNodeGeomList, ex21_lamp.name, SMESH.NODE, SMESHGUI_SelectionOp.removeCustomFilters(), and SMESHGUI_GroupOnShapeDlg.updateButtons().
{
SUIT_OverrideCursor aWaitCursor;
if (isStudyLocked())
return false;
// study
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
if ( !aStudy ) return false;
// mesh
_PTR(SObject) meshSO = aStudy->FindObjectID( myMeshID.toLatin1().data() );
SMESH::SMESH_Mesh_var mesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>( meshSO );
if ( mesh->_is_nil() ) return false;
// names of all existing groups
// QStringList groupNames;
// QString givenName = myDlg->myGrpNameLine->text();
// if ( !givenName.isEmpty() ) {
// SMESH::ListOfGroups_var groups = mesh->GetGroups();
// for ( int i = 0; i < groups->length(); ++i ) {
// CORBA::String_var name = groups[i]->GetName();
// groupNames.append( name.in() );
// }
// }
// create groups
SMESH::SMESH_GroupOnGeom_var group;
QStringList anEntryList;
for ( int isNode = 0; isNode < 2; ++isNode ) // elems and then nodes
{
QStringList::iterator geomID = isNode ? myNodeGeoIDs.begin() : myElemGeoIDs.begin();
QStringList::iterator geomEnd = isNode ? myNodeGeoIDs.end() : myElemGeoIDs.end();
for ( int i = 0; geomID != geomEnd; ++geomID, ++i )
{
// selected geom
_PTR(SObject) geomSO = aStudy->FindObjectID( geomID->toLatin1().data() );
GEOM::GEOM_Object_var geom = SMESH::SObjectToInterface<GEOM::GEOM_Object>(geomSO);
if ( geom->_is_nil() ) continue;
// group type
SMESH::ElementType elemType = isNode ? SMESH::NODE : elementType( geom );
if ( elemType == SMESH::ALL )
continue;
// make a unique name
QString name =
isNode ? myDlg->myNodeGeomList->item(i)->text() : myDlg->myElemGeomList->item(i)->text();
// int nb = 1;
// QString name = myDlg->myGrpNameLine->text() + "_" + QString::number(nb);
// while ( groupNames.contains( name ))
// name = myDlg->myGrpNameLine->text() + "_" + QString::number(++nb);
// groupNames.append( name );
//printf( "apply() %s %s\n", (*geomID).latin1(), name.latin1() );
group = mesh->CreateGroupFromGEOM( elemType, name.toLatin1().data(), geom );
if( !group->_is_nil() )
if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( group ) )
anEntryList.append( aSObject->GetID().c_str() );
}
}
SMESHGUI::Modified();
update( UF_ObjBrowser | UF_Model );
// Re-init controls to create the next group
myElemGeoIDs.clear();
myNodeGeoIDs.clear();
removeCustomFilters();
myDlg->myNodeGeomList->clear();
myDlg->myElemGeomList->clear();
myDlg->myElemGeomBtn->setChecked(false);
myDlg->myNodeGeomBtn->setChecked(false);
myDlg->updateButtons();
if( LightApp_Application* anApp =
dynamic_cast<LightApp_Application*>( SUIT_Session::session()->activeApplication() ) )
anApp->browseObjects( anEntryList, isApplyAndClose() );
return !group->_is_nil();
}
| void SMESHGUI_GroupOnShapeOp::onButtonClick | ( | ) | [private, slot] |
slot connected to selection buttons
Definition at line 383 of file SMESHGUI_GroupOnShapeDlg.cxx.
References _ELEM_GEOM, _MESH, _NODE_GEOM, myDlg, SMESHGUI_GroupOnShapeDlg.myElemGeomBtn, SMESHGUI_GroupOnShapeDlg.myMeshBtn, SMESHGUI_GroupOnShapeDlg.myNodeGeomBtn, SMESHGUI_SelectionOp.onActivateObject(), and SMESHGUI_SelectionOp.removeCustomFilters().
Referenced by startOperation().
{
removeCustomFilters();
if ( sender() == myDlg->myMeshBtn && myDlg->myMeshBtn->isChecked() )
{
myDlg->myElemGeomBtn->setChecked(false);
myDlg->myNodeGeomBtn->setChecked(false);
onActivateObject( _MESH ); // install filter
}
else if ( sender() == myDlg->myElemGeomBtn && myDlg->myElemGeomBtn->isChecked() )
{
myDlg->myMeshBtn->setChecked(false);
myDlg->myNodeGeomBtn->setChecked(false);
onActivateObject( _ELEM_GEOM ); // install filter
}
else if ( sender() == myDlg->myNodeGeomBtn && myDlg->myNodeGeomBtn->isChecked() )
{
myDlg->myMeshBtn->setChecked(false);
myDlg->myElemGeomBtn->setChecked(false);
onActivateObject( _NODE_GEOM ); // install filter
}
//selectionDone();
}
| 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, inherited] |
Removes filter corresponding to certain object selection widget.
Definition at line 199 of file SMESHGUI_SelectionOp.cxx.
References SMESHGUI_SelectionOp.removeCustomFilters().
Referenced by SMESHGUI_SelectionOp.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, inherited] |
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 SMESHGUI_SelectionOp.startOperation().
{
}
| void SMESHGUI_SelectionOp::onTextChanged | ( | int | , |
| const QStringList & | list | ||
| ) | [protected, virtual, slot, inherited] |
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 SMESHGUI_SelectionOp.actor(), SMESHGUI_SelectionOp.extractIds(), SMDS_Mesh.FindNode(), SMESH_Actor.GetObject(), SMESHGUI_SelectionOp.highlight(), SMESH_test.ids, SMESH_reg.names, SMESHGUI_SelectionOp.selected(), and SMESHGUI_SelectionOp.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, inherited] |
Remove only filters set by this operation (they are in map myFilters )
Definition at line 101 of file SMESHGUI_SelectionOp.cxx.
References SMESHGUI_SelectionOp.myFilters.
Referenced by SMESHGUI_SelectionOp.abortOperation(), SMESHGUI_SelectionOp.commitOperation(), SMESHGUI_MeshOp.createHypothesis(), init(), onApply(), onButtonClick(), SMESHGUI_SelectionOp.onDeactivateObject(), SMESHGUI_MeshOp.onEditHyp(), and SMESHGUI_SelectionOp.~SMESHGUI_SelectionOp().
| void SMESHGUI_SelectionOp::selected | ( | QStringList & | , |
| SMESHGUI_Dialog::TypesList & | , | ||
| QStringList & | |||
| ) | const [protected, virtual, inherited] |
Get names, types and ids of selected objects.
Definition at line 359 of file SMESHGUI_SelectionOp.cxx.
References SMESHGUI_Operation._PTR(), SMESHGUI_SelectionOp.idChar(), SMESHGUI_SelectionOp.MeshElement, SMESHGUI_SelectionOp.MeshNode, SMESHGUI_SelectionOp.Object, SMESHGUI_SelectionOp.selectionMode(), and SMESHGUI_SelectionOp.typeById().
Referenced by SMESHGUI_SelectionOp.onTextChanged(), SMESHGUI_BoundingBox.selectionChanged(), SMESHGUI_MinDistance.selectionChanged(), SMESHGUI_SelectionOp.selectionDone(), SMESHGUI_Make2DFrom3DOp.selectionDone(), and 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 SMESHGUI_SelectionOp.extractIds(), and SMESH_test.ids.
{
if( !dlg() )
return;
QStringList ids; dlg()->selectedObject( id, ids );
extractIds( ids, list );
}
| void SMESHGUI_GroupOnShapeOp::selectionDone | ( | ) | [protected, virtual] |
Updates dialog's look and feel.
Virtual method redefined from the base class updates dialog's look and feel
Reimplemented from SMESHGUI_SelectionOp.
Definition at line 433 of file SMESHGUI_GroupOnShapeDlg.cxx.
References SMESHGUI_Operation._PTR(), SMESH_test.ids, myDlg, myElemGeoIDs, SMESHGUI_GroupOnShapeDlg.myElemGeomBtn, SMESHGUI_GroupOnShapeDlg.myElemGeomList, SMESHGUI_GroupOnShapeDlg.myMeshBtn, myMeshID, SMESHGUI_GroupOnShapeDlg.myMeshLine, myNodeGeoIDs, SMESHGUI_GroupOnShapeDlg.myNodeGeomBtn, SMESHGUI_GroupOnShapeDlg.myNodeGeomList, ex21_lamp.name, SMESH_reg.names, SMESHGUI_SelectionOp.selected(), and SMESHGUI_GroupOnShapeDlg.updateButtons().
{
QStringList names, ids;
LightApp_Dialog::TypesList types;
selected( names, types, ids );
int nbSelected = names.size();
if ( myDlg->myMeshBtn->isChecked() ) // mesh selected
{
myDlg->myMeshLine->setText("");
myMeshID = "";
if ( nbSelected == 1 ) {
myDlg->myMeshLine->setText( names.front() );
myMeshID = ids.front();
}
myDlg->myElemGeomList->clear();
myDlg->myElemGeomBtn->setEnabled( nbSelected == 1 );
myDlg->myNodeGeomList->clear();
myDlg->myNodeGeomBtn->setEnabled( nbSelected == 1 );
myDlg->myElemGeomBtn->click();
return;
}
// Filter off inappropriate shapes
QStringList goodNames, goodIds;
if (nbSelected > 0) {
// study
if (_PTR(Study) aStudy = SMESH::GetActiveStudyDocument()) {
// mesh
if (_PTR(SObject) meshSO = aStudy->FindObjectID( myMeshID.toLatin1().data() )) {
// shape to mesh
_PTR(SObject) anObj, shapeToMesh;
if (meshSO->FindSubObject(1, anObj) && anObj->ReferencedObject(shapeToMesh)) {
// loop on selected
QStringList::iterator name = names.begin(), id = ids.begin(), idEnd = ids.end();
for (; id != idEnd; ++id, ++name ) {
// shape SO
if (_PTR(SObject) shapeSO = aStudy->FindObjectID( id->toLatin1().data() )) {
// check if shape SO is a child of shape to mesh
while ( shapeSO && shapeSO->GetID() != shapeToMesh->GetID() )
if ( shapeSO->Depth() < 2 )
shapeSO.reset();
else
shapeSO = shapeSO->GetFather();
if ( shapeSO ) {
//printf( "selectionDone() %s %s\n", (*id).latin1(), (*name).latin1() );
if ( !goodIds.contains( *id )) {
goodIds.append( *id );
goodNames.append( *name );
}
}
}
}
}
}
}
}
if ( myDlg->myElemGeomBtn->isChecked() ) // elem geomerty selection
{
myDlg->myElemGeomList->clear();
myDlg->myElemGeomList->addItems( goodNames );
myElemGeoIDs = goodIds;
}
else if ( myDlg->myNodeGeomBtn->isChecked() ) // Node geomerty selection
{
myDlg->myNodeGeomList->clear();
myDlg->myNodeGeomList->addItems( goodNames );
myNodeGeoIDs = goodIds;
}
// enable/diable Apply, which can change at selection
myDlg->updateButtons();
}
| Selection_Mode SMESHGUI_SelectionOp::selectionMode | ( | ) | const [protected, inherited] |
Return what selection mode is set in VTK viewer.
Definition at line 229 of file SMESHGUI_SelectionOp.cxx.
References SMESHGUI_SelectionOp.viewWindow().
Referenced by SMESHGUI_ShapeByMeshOp.activateSelection(), SMESHGUI_SelectionOp.mesh(), SMESHGUI_FindElemByPointOp.onElemSelected(), SMESHGUI_FindElemByPointOp.onElemTypeChange(), SMESHGUI_SelectionOp.selected(), SMESHGUI_SelectionOp.selectionDone(), and SMESHGUI_SelectionOp.startOperation().
{
SVTK_ViewWindow* wnd = viewWindow();
if( wnd )
return wnd->SelectionMode();
else
return ActorSelection;
}
| SVTK_Selector * SMESHGUI_SelectionOp::selector | ( | ) | const [protected, inherited] |
Definition at line 287 of file SMESHGUI_SelectionOp.cxx.
References SMESHGUI_SelectionOp.viewWindow().
Referenced by SMESHGUI_SelectionOp.addOrRemoveIndex(), SMESHGUI_MinDistance.firstEdited(), SMESHGUI_ShapeByMeshOp.onElemIdChanged(), SMESHGUI_ShapeByMeshOp.onSelectionDone(), SMESHGUI_MakeNodeAtPointOp.onSelectionDone(), SMESHGUI_SelectionOp.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, inherited] |
Set selection mode in VTK viewer.
Definition at line 242 of file SMESHGUI_SelectionOp.cxx.
References SMESHGUI_SelectionOp.viewWindow().
Referenced by SMESHGUI_SelectionOp.abortOperation(), SMESHGUI_ShapeByMeshOp.activateSelection(), SMESHGUI_MakeNodeAtPointOp.activateSelection(), SMESHGUI_SelectionOp.commitOperation(), SMESHGUI_FindElemByPointOp.onElemSelected(), SMESHGUI_FindElemByPointOp.onElemTypeChange(), and SMESHGUI_SelectionOp.startOperation().
{
SVTK_ViewWindow* wnd = viewWindow();
if( wnd )
wnd->SetSelectionMode( mode );
}
| void SMESHGUI_GroupOnShapeOp::startOperation | ( | ) | [protected, virtual] |
start operation
Reimplemented from SMESHGUI_SelectionOp.
Definition at line 271 of file SMESHGUI_GroupOnShapeDlg.cxx.
References init(), myDlg, SMESHGUI_GroupOnShapeDlg.myElemGeomBtn, SMESHGUI_GroupOnShapeDlg.myMeshBtn, SMESHGUI_GroupOnShapeDlg.myNodeGeomBtn, onButtonClick(), and SMESHGUI_Dialog.show().
{
if (!myDlg)
{
myDlg = new SMESHGUI_GroupOnShapeDlg();
connect(myDlg->myMeshBtn, SIGNAL(clicked()), this, SLOT(onButtonClick()));
connect(myDlg->myElemGeomBtn, SIGNAL(clicked()), this, SLOT(onButtonClick()));
connect(myDlg->myNodeGeomBtn, SIGNAL(clicked()), this, SLOT(onButtonClick()));
//connect(myDlg->myGrpNameLine, SIGNAL(textChanged(const QString&)),myDlg,SLOT(updateButtons()));
}
SMESHGUI_SelectionOp::startOperation();
init();
myDlg->show();
}
| int SMESHGUI_SelectionOp::typeById | ( | const QString & | str, |
| const EntityType | objtype | ||
| ) | const [protected, virtual, inherited] |
Find type by id.
Definition at line 297 of file SMESHGUI_SelectionOp.cxx.
References SMESHGUI_Operation._PTR(), SMESHGUI_SelectionOp.idChar(), SMESHGUI_SelectionOp.mesh(), SMESHGUI_SelectionOp.MeshElement, SMESHGUI_SelectionOp.Object, SMESHGUI_Dialog.prefix(), SMESH_AdvancedEditor.res, SMESH_test4.submesh, and SMESHGUI_Selection.type().
Referenced by SMESHGUI_SelectionOp.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, inherited] |
Definition at line 278 of file SMESHGUI_SelectionOp.cxx.
References SMESHGUI_Operation.getSMESHGUI(), and SMESH.GetViewWindow().
Referenced by SMESHGUI_SelectionOp.highlight(), SMESHGUI_ShapeByMeshOp.onElemIdChanged(), SMESHGUI_SelectionOp.selectionMode(), SMESHGUI_SelectionOp.selector(), and SMESHGUI_SelectionOp.setSelectionMode().
{
return SMESH::GetViewWindow( getSMESHGUI() );
}
Definition at line 84 of file SMESHGUI_GroupOnShapeDlg.h.
Referenced by dlg(), init(), onApply(), onButtonClick(), selectionDone(), startOperation(), and ~SMESHGUI_GroupOnShapeOp().
QStringList SMESHGUI_GroupOnShapeOp.myElemGeoIDs [private] |
Definition at line 87 of file SMESHGUI_GroupOnShapeDlg.h.
Referenced by init(), onApply(), and selectionDone().
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_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().
QString SMESHGUI_GroupOnShapeOp.myMeshID [private] |
Definition at line 86 of file SMESHGUI_GroupOnShapeDlg.h.
Referenced by init(), onApply(), and selectionDone().
QStringList SMESHGUI_GroupOnShapeOp.myNodeGeoIDs [private] |
Definition at line 87 of file SMESHGUI_GroupOnShapeDlg.h.
Referenced by init(), onApply(), and selectionDone().