From: asl Date: Thu, 7 Jul 2005 11:33:32 +0000 (+0000) Subject: full checking of geom selection X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=aba480e0e8ed82ae7c4eec9a1858146c7e491625;p=modules%2Fsmesh.git full checking of geom selection --- diff --git a/src/SMESHGUI/SMESHGUI_InitMeshDlg.cxx b/src/SMESHGUI/SMESHGUI_InitMeshDlg.cxx index 95545e4a2..c70984a64 100644 --- a/src/SMESHGUI/SMESHGUI_InitMeshDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_InitMeshDlg.cxx @@ -57,7 +57,7 @@ SMESHGUI_InitMeshDlg::SMESHGUI_InitMeshDlg( SMESHGUI* theModule ) GroupC1->layout()->setSpacing(6); GroupC1->layout()->setMargin(11); - myMeshNameLabel = new QLabel(tr("SMESH_NAME"), GroupC1, "TextLabel_NameMesh"); + new QLabel(tr("SMESH_NAME"), GroupC1, "TextLabel_NameMesh"); GroupC1->addSpace(1); myMeshName = new QLineEdit(GroupC1, "LineEdit_NameMesh"); @@ -72,8 +72,6 @@ SMESHGUI_InitMeshDlg::SMESHGUI_InitMeshDlg( SMESHGUI* theModule ) setObjectType( Algo, _smesh + ALGORITHM, -1 ); main->addWidget( GroupC1 ); - - updateControlState(); } //================================================================================= diff --git a/src/SMESHGUI/SMESHGUI_InitMeshDlg.h b/src/SMESHGUI/SMESHGUI_InitMeshDlg.h index bf8cde064..32ceba56e 100644 --- a/src/SMESHGUI/SMESHGUI_InitMeshDlg.h +++ b/src/SMESHGUI/SMESHGUI_InitMeshDlg.h @@ -52,7 +52,6 @@ public: QString meshName() const; private: - QLabel* myMeshNameLabel; QLineEdit* myMeshName; }; diff --git a/src/SMESHGUI/SMESHGUI_InitMeshOp.cxx b/src/SMESHGUI/SMESHGUI_InitMeshOp.cxx index 7a062119b..064d8174d 100644 --- a/src/SMESHGUI/SMESHGUI_InitMeshOp.cxx +++ b/src/SMESHGUI/SMESHGUI_InitMeshOp.cxx @@ -43,9 +43,12 @@ #include #include +#include #include +#include + //================================================================================= // function : Constructor // purpose : @@ -107,7 +110,6 @@ void SMESHGUI_InitMeshOp::startOperation() myHypothesisFilter = new SMESH_TypeFilter (HYPOTHESIS); init(); - myDlg->clearSelection(); myDlg->show(); } @@ -230,10 +232,9 @@ bool SMESHGUI_InitMeshOp::onApply() } } } - // commit transaction - //update( UF_Model | UF_ObjBrowser ); - module()->updateObjBrowser( true, 0 ); + update( UF_Model | UF_ObjBrowser ); + init(); return true; } @@ -264,7 +265,11 @@ QString SMESHGUI_InitMeshOp::defaultMeshName() const void SMESHGUI_InitMeshOp::init() { if( myDlg ) + { myDlg->setMeshName( defaultMeshName() ); + myDlg->clearSelection(); + myDlg->updateControlState(); + } } //================================================================================= @@ -295,3 +300,24 @@ SMESH::SMESH_Mesh_var SMESHGUI_InitMeshOp::initMesh ( GEOM::GEOM_Object_ptr theS return aMesh._retn(); } + +//================================================================================= +// function : defaultMeshName() +// purpose : +//================================================================================= +void SMESHGUI_InitMeshOp::onSelectionChanged( int id ) +{ + if( !myDlg->hasSelection( id ) ) + return; + + if( id==SMESHGUI_InitMeshDlg::GeomObj ) + { + QStringList selGeom; + myDlg->selectedObject( SMESHGUI_InitMeshDlg::GeomObj, selGeom ); + + _PTR(SObject) aGeomSO = studyDS()->FindObjectID( selGeom.first() ); + GEOM::GEOM_Object_var myGeomShape = GEOM::GEOM_Object::_narrow( _CAST(SObject,aGeomSO)->GetObject() ); + if( myGeomShape->_is_nil() || !GEOMBase::IsShape( myGeomShape ) ) + myDlg->clearSelection( id ); + } +} diff --git a/src/SMESHGUI/SMESHGUI_InitMeshOp.h b/src/SMESHGUI/SMESHGUI_InitMeshOp.h index ee4141cea..27ce68d1a 100644 --- a/src/SMESHGUI/SMESHGUI_InitMeshOp.h +++ b/src/SMESHGUI/SMESHGUI_InitMeshOp.h @@ -65,6 +65,7 @@ protected slots: private slots: void onActivateObject( int ); + void onSelectionChanged( int ); private: SMESHGUI_InitMeshDlg *myDlg;