Back to index

salome-geom  6.5.0
BasicGUI_ArcDlg.cxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 // GEOM GEOMGUI : GUI for Geometry component
00024 // File   : BasicGUI_ArcDlg.cxx
00025 // Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
00026 //
00027 #include "BasicGUI_ArcDlg.h"
00028 
00029 #include <DlgRef.h>
00030 #include <GeometryGUI.h>
00031 #include <GEOMBase.h>
00032 
00033 #include <SUIT_ResourceMgr.h>
00034 #include <SUIT_Session.h>
00035 #include <SalomeApp_Application.h>
00036 #include <LightApp_SelectionMgr.h>
00037 
00038 #include <TColStd_IndexedMapOfInteger.hxx>
00039 #include <TopTools_IndexedMapOfShape.hxx>
00040 #include <TopoDS_Shape.hxx>
00041 #include <TopoDS_Edge.hxx>
00042 #include <TopoDS.hxx>
00043 #include <TopExp.hxx>
00044 
00045 #include <GEOMImpl_Types.hxx>
00046 
00047 //=================================================================================
00048 // class    : BasicGUI_ArcDlg()
00049 // purpose  : Constructs a BasicGUI_ArcDlg which is a child of 'parent', with the
00050 //            name 'name' and widget flags set to 'f'.
00051 //            The dialog will by default be modeless, unless you set 'modal' to
00052 //            TRUE to construct a modal dialog.
00053 //=================================================================================
00054 BasicGUI_ArcDlg::BasicGUI_ArcDlg( GeometryGUI* theGeometryGUI, QWidget* parent,
00055                                   bool modal, Qt::WindowFlags fl )
00056   : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl )
00057 {
00058   SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
00059   QPixmap image0( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_ARC" ) ) );
00060   QPixmap image1( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_ARC_CENTER" ) ) );
00061   QPixmap image2( aResMgr->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
00062   QPixmap image3( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_ARC_OF_ELLIPSE" ) ) );
00063 
00064   setWindowTitle( tr( "GEOM_ARC_TITLE" ) );
00065 
00066   /***************************************************************/
00067   mainFrame()->GroupConstructors->setTitle( tr( "GEOM_ARC" ) );
00068   mainFrame()->RadioButton1->setIcon( image0 );
00069   mainFrame()->RadioButton2->setIcon( image1 );
00070   mainFrame()->RadioButton3->setIcon( image3 );
00071 
00072   Group3Pnts = new DlgRef_3Sel( centralWidget() );
00073 
00074   Group3Pnts->GroupBox1->setTitle( tr( "GEOM_POINTS" ) );
00075   Group3Pnts->TextLabel1->setText( tr( "GEOM_POINT_I" ).arg( 1 ) );
00076   Group3Pnts->TextLabel2->setText( tr( "GEOM_POINT_I" ).arg( 2 ) );
00077   Group3Pnts->TextLabel3->setText( tr( "GEOM_POINT_I" ).arg( 3 ) );
00078 
00079   Group3Pnts->LineEdit1->setReadOnly( true );
00080   Group3Pnts->LineEdit2->setReadOnly( true );
00081   Group3Pnts->LineEdit3->setReadOnly( true );
00082 
00083   Group3Pnts->LineEdit1->setEnabled(true);
00084   Group3Pnts->LineEdit2->setEnabled(false);
00085   Group3Pnts->LineEdit3->setEnabled(false);
00086 
00087   Group3Pnts->PushButton1->setIcon(image2);
00088   Group3Pnts->PushButton2->setIcon(image2);
00089   Group3Pnts->PushButton3->setIcon(image2);
00090 
00091 
00092   Group3Pnts2 = new DlgRef_3Sel1Check( centralWidget() );
00093 
00094   Group3Pnts2->GroupBox1->setTitle( tr( "GEOM_POINTS" ) );
00095   Group3Pnts2->TextLabel1->setText( tr( "GEOM_CENTER_POINT" ) );
00096   Group3Pnts2->TextLabel2->setText( tr( "GEOM_POINT_I" ).arg( "Start" ) );
00097   Group3Pnts2->TextLabel3->setText( tr( "GEOM_POINT_I" ).arg( "End" ) );
00098 
00099   Group3Pnts2->LineEdit1->setReadOnly( true );
00100   Group3Pnts2->LineEdit2->setReadOnly( true );
00101   Group3Pnts2->LineEdit3->setReadOnly( true );
00102 
00103   Group3Pnts2->LineEdit1->setEnabled(true);
00104   Group3Pnts2->LineEdit2->setEnabled(false);
00105   Group3Pnts2->LineEdit3->setEnabled(false);
00106 
00107   Group3Pnts2->PushButton1->setIcon( image2 );
00108   Group3Pnts2->PushButton2->setIcon( image2 );
00109   Group3Pnts2->PushButton3->setIcon( image2 );
00110   
00111   Group3Pnts2->CheckButton1->setText( tr( "GEOM_REVERSE" ) );
00112 
00113   Group3Pnts3 = new DlgRef_3Sel( centralWidget() );
00114 
00115   Group3Pnts3->GroupBox1->setTitle( tr( "GEOM_POINTS" ) );
00116   Group3Pnts3->TextLabel1->setText( tr( "GEOM_CENTER_POINT" ) );
00117   Group3Pnts3->TextLabel2->setText( tr( "GEOM_POINT_I" ).arg( 1 ) );
00118   Group3Pnts3->TextLabel3->setText( tr( "GEOM_POINT_I" ).arg( 2 ) );
00119 
00120   Group3Pnts3->LineEdit1->setReadOnly( true );
00121   Group3Pnts3->LineEdit2->setReadOnly( true );
00122   Group3Pnts3->LineEdit3->setReadOnly( true );
00123 
00124   Group3Pnts3->LineEdit1->setEnabled(true);
00125   Group3Pnts3->LineEdit2->setEnabled(false);
00126   Group3Pnts3->LineEdit3->setEnabled(false);
00127 
00128   Group3Pnts3->PushButton1->setIcon(image2);
00129   Group3Pnts3->PushButton2->setIcon(image2);
00130   Group3Pnts3->PushButton3->setIcon(image2);
00131 
00132   QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
00133   layout->setMargin( 0 ); layout->setSpacing( 6 );
00134   layout->addWidget( Group3Pnts );
00135   layout->addWidget( Group3Pnts2 );
00136   layout->addWidget( Group3Pnts3 );
00137 
00138   setHelpFileName( "create_arc_page.html" );
00139 
00140   Init();
00141 }
00142 
00143 
00144 //=================================================================================
00145 // function : ~BasicGUI_ArcDlg()
00146 // purpose  : Destroys the object and frees any allocated resources
00147 //=================================================================================
00148 BasicGUI_ArcDlg::~BasicGUI_ArcDlg()
00149 {
00150 }
00151 
00152 
00153 //=================================================================================
00154 // function : Init()
00155 // purpose  :
00156 //=================================================================================
00157 void BasicGUI_ArcDlg::Init()
00158 {
00159   /* init variables */
00160   myEditCurrentArgument = Group3Pnts->LineEdit1;
00161 
00162   myPoint1.nullify();
00163   myPoint2.nullify();
00164   myPoint3.nullify();
00165   Group3Pnts2->CheckButton1->setChecked( false );
00166   Group3Pnts->PushButton1->setDown(true);
00167 
00168   /* signals and slots connections */
00169   connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) );
00170   connect( myGeomGUI, SIGNAL( SignalCloseAllDialogs() ),        this, SLOT( ClickOnCancel() ) );
00171  
00172   connect( this,           SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );
00173  
00174   connect( buttonOk(),     SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
00175   connect( buttonApply(),  SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
00176 
00177   connect( Group3Pnts->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
00178   connect( Group3Pnts->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
00179   connect( Group3Pnts->PushButton3, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
00180 
00181   connect( Group3Pnts2->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
00182   connect( Group3Pnts2->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
00183   connect( Group3Pnts2->PushButton3, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
00184 
00185   connect( Group3Pnts2->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( ReverseSense() ) );
00186 
00187   connect( Group3Pnts3->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
00188   connect( Group3Pnts3->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
00189   connect( Group3Pnts3->PushButton3, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
00190 
00191   connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
00192            this, SLOT( SelectionIntoArgument() ) );
00193 
00194   initName( tr( "GEOM_ARC" ) ); 
00195   
00196 
00197   ConstructorsClicked( 0 );
00198 }
00199 
00200 
00201 //=================================================================================
00202 // function : ClickOnOk()
00203 // purpose  :
00204 //=================================================================================
00205 void BasicGUI_ArcDlg::ClickOnOk()
00206 {
00207   setIsApplyAndClose( true );
00208   if ( ClickOnApply() )
00209     ClickOnCancel();
00210 }
00211 
00212 //=================================================================================
00213 // function : ClickOnApply()
00214 // purpose  :
00215 //=================================================================================
00216 bool BasicGUI_ArcDlg::ClickOnApply()
00217 {
00218   if ( !onAccept() )
00219     return false;
00220 
00221   initName();
00222   ConstructorsClicked( getConstructorId() );
00223 
00224   return true;
00225 }
00226 
00227 
00228 //=================================================================================
00229 // function : SelectionIntoArgument()
00230 // purpose  : Called when selection as changed or other case
00231 //=================================================================================
00232 void BasicGUI_ArcDlg::SelectionIntoArgument()
00233 {
00234   myEditCurrentArgument->setText( "" );
00235 
00236   LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
00237   SALOME_ListIO aSelList;
00238   aSelMgr->selectedObjects(aSelList);
00239 
00240   if (aSelList.Extent() != 1) {
00241     switch (getConstructorId()) {
00242     case 0:
00243       if      ( myEditCurrentArgument == Group3Pnts->LineEdit1 )   myPoint1.nullify();
00244       else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 )   myPoint2.nullify();
00245       else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 )   myPoint3.nullify();
00246       break;
00247     case 1:
00248       if      ( myEditCurrentArgument == Group3Pnts2->LineEdit1 )   myPoint1.nullify();
00249       else if ( myEditCurrentArgument == Group3Pnts2->LineEdit2 )   myPoint2.nullify();
00250       else if ( myEditCurrentArgument == Group3Pnts2->LineEdit3 )   myPoint3.nullify();
00251       break;
00252     case 2:
00253       if      ( myEditCurrentArgument == Group3Pnts3->LineEdit1 )   myPoint1.nullify();
00254       else if ( myEditCurrentArgument == Group3Pnts3->LineEdit2 )   myPoint2.nullify();
00255       else if ( myEditCurrentArgument == Group3Pnts3->LineEdit3 )   myPoint3.nullify();
00256       break;
00257     default:
00258       break;
00259     }
00260     return;
00261   }   
00262 
00263   GEOM::GeomObjPtr aSelectedObject = getSelected( TopAbs_VERTEX );
00264   TopoDS_Shape aShape;
00265   if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) {
00266     QString aName = GEOMBase::GetName( aSelectedObject.get() );
00267     myEditCurrentArgument->setText(aName);
00268     switch ( getConstructorId() ) {
00269     case 0:
00270       if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) {
00271         myPoint1 = aSelectedObject;
00272         if ( myPoint1 && !myPoint2 )
00273           Group3Pnts->PushButton2->click();
00274       }
00275       else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) {
00276         myPoint2 = aSelectedObject;
00277         if ( myPoint2 && !myPoint3 )
00278           Group3Pnts->PushButton3->click();
00279       }
00280       else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) {
00281         myPoint3 = aSelectedObject;
00282         if ( myPoint3 && !myPoint1 )
00283           Group3Pnts->PushButton1->click();
00284       }
00285       break;
00286     case 1:
00287       if ( myEditCurrentArgument == Group3Pnts2->LineEdit1 ) {
00288         myPoint1 = aSelectedObject;
00289         if ( myPoint1 && !myPoint2 )
00290           Group3Pnts2->PushButton2->click();
00291       }
00292       else if ( myEditCurrentArgument == Group3Pnts2->LineEdit2 ) {
00293         myPoint2 = aSelectedObject;
00294         if ( myPoint2 && !myPoint3 )
00295           Group3Pnts2->PushButton3->click();
00296       }
00297       else if ( myEditCurrentArgument == Group3Pnts2->LineEdit3 ) {
00298         myPoint3 = aSelectedObject;
00299         if ( myPoint3 && !myPoint1 )
00300           Group3Pnts2->PushButton1->click();
00301       }
00302       break;
00303     case 2:
00304       if ( myEditCurrentArgument == Group3Pnts3->LineEdit1 ) {
00305         myPoint1 = aSelectedObject;
00306         if ( myPoint1 && !myPoint2 )
00307           Group3Pnts3->PushButton2->click();
00308       }
00309       else if ( myEditCurrentArgument == Group3Pnts3->LineEdit2 ) {
00310         myPoint2 = aSelectedObject;
00311         if ( myPoint2 && !myPoint3 )
00312           Group3Pnts3->PushButton3->click();
00313       }
00314       else if ( myEditCurrentArgument == Group3Pnts3->LineEdit3 ) {
00315         myPoint3 = aSelectedObject;
00316         if ( myPoint3 && !myPoint1 )
00317           Group3Pnts3->PushButton1->click();
00318       }
00319       break;
00320     }
00321   }
00322 
00323   displayPreview(true);
00324 }
00325 
00326 
00327 //=================================================================================
00328 // function : SetEditCurrentArgument()
00329 // purpose  :
00330 //=================================================================================
00331 void BasicGUI_ArcDlg::SetEditCurrentArgument()
00332 {
00333   globalSelection(); // close local selection to clear it
00334   localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
00335 
00336   QPushButton* send = (QPushButton*)sender();
00337   switch ( getConstructorId() ) {
00338   case 0:
00339     if      ( send == Group3Pnts->PushButton1 ) {
00340       myEditCurrentArgument = Group3Pnts->LineEdit1;
00341       Group3Pnts->PushButton2->setDown(false);
00342       Group3Pnts->PushButton3->setDown(false);
00343       Group3Pnts->LineEdit1->setEnabled(true);
00344       Group3Pnts->LineEdit2->setEnabled(false);
00345       Group3Pnts->LineEdit3->setEnabled(false);
00346     }
00347     else if ( send == Group3Pnts->PushButton2 ) {
00348       myEditCurrentArgument = Group3Pnts->LineEdit2;
00349       Group3Pnts->PushButton1->setDown(false);
00350       Group3Pnts->PushButton3->setDown(false);
00351       Group3Pnts->LineEdit1->setEnabled(false);
00352       Group3Pnts->LineEdit2->setEnabled(true);
00353       Group3Pnts->LineEdit3->setEnabled(false);
00354     }
00355     else if ( send == Group3Pnts->PushButton3 ) {
00356       myEditCurrentArgument = Group3Pnts->LineEdit3;
00357       Group3Pnts->PushButton1->setDown(false);
00358       Group3Pnts->PushButton2->setDown(false);
00359       Group3Pnts->LineEdit1->setEnabled(false);
00360       Group3Pnts->LineEdit2->setEnabled(false);
00361       Group3Pnts->LineEdit3->setEnabled(true);
00362     }
00363     break;
00364   case 1:
00365     if      ( send == Group3Pnts2->PushButton1 ) {
00366       myEditCurrentArgument = Group3Pnts2->LineEdit1;
00367       Group3Pnts2->PushButton2->setDown(false);
00368       Group3Pnts2->PushButton3->setDown(false);
00369       Group3Pnts2->LineEdit1->setEnabled(true);
00370       Group3Pnts2->LineEdit2->setEnabled(false);
00371       Group3Pnts2->LineEdit3->setEnabled(false);
00372     }
00373     else if ( send == Group3Pnts2->PushButton2 ) {
00374       myEditCurrentArgument = Group3Pnts2->LineEdit2;
00375       Group3Pnts2->PushButton1->setDown(false);
00376       Group3Pnts2->PushButton3->setDown(false);
00377       Group3Pnts2->LineEdit1->setEnabled(false);
00378       Group3Pnts2->LineEdit2->setEnabled(true);
00379       Group3Pnts2->LineEdit3->setEnabled(false);
00380     }
00381     else if ( send == Group3Pnts2->PushButton3 ) {
00382       myEditCurrentArgument = Group3Pnts2->LineEdit3;
00383       Group3Pnts2->PushButton1->setDown(false);
00384       Group3Pnts2->PushButton2->setDown(false);
00385       Group3Pnts2->LineEdit1->setEnabled(false);
00386       Group3Pnts2->LineEdit2->setEnabled(false);
00387       Group3Pnts2->LineEdit3->setEnabled(true);
00388     }
00389     break;
00390   case 2:
00391     if ( send == Group3Pnts3->PushButton1 ) {
00392       myEditCurrentArgument = Group3Pnts3->LineEdit1;
00393       Group3Pnts3->PushButton2->setDown(false);
00394       Group3Pnts3->PushButton3->setDown(false);
00395       Group3Pnts3->LineEdit1->setEnabled(true);
00396       Group3Pnts3->LineEdit2->setEnabled(false);
00397       Group3Pnts3->LineEdit3->setEnabled(false);
00398     }
00399     else if ( send == Group3Pnts3->PushButton2 ) {
00400       myEditCurrentArgument = Group3Pnts3->LineEdit2;
00401       Group3Pnts3->PushButton1->setDown(false);
00402       Group3Pnts3->PushButton3->setDown(false);
00403       Group3Pnts3->LineEdit1->setEnabled(false);
00404       Group3Pnts3->LineEdit2->setEnabled(true);
00405       Group3Pnts3->LineEdit3->setEnabled(false);
00406     }
00407     else if ( send == Group3Pnts3->PushButton3 ) {
00408       myEditCurrentArgument = Group3Pnts3->LineEdit3;
00409       Group3Pnts3->PushButton1->setDown(false);
00410       Group3Pnts3->PushButton2->setDown(false);
00411       Group3Pnts3->LineEdit1->setEnabled(false);
00412       Group3Pnts3->LineEdit2->setEnabled(false);
00413       Group3Pnts3->LineEdit3->setEnabled(true);
00414     }
00415     break;
00416   }
00417   myEditCurrentArgument->setFocus();
00418   //  SelectionIntoArgument();
00419   send->setDown(true);
00420   displayPreview(true);
00421 }
00422 
00423 
00424 //=================================================================================
00425 // function : ActivateThisDialog()
00426 // purpose  :
00427 //=================================================================================
00428 void BasicGUI_ArcDlg::ActivateThisDialog()
00429 {
00430   GEOMBase_Skeleton::ActivateThisDialog();
00431 
00432   connect( myGeomGUI->getApp()->selectionMgr(),
00433            SIGNAL( currentSelectionChanged() ),
00434            this,
00435            SLOT(SelectionIntoArgument() ) );
00436 
00437   ConstructorsClicked( getConstructorId() );
00438 }
00439 
00440 //=================================================================================
00441 // function : enterEvent()
00442 // purpose  :
00443 //=================================================================================
00444 void BasicGUI_ArcDlg::enterEvent( QEvent* )
00445 {
00446   if ( !mainFrame()->GroupConstructors->isEnabled() )
00447     ActivateThisDialog();
00448 }
00449 
00450 //=================================================================================
00451 // function : createOperation
00452 // purpose  :
00453 //=================================================================================
00454 GEOM::GEOM_IOperations_ptr BasicGUI_ArcDlg::createOperation()
00455 {
00456   return myGeomGUI->GetGeomGen()->GetICurvesOperations( getStudyId() );
00457 }
00458 
00459 //=================================================================================
00460 // function : isValid
00461 // purpose  :
00462 //=================================================================================
00463 bool BasicGUI_ArcDlg::isValid( QString& msg )
00464 {
00465   bool ok = myPoint1 && myPoint2 && myPoint3 &&
00466     myPoint1 != myPoint2 && myPoint1 != myPoint3 && myPoint2 != myPoint3;
00467   return ok;
00468 }
00469 
00470 //=================================================================================
00471 // function : execute
00472 // purpose  :
00473 //=================================================================================
00474 bool BasicGUI_ArcDlg::execute( ObjectList& objects )
00475 {
00476   bool res = false;
00477   GEOM::GEOM_Object_var anObj;
00478 
00479   GEOM::GEOM_ICurvesOperations_var anOper = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() );
00480 
00481   switch ( getConstructorId() ) {
00482   case 0:
00483     {
00484       if ( myPoint1 && myPoint2 && myPoint3 ) {
00485         anObj = anOper->MakeArc( myPoint1.get(), myPoint2.get(), myPoint3.get() );
00486         res = true;
00487       }
00488       break;
00489     }
00490   case 1:
00491     {
00492       bool Sense = Group3Pnts2->CheckButton1->isChecked();
00493       if ( myPoint1 && myPoint2 && myPoint3 ) {
00494         anObj = anOper->MakeArcCenter( myPoint1.get(), myPoint2.get(), myPoint3.get(), Sense );
00495         res = true;
00496       }
00497       break;
00498     }
00499   case 2:
00500     {
00501       if ( myPoint1 && myPoint2 && myPoint3 ) {
00502         anObj = anOper->MakeArcOfEllipse( myPoint1.get(), myPoint2.get(), myPoint3.get() );
00503         res = true;
00504       }
00505       break;
00506     }
00507   }
00508   if ( !anObj->_is_nil() ) {
00509     objects.push_back( anObj._retn() );
00510   }
00511   return res;
00512 }
00513 
00514 //=================================================================================
00515 // function : ConstructorsClicked()
00516 // purpose  : Radio button management
00517 //=================================================================================
00518 void BasicGUI_ArcDlg::ConstructorsClicked( int constructorId )
00519 {
00520   disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 );
00521 
00522   myPoint1.nullify();
00523   myPoint2.nullify();
00524   myPoint3.nullify();
00525   
00526   switch ( constructorId ) {
00527   case 0:
00528     {
00529       Group3Pnts->show();
00530       Group3Pnts2->hide();
00531       Group3Pnts3->hide();
00532       Group3Pnts->PushButton1->setDown(true);
00533       Group3Pnts->PushButton2->setDown(false);
00534       Group3Pnts->PushButton3->setDown(false);
00535       Group3Pnts->LineEdit1->setText( "" );
00536       Group3Pnts->LineEdit2->setText( "" );
00537       Group3Pnts->LineEdit3->setText( "" );
00538       Group3Pnts->LineEdit1->setEnabled(true);
00539       Group3Pnts->LineEdit2->setEnabled(false);
00540       Group3Pnts->LineEdit3->setEnabled(false);
00541 
00542       myEditCurrentArgument = Group3Pnts->LineEdit1;
00543       break;
00544     }
00545   case 1:
00546     {
00547       Group3Pnts->hide();
00548       Group3Pnts2->show();
00549       Group3Pnts3->hide();
00550       Group3Pnts2->PushButton1->setDown(true);
00551       Group3Pnts2->PushButton2->setDown(false);
00552       Group3Pnts2->PushButton3->setDown(false);
00553       Group3Pnts2->LineEdit1->setText( "" );
00554       Group3Pnts2->LineEdit2->setText( "" );
00555       Group3Pnts2->LineEdit3->setText( "" );
00556       Group3Pnts2->LineEdit1->setEnabled(true);
00557       Group3Pnts2->LineEdit2->setEnabled(false);
00558       Group3Pnts2->LineEdit3->setEnabled(false);
00559       
00560       myEditCurrentArgument = Group3Pnts2->LineEdit1;
00561       break;
00562     }
00563   case 2:
00564     {
00565       Group3Pnts->hide();
00566       Group3Pnts2->hide();
00567       Group3Pnts3->show();
00568       Group3Pnts3->PushButton1->setDown(true);
00569       Group3Pnts3->PushButton2->setDown(false);
00570       Group3Pnts3->PushButton3->setDown(false);
00571       Group3Pnts3->LineEdit1->setText( "" );
00572       Group3Pnts3->LineEdit2->setText( "" );
00573       Group3Pnts3->LineEdit3->setText( "" );
00574       Group3Pnts3->LineEdit1->setEnabled(true);
00575       Group3Pnts3->LineEdit2->setEnabled(false);
00576       Group3Pnts3->LineEdit3->setEnabled(false);
00577 
00578       myEditCurrentArgument = Group3Pnts3->LineEdit1;
00579       break;
00580     }
00581   }
00582 
00583   globalSelection(); // close local contexts, if any
00584   localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); //Select Vertex on All Shapes
00585   
00586   qApp->processEvents();
00587   updateGeometry();
00588   resize( minimumSizeHint() );
00589 
00590   myEditCurrentArgument->setFocus();
00591   connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
00592            this, SLOT( SelectionIntoArgument() ) );
00593 
00594   SelectionIntoArgument();
00595 
00596   displayPreview(true);
00597 }
00598 
00599 //=================================================================================
00600 // function : ReverseSense()
00601 // purpose  : Orientation of the arc
00602 //=================================================================================
00603 void BasicGUI_ArcDlg::ReverseSense()
00604 {
00605   displayPreview(true);
00606 }
00607 
00608 //=================================================================================
00609 // function : addSubshapeToStudy
00610 // purpose  : virtual method to add new SubObjects if local selection
00611 //=================================================================================
00612 void BasicGUI_ArcDlg::addSubshapesToStudy()
00613 {
00614   switch ( getConstructorId() ) {
00615   case 0:
00616   case 1:
00617   case 2:
00618     GEOMBase::PublishSubObject( myPoint1.get() );
00619     GEOMBase::PublishSubObject( myPoint2.get() );
00620     GEOMBase::PublishSubObject( myPoint3.get() );
00621     break;
00622   default:
00623     break;
00624   }
00625 }