Salome HOME
b0ea981002127194dfa0827210eecb7a5f0b32d3
[modules/geom.git] / src / MeasureGUI / MeasureGUI_DistanceDlg.cxx
1 // Copyright (C) 2007-2023  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  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, or (at your option) any later version.
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.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 // GEOM GEOMGUI : GUI for Geometry component
24 // File   : MeasureGUI_DistanceDlg.cxx
25 // Author : Nicolas REJNERI, Open CASCADE S.A.S.
26
27 #include "MeasureGUI_DistanceDlg.h"
28 #include "MeasureGUI_Widgets.h"
29
30 #include <DlgRef.h>
31 #include <GEOMBase.h>
32 #include <GeometryGUI.h>
33
34 #include <SUIT_Session.h>
35 #include <SUIT_Desktop.h>
36 #include <SUIT_ResourceMgr.h>
37 #include <SUIT_ViewWindow.h>
38 #include <SUIT_ViewManager.h>
39 #include <SUIT_OverrideCursor.h>
40 #include <SUIT_MessageBox.h>
41 #include <SOCC_Prs.h>
42 #include <SOCC_ViewModel.h>
43 #include <SalomeApp_Tools.h>
44 #include <SalomeApp_Application.h>
45 #include <LightApp_SelectionMgr.h>
46
47 // OCCT Includes
48 #include <Geom_Plane.hxx>
49 #include <AIS_LengthDimension.hxx>
50 #include <Prs3d_LineAspect.hxx>
51 #include <BRepBuilderAPI_MakeEdge.hxx>
52 #include <BRepBuilderAPI_MakeVertex.hxx>
53 #include <gce_MakePln.hxx>
54 #include <Precision.hxx>
55
56 //=================================================================================
57 // class    : MeasureGUI_DistanceDlg()
58 // purpose  : Constructs a MeasureGUI_DistanceDlg which is a child of 'parent', with the
59 //            name 'name' and widget flags set to 'f'.
60 //            The dialog will by default be modeless, unless you set 'modal' to
61 //            true to construct a modal dialog.
62 //=================================================================================
63 MeasureGUI_DistanceDlg::MeasureGUI_DistanceDlg (GeometryGUI* GUI, QWidget* parent)
64   : GEOMBase_Skeleton(GUI, parent)
65 {
66   SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
67   QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_MINDIST")));
68   QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
69
70   setWindowTitle(tr("GEOM_MINDIST_TITLE"));
71
72   /***************************************************************/
73   mainFrame()->GroupConstructors->setTitle(tr("GEOM_DISTANCE"));
74   mainFrame()->RadioButton1->setIcon(image0);
75   mainFrame()->RadioButton2->setAttribute(Qt::WA_DeleteOnClose);
76   mainFrame()->RadioButton2->close();
77   mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
78   mainFrame()->RadioButton3->close();
79
80   mainFrame()->GroupBoxName->hide();
81
82   myGrp = new MeasureGUI_DistanceGroup (centralWidget());
83   myGrp->GroupBox1->setTitle(tr("GEOM_MINDIST_OBJ"));
84
85   // Arguments
86   myGrp->TextLabel1->setText(tr("GEOM_OBJECT_I").arg("1"));
87   myGrp->TextLabel2->setText(tr("GEOM_OBJECT_I").arg("2"));
88   myGrp->PushButton1->setIcon(image1);
89   myGrp->PushButton2->setIcon(image1);
90   myGrp->LineEdit1->setReadOnly(true);
91   myGrp->LineEdit2->setReadOnly(true);
92
93   // Solutions combobox
94   myGrp->TextLabel7->setText(tr("GEOM_SOLUTION"));
95
96   // Distance, dx, dy and dz
97   myGrp->TextLabel3->setText(tr("GEOM_LENGTH"));
98   myGrp->TextLabel4->setText(tr("GEOM_DX"));
99   myGrp->TextLabel5->setText(tr("GEOM_DY"));
100   myGrp->TextLabel6->setText(tr("GEOM_DZ"));
101   myGrp->LineEdit3->setReadOnly(true);
102   myGrp->LineEdit4->setReadOnly(true);
103   myGrp->LineEdit5->setReadOnly(true);
104   myGrp->LineEdit6->setReadOnly(true);
105   /***************************************************************/
106
107   myHelpFileName = "min_distance_page.html";
108
109   // Initialisation
110   Init();
111 }
112
113 //=================================================================================
114 // function : ~MeasureGUI_DistanceDlg()
115 // purpose  : Destroys the object and frees any allocated resources
116 //=================================================================================
117 MeasureGUI_DistanceDlg::~MeasureGUI_DistanceDlg()
118 {
119 }
120
121 //=================================================================================
122 // function : Init()
123 // purpose  :
124 //=================================================================================
125 void MeasureGUI_DistanceDlg::Init()
126 {
127   myEditCurrentArgument = myGrp->LineEdit1;
128   myDbls = new GEOM::ListOfDouble();
129
130   myGrp->LineEdit1->setEnabled(true);
131   myGrp->LineEdit2->setEnabled(false);
132
133   myObj1.nullify();
134   myObj2.nullify();
135
136   // signals and slots connections
137   connect(buttonOk(),         SIGNAL(clicked()), this, SLOT(ClickOnOk()));
138   connect(buttonApply(),      SIGNAL(clicked()), this, SLOT(ClickOnApply()));
139
140   connect(myGrp->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
141   connect(myGrp->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
142
143   connect(myGrp->ComboBox1, SIGNAL(currentIndexChanged(int)), this, SLOT(SolutionSelected(int)));
144
145   connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
146           this, SLOT(SelectionIntoArgument()));
147
148   activateSelection();
149   SelectionIntoArgument();
150 }
151
152 //=================================================================================
153 // function : ClickOnOk()
154 // purpose  :
155 //=================================================================================
156 void MeasureGUI_DistanceDlg::ClickOnOk()
157 {
158   if (ClickOnApply())
159     ClickOnCancel();
160 }
161
162 //=================================================================================
163 // function : ClickOnApply()
164 // purpose  :
165 //=================================================================================
166 bool MeasureGUI_DistanceDlg::ClickOnApply()
167 {
168   if (!onAccept())
169     return false;
170
171   initName();
172   activateSelection();
173   return true;
174 }
175
176 //=================================================================================
177 // function : ActivateThisDialog()
178 // purpose  :
179 //=================================================================================
180 void MeasureGUI_DistanceDlg::ActivateThisDialog()
181 {
182   GEOMBase_Skeleton::ActivateThisDialog();
183
184   connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
185           this, SLOT(SelectionIntoArgument()));
186
187   activateSelection();
188   redisplayPreview();
189 }
190
191 //=================================================================================
192 // function : enterEvent()
193 // purpose  :
194 //=================================================================================
195 void MeasureGUI_DistanceDlg::enterEvent(QEvent*)
196 {
197   if (!mainFrame()->GroupConstructors->isEnabled())
198     ActivateThisDialog();
199 }
200
201 //=================================================================================
202 // function : SolutionSelected()
203 // purpose  : Called when ComboBox selection has changed
204 //=================================================================================
205 void MeasureGUI_DistanceDlg::SolutionSelected (int i)
206 {
207   if (i < 0 || (int)myDbls->length() < (i+1)*6) {
208     myGrp->LineEdit3->setText("");
209     myGrp->LineEdit4->setText("");
210     myGrp->LineEdit5->setText("");
211     myGrp->LineEdit6->setText("");
212     erasePreview();
213     return;
214   }
215
216   SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
217   int aPrecision = resMgr->integerValue( "Geometry", "length_precision", 6 );
218
219   gp_Pnt p1 (myDbls[i*6 + 0], myDbls[i*6 + 1], myDbls[i*6 + 2]);
220   gp_Pnt p2 (myDbls[i*6 + 3], myDbls[i*6 + 4], myDbls[i*6 + 5]);
221
222   double aDist = p1.Distance(p2);
223   myGrp->LineEdit3->setText(DlgRef::PrintDoubleValue(aDist, aPrecision));
224
225   gp_XYZ aVec = p2.XYZ() - p1.XYZ();
226   myGrp->LineEdit4->setText(DlgRef::PrintDoubleValue(aVec.X(), aPrecision));
227   myGrp->LineEdit5->setText(DlgRef::PrintDoubleValue(aVec.Y(), aPrecision));
228   myGrp->LineEdit6->setText(DlgRef::PrintDoubleValue(aVec.Z(), aPrecision));
229
230   redisplayPreview();
231 }
232
233 //=================================================================================
234 // function : SelectionIntoArgument()
235 // purpose  : Called when selection has changed
236 //=================================================================================
237 void MeasureGUI_DistanceDlg::SelectionIntoArgument()
238 {
239   QList<TopAbs_ShapeEnum> aTypes;
240   aTypes << TopAbs_VERTEX << TopAbs_EDGE << TopAbs_WIRE << TopAbs_FACE << TopAbs_SHELL << TopAbs_SOLID << TopAbs_COMPSOLID << TopAbs_COMPOUND << TopAbs_SHAPE;
241   GEOM::GeomObjPtr aSelectedObject = getSelected( aTypes );
242
243   // clear selection
244   disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
245   myGeomGUI->getApp()->selectionMgr()->clearSelected();
246   connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
247           this, SLOT(SelectionIntoArgument()));
248
249   if (myEditCurrentArgument == myGrp->LineEdit1) {
250     myObj1 = aSelectedObject;
251     if (myObj1 && !myObj2)
252       myGrp->PushButton2->click();
253   }
254   else {
255     myObj2 = aSelectedObject;
256     if (myObj2 && !myObj1)
257       myGrp->PushButton1->click();
258   }
259
260   processObject();
261 }
262
263 //=================================================================================
264 // function : SetEditCurrentArgument()
265 // purpose  :
266 //=================================================================================
267 void MeasureGUI_DistanceDlg::SetEditCurrentArgument()
268 {
269   QPushButton* send = (QPushButton*)sender();
270
271   if (send == myGrp->PushButton1) {
272     myEditCurrentArgument = myGrp->LineEdit1;
273
274     myGrp->PushButton2->setDown(false);
275     myGrp->LineEdit2->setEnabled(false);
276   }
277   else {
278     myEditCurrentArgument = myGrp->LineEdit2;
279
280     myGrp->PushButton1->setDown(false);
281     myGrp->LineEdit1->setEnabled(false);
282   }
283
284   // enable line edit
285   myEditCurrentArgument->setEnabled(true);
286   myEditCurrentArgument->setFocus();
287   // after setFocus(), because it will be setDown(false) when loses focus
288   send->setDown(true);
289
290   // seems we need it only to avoid preview disappearing, caused by selection mode change
291   redisplayPreview();
292 }
293
294 //=================================================================================
295 // function : processObject()
296 // purpose  : Fill dialogs fields in accordance with myObj1 and myObj2
297 //=================================================================================
298 void MeasureGUI_DistanceDlg::processObject()
299 {
300   myGrp->LineEdit1->setText(myObj1 ? GEOMBase::GetName(myObj1.get()) : "");
301   myGrp->LineEdit2->setText(myObj2 ? GEOMBase::GetName(myObj2.get()) : "");
302
303   myGrp->ComboBox1->clear();
304   myDbls->length(0);
305   erasePreview();
306
307   int nbSols = 0;
308
309   QString msg;
310   if (!isValid(msg)) return;
311
312   GEOM::GEOM_IMeasureOperations_var anOper = GEOM::GEOM_IMeasureOperations::_narrow(getOperation());
313   try {
314     nbSols = anOper->ClosestPoints(myObj1.get(), myObj2.get(), myDbls);
315   }
316   catch (const SALOME::SALOME_Exception& e) {
317     SalomeApp_Tools::QtCatchCorbaException(e);
318     return;
319   }
320
321   if (!anOper->IsDone())
322     myGrp->ComboBox1->addItem(tr(anOper->GetErrorCode()));
323   else if (nbSols <= 0)
324     myGrp->ComboBox1->addItem(tr("GEOM_MINDIST_NO_SOL"));
325   else {
326     for (int i = 0; i < nbSols; i++) {
327       myGrp->ComboBox1->addItem(tr("GEOM_SOLUTION_I").arg(i + 1));
328     }
329     myGrp->ComboBox1->setCurrentIndex(0);
330   }
331 }
332
333 //=================================================================================
334 // function : buildPrs()
335 // purpose  :
336 //=================================================================================
337 SALOME_Prs* MeasureGUI_DistanceDlg::buildPrs()
338 {
339   SUIT_ViewWindow* vw = SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
340
341   int currSol = myGrp->ComboBox1->currentIndex();
342
343   if (!myObj1 || !myObj2 ||
344       currSol == -1 || (currSol+1)*6 > (int)myDbls->length() ||
345       vw->getViewManager()->getType() != OCCViewer_Viewer::Type())
346     return 0;
347
348   gp_Pnt aPnt1 (myDbls[currSol*6 + 0], myDbls[currSol*6 + 1], myDbls[currSol*6 + 2]);
349   gp_Pnt aPnt2 (myDbls[currSol*6 + 3], myDbls[currSol*6 + 4], myDbls[currSol*6 + 5]);
350
351   double aDist = aPnt1.Distance(aPnt2);
352
353   try
354   {
355     if (aDist <= 1.e-9) {
356       BRepBuilderAPI_MakeVertex aMaker (aPnt1);
357       return getDisplayer()->BuildPrs(aMaker.Vertex());
358     }
359     else {
360       BRepBuilderAPI_MakeEdge MakeEdge (aPnt1, aPnt2);
361       TopoDS_Vertex aVert1 = BRepBuilderAPI_MakeVertex(aPnt1);
362       TopoDS_Vertex aVert2 = BRepBuilderAPI_MakeVertex(aPnt2);
363
364       //QString aLabel;
365       //aLabel.sprintf("%.1f", aDist);
366
367       gp_Pnt aPnt3 ((aPnt1.X() + aPnt2.X()) / 2,
368                     (aPnt1.Y() + aPnt2.Y()) / 2,
369                     (aPnt1.Z() + aPnt2.Z()) / 2);
370
371       gp_Vec va (aPnt3, aPnt1);
372       gp_Vec vb (aPnt3, aPnt2);
373
374       if (va.IsParallel(vb, Precision::Angular())) {
375         aPnt3.SetY((aPnt1.Y() + aPnt2.Y()) / 2 + 100);
376         aPnt3.SetZ((aPnt1.Z() + aPnt2.Z()) / 2);
377       }
378
379       gce_MakePln gce_MP (aPnt1, aPnt2, aPnt3);
380       Handle(Geom_Plane) P = new Geom_Plane (gce_MP.Value());
381
382       Handle(AIS_LengthDimension) anIO = new AIS_LengthDimension( aVert1, aVert2, P->Pln() );
383
384       SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
385       int w = resMgr->integerValue( "Geometry", "measures_line_width", 1 );
386
387       Handle(Prs3d_DimensionAspect) aDimensionStyle = new Prs3d_DimensionAspect;
388
389       aDimensionStyle->ArrowAspect()->SetLength( aDist / 20.0 );
390       aDimensionStyle->LineAspect()->SetWidth( w );
391       aDimensionStyle->SetTextHorizontalPosition( Prs3d_DTHP_Center );
392       aDimensionStyle->SetTextVerticalPosition( Prs3d_DTVP_Center );
393       aDimensionStyle->MakeText3d( Standard_False );
394       aDimensionStyle->MakeArrows3d( Standard_True );
395
396       anIO->SetFlyout( 0.0 );
397       anIO->SetDimensionAspect( aDimensionStyle );
398
399       SOCC_Prs* aPrs = dynamic_cast<SOCC_Prs*>(((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0));
400
401       if (aPrs)
402         aPrs->AddObject(anIO);
403
404       return aPrs;
405     }
406   }
407   catch (Standard_Failure&) {
408     return 0;
409   }
410 }
411
412 //=================================================================================
413 // function : createOperation
414 // purpose  :
415 //=================================================================================
416 GEOM::GEOM_IOperations_ptr MeasureGUI_DistanceDlg::createOperation()
417 {
418   return getGeomEngine()->GetIMeasureOperations();
419 }
420
421 //=================================================================================
422 // function : isValid()
423 // purpose  :
424 //=================================================================================
425 bool MeasureGUI_DistanceDlg::isValid (QString& /*msg*/)
426 {
427   return myObj1 && myObj2;
428 }
429
430 //=================================================================================
431 // function : execute
432 // purpose  :
433 //=================================================================================
434 bool MeasureGUI_DistanceDlg::execute (ObjectList& objects)
435 {
436   GEOM::GEOM_IMeasureOperations_var anOper = GEOM::GEOM_IMeasureOperations::_narrow(getOperation());
437   GEOM::GEOM_IBasicOperations_var aBasicOper = getGeomEngine()->GetIBasicOperations();
438
439   GEOM::ListOfDouble_var aDbls;
440   int nbSols = anOper->ClosestPoints(myObj1.get(), myObj2.get(), aDbls);
441
442   if (anOper->IsDone()) {
443     bool doPublishAll = true;
444     if (nbSols > 1) {
445       QMessageBox::StandardButton anAnswer =
446         SUIT_MessageBox::question(this, tr("GEOM_MINDIST_PUBLISH_TITLE"),
447                                   tr("GEOM_MINDIST_PUBLISH_TEXT"),
448                                   QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel,
449                                   QMessageBox::No);
450       if (anAnswer == QMessageBox::No)
451         doPublishAll = false;
452       else if (anAnswer != QMessageBox::Yes)
453         return true;
454     }
455     if (doPublishAll) {
456       for (int i = 0; i < nbSols; i++) {
457         GEOM::GEOM_Object_var anObj1 =
458           aBasicOper->MakePointXYZ(aDbls[i*6 + 0], aDbls[i*6 + 1], aDbls[i*6 + 2]);
459         GEOM::GEOM_Object_var anObj2 =
460           aBasicOper->MakePointXYZ(aDbls[i*6 + 3], aDbls[i*6 + 4], aDbls[i*6 + 5]);
461
462         if (!anObj1->_is_nil() && !anObj2->_is_nil()) {
463           objects.push_back(anObj1._retn());
464           objects.push_back(anObj2._retn());
465         }
466       }
467     }
468     else {
469       int i = myGrp->ComboBox1->currentIndex();
470       GEOM::GEOM_Object_var anObj1 =
471         aBasicOper->MakePointXYZ(aDbls[i*6 + 0], aDbls[i*6 + 1], aDbls[i*6 + 2]);
472       GEOM::GEOM_Object_var anObj2 =
473         aBasicOper->MakePointXYZ(aDbls[i*6 + 3], aDbls[i*6 + 4], aDbls[i*6 + 5]);
474
475       if (!anObj1->_is_nil() && !anObj2->_is_nil()) {
476         objects.push_back(anObj1._retn());
477         objects.push_back(anObj2._retn());
478       }
479     }
480   }
481
482   return true;
483 }
484
485 //=================================================================================
486 // function : activateSelection()
487 // purpose  :
488 //=================================================================================
489 void MeasureGUI_DistanceDlg::activateSelection()
490 {
491   globalSelection( GEOM_ALLSHAPES );
492   localSelection( TopAbs_SHAPE );
493 }
494
495 //=================================================================================
496 // function : redisplayPreview()
497 // purpose  :
498 //=================================================================================
499 void MeasureGUI_DistanceDlg::redisplayPreview()
500 {
501   QString aMess;
502   if (!isValid(aMess)) {
503     erasePreview(true);
504     return;
505   }
506
507   erasePreview(false);
508
509   try {
510     SUIT_OverrideCursor wc;
511
512     getDisplayer()->SetColor(Quantity_NOC_VIOLET);
513     getDisplayer()->SetToActivate(false);
514     
515     if (SALOME_Prs* aPrs = buildPrs())
516       displayPreview(aPrs);
517   }
518   catch (const SALOME::SALOME_Exception& e) {
519     SalomeApp_Tools::QtCatchCorbaException(e);
520   }
521 }
522
523 //================================================================
524 // Function : getNewObjectName
525 // Purpose  : Redefine this method to return proper name for a new object
526 //================================================================
527 QString MeasureGUI_DistanceDlg::getNewObjectName (int currObj) const
528 {
529   QString aName = tr("GEOM_MINDIST_NAME") + QString("_%1_").arg((currObj+1)/2);
530   aName += GEOMBase::GetName(currObj%2 ? myObj1.get() : myObj2.get());
531
532   return aName;
533 }
534
535 //=================================================================================
536 // function : addSubshapeToStudy
537 // purpose  : virtual method to add new SubObjects if local selection
538 //=================================================================================
539 void MeasureGUI_DistanceDlg::addSubshapesToStudy()
540 {
541   GEOMBase::PublishSubObject( myObj1.get() );
542   GEOMBase::PublishSubObject( myObj2.get() );
543 }
544
545 //=================================================================================
546 // function : getSourceObjects
547 // purpose  : virtual method to get source objects
548 //=================================================================================
549 QList<GEOM::GeomObjPtr> MeasureGUI_DistanceDlg::getSourceObjects()
550 {
551   QList<GEOM::GeomObjPtr> res;
552   res << myObj1 << myObj2;
553   return res;
554 }
555
556 //=================================================================================
557 // function : MeasureGUI_DistanceGroup
558 // purpose  :
559 //=================================================================================
560 MeasureGUI_DistanceGroup::MeasureGUI_DistanceGroup (QWidget *parent)
561 {
562   gridLayout = new QGridLayout (parent);
563   gridLayout->setSpacing(6);
564   gridLayout->setContentsMargins(11, 11, 11, 11);
565   gridLayout->setHorizontalSpacing(0);
566   gridLayout->setVerticalSpacing(0);
567   gridLayout->setContentsMargins(0, 0, 0, 0);
568
569   GroupBox1 = new QGroupBox (parent);
570
571   gridLayout1 = new QGridLayout (GroupBox1);
572   gridLayout1->setSpacing(6);
573   gridLayout1->setContentsMargins(11, 11, 11, 11);
574   gridLayout1->setHorizontalSpacing(6);
575   gridLayout1->setVerticalSpacing(6);
576   gridLayout1->setContentsMargins(9, 9, 9, 9);
577
578   // 2Sel
579   TextLabel1 = new QLabel(GroupBox1);
580   TextLabel2 = new QLabel(GroupBox1);
581
582   PushButton1 = new QPushButton (GroupBox1);
583   PushButton2 = new QPushButton (GroupBox1);
584
585   LineEdit1 = new QLineEdit(GroupBox1);
586   LineEdit2 = new QLineEdit(GroupBox1);
587
588   gridLayout1->addWidget(TextLabel1, 0, 0, 1, 1);
589   gridLayout1->addWidget(TextLabel2, 1, 0, 1, 1);
590   gridLayout1->addWidget(PushButton1, 0, 1, 1, 1);
591   gridLayout1->addWidget(PushButton2, 1, 1, 1, 1);
592   gridLayout1->addWidget(LineEdit1, 0, 2, 1, 1);
593   gridLayout1->addWidget(LineEdit2, 1, 2, 1, 1);
594
595   // 1Combo
596   TextLabel7 = new QLabel (GroupBox1);
597
598   ComboBox1 = new QComboBox (GroupBox1);
599
600   gridLayout1->addWidget(TextLabel7, 2, 0, 1, 1);
601   gridLayout1->addWidget(ComboBox1, 2, 1, 1, 2);
602
603   // 4Text
604   TextLabel3 = new QLabel (GroupBox1);
605   TextLabel4 = new QLabel (GroupBox1);
606   TextLabel5 = new QLabel (GroupBox1);
607   TextLabel6 = new QLabel (GroupBox1);
608
609   LineEdit3 = new QLineEdit(GroupBox1);
610   LineEdit4 = new QLineEdit(GroupBox1);
611   LineEdit5 = new QLineEdit(GroupBox1);
612   LineEdit6 = new QLineEdit(GroupBox1);
613
614   gridLayout1->addWidget(TextLabel3, 3, 0, 1, 1);
615   gridLayout1->addWidget(TextLabel4, 4, 0, 1, 1);
616   gridLayout1->addWidget(TextLabel5, 5, 0, 1, 1);
617   gridLayout1->addWidget(TextLabel6, 6, 0, 1, 1);
618
619   gridLayout1->addWidget(LineEdit3, 3, 1, 1, 2);
620   gridLayout1->addWidget(LineEdit4, 4, 1, 1, 2);
621   gridLayout1->addWidget(LineEdit5, 5, 1, 1, 2);
622   gridLayout1->addWidget(LineEdit6, 6, 1, 1, 2);
623
624   gridLayout->addWidget(GroupBox1, 0, 0, 1, 1);
625 }
626
627 //=================================================================================
628 // function : ~MeasureGUI_DistanceGroup()
629 // purpose  : Destroys the object and frees any allocated resources
630 //=================================================================================
631 MeasureGUI_DistanceGroup::~MeasureGUI_DistanceGroup()
632 {
633   // no need to delete child widgets, Qt does it all for us
634 }