Salome HOME
Some fixes
[modules/shaper.git] / src / XGUI / XGUI_InspectionPanel.cpp
1 // Copyright (C) 2014-2017  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
19 //
20
21 #include "XGUI_InspectionPanel.h"
22 #include "XGUI_SelectionMgr.h"
23 #include "XGUI_Selection.h"
24 #include "XGUI_Tools.h"
25
26 #include <ModuleBase_ViewerPrs.h>
27 #include <ModuleBase_Tools.h>
28
29 #include <ModelAPI_Result.h>
30
31 #include <QLayout>
32 #include <QScrollArea>
33 #include <QLabel>
34 #include <QLineEdit>
35 #include <QTableWidget>
36 #include <QHeaderView>
37 #include <QTextBrowser>
38
39 #include <BRep_Tool.hxx>
40 #include <BRepTools.hxx>
41 #include <BRepGProp.hxx>
42 #include <GeomAbs_CurveType.hxx>
43 #include <GeomAbs_SurfaceType.hxx>
44 #include <GeomAdaptor_Curve.hxx>
45 #include <GeomAdaptor_Surface.hxx>
46 #include <Geom_BSplineCurve.hxx>
47 #include <GProp_GProps.hxx>
48 #include <gp_Circ.hxx>
49 #include <gp_Elips.hxx>
50 #include <gp_Sphere.hxx>
51 #include <gp_Cylinder.hxx>
52 #include <gp_Cone.hxx>
53 #include <gp_Torus.hxx>
54 #include <TopTools_MapOfShape.hxx>
55 #include <TopTools_ListOfShape.hxx>
56 #include <TopExp.hxx>
57 #include <TopExp_Explorer.hxx>
58 #include <TopoDS_Iterator.hxx>
59 #include <TopoDS.hxx>
60 #include <TopoDS_Vertex.hxx>
61 #include <TopoDS_Edge.hxx>
62 #include <TopoDS_Face.hxx>
63 #include <TopoDS_Wire.hxx>
64 #include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic
65
66 XGUI_InspectionPanel::XGUI_InspectionPanel(QWidget* theParent, XGUI_SelectionMgr* theMgr)
67   : QDockWidget(theParent),
68   mySelectionMgr(theMgr)
69 {
70   setWindowTitle(tr("Inspection Panel"));
71   setObjectName(INSPECTION_PANEL);
72   setStyleSheet("::title { position: relative; padding-left: 5px; text-align: left center }");
73
74   QScrollArea* aScrollArea = new QScrollArea(this);
75   setWidget(aScrollArea);
76
77   // Create an internal widget
78   QWidget* aMainWidget = new QWidget(aScrollArea);
79
80   QVBoxLayout* aMainLayout = new QVBoxLayout(aMainWidget);
81   aMainLayout->setContentsMargins(5, 5, 5, 5);
82
83   QWidget* aNameWgt = new QWidget(aMainWidget);
84   QHBoxLayout* aNameLayout = new QHBoxLayout(aNameWgt);
85   aNameLayout->setContentsMargins(0, 0, 0, 0);
86   aNameLayout->addWidget(new QLabel(tr("Object"), aNameWgt));
87   myNameEdt = new QLineEdit(aNameWgt);
88   myNameEdt->setReadOnly(true);
89   aNameLayout->addWidget(myNameEdt);
90
91   aMainLayout->addWidget(aNameWgt);
92
93   // Table with sub-shapes
94   mySubShapesTab = new QTableWidget(9, 2, aMainWidget);
95   mySubShapesTab->setFocusPolicy(Qt::NoFocus);
96   mySubShapesTab->verticalHeader()->hide();
97   QStringList aTitles;
98   aTitles << tr("Sub-shapes") << tr("Number");
99   mySubShapesTab->setHorizontalHeaderLabels(aTitles);
100
101   QStringList aSubShapes;
102   aSubShapes << "SHAPE" << "COMPOUND" << "COMPSOLID" <<
103     "SOLID" << "SHELL" << "FACE" << "WIRE" << "EDGE" << "VERTEX";
104   int i = 0;
105   foreach(QString aType, aSubShapes) {
106     QTableWidgetItem* aItem = new QTableWidgetItem(aType);
107     aItem->setFlags(Qt::ItemIsEnabled);
108     mySubShapesTab->setItem(i++, 0, aItem);
109   }
110   for (i = 0; i < 9; i++) {
111     QTableWidgetItem* aItem = new QTableWidgetItem("");
112     aItem->setFlags(Qt::ItemIsEnabled);
113     aItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
114     mySubShapesTab->setItem(i, 1, aItem);
115   }
116   mySubShapesTab->setColumnWidth(0, 90);
117   mySubShapesTab->setColumnWidth(1, 70);
118
119   mySubShapesTab->setMaximumWidth(170);
120   mySubShapesTab->setMinimumHeight(300);
121
122   aMainLayout->addWidget(mySubShapesTab);
123
124   // Type of object
125   QWidget* aTypeWgt = new QWidget(aMainWidget);
126   QHBoxLayout* aTypeLayout = new QHBoxLayout(aTypeWgt);
127   aTypeLayout->setContentsMargins(0, 0, 0, 0);
128
129   aTypeLayout->addWidget(new QLabel(tr("Type:"), aTypeWgt));
130   myTypeLbl = new QLabel("", aTypeWgt);
131   aTypeLayout->addWidget(myTypeLbl);
132
133   aMainLayout->addWidget(aTypeWgt);
134
135   myTypeParams = new QTextBrowser(aMainWidget);
136   myTypeParams->setMaximumWidth(170);
137   myTypeParams->setMaximumHeight(160);
138   myTypeParams->setReadOnly(true);
139   myTypeParams->setFocusPolicy(Qt::NoFocus);
140   myTypeParams->setFrameStyle(QFrame::NoFrame);
141   myTypeParams->viewport()->setBackgroundRole(QPalette::Window);
142
143   aMainLayout->addWidget(myTypeParams);
144
145   aScrollArea->setWidget(aMainWidget);
146
147   connect(mySelectionMgr, SIGNAL(selectionChanged()), SLOT(onSelectionChanged()));
148 }
149
150 //********************************************************************
151 XGUI_InspectionPanel::~XGUI_InspectionPanel()
152 {
153 }
154
155 //********************************************************************
156 void XGUI_InspectionPanel::setSubShapeValue(SudShape theId, int theVal)
157 {
158   mySubShapesTab->item(theId, 1)->setText(QString::number(theVal));
159 }
160
161 //********************************************************************
162 void XGUI_InspectionPanel::clearContent()
163 {
164   setName("");
165   for (int i = 0; i <= VertexId; i++) {
166     mySubShapesTab->item((SudShape)i, 1)->setText("");
167   }
168   myTypeLbl->setText("");
169   myTypeParams->setText("");
170 }
171
172 //********************************************************************
173 void XGUI_InspectionPanel::onSelectionChanged()
174 {
175   clearContent();
176   XGUI_Selection* aSelection = mySelectionMgr->selection();
177   QList<ModuleBase_ViewerPrsPtr> aSelectedList =
178     aSelection->getSelected(ModuleBase_ISelection::Viewer);
179   if (aSelectedList.count() > 0) {
180     ModuleBase_ViewerPrsPtr aPrs = aSelectedList.first();
181     TopoDS_Shape aShape = ModuleBase_Tools::getSelectedShape(aPrs);
182     if (aShape.IsNull())
183       return;
184     setName(XGUI_Tools::generateName(aPrs));
185     setShapeContent(aShape);
186     setShapeParams(aShape);
187   }
188 }
189
190 //********************************************************************
191 void XGUI_InspectionPanel::setName(const QString& theName)
192 {
193   myNameEdt->setText(theName);
194 }
195
196 //********************************************************************
197 void XGUI_InspectionPanel::setShapeContent(const TopoDS_Shape& theShape)
198 {
199   try {
200     OCC_CATCH_SIGNALS;
201     int iType, nbTypes[TopAbs_SHAPE];
202     for (iType = 0; iType < TopAbs_SHAPE; ++iType) {
203       nbTypes[iType] = 0;
204     }
205     nbTypes[theShape.ShapeType()]++;
206
207     TopTools_MapOfShape aMapOfShape;
208     aMapOfShape.Add(theShape);
209     TopTools_ListOfShape aListOfShape;
210     aListOfShape.Append(theShape);
211
212     TopTools_ListIteratorOfListOfShape itL(aListOfShape);
213     for (; itL.More(); itL.Next()) {
214       TopoDS_Shape sp = itL.Value();
215       TopoDS_Iterator it(sp);
216       for (; it.More(); it.Next()) {
217         TopoDS_Shape s = it.Value();
218         if (aMapOfShape.Add(s)) {
219           aListOfShape.Append(s);
220           nbTypes[s.ShapeType()]++;
221         }
222       }
223     }
224     setSubShapeValue(VertexId, nbTypes[TopAbs_VERTEX]);
225     setSubShapeValue(EdgeId, nbTypes[TopAbs_EDGE]);
226     setSubShapeValue(WireId, nbTypes[TopAbs_WIRE]);
227     setSubShapeValue(FaceId, nbTypes[TopAbs_FACE]);
228     setSubShapeValue(ShellId, nbTypes[TopAbs_SHELL]);
229     setSubShapeValue(SolidId, nbTypes[TopAbs_SOLID]);
230     setSubShapeValue(CompsolidId, nbTypes[TopAbs_COMPSOLID]);
231     setSubShapeValue(CompoundId, nbTypes[TopAbs_COMPOUND]);
232     setSubShapeValue(ShapeId, aMapOfShape.Extent());
233   }
234   catch (Standard_Failure) {
235     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
236     //SetErrorCode(aFail->GetMessageString());
237   }
238 }
239
240 //********************************************************************
241 void XGUI_InspectionPanel::setShapeParams(const TopoDS_Shape& theShape)
242 {
243   switch (theShape.ShapeType()) {
244   case TopAbs_VERTEX:
245     fillVertex(theShape);
246     break;
247   case TopAbs_EDGE:
248     fillEdge(theShape);
249     break;
250   case TopAbs_FACE:
251     fillFace(theShape);
252     break;
253   case TopAbs_SOLID:
254     fillSolid(theShape);
255     break;
256   case TopAbs_WIRE:
257   case TopAbs_SHELL:
258   case TopAbs_COMPSOLID:
259   case TopAbs_COMPOUND:
260     fillContainer(theShape);
261     break;
262   }
263 }
264
265 //********************************************************************
266 void XGUI_InspectionPanel::fillVertex(const TopoDS_Shape& theShape)
267 {
268   TopoDS_Vertex aV = TopoDS::Vertex(theShape);
269   gp_Pnt aP = BRep_Tool::Pnt(aV);
270   setVertexType(aP.XYZ());
271 }
272
273 //********************************************************************
274 void XGUI_InspectionPanel::fillEdge(const TopoDS_Shape& theShape)
275 {
276   TopoDS_Edge aE = TopoDS::Edge(theShape);
277
278   bool bDegenerated = BRep_Tool::Degenerated(aE);
279
280   double aT1, aT2;
281   Handle(Geom_Curve) aC3D = BRep_Tool::Curve(aE, aT1, aT2);
282   GeomAdaptor_Curve aGAC(aC3D);
283   GeomAbs_CurveType aCT = aGAC.GetType();
284
285   if (aCT == GeomAbs_Line) { // Line
286     gp_Pnt aP1, aP2;
287     aGAC.D0(aT1, aP1);
288     aGAC.D0(aT2, aP2);
289     setLineType(aP1.XYZ(), aP2.XYZ());
290
291   } else if (aCT == GeomAbs_Circle) {
292     gp_Circ aCirc = aGAC.Circle();
293     gp_Pnt aP = aCirc.Location();
294     gp_Ax2 aAx2 = aCirc.Position();
295     double aR1 = aCirc.Radius();
296     gp_Dir aDir = aAx2.Axis().Direction();
297
298     bool isArc = (Abs(aT2 - aT1 - aC3D->Period()) >= Precision::PConfusion());
299     if (isArc) {
300       gp_Pnt aP1, aP2;
301       aGAC.D0(aT1, aP1);
302       aGAC.D0(aT2, aP2);
303       setArcType(aP.XYZ(), aDir.XYZ(), aR1, aP1.XYZ(), aP2.XYZ());
304     } else
305       setCircleType(aP.XYZ(), aDir.XYZ(), aR1);
306
307   } else if (aCT == GeomAbs_Ellipse) {
308     gp_Elips aElips = aGAC.Ellipse();
309     gp_Pnt aP = aElips.Location();
310     gp_Ax2 aAx2 = aElips.Position();
311     double aR1 = aElips.MajorRadius();
312     double aR2 = aElips.MinorRadius();
313     gp_Dir aDir = aAx2.Axis().Direction();
314     gp_Pnt aP1, aP2;
315     aGAC.D0(aT1, aP1);
316     aGAC.D0(aT2, aP2);
317     bool isArc = aP1.Distance(aP2) > Precision::Confusion();
318     if (isArc)
319       setEllipseArcType(aP.XYZ(), aDir.XYZ(), aR1, aR2, aP1.XYZ(), aP2.XYZ());
320     else
321       setEllipseType(aP.XYZ(), aDir.XYZ(), aR1, aR2);
322   }
323 }
324
325 //********************************************************************
326 void XGUI_InspectionPanel::fillFace(const TopoDS_Shape& theShape)
327 {
328   TopoDS_Face aF = TopoDS::Face(theShape);
329   //
330   Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aF);
331   GeomAdaptor_Surface aGAS(aSurf);
332   GeomAbs_SurfaceType aST = aGAS.GetType();
333
334   // 1. Plane
335   if (aST == GeomAbs_Plane) {
336     gp_Pln aPln = aGAS.Plane();
337     gp_Pnt aP0 = aPln.Location();
338     gp_Ax3 aAx3 = aPln.Position();
339
340     setPlaneType(aP0.XYZ(), aAx3.Direction().XYZ());
341   }
342   // 2. Sphere
343   else if (aST == GeomAbs_Sphere) {
344     gp_Sphere aSphere = aGAS.Sphere();
345     gp_Pnt aP0 = aSphere.Location();
346     double aR1 = aSphere.Radius();
347
348     setSphereType(aP0.XYZ(), aR1);
349   }
350   // 3. Cylinder
351   else if (aST == GeomAbs_Cylinder) {
352     gp_Cylinder aCyl = aGAS.Cylinder();
353     gp_Pnt aP0 = aCyl.Location();
354     gp_Ax3 aAx3 = aCyl.Position();
355     double aR1 = aCyl.Radius();
356
357     double aUMin, aUMax, aVMin, aVMax;
358     BRepTools::UVBounds(aF, aUMin, aUMax, aVMin, aVMax);
359     double dV = aVMax - aVMin;
360
361     setCylinderType(aP0.XYZ(), aAx3.Direction().XYZ(), aR1, dV);
362   }
363   // 4. Cone
364   else if (aST == GeomAbs_Cone) {
365     gp_Cone aCone = aGAS.Cone();
366     gp_Pnt aP0 = aCone.Location();
367     gp_Ax3 aAx3 = aCone.Position();
368     double aR1 = aCone.RefRadius();
369
370     double aUMin, aUMax, aVMin, aVMax;
371     BRepTools::UVBounds(aF, aUMin, aUMax, aVMin, aVMax);
372     double aSemiAngle = fabs(aCone.SemiAngle());
373     double dV = (aVMax - aVMin)*cos(aSemiAngle);
374     double aR2 = aR1 - (aVMax - aVMin)*sin(aSemiAngle);
375
376     setConeType(aP0.XYZ(), aAx3.Direction().XYZ(), aR1, aR2, dV);
377   }
378   // 5. Torus
379   else if (aST == GeomAbs_Torus) {
380     gp_Torus aTorus = aGAS.Torus();
381     gp_Pnt aP0 = aTorus.Location();
382     gp_Ax3 aAx3 = aTorus.Position();
383     double aR1 = aTorus.MajorRadius();
384     double aR2 = aTorus.MinorRadius();
385
386     setTorusType(aP0.XYZ(), aAx3.Direction().XYZ(), aR1, aR2);
387   }
388 }
389
390 //********************************************************************
391 void XGUI_InspectionPanel::fillSolid(const TopoDS_Shape& theShape)
392 {
393   myTypeLbl->setText(tr("Solid"));
394   TopoDS_Solid aSd = TopoDS::Solid(theShape);
395   processSphere(aSd);
396 }
397
398
399
400 //********************************************************************
401 bool IsEqual(const gp_Sphere& aSp1, const gp_Sphere& aSp2, const Standard_Real aTolLin)
402 {
403   double aR1 = aSp1.Radius();
404   double aR2 = aSp2.Radius();
405   if (fabs(aR1 - aR2) > aTolLin) {
406     return false;
407   }
408   const gp_Pnt& aPC1 = aSp1.Position().Location();
409   const gp_Pnt& aPC2 = aSp2.Position().Location();
410   double aD2 = aPC1.SquareDistance(aPC2);
411   return (aD2 < (aTolLin*aTolLin));
412 }
413
414
415 bool XGUI_InspectionPanel::processSphere(const TopoDS_Solid& theSolid)
416 {
417   gp_Sphere aSphere[2];
418   GeomAbs_SurfaceType aST;
419   Handle(Geom_Surface) aS;
420   GeomAdaptor_Surface aGAS;
421
422   double aTol = Precision::Confusion();
423   double aTolAng = Precision::Angular();
424
425   TopExp_Explorer aExp(theSolid, TopAbs_FACE);
426   int j;
427   for (j = 0; aExp.More(); aExp.Next(), ++j) {
428     const TopoDS_Face& aF = *((TopoDS_Face*)&aExp.Current());
429     aS = BRep_Tool::Surface(aF);
430     aGAS.Load(aS);
431     aST = aGAS.GetType();
432     if (aST != GeomAbs_Sphere) {
433       return false;
434     }
435     aSphere[j] = aGAS.Sphere();
436   }
437   bool bIsEqual = IsEqual(aSphere[0], aSphere[1], aTol);
438   if (!bIsEqual) {
439     return false;
440   }
441   GProp_GProps aGProps;
442   bool bOnlyClosed = false;
443   double aVolume = aSphere[0].Volume();
444   BRepGProp::VolumeProperties(theSolid, aGProps, aTol, bOnlyClosed);
445
446   double aVolumeS = aGProps.Mass();
447   if (aVolumeS < 0.) {
448     aVolumeS = -aVolumeS;
449   }
450   double dV = fabs(aVolumeS - aVolume);
451   if (dV > aTol) {
452     return false;
453   }
454   double aArea = aSphere[0].Area();
455   BRepGProp::SurfaceProperties(theSolid, aGProps, aTol);
456   double aAreaS = aGProps.Mass();
457   double dA = fabs(aAreaS - aArea);
458   if (dA > aTol) {
459     return false;
460   }
461   gp_Pnt aP0 = aSphere[0].Location();
462   double aR1 = aSphere[0].Radius();
463
464   setSphereType(aP0.XYZ(), aR1);
465
466   return true;
467 }
468
469
470 //********************************************************************
471 void XGUI_InspectionPanel::fillContainer(const TopoDS_Shape& theShape)
472 {
473   TopAbs_ShapeEnum aType = theShape.ShapeType();
474   if (aType == TopAbs_SHELL) {
475     bool aIsClosed = BRep_Tool::IsClosed(theShape);
476     myTypeLbl->setText(tr("Shell"));
477     myTypeParams->setText(aIsClosed? tr("Closed") : tr("Non-closed"));
478   } else if (aType == TopAbs_WIRE) {
479     TopoDS_Wire aW = TopoDS::Wire(theShape);
480     bool isClosed = aW.Closed();
481     myTypeLbl->setText(tr("Wire"));
482     myTypeParams->setText(isClosed ? tr("Closed") : tr("Non-closed"));
483   }
484 }
485
486 //********************************************************************
487 #define TITLE(val) ("<b>" + val + "</b>")
488
489 void XGUI_InspectionPanel::setCylinderType(const gp_XYZ& theLoc,
490   const gp_XYZ& theDir, double theRadius, double theHeight)
491 {
492   myTypeLbl->setText(tr("Cylinder"));
493   QString aParams = TITLE(tr("Center")) +
494     "<br> X: " + QString::number(theLoc.X()) +
495     "<br> Y: " + QString::number(theLoc.Y()) +
496     "<br> Z: " + QString::number(theLoc.Z()) +
497     "<br>" + TITLE(tr("Axis")) +
498     "<br> DX: " + QString::number(theDir.X()) +
499     "<br> DY: " + QString::number(theDir.Y()) +
500     "<br> DZ: " + QString::number(theDir.Z()) +
501     "<br>" + TITLE(tr("Dimensions")) +
502     "<br>" + tr("Radius: ") + QString::number(theRadius) +
503     "<br>" + tr("Height: ") + QString::number(theHeight);
504
505   myTypeParams->setText(aParams);
506 }
507
508 //********************************************************************
509 void XGUI_InspectionPanel::setSphereType(const gp_XYZ& theLoc, double theRadius)
510 {
511   myTypeLbl->setText(tr("Sphere"));
512   QString aParams = TITLE(tr("Center")) +
513     "<br> X: " + QString::number(theLoc.X()) +
514     "<br> Y: " + QString::number(theLoc.Y()) +
515     "<br> Z: " + QString::number(theLoc.Z()) +
516     "<br>" + TITLE(tr("Dimensions")) +
517     "<br>" + tr("Radius: ") + QString::number(theRadius);
518   myTypeParams->setText(aParams);
519 }
520
521 //********************************************************************
522 void XGUI_InspectionPanel::setBoxType(double theX, double theY, double theZ,
523   double theXsize, double theYsize, double theZsize)
524 {
525   myTypeLbl->setText(tr("Box"));
526   QString aParams = TITLE(tr("Position")) +
527     "<br> X: " + QString::number(theX) +
528     "<br> Y: " + QString::number(theY) +
529     "<br> Z: " + QString::number(theZ) +
530     "<br>" + TITLE(tr("Dimensions")) +
531     "<br>" + "Ax :" + QString::number(theXsize) +
532     "<br>" + "Ay :" + QString::number(theYsize) +
533     "<br>" + "Az :" + QString::number(theZsize);
534   myTypeParams->setText(aParams);
535 }
536
537 //********************************************************************
538 void XGUI_InspectionPanel::setRotatedBoxType(double theX, double theY, double theZ,
539   double theZaxisX, double theZaxisY, double theZaxisZ,
540   double theXaxisX, double theXaxisY, double theXaxisZ,
541   double theXsize, double theYsize, double theZsize)
542 {
543   myTypeLbl->setText(tr("Box"));
544   QString aParams = TITLE(tr("Position")) +
545     "<br> X: " + QString::number(theX) +
546     "<br> Y: " + QString::number(theY) +
547     "<br> Z: " + QString::number(theZ) +
548     "<br>" + TITLE(tr("Z axis")) +
549     "<br> DX: " + QString::number(theZaxisX) +
550     "<br> DY: " + QString::number(theZaxisY) +
551     "<br> DZ: " + QString::number(theZaxisZ) +
552     "<br>" + TITLE(tr("X axis")) +
553     "<br> DX: " + QString::number(theXaxisX) +
554     "<br> DY: " + QString::number(theXaxisY) +
555     "<br> DZ: " + QString::number(theXaxisZ) +
556     "<br>" + TITLE(tr("Dimensions")) +
557     "<br>" + "Ax :" + QString::number(theXsize) +
558     "<br>" + "Ay :" + QString::number(theYsize) +
559     "<br>" + "Az :" + QString::number(theZsize);
560   myTypeParams->setText(aParams);
561 }
562
563 //********************************************************************
564 void XGUI_InspectionPanel::setPlaneType(const gp_XYZ& theLoc, const gp_XYZ& theDir)
565 {
566   myTypeLbl->setText(tr("Plane"));
567   QString aParams = TITLE(tr("Center")) +
568     "<br> X: " + QString::number(theLoc.X()) +
569     "<br> Y: " + QString::number(theLoc.Y()) +
570     "<br> Z: " + QString::number(theLoc.Z()) +
571     "<br>" + TITLE(tr("Normal")) +
572     "<br> DX: " + QString::number(theDir.X()) +
573     "<br> DY: " + QString::number(theDir.Y()) +
574     "<br> DZ: " + QString::number(theDir.Z());
575   myTypeParams->setText(aParams);
576 }
577
578 //********************************************************************
579 void XGUI_InspectionPanel::setVertexType(const gp_XYZ& theLoc)
580 {
581   myTypeLbl->setText(tr("Vertex"));
582   QString aParams = TITLE(tr("Coordinates")) +
583     "<br> X: " + QString::number(theLoc.X()) +
584     "<br> Y: " + QString::number(theLoc.Y()) +
585     "<br> Z: " + QString::number(theLoc.Z());
586   myTypeParams->setText(aParams);
587 }
588
589 //********************************************************************
590 void XGUI_InspectionPanel::setCircleType(const gp_XYZ& theLoc, const gp_XYZ& theDir,
591   double theRadius)
592 {
593   myTypeLbl->setText(tr("Circle"));
594   QString aParams = TITLE(tr("Center")) +
595     "<br> X: " + QString::number(theLoc.X()) +
596     "<br> Y: " + QString::number(theLoc.Y()) +
597     "<br> Z: " + QString::number(theLoc.Z()) +
598     "<br>" + TITLE(tr("Normal")) +
599     "<br> DX: " + QString::number(theDir.X()) +
600     "<br> DY: " + QString::number(theDir.Y()) +
601     "<br> DZ: " + QString::number(theDir.Z()) +
602     "<br>" + TITLE(tr("Dimensions")) +
603     "<br>" + tr("Radius: ") + QString::number(theRadius);
604   myTypeParams->setText(aParams);
605 }
606
607 //********************************************************************
608 void XGUI_InspectionPanel::setArcType(const gp_XYZ& theLoc, const gp_XYZ& theDir,
609   double theRadius, const gp_XYZ& theP1, const gp_XYZ& theP2)
610 {
611   myTypeLbl->setText(tr("Arc"));
612   QString aParams = TITLE(tr("Center")) +
613     "<br> X: " + QString::number(theLoc.X()) +
614     "<br> Y: " + QString::number(theLoc.Y()) +
615     "<br> Z: " + QString::number(theLoc.Z()) +
616     "<br>" + TITLE(tr("Normal")) +
617     "<br> DX: " + QString::number(theDir.X()) +
618     "<br> DY: " + QString::number(theDir.Y()) +
619     "<br> DZ: " + QString::number(theDir.Z()) +
620     "<br>" + TITLE(tr("Dimensions")) +
621     "<br>" + tr("Radius:") + QString::number(theRadius) +
622     "<br>" + TITLE(tr("Point 1")) +
623     "<br> X: " + QString::number(theP1.X()) +
624     "<br> Y: " + QString::number(theP1.Y()) +
625     "<br> Z: " + QString::number(theP1.Z()) +
626     "<br>" + TITLE(tr("Point 2")) +
627     "<br> X: " + QString::number(theP2.X()) +
628     "<br> Y: " + QString::number(theP2.Y()) +
629     "<br> Z: " + QString::number(theP2.Z());
630   myTypeParams->setText(aParams);
631 }
632
633 //********************************************************************
634 void XGUI_InspectionPanel::setEllipseType(const gp_XYZ& theLoc, const gp_XYZ& theDir,
635   double theMajorRad, double theMinorRad)
636 {
637   myTypeLbl->setText(tr("Ellipse"));
638   QString aParams = TITLE(tr("Center")) +
639     "<br> X: " + QString::number(theLoc.X()) +
640     "<br> Y: " + QString::number(theLoc.Y()) +
641     "<br> Z: " + QString::number(theLoc.Z()) +
642     "<br>" + TITLE(tr("Normal")) +
643     "<br> DX: " + QString::number(theDir.X()) +
644     "<br> DY: " + QString::number(theDir.Y()) +
645     "<br> DZ: " + QString::number(theDir.Z()) +
646     "<br>" + TITLE(tr("Dimensions")) +
647     "<br>" + tr("Major radius: ") + QString::number(theMajorRad) +
648     "<br>" + tr("Minor radius: ") + QString::number(theMinorRad);
649   myTypeParams->setText(aParams);
650 }
651
652 //********************************************************************
653 void XGUI_InspectionPanel::setEllipseArcType(const gp_XYZ& theLoc, const gp_XYZ& theDir,
654   double theMajorRad, double theMinorRad, const gp_XYZ& theP1, const gp_XYZ& theP2)
655 {
656   myTypeLbl->setText(tr("Elliptical arc"));
657   QString aParams = TITLE(tr("Center")) +
658     "<br> X: " + QString::number(theLoc.X()) +
659     "<br> Y: " + QString::number(theLoc.Y()) +
660     "<br> Z: " + QString::number(theLoc.Z()) +
661     "<br>" + TITLE(tr("Normal")) +
662     "<br> DX: " + QString::number(theDir.X()) +
663     "<br> DY: " + QString::number(theDir.Y()) +
664     "<br> DZ: " + QString::number(theDir.Z()) +
665     "<br>" + TITLE(tr("Dimensions")) +
666     "<br>" + tr("Major radius:") + QString::number(theMajorRad) +
667     "<br>" + tr("Minor radius:") + QString::number(theMinorRad) +
668     "<br>" + TITLE(tr("Point 1")) +
669     "<br> X: " + QString::number(theP1.X()) +
670     "<br> Y: " + QString::number(theP1.Y()) +
671     "<br> Z: " + QString::number(theP1.Z()) +
672     "<br>" + TITLE(tr("Point 2")) +
673     "<br> X: " + QString::number(theP2.X()) +
674     "<br> Y: " + QString::number(theP2.Y()) +
675     "<br> Z: " + QString::number(theP2.Z());
676   myTypeParams->setText(aParams);
677 }
678
679 void XGUI_InspectionPanel::setLineType(const gp_XYZ& theP1, const gp_XYZ& theP2)
680 {
681   myTypeLbl->setText(tr("Line"));
682   QString aParams = TITLE(tr("Point 1")) +
683     "<br> X: " + QString::number(theP1.X()) +
684     "<br> Y: " + QString::number(theP1.Y()) +
685     "<br> Z: " + QString::number(theP1.Z()) +
686     "<br>" + TITLE(tr("Point 2")) +
687     "<br> X: " + QString::number(theP2.X()) +
688     "<br> Y: " + QString::number(theP2.Y()) +
689     "<br> Z: " + QString::number(theP2.Z());
690   myTypeParams->setText(aParams);
691 }
692
693 void XGUI_InspectionPanel::setConeType(const gp_XYZ& theLoc, const gp_XYZ& theDir,
694   double theRad1, double theRad2, double theHeight)
695 {
696   myTypeLbl->setText(tr("Cone"));
697   QString aParams = TITLE(tr("Center")) +
698     "<br> X: " + QString::number(theLoc.X()) +
699     "<br> Y: " + QString::number(theLoc.Y()) +
700     "<br> Z: " + QString::number(theLoc.Z()) +
701     "<br>" + TITLE(tr("Axis")) +
702     "<br> DX: " + QString::number(theDir.X()) +
703     "<br> DY: " + QString::number(theDir.Y()) +
704     "<br> DZ: " + QString::number(theDir.Z()) +
705     "<br>" + TITLE(tr("Dimensions")) +
706     "<br>" + tr("Radius 1: ") + QString::number(theRad1) +
707     "<br>" + tr("Radius 2: ") + QString::number(theRad2) +
708     "<br>" + tr("Height: ") + QString::number(theHeight);
709
710   myTypeParams->setText(aParams);
711 }
712
713 void XGUI_InspectionPanel::setTorusType(const gp_XYZ& theLoc, const gp_XYZ& theDir,
714   double theRad1, double theRad2)
715 {
716   myTypeLbl->setText(tr("Torus"));
717   QString aParams = TITLE(tr("Center")) +
718     "<br> X: " + QString::number(theLoc.X()) +
719     "<br> Y: " + QString::number(theLoc.Y()) +
720     "<br> Z: " + QString::number(theLoc.Z()) +
721     "<br>" + TITLE(tr("Axis")) +
722     "<br> DX: " + QString::number(theDir.X()) +
723     "<br> DY: " + QString::number(theDir.Y()) +
724     "<br> DZ: " + QString::number(theDir.Z()) +
725     "<br>" + TITLE(tr("Dimensions")) +
726     "<br>" + tr("Radius 1: ") + QString::number(theRad1) +
727     "<br>" + tr("Radius 2: ") + QString::number(theRad2);
728
729   myTypeParams->setText(aParams);
730 }