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 : EntityGUI_SketcherDlg.cxx
25 // Author : Damien COQUERET, Open CASCADE S.A.S.
27 #include "EntityGUI_SketcherDlg.h"
28 #include "EntityGUI_Widgets.h"
29 #include <SalomeApp_DoubleSpinBox.h>
32 #include <GeometryGUI.h>
33 #include <GEOMImpl_Types.hxx>
34 #include <Geom_Surface.hxx>
35 #include <Geom_Plane.hxx>
37 #include <SUIT_Desktop.h>
38 #include <SUIT_Session.h>
39 #include <SUIT_MessageBox.h>
40 #include <SUIT_ResourceMgr.h>
41 #include <SalomeApp_Application.h>
42 #include <LightApp_Application.h>
43 #include <LightApp_SelectionMgr.h>
47 #include <BRep_Tool.hxx>
49 #include <TopExp_Explorer.hxx>
50 #include <TopoDS_Vertex.hxx>
52 #include <BRepBuilderAPI_Transform.hxx>
53 #include <BRepBuilderAPI_MakeWire.hxx>
54 #include <Sketcher_Profile.hxx>
56 #include <SalomeApp_Study.h>
60 //=================================================================================
61 // class : EntityGUI_SketcherDlg()
62 // purpose : Constructs a EntityGUI_SketcherDlg which is a child of 'parent', with the
63 // name 'name' and widget flags set to 'f'.
64 // The dialog will by default be modeless, unless you set 'modal' to
65 // TRUE to construct a modal dialog.
66 //=================================================================================
67 EntityGUI_SketcherDlg::EntityGUI_SketcherDlg( GeometryGUI* GUI, QWidget* parent,
68 bool modal, Qt::WindowFlags fl,
69 const double lineWidth )
70 : QDialog( parent, fl ),
71 myIsAllAdded( false ),
73 GEOMBase_Helper( dynamic_cast<SUIT_Desktop*>( parent ) ),
75 myLineWidth( lineWidth )
78 setAttribute( Qt::WA_DeleteOnClose );
80 myGeometryGUI->SetActiveDialogBox(this);
82 MainWidget = new EntityGUI_Skeleton( this );
83 QVBoxLayout* topLayout = new QVBoxLayout( this );
84 topLayout->setMargin( 9 ); topLayout->setSpacing( 6 );
86 MainWidget->buttonCancel->setText( tr( "GEOM_BUT_CANCEL" ) );
87 MainWidget->buttonEnd->setText( tr( "GEOM_BUT_END_SKETCH" ) );
88 MainWidget->buttonClose->setText( tr( "GEOM_BUT_CLOSE_SKETCH" ) );
89 MainWidget->buttonHelp->setText( tr( "GEOM_BUT_HELP" ) );
91 QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
92 QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_UNDO" ) ) );
93 QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_REDO" ) ) );
95 setWindowTitle( tr( "GEOM_SKETCHER_TITLE" ) );
97 MainWidget->GroupConstructors->setTitle( tr( "GEOM_SKETCHER_EL" ) );
98 MainWidget->RadioButton1->setText( tr( "GEOM_SKETCHER_SEGMENT" ) );
99 MainWidget->RadioButton2->setText( tr( "GEOM_SKETCHER_ARC" ) );
100 MainWidget->GroupDest->setTitle( tr( "GEOM_SKETCHER_DEST" ) );
101 MainWidget->GroupDest1->setTitle( tr( "GEOM_SKETCHER_TYPE" ) );
102 MainWidget->RB_Dest1->setText( tr( "GEOM_SKETCHER_POINT" ) );
103 MainWidget->RB_Dest2->setText( tr( "GEOM_SKETCHER_DIR" ) );
105 /***************************************************************/
107 GroupBox1 = new QGroupBox(tr("GEOM_CS"), this);
108 QGridLayout* OwnLayout = new QGridLayout(GroupBox1);
109 OwnLayout->setSpacing(6);
110 OwnLayout->setMargin(11);
112 ComboBox1 = new QComboBox(GroupBox1);
113 OwnLayout->addWidget(ComboBox1);
115 topLayout->addWidget(GroupBox1);
116 topLayout->addWidget( MainWidget );
118 GroupPt = new EntityGUI_Point( MainWidget->DestCnt );
120 GroupPt->GroupPoint->setTitle( tr( "GEOM_SKETCHER_POINT" ) );
121 GroupPt->RB_Point1->setText( tr( "GEOM_SKETCHER_ABS" ) );
122 GroupPt->RB_Point2->setText( tr( "GEOM_SKETCHER_REL" ) );
123 GroupPt->RB_Point3->setText( tr( "GEOM_SKETCHER_SEL" ) );
125 GroupD1 = new EntityGUI_Dir1( MainWidget->DestCnt );
127 GroupD1->GroupDir1->setTitle( tr( "GEOM_SKETCHER_DIR" ) );
128 GroupD1->RB_Dir11->setText( tr( "GEOM_SKETCHER_ANGLE" ) );
129 GroupD1->RB_Dir12->setText( tr( "GEOM_SKETCHER_PER" ) );
130 GroupD1->RB_Dir13->setText( tr( "GEOM_SKETCHER_TAN" ) );
131 GroupD1->RB_Dir14->setText( tr( "GEOM_SKETCHER_VXVY" ) );
133 GroupD2 = new EntityGUI_Dir2( MainWidget->DestCnt );
135 GroupD2->GroupDir2->setTitle( tr( "GEOM_SKETCHER_DIR" ) );
136 GroupD2->RB_Dir21->setText( tr( "GEOM_SKETCHER_LENGTH" ) );
137 GroupD2->RB_Dir22->setText( tr( "GEOM_SKETCHER_X" ) );
138 GroupD2->RB_Dir23->setText( tr( "GEOM_SKETCHER_Y" ) );
140 Group1Sel = new EntityGUI_1Sel( MainWidget->SkeletonCnt );
142 Group1Sel->TextLabel1->setText( tr( "GEOM_SKETCHER_POINT2" ) );
143 Group1Sel->GroupBox1->setTitle( tr( "GEOM_SKETCHER_VALUES" ) );
144 Group1Sel->buttonApply->setText( tr( "GEOM_SKETCHER_APPLY" ) );
145 Group1Sel->PushButton1->setIcon( image0 );
146 Group1Sel->buttonUndo->setIcon( image1 );
147 Group1Sel->buttonRedo->setIcon( image2 );
148 Group1Sel->LineEdit1->setReadOnly( true );
150 Group1Spin = new EntityGUI_1Spin( MainWidget->SkeletonCnt );
151 Group1Spin->GroupBox1->setTitle( tr( "GEOM_SKETCHER_VALUES" ) );
152 Group1Spin->buttonApply->setText( tr( "GEOM_SKETCHER_APPLY" ) );
153 Group1Spin->buttonUndo->setIcon( image1 );
154 Group1Spin->buttonRedo->setIcon( image2 );
156 Group2Spin = new EntityGUI_2Spin( MainWidget->SkeletonCnt );
157 Group2Spin->GroupBox1->setTitle( tr( "GEOM_SKETCHER_VALUES" ) );
158 Group2Spin->buttonApply->setText( tr( "GEOM_SKETCHER_APPLY" ) );
159 Group2Spin->buttonUndo->setIcon( image1 );
160 Group2Spin->buttonRedo->setIcon( image2 );
162 Group3Spin = new EntityGUI_3Spin( MainWidget->SkeletonCnt );
163 Group3Spin->GroupBox1->setTitle( tr( "GEOM_SKETCHER_VALUES" ) );
164 Group3Spin->buttonApply->setText( tr( "GEOM_SKETCHER_APPLY" ) );
165 Group3Spin->buttonUndo->setIcon( image1 );
166 Group3Spin->buttonRedo->setIcon( image2 );
168 Group4Spin = new EntityGUI_4Spin( MainWidget->SkeletonCnt );
169 Group4Spin->GroupBox1->setTitle( tr( "GEOM_SKETCHER_VALUES" ) );
170 Group4Spin->buttonApply->setText( tr( "GEOM_SKETCHER_APPLY" ) );
171 Group4Spin->buttonUndo->setIcon( image1 );
172 Group4Spin->buttonRedo->setIcon( image2 );
174 QGridLayout* DestCntLayout = new QGridLayout( MainWidget->DestCnt );
175 DestCntLayout->setMargin( 0 ); DestCntLayout->setSpacing( 6 );
176 DestCntLayout->addWidget( GroupPt, 0, 0, 1, 2 );
177 DestCntLayout->addWidget( GroupD1, 1, 0 );
178 DestCntLayout->addWidget( GroupD2, 1, 1 );
180 QVBoxLayout* SkeletonCntlayout = new QVBoxLayout( MainWidget->SkeletonCnt );
181 SkeletonCntlayout->setMargin( 0 ); SkeletonCntlayout->setSpacing( 6 );
182 SkeletonCntlayout->addWidget( Group1Sel, 0, 0 );
183 SkeletonCntlayout->addWidget( Group1Spin, 0, 0 );
184 SkeletonCntlayout->addWidget( Group2Spin, 0, 0 );
185 SkeletonCntlayout->addWidget( Group3Spin, 0, 0 );
186 SkeletonCntlayout->addWidget( Group4Spin, 0, 0 );
187 /***************************************************************/
189 QButtonGroup* ButtonGroup = new QButtonGroup( this );
190 ButtonGroup->addButton( MainWidget->RB_Dest1, 1 );
191 ButtonGroup->addButton( MainWidget->RB_Dest2, 0 );
193 /* signals and slots connections */
194 connect( MainWidget->buttonEnd, SIGNAL( clicked() ), this, SLOT( ClickOnEnd() ) );
195 connect( MainWidget->buttonClose, SIGNAL( clicked() ), this, SLOT( ClickOnEnd() ) );
196 connect( MainWidget->buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) );
197 connect( MainWidget->buttonHelp, SIGNAL( clicked() ), this, SLOT( ClickOnHelp() ) );
199 connect( Group1Sel->buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
200 connect( Group1Sel->buttonUndo, SIGNAL( clicked() ), this, SLOT( ClickOnUndo() ) );
201 connect( Group1Sel->buttonRedo, SIGNAL( clicked() ), this, SLOT( ClickOnRedo() ) );
202 connect( Group1Spin->buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
203 connect( Group1Spin->buttonUndo, SIGNAL( clicked() ), this, SLOT( ClickOnUndo() ) );
204 connect( Group1Spin->buttonRedo, SIGNAL( clicked() ), this, SLOT( ClickOnRedo() ) );
205 connect( Group2Spin->buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
206 connect( Group2Spin->buttonUndo, SIGNAL( clicked() ), this, SLOT( ClickOnUndo() ) );
207 connect( Group2Spin->buttonRedo, SIGNAL( clicked() ), this, SLOT( ClickOnRedo() ) );
208 connect( Group3Spin->buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
209 connect( Group3Spin->buttonUndo, SIGNAL( clicked() ), this, SLOT( ClickOnUndo() ) );
210 connect( Group3Spin->buttonRedo, SIGNAL( clicked() ), this, SLOT( ClickOnRedo() ) ) ;
211 connect( Group4Spin->buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
212 connect( Group4Spin->buttonUndo, SIGNAL( clicked() ), this, SLOT( ClickOnUndo() ) );
213 connect( Group4Spin->buttonRedo, SIGNAL( clicked() ), this, SLOT( ClickOnRedo() ) );
215 connect( MainWidget->ButtonGroup, SIGNAL( buttonClicked( int ) ), this, SLOT( TypeClicked( int ) ) );
216 connect( ButtonGroup, SIGNAL( buttonClicked( int ) ), this, SLOT( DestClicked( int ) ) );
217 connect( GroupPt->ButtonGroup, SIGNAL( buttonClicked( int ) ), this, SLOT( PointClicked( int ) ) );
218 connect( GroupD1->ButtonGroup, SIGNAL( buttonClicked( int ) ), this, SLOT( Dir1Clicked( int ) ) );
219 connect( GroupD2->ButtonGroup, SIGNAL( buttonClicked( int ) ), this, SLOT( Dir2Clicked( int ) ));
221 connect( Group1Sel->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
222 connect( Group1Sel->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
224 connect( Group1Spin->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
225 connect( Group2Spin->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
226 connect( Group2Spin->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
227 connect( Group3Spin->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
228 connect( Group3Spin->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
229 connect( Group3Spin->SpinBox_DZ, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
230 connect( Group4Spin->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
231 connect( Group4Spin->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
232 connect( Group4Spin->SpinBox_DZ, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
233 connect( Group4Spin->SpinBox_DS, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
235 connect( ComboBox1, SIGNAL( activated( int ) ), this, SLOT( SelectionIntoArgument() ) );
237 connect( myGeometryGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), this, SLOT( SetDoubleSpinBoxStep( double ) ) );
239 connect( myGeometryGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) );
240 connect( myGeometryGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) );
242 // install event filter on spin-boxes to provide Apply action on Return pressed
243 Group1Spin->SpinBox_DX->installEventFilter(this);
244 Group2Spin->SpinBox_DX->installEventFilter(this);
245 Group2Spin->SpinBox_DY->installEventFilter(this);
246 Group3Spin->SpinBox_DX->installEventFilter(this);
247 Group3Spin->SpinBox_DY->installEventFilter(this);
248 Group3Spin->SpinBox_DZ->installEventFilter(this);
249 Group4Spin->SpinBox_DX->installEventFilter(this);
250 Group4Spin->SpinBox_DY->installEventFilter(this);
251 Group4Spin->SpinBox_DZ->installEventFilter(this);
252 Group4Spin->SpinBox_DS->installEventFilter(this);
258 //=================================================================================
259 // function : ~EntityGUI_SketcherDlg()
260 // purpose : Destroys the object and frees any allocated resources
261 //=================================================================================
262 EntityGUI_SketcherDlg::~EntityGUI_SketcherDlg()
264 myGeometryGUI->SetActiveDialogBox( 0 );
268 //=================================================================================
269 // function : eventFilter()
270 // purpose : event filter for spin-boxes to provide Apply action on Return pressed
271 //=================================================================================
272 bool EntityGUI_SketcherDlg::eventFilter (QObject* object, QEvent* event)
274 if (event->type() == QEvent::KeyPress) {
275 QKeyEvent* ke = (QKeyEvent*)event;
276 if (ke->key() == Qt::Key_Return) {
277 if (object == Group1Spin->SpinBox_DX) {
278 Group1Spin->buttonApply->animateClick();
280 } else if (object == Group2Spin->SpinBox_DX ||
281 object == Group2Spin->SpinBox_DY) {
282 Group2Spin->buttonApply->animateClick();
284 } else if (object == Group3Spin->SpinBox_DX ||
285 object == Group3Spin->SpinBox_DY ||
286 object == Group3Spin->SpinBox_DZ) {
287 Group3Spin->buttonApply->animateClick();
289 } else if (object == Group4Spin->SpinBox_DX ||
290 object == Group4Spin->SpinBox_DY ||
291 object == Group4Spin->SpinBox_DZ ||
292 object == Group4Spin->SpinBox_DS) {
293 Group4Spin->buttonApply->animateClick();
299 // Fix of the NPAL16010 bug is removed, because it's not actual with the Qt-4.x
301 return QDialog::eventFilter(object, event);
305 //=================================================================================
308 //=================================================================================
309 void EntityGUI_SketcherDlg::Init()
312 myEditCurrentArgument = Group1Sel->LineEdit1;
313 myCommand.append( "Sketcher" );
314 myUndoCommand.append( "Sketcher" );
316 mySketchState = FIRST_POINT;
317 globalSelection( GEOM_POINT );
324 myHelpFileName = "create_sketcher_page.html";
326 /* Get setting of step value from file configuration */
327 double step = SUIT_Session::session()->resourceMgr()->doubleValue( "Geometry", "SettingsGeomStep", 100.0 );
329 /* min, max, step and decimals for spin boxes */
330 initSpinBox( Group1Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" );
331 initSpinBox( Group2Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" );
332 initSpinBox( Group2Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" );
333 initSpinBox( Group3Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" );
334 initSpinBox( Group3Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" );
335 initSpinBox( Group3Spin->SpinBox_DZ, COORD_MIN, COORD_MAX, step, "length_precision" );
336 initSpinBox( Group4Spin->SpinBox_DZ, COORD_MIN, COORD_MAX, step, "length_precision" );
337 // san: Note specific step values below!
338 initSpinBox( Group4Spin->SpinBox_DX, COORD_MIN, COORD_MAX, 0.1, "length_precision" );
339 initSpinBox( Group4Spin->SpinBox_DY, COORD_MIN, COORD_MAX, 0.1, "length_precision" );
340 initSpinBox( Group4Spin->SpinBox_DS, COORD_MIN, COORD_MAX, 5., "length_precision" );
342 /* displays Dialog */
343 MainWidget->GroupConstructors->setEnabled( false );
344 MainWidget->GroupDest1->setEnabled( false );
345 setEnabledUndo( false );
346 setEnabledRedo( false );
348 MainWidget->RadioButton1->setChecked( true );
356 GEOMBase_Helper::displayPreview( false, true, true, myLineWidth );
360 //=================================================================================
361 // function : InitClick()
363 //=================================================================================
364 void EntityGUI_SketcherDlg::InitClick()
366 disconnect( myGeometryGUI->getApp()->selectionMgr(), 0, this, 0 );
376 //=================================================================================
377 // function : TypeClicked()
378 // purpose : Radio button management
379 //=================================================================================
380 void EntityGUI_SketcherDlg::TypeClicked( int constructorId )
382 myConstructorId = constructorId;
383 if ( myConstructorId == 0 ) { // SEGMENT
384 GroupD2->setEnabled( true );
385 MainWidget->RB_Dest1->setEnabled( true );
386 MainWidget->RB_Dest1->setChecked( true );
389 else if ( myConstructorId == 1 ) { // ARC
390 GroupD2->setEnabled( false );
391 MainWidget->RB_Dest1->setEnabled( false );
392 MainWidget->RB_Dest2->setChecked( true );
398 //=================================================================================
399 // function : DestClicked()
400 // purpose : Radio button management
401 //=================================================================================
402 void EntityGUI_SketcherDlg::DestClicked( int constructorId )
408 if ( constructorId == 1 ) {
410 GroupPt->RB_Point1->setChecked( true );
412 PointClicked( 1 ); // XY
414 else if ( constructorId == 0 ) {
416 GroupD1->RB_Dir11->setChecked( true );
419 Dir1Clicked( 2 ); // Angle
424 //=================================================================================
425 // function : PointClicked()
426 // purpose : Radio button management
427 //=================================================================================
428 void EntityGUI_SketcherDlg::PointClicked( int constructorId )
432 // Get setting of step value from file configuration
433 double step = SUIT_Session::session()->resourceMgr()->doubleValue( "Geometry", "SettingsGeomStep", 100.0 );
435 if ( myConstructorId == 0 ) { // SEGMENT
436 if ( constructorId == 1 ) { // XY
437 mySketchType = PT_ABS;
438 initSpinBox( Group2Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" );
439 initSpinBox( Group2Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" );
440 Group2Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_X2" ) );
441 Group2Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_Y2" ) );
443 Group2Spin->SpinBox_DX->setValue( myX );
445 Group2Spin->SpinBox_DY->setValue( myY );
447 Group2Spin->buttonApply->setFocus();
449 GEOMBase_Helper::displayPreview( false, true, true, myLineWidth );
451 else if ( constructorId == 0 ) { // DXDY
452 mySketchType = PT_RELATIVE;
453 initSpinBox( Group2Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" );
454 initSpinBox( Group2Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" );
455 Group2Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_DX2" ) );
456 Group2Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_DY2" ) );
458 Group2Spin->SpinBox_DX->setValue( myDX );
460 Group2Spin->SpinBox_DY->setValue( myDY );
462 Group2Spin->buttonApply->setFocus();
464 GEOMBase_Helper::displayPreview( false, true, true, myLineWidth );
466 else if ( constructorId == 2 ) { // Selection
467 mySketchType = PT_SEL;
468 myEditCurrentArgument = Group1Sel->LineEdit1;
470 Group1Sel->buttonApply->setFocus();
471 SelectionIntoArgument();
474 connect( myGeometryGUI->getApp()->selectionMgr(),
475 SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
480 //=================================================================================
481 // function : Dir1Clicked()
482 // purpose : Radio button management
483 //=================================================================================
484 void EntityGUI_SketcherDlg::Dir1Clicked( int constructorId )
486 myConstructorDirId = constructorId;
487 GroupD2->RB_Dir21->setChecked( true );
492 //=================================================================================
493 // function : Dir2Clicked()
494 // purpose : Radio button management
495 //=================================================================================
496 void EntityGUI_SketcherDlg::Dir2Clicked( int constructorId )
501 // Get setting of step value from file configuration
502 double step = SUIT_Session::session()->resourceMgr()->doubleValue( "Geometry", "SettingsGeomStep", 100.0 );
504 if ( myConstructorId == 0 ) { // SEGMENT
508 if ( myConstructorDirId == 2 ) { // Angle
509 initSpinBox( Group2Spin->SpinBox_DX, COORD_MIN, COORD_MAX, 5., "length_precision" );
510 Group2Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_ANGLE2" ) );
511 Group2Spin->SpinBox_DX->setValue( myAngle );
512 Group2Spin->buttonApply->setFocus();
515 if ( constructorId == 2 ) { // Length
516 mySketchType = DIR_ANGLE_LENGTH;
517 initSpinBox( Group2Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" );
518 Group2Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_LENGTH2" ) );
519 Group2Spin->SpinBox_DY->setValue( myLength );
521 else if ( constructorId == 0 ) { // X
522 mySketchType = DIR_ANGLE_X;
523 initSpinBox( Group2Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, "angle_precision" );
524 Group2Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_X3" ) );
525 Group2Spin->SpinBox_DY->setValue( myX );
527 else if ( constructorId == 1 ) { // Y
528 mySketchType = DIR_ANGLE_Y;
529 initSpinBox( Group2Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, "angle_precision" );
530 Group2Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_Y3" ) );
531 Group2Spin->SpinBox_DY->setValue( myY );
534 else if ( myConstructorDirId == 0 ) { // Perpendicular
536 Group1Spin->buttonApply->setFocus();
538 if ( constructorId == 2 ) { // Length
539 mySketchType = DIR_PER_LENGTH;
540 Group1Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_LENGTH2" ) );
541 Group1Spin->SpinBox_DX->setValue( myLength );
543 else if ( constructorId == 0 ) { // X
544 mySketchType = DIR_PER_X;
545 Group1Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_X3" ) );
546 Group1Spin->SpinBox_DX->setValue( myX );
548 else if ( constructorId == 1 ) { // Y
549 mySketchType = DIR_PER_Y;
550 Group1Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_Y3" ) );
551 Group1Spin->SpinBox_DX->setValue( myY );
554 else if ( myConstructorDirId == 1 ) { // Tangent
556 Group1Spin->buttonApply->setFocus();
558 if ( constructorId == 2 ) { // Length
559 mySketchType = DIR_TAN_LENGTH;
560 Group1Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_LENGTH2" ) );
561 Group1Spin->SpinBox_DX->setValue( myLength );
563 else if ( constructorId == 0 ) { // X
564 mySketchType = DIR_TAN_X;
565 Group1Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_X3" ) );
566 Group1Spin->SpinBox_DX->setValue( myX );
568 else if ( constructorId == 1 ) { // Y
569 mySketchType = DIR_TAN_Y;
570 Group1Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_Y3" ) );
571 Group1Spin->SpinBox_DX->setValue( myY );
574 else if ( myConstructorDirId == 3 ) { // DXDY
575 initSpinBox( Group3Spin->SpinBox_DX, COORD_MIN, COORD_MAX, 0.1, "length_precision" );
576 initSpinBox( Group3Spin->SpinBox_DY, COORD_MIN, COORD_MAX, 0.1, "length_precision" );
577 initSpinBox( Group3Spin->SpinBox_DZ, COORD_MIN, COORD_MAX, step, "length_precision" );
578 Group3Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_VX2" ) );
579 Group3Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_VY2" ) );
581 Group3Spin->SpinBox_DX->setValue( myDX );
583 Group3Spin->SpinBox_DY->setValue( myDY );
585 Group3Spin->buttonApply->setFocus();
587 if ( constructorId == 2 ) { // Length
588 mySketchType = DIR_DXDY_LENGTH;
589 Group3Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_LENGTH2" ) );
590 Group3Spin->SpinBox_DZ->setValue( myLength );
592 else if ( constructorId == 0 ) { // X
593 mySketchType = DIR_DXDY_X;
594 Group3Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_X3" ) );
595 Group3Spin->SpinBox_DZ->setValue( myX );
597 else if ( constructorId == 1 ) { // Y
598 mySketchType = DIR_DXDY_Y;
599 Group3Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_Y3" ) );
600 Group3Spin->SpinBox_DZ->setValue( myY );
604 else if ( myConstructorId == 1 ) { // ARC
605 if ( myConstructorDirId == 2 ) { // Angle
606 if ( constructorId == 2 ) { // Length
607 mySketchType = DIR_ANGLE_LENGTH;
608 initSpinBox( Group3Spin->SpinBox_DX, COORD_MIN, COORD_MAX, 5., "angle_precision" );
609 initSpinBox( Group3Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" );
610 initSpinBox( Group3Spin->SpinBox_DZ, COORD_MIN, COORD_MAX, 5., "angle_precision" );
611 Group3Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_ANGLE2" ) );
612 Group3Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_RADIUS2" ) );
613 Group3Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_ANGLE2" ));
614 Group3Spin->SpinBox_DX->setValue( myAngle );
616 Group3Spin->SpinBox_DY->setValue( myRadius );
618 Group3Spin->SpinBox_DZ->setValue( myLength );
620 Group3Spin->buttonApply->setFocus();
623 else if ( myConstructorDirId == 0 ) { // Perpendicular
624 if ( constructorId == 2 ) { // Length
625 mySketchType = DIR_PER_LENGTH;
626 initSpinBox( Group2Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" );
627 initSpinBox( Group2Spin->SpinBox_DY, COORD_MIN, COORD_MAX, 5., "angle_precision" );
628 Group2Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_RADIUS2" ) );
629 Group2Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_ANGLE2" ) );
631 Group2Spin->SpinBox_DX->setValue( myRadius );
633 Group2Spin->SpinBox_DY->setValue( myLength );
635 Group2Spin->buttonApply->setFocus();
638 else if ( myConstructorDirId == 1 ) { // Tangent
639 if ( constructorId == 2 ) { // Length
640 mySketchType = DIR_TAN_LENGTH;
641 initSpinBox( Group2Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" );
642 initSpinBox( Group2Spin->SpinBox_DY, COORD_MIN, COORD_MAX, 5., "angle_precision" );
643 Group2Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_RADIUS2" ) );
644 Group2Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_ANGLE2" ) );
646 Group2Spin->SpinBox_DX->setValue( myRadius );
648 Group2Spin->SpinBox_DY->setValue( myLength );
650 Group2Spin->buttonApply->setFocus();
653 else if ( myConstructorDirId == 3 ) { // DXDY
654 if ( constructorId == 2 ) { // Length
655 mySketchType = DIR_DXDY_LENGTH;
656 Group4Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_VX2" ) );
657 Group4Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_VY2" ) );
658 Group4Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_RADIUS2" ) );
659 Group4Spin->TextLabel4->setText( tr( "GEOM_SKETCHER_ANGLE2" ) );
661 Group4Spin->SpinBox_DX->setValue( myDX );
663 Group4Spin->SpinBox_DY->setValue( myDY );
665 Group4Spin->SpinBox_DZ->setValue( myRadius );
667 Group4Spin->SpinBox_DS->setValue( myLength );
669 Group4Spin->buttonApply->setFocus();
674 GEOMBase_Helper::displayPreview( false, true, true, myLineWidth );
678 //=================================================================================
679 // function : ClickOnCancel()
681 //=================================================================================
682 void EntityGUI_SketcherDlg::ClickOnCancel()
688 //=================================================================================
689 // function : ClickOnEnd()
690 // purpose : connected to buttonEnd AND buttonClose
691 //=================================================================================
692 void EntityGUI_SketcherDlg::ClickOnEnd()
694 if ( sender() == MainWidget->buttonClose ) {
695 // Verify validity of commands
696 if ( myCommand.count() <= 2 ) {
697 SUIT_MessageBox::critical( SUIT_Session::session()->activeApplication()->desktop(),
698 tr( "GEOM_ERROR_STATUS" ), tr( "CANNOT_CLOSE" ), tr( "BUT_OK" ) );
703 QString Command = myCommand.join( "" ) + GetNewCommand( Parameters );
704 Sketcher_Profile aProfile( Command.toAscii() );
706 Command = myCommand.join( "" );
707 aProfile = Sketcher_Profile( Command.toAscii() );
708 TopoDS_Shape myShape;
709 if ( aProfile.IsDone() )
710 myShape = aProfile.GetShape();
712 if ( myShape.ShapeType() != TopAbs_VERTEX )
713 myCommand.append( ":WW" );
716 // PAL16008 (Sketcher Validation should be equal to Apply&Close)
717 if ( Group1Spin->buttonApply->isEnabled() && Group1Spin->isVisible() ||
718 Group2Spin->buttonApply->isEnabled() && Group2Spin->isVisible() ||
719 Group3Spin->buttonApply->isEnabled() && Group3Spin->isVisible() ||
720 Group4Spin->buttonApply->isEnabled() && Group4Spin->isVisible() ||
721 Group1Sel ->buttonApply->isEnabled() && Group1Sel->isVisible() ) {
727 if ( myCommand.size() > 2 )
734 //=================================================================================
735 // function : ClickOnApply()
737 //=================================================================================
738 bool EntityGUI_SketcherDlg::ClickOnApply()
740 if ( sender() && sender()->inherits( "QPushButton" ) )
741 ( (QPushButton*)sender() )->setFocus(); // to update value of currently edited spin-box (PAL11948)
744 myCommand.append( GetNewCommand( aParameters ) );
745 mySketchState = NEXT_POINT;
747 myUndoCommand.clear();
748 myUndoCommand.append( "Sketcher" );
750 myParameters.append( aParameters );
751 myUndoParameters.clear();
753 MainWidget->GroupConstructors->setEnabled( true );
754 MainWidget->GroupDest1->setEnabled( true );
755 setEnabledUndo( true );
756 setEnabledRedo( false );
759 GEOMBase_Helper::displayPreview( false, true, true, myLineWidth );
762 // Set focus to SpinBox_DX
763 if ( sender() == Group1Spin->buttonApply ) {
764 (Group1Spin->SpinBox_DX)->setFocus();
765 (Group1Spin->SpinBox_DX)->selectAll();
767 else if ( sender() == Group2Spin->buttonApply ) {
768 (Group2Spin->SpinBox_DX)->setFocus();
769 (Group2Spin->SpinBox_DX)->selectAll();
771 else if ( sender() == Group3Spin->buttonApply ) {
772 (Group3Spin->SpinBox_DX)->setFocus();
773 (Group3Spin->SpinBox_DX)->selectAll();
775 else if ( sender() == Group4Spin->buttonApply ) {
776 (Group4Spin->SpinBox_DX)->setFocus();
777 (Group4Spin->SpinBox_DX)->selectAll();
783 //=================================================================================
784 // function : ClickOnHelp()
786 //=================================================================================
787 void EntityGUI_SketcherDlg::ClickOnHelp()
789 LightApp_Application* app = (LightApp_Application*)( SUIT_Session::session()->activeApplication() );
791 app->onHelpContextModule( myGeometryGUI ? app->moduleName( myGeometryGUI->moduleName() ) : QString( "" ), myHelpFileName );
795 platform = "winapplication";
797 platform = "application";
800 SUIT_MessageBox::warning( 0, QObject::tr( "WRN_WARNING" ),
801 QObject::tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" ).
802 arg( app->resourceMgr()->stringValue( "ExternalBrowser", platform ) ).arg( myHelpFileName ),
803 QObject::tr( "BUT_OK" ) );
807 //=================================================================================
808 // function : ClickOnUndo()
810 //=================================================================================
811 void EntityGUI_SketcherDlg::ClickOnUndo()
813 myUndoCommand.append( myCommand.last() );
814 myCommand.pop_back();
816 myUndoParameters.append( myParameters.last() );
817 myParameters.pop_back();
819 if ( myCommand.count() == 1 ) {
820 mySketchState = FIRST_POINT;
822 MainWidget->RadioButton1->setChecked( true );
825 connect( myGeometryGUI->getApp()->selectionMgr(),
826 SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
828 MainWidget->GroupConstructors->setEnabled( false );
829 MainWidget->GroupDest1->setEnabled( false );
830 setEnabledUndo( false );
833 setEnabledRedo( true );
835 GEOMBase_Helper::displayPreview( false, true, true, myLineWidth );
838 //=================================================================================
839 // function : ClickOnRedo()
841 //=================================================================================
842 void EntityGUI_SketcherDlg::ClickOnRedo()
844 myCommand.append( myUndoCommand.last() );
845 myUndoCommand.pop_back();
847 myParameters.append( myUndoParameters.last() );
848 myUndoParameters.pop_back();
850 mySketchState = NEXT_POINT;
852 MainWidget->GroupConstructors->setEnabled( true );
853 MainWidget->GroupDest1->setEnabled( true );
854 setEnabledUndo( true );
856 if ( myUndoCommand.count() == 1 )
857 setEnabledRedo( false );
859 GEOMBase_Helper::displayPreview( false, true, true, myLineWidth );
862 //=================================================================================
863 // function : setEnabledUndo()
865 //=================================================================================
866 void EntityGUI_SketcherDlg::setEnabledUndo( bool value )
868 Group1Sel->buttonUndo->setEnabled( value );
869 Group1Spin->buttonUndo->setEnabled( value );
870 Group2Spin->buttonUndo->setEnabled( value );
871 Group3Spin->buttonUndo->setEnabled( value );
872 Group4Spin->buttonUndo->setEnabled( value );
875 //=================================================================================
876 // function : setEnabledRedo()
878 //=================================================================================
879 void EntityGUI_SketcherDlg::setEnabledRedo( bool value )
881 Group1Sel->buttonRedo->setEnabled( value );
882 Group1Spin->buttonRedo->setEnabled( value );
883 Group2Spin->buttonRedo->setEnabled( value );
884 Group3Spin->buttonRedo->setEnabled( value );
885 Group4Spin->buttonRedo->setEnabled( value );
888 //=================================================================================
889 // function : SelectionIntoArgument()
890 // purpose : Called when selection as changed
891 //=================================================================================
892 void EntityGUI_SketcherDlg::SelectionIntoArgument()
894 myEditCurrentArgument->setText( "" );
900 LightApp_SelectionMgr* aSelMgr = myGeometryGUI->getApp()->selectionMgr();
901 SALOME_ListIO aSelList;
902 aSelMgr->selectedObjects(aSelList);
904 int nbSel = aSelList.Extent();
905 if (nbSel == 1 && myEditCurrentArgument == Group1Sel->LineEdit1) {
906 Standard_Boolean aRes = Standard_False;
907 GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aRes);
908 if (!CORBA::is_nil(aSelectedObject) && aRes) {
910 if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_VERTEX)) {
912 gp_Ax3 aWPlane = GetActiveLocalCS();
914 aTrans.SetTransformation(aWPlane);
915 BRepBuilderAPI_Transform aTransformation (aShape, aTrans, Standard_False);
916 aShape = aTransformation.Shape();
919 if ( GEOMBase::VertexToPoint( aShape, aPnt ) ) {
922 Group1Sel->LineEdit1->setText( GEOMBase::GetName( aSelectedObject ) );
923 if( Group2Spin->isVisible() && mySketchType == PT_ABS ) {
924 disconnect( Group2Spin->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
925 disconnect( Group2Spin->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
926 Group2Spin->SpinBox_DX->setValue(myX);
927 Group2Spin->SpinBox_DY->setValue(myY);
928 connect( Group2Spin->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
929 connect( Group2Spin->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
930 } else if ( Group2Spin->isVisible() && mySketchType == PT_RELATIVE ) {
931 if ( myLastX1 && myLastY1 ) {
932 Group2Spin->SpinBox_DX->setValue(myX - myLastX1);
933 Group2Spin->SpinBox_DY->setValue(myY - myLastY1);
935 if ( mySketchState != FIRST_POINT ) {
936 Group2Spin->SpinBox_DX->setValue(myX - tmpX);
937 Group2Spin->SpinBox_DY->setValue(myY - tmpY);
939 Group2Spin->SpinBox_DX->setValue(myX);
940 Group2Spin->SpinBox_DY->setValue(myY);
949 GEOMBase_Helper::displayPreview( false, true, true, myLineWidth );
953 //=================================================================================
954 // function : SetEditCurrentArgument()
956 //=================================================================================
957 void EntityGUI_SketcherDlg::SetEditCurrentArgument()
959 if ( sender() == Group1Sel->PushButton1 ) {
960 myEditCurrentArgument = Group1Sel->LineEdit1;
961 myEditCurrentArgument->setFocus();
963 SelectionIntoArgument();
967 //=================================================================================
968 // function : LineEditReturnPressed()
970 //=================================================================================
971 void EntityGUI_SketcherDlg::LineEditReturnPressed()
973 if ( sender() == Group1Sel->LineEdit1 ) {
974 myEditCurrentArgument = Group1Sel->LineEdit1;
976 /* User name of object input management */
977 /* If successfull the selection is changed and signal emitted... */
978 /* so SelectionIntoArgument() is automatically called. */
979 const QString objectUserName = myEditCurrentArgument->text();
980 QWidget* thisWidget = (QWidget*)this;
982 LightApp_SelectionMgr* aSelMgr = myGeometryGUI->getApp()->selectionMgr();
983 SALOME_ListIO aSelList;
984 aSelMgr->selectedObjects(aSelList);
986 if (GEOMBase::SelectionByNameInDialogs(thisWidget, objectUserName, aSelList))
987 myEditCurrentArgument->setText( objectUserName );
992 //=================================================================================
993 // function : DeactivateActiveDialog()
995 //=================================================================================
996 void EntityGUI_SketcherDlg::DeactivateActiveDialog()
998 //myGeometryGUI->SetState( -1 );
1000 setEnabled( false );
1002 disconnect( myGeometryGUI->getApp()->selectionMgr(), 0, this, 0 );
1003 myGeometryGUI->SetActiveDialogBox( 0 );
1007 //=================================================================================
1008 // function : ActivateThisDialog()
1010 //=================================================================================
1011 void EntityGUI_SketcherDlg::ActivateThisDialog()
1013 myGeometryGUI->EmitSignalDeactivateDialog();
1015 myGeometryGUI->SetActiveDialogBox( this );
1017 connect( myGeometryGUI->getApp()->selectionMgr(),
1018 SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
1020 //myGeometryGUI->SetState( 0 );
1021 globalSelection( GEOM_POINT );
1023 myEditCurrentArgument = Group1Sel->LineEdit1;
1024 myEditCurrentArgument->setFocus();
1026 GEOMBase_Helper::displayPreview( false, true, true, myLineWidth );
1030 //=================================================================================
1031 // function : enterEvent [REDEFINED]
1033 //=================================================================================
1034 void EntityGUI_SketcherDlg::enterEvent( QEvent* )
1036 if ( !MainWidget->GroupConstructors->isEnabled() )
1037 ActivateThisDialog();
1041 //=================================================================================
1042 // function : closeEvent()
1044 //=================================================================================
1045 void EntityGUI_SketcherDlg::closeEvent( QCloseEvent* e )
1047 //myGeometryGUI->SetState( -1 );
1048 disconnect( myGeometryGUI->getApp()->selectionMgr(), 0, this, 0 );
1049 myGeometryGUI->getApp()->updateActions();
1050 QDialog::closeEvent( e );
1054 //=================================================================================
1055 // function : ValueChangedInSpinBox()
1057 //=================================================================================
1058 void EntityGUI_SketcherDlg::ValueChangedInSpinBox( double newValue )
1060 QObject* send = (QObject*)sender();
1061 Standard_Real vx, vy, vz, vs;
1062 vx = vy = vz = vs = 0.0;
1064 QString vxStr, vyStr, vzStr, vsStr;
1066 QString newValueStr;
1067 if( SalomeApp_DoubleSpinBox* aDoubleSpinBox = (SalomeApp_DoubleSpinBox*)send )
1068 newValueStr = aDoubleSpinBox->text();
1070 if ( send == Group1Spin->SpinBox_DX ) {
1071 vx = newValue; vxStr = newValueStr;
1073 else if ( send == Group2Spin->SpinBox_DX ) {
1074 vx = newValue; vxStr = newValueStr;
1075 vy = Group2Spin->SpinBox_DY->value(); vyStr = Group2Spin->SpinBox_DY->text();
1077 else if ( send == Group2Spin->SpinBox_DY ) {
1078 vx = Group2Spin->SpinBox_DX->value(); vxStr = Group2Spin->SpinBox_DX->text();
1079 vy = newValue; vyStr = newValueStr;
1081 else if ( send == Group3Spin->SpinBox_DX ) {
1082 vx = newValue; vxStr = newValueStr;
1083 vy = Group3Spin->SpinBox_DY->value(); vyStr = Group3Spin->SpinBox_DY->text();
1084 vz = Group3Spin->SpinBox_DZ->value(); vzStr = Group3Spin->SpinBox_DZ->text();
1086 else if ( send == Group3Spin->SpinBox_DY ) {
1087 vx = Group3Spin->SpinBox_DX->value(); vxStr = Group3Spin->SpinBox_DX->text();
1088 vy = newValue; vyStr = newValueStr;
1089 vz = Group3Spin->SpinBox_DZ->value(); vzStr = Group3Spin->SpinBox_DZ->text();
1091 else if ( send == Group3Spin->SpinBox_DZ ) {
1092 vx = Group3Spin->SpinBox_DX->value(); vxStr = Group3Spin->SpinBox_DX->text();
1093 vy = Group3Spin->SpinBox_DY->value(); vyStr = Group3Spin->SpinBox_DY->text();
1094 vz = newValue; vzStr = newValueStr;
1096 else if ( send == Group4Spin->SpinBox_DX ) {
1097 vx = newValue; vxStr = newValueStr;
1098 vy = Group4Spin->SpinBox_DY->value(); vyStr = Group4Spin->SpinBox_DY->text();
1099 vz = Group4Spin->SpinBox_DZ->value(); vzStr = Group4Spin->SpinBox_DZ->text();
1100 vs = Group4Spin->SpinBox_DS->value(); vsStr = Group4Spin->SpinBox_DS->text();
1102 else if ( send == Group4Spin->SpinBox_DY ) {
1103 vx = Group4Spin->SpinBox_DX->value(); vxStr = Group4Spin->SpinBox_DX->text();
1104 vy = newValue; vyStr = newValueStr;
1105 vz = Group4Spin->SpinBox_DZ->value(); vzStr = Group4Spin->SpinBox_DZ->text();
1106 vs = Group4Spin->SpinBox_DS->value(); vsStr = Group4Spin->SpinBox_DS->text();
1108 else if ( send == Group4Spin->SpinBox_DZ ) {
1109 vx = Group4Spin->SpinBox_DX->value(); vxStr = Group4Spin->SpinBox_DX->text();
1110 vy = Group4Spin->SpinBox_DY->value(); vyStr = Group4Spin->SpinBox_DY->text();
1111 vz = newValue; vzStr = newValueStr;
1112 vs = Group4Spin->SpinBox_DS->value(); vsStr = Group4Spin->SpinBox_DS->text();
1114 else if ( send == Group4Spin->SpinBox_DS ) {
1115 vx = Group4Spin->SpinBox_DX->value(); vxStr = Group4Spin->SpinBox_DX->text();
1116 vy = Group4Spin->SpinBox_DY->value(); vyStr = Group4Spin->SpinBox_DY->text();
1117 vz = Group4Spin->SpinBox_DZ->value(); vzStr = Group4Spin->SpinBox_DZ->text();
1118 vs = newValue; vsStr = newValueStr;
1120 // Fix of the NPAL16010 bug is removed, because it's not actual with the Qt-4.x
1122 if ( myConstructorId == 0 ) { // SEGMENT
1123 if ( mySketchType == PT_ABS ) {
1129 else if ( mySketchType == PT_RELATIVE ) {
1135 else if ( mySketchType == DIR_ANGLE_LENGTH ) {
1139 myLengthStr = vyStr;
1141 else if ( mySketchType == DIR_ANGLE_X ) {
1147 else if ( mySketchType == DIR_ANGLE_Y ) {
1153 else if ( mySketchType == DIR_PER_LENGTH ) {
1155 myLengthStr = vxStr;
1157 else if ( mySketchType == DIR_PER_X ) {
1161 else if ( mySketchType == DIR_PER_Y ) {
1165 else if ( mySketchType == DIR_TAN_LENGTH ) {
1167 myLengthStr = vxStr;
1169 else if ( mySketchType == DIR_TAN_X ) {
1173 else if ( mySketchType == DIR_TAN_Y ) {
1177 else if ( mySketchType == DIR_DXDY_LENGTH ) {
1183 myLengthStr = vzStr;
1185 else if ( mySketchType == DIR_DXDY_X ) {
1193 else if ( mySketchType == DIR_DXDY_Y ) {
1202 else if ( myConstructorId == 1 ) { // ARC
1203 if ( mySketchType == DIR_ANGLE_LENGTH ) {
1208 myRadiusStr = vyStr;
1209 myLengthStr = vzStr;
1211 else if ( mySketchType == DIR_PER_LENGTH ) {
1214 myRadiusStr = vxStr;
1215 myLengthStr = vyStr;
1217 else if ( mySketchType == DIR_TAN_LENGTH ) {
1220 myRadiusStr = vxStr;
1221 myLengthStr = vyStr;
1223 else if ( mySketchType == DIR_DXDY_LENGTH ) {
1230 myRadiusStr = vzStr;
1231 myLengthStr = vsStr;
1235 GEOMBase_Helper::displayPreview( false, true, true, myLineWidth );
1239 //=================================================================================
1240 // function : GetNewCommand()
1241 // purpose : Build the new command with context
1242 //=================================================================================
1243 QString EntityGUI_SketcherDlg::GetNewCommand( QString& theParameters )
1245 theParameters.clear();
1246 QString myNewCommand = ":";
1247 if ( mySketchState == FIRST_POINT ) {
1248 if ( mySketchType == PT_ABS || mySketchType == PT_SEL ) {
1249 myNewCommand = myNewCommand + "F " + QString::number( myX ) + " " + QString::number( myY );
1250 theParameters = myXStr + ":" + myYStr;
1252 if ( mySketchType == PT_RELATIVE) {
1253 myNewCommand = myNewCommand + "F " + QString::number( myDX ) + " " + QString::number( myDY );
1254 theParameters = myDXStr + ":" + myDYStr;
1256 return myNewCommand;
1259 if ( myConstructorId == 0 ) { // SEGMENT
1260 if ( mySketchType == PT_ABS || mySketchType == PT_SEL ) {
1261 myNewCommand = myNewCommand + "TT " + QString::number( myX ) + " " + QString::number( myY );
1262 theParameters = myXStr + ":" + myYStr;
1264 if ( mySketchType == PT_RELATIVE) {
1265 myNewCommand = myNewCommand + "T " + QString::number( myDX ) + " " + QString::number( myDY );
1266 theParameters = myDXStr + ":" + myDYStr;
1268 if ( mySketchType == DIR_ANGLE_LENGTH ) {
1269 myNewCommand = myNewCommand + "R " + QString::number( myAngle );
1270 myNewCommand = myNewCommand + ":" + "L " + QString::number( myLength );
1271 theParameters = myAngleStr + ":" + myLengthStr;
1273 if ( mySketchType == DIR_ANGLE_X ) {
1274 myNewCommand = myNewCommand + "R " + QString::number( myAngle );
1275 myNewCommand = myNewCommand + ":" + "IX " + QString::number( myX );
1276 theParameters = myAngleStr + ":" + myXStr;
1278 if ( mySketchType == DIR_ANGLE_Y ) {
1279 myNewCommand = myNewCommand + "R " + QString::number( myAngle );
1280 myNewCommand = myNewCommand + ":" + "IY " + QString::number( myY );
1281 theParameters = myAngleStr + ":" + myYStr;
1283 if ( mySketchType == DIR_PER_LENGTH ) {
1284 myNewCommand = myNewCommand + "R " + QString::number( 90.0 );
1285 myNewCommand = myNewCommand + ":" + "L " + QString::number( myLength );
1286 theParameters = QString::number( 90.0 ) + ":" + myLengthStr;
1288 if ( mySketchType == DIR_PER_X ) {
1289 myNewCommand = myNewCommand + "R " + QString::number( 90.0 );
1290 myNewCommand = myNewCommand + ":" + "IX " + QString::number( myX );
1291 theParameters = QString::number( 90.0 ) + ":" + myXStr;
1293 if ( mySketchType == DIR_PER_Y ) {
1294 myNewCommand = myNewCommand + "R " + QString::number( 90.0 );
1295 myNewCommand = myNewCommand + ":" + "IY " + QString::number( myY );
1296 theParameters = QString::number( 90.0 ) + ":" + myYStr;
1298 if ( mySketchType == DIR_TAN_LENGTH ) {
1299 myNewCommand = myNewCommand + "L " + QString::number( myLength );
1300 theParameters = myLengthStr;
1302 if ( mySketchType == DIR_TAN_X ) {
1303 myNewCommand = myNewCommand + "IX " + QString::number( myX );
1304 theParameters = myXStr;
1306 if ( mySketchType == DIR_TAN_Y) {
1307 myNewCommand = myNewCommand + "IY " + QString::number(myY);
1308 theParameters = myYStr;
1310 if ( mySketchType == DIR_DXDY_LENGTH ) {
1311 myNewCommand = myNewCommand + "D " + QString::number( myDX ) + " " + QString::number( myDY );
1312 myNewCommand = myNewCommand + ":" + "L " + QString::number( myLength );
1313 theParameters = myDXStr + ":" + myDYStr + ":" + myLengthStr;
1315 if ( mySketchType == DIR_DXDY_X ) {
1316 myNewCommand = myNewCommand + "D " + QString::number( myDX ) + " " + QString::number( myDY );
1317 myNewCommand = myNewCommand + ":" + "IX " + QString::number( myX );
1318 theParameters = myDXStr + ":" + myDYStr + ":" + myXStr;
1320 if ( mySketchType == DIR_DXDY_Y ) {
1321 myNewCommand = myNewCommand + "D " + QString::number( myDX ) + " " + QString::number( myDY );
1322 myNewCommand = myNewCommand + ":" + "IY " + QString::number( myY );
1323 theParameters = myDXStr + ":" + myDYStr + ":" + myYStr;
1326 else if ( myConstructorId == 1 ) { // ARC
1327 if ( mySketchType == DIR_ANGLE_LENGTH ) {
1328 myNewCommand = myNewCommand + "R " + QString::number( myAngle );
1329 myNewCommand = myNewCommand + ":" + "C " + QString::number( myRadius ) + " " + QString::number( myLength );
1330 theParameters = myAngleStr + ":" + myRadiusStr + ":" + myLengthStr;
1332 if ( mySketchType == DIR_PER_LENGTH ) {
1333 myNewCommand = myNewCommand + "R " + QString::number( 90.0 );
1334 myNewCommand = myNewCommand + ":" + "C " + QString::number( myRadius ) + " " + QString::number( myLength );
1335 theParameters = QString::number( 90.0 ) + ":" + myRadiusStr + ":" + myLengthStr;
1337 if ( mySketchType == DIR_TAN_LENGTH ) {
1338 myNewCommand = myNewCommand + "C " + QString::number( myRadius ) + " " + QString::number( myLength );
1339 theParameters = myRadiusStr + ":" + myLengthStr;
1341 if ( mySketchType == DIR_DXDY_LENGTH ) {
1342 myNewCommand = myNewCommand + "D " + QString::number( myDX ) + " " + QString::number( myDY );
1343 myNewCommand = myNewCommand + ":" + "C " + QString::number( myRadius ) + " " + QString::number( myLength );
1344 theParameters = myDXStr + ":" + myDYStr + ":" + myRadiusStr + ":" + myLengthStr;
1347 return myNewCommand;
1350 //=================================================================================
1351 // function : createOperation
1353 //=================================================================================
1354 GEOM::GEOM_IOperations_ptr EntityGUI_SketcherDlg::createOperation()
1356 return getGeomEngine()->GetICurvesOperations( getStudyId() );
1359 //=================================================================================
1360 // function : isValid
1362 //=================================================================================
1363 bool EntityGUI_SketcherDlg::isValid( QString& msg )
1366 bool toCorrect = !IsPreview() || myIsApply;
1368 if( Group1Spin->isVisible() ) {
1369 ok = Group1Spin->SpinBox_DX->isValid( msg, toCorrect ) && ok;
1371 else if( Group2Spin->isVisible() ) {
1372 ok = Group2Spin->SpinBox_DX->isValid( msg, toCorrect ) && ok;
1373 ok = Group2Spin->SpinBox_DY->isValid( msg, toCorrect ) && ok;
1375 else if( Group3Spin->isVisible() ) {
1376 ok = Group3Spin->SpinBox_DX->isValid( msg, toCorrect ) && ok;
1377 ok = Group3Spin->SpinBox_DY->isValid( msg, toCorrect ) && ok;
1378 ok = Group3Spin->SpinBox_DZ->isValid( msg, toCorrect ) && ok;
1380 else if( Group4Spin->isVisible() ) {
1381 ok = Group4Spin->SpinBox_DX->isValid( msg, toCorrect ) && ok;
1382 ok = Group4Spin->SpinBox_DY->isValid( msg, toCorrect ) && ok;
1383 ok = Group4Spin->SpinBox_DZ->isValid( msg, toCorrect ) && ok;
1384 ok = Group4Spin->SpinBox_DS->isValid( msg, toCorrect ) && ok;
1387 if( myIsApply && !ok )
1393 //=================================================================================
1394 // function : execute
1396 //=================================================================================
1397 bool EntityGUI_SketcherDlg::execute( ObjectList& objects )
1399 QString aParameters;
1401 if ( mySketchState == FIRST_POINT ) {
1406 //Test if the current point is the same as the last one
1407 TopoDS_Shape myShape1, myShape2;
1410 QString Command1 = myCommand.join( "" );
1411 Sketcher_Profile aProfile1( Command1.toAscii() );
1412 if ( aProfile1.IsDone() )
1413 myShape1 = aProfile1.GetShape();
1416 QString Command2 = Command1 + GetNewCommand( aParameters );
1417 Sketcher_Profile aProfile2( Command2.toAscii() );
1418 if ( aProfile2.IsDone() )
1419 myShape2 = aProfile2.GetShape();
1421 if ( myShape2.IsNull() ) {
1422 //the current point is the same as the last one
1423 myLastX2 = myLastX1;
1424 myLastY2 = myLastY1;
1427 TopoDS_Vertex V1, V2;
1429 if ( myShape1.ShapeType() == TopAbs_VERTEX ) {
1430 //the last shape is the first point
1431 pt = BRep_Tool::Pnt( TopoDS::Vertex( myShape1 ) );
1436 TopExp::Vertices( TopoDS::Wire( myShape1 ), V1, V2 );
1437 pt = BRep_Tool::Pnt( V2 );
1441 TopExp::Vertices( TopoDS::Wire( myShape2 ), V1, V2 );
1442 pt = BRep_Tool::Pnt( V2 );
1449 if ( ( mySketchState != FIRST_POINT &&
1450 myLastX1 == myLastX2 && myLastY1 == myLastY2 ) || myIsAllAdded ) {
1451 cmd = myCommand.join( "" );
1453 if ( Group1Sel->isVisible() ) {
1454 Group1Sel->buttonApply->setEnabled( false );
1455 //Group1Sel->buttonApply->setFocus();
1457 if ( Group1Spin->isVisible() ) {
1458 Group1Spin->buttonApply->setEnabled( false );
1459 //Group1Spin->buttonApply->setFocus();
1461 if ( Group2Spin->isVisible() ) {
1462 Group2Spin->buttonApply->setEnabled( false );
1463 //Group2Spin->buttonApply->setFocus();
1465 if ( Group3Spin->isVisible() ) {
1466 Group3Spin->buttonApply->setEnabled( false );
1467 //Group3Spin->buttonApply->setFocus();
1469 if ( Group4Spin->isVisible() ) {
1470 Group4Spin->buttonApply->setEnabled( false );
1471 //Group4Spin->buttonApply->setFocus();
1475 cmd = myCommand.join( "" ) + GetNewCommand( aParameters );
1477 if ( Group1Sel->isVisible() ) {
1478 Group1Sel->buttonApply->setEnabled( true );
1479 //Group1Sel->buttonApply->setFocus();
1481 if ( Group1Spin->isVisible() ) {
1482 Group1Spin->buttonApply->setEnabled( true );
1483 //Group1Spin->buttonApply->setFocus();
1485 if ( Group2Spin->isVisible() ) {
1486 Group2Spin->buttonApply->setEnabled( true );
1487 //Group2Spin->buttonApply->setFocus();
1489 if ( Group3Spin->isVisible() ) {
1490 Group3Spin->buttonApply->setEnabled( true );
1491 //Group3Spin->buttonApply->setFocus();
1493 if ( Group4Spin->isVisible() ) {
1494 Group4Spin->buttonApply->setEnabled( true );
1495 //Group4Spin->buttonApply->setFocus();
1499 gp_Ax3 myWPlane = GetActiveLocalCS();
1500 GEOM::ListOfDouble_var WPlane = new GEOM::ListOfDouble;
1501 WPlane->length( 9 );
1502 WPlane[0] = myWPlane.Location().X();
1503 WPlane[1] = myWPlane.Location().Y();
1504 WPlane[2] = myWPlane.Location().Z();
1506 WPlane[3] = myWPlane.Direction().X();
1507 WPlane[4] = myWPlane.Direction().Y();
1508 WPlane[5] = myWPlane.Direction().Z();
1510 WPlane[6] = myWPlane.XDirection().X();
1511 WPlane[7] = myWPlane.XDirection().Y();
1512 WPlane[8] = myWPlane.XDirection().Z();
1514 GEOM::GEOM_ICurvesOperations_var anOper = GEOM::GEOM_ICurvesOperations::_narrow(getOperation());
1515 GEOM::GEOM_Object_var anObj = anOper->MakeSketcher( cmd.toLatin1().constData(), WPlane );
1517 if ( !anObj->_is_nil() )
1519 if( !IsPreview() ) {
1520 QStringList aCurrentParameters = myParameters;
1521 aCurrentParameters << aParameters;
1522 anObj->SetParameters(aCurrentParameters.join(":").toLatin1().constData());
1525 objects.push_back( anObj._retn() );
1531 //================================================================
1532 // Function : displayPreview
1533 // Purpose : Method for displaying preview of resulting shape
1534 // Redefined from GEOMBase_Helper.
1535 //================================================================
1536 void EntityGUI_SketcherDlg::displayPreview( GEOM::GEOM_Object_ptr object,
1538 const bool activate,
1540 const double lineWidth,
1541 const int displayMode,
1544 // Set color for preview shape
1545 getDisplayer()->SetColor( Quantity_NOC_RED );
1547 // set width of displayed shape
1548 getDisplayer()->SetWidth( (lineWidth == -1)?myLineWidth:lineWidth );
1550 // Disable activation of selection
1551 getDisplayer()->SetToActivate( activate );
1553 // Make a reference to GEOM_Object
1554 CORBA::String_var objStr = myGeometryGUI->getApp()->orb()->object_to_string( object );
1555 getDisplayer()->SetName( objStr.in() );
1557 // Create wire from applayed object
1558 TopoDS_Shape anApplyedWire, aLastSegment;
1559 if ( !createShapes( object, anApplyedWire, aLastSegment ) )
1563 SALOME_Prs* aPrs = getDisplayer()->BuildPrs( anApplyedWire );
1564 if ( aPrs != 0 && !aPrs->IsNull() )
1565 GEOMBase_Helper::displayPreview( aPrs, append, update );
1567 getDisplayer()->SetColor( Quantity_NOC_VIOLET );
1568 aPrs = getDisplayer()->BuildPrs( aLastSegment );
1569 if ( aPrs != 0 && !aPrs->IsNull() )
1570 GEOMBase_Helper::displayPreview( aPrs, append, update );
1572 getDisplayer()->UnsetName();
1574 // Enable activation of displayed objects
1575 getDisplayer()->SetToActivate( true );
1578 //================================================================
1579 // Function : createShapes
1580 // Purpose : Create applyed wire, and last segment from entry object
1581 //================================================================
1582 bool EntityGUI_SketcherDlg::createShapes( GEOM::GEOM_Object_ptr theObject,
1583 TopoDS_Shape& theApplyedWire,
1584 TopoDS_Shape& theLastSegment )
1586 TopoDS_Shape aShape;
1587 if ( !GEOMBase::GetShape( theObject, aShape ) ||
1588 aShape.ShapeType() != TopAbs_WIRE && aShape.ShapeType() != TopAbs_VERTEX )
1591 if ( Group1Sel->isVisible() && !Group1Sel->buttonApply->isEnabled() ||
1592 Group1Spin->isVisible() && !Group1Spin->buttonApply->isEnabled() ||
1593 Group2Spin->isVisible() && !Group2Spin->buttonApply->isEnabled() ||
1594 Group3Spin->isVisible() && !Group3Spin->buttonApply->isEnabled() ||
1595 Group4Spin->isVisible() && !Group4Spin->buttonApply->isEnabled() ) {
1596 theApplyedWire = aShape;
1600 BRepBuilderAPI_MakeWire aBuilder;
1601 TopExp_Explorer anExp( aShape, TopAbs_EDGE );
1603 TopoDS_Shape anEdge = anExp.Current();
1605 if ( anExp.More() ) // i.e. non-last edge
1606 aBuilder.Add( TopoDS::Edge( anEdge ) );
1608 theLastSegment = anEdge;
1613 if ( aBuilder.IsDone() )
1614 theApplyedWire = aBuilder.Shape();
1619 //=================================================================================
1620 // function : keyPressEvent()
1622 //=================================================================================
1623 void EntityGUI_SketcherDlg::keyPressEvent( QKeyEvent* e )
1625 QDialog::keyPressEvent( e );
1626 if ( e->isAccepted() )
1629 if ( e->key() == Qt::Key_F1 ) {
1635 //=================================================================================
1636 // function : initSpinBox()
1638 //=================================================================================
1639 void EntityGUI_SketcherDlg::initSpinBox( SalomeApp_DoubleSpinBox* spinBox,
1640 double min, double max,
1641 double step, const char* quantity )
1643 // The same stuff as in GEOMBase_Skeleton::initSpinBox()!
1644 // TODO: Think how to keep the single piece of code...
1646 // Obtain precision from preferences
1647 SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
1648 int aPrecision = resMgr->integerValue( "Geometry", quantity, 6 );
1650 spinBox->setPrecision( aPrecision );
1651 spinBox->setDecimals( aPrecision ); // it's necessary to set decimals before the range setting,
1652 // by default Qt rounds boundaries to 2 decimals at setRange
1653 spinBox->setRange( min, max );
1654 spinBox->setSingleStep( step );
1656 // Add a hint for the user saying how to tune precision
1657 QString userPropName = QObject::tr( QString( "PREF_%1" ).arg( quantity ).toLatin1().constData() );
1658 spinBox->setProperty( "validity_tune_hint",
1659 QVariant( QObject::tr( "PRECISION_HINT" ).arg( userPropName ) ) );
1662 //=================================================================================
1663 // function : SetDoubleSpinBoxStep()
1664 // purpose : Double spin box management
1665 //=================================================================================
1666 void EntityGUI_SketcherDlg::SetDoubleSpinBoxStep( double step )
1668 Group1Spin->SpinBox_DX->setSingleStep(step);
1669 Group2Spin->SpinBox_DX->setSingleStep(step);
1670 Group2Spin->SpinBox_DY->setSingleStep(step);
1671 Group3Spin->SpinBox_DX->setSingleStep(step);
1672 Group3Spin->SpinBox_DY->setSingleStep(step);
1673 Group3Spin->SpinBox_DZ->setSingleStep(step);
1674 Group4Spin->SpinBox_DZ->setSingleStep(step);
1676 // san: Do NOT override the step when a speicifc step value is used
1677 // in some input fields!
1678 //Group4Spin->SpinBox_DX->setSingleStep(step);
1679 //Group4Spin->SpinBox_DY->setSingleStep(step);
1680 //Group4Spin->SpinBox_DS->setSingleStep(step);
1683 //=================================================================================
1684 // function : FindLocalCS()
1685 // purpose : Find All Coordinates systems in study
1686 //=================================================================================
1687 void EntityGUI_SketcherDlg::FindLocalCS()
1691 SalomeApp_Application* app =
1692 dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
1696 SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
1700 _PTR(Study) aStudy = appStudy->studyDS();
1703 ComboBox1->addItem(tr("GEOM_GCS"));
1704 gp_Pnt aOrigin = gp_Pnt(0, 0, 0);
1705 gp_Dir aDirZ = gp_Dir(0, 0, 1);
1706 gp_Dir aDirX = gp_Dir(1, 0, 0);
1707 gp_Ax3 globalCS = gp_Ax3(aOrigin, aDirZ, aDirX);
1708 myLCSList.push_back(globalCS);
1710 // get GEOM component
1711 CORBA::String_var geomIOR = app->orb()->object_to_string( GeometryGUI::GetGeomGen() );
1712 _PTR(SObject) obj = aStudy->FindObjectIOR( geomIOR.in() );
1715 _PTR(SComponent) fc = obj->GetFatherComponent();
1716 QString geomComp = fc->GetID().c_str();
1717 _PTR(SObject) comp = aStudy->FindObjectID( geomComp.toLatin1().data() );
1721 // browse through all GEOM data tree
1722 _PTR(ChildIterator) it ( aStudy->NewChildIterator( comp ) );
1723 for ( it->InitEx( true ); it->More(); it->Next() ) {
1724 _PTR(SObject) child( it->Value() );
1725 CORBA::Object_var corbaObj = GeometryGUI::ClientSObjectToObject( child );
1726 GEOM::GEOM_Object_var geomObj = GEOM::GEOM_Object::_narrow( corbaObj );
1727 if( CORBA::is_nil( geomObj ) )
1729 if (geomObj->GetType() == GEOM_MARKER) {
1730 ComboBox1->addItem(geomObj->GetName());
1731 TopoDS_Shape aShape = GEOM_Client().GetShape(GeometryGUI::GetGeomGen(), geomObj);
1734 aLCS.Transform(aShape.Location().Transformation());
1735 if (aShape.ShapeType() == TopAbs_FACE) {
1736 Handle(Geom_Surface) aGS = BRep_Tool::Surface(TopoDS::Face(aShape));
1737 if (!aGS.IsNull() && aGS->IsKind(STANDARD_TYPE(Geom_Plane))) {
1738 Handle(Geom_Plane) aGPlane = Handle(Geom_Plane)::DownCast(aGS);
1739 gp_Pln aPln = aGPlane->Pln();
1740 aLCS = aPln.Position();
1743 myLCSList.push_back(aLCS);
1748 //=================================================================================
1749 // function : GetActiveLocalCS()
1750 // purpose : Find All Coordinates systems in study
1751 //=================================================================================
1752 gp_Ax3 EntityGUI_SketcherDlg::GetActiveLocalCS()
1754 int ind = ComboBox1->currentIndex();
1756 return myGeometryGUI->GetWorkingPlane();
1758 gp_Ax3 aLCS = myLCSList.at(ind);
1760 myGeometryGUI->SetWorkingPlane( aLCS );
1761 myGeometryGUI->ActiveWorkingPlane();