- GroupC1->LineEdit11->setText("");
- GroupC1->LineEdit12->setText("");
- GroupC1->LineEdit13->setText("");
- GroupC1->LineEdit21->setText("");
- GroupC1->LineEdit22->setText("");
- GroupC1->LineEdit23->setText("");
- GroupC1->LineEdit31->setText("");
- GroupC1->LineEdit32->setText("");
- GroupC1->LineEdit33->setText("");
- GroupC1->LineEdit41->setText("");
- GroupC1->LineEdit42->setText("");
- GroupC1->LineEdit43->setText("");
-
- if(S.IsNull())
- return;
-
- QString resString;
- GProp_GProps System;
-
- try {
- if(S.ShapeType() == TopAbs_VERTEX || S.ShapeType() == TopAbs_EDGE || S.ShapeType() == TopAbs_WIRE)
- BRepGProp::LinearProperties(S, System);
- else if(S.ShapeType() == TopAbs_FACE || S.ShapeType() == TopAbs_SHELL)
- BRepGProp::SurfaceProperties(S, System);
- else
- BRepGProp::VolumeProperties(S, System);
-
- gp_Mat I = System.MatrixOfInertia() ;
- GProp_PrincipalProps Pr = System.PrincipalProperties();
- Standard_Real Ix,Iy,Iz;
- Pr.Moments(Ix,Iy,Iz);
-
- /* matrix 3x3 */
- resString = tr("%1").arg(I(1,1), 12, 'f', 6);
- GroupC1->LineEdit11->setText(resString);
- resString = tr("%1").arg(I(1,2), 12, 'f', 6);
- GroupC1->LineEdit12->setText(resString);
- resString = tr("%1").arg(I(1,3), 12, 'f', 6);
- GroupC1->LineEdit13->setText(resString);
-
- resString = tr("%1").arg(I(2,1), 12, 'f', 6);
- GroupC1->LineEdit21->setText(resString);
- resString = tr("%1").arg(I(2,2), 12, 'f', 6);
- GroupC1->LineEdit22->setText(resString);
- resString = tr("%1").arg(I(2,3), 12, 'f', 6);
- GroupC1->LineEdit23->setText(resString);
-
- resString = tr("%1").arg(I(3,1), 12, 'f', 6);
- GroupC1->LineEdit31->setText(resString);
- resString = tr("%1").arg(I(3,2), 12, 'f', 6);
- GroupC1->LineEdit32->setText(resString);
- resString = tr("%1").arg(I(3,3), 12, 'f', 6);
- GroupC1->LineEdit33->setText(resString);
-
- /* moments */
- resString = tr("%1").arg(Ix, 12, 'f', 6);
- GroupC1->LineEdit41->setText(resString);
- resString = tr("%1").arg(Ix, 12, 'f', 6);
- GroupC1->LineEdit42->setText(resString);
- resString = tr("%1").arg(Iz, 12, 'f', 6);
- GroupC1->LineEdit43->setText(resString);
- }
- catch(Standard_Failure) {
- MESSAGE("Catch intercepted in CalculateAndDisplayInertia()");
+ if ( myObj->_is_nil() )
+ return false;
+ else {
+ GEOM::GEOM_IMeasureOperations_var anOper = GEOM::GEOM_IMeasureOperations::_narrow( getOperation() );
+ try {
+ double x, y, z;
+ anOper->GetInertia( myObj,
+ I( 1, 1 ), I( 1, 2 ), I( 1, 3 ),
+ I( 2, 1 ), I( 2, 2 ), I( 2, 3 ),
+ I( 3, 1 ), I( 3, 2 ), I( 3, 3 ),
+ x, y, z );
+
+ theIXYZ.SetCoord( x, y, z );
+ }
+ catch ( const SALOME::SALOME_Exception& e ) {
+ SalomeApp_Tools::QtCatchCorbaException( e );
+ return false;
+ }
+
+ return anOper->IsDone();