Salome HOME
Update Filters data model using the previous filters implementation: filter arguments...
[modules/shaper.git] / src / XGUI / XGUI_InspectionPanel.cpp
1 // Copyright (C) 2014-2019  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 email : webmaster.salome@opencascade.com
18 //
19
20 #include "XGUI_InspectionPanel.h"
21 #include "XGUI_SelectionMgr.h"
22 #include "XGUI_Selection.h"
23 #include "XGUI_Tools.h"
24
25 #include <ModuleBase_ViewerPrs.h>
26 #include <ModuleBase_Tools.h>
27
28 #include <ModelAPI_Result.h>
29
30 #include <GeomAPI_Ax3.h>
31 #include <GeomAPI_Box.h>
32 #include <GeomAPI_Circ.h>
33 #include <GeomAPI_Cone.h>
34 #include <GeomAPI_Cylinder.h>
35 #include <GeomAPI_Edge.h>
36 #include <GeomAPI_Ellipse.h>
37 #include <GeomAPI_Face.h>
38 #include <GeomAPI_Pln.h>
39 #include <GeomAPI_Pnt.h>
40 #include <GeomAPI_Shell.h>
41 #include <GeomAPI_Solid.h>
42 #include <GeomAPI_Sphere.h>
43 #include <GeomAPI_Torus.h>
44 #include <GeomAPI_Vertex.h>
45 #include <GeomAPI_Wire.h>
46
47 #include <QLayout>
48 #include <QScrollArea>
49 #include <QLabel>
50 #include <QLineEdit>
51 #include <QTableWidget>
52 #include <QHeaderView>
53 #include <QTextBrowser>
54 #include <QResizeEvent>
55 #include <QSplitter>
56
57 #include <BRepBndLib.hxx>
58 #include <TopoDS_Iterator.hxx>
59 #include <TopTools_MapOfShape.hxx>
60 #include <TopTools_ListOfShape.hxx>
61 #include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic
62
63 // ================     Auxiliary functions     ================
64 #define TITLE(val) ("<b>" + (val) + "</b>")
65
66 static void appendPointToParameters(const QString& thePointTitle,
67                                     const GeomPointPtr& theCoord,
68                                           QString& theParams)
69 {
70   theParams += TITLE(thePointTitle) +
71     "<br> X: " + QString::number(theCoord->x()) +
72     "<br> Y: " + QString::number(theCoord->y()) +
73     "<br> Z: " + QString::number(theCoord->z()) +
74     "<br>";
75 }
76
77 static void appendDirToParameters(const QString& theDirTitle,
78                                   const GeomDirPtr& theDirection,
79                                         QString& theParams)
80 {
81   theParams += TITLE(theDirTitle) +
82     "<br> DX: " + QString::number(theDirection->x()) +
83     "<br> DY: " + QString::number(theDirection->y()) +
84     "<br> DZ: " + QString::number(theDirection->z()) +
85     "<br>";
86 }
87
88 static void appendGroupNameToParameters(const QString& theGroupTitle, QString& theParams)
89 {
90   theParams += TITLE(theGroupTitle) + "<br>";
91 }
92
93 static void appendNamedValueToParameters(const QString& theName,
94                                          const double   theValue,
95                                                QString& theParams)
96 {
97   theParams += theName + ": " + QString::number(theValue) + "<br>";
98 }
99
100 static void appendNamedValueToParameters(const QString& theName,
101                                          const bool     theValue,
102                                                QString& theParams)
103 {
104   theParams += theName + ": " + (theValue ? "True" : "False") + "<br>";
105 }
106
107
108 // ================     XGUI_InspectionPanel    ================
109
110 XGUI_InspectionPanel::XGUI_InspectionPanel(QWidget* theParent, XGUI_SelectionMgr* theMgr)
111   : QDockWidget(theParent),
112   mySelectionMgr(theMgr)
113 {
114   setWindowTitle(tr("Inspection Panel"));
115   setObjectName(INSPECTION_PANEL);
116   setStyleSheet("::title { position: relative; padding-left: 5px; text-align: left center }");
117
118   QSplitter* aSplitter = new QSplitter(Qt::Vertical, this);
119
120   // Create an internal widget
121   QWidget* aNameWgt = new QWidget(aSplitter);
122   QHBoxLayout* aNameLayout = new QHBoxLayout(aNameWgt);
123   aNameLayout->setContentsMargins(3, 0, 3, 0);
124   aNameLayout->addWidget(new QLabel(tr("Object"), aNameWgt));
125   myNameEdt = new QLineEdit(aNameWgt);
126   myNameEdt->setReadOnly(true);
127   aNameLayout->addWidget(myNameEdt);
128
129   aSplitter->addWidget(aNameWgt);
130
131   // Table with sub-shapes
132   mySubShapesTab = new QTableWidget(9, 2, aSplitter);
133   mySubShapesTab->setFocusPolicy(Qt::NoFocus);
134   mySubShapesTab->verticalHeader()->hide();
135   QStringList aTitles;
136   aTitles << tr("Sub-shapes") << tr("Number");
137   mySubShapesTab->setHorizontalHeaderLabels(aTitles);
138
139   QStringList aSubShapes;
140   aSubShapes << "SHAPE" << "COMPOUND" << "COMPSOLID" <<
141     "SOLID" << "SHELL" << "FACE" << "WIRE" << "EDGE" << "VERTEX";
142   int i = 0;
143   foreach(QString aType, aSubShapes) {
144     QTableWidgetItem* aItem = new QTableWidgetItem(aType);
145     aItem->setFlags(Qt::ItemIsEnabled);
146     mySubShapesTab->setItem(i++, 0, aItem);
147   }
148   for (i = 0; i < 9; i++) {
149     QTableWidgetItem* aItem = new QTableWidgetItem("");
150     aItem->setFlags(Qt::ItemIsEnabled);
151     aItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
152     mySubShapesTab->setItem(i, 1, aItem);
153   }
154   mySubShapesTab->setColumnWidth(0, 90);
155   mySubShapesTab->setColumnWidth(1, 70);
156
157   aSplitter->addWidget(mySubShapesTab);
158
159   // Type of object
160   QWidget* aTypeWgt = new QWidget(aSplitter);
161   QHBoxLayout* aTypeLayout = new QHBoxLayout(aTypeWgt);
162   aTypeLayout->setContentsMargins(3, 0, 3, 0);
163
164   aTypeLayout->addWidget(new QLabel(tr("Type:"), aTypeWgt));
165   myTypeLbl = new QLabel("", aTypeWgt);
166   aTypeLayout->addWidget(myTypeLbl);
167
168   aSplitter->addWidget(aTypeWgt);
169
170   myTypeParams = new QTextBrowser(aSplitter);
171   myTypeParams->setReadOnly(true);
172   myTypeParams->setFocusPolicy(Qt::NoFocus);
173   myTypeParams->viewport()->setBackgroundRole(QPalette::Window);
174
175   aSplitter->addWidget(myTypeParams);
176
177   aSplitter->setCollapsible(0, false);
178   aSplitter->setCollapsible(1, false);
179   aSplitter->setCollapsible(2, false);
180   aSplitter->setCollapsible(3, false);
181
182   QList<int> aSizes;
183   aSizes << 10 << 140 << 10;
184   aSplitter->setSizes(aSizes);
185
186   setWidget(aSplitter);
187
188   connect(mySelectionMgr, SIGNAL(selectionChanged()), SLOT(onSelectionChanged()));
189 }
190
191 //********************************************************************
192 XGUI_InspectionPanel::~XGUI_InspectionPanel()
193 {
194 }
195
196 //********************************************************************
197 void XGUI_InspectionPanel::setSubShapeValue(SudShape theId, int theVal)
198 {
199   mySubShapesTab->item(theId, 1)->setText(QString::number(theVal));
200 }
201
202 //********************************************************************
203 void XGUI_InspectionPanel::clearContent()
204 {
205   setName("");
206   for (int i = 0; i <= VertexId; i++) {
207     mySubShapesTab->item((SudShape)i, 1)->setText("");
208   }
209   myTypeLbl->setText("");
210   setParamsText("");
211 }
212
213 //********************************************************************
214 void XGUI_InspectionPanel::onSelectionChanged()
215 {
216   clearContent();
217   XGUI_Selection* aSelection = mySelectionMgr->selection();
218   QList<ModuleBase_ViewerPrsPtr> aSelectedList =
219     aSelection->getSelected(ModuleBase_ISelection::Viewer);
220
221   QList<ModuleBase_ViewerPrsPtr> anOBSelected =
222     aSelection->getSelected(ModuleBase_ISelection::Browser);
223   if (!anOBSelected.isEmpty())
224     ModuleBase_ISelection::appendSelected(anOBSelected, aSelectedList);
225
226   if (aSelectedList.count() > 0) {
227     ModuleBase_ViewerPrsPtr aPrs = aSelectedList.first();
228     TopoDS_Shape aShape = ModuleBase_Tools::getSelectedShape(aPrs);
229     if (aShape.IsNull()) {
230       ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(aPrs->object());
231       if (aRes.get()) {
232         GeomShapePtr aShpPtr = aRes->shape();
233         if (aShpPtr.get()) {
234           aShape = aShpPtr->impl<TopoDS_Shape>();
235         }
236       }
237     }
238     if (aShape.IsNull())
239       return;
240     GeomShapePtr aShapePtr(new GeomAPI_Shape());
241     aShapePtr->setImpl(new TopoDS_Shape(aShape));
242
243     ModuleBase_ViewerPrsPtr aPrsCopy(new ModuleBase_ViewerPrs(aPrs->object(), aShapePtr));
244     setName(XGUI_Tools::generateName(aPrsCopy));
245     setShapeContent(aShape);
246     setShapeParams(aShape);
247   }
248 }
249
250 //********************************************************************
251 void XGUI_InspectionPanel::setName(const QString& theName)
252 {
253   myNameEdt->setText(theName);
254 }
255
256 //********************************************************************
257 void XGUI_InspectionPanel::setShapeContent(const TopoDS_Shape& theShape)
258 {
259   try {
260     OCC_CATCH_SIGNALS;
261     int iType, nbTypes[TopAbs_SHAPE];
262     for (iType = 0; iType < TopAbs_SHAPE; ++iType) {
263       nbTypes[iType] = 0;
264     }
265     nbTypes[theShape.ShapeType()]++;
266
267     TopTools_MapOfShape aMapOfShape;
268     aMapOfShape.Add(theShape);
269     TopTools_ListOfShape aListOfShape;
270     aListOfShape.Append(theShape);
271
272     TopTools_ListIteratorOfListOfShape itL(aListOfShape);
273     for (; itL.More(); itL.Next()) {
274       TopoDS_Shape sp = itL.Value();
275       TopoDS_Iterator it(sp);
276       for (; it.More(); it.Next()) {
277         TopoDS_Shape s = it.Value();
278         if (aMapOfShape.Add(s)) {
279           aListOfShape.Append(s);
280           nbTypes[s.ShapeType()]++;
281         }
282       }
283     }
284     setSubShapeValue(VertexId, nbTypes[TopAbs_VERTEX]);
285     setSubShapeValue(EdgeId, nbTypes[TopAbs_EDGE]);
286     setSubShapeValue(WireId, nbTypes[TopAbs_WIRE]);
287     setSubShapeValue(FaceId, nbTypes[TopAbs_FACE]);
288     setSubShapeValue(ShellId, nbTypes[TopAbs_SHELL]);
289     setSubShapeValue(SolidId, nbTypes[TopAbs_SOLID]);
290     setSubShapeValue(CompsolidId, nbTypes[TopAbs_COMPSOLID]);
291     setSubShapeValue(CompoundId, nbTypes[TopAbs_COMPOUND]);
292     setSubShapeValue(ShapeId, aMapOfShape.Extent());
293   }
294   catch (Standard_Failure) {
295   }
296 }
297
298 //********************************************************************
299 void XGUI_InspectionPanel::setShapeParams(const TopoDS_Shape& theShape)
300 {
301   GeomShapePtr aShape(new GeomAPI_Shape);
302   aShape->setImpl(new TopoDS_Shape(theShape));
303
304   switch (aShape->shapeType()) {
305   case GeomAPI_Shape::VERTEX:
306     fillVertex(aShape->vertex());
307     break;
308   case GeomAPI_Shape::EDGE:
309     fillEdge(aShape->edge());
310     break;
311   case GeomAPI_Shape::FACE:
312     fillFace(aShape->face());
313     break;
314   case GeomAPI_Shape::SOLID:
315     fillSolid(aShape->solid());
316     break;
317   case GeomAPI_Shape::WIRE:
318     fillWire(aShape->wire());
319     break;
320   case GeomAPI_Shape::SHELL:
321     fillShell(aShape->shell());
322     break;
323   case GeomAPI_Shape::COMPSOLID:
324   case GeomAPI_Shape::COMPOUND:
325     fillContainer(aShape);
326     break;
327   }
328 }
329
330 //********************************************************************
331 void XGUI_InspectionPanel::fillVertex(const GeomVertexPtr& theVertex)
332 {
333   GeomPointPtr aPoint = theVertex->point();
334
335   myTypeLbl->setText(tr("Vertex"));
336
337   QString aParams;
338   appendPointToParameters(tr("Coordinates"), aPoint, aParams);
339   setParamsText(aParams);
340 }
341
342 //********************************************************************
343 void XGUI_InspectionPanel::fillEdge(const GeomEdgePtr& theEdge)
344 {
345   QString aParams;
346   if (theEdge->isDegenerated())
347     appendNamedValueToParameters(tr("Degenerated"), true, aParams);
348
349   GeomPointPtr aStartPnt = theEdge->firstPoint();
350   GeomPointPtr aEndPnt = theEdge->lastPoint();
351   bool addStartEndPoints = false;
352
353   if (theEdge->isLine()) {
354     myTypeLbl->setText(tr("Line segment"));
355     addStartEndPoints = true;
356   }
357   else {
358     GeomCirclePtr aCircle = theEdge->circle();
359     if (aCircle) {
360       addStartEndPoints = aStartPnt->distance(aEndPnt) >= Precision::Confusion();
361       if (addStartEndPoints)
362         myTypeLbl->setText("Arc of circle");
363       else
364         myTypeLbl->setText("Circle");
365
366       appendPointToParameters(tr("Center"), aCircle->center(), aParams);
367       appendDirToParameters(tr("Normal"), aCircle->normal(), aParams);
368       appendGroupNameToParameters(tr("Dimensions"), aParams);
369       appendNamedValueToParameters(tr("Radius"), aCircle->radius(), aParams);
370     }
371     else {
372       GeomEllipsePtr anEllipse = theEdge->ellipse();
373       if (anEllipse) {
374         addStartEndPoints = aStartPnt->distance(aEndPnt) >= Precision::Confusion();
375         if (addStartEndPoints)
376           myTypeLbl->setText("Arc of ellipse");
377         else
378           myTypeLbl->setText("Ellipse");
379
380         appendPointToParameters(tr("Center"), anEllipse->center(), aParams);
381         appendDirToParameters(tr("Normal"), anEllipse->normal(), aParams);
382         appendGroupNameToParameters(tr("Dimensions"), aParams);
383         appendNamedValueToParameters(tr("Major radius"), anEllipse->majorRadius(), aParams);
384         appendNamedValueToParameters(tr("Minor radius"), anEllipse->minorRadius(), aParams);
385       }
386       else
387         // Common case
388         myTypeLbl->setText(tr("Edge"));
389     }
390   }
391
392   if (addStartEndPoints) {
393     appendPointToParameters(tr("Start point"), aStartPnt, aParams);
394     appendPointToParameters(tr("End point"), aEndPnt, aParams);
395   }
396   setParamsText(aParams);
397 }
398
399 //********************************************************************
400 void XGUI_InspectionPanel::fillWire(const GeomWirePtr& theWire)
401 {
402   QString aParams;
403   appendNamedValueToParameters(tr("Closed"), theWire->isClosed(), aParams);
404
405   // check the wire is a polygon
406   std::list<GeomPointPtr> aPolygonPoints;
407   if (theWire->isPolygon(aPolygonPoints)) {
408     myTypeLbl->setText(tr("Polygon"));
409     int aCornerIndex = 0;
410     for (std::list<GeomPointPtr>::const_iterator aPtIt = aPolygonPoints.begin();
411          aPtIt != aPolygonPoints.end(); ++aPtIt)
412        appendPointToParameters(tr("Point") + " " + QString::number(++aCornerIndex),
413                                *aPtIt, aParams);
414   }
415   else
416     myTypeLbl->setText(tr("Wire"));
417
418   setParamsText(aParams);
419 }
420
421 //********************************************************************
422 void XGUI_InspectionPanel::fillFace(const GeomFacePtr& theFace)
423 {
424   QString aParams;
425   // 1. Plane and planar faces
426   GeomPlanePtr aPlane = theFace->getPlane();
427   if (aPlane) {
428     bool isCommonCase = true;
429     // Check face bounded by circle or ellipse
430     std::list<GeomShapePtr> aSubs = theFace->subShapes(GeomAPI_Shape::EDGE);
431     if (aSubs.size() == 1) {
432       GeomEdgePtr anEdge = aSubs.front()->edge();
433       if (anEdge->isCircle() || anEdge->isEllipse()) {
434         fillEdge(anEdge);
435         isCommonCase = false;
436       }
437     }
438     else {
439       // Check face bounded by a single wire which is rectangle
440       aSubs = theFace->subShapes(GeomAPI_Shape::WIRE);
441       if (aSubs.size() == 1) {
442         GeomWirePtr aWire = aSubs.front()->wire();
443         std::list<GeomPointPtr> aCorners;
444         if (aWire->isRectangle(aCorners)) {
445           GeomPointPtr aBaseCorner = aCorners.front();
446           aCorners.pop_front();
447
448           double aWidth = aBaseCorner->distance(aCorners.front());
449           double aHeight = aBaseCorner->distance(aCorners.back());
450
451           myTypeLbl->setText(tr("Rectangle"));
452           appendPointToParameters(tr("Corner"), aBaseCorner, aParams);
453           appendDirToParameters(tr("Normal"), aPlane->direction(), aParams);
454           appendGroupNameToParameters(tr("Dimensions"), aParams);
455           appendNamedValueToParameters(tr("Width"), aWidth, aParams);
456           appendNamedValueToParameters(tr("Height"), aHeight, aParams);
457           setParamsText(aParams);
458
459           isCommonCase = false;
460         }
461       }
462     }
463
464     if (isCommonCase)
465       setPlaneType(tr("Plane"), aPlane);
466   }
467   else {
468     // 2. Sphere
469     GeomSpherePtr aSphere = theFace->getSphere();
470     if (aSphere)
471       setSphereType(tr("Sphere"), aSphere);
472     else {
473       // 3. Cylinder
474       GeomCylinderPtr aCylinder = theFace->getCylinder();
475       if (aCylinder)
476         setCylinderType(tr("Cylinder"), aCylinder);
477       else {
478         // 4. Cone
479         GeomConePtr aCone = theFace->getCone();
480         if (aCone)
481           setConeType(tr("Cone"), aCone);
482         else {
483           // 5. Torus
484           GeomTorusPtr aTorus = theFace->getTorus();
485           if (aTorus)
486             setTorusType(tr("Torus"), aTorus);
487           else
488             // 6. Common case
489             myTypeLbl->setText(tr("Face"));
490         }
491       }
492     }
493   }
494 }
495
496 //********************************************************************
497 void XGUI_InspectionPanel::fillShell(const GeomShellPtr& theShell)
498 {
499   // 1. Sphere
500   GeomSpherePtr aSphere = theShell->getSphere();
501   if (aSphere)
502     setSphereType(tr("Sphere"), aSphere);
503   else {
504     // 2. Cylinder
505     GeomCylinderPtr aCylinder = theShell->getCylinder();
506     if (aCylinder)
507       setCylinderType(tr("Cylinder"), aCylinder);
508     else {
509       // 3. Cone
510       GeomConePtr aCone = theShell->getCone();
511       if (aCone)
512         setConeType(tr("Cone"), aCone);
513       else {
514         // 4. Torus
515         GeomTorusPtr aTorus = theShell->getTorus();
516         if (aTorus)
517           setTorusType(tr("Torus"), aTorus);
518         else {
519           // 5. Axis-aligned/Rotated Box
520           GeomBoxPtr aBox = theShell->getParallelepiped();
521           if (aBox) {
522             if (aBox->isAxesAligned())
523               setBoxType(tr("Box"), aBox);
524             else
525               setRotatedBoxType(tr("Rotated Box"), aBox);
526           }
527           else
528             // 6. Common case
529             myTypeLbl->setText(tr("Shell"));
530         }
531       }
532     }
533   }
534 }
535
536 //********************************************************************
537 void XGUI_InspectionPanel::fillSolid(const GeomSolidPtr& theSolid)
538 {
539   // 1. Sphere
540   GeomSpherePtr aSphere = theSolid->getSphere();
541   if (aSphere)
542     setSphereType(tr("Sphere"), aSphere);
543   else {
544     // 2. Cylinder
545     GeomCylinderPtr aCylinder = theSolid->getCylinder();
546     if (aCylinder)
547       setCylinderType(tr("Cylinder"), aCylinder);
548     else {
549       // 3. Cone
550       GeomConePtr aCone = theSolid->getCone();
551       if (aCone)
552         setConeType(tr("Cone"), aCone);
553       else {
554         // 4. Torus
555         GeomTorusPtr aTorus = theSolid->getTorus();
556         if (aTorus)
557           setTorusType(tr("Torus"), aTorus);
558         else {
559           // 5. Axis-aligned/Rotated Box
560           GeomBoxPtr aBox = theSolid->getParallelepiped();
561           if (aBox) {
562             if (aBox->isAxesAligned())
563               setBoxType(tr("Box"), aBox);
564             else
565               setRotatedBoxType(tr("Rotated Box"), aBox);
566           }
567           else
568             // 6. Common case
569             myTypeLbl->setText(tr("Solid"));
570         }
571       }
572     }
573   }
574 }
575
576 //********************************************************************
577 void XGUI_InspectionPanel::fillContainer(const GeomShapePtr& theShape)
578 {
579   if (theShape->shapeType() == GeomAPI_Shape::COMPSOLID)
580     myTypeLbl->setText("CompSolid");
581   else if (theShape->shapeType() == GeomAPI_Shape::COMPOUND)
582     myTypeLbl->setText("Compound");
583
584   // fill bounding box
585   TopoDS_Shape aShape = theShape->impl<TopoDS_Shape>();
586   Bnd_Box aBB;
587   BRepBndLib::Add(aShape, aBB);
588
589   if (aBB.IsVoid())
590     return;
591
592   gp_Pnt aMinPnt = aBB.CornerMin();
593   GeomPointPtr aMinPoint(new GeomAPI_Pnt(aMinPnt.X(), aMinPnt.Y(), aMinPnt.Z()));
594
595   gp_Pnt aMaxPnt = aBB.CornerMax();
596   GeomPointPtr aMaxPoint(new GeomAPI_Pnt(aMaxPnt.X(), aMaxPnt.Y(), aMaxPnt.Z()));
597
598   QString aParams;
599   appendGroupNameToParameters(tr("Bounding box"), aParams);
600   appendPointToParameters(tr("Minimal corner"), aMinPoint, aParams);
601   appendPointToParameters(tr("Maximal corner"), aMaxPoint, aParams);
602 }
603
604 void XGUI_InspectionPanel::setPlaneType(const QString& theTitle,
605                                         const std::shared_ptr<GeomAPI_Pln>& thePlane)
606 {
607   myTypeLbl->setText(theTitle);
608   QString aParams;
609   appendPointToParameters(tr("Origin"), thePlane->location(), aParams);
610   appendDirToParameters(tr("Normal"), thePlane->direction(), aParams);
611   setParamsText(aParams);
612 }
613
614 void XGUI_InspectionPanel::setSphereType(const QString& theTitle,
615                                          const std::shared_ptr<GeomAPI_Sphere>& theSphere)
616 {
617   myTypeLbl->setText(theTitle);
618   QString aParams;
619   appendPointToParameters(tr("Center"), theSphere->center(), aParams);
620   appendGroupNameToParameters(tr("Dimensions"), aParams);
621   appendNamedValueToParameters(tr("Radius"), theSphere->radius(), aParams);
622   setParamsText(aParams);
623 }
624
625 void XGUI_InspectionPanel::setCylinderType(const QString& theTitle,
626                                            const std::shared_ptr<GeomAPI_Cylinder>& theCyl)
627 {
628   myTypeLbl->setText(theTitle);
629   QString aParams;
630   appendPointToParameters(tr("Position"), theCyl->location(), aParams);
631   appendDirToParameters(tr("Axis"), theCyl->axis(), aParams);
632   appendGroupNameToParameters(tr("Dimensions"), aParams);
633   appendNamedValueToParameters(tr("Radius"), theCyl->radius(), aParams);
634   appendNamedValueToParameters(tr("Height"), theCyl->height(), aParams);
635   setParamsText(aParams);
636 }
637
638 void XGUI_InspectionPanel::setConeType(const QString& theTitle,
639                                        const std::shared_ptr<GeomAPI_Cone>& theCone)
640 {
641   myTypeLbl->setText(theTitle);
642   QString aParams;
643   appendPointToParameters(tr("Position"), theCone->location(), aParams);
644   appendDirToParameters(tr("Axis"), theCone->axis(), aParams);
645   appendGroupNameToParameters(tr("Dimensions"), aParams);
646   appendNamedValueToParameters(tr("Radius 1"), theCone->radius1(), aParams);
647   appendNamedValueToParameters(tr("Radius 2"), theCone->radius2(), aParams);
648   appendNamedValueToParameters(tr("Height"), theCone->height(), aParams);
649   setParamsText(aParams);
650 }
651
652 void XGUI_InspectionPanel::setTorusType(const QString& theTitle,
653                                         const std::shared_ptr<GeomAPI_Torus>& theTorus)
654 {
655   myTypeLbl->setText(theTitle);
656   QString aParams;
657   appendPointToParameters(tr("Center"), theTorus->center(), aParams);
658   appendDirToParameters(tr("Axis"), theTorus->direction(), aParams);
659   appendGroupNameToParameters(tr("Dimensions"), aParams);
660   appendNamedValueToParameters(tr("Major radius"), theTorus->majorRadius(), aParams);
661   appendNamedValueToParameters(tr("Minor radius"), theTorus->minorRadius(), aParams);
662   setParamsText(aParams);
663 }
664
665 void XGUI_InspectionPanel::setBoxType(const QString& theTitle,
666                                       const std::shared_ptr<GeomAPI_Box>& theBox)
667 {
668   myTypeLbl->setText(theTitle);
669   QString aParams;
670   appendPointToParameters(tr("Position"), theBox->axes()->origin(), aParams);
671   appendGroupNameToParameters(tr("Dimensions"), aParams);
672   appendNamedValueToParameters(tr("Width"), theBox->width(), aParams);
673   appendNamedValueToParameters(tr("Depth"), theBox->depth(), aParams);
674   appendNamedValueToParameters(tr("Height"), theBox->height(), aParams);
675   setParamsText(aParams);
676 }
677
678 void XGUI_InspectionPanel::setRotatedBoxType(const QString& theTitle,
679                                              const std::shared_ptr<GeomAPI_Box>& theBox)
680 {
681   myTypeLbl->setText(theTitle);
682   QString aParams;
683   std::shared_ptr<GeomAPI_Ax3> anAxes = theBox->axes();
684   appendPointToParameters(tr("Position"), anAxes->origin(), aParams);
685   appendDirToParameters(tr("Z axis"), anAxes->normal(), aParams);
686   appendDirToParameters(tr("X axis"), anAxes->dirX(), aParams);
687   appendGroupNameToParameters(tr("Dimensions"), aParams);
688   appendNamedValueToParameters(tr("Width"), theBox->width(), aParams);
689   appendNamedValueToParameters(tr("Depth"), theBox->depth(), aParams);
690   appendNamedValueToParameters(tr("Height"), theBox->height(), aParams);
691   setParamsText(aParams);
692 }
693
694
695 void XGUI_InspectionPanel::setParamsText(const QString& theText)
696 {
697   myTypeParams->setText(theText);
698 }