mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-30 22:20:34 +05:00
isReadyToStart method added
This commit is contained in:
parent
f4b5c42b70
commit
2bd09d7cc7
@ -8,12 +8,14 @@
|
|||||||
// Author : Sergey LITONIN
|
// Author : Sergey LITONIN
|
||||||
// Module : SALOME
|
// Module : SALOME
|
||||||
|
|
||||||
#include <SMESHGUI_Operation.h>
|
#include "SMESHGUI_Operation.h"
|
||||||
#include <SMESHGUI.h>
|
#include "SMESHGUI.h"
|
||||||
#include <SMESHGUI_VTKUtils.h>
|
#include "SMESHGUI_VTKUtils.h"
|
||||||
|
|
||||||
#include <SVTK_ViewWindow.h>
|
#include <SVTK_ViewWindow.h>
|
||||||
#include <SVTK_Selector.h>
|
#include <SVTK_Selector.h>
|
||||||
|
#include <SUIT_MessageBox.h>
|
||||||
|
#include <SUIT_Desktop.h>
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -26,9 +28,7 @@
|
|||||||
// Purpose : Constructor
|
// Purpose : Constructor
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
SMESHGUI_Operation::SMESHGUI_Operation( SalomeApp_Application* app )
|
SMESHGUI_Operation::SMESHGUI_Operation( SalomeApp_Application* app )
|
||||||
: SalomeApp_Operation( app ),
|
: SalomeApp_Operation( app )
|
||||||
myViewWindow( 0 ),
|
|
||||||
mySelector( 0 )
|
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -38,44 +38,97 @@ SMESHGUI_Operation::~SMESHGUI_Operation()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
// name : setSelectionMode
|
||||||
|
// Purpose : Set selection mode
|
||||||
|
//=======================================================================
|
||||||
void SMESHGUI_Operation::setSelectionMode( const Selection_Mode mode )
|
void SMESHGUI_Operation::setSelectionMode( const Selection_Mode mode )
|
||||||
{
|
{
|
||||||
if( myViewWindow )
|
SVTK_ViewWindow* wnd = viewWindow();
|
||||||
myViewWindow->SetSelectionMode( mode );
|
if( wnd )
|
||||||
|
wnd->SetSelectionMode( mode );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
// name : highlight
|
||||||
|
// Purpose : Highlight object in 3d viewer
|
||||||
|
//=======================================================================
|
||||||
void SMESHGUI_Operation::highlight( const Handle( SALOME_InteractiveObject )& obj,
|
void SMESHGUI_Operation::highlight( const Handle( SALOME_InteractiveObject )& obj,
|
||||||
const bool hilight, const bool immediately )
|
const bool hilight, const bool immediately )
|
||||||
{
|
{
|
||||||
if( myViewWindow )
|
SVTK_ViewWindow* wnd = viewWindow();
|
||||||
myViewWindow->highlight( obj, hilight, immediately );
|
if( wnd )
|
||||||
|
wnd->highlight( obj, hilight, immediately );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
// name : addOrRemoveIndex
|
||||||
|
// Purpose : Select/deselect cells of mesh
|
||||||
|
//=======================================================================
|
||||||
void SMESHGUI_Operation::addOrRemoveIndex( const Handle( SALOME_InteractiveObject )& obj,
|
void SMESHGUI_Operation::addOrRemoveIndex( const Handle( SALOME_InteractiveObject )& obj,
|
||||||
const TColStd_MapOfInteger& indices, const bool isModeShift )
|
const TColStd_MapOfInteger& indices,
|
||||||
|
const bool isModeShift )
|
||||||
{
|
{
|
||||||
if( mySelector )
|
SVTK_Selector* sel = selector();
|
||||||
mySelector->AddOrRemoveIndex( obj, indices, isModeShift );
|
if( sel )
|
||||||
|
sel->AddOrRemoveIndex( obj, indices, isModeShift );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
// name : getSMESHGUI
|
||||||
|
// Purpose : Get SMESH module
|
||||||
|
//=======================================================================
|
||||||
SMESHGUI* SMESHGUI_Operation::getSMESHGUI() const
|
SMESHGUI* SMESHGUI_Operation::getSMESHGUI() const
|
||||||
{
|
{
|
||||||
return dynamic_cast<SMESHGUI*>( module() );
|
return dynamic_cast<SMESHGUI*>( module() );
|
||||||
}
|
}
|
||||||
|
|
||||||
SVTK_ViewWindow* SMESHGUI_Operation::getViewWindow() const
|
//=======================================================================
|
||||||
|
// name : viewWindow
|
||||||
|
// Purpose : Get active view window
|
||||||
|
//=======================================================================
|
||||||
|
SVTK_ViewWindow* SMESHGUI_Operation::viewWindow() const
|
||||||
{
|
{
|
||||||
return myViewWindow;
|
return SMESH::GetViewWindow( getSMESHGUI() );
|
||||||
}
|
}
|
||||||
|
|
||||||
SVTK_Selector* SMESHGUI_Operation::getSelector() const
|
//=======================================================================
|
||||||
|
// name : selector
|
||||||
|
// Purpose : Get selector
|
||||||
|
//=======================================================================
|
||||||
|
SVTK_Selector* SMESHGUI_Operation::selector() const
|
||||||
{
|
{
|
||||||
return mySelector;
|
SVTK_ViewWindow* wnd = viewWindow();
|
||||||
|
return wnd ? wnd->GetSelector() : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
// name : startOperation
|
||||||
|
// Purpose : Start opeartion
|
||||||
|
//=======================================================================
|
||||||
void SMESHGUI_Operation::startOperation()
|
void SMESHGUI_Operation::startOperation()
|
||||||
{
|
{
|
||||||
SalomeApp_Operation::startOperation();
|
SalomeApp_Operation::startOperation();
|
||||||
myViewWindow = SMESH::GetViewWindow( getSMESHGUI() );
|
|
||||||
mySelector = myViewWindow ? myViewWindow->GetSelector() : 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
// name : isReadyToStart
|
||||||
|
// Purpose : Verify whether operation is ready to start
|
||||||
|
//=======================================================================
|
||||||
|
bool SMESHGUI_Operation::isReadyToStart()
|
||||||
|
{
|
||||||
|
if ( !SalomeApp_Operation::isReadyToStart() )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if ( getSMESHGUI() == 0 )
|
||||||
|
{
|
||||||
|
SUIT_MessageBox::warn1( SMESHGUI::desktop(), tr( "SMESH_WRN_WARNING" ),
|
||||||
|
tr( "NO_MODULE" ), tr( "SMESH_BUT_OK" ) );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -36,19 +36,20 @@ public:
|
|||||||
virtual ~SMESHGUI_Operation();
|
virtual ~SMESHGUI_Operation();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void setSelectionMode( const Selection_Mode );
|
|
||||||
void highlight( const Handle( SALOME_InteractiveObject )&, const bool, const bool = true );
|
|
||||||
void addOrRemoveIndex( const Handle( SALOME_InteractiveObject )&, const TColStd_MapOfInteger&, const bool );
|
|
||||||
|
|
||||||
virtual void startOperation();
|
void setSelectionMode( const Selection_Mode );
|
||||||
|
void highlight( const Handle( SALOME_InteractiveObject )&,
|
||||||
|
const bool, const bool = true );
|
||||||
|
void addOrRemoveIndex( const Handle( SALOME_InteractiveObject )&,
|
||||||
|
const TColStd_MapOfInteger&, const bool );
|
||||||
|
|
||||||
SMESHGUI* getSMESHGUI() const;
|
virtual void startOperation();
|
||||||
SVTK_ViewWindow* getViewWindow() const;
|
virtual bool isReadyToStart();
|
||||||
SVTK_Selector* getSelector() const;
|
|
||||||
|
SMESHGUI* getSMESHGUI() const;
|
||||||
|
SVTK_ViewWindow* viewWindow() const;
|
||||||
|
SVTK_Selector* selector() const;
|
||||||
|
|
||||||
private:
|
|
||||||
SVTK_ViewWindow* myViewWindow;
|
|
||||||
SVTK_Selector* mySelector;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -2800,3 +2800,9 @@ msgstr "Nodes"
|
|||||||
|
|
||||||
msgid "SMESHGUI::PREF_ELEMENTS"
|
msgid "SMESHGUI::PREF_ELEMENTS"
|
||||||
msgstr "Elements"
|
msgstr "Elements"
|
||||||
|
|
||||||
|
# =====================================================
|
||||||
|
|
||||||
|
msgid "SMESHGUI_Operation::NO_MODULE"
|
||||||
|
msgstr "There is no MESH module to start operation"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user