1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // SMESH SMESHGUI : GUI for SMESH component
23 // File : SMESHGUI_ExtrusionAlongPathDlg.cxx
24 // Author : Vadim SANDLER
28 #include "SMESHGUI_ExtrusionAlongPathDlg.h"
31 #include "SMESHGUI_Utils.h"
32 #include "SMESHGUI_VTKUtils.h"
33 #include "SMESHGUI_MeshUtils.h"
34 #include "SMESHGUI_SpinBox.h"
35 #include "SMESHGUI_IdValidator.h"
37 #include "SMESH_Actor.h"
38 #include "SMESH_TypeFilter.hxx"
39 #include "SMESH_NumberFilter.hxx"
40 #include "SMESH_LogicalFilter.hxx"
42 #include "SMDS_Mesh.hxx"
46 #include "SUIT_ResourceMgr.h"
47 #include "SUIT_OverrideCursor.h"
48 #include "SUIT_Desktop.h"
49 #include "SUIT_MessageBox.h"
50 #include "SUIT_Session.h"
52 #include "LightApp_Application.h"
54 #include "SVTK_ViewModel.h"
55 #include "SVTK_ViewWindow.h"
56 #include "SVTK_Selector.h"
57 #include "SVTK_Selection.h"
58 #include "SALOME_ListIO.hxx"
60 #include "utilities.h"
63 #include <BRep_Tool.hxx>
64 #include <TopoDS_Shape.hxx>
66 #include <TopoDS_Vertex.hxx>
68 #include <TColStd_MapOfInteger.hxx>
69 #include <TColStd_IndexedMapOfInteger.hxx>
72 #include <qapplication.h>
73 #include <qbuttongroup.h>
74 #include <qgroupbox.h>
76 #include <qlineedit.h>
77 #include <qpushbutton.h>
78 #include <qtoolbutton.h>
79 #include <qradiobutton.h>
80 #include <qcheckbox.h>
83 #include <qvalidator.h>
88 #include "SALOMEconfig.h"
89 #include CORBA_SERVER_HEADER(SMESH_Group)
90 #include CORBA_SERVER_HEADER(SMESH_MeshEditor)
94 //=================================================================================
95 // function : SMESHGUI_ExtrusionAlongPathDlg()
96 // purpose : constructor
97 //=================================================================================
98 SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theModule,
100 : QDialog( SMESH::GetDesktop( theModule ), "SMESHGUI_ExtrusionAlongPathDlg", modal,
101 WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose),
102 mySMESHGUI( theModule ),
103 mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
105 SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( mySMESHGUI );
106 QPixmap edgeImage ( mgr->loadPixmap("SMESH", tr("ICON_DLG_EDGE")));
107 QPixmap faceImage ( mgr->loadPixmap("SMESH", tr("ICON_DLG_TRIANGLE")));
108 QPixmap selectImage ( mgr->loadPixmap("SMESH", tr("ICON_SELECT")));
109 QPixmap addImage ( mgr->loadPixmap("SMESH", tr("ICON_APPEND")));
110 QPixmap removeImage ( mgr->loadPixmap("SMESH", tr("ICON_REMOVE")));
114 setCaption(tr("EXTRUSION_ALONG_PATH"));
115 setSizeGripEnabled(TRUE);
117 QGridLayout* topLayout = new QGridLayout(this);
118 topLayout->setSpacing(6);
119 topLayout->setMargin(11);
121 /***************************************************************/
122 // Elements type group box (1d / 2d elements)
123 GroupConstructors = new QButtonGroup(tr("SMESH_EXTRUSION"), this);
124 GroupConstructors->setColumnLayout(0, Qt::Vertical);
125 GroupConstructors->layout()->setSpacing(0);
126 GroupConstructors->layout()->setMargin(0);
127 QGridLayout* GroupConstructorsLayout = new QGridLayout(GroupConstructors->layout());
128 GroupConstructorsLayout->setAlignment(Qt::AlignTop);
129 GroupConstructorsLayout->setSpacing(6); GroupConstructorsLayout->setMargin(11);
131 Elements1dRB = new QRadioButton(GroupConstructors);
132 Elements1dRB->setPixmap(edgeImage);
133 Elements2dRB = new QRadioButton(GroupConstructors);
134 Elements2dRB->setPixmap(faceImage);
135 Elements1dRB->setChecked(true);
138 GroupConstructorsLayout->addWidget(Elements1dRB, 0, 0);
139 GroupConstructorsLayout->addWidget(Elements2dRB, 0, 2);
141 /***************************************************************/
142 // Arguments group box
143 GroupArguments = new QGroupBox(tr("EXTRUSION_1D"), this);
144 GroupArguments->setColumnLayout(0, Qt::Vertical);
145 GroupArguments->layout()->setSpacing(0); GroupArguments->layout()->setMargin(0);
146 QGridLayout* GroupArgumentsLayout = new QGridLayout(GroupArguments->layout());
147 GroupArgumentsLayout->setAlignment(Qt::AlignTop);
148 GroupArgumentsLayout->setSpacing(6); GroupArgumentsLayout->setMargin(11);
150 // Controls for elements selection
151 ElementsLab = new QLabel(tr("SMESH_ID_ELEMENTS"), GroupArguments);
153 SelectElementsButton = new QToolButton(GroupArguments);
154 SelectElementsButton->setPixmap(selectImage);
156 ElementsLineEdit = new QLineEdit(GroupArguments);
157 ElementsLineEdit->setValidator(new SMESHGUI_IdValidator(this));
159 // Controls for the whole mesh selection
160 MeshCheck = new QCheckBox(tr("SMESH_SELECT_WHOLE_MESH"), GroupArguments);
162 // Controls for path selection
163 PathGrp = new QGroupBox(tr("SMESH_PATH"), GroupArguments);
164 PathGrp->setColumnLayout(0, Qt::Vertical);
165 PathGrp->layout()->setSpacing(0); PathGrp->layout()->setMargin(0);
166 QGridLayout* PathGrpLayout = new QGridLayout(PathGrp->layout());
167 PathGrpLayout->setAlignment(Qt::AlignTop);
168 PathGrpLayout->setSpacing(6); PathGrpLayout->setMargin(11);
170 // Controls for path mesh selection
171 PathMeshLab = new QLabel(tr("SMESH_PATH_MESH"), PathGrp);
173 SelectPathMeshButton = new QToolButton(PathGrp);
174 SelectPathMeshButton->setPixmap(selectImage);
176 PathMeshLineEdit = new QLineEdit(PathGrp);
177 PathMeshLineEdit->setReadOnly(true);
179 // Controls for path shape selection
180 PathShapeLab = new QLabel(tr("SMESH_PATH_SHAPE"), PathGrp);
182 SelectPathShapeButton = new QToolButton(PathGrp);
183 SelectPathShapeButton->setPixmap(selectImage);
185 PathShapeLineEdit = new QLineEdit(PathGrp);
186 PathShapeLineEdit->setReadOnly(true);
188 // Controls for path starting point selection
189 StartPointLab = new QLabel(tr("SMESH_PATH_START"), PathGrp);
191 SelectStartPointButton = new QToolButton(PathGrp);
192 SelectStartPointButton->setPixmap(selectImage);
194 StartPointLineEdit = new QLineEdit(PathGrp);
195 StartPointLineEdit->setValidator(new QIntValidator(this));
198 PathGrpLayout->addWidget(PathMeshLab, 0, 0);
199 PathGrpLayout->addWidget(SelectPathMeshButton, 0, 1);
200 PathGrpLayout->addWidget(PathMeshLineEdit, 0, 2);
201 PathGrpLayout->addWidget(PathShapeLab, 1, 0);
202 PathGrpLayout->addWidget(SelectPathShapeButton, 1, 1);
203 PathGrpLayout->addWidget(PathShapeLineEdit, 1, 2);
204 PathGrpLayout->addWidget(StartPointLab, 2, 0);
205 PathGrpLayout->addWidget(SelectStartPointButton, 2, 1);
206 PathGrpLayout->addWidget(StartPointLineEdit, 2, 2);
208 // Controls for base point defining
209 BasePointCheck = new QCheckBox(tr("SMESH_USE_BASE_POINT"), GroupArguments);
211 BasePointGrp = new QGroupBox(tr("SMESH_BASE_POINT"), GroupArguments);
212 BasePointGrp->setColumnLayout(0, Qt::Vertical);
213 BasePointGrp->layout()->setSpacing(0); BasePointGrp->layout()->setMargin(0);
214 QGridLayout* BasePointGrpLayout = new QGridLayout(BasePointGrp->layout());
215 BasePointGrpLayout->setAlignment(Qt::AlignTop);
216 BasePointGrpLayout->setSpacing(6); BasePointGrpLayout->setMargin(11);
218 SelectBasePointButton = new QToolButton(BasePointGrp);
219 SelectBasePointButton->setPixmap(selectImage);
221 XLab = new QLabel(tr("SMESH_X"), BasePointGrp);
222 XLab->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs );
223 XSpin = new SMESHGUI_SpinBox(BasePointGrp);
224 YLab = new QLabel(tr("SMESH_Y"), BasePointGrp);
225 YLab->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs );
226 YSpin = new SMESHGUI_SpinBox(BasePointGrp);
227 ZLab = new QLabel(tr("SMESH_Z"), BasePointGrp);
228 ZLab->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs );
229 ZSpin = new SMESHGUI_SpinBox(BasePointGrp);
232 BasePointGrpLayout->addWidget(SelectBasePointButton, 0, 0);
233 BasePointGrpLayout->addWidget(XLab, 0, 1);
234 BasePointGrpLayout->addWidget(XSpin, 0, 2);
235 BasePointGrpLayout->addWidget(YLab, 0, 3);
236 BasePointGrpLayout->addWidget(YSpin, 0, 4);
237 BasePointGrpLayout->addWidget(ZLab, 0, 5);
238 BasePointGrpLayout->addWidget(ZSpin, 0, 6);
240 // Controls for angles defining
241 AnglesCheck = new QCheckBox(tr("SMESH_USE_ANGLES"), GroupArguments);
243 AnglesGrp = new QGroupBox(tr("SMESH_ANGLES"), GroupArguments);
244 AnglesGrp->setColumnLayout(0, Qt::Vertical);
245 AnglesGrp->layout()->setSpacing(0); AnglesGrp->layout()->setMargin(0);
246 QGridLayout* AnglesGrpLayout = new QGridLayout(AnglesGrp->layout());
247 AnglesGrpLayout->setAlignment(Qt::AlignTop);
248 AnglesGrpLayout->setSpacing(6); AnglesGrpLayout->setMargin(11);
250 AnglesList = new QListBox(AnglesGrp);
251 AnglesList->setSelectionMode(QListBox::Extended);
253 AddAngleButton = new QToolButton(AnglesGrp);
254 AddAngleButton->setPixmap(addImage);
256 RemoveAngleButton = new QToolButton(AnglesGrp);
257 RemoveAngleButton->setPixmap(removeImage);
259 AngleSpin = new SMESHGUI_SpinBox(AnglesGrp);
261 LinearAnglesCheck = new QCheckBox(tr("LINEAR_ANGLES"), AnglesGrp);
264 QVBoxLayout* bLayout = new QVBoxLayout();
265 bLayout->addWidget(AddAngleButton);
266 bLayout->addSpacing(6);
267 bLayout->addWidget(RemoveAngleButton);
268 bLayout->addStretch();
269 AnglesGrpLayout->addMultiCellWidget(AnglesList, 0, 1, 0, 0);
270 AnglesGrpLayout->addMultiCellLayout(bLayout, 0, 1, 1, 1);
271 AnglesGrpLayout->addWidget( AngleSpin, 0, 2 );
272 AnglesGrpLayout->addWidget( LinearAnglesCheck, 2, 0 );
273 AnglesGrpLayout->setRowStretch(1, 10);
275 // CheckBox for groups generation
276 MakeGroupsCheck = new QCheckBox(tr("SMESH_MAKE_GROUPS"), GroupArguments);
277 MakeGroupsCheck->setChecked(true);
280 GroupArgumentsLayout->addWidget( ElementsLab, 0, 0 );
281 GroupArgumentsLayout->addWidget( SelectElementsButton, 0, 1 );
282 GroupArgumentsLayout->addWidget( ElementsLineEdit, 0, 2 );
283 GroupArgumentsLayout->addMultiCellWidget(MeshCheck, 1, 1, 0, 2);
284 GroupArgumentsLayout->addMultiCellWidget(PathGrp, 2, 2, 0, 2);
285 GroupArgumentsLayout->addWidget( BasePointCheck, 3, 0 );
286 GroupArgumentsLayout->addMultiCellWidget(BasePointGrp, 3, 4, 1, 2);
287 GroupArgumentsLayout->addWidget( AnglesCheck, 5, 0 );
288 GroupArgumentsLayout->addMultiCellWidget(AnglesGrp, 5, 6, 1, 2);
289 GroupArgumentsLayout->addMultiCellWidget(MakeGroupsCheck, 7, 7, 0, 2);
290 GroupArgumentsLayout->setRowStretch(6, 10);
292 /***************************************************************/
293 // common buttons group box
294 GroupButtons = new QGroupBox(this);
295 GroupButtons->setColumnLayout(0, Qt::Vertical);
296 GroupButtons->layout()->setSpacing(0);
297 GroupButtons->layout()->setMargin(0);
298 QGridLayout* GroupButtonsLayout = new QGridLayout(GroupButtons->layout());
299 GroupButtonsLayout->setAlignment(Qt::AlignTop);
300 GroupButtonsLayout->setSpacing(6); GroupButtonsLayout->setMargin(11);
302 OkButton = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), GroupButtons);
303 OkButton->setAutoDefault(true);
304 OkButton->setDefault(true);
306 ApplyButton = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons);
307 ApplyButton->setAutoDefault(true);
309 CloseButton = new QPushButton(tr("SMESH_BUT_CLOSE"), GroupButtons);
310 CloseButton->setAutoDefault(true);
312 HelpButton = new QPushButton(tr("SMESH_BUT_HELP"), GroupButtons);
313 HelpButton->setAutoDefault(true);
316 GroupButtonsLayout->addWidget(OkButton, 0, 0);
317 GroupButtonsLayout->addWidget(ApplyButton, 0, 1);
318 GroupButtonsLayout->addWidget(CloseButton, 0, 3);
319 GroupButtonsLayout->addWidget(HelpButton, 0, 4);
320 GroupButtonsLayout->addColSpacing(2, 10);
321 GroupButtonsLayout->setColStretch(2, 10);
323 /***************************************************************/
325 topLayout->addWidget(GroupConstructors, 0, 0);
326 topLayout->addWidget(GroupArguments, 1, 0);
327 topLayout->addWidget(GroupButtons, 2, 0);
329 /***************************************************************/
331 XSpin->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3);
332 YSpin->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3);
333 ZSpin->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3);
334 AngleSpin->RangeStepAndValidator(-180.0, 180.0, 5.0, 3);
336 mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector();
338 mySMESHGUI->SetActiveDialogBox(this);
340 // Costruction of the logical filter for the elements: mesh/sub-mesh/group
341 SMESH_TypeFilter* aMeshOrSubMeshFilter = new SMESH_TypeFilter (MESHorSUBMESH);
342 SMESH_TypeFilter* aSmeshGroupFilter = new SMESH_TypeFilter (GROUP);
344 QPtrList<SUIT_SelectionFilter> aListOfFilters;
345 if (aMeshOrSubMeshFilter) aListOfFilters.append(aMeshOrSubMeshFilter);
346 if (aSmeshGroupFilter) aListOfFilters.append(aSmeshGroupFilter);
348 myElementsFilter = new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR);
349 myPathMeshFilter = new SMESH_TypeFilter (MESH);
351 myHelpFileName = "extrusion_along_path_page.html";
355 /***************************************************************/
356 // signals-slots connections
357 connect(OkButton, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
358 connect(CloseButton, SIGNAL(clicked()), this, SLOT(reject()));
359 connect(ApplyButton, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
360 connect(HelpButton, SIGNAL(clicked()), this, SLOT(ClickOnHelp()));
362 connect(AddAngleButton, SIGNAL(clicked()), this, SLOT(OnAngleAdded()));
363 connect(RemoveAngleButton, SIGNAL(clicked()), this, SLOT(OnAngleRemoved()));
365 connect(GroupConstructors, SIGNAL(clicked(int)), SLOT(ConstructorsClicked(int)));
367 connect(SelectElementsButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
368 connect(SelectPathMeshButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
369 connect(SelectPathShapeButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
370 connect(SelectStartPointButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
371 connect(SelectBasePointButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
373 connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
374 connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
375 connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(reject()));
377 connect(ElementsLineEdit, SIGNAL(textChanged(const QString&)),
378 SLOT(onTextChange(const QString&)));
379 connect(StartPointLineEdit, SIGNAL(textChanged(const QString&)),
380 SLOT(onTextChange(const QString&)));
382 connect(MeshCheck, SIGNAL(toggled(bool)), SLOT(onSelectMesh()));
383 connect(AnglesCheck, SIGNAL(toggled(bool)), SLOT(onAnglesCheck()));
384 connect(BasePointCheck, SIGNAL(toggled(bool)), SLOT(onBasePointCheck()));
386 AnglesList->installEventFilter(this);
387 ElementsLineEdit->installEventFilter(this);
388 StartPointLineEdit->installEventFilter(this);
389 XSpin->editor()->installEventFilter(this);
390 YSpin->editor()->installEventFilter(this);
391 ZSpin->editor()->installEventFilter(this);
393 /***************************************************************/
395 this->show(); // displays Dialog
398 //=================================================================================
399 // function : ~SMESHGUI_ExtrusionAlongPathDlg()
400 // purpose : destructor
401 //=================================================================================
402 SMESHGUI_ExtrusionAlongPathDlg::~SMESHGUI_ExtrusionAlongPathDlg()
404 // no need to delete child widgets, Qt does it all for us
407 //=================================================================================
409 // purpose : initialization
410 //=================================================================================
411 void SMESHGUI_ExtrusionAlongPathDlg::Init (bool ResetControls)
414 myEditCurrentArgument = 0;
416 myMesh = SMESH::SMESH_Mesh::_nil();
417 myIDSource = SMESH::SMESH_IDSource::_nil();
419 myPathMesh = SMESH::SMESH_Mesh::_nil();
420 myPathShape = GEOM::GEOM_Object::_nil();
422 ElementsLineEdit->clear();
423 PathMeshLineEdit->clear();
424 PathShapeLineEdit->clear();
425 StartPointLineEdit->clear();
428 XSpin->SetValue(0.0);
429 YSpin->SetValue(0.0);
430 ZSpin->SetValue(0.0);
432 AngleSpin->SetValue(45);
433 MeshCheck->setChecked(false);
434 ConstructorsClicked(0);
439 SetEditCurrentArgument(0);
442 //=================================================================================
443 // function : ConstructorsClicked()
444 // purpose : Called when user changes type of elements (1d / 2d)
445 //=================================================================================
446 void SMESHGUI_ExtrusionAlongPathDlg::ConstructorsClicked (int type)
448 if (myType == type) return;
450 disconnect(mySelectionMgr, 0, this, 0);
453 GroupArguments->setTitle(tr("EXTRUSION_1D"));
455 GroupArguments->setTitle(tr("EXTRUSION_2D"));
457 // clear elements ID list
458 if (!MeshCheck->isChecked()) {
459 ElementsLineEdit->clear();
461 // set selection mode if necessary
462 if (myEditCurrentArgument == ElementsLineEdit) {
463 mySelectionMgr->clearSelected();
464 mySelectionMgr->clearFilters();
465 SMESH::SetPickable();
467 SMESH::SetPointRepresentation(false);
468 if (MeshCheck->isChecked()) {
469 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
470 aViewWindow->SetSelectionMode(ActorSelection);
471 mySelectionMgr->installFilter(myElementsFilter);
475 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
476 aViewWindow->SetSelectionMode(EdgeSelection);
480 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
481 aViewWindow->SetSelectionMode(FaceSelection);
485 connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
490 //=================================================================================
491 // function : ClickOnApply()
492 // purpose : Called when user presses <Apply> button
493 //=================================================================================
494 bool SMESHGUI_ExtrusionAlongPathDlg::ClickOnApply()
496 if (mySMESHGUI->isActiveStudyLocked())
499 if (myMesh->_is_nil() || MeshCheck->isChecked() && myIDSource->_is_nil() ||
500 !myMeshActor || myPathMesh->_is_nil() || myPathShape->_is_nil())
503 SMESH::long_array_var anElementsId = new SMESH::long_array;
505 if (MeshCheck->isChecked()) {
506 // If "Select whole mesh, submesh or group" check box is on ->
507 // get all elements of the required type from the object selected
509 // if MESH object is selected
510 if (!CORBA::is_nil(SMESH::SMESH_Mesh::_narrow(myIDSource))) {
512 SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow(myIDSource);
513 // get IDs from mesh...
514 if (Elements1dRB->isChecked())
516 anElementsId = aMesh->GetElementsByType(SMESH::EDGE);
517 else if (Elements2dRB->isChecked()) {
518 anElementsId = aMesh->GetElementsByType(SMESH::FACE);
521 // SUBMESH is selected
522 if (!CORBA::is_nil(SMESH::SMESH_subMesh::_narrow(myIDSource))) {
524 SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow(myIDSource);
525 // get IDs from submesh
526 if (Elements1dRB->isChecked())
528 anElementsId = aSubMesh->GetElementsByType(SMESH::EDGE);
529 else if (Elements2dRB->isChecked())
531 anElementsId = aSubMesh->GetElementsByType(SMESH::FACE);
534 if (!CORBA::is_nil(SMESH::SMESH_GroupBase::_narrow(myIDSource))) {
536 SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow(myIDSource);
537 // get IDs from group
538 // 1d elements or 2d elements
539 if (Elements1dRB->isChecked() && aGroup->GetType() == SMESH::EDGE ||
540 Elements2dRB->isChecked() && aGroup->GetType() == SMESH::FACE)
541 anElementsId = aGroup->GetListOfID();
544 // If "Select whole mesh, submesh or group" check box is off ->
545 // use only elements of given type selected by user
547 SMDS_Mesh* aMesh = myMeshActor->GetObject()->GetMesh();
549 QStringList aListElementsId = QStringList::split(" ", ElementsLineEdit->text(), false);
550 anElementsId = new SMESH::long_array;
551 anElementsId->length(aListElementsId.count());
554 for (int i = 0; i < aListElementsId.count(); i++) {
555 long ind = aListElementsId[ i ].toLong(&bOk);
557 const SMDS_MeshElement* e = aMesh->FindElement(ind);
559 bool typeMatch = Elements1dRB->isChecked() && e->GetType() == SMDSAbs_Edge ||
560 Elements2dRB->isChecked() && e->GetType() == SMDSAbs_Face;
562 anElementsId[ j++ ] = ind;
566 anElementsId->length(j);
570 if (anElementsId->length() <= 0) {
574 if (StartPointLineEdit->text().stripWhiteSpace().isEmpty()) {
579 long aNodeStart = StartPointLineEdit->text().toLong(&bOk);
585 SMESH::double_array_var anAngles = new SMESH::double_array;
586 if (AnglesCheck->isChecked()) {
587 anAngles->length(AnglesList->count());
590 for (int i = 0; i < AnglesList->count(); i++) {
591 double angle = AnglesList->text(i).toDouble(&bOk);
593 anAngles[ j++ ] = angle*PI/180;
599 SMESH::PointStruct aBasePoint;
600 if (BasePointCheck->isChecked()) {
601 aBasePoint.x = XSpin->GetValue();
602 aBasePoint.y = YSpin->GetValue();
603 aBasePoint.z = ZSpin->GetValue();
607 SUIT_OverrideCursor wc;
608 SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
609 if ( LinearAnglesCheck->isChecked() )
610 anAngles = aMeshEditor->LinearAnglesVariation( myPathMesh, myPathShape, anAngles );
612 SMESH::SMESH_MeshEditor::Extrusion_Error retVal;
613 if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() )
614 SMESH::ListOfGroups_var groups =
615 aMeshEditor->ExtrusionAlongPathMakeGroups(anElementsId, myPathMesh,
616 myPathShape, aNodeStart,
617 AnglesCheck->isChecked(), anAngles,
618 BasePointCheck->isChecked(), aBasePoint, retVal);
620 retVal = aMeshEditor->ExtrusionAlongPath(anElementsId, myPathMesh,
621 myPathShape, aNodeStart,
622 AnglesCheck->isChecked(), anAngles,
623 BasePointCheck->isChecked(), aBasePoint);
628 case SMESH::SMESH_MeshEditor::EXTR_NO_ELEMENTS:
629 SUIT_MessageBox::warn1(SMESHGUI::desktop(),
631 tr("NO_ELEMENTS_SELECTED"),
634 case SMESH::SMESH_MeshEditor::EXTR_PATH_NOT_EDGE:
635 SUIT_MessageBox::warn1(SMESHGUI::desktop(),
637 tr("SELECTED_PATH_IS_NOT_EDGE"),
640 case SMESH::SMESH_MeshEditor::EXTR_BAD_PATH_SHAPE:
641 SUIT_MessageBox::warn1(SMESHGUI::desktop(),
643 tr("BAD_SHAPE_TYPE"),
646 case SMESH::SMESH_MeshEditor::EXTR_BAD_STARTING_NODE:
647 SUIT_MessageBox::warn1(SMESHGUI::desktop(),
649 tr("EXTR_BAD_STARTING_NODE"),
652 case SMESH::SMESH_MeshEditor::EXTR_BAD_ANGLES_NUMBER:
653 SUIT_MessageBox::warn1(SMESHGUI::desktop(),
655 tr("WRONG_ANGLES_NUMBER"),
658 case SMESH::SMESH_MeshEditor::EXTR_CANT_GET_TANGENT:
659 SUIT_MessageBox::warn1(SMESHGUI::desktop(),
661 tr("CANT_GET_TANGENT"),
664 case SMESH::SMESH_MeshEditor::EXTR_OK:
671 //mySelectionMgr->clearSelected();
672 SMESH::Update( myMeshActor->getIO(), myMeshActor->GetVisibility() );
673 if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() )
674 mySMESHGUI->updateObjBrowser(true); // new groups may appear
675 //SMESH::UpdateView();
677 ConstructorsClicked(GetConstructorId());
681 //=================================================================================
682 // function : ClickOnOk()
683 // purpose : Called when user presses <OK> button
684 //=================================================================================
685 void SMESHGUI_ExtrusionAlongPathDlg::ClickOnOk()
691 //=================================================================================
692 // function : ClickOnHelp()
694 //=================================================================================
695 void SMESHGUI_ExtrusionAlongPathDlg::ClickOnHelp()
697 LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
699 app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
703 platform = "winapplication";
705 platform = "application";
707 SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"),
708 QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
709 arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName),
710 QObject::tr("BUT_OK"));
714 //=================================================================================
715 // function : reject()
716 // purpose : Called when dialog box is closed
717 //=================================================================================
718 void SMESHGUI_ExtrusionAlongPathDlg::reject()
720 disconnect(mySelectionMgr, 0, this, 0);
721 mySelectionMgr->clearFilters();
722 //mySelectionMgr->clearSelected();
723 SMESH::SetPickable(); // ???
724 SMESH::SetPointRepresentation(false);
725 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
726 aViewWindow->SetSelectionMode(ActorSelection);
727 mySMESHGUI->ResetState();
731 //=======================================================================
732 // function : onTextChange()
734 //=======================================================================
735 void SMESHGUI_ExtrusionAlongPathDlg::onTextChange (const QString& theNewText)
737 QLineEdit* send = (QLineEdit*)sender();
745 if (send != StartPointLineEdit && send != ElementsLineEdit)
746 send = ElementsLineEdit;
748 if (send == ElementsLineEdit && myEditCurrentArgument == ElementsLineEdit) {
749 // hilight entered elements
750 SMDS_Mesh* aMesh = 0;
752 aMesh = myMeshActor->GetObject()->GetMesh();
755 //mySelectionMgr->clearSelected();
756 //mySelectionMgr->AddIObject(myMeshActor->getIO());
758 aList.Append(myMeshActor->getIO());
759 mySelectionMgr->setSelectedObjects(aList, false);
761 QStringList aListId = QStringList::split(" ", theNewText, false);
763 const Handle(SALOME_InteractiveObject)& anIO = myMeshActor->getIO();
764 TColStd_MapOfInteger newIndices;
765 for (int i = 0; i < aListId.count(); i++) {
766 long ind = aListId[ i ].toLong(&bOk);
768 const SMDS_MeshElement* e = aMesh->FindElement(ind);
770 // check also type of element
771 bool typeMatch = Elements1dRB->isChecked() && e->GetType() == SMDSAbs_Edge ||
772 Elements2dRB->isChecked() && e->GetType() == SMDSAbs_Face;
774 newIndices.Add(e->GetID());
778 mySelector->AddOrRemoveIndex(anIO, newIndices, false);
779 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
780 aViewWindow->highlight( anIO, true, true );
782 } else if (send == StartPointLineEdit &&
783 myEditCurrentArgument == StartPointLineEdit) {
784 if (!myPathMesh->_is_nil()) {
785 SMESH_Actor* aPathActor = SMESH::FindActorByObject(myPathMesh);
786 SMDS_Mesh* aMesh = 0;
788 aMesh = aPathActor->GetObject()->GetMesh();
790 //mySelectionMgr->clearSelected();
791 //mySelectionMgr->AddIObject(aPathActor->getIO());
793 aList.Append(aPathActor->getIO());
794 mySelectionMgr->setSelectedObjects(aList, false);
797 long ind = theNewText.toLong(&bOk);
799 const SMDS_MeshNode* n = aMesh->FindNode(ind);
801 //if (!mySelectionMgr->IsIndexSelected(aPathActor->getIO(), n->GetID())) {
802 TColStd_MapOfInteger newIndices;
803 newIndices.Add(n->GetID());
804 mySelector->AddOrRemoveIndex( aPathActor->getIO(), newIndices, false );
805 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
806 aViewWindow->highlight( aPathActor->getIO(), true, true );
814 //=================================================================================
815 // function : SelectionIntoArgument()
816 // purpose : Called when selection as changed or other case
817 //=================================================================================
818 void SMESHGUI_ExtrusionAlongPathDlg::SelectionIntoArgument()
822 // return if dialog box is inactive
823 if (!GroupButtons->isEnabled())
826 // selected objects count
827 const SALOME_ListIO& aList = mySelector->StoredIObjects();
828 int nbSel = aList.Extent();
835 if (myEditCurrentArgument == ElementsLineEdit) {
836 // we are now selecting mesh elements (or whole mesh/submesh/group)
838 ElementsLineEdit->clear();
839 myMesh = SMESH::SMESH_Mesh::_nil();
840 myIDSource = SMESH::SMESH_IDSource::_nil();
843 // try to get mesh from selection
844 Handle(SALOME_InteractiveObject) IO = aList.First();
845 myMesh = SMESH::GetMeshByIO(IO);
846 if (myMesh->_is_nil())
849 // MakeGroups is available if there are groups
850 if ( myMesh->NbGroups() == 0 ) {
851 MakeGroupsCheck->setChecked(false);
852 MakeGroupsCheck->setEnabled(false);
854 MakeGroupsCheck->setEnabled(true);
857 myMeshActor = SMESH::FindActorByObject(myMesh);
861 if (MeshCheck->isChecked()) {
862 // If "Select whole mesh, submesh or group" check box is on ->
863 // get ID source and put it's name to the edit box
865 SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
867 myIDSource = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>(IO);
868 ElementsLineEdit->setText(aString);
870 // If "Select whole mesh, submesh or group" check box is off ->
871 // try to get selected elements IDs
873 //int aNbUnits = SMESH::GetNameOfSelectedElements(mySelectionMgr, aString);
874 SMESH::GetNameOfSelectedElements(mySelector, IO, aString);
875 ElementsLineEdit->setText(aString);
877 } else if (myEditCurrentArgument == PathMeshLineEdit) {
878 // we are now selecting path mesh
880 PathMeshLineEdit->clear();
881 myPathMesh = SMESH::SMESH_Mesh::_nil();
882 PathShapeLineEdit->clear();
883 myPathShape = GEOM::GEOM_Object::_nil();
884 StartPointLineEdit->clear();
886 // try to get mesh from selection
887 Handle(SALOME_InteractiveObject) IO = aList.First();
888 myPathMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO);
889 if(myPathMesh->_is_nil())
893 SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
894 PathMeshLineEdit->setText(aString);
895 } else if (myEditCurrentArgument == PathShapeLineEdit) {
896 // we are now selecting path mesh
898 PathShapeLineEdit->clear();
899 myPathShape = GEOM::GEOM_Object::_nil();
900 StartPointLineEdit->clear();
902 // return if path mesh is not yet selected
903 if (myPathMesh->_is_nil())
906 // try to get shape from selection
907 Handle(SALOME_InteractiveObject) IO = aList.First();
908 myPathShape = SMESH::IObjectToInterface<GEOM::GEOM_Object>(IO);
909 if (myPathShape->_is_nil())
913 SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
914 PathShapeLineEdit->setText(aString);
915 } else if (myEditCurrentArgument == StartPointLineEdit) {
916 // we are now selecting start point of path
918 StartPointLineEdit->clear();
920 // return if path mesh or path shape is not yet selected
921 if (myPathMesh->_is_nil() || myPathShape->_is_nil())
924 // try to get shape from selection
925 Handle(SALOME_InteractiveObject) IO = aList.First();
927 SMESH_Actor* aPathActor = SMESH::FindActorByObject(myPathMesh);
932 int aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, aPathActor->getIO(), aString);
934 StartPointLineEdit->setText(aString.stripWhiteSpace());
936 } else if (myEditCurrentArgument == XSpin) {
937 // we are now selecting base point
938 // reset is not performed here!
940 // return if is not enabled
941 if (!BasePointGrp->isEnabled())
944 // try to get shape from selection
945 Handle(SALOME_InteractiveObject) IO = aList.First();
947 // check if geom vertex is selected
948 GEOM::GEOM_Object_var aGeomObj = SMESH::IObjectToInterface<GEOM::GEOM_Object>(IO);
949 TopoDS_Vertex aVertex;
950 if (!aGeomObj->_is_nil()) {
951 if (aGeomObj->IsShape() && GEOMBase::GetShape(aGeomObj, aVertex) && !aVertex.IsNull()) {
952 gp_Pnt aPnt = BRep_Tool::Pnt(aVertex);
953 XSpin->SetValue(aPnt.X());
954 YSpin->SetValue(aPnt.Y());
955 ZSpin->SetValue(aPnt.Z());
960 // check if smesh node is selected
961 SMESH::SMESH_Mesh_var aMesh = SMESH::GetMeshByIO(IO);
962 if (aMesh->_is_nil())
966 int aNbUnits = SMESH::GetNameOfSelectedNodes(mySelector, myMeshActor->getIO(), aString);
967 // return if more than one node is selected
971 SMESH_Actor* aMeshActor = SMESH::FindActorByObject(aMesh);
975 SMDS_Mesh* mesh = aMeshActor->GetObject()->GetMesh();
979 const SMDS_MeshNode* n = mesh->FindNode(aString.toLong());
983 XSpin->SetValue(n->X());
984 YSpin->SetValue(n->Y());
985 ZSpin->SetValue(n->Z());
989 //=================================================================================
990 // function : SetEditCurrentArgument()
992 //=================================================================================
993 void SMESHGUI_ExtrusionAlongPathDlg::SetEditCurrentArgument()
995 QToolButton* send = (QToolButton*)sender();
996 if (send != SelectElementsButton &&
997 send != SelectPathMeshButton &&
998 send != SelectPathShapeButton &&
999 send != SelectStartPointButton &&
1000 send != SelectBasePointButton)
1002 SetEditCurrentArgument(send);
1005 //=================================================================================
1006 // function : SetEditCurrentArgument()
1008 //=================================================================================
1009 void SMESHGUI_ExtrusionAlongPathDlg::SetEditCurrentArgument (QToolButton* button)
1011 disconnect(mySelectionMgr, 0, this, 0);
1012 mySelectionMgr->clearSelected();
1013 mySelectionMgr->clearFilters();
1014 SMESH::SetPickable();
1016 if (button == SelectElementsButton) {
1017 myEditCurrentArgument = ElementsLineEdit;
1018 SMESH::SetPointRepresentation(false);
1019 if (MeshCheck->isChecked()) {
1020 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
1021 aViewWindow->SetSelectionMode(ActorSelection);
1022 mySelectionMgr->installFilter(myElementsFilter);
1024 if (Elements1dRB->isChecked())
1026 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
1027 aViewWindow->SetSelectionMode(EdgeSelection);
1029 else if (Elements2dRB->isChecked())
1031 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
1032 aViewWindow->SetSelectionMode(FaceSelection);
1035 } else if (button == SelectPathMeshButton) {
1036 myEditCurrentArgument = PathMeshLineEdit;
1037 SMESH::SetPointRepresentation(false);
1038 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
1039 aViewWindow->SetSelectionMode(ActorSelection);
1040 mySelectionMgr->installFilter(myPathMeshFilter);
1042 else if (button == SelectPathShapeButton) {
1043 myEditCurrentArgument = PathShapeLineEdit;
1044 SMESH::SetPointRepresentation(false);
1045 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
1046 aViewWindow->SetSelectionMode(ActorSelection);
1048 if (!myPathMesh->_is_nil()) {
1049 GEOM::GEOM_Object_var aMainShape = myPathMesh->GetShapeToMesh();
1050 SMESH_Actor* aPathActor = SMESH::FindActorByObject(myPathMesh);
1052 if (!aMainShape->_is_nil() && aPathActor)
1053 mySelectionMgr->installFilter(new SMESH_NumberFilter ("GEOM", TopAbs_SHAPE, -1,
1054 TopAbs_EDGE, aMainShape));
1055 //SMESH::SetPickable(aPathActor);
1058 else if (button == SelectStartPointButton) {
1059 myEditCurrentArgument = StartPointLineEdit;
1060 if (!myPathMesh->_is_nil()) {
1061 SMESH_Actor* aPathActor = SMESH::FindActorByObject(myPathMesh);
1063 SMESH::SetPointRepresentation(true);
1064 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
1065 aViewWindow->SetSelectionMode(NodeSelection);
1066 SMESH::SetPickable(aPathActor);
1070 else if (button == SelectBasePointButton) {
1071 myEditCurrentArgument = XSpin;
1072 SMESH::SetPointRepresentation(true);
1073 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
1074 aViewWindow->SetSelectionMode(NodeSelection);
1076 SMESH_TypeFilter* aMeshOrSubMeshFilter = new SMESH_TypeFilter(MESHorSUBMESH);
1077 SMESH_TypeFilter* aSmeshGroupFilter = new SMESH_TypeFilter(GROUP);
1078 SMESH_NumberFilter* aVertexFilter = new SMESH_NumberFilter ("GEOM", TopAbs_SHAPE,
1080 QPtrList<SUIT_SelectionFilter> aListOfFilters;
1081 if (aMeshOrSubMeshFilter) aListOfFilters.append(aMeshOrSubMeshFilter);
1082 if (aSmeshGroupFilter) aListOfFilters.append(aSmeshGroupFilter);
1083 if (aVertexFilter) aListOfFilters.append(aVertexFilter);
1085 mySelectionMgr->installFilter(new SMESH_LogicalFilter
1086 (aListOfFilters, SMESH_LogicalFilter::LO_OR));
1089 if (myEditCurrentArgument && !myEditCurrentArgument->hasFocus())
1090 myEditCurrentArgument->setFocus();
1092 connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
1093 SelectionIntoArgument();
1096 //=================================================================================
1097 // function : DeactivateActiveDialog()
1098 // purpose : Deactivates this dialog
1099 //=================================================================================
1100 void SMESHGUI_ExtrusionAlongPathDlg::DeactivateActiveDialog()
1102 if (GroupConstructors->isEnabled()) {
1103 GroupConstructors->setEnabled(false);
1104 GroupArguments->setEnabled(false);
1105 GroupButtons->setEnabled(false);
1106 mySMESHGUI->ResetState();
1107 mySMESHGUI->SetActiveDialogBox(0);
1111 //=================================================================================
1112 // function : ActivateThisDialog()
1113 // purpose : Activates this dialog
1114 //=================================================================================
1115 void SMESHGUI_ExtrusionAlongPathDlg::ActivateThisDialog()
1117 // Emit a signal to deactivate the active dialog
1118 mySMESHGUI->EmitSignalDeactivateDialog();
1119 GroupConstructors->setEnabled(true);
1120 GroupArguments->setEnabled(true);
1121 GroupButtons->setEnabled(true);
1123 mySMESHGUI->SetActiveDialogBox(this);
1125 ConstructorsClicked(GetConstructorId());
1126 SelectionIntoArgument();
1129 //=================================================================================
1130 // function : enterEvent()
1131 // purpose : Mouse enter event
1132 //=================================================================================
1133 void SMESHGUI_ExtrusionAlongPathDlg::enterEvent (QEvent*)
1135 if (!GroupConstructors->isEnabled())
1136 ActivateThisDialog();
1139 //=======================================================================
1140 // function : onSelectMesh()
1142 //=======================================================================
1143 void SMESHGUI_ExtrusionAlongPathDlg::onSelectMesh()
1145 bool toSelectMesh = MeshCheck->isChecked();
1147 ElementsLineEdit->setReadOnly(toSelectMesh);
1148 ElementsLab->setText(toSelectMesh ? tr("SMESH_NAME") : tr("SMESH_ID_ELEMENTS"));
1149 ElementsLineEdit->clear();
1151 SetEditCurrentArgument(SelectElementsButton);
1154 //=================================================================================
1155 // function : GetConstructorId()
1157 //=================================================================================
1158 int SMESHGUI_ExtrusionAlongPathDlg::GetConstructorId()
1160 if (GroupConstructors != NULL && GroupConstructors->selected() != NULL)
1161 return GroupConstructors->id(GroupConstructors->selected());
1165 //=======================================================================
1166 // function : onAnglesCheck()
1167 // purpose : called when "Use Angles" check box is switched
1168 //=======================================================================
1169 void SMESHGUI_ExtrusionAlongPathDlg::onAnglesCheck()
1171 AnglesGrp->setEnabled(AnglesCheck->isChecked());
1174 //=======================================================================
1175 // function : onBasePointCheck()
1176 // purpose : called when "Use Base Point" check box is switched
1177 //=======================================================================
1178 void SMESHGUI_ExtrusionAlongPathDlg::onBasePointCheck()
1180 BasePointGrp->setEnabled(BasePointCheck->isChecked());
1183 //=======================================================================
1184 // function : OnAngleAdded()
1185 // purpose : Called when user adds angle to the list
1186 //=======================================================================
1187 void SMESHGUI_ExtrusionAlongPathDlg::OnAngleAdded()
1189 AnglesList->insertItem(QString::number(AngleSpin->GetValue()));
1192 //=======================================================================
1193 // function : OnAngleRemoved()
1194 // purpose : Called when user removes angle(s) from the list
1195 //=======================================================================
1196 void SMESHGUI_ExtrusionAlongPathDlg::OnAngleRemoved()
1198 QList<QListBoxItem> aList;
1199 aList.setAutoDelete(false);
1200 for (int i = 0; i < AnglesList->count(); i++)
1201 if (AnglesList->isSelected(i))
1202 aList.append(AnglesList->item(i));
1204 for (int i = 0; i < aList.count(); i++)
1208 //=================================================================================
1209 // function : eventFilter()
1210 // purpose : event filter ???
1211 //=================================================================================
1212 bool SMESHGUI_ExtrusionAlongPathDlg::eventFilter (QObject* object, QEvent* event)
1214 if (event->type() == QEvent::KeyPress) {
1215 QKeyEvent* ke = (QKeyEvent*)event;
1216 if (object == AnglesList) {
1217 if (ke->key() == Key_Delete)
1221 else if (event->type() == QEvent::FocusIn) {
1222 if (object == ElementsLineEdit) {
1223 if (myEditCurrentArgument != ElementsLineEdit)
1224 SetEditCurrentArgument(SelectElementsButton);
1226 else if (object == StartPointLineEdit) {
1227 if (myEditCurrentArgument != StartPointLineEdit)
1228 SetEditCurrentArgument(SelectStartPointButton);
1230 else if (object == XSpin->editor() || object == YSpin->editor() || object == ZSpin->editor()) {
1231 if (myEditCurrentArgument != XSpin)
1232 SetEditCurrentArgument(SelectBasePointButton);
1235 return QDialog::eventFilter(object, event);
1238 //=================================================================================
1239 // function : keyPressEvent()
1241 //=================================================================================
1242 void SMESHGUI_ExtrusionAlongPathDlg::keyPressEvent( QKeyEvent* e )
1244 QDialog::keyPressEvent( e );
1245 if ( e->isAccepted() )
1248 if ( e->key() == Key_F1 )