2004-12-01 15:48:31 +05:00
|
|
|
// SMESH SMESHGUI : GUI for SMESH component
|
|
|
|
//
|
|
|
|
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
2005-06-07 19:22:20 +06:00
|
|
|
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
|
|
|
//
|
|
|
|
// This library is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Lesser General Public
|
|
|
|
// License as published by the Free Software Foundation; either
|
|
|
|
// version 2.1 of the License.
|
|
|
|
//
|
|
|
|
// This library is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public
|
|
|
|
// License along with this library; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
//
|
2006-06-01 17:39:17 +06:00
|
|
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
2004-12-01 15:48:31 +05:00
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// File : SMESHGUI_GroupOpDlg.cxx
|
|
|
|
// Author : Sergey LITONIN
|
|
|
|
// Module : SMESH
|
|
|
|
|
|
|
|
#include "SMESHGUI_GroupOpDlg.h"
|
|
|
|
|
|
|
|
#include "SMESHGUI.h"
|
|
|
|
#include "SMESHGUI_Utils.h"
|
2005-06-08 16:45:19 +06:00
|
|
|
#include "SMESHGUI_VTKUtils.h"
|
2005-06-07 19:22:20 +06:00
|
|
|
|
2004-12-01 15:48:31 +05:00
|
|
|
#include "SMESH_TypeFilter.hxx"
|
|
|
|
|
2005-06-07 19:22:20 +06:00
|
|
|
#include "SUIT_ResourceMgr.h"
|
|
|
|
#include "SUIT_Desktop.h"
|
2006-05-06 14:51:48 +06:00
|
|
|
#include "SUIT_Session.h"
|
|
|
|
#include "SUIT_MessageBox.h"
|
|
|
|
|
|
|
|
#include "LightApp_Application.h"
|
2005-06-07 19:22:20 +06:00
|
|
|
|
2005-11-03 13:38:17 +05:00
|
|
|
#include "LightApp_SelectionMgr.h"
|
2005-06-07 19:22:20 +06:00
|
|
|
#include "SVTK_Selection.h"
|
2005-06-08 16:45:19 +06:00
|
|
|
#include "SVTK_ViewWindow.h"
|
|
|
|
#include "SVTK_Selector.h"
|
2005-06-07 19:22:20 +06:00
|
|
|
#include "SALOME_ListIO.hxx"
|
|
|
|
|
|
|
|
// QT Includes
|
2004-12-01 15:48:31 +05:00
|
|
|
#include <qframe.h>
|
|
|
|
#include <qlayout.h>
|
|
|
|
#include <qpushbutton.h>
|
|
|
|
#include <qgroupbox.h>
|
|
|
|
#include <qlabel.h>
|
|
|
|
#include <qlistbox.h>
|
|
|
|
#include <qlineedit.h>
|
|
|
|
#include <qmessagebox.h>
|
|
|
|
|
|
|
|
#define SPACING 5
|
|
|
|
#define MARGIN 10
|
|
|
|
|
2005-06-07 19:22:20 +06:00
|
|
|
/*!
|
|
|
|
* Class : SMESHGUI_GroupOpDlg
|
|
|
|
* Description : Perform boolean operations on groups
|
|
|
|
*/
|
2004-12-01 15:48:31 +05:00
|
|
|
|
|
|
|
//=======================================================================
|
|
|
|
// name : SMESHGUI_GroupOpDlg::SMESHGUI_GroupOpDlg
|
|
|
|
// Purpose : Constructor
|
|
|
|
//=======================================================================
|
2005-06-08 16:45:19 +06:00
|
|
|
SMESHGUI_GroupOpDlg::SMESHGUI_GroupOpDlg( SMESHGUI* theModule, const int theMode )
|
|
|
|
: QDialog( SMESH::GetDesktop( theModule ), "SMESHGUI_GroupOpDlg", false,
|
|
|
|
WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ),
|
|
|
|
mySMESHGUI( theModule ),
|
2005-07-01 16:42:32 +06:00
|
|
|
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
|
2004-12-01 15:48:31 +05:00
|
|
|
{
|
|
|
|
myMode = theMode;
|
|
|
|
|
2006-05-06 14:51:48 +06:00
|
|
|
if (myMode == UNION) {
|
|
|
|
setCaption(tr("UNION_OF_TWO_GROUPS"));
|
|
|
|
myHelpFileName = "/files/using_operations_on_groups.htm#Union";
|
|
|
|
}
|
|
|
|
else if (myMode == INTERSECT) {
|
|
|
|
setCaption(tr("INTERSECTION_OF_TWO_GROUPS"));
|
|
|
|
myHelpFileName = "/files/using_operations_on_groups.htm#Intersection";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
setCaption(tr("CUT_OF_TWO_GROUPS"));
|
|
|
|
myHelpFileName = "/files/using_operations_on_groups.htm#Cut";
|
|
|
|
}
|
2004-12-01 15:48:31 +05:00
|
|
|
|
2005-07-01 16:42:32 +06:00
|
|
|
mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector();
|
|
|
|
|
2005-06-07 19:22:20 +06:00
|
|
|
QVBoxLayout* aDlgLay = new QVBoxLayout (this, MARGIN, SPACING);
|
2004-12-01 15:48:31 +05:00
|
|
|
|
2005-06-07 19:22:20 +06:00
|
|
|
QFrame* aMainFrame = createMainFrame (this);
|
|
|
|
QFrame* aBtnFrame = createButtonFrame(this);
|
2004-12-01 15:48:31 +05:00
|
|
|
|
2005-06-07 19:22:20 +06:00
|
|
|
aDlgLay->addWidget(aMainFrame);
|
|
|
|
aDlgLay->addWidget(aBtnFrame);
|
2004-12-01 15:48:31 +05:00
|
|
|
|
2005-06-07 19:22:20 +06:00
|
|
|
aDlgLay->setStretchFactor(aMainFrame, 1);
|
2004-12-01 15:48:31 +05:00
|
|
|
|
2005-06-08 16:45:19 +06:00
|
|
|
Init();
|
2004-12-01 15:48:31 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
//=======================================================================
|
|
|
|
// name : SMESHGUI_GroupOpDlg::createMainFrame
|
|
|
|
// Purpose : Create frame containing dialog's input fields
|
|
|
|
//=======================================================================
|
2005-06-07 19:22:20 +06:00
|
|
|
QFrame* SMESHGUI_GroupOpDlg::createMainFrame (QWidget* theParent)
|
2004-12-01 15:48:31 +05:00
|
|
|
{
|
2005-06-07 19:22:20 +06:00
|
|
|
QGroupBox* aMainGrp = new QGroupBox(1, Qt::Horizontal, theParent);
|
|
|
|
aMainGrp->setFrameStyle(QFrame::NoFrame);
|
|
|
|
aMainGrp->setInsideMargin(0);
|
|
|
|
|
|
|
|
QGroupBox* aNameGrp = new QGroupBox(1, Qt::Vertical, tr("NAME"), aMainGrp);
|
|
|
|
new QLabel(tr("RESULT_NAME"), aNameGrp);
|
|
|
|
myNameEdit = new QLineEdit(aNameGrp);
|
|
|
|
|
|
|
|
QGroupBox* anArgGrp = new QGroupBox(3, Qt::Horizontal, tr("ARGUMENTS"), aMainGrp);
|
|
|
|
|
|
|
|
new QLabel(myMode == CUT ? tr("MAIN_OBJECT") :tr("OBJECT_1"), anArgGrp);
|
|
|
|
myBtn1 = new QPushButton(anArgGrp);
|
|
|
|
myEdit1 = new QLineEdit(anArgGrp);
|
|
|
|
myEdit1->setAlignment( Qt::AlignLeft );
|
|
|
|
|
|
|
|
new QLabel(myMode == CUT ? tr("TOOL_OBJECT") :tr("OBJECT_2"), anArgGrp);
|
|
|
|
myBtn2 = new QPushButton(anArgGrp);
|
|
|
|
myEdit2 = new QLineEdit(anArgGrp);
|
|
|
|
myEdit2->setAlignment( Qt::AlignLeft );
|
|
|
|
|
|
|
|
myEdit1->setReadOnly(true);
|
|
|
|
myEdit2->setReadOnly(true);
|
|
|
|
|
2005-06-08 16:45:19 +06:00
|
|
|
QPixmap aPix (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
|
2005-06-07 19:22:20 +06:00
|
|
|
myBtn1->setPixmap(aPix);
|
|
|
|
myBtn2->setPixmap(aPix);
|
|
|
|
|
2004-12-01 15:48:31 +05:00
|
|
|
return aMainGrp;
|
|
|
|
}
|
|
|
|
|
|
|
|
//=======================================================================
|
|
|
|
// name : SMESHGUI_GroupOpDlg::createButtonFrame
|
|
|
|
// Purpose : Create frame containing buttons
|
|
|
|
//=======================================================================
|
2005-06-07 19:22:20 +06:00
|
|
|
QFrame* SMESHGUI_GroupOpDlg::createButtonFrame (QWidget* theParent)
|
2004-12-01 15:48:31 +05:00
|
|
|
{
|
2005-06-07 19:22:20 +06:00
|
|
|
QFrame* aFrame = new QFrame(theParent);
|
|
|
|
aFrame->setFrameStyle(QFrame::Box | QFrame::Sunken);
|
2004-12-01 15:48:31 +05:00
|
|
|
|
2005-06-07 19:22:20 +06:00
|
|
|
myOkBtn = new QPushButton(tr("SMESH_BUT_OK" ), aFrame);
|
|
|
|
myApplyBtn = new QPushButton(tr("SMESH_BUT_APPLY"), aFrame);
|
|
|
|
myCloseBtn = new QPushButton(tr("SMESH_BUT_CLOSE"), aFrame);
|
2006-05-06 14:51:48 +06:00
|
|
|
myHelpBtn = new QPushButton(tr("SMESH_BUT_HELP"), aFrame);
|
2004-12-01 15:48:31 +05:00
|
|
|
|
2005-06-07 19:22:20 +06:00
|
|
|
QSpacerItem* aSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
2004-12-01 15:48:31 +05:00
|
|
|
|
2005-06-07 19:22:20 +06:00
|
|
|
QHBoxLayout* aLay = new QHBoxLayout(aFrame, MARGIN, SPACING);
|
|
|
|
|
|
|
|
aLay->addWidget(myOkBtn);
|
|
|
|
aLay->addWidget(myApplyBtn);
|
|
|
|
aLay->addItem(aSpacer);
|
|
|
|
aLay->addWidget(myCloseBtn);
|
2006-05-06 14:51:48 +06:00
|
|
|
aLay->addWidget(myHelpBtn);
|
2004-12-01 15:48:31 +05:00
|
|
|
|
|
|
|
// connect signals and slots
|
2005-06-07 19:22:20 +06:00
|
|
|
connect(myOkBtn, SIGNAL(clicked()), SLOT(onOk()));
|
|
|
|
connect(myCloseBtn, SIGNAL(clicked()), SLOT(onClose()));
|
|
|
|
connect(myApplyBtn, SIGNAL(clicked()), SLOT(onApply()));
|
2006-05-06 14:51:48 +06:00
|
|
|
connect(myHelpBtn, SIGNAL(clicked()), SLOT(onHelp()));
|
2004-12-01 15:48:31 +05:00
|
|
|
|
|
|
|
return aFrame;
|
|
|
|
}
|
|
|
|
|
|
|
|
//=======================================================================
|
|
|
|
// name : SMESHGUI_GroupOpDlg::~SMESHGUI_GroupOpDlg
|
|
|
|
// Purpose : Destructor
|
|
|
|
//=======================================================================
|
|
|
|
SMESHGUI_GroupOpDlg::~SMESHGUI_GroupOpDlg()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//=======================================================================
|
|
|
|
// name : SMESHGUI_GroupOpDlg::Init
|
|
|
|
// Purpose : Init dialog fields, connect signals and slots, show dialog
|
|
|
|
//=======================================================================
|
2005-06-08 16:45:19 +06:00
|
|
|
void SMESHGUI_GroupOpDlg::Init()
|
2004-12-01 15:48:31 +05:00
|
|
|
{
|
2005-06-08 16:45:19 +06:00
|
|
|
mySMESHGUI->SetActiveDialogBox((QDialog*)this);
|
2004-12-01 15:48:31 +05:00
|
|
|
myFocusWg = myEdit1;
|
2005-06-07 19:22:20 +06:00
|
|
|
|
2004-12-01 15:48:31 +05:00
|
|
|
myGroup1 = SMESH::SMESH_GroupBase::_nil();
|
|
|
|
myGroup2 = SMESH::SMESH_GroupBase::_nil();
|
2005-06-07 19:22:20 +06:00
|
|
|
|
2004-12-01 15:48:31 +05:00
|
|
|
// selection and SMESHGUI
|
2005-06-07 19:22:20 +06:00
|
|
|
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionDone()));
|
2005-06-08 16:45:19 +06:00
|
|
|
connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), SLOT(onDeactivate()));
|
|
|
|
connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(ClickOnClose()));
|
2005-06-07 19:22:20 +06:00
|
|
|
|
|
|
|
connect(myBtn1, SIGNAL(clicked()), this, SLOT(onFocusChanged()));
|
|
|
|
connect(myBtn2, SIGNAL(clicked()), this, SLOT(onFocusChanged()));
|
|
|
|
|
|
|
|
this->show();
|
2004-12-01 15:48:31 +05:00
|
|
|
|
|
|
|
// set selection mode
|
2005-07-01 16:42:32 +06:00
|
|
|
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
|
|
|
|
aViewWindow->SetSelectionMode(ActorSelection);
|
2005-06-07 19:22:20 +06:00
|
|
|
mySelectionMgr->installFilter(new SMESH_TypeFilter (GROUP));
|
2004-12-01 15:48:31 +05:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
//=======================================================================
|
|
|
|
// name : SMESHGUI_GroupOpDlg::isValid
|
|
|
|
// Purpose : Verify validity of input data
|
|
|
|
//=======================================================================
|
|
|
|
bool SMESHGUI_GroupOpDlg::isValid()
|
|
|
|
{
|
|
|
|
// Verify validity of group name
|
2005-06-07 19:22:20 +06:00
|
|
|
if (myNameEdit->text() == "") {
|
|
|
|
QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"),
|
|
|
|
tr("EMPTY_NAME"), QMessageBox::Ok);
|
2004-12-01 15:48:31 +05:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Verufy wheter arguments speciffiyed
|
2005-06-07 19:22:20 +06:00
|
|
|
if (myGroup1->_is_nil() || myGroup2->_is_nil()) {
|
|
|
|
QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"),
|
|
|
|
tr("INCORRECT_ARGUMENTS"), QMessageBox::Ok);
|
2004-12-01 15:48:31 +05:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Verify whether arguments belongs to same mesh
|
|
|
|
SMESH::SMESH_Mesh_ptr aMesh1 = myGroup1->GetMesh();
|
|
|
|
SMESH::SMESH_Mesh_ptr aMesh2 = myGroup2->GetMesh();
|
2005-06-07 19:22:20 +06:00
|
|
|
|
2004-12-01 15:48:31 +05:00
|
|
|
int aMeshId1 = !aMesh1->_is_nil() ? aMesh1->GetId() : -1;
|
|
|
|
int aMeshId2 = !aMesh2->_is_nil() ? aMesh2->GetId() : -1;
|
2005-06-07 19:22:20 +06:00
|
|
|
|
|
|
|
if (aMeshId1 != aMeshId2 || aMeshId1 == -1) {
|
|
|
|
QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"),
|
|
|
|
tr("DIFF_MESHES"), QMessageBox::Ok);
|
2004-12-01 15:48:31 +05:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Verify whether groups have same types of entities
|
2005-06-07 19:22:20 +06:00
|
|
|
if (myGroup1->GetType() != myGroup2->GetType()) {
|
|
|
|
QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"),
|
|
|
|
tr("DIFF_TYPES"), QMessageBox::Ok);
|
2004-12-01 15:48:31 +05:00
|
|
|
return false;
|
|
|
|
}
|
2005-06-07 19:22:20 +06:00
|
|
|
|
2004-12-01 15:48:31 +05:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
//=======================================================================
|
|
|
|
// name : SMESHGUI_GroupOpDlg::onApply
|
2005-06-07 19:22:20 +06:00
|
|
|
// Purpose : SLOT called when "Apply" button pressed.
|
2004-12-01 15:48:31 +05:00
|
|
|
//=======================================================================
|
|
|
|
bool SMESHGUI_GroupOpDlg::onApply()
|
|
|
|
{
|
2005-06-08 16:45:19 +06:00
|
|
|
if (!isValid() || mySMESHGUI->isActiveStudyLocked())
|
2004-12-01 15:48:31 +05:00
|
|
|
return false;
|
2005-06-07 19:22:20 +06:00
|
|
|
|
2004-12-01 15:48:31 +05:00
|
|
|
SMESH::SMESH_Mesh_ptr aMesh = myGroup1->GetMesh();
|
|
|
|
QString aName = myNameEdit->text();
|
|
|
|
SMESH::SMESH_Group_ptr aNewGrp = SMESH::SMESH_Group::_nil();
|
2005-06-07 19:22:20 +06:00
|
|
|
|
|
|
|
if (myMode == UNION) aNewGrp = aMesh->UnionGroups(myGroup1, myGroup2, aName.latin1());
|
|
|
|
else if (myMode == INTERSECT) aNewGrp = aMesh->IntersectGroups(myGroup1, myGroup2, aName.latin1());
|
|
|
|
else aNewGrp = aMesh->CutGroups(myGroup1, myGroup2, aName.latin1());
|
|
|
|
|
|
|
|
if (!aNewGrp->_is_nil()) {
|
2005-06-08 16:45:19 +06:00
|
|
|
mySMESHGUI->updateObjBrowser(true);
|
2004-12-01 15:48:31 +05:00
|
|
|
reset();
|
|
|
|
return true;
|
2005-06-07 19:22:20 +06:00
|
|
|
} else {
|
|
|
|
QMessageBox::critical(SMESHGUI::desktop(), tr("SMESH_ERROR"),
|
|
|
|
tr("SMESH_OPERATION_FAILED"), "OK");
|
2004-12-01 15:48:31 +05:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//=======================================================================
|
|
|
|
// name : SMESHGUI_GroupOpDlg::onOk
|
2005-06-07 19:22:20 +06:00
|
|
|
// Purpose : SLOT called when "Ok" button pressed.
|
2004-12-01 15:48:31 +05:00
|
|
|
//=======================================================================
|
|
|
|
void SMESHGUI_GroupOpDlg::onOk()
|
|
|
|
{
|
2005-06-07 19:22:20 +06:00
|
|
|
if (onApply())
|
2004-12-01 15:48:31 +05:00
|
|
|
onClose();
|
|
|
|
}
|
|
|
|
|
|
|
|
//=======================================================================
|
|
|
|
// name : SMESHGUI_GroupOpDlg::onClose
|
|
|
|
// Purpose : SLOT called when "Close" button pressed. Close dialog
|
|
|
|
//=======================================================================
|
|
|
|
void SMESHGUI_GroupOpDlg::onClose()
|
|
|
|
{
|
2005-07-01 16:42:32 +06:00
|
|
|
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
|
|
|
|
aViewWindow->SetSelectionMode(ActorSelection);
|
2005-06-07 19:22:20 +06:00
|
|
|
disconnect(mySelectionMgr, 0, this, 0);
|
2005-06-08 16:45:19 +06:00
|
|
|
disconnect(mySMESHGUI, 0, this, 0);
|
|
|
|
mySMESHGUI->ResetState();
|
2005-06-07 19:22:20 +06:00
|
|
|
mySelectionMgr->clearFilters();
|
2004-12-01 15:48:31 +05:00
|
|
|
reject();
|
|
|
|
}
|
|
|
|
|
2006-05-06 14:51:48 +06:00
|
|
|
//=================================================================================
|
|
|
|
// function : onHelp()
|
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
|
|
|
void SMESHGUI_GroupOpDlg::onHelp()
|
|
|
|
{
|
|
|
|
LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
|
|
|
|
if (app)
|
|
|
|
app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
|
|
|
|
else {
|
|
|
|
SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"),
|
|
|
|
QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
|
|
|
|
arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(myHelpFileName),
|
|
|
|
QObject::tr("BUT_OK"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-12-01 15:48:31 +05:00
|
|
|
//=======================================================================
|
|
|
|
// name : SMESHGUI_GroupOpDlg::onSelectionDone
|
|
|
|
// Purpose : SLOT called when selection changed
|
|
|
|
//=======================================================================
|
|
|
|
void SMESHGUI_GroupOpDlg::onSelectionDone()
|
|
|
|
{
|
2005-06-07 19:22:20 +06:00
|
|
|
if (myFocusWg == myEdit1)
|
2004-12-01 15:48:31 +05:00
|
|
|
myGroup1 = SMESH::SMESH_GroupBase::_nil();
|
|
|
|
else
|
|
|
|
myGroup2 = SMESH::SMESH_GroupBase::_nil();
|
2005-06-07 19:22:20 +06:00
|
|
|
|
|
|
|
myFocusWg->setText("");
|
|
|
|
|
|
|
|
SALOME_ListIO aList;
|
|
|
|
mySelectionMgr->selectedObjects(aList);
|
|
|
|
|
|
|
|
if (aList.Extent() == 1) {
|
|
|
|
SMESH::SMESH_GroupBase_var aGroup =
|
|
|
|
SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(aList.First());
|
|
|
|
|
|
|
|
if (!aGroup->_is_nil())
|
2004-12-01 15:48:31 +05:00
|
|
|
{
|
2005-06-07 19:22:20 +06:00
|
|
|
myFocusWg->setText(aGroup->GetName());
|
|
|
|
myFocusWg->setCursorPosition( 0 );
|
2004-12-01 15:48:31 +05:00
|
|
|
|
2005-06-07 19:22:20 +06:00
|
|
|
if (myFocusWg == myEdit1)
|
2004-12-01 15:48:31 +05:00
|
|
|
myGroup1 = aGroup;
|
|
|
|
else
|
|
|
|
myGroup2 = aGroup;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//=======================================================================
|
|
|
|
// name : SMESHGUI_GroupOpDlg::onDeactivate
|
|
|
|
// Purpose : SLOT called when dialog must be deativated
|
|
|
|
//=======================================================================
|
|
|
|
void SMESHGUI_GroupOpDlg::onDeactivate()
|
|
|
|
{
|
2005-06-07 19:22:20 +06:00
|
|
|
setEnabled(false);
|
|
|
|
mySelectionMgr->clearFilters();
|
2004-12-01 15:48:31 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
//=======================================================================
|
|
|
|
// name : SMESHGUI_GroupOpDlg::enterEvent
|
|
|
|
// Purpose : Event filter
|
|
|
|
//=======================================================================
|
2005-06-07 19:22:20 +06:00
|
|
|
void SMESHGUI_GroupOpDlg::enterEvent (QEvent*)
|
2004-12-01 15:48:31 +05:00
|
|
|
{
|
2005-06-08 16:45:19 +06:00
|
|
|
mySMESHGUI->EmitSignalDeactivateDialog();
|
2005-06-07 19:22:20 +06:00
|
|
|
setEnabled(true);
|
2005-07-01 16:42:32 +06:00
|
|
|
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
|
|
|
|
aViewWindow->SetSelectionMode(ActorSelection);
|
2005-06-07 19:22:20 +06:00
|
|
|
mySelectionMgr->installFilter(new SMESH_TypeFilter (GROUP));
|
2004-12-01 15:48:31 +05:00
|
|
|
}
|
|
|
|
|
2005-06-07 19:22:20 +06:00
|
|
|
//=======================================================================
|
|
|
|
// name : SMESHGUI_GroupOpDlg::closeEvent
|
|
|
|
// purpose :
|
|
|
|
//=======================================================================
|
|
|
|
void SMESHGUI_GroupOpDlg::closeEvent (QCloseEvent*)
|
2004-12-01 15:48:31 +05:00
|
|
|
{
|
2005-06-07 19:22:20 +06:00
|
|
|
onClose();
|
2004-12-01 15:48:31 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
//=======================================================================
|
|
|
|
// name : SMESHGUI_GroupOpDlg::onFocusChanged
|
|
|
|
// Purpose : SLOT. Called when "Select" button pressed.
|
|
|
|
//=======================================================================
|
|
|
|
void SMESHGUI_GroupOpDlg::onFocusChanged()
|
|
|
|
{
|
|
|
|
const QObject* aSender = sender();
|
|
|
|
myFocusWg = aSender == myBtn1 ? myEdit1 : myEdit2;
|
|
|
|
onSelectionDone();
|
|
|
|
}
|
|
|
|
|
|
|
|
//=======================================================================
|
|
|
|
// name : SMESHGUI_GroupOpDlg::reset
|
|
|
|
// Purpose : Rest state of dialog
|
|
|
|
//=======================================================================
|
|
|
|
void SMESHGUI_GroupOpDlg::reset()
|
|
|
|
{
|
2005-06-07 19:22:20 +06:00
|
|
|
myNameEdit->setText("");
|
|
|
|
myEdit1->setText("");
|
|
|
|
myEdit2->setText("");
|
2004-12-01 15:48:31 +05:00
|
|
|
myFocusWg = myEdit1;
|
|
|
|
myNameEdit->setFocus();
|
|
|
|
}
|