IPAL22806: TC6.4.0: fatal error at partition by plane.

This commit is contained in:
jfa 2011-11-16 12:07:36 +00:00
parent e5bcf75bd2
commit 3d4bc37e0f

View File

@ -18,12 +18,11 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// File : OperationGUI_PartitionDlg.cxx // File : OperationGUI_PartitionDlg.cxx
// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. // Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
//
#include "OperationGUI_PartitionDlg.h" #include "OperationGUI_PartitionDlg.h"
#include <DlgRef.h> #include <DlgRef.h>
@ -44,7 +43,7 @@
//================================================================================= //=================================================================================
// class : OperationGUI_PartitionDlg() // class : OperationGUI_PartitionDlg()
// purpose : Constructs a OperationGUI_PartitionDlg which is a child of 'parent', with the // purpose : Constructs a OperationGUI_PartitionDlg which is a child of 'parent', with the
// name 'name' and widget flags set to 'f'. // name 'name' and widget flags set to 'f'.
// The dialog will by default be modeless, unless you set 'modal' to // The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
@ -88,7 +87,7 @@ OperationGUI_PartitionDlg::OperationGUI_PartitionDlg( GeometryGUI* theGeometryGU
/***************************************************************/ /***************************************************************/
setHelpFileName( "partition_page.html" ); setHelpFileName( "partition_page.html" );
Init(); Init();
} }
@ -104,12 +103,12 @@ OperationGUI_PartitionDlg::~OperationGUI_PartitionDlg()
void OperationGUI_PartitionDlg::SetListMaterials( GEOM::ListOfLong ListMaterials ) void OperationGUI_PartitionDlg::SetListMaterials( GEOM::ListOfLong ListMaterials )
{ {
myListMaterials = ListMaterials; myListMaterials = ListMaterials;
} }
GEOM::ListOfLong OperationGUI_PartitionDlg::GetListMaterials() GEOM::ListOfLong OperationGUI_PartitionDlg::GetListMaterials()
{ {
return myListMaterials; return myListMaterials;
} }
//================================================================================= //=================================================================================
@ -132,7 +131,7 @@ void OperationGUI_PartitionDlg::Init()
GroupPoints->ComboBox1->addItem( tr( "GEOM_RECONSTRUCTION_LIMIT_VERTEX" ) ); GroupPoints->ComboBox1->addItem( tr( "GEOM_RECONSTRUCTION_LIMIT_VERTEX" ) );
GroupPoints->ComboBox1->setItemData(GroupPoints->ComboBox1->count()-1, GEOM::VERTEX); GroupPoints->ComboBox1->setItemData(GroupPoints->ComboBox1->count()-1, GEOM::VERTEX);
GroupPoints->CheckButton1->setChecked( false ); GroupPoints->CheckButton1->setChecked( false );
mainFrame()->GroupBoxPublish->show(); mainFrame()->GroupBoxPublish->show();
/* signals and slots connections */ /* signals and slots connections */
@ -140,13 +139,13 @@ void OperationGUI_PartitionDlg::Init()
connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) ); connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );
connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect( GroupPoints->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); connect( GroupPoints->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect( GroupPoints->ComboBox1, SIGNAL( activated( int ) ), this, SLOT( ComboTextChanged() ) ); connect( GroupPoints->ComboBox1, SIGNAL( activated( int ) ), this, SLOT( ComboTextChanged() ) );
connect( myGeomGUI->getApp()->selectionMgr(), connect( myGeomGUI->getApp()->selectionMgr(),
@ -154,7 +153,7 @@ void OperationGUI_PartitionDlg::Init()
connect( GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(processPreview()) ); connect( GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(processPreview()) );
connect( GroupPoints->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(processPreview()) ); connect( GroupPoints->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(processPreview()) );
initName( tr( "GEOM_PARTITION" ) ); initName( tr( "GEOM_PARTITION" ) );
ConstructorsClicked( 0 ); ConstructorsClicked( 0 );
@ -170,13 +169,13 @@ void OperationGUI_PartitionDlg::ConstructorsClicked( int constructorId )
{ {
disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 ); disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 );
globalSelection(); globalSelection();
//myListShapes.length( 0 ); //myListShapes.length( 0 );
//myListTools.length( 0 ); //myListTools.length( 0 );
//myListKeepInside.length( 0 ); // obsolete //myListKeepInside.length( 0 ); // obsolete
//myListRemoveInside.length( 0 ); // obsolete //myListRemoveInside.length( 0 ); // obsolete
//myListMaterials.length( 0 ); // obsolete //myListMaterials.length( 0 ); // obsolete
switch ( constructorId ) { switch ( constructorId ) {
case 0: /*Full partition */ case 0: /*Full partition */
GroupPoints->GroupBox1->setTitle( tr( "GEOM_PARTITION" ) ); GroupPoints->GroupBox1->setTitle( tr( "GEOM_PARTITION" ) );
@ -203,7 +202,7 @@ void OperationGUI_PartitionDlg::ConstructorsClicked( int constructorId )
GroupPoints->PushButton1->setDown( true ); GroupPoints->PushButton1->setDown( true );
GroupPoints->LineEdit1->setEnabled(true); GroupPoints->LineEdit1->setEnabled(true);
break; break;
} }
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
GroupPoints->LineEdit1->clear(); GroupPoints->LineEdit1->clear();
@ -214,7 +213,7 @@ void OperationGUI_PartitionDlg::ConstructorsClicked( int constructorId )
resize( minimumSizeHint() ); resize( minimumSizeHint() );
myEditCurrentArgument->setFocus(); myEditCurrentArgument->setFocus();
connect( myGeomGUI->getApp()->selectionMgr(), connect( myGeomGUI->getApp()->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
SelectionIntoArgument(); SelectionIntoArgument();
} }
@ -240,10 +239,9 @@ bool OperationGUI_PartitionDlg::ClickOnApply()
{ {
if ( !onAccept() ) if ( !onAccept() )
return false; return false;
initName(); initName();
// 0020854: EDF 1398 GEOM: Ergonomy of Partition GUI window // 0020854: EDF 1398 GEOM: Ergonomy of Partition GUI window
// ConstructorsClicked( getConstructorId() ); // ConstructorsClicked( getConstructorId() );
return true; return true;
} }
@ -257,13 +255,13 @@ void OperationGUI_PartitionDlg::SelectionIntoArgument()
{ {
myEditCurrentArgument->setText( "" ); myEditCurrentArgument->setText( "" );
QString aString = ""; QString aString = "";
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
SALOME_ListIO aSelList; SALOME_ListIO aSelList;
aSelMgr->selectedObjects(aSelList); aSelMgr->selectedObjects(aSelList);
int nbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aString, true); int nbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aString, true);
if ( getConstructorId() == 1 ) { if ( getConstructorId() == 1 ) {
// for half-selection, only one shape can be selected as an object // for half-selection, only one shape can be selected as an object
// and only one plane as a tool // and only one plane as a tool
@ -292,11 +290,11 @@ void OperationGUI_PartitionDlg::SelectionIntoArgument()
} }
} }
} }
if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) { if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {
GEOMBase::ConvertListOfIOInListOfGO(aSelList, myListShapes, true); GEOMBase::ConvertListOfIOInListOfGO(aSelList, myListShapes, true);
//myListMaterials.length( 0 ); // obsolete //myListMaterials.length( 0 ); // obsolete
GEOM::shape_type type = GEOM::SHAPE; GEOM::shape_type type = GEOM::SHAPE;
for (int i = 0; i < myListShapes.length(); i++) for (int i = 0; i < myListShapes.length(); i++)
type = qMin( type, myListShapes[i]->GetMaxShapeType() ); type = qMin( type, myListShapes[i]->GetMaxShapeType() );
@ -322,7 +320,7 @@ void OperationGUI_PartitionDlg::SelectionIntoArgument()
} }
} }
} }
myEditCurrentArgument->setText( aString ); myEditCurrentArgument->setText( aString );
processPreview(); processPreview();
} }
@ -335,7 +333,7 @@ void OperationGUI_PartitionDlg::SelectionIntoArgument()
void OperationGUI_PartitionDlg::SetEditCurrentArgument() void OperationGUI_PartitionDlg::SetEditCurrentArgument()
{ {
QPushButton* send = (QPushButton*)sender(); QPushButton* send = (QPushButton*)sender();
if ( send == GroupPoints->PushButton1 ) { if ( send == GroupPoints->PushButton1 ) {
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
GroupPoints->PushButton2->setDown(false); GroupPoints->PushButton2->setDown(false);
@ -351,9 +349,9 @@ void OperationGUI_PartitionDlg::SetEditCurrentArgument()
if ( getConstructorId() == 1 ) if ( getConstructorId() == 1 )
globalSelection( GEOM_PLANE ); globalSelection( GEOM_PLANE );
} }
globalSelection( GEOM_ALLSHAPES ); globalSelection( GEOM_ALLSHAPES );
myEditCurrentArgument->setFocus(); myEditCurrentArgument->setFocus();
SelectionIntoArgument(); SelectionIntoArgument();
send->setDown(true); send->setDown(true);
@ -369,7 +367,7 @@ void OperationGUI_PartitionDlg::LineEditReturnPressed()
{ {
QLineEdit* send = (QLineEdit*)sender(); QLineEdit* send = (QLineEdit*)sender();
if ( send == GroupPoints->LineEdit1 || if ( send == GroupPoints->LineEdit1 ||
send == GroupPoints->LineEdit2 ) { send == GroupPoints->LineEdit2 ) {
myEditCurrentArgument = send; myEditCurrentArgument = send;
GEOMBase_Skeleton::LineEditReturnPressed(); GEOMBase_Skeleton::LineEditReturnPressed();
@ -384,10 +382,10 @@ void OperationGUI_PartitionDlg::LineEditReturnPressed()
void OperationGUI_PartitionDlg::ActivateThisDialog() void OperationGUI_PartitionDlg::ActivateThisDialog()
{ {
GEOMBase_Skeleton::ActivateThisDialog(); GEOMBase_Skeleton::ActivateThisDialog();
connect( myGeomGUI->getApp()->selectionMgr(), connect( myGeomGUI->getApp()->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
ConstructorsClicked( getConstructorId() ); ConstructorsClicked( getConstructorId() );
processPreview(); processPreview();
} }
@ -417,9 +415,11 @@ GEOM::GEOM_IOperations_ptr OperationGUI_PartitionDlg::createOperation()
// function : isValid // function : isValid
// purpose : // purpose :
//================================================================================= //=================================================================================
bool OperationGUI_PartitionDlg::isValid( QString& ) bool OperationGUI_PartitionDlg::isValid (QString& )
{ {
return ( myListShapes.length() || myListTools.length() ); // || myListKeepInside.length() || myListRemoveInside.length() // obsolete return (getConstructorId() == 0 ?
myListShapes.length() :
myListShapes.length() && myListTools.length());
} }
@ -427,31 +427,35 @@ bool OperationGUI_PartitionDlg::isValid( QString& )
// function : execute // function : execute
// purpose : // purpose :
//================================================================================= //=================================================================================
bool OperationGUI_PartitionDlg::execute( ObjectList& objects ) bool OperationGUI_PartitionDlg::execute (ObjectList& objects)
{ {
bool res = false; bool res = false;
GEOM::GEOM_Object_var anObj; GEOM::GEOM_Object_var anObj;
int aLimit = GetLimit(); GEOM::GEOM_IBooleanOperations_var anOper = GEOM::GEOM_IBooleanOperations::_narrow(getOperation());
int aKeepNonlimitShapes = GroupPoints->CheckButton1->isChecked();
bool aNoSelfIntersection = GroupPoints->CheckButton2->isChecked();
GEOM::GEOM_IBooleanOperations_var anOper = GEOM::GEOM_IBooleanOperations::_narrow( getOperation() );
switch ( getConstructorId() ) { switch ( getConstructorId() ) {
case 0: case 0:
anObj = aNoSelfIntersection ? {
anOper->MakePartitionNonSelfIntersectedShape( myListShapes, myListTools, int aLimit = GetLimit();
myListKeepInside, myListRemoveInside, int aKeepNonlimitShapes = GroupPoints->CheckButton1->isChecked();
aLimit, false, myListMaterials, aKeepNonlimitShapes ) : bool aNoSelfIntersection = GroupPoints->CheckButton2->isChecked();
anOper->MakePartition( myListShapes, myListTools,
myListKeepInside, myListRemoveInside, anObj = aNoSelfIntersection ?
aLimit, false, myListMaterials, aKeepNonlimitShapes ); anOper->MakePartitionNonSelfIntersectedShape(myListShapes, myListTools,
res = true; myListKeepInside, myListRemoveInside,
aLimit, false, myListMaterials, aKeepNonlimitShapes) :
anOper->MakePartition(myListShapes, myListTools,
myListKeepInside, myListRemoveInside,
aLimit, false, myListMaterials, aKeepNonlimitShapes);
res = true;
}
break; break;
case 1: case 1:
anObj = anOper->MakeHalfPartition( myListShapes[0].in(), myListTools[0].in() ); {
res = true; anObj = anOper->MakeHalfPartition( myListShapes[0].in(), myListTools[0].in() );
res = true;
}
break; break;
} }
@ -460,7 +464,7 @@ bool OperationGUI_PartitionDlg::execute( ObjectList& objects )
GEOMBase::GetShape( anObj, aShape, TopAbs_SHAPE ); GEOMBase::GetShape( anObj, aShape, TopAbs_SHAPE );
TopoDS_Iterator It( aShape, Standard_True, Standard_True ); TopoDS_Iterator It( aShape, Standard_True, Standard_True );
int nbSubshapes = 0; int nbSubshapes = 0;
for ( ; It.More(); It.Next() ) for (; It.More(); It.Next())
nbSubshapes++; nbSubshapes++;
if ( nbSubshapes ) if ( nbSubshapes )
@ -470,7 +474,7 @@ bool OperationGUI_PartitionDlg::execute( ObjectList& objects )
QObject::tr( "GEOM_ERROR" ), QObject::tr( "GEOM_ERROR" ),
QObject::tr( "GEOM_WRN_PARTITION_RESULT_EMPTY" ) ); QObject::tr( "GEOM_WRN_PARTITION_RESULT_EMPTY" ) );
} }
return res; return res;
} }
@ -492,7 +496,7 @@ void OperationGUI_PartitionDlg::restoreSubShapes( SALOMEDS::Study_ptr theStudy
//======================================================================= //=======================================================================
//function : ComboTextChanged //function : ComboTextChanged
//purpose : //purpose :
//======================================================================= //=======================================================================
void OperationGUI_PartitionDlg::ComboTextChanged() void OperationGUI_PartitionDlg::ComboTextChanged()
{ {
@ -508,7 +512,7 @@ void OperationGUI_PartitionDlg::ComboTextChanged()
//================================================================================= //=================================================================================
// function : GetLimit() // function : GetLimit()
// purpose : // purpose :
//================================================================================= //=================================================================================
int OperationGUI_PartitionDlg::GetLimit() const int OperationGUI_PartitionDlg::GetLimit() const
{ {