1 // Copyright (C) 2014-2017 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 #include "XGUI_InspectionPanel.h"
22 #include "XGUI_SelectionMgr.h"
23 #include "XGUI_Selection.h"
24 #include "XGUI_Tools.h"
26 #include <ModuleBase_ViewerPrs.h>
27 #include <ModuleBase_Tools.h>
29 #include <ModelAPI_Result.h>
32 #include <QScrollArea>
35 #include <QTableWidget>
36 #include <QHeaderView>
37 #include <QTextBrowser>
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>
57 #include <TopExp_Explorer.hxx>
58 #include <TopoDS_Iterator.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
66 XGUI_InspectionPanel::XGUI_InspectionPanel(QWidget* theParent, XGUI_SelectionMgr* theMgr)
67 : QDockWidget(theParent),
68 mySelectionMgr(theMgr)
70 setWindowTitle(tr("Inspection Panel"));
71 setObjectName(INSPECTION_PANEL);
72 setStyleSheet("::title { position: relative; padding-left: 5px; text-align: left center }");
74 QScrollArea* aScrollArea = new QScrollArea(this);
75 setWidget(aScrollArea);
77 // Create an internal widget
78 QWidget* aMainWidget = new QWidget(aScrollArea);
80 QVBoxLayout* aMainLayout = new QVBoxLayout(aMainWidget);
81 aMainLayout->setContentsMargins(5, 5, 5, 5);
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);
91 aMainLayout->addWidget(aNameWgt);
93 // Table with sub-shapes
94 mySubShapesTab = new QTableWidget(9, 2, aMainWidget);
95 mySubShapesTab->setFocusPolicy(Qt::NoFocus);
96 mySubShapesTab->verticalHeader()->hide();
98 aTitles << tr("Sub-shapes") << tr("Number");
99 mySubShapesTab->setHorizontalHeaderLabels(aTitles);
101 QStringList aSubShapes;
102 aSubShapes << "SHAPE" << "COMPOUND" << "COMPSOLID" <<
103 "SOLID" << "SHELL" << "FACE" << "WIRE" << "EDGE" << "VERTEX";
105 foreach(QString aType, aSubShapes) {
106 QTableWidgetItem* aItem = new QTableWidgetItem(aType);
107 aItem->setFlags(Qt::ItemIsEnabled);
108 mySubShapesTab->setItem(i++, 0, aItem);
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);
116 mySubShapesTab->setColumnWidth(0, 90);
117 mySubShapesTab->setColumnWidth(1, 70);
119 mySubShapesTab->setMaximumWidth(170);
120 mySubShapesTab->setMinimumHeight(300);
122 aMainLayout->addWidget(mySubShapesTab);
125 QWidget* aTypeWgt = new QWidget(aMainWidget);
126 QHBoxLayout* aTypeLayout = new QHBoxLayout(aTypeWgt);
127 aTypeLayout->setContentsMargins(0, 0, 0, 0);
129 aTypeLayout->addWidget(new QLabel(tr("Type:"), aTypeWgt));
130 myTypeLbl = new QLabel("", aTypeWgt);
131 aTypeLayout->addWidget(myTypeLbl);
133 aMainLayout->addWidget(aTypeWgt);
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);
143 aMainLayout->addWidget(myTypeParams);
145 aScrollArea->setWidget(aMainWidget);
147 connect(mySelectionMgr, SIGNAL(selectionChanged()), SLOT(onSelectionChanged()));
150 //********************************************************************
151 XGUI_InspectionPanel::~XGUI_InspectionPanel()
155 //********************************************************************
156 void XGUI_InspectionPanel::setSubShapeValue(SudShape theId, int theVal)
158 mySubShapesTab->item(theId, 1)->setText(QString::number(theVal));
161 //********************************************************************
162 void XGUI_InspectionPanel::clearContent()
165 for (int i = 0; i <= VertexId; i++) {
166 mySubShapesTab->item((SudShape)i, 1)->setText("");
168 myTypeLbl->setText("");
169 myTypeParams->setText("");
172 //********************************************************************
173 void XGUI_InspectionPanel::onSelectionChanged()
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);
184 setName(XGUI_Tools::generateName(aPrs));
185 setShapeContent(aShape);
186 setShapeParams(aShape);
190 //********************************************************************
191 void XGUI_InspectionPanel::setName(const QString& theName)
193 myNameEdt->setText(theName);
196 //********************************************************************
197 void XGUI_InspectionPanel::setShapeContent(const TopoDS_Shape& theShape)
201 int iType, nbTypes[TopAbs_SHAPE];
202 for (iType = 0; iType < TopAbs_SHAPE; ++iType) {
205 nbTypes[theShape.ShapeType()]++;
207 TopTools_MapOfShape aMapOfShape;
208 aMapOfShape.Add(theShape);
209 TopTools_ListOfShape aListOfShape;
210 aListOfShape.Append(theShape);
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()]++;
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());
234 catch (Standard_Failure) {
235 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
236 //SetErrorCode(aFail->GetMessageString());
240 //********************************************************************
241 void XGUI_InspectionPanel::setShapeParams(const TopoDS_Shape& theShape)
243 switch (theShape.ShapeType()) {
245 fillVertex(theShape);
258 case TopAbs_COMPSOLID:
259 case TopAbs_COMPOUND:
260 fillContainer(theShape);
265 //********************************************************************
266 void XGUI_InspectionPanel::fillVertex(const TopoDS_Shape& theShape)
268 TopoDS_Vertex aV = TopoDS::Vertex(theShape);
269 gp_Pnt aP = BRep_Tool::Pnt(aV);
270 setVertexType(aP.XYZ());
273 //********************************************************************
274 void XGUI_InspectionPanel::fillEdge(const TopoDS_Shape& theShape)
276 TopoDS_Edge aE = TopoDS::Edge(theShape);
278 bool bDegenerated = BRep_Tool::Degenerated(aE);
281 Handle(Geom_Curve) aC3D = BRep_Tool::Curve(aE, aT1, aT2);
282 GeomAdaptor_Curve aGAC(aC3D);
283 GeomAbs_CurveType aCT = aGAC.GetType();
285 if (aCT == GeomAbs_Line) { // Line
289 setLineType(aP1.XYZ(), aP2.XYZ());
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();
298 bool isArc = (Abs(aT2 - aT1 - aC3D->Period()) >= Precision::PConfusion());
303 setArcType(aP.XYZ(), aDir.XYZ(), aR1, aP1.XYZ(), aP2.XYZ());
305 setCircleType(aP.XYZ(), aDir.XYZ(), aR1);
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();
317 bool isArc = aP1.Distance(aP2) > Precision::Confusion();
319 setEllipseArcType(aP.XYZ(), aDir.XYZ(), aR1, aR2, aP1.XYZ(), aP2.XYZ());
321 setEllipseType(aP.XYZ(), aDir.XYZ(), aR1, aR2);
325 //********************************************************************
326 void XGUI_InspectionPanel::fillFace(const TopoDS_Shape& theShape)
328 TopoDS_Face aF = TopoDS::Face(theShape);
330 Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aF);
331 GeomAdaptor_Surface aGAS(aSurf);
332 GeomAbs_SurfaceType aST = aGAS.GetType();
335 if (aST == GeomAbs_Plane) {
336 gp_Pln aPln = aGAS.Plane();
337 gp_Pnt aP0 = aPln.Location();
338 gp_Ax3 aAx3 = aPln.Position();
340 setPlaneType(aP0.XYZ(), aAx3.Direction().XYZ());
343 else if (aST == GeomAbs_Sphere) {
344 gp_Sphere aSphere = aGAS.Sphere();
345 gp_Pnt aP0 = aSphere.Location();
346 double aR1 = aSphere.Radius();
348 setSphereType(aP0.XYZ(), aR1);
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();
357 double aUMin, aUMax, aVMin, aVMax;
358 BRepTools::UVBounds(aF, aUMin, aUMax, aVMin, aVMax);
359 double dV = aVMax - aVMin;
361 setCylinderType(aP0.XYZ(), aAx3.Direction().XYZ(), aR1, dV);
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();
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);
376 setConeType(aP0.XYZ(), aAx3.Direction().XYZ(), aR1, aR2, dV);
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();
386 setTorusType(aP0.XYZ(), aAx3.Direction().XYZ(), aR1, aR2);
390 //********************************************************************
391 void XGUI_InspectionPanel::fillSolid(const TopoDS_Shape& theShape)
393 myTypeLbl->setText(tr("Solid"));
394 TopoDS_Solid aSd = TopoDS::Solid(theShape);
400 //********************************************************************
401 bool IsEqual(const gp_Sphere& aSp1, const gp_Sphere& aSp2, const Standard_Real aTolLin)
403 double aR1 = aSp1.Radius();
404 double aR2 = aSp2.Radius();
405 if (fabs(aR1 - aR2) > aTolLin) {
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));
415 bool XGUI_InspectionPanel::processSphere(const TopoDS_Solid& theSolid)
417 gp_Sphere aSphere[2];
418 GeomAbs_SurfaceType aST;
419 Handle(Geom_Surface) aS;
420 GeomAdaptor_Surface aGAS;
422 double aTol = Precision::Confusion();
423 double aTolAng = Precision::Angular();
425 TopExp_Explorer aExp(theSolid, TopAbs_FACE);
427 for (j = 0; aExp.More(); aExp.Next(), ++j) {
428 const TopoDS_Face& aF = *((TopoDS_Face*)&aExp.Current());
429 aS = BRep_Tool::Surface(aF);
431 aST = aGAS.GetType();
432 if (aST != GeomAbs_Sphere) {
435 aSphere[j] = aGAS.Sphere();
437 bool bIsEqual = IsEqual(aSphere[0], aSphere[1], aTol);
441 GProp_GProps aGProps;
442 bool bOnlyClosed = false;
443 double aVolume = aSphere[0].Volume();
444 BRepGProp::VolumeProperties(theSolid, aGProps, aTol, bOnlyClosed);
446 double aVolumeS = aGProps.Mass();
448 aVolumeS = -aVolumeS;
450 double dV = fabs(aVolumeS - aVolume);
454 double aArea = aSphere[0].Area();
455 BRepGProp::SurfaceProperties(theSolid, aGProps, aTol);
456 double aAreaS = aGProps.Mass();
457 double dA = fabs(aAreaS - aArea);
461 gp_Pnt aP0 = aSphere[0].Location();
462 double aR1 = aSphere[0].Radius();
464 setSphereType(aP0.XYZ(), aR1);
470 //********************************************************************
471 void XGUI_InspectionPanel::fillContainer(const TopoDS_Shape& theShape)
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"));
486 //********************************************************************
487 #define TITLE(val) ("<b>" + val + "</b>")
489 void XGUI_InspectionPanel::setCylinderType(const gp_XYZ& theLoc,
490 const gp_XYZ& theDir, double theRadius, double theHeight)
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);
505 myTypeParams->setText(aParams);
508 //********************************************************************
509 void XGUI_InspectionPanel::setSphereType(const gp_XYZ& theLoc, double theRadius)
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);
521 //********************************************************************
522 void XGUI_InspectionPanel::setBoxType(double theX, double theY, double theZ,
523 double theXsize, double theYsize, double theZsize)
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);
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)
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);
563 //********************************************************************
564 void XGUI_InspectionPanel::setPlaneType(const gp_XYZ& theLoc, const gp_XYZ& theDir)
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);
578 //********************************************************************
579 void XGUI_InspectionPanel::setVertexType(const gp_XYZ& theLoc)
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);
589 //********************************************************************
590 void XGUI_InspectionPanel::setCircleType(const gp_XYZ& theLoc, const gp_XYZ& theDir,
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);
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)
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);
633 //********************************************************************
634 void XGUI_InspectionPanel::setEllipseType(const gp_XYZ& theLoc, const gp_XYZ& theDir,
635 double theMajorRad, double theMinorRad)
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);
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)
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);
679 void XGUI_InspectionPanel::setLineType(const gp_XYZ& theP1, const gp_XYZ& theP2)
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);
693 void XGUI_InspectionPanel::setConeType(const gp_XYZ& theLoc, const gp_XYZ& theDir,
694 double theRad1, double theRad2, double theHeight)
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);
710 myTypeParams->setText(aParams);
713 void XGUI_InspectionPanel::setTorusType(const gp_XYZ& theLoc, const gp_XYZ& theDir,
714 double theRad1, double theRad2)
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);
729 myTypeParams->setText(aParams);