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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : BasicGUI_MarkerDlg.cxx
25 // Author : Sergey LITONIN
29 #include "BasicGUI_MarkerDlg.h"
30 #include "DlgRef_SpinBox.h"
31 #include "QAD_Desktop.h"
32 #include "QAD_RightFrame.h"
33 #include "VTKViewer_ViewFrame.h"
34 #include "OCCViewer_ViewFrame.h"
35 #include "QAD_Config.h"
36 #include "GEOMImpl_Types.hxx"
37 #include "utilities.h"
42 #include <TopoDS_Vertex.hxx>
43 #include <TopoDS_Face.hxx>
44 #include <TColStd_IndexedMapOfInteger.hxx>
45 #include <TopTools_IndexedMapOfShape.hxx>
46 #include <BRep_Tool.hxx>
49 #include <Geom_Plane.hxx>
50 #include <GProp_GProps.hxx>
51 #include <BRepGProp.hxx>
53 //=================================================================================
54 // class : BasicGUI_MarkerDlg()
55 // purpose : Constructor
56 //=================================================================================
57 BasicGUI_MarkerDlg::BasicGUI_MarkerDlg( QWidget* theParent, SALOME_Selection* theSel )
58 : GEOMBase_Skeleton( theParent, "BasicGUI_MarkerDlg", theSel, false,
59 WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
61 QPixmap iconCS1 ( QAD_Desktop::getResourceManager()->loadPixmap( "GEOM", tr( "ICON_MARKER" ) ) );
62 QPixmap iconCS2 ( QAD_Desktop::getResourceManager()->loadPixmap( "GEOM", tr( "ICON_MARKER2" ) ) );
63 QPixmap iconCS3 ( QAD_Desktop::getResourceManager()->loadPixmap( "GEOM", tr( "ICON_MARKER3" ) ) );
64 QPixmap iconSelect( QAD_Desktop::getResourceManager()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
66 setCaption( tr( "CAPTION" ) );
68 GroupConstructors->setTitle( tr( "LOCALCS" ) );
69 RadioButton1->setPixmap( iconCS1 );
70 RadioButton2->setPixmap( iconCS2 );
71 RadioButton3->setPixmap( iconCS3 );
73 Group1 = new DlgRef_1Sel_QTD(this, "Group1");
74 Group1->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
75 Group1->TextLabel1->setText(tr("GEOM_OBJECT"));
76 Group1->PushButton1->setPixmap(iconSelect);
78 Group2 = new DlgRef_3Sel_QTD(this, "Group2");
79 Group2->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
80 Group2->TextLabel1->setText(tr("GEOM_POINT"));
81 Group2->TextLabel2->setText(tr("XDIR"));
82 Group2->TextLabel3->setText(tr("YDIR"));
83 Group2->PushButton1->setPixmap(iconSelect);
84 Group2->PushButton2->setPixmap(iconSelect);
85 Group2->PushButton3->setPixmap(iconSelect);
87 aMainGrp = new QGroupBox( 1, Qt::Horizontal, this );
88 aMainGrp->setFrameStyle( QFrame::NoFrame );
89 aMainGrp->setInsideMargin( 0 );
91 QGroupBox* anOriGrp = new QGroupBox( 1, Qt::Vertical, tr( "ORIGIN" ), aMainGrp );
92 new QLabel( tr( "GEOM_X" ), anOriGrp );
93 myData[ X ] = new DlgRef_SpinBox( anOriGrp );
94 new QLabel( tr( "GEOM_Y" ), anOriGrp );
95 myData[ Y ] = new DlgRef_SpinBox( anOriGrp );
96 new QLabel( tr( "GEOM_Z" ), anOriGrp );
97 myData[ Z ] = new DlgRef_SpinBox( anOriGrp );
99 QGroupBox* aXAxisGrp = new QGroupBox( 1, Qt::Vertical, tr( "XDIR" ), aMainGrp );
100 new QLabel( tr( "DX" ), aXAxisGrp );
101 myData[ DX1 ] = new DlgRef_SpinBox( aXAxisGrp );
102 new QLabel( tr( "DY" ), aXAxisGrp );
103 myData[ DY1 ] = new DlgRef_SpinBox( aXAxisGrp );
104 new QLabel( tr( "DZ" ), aXAxisGrp );
105 myData[ DZ1 ] = new DlgRef_SpinBox( aXAxisGrp );
107 QGroupBox* anYAxisGrp = new QGroupBox( 1, Qt::Vertical, tr( "YDIR" ), aMainGrp );
108 new QLabel( tr( "DX" ), anYAxisGrp );
109 myData[ DX2 ] = new DlgRef_SpinBox( anYAxisGrp );
110 new QLabel( tr( "DY" ), anYAxisGrp );
111 myData[ DY2 ] = new DlgRef_SpinBox( anYAxisGrp );
112 new QLabel( tr( "DZ" ), anYAxisGrp );
113 myData[ DZ2 ] = new DlgRef_SpinBox( anYAxisGrp );
115 Layout1->addWidget( aMainGrp, 2, 0 );
116 Layout1->addWidget( Group1, 2, 0 );
117 Layout1->addWidget( Group2, 2, 0 );
123 //=================================================================================
124 // function : ~BasicGUI_MarkerDlg()
125 // purpose : Destroys the object and frees any allocated resources
126 //=================================================================================
127 BasicGUI_MarkerDlg::~BasicGUI_MarkerDlg()
132 //=================================================================================
135 //=================================================================================
136 void BasicGUI_MarkerDlg::Init( SALOME_Selection* theSel )
138 myBlockPreview = false;
139 myConstructorId = -1;
140 myEditCurrentArgument = Group1->LineEdit1;
141 Group1->LineEdit1->setReadOnly( true );
142 Group2->LineEdit1->setReadOnly( true );
143 Group2->LineEdit2->setReadOnly( true );
144 Group2->LineEdit3->setReadOnly( true );
146 GeometryGUI* aGeomGUI = GeometryGUI::GetGeomGUI();
148 connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int)));
149 connect(Group1->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
150 connect(Group2->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
151 connect(Group2->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
152 connect(Group2->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
154 connect(Group1->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
155 connect(Group2->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
156 connect(Group2->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
157 connect(Group2->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
159 connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( onClose() ) );
160 connect( aGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( onDeactivate() ) );
161 connect( aGeomGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( onClose() ) );
163 connect( buttonOk, SIGNAL( clicked() ), this, SLOT( onOk() ) );
164 connect( buttonApply, SIGNAL( clicked() ), this, SLOT( onApply() ) );
166 connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionDone() ) );
168 initName( tr( "LCS_NAME" ) );
170 QString aStr = QAD_CONFIG->getSetting( "Geometry:SettingsGeomStep" );
171 for ( DataMap::iterator anIter = myData.begin(); anIter != myData.end(); ++anIter )
173 anIter.data()->RangeStepAndValidator( -999.999, 999.999, aStr.toDouble(), 3 );
174 connect( anIter.data(), SIGNAL( valueChanged( double ) ),
175 this, SLOT( onValueChanged( double ) ) );
178 myBlockPreview = true;
179 for ( DataMap::iterator anIter = myData.begin(); anIter != myData.end(); ++anIter )
180 anIter.data()->SetValue( 0 );
181 myData[ DX1 ]->SetValue( 1 );
182 myData[ DY2 ]->SetValue( 1 );
183 myBlockPreview = false;
185 ConstructorsClicked( 0 );
187 QAD_ViewFrame* aFrame = QAD_Application::getDesktop()->getActiveApp()->
188 getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame();
190 VTKViewer_ViewFrame* aVTKFrame = dynamic_cast<VTKViewer_ViewFrame*>( aFrame );
193 aVTKFrame->AdjustTrihedrons( true );
197 OCCViewer_ViewFrame* aOCCFrame = dynamic_cast<OCCViewer_ViewFrame*>( aFrame );
199 aOCCFrame->AdjustTrihedrons( true );
202 //=================================================================================
203 // function : ConstructorsClicked()
204 // purpose : Radio button management
205 //=================================================================================
206 void BasicGUI_MarkerDlg::ConstructorsClicked( int constructorId )
208 if ( myConstructorId == constructorId && myConstructorId == 0 )
210 localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
211 activate( GEOM_MARKER );
216 myConstructorId = constructorId;
218 disconnect(mySelection, 0, this, 0);
220 switch (constructorId)
228 localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
229 activate( GEOM_MARKER );
239 globalSelection( GEOM_ALLGEOM );
240 myEditCurrentArgument = Group1->LineEdit1;
241 Group1->LineEdit1->setText("");
251 globalSelection( GEOM_POINT );
252 myEditCurrentArgument = Group2->LineEdit1;
253 Group2->LineEdit1->setText("");
254 Group2->LineEdit2->setText("");
255 Group2->LineEdit3->setText("");
260 connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionDone()));
264 //=================================================================================
267 //=================================================================================
268 void BasicGUI_MarkerDlg::onOk()
274 //=======================================================================
275 // function : onClose()
277 //=======================================================================
278 void BasicGUI_MarkerDlg::onClose()
280 GEOMBase_Skeleton::ClickOnCancel();
283 //=================================================================================
284 // function : onApply()
286 //=================================================================================
287 bool BasicGUI_MarkerDlg::onApply()
293 ConstructorsClicked( getConstructorId() );
298 //=================================================================================
299 // function : onSelectionDone0()
300 // purpose : Reaction on selection when first method of creation is current one
301 //=================================================================================
302 void BasicGUI_MarkerDlg::onSelectionDone0()
304 if ( mySelection->IObjectCount() == 1 )
307 Standard_Boolean aRes = Standard_False;
308 Handle(SALOME_InteractiveObject) anIO = mySelection->firstIObject();
309 GEOM::GEOM_Object_var aSelectedObj = GEOMBase::ConvertIOinGEOMObject( anIO, aRes );
311 if ( aRes && !aSelectedObj->_is_nil() )
314 if ( myGeomBase->GetShape( aSelectedObj, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
316 if ( aSelectedObj->GetType() == GEOM_MARKER && aShape.ShapeType() == TopAbs_FACE )
318 TopoDS_Face aFace = TopoDS::Face( aShape );
319 Handle(Geom_Plane) aPlane = Handle(Geom_Plane)::DownCast( BRep_Tool::Surface( aFace ) );
321 if ( !aPlane.IsNull() )
323 gp_Ax3 anAx3 = aPlane->Pln().Position();
324 gp_Pnt aLoc = anAx3.Location();
325 gp_Dir aXDir = anAx3.XDirection();
326 gp_Dir aYDir = anAx3.YDirection();
328 myData[ X ]->SetValue( aLoc.X() );
329 myData[ Y ]->SetValue( aLoc.Y() );
330 myData[ Z ]->SetValue( aLoc.Z() );
332 myData[ DX1 ]->SetValue( aXDir.X() );
333 myData[ DY1 ]->SetValue( aXDir.Y() );
334 myData[ DZ1 ]->SetValue( aXDir.Z() );
336 myData[ DX2 ]->SetValue( aYDir.X() );
337 myData[ DY2 ]->SetValue( aYDir.Y() );
338 myData[ DZ2 ]->SetValue( aYDir.Z() );
339 //mySelection->ClearIObjects();
344 if ( mySelection->HasIndex( anIO ) )
346 TColStd_IndexedMapOfInteger aMap;
347 mySelection->GetIndex( anIO, aMap );
348 if ( aMap.Extent() == 1 )
350 int anIndex = aMap( 1 );
351 TopTools_IndexedMapOfShape aShapes;
352 TopExp::MapShapes( aShape, aShapes );
353 aShape = aShapes.FindKey( anIndex );
354 //mySelection->ClearIObjects();
358 if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX )
360 gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) );
361 myData[ X ]->SetValue( aPnt.X() );
362 myData[ Y ]->SetValue( aPnt.Y() );
363 myData[ Z ]->SetValue( aPnt.Z() );
374 //=================================================================================
375 // function : onSelectionDone()
376 // purpose : Called when selection as changed or other case
377 //=================================================================================
378 void BasicGUI_MarkerDlg::onSelectionDone()
380 if ( getConstructorId() == 0 )
387 myEditCurrentArgument->setText("");
390 if ( mySelection->IObjectCount() == 1 ) {
391 Standard_Boolean aRes = Standard_False;
392 Handle(SALOME_InteractiveObject) anIO = mySelection->firstIObject();
393 GEOM::GEOM_Object_var aSelectedObj = GEOMBase::ConvertIOinGEOMObject( anIO, aRes );
395 if ( !CORBA::is_nil( aSelectedObj ) && aRes ) {
396 aName = GEOMBase::GetName( aSelectedObj );
398 if ( myGeomBase->GetShape( aSelectedObj, aShape, TopAbs_SHAPE ) ) {
399 GEOM::short_array anIndexes;
400 if ( mySelection->HasIndex( anIO ) ) {
401 TColStd_IndexedMapOfInteger aMap;
402 mySelection->GetIndex( anIO, aMap );
403 int anIndex = aMap( 1 );
404 TopTools_IndexedMapOfShape aShapes;
405 TopExp::MapShapes( aShape, aShapes );
406 aShape = aShapes.FindKey( anIndex );
409 if ( getConstructorId() == 1 ) {
410 if ( !aShape.IsNull() ) {
412 if (aShape.ShapeType() == TopAbs_VERTEX) {
413 aPnt = BRep_Tool::Pnt(TopoDS::Vertex(aShape));
416 GProp_GProps aSystem;
417 if (aShape.ShapeType() == TopAbs_EDGE || aShape.ShapeType() == TopAbs_WIRE)
418 BRepGProp::LinearProperties(aShape, aSystem);
419 else if (aShape.ShapeType() == TopAbs_FACE || aShape.ShapeType() == TopAbs_SHELL)
420 BRepGProp::SurfaceProperties(aShape, aSystem);
422 BRepGProp::VolumeProperties(aShape, aSystem);
424 aPnt = aSystem.CentreOfMass();
428 anAx3.Transform(aShape.Location().Transformation());
429 if(aShape.ShapeType() == TopAbs_FACE) {
430 Handle(Geom_Surface) aGS = BRep_Tool::Surface( TopoDS::Face( aShape ) );
431 if (!aGS.IsNull() && aGS->IsKind( STANDARD_TYPE( Geom_Plane ) ) ) {
432 Handle(Geom_Plane) aGPlane = Handle(Geom_Plane)::DownCast( aGS );
433 gp_Pln aPln = aGPlane->Pln();
434 anAx3 = aPln.Position();
438 gp_Dir aDirX = anAx3.XDirection();
439 gp_Dir aDirY = anAx3.YDirection();
441 myData[ X ]->SetValue( aPnt.X() );
442 myData[ Y ]->SetValue( aPnt.Y() );
443 myData[ Z ]->SetValue( aPnt.Z() );
445 myData[ DX1 ]->SetValue( aDirX.X() );
446 myData[ DY1 ]->SetValue( aDirX.Y() );
447 myData[ DZ1 ]->SetValue( aDirX.Z() );
449 myData[ DX2 ]->SetValue( aDirY.X() );
450 myData[ DY2 ]->SetValue( aDirY.Y() );
451 myData[ DZ2 ]->SetValue( aDirY.Z() );
453 myEditCurrentArgument->setText( aName );
456 myData[ X ]->SetValue( 0 );
457 myData[ Y ]->SetValue( 0 );
458 myData[ Z ]->SetValue( 0 );
460 myData[ DX1 ]->SetValue( 0 );
461 myData[ DY1 ]->SetValue( 0 );
462 myData[ DZ1 ]->SetValue( 0 );
464 myData[ DX2 ]->SetValue( 0 );
465 myData[ DY2 ]->SetValue( 0 );
466 myData[ DZ2 ]->SetValue( 0 );
469 else if ( getConstructorId() == 2 ) {
470 if (myEditCurrentArgument == Group2->LineEdit1) {
471 if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX ) {
472 gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) );
473 myData[ X ]->SetValue( aPnt.X() );
474 myData[ Y ]->SetValue( aPnt.Y() );
475 myData[ Z ]->SetValue( aPnt.Z() );
476 myEditCurrentArgument->setText( aName );
479 myData[ X ]->SetValue( 0 );
480 myData[ Y ]->SetValue( 0 );
481 myData[ Z ]->SetValue( 0 );
484 else if (myEditCurrentArgument == Group2->LineEdit2) {
485 if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_EDGE ) {
486 gp_Pnt aP1 = BRep_Tool::Pnt(TopExp::FirstVertex(TopoDS::Edge(aShape)));
487 gp_Pnt aP2 = BRep_Tool::Pnt(TopExp::LastVertex(TopoDS::Edge(aShape)));
488 gp_Dir aDir(gp_Vec(aP1, aP2));
490 myData[ DX1 ]->SetValue( aDir.X() );
491 myData[ DY1 ]->SetValue( aDir.Y() );
492 myData[ DZ1 ]->SetValue( aDir.Z() );
493 myEditCurrentArgument->setText( aName );
496 myData[ DX1 ]->SetValue( 0 );
497 myData[ DY1 ]->SetValue( 0 );
498 myData[ DZ1 ]->SetValue( 0 );
501 else if (myEditCurrentArgument == Group2->LineEdit3) {
502 if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_EDGE ) {
503 gp_Pnt aP1 = BRep_Tool::Pnt(TopExp::FirstVertex(TopoDS::Edge(aShape)));
504 gp_Pnt aP2 = BRep_Tool::Pnt(TopExp::LastVertex(TopoDS::Edge(aShape)));
505 gp_Dir aDir(gp_Vec(aP1, aP2));
507 myData[ DX2 ]->SetValue( aDir.X() );
508 myData[ DY2 ]->SetValue( aDir.Y() );
509 myData[ DZ2 ]->SetValue( aDir.Z() );
510 myEditCurrentArgument->setText( aName );
513 myData[ DX2 ]->SetValue( 0 );
514 myData[ DY2 ]->SetValue( 0 );
515 myData[ DZ2 ]->SetValue( 0 );
523 if ( getConstructorId() == 1 ) {
524 myData[ X ]->SetValue( 0 );
525 myData[ Y ]->SetValue( 0 );
526 myData[ Z ]->SetValue( 0 );
528 myData[ DX1 ]->SetValue( 0 );
529 myData[ DY1 ]->SetValue( 0 );
530 myData[ DZ1 ]->SetValue( 0 );
532 myData[ DX2 ]->SetValue( 0 );
533 myData[ DY2 ]->SetValue( 0 );
534 myData[ DZ2 ]->SetValue( 0 );
536 else if ( getConstructorId() == 2 ) {
537 if (myEditCurrentArgument == Group2->LineEdit1) {
538 myData[ X ]->SetValue( 0 );
539 myData[ Y ]->SetValue( 0 );
540 myData[ Z ]->SetValue( 0 );
542 else if (myEditCurrentArgument == Group2->LineEdit2) {
543 myData[ DX1 ]->SetValue( 0 );
544 myData[ DY1 ]->SetValue( 0 );
545 myData[ DZ1 ]->SetValue( 0 );
547 else if (myEditCurrentArgument == Group2->LineEdit3) {
548 myData[ DX2 ]->SetValue( 0 );
549 myData[ DY2 ]->SetValue( 0 );
550 myData[ DZ2 ]->SetValue( 0 );
558 //=================================================================================
559 // function : SetEditCurrentArgument()
561 //=================================================================================
562 void BasicGUI_MarkerDlg::SetEditCurrentArgument()
564 QPushButton* send = (QPushButton*)sender();
566 if(send == Group1->PushButton1) {
567 myEditCurrentArgument = Group1->LineEdit1;
568 globalSelection( GEOM_ALLGEOM );
570 else if(send == Group2->PushButton1) {
571 myEditCurrentArgument = Group2->LineEdit1;
572 globalSelection( GEOM_POINT );
574 else if(send == Group2->PushButton2) {
575 myEditCurrentArgument = Group2->LineEdit2;
576 globalSelection( GEOM_LINE );
578 else if(send == Group2->PushButton3) {
579 myEditCurrentArgument = Group2->LineEdit3;
580 globalSelection( GEOM_LINE );
583 myEditCurrentArgument->setFocus();
587 //=================================================================================
588 // function : LineEditReturnPressed()
590 //=================================================================================
591 void BasicGUI_MarkerDlg::LineEditReturnPressed()
593 QLineEdit* send = (QLineEdit*)sender();
595 myEditCurrentArgument = send;
596 GEOMBase_Skeleton::LineEditReturnPressed();
599 //=================================================================================
600 // function : onActivate()
602 //=================================================================================
603 void BasicGUI_MarkerDlg::onActivate()
605 GEOMBase_Skeleton::ActivateThisDialog();
606 connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionDone() ) );
608 ConstructorsClicked( getConstructorId() );
611 //=================================================================================
612 // function : onDeactivate()
613 // purpose : public slot to deactivate if active
614 //=================================================================================
615 void BasicGUI_MarkerDlg::onDeactivate()
617 GEOMBase_Skeleton::DeactivateActiveDialog();
620 //=================================================================================
621 // function : enterEvent()
623 //=================================================================================
624 void BasicGUI_MarkerDlg::enterEvent(QEvent* e)
626 if ( !GroupConstructors->isEnabled() )
630 //=================================================================================
631 // function : createOperation
633 //=================================================================================
634 GEOM::GEOM_IOperations_ptr BasicGUI_MarkerDlg::createOperation()
636 return getGeomEngine()->GetIBasicOperations( getStudyId() );
639 //=================================================================================
640 // function : isValid
642 //=================================================================================
643 bool BasicGUI_MarkerDlg::isValid( QString& msg )
645 const int id = getConstructorId();
646 gp_Vec v1( myData[ DX1 ]->GetValue(), myData[ DY1 ]->GetValue(), myData[ DZ1 ]->GetValue() ),
647 v2( myData[ DX2 ]->GetValue(), myData[ DY2 ]->GetValue(), myData[ DZ2 ]->GetValue() );
650 // we will got exception if the magnitude of any of the 2 vectors <= gp::Resolution()
651 // Vectors shouldn't be checked for being orthogonal here!
652 if ( v1.Magnitude() > gp::Resolution() && v2.Magnitude() > gp::Resolution() ) {
653 isOk = !v1.IsParallel( v2, Precision::Angular() );
655 msg += tr( "VEC_PARALLEL" );
663 return !Group1->LineEdit1->text().isEmpty() && isOk;
665 return !Group2->LineEdit1->text().isEmpty() &&
666 !Group2->LineEdit2->text().isEmpty() &&
667 !Group2->LineEdit3->text().isEmpty() && isOk;
672 //=================================================================================
673 // function : execute
675 //=================================================================================
676 bool BasicGUI_MarkerDlg::execute( ObjectList& objects )
678 GEOM::GEOM_Object_var anObj = GEOM::GEOM_IBasicOperations::_narrow(
679 getOperation() )->MakeMarker( myData[ X ]->GetValue(), myData[ Y ]->GetValue(), myData[ Z ]->GetValue(),
680 myData[ DX1 ]->GetValue(), myData[ DY1 ]->GetValue(), myData[ DZ1 ]->GetValue(),
681 myData[ DX2 ]->GetValue(), myData[ DY2 ]->GetValue(), myData[ DZ2 ]->GetValue() );
683 if ( !anObj->_is_nil() )
684 objects.push_back( anObj._retn() );
689 //=================================================================================
690 // function : closeEvent
692 //=================================================================================
693 void BasicGUI_MarkerDlg::closeEvent( QCloseEvent* e )
695 GEOMBase_Skeleton::closeEvent( e );
698 //=================================================================================
699 // function : onValueChanged
701 //=================================================================================
702 void BasicGUI_MarkerDlg::onValueChanged( double )
707 //=================================================================================
708 // function : displayPreview
710 //=================================================================================
711 void BasicGUI_MarkerDlg::displayPreview ( const bool activate,
713 const bool toRemoveFromEngine,
714 const double lineWidth )
716 if ( !myBlockPreview )
718 GEOMBase_Skeleton::displayPreview( activate, update, toRemoveFromEngine, lineWidth );
719 if ( myConstructorId == 0 )
721 GEOMBase_Skeleton::activate( GEOM_MARKER );