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

SMESHGUI_ConvToQuadOp Class Reference

#include <SMESHGUI_ConvToQuadOp.h>

Inheritance diagram for SMESHGUI_ConvToQuadOp:
Inheritance graph
[legend]

Public Types

enum  MeshType { Comp = 0, Linear, Quadratic }
typedef QList< intIdList

Public Member Functions

 SMESHGUI_ConvToQuadOp ()
 Constructor.
virtual ~SMESHGUI_ConvToQuadOp ()
 Destructor.
virtual LightApp_Dialogdlg () const
 Gets dialog of this operation.

Static Public Member Functions

static void extractIds (const QStringList &, IdList &, const QChar)

Protected Types

enum  EntityType { Object, MeshNode, MeshElement }

Protected Slots

virtual bool onApply ()
 Edits mesh.
void ConnectRadioButtons (int)
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 ()
 Creates dialog if necessary and shows it.
virtual void selectionDone ()
 Updates dialog's look and feel.
virtual SUIT_SelectionFiltercreateFilter (const int) const
 Creates selection filter.
MeshType ConsistMesh (const SMESH::SMESH_IDSource_var &) const
 ConsistMesh Determines, what elements this mesh contains.
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_Actoractor () 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.
SMESHGUIgetSMESHGUI () 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 Attributes

SMESHGUI_ConvToQuadDlgmyDlg

Detailed Description

Definition at line 41 of file SMESHGUI_ConvToQuadOp.h.


Member Typedef Documentation

typedef QList<int> SMESHGUI_SelectionOp.IdList [inherited]

Definition at line 59 of file SMESHGUI_SelectionOp.h.


Member Enumeration Documentation

enum SMESHGUI_SelectionOp::EntityType [protected, inherited]
Enumerator:
Object 
MeshNode 
MeshElement 

Definition at line 68 of file SMESHGUI_SelectionOp.h.

Enumerator:
Comp 
Linear 
Quadratic 

Definition at line 46 of file SMESHGUI_ConvToQuadOp.h.

{ Comp = 0, Linear, Quadratic };

Constructor & Destructor Documentation

SMESHGUI_ConvToQuadOp::SMESHGUI_ConvToQuadOp ( )

Constructor.

Initialize operation

Definition at line 54 of file SMESHGUI_ConvToQuadOp.cxx.

  : SMESHGUI_SelectionOp(), 
    myDlg( 0 )
{
}
SMESHGUI_ConvToQuadOp::~SMESHGUI_ConvToQuadOp ( ) [virtual]

Destructor.

Definition at line 65 of file SMESHGUI_ConvToQuadOp.cxx.

References myDlg.

{
  if ( myDlg )
    delete myDlg;
}

Member Function Documentation

SMESHGUI_Operation._PTR ( Study  ) const [protected, inherited]
void SMESHGUI_SelectionOp::abortOperation ( ) [protected, virtual, inherited]
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]
void SMESHGUI_ConvToQuadOp::ConnectRadioButtons ( int  id) [protected, slot]

Definition at line 304 of file SMESHGUI_ConvToQuadOp.cxx.

References SMESHGUI_Operation._PTR(), SMESHGUI_SelectionOp.mesh(), myDlg, and SMESHGUI_ConvToQuadDlg.SetEnabledCheck().

Referenced by startOperation().

{
  QString anObjEntry = myDlg->selectedObject( 0 );
  _PTR(SObject) pObj = studyDS()->FindObjectID( anObjEntry.toLatin1().data() );
  if ( !pObj ) return;

  SMESH::SMESH_IDSource_var idSource = 
    SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( pObj );  
  SMESH::SMESH_Mesh_var mesh = idSource->GetMesh();

  bool hasGeom = mesh->HasShapeToMesh();

  if( id || !hasGeom )
    myDlg->SetEnabledCheck( false );
  else
    myDlg->SetEnabledCheck( true );
}
SMESHGUI_ConvToQuadOp::MeshType SMESHGUI_ConvToQuadOp::ConsistMesh ( const SMESH::SMESH_IDSource_var &  idSource) const [protected]

ConsistMesh Determines, what elements this mesh contains.

Definition at line 280 of file SMESHGUI_ConvToQuadOp.cxx.

References Comp, Linear, Quadratic, SMDSEntity_Edge, SMDSEntity_Hexa, SMDSEntity_Penta, SMDSEntity_Pyramid, SMDSEntity_Quad_Edge, SMDSEntity_Quad_Hexa, SMDSEntity_Quad_Penta, SMDSEntity_Quad_Pyramid, SMDSEntity_Quad_Quadrangle, SMDSEntity_Quad_Tetra, SMDSEntity_Quad_Triangle, SMDSEntity_Quadrangle, SMDSEntity_Tetra, and SMDSEntity_Triangle.

Referenced by selectionDone().

{
  SMESH::long_array_var nbElemOfType = idSource->GetMeshInfo();
  bool hasQuad = ( nbElemOfType[SMDSEntity_Quad_Edge      ] ||
                   nbElemOfType[SMDSEntity_Quad_Triangle  ] ||
                   nbElemOfType[SMDSEntity_Quad_Quadrangle] ||
                   nbElemOfType[SMDSEntity_Quad_Tetra     ] ||
                   nbElemOfType[SMDSEntity_Quad_Hexa      ] ||
                   nbElemOfType[SMDSEntity_Quad_Pyramid   ] ||
                   nbElemOfType[SMDSEntity_Quad_Penta     ] );

  bool hasLin  = ( nbElemOfType[SMDSEntity_Edge      ] ||
                   nbElemOfType[SMDSEntity_Triangle  ] ||
                   nbElemOfType[SMDSEntity_Quadrangle] ||
                   nbElemOfType[SMDSEntity_Tetra     ] ||
                   nbElemOfType[SMDSEntity_Hexa      ] ||
                   nbElemOfType[SMDSEntity_Pyramid   ] ||
                   nbElemOfType[SMDSEntity_Penta     ] );

  if ( hasQuad && hasLin )
    return Comp;
  return hasQuad ? Quadratic : Linear;
}
SUIT_SelectionFilter * SMESHGUI_ConvToQuadOp::createFilter ( const int  theId) const [protected, virtual]

Creates selection filter.

Parameters:
theId- identifier of current selection widget
Return values:
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 187 of file SMESHGUI_ConvToQuadOp.cxx.

References MESHorSUBMESH.

{
  if ( theId == 0 )
    return new SMESH_TypeFilter( MESHorSUBMESH );
  else
    return 0;
}
LightApp_Dialog * SMESHGUI_ConvToQuadOp::dlg ( ) const [virtual]

Gets dialog of this operation.

Return values:
LightApp_Dialog*- pointer to dialog of this operation

Definition at line 77 of file SMESHGUI_ConvToQuadOp.cxx.

References myDlg.

Referenced by onApply(), and selectionDone().

{
  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().

{
  QStringList::const_iterator anIt = ids.begin(),
                              aLast = ids.end();
  QString id_str;
  for( ; anIt!=aLast; anIt++ )
  {
    id_str = *anIt;
    int pos = idchar=='\0' ? -1 : id_str.indexOf( idchar );
    int id = -1;
    if( idchar=='\0' || pos>=0 )
    {
      id = id_str.mid( pos+1 ).toInt();
      list.append( id );
    }
  }
}
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() );
}
SMESHGUI * SMESHGUI_Operation::getSMESHGUI ( ) const [protected, inherited]
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_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]
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;
}
bool SMESHGUI_Operation::isStudyLocked ( const bool  theMess = true) const [protected, inherited]

Verifies whether study of operation is locked.

Parameters:
theMess- specifies whether message box must be shown if study is locked
Returns:
State of study.

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.

Parameters:
theOtherOp- other operation
Returns:
Returns TRUE if the given operator is valid for this one, FALSE otherwise

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(), ConnectRadioButtons(), SMESHGUI_MeshOp.isSubshapeOk(), SMESHGUI_GroupOnShapeOp.onApply(), onApply(), SMESHGUI_MeshOp.selectionDone(), 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 SMESHGUI_GroupOnShapeOp.init(), SMESHGUI_GroupOnShapeOp.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_ConvToQuadOp::onApply ( ) [protected, virtual, slot]

Edits mesh.

Virtual slot redefined from the base class called when "Apply" button is clicked

Reimplemented from SMESHGUI_Operation.

Definition at line 202 of file SMESHGUI_ConvToQuadOp.cxx.

References SMESHGUI_Operation._PTR(), SMESHGUI_ConvToQuadDlg.CurrentRB(), dlg(), SMESHGUI_ConvToQuadDlg.IsEnabledCheck(), SMESHGUI_ConvToQuadDlg.IsMediumNdsOnGeom(), SMESHGUI_SelectionOp.mesh(), SMESHGUI.Modified(), myDlg, and selectionDone().

{
  SUIT_OverrideCursor aWaitCursor;

  QString aMess;

  QString anObjEntry = myDlg->selectedObject( 0 );
  _PTR(SObject) pObj = studyDS()->FindObjectID( anObjEntry.toLatin1().data() );
  if ( !pObj )
  {
    dlg()->show();
    SUIT_MessageBox::warning( myDlg,
                              tr( "SMESH_WRN_WARNING" ), tr("MESH_IS_NOT_SELECTED") );
    return false;
  }

  SMESH::SMESH_Mesh_var mesh;
  SMESH::SMESH_IDSource_var idSource = 
    SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( pObj );  
  if( !CORBA::is_nil(idSource) )
    mesh = idSource->GetMesh();

  if( CORBA::is_nil(mesh) )
  {
    SUIT_MessageBox::warning( myDlg,
                              tr( "SMESH_WRN_WARNING" ), tr("REF_IS_NULL") );
    return false;
  }

  bool aResult = false;

  try
  {
    SMESH::SMESH_MeshEditor_var aEditor = mesh->GetMeshEditor();
    aResult = true; 
    SMESH::SMESH_Mesh_var sourceMesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>( pObj );  
    if( !myDlg->CurrentRB() )
    {
      bool aParam = true;
      if( myDlg->IsEnabledCheck() )
        aParam = myDlg->IsMediumNdsOnGeom();

      if ( sourceMesh->_is_nil() )
        aEditor->ConvertToQuadraticObject( aParam, idSource );
      else
        aEditor->ConvertToQuadratic( aParam );
    }
    else
    {
      if ( sourceMesh->_is_nil() )
        aEditor->ConvertFromQuadraticObject( idSource );
      else
        aEditor->ConvertFromQuadratic();
    }
  }
  catch ( const SALOME::SALOME_Exception& S_ex )
  {
    SalomeApp_Tools::QtCatchCorbaException( S_ex );
    aResult = false;
  }
  catch ( ... )
  {
    aResult = false;
  }
  if( aResult )
  {
    SMESHGUI::Modified();
    update( UF_ObjBrowser | UF_Model | UF_Viewer );
    selectionDone();
  }
  return aResult;
}
void SMESHGUI_Operation::onCancel ( ) [protected, virtual, slot, inherited]
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().

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]
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(), SMESHGUI_GroupOnShapeOp.init(), SMESHGUI_GroupOnShapeOp.onApply(), SMESHGUI_GroupOnShapeOp.onButtonClick(), SMESHGUI_SelectionOp.onDeactivateObject(), SMESHGUI_MeshOp.onEditHyp(), and SMESHGUI_SelectionOp.~SMESHGUI_SelectionOp().

{
  if (myFilters.count() > 0) {
    LightApp_SelectionMgr* mgr = selectionMgr();
    Filters::const_iterator anIt = myFilters.begin(),
                            aLast = myFilters.end();
    for ( ; anIt != aLast; anIt++) {
      if (anIt.value()) {
        if (mgr) mgr->removeFilter(anIt.value());
        delete anIt.value();
      }
    }

    myFilters.clear();
  }
}
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 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() );
      }
    }
  }
}
void SMESHGUI_SelectionOp::selectedIds ( const int  id,
IdList list 
) const [protected, inherited]

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_ConvToQuadOp::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 117 of file SMESHGUI_ConvToQuadOp.cxx.

References SMESHGUI_Operation._PTR(), Comp, ConsistMesh(), dlg(), Linear, SMESHGUI_SelectionOp.mesh(), myDlg, Quadratic, SMESHGUI_ConvToQuadDlg.SetEnabledControls(), SMESHGUI_ConvToQuadDlg.SetEnabledRB(), and SMESHGUI_ConvToQuadDlg.ShowWarning().

Referenced by onApply(), and startOperation().

{
  if ( !dlg()->isVisible() )
    return;

  SMESHGUI_SelectionOp::selectionDone();
  try
  {
    QString anObjEntry = myDlg->selectedObject( 0 );
    _PTR(SObject) pObj = studyDS()->FindObjectID( anObjEntry.toLatin1().data() );
    if ( !pObj ) return;

    SMESH::SMESH_IDSource_var idSource = 
      SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( pObj );  

    myDlg->setButtonEnabled( true, QtxDialog::OK | QtxDialog::Apply );
    if( idSource->_is_nil() )
    {
      myDlg->SetEnabledControls( false );
      myDlg->setButtonEnabled( false, QtxDialog::OK | QtxDialog::Apply );
      return;
    }
    MeshType meshType = ConsistMesh( idSource );
    if( meshType == SMESHGUI_ConvToQuadOp::Quadratic )
    {
      myDlg->SetEnabledRB( 0, false );
    }
    else if( meshType == SMESHGUI_ConvToQuadOp::Linear )
    {
      myDlg->SetEnabledRB( 1, false );
    }
    else 
    {
      myDlg->SetEnabledControls( true );
    }

    // show warning on non-conformal result mesh
    if ( ! idSource->_is_nil() )
    {
      SMESH::SMESH_subMesh_var subMesh = 
        SMESH::SObjectToInterface<SMESH::SMESH_subMesh>( pObj );
      bool toShow = false;
      if ( !subMesh->_is_nil() )
      {
        SMESH::SMESH_Mesh_var mesh = idSource->GetMesh();
        idSource = SMESH::SMESH_IDSource::_narrow( mesh );
        MeshType fullMeshType = ConsistMesh( idSource );
        toShow = ( fullMeshType != Comp );
      }
      myDlg->ShowWarning( toShow );
    }
  }
  catch ( const SALOME::SALOME_Exception& S_ex )
  {
    SalomeApp_Tools::QtCatchCorbaException( S_ex );
  }
  catch ( ... )
  {
  }
}
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]
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]
void SMESHGUI_ConvToQuadOp::startOperation ( ) [protected, virtual]

Creates dialog if necessary and shows it.

Virtual method redefined from base class called when operation is started creates dialog if necessary and shows it, activates selection

Reimplemented from SMESHGUI_SelectionOp.

Definition at line 90 of file SMESHGUI_ConvToQuadOp.cxx.

References ConnectRadioButtons(), myDlg, SMESHGUI_Operation.myHelpFileName, selectionDone(), SMESHGUI_ConvToQuadDlg.SetMediumNdsOnGeom(), SMESHGUI_Dialog.show(), and SMESHGUI_ConvToQuadDlg.ShowWarning().

{
  if( !myDlg )
  {
    myDlg = new SMESHGUI_ConvToQuadDlg( );
  }
  connect( myDlg, SIGNAL( onClicked( int ) ), SLOT( ConnectRadioButtons( int ) ) );

  myHelpFileName = "convert_to_from_quadratic_mesh_page.html";

  SMESHGUI_SelectionOp::startOperation();

  myDlg->SetMediumNdsOnGeom( false );
  myDlg->activateObject( 0 );
  myDlg->ShowWarning( false );
  myDlg->show();

  selectionDone();
}
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]

Field Documentation

QString SMESHGUI_Operation.myHelpFileName [protected, inherited]
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