NPAL18362: EDF634: SIGSEV when we try to create a point and when a geom object is selected.

This commit is contained in:
jfa 2007-12-18 12:21:12 +00:00
parent 771241721f
commit 19a2c21851

View File

@ -10,14 +10,14 @@
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details. // Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public // You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// 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
// //
// //
// //
@ -49,10 +49,12 @@
#include <TopTools_IndexedMapOfShape.hxx> #include <TopTools_IndexedMapOfShape.hxx>
#include <qapplication.h> #include <qapplication.h>
using namespace std; using namespace std;
//================================================================================= //=================================================================================
// 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.
@ -107,7 +109,7 @@ BasicGUI_PointDlg::BasicGUI_PointDlg(GeometryGUI* theGeometryGUI, QWidget* paren
GroupLineIntersection->PushButton1->setPixmap(image2); GroupLineIntersection->PushButton1->setPixmap(image2);
GroupLineIntersection->TextLabel2->setText(tr("GEOM_LINE2")); GroupLineIntersection->TextLabel2->setText(tr("GEOM_LINE2"));
GroupLineIntersection->PushButton2->setPixmap(image2); GroupLineIntersection->PushButton2->setPixmap(image2);
Layout1->addWidget( aFrame, 2, 0 ); Layout1->addWidget( aFrame, 2, 0 );
/***************************************************************/ /***************************************************************/
@ -134,7 +136,7 @@ BasicGUI_PointDlg::BasicGUI_PointDlg(GeometryGUI* theGeometryGUI, QWidget* paren
myZ->setPalette( aPal ); myZ->setPalette( aPal );
setHelpFileName("point.htm"); setHelpFileName("point.htm");
Init(); Init();
} }
@ -167,7 +169,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 */
GroupXYZ->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); GroupXYZ->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY);
GroupXYZ->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); GroupXYZ->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY);
@ -219,11 +221,11 @@ void BasicGUI_PointDlg::Init()
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupRefPoint->SpinBox_DY, SLOT(SetStep(double))); connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupRefPoint->SpinBox_DY, SLOT(SetStep(double)));
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupRefPoint->SpinBox_DZ, SLOT(SetStep(double))); connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupRefPoint->SpinBox_DZ, SLOT(SetStep(double)));
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
initName( tr("GEOM_VERTEX") ); initName( tr("GEOM_VERTEX") );
ConstructorsClicked( 0 ); ConstructorsClicked( 0 );
} }
@ -233,7 +235,7 @@ void BasicGUI_PointDlg::Init()
// purpose : Radio button management // purpose : Radio button management
//================================================================================= //=================================================================================
void BasicGUI_PointDlg::ConstructorsClicked(int constructorId) void BasicGUI_PointDlg::ConstructorsClicked(int constructorId)
{ {
switch ( constructorId ) switch ( constructorId )
{ {
case 0: case 0:
@ -258,7 +260,7 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId)
GroupXYZ->hide(); GroupXYZ->hide();
GroupOnCurve->hide(); GroupOnCurve->hide();
GroupRefPoint->show(); GroupRefPoint->show();
GroupLineIntersection->hide(); GroupLineIntersection->hide();
myCoordGrp->show(); myCoordGrp->show();
break; break;
} }
@ -273,12 +275,12 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId)
GroupXYZ->hide(); GroupXYZ->hide();
GroupRefPoint->hide(); GroupRefPoint->hide();
GroupOnCurve->show(); GroupOnCurve->show();
GroupLineIntersection->hide(); GroupLineIntersection->hide();
myCoordGrp->show(); myCoordGrp->show();
break; break;
} }
case 3: case 3:
{ {
myEditCurrentArgument = GroupLineIntersection->LineEdit1; myEditCurrentArgument = GroupLineIntersection->LineEdit1;
GroupLineIntersection->LineEdit1->setText(""); GroupLineIntersection->LineEdit1->setText("");
GroupLineIntersection->LineEdit2->setText(""); GroupLineIntersection->LineEdit2->setText("");
@ -290,7 +292,7 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId)
GroupXYZ->hide(); GroupXYZ->hide();
GroupRefPoint->hide(); GroupRefPoint->hide();
GroupOnCurve->hide(); GroupOnCurve->hide();
GroupLineIntersection->show(); GroupLineIntersection->show();
myCoordGrp->hide(); myCoordGrp->hide();
break; break;
} }
@ -327,7 +329,7 @@ bool BasicGUI_PointDlg::ClickOnApply()
{ {
if ( !onAccept() ) if ( !onAccept() )
return false; return false;
initName(); initName();
ConstructorsClicked( getConstructorId() ); ConstructorsClicked( getConstructorId() );
return true; return true;
@ -369,29 +371,27 @@ void BasicGUI_PointDlg::SelectionIntoArgument()
QString aName = GEOMBase::GetName( aSelectedObject ); QString aName = GEOMBase::GetName( aSelectedObject );
if ( !CORBA::is_nil( aSelectedObject ) && aRes ) if ( !CORBA::is_nil( aSelectedObject ) && aRes )
{ {
myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
TopoDS_Shape aShape; TopoDS_Shape aShape;
if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
{ {
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 );
if ( aMap.Extent() == 1 ) if ( aMap.Extent() == 1 )
{ {
GEOM::GEOM_IShapesOperations_var aShapesOp = GEOM::GEOM_IShapesOperations_var aShapesOp =
getGeomEngine()->GetIShapesOperations( getStudyId() ); getGeomEngine()->GetIShapesOperations( getStudyId() );
int anIndex = aMap( 1 ); int anIndex = aMap( 1 );
TopTools_IndexedMapOfShape aShapes; TopTools_IndexedMapOfShape aShapes;
TopExp::MapShapes( aShape, aShapes ); TopExp::MapShapes( aShape, aShapes );
aShape = aShapes.FindKey( anIndex ); aShape = aShapes.FindKey( anIndex );
aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
aSelMgr->clearSelected(); }
} }
}
if ( id == 0 ) if ( id == 0 )
{ {
if ( aShape.IsNull() || aShape.ShapeType() != TopAbs_VERTEX ) if ( aShape.IsNull() || aShape.ShapeType() != TopAbs_VERTEX )
return; return;
gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) ); gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) );
GroupXYZ->SpinBox_DX->SetValue( aPnt.X() ); GroupXYZ->SpinBox_DX->SetValue( aPnt.X() );
@ -410,14 +410,14 @@ void BasicGUI_PointDlg::SelectionIntoArgument()
} }
else if ( id == 3 ) else if ( id == 3 )
{ {
if (myEditCurrentArgument == GroupLineIntersection->LineEdit1) { if (myEditCurrentArgument == GroupLineIntersection->LineEdit1) {
myLine1 = aSelectedObject; myLine1 = aSelectedObject;
GroupLineIntersection->LineEdit1->setText( aName ); GroupLineIntersection->LineEdit1->setText( aName );
} }
else if (myEditCurrentArgument == GroupLineIntersection->LineEdit2) { else if (myEditCurrentArgument == GroupLineIntersection->LineEdit2) {
myLine2 = aSelectedObject; myLine2 = aSelectedObject;
GroupLineIntersection->LineEdit2->setText( aName ); GroupLineIntersection->LineEdit2->setText( aName );
} }
} }
} }
} }
@ -435,10 +435,10 @@ void BasicGUI_PointDlg::LineEditReturnPressed()
QLineEdit* send = (QLineEdit*)sender(); QLineEdit* send = (QLineEdit*)sender();
if ( send == GroupRefPoint->LineEdit1 || send == GroupOnCurve->LineEdit1 || if ( send == GroupRefPoint->LineEdit1 || send == GroupOnCurve->LineEdit1 ||
send == GroupLineIntersection->LineEdit1 || send == GroupLineIntersection->LineEdit2 ) send == GroupLineIntersection->LineEdit1 || send == GroupLineIntersection->LineEdit2 )
{ {
myEditCurrentArgument = send; myEditCurrentArgument = send;
GEOMBase_Skeleton::LineEditReturnPressed(); GEOMBase_Skeleton::LineEditReturnPressed();
} }
} }
@ -454,28 +454,28 @@ void BasicGUI_PointDlg::SetEditCurrentArgument()
{ {
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 == GroupLineIntersection->PushButton1 ) else if ( send == GroupLineIntersection->PushButton1 )
{ {
GroupLineIntersection->LineEdit1->setFocus(); GroupLineIntersection->LineEdit1->setFocus();
myEditCurrentArgument = GroupLineIntersection->LineEdit1; myEditCurrentArgument = GroupLineIntersection->LineEdit1;
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
} }
else if ( send == GroupLineIntersection->PushButton2 ) else if ( send == GroupLineIntersection->PushButton2 )
{ {
GroupLineIntersection->LineEdit2->setFocus(); GroupLineIntersection->LineEdit2->setFocus();
myEditCurrentArgument = GroupLineIntersection->LineEdit2; myEditCurrentArgument = GroupLineIntersection->LineEdit2;
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
} }
} }
@ -592,7 +592,7 @@ bool BasicGUI_PointDlg::execute( ObjectList& objects )
double x = GroupXYZ->SpinBox_DX->GetValue(); double x = GroupXYZ->SpinBox_DX->GetValue();
double y = GroupXYZ->SpinBox_DY->GetValue(); double y = GroupXYZ->SpinBox_DY->GetValue();
double z = GroupXYZ->SpinBox_DZ->GetValue(); double z = GroupXYZ->SpinBox_DZ->GetValue();
anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->MakePointXYZ( x,y,z ); anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->MakePointXYZ( x,y,z );
res = true; res = true;
break; break;
@ -602,7 +602,7 @@ bool BasicGUI_PointDlg::execute( ObjectList& objects )
double dx = GroupRefPoint->SpinBox_DX->GetValue(); double dx = GroupRefPoint->SpinBox_DX->GetValue();
double dy = GroupRefPoint->SpinBox_DY->GetValue(); double dy = GroupRefPoint->SpinBox_DY->GetValue();
double dz = GroupRefPoint->SpinBox_DZ->GetValue(); double dz = GroupRefPoint->SpinBox_DZ->GetValue();
anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )-> anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->
MakePointWithReference( myRefPoint, dx, dy, dz ); MakePointWithReference( myRefPoint, dx, dy, dz );
res = true; res = true;
@ -637,7 +637,7 @@ bool BasicGUI_PointDlg::execute( ObjectList& objects )
myZ->setText( "" ); myZ->setText( "" );
} }
} }
if ( !anObj->_is_nil() ) if ( !anObj->_is_nil() )
{ {
//printf( "--> a valid point is created\n" ); //printf( "--> a valid point is created\n" );