0019050 Test integration

This commit is contained in:
dmv 2008-09-05 07:46:10 +00:00
parent 6ab4ad8df1
commit 01153dd95e
2 changed files with 62 additions and 19 deletions

View File

@ -75,6 +75,8 @@ BasicGUI_LineDlg::BasicGUI_LineDlg( GeometryGUI* theGeometryGUI, QWidget* parent
GroupPoints->PushButton2->setIcon( image1 ); GroupPoints->PushButton2->setIcon( image1 );
GroupPoints->LineEdit1->setReadOnly( true ); GroupPoints->LineEdit1->setReadOnly( true );
GroupPoints->LineEdit2->setReadOnly( true ); GroupPoints->LineEdit2->setReadOnly( true );
GroupPoints->LineEdit1->setEnabled( true );
GroupPoints->LineEdit2->setEnabled( false );
GroupFaces = new DlgRef_2Sel( centralWidget() ); GroupFaces = new DlgRef_2Sel( centralWidget() );
GroupFaces->GroupBox1->setTitle( tr( "GEOM_FACES" ) ); GroupFaces->GroupBox1->setTitle( tr( "GEOM_FACES" ) );
@ -84,6 +86,8 @@ BasicGUI_LineDlg::BasicGUI_LineDlg( GeometryGUI* theGeometryGUI, QWidget* parent
GroupFaces->PushButton2->setIcon( image1 ); GroupFaces->PushButton2->setIcon( image1 );
GroupFaces->LineEdit1->setReadOnly( true ); GroupFaces->LineEdit1->setReadOnly( true );
GroupFaces->LineEdit2->setReadOnly( true ); GroupFaces->LineEdit2->setReadOnly( true );
GroupFaces->LineEdit1->setEnabled( true );
GroupFaces->LineEdit2->setEnabled( false );
QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
layout->setMargin( 0 ); layout->setSpacing( 6 ); layout->setMargin( 0 ); layout->setSpacing( 6 );
@ -195,6 +199,8 @@ void BasicGUI_LineDlg::ConstructorsClicked( int constructorId )
myPoint2 = GEOM::GEOM_Object::_nil(); myPoint2 = GEOM::GEOM_Object::_nil();
GroupPoints->PushButton1->setDown(true); GroupPoints->PushButton1->setDown(true);
GroupPoints->PushButton2->setDown(false); GroupPoints->PushButton2->setDown(false);
GroupPoints->LineEdit1->setEnabled(true);
GroupPoints->LineEdit2->setEnabled(false);
GroupPoints->show(); GroupPoints->show();
GroupFaces->hide(); GroupFaces->hide();
break; break;
@ -210,6 +216,8 @@ void BasicGUI_LineDlg::ConstructorsClicked( int constructorId )
myFace2 = GEOM::GEOM_Object::_nil(); myFace2 = GEOM::GEOM_Object::_nil();
GroupFaces->PushButton1->setDown(true); GroupFaces->PushButton1->setDown(true);
GroupFaces->PushButton2->setDown(false); GroupFaces->PushButton2->setDown(false);
GroupFaces->LineEdit1->setEnabled(true);
GroupFaces->LineEdit2->setEnabled(false);
GroupPoints->hide(); GroupPoints->hide();
GroupFaces->show(); GroupFaces->show();
break; break;
@ -244,14 +252,13 @@ void BasicGUI_LineDlg::SelectionIntoArgument()
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes ); GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes );
if ( !CORBA::is_nil( aSelectedObject ) && aRes ) { if ( !CORBA::is_nil( aSelectedObject ) && aRes ) {
QString aName = GEOMBase::GetName( aSelectedObject ); QString aName = GEOMBase::GetName( aSelectedObject );
TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
if ( myEditCurrentArgument == GroupFaces->LineEdit1 ||
myEditCurrentArgument == GroupFaces->LineEdit2 )
aNeedType = TopAbs_FACE;
TopoDS_Shape aShape; TopoDS_Shape aShape;
if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) { if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) {
TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
if ( myEditCurrentArgument == GroupFaces->LineEdit1 ||
myEditCurrentArgument == GroupFaces->LineEdit2 )
aNeedType = TopAbs_FACE;
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
TColStd_IndexedMapOfInteger aMap; TColStd_IndexedMapOfInteger aMap;
aSelMgr->GetIndexes( firstIObject(), aMap ); aSelMgr->GetIndexes( firstIObject(), aMap );
@ -283,24 +290,31 @@ void BasicGUI_LineDlg::SelectionIntoArgument()
myEditCurrentArgument->setText( aName ); myEditCurrentArgument->setText( aName );
if (!aSelectedObject->_is_nil()) { // clear selection if something selected
globalSelection();
localSelection( GEOM::GEOM_Object::_nil(), aNeedType );
}
if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) { if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {
myPoint1 = aSelectedObject; myPoint1 = aSelectedObject;
if ( !myPoint1->_is_nil() && myPoint2->_is_nil() ) { if ( !myPoint1->_is_nil() && myPoint2->_is_nil() )
globalSelection(); // close local selection to clear it GroupPoints->PushButton2->click();
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
GroupPoints->PushButton2->click();
}
} }
else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) { else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) {
myPoint2 = aSelectedObject; myPoint2 = aSelectedObject;
if ( !myPoint2->_is_nil() && myPoint1->_is_nil() ) { if ( !myPoint2->_is_nil() && myPoint1->_is_nil() )
globalSelection(); // close local selection to clear it GroupPoints->PushButton1->click();
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); }
GroupPoints->PushButton1->click(); else if ( myEditCurrentArgument == GroupFaces->LineEdit1 ) {
} myFace1 = aSelectedObject;
if ( !myFace1->_is_nil() && myFace2->_is_nil() )
GroupFaces->PushButton2->click();
}
else if ( myEditCurrentArgument == GroupFaces->LineEdit2 ) {
myFace2 = aSelectedObject;
if ( !myFace2->_is_nil() && myFace1->_is_nil() )
GroupFaces->PushButton1->click();
} }
else if ( myEditCurrentArgument == GroupFaces->LineEdit1 ) myFace1 = aSelectedObject;
else if ( myEditCurrentArgument == GroupFaces->LineEdit2 ) myFace2 = aSelectedObject;
} }
displayPreview(); displayPreview();
@ -315,24 +329,36 @@ void BasicGUI_LineDlg::SetEditCurrentArgument()
{ {
if ( IObjectCount() != 0 ) { if ( IObjectCount() != 0 ) {
globalSelection(); // close local selection to clear it globalSelection(); // close local selection to clear it
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
if ( myEditCurrentArgument == GroupFaces->LineEdit1 || myEditCurrentArgument == GroupFaces->LineEdit2 )
aNeedType = TopAbs_FACE;
localSelection( GEOM::GEOM_Object::_nil(), aNeedType );
} }
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);
GroupPoints->LineEdit1->setEnabled(true);
GroupPoints->LineEdit2->setEnabled(false);
} }
else if ( send == GroupPoints->PushButton2 ) { else if ( send == GroupPoints->PushButton2 ) {
myEditCurrentArgument = GroupPoints->LineEdit2; myEditCurrentArgument = GroupPoints->LineEdit2;
GroupPoints->PushButton1->setDown(false); GroupPoints->PushButton1->setDown(false);
GroupPoints->LineEdit1->setEnabled(false);
GroupPoints->LineEdit2->setEnabled(true);
} }
else if ( send == GroupFaces->PushButton1 ) { else if ( send == GroupFaces->PushButton1 ) {
myEditCurrentArgument = GroupFaces->LineEdit1; myEditCurrentArgument = GroupFaces->LineEdit1;
GroupFaces->PushButton2->setDown(false); GroupFaces->PushButton2->setDown(false);
GroupFaces->LineEdit1->setEnabled(true);
GroupFaces->LineEdit2->setEnabled(false);
} }
else if ( send == GroupFaces->PushButton2 ) { else if ( send == GroupFaces->PushButton2 ) {
myEditCurrentArgument = GroupFaces->LineEdit2; myEditCurrentArgument = GroupFaces->LineEdit2;
GroupFaces->PushButton1->setDown(false); GroupFaces->PushButton1->setDown(false);
GroupFaces->LineEdit1->setEnabled(false);
GroupFaces->LineEdit2->setEnabled(true);
} }
myEditCurrentArgument->setFocus(); myEditCurrentArgument->setFocus();
// SelectionIntoArgument(); // SelectionIntoArgument();

View File

@ -71,6 +71,8 @@ OperationGUI_PartitionDlg::OperationGUI_PartitionDlg( GeometryGUI* theGeometryGU
GroupPoints->PushButton2->setIcon( image2 ); GroupPoints->PushButton2->setIcon( image2 );
GroupPoints->LineEdit1->setReadOnly( true ); GroupPoints->LineEdit1->setReadOnly( true );
GroupPoints->LineEdit2->setReadOnly( true ); GroupPoints->LineEdit2->setReadOnly( true );
GroupPoints->LineEdit1->setEnabled(true);
GroupPoints->LineEdit2->setEnabled(false);
GroupPoints->CheckButton1->setText( tr( "GEOM_KEEP_NONLIMIT_SHAPES" ) ); GroupPoints->CheckButton1->setText( tr( "GEOM_KEEP_NONLIMIT_SHAPES" ) );
QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
@ -141,6 +143,7 @@ void OperationGUI_PartitionDlg::Init()
initName( tr( "GEOM_PARTITION" ) ); initName( tr( "GEOM_PARTITION" ) );
ConstructorsClicked( 0 ); ConstructorsClicked( 0 );
GroupPoints->PushButton1->click();
} }
@ -167,6 +170,10 @@ void OperationGUI_PartitionDlg::ConstructorsClicked( int constructorId )
GroupPoints->ComboBox1->show(); GroupPoints->ComboBox1->show();
GroupPoints->ComboBox1->setCurrentIndex( 0 ); GroupPoints->ComboBox1->setCurrentIndex( 0 );
GroupPoints->CheckButton1->show(); GroupPoints->CheckButton1->show();
GroupPoints->PushButton1->setDown( true );
GroupPoints->PushButton2->setDown( false );
GroupPoints->LineEdit1->setEnabled(true);
GroupPoints->LineEdit2->setEnabled(false);
break; break;
case 1: /*Half-space partition */ case 1: /*Half-space partition */
GroupPoints->GroupBox1->setTitle( tr( "GEOM_PARTITION_HALFSPACE" ) ); GroupPoints->GroupBox1->setTitle( tr( "GEOM_PARTITION_HALFSPACE" ) );
@ -174,6 +181,8 @@ void OperationGUI_PartitionDlg::ConstructorsClicked( int constructorId )
GroupPoints->ComboBox1->hide(); GroupPoints->ComboBox1->hide();
GroupPoints->TextLabel2->setText( tr( "GEOM_PLANE" ) ); GroupPoints->TextLabel2->setText( tr( "GEOM_PLANE" ) );
GroupPoints->CheckButton1->hide(); GroupPoints->CheckButton1->hide();
GroupPoints->PushButton1->setDown( true );
GroupPoints->LineEdit1->setEnabled(true);
break; break;
} }
@ -270,10 +279,17 @@ 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->LineEdit1->setEnabled(true);
GroupPoints->LineEdit2->setEnabled(false);
}
else if ( send == GroupPoints->PushButton2 ) { else if ( send == GroupPoints->PushButton2 ) {
myEditCurrentArgument = GroupPoints->LineEdit2; myEditCurrentArgument = GroupPoints->LineEdit2;
GroupPoints->PushButton1->setDown(false);
GroupPoints->LineEdit1->setEnabled(false);
GroupPoints->LineEdit2->setEnabled(true);
if ( getConstructorId() == 1 ) if ( getConstructorId() == 1 )
globalSelection( GEOM_PLANE ); globalSelection( GEOM_PLANE );
} }
@ -282,6 +298,7 @@ void OperationGUI_PartitionDlg::SetEditCurrentArgument()
myEditCurrentArgument->setFocus(); myEditCurrentArgument->setFocus();
SelectionIntoArgument(); SelectionIntoArgument();
send->setDown(true);
} }