mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-18 17:00:40 +05:00
Fix memory leaks
This commit is contained in:
parent
56ca7cc409
commit
c20be9052a
@ -194,14 +194,14 @@ void GroupGUI_GroupDlg::Init()
|
||||
|
||||
mainFrame()->ResultName->setText( GEOMBase::GetName( myGroup ) );
|
||||
|
||||
GEOM::GEOM_IGroupOperations_var anOp = GEOM::GEOM_IGroupOperations::_narrow( getOperation() );
|
||||
myMainObj = anOp->GetMainShape( myGroup );
|
||||
GEOM::GEOM_IGroupOperations_var anOper = GEOM::GEOM_IGroupOperations::_narrow( getOperation() );
|
||||
myMainObj = anOper->GetMainShape( myGroup );
|
||||
if ( !CORBA::is_nil( myMainObj ) )
|
||||
myMainName->setText( GEOMBase::GetName( myMainObj ) );
|
||||
|
||||
setShapeType( (TopAbs_ShapeEnum)anOp->GetType( myGroup ) );
|
||||
setShapeType( (TopAbs_ShapeEnum)anOper->GetType( myGroup ) );
|
||||
|
||||
GEOM::ListOfLong_var aCurrList = anOp->GetObjects( myGroup );
|
||||
GEOM::ListOfLong_var aCurrList = anOper->GetObjects( myGroup );
|
||||
for ( int i = 0, n = aCurrList->length(); i < n; i++ )
|
||||
myIdList->addItem( new QListWidgetItem( QString( "%1" ).arg( aCurrList[i] ) ) );
|
||||
|
||||
@ -1052,25 +1052,25 @@ bool GroupGUI_GroupDlg::execute( ObjectList& objects )
|
||||
{
|
||||
setInPlaceObj( GEOM::GEOM_Object::_nil() );
|
||||
|
||||
GEOM::GEOM_IGroupOperations_var anOp = GEOM::GEOM_IGroupOperations::_narrow(getOperation());
|
||||
GEOM::GEOM_IGroupOperations_var anOper = GEOM::GEOM_IGroupOperations::_narrow(getOperation());
|
||||
|
||||
GEOM::GEOM_Object_var aGroup;
|
||||
if (myMode == CreateGroup)
|
||||
aGroup = anOp->CreateGroup(myMainObj, getShapeType());
|
||||
aGroup = anOper->CreateGroup(myMainObj, getShapeType());
|
||||
else if (myMode == EditGroup)
|
||||
aGroup = myGroup;
|
||||
|
||||
if (CORBA::is_nil(aGroup) || (myMode == CreateGroup && !anOp->IsDone()))
|
||||
if (CORBA::is_nil(aGroup) || (myMode == CreateGroup && !anOper->IsDone()))
|
||||
return false;
|
||||
|
||||
GEOM::ListOfLong_var aCurrList = anOp->GetObjects(aGroup);
|
||||
if (!anOp->IsDone())
|
||||
GEOM::ListOfLong_var aCurrList = anOper->GetObjects(aGroup);
|
||||
if (!anOper->IsDone())
|
||||
return false;
|
||||
|
||||
if (aCurrList->length() > 0)
|
||||
{
|
||||
anOp->DifferenceIDs(aGroup, aCurrList);
|
||||
if (!anOp->IsDone())
|
||||
anOper->DifferenceIDs(aGroup, aCurrList);
|
||||
if (!anOper->IsDone())
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1082,8 +1082,8 @@ bool GroupGUI_GroupDlg::execute( ObjectList& objects )
|
||||
for (ii = 0; ii < nn; ii++) {
|
||||
aNewList[ii] = myIdList->item(ii)->text().toInt();
|
||||
}
|
||||
anOp->UnionIDs(aGroup, aNewList);
|
||||
if (!anOp->IsDone())
|
||||
anOper->UnionIDs(aGroup, aNewList);
|
||||
if (!anOper->IsDone())
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1115,8 +1115,8 @@ GEOM::GEOM_Object_ptr GroupGUI_GroupDlg::getFather( GEOM::GEOM_Object_ptr theObj
|
||||
{
|
||||
GEOM::GEOM_Object_var aFatherObj;
|
||||
if ( theObj->GetType() == GEOM_GROUP ) {
|
||||
GEOM::GEOM_IGroupOperations_var anOp = GEOM::GEOM_IGroupOperations::_narrow( getOperation() );
|
||||
aFatherObj = anOp->GetMainShape( theObj );
|
||||
GEOM::GEOM_IGroupOperations_var anOper = GEOM::GEOM_IGroupOperations::_narrow( getOperation() );
|
||||
aFatherObj = anOper->GetMainShape( theObj );
|
||||
}
|
||||
return aFatherObj._retn();
|
||||
}
|
||||
|
@ -448,11 +448,13 @@ bool PrimitiveGUI_BoxDlg::execute (ObjectList& objects)
|
||||
|
||||
GEOM::GEOM_Object_var anObj;
|
||||
|
||||
GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation());
|
||||
|
||||
switch (getConstructorId()) {
|
||||
case 0:
|
||||
{
|
||||
if (!CORBA::is_nil(myPoint1) && !CORBA::is_nil(myPoint2)) {
|
||||
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->MakeBoxTwoPnt(myPoint1, myPoint2);
|
||||
anObj = anOper->MakeBoxTwoPnt(myPoint1, myPoint2);
|
||||
res = true;
|
||||
}
|
||||
}
|
||||
@ -463,14 +465,14 @@ bool PrimitiveGUI_BoxDlg::execute (ObjectList& objects)
|
||||
double y = GroupDimensions->SpinBox_DY->value();
|
||||
double z = GroupDimensions->SpinBox_DZ->value();
|
||||
|
||||
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->MakeBoxDXDYDZ(x, y, z);
|
||||
anObj = anOper->MakeBoxDXDYDZ(x, y, z);
|
||||
if (!anObj->_is_nil() && !IsPreview())
|
||||
{
|
||||
QStringList aParameters;
|
||||
aParameters << GroupDimensions->SpinBox_DX->text();
|
||||
aParameters << GroupDimensions->SpinBox_DY->text();
|
||||
aParameters << GroupDimensions->SpinBox_DZ->text();
|
||||
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
|
||||
anObj->SetParameters(aParameters.join(":").toLatin1().constData());
|
||||
}
|
||||
res = true;
|
||||
}
|
||||
|
@ -470,32 +470,32 @@ bool PrimitiveGUI_ConeDlg::execute (ObjectList& objects)
|
||||
|
||||
GEOM::GEOM_Object_var anObj;
|
||||
|
||||
GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation());
|
||||
|
||||
switch (getConstructorId()) {
|
||||
case 0:
|
||||
if (!CORBA::is_nil(myPoint) && !CORBA::is_nil(myDir)) {
|
||||
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
|
||||
MakeConePntVecR1R2H(myPoint, myDir, getRadius1(), getRadius2(), getHeight());
|
||||
anObj = anOper->MakeConePntVecR1R2H(myPoint, myDir, getRadius1(), getRadius2(), getHeight());
|
||||
if (!anObj->_is_nil() && !IsPreview())
|
||||
{
|
||||
QStringList aParameters;
|
||||
aParameters << GroupPoints->SpinBox_DX->text();
|
||||
aParameters << GroupPoints->SpinBox_DY->text();
|
||||
aParameters << GroupPoints->SpinBox_DZ->text();
|
||||
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
|
||||
anObj->SetParameters(aParameters.join(":").toLatin1().constData());
|
||||
}
|
||||
res = true;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
|
||||
MakeConeR1R2H(getRadius1(), getRadius2(), getHeight());
|
||||
anObj = anOper->MakeConeR1R2H(getRadius1(), getRadius2(), getHeight());
|
||||
if (!anObj->_is_nil() && !IsPreview())
|
||||
{
|
||||
QStringList aParameters;
|
||||
aParameters << GroupDimensions->SpinBox_DX->text();
|
||||
aParameters << GroupDimensions->SpinBox_DY->text();
|
||||
aParameters << GroupDimensions->SpinBox_DZ->text();
|
||||
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
|
||||
anObj->SetParameters(aParameters.join(":").toLatin1().constData());
|
||||
}
|
||||
res = true;
|
||||
break;
|
||||
|
@ -461,30 +461,30 @@ bool PrimitiveGUI_CylinderDlg::execute (ObjectList& objects)
|
||||
|
||||
GEOM::GEOM_Object_var anObj;
|
||||
|
||||
GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation());
|
||||
|
||||
switch (getConstructorId()) {
|
||||
case 0:
|
||||
if (!CORBA::is_nil(myPoint) && !CORBA::is_nil(myDir)) {
|
||||
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
|
||||
MakeCylinderPntVecRH(myPoint, myDir, getRadius(), getHeight());
|
||||
anObj = anOper->MakeCylinderPntVecRH(myPoint, myDir, getRadius(), getHeight());
|
||||
if (!anObj->_is_nil() && !IsPreview())
|
||||
{
|
||||
QStringList aParameters;
|
||||
aParameters << GroupPoints->SpinBox_DX->text();
|
||||
aParameters << GroupPoints->SpinBox_DY->text();
|
||||
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
|
||||
anObj->SetParameters(aParameters.join(":").toLatin1().constData());
|
||||
}
|
||||
res = true;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
|
||||
MakeCylinderRH(getRadius(), getHeight());
|
||||
anObj = anOper->MakeCylinderRH(getRadius(), getHeight());
|
||||
if (!anObj->_is_nil() && !IsPreview())
|
||||
{
|
||||
QStringList aParameters;
|
||||
aParameters << GroupDimensions->SpinBox_DX->text();
|
||||
aParameters << GroupDimensions->SpinBox_DY->text();
|
||||
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
|
||||
anObj->SetParameters(aParameters.join(":").toLatin1().constData());
|
||||
}
|
||||
res = true;
|
||||
break;
|
||||
|
@ -572,30 +572,29 @@ bool PrimitiveGUI_DiskDlg::execute (ObjectList& objects)
|
||||
|
||||
GEOM::GEOM_Object_var anObj;
|
||||
|
||||
GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation());
|
||||
|
||||
switch (getConstructorId()) {
|
||||
case 0:
|
||||
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
|
||||
MakeDiskR(getRadius(), myOrientationType);
|
||||
anObj = anOper->MakeDiskR(getRadius(), myOrientationType);
|
||||
if (!anObj->_is_nil() && !IsPreview())
|
||||
{
|
||||
aParameters << GroupDimensions->SpinBox_DX->text();
|
||||
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
|
||||
anObj->SetParameters(aParameters.join(":").toLatin1().constData());
|
||||
}
|
||||
res = true;
|
||||
break;
|
||||
case 1:
|
||||
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
|
||||
MakeDiskPntVecR(myPoint, myDir, getRadius());
|
||||
anObj = anOper->MakeDiskPntVecR(myPoint, myDir, getRadius());
|
||||
if (!anObj->_is_nil() && !IsPreview())
|
||||
{
|
||||
aParameters << GroupPntVecR->SpinBox_DX->text();
|
||||
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
|
||||
anObj->SetParameters(aParameters.join(":").toLatin1().constData());
|
||||
}
|
||||
res = true;
|
||||
break;
|
||||
case 2:
|
||||
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
|
||||
MakeDiskThreePnt(myPoint1, myPoint2, myPoint3);
|
||||
anObj = anOper->MakeDiskThreePnt(myPoint1, myPoint2, myPoint3);
|
||||
res = true;
|
||||
break;
|
||||
}
|
||||
|
@ -492,31 +492,30 @@ bool PrimitiveGUI_FaceDlg::execute (ObjectList& objects)
|
||||
bool res = false;
|
||||
QStringList aParameters;
|
||||
GEOM::GEOM_Object_var anObj;
|
||||
|
||||
GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation());
|
||||
|
||||
switch (getConstructorId()) {
|
||||
case 0:
|
||||
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
|
||||
MakeFaceHW(GroupDimensions->SpinBox_DX->value(),
|
||||
anObj = anOper->MakeFaceHW(GroupDimensions->SpinBox_DX->value(),
|
||||
GroupDimensions->SpinBox_DY->value(), myOrientationType);
|
||||
if (!anObj->_is_nil() && !IsPreview())
|
||||
{
|
||||
aParameters << GroupDimensions->SpinBox_DX->text();
|
||||
aParameters << GroupDimensions->SpinBox_DY->text();
|
||||
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
|
||||
anObj->SetParameters(aParameters.join(":").toLatin1().constData());
|
||||
}
|
||||
res = true;
|
||||
break;
|
||||
case 1:
|
||||
if (GroupType->RadioButton1->isChecked())
|
||||
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
|
||||
MakeFaceObjHW(myEdge, GroupPlane->SpinBox_DX->value(), GroupPlane->SpinBox_DY->value());
|
||||
else if (GroupType->RadioButton2->isChecked())
|
||||
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
|
||||
MakeFaceObjHW(myFace, GroupPlane->SpinBox_DX->value(), GroupPlane->SpinBox_DY->value());
|
||||
anObj = GroupType->RadioButton1->isChecked() ?
|
||||
anOper->MakeFaceObjHW(myEdge, GroupPlane->SpinBox_DX->value(), GroupPlane->SpinBox_DY->value()) :
|
||||
anOper->MakeFaceObjHW(myFace, GroupPlane->SpinBox_DX->value(), GroupPlane->SpinBox_DY->value());
|
||||
if (!anObj->_is_nil() && !IsPreview())
|
||||
{
|
||||
aParameters << GroupPlane->SpinBox_DX->text();
|
||||
aParameters << GroupPlane->SpinBox_DY->text();
|
||||
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
|
||||
anObj->SetParameters(aParameters.join(":").toLatin1().constData());
|
||||
}
|
||||
res = true;
|
||||
break;
|
||||
|
@ -396,16 +396,18 @@ bool PrimitiveGUI_SphereDlg::execute( ObjectList& objects )
|
||||
|
||||
GEOM::GEOM_Object_var anObj;
|
||||
|
||||
GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation());
|
||||
|
||||
switch ( getConstructorId() ) {
|
||||
case 0 :
|
||||
{
|
||||
if ( !CORBA::is_nil( myPoint ) ) {
|
||||
anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeSpherePntR( myPoint, getRadius() );
|
||||
anObj = anOper->MakeSpherePntR( myPoint, getRadius() );
|
||||
if (!anObj->_is_nil() && !IsPreview())
|
||||
{
|
||||
QStringList aParameters;
|
||||
aParameters << GroupPoints->SpinBox_DX->text();
|
||||
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
|
||||
anObj->SetParameters(aParameters.join(":").toLatin1().constData());
|
||||
}
|
||||
res = true;
|
||||
}
|
||||
@ -413,12 +415,12 @@ bool PrimitiveGUI_SphereDlg::execute( ObjectList& objects )
|
||||
}
|
||||
case 1 :
|
||||
{
|
||||
anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeSphereR( getRadius() );
|
||||
anObj = anOper->MakeSphereR( getRadius() );
|
||||
if (!anObj->_is_nil() && !IsPreview())
|
||||
{
|
||||
QStringList aParameters;
|
||||
aParameters << GroupDimensions->SpinBox_DX->text();
|
||||
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
|
||||
anObj->SetParameters(aParameters.join(":").toLatin1().constData());
|
||||
}
|
||||
res = true;
|
||||
break;
|
||||
|
@ -457,30 +457,30 @@ bool PrimitiveGUI_TorusDlg::execute (ObjectList& objects)
|
||||
|
||||
GEOM::GEOM_Object_var anObj;
|
||||
|
||||
GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation());
|
||||
|
||||
switch (getConstructorId()) {
|
||||
case 0:
|
||||
if (!CORBA::is_nil(myPoint) && !CORBA::is_nil(myDir)) {
|
||||
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
|
||||
MakeTorusPntVecRR(myPoint, myDir, getRadius1(), getRadius2());
|
||||
anObj = anOper->MakeTorusPntVecRR(myPoint, myDir, getRadius1(), getRadius2());
|
||||
if (!anObj->_is_nil() && !IsPreview())
|
||||
{
|
||||
QStringList aParameters;
|
||||
aParameters << GroupPoints->SpinBox_DX->text();
|
||||
aParameters << GroupPoints->SpinBox_DY->text();
|
||||
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
|
||||
anObj->SetParameters(aParameters.join(":").toLatin1().constData());
|
||||
}
|
||||
res = true;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
|
||||
MakeTorusRR(getRadius1(), getRadius2());
|
||||
anObj = anOper->MakeTorusRR(getRadius1(), getRadius2());
|
||||
if (!anObj->_is_nil() && !IsPreview())
|
||||
{
|
||||
QStringList aParameters;
|
||||
aParameters << GroupDimensions->SpinBox_DX->text();
|
||||
aParameters << GroupDimensions->SpinBox_DY->text();
|
||||
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
|
||||
anObj->SetParameters(aParameters.join(":").toLatin1().constData());
|
||||
}
|
||||
res = true;
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user