Minimum distance measurement widget. More...
#include <SMESHGUI_Measurements.h>

Public Member Functions | |
| SMESHGUI_MinDistance (QWidget *=0) | |
| Constructor. | |
| ~SMESHGUI_MinDistance () | |
| Destructor. | |
| bool | eventFilter (QObject *, QEvent *) |
| Event filter. | |
| void | updateSelection () |
| Setup selection mode depending on the current widget state. | |
| void | deactivate () |
| Deactivate widget. | |
Private Types | |
| enum | { NoTgt, FirstTgt, SecondTgt } |
| enum | { OriginTgt, NodeTgt, ElementTgt, ObjectTgt } |
Private Slots | |
| void | selectionChanged () |
| Called when selection is changed. | |
| void | firstChanged () |
| Called when first target mode is changed by the user. | |
| void | secondChanged () |
| Called when second target mode is changed by the user. | |
| void | firstEdited () |
| Called when first target is edited by the user. | |
| void | secondEdited () |
| Called when second target is edited by the user. | |
| void | compute () |
| Compute the minimum distance between targets. | |
| void | clear () |
| Reset the widget to the initial state (nullify result fields) | |
Private Member Functions | |
| void | setTarget (int) |
| Set current target for selection. | |
| void | erasePreview () |
| Erase preview actor. | |
| void | displayPreview () |
| Display preview actor. | |
| void | createPreview (double, double, double, double, double, double) |
| Create preview actor. | |
Private Attributes | |
| QButtonGroup * | myFirst |
| QButtonGroup * | mySecond |
| QLineEdit * | myFirstTgt |
| QLineEdit * | mySecondTgt |
| QLineEdit * | myDX |
| QLineEdit * | myDY |
| QLineEdit * | myDZ |
| QLineEdit * | myDistance |
| int | myCurrentTgt |
| SMESH::SMESH_IDSource_var | myFirstSrc |
| SMESH::SMESH_IDSource_var | mySecondSrc |
| SMESH_Actor * | myFirstActor |
| SMESH_Actor * | mySecondActor |
| SMESHGUI_IdValidator * | myValidator |
| SUIT_SelectionFilter * | myFilter |
| SALOME_Actor * | myPreview |
Minimum distance measurement widget.
Widget to calculate minimum distance between two objects.
Definition at line 43 of file SMESHGUI_Measurements.h.
anonymous enum [private] |
Definition at line 47 of file SMESHGUI_Measurements.h.
anonymous enum [private] |
Definition at line 48 of file SMESHGUI_Measurements.h.
{ OriginTgt, NodeTgt, ElementTgt, ObjectTgt };
| SMESHGUI_MinDistance::SMESHGUI_MinDistance | ( | QWidget * | parent = 0 | ) |
Constructor.
| parent | parent widget |
Definition at line 87 of file SMESHGUI_Measurements.cxx.
References clear(), compute(), ElementTgt, firstChanged(), firstEdited(), GROUP, SMESH_LogicalFilter.LO_OR, MESHorSUBMESH, myDistance, myDX, myDY, myDZ, myFilter, myFirst, myFirstTgt, mySecond, mySecondTgt, myValidator, NodeTgt, ObjectTgt, OriginTgt, secondChanged(), and secondEdited().
: QWidget( parent ), myCurrentTgt( FirstTgt ), myFirstActor( 0 ), mySecondActor( 0 ), myPreview( 0 ) { QGroupBox* aFirstTgtGrp = new QGroupBox( tr( "FIRST_TARGET" ), this ); QRadioButton* aFNode = new QRadioButton( tr( "NODE" ), aFirstTgtGrp ); QRadioButton* aFElem = new QRadioButton( tr( "ELEMENT" ), aFirstTgtGrp ); QRadioButton* aFObject = new QRadioButton( tr( "OBJECT" ), aFirstTgtGrp ); myFirstTgt = new QLineEdit( aFirstTgtGrp ); QGridLayout* fl = new QGridLayout( aFirstTgtGrp ); fl->setMargin( MARGIN ); fl->setSpacing( SPACING ); fl->addWidget( aFNode, 0, 0 ); fl->addWidget( aFElem, 0, 1 ); fl->addWidget( aFObject, 0, 2 ); fl->addWidget( myFirstTgt, 1, 0, 1, 3 ); myFirst = new QButtonGroup( this ); myFirst->addButton( aFNode, NodeTgt ); myFirst->addButton( aFElem, ElementTgt ); myFirst->addButton( aFObject, ObjectTgt ); QGroupBox* aSecondTgtGrp = new QGroupBox( tr( "SECOND_TARGET" ), this ); QRadioButton* aSOrigin = new QRadioButton( tr( "ORIGIN" ), aSecondTgtGrp ); QRadioButton* aSNode = new QRadioButton( tr( "NODE" ), aSecondTgtGrp ); QRadioButton* aSElem = new QRadioButton( tr( "ELEMENT" ), aSecondTgtGrp ); QRadioButton* aSObject = new QRadioButton( tr( "OBJECT" ), aSecondTgtGrp ); mySecondTgt = new QLineEdit( aSecondTgtGrp ); QGridLayout* sl = new QGridLayout( aSecondTgtGrp ); sl->setMargin( MARGIN ); sl->setSpacing( SPACING ); sl->addWidget( aSOrigin, 0, 0 ); sl->addWidget( aSNode, 0, 1 ); sl->addWidget( aSElem, 0, 2 ); sl->addWidget( aSObject, 0, 3 ); sl->addWidget( mySecondTgt, 1, 0, 1, 4 ); mySecond = new QButtonGroup( this ); mySecond->addButton( aSOrigin, OriginTgt ); mySecond->addButton( aSNode, NodeTgt ); mySecond->addButton( aSElem, ElementTgt ); mySecond->addButton( aSObject, ObjectTgt ); QPushButton* aCompute = new QPushButton( tr( "COMPUTE" ), this ); QGroupBox* aResults = new QGroupBox( tr( "RESULT" ), this ); QLabel* aDxLab = new QLabel( "dX", aResults ); myDX = new QLineEdit( aResults ); QLabel* aDyLab = new QLabel( "dY", aResults ); myDY = new QLineEdit( aResults ); QLabel* aDzLab = new QLabel( "dZ", aResults ); myDZ = new QLineEdit( aResults ); QLabel* aDistLab = new QLabel( tr( "DISTANCE" ), aResults ); myDistance = new QLineEdit( aResults ); QGridLayout* rl = new QGridLayout( aResults ); rl->setMargin( MARGIN ); rl->setSpacing( SPACING ); rl->addWidget( aDxLab, 0, 0 ); rl->addWidget( myDX, 0, 1 ); rl->addWidget( aDyLab, 1, 0 ); rl->addWidget( myDY, 1, 1 ); rl->addWidget( aDzLab, 2, 0 ); rl->addWidget( myDZ, 2, 1 ); rl->addWidget( aDistLab, 0, 2 ); rl->addWidget( myDistance, 0, 3 ); QGridLayout* l = new QGridLayout( this ); l->setMargin( MARGIN ); l->setSpacing( SPACING ); l->addWidget( aFirstTgtGrp, 0, 0, 1, 2 ); l->addWidget( aSecondTgtGrp, 1, 0, 1, 2 ); l->addWidget( aCompute, 2, 0 ); l->addWidget( aResults, 3, 0, 1, 2 ); l->setColumnStretch( 1, 5 ); l->setRowStretch( 4, 5 ); aFNode->setChecked( true ); aSOrigin->setChecked( true ); #ifndef MINDIST_ENABLE_ELEMENT aFElem->setEnabled( false ); // NOT AVAILABLE YET aSElem->setEnabled( false ); // NOT AVAILABLE YET #endif #ifndef MINDIST_ENABLE_OBJECT aFObject->setEnabled( false ); // NOT AVAILABLE YET aSObject->setEnabled( false ); // NOT AVAILABLE YET #endif myDX->setReadOnly( true ); myDY->setReadOnly( true ); myDZ->setReadOnly( true ); myDistance->setReadOnly( true ); myValidator = new SMESHGUI_IdValidator( this, 1 ); myFirstTgt->installEventFilter( this ); mySecondTgt->installEventFilter( this ); connect( myFirst, SIGNAL( buttonClicked( int ) ), this, SLOT( firstChanged() ) ); connect( mySecond, SIGNAL( buttonClicked( int ) ), this, SLOT( secondChanged() ) ); connect( aCompute, SIGNAL( clicked() ), this, SLOT( compute() ) ); connect( myFirstTgt, SIGNAL( textEdited( QString ) ), this, SLOT( firstEdited() ) ); connect( mySecondTgt, SIGNAL( textEdited( QString ) ), this, SLOT( secondEdited() ) ); QList<SUIT_SelectionFilter*> filters; filters.append( new SMESH_TypeFilter( MESHorSUBMESH ) ); filters.append( new SMESH_TypeFilter( GROUP ) ); myFilter = new SMESH_LogicalFilter( filters, SMESH_LogicalFilter::LO_OR ); mySecondTgt->setEnabled( mySecond->checkedId() != OriginTgt ); clear(); //setTarget( FirstTgt ); }
| SMESHGUI_MinDistance::~SMESHGUI_MinDistance | ( | ) |
Destructor.
Definition at line 206 of file SMESHGUI_Measurements.cxx.
References erasePreview(), and myPreview.
{
erasePreview();
if ( myPreview )
myPreview->Delete();
}
| void SMESHGUI_MinDistance::clear | ( | ) | [private, slot] |
Reset the widget to the initial state (nullify result fields)
Definition at line 595 of file SMESHGUI_Measurements.cxx.
References erasePreview(), myDistance, myDX, myDY, and myDZ.
Referenced by compute(), firstChanged(), firstEdited(), secondChanged(), secondEdited(), selectionChanged(), and SMESHGUI_MinDistance().
{
myDX->clear();
myDY->clear();
myDZ->clear();
myDistance->clear();
erasePreview();
}
| void SMESHGUI_MinDistance::compute | ( | ) | [private, slot] |
Compute the minimum distance between targets.
Definition at line 519 of file SMESHGUI_Measurements.cxx.
References clear(), createPreview(), displayPreview(), ElementTgt, erasePreview(), FACE, SMESHGUI.GetSMESHGen(), SMESH_test.ids, ex30_tepal.m, SMESH.Measure.minX, SMESH.Measure.minY, SMESH.Measure.minZ, myDistance, myDX, myDY, myDZ, myFirst, myFirstSrc, myFirstTgt, mySecond, mySecondSrc, mySecondTgt, SMESH.NODE, SMESH.Measure.node1, SMESH.Measure.node2, NodeTgt, OriginTgt, SMESHGUI.resourceMgr(), SMESH.Measure.value, ex29_refine.x1, ex29_refine.x2, SMESH_fixation.y1, SMESH_fixation.y2, SMESH_fixation.z1, and SMESH_fixation.z2.
Referenced by SMESHGUI_MinDistance().
{
SUIT_OverrideCursor wc;
SMESH::SMESH_IDSource_var s1;
SMESH::SMESH_IDSource_var s2;
bool isOrigin = mySecond->checkedId() == OriginTgt;
// process first target
if ( !CORBA::is_nil( myFirstSrc ) ) {
if ( myFirst->checkedId() == NodeTgt || myFirst->checkedId() == ElementTgt ) {
SMESH::SMESH_Mesh_var m = myFirstSrc->GetMesh();
long id = myFirstTgt->text().toLong();
if ( !CORBA::is_nil( m ) && id ) {
SMESH::long_array_var ids = new SMESH::long_array();
ids->length( 1 );
ids[0] = id;
SMESH::SMESH_MeshEditor_var me = m->GetMeshEditor();
s1 = me->MakeIDSource( ids.in(), myFirst->checkedId() == NodeTgt ? SMESH::NODE : SMESH::FACE );
}
}
else {
s1 = myFirstSrc;
}
}
// process second target
if ( !CORBA::is_nil( mySecondSrc ) ) {
if ( mySecond->checkedId() == NodeTgt || mySecond->checkedId() == ElementTgt ) {
SMESH::SMESH_Mesh_var m = mySecondSrc->GetMesh();
long id = mySecondTgt->text().toLong();
if ( !CORBA::is_nil( m ) && id ) {
SMESH::long_array_var ids = new SMESH::long_array();
ids->length( 1 );
ids[0] = id;
SMESH::SMESH_MeshEditor_var me = m->GetMeshEditor();
s2 = me->MakeIDSource( ids.in(), mySecond->checkedId() == NodeTgt ? SMESH::NODE : SMESH::FACE );
}
}
else {
s2 = mySecondSrc;
}
}
if ( !CORBA::is_nil( s1 ) && ( !CORBA::is_nil( s2 ) || isOrigin ) ) {
// compute min distance
int precision = SMESHGUI::resourceMgr()->integerValue( "SMESH", "length_precision", 6 );
SMESH::Measurements_var measure = SMESHGUI::GetSMESHGen()->CreateMeasurements();
SMESH::Measure result = measure->MinDistance( s1.in(), s2.in() );
measure->UnRegister();
myDX->setText( QString::number( result.minX, precision > 0 ? 'f' : 'g', qAbs( precision ) ) );
myDY->setText( QString::number( result.minY, precision > 0 ? 'f' : 'g', qAbs( precision ) ) );
myDZ->setText( QString::number( result.minZ, precision > 0 ? 'f' : 'g', qAbs( precision ) ) );
myDistance->setText( QString::number( result.value, precision > 0 ? 'f' : 'g', qAbs( precision ) ) );
// update preview actor
erasePreview();
double x1, y1, z1, x2, y2, z2;
SMESH::double_array_var coord = s1->GetMesh()->GetNodeXYZ( result.node1 );
x1 = coord[0]; y1 = coord[1]; z1 = coord[2];
if ( isOrigin ) {
x2 = y2 = z2 = 0.;
}
else {
coord = s2->GetMesh()->GetNodeXYZ( result.node2 );
x2 = coord[0]; y2 = coord[1]; z2 = coord[2];
}
createPreview( x1, y1, z1, x2, y2, z2 );
displayPreview();
}
else {
clear();
}
}
| void SMESHGUI_MinDistance::createPreview | ( | double | x1, |
| double | y1, | ||
| double | z1, | ||
| double | x2, | ||
| double | y2, | ||
| double | z2 | ||
| ) | [private] |
Create preview actor.
| x1 | X coordinate of first point |
| y1 | X coordinate of first point |
| z1 | Y coordinate of first point |
| x2 | Y coordinate of second point |
| y2 | Z coordinate of second point |
| z2 | Z coordinate of second point |
Definition at line 328 of file SMESHGUI_Measurements.cxx.
References myPreview.
Referenced by compute().
{
if ( myPreview )
myPreview->Delete();
vtkUnstructuredGrid* aGrid = vtkUnstructuredGrid::New();
// create points
vtkPoints* aPoints = vtkPoints::New();
aPoints->SetNumberOfPoints( 2 );
aPoints->SetPoint( 0, x1, y1, z1 );
aPoints->SetPoint( 1, x2, y2, z2 );
aGrid->SetPoints( aPoints );
aPoints->Delete();
// create cells
vtkIdList* anIdList = vtkIdList::New();
anIdList->SetNumberOfIds( 2 );
vtkCellArray* aCells = vtkCellArray::New();
aCells->Allocate( 2, 0);
vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
aCellTypesArray->SetNumberOfComponents( 1 );
aCellTypesArray->Allocate( 1 );
anIdList->SetId( 0, 0 ); anIdList->SetId( 1, 1 );
aCells->InsertNextCell( anIdList );
aCellTypesArray->InsertNextValue( VTK_LINE );
anIdList->Delete();
VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New();
aCellLocationsArray->SetNumberOfComponents( 1 );
aCellLocationsArray->SetNumberOfTuples( 1 );
aCells->InitTraversal();
for( vtkIdType idType = 0, *pts, npts; aCells->GetNextCell( npts, pts ); idType++ )
aCellLocationsArray->SetValue( idType, aCells->GetTraversalLocation( npts ) );
aGrid->SetCells( aCellTypesArray, aCellLocationsArray, aCells );
aCellLocationsArray->Delete();
aCellTypesArray->Delete();
aCells->Delete();
// create actor
vtkDataSetMapper* aMapper = vtkDataSetMapper::New();
aMapper->SetInput( aGrid );
aGrid->Delete();
myPreview = SALOME_Actor::New();
myPreview->PickableOff();
myPreview->SetMapper( aMapper );
aMapper->Delete();
vtkProperty* aProp = vtkProperty::New();
aProp->SetRepresentationToWireframe();
aProp->SetColor( 250, 0, 250 );
aProp->SetPointSize( 5 );
aProp->SetLineWidth( 3 );
myPreview->SetProperty( aProp );
aProp->Delete();
}
| void SMESHGUI_MinDistance::deactivate | ( | ) |
Deactivate widget.
Definition at line 278 of file SMESHGUI_Measurements.cxx.
References SMESHGUI.selectionMgr().
Referenced by SMESHGUI_MeasureDlg.deactivate().
{
disconnect( SMESHGUI::selectionMgr(), 0, this, 0 );
}
| void SMESHGUI_MinDistance::displayPreview | ( | ) | [private] |
Display preview actor.
Definition at line 310 of file SMESHGUI_Measurements.cxx.
References SMESH.GetViewWindow(), and myPreview.
Referenced by compute().
{
SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow();
if ( aViewWindow && myPreview ) {
aViewWindow->AddActor( myPreview );
aViewWindow->Repaint();
}
}
| void SMESHGUI_MinDistance::erasePreview | ( | ) | [private] |
Erase preview actor.
Definition at line 298 of file SMESHGUI_Measurements.cxx.
References SMESH.GetViewWindow(), and myPreview.
Referenced by clear(), compute(), and ~SMESHGUI_MinDistance().
{
SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow();
if ( aViewWindow && myPreview ) {
aViewWindow->RemoveActor( myPreview );
aViewWindow->Repaint();
}
}
Event filter.
| o | object |
| o | event |
true if event is filtered or false otherwise Definition at line 219 of file SMESHGUI_Measurements.cxx.
References FirstTgt, myFirstTgt, mySecondTgt, SecondTgt, and setTarget().
{
if ( e->type() == QEvent::FocusIn ) {
if ( o == myFirstTgt )
setTarget( FirstTgt );
else if ( o == mySecondTgt )
setTarget( SecondTgt );
}
return QWidget::eventFilter( o, e );
}
| void SMESHGUI_MinDistance::firstChanged | ( | ) | [private, slot] |
Called when first target mode is changed by the user.
Definition at line 448 of file SMESHGUI_Measurements.cxx.
References clear(), FirstTgt, myFirst, myFirstSrc, myFirstTgt, myValidator, ObjectTgt, setTarget(), and updateSelection().
Referenced by SMESHGUI_MinDistance().
{
myFirstSrc = SMESH::SMESH_IDSource::_nil();
myFirstTgt->clear();
myFirstTgt->setReadOnly( myFirst->checkedId() == ObjectTgt );
myFirstTgt->setValidator( myFirst->checkedId() == ObjectTgt ? 0 : myValidator );
setTarget( FirstTgt );
updateSelection();
clear();
}
| void SMESHGUI_MinDistance::firstEdited | ( | ) | [private, slot] |
Called when first target is edited by the user.
Definition at line 477 of file SMESHGUI_Measurements.cxx.
References clear(), ElementTgt, FirstTgt, SMESH.GetViewWindow(), Handle(), myFirst, myFirstActor, myFirstTgt, NodeTgt, SMESHGUI_SelectionOp.selector(), and setTarget().
Referenced by SMESHGUI_MinDistance(), and updateSelection().
{
setTarget( FirstTgt );
if ( sender() == myFirstTgt )
clear();
SVTK_Selector* selector = SMESH::GetViewWindow()->GetSelector();
if ( myFirstActor && selector ) {
Handle(SALOME_InteractiveObject) IO = myFirstActor->getIO();
if ( myFirst->checkedId() == NodeTgt || myFirst->checkedId() == ElementTgt ) {
TColStd_MapOfInteger ID;
ID.Add( myFirstTgt->text().toLong() );
selector->AddOrRemoveIndex( IO, ID, false );
}
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow() )
aViewWindow->highlight( IO, true, true );
}
}
| void SMESHGUI_MinDistance::secondChanged | ( | ) | [private, slot] |
Called when second target mode is changed by the user.
Definition at line 462 of file SMESHGUI_Measurements.cxx.
References clear(), mySecond, mySecondSrc, mySecondTgt, myValidator, NoTgt, ObjectTgt, OriginTgt, SecondTgt, setTarget(), and updateSelection().
Referenced by SMESHGUI_MinDistance().
{
mySecondSrc = SMESH::SMESH_IDSource::_nil();
mySecondTgt->setEnabled( mySecond->checkedId() != OriginTgt );
mySecondTgt->setReadOnly( mySecond->checkedId() == ObjectTgt );
mySecondTgt->setValidator( mySecond->checkedId() == ObjectTgt ? 0 : myValidator );
mySecondTgt->clear();
setTarget( mySecond->checkedId() != OriginTgt ? SecondTgt : NoTgt );
updateSelection();
clear();
}
| void SMESHGUI_MinDistance::secondEdited | ( | ) | [private, slot] |
Called when second target is edited by the user.
Definition at line 498 of file SMESHGUI_Measurements.cxx.
References clear(), ElementTgt, SMESH.GetViewWindow(), Handle(), mySecond, mySecondActor, mySecondTgt, NodeTgt, SecondTgt, SMESHGUI_SelectionOp.selector(), and setTarget().
Referenced by SMESHGUI_MinDistance(), and updateSelection().
{
setTarget( SecondTgt );
if ( sender() == mySecondTgt )
clear();
SVTK_Selector* selector = SMESH::GetViewWindow()->GetSelector();
if ( mySecondActor && selector ) {
Handle(SALOME_InteractiveObject) IO = mySecondActor->getIO();
if ( mySecond->checkedId() == NodeTgt || mySecond->checkedId() == ElementTgt ) {
TColStd_MapOfInteger ID;
ID.Add( mySecondTgt->text().toLong() );
selector->AddOrRemoveIndex( IO, ID, false );
}
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow() )
aViewWindow->highlight( IO, true, true );
}
}
| void SMESHGUI_MinDistance::selectionChanged | ( | ) | [private, slot] |
Called when selection is changed.
Definition at line 383 of file SMESHGUI_Measurements.cxx.
References clear(), SMESH.FindActorByEntry(), FirstTgt, SMESH.GetNameOfSelectedElements(), SMESH.GetNameOfSelectedIObjects(), SMESH.GetNameOfSelectedNodes(), SMESH.GetViewWindow(), Handle(), myCurrentTgt, myFirst, myFirstActor, myFirstSrc, myFirstTgt, mySecond, mySecondActor, mySecondSrc, mySecondTgt, NodeTgt, ObjectTgt, SecondTgt, SMESHGUI_SelectionOp.selected(), SMESHGUI.selectionMgr(), and SMESHGUI_SelectionOp.selector().
Referenced by updateSelection().
{
SUIT_OverrideCursor wc;
SALOME_ListIO selected;
SMESHGUI::selectionMgr()->selectedObjects( selected );
if ( selected.Extent() == 1 ) {
Handle(SALOME_InteractiveObject) IO = selected.First();
SMESH::SMESH_IDSource_var obj = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>( IO );
if ( !CORBA::is_nil( obj ) ) {
if ( myCurrentTgt == FirstTgt ) {
myFirstSrc = obj;
myFirstActor = SMESH::FindActorByEntry( IO->getEntry() );
if ( myFirst->checkedId() == ObjectTgt ) {
QString aName;
SMESH::GetNameOfSelectedIObjects( SMESHGUI::selectionMgr(), aName );
myFirstTgt->setText( aName );
}
else {
SVTK_Selector* selector = SMESH::GetViewWindow()->GetSelector();
QString ID;
int nb = 0;
if ( myFirstActor && selector ) {
nb = myFirst->checkedId() == NodeTgt ?
SMESH::GetNameOfSelectedElements( selector, IO, ID ) :
SMESH::GetNameOfSelectedNodes( selector, IO, ID );
}
if ( nb == 1 )
myFirstTgt->setText( ID.trimmed() );
else
myFirstTgt->clear();
}
}
else if ( myCurrentTgt == SecondTgt ) {
mySecondSrc = obj;
mySecondActor = SMESH::FindActorByEntry( IO->getEntry() );
if ( mySecond->checkedId() == ObjectTgt ) {
QString aName;
SMESH::GetNameOfSelectedIObjects( SMESHGUI::selectionMgr(), aName );
mySecondTgt->setText( aName );
}
else {
SVTK_Selector* selector = SMESH::GetViewWindow()->GetSelector();
QString ID;
int nb = 0;
if ( mySecondActor && selector ) {
nb = mySecond->checkedId() == NodeTgt ?
SMESH::GetNameOfSelectedElements( selector, IO, ID ) :
SMESH::GetNameOfSelectedNodes( selector, IO, ID );
}
if ( nb == 1 )
mySecondTgt->setText( ID.trimmed() );
else
mySecondTgt->clear();
}
}
}
}
clear();
}
| void SMESHGUI_MinDistance::setTarget | ( | int | target | ) | [private] |
Set current target for selection.
| target | new target ID |
Definition at line 287 of file SMESHGUI_Measurements.cxx.
References myCurrentTgt, and updateSelection().
Referenced by eventFilter(), firstChanged(), firstEdited(), secondChanged(), and secondEdited().
{
if ( myCurrentTgt != target ) {
myCurrentTgt = target;
updateSelection();
}
}
| void SMESHGUI_MinDistance::updateSelection | ( | ) |
Setup selection mode depending on the current widget state.
Definition at line 233 of file SMESHGUI_Measurements.cxx.
References ElementTgt, firstEdited(), FirstTgt, SMESH.GetViewWindow(), myCurrentTgt, myFilter, myFirst, mySecond, NodeTgt, NoTgt, ObjectTgt, secondEdited(), SecondTgt, selectionChanged(), SMESHGUI.selectionMgr(), and SMESH.SetPointRepresentation().
Referenced by firstChanged(), secondChanged(), setTarget(), and SMESHGUI_MeasureDlg.updateSelection().
{
LightApp_SelectionMgr* selMgr = SMESHGUI::selectionMgr();
disconnect( selMgr, 0, this, 0 );
selMgr->clearFilters();
bool nodeMode = ( myCurrentTgt == FirstTgt && myFirst->checkedId() == NodeTgt ) ||
( myCurrentTgt == SecondTgt && mySecond->checkedId() == NodeTgt );
bool elemMode = ( myCurrentTgt == FirstTgt && myFirst->checkedId() == ElementTgt ) ||
( myCurrentTgt == SecondTgt && mySecond->checkedId() == ElementTgt );
bool objMode = ( myCurrentTgt == FirstTgt && myFirst->checkedId() == ObjectTgt ) ||
( myCurrentTgt == SecondTgt && mySecond->checkedId() == ObjectTgt ) ||
( myCurrentTgt == NoTgt );
if ( nodeMode ) {
SMESH::SetPointRepresentation( true );
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow() )
aViewWindow->SetSelectionMode( NodeSelection );
}
else if ( elemMode ) {
SMESH::SetPointRepresentation( false );
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow() )
aViewWindow->SetSelectionMode( CellSelection );
}
else if ( objMode ) {
SMESH::SetPointRepresentation( false );
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow() )
aViewWindow->SetSelectionMode( ActorSelection );
selMgr->installFilter( myFilter );
}
connect( selMgr, SIGNAL( currentSelectionChanged() ), this, SLOT( selectionChanged() ) );
if ( myCurrentTgt == FirstTgt )
firstEdited();
else if ( myCurrentTgt == SecondTgt )
secondEdited();
//selectionChanged();
}
int SMESHGUI_MinDistance.myCurrentTgt [private] |
Definition at line 82 of file SMESHGUI_Measurements.h.
Referenced by selectionChanged(), setTarget(), and updateSelection().
QLineEdit* SMESHGUI_MinDistance.myDistance [private] |
Definition at line 81 of file SMESHGUI_Measurements.h.
Referenced by clear(), compute(), and SMESHGUI_MinDistance().
QLineEdit* SMESHGUI_MinDistance.myDX [private] |
Definition at line 78 of file SMESHGUI_Measurements.h.
Referenced by clear(), compute(), and SMESHGUI_MinDistance().
QLineEdit* SMESHGUI_MinDistance.myDY [private] |
Definition at line 79 of file SMESHGUI_Measurements.h.
Referenced by clear(), compute(), and SMESHGUI_MinDistance().
QLineEdit* SMESHGUI_MinDistance.myDZ [private] |
Definition at line 80 of file SMESHGUI_Measurements.h.
Referenced by clear(), compute(), and SMESHGUI_MinDistance().
Definition at line 88 of file SMESHGUI_Measurements.h.
Referenced by SMESHGUI_MinDistance(), and updateSelection().
QButtonGroup* SMESHGUI_MinDistance.myFirst [private] |
Definition at line 74 of file SMESHGUI_Measurements.h.
Referenced by compute(), firstChanged(), firstEdited(), selectionChanged(), SMESHGUI_MinDistance(), and updateSelection().
SMESH_Actor* SMESHGUI_MinDistance.myFirstActor [private] |
Definition at line 85 of file SMESHGUI_Measurements.h.
Referenced by firstEdited(), and selectionChanged().
SMESH::SMESH_IDSource_var SMESHGUI_MinDistance.myFirstSrc [private] |
Definition at line 83 of file SMESHGUI_Measurements.h.
Referenced by compute(), firstChanged(), and selectionChanged().
QLineEdit* SMESHGUI_MinDistance.myFirstTgt [private] |
Definition at line 76 of file SMESHGUI_Measurements.h.
Referenced by compute(), eventFilter(), firstChanged(), firstEdited(), selectionChanged(), and SMESHGUI_MinDistance().
SALOME_Actor* SMESHGUI_MinDistance.myPreview [private] |
Definition at line 89 of file SMESHGUI_Measurements.h.
Referenced by createPreview(), displayPreview(), erasePreview(), and ~SMESHGUI_MinDistance().
QButtonGroup* SMESHGUI_MinDistance.mySecond [private] |
Definition at line 75 of file SMESHGUI_Measurements.h.
Referenced by compute(), secondChanged(), secondEdited(), selectionChanged(), SMESHGUI_MinDistance(), and updateSelection().
SMESH_Actor* SMESHGUI_MinDistance.mySecondActor [private] |
Definition at line 86 of file SMESHGUI_Measurements.h.
Referenced by secondEdited(), and selectionChanged().
SMESH::SMESH_IDSource_var SMESHGUI_MinDistance.mySecondSrc [private] |
Definition at line 84 of file SMESHGUI_Measurements.h.
Referenced by compute(), secondChanged(), and selectionChanged().
QLineEdit* SMESHGUI_MinDistance.mySecondTgt [private] |
Definition at line 77 of file SMESHGUI_Measurements.h.
Referenced by compute(), eventFilter(), secondChanged(), secondEdited(), selectionChanged(), and SMESHGUI_MinDistance().
Definition at line 87 of file SMESHGUI_Measurements.h.
Referenced by firstChanged(), secondChanged(), and SMESHGUI_MinDistance().