1 // SMESH SMESHGUI : GUI for SMESH component
3 // Copyright (C) 2003 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
24 // File : SMESHGUI_ExtrusionAlongPathDlg.cxx
25 // Author : Vadim SANDLER
29 #include "SMESHGUI_ExtrusionAlongPathDlg.h"
32 #include "SMESHGUI_Utils.h"
33 #include "SMESHGUI_VTKUtils.h"
34 #include "SMESHGUI_MeshUtils.h"
35 #include "SMESHGUI_SpinBox.h"
36 #include "SMESHGUI_IdValidator.h"
38 #include "SMESH_Actor.h"
39 #include "SMESH_TypeFilter.hxx"
40 #include "SMESH_NumberFilter.hxx"
41 #include "SMESH_LogicalFilter.hxx"
43 #include "SMDS_Mesh.hxx"
47 #include "SUIT_ResourceMgr.h"
48 #include "SUIT_OverrideCursor.h"
49 #include "SUIT_Desktop.h"
50 #include "SUIT_MessageBox.h"
51 #include "SUIT_Session.h"
53 #include "LightApp_Application.h"
55 #include "SVTK_ViewModel.h"
56 #include "SVTK_ViewWindow.h"
57 #include "SVTK_Selector.h"
58 #include "SVTK_Selection.h"
59 #include "SALOME_ListIO.hxx"
61 #include "utilities.h"
64 #include <BRep_Tool.hxx>
65 #include <TopoDS_Shape.hxx>
67 #include <TopoDS_Vertex.hxx>
69 #include <TColStd_MapOfInteger.hxx>
70 #include <TColStd_IndexedMapOfInteger.hxx>
73 #include <qapplication.h>
74 #include <qbuttongroup.h>
75 #include <qgroupbox.h>
77 #include <qlineedit.h>
78 #include <qpushbutton.h>
79 #include <qtoolbutton.h>
80 #include <qradiobutton.h>
81 #include <qcheckbox.h>
84 #include <qvalidator.h>
89 #include "SALOMEconfig.h"
90 #include CORBA_SERVER_HEADER(SMESH_Group)
91 #include CORBA_SERVER_HEADER(SMESH_MeshEditor)
95 //=================================================================================
96 // function : SMESHGUI_ExtrusionAlongPathDlg()
97 // purpose : constructor
98 //=================================================================================
99 SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theModule,
101 : QDialog( SMESH::GetDesktop( theModule ), "SMESHGUI_ExtrusionAlongPathDlg", modal,
102 WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose),
103 mySMESHGUI( theModule ),
104 mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
106 SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( mySMESHGUI );
107 QPixmap edgeImage ( mgr->loadPixmap("SMESH", tr("ICON_DLG_EDGE")));
108 QPixmap faceImage ( mgr->loadPixmap("SMESH", tr("ICON_DLG_TRIANGLE")));
109 QPixmap selectImage ( mgr->loadPixmap("SMESH", tr("ICON_SELECT")));
110 QPixmap addImage ( mgr->loadPixmap("SMESH", tr("ICON_APPEND")));
111 QPixmap removeImage ( mgr->loadPixmap("SMESH", tr("ICON_REMOVE")));
115 setCaption(tr("EXTRUSION_ALONG_PATH"));
116 setSizeGripEnabled(TRUE);
118 QGridLayout* topLayout = new QGridLayout(this);
119 topLayout->setSpacing(6);
120 topLayout->setMargin(11);
122 /***************************************************************/
123 // Elements type group box (1d / 2d elements)
124 GroupConstructors = new QButtonGroup(tr("SMESH_EXTRUSION"), this);
125 GroupConstructors->setColumnLayout(0, Qt::Vertical);
126 GroupConstructors->layout()->setSpacing(0);
127 GroupConstructors->layout()->setMargin(0);
128 QGridLayout* GroupConstructorsLayout = new QGridLayout(GroupConstructors->layout());
129 GroupConstructorsLayout->setAlignment(Qt::AlignTop);
130 GroupConstructorsLayout->setSpacing(6); GroupConstructorsLayout->setMargin(11);
132 Elements1dRB = new QRadioButton(GroupConstructors);
133 Elements1dRB->setPixmap(edgeImage);
134 Elements2dRB = new QRadioButton(GroupConstructors);
135 Elements2dRB->setPixmap(faceImage);
136 Elements1dRB->setChecked(true);
139 GroupConstructorsLayout->addWidget(Elements1dRB, 0, 0);
140 GroupConstructorsLayout->addWidget(Elements2dRB, 0, 2);
142 /***************************************************************/
143 // Arguments group box
144 GroupArguments = new QGroupBox(tr("EXTRUSION_1D"), this);
145 GroupArguments->setColumnLayout(0, Qt::Vertical);
146 GroupArguments->layout()->setSpacing(0); GroupArguments->layout()->setMargin(0);
147 QGridLayout* GroupArgumentsLayout = new QGridLayout(GroupArguments->layout());
148 GroupArgumentsLayout->setAlignment(Qt::AlignTop);
149 GroupArgumentsLayout->setSpacing(6); GroupArgumentsLayout->setMargin(11);
151 // Controls for elements selection
152 ElementsLab = new QLabel(tr("SMESH_ID_ELEMENTS"), GroupArguments);
154 SelectElementsButton = new QToolButton(GroupArguments);
155 SelectElementsButton->setPixmap(selectImage);
157 ElementsLineEdit = new QLineEdit(GroupArguments);
158 ElementsLineEdit->setValidator(new SMESHGUI_IdValidator(this));
160 // Controls for the whole mesh selection
161 MeshCheck = new QCheckBox(tr("SMESH_SELECT_WHOLE_MESH"), GroupArguments);
163 // Controls for path selection
164 PathGrp = new QGroupBox(tr("SMESH_PATH"), GroupArguments);
165 PathGrp->setColumnLayout(0, Qt::Vertical);
166 PathGrp->layout()->setSpacing(0); PathGrp->layout()->setMargin(0);
167 QGridLayout* PathGrpLayout = new QGridLayout(PathGrp->layout());
168 PathGrpLayout->setAlignment(Qt::AlignTop);
169 PathGrpLayout->setSpacing(6); PathGrpLayout->setMargin(11);
171 // Controls for path mesh selection
172 PathMeshLab = new QLabel(tr("SMESH_PATH_MESH"), PathGrp);
174 SelectPathMeshButton = new QToolButton(PathGrp);
175 SelectPathMeshButton->setPixmap(selectImage);
177 PathMeshLineEdit = new QLineEdit(PathGrp);
178 PathMeshLineEdit->setReadOnly(true);
180 // Controls for path shape selection
181 PathShapeLab = new QLabel(tr("SMESH_PATH_SHAPE"), PathGrp);
183 SelectPathShapeButton = new QToolButton(PathGrp);
184 SelectPathShapeButton->setPixmap(selectImage);
186 PathShapeLineEdit = new QLineEdit(PathGrp);
187 PathShapeLineEdit->setReadOnly(true);
189 // Controls for path starting point selection
190 StartPointLab = new QLabel(tr("SMESH_PATH_START"), PathGrp);
192 SelectStartPointButton = new QToolButton(PathGrp);
193 SelectStartPointButton->setPixmap(selectImage);
195 StartPointLineEdit = new QLineEdit(PathGrp);
196 StartPointLineEdit->setValidator(new QIntValidator(this));
199 PathGrpLayout->addWidget(PathMeshLab, 0, 0);
200 PathGrpLayout->addWidget(SelectPathMeshButton, 0, 1);
201 PathGrpLayout->addWidget(PathMeshLineEdit, 0, 2);
202 PathGrpLayout->addWidget(PathShapeLab, 1, 0);
203 PathGrpLayout->addWidget(SelectPathShapeButton, 1, 1);
204 PathGrpLayout->addWidget(PathShapeLineEdit, 1, 2);
205 PathGrpLayout->addWidget(StartPointLab, 2, 0);
206 PathGrpLayout->addWidget(SelectStartPointButton, 2, 1);
207 PathGrpLayout->addWidget(StartPointLineEdit, 2, 2);
209 // Controls for base point defining
210 BasePointCheck = new QCheckBox(tr("SMESH_USE_BASE_POINT"), GroupArguments);
212 BasePointGrp = new QGroupBox(tr("SMESH_BASE_POINT"), GroupArguments);
213 BasePointGrp->setColumnLayout(0, Qt::Vertical);
214 BasePointGrp->layout()->setSpacing(0); BasePointGrp->layout()->setMargin(0);
215 QGridLayout* BasePointGrpLayout = new QGridLayout(BasePointGrp->layout());
216 BasePointGrpLayout->setAlignment(Qt::AlignTop);
217 BasePointGrpLayout->setSpacing(6); BasePointGrpLayout->setMargin(11);
219 SelectBasePointButton = new QToolButton(BasePointGrp);
220 SelectBasePointButton->setPixmap(selectImage);
222 XLab = new QLabel(tr("SMESH_X"), BasePointGrp);
223 XLab->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs );
224 XSpin = new SMESHGUI_SpinBox(BasePointGrp);
225 YLab = new QLabel(tr("SMESH_Y"), BasePointGrp);
226 YLab->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs );
227 YSpin = new SMESHGUI_SpinBox(BasePointGrp);
228 ZLab = new QLabel(tr("SMESH_Z"), BasePointGrp);
229 ZLab->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs );
230 ZSpin = new SMESHGUI_SpinBox(BasePointGrp);
233 BasePointGrpLayout->addWidget(SelectBasePointButton, 0, 0);
234 BasePointGrpLayout->addWidget(XLab, 0, 1);
235 BasePointGrpLayout->addWidget(XSpin, 0, 2);
236 BasePointGrpLayout->addWidget(YLab, 0, 3);
237 BasePointGrpLayout->addWidget(YSpin, 0, 4);
238 BasePointGrpLayout->addWidget(ZLab, 0, 5);
239 BasePointGrpLayout->addWidget(ZSpin, 0, 6);
241 // Controls for angles defining
242 AnglesCheck = new QCheckBox(tr("SMESH_USE_ANGLES"), GroupArguments);
244 AnglesGrp = new QGroupBox(tr("SMESH_ANGLES"), GroupArguments);
245 AnglesGrp->setColumnLayout(0, Qt::Vertical);
246 AnglesGrp->layout()->setSpacing(0); AnglesGrp->layout()->setMargin(0);
247 QGridLayout* AnglesGrpLayout = new QGridLayout(AnglesGrp->layout());
248 AnglesGrpLayout->setAlignment(Qt::AlignTop);
249 AnglesGrpLayout->setSpacing(6); AnglesGrpLayout->setMargin(11);
251 AnglesList = new QListBox(AnglesGrp);
252 AnglesList->setSelectionMode(QListBox::Extended);
254 AddAngleButton = new QToolButton(AnglesGrp);
255 AddAngleButton->setPixmap(addImage);
257 RemoveAngleButton = new QToolButton(AnglesGrp);
258 RemoveAngleButton->setPixmap(removeImage);
260 AngleSpin = new SMESHGUI_SpinBox(AnglesGrp);
262 LinearAnglesCheck = new QCheckBox(tr("LINEAR_ANGLES"), AnglesGrp);
265 QVBoxLayout* bLayout = new QVBoxLayout();
266 bLayout->addWidget(AddAngleButton);
267 bLayout->addSpacing(6);
268 bLayout->addWidget(RemoveAngleButton);
269 bLayout->addStretch();
270 AnglesGrpLayout->addMultiCellWidget(AnglesList, 0, 1, 0, 0);
271 AnglesGrpLayout->addMultiCellLayout(bLayout, 0, 1, 1, 1);
272 AnglesGrpLayout->addWidget( AngleSpin, 0, 2 );
273 AnglesGrpLayout->addWidget( LinearAnglesCheck, 2, 0 );
274 AnglesGrpLayout->setRowStretch(1, 10);
276 // CheckBox for groups generation
277 MakeGroupsCheck = new QCheckBox(tr("SMESH_MAKE_GROUPS"), GroupArguments);
278 MakeGroupsCheck->setChecked(true);
281 GroupArgumentsLayout->addWidget( ElementsLab, 0, 0 );
282 GroupArgumentsLayout->addWidget( SelectElementsButton, 0, 1 );
283 GroupArgumentsLayout->addWidget( ElementsLineEdit, 0, 2 );
284 GroupArgumentsLayout->addMultiCellWidget(MeshCheck, 1, 1, 0, 2);
285 GroupArgumentsLayout->addMultiCellWidget(PathGrp, 2, 2, 0, 2);
286 GroupArgumentsLayout->addWidget( BasePointCheck, 3, 0 );
287 GroupArgumentsLayout->addMultiCellWidget(BasePointGrp, 3, 4, 1, 2);
288 GroupArgumentsLayout->addWidget( AnglesCheck, 5, 0 );
289 GroupArgumentsLayout->addMultiCellWidget(AnglesGrp, 5, 6, 1, 2);
290 GroupArgumentsLayout->addMultiCellWidget(MakeGroupsCheck, 7, 7, 0, 2);
291 GroupArgumentsLayout->setRowStretch(6, 10);
293 /***************************************************************/
294 // common buttons group box
295 GroupButtons = new QGroupBox(this);
296 GroupButtons->setColumnLayout(0, Qt::Vertical);
297 GroupButtons->layout()->setSpacing(0);
298 GroupButtons->layout()->setMargin(0);
299 QGridLayout* GroupButtonsLayout = new QGridLayout(GroupButtons->layout());
300 GroupButtonsLayout->setAlignment(Qt::AlignTop);
301 GroupButtonsLayout->setSpacing(6); GroupButtonsLayout->setMargin(11);
303 OkButton = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons);
304 OkButton->setAutoDefault(true);
305 OkButton->setDefault(true);
307 ApplyButton = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons);
308 ApplyButton->setAutoDefault(true);
310 CloseButton = new QPushButton(tr("SMESH_BUT_CLOSE"), GroupButtons);
311 CloseButton->setAutoDefault(true);
313 HelpButton = new QPushButton(tr("SMESH_BUT_HELP"), GroupButtons);
314 HelpButton->setAutoDefault(true);
317 GroupButtonsLayout->addWidget(OkButton, 0, 0);
318 GroupButtonsLayout->addWidget(ApplyButton, 0, 1);
319 GroupButtonsLayout->addWidget(CloseButton, 0, 3);
320 GroupButtonsLayout->addWidget(HelpButton, 0, 4);
321 GroupButtonsLayout->addColSpacing(2, 10);
322 GroupButtonsLayout->setColStretch(2, 10);
324 /***************************************************************/
326 topLayout->addWidget(GroupConstructors, 0, 0);
327 topLayout->addWidget(GroupArguments, 1, 0);
328 topLayout->addWidget(GroupButtons, 2, 0);
330 /***************************************************************/
332 XSpin->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3);
333 YSpin->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3);
334 ZSpin->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3);
335 AngleSpin->RangeStepAndValidator(-180.0, 180.0, 5.0, 3);
337 mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector();
339 mySMESHGUI->SetActiveDialogBox(this);
341 // Costruction of the logical filter for the elements: mesh/sub-mesh/group
342 SMESH_TypeFilter* aMeshOrSubMeshFilter = new SMESH_TypeFilter (MESHorSUBMESH);
343 SMESH_TypeFilter* aSmeshGroupFilter = new SMESH_TypeFilter (GROUP);
345 QPtrList<SUIT_SelectionFilter> aListOfFilters;
346 if (aMeshOrSubMeshFilter) aListOfFilters.append(aMeshOrSubMeshFilter);
347 if (aSmeshGroupFilter) aListOfFilters.append(aSmeshGroupFilter);
349 myElementsFilter = new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR);
350 myPathMeshFilter = new SMESH_TypeFilter (MESH);
352 myHelpFileName = "extrusion_along_path_page.html";
356 /***************************************************************/
357 // signals-slots connections
358 connect(OkButton, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
359 connect(CloseButton, SIGNAL(clicked()), this, SLOT(reject()));
360 connect(ApplyButton, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
361 connect(HelpButton, SIGNAL(clicked()), this, SLOT(ClickOnHelp()));
363 connect(AddAngleButton, SIGNAL(clicked()), this, SLOT(OnAngleAdded()));
364 connect(RemoveAngleButton, SIGNAL(clicked()), this, SLOT(OnAngleRemoved()));
366 connect(GroupConstructors, SIGNAL(clicked(int)), SLOT(ConstructorsClicked(int)));
368 connect(SelectElementsButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
369 connect(SelectPathMeshButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
370 connect(SelectPathShapeButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
371 connect(SelectStartPointButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
372 connect(SelectBasePointButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
374 connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
375 connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
376 connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(reject()));
378 connect(ElementsLineEdit, SIGNAL(textChanged(const QString&)),
379 SLOT(onTextChange(const QString&)));
380 connect(StartPointLineEdit, SIGNAL(textChanged(const QString&)),
381 SLOT(onTextChange(const QString&)));
383 connect(MeshCheck, SIGNAL(toggled(bool)), SLOT(onSelectMesh()));
384 connect(AnglesCheck, SIGNAL(toggled(bool)), SLOT(onAnglesCheck()));
385 connect(BasePointCheck, SIGNAL(toggled(bool)), SLOT(onBasePointCheck()));
387 AnglesList->installEventFilter(this);
388 ElementsLineEdit->installEventFilter(this);
389 StartPointLineEdit->installEventFilter(this);
390 XSpin->editor()->installEventFilter(this);
391 YSpin->editor()->installEventFilter(this);
392 ZSpin->editor()->installEventFilter(this);
394 /***************************************************************/
396 this->show(); // displays Dialog
399 //=================================================================================
400 // function : ~SMESHGUI_ExtrusionAlongPathDlg()
401 // purpose : destructor
402 //=================================================================================
403 SMESHGUI_ExtrusionAlongPathDlg::~SMESHGUI_ExtrusionAlongPathDlg()
405 // no need to delete child widgets, Qt does it all for us
408 //=================================================================================
410 // purpose : initialization
411 //=================================================================================
412 void SMESHGUI_ExtrusionAlongPathDlg::Init (bool ResetControls)
415 myEditCurrentArgument = 0;
417 myMesh = SMESH::SMESH_Mesh::_nil();
418 myIDSource = SMESH::SMESH_IDSource::_nil();
420 myPathMesh = SMESH::SMESH_Mesh::_nil();
421 myPathShape = GEOM::GEOM_Object::_nil();
423 ElementsLineEdit->clear();
424 PathMeshLineEdit->clear();
425 PathShapeLineEdit->clear();
426 StartPointLineEdit->clear();
429 XSpin->SetValue(0.0);
430 YSpin->SetValue(0.0);
431 ZSpin->SetValue(0.0);
433 AngleSpin->SetValue(45);
434 MeshCheck->setChecked(false);
435 ConstructorsClicked(0);
440 SetEditCurrentArgument(0);
443 //=================================================================================
444 // function : ConstructorsClicked()
445 // purpose : Called when user changes type of elements (1d / 2d)
446 //=================================================================================
447 void SMESHGUI_ExtrusionAlongPathDlg::ConstructorsClicked (int type)
449 if (myType == type) return;
451 disconnect(mySelectionMgr, 0, this, 0);
454 GroupArguments->setTitle(tr("EXTRUSION_1D"));
456 GroupArguments->setTitle(tr("EXTRUSION_2D"));
458 // clear elements ID list
459 if (!MeshCheck->isChecked()) {
460 ElementsLineEdit->clear();
462 // set selection mode if necessary
463 if (myEditCurrentArgument == ElementsLineEdit) {
464 mySelectionMgr->clearSelected();
465 mySelectionMgr->clearFilters();
466 SMESH::SetPickable();
468 SMESH::SetPointRepresentation(false);
469 if (MeshCheck->isChecked()) {
470 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
471 aViewWindow->SetSelectionMode(ActorSelection);
472 mySelectionMgr->installFilter(myElementsFilter);
476 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
477 aViewWindow->SetSelectionMode(EdgeSelection);
481 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
482 aViewWindow->SetSelectionMode(FaceSelection);
486 connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
491 //=================================================================================
492 // function : ClickOnApply()
493 // purpose : Called when user presses <Apply> button
494 //=================================================================================
495 bool SMESHGUI_ExtrusionAlongPathDlg::ClickOnApply()
497 if (mySMESHGUI->isActiveStudyLocked())
500 if (myMesh->_is_nil() || MeshCheck->isChecked() && myIDSource->_is_nil() ||
501 !myMeshActor || myPathMesh->_is_nil() || myPathShape->_is_nil())
504 SMESH::long_array_var anElementsId = new SMESH::long_array;
506 if (MeshCheck->isChecked()) {
507 // If "Select whole mesh, submesh or group" check box is on ->
508 // get all elements of the required type from the object selected
510 // if MESH object is selected
511 if (!CORBA::is_nil(SMESH::SMESH_Mesh::_narrow(myIDSource))) {
513 SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow(myIDSource);
514 // get IDs from mesh...
515 if (Elements1dRB->isChecked())
517 anElementsId = aMesh->GetElementsByType(SMESH::EDGE);
518 else if (Elements2dRB->isChecked()) {
519 anElementsId = aMesh->GetElementsByType(SMESH::FACE);
522 // SUBMESH is selected
523 if (!CORBA::is_nil(SMESH::SMESH_subMesh::_narrow(myIDSource))) {
525 SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow(myIDSource);
526 // get IDs from submesh
527 if (Elements1dRB->isChecked())
529 anElementsId = aSubMesh->GetElementsByType(SMESH::EDGE);
530 else if (Elements2dRB->isChecked())
532 anElementsId = aSubMesh->GetElementsByType(SMESH::FACE);
535 if (!CORBA::is_nil(SMESH::SMESH_GroupBase::_narrow(myIDSource))) {
537 SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow(myIDSource);
538 // get IDs from group
539 // 1d elements or 2d elements
540 if (Elements1dRB->isChecked() && aGroup->GetType() == SMESH::EDGE ||
541 Elements2dRB->isChecked() && aGroup->GetType() == SMESH::FACE)
542 anElementsId = aGroup->GetListOfID();
545 // If "Select whole mesh, submesh or group" check box is off ->
546 // use only elements of given type selected by user
548 SMDS_Mesh* aMesh = myMeshActor->GetObject()->GetMesh();
550 QStringList aListElementsId = QStringList::split(" ", ElementsLineEdit->text(), false);
551 anElementsId = new SMESH::long_array;
552 anElementsId->length(aListElementsId.count());
555 for (int i = 0; i < aListElementsId.count(); i++) {
556 long ind = aListElementsId[ i ].toLong(&bOk);
558 const SMDS_MeshElement* e = aMesh->FindElement(ind);
560 bool typeMatch = Elements1dRB->isChecked() && e->GetType() == SMDSAbs_Edge ||
561 Elements2dRB->isChecked() && e->GetType() == SMDSAbs_Face;
563 anElementsId[ j++ ] = ind;
567 anElementsId->length(j);
571 if (anElementsId->length() <= 0) {
575 if (StartPointLineEdit->text().stripWhiteSpace().isEmpty()) {
580 long aNodeStart = StartPointLineEdit->text().toLong(&bOk);
586 SMESH::double_array_var anAngles = new SMESH::double_array;
587 if (AnglesCheck->isChecked()) {
588 anAngles->length(AnglesList->count());
591 for (int i = 0; i < AnglesList->count(); i++) {
592 double angle = AnglesList->text(i).toDouble(&bOk);
594 anAngles[ j++ ] = angle*PI/180;
600 SMESH::PointStruct aBasePoint;
601 if (BasePointCheck->isChecked()) {
602 aBasePoint.x = XSpin->GetValue();
603 aBasePoint.y = YSpin->GetValue();
604 aBasePoint.z = ZSpin->GetValue();
608 SUIT_OverrideCursor wc;
609 SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
610 if ( LinearAnglesCheck->isChecked() )
611 anAngles = aMeshEditor->LinearAnglesVariation( myPathMesh, myPathShape, anAngles );
613 SMESH::SMESH_MeshEditor::Extrusion_Error retVal;
614 if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() )
615 SMESH::ListOfGroups_var groups =
616 aMeshEditor->ExtrusionAlongPathMakeGroups(anElementsId, myPathMesh,
617 myPathShape, aNodeStart,
618 AnglesCheck->isChecked(), anAngles,
619 BasePointCheck->isChecked(), aBasePoint, retVal);
621 retVal = aMeshEditor->ExtrusionAlongPath(anElementsId, myPathMesh,
622 myPathShape, aNodeStart,
623 AnglesCheck->isChecked(), anAngles,
624 BasePointCheck->isChecked(), aBasePoint);
629 case SMESH::SMESH_MeshEditor::EXTR_NO_ELEMENTS:
630 SUIT_MessageBox::warn1(SMESHGUI::desktop(),
632 tr("NO_ELEMENTS_SELECTED"),
635 case SMESH::SMESH_MeshEditor::EXTR_PATH_NOT_EDGE:
636 SUIT_MessageBox::warn1(SMESHGUI::desktop(),
638 tr("SELECTED_PATH_IS_NOT_EDGE"),
641 case SMESH::SMESH_MeshEditor::EXTR_BAD_PATH_SHAPE:
642 SUIT_MessageBox::warn1(SMESHGUI::desktop(),
644 tr("BAD_SHAPE_TYPE"),
647 case SMESH::SMESH_MeshEditor::EXTR_BAD_STARTING_NODE:
648 SUIT_MessageBox::warn1(SMESHGUI::desktop(),
650 tr("EXTR_BAD_STARTING_NODE"),
653 case SMESH::SMESH_MeshEditor::EXTR_BAD_ANGLES_NUMBER:
654 SUIT_MessageBox::warn1(SMESHGUI::desktop(),
656 tr("WRONG_ANGLES_NUMBER"),
659 case SMESH::SMESH_MeshEditor::EXTR_CANT_GET_TANGENT:
660 SUIT_MessageBox::warn1(SMESHGUI::desktop(),
662 tr("CANT_GET_TANGENT"),
665 case SMESH::SMESH_MeshEditor::EXTR_OK:
672 //mySelectionMgr->clearSelected();
673 SMESH::Update( myMeshActor->getIO(), myMeshActor->GetVisibility() );
674 if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() )
675 mySMESHGUI->updateObjBrowser(true); // new groups may appear
676 //SMESH::UpdateView();
678 ConstructorsClicked(GetConstructorId());
682 //=================================================================================
683 // function : ClickOnOk()
684 // purpose : Called when user presses <OK> button
685 //=================================================================================
686 void SMESHGUI_ExtrusionAlongPathDlg::ClickOnOk()
692 //=================================================================================
693 // function : ClickOnHelp()
695 //=================================================================================
696 void SMESHGUI_ExtrusionAlongPathDlg::ClickOnHelp()
698 LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
700 app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
704 platform = "winapplication";
706 platform = "application";
708 SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"),
709 QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
710 arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName),
711 QObject::tr("BUT_OK"));
715 //=================================================================================
716 // function : reject()
717 // purpose : Called when dialog box is closed
718 //=================================================================================
719 void SMESHGUI_ExtrusionAlongPathDlg::reject()
721 disconnect(mySelectionMgr, 0, this, 0);
722 mySelectionMgr->clearFilters();
723 //mySelectionMgr->clearSelected();
724 SMESH::SetPickable(); // ???
725 SMESH::SetPointRepresentation(false);
726 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
727 aViewWindow->SetSelectionMode(ActorSelection);
728 mySMESHGUI->ResetState();
732 //=======================================================================
733 // function : onTextChange()
735 //=======================================================================
736 void SMESHGUI_ExtrusionAlongPathDlg::onTextChange (const QString& theNewText)
738 QLineEdit* send = (QLineEdit*)sender();
746 if (send != StartPointLineEdit && send != ElementsLineEdit)
747 send = ElementsLineEdit;
749 if (send == ElementsLineEdit && myEditCurrentArgument == ElementsLineEdit) {
750 // hilight entered elements
751 SMDS_Mesh* aMesh = 0;
753 aMesh = myMeshActor->GetObject()->GetMesh();
756 //mySelectionMgr->clearSelected();
757 //mySelectionMgr->AddIObject(myMeshActor->getIO());
759 aList.Append(myMeshActor->getIO());
760 mySelectionMgr->setSelectedObjects(aList, false);
762 QStringList aListId = QStringList::split(" ", theNewText, false);
764 const Handle(SALOME_InteractiveObject)& anIO = myMeshActor->getIO();
765 TColStd_MapOfInteger newIndices;
766 for (int i = 0; i < aListId.count(); i++) {
767 long ind = aListId[ i ].toLong(&bOk);
769 const SMDS_MeshElement* e = aMesh->FindElement(ind);
771 // check also type of element
772 bool typeMatch = Elements1dRB->isChecked() && e->GetType() == SMDSAbs_Edge ||
773 Elements2dRB->isChecked() && e->GetType() == SMDSAbs_Face;
775 newIndices.Add(e->GetID());
779 mySelector->AddOrRemoveIndex(anIO, newIndices, false);
780 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
781 aViewWindow->highlight( anIO, true, true );
783 } else if (send == StartPointLineEdit &&
784 myEditCurrentArgument == StartPointLineEdit) {
785 if (!myPathMesh->_is_nil()) {
786 SMESH_Actor* aPathActor = SMESH::FindActorByObject(myPathMesh);
787 SMDS_Mesh* aMesh = 0;
789 aMesh = aPathActor->GetObject()->GetMesh();
791 //mySelectionMgr->clearSelected();
792 //mySelectionMgr->AddIObject(aPathActor->getIO());
794 aList.Append(aPathActor->getIO());
795 mySelectionMgr->setSelectedObjects(aList, false);
798 long ind = theNewText.toLong(&bOk);
800 const SMDS_MeshNode* n = aMesh->FindNode(ind);
802 //if (!mySelectionMgr->IsIndexSelected(aPathActor->getIO(), n->GetID())) {
803 TColStd_MapOfInteger newIndices;
804 newIndices.Add(n->GetID());
805 mySelector->AddOrRemoveIndex( aPathActor->getIO(), newIndices, false );
806 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
807 aViewWindow->highlight( aPathActor->getIO(), true, true );
815 //=================================================================================
816 // function : SelectionIntoArgument()
817 // purpose : Called when selection as changed or other case
818 //=================================================================================
819 void SMESHGUI_ExtrusionAlongPathDlg::SelectionIntoArgument()
823 // return if dialog box is inactive
824 if (!GroupButtons->isEnabled())
827 // selected objects count
828 const SALOME_ListIO& aList = mySelector->StoredIObjects();
829 int nbSel = aList.Extent();
836 if (myEditCurrentArgument == ElementsLineEdit) {
837 // we are now selecting mesh elements (or whole mesh/submesh/group)
839 ElementsLineEdit->clear();
840 myMesh = SMESH::SMESH_Mesh::_nil();
841 myIDSource = SMESH::SMESH_IDSource::_nil();
844 // try to get mesh from selection
845 Handle(SALOME_InteractiveObject) IO = aList.First();
846 myMesh = SMESH::GetMeshByIO(IO);
847 if (myMesh->_is_nil())
850 // MakeGroups is available if there are groups
851 if ( myMesh->NbGroups() == 0 ) {
852 MakeGroupsCheck->setChecked(false);
853 MakeGroupsCheck->setEnabled(false);
855 MakeGroupsCheck->setEnabled(true);
858 myMeshActor = SMESH::FindActorByObject(myMesh);
862 if (MeshCheck->isChecked()) {
863 // If "Select whole mesh, submesh or group" check box is on ->
864 // get ID source and put it's name to the edit box
866 SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
868 myIDSource = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>(IO);
869 ElementsLineEdit->setText(aString);
871 // If "Select whole mesh, submesh or group" check box is off ->
872 // try to get selected elements IDs
874 //int aNbUnits = SMESH::GetNameOfSelectedElements(mySelectionMgr, aString);
875 SMESH::GetNameOfSelectedElements(mySelector, IO, aString);
876 ElementsLineEdit->setText(aString);
878 } else if (myEditCurrentArgument == PathMeshLineEdit) {
879 // we are now selecting path mesh
881 PathMeshLineEdit->clear();
882 myPathMesh = SMESH::SMESH_Mesh::_nil();
883 PathShapeLineEdit->clear();
884 myPathShape = GEOM::GEOM_Object::_nil();
885 StartPointLineEdit->clear();
887 // try to get mesh from selection
888 Handle(SALOME_InteractiveObject) IO = aList.First();
889 myPathMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO);
890 if(myPathMesh->_is_nil())
894 SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
895 PathMeshLineEdit->setText(aString);
896 } else if (myEditCurrentArgument == PathShapeLineEdit) {
897 // we are now selecting path mesh
899 PathShapeLineEdit->clear();
900 myPathShape = GEOM::GEOM_Object::_nil();
901 StartPointLineEdit->clear();
903 // return if path mesh is not yet selected
904 if (myPathMesh->_is_nil())
907 // try to get shape from selection
908 Handle(SALOME_InteractiveObject) IO = aList.First();
909 myPathShape = SMESH::IObjectToInterface<GEOM::GEOM_Object>(IO);
910 if (myPathShape->_is_nil())
914 SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
915 PathShapeLineEdit->setText(aString);
916 } else if (myEditCurrentArgument == StartPointLineEdit) {
917 // we are now selecting start point of path
919 StartPointLineEdit->clear();
921 // return if path mesh or path shape is not yet selected
922 if (myPathMesh->_is_nil() || myPathShape->_is_nil())
925 // try to get shape from selection
926 Handle(SALOME_InteractiveObject) IO = aList.First();
928 SMESH_Actor* aPathActor = SMESH::FindActorByObject(myPathMesh);
933 int aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, aPathActor->getIO(), aString);
935 StartPointLineEdit->setText(aString.stripWhiteSpace());
937 } else if (myEditCurrentArgument == XSpin) {
938 // we are now selecting base point
939 // reset is not performed here!
941 // return if is not enabled
942 if (!BasePointGrp->isEnabled())
945 // try to get shape from selection
946 Handle(SALOME_InteractiveObject) IO = aList.First();
948 // check if geom vertex is selected
949 GEOM::GEOM_Object_var aGeomObj = SMESH::IObjectToInterface<GEOM::GEOM_Object>(IO);
950 TopoDS_Vertex aVertex;
951 if (!aGeomObj->_is_nil()) {
952 if (aGeomObj->IsShape() && GEOMBase::GetShape(aGeomObj, aVertex) && !aVertex.IsNull()) {
953 gp_Pnt aPnt = BRep_Tool::Pnt(aVertex);
954 XSpin->SetValue(aPnt.X());
955 YSpin->SetValue(aPnt.Y());
956 ZSpin->SetValue(aPnt.Z());
961 // check if smesh node is selected
962 SMESH::SMESH_Mesh_var aMesh = SMESH::GetMeshByIO(IO);
963 if (aMesh->_is_nil())
967 int aNbUnits = SMESH::GetNameOfSelectedNodes(mySelector, myMeshActor->getIO(), aString);
968 // return if more than one node is selected
972 SMESH_Actor* aMeshActor = SMESH::FindActorByObject(aMesh);
976 SMDS_Mesh* mesh = aMeshActor->GetObject()->GetMesh();
980 const SMDS_MeshNode* n = mesh->FindNode(aString.toLong());
984 XSpin->SetValue(n->X());
985 YSpin->SetValue(n->Y());
986 ZSpin->SetValue(n->Z());
990 //=================================================================================
991 // function : SetEditCurrentArgument()
993 //=================================================================================
994 void SMESHGUI_ExtrusionAlongPathDlg::SetEditCurrentArgument()
996 QToolButton* send = (QToolButton*)sender();
997 if (send != SelectElementsButton &&
998 send != SelectPathMeshButton &&
999 send != SelectPathShapeButton &&
1000 send != SelectStartPointButton &&
1001 send != SelectBasePointButton)
1003 SetEditCurrentArgument(send);
1006 //=================================================================================
1007 // function : SetEditCurrentArgument()
1009 //=================================================================================
1010 void SMESHGUI_ExtrusionAlongPathDlg::SetEditCurrentArgument (QToolButton* button)
1012 disconnect(mySelectionMgr, 0, this, 0);
1013 mySelectionMgr->clearSelected();
1014 mySelectionMgr->clearFilters();
1015 SMESH::SetPickable();
1017 if (button == SelectElementsButton) {
1018 myEditCurrentArgument = ElementsLineEdit;
1019 SMESH::SetPointRepresentation(false);
1020 if (MeshCheck->isChecked()) {
1021 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
1022 aViewWindow->SetSelectionMode(ActorSelection);
1023 mySelectionMgr->installFilter(myElementsFilter);
1025 if (Elements1dRB->isChecked())
1027 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
1028 aViewWindow->SetSelectionMode(EdgeSelection);
1030 else if (Elements2dRB->isChecked())
1032 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
1033 aViewWindow->SetSelectionMode(FaceSelection);
1036 } else if (button == SelectPathMeshButton) {
1037 myEditCurrentArgument = PathMeshLineEdit;
1038 SMESH::SetPointRepresentation(false);
1039 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
1040 aViewWindow->SetSelectionMode(ActorSelection);
1041 mySelectionMgr->installFilter(myPathMeshFilter);
1043 else if (button == SelectPathShapeButton) {
1044 myEditCurrentArgument = PathShapeLineEdit;
1045 SMESH::SetPointRepresentation(false);
1046 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
1047 aViewWindow->SetSelectionMode(ActorSelection);
1049 if (!myPathMesh->_is_nil()) {
1050 GEOM::GEOM_Object_var aMainShape = myPathMesh->GetShapeToMesh();
1051 SMESH_Actor* aPathActor = SMESH::FindActorByObject(myPathMesh);
1053 if (!aMainShape->_is_nil() && aPathActor)
1054 mySelectionMgr->installFilter(new SMESH_NumberFilter ("GEOM", TopAbs_SHAPE, -1,
1055 TopAbs_EDGE, aMainShape));
1056 //SMESH::SetPickable(aPathActor);
1059 else if (button == SelectStartPointButton) {
1060 myEditCurrentArgument = StartPointLineEdit;
1061 if (!myPathMesh->_is_nil()) {
1062 SMESH_Actor* aPathActor = SMESH::FindActorByObject(myPathMesh);
1064 SMESH::SetPointRepresentation(true);
1065 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
1066 aViewWindow->SetSelectionMode(NodeSelection);
1067 SMESH::SetPickable(aPathActor);
1071 else if (button == SelectBasePointButton) {
1072 myEditCurrentArgument = XSpin;
1073 SMESH::SetPointRepresentation(true);
1074 if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
1075 aViewWindow->SetSelectionMode(NodeSelection);
1077 SMESH_TypeFilter* aMeshOrSubMeshFilter = new SMESH_TypeFilter(MESHorSUBMESH);
1078 SMESH_TypeFilter* aSmeshGroupFilter = new SMESH_TypeFilter(GROUP);
1079 SMESH_NumberFilter* aVertexFilter = new SMESH_NumberFilter ("GEOM", TopAbs_SHAPE,
1081 QPtrList<SUIT_SelectionFilter> aListOfFilters;
1082 if (aMeshOrSubMeshFilter) aListOfFilters.append(aMeshOrSubMeshFilter);
1083 if (aSmeshGroupFilter) aListOfFilters.append(aSmeshGroupFilter);
1084 if (aVertexFilter) aListOfFilters.append(aVertexFilter);
1086 mySelectionMgr->installFilter(new SMESH_LogicalFilter
1087 (aListOfFilters, SMESH_LogicalFilter::LO_OR));
1090 if (myEditCurrentArgument && !myEditCurrentArgument->hasFocus())
1091 myEditCurrentArgument->setFocus();
1093 connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
1094 SelectionIntoArgument();
1097 //=================================================================================
1098 // function : DeactivateActiveDialog()
1099 // purpose : Deactivates this dialog
1100 //=================================================================================
1101 void SMESHGUI_ExtrusionAlongPathDlg::DeactivateActiveDialog()
1103 if (GroupConstructors->isEnabled()) {
1104 GroupConstructors->setEnabled(false);
1105 GroupArguments->setEnabled(false);
1106 GroupButtons->setEnabled(false);
1107 mySMESHGUI->ResetState();
1108 mySMESHGUI->SetActiveDialogBox(0);
1112 //=================================================================================
1113 // function : ActivateThisDialog()
1114 // purpose : Activates this dialog
1115 //=================================================================================
1116 void SMESHGUI_ExtrusionAlongPathDlg::ActivateThisDialog()
1118 // Emit a signal to deactivate the active dialog
1119 mySMESHGUI->EmitSignalDeactivateDialog();
1120 GroupConstructors->setEnabled(true);
1121 GroupArguments->setEnabled(true);
1122 GroupButtons->setEnabled(true);
1124 mySMESHGUI->SetActiveDialogBox(this);
1126 ConstructorsClicked(GetConstructorId());
1127 SelectionIntoArgument();
1130 //=================================================================================
1131 // function : enterEvent()
1132 // purpose : Mouse enter event
1133 //=================================================================================
1134 void SMESHGUI_ExtrusionAlongPathDlg::enterEvent (QEvent*)
1136 if (!GroupConstructors->isEnabled())
1137 ActivateThisDialog();
1140 //=======================================================================
1141 // function : onSelectMesh()
1143 //=======================================================================
1144 void SMESHGUI_ExtrusionAlongPathDlg::onSelectMesh()
1146 bool toSelectMesh = MeshCheck->isChecked();
1148 ElementsLineEdit->setReadOnly(toSelectMesh);
1149 ElementsLab->setText(toSelectMesh ? tr("SMESH_NAME") : tr("SMESH_ID_ELEMENTS"));
1150 ElementsLineEdit->clear();
1152 SetEditCurrentArgument(SelectElementsButton);
1155 //=================================================================================
1156 // function : GetConstructorId()
1158 //=================================================================================
1159 int SMESHGUI_ExtrusionAlongPathDlg::GetConstructorId()
1161 if (GroupConstructors != NULL && GroupConstructors->selected() != NULL)
1162 return GroupConstructors->id(GroupConstructors->selected());
1166 //=======================================================================
1167 // function : onAnglesCheck()
1168 // purpose : called when "Use Angles" check box is switched
1169 //=======================================================================
1170 void SMESHGUI_ExtrusionAlongPathDlg::onAnglesCheck()
1172 AnglesGrp->setEnabled(AnglesCheck->isChecked());
1175 //=======================================================================
1176 // function : onBasePointCheck()
1177 // purpose : called when "Use Base Point" check box is switched
1178 //=======================================================================
1179 void SMESHGUI_ExtrusionAlongPathDlg::onBasePointCheck()
1181 BasePointGrp->setEnabled(BasePointCheck->isChecked());
1184 //=======================================================================
1185 // function : OnAngleAdded()
1186 // purpose : Called when user adds angle to the list
1187 //=======================================================================
1188 void SMESHGUI_ExtrusionAlongPathDlg::OnAngleAdded()
1190 AnglesList->insertItem(QString::number(AngleSpin->GetValue()));
1193 //=======================================================================
1194 // function : OnAngleRemoved()
1195 // purpose : Called when user removes angle(s) from the list
1196 //=======================================================================
1197 void SMESHGUI_ExtrusionAlongPathDlg::OnAngleRemoved()
1199 QList<QListBoxItem> aList;
1200 aList.setAutoDelete(false);
1201 for (int i = 0; i < AnglesList->count(); i++)
1202 if (AnglesList->isSelected(i))
1203 aList.append(AnglesList->item(i));
1205 for (int i = 0; i < aList.count(); i++)
1209 //=================================================================================
1210 // function : eventFilter()
1211 // purpose : event filter ???
1212 //=================================================================================
1213 bool SMESHGUI_ExtrusionAlongPathDlg::eventFilter (QObject* object, QEvent* event)
1215 if (event->type() == QEvent::KeyPress) {
1216 QKeyEvent* ke = (QKeyEvent*)event;
1217 if (object == AnglesList) {
1218 if (ke->key() == Key_Delete)
1222 else if (event->type() == QEvent::FocusIn) {
1223 if (object == ElementsLineEdit) {
1224 if (myEditCurrentArgument != ElementsLineEdit)
1225 SetEditCurrentArgument(SelectElementsButton);
1227 else if (object == StartPointLineEdit) {
1228 if (myEditCurrentArgument != StartPointLineEdit)
1229 SetEditCurrentArgument(SelectStartPointButton);
1231 else if (object == XSpin->editor() || object == YSpin->editor() || object == ZSpin->editor()) {
1232 if (myEditCurrentArgument != XSpin)
1233 SetEditCurrentArgument(SelectBasePointButton);
1236 return QDialog::eventFilter(object, event);
1239 //=================================================================================
1240 // function : keyPressEvent()
1242 //=================================================================================
1243 void SMESHGUI_ExtrusionAlongPathDlg::keyPressEvent( QKeyEvent* e )
1245 QDialog::keyPressEvent( e );
1246 if ( e->isAccepted() )
1249 if ( e->key() == Key_F1 )