1 // Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // GEOM GEOMGUI : GUI for Geometry component
24 // File : BasicGUI_ArcDlg.cxx
25 // Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
27 #include "BasicGUI_ArcDlg.h"
30 #include <GeometryGUI.h>
33 #include <SUIT_ResourceMgr.h>
34 #include <SUIT_Session.h>
35 #include <SalomeApp_Application.h>
36 #include <LightApp_SelectionMgr.h>
38 #include <TColStd_IndexedMapOfInteger.hxx>
39 #include <TopTools_IndexedMapOfShape.hxx>
40 #include <TopoDS_Shape.hxx>
41 #include <TopoDS_Edge.hxx>
45 #include <GEOMImpl_Types.hxx>
47 //=================================================================================
48 // class : BasicGUI_ArcDlg()
49 // purpose : Constructs a BasicGUI_ArcDlg which is a child of 'parent', with the
50 // name 'name' and widget flags set to 'f'.
51 // The dialog will by default be modeless, unless you set 'modal' to
52 // TRUE to construct a modal dialog.
53 //=================================================================================
54 BasicGUI_ArcDlg::BasicGUI_ArcDlg( GeometryGUI* theGeometryGUI, QWidget* parent,
55 bool modal, Qt::WindowFlags fl )
56 : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl )
58 SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
59 QPixmap image0( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_ARC" ) ) );
60 QPixmap image1( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_ARC_CENTER" ) ) );
61 QPixmap image2( aResMgr->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
62 QPixmap image3( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_ARC_OF_ELLIPSE" ) ) );
64 setWindowTitle( tr( "GEOM_ARC_TITLE" ) );
66 /***************************************************************/
67 mainFrame()->GroupConstructors->setTitle( tr( "GEOM_ARC" ) );
68 mainFrame()->RadioButton1->setIcon( image0 );
69 mainFrame()->RadioButton2->setIcon( image1 );
70 mainFrame()->RadioButton3->setIcon( image3 );
72 Group3Pnts = new DlgRef_3Sel( centralWidget() );
74 Group3Pnts->GroupBox1->setTitle( tr( "GEOM_POINTS" ) );
75 Group3Pnts->TextLabel1->setText( tr( "GEOM_POINT_I" ).arg( 1 ) );
76 Group3Pnts->TextLabel2->setText( tr( "GEOM_POINT_I" ).arg( 2 ) );
77 Group3Pnts->TextLabel3->setText( tr( "GEOM_POINT_I" ).arg( 3 ) );
79 Group3Pnts->LineEdit1->setReadOnly( true );
80 Group3Pnts->LineEdit2->setReadOnly( true );
81 Group3Pnts->LineEdit3->setReadOnly( true );
83 Group3Pnts->LineEdit1->setEnabled(true);
84 Group3Pnts->LineEdit2->setEnabled(false);
85 Group3Pnts->LineEdit3->setEnabled(false);
87 Group3Pnts->PushButton1->setIcon(image2);
88 Group3Pnts->PushButton2->setIcon(image2);
89 Group3Pnts->PushButton3->setIcon(image2);
92 Group3Pnts2 = new DlgRef_3Sel1Check( centralWidget() );
94 Group3Pnts2->GroupBox1->setTitle( tr( "GEOM_POINTS" ) );
95 Group3Pnts2->TextLabel1->setText( tr( "GEOM_CENTER_POINT" ) );
96 Group3Pnts2->TextLabel2->setText( tr( "GEOM_POINT_I" ).arg( "Start" ) );
97 Group3Pnts2->TextLabel3->setText( tr( "GEOM_POINT_I" ).arg( "End" ) );
99 Group3Pnts2->LineEdit1->setReadOnly( true );
100 Group3Pnts2->LineEdit2->setReadOnly( true );
101 Group3Pnts2->LineEdit3->setReadOnly( true );
103 Group3Pnts2->LineEdit1->setEnabled(true);
104 Group3Pnts2->LineEdit2->setEnabled(false);
105 Group3Pnts2->LineEdit3->setEnabled(false);
107 Group3Pnts2->PushButton1->setIcon( image2 );
108 Group3Pnts2->PushButton2->setIcon( image2 );
109 Group3Pnts2->PushButton3->setIcon( image2 );
111 Group3Pnts2->CheckButton1->setText( tr( "GEOM_REVERSE" ) );
113 Group3Pnts3 = new DlgRef_3Sel( centralWidget() );
115 Group3Pnts3->GroupBox1->setTitle( tr( "GEOM_POINTS" ) );
116 Group3Pnts3->TextLabel1->setText( tr( "GEOM_CENTER_POINT" ) );
117 Group3Pnts3->TextLabel2->setText( tr( "GEOM_POINT_I" ).arg( 1 ) );
118 Group3Pnts3->TextLabel3->setText( tr( "GEOM_POINT_I" ).arg( 2 ) );
120 Group3Pnts3->LineEdit1->setReadOnly( true );
121 Group3Pnts3->LineEdit2->setReadOnly( true );
122 Group3Pnts3->LineEdit3->setReadOnly( true );
124 Group3Pnts3->LineEdit1->setEnabled(true);
125 Group3Pnts3->LineEdit2->setEnabled(false);
126 Group3Pnts3->LineEdit3->setEnabled(false);
128 Group3Pnts3->PushButton1->setIcon(image2);
129 Group3Pnts3->PushButton2->setIcon(image2);
130 Group3Pnts3->PushButton3->setIcon(image2);
132 QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
133 layout->setMargin( 0 ); layout->setSpacing( 6 );
134 layout->addWidget( Group3Pnts );
135 layout->addWidget( Group3Pnts2 );
136 layout->addWidget( Group3Pnts3 );
138 setHelpFileName( "create_arc_page.html" );
144 //=================================================================================
145 // function : ~BasicGUI_ArcDlg()
146 // purpose : Destroys the object and frees any allocated resources
147 //=================================================================================
148 BasicGUI_ArcDlg::~BasicGUI_ArcDlg()
153 //=================================================================================
156 //=================================================================================
157 void BasicGUI_ArcDlg::Init()
160 myEditCurrentArgument = Group3Pnts->LineEdit1;
162 myPoint1 = myPoint2 = myPoint3 = GEOM::GEOM_Object::_nil();
163 Group3Pnts2->CheckButton1->setChecked( false );
164 Group3Pnts->PushButton1->setDown(true);
166 /* signals and slots connections */
167 connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) );
168 connect( myGeomGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) );
170 connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );
172 connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
173 connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
175 connect( Group3Pnts->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
176 connect( Group3Pnts->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
177 connect( Group3Pnts->PushButton3, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
179 connect( Group3Pnts->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
180 connect( Group3Pnts->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
181 connect( Group3Pnts->LineEdit3, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
183 connect( Group3Pnts2->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
184 connect( Group3Pnts2->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
185 connect( Group3Pnts2->PushButton3, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
187 connect( Group3Pnts2->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
188 connect( Group3Pnts2->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
189 connect( Group3Pnts2->LineEdit3, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
191 connect( Group3Pnts2->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( ReverseSense() ) );
193 connect( Group3Pnts3->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
194 connect( Group3Pnts3->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
195 connect( Group3Pnts3->PushButton3, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
197 connect( Group3Pnts3->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
198 connect( Group3Pnts3->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
199 connect( Group3Pnts3->LineEdit3, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
201 connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
202 this, SLOT( SelectionIntoArgument() ) );
204 initName( tr( "GEOM_ARC" ) );
207 ConstructorsClicked( 0 );
211 //=================================================================================
212 // function : ClickOnOk()
214 //=================================================================================
215 void BasicGUI_ArcDlg::ClickOnOk()
217 if ( ClickOnApply() )
221 //=================================================================================
222 // function : ClickOnApply()
224 //=================================================================================
225 bool BasicGUI_ArcDlg::ClickOnApply()
231 ConstructorsClicked( getConstructorId() );
237 //=================================================================================
238 // function : SelectionIntoArgument()
239 // purpose : Called when selection as changed or other case
240 //=================================================================================
241 void BasicGUI_ArcDlg::SelectionIntoArgument()
243 myEditCurrentArgument->setText( "" );
245 LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
246 SALOME_ListIO aSelList;
247 aSelMgr->selectedObjects(aSelList);
249 if (aSelList.Extent() != 1) {
250 switch (getConstructorId()) {
252 if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) myPoint1 = GEOM::GEOM_Object::_nil();
253 else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) myPoint2 = GEOM::GEOM_Object::_nil();
254 else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) myPoint3 = GEOM::GEOM_Object::_nil();
258 if ( myEditCurrentArgument == Group3Pnts2->LineEdit1 ) myPoint1 = GEOM::GEOM_Object::_nil();
259 else if ( myEditCurrentArgument == Group3Pnts2->LineEdit2 ) myPoint2 = GEOM::GEOM_Object::_nil();
260 else if ( myEditCurrentArgument == Group3Pnts2->LineEdit3 ) myPoint3 = GEOM::GEOM_Object::_nil();
264 if ( myEditCurrentArgument == Group3Pnts3->LineEdit1 ) myPoint1 = GEOM::GEOM_Object::_nil();
265 else if ( myEditCurrentArgument == Group3Pnts3->LineEdit2 ) myPoint2 = GEOM::GEOM_Object::_nil();
266 else if ( myEditCurrentArgument == Group3Pnts3->LineEdit3 ) myPoint3 = GEOM::GEOM_Object::_nil();
272 Standard_Boolean aRes = Standard_False;
273 GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aRes);
274 if ( !CORBA::is_nil( aSelectedObject ) && aRes ) {
275 QString aName = GEOMBase::GetName(aSelectedObject);
277 // Get Selected object if selected subshape
279 if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull())
281 TColStd_IndexedMapOfInteger aMap;
282 aSelMgr->GetIndexes(aSelList.First(), aMap);
283 if (aMap.Extent() == 1) // Local Selection
285 int anIndex = aMap(1);
286 aName += QString(":vertex_%1").arg(anIndex);
288 //Find SubShape Object in Father
289 GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
291 if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
292 GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
293 aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
296 aSelectedObject = aFindedObject; // get Object from study
298 else // Global Selection
300 if (aShape.ShapeType() != TopAbs_VERTEX) {
301 aSelectedObject = GEOM::GEOM_Object::_nil();
307 myEditCurrentArgument->setText(aName);
309 if (!aSelectedObject->_is_nil()) { // clear selection if something selected
311 localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
314 switch ( getConstructorId() ) {
316 if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) {
317 myPoint1 = aSelectedObject;
318 if ( !myPoint1->_is_nil() && myPoint2->_is_nil() )
319 Group3Pnts->PushButton2->click();
321 else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) {
322 myPoint2 = aSelectedObject;
323 if ( !myPoint2->_is_nil() && myPoint3->_is_nil() )
324 Group3Pnts->PushButton3->click();
326 else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) {
327 myPoint3 = aSelectedObject;
328 if ( !myPoint3->_is_nil() && myPoint1->_is_nil() )
329 Group3Pnts->PushButton1->click();
333 if ( myEditCurrentArgument == Group3Pnts2->LineEdit1 ) {
334 myPoint1 = aSelectedObject;
335 if ( !myPoint1->_is_nil() && myPoint2->_is_nil() )
336 Group3Pnts2->PushButton2->click();
338 else if ( myEditCurrentArgument == Group3Pnts2->LineEdit2 ) {
339 myPoint2 = aSelectedObject;
340 if ( !myPoint2->_is_nil() && myPoint3->_is_nil() )
341 Group3Pnts2->PushButton3->click();
343 else if ( myEditCurrentArgument == Group3Pnts2->LineEdit3 ) {
344 myPoint3 = aSelectedObject;
345 if ( !myPoint3->_is_nil() && myPoint1->_is_nil() )
346 Group3Pnts2->PushButton1->click();
350 if ( myEditCurrentArgument == Group3Pnts3->LineEdit1 ) {
351 myPoint1 = aSelectedObject;
352 if ( !myPoint1->_is_nil() && myPoint2->_is_nil() )
353 Group3Pnts3->PushButton2->click();
355 else if ( myEditCurrentArgument == Group3Pnts3->LineEdit2 ) {
356 myPoint2 = aSelectedObject;
357 if ( !myPoint2->_is_nil() && myPoint3->_is_nil() )
358 Group3Pnts3->PushButton3->click();
360 else if ( myEditCurrentArgument == Group3Pnts3->LineEdit3 ) {
361 myPoint3 = aSelectedObject;
362 if ( !myPoint3->_is_nil() && myPoint1->_is_nil() )
363 Group3Pnts3->PushButton1->click();
373 //=================================================================================
374 // function : SetEditCurrentArgument()
376 //=================================================================================
377 void BasicGUI_ArcDlg::SetEditCurrentArgument()
379 globalSelection(); // close local selection to clear it
380 localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
382 QPushButton* send = (QPushButton*)sender();
383 switch ( getConstructorId() ) {
385 if ( send == Group3Pnts->PushButton1 ) {
386 myEditCurrentArgument = Group3Pnts->LineEdit1;
387 Group3Pnts->PushButton2->setDown(false);
388 Group3Pnts->PushButton3->setDown(false);
389 Group3Pnts->LineEdit1->setEnabled(true);
390 Group3Pnts->LineEdit2->setEnabled(false);
391 Group3Pnts->LineEdit3->setEnabled(false);
393 else if ( send == Group3Pnts->PushButton2 ) {
394 myEditCurrentArgument = Group3Pnts->LineEdit2;
395 Group3Pnts->PushButton1->setDown(false);
396 Group3Pnts->PushButton3->setDown(false);
397 Group3Pnts->LineEdit1->setEnabled(false);
398 Group3Pnts->LineEdit2->setEnabled(true);
399 Group3Pnts->LineEdit3->setEnabled(false);
401 else if ( send == Group3Pnts->PushButton3 ) {
402 myEditCurrentArgument = Group3Pnts->LineEdit3;
403 Group3Pnts->PushButton1->setDown(false);
404 Group3Pnts->PushButton2->setDown(false);
405 Group3Pnts->LineEdit1->setEnabled(false);
406 Group3Pnts->LineEdit2->setEnabled(false);
407 Group3Pnts->LineEdit3->setEnabled(true);
411 if ( send == Group3Pnts2->PushButton1 ) {
412 myEditCurrentArgument = Group3Pnts2->LineEdit1;
413 Group3Pnts2->PushButton2->setDown(false);
414 Group3Pnts2->PushButton3->setDown(false);
415 Group3Pnts2->LineEdit1->setEnabled(true);
416 Group3Pnts2->LineEdit2->setEnabled(false);
417 Group3Pnts2->LineEdit3->setEnabled(false);
419 else if ( send == Group3Pnts2->PushButton2 ) {
420 myEditCurrentArgument = Group3Pnts2->LineEdit2;
421 Group3Pnts2->PushButton1->setDown(false);
422 Group3Pnts2->PushButton3->setDown(false);
423 Group3Pnts2->LineEdit1->setEnabled(false);
424 Group3Pnts2->LineEdit2->setEnabled(true);
425 Group3Pnts2->LineEdit3->setEnabled(false);
427 else if ( send == Group3Pnts2->PushButton3 ) {
428 myEditCurrentArgument = Group3Pnts2->LineEdit3;
429 Group3Pnts2->PushButton1->setDown(false);
430 Group3Pnts2->PushButton2->setDown(false);
431 Group3Pnts2->LineEdit1->setEnabled(false);
432 Group3Pnts2->LineEdit2->setEnabled(false);
433 Group3Pnts2->LineEdit3->setEnabled(true);
437 if ( send == Group3Pnts3->PushButton1 ) {
438 myEditCurrentArgument = Group3Pnts3->LineEdit1;
439 Group3Pnts3->PushButton2->setDown(false);
440 Group3Pnts3->PushButton3->setDown(false);
441 Group3Pnts3->LineEdit1->setEnabled(true);
442 Group3Pnts3->LineEdit2->setEnabled(false);
443 Group3Pnts3->LineEdit3->setEnabled(false);
445 else if ( send == Group3Pnts3->PushButton2 ) {
446 myEditCurrentArgument = Group3Pnts3->LineEdit2;
447 Group3Pnts3->PushButton1->setDown(false);
448 Group3Pnts3->PushButton3->setDown(false);
449 Group3Pnts3->LineEdit1->setEnabled(false);
450 Group3Pnts3->LineEdit2->setEnabled(true);
451 Group3Pnts3->LineEdit3->setEnabled(false);
453 else if ( send == Group3Pnts3->PushButton3 ) {
454 myEditCurrentArgument = Group3Pnts3->LineEdit3;
455 Group3Pnts3->PushButton1->setDown(false);
456 Group3Pnts3->PushButton2->setDown(false);
457 Group3Pnts3->LineEdit1->setEnabled(false);
458 Group3Pnts3->LineEdit2->setEnabled(false);
459 Group3Pnts3->LineEdit3->setEnabled(true);
463 myEditCurrentArgument->setFocus();
464 // SelectionIntoArgument();
470 //=================================================================================
471 // function : LineEditReturnPressed()
473 //=================================================================================
474 void BasicGUI_ArcDlg::LineEditReturnPressed()
476 QLineEdit* send = (QLineEdit*)sender();
477 if ( send == Group3Pnts->LineEdit1 || send == Group3Pnts->LineEdit2 || send == Group3Pnts->LineEdit3 ||
478 send == Group3Pnts2->LineEdit1 || send == Group3Pnts2->LineEdit2 || send == Group3Pnts2->LineEdit3 ||
479 send == Group3Pnts3->LineEdit1 || send == Group3Pnts3->LineEdit2 || send == Group3Pnts3->LineEdit3 ) {
480 myEditCurrentArgument = send;
481 GEOMBase_Skeleton::LineEditReturnPressed();
486 //=================================================================================
487 // function : ActivateThisDialog()
489 //=================================================================================
490 void BasicGUI_ArcDlg::ActivateThisDialog()
492 GEOMBase_Skeleton::ActivateThisDialog();
494 connect( myGeomGUI->getApp()->selectionMgr(),
495 SIGNAL( currentSelectionChanged() ),
497 SLOT(SelectionIntoArgument() ) );
499 ConstructorsClicked( getConstructorId() );
502 //=================================================================================
503 // function : enterEvent()
505 //=================================================================================
506 void BasicGUI_ArcDlg::enterEvent( QEvent* )
508 if ( !mainFrame()->GroupConstructors->isEnabled() )
509 ActivateThisDialog();
512 //=================================================================================
513 // function : createOperation
515 //=================================================================================
516 GEOM::GEOM_IOperations_ptr BasicGUI_ArcDlg::createOperation()
518 return myGeomGUI->GetGeomGen()->GetICurvesOperations( getStudyId() );
521 //=================================================================================
522 // function : isEqual
523 // purpose : it may also be needed to check for min distance between gp_Pnt-s...
524 //=================================================================================
525 static bool isEqual( const GEOM::GEOM_Object_var& thePnt1, const GEOM::GEOM_Object_var& thePnt2 )
527 return thePnt1->_is_equivalent( thePnt2 );
530 //=================================================================================
531 // function : isValid
533 //=================================================================================
534 bool BasicGUI_ArcDlg::isValid( QString& msg )
536 switch (getConstructorId()) {
539 if (Group3Pnts->LineEdit1->text().trimmed().isEmpty() ||
540 Group3Pnts->LineEdit2->text().trimmed().isEmpty() ||
541 Group3Pnts->LineEdit3->text().trimmed().isEmpty())
547 if (Group3Pnts2->LineEdit1->text().trimmed().isEmpty() ||
548 Group3Pnts2->LineEdit2->text().trimmed().isEmpty() ||
549 Group3Pnts2->LineEdit3->text().trimmed().isEmpty())
555 if (Group3Pnts3->LineEdit1->text().trimmed().isEmpty() ||
556 Group3Pnts3->LineEdit2->text().trimmed().isEmpty() ||
557 Group3Pnts3->LineEdit3->text().trimmed().isEmpty())
562 return !myPoint1->_is_nil() && !myPoint2->_is_nil() && !myPoint3->_is_nil() &&
563 !isEqual( myPoint1, myPoint2 ) && !isEqual( myPoint1, myPoint3 ) && !isEqual( myPoint2, myPoint3 );
566 //=================================================================================
567 // function : execute
569 //=================================================================================
570 bool BasicGUI_ArcDlg::execute( ObjectList& objects )
573 GEOM::GEOM_Object_var anObj;
575 GEOM::GEOM_ICurvesOperations_var anOper = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() );
577 switch ( getConstructorId() ) {
580 if ( !CORBA::is_nil( myPoint1 ) && !CORBA::is_nil( myPoint2 ) && !CORBA::is_nil( myPoint3 ) ) {
581 anObj = anOper->MakeArc( myPoint1, myPoint2, myPoint3 );
588 bool Sense = Group3Pnts2->CheckButton1->isChecked();
589 if ( !CORBA::is_nil( myPoint1 ) && !CORBA::is_nil( myPoint2 ) && !CORBA::is_nil( myPoint3 ) ) {
590 anObj = anOper->MakeArcCenter( myPoint1, myPoint2, myPoint3, Sense );
597 if ( !CORBA::is_nil( myPoint1 ) && !CORBA::is_nil( myPoint2 ) && !CORBA::is_nil( myPoint3 ) ) {
598 anObj = anOper->MakeArcOfEllipse( myPoint1, myPoint2, myPoint3 );
604 if ( !anObj->_is_nil() ) {
605 objects.push_back( anObj._retn() );
610 //=================================================================================
611 // function : ConstructorsClicked()
612 // purpose : Radio button management
613 //=================================================================================
614 void BasicGUI_ArcDlg::ConstructorsClicked( int constructorId )
616 disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 );
618 switch ( constructorId ) {
621 globalSelection(); // close local contexts, if any
622 localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); //Select Vertex on All Shapes
627 Group3Pnts->PushButton1->setDown(true);
628 Group3Pnts->PushButton2->setDown(false);
629 Group3Pnts->PushButton3->setDown(false);
630 Group3Pnts->LineEdit1->setText( "" );
631 Group3Pnts->LineEdit2->setText( "" );
632 Group3Pnts->LineEdit3->setText( "" );
633 Group3Pnts->LineEdit1->setEnabled(true);
634 Group3Pnts->LineEdit2->setEnabled(false);
635 Group3Pnts->LineEdit3->setEnabled(false);
636 myPoint1 = myPoint2 = myPoint3 = GEOM::GEOM_Object::_nil();
638 myEditCurrentArgument = Group3Pnts->LineEdit1;
643 globalSelection(); // close local contexts, if any
644 localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); //Select Vertex on All Shapes
649 Group3Pnts2->PushButton1->setDown(true);
650 Group3Pnts2->PushButton2->setDown(false);
651 Group3Pnts2->PushButton3->setDown(false);
652 Group3Pnts2->LineEdit1->setText( "" );
653 Group3Pnts2->LineEdit2->setText( "" );
654 Group3Pnts2->LineEdit3->setText( "" );
655 Group3Pnts2->LineEdit1->setEnabled(true);
656 Group3Pnts2->LineEdit2->setEnabled(false);
657 Group3Pnts2->LineEdit3->setEnabled(false);
658 myPoint1 = myPoint2 = myPoint3 = GEOM::GEOM_Object::_nil();
660 myEditCurrentArgument = Group3Pnts2->LineEdit1;
665 globalSelection(); // close local contexts, if any
666 localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); //Select Vertex on All Shapes
671 Group3Pnts3->PushButton1->setDown(true);
672 Group3Pnts3->PushButton2->setDown(false);
673 Group3Pnts3->PushButton3->setDown(false);
674 Group3Pnts3->LineEdit1->setText( "" );
675 Group3Pnts3->LineEdit2->setText( "" );
676 Group3Pnts3->LineEdit3->setText( "" );
677 Group3Pnts3->LineEdit1->setEnabled(true);
678 Group3Pnts3->LineEdit2->setEnabled(false);
679 Group3Pnts3->LineEdit3->setEnabled(false);
680 myPoint1 = myPoint2 = myPoint3 = GEOM::GEOM_Object::_nil();
682 myEditCurrentArgument = Group3Pnts3->LineEdit1;
687 qApp->processEvents();
689 resize( minimumSizeHint() );
691 myEditCurrentArgument->setFocus();
692 connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
693 this, SLOT( SelectionIntoArgument() ) );
695 if ( CORBA::is_nil( myPoint1 ) )
696 SelectionIntoArgument();
701 //=================================================================================
702 // function : ReverseSense()
703 // purpose : Orientation of the arc
704 //=================================================================================
705 void BasicGUI_ArcDlg::ReverseSense()
710 //=================================================================================
711 // function : addSubshapeToStudy
712 // purpose : virtual method to add new SubObjects if local selection
713 //=================================================================================
714 void BasicGUI_ArcDlg::addSubshapesToStudy()
716 QMap<QString, GEOM::GEOM_Object_var> objMap;
718 switch ( getConstructorId() ) {
720 objMap[Group3Pnts->LineEdit1->text()] = myPoint1;
721 objMap[Group3Pnts->LineEdit2->text()] = myPoint2;
722 objMap[Group3Pnts->LineEdit3->text()] = myPoint3;
725 objMap[Group3Pnts2->LineEdit1->text()] = myPoint1;
726 objMap[Group3Pnts2->LineEdit2->text()] = myPoint2;
727 objMap[Group3Pnts2->LineEdit3->text()] = myPoint3;
730 objMap[Group3Pnts3->LineEdit1->text()] = myPoint1;
731 objMap[Group3Pnts3->LineEdit2->text()] = myPoint2;
732 objMap[Group3Pnts3->LineEdit3->text()] = myPoint3;
735 addSubshapesToFather( objMap );