2008-03-12 21:11:49 +05:00
|
|
|
// SMESH SMESHGUI : GUI for SMESH component
|
2004-12-01 15:48:31 +05:00
|
|
|
//
|
2008-03-12 21:11:49 +05:00
|
|
|
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
|
|
|
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
2005-06-07 19:22:20 +06:00
|
|
|
//
|
2008-03-12 21:11:49 +05:00
|
|
|
// 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.
|
2005-06-07 19:22:20 +06:00
|
|
|
//
|
2008-03-12 21:11:49 +05:00
|
|
|
// 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.
|
2005-06-07 19:22:20 +06:00
|
|
|
//
|
2008-03-12 21:11:49 +05:00
|
|
|
// 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
|
2005-06-07 19:22:20 +06:00
|
|
|
//
|
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
|
|
|
//
|
2008-03-12 21:11:49 +05:00
|
|
|
// File : SMESHGUI_ExtrusionDlg.cxx
|
|
|
|
// Author : Michael ZORIN, Open CASCADE S.A.S.
|
2004-12-01 15:48:31 +05:00
|
|
|
//
|
|
|
|
|
2008-03-12 21:11:49 +05:00
|
|
|
// SMESH includes
|
2004-12-01 15:48:31 +05:00
|
|
|
#include "SMESHGUI_ExtrusionDlg.h"
|
2005-06-07 19:22:20 +06:00
|
|
|
|
2004-12-01 15:48:31 +05:00
|
|
|
#include "SMESHGUI.h"
|
|
|
|
#include "SMESHGUI_Utils.h"
|
|
|
|
#include "SMESHGUI_VTKUtils.h"
|
|
|
|
#include "SMESHGUI_MeshUtils.h"
|
2005-06-07 19:22:20 +06:00
|
|
|
#include "SMESHGUI_SpinBox.h"
|
2004-12-01 15:48:31 +05:00
|
|
|
#include "SMESHGUI_IdValidator.h"
|
2005-06-07 19:22:20 +06:00
|
|
|
|
2008-03-12 21:11:49 +05:00
|
|
|
#include <SMESH_Actor.h>
|
|
|
|
#include <SMESH_TypeFilter.hxx>
|
|
|
|
#include <SMESH_LogicalFilter.hxx>
|
2004-12-01 15:48:31 +05:00
|
|
|
|
2008-03-12 21:11:49 +05:00
|
|
|
#include <SMDS_Mesh.hxx>
|
2006-05-06 14:51:48 +06:00
|
|
|
|
2008-03-12 21:11:49 +05:00
|
|
|
// SALOME GUI includes
|
|
|
|
#include <SUIT_ResourceMgr.h>
|
|
|
|
#include <SUIT_Desktop.h>
|
|
|
|
#include <SUIT_MessageBox.h>
|
|
|
|
#include <SUIT_Session.h>
|
2005-06-07 19:22:20 +06:00
|
|
|
|
2008-03-12 21:11:49 +05:00
|
|
|
#include <LightApp_Application.h>
|
|
|
|
#include <LightApp_SelectionMgr.h>
|
2005-06-07 19:22:20 +06:00
|
|
|
|
2008-03-12 21:11:49 +05:00
|
|
|
#include <SVTK_ViewModel.h>
|
|
|
|
#include <SVTK_ViewWindow.h>
|
2004-12-01 15:48:31 +05:00
|
|
|
|
2008-03-12 21:11:49 +05:00
|
|
|
// OCCT includes
|
2005-06-07 19:22:20 +06:00
|
|
|
#include <TColStd_MapOfInteger.hxx>
|
|
|
|
#include <TColStd_IndexedMapOfInteger.hxx>
|
|
|
|
|
2008-03-12 21:11:49 +05:00
|
|
|
// Qt includes
|
|
|
|
#include <QApplication>
|
|
|
|
#include <QButtonGroup>
|
|
|
|
#include <QGroupBox>
|
|
|
|
#include <QLabel>
|
|
|
|
#include <QLineEdit>
|
|
|
|
#include <QPushButton>
|
|
|
|
#include <QRadioButton>
|
|
|
|
#include <QCheckBox>
|
|
|
|
#include <QSpinBox>
|
|
|
|
#include <QHBoxLayout>
|
|
|
|
#include <QVBoxLayout>
|
|
|
|
#include <QGridLayout>
|
|
|
|
#include <QKeyEvent>
|
|
|
|
|
|
|
|
// IDL includes
|
|
|
|
#include <SALOMEconfig.h>
|
2005-01-20 11:25:54 +05:00
|
|
|
#include CORBA_SERVER_HEADER(SMESH_Group)
|
2007-04-18 21:44:59 +06:00
|
|
|
#include CORBA_SERVER_HEADER(SMESH_MeshEditor)
|
2005-01-20 11:25:54 +05:00
|
|
|
|
2008-03-12 21:11:49 +05:00
|
|
|
#define SPACING 6
|
|
|
|
#define MARGIN 11
|
2004-12-01 15:48:31 +05:00
|
|
|
|
|
|
|
//=================================================================================
|
2005-06-07 19:22:20 +06:00
|
|
|
// function : SMESHGUI_ExtrusionDlg()
|
|
|
|
// purpose : constructor
|
2004-12-01 15:48:31 +05:00
|
|
|
//=================================================================================
|
2008-03-12 21:11:49 +05:00
|
|
|
SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule)
|
|
|
|
: QDialog( SMESH::GetDesktop( theModule ) ),
|
|
|
|
mySMESHGUI( theModule ),
|
|
|
|
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
|
2004-12-01 15:48:31 +05:00
|
|
|
{
|
2005-06-08 16:45:19 +06:00
|
|
|
QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_EDGE")));
|
|
|
|
QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_TRIANGLE")));
|
|
|
|
QPixmap image2 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
|
2005-06-07 19:22:20 +06:00
|
|
|
|
2008-03-12 21:11:49 +05:00
|
|
|
setModal( false );
|
|
|
|
setAttribute( Qt::WA_DeleteOnClose, true );
|
|
|
|
setWindowTitle(tr("EXTRUSION_ALONG_LINE"));
|
|
|
|
setSizeGripEnabled(true);
|
2005-06-07 19:22:20 +06:00
|
|
|
|
2008-03-12 21:11:49 +05:00
|
|
|
QVBoxLayout* SMESHGUI_ExtrusionDlgLayout = new QVBoxLayout(this);
|
|
|
|
SMESHGUI_ExtrusionDlgLayout->setSpacing(SPACING);
|
|
|
|
SMESHGUI_ExtrusionDlgLayout->setMargin(MARGIN);
|
2004-12-01 15:48:31 +05:00
|
|
|
|
|
|
|
/***************************************************************/
|
2008-03-12 21:11:49 +05:00
|
|
|
ConstructorsBox = new QGroupBox(tr("SMESH_EXTRUSION"), this);
|
|
|
|
GroupConstructors = new QButtonGroup(this);
|
|
|
|
QHBoxLayout* ConstructorsBoxLayout = new QHBoxLayout(ConstructorsBox);
|
|
|
|
ConstructorsBoxLayout->setSpacing(SPACING);
|
|
|
|
ConstructorsBoxLayout->setMargin(MARGIN);
|
|
|
|
|
|
|
|
RadioButton1= new QRadioButton(ConstructorsBox);
|
|
|
|
RadioButton1->setIcon(image0);
|
|
|
|
RadioButton2= new QRadioButton(ConstructorsBox);
|
|
|
|
RadioButton2->setIcon(image1);
|
|
|
|
|
|
|
|
ConstructorsBoxLayout->addWidget(RadioButton1);
|
|
|
|
ConstructorsBoxLayout->addWidget(RadioButton2);
|
|
|
|
|
|
|
|
GroupConstructors->addButton(RadioButton1, 0);
|
|
|
|
GroupConstructors->addButton(RadioButton2, 1);
|
2005-06-07 19:22:20 +06:00
|
|
|
|
2004-12-01 15:48:31 +05:00
|
|
|
/***************************************************************/
|
2008-03-12 21:11:49 +05:00
|
|
|
GroupButtons = new QGroupBox(this);
|
|
|
|
QHBoxLayout* GroupButtonsLayout = new QHBoxLayout(GroupButtons);
|
|
|
|
GroupButtonsLayout->setSpacing(SPACING);
|
|
|
|
GroupButtonsLayout->setMargin(MARGIN);
|
|
|
|
|
|
|
|
buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons);
|
|
|
|
buttonOk->setAutoDefault(true);
|
|
|
|
buttonOk->setDefault(true);
|
|
|
|
buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons);
|
|
|
|
buttonApply->setAutoDefault(true);
|
|
|
|
buttonCancel = new QPushButton(tr("SMESH_BUT_CLOSE"), GroupButtons);
|
|
|
|
buttonCancel->setAutoDefault(true);
|
|
|
|
buttonHelp = new QPushButton(tr("SMESH_BUT_HELP"), GroupButtons);
|
|
|
|
buttonHelp->setAutoDefault(true);
|
|
|
|
|
|
|
|
GroupButtonsLayout->addWidget(buttonOk);
|
|
|
|
GroupButtonsLayout->addSpacing(10);
|
|
|
|
GroupButtonsLayout->addWidget(buttonApply);
|
|
|
|
GroupButtonsLayout->addSpacing(10);
|
|
|
|
GroupButtonsLayout->addStretch();
|
|
|
|
GroupButtonsLayout->addWidget(buttonCancel);
|
|
|
|
GroupButtonsLayout->addWidget(buttonHelp);
|
2004-12-01 15:48:31 +05:00
|
|
|
|
|
|
|
/***************************************************************/
|
2008-03-12 21:11:49 +05:00
|
|
|
GroupArguments = new QGroupBox(tr("EXTRUSION_1D"), this);
|
|
|
|
QGridLayout* GroupArgumentsLayout = new QGridLayout(GroupArguments);
|
|
|
|
GroupArgumentsLayout->setSpacing(SPACING);
|
|
|
|
GroupArgumentsLayout->setMargin(MARGIN);
|
2004-12-01 15:48:31 +05:00
|
|
|
|
|
|
|
// Controls for elements selection
|
2008-03-12 21:11:49 +05:00
|
|
|
TextLabelElements = new QLabel(tr("SMESH_ID_ELEMENTS"), GroupArguments);
|
|
|
|
|
|
|
|
SelectElementsButton = new QPushButton(GroupArguments);
|
|
|
|
SelectElementsButton->setIcon(image2);
|
2005-06-07 19:22:20 +06:00
|
|
|
|
2008-03-12 21:11:49 +05:00
|
|
|
LineEditElements = new QLineEdit(GroupArguments);
|
|
|
|
LineEditElements->setValidator(new SMESHGUI_IdValidator(this));
|
2004-12-01 15:48:31 +05:00
|
|
|
|
|
|
|
// Control for the whole mesh selection
|
2008-03-12 21:11:49 +05:00
|
|
|
CheckBoxMesh = new QCheckBox(tr("SMESH_SELECT_WHOLE_MESH"), GroupArguments);
|
2004-12-01 15:48:31 +05:00
|
|
|
|
|
|
|
// Controls for vector selection
|
2008-03-12 21:11:49 +05:00
|
|
|
TextLabelVector = new QLabel(tr("SMESH_VECTOR"), GroupArguments);
|
2005-06-07 19:22:20 +06:00
|
|
|
|
2008-03-12 21:11:49 +05:00
|
|
|
TextLabelDx = new QLabel(tr("SMESH_DX"), GroupArguments);
|
|
|
|
SpinBox_Dx = new SMESHGUI_SpinBox(GroupArguments);
|
2004-12-01 15:48:31 +05:00
|
|
|
|
2008-03-12 21:11:49 +05:00
|
|
|
TextLabelDy = new QLabel(tr("SMESH_DY"), GroupArguments);
|
|
|
|
SpinBox_Dy = new SMESHGUI_SpinBox(GroupArguments);
|
2004-12-01 15:48:31 +05:00
|
|
|
|
2008-03-12 21:11:49 +05:00
|
|
|
TextLabelDz = new QLabel(tr("SMESH_DZ"), GroupArguments);
|
|
|
|
SpinBox_Dz = new SMESHGUI_SpinBox(GroupArguments);
|
2005-06-07 19:22:20 +06:00
|
|
|
|
2004-12-01 15:48:31 +05:00
|
|
|
// Controls for nb. steps defining
|
2008-03-12 21:11:49 +05:00
|
|
|
TextLabelNbSteps = new QLabel(tr("SMESH_NUMBEROFSTEPS"), GroupArguments);
|
|
|
|
SpinBox_NbSteps = new QSpinBox(GroupArguments);
|
2005-06-07 19:22:20 +06:00
|
|
|
|
2008-02-11 20:08:07 +05:00
|
|
|
// CheckBox for groups generation
|
|
|
|
MakeGroupsCheck = new QCheckBox(tr("SMESH_MAKE_GROUPS"), GroupArguments);
|
|
|
|
|
2008-03-12 21:11:49 +05:00
|
|
|
GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0);
|
|
|
|
GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
|
|
|
|
GroupArgumentsLayout->addWidget(LineEditElements, 0, 2, 1, 6);
|
|
|
|
GroupArgumentsLayout->addWidget(CheckBoxMesh, 0, 0, 1, 8);
|
|
|
|
GroupArgumentsLayout->addWidget(TextLabelVector, 2, 0);
|
|
|
|
GroupArgumentsLayout->addWidget(TextLabelDx, 2, 2);
|
|
|
|
GroupArgumentsLayout->addWidget(SpinBox_Dx, 2, 3);
|
|
|
|
GroupArgumentsLayout->addWidget(TextLabelDy, 2, 4);
|
|
|
|
GroupArgumentsLayout->addWidget(SpinBox_Dy, 2, 5);
|
|
|
|
GroupArgumentsLayout->addWidget(TextLabelDz, 2, 6);
|
|
|
|
GroupArgumentsLayout->addWidget(SpinBox_Dz, 2, 7);
|
|
|
|
GroupArgumentsLayout->addWidget(TextLabelNbSteps, 3, 0);
|
|
|
|
GroupArgumentsLayout->addWidget(SpinBox_NbSteps, 3, 2, 1, 6);
|
|
|
|
GroupArgumentsLayout->addWidget(MakeGroupsCheck, 4, 0, 1, 8);
|
2008-02-11 20:08:07 +05:00
|
|
|
|
2008-03-12 21:11:49 +05:00
|
|
|
/***************************************************************/
|
|
|
|
SMESHGUI_ExtrusionDlgLayout->addWidget(ConstructorsBox);
|
|
|
|
SMESHGUI_ExtrusionDlgLayout->addWidget(GroupArguments);
|
|
|
|
SMESHGUI_ExtrusionDlgLayout->addWidget(GroupButtons);
|
2005-06-07 19:22:20 +06:00
|
|
|
|
2004-12-01 15:48:31 +05:00
|
|
|
/* Initialisations */
|
2006-07-03 20:23:38 +06:00
|
|
|
SpinBox_Dx->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3);
|
|
|
|
SpinBox_Dy->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3);
|
|
|
|
SpinBox_Dz->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3);
|
2004-12-01 15:48:31 +05:00
|
|
|
|
2005-06-07 19:22:20 +06:00
|
|
|
SpinBox_NbSteps->setRange(1, 999999);
|
|
|
|
|
2008-03-12 21:11:49 +05:00
|
|
|
RadioButton1->setChecked(true);
|
|
|
|
MakeGroupsCheck->setChecked(true);
|
2005-06-07 19:22:20 +06:00
|
|
|
|
2005-07-28 15:29:29 +06:00
|
|
|
mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector();
|
|
|
|
|
2005-06-07 19:22:20 +06:00
|
|
|
mySMESHGUI->SetActiveDialogBox(this);
|
|
|
|
|
|
|
|
// Costruction of the logical filter for the elements: mesh/sub-mesh/group
|
|
|
|
SMESH_TypeFilter* aMeshOrSubMeshFilter = new SMESH_TypeFilter (MESHorSUBMESH);
|
|
|
|
SMESH_TypeFilter* aSmeshGroupFilter = new SMESH_TypeFilter (GROUP);
|
|
|
|
|
2008-03-12 21:11:49 +05:00
|
|
|
QList<SUIT_SelectionFilter*> aListOfFilters;
|
2005-06-07 19:22:20 +06:00
|
|
|
if (aMeshOrSubMeshFilter) aListOfFilters.append(aMeshOrSubMeshFilter);
|
|
|
|
if (aSmeshGroupFilter) aListOfFilters.append(aSmeshGroupFilter);
|
|
|
|
|
|
|
|
myMeshOrSubMeshOrGroupFilter =
|
|
|
|
new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR);
|
|
|
|
|
2008-02-11 20:08:07 +05:00
|
|
|
myHelpFileName = "extrusion_page.html";
|
2006-05-06 14:51:48 +06:00
|
|
|
|
2004-12-01 15:48:31 +05:00
|
|
|
Init();
|
2005-06-07 19:22:20 +06:00
|
|
|
|
|
|
|
/***************************************************************/
|
|
|
|
// signals and slots connections
|
2008-03-12 21:11:49 +05:00
|
|
|
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
2005-06-07 19:22:20 +06:00
|
|
|
connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
|
2008-03-12 21:11:49 +05:00
|
|
|
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
|
|
|
connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp()));
|
2006-05-06 14:51:48 +06:00
|
|
|
|
|
|
|
// to update state of the Ok & Apply buttons
|
|
|
|
connect(SpinBox_Dx, SIGNAL(valueChanged(double)), SLOT(CheckIsEnable()));
|
|
|
|
connect(SpinBox_Dy, SIGNAL(valueChanged(double)), SLOT(CheckIsEnable()));
|
|
|
|
connect(SpinBox_Dz, SIGNAL(valueChanged(double)), SLOT(CheckIsEnable()));
|
2005-06-07 19:22:20 +06:00
|
|
|
|
2008-03-12 21:11:49 +05:00
|
|
|
connect(GroupConstructors, SIGNAL(buttonClicked(int)), SLOT(ConstructorsClicked(int)));
|
|
|
|
connect(SelectElementsButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
|
|
|
connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
|
|
|
|
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
2004-12-01 15:48:31 +05:00
|
|
|
/* to close dialog if study change */
|
2008-03-12 21:11:49 +05:00
|
|
|
connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
|
|
|
|
connect(LineEditElements, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&)));
|
|
|
|
connect(CheckBoxMesh, SIGNAL(toggled(bool)), SLOT(onSelectMesh(bool)));
|
2004-12-01 15:48:31 +05:00
|
|
|
|
2005-06-07 19:22:20 +06:00
|
|
|
/***************************************************************/
|
2006-03-13 20:29:49 +05:00
|
|
|
|
2004-12-01 15:48:31 +05:00
|
|
|
ConstructorsClicked(0);
|
2005-09-02 14:32:03 +06:00
|
|
|
SelectionIntoArgument();
|
2004-12-01 15:48:31 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : ~SMESHGUI_ExtrusionDlg()
|
2005-06-07 19:22:20 +06:00
|
|
|
// purpose : destructor
|
2004-12-01 15:48:31 +05:00
|
|
|
//=================================================================================
|
|
|
|
SMESHGUI_ExtrusionDlg::~SMESHGUI_ExtrusionDlg()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : Init()
|
2005-06-07 19:22:20 +06:00
|
|
|
// purpose : initialization
|
2004-12-01 15:48:31 +05:00
|
|
|
//=================================================================================
|
2005-06-07 19:22:20 +06:00
|
|
|
void SMESHGUI_ExtrusionDlg::Init (bool ResetControls)
|
2004-12-01 15:48:31 +05:00
|
|
|
{
|
2005-06-07 19:22:20 +06:00
|
|
|
myBusy = false;
|
|
|
|
|
2004-12-01 15:48:31 +05:00
|
|
|
LineEditElements->clear();
|
2005-06-07 19:22:20 +06:00
|
|
|
myNbOkElements = 0;
|
2004-12-01 15:48:31 +05:00
|
|
|
|
2005-06-07 19:22:20 +06:00
|
|
|
myActor = 0;
|
2004-12-01 15:48:31 +05:00
|
|
|
myMesh = SMESH::SMESH_Mesh::_nil();
|
|
|
|
|
2005-06-07 19:22:20 +06:00
|
|
|
if (ResetControls) {
|
|
|
|
SpinBox_NbSteps->setValue(1);
|
|
|
|
SpinBox_Dx->SetValue(0);
|
|
|
|
SpinBox_Dy->SetValue(0);
|
|
|
|
SpinBox_Dz->SetValue(0);
|
|
|
|
|
|
|
|
CheckBoxMesh->setChecked(false);
|
|
|
|
onSelectMesh(false);
|
|
|
|
}
|
2006-05-06 14:51:48 +06:00
|
|
|
|
|
|
|
CheckIsEnable();
|
|
|
|
}
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : CheckIsEnable()
|
|
|
|
// purpose : Check whether the Ok and Apply buttons should be enabled or not
|
|
|
|
//=================================================================================
|
|
|
|
void SMESHGUI_ExtrusionDlg::CheckIsEnable()
|
|
|
|
{
|
|
|
|
double aX = SpinBox_Dx->GetValue();
|
|
|
|
double aY = SpinBox_Dy->GetValue();
|
|
|
|
double aZ = SpinBox_Dz->GetValue();
|
|
|
|
double aModule = sqrt(aX*aX + aY*aY + aZ*aZ);
|
|
|
|
|
|
|
|
bool anIsEnable = myNbOkElements > 0 && aModule > 1.0E-38;
|
|
|
|
|
|
|
|
buttonOk->setEnabled(anIsEnable);
|
|
|
|
buttonApply->setEnabled(anIsEnable);
|
2005-06-07 19:22:20 +06:00
|
|
|
}
|
2004-12-01 15:48:31 +05:00
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : ConstructorsClicked()
|
|
|
|
// purpose : Radio button management
|
|
|
|
//=================================================================================
|
2005-06-07 19:22:20 +06:00
|
|
|
void SMESHGUI_ExtrusionDlg::ConstructorsClicked (int constructorId)
|
2004-12-01 15:48:31 +05:00
|
|
|
{
|
2005-06-07 19:22:20 +06:00
|
|
|
disconnect(mySelectionMgr, 0, this, 0);
|
|
|
|
|
|
|
|
switch (constructorId) {
|
|
|
|
case 0:
|
|
|
|
{
|
|
|
|
GroupArguments->setTitle(tr("EXTRUSION_1D"));
|
|
|
|
if (!CheckBoxMesh->isChecked())
|
2005-07-01 16:42:32 +06:00
|
|
|
{
|
|
|
|
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
|
|
|
|
aViewWindow->SetSelectionMode(EdgeSelection);
|
|
|
|
}
|
2005-06-07 19:22:20 +06:00
|
|
|
break;
|
2004-12-01 15:48:31 +05:00
|
|
|
}
|
2005-06-07 19:22:20 +06:00
|
|
|
case 1:
|
|
|
|
{
|
|
|
|
GroupArguments->setTitle(tr("EXTRUSION_2D"));
|
|
|
|
if (!CheckBoxMesh->isChecked())
|
2005-07-01 16:42:32 +06:00
|
|
|
{
|
|
|
|
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
|
|
|
|
aViewWindow->SetSelectionMode(FaceSelection);
|
|
|
|
}
|
2005-06-07 19:22:20 +06:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2004-12-01 15:48:31 +05:00
|
|
|
|
|
|
|
myEditCurrentArgument = LineEditElements;
|
|
|
|
LineEditElements->setFocus();
|
2005-06-07 19:22:20 +06:00
|
|
|
|
2004-12-01 15:48:31 +05:00
|
|
|
if (CheckBoxMesh->isChecked())
|
|
|
|
onSelectMesh(true);
|
|
|
|
|
2005-06-07 19:22:20 +06:00
|
|
|
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
|
|
|
}
|
2004-12-01 15:48:31 +05:00
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : ClickOnApply()
|
2005-06-07 19:22:20 +06:00
|
|
|
// purpose : Called when user presses <Apply> button
|
2004-12-01 15:48:31 +05:00
|
|
|
//=================================================================================
|
2005-06-07 19:22:20 +06:00
|
|
|
bool SMESHGUI_ExtrusionDlg::ClickOnApply()
|
2004-12-01 15:48:31 +05:00
|
|
|
{
|
2005-06-07 19:22:20 +06:00
|
|
|
if (mySMESHGUI->isActiveStudyLocked())
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if (myNbOkElements) {
|
|
|
|
|
|
|
|
SMESH::DirStruct aVector;
|
|
|
|
aVector.PS.x = SpinBox_Dx->GetValue();
|
|
|
|
aVector.PS.y = SpinBox_Dy->GetValue();
|
|
|
|
aVector.PS.z = SpinBox_Dz->GetValue();
|
|
|
|
|
|
|
|
long aNbSteps = (long)SpinBox_NbSteps->value();
|
|
|
|
|
|
|
|
try {
|
|
|
|
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
|
2008-03-12 21:11:49 +05:00
|
|
|
QApplication::setOverrideCursor(Qt::WaitCursor);
|
2008-02-11 20:08:07 +05:00
|
|
|
|
|
|
|
if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() )
|
|
|
|
SMESH::ListOfGroups_var groups =
|
|
|
|
aMeshEditor->ExtrusionSweepMakeGroups(myElementsId.inout(), aVector, aNbSteps);
|
|
|
|
else
|
|
|
|
aMeshEditor->ExtrusionSweep(myElementsId.inout(), aVector, aNbSteps);
|
|
|
|
|
2005-06-07 19:22:20 +06:00
|
|
|
QApplication::restoreOverrideCursor();
|
|
|
|
} catch (...) {
|
2004-12-01 15:48:31 +05:00
|
|
|
}
|
2005-06-07 19:22:20 +06:00
|
|
|
|
|
|
|
SMESH::UpdateView();
|
2008-02-11 20:08:07 +05:00
|
|
|
if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() )
|
|
|
|
mySMESHGUI->updateObjBrowser(true); // new groups may appear
|
2005-06-07 19:22:20 +06:00
|
|
|
Init(false);
|
|
|
|
ConstructorsClicked(GetConstructorId());
|
2005-09-01 15:20:12 +06:00
|
|
|
SelectionIntoArgument();
|
2005-06-07 19:22:20 +06:00
|
|
|
}
|
|
|
|
return true;
|
2004-12-01 15:48:31 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : ClickOnOk()
|
2005-06-07 19:22:20 +06:00
|
|
|
// purpose : Called when user presses <OK> button
|
2004-12-01 15:48:31 +05:00
|
|
|
//=================================================================================
|
|
|
|
void SMESHGUI_ExtrusionDlg::ClickOnOk()
|
|
|
|
{
|
2005-06-07 19:22:20 +06:00
|
|
|
if (ClickOnApply())
|
|
|
|
ClickOnCancel();
|
2004-12-01 15:48:31 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : ClickOnCancel()
|
2005-06-07 19:22:20 +06:00
|
|
|
// purpose : Called when dialog box is closed
|
2004-12-01 15:48:31 +05:00
|
|
|
//=================================================================================
|
|
|
|
void SMESHGUI_ExtrusionDlg::ClickOnCancel()
|
|
|
|
{
|
2005-06-07 19:22:20 +06:00
|
|
|
disconnect(mySelectionMgr, 0, this, 0);
|
|
|
|
mySelectionMgr->clearFilters();
|
2005-11-11 13:56:51 +05:00
|
|
|
//mySelectionMgr->clearSelected();
|
2005-06-07 19:22:20 +06:00
|
|
|
SMESH::SetPickable(); // ???
|
2004-12-01 15:48:31 +05:00
|
|
|
SMESH::SetPointRepresentation(false);
|
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
|
|
|
mySMESHGUI->ResetState();
|
|
|
|
reject();
|
2004-12-01 15:48:31 +05:00
|
|
|
}
|
|
|
|
|
2006-05-06 14:51:48 +06:00
|
|
|
//=================================================================================
|
|
|
|
// function : ClickOnHelp()
|
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
|
|
|
void SMESHGUI_ExtrusionDlg::ClickOnHelp()
|
|
|
|
{
|
|
|
|
LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
|
|
|
|
if (app)
|
|
|
|
app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
|
|
|
|
else {
|
2008-03-12 21:11:49 +05:00
|
|
|
QString platform;
|
2007-02-07 17:14:23 +05:00
|
|
|
#ifdef WIN32
|
2008-03-12 21:11:49 +05:00
|
|
|
platform = "winapplication";
|
2007-02-07 17:14:23 +05:00
|
|
|
#else
|
2008-03-12 21:11:49 +05:00
|
|
|
platform = "application";
|
2007-02-07 17:14:23 +05:00
|
|
|
#endif
|
2008-03-12 21:11:49 +05:00
|
|
|
SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
|
|
|
|
tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
|
|
|
|
arg(app->resourceMgr()->stringValue("ExternalBrowser",
|
|
|
|
platform)).
|
|
|
|
arg(myHelpFileName));
|
2006-05-06 14:51:48 +06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-06-07 19:22:20 +06:00
|
|
|
//=================================================================================
|
|
|
|
// function : onTextChange()
|
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
|
|
|
void SMESHGUI_ExtrusionDlg::onTextChange (const QString& theNewText)
|
2004-12-01 15:48:31 +05:00
|
|
|
{
|
|
|
|
QLineEdit* send = (QLineEdit*)sender();
|
2005-06-07 19:22:20 +06:00
|
|
|
|
|
|
|
// return if busy
|
|
|
|
if (myBusy) return;
|
|
|
|
|
|
|
|
// set busy flag
|
2004-12-01 15:48:31 +05:00
|
|
|
myBusy = true;
|
2005-06-07 19:22:20 +06:00
|
|
|
|
2004-12-01 15:48:31 +05:00
|
|
|
if (send == LineEditElements)
|
|
|
|
myNbOkElements = 0;
|
2005-06-07 19:22:20 +06:00
|
|
|
|
2004-12-01 15:48:31 +05:00
|
|
|
// hilight entered elements/nodes
|
2005-06-07 19:22:20 +06:00
|
|
|
|
2008-02-11 20:08:07 +05:00
|
|
|
if (!myIO.IsNull()) {
|
2008-03-12 21:11:49 +05:00
|
|
|
QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts);
|
2005-06-07 19:22:20 +06:00
|
|
|
|
2008-02-11 20:08:07 +05:00
|
|
|
if (send == LineEditElements)
|
|
|
|
{
|
|
|
|
SMDS_Mesh* aMesh = myActor ? myActor->GetObject()->GetMesh() : 0;
|
|
|
|
SMESH::ElementType SMESHType = GetConstructorId() ? SMESH::FACE : SMESH::EDGE;
|
|
|
|
SMDSAbs_ElementType SMDSType = GetConstructorId() ? SMDSAbs_Face: SMDSAbs_Edge;
|
|
|
|
|
|
|
|
myElementsId = new SMESH::long_array;
|
|
|
|
myElementsId->length( aListId.count() );
|
2005-06-07 19:22:20 +06:00
|
|
|
TColStd_MapOfInteger newIndices;
|
|
|
|
for (int i = 0; i < aListId.count(); i++) {
|
2008-02-11 20:08:07 +05:00
|
|
|
int id = aListId[ i ].toInt();
|
|
|
|
bool validId = false;
|
|
|
|
if ( id > 0 ) {
|
|
|
|
if ( aMesh ) {
|
|
|
|
const SMDS_MeshElement * e = aMesh->FindElement( id );
|
|
|
|
validId = ( e && e->GetType() == SMDSType );
|
|
|
|
} else {
|
|
|
|
validId = ( myMesh->GetElementType( id, true ) == SMESHType );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ( validId && newIndices.Add( id ))
|
|
|
|
myElementsId[ newIndices.Extent()-1 ] = id;
|
2005-06-07 19:22:20 +06:00
|
|
|
}
|
2008-02-11 20:08:07 +05:00
|
|
|
myElementsId->length( myNbOkElements = newIndices.Extent() );
|
|
|
|
mySelector->AddOrRemoveIndex(myIO, newIndices, false);
|
2005-07-01 16:42:32 +06:00
|
|
|
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
|
2008-02-11 20:08:07 +05:00
|
|
|
aViewWindow->highlight( myIO, true, true );
|
2004-12-01 15:48:31 +05:00
|
|
|
}
|
|
|
|
}
|
2005-06-07 19:22:20 +06:00
|
|
|
|
2006-05-06 14:51:48 +06:00
|
|
|
CheckIsEnable();
|
2005-06-07 19:22:20 +06:00
|
|
|
|
2004-12-01 15:48:31 +05:00
|
|
|
myBusy = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : SelectionIntoArgument()
|
|
|
|
// purpose : Called when selection as changed or other case
|
|
|
|
//=================================================================================
|
|
|
|
void SMESHGUI_ExtrusionDlg::SelectionIntoArgument()
|
|
|
|
{
|
2005-06-07 19:22:20 +06:00
|
|
|
if (myBusy) return;
|
|
|
|
|
|
|
|
// return if dialog box is inactive
|
|
|
|
if (!GroupButtons->isEnabled())
|
|
|
|
return;
|
|
|
|
|
2004-12-01 15:48:31 +05:00
|
|
|
// clear
|
|
|
|
myActor = 0;
|
2008-02-11 20:08:07 +05:00
|
|
|
myIO.Nullify();
|
2004-12-01 15:48:31 +05:00
|
|
|
QString aString = "";
|
|
|
|
|
2005-06-07 19:22:20 +06:00
|
|
|
// set busy flag
|
2004-12-01 15:48:31 +05:00
|
|
|
myBusy = true;
|
2005-06-07 19:22:20 +06:00
|
|
|
|
|
|
|
myEditCurrentArgument->setText(aString);
|
2004-12-01 15:48:31 +05:00
|
|
|
myNbOkElements = 0;
|
|
|
|
myBusy = false;
|
2005-06-07 19:22:20 +06:00
|
|
|
|
2004-12-01 15:48:31 +05:00
|
|
|
// get selected mesh
|
2005-06-07 19:22:20 +06:00
|
|
|
SALOME_ListIO aList;
|
|
|
|
mySelectionMgr->selectedObjects(aList, SVTK_Viewer::Type());
|
|
|
|
int nbSel = SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
|
|
|
|
if (nbSel != 1)
|
2004-12-01 15:48:31 +05:00
|
|
|
return;
|
2005-06-07 19:22:20 +06:00
|
|
|
|
|
|
|
Handle(SALOME_InteractiveObject) IO = aList.First();
|
2004-12-01 15:48:31 +05:00
|
|
|
myMesh = SMESH::GetMeshByIO(IO);
|
2005-06-07 19:22:20 +06:00
|
|
|
if (myMesh->_is_nil())
|
2004-12-01 15:48:31 +05:00
|
|
|
return;
|
2008-02-11 20:08:07 +05:00
|
|
|
myIO = IO;
|
2004-12-01 15:48:31 +05:00
|
|
|
myActor = SMESH::FindActorByObject(myMesh);
|
2005-06-07 19:22:20 +06:00
|
|
|
|
|
|
|
if (myEditCurrentArgument == LineEditElements) {
|
|
|
|
int aNbElements = 0;
|
2008-02-11 20:08:07 +05:00
|
|
|
|
|
|
|
// MakeGroups is available if there are groups
|
|
|
|
if ( myMesh->NbGroups() == 0 ) {
|
|
|
|
MakeGroupsCheck->setChecked(false);
|
|
|
|
MakeGroupsCheck->setEnabled(false);
|
|
|
|
} else {
|
|
|
|
MakeGroupsCheck->setEnabled(true);
|
|
|
|
}
|
2005-06-07 19:22:20 +06:00
|
|
|
|
|
|
|
if (CheckBoxMesh->isChecked()) {
|
2008-02-11 20:08:07 +05:00
|
|
|
SMESH::ElementType neededType = GetConstructorId() ? SMESH::FACE : SMESH::EDGE;
|
2005-06-07 19:22:20 +06:00
|
|
|
|
|
|
|
SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
|
|
|
|
|
2008-02-11 20:08:07 +05:00
|
|
|
SMESH::SMESH_Mesh_var mesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO);
|
|
|
|
|
|
|
|
if (!mesh->_is_nil()) { //MESH
|
|
|
|
// get elements from mesh
|
|
|
|
myElementsId = mesh->GetElementsByType(neededType);
|
|
|
|
aNbElements = myElementsId->length();
|
|
|
|
} else {
|
|
|
|
SMESH::SMESH_subMesh_var aSubMesh =
|
|
|
|
SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO);
|
|
|
|
|
|
|
|
if (!aSubMesh->_is_nil()) { //SUBMESH
|
|
|
|
// get IDs from submesh
|
|
|
|
myElementsId = aSubMesh->GetElementsByType(neededType);
|
|
|
|
aNbElements = myElementsId->length();
|
|
|
|
} else {
|
|
|
|
SMESH::SMESH_GroupBase_var aGroup =
|
|
|
|
SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IO);
|
|
|
|
|
|
|
|
if (!aGroup->_is_nil() && aGroup->GetType() == neededType) { // GROUP
|
|
|
|
// get IDs from smesh group
|
|
|
|
myElementsId = aGroup->GetListOfID();
|
|
|
|
aNbElements = myElementsId->length();
|
2005-06-07 19:22:20 +06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
2008-02-11 20:08:07 +05:00
|
|
|
// get indices of selcted elements
|
|
|
|
TColStd_IndexedMapOfInteger aMapIndex;
|
|
|
|
mySelector->GetIndex(IO,aMapIndex);
|
|
|
|
aNbElements = aMapIndex.Extent();
|
|
|
|
|
|
|
|
myElementsId = new SMESH::long_array;
|
|
|
|
myElementsId->length( aNbElements );
|
|
|
|
aString = "";
|
|
|
|
for ( int i = 0; i < aNbElements; ++i )
|
|
|
|
aString += QString(" %1").arg( myElementsId[ i ] = aMapIndex( i+1 ) );
|
2004-12-01 15:48:31 +05:00
|
|
|
}
|
2005-06-07 19:22:20 +06:00
|
|
|
|
|
|
|
if (aNbElements < 1)
|
|
|
|
return;
|
|
|
|
|
|
|
|
myNbOkElements = true;
|
|
|
|
}
|
|
|
|
|
2004-12-01 15:48:31 +05:00
|
|
|
myBusy = true;
|
2005-06-07 19:22:20 +06:00
|
|
|
myEditCurrentArgument->setText(aString);
|
2004-12-01 15:48:31 +05:00
|
|
|
myBusy = false;
|
2005-06-07 19:22:20 +06:00
|
|
|
|
2004-12-01 15:48:31 +05:00
|
|
|
// OK
|
2006-05-06 14:51:48 +06:00
|
|
|
CheckIsEnable();
|
2004-12-01 15:48:31 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : SetEditCurrentArgument()
|
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
|
|
|
void SMESHGUI_ExtrusionDlg::SetEditCurrentArgument()
|
|
|
|
{
|
|
|
|
QPushButton* send = (QPushButton*)sender();
|
2005-06-07 19:22:20 +06:00
|
|
|
|
|
|
|
disconnect(mySelectionMgr, 0, this, 0);
|
|
|
|
mySelectionMgr->clearSelected();
|
|
|
|
mySelectionMgr->clearFilters();
|
|
|
|
|
|
|
|
if (send == SelectElementsButton) {
|
2004-12-01 15:48:31 +05:00
|
|
|
myEditCurrentArgument = LineEditElements;
|
2005-06-07 19:22:20 +06:00
|
|
|
if (CheckBoxMesh->isChecked()) {
|
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(myMeshOrSubMeshOrGroupFilter);
|
|
|
|
} else {
|
|
|
|
int aConstructorId = GetConstructorId();
|
|
|
|
if (aConstructorId == 0)
|
2005-07-01 16:42:32 +06:00
|
|
|
{
|
|
|
|
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
|
|
|
|
aViewWindow->SetSelectionMode(EdgeSelection);
|
|
|
|
}
|
2005-06-07 19:22:20 +06:00
|
|
|
else if (aConstructorId == 1)
|
2005-07-01 16:42:32 +06:00
|
|
|
{
|
|
|
|
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
|
|
|
|
aViewWindow->SetSelectionMode(FaceSelection);
|
|
|
|
}
|
2005-06-07 19:22:20 +06:00
|
|
|
}
|
2004-12-01 15:48:31 +05:00
|
|
|
}
|
2005-06-07 19:22:20 +06:00
|
|
|
|
2004-12-01 15:48:31 +05:00
|
|
|
myEditCurrentArgument->setFocus();
|
2005-06-07 19:22:20 +06:00
|
|
|
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
|
|
|
SelectionIntoArgument();
|
2004-12-01 15:48:31 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : DeactivateActiveDialog()
|
2005-06-07 19:22:20 +06:00
|
|
|
// purpose : Deactivates this dialog
|
2004-12-01 15:48:31 +05:00
|
|
|
//=================================================================================
|
|
|
|
void SMESHGUI_ExtrusionDlg::DeactivateActiveDialog()
|
|
|
|
{
|
2008-03-12 21:11:49 +05:00
|
|
|
if (ConstructorsBox->isEnabled()) {
|
|
|
|
ConstructorsBox->setEnabled(false);
|
2005-06-07 19:22:20 +06:00
|
|
|
GroupArguments->setEnabled(false);
|
|
|
|
GroupButtons->setEnabled(false);
|
|
|
|
mySMESHGUI->ResetState();
|
|
|
|
mySMESHGUI->SetActiveDialogBox(0);
|
2004-12-01 15:48:31 +05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : ActivateThisDialog()
|
2005-06-07 19:22:20 +06:00
|
|
|
// purpose : Activates this dialog
|
2004-12-01 15:48:31 +05:00
|
|
|
//=================================================================================
|
|
|
|
void SMESHGUI_ExtrusionDlg::ActivateThisDialog()
|
|
|
|
{
|
2005-06-07 19:22:20 +06:00
|
|
|
// Emit a signal to deactivate the active dialog
|
|
|
|
mySMESHGUI->EmitSignalDeactivateDialog();
|
2008-03-12 21:11:49 +05:00
|
|
|
ConstructorsBox->setEnabled(true);
|
2005-06-07 19:22:20 +06:00
|
|
|
GroupArguments->setEnabled(true);
|
|
|
|
GroupButtons->setEnabled(true);
|
|
|
|
|
|
|
|
mySMESHGUI->SetActiveDialogBox(this);
|
2004-12-01 15:48:31 +05:00
|
|
|
|
|
|
|
ConstructorsClicked(GetConstructorId());
|
|
|
|
SelectionIntoArgument();
|
|
|
|
}
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : enterEvent()
|
2005-06-07 19:22:20 +06:00
|
|
|
// purpose : Mouse enter event
|
2004-12-01 15:48:31 +05:00
|
|
|
//=================================================================================
|
2005-06-07 19:22:20 +06:00
|
|
|
void SMESHGUI_ExtrusionDlg::enterEvent (QEvent*)
|
2004-12-01 15:48:31 +05:00
|
|
|
{
|
2008-03-12 21:11:49 +05:00
|
|
|
if (!ConstructorsBox->isEnabled())
|
2005-06-07 19:22:20 +06:00
|
|
|
ActivateThisDialog();
|
2004-12-01 15:48:31 +05:00
|
|
|
}
|
|
|
|
|
2005-06-07 19:22:20 +06:00
|
|
|
//=================================================================================
|
|
|
|
// function : onSelectMesh()
|
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
|
|
|
void SMESHGUI_ExtrusionDlg::onSelectMesh (bool toSelectMesh)
|
2004-12-01 15:48:31 +05:00
|
|
|
{
|
|
|
|
if (toSelectMesh)
|
2005-06-07 19:22:20 +06:00
|
|
|
TextLabelElements->setText(tr("SMESH_NAME"));
|
2004-12-01 15:48:31 +05:00
|
|
|
else
|
2005-06-07 19:22:20 +06:00
|
|
|
TextLabelElements->setText(tr("SMESH_ID_ELEMENTS"));
|
|
|
|
|
|
|
|
if (myEditCurrentArgument != LineEditElements) {
|
|
|
|
LineEditElements->clear();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
mySelectionMgr->clearFilters();
|
|
|
|
|
|
|
|
if (toSelectMesh) {
|
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(myMeshOrSubMeshOrGroupFilter);
|
|
|
|
LineEditElements->setReadOnly(true);
|
|
|
|
} else {
|
|
|
|
int aConstructorId = GetConstructorId();
|
|
|
|
if (aConstructorId == 0)
|
2005-07-01 16:42:32 +06:00
|
|
|
{
|
|
|
|
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
|
|
|
|
aViewWindow->SetSelectionMode(EdgeSelection);
|
|
|
|
}
|
2005-06-07 19:22:20 +06:00
|
|
|
else if (aConstructorId == 0)
|
2005-07-01 16:42:32 +06:00
|
|
|
{
|
|
|
|
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
|
|
|
|
aViewWindow->SetSelectionMode(FaceSelection);
|
|
|
|
}
|
2005-06-07 19:22:20 +06:00
|
|
|
|
|
|
|
LineEditElements->setReadOnly(false);
|
|
|
|
onTextChange(LineEditElements->text());
|
|
|
|
}
|
|
|
|
|
2004-12-01 15:48:31 +05:00
|
|
|
SelectionIntoArgument();
|
|
|
|
}
|
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : GetConstructorId()
|
2005-06-07 19:22:20 +06:00
|
|
|
// purpose :
|
2004-12-01 15:48:31 +05:00
|
|
|
//=================================================================================
|
|
|
|
int SMESHGUI_ExtrusionDlg::GetConstructorId()
|
2005-06-07 19:22:20 +06:00
|
|
|
{
|
2008-03-12 21:11:49 +05:00
|
|
|
return GroupConstructors->checkedId();
|
2004-12-01 15:48:31 +05:00
|
|
|
}
|
2006-06-23 18:51:59 +06:00
|
|
|
|
|
|
|
//=================================================================================
|
|
|
|
// function : keyPressEvent()
|
|
|
|
// purpose :
|
|
|
|
//=================================================================================
|
|
|
|
void SMESHGUI_ExtrusionDlg::keyPressEvent( QKeyEvent* e )
|
|
|
|
{
|
|
|
|
QDialog::keyPressEvent( e );
|
|
|
|
if ( e->isAccepted() )
|
|
|
|
return;
|
|
|
|
|
2008-03-12 21:11:49 +05:00
|
|
|
if ( e->key() == Qt::Key_F1 ) {
|
|
|
|
e->accept();
|
|
|
|
ClickOnHelp();
|
|
|
|
}
|
2006-06-23 18:51:59 +06:00
|
|
|
}
|