new files for dialog and operation

This commit is contained in:
sln 2005-07-01 06:27:43 +00:00
parent c981fa08d9
commit 949d8df2c5
5 changed files with 164 additions and 2 deletions

View File

@ -106,7 +106,8 @@ LIB_SRC = SMESHGUI.cxx \
SMESHGUI_PrecisionDlg.cxx \ SMESHGUI_PrecisionDlg.cxx \
SMESHGUI_VTKUtils.cxx \ SMESHGUI_VTKUtils.cxx \
SMESHGUI_Selection.cxx \ SMESHGUI_Selection.cxx \
SMESHGUI_CreatePolyhedralVolumeDlg.cxx SMESHGUI_CreatePolyhedralVolumeDlg.cxx \
SMESHGUI_Operation.cxx
LIB_MOC = \ LIB_MOC = \
SMESHGUI.h \ SMESHGUI.h \
@ -149,7 +150,8 @@ LIB_MOC = \
SMESHGUI_SewingDlg.h \ SMESHGUI_SewingDlg.h \
SMESHGUI_PrecisionDlg.h \ SMESHGUI_PrecisionDlg.h \
SMESHGUI_MergeNodesDlg.h \ SMESHGUI_MergeNodesDlg.h \
SMESHGUI_CreatePolyhedralVolumeDlg.h SMESHGUI_CreatePolyhedralVolumeDlg.h \
SMESHGUI_Operation.h
LIB_CLIENT_IDL = SALOME_Exception.idl \ LIB_CLIENT_IDL = SALOME_Exception.idl \
GEOM_Gen.idl \ GEOM_Gen.idl \

View File

@ -99,6 +99,7 @@
#include "SalomeApp_Application.h" #include "SalomeApp_Application.h"
#include "SalomeApp_Preferences.h" #include "SalomeApp_Preferences.h"
#include "SalomeApp_VTKSelector.h" #include "SalomeApp_VTKSelector.h"
#include "SalomeApp_Operation.h"
#include "SalomeApp_ImportOperation.h" #include "SalomeApp_ImportOperation.h"
@ -1099,6 +1100,13 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
if( !mgr ) if( !mgr )
return false; return false;
SUIT_Operation* anOp = getOperation( theCommandID );
if ( anOp != 0 )
{
anOp->start();
return true;
}
SUIT_ViewWindow* view = application()->desktop()->activeWindow(); SUIT_ViewWindow* view = application()->desktop()->activeWindow();
SVTK_ViewWindow* vtkwnd = dynamic_cast<SVTK_ViewWindow*>( view ); SVTK_ViewWindow* vtkwnd = dynamic_cast<SVTK_ViewWindow*>( view );
@ -3212,3 +3220,74 @@ void SMESHGUI::createPreferences()
void SMESHGUI::preferencesChanged( const QString&, const QString& ) void SMESHGUI::preferencesChanged( const QString&, const QString& )
{ {
} }
//=======================================================================
// function : onOperationCommited
// purpose : SLOT called when operation commited. Set default selection mode
//=======================================================================
void SMESHGUI::onOperationCommited( SUIT_Operation* )
{
SVTK_ViewWindow* vtkWnd =
dynamic_cast<SVTK_ViewWindow*>( application()->desktop()->activeWindow() );
if ( vtkWnd )
vtkWnd->SetSelectionMode( ActorSelection );
}
//=======================================================================
// function : onOperationAborted
// purpose : SLOT called when operation commited. Set default selection mode
//=======================================================================
void SMESHGUI::onOperationAborted( SUIT_Operation* )
{
SVTK_ViewWindow* vtkWnd =
dynamic_cast<SVTK_ViewWindow*>( application()->desktop()->activeWindow() );
if ( vtkWnd )
vtkWnd->SetSelectionMode( ActorSelection );
}
//=======================================================================
// function : getOperation
// purpose : Get operation corresponding to the given Id
//=======================================================================
SalomeApp_Operation* SMESHGUI::getOperation( const int theId )
{
if ( myOperations.contains( theId ) )
return myOperations[ theId ];
// to do:
SalomeApp_Operation* anOp = 0;
/*switch( theId )
{
case ... :
anOp = ...;
break;
}*/
if ( anOp != 0 )
{
anOp->setModule( this );
connect( anOp, SIGNAL( aborted( SUIT_Operation* ) ),
this, SLOT( onOperationAborted( SUIT_Operation* ) ) );
connect( anOp, SIGNAL( commited( SUIT_Operation* ) ),
this, SLOT( onOperationCommited( SUIT_Operation* ) ) );
myOperations[ theId ] = anOp;
}
return anOp;
}

View File

@ -43,9 +43,11 @@ class SUIT_Study;
class SUIT_ViewWindow; class SUIT_ViewWindow;
class SUIT_ResourceMgr; class SUIT_ResourceMgr;
class SUIT_ViewManager; class SUIT_ViewManager;
class SUIT_Operation;
class SalomeApp_Study; class SalomeApp_Study;
class SalomeApp_SelectionMgr; class SalomeApp_SelectionMgr;
class SalomeApp_Operation;
//================================================================================= //=================================================================================
@ -108,6 +110,8 @@ public slots:
private slots: private slots:
void OnGUIEvent(); void OnGUIEvent();
void onViewManagerAdded( SUIT_ViewManager* ); void onViewManagerAdded( SUIT_ViewManager* );
void onOperationCommited( SUIT_Operation* );
void onOperationAborted( SUIT_Operation* );
signals: signals:
void SignalDeactivateActiveDialog() ; void SignalDeactivateActiveDialog() ;
@ -120,11 +124,14 @@ protected:
void createPopupItem( const int, const QString&, const QString&, void createPopupItem( const int, const QString&, const QString&,
const QString& = QString::null, const int = -1 ); const QString& = QString::null, const int = -1 );
SalomeApp_Operation* getOperation( const int );
private : private :
static SMESH::SMESH_Gen_var myComponentSMESH; static SMESH::SMESH_Gen_var myComponentSMESH;
QDialog* myActiveDialogBox; QDialog* myActiveDialogBox;
int myState; int myState;
QMap<int,QString> myRules; QMap<int,QString> myRules;
QMap<int, SalomeApp_Operation*> myOperations;
}; };
#endif #endif

View File

@ -0,0 +1,35 @@
// SALOME SMESHGUI
//
// Copyright (C) 2005 CEA/DEN, EDF R&D
//
//
//
// File : SMESHGUI_Operation.h
// Author : Sergey LITONIN
// Module : SALOME
#include "SMESHGUI_Operation.h"
/*
Class : SMESHGUI_Operation
Description : Base class for all SMESH operations
*/
//=======================================================================
// name : SMESHGUI_Operation
// Purpose : Constructor
//=======================================================================
SMESHGUI_Operation::SMESHGUI_Operation( SalomeApp_Application* theApp )
: SalomeApp_Operation( theApp )
{
}
SMESHGUI_Operation::~SMESHGUI_Operation()
{
}

View File

@ -0,0 +1,39 @@
// SALOME SMESHGUI
//
// Copyright (C) 2005 CEA/DEN, EDF R&D
//
//
//
// File : SMESHGUI_Operation.h
// Author : Sergey LITONIN
// Module : SALOME
#ifndef SMESHGUI_Operation_H
#define SMESHGUI_Operation_H
#include <SalomeApp_Operation.h>
/*
Class : SMESHGUI_Operation
Description : Base class for all SMESH operations
*/
class SMESHGUI_Operation : public SalomeApp_Operation
{
Q_OBJECT
public:
SMESHGUI_Operation( SalomeApp_Application* );
virtual ~SMESHGUI_Operation();
};
#endif