Salome HOME
Merge from OCC_development_generic_2006
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_NodesDlg.cxx
1 //  SMESH SMESHGUI : GUI for SMESH component
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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.
10 //
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.
15 //
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
19 //
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
21 //
22 //
23 //
24 //  File   : SMESHGUI_NodesDlg.cxx
25 //  Author : Nicolas REJNERI
26 //  Module : SMESH
27 //  $Header$
28
29 #include "SMESHGUI_NodesDlg.h"
30
31 #include "SMESHGUI.h"
32 #include "SMESHGUI_SpinBox.h"
33 #include "SMESHGUI_Utils.h"
34 #include "SMESHGUI_VTKUtils.h"
35 #include "SMESHGUI_MeshUtils.h"
36
37 #include "SMESH_Actor.h"
38 #include "SMESH_ActorUtils.h"
39 #include "SMESH_ObjectDef.h"
40
41 #include "SMDS_Mesh.hxx"
42 #include "SMDS_MeshNode.hxx"
43
44 #include "SUIT_Session.h"
45 #include "SUIT_OverrideCursor.h"
46 #include "SUIT_ViewWindow.h"
47 #include "SUIT_ViewManager.h"
48 #include "SUIT_MessageBox.h"
49 #include "SUIT_Desktop.h"
50
51 #include "SalomeApp_Study.h"
52 #include "LightApp_SelectionMgr.h"
53
54 #include "SVTK_Selector.h"
55 #include "SVTK_ViewWindow.h"
56
57 #include "SALOME_Actor.h"
58 #include "SALOME_ListIO.hxx"
59
60 #include "utilities.h"
61
62 // VTK Includes
63 #include <vtkCell.h>
64 #include <vtkIdList.h>
65 #include <vtkIntArray.h>
66 #include <vtkCellArray.h>
67 #include <vtkUnsignedCharArray.h>
68 #include <vtkUnstructuredGrid.h>
69 #include <vtkDataSetMapper.h>
70 #include <vtkActorCollection.h>
71 #include <vtkRenderer.h>
72 #include <vtkProperty.h>
73
74 // QT Includes
75 #include <qbuttongroup.h>
76 #include <qframe.h>
77 #include <qgroupbox.h>
78 #include <qlabel.h>
79 #include <qlineedit.h>
80 #include <qpushbutton.h>
81 #include <qradiobutton.h>
82 #include <qlayout.h>
83 #include <qvariant.h>
84 #include <qtooltip.h>
85 #include <qwhatsthis.h>
86 #include <qimage.h>
87 #include <qpixmap.h>
88 #include <qvalidator.h>
89 #include <qevent.h>
90
91 using namespace std;
92
93
94 namespace SMESH {
95
96   void AddNode (SMESH::SMESH_Mesh_ptr theMesh, float x, float y, float z)
97   {
98     SUIT_OverrideCursor wc;
99     try {
100       _PTR(SObject) aSobj = SMESH::FindSObject(theMesh);
101       SMESH::SMESH_MeshEditor_var aMeshEditor = theMesh->GetMeshEditor();
102       aMeshEditor->AddNode(x,y,z);
103       _PTR(Study) aStudy = GetActiveStudyDocument();
104       CORBA::Long anId = aStudy->StudyId();
105       if (TVisualObjPtr aVisualObj = SMESH::GetVisualObj(anId, aSobj->GetID().c_str())) {
106         aVisualObj->Update(true);
107       }
108     } catch (SALOME::SALOME_Exception& exc) {
109       INFOS("Follow exception was cought:\n\t" << exc.details.text);
110     } catch (const std::exception& exc) {
111       INFOS("Follow exception was cought:\n\t" << exc.what());
112     } catch (...) {
113       INFOS("Unknown exception was cought !!!");
114     }
115   }
116
117   class TNodeSimulation {
118     SVTK_ViewWindow* myViewWindow;
119
120     SALOME_Actor *myPreviewActor;
121     vtkDataSetMapper* myMapper;
122     vtkPoints* myPoints;
123
124   public:
125     TNodeSimulation(SVTK_ViewWindow* theViewWindow):
126       myViewWindow(theViewWindow)
127     {
128       vtkUnstructuredGrid* aGrid = vtkUnstructuredGrid::New();
129
130       // Create points
131       myPoints = vtkPoints::New();
132       myPoints->SetNumberOfPoints(1);
133       myPoints->SetPoint(0,0.0,0.0,0.0);
134
135       // Create cells
136       vtkIdList *anIdList = vtkIdList::New();
137       anIdList->SetNumberOfIds(1);
138
139       vtkCellArray *aCells = vtkCellArray::New();
140       aCells->Allocate(2, 0);
141
142       vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
143       aCellTypesArray->SetNumberOfComponents(1);
144       aCellTypesArray->Allocate(1);
145
146       anIdList->SetId(0, 0);
147       aCells->InsertNextCell(anIdList);
148       aCellTypesArray->InsertNextValue(VTK_VERTEX);
149
150       vtkIntArray* aCellLocationsArray = vtkIntArray::New();
151       aCellLocationsArray->SetNumberOfComponents(1);
152       aCellLocationsArray->SetNumberOfTuples(1);
153
154       aCells->InitTraversal();
155       vtkIdType npts;
156       aCellLocationsArray->SetValue(0, aCells->GetTraversalLocation(npts));
157
158       aGrid->SetCells(aCellTypesArray, aCellLocationsArray, aCells);
159
160       aGrid->SetPoints(myPoints);
161       aGrid->SetCells(aCellTypesArray, aCellLocationsArray,aCells);
162       aCellLocationsArray->Delete();
163       aCellTypesArray->Delete();
164       aCells->Delete();
165       anIdList->Delete();
166
167       // Create and display actor
168       myMapper = vtkDataSetMapper::New();
169       myMapper->SetInput(aGrid);
170       aGrid->Delete();
171
172       myPreviewActor = SALOME_Actor::New();
173       myPreviewActor->SetInfinitive(true);
174       myPreviewActor->VisibilityOff();
175       myPreviewActor->PickableOff();
176       myPreviewActor->SetMapper(myMapper);
177
178       vtkProperty* aProp = vtkProperty::New();
179       aProp->SetRepresentationToPoints();
180
181       float anRGB[3];
182       GetColor( "SMESH", "node_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 255, 0 ) );
183       aProp->SetColor( anRGB[0], anRGB[1], anRGB[2] );
184
185       float aPointSize = GetFloat( "SMESH:node_size", 3 );
186       aProp->SetPointSize( aPointSize );
187
188       myPreviewActor->SetProperty( aProp );
189       aProp->Delete();
190
191       myViewWindow->AddActor(myPreviewActor);
192     }
193
194     void SetPosition (float x, float y, float z)
195     {
196       myPoints->SetPoint(0,x,y,z);
197       myPoints->Modified();
198       SetVisibility(true);
199     }
200
201     void SetVisibility (bool theVisibility)
202     {
203       myPreviewActor->SetVisibility(theVisibility);
204       RepaintCurrentView();
205     }
206
207     ~TNodeSimulation()
208     {
209       myViewWindow->RemoveActor(myPreviewActor);
210       myPreviewActor->Delete();
211
212       myMapper->RemoveAllInputs();
213       myMapper->Delete();
214
215       myPoints->Delete();
216     }
217   };
218 }
219
220 //=================================================================================
221 // class    : SMESHGUI_NodesDlg()
222 // purpose  :
223 //=================================================================================
224 SMESHGUI_NodesDlg::SMESHGUI_NodesDlg (SMESHGUI* theModule,
225                                       const char* name,
226                                       bool modal,
227                                       WFlags fl): 
228   QDialog(SMESH::GetDesktop(theModule), 
229           name, 
230           modal, 
231           WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose),
232   mySelector(SMESH::GetViewWindow(theModule)->GetSelector()),
233   mySelectionMgr(SMESH::GetSelectionMgr(theModule)),
234   mySMESHGUI(theModule)
235 {
236   mySimulation = new SMESH::TNodeSimulation(SMESH::GetViewWindow( mySMESHGUI ));
237
238   QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_NODE")));
239   if (!name)
240     setName("SMESHGUI_NodesDlg");
241   resize(303, 185);
242   setCaption(tr("MESH_NODE_TITLE"));
243   setSizeGripEnabled(TRUE);
244   SMESHGUI_NodesDlgLayout = new QGridLayout(this);
245   SMESHGUI_NodesDlgLayout->setSpacing(6);
246   SMESHGUI_NodesDlgLayout->setMargin(11);
247
248   /***************************************************************/
249   GroupButtons = new QGroupBox(this, "GroupButtons");
250   GroupButtons->setGeometry(QRect(10, 10, 281, 48));
251   GroupButtons->setTitle(tr("" ));
252   GroupButtons->setColumnLayout(0, Qt::Vertical);
253   GroupButtons->layout()->setSpacing(0);
254   GroupButtons->layout()->setMargin(0);
255   GroupButtonsLayout = new QGridLayout(GroupButtons->layout());
256   GroupButtonsLayout->setAlignment(Qt::AlignTop);
257   GroupButtonsLayout->setSpacing(6);
258   GroupButtonsLayout->setMargin(11);
259   buttonCancel = new QPushButton(GroupButtons, "buttonCancel");
260   buttonCancel->setText(tr("SMESH_BUT_CLOSE" ));
261   buttonCancel->setAutoDefault(TRUE);
262   GroupButtonsLayout->addWidget(buttonCancel, 0, 3);
263   buttonApply = new QPushButton(GroupButtons, "buttonApply");
264   buttonApply->setText(tr("SMESH_BUT_APPLY" ));
265   buttonApply->setAutoDefault(TRUE);
266   GroupButtonsLayout->addWidget(buttonApply, 0, 1);
267   QSpacerItem* spacer_9 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
268   GroupButtonsLayout->addItem(spacer_9, 0, 2);
269   buttonOk = new QPushButton(GroupButtons, "buttonOk");
270   buttonOk->setText(tr("SMESH_BUT_OK" ));
271   buttonOk->setAutoDefault(TRUE);
272   buttonOk->setDefault(TRUE);
273   GroupButtonsLayout->addWidget(buttonOk, 0, 0);
274   SMESHGUI_NodesDlgLayout->addWidget(GroupButtons, 2, 0);
275
276   /***************************************************************/
277   GroupConstructors = new QButtonGroup(this, "GroupConstructors");
278   GroupConstructors->setTitle(tr("MESH_NODE" ));
279   GroupConstructors->setExclusive(TRUE);
280   GroupConstructors->setColumnLayout(0, Qt::Vertical);
281   GroupConstructors->layout()->setSpacing(0);
282   GroupConstructors->layout()->setMargin(0);
283   GroupConstructorsLayout = new QGridLayout(GroupConstructors->layout());
284   GroupConstructorsLayout->setAlignment(Qt::AlignTop);
285   GroupConstructorsLayout->setSpacing(6);
286   GroupConstructorsLayout->setMargin(11);
287   Constructor1 = new QRadioButton(GroupConstructors, "Constructor1");
288   Constructor1->setText(tr("" ));
289   Constructor1->setPixmap(image0);
290   Constructor1->setChecked(TRUE);
291   GroupConstructorsLayout->addWidget(Constructor1, 0, 0);
292   QSpacerItem* spacer_2 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
293   GroupConstructorsLayout->addItem(spacer_2, 0, 1);
294   SMESHGUI_NodesDlgLayout->addWidget(GroupConstructors, 0, 0);
295
296   /***************************************************************/
297   GroupCoordinates = new QGroupBox(this, "GroupCoordinates");
298   GroupCoordinates->setTitle(tr("SMESH_COORDINATES" ));
299   GroupCoordinates->setColumnLayout(0, Qt::Vertical);
300   GroupCoordinates->layout()->setSpacing(0);
301   GroupCoordinates->layout()->setMargin(0);
302   GroupCoordinatesLayout = new QGridLayout(GroupCoordinates->layout());
303   GroupCoordinatesLayout->setAlignment(Qt::AlignTop);
304   GroupCoordinatesLayout->setSpacing(6);
305   GroupCoordinatesLayout->setMargin(11);
306   TextLabel_X = new QLabel(GroupCoordinates, "TextLabel_X");
307   TextLabel_X->setText(tr("SMESH_X" ));
308   GroupCoordinatesLayout->addWidget(TextLabel_X, 0, 0);
309   TextLabel_Y = new QLabel(GroupCoordinates, "TextLabel_Y");
310   TextLabel_Y->setText(tr("SMESH_Y" ));
311   GroupCoordinatesLayout->addWidget(TextLabel_Y, 0, 2);
312
313   TextLabel_Z = new QLabel(GroupCoordinates, "TextLabel_Z");
314   TextLabel_Z->setText(tr("SMESH_Z" ));
315   GroupCoordinatesLayout->addWidget(TextLabel_Z, 0, 4);
316
317   SpinBox_X = new SMESHGUI_SpinBox(GroupCoordinates, "SpinBox_X");
318   GroupCoordinatesLayout->addWidget(SpinBox_X, 0, 1);
319
320   SpinBox_Y = new SMESHGUI_SpinBox(GroupCoordinates, "SpinBox_Y");
321   GroupCoordinatesLayout->addWidget(SpinBox_Y, 0, 3);
322
323   SpinBox_Z = new SMESHGUI_SpinBox(GroupCoordinates, "SpinBox_Z");
324   GroupCoordinatesLayout->addWidget(SpinBox_Z, 0, 5);
325
326   SMESHGUI_NodesDlgLayout->addWidget(GroupCoordinates, 1, 0);
327
328   /* Initialisation and display */
329   Init();
330 }
331
332 //=======================================================================
333 // function : ~SMESHGUI_NodesDlg()
334 // purpose  : Destructor
335 //=======================================================================
336 SMESHGUI_NodesDlg::~SMESHGUI_NodesDlg()
337 {
338   delete mySimulation;
339 }
340
341 //=================================================================================
342 // function : Init()
343 // purpose  :
344 //=================================================================================
345 void SMESHGUI_NodesDlg::Init ()
346 {
347   /* Get setting of step value from file configuration */
348   double step;
349   // QString St = SUIT_CONFIG->getSetting("xxxxxxxxxxxxx");  TODO
350   // step = St.toDouble();                                    TODO
351   step = 25.0;
352
353   /* min, max, step and decimals for spin boxes */
354   SpinBox_X->RangeStepAndValidator(-999.999, +999.999, step, 3);
355   SpinBox_Y->RangeStepAndValidator(-999.999, +999.999, step, 3);
356   SpinBox_Z->RangeStepAndValidator(-999.999, +999.999, step, 3);
357   SpinBox_X->SetValue(0.0);
358   SpinBox_Y->SetValue(0.0);
359   SpinBox_Z->SetValue(0.0);
360
361   mySMESHGUI->SetActiveDialogBox((QDialog*)this);
362
363   /* signals and slots connections */
364   connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
365   connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
366   connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
367
368   connect(SpinBox_X, SIGNAL (valueChanged(double)), SLOT(ValueChangedInSpinBox(double)));
369   connect(SpinBox_Y, SIGNAL (valueChanged(double)), SLOT(ValueChangedInSpinBox(double)));
370   connect(SpinBox_Z, SIGNAL (valueChanged(double)), SLOT(ValueChangedInSpinBox(double)));
371
372   connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(SelectionIntoArgument()));
373   connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), SLOT(DeactivateActiveDialog()));
374   /* to close dialog if study frame change */
375   connect(mySMESHGUI, SIGNAL (SignalStudyFrameChanged()), SLOT(ClickOnCancel()));
376
377   /* Move widget on the botton right corner of main widget */
378   int x, y;
379   mySMESHGUI->DefineDlgPosition(this, x, y);
380   this->move(x, y);
381   this->show();
382
383   // set selection mode
384   SMESH::SetPointRepresentation(true);
385   if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
386     aViewWindow->SetSelectionMode(NodeSelection);
387
388   SelectionIntoArgument();
389 }
390
391 //=================================================================================
392 // function : ValueChangedInSpinBox()
393 // purpose  :
394 //=================================================================================
395 void SMESHGUI_NodesDlg::ValueChangedInSpinBox (double newValue)
396 {
397   if (!myMesh->_is_nil()) {
398     double vx = SpinBox_X->GetValue();
399     double vy = SpinBox_Y->GetValue();
400     double vz = SpinBox_Z->GetValue();
401
402     mySimulation->SetPosition(vx,vy,vz);
403   }
404 }
405
406 //=================================================================================
407 // function : ClickOnOk()
408 // purpose  :
409 //=================================================================================
410 void SMESHGUI_NodesDlg::ClickOnOk()
411 {
412   if (ClickOnApply())
413     ClickOnCancel();
414 }
415
416 //=================================================================================
417 // function : ClickOnApply()
418 // purpose  :
419 //=================================================================================
420 bool SMESHGUI_NodesDlg::ClickOnApply()
421 {
422   if (mySMESHGUI->isActiveStudyLocked())
423     return false;
424
425   if (myMesh->_is_nil()) {
426     SUIT_MessageBox::warn1(SMESHGUI::desktop(), tr("SMESH_WRN_WARNING"),
427                            tr("MESH_IS_NOT_SELECTED"), tr("SMESH_BUT_OK"));
428     return false;
429   }
430
431   /* Recup args and call method */
432   double x = SpinBox_X->GetValue();
433   double y = SpinBox_Y->GetValue();
434   double z = SpinBox_Z->GetValue();
435   mySimulation->SetVisibility(false);
436   SMESH::AddNode(myMesh,x,y,z);
437   SMESH::SetPointRepresentation(true);
438
439   // select myMesh
440   SALOME_ListIO aList;
441   mySelectionMgr->selectedObjects(aList);
442   if (aList.Extent() != 1) {
443     if (SVTK_ViewWindow* aViewWindow = SMESH::GetCurrentVtkView()) {
444       vtkActorCollection *aCollection = aViewWindow->getRenderer()->GetActors();
445       aCollection->InitTraversal();
446       while (vtkActor *anAct = aCollection->GetNextActor()) {
447         if (SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)) {
448           if (anActor->hasIO()) {
449             if (SMESH_MeshObj *aMeshObj = dynamic_cast<SMESH_MeshObj*>(anActor->GetObject().get())) {
450               if (myMesh->_is_equivalent(aMeshObj->GetMeshServer())) {
451                 aList.Clear();
452                 aList.Append(anActor->getIO());
453                 mySelectionMgr->setSelectedObjects(aList, false);
454                 break;
455               }
456             }
457           }
458         }
459       }
460     }
461   }
462   return true;
463 }
464
465 //=================================================================================
466 // function : ClickOnCancel()
467 // purpose  :
468 //=================================================================================
469 void SMESHGUI_NodesDlg::ClickOnCancel()
470 {
471   disconnect(mySelectionMgr, 0, this, 0);
472   if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
473     aViewWindow->SetSelectionMode(ActorSelection);
474
475   mySimulation->SetVisibility(false);
476   SMESH::SetPointRepresentation(false);
477   mySMESHGUI->ResetState();
478
479   reject();
480 }
481
482 //=================================================================================
483 // function : SelectionIntoArgument()
484 // purpose  : Called when selection as changed or other case
485 //=================================================================================
486 void SMESHGUI_NodesDlg::SelectionIntoArgument()
487 {
488   if (!GroupConstructors->isEnabled())
489     return;
490
491   mySimulation->SetVisibility(false);
492   SMESH::SetPointRepresentation(true);
493
494   const SALOME_ListIO& aList = mySelector->StoredIObjects();
495   if (aList.Extent() == 1) {
496     Handle(SALOME_InteractiveObject) anIO = aList.First();
497     if (anIO->hasEntry()) {
498       myMesh = SMESH::GetMeshByIO(anIO);
499       if (myMesh->_is_nil()) return;
500       QString aText;
501       if (SMESH::GetNameOfSelectedNodes(mySelector,anIO,aText) == 1) {
502         if (SMESH_Actor* anActor = SMESH::FindActorByObject(myMesh.in())) {
503           if (SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh()) {
504             if (const SMDS_MeshNode* aNode = aMesh->FindNode(aText.toInt())) {
505               SpinBox_X->SetValue(aNode->X());
506               SpinBox_Y->SetValue(aNode->Y());
507               SpinBox_Z->SetValue(aNode->Z());
508             }
509           }
510         }
511       }
512       mySimulation->SetPosition(SpinBox_X->GetValue(),
513                                 SpinBox_Y->GetValue(),
514                                 SpinBox_Z->GetValue());
515     }
516   }
517 }
518
519 //=================================================================================
520 // function : closeEvent()
521 // purpose  :
522 //=================================================================================
523 void SMESHGUI_NodesDlg::closeEvent (QCloseEvent*)
524 {
525   this->ClickOnCancel(); /* same than click on cancel button */
526 }
527
528 //=================================================================================
529 // function : hideEvent()
530 // purpose  : caused by ESC key
531 //=================================================================================
532 void SMESHGUI_NodesDlg::hideEvent (QHideEvent*)
533 {
534   if (!isMinimized())
535     ClickOnCancel();
536 }
537
538 //=================================================================================
539 // function : enterEvent()
540 // purpose  : to reactivate this dialog box when mouse enter onto the window
541 //=================================================================================
542 void SMESHGUI_NodesDlg::enterEvent(QEvent*)
543 {
544   if (!GroupConstructors->isEnabled())
545     ActivateThisDialog();
546 }
547
548 //=================================================================================
549 // function : DeactivateActiveDialog()
550 // purpose  : public slot to deactivate if active
551 //=================================================================================
552 void SMESHGUI_NodesDlg::DeactivateActiveDialog()
553 {
554   if (GroupConstructors->isEnabled()) {
555     GroupConstructors->setEnabled(false);
556     GroupCoordinates->setEnabled(false);
557     GroupButtons->setEnabled(false);
558     mySimulation->SetVisibility(false);
559     mySMESHGUI->ResetState();
560     mySMESHGUI->SetActiveDialogBox(0);
561   }
562 }
563
564 //=================================================================================
565 // function : ActivateThisDialog()
566 // purpose  :
567 //=================================================================================
568 void SMESHGUI_NodesDlg::ActivateThisDialog()
569 {
570   mySMESHGUI->EmitSignalDeactivateDialog();
571   GroupConstructors->setEnabled(true);
572   GroupCoordinates->setEnabled(true);
573   GroupButtons->setEnabled(true);
574
575   SMESH::SetPointRepresentation(true);
576   if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
577     aViewWindow->SetSelectionMode(NodeSelection);
578
579   SelectionIntoArgument();
580 }