1 // GEOM GEOMGUI : GUI for Geometry component
3 // Copyright (C) 2003 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
22 // File : BasicGUI_PointDlg.cxx
23 // Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
26 #include "BasicGUI_PointDlg.h"
28 #include <SUIT_ResourceMgr.h>
29 #include <SUIT_Session.h>
30 #include <SalomeApp_Application.h>
31 #include <LightApp_SelectionMgr.h>
33 #include <GeometryGUI.h>
38 #include <GEOMImpl_Types.hxx>
40 #include <QApplication>
44 #include <TopoDS_Shape.hxx>
45 #include <TopAbs_ShapeEnum.hxx>
47 #include <BRep_Tool.hxx>
49 #include <TColStd_IndexedMapOfInteger.hxx>
50 #include <TopTools_IndexedMapOfShape.hxx>
52 //=================================================================================
53 // class : BasicGUI_PointDlg()
54 // purpose : Constructs a BasicGUI_PointDlg which is a child of 'parent', with the
55 // name 'name' and widget flags set to 'f'.
56 // The dialog will by default be modeless, unless you set 'modal' to
57 // TRUE to construct a modal dialog.
58 //=================================================================================
59 BasicGUI_PointDlg::BasicGUI_PointDlg( GeometryGUI* theGeometryGUI, QWidget* parent,
60 bool modal, Qt::WindowFlags fl )
61 : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl )
63 QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_POINT") ) );
64 QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_POINT_EDGE" ) ) );
65 QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
66 QPixmap image3( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_POINT_REF" ) ) );
67 QPixmap image4( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_POINT_LINES") ) );
69 setWindowTitle( tr( "GEOM_POINT_TITLE" ) );
71 /***************************************************************/
72 mainFrame()->GroupConstructors->setTitle( tr( "GEOM_POINTS" ) );
73 mainFrame()->RadioButton1->setIcon( image0 );
74 mainFrame()->RadioButton2->setIcon( image3 );
75 mainFrame()->RadioButton3->setIcon( image1 );
76 mainFrame()->RadioButton4->show();
77 mainFrame()->RadioButton4->setIcon( image4 );
79 GroupXYZ = new DlgRef_3Spin( centralWidget() );
80 GroupXYZ->GroupBox1->setTitle( tr( "GEOM_COORDINATES" ) );
81 GroupXYZ->TextLabel1->setText( tr( "GEOM_X" ) );
82 GroupXYZ->TextLabel2->setText( tr( "GEOM_Y" ) );
83 GroupXYZ->TextLabel3->setText( tr( "GEOM_Z" ) );
85 GroupOnCurve = new DlgRef_1Sel1Spin( centralWidget() );
86 GroupOnCurve->GroupBox1->setTitle( tr( "GEOM_PARAM_POINT" ) );
87 GroupOnCurve->TextLabel1->setText( tr( "GEOM_EDGE" ) );
88 GroupOnCurve->TextLabel2->setText( tr( "GEOM_PARAMETER" ) );
89 GroupOnCurve->PushButton1->setIcon( image2 );
91 GroupRefPoint = new DlgRef_1Sel3Spin( centralWidget() );
92 GroupRefPoint->GroupBox1->setTitle( tr( "GEOM_REF_POINT" ) );
93 GroupRefPoint->TextLabel1->setText( tr( "GEOM_POINT" ) );
94 GroupRefPoint->PushButton1->setIcon( image2 );
95 GroupRefPoint->TextLabel2->setText( tr( "GEOM_DX" ) );
96 GroupRefPoint->TextLabel3->setText( tr( "GEOM_DY" ) );
97 GroupRefPoint->TextLabel4->setText( tr( "GEOM_DZ" ) );
99 GroupLineIntersection = new DlgRef_2Sel( centralWidget() );
100 GroupLineIntersection->GroupBox1->setTitle( tr( "GEOM_LINE_INTERSECTION" ) );
101 GroupLineIntersection->TextLabel1->setText( tr( "GEOM_LINE1" ) );
102 GroupLineIntersection->TextLabel2->setText( tr( "GEOM_LINE2" ) );
103 GroupLineIntersection->PushButton1->setIcon( image2 );
104 GroupLineIntersection->PushButton2->setIcon( image2 );
106 myCoordGrp = new QGroupBox( tr( "GEOM_COORDINATES" ), centralWidget() );
107 QGridLayout* myCoordGrpLayout = new QGridLayout( myCoordGrp );
108 myCoordGrpLayout->addWidget( new QLabel( tr( "GEOM_X" ), myCoordGrp ), 0, 0 );
109 myX = new QLineEdit( myCoordGrp );
110 myCoordGrpLayout->addWidget( myX, 0, 1 );
111 myCoordGrpLayout->addWidget( new QLabel( tr( "GEOM_Y" ), myCoordGrp ), 1, 0 );
112 myY = new QLineEdit( myCoordGrp );
113 myCoordGrpLayout->addWidget( myY, 1, 1 );
114 myCoordGrpLayout->addWidget( new QLabel( tr( "GEOM_Z" ), myCoordGrp ), 2, 0 );
115 myZ = new QLineEdit( myCoordGrp );
116 myCoordGrpLayout->addWidget( myZ, 2, 1 );
118 QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
119 layout->setMargin( 0 ); layout->setSpacing( 6 );
120 layout->addWidget( GroupXYZ );
121 layout->addWidget( GroupOnCurve );
122 layout->addWidget( GroupRefPoint );
123 layout->addWidget( GroupLineIntersection );
124 layout->addWidget( myCoordGrp );
126 myX->setReadOnly( true );
127 myY->setReadOnly( true );
128 myZ->setReadOnly( true );
130 myX->setEnabled( false );
131 myY->setEnabled( false );
132 myZ->setEnabled( false );
134 QPalette aPal = myX->palette();
135 aPal.setColor( QPalette::Disabled, QPalette::Text, QColor( 0, 0, 0 ) ) ;
136 myX->setPalette( aPal );
137 myY->setPalette( aPal );
138 myZ->setPalette( aPal );
140 // setHelpFileName( "create_point_page.html" );
141 setHelpFileName( "point.htm" );
147 //=================================================================================
148 // function : ~BasicGUI_PointDlg()
149 // purpose : Destructor
150 //=================================================================================
151 BasicGUI_PointDlg::~BasicGUI_PointDlg()
156 //=================================================================================
159 //=================================================================================
160 void BasicGUI_PointDlg::Init()
162 GroupOnCurve->LineEdit1->setReadOnly( true );
163 GroupRefPoint->LineEdit1->setReadOnly( true );
164 GroupLineIntersection->LineEdit1->setReadOnly( true );
165 GroupLineIntersection->LineEdit2->setReadOnly( true );
167 myEdge = GEOM::GEOM_Object::_nil();
168 myRefPoint = GEOM::GEOM_Object::_nil();
170 myEditCurrentArgument = 0;
172 /* Get setting of step value from file configuration */
173 SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
174 double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100 );
176 /* min, max, step and decimals for spin boxes */
177 initSpinBox( GroupXYZ->SpinBox_DX, COORD_MIN, COORD_MAX, step, 3 ); // VSR:TODO : DBL_DIGITS_DISPLAY
178 initSpinBox( GroupXYZ->SpinBox_DY, COORD_MIN, COORD_MAX, step, 3 ); // VSR:TODO : DBL_DIGITS_DISPLAY
179 initSpinBox( GroupXYZ->SpinBox_DZ, COORD_MIN, COORD_MAX, step, 3 ); // VSR:TODO : DBL_DIGITS_DISPLAY
180 GroupXYZ->SpinBox_DX->setValue( 0.0 );
181 GroupXYZ->SpinBox_DY->setValue( 0.0 );
182 GroupXYZ->SpinBox_DZ->setValue( 0.0 );
184 initSpinBox( GroupRefPoint->SpinBox_DX, COORD_MIN, COORD_MAX, step, 3 ); // VSR:TODO : DBL_DIGITS_DISPLAY
185 initSpinBox( GroupRefPoint->SpinBox_DY, COORD_MIN, COORD_MAX, step, 3 ); // VSR:TODO : DBL_DIGITS_DISPLAY
186 initSpinBox( GroupRefPoint->SpinBox_DZ, COORD_MIN, COORD_MAX, step, 3 ); // VSR:TODO : DBL_DIGITS_DISPLAY
187 GroupRefPoint->SpinBox_DX->setValue( 0.0 );
188 GroupRefPoint->SpinBox_DY->setValue( 0.0 );
189 GroupRefPoint->SpinBox_DZ->setValue( 0.0 );
193 initSpinBox( GroupOnCurve->SpinBox_DX, 0., 1., step, 3 ); // VSR:TODO : DBL_DIGITS_DISPLAY
194 GroupOnCurve->SpinBox_DX->setValue( 0.5 );
196 /* signals and slots connections */
197 connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) );
198 connect( myGeomGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) );
200 connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
201 connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
203 connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );
205 connect( GroupOnCurve->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
206 connect( GroupOnCurve->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
208 connect( GroupLineIntersection->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
209 connect( GroupLineIntersection->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
210 connect( GroupLineIntersection->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
211 connect( GroupLineIntersection->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
213 connect( GroupOnCurve->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
214 connect( GroupXYZ->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
215 connect( GroupXYZ->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
216 connect( GroupXYZ->SpinBox_DZ, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
217 connect( GroupRefPoint->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
218 connect( GroupRefPoint->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
219 connect( GroupRefPoint->SpinBox_DZ, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
222 connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupOnCurve->SpinBox_DX, SLOT( SetStep( double ) ) );
223 connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupXYZ->SpinBox_DX, SLOT( SetStep( double ) ) );
224 connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupXYZ->SpinBox_DY, SLOT( SetStep( double ) ) );
225 connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupXYZ->SpinBox_DZ, SLOT( SetStep( double ) ) );
226 connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupRefPoint->SpinBox_DX, SLOT( SetStep( double ) ) );
227 connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupRefPoint->SpinBox_DY, SLOT( SetStep( double ) ) );
228 connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupRefPoint->SpinBox_DZ, SLOT( SetStep( double ) ) );
231 connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged() ),
232 this, SLOT(SelectionIntoArgument() ) );
235 initName( tr( "GEOM_VERTEX" ) );
237 ConstructorsClicked( 0 );
241 //=================================================================================
242 // function : ConstructorsClicked()
243 // purpose : Radio button management
244 //=================================================================================
245 void BasicGUI_PointDlg::ConstructorsClicked(int constructorId)
247 globalSelection(); // close local contexts, if any
249 switch ( constructorId ) {
252 localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
254 GroupRefPoint->hide();
255 GroupOnCurve->hide();
256 GroupLineIntersection->hide();
265 myEditCurrentArgument = GroupRefPoint->LineEdit1;
266 myEditCurrentArgument->setText( "" );
267 myRefPoint = GEOM::GEOM_Object::_nil();
269 localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
272 GroupOnCurve->hide();
273 GroupLineIntersection->hide();
275 GroupRefPoint->show();
282 myEditCurrentArgument = GroupOnCurve->LineEdit1;
283 myEditCurrentArgument->setText( "" );
284 myEdge = GEOM::GEOM_Object::_nil();
286 localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
289 GroupRefPoint->hide();
290 GroupLineIntersection->hide();
292 GroupOnCurve->show();
299 myEditCurrentArgument = GroupLineIntersection->LineEdit1;
300 GroupLineIntersection->LineEdit1->setText( "" );
301 GroupLineIntersection->LineEdit2->setText( "" );
302 myLine1 = GEOM::GEOM_Object::_nil();
303 myLine2 = GEOM::GEOM_Object::_nil();
305 localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
308 GroupRefPoint->hide();
309 GroupOnCurve->hide();
313 GroupLineIntersection->show();
322 qApp->processEvents();
324 resize( minimumSize() );
326 SelectionIntoArgument();
330 //=================================================================================
331 // function : ClickOnOk()
333 //=================================================================================
334 void BasicGUI_PointDlg::ClickOnOk()
341 //=================================================================================
342 // function : ClickOnApply()
344 //=================================================================================
345 bool BasicGUI_PointDlg::ClickOnApply()
351 ConstructorsClicked( getConstructorId() );
356 //=================================================================================
357 // function : SelectionIntoArgument()
358 // purpose : Called when selection as changed (for constructors not using local context)
359 //=================================================================================
360 void BasicGUI_PointDlg::SelectionIntoArgument()
362 const int id = getConstructorId();
364 if ( ( id == 1 || id == 2 ) && myEditCurrentArgument != 0 ) {
365 myEditCurrentArgument->setText( "" );
369 myRefPoint = myEdge = GEOM::GEOM_Object::_nil();
372 if ( IObjectCount() == 1 ) {
373 Standard_Boolean aRes = Standard_False;
374 Handle(SALOME_InteractiveObject) anIO = firstIObject();
375 GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes );
376 if ( !CORBA::is_nil( aSelectedObject ) && aRes ) {
377 QString aName = GEOMBase::GetName(aSelectedObject);
380 if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) {
381 TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
382 if ( id == 2 || id == 3 )
383 aNeedType = TopAbs_EDGE;
385 LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
386 TColStd_IndexedMapOfInteger aMap;
387 aSelMgr->GetIndexes(firstIObject(), aMap);
388 if ( aMap.Extent() == 1 ) { // Local Selection
389 int anIndex = aMap( 1 );
390 if ( aNeedType == TopAbs_EDGE )
391 aName += QString( ":edge_%1" ).arg( anIndex );
393 aName += QString( ":vertex_%1" ).arg( anIndex );
395 //Find SubShape Object in Father
396 GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather( aSelectedObject, aName );
398 if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
399 GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() );
400 aSelectedObject = aShapesOp->GetSubShape( aSelectedObject, anIndex );
403 aSelectedObject = aFindedObject; // get Object from study
406 else { // Global Selection
407 if ( aShape.ShapeType() != aNeedType ) {
408 aSelectedObject = GEOM::GEOM_Object::_nil();
410 if ( id == 0 ) return;
416 if ( aShape.IsNull() ) return;
417 gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) );
418 GroupXYZ->SpinBox_DX->setValue( aPnt.X() );
419 GroupXYZ->SpinBox_DY->setValue( aPnt.Y() );
420 GroupXYZ->SpinBox_DZ->setValue( aPnt.Z() );
422 else if ( id == 1 ) {
423 myRefPoint = aSelectedObject;
424 GroupRefPoint->LineEdit1->setText( aName );
426 else if ( id == 2 ) {
427 myEdge = aSelectedObject;
428 GroupOnCurve->LineEdit1->setText( aName );
430 else if ( id == 3 ) {
431 if ( myEditCurrentArgument == GroupLineIntersection->LineEdit1 ) {
432 myLine1 = aSelectedObject;
433 myEditCurrentArgument->setText( aName );
435 else if ( myEditCurrentArgument == GroupLineIntersection->LineEdit2 ) {
436 myLine2 = aSelectedObject;
437 myEditCurrentArgument->setText( aName );
447 //=================================================================================
448 // function : LineEditReturnPressed()
450 //=================================================================================
451 void BasicGUI_PointDlg::LineEditReturnPressed()
453 QLineEdit* send = (QLineEdit*)sender();
454 if ( send == GroupRefPoint->LineEdit1 ||
455 send == GroupOnCurve->LineEdit1 ||
456 send == GroupLineIntersection->LineEdit1 ||
457 send == GroupLineIntersection->LineEdit2 ) {
458 myEditCurrentArgument = send;
459 GEOMBase_Skeleton::LineEditReturnPressed();
464 //=================================================================================
465 // function : SetEditCurrentArgument()
467 //=================================================================================
468 void BasicGUI_PointDlg::SetEditCurrentArgument()
470 globalSelection(); // close local contexts, if any
472 QPushButton* send = (QPushButton*)sender();
473 globalSelection( GEOM_POINT ); // to break previous local selection
475 if ( send == GroupRefPoint->PushButton1 ) {
476 GroupRefPoint->LineEdit1->setFocus();
477 myEditCurrentArgument = GroupRefPoint->LineEdit1;
479 localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
481 else if ( send == GroupOnCurve->PushButton1 ) {
482 GroupOnCurve->LineEdit1->setFocus();
483 myEditCurrentArgument = GroupOnCurve->LineEdit1;
485 localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
487 else if ( send == GroupLineIntersection->PushButton1 ) {
488 GroupLineIntersection->LineEdit1->setFocus();
489 myEditCurrentArgument = GroupLineIntersection->LineEdit1;
491 localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
493 else if ( send == GroupLineIntersection->PushButton2 ) {
494 GroupLineIntersection->LineEdit2->setFocus();
495 myEditCurrentArgument = GroupLineIntersection->LineEdit2;
497 localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
502 //=================================================================================
503 // function : enterEvent()
504 // purpose : to reactivate this dialog box when mouse enter onto the window
505 //=================================================================================
506 void BasicGUI_PointDlg::enterEvent( QEvent* )
508 if ( !mainFrame()->GroupConstructors->isEnabled() )
509 ActivateThisDialog();
513 //=================================================================================
514 // function : ActivateThisDialog()
516 //=================================================================================
517 void BasicGUI_PointDlg::ActivateThisDialog( )
519 GEOMBase_Skeleton::ActivateThisDialog();
520 // myGeomGUI->SetState( 0 );
521 ConstructorsClicked( getConstructorId() );
525 //=================================================================================
526 // function : DeactivateActiveDialog()
527 // purpose : public slot to deactivate if active
528 //=================================================================================
529 void BasicGUI_PointDlg::DeactivateActiveDialog()
531 // myGeomGUI->SetState( -1 );
532 GEOMBase_Skeleton::DeactivateActiveDialog();
536 //=================================================================================
537 // function : ValueChangedInSpinBox()
539 //=================================================================================
540 void BasicGUI_PointDlg::ValueChangedInSpinBox(double newValue)
545 //=================================================================================
546 // funcion : getParameter()
548 //=================================================================================
549 double BasicGUI_PointDlg::getParameter() const
551 return GroupOnCurve->SpinBox_DX->value();
554 //=================================================================================
555 // function : OnPointSelected
557 //=================================================================================
558 void BasicGUI_PointDlg::OnPointSelected( const gp_Pnt& thePnt )
560 if ( getConstructorId() == 0 ) {
561 GroupXYZ->SpinBox_DX->setValue( thePnt.X() );
562 GroupXYZ->SpinBox_DY->setValue( thePnt.Y() );
563 GroupXYZ->SpinBox_DZ->setValue( thePnt.Z() );
569 //=================================================================================
570 // function : createOperation
572 //=================================================================================
573 GEOM::GEOM_IOperations_ptr BasicGUI_PointDlg::createOperation()
575 return myGeomGUI->GetGeomGen()->GetIBasicOperations( getStudyId() );
578 //=================================================================================
579 // function : isValid
581 //=================================================================================
582 bool BasicGUI_PointDlg::isValid( QString& /*msg*/ )
584 const int id = getConstructorId();
588 return !myRefPoint->_is_nil();
590 return !myEdge->_is_nil();
592 return ( !myLine1->_is_nil() && !myLine2->_is_nil() );
596 //=================================================================================
597 // function : execute
599 //=================================================================================
600 bool BasicGUI_PointDlg::execute( ObjectList& objects )
604 GEOM::GEOM_Object_var anObj;
606 switch ( getConstructorId() ) {
609 double x = GroupXYZ->SpinBox_DX->value();
610 double y = GroupXYZ->SpinBox_DY->value();
611 double z = GroupXYZ->SpinBox_DZ->value();
613 anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->MakePointXYZ( x, y, z );
619 double dx = GroupRefPoint->SpinBox_DX->value();
620 double dy = GroupRefPoint->SpinBox_DY->value();
621 double dz = GroupRefPoint->SpinBox_DZ->value();
623 anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->
624 MakePointWithReference( myRefPoint, dx, dy, dz );
629 anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->
630 MakePointOnCurve( myEdge, getParameter() );
634 anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->
635 MakePointOnLinesIntersection( myLine1, myLine2 );
640 if ( getConstructorId() == 1 || getConstructorId() == 2 ) {
642 if ( GEOMBase::GetShape( anObj, aShape ) && !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX ) {
643 gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) );
644 myX->setText( QString( "%1" ).arg( aPnt.X() ) );
645 myY->setText( QString( "%1" ).arg( aPnt.Y() ) );
646 myZ->setText( QString( "%1" ).arg( aPnt.Z() ) );
655 if ( !anObj->_is_nil() ) {
656 objects.push_back( anObj._retn() );
662 //=================================================================================
663 // function : addSubshapeToStudy
664 // purpose : virtual method to add new SubObjects if local selection
665 //=================================================================================
666 void BasicGUI_PointDlg::addSubshapesToStudy()
668 QMap<QString, GEOM::GEOM_Object_var> objMap;
670 switch ( getConstructorId() ) {
674 objMap[GroupRefPoint->LineEdit1->text()] = myRefPoint;
677 objMap[GroupOnCurve->LineEdit1->text()] = myEdge;
680 objMap[GroupLineIntersection->LineEdit1->text()] = myLine1;
681 objMap[GroupLineIntersection->LineEdit2->text()] = myLine2;
684 addSubshapesToFather( objMap );