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

SMESHGUI_MakeNodeAtPointOp Class Reference

Operation to make a mesh pass through a point. More...

#include <SMESHGUI_MakeNodeAtPointDlg.h>

Inheritance diagram for SMESHGUI_MakeNodeAtPointOp:
Inheritance graph
[legend]

Public Types

typedef QList< intIdList

Public Member Functions

 SMESHGUI_MakeNodeAtPointOp ()
 Constructor.
virtual ~SMESHGUI_MakeNodeAtPointOp ()
 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 ()
 perform it's intention action: move or create a node
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 ()
 This enumeration is used in typeById method to distinguish objects, mesh nodes and mesh elements, because node end element ids may overlap.
virtual void stopOperation ()
 Stops operation.
virtual void activateSelection ()
 Activate Node selection.
bool isValid (QString &)
 Check selected node id validity.
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 selectionDone ()
virtual void initDialog ()
 sets the dialog widgets to state just after operation start
virtual SUIT_SelectionFiltercreateFilter (const int) const
 Creates filter being used when certain object selection widget is active If no filter must be used, then function must return 0 if id is negative, then function must return filter for common using independently of active widget.
void removeCustomFilters ()
 Remove only filters set by this operation (they are in map myFilters )
Selection_Mode selectionMode () const
 Return what selection mode is set in VTK viewer.
void setSelectionMode (const Selection_Mode)
 Set selection mode in VTK viewer.
void highlight (const Handle(SALOME_InteractiveObject)&, const bool, const bool=true)
 Hilight object in VTK viewer.
void addOrRemoveIndex (const Handle(SALOME_InteractiveObject)&, const TColStd_MapOfInteger &, const bool isModeShift)
 Select some nodes or elements in VTK.
SVTK_ViewWindow * viewWindow () const
SVTK_Selector * selector () const
virtual void selected (QStringList &, SMESHGUI_Dialog::TypesList &, QStringList &) const
 Get names, types and ids of selected objects.
virtual int typeById (const QString &, const EntityType) const
 Find type by id.
virtual QChar idChar () const
 Char using to divide <entry> and <id> in string id representation. By default, '#'.
void selectedIds (const int, IdList &) const
 Try to find in certain object selection widget selected node or element ids and return it.
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 Slots

void onSelectionDone ()
 SLOT called when selection changed.
void redisplayPreview ()
 update preview

Private Attributes

SMESHGUI_MakeNodeAtPointDlgmyDlg
SUIT_SelectionFiltermyFilter
int myMeshOldDisplayMode
SMESHGUI_MeshEditPreviewmySimulation
SMESH_ActormyMeshActor
bool myNoPreview

Detailed Description

Operation to make a mesh pass through a point.

Definition at line 46 of file SMESHGUI_MakeNodeAtPointDlg.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.


Constructor & Destructor Documentation

SMESHGUI_MakeNodeAtPointOp::SMESHGUI_MakeNodeAtPointOp ( )

Constructor.

Definition at line 313 of file SMESHGUI_MakeNodeAtPointDlg.cxx.

References SMESHGUI_MakeNodeAtPointDlg.myAutoSearchChkBox, myDlg, myFilter, SMESHGUI_Operation.myHelpFileName, SMESHGUI_MakeNodeAtPointDlg.myId, SMESHGUI_MakeNodeAtPointDlg.myPreviewChkBox, mySimulation, SMESHGUI_MakeNodeAtPointDlg.myX, SMESHGUI_MakeNodeAtPointDlg.myY, SMESHGUI_MakeNodeAtPointDlg.myZ, and redisplayPreview().

{
  mySimulation = 0;
  myDlg = new SMESHGUI_MakeNodeAtPointDlg;
  myFilter = 0;
  myHelpFileName = "mesh_through_point_page.html";

  // connect signals and slots
  connect(myDlg->myX, SIGNAL (valueChanged(double)), this, SLOT(redisplayPreview()));
  connect(myDlg->myY, SIGNAL (valueChanged(double)), this, SLOT(redisplayPreview()));
  connect(myDlg->myZ, SIGNAL (valueChanged(double)), this, SLOT(redisplayPreview()));
  connect(myDlg->myId,SIGNAL (textChanged(const QString&)),SLOT(redisplayPreview()));
  connect(myDlg->myPreviewChkBox,   SIGNAL (toggled(bool)),SLOT(redisplayPreview()));
  connect(myDlg->myAutoSearchChkBox,SIGNAL (toggled(bool)),SLOT(redisplayPreview()));
}
SMESHGUI_MakeNodeAtPointOp::~SMESHGUI_MakeNodeAtPointOp ( ) [virtual]

Destructor.

Definition at line 740 of file SMESHGUI_MakeNodeAtPointDlg.cxx.

References myDlg, myFilter, and mySimulation.

{
  if ( myDlg )        delete myDlg;
  if ( mySimulation ) delete mySimulation;
  if ( myFilter )     delete myFilter;
}

Member Function Documentation

SMESHGUI_Operation._PTR ( Study  ) const [protected, inherited]
void SMESHGUI_SelectionOp::abortOperation ( ) [protected, virtual, inherited]
void SMESHGUI_MakeNodeAtPointOp::activateSelection ( ) [protected, virtual]

Activate Node selection.

Definition at line 726 of file SMESHGUI_MakeNodeAtPointDlg.cxx.

References myFilter, SMESH.SetPointRepresentation(), and SMESHGUI_SelectionOp.setSelectionMode().

{
  selectionMgr()->clearFilters();
  SMESH::SetPointRepresentation(false);
  selectionMgr()->installFilter( myFilter );
  setSelectionMode( NodeSelection );
}
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]
SUIT_SelectionFilter * SMESHGUI_SelectionOp::createFilter ( const int  ) const [protected, virtual, inherited]

Creates filter being used when certain object selection widget is active If no filter must be used, then function must return 0 if id is negative, then function must return filter for common using independently of active widget.

Reimplemented in SMESHGUI_ConvToQuadOp, SMESHGUI_GroupOnShapeOp, SMESHGUI_Make2DFrom3DOp, and SMESHGUI_MeshOp.

Definition at line 171 of file SMESHGUI_SelectionOp.cxx.

Referenced by SMESHGUI_SelectionOp.onActivateObject().

{
  return 0;
}
LightApp_Dialog * SMESHGUI_MakeNodeAtPointOp::dlg ( ) const [virtual]

Gets dialog of this operation.

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

Definition at line 754 of file SMESHGUI_MakeNodeAtPointDlg.cxx.

References myDlg.

Referenced by onApply().

{
  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(), 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;
}
bool SMESHGUI_MakeNodeAtPointOp::isValid ( QString &  msg) [protected]

Check selected node id validity.

Definition at line 495 of file SMESHGUI_MakeNodeAtPointDlg.cxx.

References SMESH_Actor.GetObject(), SMESHGUI_MakeNodeAtPointDlg.myAutoSearchChkBox, myDlg, SMESHGUI_MakeNodeAtPointDlg.myId, myMeshActor, myNoPreview, SMESHGUI_MakeNodeAtPointDlg.myX, SMESHGUI_MakeNodeAtPointDlg.myY, and SMESHGUI_MakeNodeAtPointDlg.myZ.

Referenced by onApply(), and redisplayPreview().

{
  bool ok = true;
  if ( myMeshActor &&
       !myDlg->myAutoSearchChkBox->isChecked() )
  {
    ok = false;
    int id = myDlg->myId->text().toInt();
    if ( id > 0 )
      if (SMDS_Mesh* aMesh = myMeshActor->GetObject()->GetMesh())
        ok = aMesh->FindNode( id );
    if( !ok )
      msg += tr("INVALID_ID") + "\n";
  }

  ok = myDlg->myX->isValid( msg, !myNoPreview ) && ok;
  ok = myDlg->myY->isValid( msg, !myNoPreview ) && ok;
  ok = myDlg->myZ->isValid( msg, !myNoPreview ) && ok;

  return ok;
}
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(), SMESHGUI_GroupOnShapeOp.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 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_MakeNodeAtPointOp::onApply ( ) [protected, virtual, slot]

perform it's intention action: move or create a node

Reimplemented from SMESHGUI_Operation.

Definition at line 411 of file SMESHGUI_MakeNodeAtPointDlg.cxx.

References SMESHGUI.desktop(), dlg(), SMESH.GetMeshByIO(), SMESHGUI_SpinBox.GetValue(), SMESHGUI_Operation.isStudyLocked(), isValid(), SMESHGUI.Modified(), SMESHGUI_MakeNodeAtPointDlg.myCurrentX, SMESHGUI_MakeNodeAtPointDlg.myCurrentY, SMESHGUI_MakeNodeAtPointDlg.myCurrentZ, myDlg, SMESHGUI_MakeNodeAtPointDlg.myDX, SMESHGUI_MakeNodeAtPointDlg.myDY, SMESHGUI_MakeNodeAtPointDlg.myDZ, SMESHGUI_MakeNodeAtPointDlg.myId, myMeshActor, SMESHGUI_MakeNodeAtPointDlg.myX, SMESHGUI_MakeNodeAtPointDlg.myY, SMESHGUI_MakeNodeAtPointDlg.myZ, SMESHGUI_SpinBox.SetValue(), and SMESH.UpdateView().

{
  if( isStudyLocked() )
    return false;

  if ( !myMeshActor ) {
    SUIT_MessageBox::warning( dlg(), tr( "SMESH_WRN_WARNING" ),
                              tr("INVALID_MESH") );
    dlg()->show();
    return false;
  }

  QString msg;
  if ( !isValid( msg ) ) { // node id is invalid
    if( !msg.isEmpty() )
      SUIT_MessageBox::warning( dlg(), tr( "SMESH_WRN_WARNING" ),
                                tr("INVALID_ID") );
    dlg()->show();
    return false;
  }


  try {
    SMESH::SMESH_Mesh_var aMesh = SMESH::GetMeshByIO(myMeshActor->getIO());
    if (aMesh->_is_nil()) {
      SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_ERROR"),
                                   tr("SMESHG_NO_MESH") );
      return true;
    }
    SMESH::SMESH_MeshEditor_var aMeshEditor = aMesh->GetMeshEditor();
    if (aMeshEditor->_is_nil())
      return true;

    bool ok;
    int anId = myDlg->myId->text().toInt( &ok );
    if( !ok || anId < 1 )
      anId = aMeshEditor->FindNodeClosestTo(myDlg->myX->GetValue(),
                                            myDlg->myY->GetValue(),
                                            myDlg->myZ->GetValue());

    int aResult = aMeshEditor->MoveNode(anId,
                                        myDlg->myX->GetValue(),
                                        myDlg->myY->GetValue(),
                                        myDlg->myZ->GetValue() );

    if (aResult)
    {
      QStringList aParameters;
      aParameters << myDlg->myX->text();
      aParameters << myDlg->myY->text();
      aParameters << myDlg->myZ->text();
      aMesh->SetParameters( aParameters.join(":").toLatin1().constData() );

      myDlg->myCurrentX->SetValue(0);
      myDlg->myCurrentY->SetValue(0);
      myDlg->myCurrentZ->SetValue(0);
      myDlg->myDX->SetValue(0);
      myDlg->myDY->SetValue(0);
      myDlg->myDZ->SetValue(0);
      myDlg->myId->setText("");

      SALOME_ListIO aList;
      selectionMgr()->setSelectedObjects(aList,false);
      aList.Append(myMeshActor->getIO());
      selectionMgr()->setSelectedObjects(aList,false);
      SMESH::UpdateView();
      SMESHGUI::Modified();
    }
  }
  catch (const SALOME::SALOME_Exception& S_ex) {
    SalomeApp_Tools::QtCatchCorbaException(S_ex);
  }
  catch (...) {
  }

  return true;
}
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_MakeNodeAtPointOp::onSelectionDone ( ) [private, slot]

SLOT called when selection changed.

Definition at line 523 of file SMESHGUI_MakeNodeAtPointDlg.cxx.

References SMESH_fixation.aShape, ex05_hole1build.dx, ex05_hole1build.dz, SMESH.FindActorByEntry(), SMESH_box.geom, SMESH.GetNameOfSelectedElements(), SMESH_Actor.GetObject(), SMESHGUI_SpinBox.GetValue(), Handle(), SMESHGUI_MakeNodeAtPointDlg.myCoordBtn, SMESHGUI_MakeNodeAtPointDlg.myCurrentX, SMESHGUI_MakeNodeAtPointDlg.myCurrentY, SMESHGUI_MakeNodeAtPointDlg.myCurrentZ, myDlg, SMESHGUI_MakeNodeAtPointDlg.myDX, SMESHGUI_MakeNodeAtPointDlg.myDY, SMESHGUI_MakeNodeAtPointDlg.myDZ, SMESHGUI_MakeNodeAtPointDlg.myId, SMESHGUI_MakeNodeAtPointDlg.myIdBtn, myMeshActor, myNoPreview, SMESHGUI_MakeNodeAtPointDlg.myX, SMESHGUI_MakeNodeAtPointDlg.myY, SMESHGUI_MakeNodeAtPointDlg.myZ, redisplayPreview(), SMESHGUI_SelectionOp.selector(), SMESHGUI_SpinBox.SetValue(), ex13_hole1partial.x, and ex13_hole1partial.y.

Referenced by startOperation().

{
  if ( !myDlg->isVisible() || !myDlg->isEnabled() )
    return;
  try {
    SALOME_ListIO aList;
    selectionMgr()->selectedObjects(aList, SVTK_Viewer::Type());
    if (aList.Extent() != 1)
      return;
    Handle(SALOME_InteractiveObject) anIO = aList.First();
    SMESH_Actor* aMeshActor = SMESH::FindActorByEntry(anIO->getEntry());

    if (!aMeshActor) { // coord by geom
      if ( myDlg->myCoordBtn->isChecked() ) {
        GEOM::GEOM_Object_var geom = SMESH::IObjectToInterface<GEOM::GEOM_Object>(anIO);
        if ( !geom->_is_nil() ) {
          TopoDS_Vertex aShape;
          if ( GEOMBase::GetShape(geom, aShape) &&
               aShape.ShapeType() == TopAbs_VERTEX ) {
            gp_Pnt P = BRep_Tool::Pnt(aShape);
            myNoPreview = true;
            myDlg->myX->SetValue(P.X());
            myDlg->myY->SetValue(P.Y());
            myDlg->myZ->SetValue(P.Z());
            myNoPreview = false;
            redisplayPreview();
          }
        }
        return;
      }
    }

    if ( !myMeshActor )
      myMeshActor = aMeshActor;

    QString aString;
    int nbElems = SMESH::GetNameOfSelectedElements(selector(),anIO, aString);
    if (nbElems == 1) {
      if (SMDS_Mesh* aMesh = aMeshActor->GetObject()->GetMesh()) {
        if (const SMDS_MeshNode* aNode = aMesh->FindNode(aString.toInt())) {
          myNoPreview = true;
          if ( myDlg->myCoordBtn->isChecked() ) { // set coord
            myDlg->myX->SetValue(aNode->X());
            myDlg->myY->SetValue(aNode->Y());
            myDlg->myZ->SetValue(aNode->Z());
            myNoPreview = false;
            redisplayPreview();
          }
          else if ( myDlg->myIdBtn->isChecked() &&
                    myDlg->myIdBtn->isEnabled() ) { // set node to move
            myDlg->myId->setText(aString);
            myNoPreview = false;
            redisplayPreview();
          }

          if (const SMDS_MeshNode* aCurrentNode = aMesh->FindNode(myDlg->myId->text().toInt())) {
            double x = aCurrentNode->X();
            double y = aCurrentNode->Y();
            double z = aCurrentNode->Z();
            double dx = myDlg->myX->GetValue() - x;
            double dy = myDlg->myY->GetValue() - y;
            double dz = myDlg->myZ->GetValue() - z;
            myDlg->myCurrentX->SetValue(x);
            myDlg->myCurrentY->SetValue(y);
            myDlg->myCurrentZ->SetValue(z);
            myDlg->myDX->SetValue(dx);
            myDlg->myDY->SetValue(dy);
            myDlg->myDZ->SetValue(dz);
          }
        }
      }
    }
  } catch (...) {
  }
}
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_MakeNodeAtPointOp::redisplayPreview ( ) [private, slot]

update preview

Definition at line 605 of file SMESHGUI_MakeNodeAtPointDlg.cxx.

References ex05_hole1build.dx, ex05_hole1build.dz, SMESH.GetMeshByIO(), SMESHGUI_SpinBox.GetValue(), isValid(), SMESHGUI_MakeNodeAtPointDlg.myAutoSearchChkBox, SMESHGUI_MakeNodeAtPointDlg.myCurrentX, SMESHGUI_MakeNodeAtPointDlg.myCurrentY, SMESHGUI_MakeNodeAtPointDlg.myCurrentZ, myDlg, SMESHGUI_MakeNodeAtPointDlg.myDX, SMESHGUI_MakeNodeAtPointDlg.myDY, SMESHGUI_MakeNodeAtPointDlg.myDZ, SMESHGUI_MakeNodeAtPointDlg.myId, myMeshActor, myNoPreview, SMESHGUI_MakeNodeAtPointDlg.myPreviewChkBox, mySimulation, SMESHGUI_MakeNodeAtPointDlg.myX, SMESHGUI_MakeNodeAtPointDlg.myY, SMESHGUI_MakeNodeAtPointDlg.myZ, SMESH.NODE, SMESHGUI_MeshEditPreview.SetData(), SMESHGUI_SpinBox.SetValue(), SMESHGUI_MeshEditPreview.SetVisibility(), ex13_hole1partial.x, and ex13_hole1partial.y.

Referenced by onSelectionDone(), SMESHGUI_MakeNodeAtPointOp(), and startOperation().

{
  if ( myNoPreview )
    return;
  myNoPreview = true;

  SMESH::MeshPreviewStruct_var aMeshPreviewStruct;

  bool moveShown = false;
  if ( myMeshActor)
  {
    const bool autoSearch = myDlg->myAutoSearchChkBox->isChecked();
    const bool preview    = myDlg->myPreviewChkBox->isChecked();
    if ( autoSearch )
    {
      myDlg->myCurrentX->SetValue(0);
      myDlg->myCurrentY->SetValue(0);
      myDlg->myCurrentZ->SetValue(0);
      myDlg->myDX->SetValue(0);
      myDlg->myDY->SetValue(0);
      myDlg->myDZ->SetValue(0);
      myDlg->myId->setText("");
    }
    QString msg;
    if ( autoSearch || isValid( msg ) )
    {
      try {
        SMESH::SMESH_Mesh_var aMesh = SMESH::GetMeshByIO(myMeshActor->getIO());
        if (!aMesh->_is_nil()) {
          SMESH::SMESH_MeshEditor_var aPreviewer = aMesh->GetMeshEditPreviewer();
          if (!aPreviewer->_is_nil())
          {
            SUIT_OverrideCursor aWaitCursor;

            int anId = 0;
            if ( autoSearch )
              anId = aPreviewer->FindNodeClosestTo(myDlg->myX->GetValue(),
                                                   myDlg->myY->GetValue(),
                                                   myDlg->myZ->GetValue());
            else
              anId = myDlg->myId->text().toInt();

            // find id and/or just compute preview
            aPreviewer->MoveNode(anId,
                                 myDlg->myX->GetValue(),
                                 myDlg->myY->GetValue(),
                                 myDlg->myZ->GetValue());
            if ( autoSearch ) { // set found id
              QString idTxt("%1");
              if ( anId > 0 )
                idTxt = idTxt.arg( anId );
              else
                idTxt = "";
              myDlg->myId->setText( idTxt );
            }

            SMESH::double_array* aXYZ = aMesh->GetNodeXYZ( anId );
            if( aXYZ && aXYZ->length() >= 3 )
            {
              double x = aXYZ->operator[](0);
              double y = aXYZ->operator[](1);
              double z = aXYZ->operator[](2);
              double dx = myDlg->myX->GetValue() - x;
              double dy = myDlg->myY->GetValue() - y;
              double dz = myDlg->myZ->GetValue() - z;
              myDlg->myCurrentX->SetValue(x);
              myDlg->myCurrentY->SetValue(y);
              myDlg->myCurrentZ->SetValue(z);
              myDlg->myDX->SetValue(dx);
              myDlg->myDY->SetValue(dy);
              myDlg->myDZ->SetValue(dz);
            }

            if ( preview ) { // fill preview data
              aMeshPreviewStruct = aPreviewer->GetPreviewData();
              moveShown = ( anId > 0 );
            }
          }
        }
      }catch (...) {
      }
    }
  }

  if ( !moveShown )
  {
    aMeshPreviewStruct = new SMESH::MeshPreviewStruct();

    aMeshPreviewStruct->nodesXYZ.length(1);
    aMeshPreviewStruct->nodesXYZ[0].x = myDlg->myX->GetValue();
    aMeshPreviewStruct->nodesXYZ[0].y = myDlg->myY->GetValue();
    aMeshPreviewStruct->nodesXYZ[0].z = myDlg->myZ->GetValue();

    aMeshPreviewStruct->elementTypes.length(1);
    aMeshPreviewStruct->elementTypes[0].SMDS_ElementType = SMESH::NODE;
    aMeshPreviewStruct->elementTypes[0].isPoly = false;
    aMeshPreviewStruct->elementTypes[0].nbNodesInElement = 1;

    aMeshPreviewStruct->elementConnectivities.length(1);
    aMeshPreviewStruct->elementConnectivities[0] = 0;
  }

  // display data
  if ( aMeshPreviewStruct.operator->() )
  {
    mySimulation->SetData(aMeshPreviewStruct._retn());
  }
  else
{
    mySimulation->SetVisibility(false);
  }

  myNoPreview = 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_SelectionOp::selectionDone ( ) [protected, virtual, inherited]

Reimplemented in SMESHGUI_ConvToQuadOp, SMESHGUI_GroupOnShapeOp, SMESHGUI_Make2DFrom3DOp, and SMESHGUI_MeshOp.

Definition at line 144 of file SMESHGUI_SelectionOp.cxx.

References SMESH_test.ids, SMESH_reg.names, SMESHGUI_SelectionOp.selected(), and SMESHGUI_SelectionOp.selectionMode().

Referenced by SMESHGUI_SelectionOp.onActivateObject().

{
  if( !dlg() )
    return;

  if( selectionMode()!=ActorSelection )
  {
    SALOME_ListIO aList;
    selectionMgr()->selectedObjects( aList, SVTK_Viewer::Type() );

    if( aList.Extent() != 1 ) //we can select nodes or elements only within one mesh
    {
      dlg()->clearSelection();
      return;
    }    
  }
    
  QStringList names, ids;
  LightApp_Dialog::TypesList types;
  selected( names, types, ids );
  dlg()->selectObject( names, types, ids );
}
Selection_Mode SMESHGUI_SelectionOp::selectionMode ( ) const [protected, 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_MakeNodeAtPointOp::startOperation ( ) [protected, virtual]

This enumeration is used in typeById method to distinguish objects, mesh nodes and mesh elements, because node end element ids may overlap.

Reimplemented from SMESHGUI_SelectionOp.

Definition at line 333 of file SMESHGUI_MakeNodeAtPointDlg.cxx.

References SMESHGUI_MeshEditPreview.GetActor(), SMESH.GetFloat(), SMESHGUI_Operation.getSMESHGUI(), SMESH.GetViewWindow(), SMESH_LogicalFilter.LO_OR, SMESHGUI_MakeNodeAtPointDlg.myCurrentX, SMESHGUI_MakeNodeAtPointDlg.myCurrentY, SMESHGUI_MakeNodeAtPointDlg.myCurrentZ, myDlg, SMESHGUI_MakeNodeAtPointDlg.myDX, SMESHGUI_MakeNodeAtPointDlg.myDY, SMESHGUI_MakeNodeAtPointDlg.myDZ, myFilter, SMESHGUI_MakeNodeAtPointDlg.myId, myMeshActor, myNoPreview, mySimulation, SMESHGUI_MakeNodeAtPointDlg.myX, SMESHGUI_MakeNodeAtPointDlg.myY, SMESHGUI_MakeNodeAtPointDlg.myZ, onSelectionDone(), redisplayPreview(), SMESH.RepaintCurrentView(), SMESH_Actor.SetPointRepresentation(), SMESHGUI_SpinBox.SetValue(), and SMESHGUI_Dialog.show().

{
  myNoPreview = false;
  myMeshActor = 0;

  // init simulation with a current View
  if ( mySimulation ) delete mySimulation;
  mySimulation = new SMESHGUI_MeshEditPreview(SMESH::GetViewWindow( getSMESHGUI() ));
  vtkProperty* aProp = vtkProperty::New();
  aProp->SetRepresentationToWireframe();
  aProp->SetColor(250, 0, 250);
  aProp->SetPointSize(5);
  aProp->SetLineWidth( SMESH::GetFloat("SMESH:element_width",1) + 1);
  mySimulation->GetActor()->SetProperty(aProp);
  aProp->Delete();

  // SalomeApp_TypeFilter depends on a current study
  if ( myFilter ) delete myFilter;
  QList<SUIT_SelectionFilter*> filters;
  filters.append( new SalomeApp_TypeFilter((SalomeApp_Study*)study(), "SMESH" ));
  TColStd_MapOfInteger vertexType;
  vertexType.Add( TopAbs_VERTEX );
  filters.append( new SMESH_NumberFilter("GEOM", TopAbs_VERTEX, 1, vertexType ));
  myFilter = new SMESH_LogicalFilter( filters, SMESH_LogicalFilter::LO_OR );

  // IPAL19360
  SMESHGUI_SelectionOp::startOperation(); // this method should be called only after filter creation
  //activateSelection(); // set filters   // called inside of previous statement

  myDlg->myX->SetValue(0);
  myDlg->myY->SetValue(0);
  myDlg->myZ->SetValue(0);
  myDlg->myCurrentX->SetValue(0);
  myDlg->myCurrentY->SetValue(0);
  myDlg->myCurrentZ->SetValue(0);
  myDlg->myDX->SetValue(0);
  myDlg->myDY->SetValue(0);
  myDlg->myDZ->SetValue(0);
  myDlg->myId->setText("");
  myDlg->show();

  onSelectionDone(); // init myMeshActor

  if ( myMeshActor ) {
//     myMeshOldDisplayMode = myMeshActor->GetRepresentation();
//     myMeshActor->SetRepresentation( VTK_WIREFRAME );
    myMeshActor->SetPointRepresentation(true);
    SMESH::RepaintCurrentView();
    redisplayPreview();
  }
}
void SMESHGUI_MakeNodeAtPointOp::stopOperation ( ) [protected, virtual]

Stops operation.

Definition at line 391 of file SMESHGUI_MakeNodeAtPointDlg.cxx.

References myFilter, myMeshActor, myNoPreview, mySimulation, SMESH.RepaintCurrentView(), SMESH_Actor.SetPointRepresentation(), and SMESHGUI_MeshEditPreview.SetVisibility().

{
  myNoPreview = true;
  mySimulation->SetVisibility(false);
  if ( myMeshActor ) {
//     myMeshActor->SetRepresentation( myMeshOldDisplayMode );
    myMeshActor->SetPointRepresentation(false);
    SMESH::RepaintCurrentView();
    myMeshActor = 0;
  }
  selectionMgr()->removeFilter( myFilter );
  SMESHGUI_SelectionOp::stopOperation();
}
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]

Definition at line 76 of file SMESHGUI_MakeNodeAtPointDlg.h.

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