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
24 // File : BasicGUI_MarkerDlg.cxx
25 // Author : Sergey LITONIN
29 #include "BasicGUI_MarkerDlg.h"
30 #include "DlgRef_SpinBox.h"
32 #include "SUIT_Desktop.h"
33 #include "SUIT_Session.h"
34 #include "SalomeApp_Application.h"
35 #include "LightApp_SelectionMgr.h"
39 #include "GEOMImpl_Types.hxx"
41 #include "utilities.h"
44 #include <BRep_Tool.hxx>
48 #include <TopoDS_Vertex.hxx>
49 #include <TopoDS_Face.hxx>
50 #include <Geom_Plane.hxx>
51 #include <TopTools_IndexedMapOfShape.hxx>
52 #include <TColStd_IndexedMapOfInteger.hxx>
56 //=================================================================================
57 // class : BasicGUI_MarkerDlg()
58 // purpose : Constructor
59 //=================================================================================
60 BasicGUI_MarkerDlg::BasicGUI_MarkerDlg( GeometryGUI* theGeometryGUI, QWidget* theParent )
61 : GEOMBase_Skeleton(theGeometryGUI, theParent, "BasicGUI_MarkerDlg", false,
62 WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
64 QPixmap iconCS1 ( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_MARKER" ) ) );
65 QPixmap iconCS2 ( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_MARKER2" ) ) );
66 QPixmap iconCS3 ( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_MARKER3" ) ) );
67 QPixmap iconSelect( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
69 setCaption( tr( "CAPTION" ) );
71 GroupConstructors->setTitle( tr( "LOCALCS" ) );
72 RadioButton1->setPixmap( iconCS1 );
73 RadioButton2->setPixmap( iconCS2 );
74 RadioButton3->setPixmap( iconCS3 );
76 Group1 = new DlgRef_1Sel_QTD(this, "Group1");
77 Group1->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
78 Group1->TextLabel1->setText(tr("GEOM_OBJECT"));
79 Group1->PushButton1->setPixmap(iconSelect);
81 Group2 = new DlgRef_3Sel_QTD(this, "Group2");
82 Group2->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
83 Group2->TextLabel1->setText(tr("GEOM_POINT"));
84 Group2->TextLabel2->setText(tr("XDIR"));
85 Group2->TextLabel3->setText(tr("YDIR"));
86 Group2->PushButton1->setPixmap(iconSelect);
87 Group2->PushButton2->setPixmap(iconSelect);
88 Group2->PushButton3->setPixmap(iconSelect);
90 aMainGrp = new QGroupBox( 1, Qt::Horizontal, this );
91 aMainGrp->setFrameStyle( QFrame::NoFrame );
92 aMainGrp->setInsideMargin( 0 );
94 QGroupBox* anOriGrp = new QGroupBox( 1, Qt::Vertical, tr( "ORIGIN" ), aMainGrp );
95 new QLabel( tr( "GEOM_X" ), anOriGrp );
96 myData[ X ] = new DlgRef_SpinBox( anOriGrp );
97 new QLabel( tr( "GEOM_Y" ), anOriGrp );
98 myData[ Y ] = new DlgRef_SpinBox( anOriGrp );
99 new QLabel( tr( "GEOM_Z" ), anOriGrp );
100 myData[ Z ] = new DlgRef_SpinBox( anOriGrp );
102 QGroupBox* aXAxisGrp = new QGroupBox( 1, Qt::Vertical, tr( "XDIR" ), aMainGrp );
103 new QLabel( tr( "DX" ), aXAxisGrp );
104 myData[ DX1 ] = new DlgRef_SpinBox( aXAxisGrp );
105 new QLabel( tr( "DY" ), aXAxisGrp );
106 myData[ DY1 ] = new DlgRef_SpinBox( aXAxisGrp );
107 new QLabel( tr( "DZ" ), aXAxisGrp );
108 myData[ DZ1 ] = new DlgRef_SpinBox( aXAxisGrp );
110 QGroupBox* anYAxisGrp = new QGroupBox( 1, Qt::Vertical, tr( "YDIR" ), aMainGrp );
111 new QLabel( tr( "DX" ), anYAxisGrp );
112 myData[ DX2 ] = new DlgRef_SpinBox( anYAxisGrp );
113 new QLabel( tr( "DY" ), anYAxisGrp );
114 myData[ DY2 ] = new DlgRef_SpinBox( anYAxisGrp );
115 new QLabel( tr( "DZ" ), anYAxisGrp );
116 myData[ DZ2 ] = new DlgRef_SpinBox( anYAxisGrp );
118 Layout1->addWidget( aMainGrp, 2, 0 );
119 Layout1->addWidget( Group1, 2, 0 );
120 Layout1->addWidget( Group2, 2, 0 );
122 setHelpFileName("local_coordinate_system.htm");
128 //=================================================================================
129 // function : ~BasicGUI_MarkerDlg()
130 // purpose : Destroys the object and frees any allocated resources
131 //=================================================================================
132 BasicGUI_MarkerDlg::~BasicGUI_MarkerDlg()
137 //=================================================================================
140 //=================================================================================
141 void BasicGUI_MarkerDlg::Init()
143 myBlockPreview = false;
144 myConstructorId = -1;
145 myEditCurrentArgument = Group1->LineEdit1;
146 Group1->LineEdit1->setReadOnly( true );
147 Group2->LineEdit1->setReadOnly( true );
148 Group2->LineEdit2->setReadOnly( true );
149 Group2->LineEdit3->setReadOnly( true );
151 connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int)));
152 connect(Group1->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
153 connect(Group2->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
154 connect(Group2->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
155 connect(Group2->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
157 connect(Group1->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
158 connect(Group2->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
159 connect(Group2->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
160 connect(Group2->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
162 connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( onClose() ) );
163 connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( onDeactivate() ) );
164 connect( myGeomGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( onClose() ) );
166 connect( buttonOk, SIGNAL( clicked() ), this, SLOT( onOk() ) );
167 connect( buttonApply, SIGNAL( clicked() ), this, SLOT( onApply() ) );
169 connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
170 SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionDone() ) );
172 initName( tr( "LCS_NAME" ) );
174 SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
175 double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100);
177 for ( DataMap::iterator anIter = myData.begin(); anIter != myData.end(); ++anIter )
179 anIter.data()->RangeStepAndValidator( COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY );
180 connect( anIter.data(), SIGNAL( valueChanged( double ) ),
181 this, SLOT( onValueChanged( double ) ) );
184 myBlockPreview = true;
185 for ( DataMap::iterator anIter = myData.begin(); anIter != myData.end(); ++anIter )
186 anIter.data()->SetValue( 0 );
187 myData[ DX1 ]->SetValue( 1 );
188 myData[ DY2 ]->SetValue( 1 );
189 myBlockPreview = false;
191 ConstructorsClicked( 0 );
196 QAD_ViewFrame* aFrame = QAD_Application::getDesktop()->getActiveApp()->
197 getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame();
199 VTKViewer_ViewFrame* aVTKFrame = dynamic_cast<VTKViewer_ViewFrame*>( aFrame );
202 aVTKFrame->AdjustTrihedrons( true );
206 OCCViewer_ViewFrame* aOCCFrame = dynamic_cast<OCCViewer_ViewFrame*>( aFrame );
208 aOCCFrame->AdjustTrihedrons( true );
212 //=================================================================================
213 // function : ConstructorsClicked()
214 // purpose : Radio button management
215 //=================================================================================
216 void BasicGUI_MarkerDlg::ConstructorsClicked( int constructorId )
218 if ( myConstructorId == constructorId && myConstructorId == 0 )
220 localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
221 activate( GEOM_MARKER );
226 myConstructorId = constructorId;
228 disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0);
230 switch (constructorId)
238 localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
239 activate( GEOM_MARKER );
246 //PAL6669: resize(0, 0);
249 globalSelection( GEOM_ALLGEOM );
250 myEditCurrentArgument = Group1->LineEdit1;
251 Group1->LineEdit1->setText("");
258 //PAL6669: resize(0, 0);
261 globalSelection( GEOM_POINT );
262 myEditCurrentArgument = Group2->LineEdit1;
263 Group2->LineEdit1->setText("");
264 Group2->LineEdit2->setText("");
265 Group2->LineEdit3->setText("");
270 connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
271 SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionDone()));
275 //=================================================================================
278 //=================================================================================
279 void BasicGUI_MarkerDlg::onOk()
285 //=======================================================================
286 // function : onClose()
288 //=======================================================================
289 void BasicGUI_MarkerDlg::onClose()
291 GEOMBase_Skeleton::ClickOnCancel();
294 //=================================================================================
295 // function : onApply()
297 //=================================================================================
298 bool BasicGUI_MarkerDlg::onApply()
304 ConstructorsClicked( getConstructorId() );
309 //=================================================================================
310 // function : onSelectionDone0()
311 // purpose : Reaction on selection when first method of creation is current one
312 //=================================================================================
313 void BasicGUI_MarkerDlg::onSelectionDone0()
315 if ( IObjectCount() == 1 )
317 Standard_Boolean aRes = Standard_False;
318 Handle(SALOME_InteractiveObject) anIO = firstIObject();
319 GEOM::GEOM_Object_var aSelectedObj = GEOMBase::ConvertIOinGEOMObject( anIO, aRes );
321 LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
323 if ( aRes && !aSelectedObj->_is_nil() )
326 if ( GEOMBase::GetShape( aSelectedObj, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
328 // Existing LCS selected
329 if ( aSelectedObj->GetType() == GEOM_MARKER && aShape.ShapeType() == TopAbs_FACE )
331 TopoDS_Face aFace = TopoDS::Face( aShape );
332 Handle(Geom_Plane) aPlane = Handle(Geom_Plane)::DownCast( BRep_Tool::Surface( aFace ) );
334 if ( !aPlane.IsNull() )
336 gp_Ax3 anAx3 = aPlane->Pln().Position();
337 gp_Pnt aLoc = anAx3.Location();
338 gp_Dir aXDir = anAx3.XDirection();
339 gp_Dir aYDir = anAx3.YDirection();
341 myData[ X ]->SetValue( aLoc.X() );
342 myData[ Y ]->SetValue( aLoc.Y() );
343 myData[ Z ]->SetValue( aLoc.Z() );
345 myData[ DX1 ]->SetValue( aXDir.X() );
346 myData[ DY1 ]->SetValue( aXDir.Y() );
347 myData[ DZ1 ]->SetValue( aXDir.Z() );
349 myData[ DX2 ]->SetValue( aYDir.X() );
350 myData[ DY2 ]->SetValue( aYDir.Y() );
351 myData[ DZ2 ]->SetValue( aYDir.Z() );
352 aSelMgr->clearSelected();
357 TColStd_IndexedMapOfInteger aMap;
358 aSelMgr->GetIndexes( anIO, aMap );
359 if ( aMap.Extent() == 1 )
361 int anIndex = aMap( 1 );
362 TopTools_IndexedMapOfShape aShapes;
363 TopExp::MapShapes( aShape, aShapes );
364 aShape = aShapes.FindKey( anIndex );
365 aSelMgr->clearSelected();
368 if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX )
370 gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) );
371 myData[ X ]->SetValue( aPnt.X() );
372 myData[ Y ]->SetValue( aPnt.Y() );
373 myData[ Z ]->SetValue( aPnt.Z() );
384 //=================================================================================
385 // function : onSelectionDone()
386 // purpose : Called when selection as changed or other case
387 //=================================================================================
388 void BasicGUI_MarkerDlg::onSelectionDone()
390 if ( getConstructorId() == 0 ) {
395 myEditCurrentArgument->setText("");
398 if ( IObjectCount() == 1 ) {
399 Standard_Boolean aRes = Standard_False;
400 Handle(SALOME_InteractiveObject) anIO = firstIObject();
401 GEOM::GEOM_Object_var aSelectedObj = GEOMBase::ConvertIOinGEOMObject( anIO, aRes );
403 if ( !CORBA::is_nil( aSelectedObj ) && aRes ) {
404 aName = GEOMBase::GetName( aSelectedObj );
406 if ( getConstructorId() == 1 ) { // by shape position
407 // Get shape's position
408 CORBA::Double Ox,Oy,Oz, Zx,Zy,Zz, Xx,Xy,Xz, Yx,Yy,Yz;
409 Ox = Oy = Oz = Zx = Zy = Xy = Xz = Yx = Yz = 0;
412 GEOM::GEOM_IMeasureOperations_ptr aMeasureOp =
413 myGeomGUI->GetGeomGen()->GetIMeasureOperations(getStudyId());
414 aMeasureOp->GetPosition(aSelectedObj, Ox,Oy,Oz, Zx,Zy,Zz, Xx,Xy,Xz);
416 // Calculate Y direction
417 if (aMeasureOp->IsDone()) {
418 gp_Pnt aPnt (Ox,Oy,Oz);
419 gp_Dir aDirN (Zx,Zy,Zz);
420 gp_Dir aDirX (Xx,Xy,Xz);
421 gp_Ax3 anAx3 (aPnt, aDirN, aDirX);
423 gp_Dir aDirY = anAx3.YDirection();
424 aDirY.Coord(Yx,Yy,Yz);
428 myData[ X ]->SetValue( Ox );
429 myData[ Y ]->SetValue( Oy );
430 myData[ Z ]->SetValue( Oz );
432 myData[ DX1 ]->SetValue( Xx );
433 myData[ DY1 ]->SetValue( Xy );
434 myData[ DZ1 ]->SetValue( Xz );
436 myData[ DX2 ]->SetValue( Yx );
437 myData[ DY2 ]->SetValue( Yy );
438 myData[ DZ2 ]->SetValue( Yz );
440 myEditCurrentArgument->setText( aName );
442 else if ( getConstructorId() == 2 ) { // by point and two vectors
444 if ( GEOMBase::GetShape( aSelectedObj, aShape, TopAbs_SHAPE ) ) {
445 GEOM::short_array anIndexes;
447 TColStd_IndexedMapOfInteger aMap;
448 LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
449 aSelMgr->GetIndexes( anIO, aMap );
451 if ( !aMap.IsEmpty() ) {
452 int anIndex = aMap( 1 );
453 TopTools_IndexedMapOfShape aShapes;
454 TopExp::MapShapes( aShape, aShapes );
455 aShape = aShapes.FindKey( anIndex );
458 if (myEditCurrentArgument == Group2->LineEdit1) {
459 if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX ) {
460 gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) );
461 myData[ X ]->SetValue( aPnt.X() );
462 myData[ Y ]->SetValue( aPnt.Y() );
463 myData[ Z ]->SetValue( aPnt.Z() );
464 myEditCurrentArgument->setText( aName );
467 myData[ X ]->SetValue( 0 );
468 myData[ Y ]->SetValue( 0 );
469 myData[ Z ]->SetValue( 0 );
472 else if (myEditCurrentArgument == Group2->LineEdit2) {
473 if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_EDGE ) {
474 gp_Pnt aP1 = BRep_Tool::Pnt(TopExp::FirstVertex(TopoDS::Edge(aShape)));
475 gp_Pnt aP2 = BRep_Tool::Pnt(TopExp::LastVertex(TopoDS::Edge(aShape)));
476 gp_Dir aDir(gp_Vec(aP1, aP2));
478 myData[ DX1 ]->SetValue( aDir.X() );
479 myData[ DY1 ]->SetValue( aDir.Y() );
480 myData[ DZ1 ]->SetValue( aDir.Z() );
481 myEditCurrentArgument->setText( aName );
484 myData[ DX1 ]->SetValue( 0 );
485 myData[ DY1 ]->SetValue( 0 );
486 myData[ DZ1 ]->SetValue( 0 );
489 else if (myEditCurrentArgument == Group2->LineEdit3) {
490 if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_EDGE ) {
491 gp_Pnt aP1 = BRep_Tool::Pnt(TopExp::FirstVertex(TopoDS::Edge(aShape)));
492 gp_Pnt aP2 = BRep_Tool::Pnt(TopExp::LastVertex(TopoDS::Edge(aShape)));
493 gp_Dir aDir(gp_Vec(aP1, aP2));
495 myData[ DX2 ]->SetValue( aDir.X() );
496 myData[ DY2 ]->SetValue( aDir.Y() );
497 myData[ DZ2 ]->SetValue( aDir.Z() );
498 myEditCurrentArgument->setText( aName );
501 myData[ DX2 ]->SetValue( 0 );
502 myData[ DY2 ]->SetValue( 0 );
503 myData[ DZ2 ]->SetValue( 0 );
511 if ( getConstructorId() == 1 ) {
512 myData[ X ]->SetValue( 0 );
513 myData[ Y ]->SetValue( 0 );
514 myData[ Z ]->SetValue( 0 );
516 myData[ DX1 ]->SetValue( 0 );
517 myData[ DY1 ]->SetValue( 0 );
518 myData[ DZ1 ]->SetValue( 0 );
520 myData[ DX2 ]->SetValue( 0 );
521 myData[ DY2 ]->SetValue( 0 );
522 myData[ DZ2 ]->SetValue( 0 );
524 else if ( getConstructorId() == 2 ) {
525 if (myEditCurrentArgument == Group2->LineEdit1) {
526 myData[ X ]->SetValue( 0 );
527 myData[ Y ]->SetValue( 0 );
528 myData[ Z ]->SetValue( 0 );
530 else if (myEditCurrentArgument == Group2->LineEdit2) {
531 myData[ DX1 ]->SetValue( 0 );
532 myData[ DY1 ]->SetValue( 0 );
533 myData[ DZ1 ]->SetValue( 0 );
535 else if (myEditCurrentArgument == Group2->LineEdit3) {
536 myData[ DX2 ]->SetValue( 0 );
537 myData[ DY2 ]->SetValue( 0 );
538 myData[ DZ2 ]->SetValue( 0 );
546 //=================================================================================
547 // function : SetEditCurrentArgument()
549 //=================================================================================
550 void BasicGUI_MarkerDlg::SetEditCurrentArgument()
552 QPushButton* send = (QPushButton*)sender();
554 if(send == Group1->PushButton1) {
555 myEditCurrentArgument = Group1->LineEdit1;
556 globalSelection( GEOM_ALLGEOM );
558 else if(send == Group2->PushButton1) {
559 myEditCurrentArgument = Group2->LineEdit1;
560 globalSelection( GEOM_POINT );
562 else if(send == Group2->PushButton2) {
563 myEditCurrentArgument = Group2->LineEdit2;
564 globalSelection( GEOM_LINE );
566 else if(send == Group2->PushButton3) {
567 myEditCurrentArgument = Group2->LineEdit3;
568 globalSelection( GEOM_LINE );
571 myEditCurrentArgument->setFocus();
575 //=================================================================================
576 // function : LineEditReturnPressed()
578 //=================================================================================
579 void BasicGUI_MarkerDlg::LineEditReturnPressed()
581 QLineEdit* send = (QLineEdit*)sender();
583 myEditCurrentArgument = send;
584 GEOMBase_Skeleton::LineEditReturnPressed();
587 //=================================================================================
588 // function : onActivate()
590 //=================================================================================
591 void BasicGUI_MarkerDlg::onActivate()
593 GEOMBase_Skeleton::ActivateThisDialog();
594 connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
595 SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionDone() ) );
597 ConstructorsClicked( getConstructorId() );
600 //=================================================================================
601 // function : onDeactivate()
602 // purpose : public slot to deactivate if active
603 //=================================================================================
604 void BasicGUI_MarkerDlg::onDeactivate()
606 GEOMBase_Skeleton::DeactivateActiveDialog();
609 //=================================================================================
610 // function : enterEvent()
612 //=================================================================================
613 void BasicGUI_MarkerDlg::enterEvent(QEvent* e)
615 if ( !GroupConstructors->isEnabled() )
619 //=================================================================================
620 // function : createOperation
622 //=================================================================================
623 GEOM::GEOM_IOperations_ptr BasicGUI_MarkerDlg::createOperation()
625 return myGeomGUI->GetGeomGen()->GetIBasicOperations( getStudyId() );
628 //=================================================================================
629 // function : isValid
631 //=================================================================================
632 bool BasicGUI_MarkerDlg::isValid( QString& msg )
634 const int id = getConstructorId();
635 gp_Vec v1( myData[ DX1 ]->GetValue(), myData[ DY1 ]->GetValue(), myData[ DZ1 ]->GetValue() ),
636 v2( myData[ DX2 ]->GetValue(), myData[ DY2 ]->GetValue(), myData[ DZ2 ]->GetValue() );
639 // we will got exception if the magnitude of any of the 2 vectors <= gp::Resolution()
640 // Vectors shouldn't be checked for being orthogonal here!
641 if ( v1.Magnitude() > gp::Resolution() && v2.Magnitude() > gp::Resolution() ) {
642 isOk = !v1.IsParallel( v2, Precision::Angular() );
644 msg += tr( "VEC_PARALLEL" );
652 return !Group1->LineEdit1->text().isEmpty() && isOk;
654 return !Group2->LineEdit1->text().isEmpty() &&
655 !Group2->LineEdit2->text().isEmpty() &&
656 !Group2->LineEdit3->text().isEmpty() && isOk;
661 //=================================================================================
662 // function : execute
664 //=================================================================================
665 bool BasicGUI_MarkerDlg::execute( ObjectList& objects )
667 GEOM::GEOM_Object_var anObj = GEOM::GEOM_IBasicOperations::_narrow(
668 getOperation() )->MakeMarker( myData[ X ]->GetValue(), myData[ Y ]->GetValue(), myData[ Z ]->GetValue(),
669 myData[ DX1 ]->GetValue(), myData[ DY1 ]->GetValue(), myData[ DZ1 ]->GetValue(),
670 myData[ DX2 ]->GetValue(), myData[ DY2 ]->GetValue(), myData[ DZ2 ]->GetValue() );
672 if ( !anObj->_is_nil() )
673 objects.push_back( anObj._retn() );
678 //=================================================================================
679 // function : closeEvent
681 //=================================================================================
682 void BasicGUI_MarkerDlg::closeEvent( QCloseEvent* e )
684 GEOMBase_Skeleton::closeEvent( e );
687 //=================================================================================
688 // function : onValueChanged
690 //=================================================================================
691 void BasicGUI_MarkerDlg::onValueChanged( double )
696 //=================================================================================
697 // function : displayPreview
699 //=================================================================================
700 void BasicGUI_MarkerDlg::displayPreview ( const bool activate,
702 const bool toRemoveFromEngine,
703 const double lineWidth )
705 if ( !myBlockPreview )
707 GEOMBase_Skeleton::displayPreview( activate, update, toRemoveFromEngine, lineWidth );
708 if ( myConstructorId == 0 )
710 GEOMBase_Skeleton::activate( GEOM_MARKER );