Version: 6.3.1
Public Member Functions | Private Types | Private Slots | Private Member Functions | Private Attributes

SMESHGUI_BoundingBox Class Reference

Bounding box measurement widget. More...

#include <SMESHGUI_Measurements.h>

Inheritance diagram for SMESHGUI_BoundingBox:
Inheritance graph
[legend]

Public Member Functions

 SMESHGUI_BoundingBox (QWidget *=0)
 Constructor.
 ~SMESHGUI_BoundingBox ()
 Destructor.
void updateSelection ()
 Setup selection mode depending on the current widget state.
void deactivate ()
 Deactivate widget.

Private Types

enum  { ObjectsSrc, NodesSrc, ElementsSrc }
typedef QList
< SMESH::SMESH_IDSource_var > 
SourceList

Private Slots

void selectionChanged ()
 Called when selection is changed.
void sourceChanged ()
 Called when source mode is changed by the user.
void sourceEdited ()
 Called when source mode is edited by the user.
void compute ()
 Calculate bounding box of the selected object(s)
void clear ()
 Reset the widget to the initial state (nullify result fields)

Private Member Functions

void erasePreview ()
 Erase preview actor.
void displayPreview ()
 Display preview actor.
void createPreview (double, double, double, double, double, double)
 Create preview actor.

Private Attributes

QButtonGroup * mySourceMode
QLineEdit * mySource
QLineEdit * myXmin
QLineEdit * myXmax
QLineEdit * myDX
QLineEdit * myYmin
QLineEdit * myYmax
QLineEdit * myDY
QLineEdit * myZmin
QLineEdit * myZmax
QLineEdit * myDZ
SourceList mySrc
SMESH_ActormyActor
SMESHGUI_IdValidatormyValidator
QString myIDs
SUIT_SelectionFiltermyFilter
SALOME_ActormyPreview

Detailed Description

Bounding box measurement widget.

Widget to calculate bounding box of the selected object(s).

Definition at line 92 of file SMESHGUI_Measurements.h.


Member Typedef Documentation

typedef QList<SMESH::SMESH_IDSource_var> SMESHGUI_BoundingBox.SourceList [private]

Definition at line 118 of file SMESHGUI_Measurements.h.


Member Enumeration Documentation

anonymous enum [private]
Enumerator:
ObjectsSrc 
NodesSrc 
ElementsSrc 

Definition at line 96 of file SMESHGUI_Measurements.h.


Constructor & Destructor Documentation

SMESHGUI_BoundingBox::SMESHGUI_BoundingBox ( QWidget parent = 0)

Constructor.

Parameters:
parentparent widget

Definition at line 615 of file SMESHGUI_Measurements.cxx.

References clear(), compute(), ElementsSrc, GROUP, SMESH_LogicalFilter.LO_OR, MESHorSUBMESH, myDX, myDY, myDZ, myFilter, mySource, mySourceMode, myValidator, myXmax, myXmin, myYmax, myYmin, myZmax, myZmin, NodesSrc, ObjectsSrc, sourceChanged(), and sourceEdited().

: QWidget( parent ), myActor( 0 ), myPreview( 0 )
{
  QGroupBox* aSourceGrp = new QGroupBox( tr( "SOURCE" ), this );
  QRadioButton* aObjects  = new QRadioButton( tr( "OBJECTS" ),  aSourceGrp );
  QRadioButton* aNodes    = new QRadioButton( tr( "NODES" ),    aSourceGrp );
  QRadioButton* aElements = new QRadioButton( tr( "ELEMENTS" ), aSourceGrp );
  mySource = new QLineEdit( aSourceGrp );
  
  QGridLayout* fl = new QGridLayout( aSourceGrp );
  fl->setMargin( MARGIN );
  fl->setSpacing( SPACING );
  fl->addWidget( aObjects,   0, 0 );
  fl->addWidget( aNodes,     0, 1 );
  fl->addWidget( aElements,  0, 2 );
  fl->addWidget( mySource,   1, 0, 1, 3 );
  
  mySourceMode = new QButtonGroup( this );
  mySourceMode->addButton( aObjects,  ObjectsSrc );
  mySourceMode->addButton( aNodes,    NodesSrc );
  mySourceMode->addButton( aElements, ElementsSrc );

  QPushButton* aCompute = new QPushButton( tr( "COMPUTE" ), this );

  QGroupBox* aResults = new QGroupBox( tr( "RESULT" ), this );
  QLabel* aXminLab = new QLabel( "Xmin", aResults );
  myXmin           = new QLineEdit( aResults );
  QLabel* aXmaxLab = new QLabel( "Xmax", aResults );
  myXmax           = new QLineEdit( aResults );
  QLabel* aDxLab   = new QLabel( "dX", aResults );
  myDX             = new QLineEdit( aResults );
  QLabel* aYminLab = new QLabel( "Ymin", aResults );
  myYmin           = new QLineEdit( aResults );
  QLabel* aYmaxLab = new QLabel( "Ymax", aResults );
  myYmax           = new QLineEdit( aResults );
  QLabel* aDyLab   = new QLabel( "dY", aResults );
  myDY             = new QLineEdit( aResults );
  QLabel* aZminLab = new QLabel( "Zmin", aResults );
  myZmin           = new QLineEdit( aResults );
  QLabel* aZmaxLab = new QLabel( "Zmax", aResults );
  myZmax           = new QLineEdit( aResults );
  QLabel* aDzLab   = new QLabel( "dZ", aResults );
  myDZ             = new QLineEdit( aResults );

  QGridLayout* rl  = new QGridLayout( aResults );
  rl->setMargin( MARGIN );
  rl->setSpacing( SPACING );
  rl->addWidget( aXminLab,   0, 0 );
  rl->addWidget( myXmin,     0, 1 );
  rl->addWidget( aXmaxLab,   0, 2 );
  rl->addWidget( myXmax,     0, 3 );
  rl->addWidget( aDxLab,     0, 4 );
  rl->addWidget( myDX,       0, 5 );
  rl->addWidget( aYminLab,   1, 0 );
  rl->addWidget( myYmin,     1, 1 );
  rl->addWidget( aYmaxLab,   1, 2 );
  rl->addWidget( myYmax,     1, 3 );
  rl->addWidget( aDyLab,     1, 4 );
  rl->addWidget( myDY,       1, 5 );
  rl->addWidget( aZminLab,   2, 0 );
  rl->addWidget( myZmin,     2, 1 );
  rl->addWidget( aZmaxLab,   2, 2 );
  rl->addWidget( myZmax,     2, 3 );
  rl->addWidget( aDzLab,     2, 4 );
  rl->addWidget( myDZ,       2, 5 );

  QGridLayout* l = new QGridLayout( this );
  l->setMargin( MARGIN );
  l->setSpacing( SPACING );

  l->addWidget( aSourceGrp, 0, 0, 1, 2 );
  l->addWidget( aCompute,   1, 0 );
  l->addWidget( aResults,   2, 0, 1, 2 );
  l->setColumnStretch( 1, 5 );
  l->setRowStretch( 3, 5 );

  aObjects->setChecked( true );
  myXmin->setReadOnly( true );
  myXmax->setReadOnly( true );
  myDX->setReadOnly( true );
  myYmin->setReadOnly( true );
  myYmax->setReadOnly( true );
  myDY->setReadOnly( true );
  myZmin->setReadOnly( true );
  myZmax->setReadOnly( true );
  myDZ->setReadOnly( true );

  myValidator = new SMESHGUI_IdValidator( this );

  connect( mySourceMode, SIGNAL( buttonClicked( int ) ),  this, SLOT( sourceChanged() ) );
  connect( aCompute,     SIGNAL( clicked() ),             this, SLOT( compute() ) );
  connect( mySource,     SIGNAL( textEdited( QString ) ), this, SLOT( sourceEdited() ) );

  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 );

  clear();
}
SMESHGUI_BoundingBox::~SMESHGUI_BoundingBox ( )

Destructor.

Definition at line 719 of file SMESHGUI_Measurements.cxx.

References erasePreview(), and myPreview.

{
  erasePreview();
  if ( myPreview )
    myPreview->Delete();
}

Member Function Documentation

void SMESHGUI_BoundingBox::clear ( ) [private, slot]

Reset the widget to the initial state (nullify result fields)

Definition at line 1069 of file SMESHGUI_Measurements.cxx.

References erasePreview(), myDX, myDY, myDZ, myXmax, myXmin, myYmax, myYmin, myZmax, and myZmin.

Referenced by compute(), selectionChanged(), SMESHGUI_BoundingBox(), sourceChanged(), and sourceEdited().

{
  myXmin->clear();
  myXmax->clear();
  myDX->clear();
  myYmin->clear();
  myYmax->clear();
  myDY->clear();
  myZmin->clear();
  myZmax->clear();
  myDZ->clear();
  erasePreview();
}
void SMESHGUI_BoundingBox::compute ( ) [private, slot]

Calculate bounding box of the selected object(s)

Definition at line 1016 of file SMESHGUI_Measurements.cxx.

References clear(), createPreview(), displayPreview(), ElementsSrc, erasePreview(), FACE, SMESHGUI.GetSMESHGen(), SMESH_test.ids, ex30_tepal.m, SMESH.Measure.maxX, SMESH.Measure.maxY, SMESH.Measure.maxZ, SMESH.Measure.minX, SMESH.Measure.minY, SMESH.Measure.minZ, myDX, myDY, myDZ, myIDs, mySourceMode, mySrc, myXmax, myXmin, myYmax, myYmin, myZmax, myZmin, SMESH.NODE, NodesSrc, and SMESHGUI.resourceMgr().

Referenced by SMESHGUI_BoundingBox().

{
  SUIT_OverrideCursor wc;
  SMESH::ListOfIDSources_var srcList = new SMESH::ListOfIDSources();
  if ( mySourceMode->checkedId() == NodesSrc || mySourceMode->checkedId() == ElementsSrc ) {
    if ( mySrc.count() > 0 && !CORBA::is_nil( mySrc[0] ) ) {
      SMESH::SMESH_Mesh_var m = mySrc[0]->GetMesh();
      QStringList ids = myIDs.split( " ", QString::SkipEmptyParts );
      if ( !CORBA::is_nil( m ) && ids.count() > 0 ) {
        SMESH::long_array_var ids_in = new SMESH::long_array();
        ids_in->length( ids.count() );
        for( int i = 0; i < ids.count(); i++ )
          ids_in[i] = ids[i].trimmed().toLong();
        SMESH::SMESH_MeshEditor_var me = m->GetMeshEditor();
        SMESH::SMESH_IDSource_var s = me->MakeIDSource( ids_in.in(), mySourceMode->checkedId() == NodesSrc ? SMESH::NODE : SMESH::FACE ); 
        srcList->length( 1 );
        srcList[0] = s;
      }
    }
  }
  else {
    srcList->length( mySrc.count() );
    for( int i = 0; i < mySrc.count(); i++ )
      srcList[i] = mySrc[i];
  }
  if ( srcList->length() > 0 ) {
    // compute bounding box
    int precision = SMESHGUI::resourceMgr()->integerValue( "SMESH", "length_precision", 6 );
    SMESH::Measurements_var measure = SMESHGUI::GetSMESHGen()->CreateMeasurements();
    SMESH::Measure result = measure->BoundingBox( srcList.in() );
    measure->UnRegister();
    myXmin->setText( QString::number( result.minX, precision > 0 ? 'f' : 'g', qAbs( precision ) ) );
    myXmax->setText( QString::number( result.maxX, precision > 0 ? 'f' : 'g', qAbs( precision ) ) );
    myDX->setText( QString::number( result.maxX-result.minX, precision > 0 ? 'f' : 'g', qAbs( precision ) ) );
    myYmin->setText( QString::number( result.minY, precision > 0 ? 'f' : 'g', qAbs( precision ) ) );
    myYmax->setText( QString::number( result.maxY, precision > 0 ? 'f' : 'g', qAbs( precision ) ) );
    myDY->setText( QString::number( result.maxY-result.minY, precision > 0 ? 'f' : 'g', qAbs( precision ) ) );
    myZmin->setText( QString::number( result.minZ, precision > 0 ? 'f' : 'g', qAbs( precision ) ) );
    myZmax->setText( QString::number( result.maxZ, precision > 0 ? 'f' : 'g', qAbs( precision ) ) );
    myDZ->setText( QString::number( result.maxZ-result.minZ, precision > 0 ? 'f' : 'g', qAbs( precision ) ) );
    // update preview actor
    erasePreview();
    createPreview( result.minX, result.maxX, result.minY, result.maxY, result.minZ, result.maxZ );
    displayPreview();
  }
  else {
    clear();
  }
}
void SMESHGUI_BoundingBox::createPreview ( double  minX,
double  maxX,
double  minY,
double  maxY,
double  minZ,
double  maxZ 
) [private]

Create preview actor.

Parameters:
minXmin X coordinate of bounding box
maxXmax X coordinate of bounding box
minYmin Y coordinate of bounding box
maxYmax Y coordinate of bounding box
minZmin Z coordinate of bounding box
maxZmax Z coordinate of bounding box

Definition at line 805 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( 8 );
  aPoints->SetPoint( 0, minX, minY, minZ );
  aPoints->SetPoint( 1, maxX, minY, minZ );
  aPoints->SetPoint( 2, minX, maxY, minZ );
  aPoints->SetPoint( 3, maxX, maxY, minZ );
  aPoints->SetPoint( 4, minX, minY, maxZ );
  aPoints->SetPoint( 5, maxX, minY, maxZ );
  aPoints->SetPoint( 6, minX, maxY, maxZ );
  aPoints->SetPoint( 7, maxX, maxY, maxZ );
  aGrid->SetPoints( aPoints );
  aPoints->Delete();
  // create cells
  // connectivity: 0-1 0-4 0-2 1-5 1-3 2-6 2-3 3-7 4-6 4-5 5-7 6-7
  vtkIdList* anIdList = vtkIdList::New();
  anIdList->SetNumberOfIds( 2 );
  vtkCellArray* aCells = vtkCellArray::New();
  aCells->Allocate( 2*12, 0);
  vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
  aCellTypesArray->SetNumberOfComponents( 1 );
  aCellTypesArray->Allocate( 12 );
  anIdList->SetId( 0, 0 ); anIdList->SetId( 1, 1 );
  aCells->InsertNextCell( anIdList );
  aCellTypesArray->InsertNextValue( VTK_LINE );
  anIdList->SetId( 0, 0 ); anIdList->SetId( 1, 4 );
  aCells->InsertNextCell( anIdList );
  aCellTypesArray->InsertNextValue( VTK_LINE );
  anIdList->SetId( 0, 0 ); anIdList->SetId( 1, 2 );
  aCells->InsertNextCell( anIdList );
  aCellTypesArray->InsertNextValue( VTK_LINE );
  anIdList->SetId( 0, 1 ); anIdList->SetId( 1, 5 );
  aCells->InsertNextCell( anIdList );
  aCellTypesArray->InsertNextValue( VTK_LINE );
  anIdList->SetId( 0, 1 ); anIdList->SetId( 1, 3 );
  aCells->InsertNextCell( anIdList );
  aCellTypesArray->InsertNextValue( VTK_LINE );
  anIdList->SetId( 0, 2 ); anIdList->SetId( 1, 6 );
  aCells->InsertNextCell( anIdList );
  aCellTypesArray->InsertNextValue( VTK_LINE );
  anIdList->SetId( 0, 2 ); anIdList->SetId( 1, 3 );
  aCells->InsertNextCell( anIdList );
  aCellTypesArray->InsertNextValue( VTK_LINE );
  anIdList->SetId( 0, 3 ); anIdList->SetId( 1, 7 );
  aCells->InsertNextCell( anIdList );
  aCellTypesArray->InsertNextValue( VTK_LINE );
  anIdList->SetId( 0, 4 ); anIdList->SetId( 1, 6 );
  aCells->InsertNextCell( anIdList );
  aCellTypesArray->InsertNextValue( VTK_LINE );
  anIdList->SetId( 0, 4 ); anIdList->SetId( 1, 5 );
  aCells->InsertNextCell( anIdList );
  aCellTypesArray->InsertNextValue( VTK_LINE );
  anIdList->SetId( 0, 5 ); anIdList->SetId( 1, 7 );
  aCells->InsertNextCell( anIdList );
  aCellTypesArray->InsertNextValue( VTK_LINE );
  anIdList->SetId( 0, 6 ); anIdList->SetId( 1, 7 );
  aCells->InsertNextCell( anIdList );
  aCellTypesArray->InsertNextValue( VTK_LINE );
  anIdList->Delete();
  VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New();
  aCellLocationsArray->SetNumberOfComponents( 1 );
  aCellLocationsArray->SetNumberOfTuples( 12 );
  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_BoundingBox::deactivate ( )

Deactivate widget.

Definition at line 767 of file SMESHGUI_Measurements.cxx.

References SMESHGUI.selectionMgr().

Referenced by SMESHGUI_MeasureDlg.deactivate().

{
  disconnect( SMESHGUI::selectionMgr(), 0, this, 0 );
}
void SMESHGUI_BoundingBox::displayPreview ( ) [private]

Display preview actor.

Definition at line 787 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_BoundingBox::erasePreview ( ) [private]

Erase preview actor.

Definition at line 775 of file SMESHGUI_Measurements.cxx.

References SMESH.GetViewWindow(), and myPreview.

Referenced by clear(), compute(), and ~SMESHGUI_BoundingBox().

{
  SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow();
  if ( aViewWindow && myPreview ) {
    aViewWindow->RemoveActor( myPreview );
    aViewWindow->Repaint();
  }
}
void SMESHGUI_BoundingBox::selectionChanged ( ) [private, slot]

Called when selection is changed.

Definition at line 900 of file SMESHGUI_Measurements.cxx.

References clear(), SMESH.FindActorByEntry(), SMESH.GetNameOfSelectedElements(), SMESH.GetNameOfSelectedIObjects(), SMESH.GetNameOfSelectedNodes(), SMESH.GetViewWindow(), Handle(), myActor, myIDs, mySource, mySourceMode, mySrc, myValidator, NodesSrc, ObjectsSrc, 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 ) ) {
      mySrc.clear();
      mySrc.append( obj );
      myActor = SMESH::FindActorByEntry( IO->getEntry() );
      if ( mySourceMode->checkedId() == ObjectsSrc ) {
        QString aName;
        SMESH::GetNameOfSelectedIObjects( SMESHGUI::selectionMgr(), aName );
        mySource->setText( aName );
      }
      else {
        SVTK_Selector* selector = SMESH::GetViewWindow()->GetSelector();
        QString ID;
        int nb = 0;
        if ( myActor && selector ) {
          nb = mySourceMode->checkedId() == NodesSrc ? 
            SMESH::GetNameOfSelectedElements( selector, IO, ID ) :
            SMESH::GetNameOfSelectedNodes( selector, IO, ID );
        }
        if ( nb > 0 ) {
          myIDs = ID.trimmed();
          if ( nb < MAX_NB_FOR_EDITOR ) {
            mySource->setReadOnly( false );
            if ( mySource->validator() != myValidator )
              mySource->setValidator( myValidator );
            mySource->setText( ID.trimmed() );
          }
          else {
            mySource->setReadOnly( true );
            mySource->setValidator( 0 );
            mySource->setText( tr( "SELECTED_NB_OBJ" ).arg( nb )
                               .arg( mySourceMode->checkedId() == NodesSrc ? tr( "NB_NODES" ) : tr( "NB_ELEMENTS") ) );
          }
        }
        else {
          myIDs = "";
          mySource->clear();
          mySource->setReadOnly( false );
          mySource->setValidator( myValidator );
        }
      }
    }
  }
  else if ( selected.Extent() > 1 ) {
    myIDs = "";
    SALOME_ListIteratorOfListIO It( selected );
    mySrc.clear();
    myActor = 0;
    if ( mySourceMode->checkedId() == ObjectsSrc ) {
      for( ; It.More(); It.Next()){
        Handle(SALOME_InteractiveObject) IO = It.Value();
        SMESH::SMESH_IDSource_var obj = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>( IO );
        if ( !CORBA::is_nil( obj ) ) {
          mySrc.append( obj );
        }
      }
      QString aName;
      SMESH::GetNameOfSelectedIObjects( SMESHGUI::selectionMgr(), aName );
      mySource->setText( aName );
    }
    else {
      mySource->clear();
    }
  }
  clear();
}
void SMESHGUI_BoundingBox::sourceChanged ( ) [private, slot]

Called when source mode is changed by the user.

Definition at line 979 of file SMESHGUI_Measurements.cxx.

References clear(), myIDs, mySource, mySourceMode, myValidator, ObjectsSrc, and updateSelection().

Referenced by SMESHGUI_BoundingBox().

{
  myIDs = "";
  mySource->clear();
  mySource->setReadOnly( mySourceMode->checkedId() == ObjectsSrc );
  mySource->setValidator( mySourceMode->checkedId() == ObjectsSrc ? 0 : myValidator );
  updateSelection();
  clear();
}
void SMESHGUI_BoundingBox::sourceEdited ( ) [private, slot]

Called when source mode is edited by the user.

Definition at line 992 of file SMESHGUI_Measurements.cxx.

References clear(), ElementsSrc, SMESH.GetViewWindow(), Handle(), SMESH_test.ids, myActor, myIDs, mySource, mySourceMode, NodesSrc, and SMESHGUI_SelectionOp.selector().

Referenced by SMESHGUI_BoundingBox(), and updateSelection().

{
  if ( sender() == mySource )
    clear();
  SVTK_Selector* selector = SMESH::GetViewWindow()->GetSelector();
  if ( myActor && selector ) {
    Handle(SALOME_InteractiveObject) IO = myActor->getIO();
    if ( mySourceMode->checkedId() == NodesSrc || mySourceMode->checkedId() == ElementsSrc ) {
      TColStd_MapOfInteger ID;
      if ( !mySource->isReadOnly() )
        myIDs = mySource->text();
      QStringList ids = myIDs.split( " ", QString::SkipEmptyParts );
      foreach ( QString id, ids )
        ID.Add( id.trimmed().toLong() );
      selector->AddOrRemoveIndex( IO, ID, false );
    }
    if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow() )
      aViewWindow->highlight( IO, true, true );
  }
}
void SMESHGUI_BoundingBox::updateSelection ( )

Setup selection mode depending on the current widget state.

Definition at line 729 of file SMESHGUI_Measurements.cxx.

References ElementsSrc, SMESH.GetViewWindow(), myFilter, mySourceMode, NodesSrc, ObjectsSrc, selectionChanged(), SMESHGUI.selectionMgr(), SMESH.SetPointRepresentation(), and sourceEdited().

Referenced by sourceChanged(), and SMESHGUI_MeasureDlg.updateSelection().

{
  LightApp_SelectionMgr* selMgr = SMESHGUI::selectionMgr();

  disconnect( selMgr, 0, this, 0 );
  selMgr->clearFilters();
  
  bool nodeMode = mySourceMode->checkedId() == NodesSrc;
  bool elemMode = mySourceMode->checkedId() == ElementsSrc;
  bool objMode  = mySourceMode->checkedId() == ObjectsSrc;

  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() ) );

  sourceEdited();

  //selectionChanged();
}

Field Documentation

Definition at line 131 of file SMESHGUI_Measurements.h.

Referenced by selectionChanged(), and sourceEdited().

QLineEdit* SMESHGUI_BoundingBox.myDX [private]

Definition at line 123 of file SMESHGUI_Measurements.h.

Referenced by clear(), compute(), and SMESHGUI_BoundingBox().

QLineEdit* SMESHGUI_BoundingBox.myDY [private]

Definition at line 126 of file SMESHGUI_Measurements.h.

Referenced by clear(), compute(), and SMESHGUI_BoundingBox().

QLineEdit* SMESHGUI_BoundingBox.myDZ [private]

Definition at line 129 of file SMESHGUI_Measurements.h.

Referenced by clear(), compute(), and SMESHGUI_BoundingBox().

Definition at line 134 of file SMESHGUI_Measurements.h.

Referenced by SMESHGUI_BoundingBox(), and updateSelection().

QString SMESHGUI_BoundingBox.myIDs [private]

Definition at line 133 of file SMESHGUI_Measurements.h.

Referenced by compute(), selectionChanged(), sourceChanged(), and sourceEdited().

QLineEdit* SMESHGUI_BoundingBox.mySource [private]
QButtonGroup* SMESHGUI_BoundingBox.mySourceMode [private]

Definition at line 130 of file SMESHGUI_Measurements.h.

Referenced by compute(), and selectionChanged().

Definition at line 132 of file SMESHGUI_Measurements.h.

Referenced by selectionChanged(), SMESHGUI_BoundingBox(), and sourceChanged().

QLineEdit* SMESHGUI_BoundingBox.myXmax [private]

Definition at line 122 of file SMESHGUI_Measurements.h.

Referenced by clear(), compute(), and SMESHGUI_BoundingBox().

QLineEdit* SMESHGUI_BoundingBox.myXmin [private]

Definition at line 121 of file SMESHGUI_Measurements.h.

Referenced by clear(), compute(), and SMESHGUI_BoundingBox().

QLineEdit* SMESHGUI_BoundingBox.myYmax [private]

Definition at line 125 of file SMESHGUI_Measurements.h.

Referenced by clear(), compute(), and SMESHGUI_BoundingBox().

QLineEdit* SMESHGUI_BoundingBox.myYmin [private]

Definition at line 124 of file SMESHGUI_Measurements.h.

Referenced by clear(), compute(), and SMESHGUI_BoundingBox().

QLineEdit* SMESHGUI_BoundingBox.myZmax [private]

Definition at line 128 of file SMESHGUI_Measurements.h.

Referenced by clear(), compute(), and SMESHGUI_BoundingBox().

QLineEdit* SMESHGUI_BoundingBox.myZmin [private]

Definition at line 127 of file SMESHGUI_Measurements.h.

Referenced by clear(), compute(), and SMESHGUI_BoundingBox().

Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS