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

@ -17,7 +17,7 @@
// 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,7 +49,9 @@
#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
@ -220,7 +222,7 @@ void BasicGUI_PointDlg::Init()
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") );
@ -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();
} }
} }