Fix pb with point on edges intersection.

This commit is contained in:
jfa 2010-01-28 08:56:39 +00:00
parent 0f8fc7e029
commit 1a69b23185

View File

@ -19,10 +19,10 @@
// //
// 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 : BasicGUI_PointDlg.cxx // File : BasicGUI_PointDlg.cxx
// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. // Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
//
#include "BasicGUI_PointDlg.h" #include "BasicGUI_PointDlg.h"
#include <SUIT_ResourceMgr.h> #include <SUIT_ResourceMgr.h>
@ -64,7 +64,7 @@
//================================================================================= //=================================================================================
// class : BasicGUI_PointDlg() // class : BasicGUI_PointDlg()
// purpose : Constructs a BasicGUI_PointDlg which is a child of 'parent', with the // purpose : Constructs a BasicGUI_PointDlg 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.
@ -171,13 +171,13 @@ BasicGUI_PointDlg::BasicGUI_PointDlg( GeometryGUI* theGeometryGUI, QWidget* pare
myZ->setEnabled( false ); myZ->setEnabled( false );
QPalette aPal = myX->palette(); QPalette aPal = myX->palette();
aPal.setColor( QPalette::Disabled, QPalette::Text, QColor( 0, 0, 0 ) ) ; aPal.setColor( QPalette::Disabled, QPalette::Text, QColor( 0, 0, 0 ) );
myX->setPalette( aPal ); myX->setPalette( aPal );
myY->setPalette( aPal ); myY->setPalette( aPal );
myZ->setPalette( aPal ); myZ->setPalette( aPal );
setHelpFileName( "create_point_page.html" ); setHelpFileName( "create_point_page.html" );
Init(); Init();
} }
@ -213,7 +213,7 @@ void BasicGUI_PointDlg::Init()
/* Get setting of step value from file configuration */ /* Get setting of step value from file configuration */
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100 ); double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100 );
/* min, max, step and decimals for spin boxes */ /* min, max, step and decimals for spin boxes */
initSpinBox( GroupXYZ->SpinBox_DX, COORD_MIN, COORD_MAX, step, 6 ); // VSR: TODO: DBL_DIGITS_DISPLAY initSpinBox( GroupXYZ->SpinBox_DX, COORD_MIN, COORD_MAX, step, 6 ); // VSR: TODO: DBL_DIGITS_DISPLAY
initSpinBox( GroupXYZ->SpinBox_DY, COORD_MIN, COORD_MAX, step, 6 ); // VSR: TODO: DBL_DIGITS_DISPLAY initSpinBox( GroupXYZ->SpinBox_DY, COORD_MIN, COORD_MAX, step, 6 ); // VSR: TODO: DBL_DIGITS_DISPLAY
@ -248,7 +248,6 @@ void BasicGUI_PointDlg::Init()
connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) ); connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );
connect( myParamCoord->button( PARAM_VALUE ), SIGNAL( clicked() ), this, SLOT( ClickParamCoord() ) ); connect( myParamCoord->button( PARAM_VALUE ), SIGNAL( clicked() ), this, SLOT( ClickParamCoord() ) );
connect( myParamCoord->button( COORD_VALUE ), SIGNAL( clicked() ), this, SLOT( ClickParamCoord() ) ); connect( myParamCoord->button( COORD_VALUE ), SIGNAL( clicked() ), this, SLOT( ClickParamCoord() ) );
connect( GroupOnCurve->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); connect( GroupOnCurve->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
@ -277,9 +276,8 @@ void BasicGUI_PointDlg::Init()
connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged() ), connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged() ),
this, SLOT(SelectionIntoArgument() ) ); this, SLOT(SelectionIntoArgument() ) );
initName( tr( "GEOM_VERTEX" ) ); initName( tr( "GEOM_VERTEX" ) );
ConstructorsClicked( 0 ); ConstructorsClicked( 0 );
} }
@ -306,14 +304,14 @@ void BasicGUI_PointDlg::SetDoubleSpinBoxStep( double step )
// purpose : Radio button management // purpose : Radio button management
//================================================================================= //=================================================================================
void BasicGUI_PointDlg::ConstructorsClicked(int constructorId) void BasicGUI_PointDlg::ConstructorsClicked(int constructorId)
{ {
globalSelection(); // close local contexts, if any globalSelection(); // close local contexts, if any
switch ( constructorId ) { switch ( constructorId ) {
case GEOM_POINT_XYZ: case GEOM_POINT_XYZ:
{ {
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
GroupRefPoint->hide(); GroupRefPoint->hide();
GroupOnCurve->hide(); GroupOnCurve->hide();
GroupLineIntersection->hide(); GroupLineIntersection->hide();
@ -331,18 +329,18 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId)
myEditCurrentArgument = GroupRefPoint->LineEdit1; myEditCurrentArgument = GroupRefPoint->LineEdit1;
myEditCurrentArgument->setText( "" ); myEditCurrentArgument->setText( "" );
myRefPoint = GEOM::GEOM_Object::_nil(); myRefPoint = GEOM::GEOM_Object::_nil();
GroupRefPoint->PushButton1->setDown(true); GroupRefPoint->PushButton1->setDown(true);
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
myParamCoord->button( PARAM_VALUE )->hide(); myParamCoord->button( PARAM_VALUE )->hide();
myParamCoord->button( COORD_VALUE )->hide(); myParamCoord->button( COORD_VALUE )->hide();
GroupXYZ->hide(); GroupXYZ->hide();
GroupOnCurve->hide(); GroupOnCurve->hide();
GroupLineIntersection->hide(); GroupLineIntersection->hide();
GroupOnSurface->hide(); GroupOnSurface->hide();
GroupRefPoint->show(); GroupRefPoint->show();
myCoordGrp->show(); myCoordGrp->show();
break; break;
} }
@ -445,7 +443,7 @@ bool BasicGUI_PointDlg::ClickOnApply()
{ {
if ( !onAccept() ) if ( !onAccept() )
return false; return false;
initName(); initName();
ConstructorsClicked( getConstructorId() ); ConstructorsClicked( getConstructorId() );
return true; return true;
@ -498,7 +496,7 @@ void BasicGUI_PointDlg::SelectionIntoArgument()
//Find SubShape Object in Father //Find SubShape Object in Father
GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName); GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
GEOM::GEOM_IShapesOperations_var aShapesOp = GEOM::GEOM_IShapesOperations_var aShapesOp =
getGeomEngine()->GetIShapesOperations(getStudyId()); getGeomEngine()->GetIShapesOperations(getStudyId());
@ -557,7 +555,7 @@ void BasicGUI_PointDlg::SelectionIntoArgument()
} }
} }
} }
displayPreview(); displayPreview();
} }
@ -569,9 +567,9 @@ void BasicGUI_PointDlg::SelectionIntoArgument()
void BasicGUI_PointDlg::LineEditReturnPressed() void BasicGUI_PointDlg::LineEditReturnPressed()
{ {
QLineEdit* send = (QLineEdit*)sender(); QLineEdit* send = (QLineEdit*)sender();
if ( send == GroupRefPoint->LineEdit1 || if ( send == GroupRefPoint->LineEdit1 ||
send == GroupOnCurve->LineEdit1 || send == GroupOnCurve->LineEdit1 ||
send == GroupLineIntersection->LineEdit1 || send == GroupLineIntersection->LineEdit1 ||
send == GroupLineIntersection->LineEdit2 ) { send == GroupLineIntersection->LineEdit2 ) {
myEditCurrentArgument = send; myEditCurrentArgument = send;
GEOMBase_Skeleton::LineEditReturnPressed(); GEOMBase_Skeleton::LineEditReturnPressed();
@ -592,13 +590,13 @@ void BasicGUI_PointDlg::SetEditCurrentArgument()
if ( send == GroupRefPoint->PushButton1 ) { if ( send == GroupRefPoint->PushButton1 ) {
GroupRefPoint->LineEdit1->setFocus(); GroupRefPoint->LineEdit1->setFocus();
myEditCurrentArgument = GroupRefPoint->LineEdit1; myEditCurrentArgument = GroupRefPoint->LineEdit1;
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
} }
else if ( send == GroupOnCurve->PushButton1 ) { else if ( send == GroupOnCurve->PushButton1 ) {
GroupOnCurve->LineEdit1->setFocus(); GroupOnCurve->LineEdit1->setFocus();
myEditCurrentArgument = GroupOnCurve->LineEdit1; myEditCurrentArgument = GroupOnCurve->LineEdit1;
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
} }
else if ( send == GroupOnSurface->PushButton1 ) else if ( send == GroupOnSurface->PushButton1 )
@ -775,7 +773,6 @@ bool BasicGUI_PointDlg::isValid( QString& msg )
ok = GroupXYZ->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok; ok = GroupXYZ->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok;
} }
return !myFace->_is_nil() && ok; return !myFace->_is_nil() && ok;
} }
return false; return false;
} }
@ -803,7 +800,7 @@ bool BasicGUI_PointDlg::execute( ObjectList& objects )
aParameters << GroupXYZ->SpinBox_DX->text(); aParameters << GroupXYZ->SpinBox_DX->text();
aParameters << GroupXYZ->SpinBox_DY->text(); aParameters << GroupXYZ->SpinBox_DY->text();
aParameters << GroupXYZ->SpinBox_DZ->text(); aParameters << GroupXYZ->SpinBox_DZ->text();
anObj = anOper->MakePointXYZ( x, y, z ); anObj = anOper->MakePointXYZ( x, y, z );
res = true; res = true;
break; break;
@ -817,7 +814,7 @@ bool BasicGUI_PointDlg::execute( ObjectList& objects )
aParameters << GroupRefPoint->SpinBox_DX->text(); aParameters << GroupRefPoint->SpinBox_DX->text();
aParameters << GroupRefPoint->SpinBox_DY->text(); aParameters << GroupRefPoint->SpinBox_DY->text();
aParameters << GroupRefPoint->SpinBox_DZ->text(); aParameters << GroupRefPoint->SpinBox_DZ->text();
anObj = anOper->MakePointWithReference( myRefPoint, dx, dy, dz ); anObj = anOper->MakePointWithReference( myRefPoint, dx, dy, dz );
res = true; res = true;
break; break;
@ -831,18 +828,18 @@ bool BasicGUI_PointDlg::execute( ObjectList& objects )
double x = GroupXYZ->SpinBox_DX->value(); double x = GroupXYZ->SpinBox_DX->value();
double y = GroupXYZ->SpinBox_DY->value(); double y = GroupXYZ->SpinBox_DY->value();
double z = GroupXYZ->SpinBox_DZ->value(); double z = GroupXYZ->SpinBox_DZ->value();
aParameters << GroupXYZ->SpinBox_DX->text(); aParameters << GroupXYZ->SpinBox_DX->text();
aParameters << GroupXYZ->SpinBox_DY->text(); aParameters << GroupXYZ->SpinBox_DY->text();
aParameters << GroupXYZ->SpinBox_DZ->text(); aParameters << GroupXYZ->SpinBox_DZ->text();
anObj = anOper->MakePointOnCurveByCoord( myEdge, x, y, z ); anObj = anOper->MakePointOnCurveByCoord( myEdge, x, y, z );
} }
res = true; res = true;
break; break;
} }
case GEOM_POINT_INTINT : case GEOM_POINT_INTINT :
anOper->MakePointOnLinesIntersection( myLine1, myLine2 ); anObj = anOper->MakePointOnLinesIntersection( myLine1, myLine2 );
res = true; res = true;
break; break;
case GEOM_POINT_SURF : case GEOM_POINT_SURF :
@ -855,26 +852,25 @@ bool BasicGUI_PointDlg::execute( ObjectList& objects )
double x = GroupXYZ->SpinBox_DX->value(); double x = GroupXYZ->SpinBox_DX->value();
double y = GroupXYZ->SpinBox_DY->value(); double y = GroupXYZ->SpinBox_DY->value();
double z = GroupXYZ->SpinBox_DZ->value(); double z = GroupXYZ->SpinBox_DZ->value();
aParameters << GroupXYZ->SpinBox_DX->text(); aParameters << GroupXYZ->SpinBox_DX->text();
aParameters << GroupXYZ->SpinBox_DY->text(); aParameters << GroupXYZ->SpinBox_DY->text();
aParameters << GroupXYZ->SpinBox_DZ->text(); aParameters << GroupXYZ->SpinBox_DZ->text();
anObj = anOper->MakePointOnSurfaceByCoord( myFace, x, y, z ); anObj = anOper->MakePointOnSurfaceByCoord( myFace, x, y, z );
} }
res = true; res = true;
break; break;
} }
} }
const int id = getConstructorId(); const int id = getConstructorId();
if(!anObj->_is_nil() && !IsPreview() && (id == GEOM_POINT_XYZ || if(!anObj->_is_nil() && !IsPreview() && (id == GEOM_POINT_XYZ ||
id == GEOM_POINT_REF || id == GEOM_POINT_REF ||
id == GEOM_POINT_EDGE || id == GEOM_POINT_EDGE ||
id == GEOM_POINT_SURF) ) { id == GEOM_POINT_SURF) ) {
anObj->SetParameters(aParameters.join(":").toLatin1().constData()); anObj->SetParameters(aParameters.join(":").toLatin1().constData());
} }
if ( id == GEOM_POINT_REF || id == GEOM_POINT_EDGE || id == GEOM_POINT_SURF ) { if ( id == GEOM_POINT_REF || id == GEOM_POINT_EDGE || id == GEOM_POINT_SURF ) {
TopoDS_Shape aShape; TopoDS_Shape aShape;
@ -891,11 +887,11 @@ bool BasicGUI_PointDlg::execute( ObjectList& objects )
myZ->setText( "" ); myZ->setText( "" );
} }
} }
if ( !anObj->_is_nil() ) { if ( !anObj->_is_nil() ) {
objects.push_back( anObj._retn() ); objects.push_back( anObj._retn() );
} }
return res; return res;
} }
@ -945,7 +941,7 @@ void BasicGUI_PointDlg::updateParamCoord(bool theIsUpdate)
{ {
bool isParam = myParamCoord->checkedId() == PARAM_VALUE; bool isParam = myParamCoord->checkedId() == PARAM_VALUE;
GroupXYZ->setShown( !isParam ); GroupXYZ->setShown( !isParam );
const int id = getConstructorId(); const int id = getConstructorId();
if ( id == GEOM_POINT_EDGE ) { if ( id == GEOM_POINT_EDGE ) {
GroupOnCurve->TextLabel2->setShown( isParam ); GroupOnCurve->TextLabel2->setShown( isParam );