mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-02-22 02:25:37 +05:00
Fix memory leaks
This commit is contained in:
parent
ba2aa33a1e
commit
ee26d6488a
@ -215,17 +215,18 @@ bool MeasureGUI_AngleDlg::getParameters (double& theAngle)
|
|||||||
{
|
{
|
||||||
QString msg;
|
QString msg;
|
||||||
if (isValid(msg)) {
|
if (isValid(msg)) {
|
||||||
|
GEOM::GEOM_IMeasureOperations_var anOper = GEOM::GEOM_IMeasureOperations::_narrow( getOperation() );
|
||||||
try {
|
try {
|
||||||
theAngle = GEOM::GEOM_IMeasureOperations::_narrow(getOperation())->GetAngle(myObj, myObj2);
|
theAngle = anOper->GetAngle(myObj, myObj2);
|
||||||
}
|
}
|
||||||
catch(const SALOME::SALOME_Exception& e) {
|
catch(const SALOME::SALOME_Exception& e) {
|
||||||
SalomeApp_Tools::QtCatchCorbaException(e);
|
SalomeApp_Tools::QtCatchCorbaException(e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isDone = getOperation()->IsDone();
|
bool isDone = anOper->IsDone();
|
||||||
if (!isDone) {
|
if (!isDone) {
|
||||||
CORBA::String_var aMsg = getOperation()->GetErrorCode();
|
CORBA::String_var aMsg = anOper->GetErrorCode();
|
||||||
SUIT_MessageBox::warning(this,
|
SUIT_MessageBox::warning(this,
|
||||||
QObject::tr("WRN_WARNING"),
|
QObject::tr("WRN_WARNING"),
|
||||||
QObject::tr(aMsg.in()));
|
QObject::tr(aMsg.in()));
|
||||||
|
@ -162,6 +162,7 @@ bool MeasureGUI_BndBoxDlg::getParameters( double& theXmin, double& theXmax,
|
|||||||
if ( myObj->_is_nil() )
|
if ( myObj->_is_nil() )
|
||||||
return false;
|
return false;
|
||||||
else {
|
else {
|
||||||
|
GEOM::GEOM_IMeasureOperations_var anOper = GEOM::GEOM_IMeasureOperations::_narrow( getOperation() );
|
||||||
try {
|
try {
|
||||||
Handle(Poly_Triangulation) Trtn = 0;
|
Handle(Poly_Triangulation) Trtn = 0;
|
||||||
|
|
||||||
@ -198,8 +199,7 @@ bool MeasureGUI_BndBoxDlg::getParameters( double& theXmin, double& theXmax,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GEOM::GEOM_IMeasureOperations::_narrow( getOperation() )->GetBoundingBox(
|
anOper->GetBoundingBox( myObj, theXmin, theXmax, theYmin, theYmax, theZmin, theZmax );
|
||||||
myObj, theXmin, theXmax, theYmin, theYmax, theZmin, theZmax );
|
|
||||||
|
|
||||||
if (!Trtn.IsNull())
|
if (!Trtn.IsNull())
|
||||||
{
|
{
|
||||||
@ -227,7 +227,7 @@ bool MeasureGUI_BndBoxDlg::getParameters( double& theXmin, double& theXmax,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return getOperation()->IsDone();
|
return anOper->IsDone();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -290,9 +290,9 @@ bool MeasureGUI_CenterMassDlg::getParameters( double& theX, double& theY, double
|
|||||||
return false;
|
return false;
|
||||||
else {
|
else {
|
||||||
try {
|
try {
|
||||||
GEOM::GEOM_Object_var anObj;
|
GEOM::GEOM_IMeasureOperations_var anOper = GEOM::GEOM_IMeasureOperations::_narrow( getOperation() );
|
||||||
anObj = GEOM::GEOM_IMeasureOperations::_narrow( getOperation() )->GetCentreOfMass( myObj );
|
GEOM::GEOM_Object_var anObj = anOper->GetCentreOfMass( myObj );
|
||||||
if ( !getOperation()->IsDone() )
|
if ( !anOper->IsDone() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
TopoDS_Shape aShape;
|
TopoDS_Shape aShape;
|
||||||
@ -324,9 +324,8 @@ bool MeasureGUI_CenterMassDlg::getParameters( double& theX, double& theY, double
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
bool MeasureGUI_CenterMassDlg::execute( ObjectList& objects )
|
bool MeasureGUI_CenterMassDlg::execute( ObjectList& objects )
|
||||||
{
|
{
|
||||||
GEOM::GEOM_Object_var anObj;
|
GEOM::GEOM_IMeasureOperations_var anOper = GEOM::GEOM_IMeasureOperations::_narrow( getOperation() );
|
||||||
|
GEOM::GEOM_Object_var anObj = anOper->GetCentreOfMass( myObj );
|
||||||
anObj = GEOM::GEOM_IMeasureOperations::_narrow( getOperation() )->GetCentreOfMass( myObj );
|
|
||||||
|
|
||||||
if ( !anObj->_is_nil() )
|
if ( !anObj->_is_nil() )
|
||||||
objects.push_back( anObj._retn() );
|
objects.push_back( anObj._retn() );
|
||||||
|
@ -241,10 +241,10 @@ bool MeasureGUI_CheckCompoundOfBlocksDlg::getBCErrors( bool& theIsCompoundOfBloc
|
|||||||
if ( myObj->_is_nil() )
|
if ( myObj->_is_nil() )
|
||||||
return false;
|
return false;
|
||||||
else {
|
else {
|
||||||
|
GEOM::GEOM_IBlocksOperations_var anOper = GEOM::GEOM_IBlocksOperations::_narrow( getOperation() );
|
||||||
try {
|
try {
|
||||||
GEOM::GEOM_IBlocksOperations::BCErrors_var aErrs;
|
GEOM::GEOM_IBlocksOperations::BCErrors_var aErrs;
|
||||||
theIsCompoundOfBlocks =
|
theIsCompoundOfBlocks = anOper->CheckCompoundOfBlocks( myObj, aErrs );
|
||||||
GEOM::GEOM_IBlocksOperations::_narrow( getOperation() )->CheckCompoundOfBlocks( myObj, aErrs );
|
|
||||||
theErrors = aErrs;
|
theErrors = aErrs;
|
||||||
}
|
}
|
||||||
catch ( const SALOME::SALOME_Exception& e ) {
|
catch ( const SALOME::SALOME_Exception& e ) {
|
||||||
@ -252,7 +252,7 @@ bool MeasureGUI_CheckCompoundOfBlocksDlg::getBCErrors( bool& theIsCompoundOfBloc
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return getOperation()->IsDone();
|
return anOper->IsDone();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -472,9 +472,8 @@ bool MeasureGUI_CheckCompoundOfBlocksDlg::isValid( QString& )
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
bool MeasureGUI_CheckCompoundOfBlocksDlg::execute( ObjectList& objects )
|
bool MeasureGUI_CheckCompoundOfBlocksDlg::execute( ObjectList& objects )
|
||||||
{
|
{
|
||||||
GEOM::GEOM_Object_var anObj;
|
GEOM::GEOM_IBlocksOperations_var anOper = GEOM::GEOM_IBlocksOperations::_narrow( getOperation() );
|
||||||
|
GEOM::GEOM_Object_var anObj = anOper->CheckAndImprove( myObj );
|
||||||
anObj = GEOM::GEOM_IBlocksOperations::_narrow( getOperation() )->CheckAndImprove( myObj );
|
|
||||||
|
|
||||||
if ( !anObj->_is_nil() )
|
if ( !anObj->_is_nil() )
|
||||||
objects.push_back( anObj._retn() );
|
objects.push_back( anObj._retn() );
|
||||||
|
@ -110,15 +110,14 @@ bool MeasureGUI_CheckShapeDlg::getParameters ( bool& theIsValid, QString& theMsg
|
|||||||
if ( myObj->_is_nil() )
|
if ( myObj->_is_nil() )
|
||||||
return false;
|
return false;
|
||||||
else {
|
else {
|
||||||
|
GEOM::GEOM_IMeasureOperations_var anOper = GEOM::GEOM_IMeasureOperations::_narrow( getOperation() );
|
||||||
try {
|
try {
|
||||||
char* aMsg;
|
char* aMsg;
|
||||||
bool isCheckGeometry = myGrp->CheckBox1->isChecked();
|
bool isCheckGeometry = myGrp->CheckBox1->isChecked();
|
||||||
GEOM::GEOM_IMeasureOperations_ptr aMeasureOp =
|
|
||||||
GEOM::GEOM_IMeasureOperations::_narrow( getOperation() );
|
|
||||||
if ( isCheckGeometry )
|
if ( isCheckGeometry )
|
||||||
theIsValid = aMeasureOp->CheckShapeWithGeometry( myObj, aMsg );
|
theIsValid = anOper->CheckShapeWithGeometry( myObj, aMsg );
|
||||||
else
|
else
|
||||||
theIsValid = aMeasureOp->CheckShape( myObj, aMsg );
|
theIsValid = anOper->CheckShape( myObj, aMsg );
|
||||||
theMsg = aMsg;
|
theMsg = aMsg;
|
||||||
}
|
}
|
||||||
catch( const SALOME::SALOME_Exception& e ) {
|
catch( const SALOME::SALOME_Exception& e ) {
|
||||||
@ -126,7 +125,7 @@ bool MeasureGUI_CheckShapeDlg::getParameters ( bool& theIsValid, QString& theMsg
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return getOperation()->IsDone();
|
return anOper->IsDone();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -207,10 +207,11 @@ bool MeasureGUI_DistanceDlg::getParameters (double& theDistance,
|
|||||||
{
|
{
|
||||||
QString msg;
|
QString msg;
|
||||||
if (isValid(msg)) {
|
if (isValid(msg)) {
|
||||||
|
GEOM::GEOM_IMeasureOperations_var anOper = GEOM::GEOM_IMeasureOperations::_narrow( getOperation() );
|
||||||
|
|
||||||
try {
|
try {
|
||||||
double x1, y1, z1, x2, y2, z2;
|
double x1, y1, z1, x2, y2, z2;
|
||||||
theDistance = GEOM::GEOM_IMeasureOperations::_narrow(getOperation())->
|
theDistance = anOper->GetMinDistance(myObj, myObj2, x1, y1, z1, x2, y2, z2);
|
||||||
GetMinDistance(myObj, myObj2, x1, y1, z1, x2, y2, z2);
|
|
||||||
|
|
||||||
thePnt1.SetCoord(x1, y1, z1);
|
thePnt1.SetCoord(x1, y1, z1);
|
||||||
thePnt2.SetCoord(x2, y2, z2);
|
thePnt2.SetCoord(x2, y2, z2);
|
||||||
@ -220,7 +221,7 @@ bool MeasureGUI_DistanceDlg::getParameters (double& theDistance,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return getOperation()->IsDone();
|
return anOper->IsDone();
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -169,13 +169,14 @@ bool MeasureGUI_InertiaDlg::getParameters( gp_Mat& I,
|
|||||||
if ( myObj->_is_nil() )
|
if ( myObj->_is_nil() )
|
||||||
return false;
|
return false;
|
||||||
else {
|
else {
|
||||||
|
GEOM::GEOM_IMeasureOperations_var anOper = GEOM::GEOM_IMeasureOperations::_narrow( getOperation() );
|
||||||
try {
|
try {
|
||||||
double x, y, z;
|
double x, y, z;
|
||||||
GEOM::GEOM_IMeasureOperations::_narrow( getOperation() )->GetInertia( myObj,
|
anOper->GetInertia( myObj,
|
||||||
I( 1, 1 ), I( 1, 2 ), I( 1, 3 ),
|
I( 1, 1 ), I( 1, 2 ), I( 1, 3 ),
|
||||||
I( 2, 1 ), I( 2, 2 ), I( 2, 3 ),
|
I( 2, 1 ), I( 2, 2 ), I( 2, 3 ),
|
||||||
I( 3, 1 ), I( 3, 2 ), I( 3, 3 ),
|
I( 3, 1 ), I( 3, 2 ), I( 3, 3 ),
|
||||||
x, y, z );
|
x, y, z );
|
||||||
|
|
||||||
theIXYZ.SetCoord( x, y, z );
|
theIXYZ.SetCoord( x, y, z );
|
||||||
}
|
}
|
||||||
@ -184,6 +185,6 @@ bool MeasureGUI_InertiaDlg::getParameters( gp_Mat& I,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return getOperation()->IsDone();
|
return anOper->IsDone();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -156,16 +156,17 @@ bool MeasureGUI_MaxToleranceDlg::getParameters( double& theMinFaceToler,
|
|||||||
if ( myObj->_is_nil() )
|
if ( myObj->_is_nil() )
|
||||||
return false;
|
return false;
|
||||||
else {
|
else {
|
||||||
|
GEOM::GEOM_IMeasureOperations_var anOper = GEOM::GEOM_IMeasureOperations::_narrow( getOperation() );
|
||||||
try {
|
try {
|
||||||
GEOM::GEOM_IMeasureOperations::_narrow( getOperation() )->GetTolerance( myObj,
|
anOper->GetTolerance( myObj,
|
||||||
theMinFaceToler, theMaxFaceToler, theMinEdgeToler,
|
theMinFaceToler, theMaxFaceToler, theMinEdgeToler,
|
||||||
theMaxEdgeToler, theMinVertexToler, theMaxVertexToler );
|
theMaxEdgeToler, theMinVertexToler, theMaxVertexToler );
|
||||||
}
|
}
|
||||||
catch( const SALOME::SALOME_Exception& e ) {
|
catch( const SALOME::SALOME_Exception& e ) {
|
||||||
SalomeApp_Tools::QtCatchCorbaException( e );
|
SalomeApp_Tools::QtCatchCorbaException( e );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return getOperation()->IsDone();
|
return anOper->IsDone();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -354,8 +354,8 @@ bool MeasureGUI_NormaleDlg::isValid (QString&)
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
bool MeasureGUI_NormaleDlg::execute (ObjectList& objects)
|
bool MeasureGUI_NormaleDlg::execute (ObjectList& objects)
|
||||||
{
|
{
|
||||||
GEOM::GEOM_Object_var anObj =
|
GEOM::GEOM_IMeasureOperations_var anOper = GEOM::GEOM_IMeasureOperations::_narrow( getOperation() );
|
||||||
GEOM::GEOM_IMeasureOperations::_narrow(getOperation())->GetNormal(myFace, myPoint);
|
GEOM::GEOM_Object_var anObj = anOper->GetNormal(myFace, myPoint);
|
||||||
|
|
||||||
if (!anObj->_is_nil())
|
if (!anObj->_is_nil())
|
||||||
objects.push_back(anObj._retn());
|
objects.push_back(anObj._retn());
|
||||||
|
@ -155,16 +155,16 @@ bool MeasureGUI_PropertiesDlg::getParameters( double& theLength,
|
|||||||
if ( myObj->_is_nil() )
|
if ( myObj->_is_nil() )
|
||||||
return false;
|
return false;
|
||||||
else {
|
else {
|
||||||
|
GEOM::GEOM_IMeasureOperations_var anOper = GEOM::GEOM_IMeasureOperations::_narrow( getOperation() );
|
||||||
try {
|
try {
|
||||||
GEOM::GEOM_IMeasureOperations::_narrow( getOperation() )->GetBasicProperties(
|
anOper->GetBasicProperties( myObj, theLength, theArea, theVolume );
|
||||||
myObj, theLength, theArea, theVolume );
|
|
||||||
}
|
}
|
||||||
catch( const SALOME::SALOME_Exception& e ) {
|
catch( const SALOME::SALOME_Exception& e ) {
|
||||||
SalomeApp_Tools::QtCatchCorbaException( e );
|
SalomeApp_Tools::QtCatchCorbaException( e );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return getOperation()->IsDone();
|
return anOper->IsDone();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,9 +208,10 @@ bool MeasureGUI_WhatisDlg::getParameters( QString& theText )
|
|||||||
if ( myObj->_is_nil() )
|
if ( myObj->_is_nil() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
GEOM::GEOM_IMeasureOperations_var anOper = GEOM::GEOM_IMeasureOperations::_narrow( getOperation() );
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
theText = GEOM::GEOM_IMeasureOperations::_narrow( getOperation() )->WhatIs( myObj );
|
theText = anOper->WhatIs( myObj );
|
||||||
}
|
}
|
||||||
catch( const SALOME::SALOME_Exception& e )
|
catch( const SALOME::SALOME_Exception& e )
|
||||||
{
|
{
|
||||||
@ -218,7 +219,7 @@ bool MeasureGUI_WhatisDlg::getParameters( QString& theText )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return getOperation()->IsDone();
|
return anOper->IsDone();
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -237,18 +238,18 @@ QString MeasureGUI_WhatisDlg::getKindOfShape( QString& theParameters )
|
|||||||
GEOM::ListOfLong_var anInts;
|
GEOM::ListOfLong_var anInts;
|
||||||
GEOM::ListOfDouble_var aDbls;
|
GEOM::ListOfDouble_var aDbls;
|
||||||
|
|
||||||
GEOM::GEOM_IMeasureOperations_var anOp = GEOM::GEOM_IMeasureOperations::_narrow( getOperation() );
|
GEOM::GEOM_IMeasureOperations_var anOper = GEOM::GEOM_IMeasureOperations::_narrow( getOperation() );
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
aKind = anOp->KindOfShape( myObj, anInts, aDbls );
|
aKind = anOper->KindOfShape( myObj, anInts, aDbls );
|
||||||
}
|
}
|
||||||
catch( const SALOME::SALOME_Exception& e ) {
|
catch( const SALOME::SALOME_Exception& e ) {
|
||||||
SalomeApp_Tools::QtCatchCorbaException( e );
|
SalomeApp_Tools::QtCatchCorbaException( e );
|
||||||
return aKindStr;
|
return aKindStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !anOp->IsDone() )
|
if ( !anOper->IsDone() )
|
||||||
return aKindStr;
|
return aKindStr;
|
||||||
|
|
||||||
#define PRINT_DOUBLE(val) QString(" %1").arg( DlgRef::PrintDoubleValue( val ) )
|
#define PRINT_DOUBLE(val) QString(" %1").arg( DlgRef::PrintDoubleValue( val ) )
|
||||||
|
Loading…
Reference in New Issue
Block a user