Version: 6.3.1
Public Member Functions | Protected Slots | Protected Member Functions | Protected Attributes

SMESHGUI_EvaluateOp Class Reference

Operation to evaluate a mesh and show result. More...

#include <SMESHGUI_ComputeDlg.h>

Inheritance diagram for SMESHGUI_EvaluateOp:
Inheritance graph
[legend]

Public Member Functions

 SMESHGUI_EvaluateOp ()
 Constructor.
virtual ~SMESHGUI_EvaluateOp ()
 Desctructor.
virtual LightApp_Dialogdlg () const
 Gets dialog of this operation.
SMESH::SMESH_Mesh_ptr getMesh ()

Protected Slots

virtual bool onApply ()
 returns from compute mesh result dialog
void onPreviewShape ()
 update preview
void onPublishShape ()
 publish selected subshape
void onShowBadMesh ()
 show mesh elements preventing computation of a submesh of current row
void currentCellChanged ()
 SLOT called when a selected cell in table() changed.
virtual void onOk ()
virtual void onCancel ()
void onHelp ()

Protected Member Functions

virtual void startOperation ()
 perform it's intention action: compute mesh
virtual void stopOperation ()
 Stops operation.
SMESHGUI_ComputeDlgcomputeDlg () const
 Gets dialog of compute operation.
void computeMesh ()
 computeMesh()
void showComputeResult (const bool, const bool, SMESH::compute_error_array_var &, const bool, const QString &)
SMESHGUI_ComputeDlgevaluateDlg () const
 Gets dialog of evaluate operation.
void evaluateMesh ()
 evaluateMesh()
void showEvaluateResult (const SMESH::long_array &theRes, const bool, const bool, SMESH::compute_error_array_var &, const bool, const QString &)
virtual bool isValid (SUIT_Operation *theOp) const
 check the same operations on the same mesh
 Handle (SALOME_InteractiveObject) myIObject
virtual void initDialog ()
 sets the dialog widgets to state just after operation start
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

Protected Attributes

SMESH::SMESH_Mesh_var myMesh
GEOM::GEOM_Object_var myMainShape
SMESH::TShapeDisplayermyTShapeDisplayer
SMESHGUI_MeshEditPreviewmyBadMeshDisplayer
QString myHelpFileName
bool myIsApplyAndClose

Detailed Description

Operation to evaluate a mesh and show result.

Definition at line 188 of file SMESHGUI_ComputeDlg.h.


Constructor & Destructor Documentation

SMESHGUI_EvaluateOp::SMESHGUI_EvaluateOp ( )

Constructor.

Definition at line 1833 of file SMESHGUI_ComputeDlg.cxx.

SMESHGUI_EvaluateOp::~SMESHGUI_EvaluateOp ( ) [virtual]

Desctructor.

Definition at line 1845 of file SMESHGUI_ComputeDlg.cxx.

{
}

Member Function Documentation

SMESHGUI_Operation._PTR ( Study  ) const [protected, inherited]
SMESHGUI_ComputeDlg * SMESHGUI_BaseComputeOp::computeDlg ( ) const [protected, inherited]

Gets dialog of compute operation.

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

Definition at line 1223 of file SMESHGUI_ComputeDlg.cxx.

References SMESHGUI_BaseComputeOp.currentCellChanged(), SMESHGUI_BaseComputeOp.myCompDlg, SMESHGUI_BaseComputeOp.onPreviewShape(), SMESHGUI_BaseComputeOp.onPublishShape(), SMESHGUI_BaseComputeOp.onShowBadMesh(), and SMESHGUI_BaseComputeOp.table().

Referenced by SMESHGUI_ComputeOp.dlg(), SMESHGUI_PrecomputeOp.onCancel(), SMESHGUI_PrecomputeOp.onCompute(), SMESHGUI_PrecomputeOp.onPreview(), SMESHGUI_BaseComputeOp.showComputeResult(), SMESHGUI_PrecomputeOp.startOperation(), and SMESHGUI_BaseComputeOp.startOperation().

{
  if ( !myCompDlg )
  {
    SMESHGUI_BaseComputeOp* me = (SMESHGUI_BaseComputeOp*)this;
    me->myCompDlg = new SMESHGUI_ComputeDlg( desktop(), false );
    // connect signals and slots
    connect(myCompDlg->myShowBtn,    SIGNAL (clicked()), SLOT(onPreviewShape()));
    connect(myCompDlg->myPublishBtn, SIGNAL (clicked()), SLOT(onPublishShape()));
    connect(myCompDlg->myBadMeshBtn, SIGNAL (clicked()), SLOT(onShowBadMesh()));

    QTableWidget* aTable = me->table();
    connect(aTable, SIGNAL(itemSelectionChanged()), SLOT(currentCellChanged()));
    connect(aTable, SIGNAL(currentCellChanged(int,int,int,int)), SLOT(currentCellChanged()));
  }
  return myCompDlg;
}
void SMESHGUI_BaseComputeOp::computeMesh ( ) [protected, inherited]

computeMesh()

Definition at line 762 of file SMESHGUI_ComputeDlg.cxx.

References SMESHGUI_Operation._PTR(), SMDS_Mesh.CheckMemory(), SMESH.COMPERR_MEMORY_PB, SMESH.GetMessageOnAlgoStateErrors(), SMESH.GetResourceMgr(), SMESHGUI.GetSMESHGen(), SMESHGUI.GetSMESHGUI(), SMESHGUI_Operation.getSMESHGUI(), MESSAGE, SMESH.ModifiedMesh(), SMESHGUI_BaseComputeOp.myCompDlg, SMESHGUI_BaseComputeOp.myMainShape, SMESHGUI_BaseComputeOp.myMesh, SMESH.OnVisuException(), SMESH.MemoryReserve.release(), SMESH_AdvancedEditor.res, SMESHGUI_ComputeDlg_QThreadQDialog.result(), SMESHGUI_BaseComputeOp.showComputeResult(), and SMESH.Update().

Referenced by SMESHGUI_PrecomputeOp.onCompute(), and SMESHGUI_ComputeOp.startOperation().

{
  // COMPUTE MESH

  SMESH::MemoryReserve aMemoryReserve;

  SMESH::compute_error_array_var aCompErrors;
  QString                        aHypErrors;

  bool computeFailed = true, memoryLack = false;

  _PTR(SObject) aMeshSObj = SMESH::FindSObject(myMesh);
  if ( !aMeshSObj ) // IPAL 21340
    return;
  bool hasShape = myMesh->HasShapeToMesh();
  bool shapeOK = myMainShape->_is_nil() ? !hasShape : hasShape;
  if ( shapeOK )
  {
    myCompDlg->myMeshName->setText( aMeshSObj->GetName().c_str() );
    SMESH::SMESH_Gen_var gen = getSMESHGUI()->GetSMESHGen();
    SMESH::algo_error_array_var errors = gen->GetAlgoState(myMesh,myMainShape);
    if ( errors->length() > 0 ) {
      aHypErrors = SMESH::GetMessageOnAlgoStateErrors( errors.in() );
    }
    if ( myMesh->HasModificationsToDiscard() && // issue 0020693
         SUIT_MessageBox::question( desktop(), tr( "SMESH_WARNING" ),
                                    tr( "FULL_RECOMPUTE_QUESTION" ),
                                    tr( "SMESH_BUT_YES" ), tr( "SMESH_BUT_NO" ), 1, 0 ) == 0 )
      myMesh->Clear();
    SUIT_OverrideCursor aWaitCursor;
    try {
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
      OCC_CATCH_SIGNALS;
#endif
      //SMESH::UpdateNulData(myIObject, true);
      bool res;
#ifdef WITH_SMESH_CANCEL_COMPUTE
      SMESHGUI_ComputeDlg_QThreadQDialog qthreaddialog(desktop(), gen, myMesh, myMainShape);
      qthreaddialog.exec();
      res = qthreaddialog.result();
#else
      res = gen->Compute(myMesh, myMainShape);
#endif
      if (res)
        computeFailed = false;
    }
    catch(const SALOME::SALOME_Exception & S_ex){
      memoryLack = true;
    }
    try {
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
      OCC_CATCH_SIGNALS;
#endif
      aCompErrors = gen->GetComputeErrors( myMesh, myMainShape );
      // check if there are memory problems
      for ( int i = 0; (i < aCompErrors->length()) && !memoryLack; ++i )
        memoryLack = ( aCompErrors[ i ].code == SMESH::COMPERR_MEMORY_PB );
    }
    catch(const SALOME::SALOME_Exception & S_ex){
      memoryLack = true;
    }

    if ( !memoryLack && !SMDS_Mesh::CheckMemory(true) ) { // has memory to show dialog boxes?
      memoryLack = true;
    }

    // NPAL16631: if ( !memoryLack )
    {
      SMESH::ModifiedMesh(aMeshSObj, !computeFailed, myMesh->NbNodes() == 0);
      update( UF_ObjBrowser | UF_Model );

      // SHOW MESH
      // NPAL16631: if ( getSMESHGUI()->automaticUpdate() )
      SUIT_ResourceMgr* resMgr = SMESH::GetResourceMgr( SMESHGUI::GetSMESHGUI() );
      long newSize = myMesh->NbElements();
      bool limitExceeded;
      if ( !memoryLack )
      {
        if ( getSMESHGUI()->automaticUpdate( newSize, &limitExceeded ) )
        {
          try {
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
            OCC_CATCH_SIGNALS;
#endif
            SMESH::Update(myIObject, true);
          }
          catch (...) {
#ifdef _DEBUG_
            MESSAGE ( "Exception thrown during mesh visualization" );
#endif
            if ( SMDS_Mesh::CheckMemory(true) ) { // has memory to show warning?
              SMESH::OnVisuException();
            }
            else {
              memoryLack = true;
            }
          }
        }
        else if ( limitExceeded )
        {
          long limitSize = resMgr->integerValue( "SMESH", "update_limit", 500000 );
          SUIT_MessageBox::warning( desktop(),
                                    tr( "SMESH_WRN_WARNING" ),
                                    tr( "SMESH_WRN_SIZE_LIMIT_EXCEEDED" ).arg( newSize ).arg( limitSize ) );
        }
      }
      LightApp_SelectionMgr *Sel = selectionMgr();
      if ( Sel )
      {
        SALOME_ListIO selected;
        selected.Append( myIObject );
        Sel->setSelectedObjects( selected );
      }
    }
  }

  if ( memoryLack )
    aMemoryReserve.release();

  myCompDlg->setWindowTitle(tr( computeFailed ? "SMESH_WRN_COMPUTE_FAILED" : "SMESH_COMPUTE_SUCCEED"));

  // SHOW ERRORS
  
  bool noCompError = ( !aCompErrors.operator->() || aCompErrors->length() == 0 );
  bool noHypoError = ( aHypErrors.isEmpty() );

  SUIT_ResourceMgr* resMgr = SMESH::GetResourceMgr( SMESHGUI::GetSMESHGUI() );
  int aNotifyMode = resMgr->integerValue( "SMESH", "show_result_notification" );

  bool isShowResultDlg = true;
  switch( aNotifyMode ) {
  case 0: // show the mesh computation result dialog NEVER
    isShowResultDlg = false;
    commit();
    break;
  case 1: // show the mesh computation result dialog if there are some errors
    if ( memoryLack || !noCompError || !noHypoError )
      isShowResultDlg = true;
    else
    {
      isShowResultDlg = false;
      commit();
    }
    break;
  default: // show the result dialog after each mesh computation
    isShowResultDlg = true;
  }

  // SHOW RESULTS
  if ( isShowResultDlg )
    showComputeResult( memoryLack, noCompError,aCompErrors, noHypoError, aHypErrors );
}
void SMESHGUI_BaseComputeOp::currentCellChanged ( ) [protected, slot, inherited]

SLOT called when a selected cell in table() changed.

Definition at line 1138 of file SMESHGUI_ComputeDlg.cxx.

References COL_BAD_MESH, COL_PUBLISHED, COL_SHAPE, COL_SHAPEID, SMESH.getSelectedRows(), SMESH.TShapeDisplayer.HasReadyActorsFor(), SMESHGUI_BaseComputeOp.myBadMeshDisplayer, SMESHGUI_BaseComputeOp.myCompDlg, SMESHGUI_BaseComputeOp.myMainShape, SMESHGUI_BaseComputeOp.myTShapeDisplayer, SMESHGUI_MeshEditPreview.SetVisibility(), SMESH.TShapeDisplayer.SetVisibility(), SMESH.TShapeDisplayer.Show(), and SMESHGUI_BaseComputeOp.table().

Referenced by SMESHGUI_BaseComputeOp.computeDlg(), SMESHGUI_BaseComputeOp.evaluateDlg(), SMESHGUI_BaseComputeOp.onPreviewShape(), SMESHGUI_BaseComputeOp.onPublishShape(), SMESHGUI_BaseComputeOp.showComputeResult(), and SMESHGUI_BaseComputeOp.showEvaluateResult().

{
  myTShapeDisplayer->SetVisibility( false );
  if ( myBadMeshDisplayer )
    myBadMeshDisplayer->SetVisibility( false );

  bool publishEnable = 0, showEnable = 0, showOnly = 1, hasBadMesh = 0;
  QList<int> rows;
  int nbSelected = SMESH::getSelectedRows( table(), rows );
  int row;
  foreach ( row, rows )
  {
    bool hasData     = ( !table()->item( row, COL_SHAPE )->text().isEmpty() );
    bool isPublished = ( !table()->item( row, COL_PUBLISHED )->text().isEmpty() );
    if ( hasData && !isPublished )
      publishEnable = true;

    int curSub = table()->item( row, COL_SHAPEID )->text().toInt();
    bool prsReady = myTShapeDisplayer->HasReadyActorsFor( curSub, myMainShape );
    if ( prsReady ) {
      myTShapeDisplayer->Show( curSub, myMainShape, showOnly );
      showOnly = false;
    }
    else {
      showEnable = true;
    }

    if ( !table()->item(row, COL_BAD_MESH)->text().isEmpty() )
      hasBadMesh = true;
  }
  myCompDlg->myPublishBtn->setEnabled( publishEnable );
  myCompDlg->myShowBtn   ->setEnabled( showEnable );
  myCompDlg->myBadMeshBtn->setEnabled( hasBadMesh && ( nbSelected == 1 ));
}
LightApp_Dialog * SMESHGUI_EvaluateOp::dlg ( ) const [virtual]

Gets dialog of this operation.

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

Definition at line 1871 of file SMESHGUI_ComputeDlg.cxx.

References SMESHGUI_BaseComputeOp.evaluateDlg().

{
  return evaluateDlg();
}
SMESHGUI_ComputeDlg * SMESHGUI_BaseComputeOp::evaluateDlg ( ) const [protected, inherited]

Gets dialog of evaluate operation.

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

Definition at line 2086 of file SMESHGUI_ComputeDlg.cxx.

References SMESHGUI_BaseComputeOp.currentCellChanged(), SMESHGUI_BaseComputeOp.myCompDlg, SMESHGUI_BaseComputeOp.onPreviewShape(), SMESHGUI_BaseComputeOp.onPublishShape(), SMESHGUI_BaseComputeOp.onShowBadMesh(), and SMESHGUI_BaseComputeOp.table().

Referenced by dlg(), SMESHGUI_BaseComputeOp.showEvaluateResult(), and startOperation().

{
  if ( !myCompDlg )
  {
    SMESHGUI_BaseComputeOp* me = (SMESHGUI_BaseComputeOp*)this;
    me->myCompDlg = new SMESHGUI_ComputeDlg( desktop(), true );
    // connect signals and slots
    connect(myCompDlg->myShowBtn,    SIGNAL (clicked()), SLOT(onPreviewShape()));
    connect(myCompDlg->myPublishBtn, SIGNAL (clicked()), SLOT(onPublishShape()));
    connect(myCompDlg->myBadMeshBtn, SIGNAL (clicked()), SLOT(onShowBadMesh()));
    QTableWidget* aTable = me->table();
    connect(aTable, SIGNAL(itemSelectionChanged()), SLOT(currentCellChanged()));
    connect(aTable, SIGNAL(currentCellChanged(int,int,int,int)), SLOT(currentCellChanged()));
  }
  return myCompDlg;
}
void SMESHGUI_BaseComputeOp::evaluateMesh ( ) [protected, inherited]

evaluateMesh()

Definition at line 1882 of file SMESHGUI_ComputeDlg.cxx.

References SMESHGUI_Operation._PTR(), SMESH.GetMessageOnAlgoStateErrors(), SMESHGUI.GetSMESHGen(), SMESHGUI_Operation.getSMESHGUI(), SMESHGUI_BaseComputeOp.myCompDlg, SMESHGUI_BaseComputeOp.myMainShape, SMESHGUI_BaseComputeOp.myMesh, SMESH.MemoryReserve.release(), and SMESHGUI_BaseComputeOp.showEvaluateResult().

Referenced by startOperation().

{
  // EVALUATE MESH

  SMESH::MemoryReserve aMemoryReserve;

  SMESH::compute_error_array_var aCompErrors;
  QString                        aHypErrors;

  bool evaluateFailed = true, memoryLack = false;
  SMESH::long_array_var aRes;

  _PTR(SObject) aMeshSObj = SMESH::FindSObject(myMesh);
  if ( !aMeshSObj ) //  IPAL21340
    return;

  bool hasShape = myMesh->HasShapeToMesh();
  bool shapeOK = myMainShape->_is_nil() ? !hasShape : hasShape;
  if ( shapeOK )
  {
    myCompDlg->myMeshName->setText( aMeshSObj->GetName().c_str() );
    SMESH::SMESH_Gen_var gen = getSMESHGUI()->GetSMESHGen();
    SMESH::algo_error_array_var errors = gen->GetAlgoState(myMesh,myMainShape);
    if ( errors->length() > 0 ) {
      aHypErrors = SMESH::GetMessageOnAlgoStateErrors( errors.in() );
    }
    SUIT_OverrideCursor aWaitCursor;
    try {
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
      OCC_CATCH_SIGNALS;
#endif
      aRes = gen->Evaluate(myMesh, myMainShape);
    }
    catch(const SALOME::SALOME_Exception & S_ex){
      memoryLack = true;
    }

    try {
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
      OCC_CATCH_SIGNALS;
#endif
      aCompErrors = gen->GetComputeErrors( myMesh, myMainShape );
    }
    catch(const SALOME::SALOME_Exception & S_ex){
      memoryLack = true;
    }
  }

  if ( memoryLack )
    aMemoryReserve.release();

  evaluateFailed =  ( aCompErrors->length() > 0 );
  myCompDlg->setWindowTitle(tr( evaluateFailed ? "SMESH_WRN_EVALUATE_FAILED" : "SMESH_EVALUATE_SUCCEED"));

  // SHOW ERRORS
  
  bool noCompError = ( !aCompErrors.operator->() || aCompErrors->length() == 0 );
  bool noHypoError = ( aHypErrors.isEmpty() );

  //SUIT_ResourceMgr* resMgr = SMESH::GetResourceMgr( SMESHGUI::GetSMESHGUI() );
  //int aNotifyMode = resMgr->integerValue( "SMESH", "show_result_notification" );

  bool isShowResultDlg = true;
  //if( noHypoError )
  //switch( aNotifyMode ) {
  //case 0: // show the mesh computation result dialog NEVER
  //isShowResultDlg = false;
  //commit();
  //break;
  //case 1: // show the mesh computation result dialog if there are some errors
  //if ( memoryLack || !noHypoError )
  //  isShowResultDlg = true;
  //else
  //{
  //  isShowResultDlg = false;
  //  commit();
  //}
  //break;
  //default: // show the result dialog after each mesh computation
  //isShowResultDlg = true;
  //}

  // SHOW RESULTS
  if ( isShowResultDlg )
    showEvaluateResult( aRes, memoryLack, noCompError, aCompErrors,
                        noHypoError, aHypErrors);
}
SMESH::SMESH_Mesh_ptr SMESHGUI_BaseComputeOp::getMesh ( ) [inherited]

Definition at line 624 of file SMESHGUI_ComputeDlg.cxx.

References SMESH.GetMeshByIO(), SMESHGUI_BaseComputeOp.Handle(), and SMESHGUI_BaseComputeOp.myMesh.

Referenced by SMESHGUI_BaseComputeOp.isValid().

{
  LightApp_SelectionMgr* Sel = selectionMgr();
  SALOME_ListIO selected; Sel->selectedObjects( selected );
  Handle(SALOME_InteractiveObject) anIO = selected.First();
  SMESH::SMESH_Mesh_var aMesh = SMESH::GetMeshByIO(anIO);
  return myMesh->_is_nil() ? aMesh._retn() : SMESH::SMESH_Mesh::_duplicate( myMesh );
}
SMESHGUI * SMESHGUI_Operation::getSMESHGUI ( ) const [protected, inherited]
SMESHGUI_BaseComputeOp.Handle ( SALOME_InteractiveObject  ) [protected, inherited]
void SMESHGUI_Operation::initDialog ( ) [protected, virtual, inherited]

sets the dialog widgets to state just after operation start

Reimplemented in SMESHGUI_PrecomputeOp, SMESHGUI_MeshOrderOp, and SMESHGUI_SelectionOp.

Definition at line 215 of file SMESHGUI_Operation.cxx.

Referenced by SMESHGUI_Operation.startOperation().

{
}
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_BaseComputeOp::isValid ( SUIT_Operation *  theOp) const [protected, virtual, inherited]

check the same operations on the same mesh

Reimplemented from SMESHGUI_Operation.

Definition at line 1306 of file SMESHGUI_ComputeDlg.cxx.

References SMESHGUI_BaseComputeOp.getMesh(), SMESHGUI_BaseComputeOp.myMesh, and PAL_MESH_041_mesh.ret.

{
  SMESHGUI_BaseComputeOp* baseOp = dynamic_cast<SMESHGUI_BaseComputeOp*>( theOp );
  bool ret = true;
  if ( !myMesh->_is_nil() && baseOp ) {
    SMESH::SMESH_Mesh_var aMesh = baseOp->getMesh();
    if ( !aMesh->_is_nil() && aMesh->GetId() == myMesh->GetId() ) ret = false;
  }
  return ret;
}
bool SMESHGUI_BaseComputeOp::onApply ( ) [protected, virtual, slot, inherited]

returns from compute mesh result dialog

Reimplemented from SMESHGUI_Operation.

Definition at line 1247 of file SMESHGUI_ComputeDlg.cxx.

Referenced by SMESHGUI_PrecomputeOp.startOperation().

{
  return true;
}
void SMESHGUI_Operation::onCancel ( ) [protected, virtual, slot, inherited]
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_BaseComputeOp::onPreviewShape ( ) [protected, slot, inherited]

update preview

Definition at line 1179 of file SMESHGUI_ComputeDlg.cxx.

References COL_SHAPEID, SMESHGUI_BaseComputeOp.currentCellChanged(), SMESH.getSelectedRows(), SMESHGUI_BaseComputeOp.myMainShape, SMESHGUI_BaseComputeOp.myTShapeDisplayer, SMESH.TShapeDisplayer.Show(), and SMESHGUI_BaseComputeOp.table().

Referenced by SMESHGUI_BaseComputeOp.computeDlg(), and SMESHGUI_BaseComputeOp.evaluateDlg().

{
  if ( myTShapeDisplayer )
  {
    SUIT_OverrideCursor aWaitCursor;
    QList<int> rows;
    SMESH::getSelectedRows( table(), rows );

    bool showOnly = true;
    int row;
    foreach ( row, rows )
    {
      int curSub = table()->item( row, COL_SHAPEID )->text().toInt();
      if ( curSub > 0 ) {
        myTShapeDisplayer->Show( curSub, myMainShape, showOnly );
        showOnly = false;
      }
    }
    currentCellChanged(); // to update buttons
  }
}
void SMESHGUI_BaseComputeOp::onPublishShape ( ) [protected, slot, inherited]

publish selected subshape

Definition at line 1056 of file SMESHGUI_ComputeDlg.cxx.

References COL_PUBLISHED, COL_SHAPE, COL_SHAPEID, SMESHGUI_BaseComputeOp.currentCellChanged(), SMESH.GetGEOMGen(), SMESH.getSelectedRows(), SMESHGUI.GetSMESHGen(), SMESHGUI_Operation.getSMESHGUI(), SMESH.getSubShape(), SMESHGUI_BaseComputeOp.myMainShape, ex21_lamp.name, SMESH_fixation.shape, SMESH.shapeTypeName(), and SMESHGUI_BaseComputeOp.table().

Referenced by SMESHGUI_BaseComputeOp.computeDlg(), and SMESHGUI_BaseComputeOp.evaluateDlg().

{
  GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen();
  SALOMEDS::Study_var study = SMESHGUI::GetSMESHGen()->GetCurrentStudy();

  QList<int> rows;
  SMESH::getSelectedRows( table(), rows );
  int row;
  foreach ( row, rows )
  {
    int curSub = table()->item(row, COL_SHAPEID)->text().toInt();
    GEOM::GEOM_Object_var shape = SMESH::getSubShape( curSub, myMainShape );
    if ( !shape->_is_nil() && ! SMESH::getSubShapeSO( curSub, myMainShape ))
    {
      if ( !SMESH::getSubShapeSO( 1, myMainShape )) // the main shape not published
      {
        QString name = GEOMBase::GetDefaultName( SMESH::shapeTypeName( myMainShape, "MAIN_SHAPE" ));
        SALOMEDS::SObject_var so =
          geomGen->AddInStudy( study, myMainShape, name.toLatin1().data(), GEOM::GEOM_Object::_nil());
        // look for myMainShape in the table
        for ( int r = 0, nr = table()->rowCount(); r < nr; ++r ) {
          if ( table()->item( r, COL_SHAPEID )->text() == "1" ) {
            if ( so->_is_nil() ) {
              table()->item( r, COL_SHAPE )->setText( so->GetName() );
              table()->item( r, COL_PUBLISHED )->setText( so->GetID() );
            }
            break;
          }
        }
        if ( curSub == 1 ) continue;
      }
      QString name = GEOMBase::GetDefaultName( SMESH::shapeTypeName( shape, "ERROR_SHAPE" ));
      SALOMEDS::SObject_var so = geomGen->AddInStudy( study, shape, name.toLatin1().data(), myMainShape);
      if ( !so->_is_nil() ) {
        table()->item( row, COL_SHAPE )->setText( so->GetName() );
        table()->item( row, COL_PUBLISHED )->setText( so->GetID() );
      }
    }
  }
  getSMESHGUI()->getApp()->updateObjectBrowser();
  currentCellChanged(); // to update buttons
}
void SMESHGUI_BaseComputeOp::onShowBadMesh ( ) [protected, slot, inherited]

show mesh elements preventing computation of a submesh of current row

Definition at line 1105 of file SMESHGUI_ComputeDlg.cxx.

References COL_BAD_MESH, COL_SHAPEID, SMESHGUI_MeshEditPreview.GetActor(), SMESH.GetFloat(), SMESH.getSelectedRows(), SMESHGUI.GetSMESHGen(), SMESHGUI_Operation.getSMESHGUI(), SMESH.GetViewWindow(), SMESHGUI_BaseComputeOp.myBadMeshDisplayer, SMESHGUI_BaseComputeOp.myMesh, SMESHGUI_BaseComputeOp.myTShapeDisplayer, SMESHGUI_MeshEditPreview.SetData(), SMESH.TShapeDisplayer.SetVisibility(), and SMESHGUI_BaseComputeOp.table().

Referenced by SMESHGUI_BaseComputeOp.computeDlg(), and SMESHGUI_BaseComputeOp.evaluateDlg().

{
  myTShapeDisplayer->SetVisibility( false );
  QList<int> rows;
  if ( SMESH::getSelectedRows( table(), rows ) == 1 ) {
    bool hasBadMesh = ( !table()->item(rows.front(), COL_BAD_MESH)->text().isEmpty() );
    if ( hasBadMesh ) {
      int curSub = table()->item(rows.front(), COL_SHAPEID)->text().toInt();
      SMESHGUI* gui = getSMESHGUI();
      SMESH::SMESH_Gen_var gen = gui->GetSMESHGen();
      SVTK_ViewWindow*    view = SMESH::GetViewWindow( gui );
      if ( myBadMeshDisplayer ) delete myBadMeshDisplayer;
      myBadMeshDisplayer = new SMESHGUI_MeshEditPreview( view );
      SMESH::MeshPreviewStruct_var aMeshData = gen->GetBadInputElements(myMesh,curSub);
      vtkFloatingPointType aPointSize = SMESH::GetFloat("SMESH:node_size",3);
      vtkFloatingPointType aLineWidth = SMESH::GetFloat("SMESH:element_width",1);
      // delete property !!!!!!!!!!
      vtkProperty* prop = vtkProperty::New();
      prop->SetLineWidth( aLineWidth * 3 );
      prop->SetPointSize( aPointSize * 3 );
      prop->SetColor( 250, 0, 250 );
      myBadMeshDisplayer->GetActor()->SetProperty( prop );
      myBadMeshDisplayer->SetData( aMeshData._retn() );
    }
  }
}
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_BaseComputeOp::showComputeResult ( const bool  theMemoryLack,
const bool  theNoCompError,
SMESH::compute_error_array_var &  theCompErrors,
const bool  theNoHypoError,
const QString &  theHypErrors 
) [protected, inherited]

Definition at line 915 of file SMESHGUI_ComputeDlg.cxx.

References SMESH.ComputeError.algoName, SMESH.ComputeError.code, COL_ALGO, COL_BAD_MESH, COL_ERROR, COL_PUBLISHED, COL_SHAPE, COL_SHAPEID, SMESH.ComputeError.comment, SMESHGUI_BaseComputeOp.computeDlg(), SMESHGUI_BaseComputeOp.currentCellChanged(), SMESH.errorText(), SMESH.ComputeError.hasBadMesh, SMESHGUI_ComputeDlg.myBadMeshBtn, SMESHGUI_ComputeDlg.myBriefInfo, SMESHGUI_ComputeDlg.myCompErrorGroup, SMESHGUI_ComputeDlg.myFullInfo, SMESHGUI_ComputeDlg.myHypErrorGroup, SMESHGUI_ComputeDlg.myHypErrorLabel, SMESHGUI_BaseComputeOp.myMainShape, SMESHGUI_ComputeDlg.myMemoryLackGroup, SMESHGUI_BaseComputeOp.myMesh, SMESHGUI_ComputeDlg.myPublishBtn, SMESHGUI_ComputeDlg.myShowBtn, SMESHGUI_ComputeDlg.myTable, SMESHGUI_MeshInfosBox.SetMeshInfo(), SMESH.shapeText(), SMESHGUI_Dialog.show(), and SMESH.ComputeError.subShapeID.

Referenced by SMESHGUI_BaseComputeOp.computeMesh(), and SMESHGUI_PrecomputeOp.onPreview().

{
  bool hasShape = myMesh->HasShapeToMesh();
  SMESHGUI_ComputeDlg* aCompDlg = computeDlg();
  aCompDlg->myMemoryLackGroup->hide();

  if ( theMemoryLack )
  {
    aCompDlg->myMemoryLackGroup->show();
    aCompDlg->myFullInfo->hide();
    aCompDlg->myBriefInfo->hide();
    aCompDlg->myHypErrorGroup->hide();
    aCompDlg->myCompErrorGroup->hide();
  }
  else if ( theNoCompError && theNoHypoError )
  {
    SMESH::long_array_var aRes = myMesh->GetMeshInfo();
    aCompDlg->myFullInfo->SetMeshInfo( aRes );
    aCompDlg->myFullInfo->show();
    aCompDlg->myBriefInfo->hide();
    aCompDlg->myHypErrorGroup->hide();
    aCompDlg->myCompErrorGroup->hide();
  }
  else
  {
    QTableWidget* tbl = aCompDlg->myTable;
    SMESH::long_array_var aRes = myMesh->GetMeshInfo();
    aCompDlg->myBriefInfo->SetMeshInfo( aRes );
    aCompDlg->myBriefInfo->show();
    aCompDlg->myFullInfo->hide();

    if ( theNoHypoError ) {
      aCompDlg->myHypErrorGroup->hide();
    }
    else {
      aCompDlg->myHypErrorGroup->show();
      aCompDlg->myHypErrorLabel->setText( theHypErrors );
    }

    if ( theNoCompError ) {
      aCompDlg->myCompErrorGroup->hide();
    }
    else {
      aCompDlg->myCompErrorGroup->show();

      if ( !hasShape ) {
        aCompDlg->myPublishBtn->hide();
        aCompDlg->myShowBtn->hide();
      }
      else {
        aCompDlg->myPublishBtn->show();
        aCompDlg->myShowBtn->show();
      }

      // fill table of errors
      tbl->setRowCount( theCompErrors->length() );
      if ( !hasShape ) tbl->hideColumn( COL_SHAPE );
      else             tbl->showColumn( COL_SHAPE );
      tbl->setColumnWidth( COL_ERROR, 200 );

      bool hasBadMesh = false;
      for ( int row = 0; row < theCompErrors->length(); ++row )
      {
        SMESH::ComputeError & err = theCompErrors[ row ];

        QString text = err.algoName.in();
        if ( !tbl->item( row, COL_ALGO ) ) tbl->setItem( row, COL_ALGO, new QTableWidgetItem( text ) );
        else tbl->item( row, COL_ALGO )->setText( text );

        text = SMESH::errorText( err.code, err.comment.in() );
        if ( !tbl->item( row, COL_ERROR ) ) tbl->setItem( row, COL_ERROR, new QTableWidgetItem( text ) );
        else tbl->item( row, COL_ERROR )->setText( text );

        text = QString("%1").arg( err.subShapeID );
        if ( !tbl->item( row, COL_SHAPEID ) ) tbl->setItem( row, COL_SHAPEID, new QTableWidgetItem( text ) );
        else tbl->item( row, COL_SHAPEID )->setText( text );

        text = hasShape ? SMESH::shapeText( err.subShapeID, myMainShape ) : QString("");
        if ( !tbl->item( row, COL_SHAPE ) ) tbl->setItem( row, COL_SHAPE, new QTableWidgetItem( text ) );
        else tbl->item( row, COL_SHAPE )->setText( text );

        text = ( !hasShape || SMESH::getSubShapeSO( err.subShapeID, myMainShape )) ? "PUBLISHED" : "";
        if ( !tbl->item( row, COL_PUBLISHED ) ) tbl->setItem( row, COL_PUBLISHED, new QTableWidgetItem( text ) );
        else tbl->item( row, COL_PUBLISHED )->setText( text ); // if text=="", "PUBLISH" button enabled

        text = err.hasBadMesh ? "hasBadMesh" : "";
        if ( !tbl->item( row, COL_BAD_MESH ) ) tbl->setItem( row, COL_BAD_MESH, new QTableWidgetItem( text ) );
        else tbl->item( row, COL_BAD_MESH )->setText( text );
        if ( err.hasBadMesh ) hasBadMesh = true;

        //tbl->item( row, COL_ERROR )->setWordWrap( true ); // VSR: TODO ???
        tbl->resizeRowToContents( row );
      }
      tbl->resizeColumnToContents( COL_ALGO );
      tbl->resizeColumnToContents( COL_SHAPE );

      if ( hasBadMesh )
        aCompDlg->myBadMeshBtn->show();
      else
        aCompDlg->myBadMeshBtn->hide();

      tbl->setCurrentCell(0,0);
      currentCellChanged(); // to update buttons
    }
  }
  // show dialog and wait, becase Compute can be invoked from Preview operation
  //aCompDlg->exec(); // this way it becomes modal - impossible to rotate model in the Viewer
  aCompDlg->show();
}
void SMESHGUI_BaseComputeOp::showEvaluateResult ( const SMESH::long_array theRes,
const bool  theMemoryLack,
const bool  theNoCompError,
SMESH::compute_error_array_var &  theCompErrors,
const bool  theNoHypoError,
const QString &  theHypErrors 
) [protected, inherited]

Definition at line 1971 of file SMESHGUI_ComputeDlg.cxx.

References SMESH.ComputeError.algoName, SMESH.ComputeError.code, COL_ALGO, COL_BAD_MESH, COL_ERROR, COL_PUBLISHED, COL_SHAPE, COL_SHAPEID, SMESH.ComputeError.comment, SMESHGUI_BaseComputeOp.currentCellChanged(), SMESH.errorText(), SMESHGUI_BaseComputeOp.evaluateDlg(), SMESH.ComputeError.hasBadMesh, SMESHGUI_ComputeDlg.myBadMeshBtn, SMESHGUI_ComputeDlg.myBriefInfo, SMESHGUI_ComputeDlg.myCompErrorGroup, SMESHGUI_ComputeDlg.myFullInfo, SMESHGUI_ComputeDlg.myHypErrorGroup, SMESHGUI_ComputeDlg.myHypErrorLabel, SMESHGUI_BaseComputeOp.myMainShape, SMESHGUI_ComputeDlg.myMemoryLackGroup, SMESHGUI_BaseComputeOp.myMesh, SMESHGUI_ComputeDlg.myPublishBtn, SMESHGUI_ComputeDlg.myShowBtn, SMESHGUI_ComputeDlg.myTable, SMESHGUI_MeshInfosBox.SetMeshInfo(), SMESH.shapeText(), SMESHGUI_Dialog.show(), and SMESH.ComputeError.subShapeID.

Referenced by SMESHGUI_BaseComputeOp.evaluateMesh().

{
  bool hasShape = myMesh->HasShapeToMesh();
  SMESHGUI_ComputeDlg* aCompDlg = evaluateDlg();
  aCompDlg->myMemoryLackGroup->hide();

  if ( theMemoryLack )
  {
    aCompDlg->myMemoryLackGroup->show();
    aCompDlg->myFullInfo->hide();
    aCompDlg->myBriefInfo->hide();
    aCompDlg->myHypErrorGroup->hide();
    aCompDlg->myCompErrorGroup->hide();
  }
  else if ( theNoCompError && theNoHypoError )
  {
    aCompDlg->myFullInfo->SetMeshInfo( theRes );
    aCompDlg->myFullInfo->show();
    aCompDlg->myBriefInfo->hide();
    aCompDlg->myHypErrorGroup->hide();
    aCompDlg->myCompErrorGroup->hide();
  }
  else
  {
    QTableWidget* tbl = aCompDlg->myTable;
    aCompDlg->myBriefInfo->SetMeshInfo( theRes );
    aCompDlg->myBriefInfo->show();
    aCompDlg->myFullInfo->hide();

    if ( theNoHypoError ) {
      aCompDlg->myHypErrorGroup->hide();
    }
    else {
      aCompDlg->myHypErrorGroup->show();
      aCompDlg->myHypErrorLabel->setText( theHypErrors );
    }

    if ( theNoCompError ) {
      aCompDlg->myCompErrorGroup->hide();
    }
    else {
      aCompDlg->myCompErrorGroup->show();

      aCompDlg->myPublishBtn->hide();
      aCompDlg->myShowBtn->hide();

      // fill table of errors
      tbl->setRowCount( theCompErrors->length() );
      if ( !hasShape ) tbl->hideColumn( COL_SHAPE );
      else             tbl->showColumn( COL_SHAPE );
      tbl->setColumnWidth( COL_ERROR, 200 );

      bool hasBadMesh = false;
      for ( int row = 0; row < theCompErrors->length(); ++row )
      {
        SMESH::ComputeError & err = theCompErrors[ row ];

        QString text = err.algoName.in();
        if ( !tbl->item( row, COL_ALGO ) ) tbl->setItem( row, COL_ALGO, new QTableWidgetItem( text ) );
        else tbl->item( row, COL_ALGO )->setText( text );

        text = SMESH::errorText( err.code, err.comment.in() );
        if ( !tbl->item( row, COL_ERROR ) ) tbl->setItem( row, COL_ERROR, new QTableWidgetItem( text ) );
        else tbl->item( row, COL_ERROR )->setText( text );

        text = QString("%1").arg( err.subShapeID );
        if ( !tbl->item( row, COL_SHAPEID ) ) tbl->setItem( row, COL_SHAPEID, new QTableWidgetItem( text ) );
        else tbl->item( row, COL_SHAPEID )->setText( text );

        text = hasShape ? SMESH::shapeText( err.subShapeID, myMainShape ) : QString("");
        if ( !tbl->item( row, COL_SHAPE ) ) tbl->setItem( row, COL_SHAPE, new QTableWidgetItem( text ) );
        else tbl->item( row, COL_SHAPE )->setText( text );

        text = ( !hasShape || SMESH::getSubShapeSO( err.subShapeID, myMainShape )) ? "PUBLISHED" : "";
        if ( !tbl->item( row, COL_PUBLISHED ) ) tbl->setItem( row, COL_PUBLISHED, new QTableWidgetItem( text ) );
        else tbl->item( row, COL_PUBLISHED )->setText( text ); // if text=="", "PUBLISH" button enabled

        text = err.hasBadMesh ? "hasBadMesh" : "";
        if ( !tbl->item( row, COL_BAD_MESH ) ) tbl->setItem( row, COL_BAD_MESH, new QTableWidgetItem( text ) );
        else tbl->item( row, COL_BAD_MESH )->setText( text );
        if ( err.hasBadMesh ) hasBadMesh = true;

        //tbl->item( row, COL_ERROR )->setWordWrap( true ); // VSR: TODO ???
        tbl->resizeRowToContents( row );
      }
      tbl->resizeColumnToContents( COL_ALGO );
      tbl->resizeColumnToContents( COL_SHAPE );

      if ( hasBadMesh )
        aCompDlg->myBadMeshBtn->show();
      else
        aCompDlg->myBadMeshBtn->hide();

      tbl->setCurrentCell(0,0);
      currentCellChanged(); // to update buttons
    }
  }
  // show dialog and wait, becase Compute can be invoked from Preview operation
  //aCompDlg->exec(); // this way it becomes modal - impossible to rotate model in the Viewer
  aCompDlg->show();
}
void SMESHGUI_EvaluateOp::startOperation ( ) [protected, virtual]
void SMESHGUI_BaseComputeOp::stopOperation ( ) [protected, virtual, inherited]

Stops operation.

Reimplemented in SMESHGUI_PrecomputeOp.

Definition at line 1035 of file SMESHGUI_ComputeDlg.cxx.

References SMESHGUI_BaseComputeOp.myBadMeshDisplayer, SMESHGUI_BaseComputeOp.myTShapeDisplayer, SMESHGUI_MeshEditPreview.SetVisibility(), and SMESH.TShapeDisplayer.SetVisibility().

{
  SMESHGUI_Operation::stopOperation();
  if ( myTShapeDisplayer )
    myTShapeDisplayer->SetVisibility( false );
  if ( myBadMeshDisplayer ) {
    myBadMeshDisplayer->SetVisibility( false );
    // delete it in order not to have problems at its destruction when the viewer
    // where it worked is dead due to e.g. study closing
    delete myBadMeshDisplayer;
    myBadMeshDisplayer = 0;
  }
  myIObject.Nullify();
}

Field Documentation

QString SMESHGUI_Operation.myHelpFileName [protected, inherited]
GEOM::GEOM_Object_var SMESHGUI_BaseComputeOp.myMainShape [protected, inherited]
SMESH::SMESH_Mesh_var SMESHGUI_BaseComputeOp.myMesh [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