Update from local sources

This commit is contained in:
apo 2005-06-08 06:18:53 +00:00
parent 4679b8437b
commit 25cec45acb
15 changed files with 293 additions and 294 deletions

View File

@ -307,19 +307,6 @@ namespace{
aFilename = fd->selectedFile(); aFilename = fd->selectedFile();
aFormat = aFilterMap[fd->selectedFilter()]; aFormat = aFilterMap[fd->selectedFilter()];
delete fd; delete fd;
if( !aFilename.isEmpty()
&& (aMesh->NbPolygons()>0 or aMesh->NbPolyhedrons()>0)
&& aFormat==SMESH::MED_V2_1){
int aRet = SUIT_MessageBox::warn2(SMESHGUI::desktop(),
QObject::tr("SMESH_WRN_WARNING"),
QObject::tr("SMESH_EXPORT_MED_V2_1").arg(anIObject->getName()),
QObject::tr("SMESH_BUT_YES"),
QObject::tr("SMESH_BUT_NO"),
0,1,0);
if(aRet){
return;
}
}
} }
if ( !aFilename.isEmpty() ) { if ( !aFilename.isEmpty() ) {
// Check whether the file already exists and delete it if yes // Check whether the file already exists and delete it if yes
@ -1235,7 +1222,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
if ( vtkwnd ) { if ( vtkwnd ) {
EmitSignalDeactivateDialog(); EmitSignalDeactivateDialog();
new SMESHGUI_NodesDlg( desktop(), "", SMESHGUI::selectionMgr() ); new SMESHGUI_NodesDlg(this);
} }
else { else {
SUIT_MessageBox::warn1(desktop(), SUIT_MessageBox::warn1(desktop(),
@ -1698,7 +1685,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
EmitSignalDeactivateDialog(); EmitSignalDeactivateDialog();
new SMESHGUI_DeleteGroupDlg( desktop(), SMESHGUI::selectionMgr() ); new SMESHGUI_DeleteGroupDlg(this);
break; break;
} }
@ -2169,7 +2156,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
aTypes.append( SMESH::FACE ); aTypes.append( SMESH::FACE );
aTypes.append( SMESH::VOLUME ); aTypes.append( SMESH::VOLUME );
} }
new SMESHGUI_FilterLibraryDlg( desktop(), aTypes, SMESHGUI_FilterLibraryDlg::EDIT ); new SMESHGUI_FilterLibraryDlg( this, SMESH::GetDesktop( this ), aTypes, SMESHGUI_FilterLibraryDlg::EDIT );
} }
break; break;
@ -2443,9 +2430,9 @@ void SMESHGUI::createPopupItem( const int id,
if( !popupMgr()->contains( popupMgr()->actionId( action( id ) ) ) ) if( !popupMgr()->contains( popupMgr()->actionId( action( id ) ) ) )
popupMgr()->insert( action( id ), parentId, 0 ); popupMgr()->insert( action( id ), parentId, 0 );
QChar lc = popupMgr()->equality(); QChar lc = QtxPopupMgr::Selection::defEquality();
QString rule = "(%1) and (%2) and (%3)"; QString rule = "(%1) and (%2) and (%3)";
rule = rule.arg( QString( "%1>0" ).arg( popupMgr()->selCountParam() ) ); rule = rule.arg( QString( "%1>0" ).arg( QtxPopupMgr::Selection::defSelCountParam() ) );
rule = rule.arg( QString( "%1client in {%2}" ).arg( lc ).arg( clients ) ); rule = rule.arg( QString( "%1client in {%2}" ).arg( lc ).arg( clients ) );
rule = rule.arg( QString( "%1type in {%2}" ).arg( lc ).arg( types ) ); rule = rule.arg( QString( "%1type in {%2}" ).arg( lc ).arg( types ) );
rule += theRule; rule += theRule;
@ -2499,19 +2486,19 @@ void SMESHGUI::initialize( CAM_Application* app )
createSMESHAction( 813, "DEL_GROUP", "ICON_DEL_GROUP" ); createSMESHAction( 813, "DEL_GROUP", "ICON_DEL_GROUP" );
createSMESHAction( 900, "ADV_INFO", "ICON_ADV_INFO" ); createSMESHAction( 900, "ADV_INFO", "ICON_ADV_INFO" );
createSMESHAction( 902, "STD_INFO", "ICON_STD_INFO" ); createSMESHAction( 902, "STD_INFO", "ICON_STD_INFO" );
createSMESHAction( 6001, "LENGTH", "ICON_LENGTH" ); createSMESHAction( 6001, "LENGTH", "ICON_LENGTH" , 0, true );
createSMESHAction( 6002, "FREE_EDGE", "ICON_FREE_EDGE" ); createSMESHAction( 6002, "FREE_EDGE", "ICON_FREE_EDGE" , 0, true );
createSMESHAction( 6003, "FREE_BORDER", "ICON_FREE_EDGE_2D" ); createSMESHAction( 6003, "FREE_BORDER", "ICON_FREE_EDGE_2D" , 0, true );
createSMESHAction( 6004, "CONNECTION", "ICON_CONNECTION" ); createSMESHAction( 6004, "CONNECTION", "ICON_CONNECTION" , 0, true );
createSMESHAction( 6011, "AREA", "ICON_AREA" ); createSMESHAction( 6011, "AREA", "ICON_AREA" , 0, true );
createSMESHAction( 6012, "TAPER", "ICON_TAPER" ); createSMESHAction( 6012, "TAPER", "ICON_TAPER" , 0, true );
createSMESHAction( 6013, "ASPECT", "ICON_ASPECT" ); createSMESHAction( 6013, "ASPECT", "ICON_ASPECT" , 0, true );
createSMESHAction( 6014, "MIN_ANG", "ICON_ANGLE" ); createSMESHAction( 6014, "MIN_ANG", "ICON_ANGLE" , 0, true );
createSMESHAction( 6015, "WRAP", "ICON_WRAP" ); createSMESHAction( 6015, "WRAP", "ICON_WRAP" , 0, true );
createSMESHAction( 6016, "SKEW", "ICON_SKEW" ); createSMESHAction( 6016, "SKEW", "ICON_SKEW", 0, true );
createSMESHAction( 6017, "ASPECT_3D", "ICON_ASPECT_3D" ); createSMESHAction( 6017, "ASPECT_3D", "ICON_ASPECT_3D", 0, true );
createSMESHAction( 6018, "LENGTH_2D", "ICON_LENGTH_2D" ); createSMESHAction( 6018, "LENGTH_2D", "ICON_LENGTH_2D", 0, true );
createSMESHAction( 6019, "CONNECTION_2D", "ICON_CONNECTION_2D" ); createSMESHAction( 6019, "CONNECTION_2D", "ICON_CONNECTION_2D", 0, true );
createSMESHAction( 400, "NODE", "ICON_DLG_NODE" ); createSMESHAction( 400, "NODE", "ICON_DLG_NODE" );
createSMESHAction( 401, "EDGE", "ICON_DLG_EDGE" ); createSMESHAction( 401, "EDGE", "ICON_DLG_EDGE" );
createSMESHAction( 4021, "TRIANGLE", "ICON_DLG_TRIANGLE" ); createSMESHAction( 4021, "TRIANGLE", "ICON_DLG_TRIANGLE" );
@ -2550,18 +2537,19 @@ void SMESHGUI::initialize( CAM_Application* app )
createSMESHAction( 10071, "DISP_ENT", "", 0, true ); createSMESHAction( 10071, "DISP_ENT", "", 0, true );
createSMESHAction( 200, "RESET" ); createSMESHAction( 200, "RESET" );
createSMESHAction( 201, "SCALAR_BAR_PROP" ); createSMESHAction( 201, "SCALAR_BAR_PROP" );
createSMESHAction( 211, "WIRE", "ICON_WIRE" ); createSMESHAction( 211, "WIRE", "ICON_WIRE", 0, true );
createSMESHAction( 212, "SHADE", "ICON_SHADE" ); createSMESHAction( 212, "SHADE", "ICON_SHADE", 0, true );
createSMESHAction( 213, "SHRINK", "ICON_SHRINK" ); createSMESHAction( 213, "SHRINK", "ICON_SHRINK", 0, true );
createSMESHAction( 214, "UPDATE", "ICON_UPDATE" ); createSMESHAction( 214, "UPDATE", "ICON_UPDATE" );
createSMESHAction( 215, "NODES", "ICON_POINTS" ); createSMESHAction( 215, "NODES", "ICON_POINTS", 0, true );
createSMESHAction( 217, "EDGES", "ICON_DLG_EDGE" ); createSMESHAction( 217, "EDGES", "ICON_DLG_EDGE", 0, true );
createSMESHAction( 218, "FACES", "ICON_DLG_TRIANGLE" ); createSMESHAction( 218, "FACES", "ICON_DLG_TRIANGLE", 0, true );
createSMESHAction( 219, "VOLUMES", "ICON_DLG_TETRAS" ); createSMESHAction( 219, "VOLUMES", "ICON_DLG_TETRAS", 0, true );
createSMESHAction( 220, "ALL" ); createSMESHAction( 220, "ALL" );
createSMESHAction( 1100, "EDIT_HYPO" );
createSMESHAction( 1101, "RENAME" ); createSMESHAction( 1101, "RENAME" );
createSMESHAction( 9010, "NUM_NODES" ); createSMESHAction( 9010, "NUM_NODES", "", 0, true );
createSMESHAction( 9011, "NUM_ELEMENTS" ); createSMESHAction( 9011, "NUM_ELEMENTS", "", 0, true );
createSMESHAction( 1131, "DISPMODE" ); createSMESHAction( 1131, "DISPMODE" );
createSMESHAction( 1132, "COLORS" ); createSMESHAction( 1132, "COLORS" );
createSMESHAction( 1133, "TRANSP" ); createSMESHAction( 1133, "TRANSP" );
@ -2847,9 +2835,9 @@ void SMESHGUI::initialize( CAM_Application* app )
hasFaces("{'Face'} in elemTypes"), hasFaces("{'Face'} in elemTypes"),
hasVolumes("{'Volume'} in elemTypes"); hasVolumes("{'Volume'} in elemTypes");
QString aSelCount = popupMgr()->selCountParam() + "= 1"; QString aSelCount = QString( "%1 = 1" ).arg( QtxPopupMgr::Selection::defSelCountParam() );
QString aClient = QString( popupMgr()->equality() )+ "client in {" + View + "}"; QString aClient = QString( "%1client in {%2}" ).arg( QtxPopupMgr::Selection::defEquality() ).arg( View );
QString aType = QString( popupMgr()->equality() ) + "type in {" + mesh_group + "}"; QString aType = QString( "%1type in {%2}" ).arg( QtxPopupMgr::Selection::defEquality() ).arg( mesh_group );
QString aMeshInVTK = aClient + "&&" + aType + "&&" + aSelCount; QString aMeshInVTK = aClient + "&&" + aType + "&&" + aSelCount;
//------------------------------------------------- //-------------------------------------------------
@ -2951,59 +2939,59 @@ void SMESHGUI::initialize( CAM_Application* app )
popupMgr()->insert( action( 6003 ), anId, -1 ); // FREE_BORDER popupMgr()->insert( action( 6003 ), anId, -1 ); // FREE_BORDER
popupMgr()->setRule( action( 6003 ), aMeshInVtkHasEdges, true ); popupMgr()->setRule( action( 6003 ), aMeshInVtkHasEdges, true );
popupMgr()->setRule( action( 6003 ), "&& controlMode = 'eFreeEdges'", true ); popupMgr()->setRule( action( 6003 ), "controlMode = 'eFreeEdges'", false );
popupMgr()->insert( action( 6001 ), anId, -1 ); // LENGTH popupMgr()->insert( action( 6001 ), anId, -1 ); // LENGTH
popupMgr()->setRule( action( 6001 ), aMeshInVtkHasEdges, true ); popupMgr()->setRule( action( 6001 ), aMeshInVtkHasEdges, true );
popupMgr()->setRule( action( 6001 ), "&& controlMode = 'eLength'", true ); popupMgr()->setRule( action( 6001 ), "controlMode = 'eLength'", false );
popupMgr()->insert( action( 6004 ), anId, -1 ); // CONNECTION popupMgr()->insert( action( 6004 ), anId, -1 ); // CONNECTION
popupMgr()->setRule( action( 6004 ), aMeshInVtkHasEdges, true ); popupMgr()->setRule( action( 6004 ), aMeshInVtkHasEdges, true );
popupMgr()->setRule( action( 6004 ), "&& controlMode = 'eMultiConnection'", true ); popupMgr()->setRule( action( 6004 ), "controlMode = 'eMultiConnection'", false );
popupMgr()->insert( separator(), anId, -1 ); popupMgr()->insert( separator(), anId, -1 );
popupMgr()->insert( action( 6002 ), anId, -1 ); // FREE_EDGE popupMgr()->insert( action( 6002 ), anId, -1 ); // FREE_EDGE
popupMgr()->setRule( action( 6002 ), aMeshInVtkHasFaces, true ); popupMgr()->setRule( action( 6002 ), aMeshInVtkHasFaces, true );
popupMgr()->setRule( action( 6002 ), "&& controlMode = 'eFreeBorders'", true ); popupMgr()->setRule( action( 6002 ), "controlMode = 'eFreeBorders'", false );
popupMgr()->insert( action( 6018 ), anId, -1 ); // LENGTH_2D popupMgr()->insert( action( 6018 ), anId, -1 ); // LENGTH_2D
popupMgr()->setRule( action( 6018 ), aMeshInVtkHasFaces, true ); popupMgr()->setRule( action( 6018 ), aMeshInVtkHasFaces, true );
popupMgr()->setRule( action( 6018 ), "&& controlMode = 'eLength2D'", true ); popupMgr()->setRule( action( 6018 ), "controlMode = 'eLength2D'", false );
popupMgr()->insert( action( 6019 ), anId, -1 ); // CONNECTION_2D popupMgr()->insert( action( 6019 ), anId, -1 ); // CONNECTION_2D
popupMgr()->setRule( action( 6019 ), aMeshInVtkHasFaces, true ); popupMgr()->setRule( action( 6019 ), aMeshInVtkHasFaces, true );
popupMgr()->setRule( action( 6019 ), "&& controlMode = 'eMultiConnection2D'", true ); popupMgr()->setRule( action( 6019 ), "controlMode = 'eMultiConnection2D'", false );
popupMgr()->insert( action( 6011 ), anId, -1 ); // AREA popupMgr()->insert( action( 6011 ), anId, -1 ); // AREA
popupMgr()->setRule( action( 6011 ), aMeshInVtkHasFaces, true ); popupMgr()->setRule( action( 6011 ), aMeshInVtkHasFaces, true );
popupMgr()->setRule( action( 6011 ), "&& controlMode = 'eArea'", true ); popupMgr()->setRule( action( 6011 ), "controlMode = 'eArea'", false );
popupMgr()->insert( action( 6012 ), anId, -1 ); // TAPER popupMgr()->insert( action( 6012 ), anId, -1 ); // TAPER
popupMgr()->setRule( action( 6012 ), aMeshInVtkHasFaces, true ); popupMgr()->setRule( action( 6012 ), aMeshInVtkHasFaces, true );
popupMgr()->setRule( action( 6012 ), "&& controlMode = 'eTaper'", true ); popupMgr()->setRule( action( 6012 ), "controlMode = 'eTaper'", false );
popupMgr()->insert( action( 6013 ), anId, -1 ); // ASPECT popupMgr()->insert( action( 6013 ), anId, -1 ); // ASPECT
popupMgr()->setRule( action( 6013 ), aMeshInVtkHasFaces, true ); popupMgr()->setRule( action( 6013 ), aMeshInVtkHasFaces, true );
popupMgr()->setRule( action( 6013 ), "&& controlMode = 'eAspectRatio'", true ); popupMgr()->setRule( action( 6013 ), "controlMode = 'eAspectRatio'", false );
popupMgr()->insert( action( 6014 ), anId, -1 ); // MIN_ANG popupMgr()->insert( action( 6014 ), anId, -1 ); // MIN_ANG
popupMgr()->setRule( action( 6014 ), aMeshInVtkHasFaces, true ); popupMgr()->setRule( action( 6014 ), aMeshInVtkHasFaces, true );
popupMgr()->setRule( action( 6014 ), "&& controlMode = 'eMinimumAngle'", true ); popupMgr()->setRule( action( 6014 ), "controlMode = 'eMinimumAngle'", false );
popupMgr()->insert( action( 6015 ), anId, -1 ); // WRAP popupMgr()->insert( action( 6015 ), anId, -1 ); // WRAP
popupMgr()->setRule( action( 6015 ), aMeshInVtkHasFaces, true ); popupMgr()->setRule( action( 6015 ), aMeshInVtkHasFaces, true );
popupMgr()->setRule( action( 6015 ), "&& controlMode = 'eWarping'", true ); popupMgr()->setRule( action( 6015 ), "controlMode = 'eWarping'", false );
popupMgr()->insert( action( 6016 ), anId, -1 ); // SKEW popupMgr()->insert( action( 6016 ), anId, -1 ); // SKEW
popupMgr()->setRule( action( 6016 ), aMeshInVtkHasFaces, true ); popupMgr()->setRule( action( 6016 ), aMeshInVtkHasFaces, true );
popupMgr()->setRule( action( 6016 ), "&& controlMode = 'eSkew'", true ); popupMgr()->setRule( action( 6016 ), "controlMode = 'eSkew'", false );
popupMgr()->insert( separator(), anId, -1 ); popupMgr()->insert( separator(), anId, -1 );
popupMgr()->insert( action( 6017 ), anId, -1 ); // ASPECT_3D popupMgr()->insert( action( 6017 ), anId, -1 ); // ASPECT_3D
popupMgr()->setRule( action( 6017 ), aMeshInVtkHasVolumes, true ); popupMgr()->setRule( action( 6017 ), aMeshInVtkHasVolumes, true );
popupMgr()->setRule( action( 6017 ), "&& controlMode = 'eAspectRatio3D'", true ); popupMgr()->setRule( action( 6017 ), "controlMode = 'eAspectRatio3D'", false );
popupMgr()->insert( separator(), anId, -1 ); popupMgr()->insert( separator(), anId, -1 );
@ -3073,7 +3061,8 @@ QString SMESHGUI::engineIOR() const
void SMESHGUI::contextMenuPopup( const QString& client, QPopupMenu* menu, QString& /*title*/ ) void SMESHGUI::contextMenuPopup( const QString& client, QPopupMenu* menu, QString& /*title*/ )
{ {
SMESHGUI_Selection sel( client, selectionMgr() ); SMESHGUI_Selection sel;
sel.init( client, selectionMgr() );
popupMgr()->updatePopup( menu, &sel ); popupMgr()->updatePopup( menu, &sel );
} }

View File

@ -38,10 +38,12 @@
#include "SalomeApp_Study.h" #include "SalomeApp_Study.h"
#include "SalomeApp_SelectionMgr.h" #include "SalomeApp_SelectionMgr.h"
#include "SVTK_Selection.h"
#include "SALOME_ListIO.hxx" #include "SALOME_ListIO.hxx"
#include "SALOME_ListIteratorOfListIO.hxx" #include "SALOME_ListIteratorOfListIO.hxx"
#include "SVTK_Selection.h"
#include "SVTK_ViewWindow.h"
// QT Includes // QT Includes
#include <qframe.h> #include <qframe.h>
#include <qlayout.h> #include <qlayout.h>
@ -68,10 +70,14 @@
// function : SMESHGUI_DeleteGroupDlg() // function : SMESHGUI_DeleteGroupDlg()
// purpose : Constructor // purpose : Constructor
//================================================================================= //=================================================================================
SMESHGUI_DeleteGroupDlg::SMESHGUI_DeleteGroupDlg (QWidget* theParent, SMESHGUI_DeleteGroupDlg::SMESHGUI_DeleteGroupDlg (SMESHGUI* theModule):
SalomeApp_SelectionMgr* theSelection) QDialog(SMESH::GetDesktop(theModule),
: QDialog(theParent, "SMESHGUI_DeleteGroupDlg", false, "SMESHGUI_DeleteGroupDlg",
WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) false,
WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
mySelectionMgr(SMESH::GetSelectionMgr(theModule)),
myViewWindow(SMESH::GetViewWindow(mySMESHGUI)),
mySMESHGUI(theModule)
{ {
setCaption(tr("CAPTION")); setCaption(tr("CAPTION"));
@ -85,7 +91,7 @@ SMESHGUI_DeleteGroupDlg::SMESHGUI_DeleteGroupDlg (QWidget* theParent,
aDlgLay->setStretchFactor(aMainFrame, 1); aDlgLay->setStretchFactor(aMainFrame, 1);
Init(theSelection); Init();
} }
//================================================================================= //=================================================================================
@ -147,30 +153,24 @@ SMESHGUI_DeleteGroupDlg::~SMESHGUI_DeleteGroupDlg()
// function : Init() // function : Init()
// purpose : Init dialog fields, connect signals and slots, show dialog // purpose : Init dialog fields, connect signals and slots, show dialog
//================================================================================= //=================================================================================
void SMESHGUI_DeleteGroupDlg::Init (SalomeApp_SelectionMgr* theSelection) void SMESHGUI_DeleteGroupDlg::Init ()
{ {
myBlockSelection = false; myBlockSelection = false;
mySelectionMgr = theSelection; mySMESHGUI->SetActiveDialogBox((QDialog*)this);
SMESHGUI* aSMESHGUI = SMESHGUI::GetSMESHGUI();
aSMESHGUI->SetActiveDialogBox((QDialog*)this);
// selection and SMESHGUI // selection and SMESHGUI
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionDone())); connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionDone()));
connect(aSMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), SLOT(onDeactivate())); connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), SLOT(onDeactivate()));
connect(aSMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(onClose())); connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(onClose()));
int x, y; int x, y;
aSMESHGUI->DefineDlgPosition(this, x, y); mySMESHGUI->DefineDlgPosition(this, x, y);
this->move(x, y); this->move(x, y);
this->show(); this->show();
// set selection mode // set selection mode
#ifdef NEW_GUI
mySelectionMgr->setSelectionModes(ActorSelection, true);
#else
mySelectionMgr->setSelectionModes(ActorSelection);
#endif
mySelectionMgr->installFilter(new SMESH_TypeFilter(GROUP)); mySelectionMgr->installFilter(new SMESH_TypeFilter(GROUP));
myViewWindow->SetSelectionMode(ActorSelection);
onSelectionDone(); onSelectionDone();
return; return;
@ -188,7 +188,7 @@ bool SMESHGUI_DeleteGroupDlg::isValid()
return false; return false;
} }
return !SMESHGUI::GetSMESHGUI()->isActiveStudyLocked(); return !mySMESHGUI->isActiveStudyLocked();
} }
//================================================================================= //=================================================================================
@ -213,7 +213,7 @@ bool SMESHGUI_DeleteGroupDlg::onApply()
myListGrp.clear(); myListGrp.clear();
mySelectionMgr->clearSelected(); mySelectionMgr->clearSelected();
SMESH::UpdateView(); SMESH::UpdateView();
SMESHGUI::GetSMESHGUI()->updateObjBrowser(true); mySMESHGUI->updateObjBrowser(true);
myBlockSelection = false; myBlockSelection = false;
return true; return true;
@ -235,10 +235,10 @@ void SMESHGUI_DeleteGroupDlg::onOk()
//================================================================================= //=================================================================================
void SMESHGUI_DeleteGroupDlg::onClose() void SMESHGUI_DeleteGroupDlg::onClose()
{ {
mySelectionMgr->setSelectionModes(ActorSelection); myViewWindow->SetSelectionMode(ActorSelection);
disconnect(mySelectionMgr, 0, this, 0); disconnect(mySelectionMgr, 0, this, 0);
disconnect(SMESHGUI::GetSMESHGUI(), 0, this, 0); disconnect(mySMESHGUI, 0, this, 0);
SMESHGUI::GetSMESHGUI()->ResetState(); mySMESHGUI->ResetState();
mySelectionMgr->clearFilters(); mySelectionMgr->clearFilters();
reject(); reject();
} }
@ -287,13 +287,9 @@ void SMESHGUI_DeleteGroupDlg::onDeactivate()
//================================================================================= //=================================================================================
void SMESHGUI_DeleteGroupDlg::enterEvent (QEvent*) void SMESHGUI_DeleteGroupDlg::enterEvent (QEvent*)
{ {
SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog(); mySMESHGUI->EmitSignalDeactivateDialog();
setEnabled(true); setEnabled(true);
#ifdef NEW_GUI myViewWindow->SetSelectionMode(ActorSelection);
mySelectionMgr->setSelectionModes(ActorSelection, true);
#else
mySelectionMgr->setSelectionModes(ActorSelection);
#endif
mySelectionMgr->installFilter(new SMESH_TypeFilter (GROUP)); mySelectionMgr->installFilter(new SMESH_TypeFilter (GROUP));
} }

View File

@ -36,9 +36,12 @@
class QCloseEvent; class QCloseEvent;
class QFrame; class QFrame;
class QPushButton; class QPushButton;
class SalomeApp_SelectionMgr;
class QListBox; class QListBox;
class SMESHGUI;
class SVTK_ViewWindow;
class SalomeApp_SelectionMgr;
/*! /*!
* Class : SMESHGUI_DeleteGroupDlg * Class : SMESHGUI_DeleteGroupDlg
* Description : Delete groups and their contents * Description : Delete groups and their contents
@ -49,11 +52,10 @@ class SMESHGUI_DeleteGroupDlg : public QDialog
Q_OBJECT Q_OBJECT
public: public:
SMESHGUI_DeleteGroupDlg (QWidget*, SMESHGUI_DeleteGroupDlg (SMESHGUI* theModule);
SalomeApp_SelectionMgr*);
virtual ~SMESHGUI_DeleteGroupDlg(); virtual ~SMESHGUI_DeleteGroupDlg();
void Init (SalomeApp_SelectionMgr*); void Init ();
private: private:
@ -82,6 +84,9 @@ private:
QPushButton* myApplyBtn; QPushButton* myApplyBtn;
QPushButton* myCloseBtn; QPushButton* myCloseBtn;
QListBox* myListBox; QListBox* myListBox;
SMESHGUI* mySMESHGUI;
SVTK_ViewWindow* myViewWindow;
SalomeApp_SelectionMgr* mySelectionMgr; SalomeApp_SelectionMgr* mySelectionMgr;
QValueList<SMESH::SMESH_GroupBase_var> myListGrp; QValueList<SMESH::SMESH_GroupBase_var> myListGrp;

View File

@ -396,7 +396,7 @@ void SMESHGUI_FilterTable::Table::insertRows (int row, int count)
if (anEditRow >= 0 && anEditCol >= 0) if (anEditRow >= 0 && anEditCol >= 0)
endEdit(anEditRow, anEditCol, true, false); endEdit(anEditRow, anEditCol, true, false);
QTable::insertRows(row, count); QTable::insertRows( row, count );
} }
//======================================================================= //=======================================================================
@ -427,9 +427,12 @@ QString SMESHGUI_FilterTable::Table::text (int row, int col) const
// name : SMESHGUI_FilterTable::SMESHGUI_FilterTable // name : SMESHGUI_FilterTable::SMESHGUI_FilterTable
// Purpose : Constructor // Purpose : Constructor
//======================================================================= //=======================================================================
SMESHGUI_FilterTable::SMESHGUI_FilterTable (QWidget* parent, SMESHGUI_FilterTable::SMESHGUI_FilterTable( SMESHGUI* theModule,
QWidget* parent,
const int type) const int type)
: QFrame(parent) : QFrame(parent),
myIsLocked( false ),
mySMESHGUI( theModule )
{ {
myEntityType = -1; myEntityType = -1;
Init(type); Init(type);
@ -439,9 +442,12 @@ SMESHGUI_FilterTable::SMESHGUI_FilterTable (QWidget* parent,
// name : SMESHGUI_FilterTable::SMESHGUI_FilterTable // name : SMESHGUI_FilterTable::SMESHGUI_FilterTable
// Purpose : Constructor // Purpose : Constructor
//======================================================================= //=======================================================================
SMESHGUI_FilterTable::SMESHGUI_FilterTable (QWidget* parent, SMESHGUI_FilterTable::SMESHGUI_FilterTable( SMESHGUI* theModule,
QWidget* parent,
const QValueList<int>& types) const QValueList<int>& types)
: QFrame(parent) : QFrame(parent),
myIsLocked( false ),
mySMESHGUI( theModule )
{ {
myEntityType = -1; myEntityType = -1;
Init(types); Init(types);
@ -842,7 +848,7 @@ void SMESHGUI_FilterTable::SetCriterion (const int theRow,
myAddWidgets[ anItem ]->SetDouble(AdditionalWidget::Tolerance, theCriterion.Tolerance); myAddWidgets[ anItem ]->SetDouble(AdditionalWidget::Tolerance, theCriterion.Tolerance);
} }
emit CretarionChanged(theRow, aType); emit CriterionChanged(theRow, aType);
} }
@ -1033,7 +1039,8 @@ void SMESHGUI_FilterTable::onClearBtn()
//======================================================================= //=======================================================================
void SMESHGUI_FilterTable::onCurrentChanged (int theRow, int theCol) void SMESHGUI_FilterTable::onCurrentChanged (int theRow, int theCol)
{ {
updateAdditionalWidget(); if( !myIsLocked )
updateAdditionalWidget();
emit CurrentChanged(theRow, theCol); emit CurrentChanged(theRow, theCol);
} }
@ -1087,7 +1094,7 @@ void SMESHGUI_FilterTable::onCriterionChanged (const int row, const int col, con
updateAdditionalWidget(); updateAdditionalWidget();
emit CretarionChanged(row, entityType); emit CriterionChanged(row, entityType);
} }
//======================================================================= //=======================================================================
@ -1125,6 +1132,7 @@ void SMESHGUI_FilterTable::addRow (Table* theTable, const int theType, const boo
int aSelectedRow = getFirstSelectedRow(); int aSelectedRow = getFirstSelectedRow();
int aCurrCol = theTable->currentColumn(); int aCurrCol = theTable->currentColumn();
myIsLocked = true;
if (toTheEnd || aSelectedRow == -1) if (toTheEnd || aSelectedRow == -1)
{ {
theTable->insertRows(theTable->numRows()); theTable->insertRows(theTable->numRows());
@ -1135,6 +1143,7 @@ void SMESHGUI_FilterTable::addRow (Table* theTable, const int theType, const boo
theTable->insertRows(aSelectedRow); theTable->insertRows(aSelectedRow);
aCurrRow = aSelectedRow; aCurrRow = aSelectedRow;
} }
myIsLocked = false;
// Criteria // Criteria
theTable->setItem(aCurrRow, 0, getCriterionItem(theTable, theType)); theTable->setItem(aCurrRow, 0, getCriterionItem(theTable, theType));
@ -1490,7 +1499,7 @@ void SMESHGUI_FilterTable::onCopyFromBtn()
{ {
if (myLibDlg == 0) if (myLibDlg == 0)
myLibDlg = new SMESHGUI_FilterLibraryDlg( myLibDlg = new SMESHGUI_FilterLibraryDlg(
this, GetType(), SMESHGUI_FilterLibraryDlg::COPY_FROM); mySMESHGUI, this, GetType(), SMESHGUI_FilterLibraryDlg::COPY_FROM);
else else
myLibDlg->Init(GetType(), SMESHGUI_FilterLibraryDlg::COPY_FROM); myLibDlg->Init(GetType(), SMESHGUI_FilterLibraryDlg::COPY_FROM);
@ -1512,7 +1521,7 @@ void SMESHGUI_FilterTable::onAddToBtn()
return; return;
if (myLibDlg == 0) if (myLibDlg == 0)
myLibDlg = new SMESHGUI_FilterLibraryDlg( myLibDlg = new SMESHGUI_FilterLibraryDlg(
this, GetType(), SMESHGUI_FilterLibraryDlg::ADD_TO); mySMESHGUI, this, GetType(), SMESHGUI_FilterLibraryDlg::ADD_TO);
else else
myLibDlg->Init(GetType(), SMESHGUI_FilterLibraryDlg::ADD_TO); myLibDlg->Init(GetType(), SMESHGUI_FilterLibraryDlg::ADD_TO);
@ -1612,10 +1621,10 @@ SMESHGUI_FilterDlg::SMESHGUI_FilterDlg( SMESHGUI* theModule,
: QDialog( SMESH::GetDesktop( theModule ), theName, false, : QDialog( SMESH::GetDesktop( theModule ), theName, false,
WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
mySMESHGUI( theModule ), mySMESHGUI( theModule ),
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ), mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
myViewWindow( SMESH::GetViewWindow( theModule ) ),
mySelector( myViewWindow->GetSelector() )
{ {
myViewWindow = SMESH::GetViewWindow( theModule );
mySelector = myViewWindow->GetSelector();
QValueList<int> aTypes; QValueList<int> aTypes;
aTypes.append(theType); aTypes.append(theType);
construct(aTypes); construct(aTypes);
@ -1656,7 +1665,7 @@ QFrame* SMESHGUI_FilterDlg::createMainFrame (QWidget* theParent)
// filter frame // filter frame
myTable = new SMESHGUI_FilterTable(aMainFrame, myTypes); myTable = new SMESHGUI_FilterTable( mySMESHGUI, aMainFrame, myTypes );
myTable->SetLibsEnabled(true); myTable->SetLibsEnabled(true);
QFrame* aLine = new QFrame(myTable->GetTableGrp()); QFrame* aLine = new QFrame(myTable->GetTableGrp());
@ -1668,7 +1677,7 @@ QFrame* SMESHGUI_FilterDlg::createMainFrame (QWidget* theParent)
// other controls // other controls
mySourceGrp = createSourceGroup(aMainFrame); mySourceGrp = createSourceGroup(aMainFrame);
connect(myTable, SIGNAL(CretarionChanged(const int, const int)), connect(myTable, SIGNAL(CriterionChanged(const int, const int)),
SLOT(onCriterionChanged(const int, const int))); SLOT(onCriterionChanged(const int, const int)));
connect(myTable, SIGNAL(CurrentChanged(int, int)), connect(myTable, SIGNAL(CurrentChanged(int, int)),
@ -2494,7 +2503,7 @@ void SMESHGUI_FilterDlg::updateSelection()
if (myTable->GetCriterionType(aRow) == FT_BelongToGeom || if (myTable->GetCriterionType(aRow) == FT_BelongToGeom ||
myTable->GetCriterionType(aRow) == FT_LyingOnGeom) { myTable->GetCriterionType(aRow) == FT_LyingOnGeom) {
mySelectionMgr->installFilter(new SMESH_NumberFilter("GEOM",TopAbs_SHAPE,0,allTypes)); mySelectionMgr->installFilter(new GEOM_SelectionFilter( aStudy, true ));
} else if (myTable->GetCriterionType(aRow) == FT_BelongToPlane) { } else if (myTable->GetCriterionType(aRow) == FT_BelongToPlane) {
mySelectionMgr->installFilter(new GEOM_FaceFilter( aStudy, StdSelect_Plane ) ); mySelectionMgr->installFilter(new GEOM_FaceFilter( aStudy, StdSelect_Plane ) );
@ -2506,7 +2515,7 @@ void SMESHGUI_FilterDlg::updateSelection()
} else { } else {
if (myIsSelectionChanged) { if (myIsSelectionChanged) {
mySelectionMgr->installFilter(new SMESH_NumberFilter ("This filter deactivates selection",TopAbs_SHAPE,0,allTypes)); mySelectionMgr->installFilter( new GEOM_TypeFilter( aStudy, -1 ) ); // This filter deactivates selection
} }
} }
} }

View File

@ -81,9 +81,11 @@ class SMESHGUI_FilterTable : public QFrame
typedef QMap<int, Table*> TableMap; typedef QMap<int, Table*> TableMap;
public: public:
SMESHGUI_FilterTable (QWidget* parent, SMESHGUI_FilterTable( SMESHGUI*,
QWidget* parent,
const int type); const int type);
SMESHGUI_FilterTable (QWidget* parent, SMESHGUI_FilterTable( SMESHGUI*,
QWidget* parent,
const QValueList<int>& type); const QValueList<int>& type);
virtual ~SMESHGUI_FilterTable(); virtual ~SMESHGUI_FilterTable();
@ -136,7 +138,7 @@ signals:
void AddToClicked(); void AddToClicked();
void EntityTypeChanged (const int); void EntityTypeChanged (const int);
void NeedValidation(); void NeedValidation();
void CretarionChanged (const int theRow, const int theEntityType); void CriterionChanged (const int theRow, const int theEntityType);
void CurrentChanged (int, int); void CurrentChanged (int, int);
private slots: private slots:
@ -172,6 +174,7 @@ private:
const QMap<int, QString>& getSupportedTypes() const; const QMap<int, QString>& getSupportedTypes() const;
private: private:
SMESHGUI* mySMESHGUI;
QGroupBox* myTableGrp; QGroupBox* myTableGrp;
QGroupBox* mySwitchTableGrp; QGroupBox* mySwitchTableGrp;
@ -187,6 +190,7 @@ private:
QButtonGroup* myEntityTypeGrp; QButtonGroup* myEntityTypeGrp;
int myEntityType; int myEntityType;
int myIsValid; int myIsValid;
bool myIsLocked;
SMESHGUI_FilterLibraryDlg* myLibDlg; SMESHGUI_FilterLibraryDlg* myLibDlg;

View File

@ -79,10 +79,8 @@ SMESHGUI_FilterLibraryDlg::Dialog::~Dialog()
bool SMESHGUI_FilterLibraryDlg::Dialog::acceptData() bool SMESHGUI_FilterLibraryDlg::Dialog::acceptData()
{ {
#ifdef NEW_GUI // if (mode() != QFileDialogP::AnyFile)
if (mode() != QFileDialogP::AnyFile) // return SUIT_FileDlg::acceptData();
return SUIT_FileDlg::acceptData();
#endif
return true; return true;
} }
@ -96,12 +94,14 @@ bool SMESHGUI_FilterLibraryDlg::Dialog::acceptData()
// name : SMESHGUI_FilterLibraryDlg::SMESHGUI_FilterLibraryDlg // name : SMESHGUI_FilterLibraryDlg::SMESHGUI_FilterLibraryDlg
// Purpose : Constructor // Purpose : Constructor
//======================================================================= //=======================================================================
SMESHGUI_FilterLibraryDlg::SMESHGUI_FilterLibraryDlg (QWidget* theParent, SMESHGUI_FilterLibraryDlg::SMESHGUI_FilterLibraryDlg (SMESHGUI* theModule,
QWidget* parent,
const QValueList<int>& theTypes, const QValueList<int>& theTypes,
const int theMode, const int theMode,
const char* theName) const char* theName)
: QDialog(theParent, theName, true, WStyle_Customize | : QDialog( parent, theName, true, WStyle_Customize |
WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ),
mySMESHGUI( theModule )
{ {
construct(theTypes, theMode); construct(theTypes, theMode);
} }
@ -110,12 +110,14 @@ SMESHGUI_FilterLibraryDlg::SMESHGUI_FilterLibraryDlg (QWidget* the
// name : SMESHGUI_FilterLibraryDlg::SMESHGUI_FilterLibraryDlg // name : SMESHGUI_FilterLibraryDlg::SMESHGUI_FilterLibraryDlg
// Purpose : Constructor // Purpose : Constructor
//======================================================================= //=======================================================================
SMESHGUI_FilterLibraryDlg::SMESHGUI_FilterLibraryDlg (QWidget* theParent, SMESHGUI_FilterLibraryDlg::SMESHGUI_FilterLibraryDlg (SMESHGUI* theModule,
QWidget* parent,
const int theType, const int theType,
const int theMode, const int theMode,
const char* theName) const char* theName)
: QDialog(theParent, theName, true, WStyle_Customize | : QDialog( parent, theName, true, WStyle_Customize |
WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ),
mySMESHGUI( theModule )
{ {
QValueList<int> aTypes; QValueList<int> aTypes;
aTypes.append(theType); aTypes.append(theType);
@ -192,7 +194,7 @@ QFrame* SMESHGUI_FilterLibraryDlg::createMainFrame (QWidget* theParent)
// table // table
myTable = new SMESHGUI_FilterTable(aMainFrame, myTypes); myTable = new SMESHGUI_FilterTable( mySMESHGUI, aMainFrame, myTypes);
myTable->SetEditable(myMode == EDIT); myTable->SetEditable(myMode == EDIT);
myTable->SetLibsEnabled(false); myTable->SetLibsEnabled(false);
@ -312,10 +314,8 @@ void SMESHGUI_FilterLibraryDlg::Init (const QValueList<int>& theTypes,
updateControlsVisibility(); updateControlsVisibility();
setEnabled(true); setEnabled(true);
SMESHGUI* aModeler = SMESHGUI::GetSMESHGUI(); connect( mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), SLOT(onDeactivate()));
connect( mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(onClose()));
connect(aModeler, SIGNAL(SignalDeactivateActiveDialog()), SLOT(onDeactivate()));
connect(aModeler, SIGNAL(SignalCloseAllDialogs()), SLOT(onClose()));
if (myMode == ADD_TO) if (myMode == ADD_TO)
{ {
@ -344,7 +344,7 @@ void SMESHGUI_FilterLibraryDlg::Init (const QValueList<int>& theTypes,
} }
int x, y; int x, y;
aModeler->DefineDlgPosition(this, x, y); mySMESHGUI->DefineDlgPosition(this, x, y);
this->move(x, y); this->move(x, y);
this->show(); this->show();
@ -448,8 +448,8 @@ void SMESHGUI_FilterLibraryDlg::onOk()
{ {
if (onApply()) if (onApply())
{ {
disconnect(SMESHGUI::GetSMESHGUI(), 0, this, 0); disconnect( mySMESHGUI, 0, this, 0);
SMESHGUI::GetSMESHGUI()->ResetState(); mySMESHGUI->ResetState();
accept(); accept();
} }
} }
@ -460,8 +460,8 @@ void SMESHGUI_FilterLibraryDlg::onOk()
//======================================================================= //=======================================================================
void SMESHGUI_FilterLibraryDlg::onClose() void SMESHGUI_FilterLibraryDlg::onClose()
{ {
disconnect(SMESHGUI::GetSMESHGUI(), 0, this, 0); disconnect( mySMESHGUI, 0, this, 0);
SMESHGUI::GetSMESHGUI()->ResetState(); mySMESHGUI->ResetState();
reject(); reject();
} }

View File

@ -64,12 +64,14 @@ public:
public: public:
SMESHGUI_FilterLibraryDlg( QWidget* parent, SMESHGUI_FilterLibraryDlg( SMESHGUI*,
QWidget*,
const QValueList<int>& types, const QValueList<int>& types,
const int mode, const int mode,
const char* name = 0 ); const char* name = 0 );
SMESHGUI_FilterLibraryDlg( QWidget* parent, SMESHGUI_FilterLibraryDlg( SMESHGUI*,
QWidget*,
const int type, const int type,
const int mode, const int mode,
const char* name = 0 ); const char* name = 0 );
@ -141,6 +143,7 @@ private:
QPushButton* myDeleteBtn; QPushButton* myDeleteBtn;
QGroupBox* myNameGrp; QGroupBox* myNameGrp;
QLineEdit* myName; QLineEdit* myName;
SMESHGUI* mySMESHGUI;
QValueList<int> myTypes; QValueList<int> myTypes;
int myMode; int myMode;

View File

@ -26,6 +26,10 @@ namespace SMESH
{ {
SMESH::FilterManager_var GetFilterManager() SMESH::FilterManager_var GetFilterManager()
{ {
return SMESHGUI::GetSMESHGen()->CreateFilterManager(); // DumpPython static SMESH::FilterManager_var aFilterManager;
if (CORBA::is_nil(aFilterManager)){
aFilterManager = SMESHGUI::GetSMESHGen()->CreateFilterManager();
}
return aFilterManager;
} }
} }

View File

@ -90,7 +90,8 @@ SMESHGUI_GroupDlg::SMESHGUI_GroupDlg( SMESHGUI* theModule, const char* name,
mySMESHGUI( theModule ), mySMESHGUI( theModule ),
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ), mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
myViewWindow( SMESH::GetViewWindow( theModule ) ), myViewWindow( SMESH::GetViewWindow( theModule ) ),
mySelector( myViewWindow->GetSelector() ) mySelector( myViewWindow->GetSelector() ),
myIsBusy( false )
{ {
if (!name) setName("SMESHGUI_GroupDlg"); if (!name) setName("SMESHGUI_GroupDlg");
initDialog(true); initDialog(true);
@ -120,7 +121,8 @@ SMESHGUI_GroupDlg::SMESHGUI_GroupDlg( SMESHGUI* theModule, const char* name,
mySMESHGUI( theModule ), mySMESHGUI( theModule ),
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ), mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
myViewWindow( SMESH::GetViewWindow( theModule ) ), myViewWindow( SMESH::GetViewWindow( theModule ) ),
mySelector( myViewWindow->GetSelector() ) mySelector( myViewWindow->GetSelector() ),
myIsBusy( false )
{ {
if (!name) setName("SMESHGUI_GroupDlg"); if (!name) setName("SMESHGUI_GroupDlg");
initDialog(false); initDialog(false);
@ -396,6 +398,8 @@ SMESHGUI_GroupDlg::~SMESHGUI_GroupDlg()
//================================================================================= //=================================================================================
void SMESHGUI_GroupDlg::init (SMESH::SMESH_Mesh_ptr theMesh) void SMESHGUI_GroupDlg::init (SMESH::SMESH_Mesh_ptr theMesh)
{ {
mySelectionMgr->installFilter(myMeshFilter);
/* init data from current selection */ /* init data from current selection */
myMesh = SMESH::SMESH_Mesh::_duplicate(theMesh); myMesh = SMESH::SMESH_Mesh::_duplicate(theMesh);
myGroup = SMESH::SMESH_Group::_nil(); myGroup = SMESH::SMESH_Group::_nil();
@ -403,11 +407,14 @@ void SMESHGUI_GroupDlg::init (SMESH::SMESH_Mesh_ptr theMesh)
myActor = SMESH::FindActorByObject(myMesh); myActor = SMESH::FindActorByObject(myMesh);
SMESH::SetPickable(myActor); SMESH::SetPickable(myActor);
const SALOME_ListIO& aList = mySelector->StoredIObjects(); SALOME_ListIO aList;
mySelectionMgr->selectedObjects( aList );
QString aName = aList.First()->getName(); if( !aList.IsEmpty() )
myMeshGroupLine->setText(aName) ; {
myMeshGroupLine->home( false ); QString aName = aList.First()->getName();
myMeshGroupLine->setText(aName) ;
myMeshGroupLine->home( false );
}
myCurrentLineEdit = 0; myCurrentLineEdit = 0;
@ -675,7 +682,6 @@ void SMESHGUI_GroupDlg::onOK()
onClose(); onClose();
} }
static bool busy = false;
//================================================================================= //=================================================================================
// function : onListSelectionChanged() // function : onListSelectionChanged()
// purpose : Called when selection in element list is changed // purpose : Called when selection in element list is changed
@ -683,8 +689,8 @@ static bool busy = false;
void SMESHGUI_GroupDlg::onListSelectionChanged() void SMESHGUI_GroupDlg::onListSelectionChanged()
{ {
// MESSAGE("SMESHGUI_GroupDlg::onListSelectionChanged(); myActor = " << myActor); // MESSAGE("SMESHGUI_GroupDlg::onListSelectionChanged(); myActor = " << myActor);
if (busy || !myActor) return; if( myIsBusy || !myActor) return;
busy = true; myIsBusy = true;
if (myCurrentLineEdit == 0) { if (myCurrentLineEdit == 0) {
mySelectionMgr->clearSelected(); mySelectionMgr->clearSelected();
@ -702,7 +708,7 @@ void SMESHGUI_GroupDlg::onListSelectionChanged()
mySelectionMgr->setSelectedObjects(aList,false); mySelectionMgr->setSelectedObjects(aList,false);
myViewWindow->highlight( myActor->getIO(), true, true ); myViewWindow->highlight( myActor->getIO(), true, true );
} }
busy = false; myIsBusy = false;
} }
//================================================================================= //=================================================================================
@ -711,11 +717,12 @@ void SMESHGUI_GroupDlg::onListSelectionChanged()
//================================================================================= //=================================================================================
void SMESHGUI_GroupDlg::onObjectSelectionChanged() void SMESHGUI_GroupDlg::onObjectSelectionChanged()
{ {
if (busy || !isEnabled()) return; if ( myIsBusy || !isEnabled()) return;
busy = true; myIsBusy = true;
const SALOME_ListIO& aList = mySelector->StoredIObjects();
SALOME_ListIO aList;
mySelectionMgr->selectedObjects( aList );
int aNbSel = aList.Extent(); int aNbSel = aList.Extent();
myElements->clearSelection(); myElements->clearSelection();
@ -737,10 +744,10 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged()
myElements->clear(); myElements->clear();
if (aNbSel != 1) { if (aNbSel == 0 ) {
myGroup = SMESH::SMESH_Group::_nil(); myGroup = SMESH::SMESH_Group::_nil();
myMesh = SMESH::SMESH_Mesh::_nil(); myMesh = SMESH::SMESH_Mesh::_nil();
busy = false; myIsBusy = false;
return; return;
} }
Handle(SALOME_InteractiveObject) IO = aList.First(); Handle(SALOME_InteractiveObject) IO = aList.First();
@ -749,7 +756,7 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged()
myMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO); myMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO);
if (myMesh->_is_nil()) if (myMesh->_is_nil())
{ {
busy = false; myIsBusy = false;
return; return;
} }
myGroup = SMESH::SMESH_Group::_nil(); myGroup = SMESH::SMESH_Group::_nil();
@ -770,25 +777,22 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged()
SMESH::SMESH_Group_var aGroup = SMESH::IObjectToInterface<SMESH::SMESH_Group>(IO); SMESH::SMESH_Group_var aGroup = SMESH::IObjectToInterface<SMESH::SMESH_Group>(IO);
if (aGroup->_is_nil()) if (aGroup->_is_nil())
{ {
busy = false; myIsBusy = false;
return; return;
} }
busy = false; myIsBusy = false;
myCurrentLineEdit = 0; myCurrentLineEdit = 0;
init(aGroup); init(aGroup);
busy = true; myIsBusy = true;
mySelectSubMesh->setEnabled(true); mySelectSubMesh->setEnabled(true);
mySelectGroup->setEnabled(true); mySelectGroup->setEnabled(true);
myGeomGroupBtn->setEnabled(true); myGeomGroupBtn->setEnabled(true);
myGeomGroupLine->setEnabled(true); myGeomGroupLine->setEnabled(true);
} }
myCurrentLineEdit = 0; myCurrentLineEdit = 0;
busy = false; myIsBusy = false;
if (!myCreate) if (!myCreate)
{
busy = false;
return; return;
}
if (myTypeId == -1) if (myTypeId == -1)
onTypeChanged(0); onTypeChanged(0);
@ -797,13 +801,13 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged()
setSelectionMode(myTypeId); setSelectionMode(myTypeId);
} }
busy = false; myIsBusy = false;
return; return;
} else if (myCurrentLineEdit == myGeomGroupLine) { } else if (myCurrentLineEdit == myGeomGroupLine) {
if (aNbSel != 1) { if (aNbSel == 0) {
myGeomGroup = GEOM::GEOM_Object::_nil(); myGeomGroup = GEOM::GEOM_Object::_nil();
busy = false; myIsBusy = false;
return; return;
} }
@ -813,7 +817,7 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged()
// Check if the object is a geometry group // Check if the object is a geometry group
if (!testResult || CORBA::is_nil(myGeomGroup)) { if (!testResult || CORBA::is_nil(myGeomGroup)) {
myGeomGroup = GEOM::GEOM_Object::_nil(); myGeomGroup = GEOM::GEOM_Object::_nil();
busy = false; myIsBusy = false;
return; return;
} }
// Check if group constructed on the same shape as a mesh or on its child // Check if group constructed on the same shape as a mesh or on its child
@ -835,7 +839,7 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged()
_PTR(SObject) aMeshSO = SMESH::FindSObject(myMesh); _PTR(SObject) aMeshSO = SMESH::FindSObject(myMesh);
if (!aMeshSO) { if (!aMeshSO) {
myGeomGroup = GEOM::GEOM_Object::_nil(); myGeomGroup = GEOM::GEOM_Object::_nil();
busy = false; myIsBusy = false;
return; return;
} }
_PTR(SObject) anObj, aRef; _PTR(SObject) anObj, aRef;
@ -859,16 +863,16 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged()
} }
if (!isRefOrSubShape) { if (!isRefOrSubShape) {
myGeomGroup = GEOM::GEOM_Object::_nil(); myGeomGroup = GEOM::GEOM_Object::_nil();
busy = false; myIsBusy = false;
return; return;
} }
} }
if (aNbSel >= 1) { if(aNbSel >= 1) {
if (aNbSel > 1) { if(aNbSel > 1) {
if (myCurrentLineEdit == mySubMeshLine) if(myCurrentLineEdit == mySubMeshLine)
aString = tr("SMESH_SUBMESH_SELECTED").arg(aNbSel); aString = tr("SMESH_SUBMESH_SELECTED").arg(aNbSel);
else if (myCurrentLineEdit == myGroupLine || myCurrentLineEdit == myGeomGroupLine) else if(myCurrentLineEdit == myGroupLine || myCurrentLineEdit == myGeomGroupLine)
aString = tr("SMESH_GROUP_SELECTED").arg(aNbSel); aString = tr("SMESH_GROUP_SELECTED").arg(aNbSel);
} else { } else {
aString = aList.First()->getName(); aString = aList.First()->getName();
@ -907,7 +911,7 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged()
myActor = SMESH::FindActorByObject(myMesh); myActor = SMESH::FindActorByObject(myMesh);
} }
busy = false; myIsBusy = false;
} }
//================================================================================= //=================================================================================
@ -1070,12 +1074,14 @@ void SMESHGUI_GroupDlg::onFilterAccepted()
//================================================================================= //=================================================================================
void SMESHGUI_GroupDlg::onAdd() void SMESHGUI_GroupDlg::onAdd()
{ {
const SALOME_ListIO& aList = mySelector->StoredIObjects(); SALOME_ListIO aList;
mySelectionMgr->selectedObjects( aList );
int aNbSel = aList.Extent(); int aNbSel = aList.Extent();
if (aNbSel == 0 || !myActor || myMesh->_is_nil()) return; if (aNbSel == 0 || !myActor || myMesh->_is_nil()) return;
busy = true; myIsBusy = true;
SMESH::ElementType aType = SMESH::ALL; SMESH::ElementType aType = SMESH::ALL;
switch(myTypeId) { switch(myTypeId) {
@ -1086,7 +1092,7 @@ void SMESHGUI_GroupDlg::onAdd()
} }
if (myCurrentLineEdit == 0) { if (myCurrentLineEdit == 0) {
//if (aNbSel != 1) { busy = false; return; } //if (aNbSel != 1) { myIsBusy = false; return; }
QString aListStr = ""; QString aListStr = "";
int aNbItems = 0; int aNbItems = 0;
if (myTypeId == 0) { if (myTypeId == 0) {
@ -1109,7 +1115,10 @@ void SMESHGUI_GroupDlg::onAdd()
} }
} else if (myCurrentLineEdit == mySubMeshLine) { } else if (myCurrentLineEdit == mySubMeshLine) {
//SALOME_ListIteratorOfListIO anIt (mySelectionMgr->StoredIObjects()); //SALOME_ListIteratorOfListIO anIt (mySelectionMgr->StoredIObjects());
const SALOME_ListIO& aList = mySelector->StoredIObjects();
SALOME_ListIO aList;
mySelectionMgr->selectedObjects( aList );
SALOME_ListIteratorOfListIO anIt (aList); SALOME_ListIteratorOfListIO anIt (aList);
for (; anIt.More(); anIt.Next()) { for (; anIt.More(); anIt.Next()) {
SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh_var aSubMesh =
@ -1138,12 +1147,14 @@ void SMESHGUI_GroupDlg::onAdd()
} }
} }
mySelectSubMesh->setChecked(false); mySelectSubMesh->setChecked(false);
busy = false; myIsBusy = false;
onListSelectionChanged(); onListSelectionChanged();
} else if (myCurrentLineEdit == myGroupLine) { } else if (myCurrentLineEdit == myGroupLine) {
//SALOME_ListIteratorOfListIO anIt (mySelectionMgr->StoredIObjects()); //SALOME_ListIteratorOfListIO anIt (mySelectionMgr->StoredIObjects());
const SALOME_ListIO& aList = mySelector->StoredIObjects(); SALOME_ListIO aList;
mySelectionMgr->selectedObjects( aList );
SALOME_ListIteratorOfListIO anIt (aList); SALOME_ListIteratorOfListIO anIt (aList);
for (; anIt.More(); anIt.Next()) { for (; anIt.More(); anIt.Next()) {
SMESH::SMESH_Group_var aGroup = SMESH::SMESH_Group_var aGroup =
@ -1167,7 +1178,7 @@ void SMESHGUI_GroupDlg::onAdd()
} }
} }
mySelectGroup->setChecked(false); mySelectGroup->setChecked(false);
busy = false; myIsBusy = false;
onListSelectionChanged(); onListSelectionChanged();
} else if (myCurrentLineEdit == myGeomGroupLine && !CORBA::is_nil(myGeomGroup)) { } else if (myCurrentLineEdit == myGeomGroupLine && !CORBA::is_nil(myGeomGroup)) {
@ -1181,7 +1192,7 @@ void SMESHGUI_GroupDlg::onAdd()
case 6: aGroupType = SMESH::EDGE; break; case 6: aGroupType = SMESH::EDGE; break;
case 4: aGroupType = SMESH::FACE; break; case 4: aGroupType = SMESH::FACE; break;
case 2: aGroupType = SMESH::VOLUME; break; case 2: aGroupType = SMESH::VOLUME; break;
default: busy = false; return; default: myIsBusy = false; return;
} }
if (aGroupType == aType) { if (aGroupType == aType) {
@ -1213,10 +1224,10 @@ void SMESHGUI_GroupDlg::onAdd()
} }
//VSR: mySelectGeomGroup->setChecked(false); //VSR: mySelectGeomGroup->setChecked(false);
busy = false; myIsBusy = false;
onListSelectionChanged(); onListSelectionChanged();
} }
busy = false; myIsBusy = false;
// mySelectionMgr->clearSelected(); // mySelectionMgr->clearSelected();
updateButtons(); updateButtons();
} }
@ -1227,7 +1238,7 @@ void SMESHGUI_GroupDlg::onAdd()
//================================================================================= //=================================================================================
void SMESHGUI_GroupDlg::onRemove() void SMESHGUI_GroupDlg::onRemove()
{ {
busy = true; myIsBusy = true;
if (myCurrentLineEdit == 0) { if (myCurrentLineEdit == 0) {
for (int i = myElements->count(); i > 0; i--) { for (int i = myElements->count(); i > 0; i--) {
if (myElements->isSelected(i-1)) { if (myElements->isSelected(i-1)) {
@ -1235,10 +1246,12 @@ void SMESHGUI_GroupDlg::onRemove()
} }
} }
} else { } else {
const SALOME_ListIO& aList = mySelector->StoredIObjects(); SALOME_ListIO aList;
mySelectionMgr->selectedObjects( aList );
int aNbSel = aList.Extent(); int aNbSel = aList.Extent();
if (aNbSel == 0) { busy = false; return; } if (aNbSel == 0) { myIsBusy = false; return; }
SMESH::ElementType aType = SMESH::ALL; SMESH::ElementType aType = SMESH::ALL;
switch(myTypeId) { switch(myTypeId) {
@ -1250,7 +1263,9 @@ void SMESHGUI_GroupDlg::onRemove()
if (myCurrentLineEdit == mySubMeshLine) { if (myCurrentLineEdit == mySubMeshLine) {
//SALOME_ListIteratorOfListIO anIt (mySelectionMgr->StoredIObjects()); //SALOME_ListIteratorOfListIO anIt (mySelectionMgr->StoredIObjects());
const SALOME_ListIO& aList = mySelector->StoredIObjects(); SALOME_ListIO aList;
mySelectionMgr->selectedObjects( aList );
SALOME_ListIteratorOfListIO anIt (aList); SALOME_ListIteratorOfListIO anIt (aList);
for (; anIt.More(); anIt.Next()) { for (; anIt.More(); anIt.Next()) {
SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(anIt.Value()); SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(anIt.Value());
@ -1292,7 +1307,9 @@ void SMESHGUI_GroupDlg::onRemove()
else if (myCurrentLineEdit == myGroupLine) { else if (myCurrentLineEdit == myGroupLine) {
Standard_Boolean aRes; Standard_Boolean aRes;
//SALOME_ListIteratorOfListIO anIt (mySelectionMgr->StoredIObjects()); //SALOME_ListIteratorOfListIO anIt (mySelectionMgr->StoredIObjects());
const SALOME_ListIO& aList = mySelector->StoredIObjects(); SALOME_ListIO aList;
mySelectionMgr->selectedObjects( aList );
SALOME_ListIteratorOfListIO anIt (aList); SALOME_ListIteratorOfListIO anIt (aList);
for (; anIt.More(); anIt.Next()) { for (; anIt.More(); anIt.Next()) {
SMESH::SMESH_Group_var aGroup = SMESH::IObjectToInterface<SMESH::SMESH_Group>(anIt.Value()); SMESH::SMESH_Group_var aGroup = SMESH::IObjectToInterface<SMESH::SMESH_Group>(anIt.Value());
@ -1311,7 +1328,7 @@ void SMESHGUI_GroupDlg::onRemove()
} }
} }
} }
busy = false; myIsBusy = false;
updateButtons(); updateButtons();
} }
@ -1326,7 +1343,7 @@ void SMESHGUI_GroupDlg::onSort()
// myElements->update(); // myElements->update();
int i, k = myElements->count(); int i, k = myElements->count();
if (k > 0) { if (k > 0) {
busy = true; myIsBusy = true;
QStringList aSelected; QStringList aSelected;
std::vector<int> anArray(k); std::vector<int> anArray(k);
// QMemArray<int> anArray(k); // QMemArray<int> anArray(k);
@ -1348,7 +1365,7 @@ void SMESHGUI_GroupDlg::onSort()
anItem = myElements->findItem(*it, Qt::ExactMatch); anItem = myElements->findItem(*it, Qt::ExactMatch);
if (anItem) myElements->setSelected(anItem, true); if (anItem) myElements->setSelected(anItem, true);
} }
busy = false; myIsBusy = false;
} }
} }

View File

@ -161,7 +161,7 @@ private:
SMESHGUI_FilterDlg* myFilterDlg; SMESHGUI_FilterDlg* myFilterDlg;
bool myCreate; bool myCreate, myIsBusy;
}; };
#endif // DIALOGBOX_GROUP_H #endif // DIALOGBOX_GROUP_H

View File

@ -270,7 +270,7 @@ void SMESHGUI_MoveNodesDlg::reset()
//======================================================================= //=======================================================================
bool SMESHGUI_MoveNodesDlg::onApply() bool SMESHGUI_MoveNodesDlg::onApply()
{ {
if (SMESHGUI::GetSMESHGUI()->isActiveStudyLocked()) if (mySMESHGUI->isActiveStudyLocked())
return false; return false;
if (!isValid(true)) if (!isValid(true))
@ -323,7 +323,7 @@ void SMESHGUI_MoveNodesDlg::onClose()
{ {
mySelectionMgr->clearSelected(); mySelectionMgr->clearSelected();
SMESH::SetPointRepresentation(false); SMESH::SetPointRepresentation(false);
mySelector->SetSelectionMode(ActorSelection); myViewWindow->SetSelectionMode(ActorSelection);
disconnect(mySelectionMgr, 0, this, 0); disconnect(mySelectionMgr, 0, this, 0);
disconnect(mySMESHGUI, 0, this, 0); disconnect(mySMESHGUI, 0, this, 0);
mySMESHGUI->ResetState(); mySMESHGUI->ResetState();
@ -417,7 +417,7 @@ void SMESHGUI_MoveNodesDlg::onDeactivate()
void SMESHGUI_MoveNodesDlg::enterEvent (QEvent*) void SMESHGUI_MoveNodesDlg::enterEvent (QEvent*)
{ {
if (!isEnabled()) { if (!isEnabled()) {
SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog(); mySMESHGUI->EmitSignalDeactivateDialog();
// set selection mode // set selection mode
SMESH::SetPointRepresentation(true); SMESH::SetPointRepresentation(true);

View File

@ -46,15 +46,16 @@
#include "SUIT_ViewWindow.h" #include "SUIT_ViewWindow.h"
#include "SUIT_ViewManager.h" #include "SUIT_ViewManager.h"
#include "SUIT_MessageBox.h" #include "SUIT_MessageBox.h"
#include "SUIT_Desktop.h"
#include "SalomeApp_Study.h" #include "SalomeApp_Study.h"
#include "SalomeApp_Application.h" #include "SalomeApp_SelectionMgr.h"
#include "SVTK_Selector.h"
#include "SVTK_ViewWindow.h" #include "SVTK_ViewWindow.h"
#include "SALOME_Actor.h" #include "SALOME_Actor.h"
#include "SALOME_ListIO.hxx" #include "SALOME_ListIO.hxx"
#include "SVTK_Selection.h"
#include "utilities.h" #include "utilities.h"
@ -113,23 +114,16 @@ namespace SMESH {
} }
class TNodeSimulation { class TNodeSimulation {
SalomeApp_Application* myApplication; SVTK_ViewWindow* myViewWindow;
SUIT_ViewWindow* myViewWindow;
SVTK_ViewWindow* myVTKViewWindow;
SALOME_Actor *myPreviewActor; SALOME_Actor *myPreviewActor;
vtkDataSetMapper* myMapper; vtkDataSetMapper* myMapper;
vtkPoints* myPoints; vtkPoints* myPoints;
public: public:
TNodeSimulation (SalomeApp_Application* theApplication) TNodeSimulation(SVTK_ViewWindow* theViewWindow):
myViewWindow(theViewWindow)
{ {
myApplication = theApplication;
SUIT_ViewManager* mgr = theApplication->activeViewManager();
if (!mgr) return;
myViewWindow = mgr->getActiveView();
myVTKViewWindow = GetVtkViewWindow(myViewWindow);
vtkUnstructuredGrid* aGrid = vtkUnstructuredGrid::New(); vtkUnstructuredGrid* aGrid = vtkUnstructuredGrid::New();
// Create points // Create points
@ -195,7 +189,7 @@ namespace SMESH {
myPreviewActor->SetProperty(aProp); myPreviewActor->SetProperty(aProp);
aProp->Delete(); aProp->Delete();
myVTKViewWindow->AddActor(myPreviewActor); myViewWindow->AddActor(myPreviewActor);
} }
void SetPosition (float x, float y, float z) void SetPosition (float x, float y, float z)
@ -213,9 +207,7 @@ namespace SMESH {
~TNodeSimulation() ~TNodeSimulation()
{ {
if (FindVtkViewWindow(myApplication->activeViewManager(), myViewWindow)) { myViewWindow->RemoveActor(myPreviewActor);
myVTKViewWindow->RemoveActor(myPreviewActor);
}
myPreviewActor->Delete(); myPreviewActor->Delete();
myMapper->RemoveAllInputs(); myMapper->RemoveAllInputs();
@ -230,17 +222,20 @@ namespace SMESH {
// class : SMESHGUI_NodesDlg() // class : SMESHGUI_NodesDlg()
// purpose : // purpose :
//================================================================================= //=================================================================================
SMESHGUI_NodesDlg::SMESHGUI_NodesDlg (QWidget* parent, SMESHGUI_NodesDlg::SMESHGUI_NodesDlg (SMESHGUI* theModule,
const char* name, const char* name,
SalomeApp_SelectionMgr* Sel,
bool modal, bool modal,
WFlags fl) WFlags fl):
: QDialog(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | QDialog(SMESH::GetDesktop(theModule),
WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose) name,
modal,
WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose),
mySelector(SMESH::GetViewWindow(theModule)->GetSelector()),
mySelectionMgr(SMESH::GetSelectionMgr(theModule)),
myViewWindow(SMESH::GetViewWindow(theModule)),
mySMESHGUI(theModule)
{ {
SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*> mySimulation = new SMESH::TNodeSimulation(myViewWindow);
(SUIT_Session::session()->activeApplication());
mySimulation = new SMESH::TNodeSimulation (anApp);
QPixmap image0 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_DLG_NODE"))); QPixmap image0 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_DLG_NODE")));
if (!name) if (!name)
@ -333,7 +328,7 @@ SMESHGUI_NodesDlg::SMESHGUI_NodesDlg (QWidget* parent,
SMESHGUI_NodesDlgLayout->addWidget(GroupCoordinates, 1, 0); SMESHGUI_NodesDlgLayout->addWidget(GroupCoordinates, 1, 0);
/* Initialisation and display */ /* Initialisation and display */
Init(Sel); Init();
} }
//======================================================================= //=======================================================================
@ -349,7 +344,7 @@ SMESHGUI_NodesDlg::~SMESHGUI_NodesDlg()
// function : Init() // function : Init()
// purpose : // purpose :
//================================================================================= //=================================================================================
void SMESHGUI_NodesDlg::Init (SalomeApp_SelectionMgr* Sel) void SMESHGUI_NodesDlg::Init ()
{ {
/* Get setting of step value from file configuration */ /* Get setting of step value from file configuration */
double step; double step;
@ -365,9 +360,7 @@ void SMESHGUI_NodesDlg::Init (SalomeApp_SelectionMgr* Sel)
SpinBox_Y->SetValue(0.0); SpinBox_Y->SetValue(0.0);
SpinBox_Z->SetValue(0.0); SpinBox_Z->SetValue(0.0);
mySelectionMgr = Sel; mySMESHGUI->SetActiveDialogBox((QDialog*)this);
myMeshGUI = SMESHGUI::GetSMESHGUI();
myMeshGUI->SetActiveDialogBox((QDialog*)this);
/* signals and slots connections */ /* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
@ -379,23 +372,19 @@ void SMESHGUI_NodesDlg::Init (SalomeApp_SelectionMgr* Sel)
connect(SpinBox_Z, SIGNAL (valueChanged(double)), SLOT(ValueChangedInSpinBox(double))); connect(SpinBox_Z, SIGNAL (valueChanged(double)), SLOT(ValueChangedInSpinBox(double)));
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(SelectionIntoArgument())); connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(SelectionIntoArgument()));
connect(myMeshGUI, SIGNAL (SignalDeactivateActiveDialog()), SLOT(DeactivateActiveDialog())); connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), SLOT(DeactivateActiveDialog()));
/* to close dialog if study frame change */ /* to close dialog if study frame change */
connect(myMeshGUI, SIGNAL (SignalStudyFrameChanged()), SLOT(ClickOnCancel())); connect(mySMESHGUI, SIGNAL (SignalStudyFrameChanged()), SLOT(ClickOnCancel()));
/* Move widget on the botton right corner of main widget */ /* Move widget on the botton right corner of main widget */
int x, y; int x, y;
myMeshGUI->DefineDlgPosition(this, x, y); mySMESHGUI->DefineDlgPosition(this, x, y);
this->move(x, y); this->move(x, y);
this->show(); this->show();
// set selection mode // set selection mode
SMESH::SetPointRepresentation(true); SMESH::SetPointRepresentation(true);
#ifdef NEW_GUI myViewWindow->SetSelectionMode(NodeSelection);
mySelectionMgr->setSelectionModes(NodeSelection, true);
#else
mySelectionMgr->setSelectionModes(NodeSelection);
#endif
SelectionIntoArgument(); SelectionIntoArgument();
} }
@ -431,7 +420,7 @@ void SMESHGUI_NodesDlg::ClickOnOk()
//================================================================================= //=================================================================================
bool SMESHGUI_NodesDlg::ClickOnApply() bool SMESHGUI_NodesDlg::ClickOnApply()
{ {
if (myMeshGUI->isActiveStudyLocked()) if (mySMESHGUI->isActiveStudyLocked())
return false; return false;
if (myMesh->_is_nil()) { if (myMesh->_is_nil()) {
@ -460,14 +449,9 @@ bool SMESHGUI_NodesDlg::ClickOnApply()
if (anActor->hasIO()) { if (anActor->hasIO()) {
if (SMESH_MeshObj *aMeshObj = dynamic_cast<SMESH_MeshObj*>(anActor->GetObject().get())) { if (SMESH_MeshObj *aMeshObj = dynamic_cast<SMESH_MeshObj*>(anActor->GetObject().get())) {
if (myMesh->_is_equivalent(aMeshObj->GetMeshServer())) { if (myMesh->_is_equivalent(aMeshObj->GetMeshServer())) {
#ifdef NEW_GUI
mySelectionMgr->clearSelected();
mySelectionMgr->AddIObject(anActor->getIO(), false);
#else
aList.Clear(); aList.Clear();
aList.Append(anActor->getIO()); aList.Append(anActor->getIO());
mySelectionMgr->setSelectedObjects(aList, false); mySelectionMgr->setSelectedObjects(aList, false);
#endif
break; break;
} }
} }
@ -485,18 +469,14 @@ bool SMESHGUI_NodesDlg::ClickOnApply()
//================================================================================= //=================================================================================
void SMESHGUI_NodesDlg::ClickOnCancel() void SMESHGUI_NodesDlg::ClickOnCancel()
{ {
MESSAGE("SMESHGUI_NodesDlg::ClickOnCancel() 1");
disconnect(mySelectionMgr, 0, this, 0); disconnect(mySelectionMgr, 0, this, 0);
mySelectionMgr->clearSelected(); myViewWindow->SetSelectionMode(ActorSelection);
mySelectionMgr->setSelectionModes(ActorSelection);
MESSAGE("SMESHGUI_NodesDlg::ClickOnCancel() 2");
mySimulation->SetVisibility(false); mySimulation->SetVisibility(false);
SMESH::SetPointRepresentation(false); SMESH::SetPointRepresentation(false);
myMeshGUI->ResetState(); mySMESHGUI->ResetState();
reject(); reject();
MESSAGE("SMESHGUI_NodesDlg::ClickOnCancel() 3");
} }
//================================================================================= //=================================================================================
@ -511,15 +491,14 @@ void SMESHGUI_NodesDlg::SelectionIntoArgument()
mySimulation->SetVisibility(false); mySimulation->SetVisibility(false);
SMESH::SetPointRepresentation(true); SMESH::SetPointRepresentation(true);
SALOME_ListIO aList; const SALOME_ListIO& aList = mySelector->StoredIObjects();
mySelectionMgr->selectedObjects(aList);
if (aList.Extent() == 1) { if (aList.Extent() == 1) {
Handle(SALOME_InteractiveObject) anIO = aList.First(); Handle(SALOME_InteractiveObject) anIO = aList.First();
if (anIO->hasEntry()) { if (anIO->hasEntry()) {
myMesh = SMESH::GetMeshByIO(anIO); myMesh = SMESH::GetMeshByIO(anIO);
if (myMesh->_is_nil()) return; if (myMesh->_is_nil()) return;
QString aText; QString aText;
if (SMESH::GetNameOfSelectedNodes(mySelectionMgr, aText) == 1) { if (SMESH::GetNameOfSelectedNodes(mySelector,anIO,aText) == 1) {
if (SMESH_Actor* anActor = SMESH::FindActorByObject(myMesh.in())) { if (SMESH_Actor* anActor = SMESH::FindActorByObject(myMesh.in())) {
if (SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh()) { if (SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh()) {
if (const SMDS_MeshNode* aNode = aMesh->FindNode(aText.toInt())) { if (const SMDS_MeshNode* aNode = aMesh->FindNode(aText.toInt())) {
@ -577,8 +556,8 @@ void SMESHGUI_NodesDlg::DeactivateActiveDialog()
GroupCoordinates->setEnabled(false); GroupCoordinates->setEnabled(false);
GroupButtons->setEnabled(false); GroupButtons->setEnabled(false);
mySimulation->SetVisibility(false); mySimulation->SetVisibility(false);
myMeshGUI->ResetState(); mySMESHGUI->ResetState();
myMeshGUI->SetActiveDialogBox(0); mySMESHGUI->SetActiveDialogBox(0);
} }
} }
@ -588,17 +567,13 @@ void SMESHGUI_NodesDlg::DeactivateActiveDialog()
//================================================================================= //=================================================================================
void SMESHGUI_NodesDlg::ActivateThisDialog() void SMESHGUI_NodesDlg::ActivateThisDialog()
{ {
myMeshGUI->EmitSignalDeactivateDialog(); mySMESHGUI->EmitSignalDeactivateDialog();
GroupConstructors->setEnabled(true); GroupConstructors->setEnabled(true);
GroupCoordinates->setEnabled(true); GroupCoordinates->setEnabled(true);
GroupButtons->setEnabled(true); GroupButtons->setEnabled(true);
SMESH::SetPointRepresentation(true); SMESH::SetPointRepresentation(true);
#ifdef NEW_GUI myViewWindow->SetSelectionMode(NodeSelection);
mySelectionMgr->setSelectionModes(NodeSelection, true);
#else
mySelectionMgr->setSelectionModes(NodeSelection);
#endif
SelectionIntoArgument(); SelectionIntoArgument();
} }

View File

@ -29,8 +29,6 @@
#ifndef DIALOGBOX_NODES_H #ifndef DIALOGBOX_NODES_H
#define DIALOGBOX_NODES_H #define DIALOGBOX_NODES_H
#include "SalomeApp_SelectionMgr.h"
#include <qvariant.h> #include <qvariant.h>
#include <qdialog.h> #include <qdialog.h>
@ -44,8 +42,12 @@ class QLabel;
class QLineEdit; class QLineEdit;
class QPushButton; class QPushButton;
class QRadioButton; class QRadioButton;
class SMESHGUI; class SMESHGUI;
class SVTK_Selector;
class SVTK_ViewWindow;
class SMESHGUI_SpinBox; class SMESHGUI_SpinBox;
class SalomeApp_SelectionMgr;
namespace SMESH{ namespace SMESH{
struct TNodeSimulation; struct TNodeSimulation;
@ -64,22 +66,23 @@ class SMESHGUI_NodesDlg : public QDialog
Q_OBJECT Q_OBJECT
public: public:
SMESHGUI_NodesDlg (QWidget* parent = 0, const char* name = 0, SMESHGUI_NodesDlg (SMESHGUI* theModule,
SalomeApp_SelectionMgr* Sel = 0, const char* name = 0,
bool modal = FALSE, bool modal = FALSE,
WFlags fl = 0); WFlags fl = 0);
~SMESHGUI_NodesDlg(); ~SMESHGUI_NodesDlg();
private: private:
SalomeApp_SelectionMgr* mySelectionMgr; SalomeApp_SelectionMgr* mySelectionMgr;
SMESHGUI* myMeshGUI; SVTK_ViewWindow* myViewWindow;
SVTK_Selector* mySelector;
SMESHGUI* mySMESHGUI;
SMESH::SMESH_Mesh_var myMesh; SMESH::SMESH_Mesh_var myMesh;
SMESH::TNodeSimulation* mySimulation; SMESH::TNodeSimulation* mySimulation;
void Init (SalomeApp_SelectionMgr*); void Init ();
void enterEvent(QEvent* e); void enterEvent(QEvent* e);
void closeEvent(QCloseEvent*); void closeEvent(QCloseEvent*);
void hideEvent (QHideEvent *); /* ESC key */ void hideEvent (QHideEvent *); /* ESC key */

View File

@ -24,18 +24,30 @@
//function : SMESHGUI_Selection //function : SMESHGUI_Selection
//purpose : //purpose :
//======================================================================= //=======================================================================
SMESHGUI_Selection::SMESHGUI_Selection()
SMESHGUI_Selection::SMESHGUI_Selection( const QString& client, : SalomeApp_Selection()
SalomeApp_SelectionMgr* mgr )
{ {
myPopupClient = client; }
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>
(SUIT_Session::session()->activeApplication()->activeStudy());
if( mgr && appStudy ) //=======================================================================
//function : ~SMESHGUI_Selection
//purpose :
//=======================================================================
SMESHGUI_Selection::~SMESHGUI_Selection()
{
}
//=======================================================================
//function : init
//purpose :
//=======================================================================
void SMESHGUI_Selection::init( const QString& client, SalomeApp_SelectionMgr* mgr )
{
SalomeApp_Selection::init( client, mgr );
if( mgr && study() )
{ {
_PTR(Study) study = appStudy->studyDS(); _PTR(Study) aStudy = study()->studyDS();
SUIT_DataOwnerPtrList sel; SUIT_DataOwnerPtrList sel;
mgr->selected( sel, client ); mgr->selected( sel, client );
@ -47,36 +59,21 @@ SMESHGUI_Selection::SMESHGUI_Selection( const QString& client,
SUIT_DataOwner* owner = ( SUIT_DataOwner* )( (*anIt ).get() ); SUIT_DataOwner* owner = ( SUIT_DataOwner* )( (*anIt ).get() );
SalomeApp_DataOwner* sowner = dynamic_cast<SalomeApp_DataOwner*>( owner ); SalomeApp_DataOwner* sowner = dynamic_cast<SalomeApp_DataOwner*>( owner );
if( sowner ) if( sowner )
myTypes.append( typeName( type( sowner, study ) ) ); myTypes.append( typeName( type( sowner, aStudy ) ) );
else else
myTypes.append( "Unknown" ); myTypes.append( "Unknown" );
} }
} }
} }
SMESHGUI_Selection::~SMESHGUI_Selection()
{
}
//=======================================================================
//function : count
//purpose :
//=======================================================================
int SMESHGUI_Selection::count() const
{
return myTypes.count();
}
//======================================================================= //=======================================================================
//function : param //function : param
//purpose : //purpose :
//======================================================================= //=======================================================================
QtxValue SMESHGUI_Selection::param( const int ind, const QString& p ) const QtxValue SMESHGUI_Selection::param( const int ind, const QString& p ) const
{ {
QtxValue val; QtxValue val;
if ( p=="client" ) val = QtxValue( myPopupClient ); if ( p=="client" ) val = QtxValue( globalParam( p ) );
else if ( p=="type" ) val = QtxValue( myTypes[ind] ); else if ( p=="type" ) val = QtxValue( myTypes[ind] );
else if ( p=="elemTypes" ) val = QtxValue( elemTypes( ind ) ); else if ( p=="elemTypes" ) val = QtxValue( elemTypes( ind ) );
else if ( p=="numberOfNodes" ) val = QtxValue( numberOfNodes( ind ) ); else if ( p=="numberOfNodes" ) val = QtxValue( numberOfNodes( ind ) );
@ -89,9 +86,9 @@ QtxValue SMESHGUI_Selection::param( const int ind, const QString& p ) const
else if ( p=="hasReference" ) val = QtxValue( hasReference( ind ) ); else if ( p=="hasReference" ) val = QtxValue( hasReference( ind ) );
else if ( p=="isVisible" ) val = QtxValue( isVisible( ind ) ); else if ( p=="isVisible" ) val = QtxValue( isVisible( ind ) );
printf( "--> param() : [%s] = %s (%s)\n", p.latin1(), val.toString().latin1(), val.typeName() ); // printf( "--> param() : [%s] = %s (%s)\n", p.latin1(), val.toString().latin1(), val.typeName() );
if ( val.type() == QVariant::List ) // if ( val.type() == QVariant::List )
cout << "size: " << val.toList().count() << endl; // cout << "size: " << val.toList().count() << endl;
return val; return val;
} }

View File

@ -29,8 +29,7 @@
#ifndef SMESHGUI_SELECTION_HeaderFile #ifndef SMESHGUI_SELECTION_HeaderFile
#define SMESHGUI_SELECTION_HeaderFile #define SMESHGUI_SELECTION_HeaderFile
#include <QtxPopupMgr.h> #include "SalomeApp_Selection.h"
#include "SALOMEDSClient_definitions.hxx" #include "SALOMEDSClient_definitions.hxx"
#include "SUIT_DataOwner.h" #include "SUIT_DataOwner.h"
@ -39,16 +38,15 @@ class SALOMEDSClient_Study;
class SalomeApp_DataOwner; class SalomeApp_DataOwner;
class SMESH_Actor; class SMESH_Actor;
class SMESHGUI_Selection : public QtxPopupMgr::Selection class SMESHGUI_Selection : public SalomeApp_Selection
{ {
public: public:
SMESHGUI_Selection( const QString&, SalomeApp_SelectionMgr* ); SMESHGUI_Selection();
virtual ~SMESHGUI_Selection(); virtual ~SMESHGUI_Selection();
virtual void init( const QString&, SalomeApp_SelectionMgr* );
virtual QtxValue param( const int , const QString& paramName ) const; virtual QtxValue param( const int , const QString& paramName ) const;
virtual int count() const;
// got from object, not from actor // got from object, not from actor
virtual int numberOfNodes( int ind ) const; virtual int numberOfNodes( int ind ) const;
virtual QVariant isComputable( int ind ) const; virtual QVariant isComputable( int ind ) const;
@ -69,7 +67,6 @@ public:
static QString typeName( const int type); static QString typeName( const int type);
private: private:
QString myPopupClient;
QStringList myTypes; QStringList myTypes;
SUIT_DataOwnerPtrList myDataOwners; SUIT_DataOwnerPtrList myDataOwners;
}; };