Salome HOME
Code refactoring
[modules/geom.git] / src / EntityGUI / EntityGUI_SketcherDlg.cxx
1 //  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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.
10 //
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.
15 //
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
19 //
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 // GEOM GEOMGUI : GUI for Geometry component
24 // File   : EntityGUI_SketcherDlg.cxx
25 // Author : Damien COQUERET, Open CASCADE S.A.S.
26 //
27 #include "EntityGUI_SketcherDlg.h"
28 #include "EntityGUI_Widgets.h"
29 #include <SalomeApp_DoubleSpinBox.h>
30
31 #include <GEOMBase.h>
32 #include <GeometryGUI.h>
33 #include <GEOMImpl_Types.hxx>
34 #include <Geom_Surface.hxx>
35 #include <Geom_Plane.hxx>
36
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>
44
45 #include <QKeyEvent>
46
47 #include <BRep_Tool.hxx>
48 #include <TopExp.hxx>
49 #include <TopExp_Explorer.hxx>
50 #include <TopoDS_Vertex.hxx>
51 #include <TopoDS.hxx>
52 #include <BRepBuilderAPI_Transform.hxx>
53 #include <BRepBuilderAPI_MakeWire.hxx>
54 #include <Sketcher_Profile.hxx>
55
56 #include <SalomeApp_Study.h>
57
58 #include <gp_Pln.hxx>
59
60 #include <Basics_Utils.hxx>
61
62 //=================================================================================
63 // class    : EntityGUI_SketcherDlg()
64 // purpose  : Constructs a EntityGUI_SketcherDlg which is a child of 'parent', with the
65 //            name 'name' and widget flags set to 'f'.
66 //            The dialog will by default be modeless, unless you set 'modal' to
67 //            TRUE to construct a modal dialog.
68 //=================================================================================
69 EntityGUI_SketcherDlg::EntityGUI_SketcherDlg( GeometryGUI* GUI, QWidget* parent,
70                                               bool modal, Qt::WindowFlags fl,
71                                               const double lineWidth )
72   : QDialog( parent, fl ),
73     myIsAllAdded( false ),
74     myIsApply( false ),
75     GEOMBase_Helper( dynamic_cast<SUIT_Desktop*>( parent ) ),
76     myGeometryGUI( GUI ),
77     myLineWidth( lineWidth )
78 {
79   setModal( modal );
80   setAttribute( Qt::WA_DeleteOnClose );
81
82   myGeometryGUI->SetActiveDialogBox(this);
83
84   MainWidget = new EntityGUI_Skeleton( this );
85   QVBoxLayout* topLayout = new QVBoxLayout( this );
86   topLayout->setMargin( 9 ); topLayout->setSpacing( 6 );
87
88   MainWidget->buttonCancel->setText( tr( "GEOM_BUT_CANCEL" ) );
89   MainWidget->buttonEnd->setText( tr( "GEOM_BUT_END_SKETCH" ) );
90   MainWidget->buttonClose->setText( tr( "GEOM_BUT_CLOSE_SKETCH" ) );
91   MainWidget->buttonHelp->setText( tr( "GEOM_BUT_HELP" ) );
92
93   QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
94   QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_UNDO" ) ) );
95   QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_REDO" ) ) );
96
97   setWindowTitle( tr( "GEOM_SKETCHER_TITLE" ) );
98
99   MainWidget->GroupConstructors->setTitle( tr( "GEOM_SKETCHER_EL" ) );
100   MainWidget->RadioButton1->setText( tr( "GEOM_SKETCHER_SEGMENT" ) );
101   MainWidget->RadioButton2->setText( tr( "GEOM_SKETCHER_ARC" ) );
102   MainWidget->GroupDest->setTitle( tr( "GEOM_SKETCHER_DEST" ) );
103   MainWidget->GroupDest1->setTitle( tr( "GEOM_SKETCHER_TYPE" ) );
104   MainWidget->RB_Dest1->setText( tr( "GEOM_SKETCHER_POINT" ) );
105   MainWidget->RB_Dest2->setText( tr( "GEOM_SKETCHER_DIR" ) );
106
107   /***************************************************************/
108
109   GroupBox1 = new QGroupBox(tr("GEOM_CS"), this);
110   QHBoxLayout* planeLayout = new QHBoxLayout(GroupBox1);
111   planeLayout->setSpacing(6);
112   planeLayout->setMargin(11);
113
114   ComboBox1 = new QComboBox(GroupBox1);
115   ComboBox1->setSizePolicy( QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed) );
116   planeLayout->addWidget(ComboBox1);
117
118   planeButton = new QPushButton (GroupBox1);
119   planeButton->setSizePolicy( QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed));
120   planeButton->setText( tr( "GEOM_SKETCHER_RESTORE" ) );
121   planeLayout->addWidget(planeButton);
122
123   topLayout->addWidget(GroupBox1);
124   topLayout->addWidget( MainWidget );
125
126   GroupPt = new EntityGUI_Point( MainWidget->DestCnt );
127
128   GroupPt->GroupPoint->setTitle( tr( "GEOM_SKETCHER_POINT" ) );
129   GroupPt->RB_Point1->setText( tr( "GEOM_SKETCHER_ABS" ) );
130   GroupPt->RB_Point2->setText( tr( "GEOM_SKETCHER_REL" ) );
131   GroupPt->RB_Point3->setText( tr( "GEOM_SKETCHER_SEL" ) );
132
133   GroupPt2 = new EntityGUI_Point( MainWidget->DestCnt );
134
135   GroupPt2->GroupPoint->setTitle( tr( "GEOM_SKETCHER_ADD_PARAMS" ) ); 
136   GroupPt2->RB_Point1->setText( tr( "GEOM_SKETCHER_NONE" ) );
137   GroupPt2->RB_Point2->setText( tr( "GEOM_SKETCHER_RADIUS" ) );
138   GroupPt2->RB_Point3->setText( tr( "GEOM_SKETCHER_CENTER" ) ); 
139
140   GroupD1 = new EntityGUI_Dir1( MainWidget->DestCnt );
141
142   GroupD1->GroupDir1->setTitle( tr( "GEOM_SKETCHER_DIR" ) );
143   GroupD1->RB_Dir11->setText( tr( "GEOM_SKETCHER_ANGLE" ) );
144   GroupD1->RB_Dir12->setText( tr( "GEOM_SKETCHER_PER" ) );
145   GroupD1->RB_Dir13->setText( tr( "GEOM_SKETCHER_TAN" ) );
146   GroupD1->RB_Dir14->setText( tr( "GEOM_SKETCHER_VXVY" ) );
147
148   GroupD2 = new EntityGUI_Dir2( MainWidget->DestCnt );
149
150   GroupD2->GroupDir2->setTitle( tr( "GEOM_SKETCHER_DIR" ) );
151   GroupD2->RB_Dir21->setText( tr( "GEOM_SKETCHER_LENGTH" ) );
152   GroupD2->RB_Dir22->setText( tr( "GEOM_SKETCHER_X" ) );
153   GroupD2->RB_Dir23->setText( tr( "GEOM_SKETCHER_Y" ) );
154
155   Group1Sel = new EntityGUI_1Sel( MainWidget->SkeletonCnt );
156   Group1Sel->TextLabel1->setText( tr( "GEOM_SKETCHER_POINT2" ) );
157   Group1Sel->GroupBox1->setTitle( tr( "GEOM_SKETCHER_VALUES" ) );
158   Group1Sel->buttonApply->setText( tr( "GEOM_SKETCHER_APPLY" ) );
159   Group1Sel->PushButton1->setIcon( image0 );
160   Group1Sel->buttonUndo->setIcon( image1 );
161   Group1Sel->buttonRedo->setIcon( image2 );
162   Group1Sel->LineEdit1->setReadOnly( true );
163
164   Group2Sel = new EntityGUI_2Sel1Check( MainWidget->SkeletonCnt );
165   Group2Sel->GroupBox1->setTitle( tr( "GEOM_SKETCHER_VALUES" ) );
166   Group2Sel->buttonApply->setText( tr( "GEOM_SKETCHER_APPLY" ) );
167   Group2Sel->checkBox->setText( tr( "GEOM_REVERSE" ) );
168   Group2Sel->PushButton1->setIcon( image0 );
169   Group2Sel->PushButton2->setIcon( image0 );
170   Group2Sel->buttonUndo->setIcon( image1 );
171   Group2Sel->buttonRedo->setIcon( image2 );
172   Group2Sel->LineEdit1->setReadOnly( true );
173   Group2Sel->LineEdit2->setReadOnly( true );
174
175   Group1Sel1Spin = new EntityGUI_1Sel1Spin1Check( MainWidget->SkeletonCnt );
176   Group1Sel1Spin->GroupBox1->setTitle( tr( "GEOM_SKETCHER_VALUES" ) );
177   Group1Sel1Spin->buttonApply->setText( tr( "GEOM_SKETCHER_APPLY" ) );
178   Group1Sel1Spin->checkBox->setText( tr( "GEOM_REVERSE" ) );
179   Group1Sel1Spin->PushButton1->setIcon( image0 );
180   Group1Sel1Spin->buttonUndo->setIcon( image1 );
181   Group1Sel1Spin->buttonRedo->setIcon( image2 );
182   Group1Sel1Spin->LineEdit1->setReadOnly( true );
183
184   Group1Spin = new EntityGUI_1Spin( MainWidget->SkeletonCnt );
185   Group1Spin->GroupBox1->setTitle( tr( "GEOM_SKETCHER_VALUES" ) );
186   Group1Spin->buttonApply->setText( tr( "GEOM_SKETCHER_APPLY" ) );
187   Group1Spin->buttonUndo->setIcon( image1 );
188   Group1Spin->buttonRedo->setIcon( image2 );
189
190   Group2Spin = new EntityGUI_2Spin( MainWidget->SkeletonCnt );
191   Group2Spin->GroupBox1->setTitle( tr( "GEOM_SKETCHER_VALUES" ) );
192   Group2Spin->buttonApply->setText( tr( "GEOM_SKETCHER_APPLY" ) );
193   Group2Spin->buttonUndo->setIcon( image1 );
194   Group2Spin->buttonRedo->setIcon( image2 );
195
196   Group3Spin = new EntityGUI_3Spin1Check( MainWidget->SkeletonCnt );
197   Group3Spin->GroupBox1->setTitle( tr( "GEOM_SKETCHER_VALUES" ) );
198   Group3Spin->buttonApply->setText( tr( "GEOM_SKETCHER_APPLY" ) );
199   Group3Spin->checkBox->setText( tr( "GEOM_REVERSE" ) );
200   Group3Spin->buttonUndo->setIcon( image1 );
201   Group3Spin->buttonRedo->setIcon( image2 );
202
203   Group4Spin = new EntityGUI_4Spin1Check( MainWidget->SkeletonCnt );
204   Group4Spin->GroupBox1->setTitle( tr( "GEOM_SKETCHER_VALUES" ) );
205   Group4Spin->buttonApply->setText( tr( "GEOM_SKETCHER_APPLY" ) );
206   Group4Spin->checkBox->setText( tr( "GEOM_REVERSE" ) );
207   Group4Spin->buttonUndo->setIcon( image1 );
208   Group4Spin->buttonRedo->setIcon( image2 );
209
210   //myErrLabel = new QLabel( MainWidget->DestCnt );
211
212   QGridLayout* DestCntLayout = new QGridLayout( MainWidget->DestCnt );
213   DestCntLayout->setMargin( 0 ); DestCntLayout->setSpacing( 6 );
214   DestCntLayout->addWidget( GroupPt, 0, 0 );
215   DestCntLayout->addWidget( GroupPt2, 0, 1 );
216   DestCntLayout->addWidget( GroupD1, 0, 0 );
217   DestCntLayout->addWidget( GroupD2, 0, 1 );
218
219   QVBoxLayout* SkeletonCntlayout = new QVBoxLayout( MainWidget->SkeletonCnt );
220   SkeletonCntlayout->setMargin( 0 ); SkeletonCntlayout->setSpacing( 6 );
221   SkeletonCntlayout->addWidget( Group1Sel,  0, 0 );
222   SkeletonCntlayout->addWidget( Group2Sel,  0, 0 );
223   SkeletonCntlayout->addWidget( Group1Sel1Spin,  0, 0 );
224   SkeletonCntlayout->addWidget( Group1Spin, 0, 0 );
225   SkeletonCntlayout->addWidget( Group2Spin, 0, 0 );
226   SkeletonCntlayout->addWidget( Group3Spin, 0, 0 );
227   SkeletonCntlayout->addWidget( Group4Spin, 0, 0 );
228   /***************************************************************/
229
230   QButtonGroup* ButtonGroup = new QButtonGroup( this );
231   ButtonGroup->addButton( MainWidget->RB_Dest1, 1 );
232   ButtonGroup->addButton( MainWidget->RB_Dest2, 0 );
233
234   /* signals and slots connections */
235   connect( MainWidget->buttonEnd,    SIGNAL( clicked() ), this, SLOT( ClickOnEnd() ) );
236   connect( MainWidget->buttonClose,  SIGNAL( clicked() ), this, SLOT( ClickOnEnd() ) );
237   connect( MainWidget->buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) );
238   connect( MainWidget->buttonHelp,   SIGNAL( clicked() ), this, SLOT( ClickOnHelp() ) );
239
240   connect( Group1Sel->buttonApply,   SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
241   connect( Group1Sel->buttonUndo,    SIGNAL( clicked() ), this, SLOT( ClickOnUndo() ) );
242   connect( Group1Sel->buttonRedo,    SIGNAL( clicked() ), this, SLOT( ClickOnRedo() ) );
243   connect( Group2Sel->buttonApply,   SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
244   connect( Group2Sel->buttonUndo,    SIGNAL( clicked() ), this, SLOT( ClickOnUndo() ) );
245   connect( Group2Sel->buttonRedo,    SIGNAL( clicked() ), this, SLOT( ClickOnRedo() ) );
246   connect( Group1Sel1Spin->buttonApply,   SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
247   connect( Group1Sel1Spin->buttonUndo,    SIGNAL( clicked() ), this, SLOT( ClickOnUndo() ) );
248   connect( Group1Sel1Spin->buttonRedo,    SIGNAL( clicked() ), this, SLOT( ClickOnRedo() ) );
249   connect( Group1Spin->buttonApply,  SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
250   connect( Group1Spin->buttonUndo,   SIGNAL( clicked() ), this, SLOT( ClickOnUndo() ) );
251   connect( Group1Spin->buttonRedo,   SIGNAL( clicked() ), this, SLOT( ClickOnRedo() ) );
252   connect( Group2Spin->buttonApply,  SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
253   connect( Group2Spin->buttonUndo,   SIGNAL( clicked() ), this, SLOT( ClickOnUndo() ) );
254   connect( Group2Spin->buttonRedo,   SIGNAL( clicked() ), this, SLOT( ClickOnRedo() ) );
255   connect( Group3Spin->buttonApply,  SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
256   connect( Group3Spin->buttonUndo,   SIGNAL( clicked() ), this, SLOT( ClickOnUndo() ) );
257   connect( Group3Spin->buttonRedo,   SIGNAL( clicked() ), this, SLOT( ClickOnRedo() ) ) ;
258   connect( Group4Spin->buttonApply,  SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
259   connect( Group4Spin->buttonUndo,   SIGNAL( clicked() ), this, SLOT( ClickOnUndo() ) );
260   connect( Group4Spin->buttonRedo,   SIGNAL( clicked() ), this, SLOT( ClickOnRedo() ) );
261
262   connect( MainWidget->ButtonGroup, SIGNAL( buttonClicked( int ) ), this, SLOT( TypeClicked( int ) ) );
263   connect( ButtonGroup, SIGNAL( buttonClicked( int ) ), this, SLOT( DestClicked( int ) ) );
264   connect( GroupPt->ButtonGroup, SIGNAL( buttonClicked( int ) ), this, SLOT( PointClicked( int ) ) );
265   connect( GroupPt2->ButtonGroup, SIGNAL( buttonClicked( int ) ), this, SLOT( Point2Clicked( int ) ) );
266   connect( GroupD1->ButtonGroup, SIGNAL( buttonClicked( int ) ), this, SLOT( Dir1Clicked( int ) ) );
267   connect( GroupD2->ButtonGroup, SIGNAL( buttonClicked( int ) ), this, SLOT( Dir2Clicked( int ) ));
268
269   connect( Group1Sel->LineEdit1,   SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
270   connect( Group1Sel->PushButton1, SIGNAL( clicked() ),       this, SLOT( SetEditCurrentArgument() ) );
271
272   connect( Group2Sel->LineEdit1,   SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
273   connect( Group2Sel->LineEdit2,   SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
274   connect( Group2Sel->PushButton1, SIGNAL( clicked() ),       this, SLOT( SetEditCurrentArgument() ) );
275   connect( Group2Sel->PushButton2, SIGNAL( clicked() ),       this, SLOT( SetEditCurrentArgument() ) );
276
277   connect( Group1Sel1Spin->LineEdit1,   SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
278   connect( Group1Sel1Spin->PushButton1, SIGNAL( clicked() ),       this, SLOT( SetEditCurrentArgument() ) );
279   connect( Group1Sel1Spin->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
280
281   connect( Group1Spin->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
282   connect( Group2Spin->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
283   connect( Group2Spin->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
284   connect( Group3Spin->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
285   connect( Group3Spin->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
286   connect( Group3Spin->SpinBox_DZ, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
287   connect( Group4Spin->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
288   connect( Group4Spin->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
289   connect( Group4Spin->SpinBox_DZ, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
290   connect( Group4Spin->SpinBox_DS, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
291
292   connect( Group3Spin->checkBox, SIGNAL( stateChanged( int ) ), this, SLOT( CheckBoxClicked( int ) ) );
293   connect( Group4Spin->checkBox, SIGNAL( stateChanged( int ) ), this, SLOT( CheckBoxClicked( int ) ) );
294   connect( Group2Sel->checkBox, SIGNAL( stateChanged( int ) ), this, SLOT( CheckBoxClicked( int ) ) );
295   connect( Group1Sel1Spin->checkBox, SIGNAL( stateChanged( int ) ), this, SLOT( CheckBoxClicked( int ) ) );
296
297   connect( ComboBox1, SIGNAL( activated( int ) ), this, SLOT( SelectionIntoArgument() ) );
298   connect( planeButton, SIGNAL( clicked() ), this, SLOT( ActivateLocalCS() ) );
299
300   connect( myGeometryGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), this, SLOT( SetDoubleSpinBoxStep( double ) ) );
301
302   connect( myGeometryGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) );
303   connect( myGeometryGUI, SIGNAL( SignalCloseAllDialogs() ),        this, SLOT( ClickOnCancel() ) );
304   
305   // install event filter on spin-boxes to provide Apply action on Return pressed
306   Group1Spin->SpinBox_DX->installEventFilter(this);
307   Group1Sel1Spin->SpinBox_DX->installEventFilter(this);
308   Group2Spin->SpinBox_DX->installEventFilter(this);
309   Group2Spin->SpinBox_DY->installEventFilter(this);
310   Group3Spin->SpinBox_DX->installEventFilter(this);
311   Group3Spin->SpinBox_DY->installEventFilter(this);
312   Group3Spin->SpinBox_DZ->installEventFilter(this);
313   Group4Spin->SpinBox_DX->installEventFilter(this);
314   Group4Spin->SpinBox_DY->installEventFilter(this);
315   Group4Spin->SpinBox_DZ->installEventFilter(this);
316   Group4Spin->SpinBox_DS->installEventFilter(this);
317
318   Init();
319 }
320
321
322 //=================================================================================
323 // function : ~EntityGUI_SketcherDlg()
324 // purpose  : Destroys the object and frees any allocated resources
325 //=================================================================================
326 EntityGUI_SketcherDlg::~EntityGUI_SketcherDlg()
327 {
328   myGeometryGUI->SetActiveDialogBox( 0 );
329 }
330
331
332 //=================================================================================
333 // function : eventFilter()
334 // purpose  : event filter for spin-boxes to provide Apply action on Return pressed
335 //=================================================================================
336 bool EntityGUI_SketcherDlg::eventFilter (QObject* object, QEvent* event)
337 {
338   if (event->type() == QEvent::KeyPress) {
339     QKeyEvent* ke = (QKeyEvent*)event;
340     if (ke->key() == Qt::Key_Return) {
341       if (object == Group1Spin->SpinBox_DX) {
342         Group1Spin->buttonApply->animateClick();
343         return true;
344       } else if (object == Group1Sel1Spin->SpinBox_DX) {
345         Group1Sel1Spin->buttonApply->animateClick();
346         return true;
347       } else if (object == Group2Spin->SpinBox_DX ||
348                  object == Group2Spin->SpinBox_DY) {
349         Group2Spin->buttonApply->animateClick();
350         return true;
351       } else if (object == Group3Spin->SpinBox_DX ||
352                  object == Group3Spin->SpinBox_DY ||
353                  object == Group3Spin->SpinBox_DZ) {
354         Group3Spin->buttonApply->animateClick();
355         return true;
356       } else if (object == Group4Spin->SpinBox_DX ||
357                  object == Group4Spin->SpinBox_DY ||
358                  object == Group4Spin->SpinBox_DZ ||
359                  object == Group4Spin->SpinBox_DS) {
360         Group4Spin->buttonApply->animateClick();
361         return true;
362       }
363     }
364   }
365
366   // Fix of the NPAL16010 bug is removed, because it's not actual with the Qt-4.x
367
368   return QDialog::eventFilter(object, event);
369 }
370
371
372 //=================================================================================
373 // function : Init()
374 // purpose  :
375 //=================================================================================
376 void EntityGUI_SketcherDlg::Init()
377 {
378   /* init variables */
379   myEditCurrentArgument = Group1Sel->LineEdit1;
380   myCommand.append( "Sketcher" );
381   myUndoCommand.append( "Sketcher" );
382
383   mySketchState = FIRST_POINT;
384   globalSelection( GEOM_POINT );
385
386   myCheckFlag = 0;
387
388   myLastX1 = 0.0;
389   myLastY1 = 0.0;
390   myLastX2 = 0.0;
391   myLastY2 = 0.0;
392
393   myHelpFileName = "create_sketcher_page.html";
394
395   /* Get setting of step value from file configuration */
396   double step = SUIT_Session::session()->resourceMgr()->doubleValue( "Geometry", "SettingsGeomStep", 100.0 );
397
398   /* min, max, step and decimals for spin boxes */
399   initSpinBox( Group1Sel1Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" );
400   initSpinBox( Group1Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" );
401   initSpinBox( Group2Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" );
402   initSpinBox( Group2Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" );
403   initSpinBox( Group3Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" );
404   initSpinBox( Group3Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" );
405   initSpinBox( Group3Spin->SpinBox_DZ, COORD_MIN, COORD_MAX, step, "length_precision" );
406   initSpinBox( Group4Spin->SpinBox_DZ, COORD_MIN, COORD_MAX, step, "length_precision" );
407   // san: Note specific step values below!
408   initSpinBox( Group4Spin->SpinBox_DX, COORD_MIN, COORD_MAX, 0.1, "length_precision" );
409   initSpinBox( Group4Spin->SpinBox_DY, COORD_MIN, COORD_MAX, 0.1, "length_precision" );
410   initSpinBox( Group4Spin->SpinBox_DS, COORD_MIN, COORD_MAX, 5., "length_precision" );
411
412   /* displays Dialog */
413   MainWidget->GroupConstructors->setEnabled( false );
414   MainWidget->GroupDest1->setEnabled( false );
415   setEnabledUndo( false );
416   setEnabledRedo( false );
417
418   MainWidget->RadioButton1->setChecked( true );
419
420   TypeClicked( 0 );
421
422   FindLocalCS();
423   resize(100,100);
424
425   ActivateLocalCS();
426   GEOMBase_Helper::displayPreview( false, true, true, myLineWidth );
427 }
428
429
430 //=================================================================================
431 // function : InitClick()
432 // purpose  :
433 //=================================================================================
434 void EntityGUI_SketcherDlg::InitClick()
435 {
436   disconnect( myGeometryGUI->getApp()->selectionMgr(), 0, this, 0 );
437   myCheckFlag = 0;
438
439   Group1Sel->hide();
440   Group2Sel->hide();
441   Group1Sel1Spin->hide();
442   Group1Spin->hide();
443   Group2Spin->hide();
444   Group3Spin->hide();
445   Group4Spin->hide();
446 }
447
448
449 //=================================================================================
450 // function : TypeClicked()
451 // purpose  : Radio button management
452 //=================================================================================
453 void EntityGUI_SketcherDlg::TypeClicked( int constructorId )
454 {
455   myConstructorId = constructorId;
456   if ( myConstructorId == 0 ) {    // SEGMENT
457     GroupPt2->setEnabled( false );
458     GroupD2->setEnabled( true );
459     MainWidget->RB_Dest1->setEnabled( true );
460     MainWidget->RB_Dest1->setChecked( true );
461     DestClicked( 1 );
462   }
463   else if (  myConstructorId == 1 ) { // ARC
464     GroupPt2->setEnabled( true );
465     GroupD2->setEnabled( false );
466     MainWidget->RB_Dest1->setEnabled( true ); 
467     MainWidget->RB_Dest1->setChecked( true );
468     DestClicked( 1 );
469   }
470 }
471
472
473 //=================================================================================
474 // function : DestClicked()
475 // purpose  : Radio button management
476 //=================================================================================
477 void EntityGUI_SketcherDlg::DestClicked( int constructorId )
478 {
479   GroupPt->hide();
480   GroupPt2->hide();
481   GroupD1->hide();
482   GroupD2->hide();
483
484   if ( constructorId == 1 ) {
485     // Point
486     GroupPt->RB_Point1->setChecked( true );
487     GroupPt->show();
488     GroupPt2->show();
489     Group3Spin->checkBox->show();
490     Group4Spin->checkBox->show();
491     PointClicked( 1 );  // XY
492   }
493   else if (  constructorId == 0 ) {
494     // Direction
495     GroupD1->RB_Dir11->setChecked( true );
496     GroupD1->show();
497     GroupD2->show();
498     Group3Spin->checkBox->hide();
499     Group4Spin->checkBox->hide();
500     Dir1Clicked( 2 );  // Angle
501   }
502 }
503
504 //=================================================================================
505 // function : PointClicked()
506 // purpose  : Radio button management
507 //=================================================================================
508 void EntityGUI_SketcherDlg::PointClicked( int constructorId )
509 {
510   myConstructorPntId = constructorId;  
511   GroupPt2->RB_Point1->setChecked( true );
512   GroupPt->RB_Point3->setEnabled( true ); 
513   Point2Clicked( 1 );
514 }
515
516 //=================================================================================
517 // function : Point2Clicked()
518 // purpose  : Radio button management
519 //=================================================================================
520 void EntityGUI_SketcherDlg::Point2Clicked( int constructorId )
521 {
522   InitClick();
523
524   // Get setting of step value from file configuration
525   double step = SUIT_Session::session()->resourceMgr()->doubleValue( "Geometry", "SettingsGeomStep", 100.0 );
526
527   if ( myConstructorPntId == 1 ) {  // XY
528     if ( constructorId == 1 ){      // No additional parameter
529       mySketchType = PT_ABS;
530       initSpinBox( Group2Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" );
531       initSpinBox( Group2Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" );
532       Group2Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_X2" ) );
533       Group2Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_Y2" ) );
534       myX = 0.0;
535       Group2Spin->SpinBox_DX->setValue( myX );
536       myY = 0.0;
537       Group2Spin->SpinBox_DY->setValue( myY );
538       Group2Spin->show();
539       Group2Spin->buttonApply->setFocus();
540
541       GEOMBase_Helper::displayPreview( false, true, true, myLineWidth );
542     }
543     else if ( constructorId == 0 ){   // Point + radius
544       mySketchType = PT_ABS_RADIUS;
545       initSpinBox( Group3Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" ); 
546       initSpinBox( Group3Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" );
547       initSpinBox( Group3Spin->SpinBox_DZ, COORD_MIN, COORD_MAX, step/10.0, "length_precision" );
548       Group3Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_X2" ) );
549       Group3Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_Y2" ) );
550       Group3Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_RADIUS2" ) ); 
551       myDX = 0.0;
552       Group3Spin->SpinBox_DX->setValue( myDX );
553       myDY = 0.0;
554       Group3Spin->SpinBox_DY->setValue( myDY );
555       myRadius=0.0;
556       Group3Spin->SpinBox_DZ->setValue( myRadius ); 
557       Group3Spin->show();
558       Group3Spin->buttonApply->setFocus();
559
560       GEOMBase_Helper::displayPreview( false, true, true, myLineWidth );
561     }
562     else if ( constructorId == 2 ){   // Point + center
563       mySketchType = PT_ABS_CENTER;
564       initSpinBox( Group4Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" ); 
565       initSpinBox( Group4Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" );
566       initSpinBox( Group4Spin->SpinBox_DZ, COORD_MIN, COORD_MAX, step, "length_precision" );
567       initSpinBox( Group4Spin->SpinBox_DS, COORD_MIN, COORD_MAX, step, "length_precision" );
568       Group4Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_X2" ) );
569       Group4Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_Y2" ) );
570       Group4Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_CENTER_X" ) );
571       Group4Spin->TextLabel4->setText( tr( "GEOM_SKETCHER_CENTER_Y" ) ); 
572       myDX = 0.0;
573       Group4Spin->SpinBox_DX->setValue( myDX );
574       myDY = 0.0;
575       Group4Spin->SpinBox_DY->setValue( myDY );
576       myXc = 0.0;
577       Group4Spin->SpinBox_DZ->setValue( myXc ); 
578       myYc = 0.0;
579       Group4Spin->SpinBox_DS->setValue( myYc );
580       Group4Spin->show();
581       Group4Spin->buttonApply->setFocus();
582
583       GEOMBase_Helper::displayPreview( false, true, true, myLineWidth );
584     }
585
586   }
587   else if ( myConstructorPntId == 0 ) {  // DXDY
588     if ( constructorId == 1 ){    // No additional parameter
589       mySketchType = PT_RELATIVE;
590       initSpinBox( Group2Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" );
591       initSpinBox( Group2Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" );
592       Group2Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_DX2" ) );
593       Group2Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_DY2" ) );
594       myDX = 0.0;
595       Group2Spin->SpinBox_DX->setValue( myDX );
596       myDY = 0.0;
597       Group2Spin->SpinBox_DY->setValue( myDY );
598       Group2Spin->show();
599       Group2Spin->buttonApply->setFocus();
600
601       GEOMBase_Helper::displayPreview( false, true, true, myLineWidth );
602     }
603     else if ( constructorId == 0 ){   // Point + radius 
604       mySketchType = PT_REL_RADIUS;
605       initSpinBox( Group3Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" ); 
606       initSpinBox( Group3Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" );
607       initSpinBox( Group3Spin->SpinBox_DZ, COORD_MIN, COORD_MAX, step/10.0, "length_precision" );
608       Group3Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_DX2" ) );
609       Group3Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_DY2" ) );
610       Group3Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_RADIUS2" ) ); 
611       myDX = 10.0;
612       Group3Spin->SpinBox_DX->setValue( myDX );
613       myDY = 0.0;
614       Group3Spin->SpinBox_DY->setValue( myDY );
615       myRadius=5.0;
616       Group3Spin->SpinBox_DZ->setValue( myRadius );
617       Group3Spin->show();
618       Group3Spin->buttonApply->setFocus();
619
620       GEOMBase_Helper::displayPreview( false, true, true, myLineWidth );
621     }
622     else if ( constructorId == 2 ){   // Point + center
623       mySketchType = PT_REL_CENTER;
624       initSpinBox( Group4Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" ); 
625       initSpinBox( Group4Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" );
626       initSpinBox( Group4Spin->SpinBox_DZ, COORD_MIN, COORD_MAX, step, "length_precision" );
627       initSpinBox( Group4Spin->SpinBox_DS, COORD_MIN, COORD_MAX, step, "length_precision" );
628       Group4Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_DX2" ) );
629       Group4Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_DY2" ) );
630       Group4Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_CENTER_DX" ) );
631       Group4Spin->TextLabel4->setText( tr( "GEOM_SKETCHER_CENTER_DY" ) ); 
632       myDX = 0.0;
633       Group4Spin->SpinBox_DX->setValue( myDX );
634       myDY = 0.0;
635       Group4Spin->SpinBox_DY->setValue( myDY );
636       myDXc = 0.0;
637       Group4Spin->SpinBox_DZ->setValue( myDXc ); 
638       myDYc = 0.0;
639       Group4Spin->SpinBox_DS->setValue( myDYc );
640       Group4Spin->show();
641       Group4Spin->buttonApply->setFocus();
642
643       GEOMBase_Helper::displayPreview( false, true, true, myLineWidth );
644     }
645
646   }
647   else if ( myConstructorPntId == 2 ) {  // Selection
648     if ( constructorId == 1 ){    // No additional parameter
649       mySketchType = PT_SEL;
650       myEditCurrentArgument = Group1Sel->LineEdit1;
651       Group1Sel->TextLabel1->setText( tr( "GEOM_SKETCHER_END_POINT2" ) ); 
652       Group1Sel->show();
653       Group1Sel->buttonApply->setFocus();
654       SelectionIntoArgument();
655     }
656     else if ( constructorId == 0 ){   // Point + radius 
657       mySketchType = PT_SEL_RADIUS;
658       myEditCurrentArgument = Group1Sel1Spin->LineEdit1;
659       initSpinBox( Group1Sel1Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step/10.0, "length_precision" );
660       Group1Sel1Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_END_POINT2" ) ); 
661       Group1Sel1Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_RADIUS2" ) ); 
662       myRadius=0.0;
663       Group1Sel1Spin->SpinBox_DX->setValue( myRadius );
664
665       Group1Sel1Spin->show();
666       Group1Sel1Spin->buttonApply->setFocus();
667       SelectionIntoArgument();
668     }
669     else if ( constructorId == 2 ){   // Point + center 
670       mySketchType = PT_SEL_CENTER;
671       myEditCurrentArgument = Group2Sel->LineEdit1;
672       Group2Sel->TextLabel1->setText( tr( "GEOM_SKETCHER_END_POINT2" ) );  
673       Group2Sel->TextLabel2->setText( tr( "GEOM_SKETCHER_CENTER2" ) );
674       Group2Sel->LineEdit1->setEnabled(true);
675       Group2Sel->PushButton1->setDown(true);
676       Group2Sel->LineEdit2->setEnabled(false);
677       Group2Sel->PushButton2->setDown(false);
678       Group2Sel->show();
679       Group2Sel->buttonApply->setFocus();
680       SelectionIntoArgument();
681     }
682
683   }
684   connect( myGeometryGUI->getApp()->selectionMgr(),
685            SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
686   
687 }
688
689
690 //=================================================================================
691 // function : Dir1Clicked()
692 // purpose  : Radio button management
693 //=================================================================================
694 void EntityGUI_SketcherDlg::Dir1Clicked( int constructorId )
695 {
696   myConstructorDirId = constructorId;
697   GroupD2->RB_Dir21->setChecked( true );
698   Dir2Clicked( 2 );
699 }
700
701
702 //=================================================================================
703 // function : Dir2Clicked()
704 // purpose  : Radio button management
705 //=================================================================================
706 void EntityGUI_SketcherDlg::Dir2Clicked( int constructorId )
707 {
708   InitClick();
709   myAngle = 0.0;
710
711   // Get setting of step value from file configuration
712   double step = SUIT_Session::session()->resourceMgr()->doubleValue( "Geometry", "SettingsGeomStep", 100.0 );
713
714   if ( myConstructorId == 0 ) {  // SEGMENT
715     myX = 0.0;
716     myY = 0.0;
717     myLength = 100.0;
718     if ( myConstructorDirId == 2 ) {  // Angle
719       initSpinBox( Group2Spin->SpinBox_DX, COORD_MIN, COORD_MAX, 5., "length_precision" );
720       Group2Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_ANGLE2" ) );
721       Group2Spin->SpinBox_DX->setValue( myAngle );
722       Group2Spin->buttonApply->setFocus();
723       Group2Spin->show();
724
725       if ( constructorId == 2 ) {  // Length
726         mySketchType = DIR_ANGLE_LENGTH;
727         initSpinBox( Group2Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" );
728         Group2Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_LENGTH2" ) );
729         Group2Spin->SpinBox_DY->setValue( myLength );
730       }
731       else if ( constructorId == 0 ) {  // X
732         mySketchType = DIR_ANGLE_X;
733         initSpinBox( Group2Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, "angle_precision" );
734         Group2Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_X3" ) );
735         Group2Spin->SpinBox_DY->setValue( myX );
736       }
737       else if ( constructorId == 1 ) {  // Y
738         mySketchType = DIR_ANGLE_Y;
739         initSpinBox( Group2Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, "angle_precision" );        
740         Group2Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_Y3" ) );
741         Group2Spin->SpinBox_DY->setValue( myY );
742       }
743     }
744     else if ( myConstructorDirId == 0 ) {  // Perpendicular
745       Group1Spin->show();
746       Group1Spin->buttonApply->setFocus();
747
748       if ( constructorId == 2 ) {  // Length
749         mySketchType = DIR_PER_LENGTH;
750         Group1Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_LENGTH2" ) );
751         Group1Spin->SpinBox_DX->setValue( myLength );
752       }
753       else if ( constructorId == 0 ) {  // X
754         mySketchType = DIR_PER_X;
755         Group1Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_X3" ) );
756         Group1Spin->SpinBox_DX->setValue( myX );
757       }
758       else if ( constructorId == 1 ) {  // Y
759         mySketchType = DIR_PER_Y;
760         Group1Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_Y3" ) );
761         Group1Spin->SpinBox_DX->setValue( myY );
762       }
763     }
764     else if ( myConstructorDirId == 1 ) {  // Tangent
765       Group1Spin->show();
766       Group1Spin->buttonApply->setFocus();
767
768       if ( constructorId == 2 ) {  // Length
769         mySketchType = DIR_TAN_LENGTH;
770         Group1Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_LENGTH2" ) );
771         Group1Spin->SpinBox_DX->setValue( myLength );
772       }
773       else if ( constructorId == 0 ) {  // X
774         mySketchType = DIR_TAN_X;
775         Group1Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_X3" ) );
776         Group1Spin->SpinBox_DX->setValue( myX );
777       }
778       else if ( constructorId == 1 ) {  // Y
779         mySketchType = DIR_TAN_Y;
780         Group1Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_Y3" ) );
781         Group1Spin->SpinBox_DX->setValue( myY );
782       }
783     }
784     else if ( myConstructorDirId == 3 ) {  // DXDY
785       initSpinBox( Group3Spin->SpinBox_DX, COORD_MIN, COORD_MAX, 0.1, "length_precision" );
786       initSpinBox( Group3Spin->SpinBox_DY, COORD_MIN, COORD_MAX, 0.1, "length_precision" );
787       initSpinBox( Group3Spin->SpinBox_DZ, COORD_MIN, COORD_MAX, step, "length_precision" );
788       Group3Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_VX2" ) );
789       Group3Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_VY2" ) );
790       myDX = 0.0;
791       Group3Spin->SpinBox_DX->setValue( myDX );
792       myDY = 0.0;
793       Group3Spin->SpinBox_DY->setValue( myDY );
794       Group3Spin->show();
795       Group3Spin->buttonApply->setFocus();
796
797       if ( constructorId == 2 ) {  // Length
798         mySketchType = DIR_DXDY_LENGTH;
799         Group3Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_LENGTH2" ) );
800         Group3Spin->SpinBox_DZ->setValue( myLength );
801       }
802       else if ( constructorId == 0 ) { // X
803         mySketchType = DIR_DXDY_X;
804         Group3Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_X3" ) );
805         Group3Spin->SpinBox_DZ->setValue( myX );
806       }
807       else if ( constructorId == 1 ) {  // Y
808         mySketchType = DIR_DXDY_Y;
809         Group3Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_Y3" ) );
810         Group3Spin->SpinBox_DZ->setValue( myY );
811       }
812     }
813   }
814   else if ( myConstructorId == 1 ) {  // ARC
815     if ( myConstructorDirId == 2 ) {  // Angle
816       if ( constructorId == 2 ) {  // Length
817         mySketchType = DIR_ANGLE_LENGTH;
818         initSpinBox( Group3Spin->SpinBox_DX, COORD_MIN, COORD_MAX, 5., "angle_precision" );
819         initSpinBox( Group3Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" );
820         initSpinBox( Group3Spin->SpinBox_DZ, COORD_MIN, COORD_MAX, 5., "angle_precision" );
821         Group3Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_ANGLE2" ) );
822         Group3Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_RADIUS2" ) );
823         Group3Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_ANGLE2" ));
824         Group3Spin->SpinBox_DX->setValue( myAngle );
825         myRadius = 100.0;
826         Group3Spin->SpinBox_DY->setValue( myRadius );
827         myLength = 30.0;
828         Group3Spin->SpinBox_DZ->setValue( myLength );
829         Group3Spin->show();
830         Group3Spin->buttonApply->setFocus();
831       }
832     }
833     else if ( myConstructorDirId == 0 ) {  // Perpendicular
834       if ( constructorId == 2 ) {  // Length
835         mySketchType = DIR_PER_LENGTH;
836         initSpinBox( Group2Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" );
837         initSpinBox( Group2Spin->SpinBox_DY, COORD_MIN, COORD_MAX, 5., "angle_precision" );
838         Group2Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_RADIUS2" ) );
839         Group2Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_ANGLE2" ) );
840         myRadius = 100.0;
841         Group2Spin->SpinBox_DX->setValue( myRadius );
842         myLength = 30.0;
843         Group2Spin->SpinBox_DY->setValue( myLength );
844         Group2Spin->show();
845         Group2Spin->buttonApply->setFocus();
846       }
847     }
848     else if ( myConstructorDirId == 1 ) {  // Tangent
849       if ( constructorId == 2 ) {  // Length
850         mySketchType = DIR_TAN_LENGTH;
851         initSpinBox( Group2Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" );
852         initSpinBox( Group2Spin->SpinBox_DY, COORD_MIN, COORD_MAX, 5., "angle_precision" );
853         Group2Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_RADIUS2" ) );
854         Group2Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_ANGLE2" ) );
855         myRadius = 100.0;
856         Group2Spin->SpinBox_DX->setValue( myRadius );
857         myLength = 30.0;
858         Group2Spin->SpinBox_DY->setValue( myLength );
859         Group2Spin->show();
860         Group2Spin->buttonApply->setFocus();
861       }
862     }
863     else if ( myConstructorDirId == 3 ) {  // DXDY
864       if ( constructorId == 2 ) {  // Length
865         mySketchType = DIR_DXDY_LENGTH;
866         Group4Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_VX2" ) );
867         Group4Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_VY2" ) );
868         Group4Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_RADIUS2" ) );
869         Group4Spin->TextLabel4->setText( tr( "GEOM_SKETCHER_ANGLE2" ) );
870         initSpinBox( Group4Spin->SpinBox_DZ, COORD_MIN, COORD_MAX, step, "length_precision" );
871         initSpinBox( Group4Spin->SpinBox_DX, COORD_MIN, COORD_MAX, 0.1, "length_precision" );
872         initSpinBox( Group4Spin->SpinBox_DY, COORD_MIN, COORD_MAX, 0.1, "length_precision" );
873         initSpinBox( Group4Spin->SpinBox_DS, COORD_MIN, COORD_MAX, 5., "length_precision" );
874         myDX = 0.0;
875         Group4Spin->SpinBox_DX->setValue( myDX );
876         myDY = 0.0;
877         Group4Spin->SpinBox_DY->setValue( myDY );
878         myRadius = 100.0;
879         Group4Spin->SpinBox_DZ->setValue( myRadius );
880         myLength = 30.0;
881         Group4Spin->SpinBox_DS->setValue( myLength );
882         Group4Spin->show();
883         Group4Spin->buttonApply->setFocus();
884       }
885     }
886   }
887
888   GEOMBase_Helper::displayPreview( false, true, true, myLineWidth );
889 }
890
891 //=================================================================================
892 // function : CheckBoxClicked()
893 // purpose  : CheckBox  management
894 //=================================================================================
895 void EntityGUI_SketcherDlg::CheckBoxClicked(int State)
896 {
897   myCheckFlag = State;
898
899   GEOMBase_Helper::displayPreview( false, true, true, myLineWidth );
900 }
901
902
903 //=================================================================================
904 // function : ClickOnCancel()
905 // purpose  :
906 //=================================================================================
907 void EntityGUI_SketcherDlg::ClickOnCancel()
908 {
909   close();
910 }
911
912
913 //=================================================================================
914 // function : ClickOnEnd()
915 // purpose  : connected to buttonEnd AND buttonClose
916 //=================================================================================
917 void EntityGUI_SketcherDlg::ClickOnEnd()
918 {
919   if ( sender() == MainWidget->buttonClose ) {
920     // Verify validity of commands
921     if ( myCommand.count() <= 2 ) {
922       SUIT_MessageBox::critical( SUIT_Session::session()->activeApplication()->desktop(),
923                                  tr( "GEOM_ERROR_STATUS" ), tr( "CANNOT_CLOSE" ), tr( "BUT_OK" ) );
924       return;
925     }
926
927     QString Parameters;
928     QString Command = myCommand.join( "" ) + GetNewCommand( Parameters );
929     Sketcher_Profile aProfile( Command.toAscii() );
930
931     Command = myCommand.join( "" );
932     aProfile = Sketcher_Profile( Command.toAscii() );
933     TopoDS_Shape myShape;
934     if ( aProfile.IsDone() )
935       myShape = aProfile.GetShape();
936
937     if ( myShape.ShapeType() != TopAbs_VERTEX )
938       myCommand.append( ":WW" );
939   }
940   else {
941     // PAL16008 (Sketcher Validation should be equal to Apply&Close)
942     if ( Group1Spin->buttonApply->isEnabled() && Group1Spin->isVisible() ||
943          Group2Spin->buttonApply->isEnabled() && Group2Spin->isVisible() ||
944          Group3Spin->buttonApply->isEnabled() && Group3Spin->isVisible() ||
945          Group4Spin->buttonApply->isEnabled() && Group4Spin->isVisible() ||
946          Group1Sel->buttonApply->isEnabled() && Group1Sel->isVisible()  ||
947          Group2Sel->buttonApply->isEnabled() && Group2Sel->isVisible()  ||
948          Group1Sel1Spin->buttonApply->isEnabled() && Group1Sel1Spin->isVisible() )  {     
949       ClickOnApply();
950     }
951     myIsAllAdded = true;
952   }
953
954   if ( myCommand.size() > 2 )
955     if ( !onAccept() )
956       return;
957
958   close();
959 }
960
961 //=================================================================================
962 // function : ClickOnApply()
963 // purpose  :
964 //=================================================================================
965 bool EntityGUI_SketcherDlg::ClickOnApply()
966 {
967   if ( sender() && sender()->inherits( "QPushButton" ) )
968     ( (QPushButton*)sender() )->setFocus(); // to update value of currently edited spin-box (PAL11948)
969
970   QString aParameters;
971   myCommand.append( GetNewCommand( aParameters ) );
972   mySketchState = NEXT_POINT;
973
974   myUndoCommand.clear();
975   myUndoCommand.append( "Sketcher" );
976
977   myParameters.append( aParameters );
978   myUndoParameters.clear();
979
980   MainWidget->GroupConstructors->setEnabled( true );
981   MainWidget->GroupDest1->setEnabled( true );
982   setEnabledUndo( true );
983   setEnabledRedo( false );
984
985   myIsApply = true;
986   GEOMBase_Helper::displayPreview( false, true, true, myLineWidth );
987   myIsApply = false;
988
989   // Set focus to SpinBox_DX
990   if ( sender() == Group1Spin->buttonApply ) {
991     (Group1Spin->SpinBox_DX)->setFocus();
992     (Group1Spin->SpinBox_DX)->selectAll();
993   }
994   else if ( sender() == Group1Sel1Spin->buttonApply ) {
995     (Group1Sel1Spin->SpinBox_DX)->setFocus();
996     (Group1Sel1Spin->SpinBox_DX)->selectAll();
997   }
998   else if ( sender() == Group2Spin->buttonApply ) {
999     (Group2Spin->SpinBox_DX)->setFocus();
1000     (Group2Spin->SpinBox_DX)->selectAll();
1001   }
1002   else if ( sender() == Group3Spin->buttonApply ) {
1003     (Group3Spin->SpinBox_DX)->setFocus();
1004     (Group3Spin->SpinBox_DX)->selectAll();
1005   }
1006   else if ( sender() == Group4Spin->buttonApply ) {
1007     (Group4Spin->SpinBox_DX)->setFocus();
1008     (Group4Spin->SpinBox_DX)->selectAll();
1009   }
1010
1011   return true;
1012 }
1013
1014 //=================================================================================
1015 // function : ClickOnHelp()
1016 // purpose  :
1017 //=================================================================================
1018 void EntityGUI_SketcherDlg::ClickOnHelp()
1019 {
1020   LightApp_Application* app = (LightApp_Application*)( SUIT_Session::session()->activeApplication() );
1021   if ( app )
1022     app->onHelpContextModule( myGeometryGUI ? app->moduleName( myGeometryGUI->moduleName() ) : QString( "" ), myHelpFileName );
1023   else {
1024     QString platform;
1025 #ifdef WIN32
1026     platform = "winapplication";
1027 #else
1028     platform = "application";
1029 #endif
1030
1031     SUIT_MessageBox::warning( 0, QObject::tr( "WRN_WARNING" ),
1032                               QObject::tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" ).
1033                               arg( app->resourceMgr()->stringValue( "ExternalBrowser", platform ) ).arg( myHelpFileName ),
1034                               QObject::tr( "BUT_OK" ) );
1035   }
1036 }
1037
1038 //=================================================================================
1039 // function : ClickOnUndo()
1040 // purpose  :
1041 //=================================================================================
1042 void EntityGUI_SketcherDlg::ClickOnUndo()
1043 {
1044   myUndoCommand.append( myCommand.last() );
1045   myCommand.pop_back();
1046
1047   myUndoParameters.append( myParameters.last() );
1048   myParameters.pop_back();
1049
1050   if ( myCommand.count() == 1 ) {
1051     mySketchState = FIRST_POINT;
1052
1053     MainWidget->RadioButton1->setChecked( true );
1054     TypeClicked( 0 );
1055
1056     connect( myGeometryGUI->getApp()->selectionMgr(),
1057              SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
1058
1059     MainWidget->GroupConstructors->setEnabled( false );
1060     MainWidget->GroupDest1->setEnabled( false );
1061     setEnabledUndo( false );
1062   }
1063
1064   setEnabledRedo( true );
1065
1066   GEOMBase_Helper::displayPreview( false, true, true, myLineWidth );
1067 }
1068
1069 //=================================================================================
1070 // function : ClickOnRedo()
1071 // purpose  :
1072 //=================================================================================
1073 void EntityGUI_SketcherDlg::ClickOnRedo()
1074 {
1075   myCommand.append( myUndoCommand.last() );
1076   myUndoCommand.pop_back();
1077
1078   myParameters.append( myUndoParameters.last() );
1079   myUndoParameters.pop_back();
1080
1081   mySketchState = NEXT_POINT;
1082
1083   MainWidget->GroupConstructors->setEnabled( true );
1084   MainWidget->GroupDest1->setEnabled( true );
1085   setEnabledUndo( true );
1086
1087   if ( myUndoCommand.count() == 1 )
1088     setEnabledRedo( false );
1089
1090   GEOMBase_Helper::displayPreview( false, true, true, myLineWidth );
1091 }
1092
1093 //=================================================================================
1094 // function : setEnabledUndo()
1095 // purpose  :
1096 //=================================================================================
1097 void EntityGUI_SketcherDlg::setEnabledUndo( bool value )
1098 {
1099   Group1Sel->buttonUndo->setEnabled( value );
1100   Group2Sel->buttonUndo->setEnabled( value );
1101   Group1Sel1Spin->buttonUndo->setEnabled( value );
1102   Group1Spin->buttonUndo->setEnabled( value );
1103   Group2Spin->buttonUndo->setEnabled( value );
1104   Group3Spin->buttonUndo->setEnabled( value );
1105   Group4Spin->buttonUndo->setEnabled( value );
1106 }
1107
1108 //=================================================================================
1109 // function : setEnabledRedo()
1110 // purpose  :
1111 //=================================================================================
1112 void EntityGUI_SketcherDlg::setEnabledRedo( bool value )
1113 {
1114   Group1Sel->buttonRedo->setEnabled( value );
1115   Group2Sel->buttonRedo->setEnabled( value );
1116   Group1Sel1Spin->buttonRedo->setEnabled( value );
1117   Group1Spin->buttonRedo->setEnabled( value );
1118   Group2Spin->buttonRedo->setEnabled( value );
1119   Group3Spin->buttonRedo->setEnabled( value );
1120   Group4Spin->buttonRedo->setEnabled( value );
1121 }
1122
1123 //=================================================================================
1124 // function : SelectionIntoArgument()
1125 // purpose  : Called when selection as changed
1126 //=================================================================================
1127 void EntityGUI_SketcherDlg::SelectionIntoArgument()
1128 {
1129   myEditCurrentArgument->setText( "" );
1130   double tmpX = myX;
1131   double tmpY = myY;
1132   myX = myLastX1;
1133   myY = myLastY1;
1134   //  printf ("\nmyX = %f         myY = %f", myX, myY);
1135   //  printf ("\nmyLastX1 = %f    myLastY1 = %f", myLastX1, myLastY1);
1136   //  printf ("\nmyLastX2 = %f    myLastY2 = %f", myLastX2, myLastY2);
1137
1138   if ( sender() == ComboBox1 )
1139       ActivateLocalCS();
1140
1141   LightApp_SelectionMgr* aSelMgr = myGeometryGUI->getApp()->selectionMgr();
1142   SALOME_ListIO aSelList;
1143   aSelMgr->selectedObjects(aSelList);
1144
1145   int nbSel = aSelList.Extent();
1146   if (nbSel == 1 && myEditCurrentArgument == Group1Sel->LineEdit1) {
1147     GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
1148     if ( !CORBA::is_nil(aSelectedObject) ) {
1149       TopoDS_Shape aShape;
1150       if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_VERTEX)) {
1151         gp_Trsf aTrans;
1152         gp_Ax3 aWPlane = GetActiveLocalCS();
1153
1154         aTrans.SetTransformation(aWPlane);
1155         BRepBuilderAPI_Transform aTransformation (aShape, aTrans, Standard_False);
1156         aShape = aTransformation.Shape();
1157
1158         gp_Pnt aPnt;
1159         if ( GEOMBase::VertexToPoint( aShape, aPnt ) ) {
1160           myX = aPnt.X();
1161           myY = aPnt.Y();
1162           Group1Sel->LineEdit1->setText( GEOMBase::GetName( aSelectedObject ) );
1163           if( Group2Spin->isVisible() && mySketchType == PT_ABS ) {
1164             disconnect( Group2Spin->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
1165             disconnect( Group2Spin->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
1166             Group2Spin->SpinBox_DX->setValue(myX);
1167             Group2Spin->SpinBox_DY->setValue(myY);
1168             connect( Group2Spin->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
1169             connect( Group2Spin->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
1170           } else if ( Group2Spin->isVisible() && mySketchType == PT_RELATIVE ) {
1171             if ( myLastX1 && myLastY1 ) {
1172               Group2Spin->SpinBox_DX->setValue(myX - myLastX1);
1173               Group2Spin->SpinBox_DY->setValue(myY - myLastY1);
1174             } else {
1175               if ( mySketchState != FIRST_POINT ) {
1176                 Group2Spin->SpinBox_DX->setValue(myX - tmpX);
1177                 Group2Spin->SpinBox_DY->setValue(myY - tmpY);
1178               } else {
1179                 Group2Spin->SpinBox_DX->setValue(myX);
1180                 Group2Spin->SpinBox_DY->setValue(myY);
1181               }
1182             }
1183           }
1184         }
1185       }
1186     }
1187   }
1188
1189   if (nbSel == 1 && myEditCurrentArgument == Group1Sel1Spin->LineEdit1) {
1190     GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
1191     if ( !CORBA::is_nil(aSelectedObject) ) {
1192       TopoDS_Shape aShape;
1193       if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_VERTEX)) {
1194         gp_Trsf aTrans;
1195         gp_Ax3 aWPlane = GetActiveLocalCS();
1196
1197         aTrans.SetTransformation(aWPlane);
1198         BRepBuilderAPI_Transform aTransformation (aShape, aTrans, Standard_False);
1199         aShape = aTransformation.Shape();
1200
1201         gp_Pnt aPnt;
1202         if ( GEOMBase::VertexToPoint( aShape, aPnt ) ) {
1203           myX = aPnt.X();
1204           myY = aPnt.Y();
1205           Group1Sel1Spin->LineEdit1->setText( GEOMBase::GetName( aSelectedObject ) );
1206           if( Group3Spin->isVisible() && mySketchType == PT_ABS ) {
1207             disconnect( Group3Spin->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
1208             disconnect( Group3Spin->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
1209             Group3Spin->SpinBox_DX->setValue(myX);
1210             Group3Spin->SpinBox_DY->setValue(myY);
1211             connect( Group3Spin->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
1212             connect( Group3Spin->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
1213           } else if ( Group3Spin->isVisible() && mySketchType == PT_RELATIVE ) {
1214             if ( myLastX1 && myLastY1 ) {
1215               Group3Spin->SpinBox_DX->setValue(myX - myLastX1);
1216               Group3Spin->SpinBox_DY->setValue(myY - myLastY1);
1217             } else {
1218               if ( mySketchState != FIRST_POINT ) {
1219                 Group3Spin->SpinBox_DX->setValue(myX - tmpX);
1220                 Group3Spin->SpinBox_DY->setValue(myY - tmpY);
1221               } else {
1222                 Group3Spin->SpinBox_DX->setValue(myX);
1223                 Group3Spin->SpinBox_DY->setValue(myY);
1224               }
1225             }
1226           }
1227         }
1228       }
1229     }
1230   }
1231
1232   if (nbSel == 1 && myEditCurrentArgument == Group2Sel->LineEdit1) {
1233     GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
1234     if ( !CORBA::is_nil(aSelectedObject) ) {
1235       TopoDS_Shape aShape;
1236       if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_VERTEX)) {
1237         gp_Trsf aTrans;
1238         gp_Ax3 aWPlane = GetActiveLocalCS();
1239
1240         aTrans.SetTransformation(aWPlane);
1241         BRepBuilderAPI_Transform aTransformation (aShape, aTrans, Standard_False);
1242         aShape = aTransformation.Shape();
1243
1244         gp_Pnt aPnt;
1245         if ( GEOMBase::VertexToPoint( aShape, aPnt ) ) {
1246           myX = aPnt.X();
1247           myY = aPnt.Y();
1248           Group2Sel->LineEdit1->setText( GEOMBase::GetName( aSelectedObject ) );
1249           if( Group4Spin->isVisible() && mySketchType == PT_ABS ) {
1250             disconnect( Group4Spin->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
1251             disconnect( Group4Spin->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
1252             Group4Spin->SpinBox_DX->setValue(myX);
1253             Group4Spin->SpinBox_DY->setValue(myY);
1254             connect( Group4Spin->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
1255             connect( Group4Spin->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
1256           } else if ( Group4Spin->isVisible() && mySketchType == PT_RELATIVE ) {
1257             if ( myLastX1 && myLastY1 ) {
1258               Group4Spin->SpinBox_DX->setValue(myX - myLastX1);
1259               Group4Spin->SpinBox_DY->setValue(myY - myLastY1);
1260             } else {
1261               if ( mySketchState != FIRST_POINT ) {
1262                 Group4Spin->SpinBox_DX->setValue(myX - tmpX);
1263                 Group4Spin->SpinBox_DY->setValue(myY - tmpY);
1264               } else {
1265                 Group4Spin->SpinBox_DX->setValue(myX);
1266                 Group4Spin->SpinBox_DY->setValue(myY);
1267               }
1268             }
1269           }
1270         }
1271       }
1272     }
1273   }
1274
1275   if (nbSel == 1 && myEditCurrentArgument == Group2Sel->LineEdit2) {
1276     if (!Group2Sel->LineEdit1->text().isEmpty()){    //Check wether or not Linedit2 has been modified
1277       myX=tmpX;                                      // If yes keep the old values of X and Y  
1278       myY=tmpY;
1279     }
1280     GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
1281     if ( !CORBA::is_nil(aSelectedObject) ) {
1282       TopoDS_Shape aShape;
1283       if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_VERTEX)) {
1284         gp_Trsf aTrans;
1285         gp_Ax3 aWPlane = GetActiveLocalCS();
1286
1287         aTrans.SetTransformation(aWPlane);
1288         BRepBuilderAPI_Transform aTransformation (aShape, aTrans, Standard_False);
1289         aShape = aTransformation.Shape();
1290
1291         gp_Pnt aPnt;
1292         if ( GEOMBase::VertexToPoint( aShape, aPnt ) ) {
1293           myXc = aPnt.X();
1294           myYc = aPnt.Y();
1295           Group2Sel->LineEdit2->setText( GEOMBase::GetName( aSelectedObject ) );
1296           if( Group4Spin->isVisible() && mySketchType == PT_ABS ) {
1297             disconnect( Group4Spin->SpinBox_DZ, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
1298             disconnect( Group4Spin->SpinBox_DS, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
1299             Group4Spin->SpinBox_DZ->setValue(myXc);
1300             Group4Spin->SpinBox_DS->setValue(myYc);
1301             connect( Group4Spin->SpinBox_DZ, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
1302             connect( Group4Spin->SpinBox_DS, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
1303           } else if ( Group4Spin->isVisible() && mySketchType == PT_RELATIVE ) {
1304             if ( myLastX1 && myLastY1 ) {
1305               Group4Spin->SpinBox_DZ->setValue(myXc - myLastX1);
1306               Group4Spin->SpinBox_DS->setValue(myYc - myLastY1);
1307             } else {
1308               if ( mySketchState != FIRST_POINT ) {
1309                 Group4Spin->SpinBox_DZ->setValue(myXc - tmpX);
1310                 Group4Spin->SpinBox_DS->setValue(myYc - tmpY);
1311               } else {
1312                 Group4Spin->SpinBox_DZ->setValue(myXc);
1313                 Group4Spin->SpinBox_DS->setValue(myYc);
1314               }
1315             }
1316           }
1317         }
1318       }
1319     }
1320   }
1321
1322
1323
1324   GEOMBase_Helper::displayPreview( false, true, true, myLineWidth );
1325 }
1326
1327
1328 //=================================================================================
1329 // function : SetEditCurrentArgument()
1330 // purpose  :
1331 //=================================================================================
1332 void EntityGUI_SketcherDlg::SetEditCurrentArgument()
1333 {
1334   if ( sender() == Group1Sel->PushButton1 ) {
1335     myEditCurrentArgument = Group1Sel->LineEdit1;
1336     myEditCurrentArgument->setFocus();
1337   }
1338   else if ( sender() == Group1Sel1Spin->PushButton1 ) {
1339     myEditCurrentArgument = Group1Sel1Spin->LineEdit1;
1340     myEditCurrentArgument->setFocus();
1341   }
1342   else if ( sender() == Group2Sel->PushButton1 ) {
1343     myEditCurrentArgument = Group2Sel->LineEdit1;
1344     Group2Sel->PushButton2->setDown(false);
1345     Group2Sel->PushButton1->setDown(true);
1346     Group2Sel->LineEdit2->setEnabled(false);
1347     Group2Sel->LineEdit1->setEnabled(true);
1348    // myEditCurrentArgument->setFocus();
1349   }
1350    else if ( sender() == Group2Sel->PushButton2 ) {
1351     myEditCurrentArgument = Group2Sel->LineEdit2;
1352     Group2Sel->PushButton1->setDown(false);
1353     Group2Sel->PushButton2->setDown(true);
1354     Group2Sel->LineEdit1->setEnabled(false);
1355     Group2Sel->LineEdit2->setEnabled(true);
1356    // myEditCurrentArgument->setFocus();
1357   }
1358   SelectionIntoArgument();
1359 }
1360
1361
1362 //=================================================================================
1363 // function : LineEditReturnPressed()
1364 // purpose  :
1365 //=================================================================================
1366 void EntityGUI_SketcherDlg::LineEditReturnPressed()
1367 {
1368   if ( sender() == Group1Sel->LineEdit1 ) 
1369     myEditCurrentArgument = Group1Sel->LineEdit1;
1370   else if ( sender() == Group1Sel1Spin->LineEdit1 ) 
1371      myEditCurrentArgument = Group1Sel1Spin->LineEdit1;
1372   else if ( sender() == Group2Sel->LineEdit1 ) 
1373      myEditCurrentArgument = Group2Sel->LineEdit1;
1374   else if ( sender() == Group2Sel->LineEdit2 )
1375      myEditCurrentArgument = Group2Sel->LineEdit2;
1376
1377   /* User name of object input management                          */
1378   /* If successfull the selection is changed and signal emitted... */
1379   /* so SelectionIntoArgument() is automatically called.           */
1380   const QString objectUserName = myEditCurrentArgument->text();
1381   QWidget* thisWidget = (QWidget*)this;
1382
1383   LightApp_SelectionMgr* aSelMgr = myGeometryGUI->getApp()->selectionMgr();
1384   SALOME_ListIO aSelList;
1385   aSelMgr->selectedObjects(aSelList);
1386
1387   if (GEOMBase::SelectionByNameInDialogs(thisWidget, objectUserName, aSelList))
1388     myEditCurrentArgument->setText( objectUserName );
1389 }
1390
1391
1392 //=================================================================================
1393 // function : DeactivateActiveDialog()
1394 // purpose  :
1395 //=================================================================================
1396 void EntityGUI_SketcherDlg::DeactivateActiveDialog()
1397 {
1398   //myGeometryGUI->SetState( -1 );
1399
1400   setEnabled( false );
1401   globalSelection();
1402   disconnect( myGeometryGUI->getApp()->selectionMgr(), 0, this, 0 );
1403   myGeometryGUI->SetActiveDialogBox( 0 );
1404 }
1405
1406
1407 //=================================================================================
1408 // function : ActivateThisDialog()
1409 // purpose  :
1410 //=================================================================================
1411 void EntityGUI_SketcherDlg::ActivateThisDialog()
1412 {
1413   myGeometryGUI->EmitSignalDeactivateDialog();
1414   setEnabled( true );
1415   myGeometryGUI->SetActiveDialogBox( this );
1416
1417   connect( myGeometryGUI->getApp()->selectionMgr(),
1418           SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
1419
1420   //myGeometryGUI->SetState( 0 );
1421   globalSelection( GEOM_POINT );
1422   
1423   myEditCurrentArgument = Group1Sel->LineEdit1;
1424   myEditCurrentArgument->setFocus();
1425   
1426    if ( sender() == Group1Sel->LineEdit1 ) {
1427      myEditCurrentArgument = Group1Sel->LineEdit1;
1428      myEditCurrentArgument->setFocus();
1429    }
1430    else if ( sender() == Group1Sel1Spin->LineEdit1 ) {
1431      myEditCurrentArgument = Group1Sel1Spin->LineEdit1;
1432      myEditCurrentArgument->setFocus();
1433    }
1434    else if ( sender() == Group2Sel->LineEdit1 ) {
1435      myEditCurrentArgument = Group2Sel->LineEdit1;
1436      myEditCurrentArgument->setFocus();
1437    }
1438     else if ( sender() == Group2Sel->LineEdit2 ) {
1439      myEditCurrentArgument = Group2Sel->LineEdit2;
1440      myEditCurrentArgument->setFocus();
1441    }
1442
1443   GEOMBase_Helper::displayPreview( false, true, true, myLineWidth );
1444 }
1445
1446
1447 //=================================================================================
1448 // function : enterEvent [REDEFINED]
1449 // purpose  :
1450 //=================================================================================
1451 void EntityGUI_SketcherDlg::enterEvent( QEvent* )
1452 {
1453   if ( !isEnabled() )
1454     ActivateThisDialog();
1455 }
1456
1457
1458 //=================================================================================
1459 // function : closeEvent()
1460 // purpose  :
1461 //=================================================================================
1462 void EntityGUI_SketcherDlg::closeEvent( QCloseEvent* e )
1463 {
1464   //myGeometryGUI->SetState( -1 );
1465   disconnect( myGeometryGUI->getApp()->selectionMgr(), 0, this, 0 );
1466   myGeometryGUI->getApp()->updateActions();
1467   QDialog::closeEvent( e );
1468 }
1469
1470
1471 //=================================================================================
1472 // function : ValueChangedInSpinBox()
1473 // purpose  :
1474 //=================================================================================
1475 void EntityGUI_SketcherDlg::ValueChangedInSpinBox( double newValue )
1476 {
1477   QObject* send = (QObject*)sender();
1478   Standard_Real vx, vy, vz, vs, minRad;
1479   vx = vy = vz = vs = minRad =0.0;
1480
1481   SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
1482   int aPrecision = resMgr->integerValue( "Geometry", "length_precision", 6 );
1483   double LastDecimal = 0.0;
1484
1485   QString vxStr, vyStr, vzStr, vsStr;
1486
1487   QString newValueStr;
1488   if( SalomeApp_DoubleSpinBox* aDoubleSpinBox = (SalomeApp_DoubleSpinBox*)send )
1489     newValueStr = aDoubleSpinBox->text();
1490
1491   if ( send == Group1Spin->SpinBox_DX ) {
1492     vx = newValue;                        vxStr = newValueStr;
1493   }
1494   else if ( send == Group1Sel1Spin->SpinBox_DX ) {
1495     vx = newValue;                        vxStr = newValueStr;
1496   }
1497   else if ( send == Group2Spin->SpinBox_DX ) {
1498     vx = newValue;                        vxStr = newValueStr;
1499     vy = Group2Spin->SpinBox_DY->value(); vyStr = Group2Spin->SpinBox_DY->text();
1500   }
1501   else if ( send == Group2Spin->SpinBox_DY ) {
1502     vx = Group2Spin->SpinBox_DX->value(); vxStr = Group2Spin->SpinBox_DX->text();
1503     vy = newValue;                        vyStr = newValueStr;
1504   }
1505   else if ( send == Group3Spin->SpinBox_DX ) {
1506     vx = newValue;                        vxStr = newValueStr;
1507     vy = Group3Spin->SpinBox_DY->value(); vyStr = Group3Spin->SpinBox_DY->text();
1508     vz = Group3Spin->SpinBox_DZ->value();
1509     if ( (mySketchType == PT_REL_RADIUS || mySketchType == PT_ABS_RADIUS) && (vx != 0 || vy != 0) ) {  
1510       minRad = 0.5 * Sqrt(vx * vx + vy * vy);                             //Computation of the minimum acceptable radius for the arc calculation
1511       if (aPrecision >= 0)    // 'f' format in the QString             
1512         LastDecimal = aPrecision;
1513       else                    // 'g' format in the Qstring
1514         LastDecimal = qAbs( aPrecision ) - ceil( log10(minRad) ); 
1515       minRad = ceil(pow(10,LastDecimal) * minRad) / pow(10,LastDecimal);  // Rounded up at the last allowed decimal place
1516       if ( Abs(vz) < minRad){
1517         if (vz < 0.0)
1518           Group3Spin->SpinBox_DZ->setValue( - minRad );
1519         else 
1520            Group3Spin->SpinBox_DZ->setValue( minRad );
1521       }
1522     }
1523     vz = Group3Spin->SpinBox_DZ->value(); vzStr = Group3Spin->SpinBox_DZ->text();
1524   }
1525   else if ( send == Group3Spin->SpinBox_DY ) {
1526     vx = Group3Spin->SpinBox_DX->value(); vxStr = Group3Spin->SpinBox_DX->text();
1527     vy = newValue;                        vyStr = newValueStr;
1528     vz = Group3Spin->SpinBox_DZ->value(); vzStr = Group3Spin->SpinBox_DZ->text();
1529     if ( (mySketchType == PT_REL_RADIUS || mySketchType == PT_ABS_RADIUS) && (vx != 0 || vy != 0)){  
1530       minRad = 0.5 * Sqrt(vx * vx + vy * vy);                            //Computation of the minimum acceptable radius for the arc calculation
1531       if (aPrecision >= 0)    // 'f' format in the QString 
1532         LastDecimal = aPrecision;
1533       else                    // 'g' format in the QString 
1534         LastDecimal = qAbs( aPrecision ) - ceil( log10(minRad) ); 
1535       minRad = ceil(pow(10,LastDecimal) * minRad) / pow(10,LastDecimal); // Rounded up at the last allowed decimal place
1536       if ( Abs(vz) < minRad){
1537         if (vz < 0.0)
1538           Group3Spin->SpinBox_DZ->setValue( - minRad );
1539         else 
1540            Group3Spin->SpinBox_DZ->setValue( minRad );
1541       }
1542     }
1543     vz = Group3Spin->SpinBox_DZ->value(); vzStr = Group3Spin->SpinBox_DZ->text();
1544   }
1545   else if ( send == Group3Spin->SpinBox_DZ ) {
1546     vx = Group3Spin->SpinBox_DX->value(); vxStr = Group3Spin->SpinBox_DX->text();
1547     vy = Group3Spin->SpinBox_DY->value(); vyStr = Group3Spin->SpinBox_DY->text();
1548     vz = newValue;                        vzStr = newValueStr;
1549   }
1550   else if ( send == Group4Spin->SpinBox_DX ) {
1551     vx = newValue;                        vxStr = newValueStr;
1552     vy = Group4Spin->SpinBox_DY->value(); vyStr = Group4Spin->SpinBox_DY->text();
1553     vz = Group4Spin->SpinBox_DZ->value(); vzStr = Group4Spin->SpinBox_DZ->text();
1554     vs = Group4Spin->SpinBox_DS->value(); vsStr = Group4Spin->SpinBox_DS->text();
1555   }
1556   else if ( send == Group4Spin->SpinBox_DY ) {
1557     vx = Group4Spin->SpinBox_DX->value(); vxStr = Group4Spin->SpinBox_DX->text();
1558     vy = newValue;                        vyStr = newValueStr;
1559     vz = Group4Spin->SpinBox_DZ->value(); vzStr = Group4Spin->SpinBox_DZ->text();
1560     vs = Group4Spin->SpinBox_DS->value(); vsStr = Group4Spin->SpinBox_DS->text();
1561   }
1562   else if ( send == Group4Spin->SpinBox_DZ ) {
1563     vx = Group4Spin->SpinBox_DX->value(); vxStr = Group4Spin->SpinBox_DX->text();
1564     vy = Group4Spin->SpinBox_DY->value(); vyStr = Group4Spin->SpinBox_DY->text();
1565     vz = newValue;                        vzStr = newValueStr;
1566     vs = Group4Spin->SpinBox_DS->value(); vsStr = Group4Spin->SpinBox_DS->text();
1567   }
1568   else if ( send == Group4Spin->SpinBox_DS ) {
1569     vx = Group4Spin->SpinBox_DX->value(); vxStr = Group4Spin->SpinBox_DX->text();
1570     vy = Group4Spin->SpinBox_DY->value(); vyStr = Group4Spin->SpinBox_DY->text();
1571     vz = Group4Spin->SpinBox_DZ->value(); vzStr = Group4Spin->SpinBox_DZ->text();
1572     vs = newValue;                        vsStr = newValueStr;
1573   }
1574   // Fix of the NPAL16010 bug is removed, because it's not actual with the Qt-4.x
1575
1576   if ( myConstructorId == 0 ) {  // SEGMENT
1577     if ( mySketchType == PT_ABS ) {
1578       myX = vx;
1579       myY = vy;
1580       myXStr = vxStr;
1581       myYStr = vyStr;
1582     }
1583     else if ( mySketchType == PT_RELATIVE ) {
1584       myDX = vx;
1585       myDY = vy;
1586       myDXStr = vxStr;
1587       myDYStr = vyStr;
1588     }
1589     else if ( mySketchType == DIR_ANGLE_LENGTH ) {
1590       myAngle = vx;
1591       myLength = vy;
1592       myAngleStr = vxStr;
1593       myLengthStr = vyStr;
1594     }
1595     else if ( mySketchType == DIR_ANGLE_X ) {
1596       myAngle = vx;
1597       myX = vy;
1598       myAngleStr = vxStr;
1599       myXStr = vyStr;
1600     }
1601     else if ( mySketchType == DIR_ANGLE_Y ) {
1602       myAngle = vx;
1603       myY = vy;
1604       myAngleStr = vxStr;
1605       myYStr = vyStr;
1606     }
1607     else if ( mySketchType == DIR_PER_LENGTH ) {
1608       myLength = vx;
1609       myLengthStr = vxStr;
1610     }
1611     else if ( mySketchType == DIR_PER_X ) {
1612       myX = vx;
1613       myXStr = vxStr;
1614     }
1615     else if ( mySketchType == DIR_PER_Y ) {
1616       myY = vx;
1617       myYStr = vxStr;
1618     }
1619     else if ( mySketchType == DIR_TAN_LENGTH ) {
1620       myLength = vx;
1621       myLengthStr = vxStr;
1622     }
1623     else if ( mySketchType == DIR_TAN_X ) {
1624       myX = vx;
1625       myXStr = vxStr;
1626     }
1627     else if ( mySketchType == DIR_TAN_Y ) {
1628       myY = vx;
1629       myYStr = vxStr;
1630     }
1631     else if ( mySketchType == DIR_DXDY_LENGTH ) {
1632       myDX = vx;
1633       myDY = vy;
1634       myLength = vz;
1635       myDXStr = vxStr;
1636       myDYStr = vyStr;
1637       myLengthStr = vzStr;
1638     }
1639     else if ( mySketchType == DIR_DXDY_X ) {
1640       myDX = vx;
1641       myDY = vy;
1642       myX = vz;
1643       myDXStr = vxStr;
1644       myDYStr = vyStr;
1645       myXStr = vzStr;
1646     }
1647     else if ( mySketchType == DIR_DXDY_Y ) {
1648       myDX = vx;
1649       myDY = vy;
1650       myY = vz;
1651       myDXStr = vxStr;
1652       myDYStr = vyStr;
1653       myYStr = vzStr;
1654     }
1655   }
1656   else if ( myConstructorId == 1 ) {  // ARC
1657     if ( mySketchType == PT_ABS ) {  
1658       myX = vx;
1659       myY = vy;
1660       myXStr = vxStr;
1661       myYStr = vyStr;
1662     }
1663     else if ( mySketchType == PT_RELATIVE ) {
1664       myDX = vx;
1665       myDY = vy;
1666       myDXStr = vxStr;
1667       myDYStr = vyStr;
1668     }
1669     if ( mySketchType == PT_ABS_RADIUS ) {  
1670       myX = vx;
1671       myY = vy;
1672       myRadius=vz;
1673       myXStr = vxStr;
1674       myYStr = vyStr;
1675       myRadiusStr = vzStr;
1676     }
1677     else if ( mySketchType == PT_REL_RADIUS ) {
1678       myDX = vx;
1679       myDY = vy;
1680       myRadius=vz;
1681       myDXStr = vxStr;
1682       myDYStr = vyStr;
1683       myRadiusStr = vzStr;
1684     }
1685     else if ( mySketchType == PT_SEL_RADIUS ) {
1686       myRadius = vx;
1687       myRadiusStr = vxStr;
1688     }
1689     if ( mySketchType == PT_ABS_CENTER ) {  
1690       myX = vx;
1691       myY = vy;
1692       myXc = vz;
1693       myYc = vs;
1694       myXStr = vxStr;
1695       myYStr = vyStr;
1696       myXcStr = vzStr;
1697       myYcStr = vsStr;
1698     }
1699     else if ( mySketchType == PT_REL_CENTER ) {
1700       myDX = vx;
1701       myDY = vy;
1702       myDXc = vz;
1703       myDYc = vs;
1704       myDXStr = vxStr;
1705       myDYStr = vyStr;
1706       myDXcStr = vzStr;
1707       myDYcStr = vsStr;
1708     }
1709     if ( mySketchType == DIR_ANGLE_LENGTH ) {
1710       myAngle = vx;
1711       myRadius = vy;
1712       myLength = vz;
1713       myAngleStr = vxStr;
1714       myRadiusStr = vyStr;
1715       myLengthStr = vzStr;
1716     }
1717     else if ( mySketchType == DIR_PER_LENGTH ) {
1718       myRadius = vx;
1719       myLength = vy;
1720       myRadiusStr = vxStr;
1721       myLengthStr = vyStr;
1722     }
1723     else if ( mySketchType == DIR_TAN_LENGTH ) {
1724       myRadius = vx;
1725       myLength = vy;
1726       myRadiusStr = vxStr;
1727       myLengthStr = vyStr;
1728     }
1729     else if ( mySketchType == DIR_DXDY_LENGTH ) {
1730       myDX = vx;
1731       myDY = vy;
1732       myRadius = vz;
1733       myLength = vs;
1734       myDXStr = vxStr;
1735       myDYStr = vyStr;
1736       myRadiusStr = vzStr;
1737       myLengthStr = vsStr;
1738     }
1739   }
1740
1741   GEOMBase_Helper::displayPreview( false, true, true, myLineWidth );
1742 }
1743
1744
1745 //=================================================================================
1746 // function : GetNewCommand()
1747 // purpose  : Build the new command with context
1748 //=================================================================================
1749 QString EntityGUI_SketcherDlg::GetNewCommand( QString& theParameters )
1750 {
1751   theParameters.clear();
1752   QString myNewCommand = ":";
1753   SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
1754   int aPrecision = resMgr->integerValue( "Geometry", "length_precision", 6 );
1755   int DigNum = qAbs(aPrecision);                   // options for the format of numbers in  myNewCommand
1756   char Format = 'f';
1757   if ( aPrecision < 0 )                            // f --> DigNum is the number of digits after the decimal point
1758     Format = 'g';                                  // g --> DigNum is the maximum number of significant digits 
1759
1760   if ( mySketchState == FIRST_POINT ) {
1761     if ( mySketchType == PT_ABS || mySketchType == PT_SEL ) {
1762       myNewCommand = myNewCommand + "F " + QString::number( myX, Format, DigNum) + " " + QString::number( myY, Format, DigNum);
1763       theParameters = myXStr + ":" + myYStr;
1764     }
1765     if ( mySketchType == PT_RELATIVE) {
1766       myNewCommand = myNewCommand + "F " + QString::number( myDX, Format, DigNum ) + " " + QString::number( myDY, Format, DigNum );
1767       theParameters = myDXStr + ":" + myDYStr;
1768     }
1769     return myNewCommand;
1770   }
1771
1772   if ( myConstructorId == 0  ) {  // SEGMENT
1773     if ( mySketchType == PT_ABS || mySketchType == PT_SEL ) {
1774       myNewCommand = myNewCommand + "TT " + QString::number( myX, Format, DigNum) + " " + QString::number( myY, Format, DigNum);
1775       theParameters = myXStr + ":" + myYStr;
1776     }
1777     if ( mySketchType == PT_RELATIVE) {
1778       myNewCommand = myNewCommand + "T " + QString::number( myDX, Format, DigNum ) + " " + QString::number( myDY, Format, DigNum );
1779       theParameters = myDXStr + ":" + myDYStr;
1780     }
1781     if ( mySketchType == DIR_ANGLE_LENGTH ) {
1782       myNewCommand = myNewCommand + "R " + QString::number( myAngle );
1783       myNewCommand = myNewCommand + ":" + "L " + QString::number( myLength, Format, DigNum );
1784       theParameters = myAngleStr + ":" + myLengthStr;
1785     }
1786     if ( mySketchType == DIR_ANGLE_X ) {
1787       myNewCommand = myNewCommand + "R " + QString::number( myAngle );
1788       myNewCommand = myNewCommand + ":" + "IX " + QString::number( myX, Format, DigNum);
1789       theParameters = myAngleStr + ":" + myXStr;
1790     }
1791     if ( mySketchType == DIR_ANGLE_Y ) {
1792       myNewCommand = myNewCommand + "R " + QString::number( myAngle );
1793       myNewCommand = myNewCommand + ":" + "IY " + QString::number( myY, Format, DigNum);
1794       theParameters = myAngleStr + ":" + myYStr;
1795     }
1796     if ( mySketchType == DIR_PER_LENGTH ) {
1797       myNewCommand = myNewCommand + "R " + QString::number( 90.0 );
1798       myNewCommand = myNewCommand + ":" + "L " + QString::number( myLength, Format, DigNum );
1799       theParameters = QString::number( 90.0 ) + ":" + myLengthStr;
1800     }
1801     if ( mySketchType == DIR_PER_X ) {
1802       myNewCommand = myNewCommand + "R " + QString::number( 90.0 );
1803       myNewCommand = myNewCommand + ":" + "IX " + QString::number( myX, Format, DigNum);
1804       theParameters = QString::number( 90.0 ) + ":" + myXStr;
1805     }
1806     if ( mySketchType == DIR_PER_Y ) {
1807       myNewCommand = myNewCommand + "R " + QString::number( 90.0 );
1808       myNewCommand = myNewCommand + ":" + "IY " + QString::number( myY, Format, DigNum);
1809       theParameters = QString::number( 90.0 ) + ":" + myYStr;
1810     }
1811     if ( mySketchType == DIR_TAN_LENGTH ) {
1812       myNewCommand = myNewCommand + "L " + QString::number( myLength, Format, DigNum );
1813       theParameters = myLengthStr;
1814     }
1815     if ( mySketchType == DIR_TAN_X ) {
1816       myNewCommand = myNewCommand + "IX " + QString::number( myX, Format, DigNum);
1817       theParameters = myXStr;
1818     }
1819     if ( mySketchType == DIR_TAN_Y) {
1820       myNewCommand = myNewCommand + "IY " + QString::number(myY, Format, DigNum);
1821       theParameters = myYStr;
1822     }
1823     if ( mySketchType == DIR_DXDY_LENGTH ) {
1824       myNewCommand = myNewCommand + "D " + QString::number( myDX, Format, DigNum ) + " " + QString::number( myDY, Format, DigNum );
1825       myNewCommand = myNewCommand + ":" + "L " + QString::number( myLength, Format, DigNum );
1826       theParameters = myDXStr + ":" + myDYStr + ":" + myLengthStr;
1827     }
1828     if ( mySketchType == DIR_DXDY_X ) {
1829       myNewCommand = myNewCommand + "D " + QString::number( myDX, Format, DigNum ) + " " + QString::number( myDY, Format, DigNum );
1830       myNewCommand = myNewCommand + ":" + "IX " + QString::number( myX, Format, DigNum);
1831       theParameters = myDXStr + ":" + myDYStr + ":" + myXStr;
1832     }
1833     if ( mySketchType == DIR_DXDY_Y ) {
1834       myNewCommand = myNewCommand + "D " + QString::number( myDX, Format, DigNum ) + " " + QString::number( myDY, Format, DigNum );
1835       myNewCommand = myNewCommand + ":" + "IY " + QString::number( myY, Format, DigNum);
1836       theParameters = myDXStr + ":" + myDYStr + ":" + myYStr;
1837     }
1838   }
1839   else if ( myConstructorId == 1 ) {  // ARC
1840     if ( mySketchType == PT_ABS || mySketchType == PT_SEL ) {
1841       myNewCommand = myNewCommand + "AA " + QString::number( myX, Format, DigNum) + " " + QString::number( myY, Format, DigNum);
1842       theParameters = myXStr + ":" + myYStr;
1843     }
1844     if ( mySketchType == PT_RELATIVE) {
1845       myNewCommand = myNewCommand + "A " + QString::number( myDX, Format, DigNum ) + " " + QString::number( myDY, Format, DigNum );
1846       theParameters = myDXStr + ":" + myDYStr;
1847     }
1848     if ( mySketchType == PT_ABS_RADIUS || mySketchType == PT_SEL_RADIUS ) {
1849       myNewCommand = myNewCommand + "UU " + QString::number( myX, Format, DigNum) + " " + QString::number( myY, Format, DigNum ) + " " + QString::number( myRadius , Format,  DigNum)+ " " + QString::number( myCheckFlag );
1850       theParameters = myXStr + ":" + myYStr + ":" + myRadiusStr; 
1851     }
1852     if ( mySketchType == PT_REL_RADIUS) {
1853       myNewCommand = myNewCommand + "U " + QString::number( myDX, Format, DigNum ) + " " + QString::number( myDY, Format, DigNum ) + " " + QString::number( myRadius, Format, DigNum )+ " " + QString::number( myCheckFlag );
1854       theParameters = myDXStr + ":" + myDYStr + ":" + myRadiusStr;  
1855     }
1856     if ( mySketchType == PT_ABS_CENTER || mySketchType == PT_SEL_CENTER ) {
1857       myNewCommand = myNewCommand + "EE " + QString::number( myX, Format, DigNum) + " " + QString::number( myY, Format, DigNum ) + " " + QString::number( myXc , Format,  DigNum) + " " + QString::number( myYc , Format,  DigNum)+ " " + QString::number( myCheckFlag ) + " " + QString::number( 0 );
1858       theParameters = myXStr + ":" + myYStr + ":" + myXcStr+ ":" + myYcStr; 
1859     }
1860     if ( mySketchType == PT_REL_CENTER) {
1861       myNewCommand = myNewCommand + "E " + QString::number( myDX, Format, DigNum ) + " " + QString::number( myDY, Format, DigNum ) + " " + QString::number( myDXc, Format, DigNum )+ " " + QString::number( myDYc, Format, DigNum )+ " " + QString::number( myCheckFlag )+ " " + QString::number( 0 );
1862       theParameters = myDXStr + ":" + myDYStr + ":" +  myDXcStr + ":" + myDYcStr ;  
1863     }
1864     if ( mySketchType == DIR_ANGLE_LENGTH ) {
1865       myNewCommand = myNewCommand + "R " + QString::number( myAngle );
1866       myNewCommand = myNewCommand + ":" + "C " + QString::number( myRadius, Format, DigNum ) + " " + QString::number( myLength, Format, DigNum );
1867       theParameters = myAngleStr + ":" + myRadiusStr + ":" + myLengthStr;
1868     }
1869     if ( mySketchType == DIR_PER_LENGTH ) {
1870       myNewCommand = myNewCommand + "R " + QString::number( 90.0 );
1871       myNewCommand = myNewCommand + ":" + "C " + QString::number( myRadius, Format, DigNum ) + " " + QString::number( myLength, Format, DigNum );
1872       theParameters = QString::number( 90.0 ) + ":" + myRadiusStr + ":" + myLengthStr;
1873     }
1874     if ( mySketchType == DIR_TAN_LENGTH ) {
1875       myNewCommand = myNewCommand + "C " + QString::number( myRadius, Format, DigNum ) + " " + QString::number( myLength, Format, DigNum );
1876       theParameters = myRadiusStr + ":" + myLengthStr;
1877     }
1878     if ( mySketchType == DIR_DXDY_LENGTH ) {
1879       myNewCommand = myNewCommand + "D " + QString::number( myDX, Format, DigNum ) + " " + QString::number( myDY, Format, DigNum );
1880       myNewCommand = myNewCommand + ":" + "C " + QString::number( myRadius, Format, DigNum ) + " " + QString::number( myLength, Format, DigNum );
1881       theParameters = myDXStr + ":" + myDYStr + ":" + myRadiusStr + ":" + myLengthStr;
1882     }
1883   }
1884   return myNewCommand;
1885 }
1886
1887 //=================================================================================
1888 // function : createOperation
1889 // purpose  :
1890 //=================================================================================
1891 GEOM::GEOM_IOperations_ptr EntityGUI_SketcherDlg::createOperation()
1892 {
1893   return getGeomEngine()->GetICurvesOperations( getStudyId() );
1894 }
1895
1896 //=================================================================================
1897 // function : isValid
1898 // purpose  :
1899 //=================================================================================
1900 bool EntityGUI_SketcherDlg::isValid( QString& msg )
1901 {
1902   bool ok = true;
1903   bool toCorrect = !IsPreview() || myIsApply;
1904
1905   if( Group1Spin->isVisible() ) {
1906     ok = Group1Spin->SpinBox_DX->isValid( msg, toCorrect ) && ok;
1907   }
1908   else if( Group1Sel1Spin->isVisible() ) {
1909     ok = Group1Sel1Spin->SpinBox_DX->isValid( msg, toCorrect ) && ok;
1910   }
1911   else if( Group2Spin->isVisible() ) {
1912     ok = Group2Spin->SpinBox_DX->isValid( msg, toCorrect ) && ok;
1913     ok = Group2Spin->SpinBox_DY->isValid( msg, toCorrect ) && ok;
1914   }
1915   else if( Group3Spin->isVisible() ) {
1916     ok = Group3Spin->SpinBox_DX->isValid( msg, toCorrect ) && ok;
1917     ok = Group3Spin->SpinBox_DY->isValid( msg, toCorrect ) && ok;
1918     ok = Group3Spin->SpinBox_DZ->isValid( msg, toCorrect ) && ok;
1919   }
1920   else if( Group4Spin->isVisible() ) {
1921     ok = Group4Spin->SpinBox_DX->isValid( msg, toCorrect ) && ok;
1922     ok = Group4Spin->SpinBox_DY->isValid( msg, toCorrect ) && ok;
1923     ok = Group4Spin->SpinBox_DZ->isValid( msg, toCorrect ) && ok;
1924     ok = Group4Spin->SpinBox_DS->isValid( msg, toCorrect ) && ok;
1925   }
1926
1927   if( myIsApply && !ok )
1928     showError( msg );
1929
1930   return ok;
1931 }
1932
1933 //=================================================================================
1934 // function : execute
1935 // purpose  :
1936 //=================================================================================
1937 bool EntityGUI_SketcherDlg::execute( ObjectList& objects )
1938 {
1939   QString aParameters;
1940
1941   if ( mySketchState == FIRST_POINT ) {
1942     myLastX2 = myX;
1943     myLastY2 = myY;
1944   }
1945   else {
1946     //Test if the current point is the same as the last one
1947     TopoDS_Shape myShape1, myShape2;
1948
1949     // Set "C" numeric locale
1950     Kernel_Utils::Localizer loc;
1951
1952     //Last Shape
1953     QString Command1 = myCommand.join( "" );
1954     Sketcher_Profile aProfile1( Command1.toAscii() );
1955     if ( aProfile1.IsDone() )
1956       myShape1 = aProfile1.GetShape();
1957
1958     //Current Shape
1959     QString Command2 = Command1 + GetNewCommand( aParameters );
1960     Sketcher_Profile aProfile2( Command2.toAscii() );
1961
1962     //Error Message
1963     if ( mySketchType == PT_ABS_CENTER || 
1964          mySketchType == PT_REL_CENTER  ){
1965       Group4Spin->label->show();
1966       Group4Spin->label->setText(QString(aProfile2.ErrMsg().c_str()));
1967     }
1968     else 
1969       Group4Spin->label->hide();
1970     if ( mySketchType == PT_SEL_CENTER ){
1971       Group2Sel->label->show();
1972       Group2Sel->label->setText(QString(aProfile2.ErrMsg().c_str()));   
1973     }
1974     else 
1975       Group2Sel->label->hide();
1976
1977     if ( aProfile2.IsDone() )
1978       myShape2 = aProfile2.GetShape();
1979
1980     if ( myShape2.IsNull() ) {
1981       //the current point is the same as the last one
1982       myLastX2 = myLastX1;
1983       myLastY2 = myLastY1;
1984     }
1985     else {
1986       TopoDS_Vertex V1, V2;
1987       gp_Pnt pt;
1988       if ( myShape1.ShapeType() == TopAbs_VERTEX ) {
1989         //the last shape is the first point
1990         pt = BRep_Tool::Pnt( TopoDS::Vertex( myShape1 ) );
1991         myLastX1 = pt.X();
1992         myLastY1 = pt.Y();
1993       }
1994       else {
1995         TopExp::Vertices( TopoDS::Wire( myShape1 ), V1, V2 );
1996         pt = BRep_Tool::Pnt( V2 );
1997         myLastX1 = pt.X();
1998         myLastY1 = pt.Y();
1999       }
2000       TopExp::Vertices( TopoDS::Wire( myShape2 ), V1, V2 );
2001       pt = BRep_Tool::Pnt( V2 );
2002       myLastX2 = pt.X();
2003       myLastY2 = pt.Y();
2004     }
2005   }
2006
2007   QString cmd;
2008   if ( ( mySketchState != FIRST_POINT &&
2009          myLastX1 == myLastX2 && myLastY1 == myLastY2 ) || myIsAllAdded ) {
2010     cmd = myCommand.join( "" );
2011     if ( Group1Sel->isVisible() ) {
2012       Group1Sel->buttonApply->setEnabled( false );
2013       //Group1Sel->buttonApply->setFocus();
2014     }
2015     if ( Group2Sel->isVisible() ) {
2016       Group2Sel->buttonApply->setEnabled( false );
2017       //Group2Sel->buttonApply->setFocus();
2018     }
2019     if ( Group1Sel1Spin->isVisible() ) {
2020       Group1Sel1Spin->buttonApply->setEnabled( false );
2021       //Group1Sel1Spin->buttonApply->setFocus();
2022     }
2023     if ( Group1Spin->isVisible() ) {
2024       Group1Spin->buttonApply->setEnabled( false );
2025       //Group1Spin->buttonApply->setFocus();
2026     }
2027     if ( Group2Spin->isVisible() ) {
2028       Group2Spin->buttonApply->setEnabled( false );
2029       //Group2Spin->buttonApply->setFocus();
2030     }
2031     if ( Group3Spin->isVisible() ) {
2032       Group3Spin->buttonApply->setEnabled( false );
2033       //Group3Spin->buttonApply->setFocus();
2034     }
2035     if ( Group4Spin->isVisible() ) {
2036       Group4Spin->buttonApply->setEnabled( false );
2037       //Group4Spin->buttonApply->setFocus();
2038     }
2039   }
2040   else {
2041     cmd = myCommand.join( "" ) + GetNewCommand( aParameters );
2042
2043     if ( Group1Sel->isVisible() ) {
2044       Group1Sel->buttonApply->setEnabled( true );
2045       //Group1Sel->buttonApply->setFocus();
2046     }
2047     if ( Group2Sel->isVisible() ) {
2048       Group2Sel->buttonApply->setEnabled( true );
2049       //Group2Sel->buttonApply->setFocus();
2050     }
2051     if ( Group1Sel1Spin->isVisible() ) {
2052       Group1Sel1Spin->buttonApply->setEnabled( true );
2053       //Group1Sel1Spin->buttonApply->setFocus();
2054     }
2055     if ( Group1Spin->isVisible() ) {
2056       Group1Spin->buttonApply->setEnabled( true );
2057       //Group1Spin->buttonApply->setFocus();
2058     }
2059     if ( Group2Spin->isVisible() ) {
2060       Group2Spin->buttonApply->setEnabled( true );
2061       //Group2Spin->buttonApply->setFocus();
2062     }
2063     if ( Group3Spin->isVisible() ) {
2064       Group3Spin->buttonApply->setEnabled( true );
2065       //Group3Spin->buttonApply->setFocus();
2066     }
2067     if ( Group4Spin->isVisible() ) {
2068       Group4Spin->buttonApply->setEnabled( true );
2069       //Group4Spin->buttonApply->setFocus();
2070     }
2071   }
2072
2073   gp_Ax3 myWPlane = GetActiveLocalCS();
2074   GEOM::ListOfDouble_var WPlane = new GEOM::ListOfDouble;
2075   WPlane->length( 9 );
2076   WPlane[0] = myWPlane.Location().X();
2077   WPlane[1] = myWPlane.Location().Y();
2078   WPlane[2] = myWPlane.Location().Z();
2079
2080   WPlane[3] = myWPlane.Direction().X();
2081   WPlane[4] = myWPlane.Direction().Y();
2082   WPlane[5] = myWPlane.Direction().Z();
2083
2084   WPlane[6] = myWPlane.XDirection().X();
2085   WPlane[7] = myWPlane.XDirection().Y();
2086   WPlane[8] = myWPlane.XDirection().Z();
2087
2088   GEOM::GEOM_ICurvesOperations_var anOper = GEOM::GEOM_ICurvesOperations::_narrow(getOperation());
2089   GEOM::GEOM_Object_var anObj = anOper->MakeSketcher( cmd.toLatin1().constData(), WPlane );
2090
2091   if ( !anObj->_is_nil() )
2092   {
2093     if( !IsPreview() ) {
2094       QStringList aCurrentParameters = myParameters;
2095       aCurrentParameters << aParameters;
2096       anObj->SetParameters(aCurrentParameters.join(":").toLatin1().constData());
2097     }
2098
2099     objects.push_back( anObj._retn() );
2100   }
2101
2102   return true;
2103 }
2104
2105 //================================================================
2106 // Function : displayPreview
2107 // Purpose  : Method for displaying preview of resulting shape
2108 //            Redefined from GEOMBase_Helper.
2109 //================================================================
2110 void EntityGUI_SketcherDlg::displayPreview( GEOM::GEOM_Object_ptr object,
2111                                             const bool            append,
2112                                             const bool            activate,
2113                                             const bool            update,
2114                                             const double          lineWidth,
2115                                             const int             displayMode,
2116                                             const int             color )
2117 {
2118   // Set color for preview shape
2119   getDisplayer()->SetColor( Quantity_NOC_RED );
2120
2121   // set width of displayed shape
2122   getDisplayer()->SetWidth( (lineWidth == -1)?myLineWidth:lineWidth );
2123
2124   // Disable activation of selection
2125   getDisplayer()->SetToActivate( activate );
2126
2127   // Make a reference to GEOM_Object
2128   CORBA::String_var objStr = myGeometryGUI->getApp()->orb()->object_to_string( object );
2129   getDisplayer()->SetName( objStr.in() );
2130
2131   // Create wire from applayed object
2132   TopoDS_Shape anApplyedWire, aLastSegment;
2133   if ( !createShapes( object, anApplyedWire, aLastSegment ) )
2134     return;
2135
2136   // Build prs
2137   SALOME_Prs* aPrs = getDisplayer()->BuildPrs( anApplyedWire );
2138   if ( aPrs != 0 && !aPrs->IsNull() )
2139     GEOMBase_Helper::displayPreview( aPrs, append, update );
2140
2141   getDisplayer()->SetColor( Quantity_NOC_VIOLET );
2142   aPrs = getDisplayer()->BuildPrs( aLastSegment );
2143   if ( aPrs != 0 && !aPrs->IsNull() )
2144     GEOMBase_Helper::displayPreview( aPrs, append, update );
2145
2146   getDisplayer()->UnsetName();
2147
2148   // Enable activation of displayed objects
2149   getDisplayer()->SetToActivate( true );
2150 }
2151
2152 //================================================================
2153 // Function : createShapes
2154 // Purpose  : Create applyed wire, and last segment from entry object
2155 //================================================================
2156 bool EntityGUI_SketcherDlg::createShapes( GEOM::GEOM_Object_ptr theObject,
2157                                           TopoDS_Shape&         theApplyedWire,
2158                                           TopoDS_Shape&         theLastSegment )
2159 {
2160   TopoDS_Shape aShape;
2161   if ( !GEOMBase::GetShape( theObject, aShape ) ||
2162        aShape.ShapeType() != TopAbs_WIRE && aShape.ShapeType() != TopAbs_VERTEX )
2163     return false;
2164
2165   if ( Group1Sel->isVisible()  && !Group1Sel->buttonApply->isEnabled()  ||
2166        Group2Sel->isVisible()  && !Group2Sel->buttonApply->isEnabled()  ||
2167        Group1Sel1Spin->isVisible()  && !Group1Sel1Spin->buttonApply->isEnabled()  ||
2168        Group1Spin->isVisible() && !Group1Spin->buttonApply->isEnabled() ||
2169        Group2Spin->isVisible() && !Group2Spin->buttonApply->isEnabled() ||
2170        Group3Spin->isVisible() && !Group3Spin->buttonApply->isEnabled() ||
2171        Group4Spin->isVisible() && !Group4Spin->buttonApply->isEnabled() ) {
2172      theApplyedWire = aShape;
2173      return true;
2174   }
2175
2176   BRepBuilderAPI_MakeWire aBuilder;
2177   TopExp_Explorer anExp( aShape, TopAbs_EDGE );
2178   while ( 1 ) {
2179     TopoDS_Shape anEdge = anExp.Current();
2180     anExp.Next();
2181     if ( anExp.More() ) // i.e. non-last edge
2182       aBuilder.Add( TopoDS::Edge( anEdge ) );
2183     else {
2184       theLastSegment = anEdge;
2185       break;
2186     }
2187   }
2188
2189   if ( aBuilder.IsDone() )
2190     theApplyedWire = aBuilder.Shape();
2191
2192   return true;
2193 }
2194
2195 //=================================================================================
2196 // function : keyPressEvent()
2197 // purpose  :
2198 //=================================================================================
2199 void  EntityGUI_SketcherDlg::keyPressEvent( QKeyEvent* e )
2200 {
2201   QDialog::keyPressEvent( e );
2202   if ( e->isAccepted() )
2203     return;
2204
2205   if ( e->key() == Qt::Key_F1 ) {
2206     e->accept();
2207     ClickOnHelp();
2208   }
2209 }
2210
2211 //=================================================================================
2212 // function : initSpinBox()
2213 // purpose  :
2214 //=================================================================================
2215 void EntityGUI_SketcherDlg::initSpinBox( SalomeApp_DoubleSpinBox* spinBox,
2216                                          double min,  double max,
2217                                          double step, const char* quantity )
2218 {
2219   // The same stuff as in GEOMBase_Skeleton::initSpinBox()!
2220   // TODO: Think how to keep the single piece of code...
2221
2222   // Obtain precision from preferences
2223   SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
2224   int aPrecision = resMgr->integerValue( "Geometry", quantity, 6 );
2225   
2226   spinBox->setPrecision( aPrecision );
2227   spinBox->setDecimals( qAbs( aPrecision ) ); // it's necessary to set decimals before the range setting,
2228                                               // by default Qt rounds boundaries to 2 decimals at setRange
2229   spinBox->setRange( min, max );
2230   spinBox->setSingleStep( step );
2231   
2232   // Add a hint for the user saying how to tune precision
2233   QString userPropName = QObject::tr( QString( "GEOM_PREF_%1" ).arg( quantity ).toLatin1().constData() );
2234   spinBox->setProperty( "validity_tune_hint", 
2235                         QVariant( QObject::tr( "GEOM_PRECISION_HINT" ).arg( userPropName ) ) );
2236 }
2237
2238 //=================================================================================
2239 // function : SetDoubleSpinBoxStep()
2240 // purpose  : Double spin box management
2241 //=================================================================================
2242 void EntityGUI_SketcherDlg::SetDoubleSpinBoxStep( double step )
2243 {
2244   Group1Spin->SpinBox_DX->setSingleStep(step);
2245   Group1Sel1Spin->SpinBox_DX->setSingleStep(step);
2246   Group2Spin->SpinBox_DX->setSingleStep(step);
2247   Group2Spin->SpinBox_DY->setSingleStep(step);
2248   Group3Spin->SpinBox_DX->setSingleStep(step);
2249   Group3Spin->SpinBox_DY->setSingleStep(step);
2250   Group3Spin->SpinBox_DZ->setSingleStep(step);
2251   Group4Spin->SpinBox_DZ->setSingleStep(step);
2252
2253   // san: Do NOT override the step when a speicifc step value is used
2254   // in some input fields!
2255   //Group4Spin->SpinBox_DX->setSingleStep(step);
2256   //Group4Spin->SpinBox_DY->setSingleStep(step);
2257   //Group4Spin->SpinBox_DS->setSingleStep(step);
2258 }
2259
2260 //=================================================================================
2261 // function : FindLocalCS()
2262 // purpose  : Find All Coordinates systems in study
2263 //=================================================================================
2264 void EntityGUI_SketcherDlg::FindLocalCS()
2265 {
2266   ComboBox1->clear();
2267   myLCSList.clear();
2268   SalomeApp_Application* app =
2269     dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
2270   if ( !app )
2271     return;
2272
2273   SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
2274   if ( !appStudy )
2275     return;
2276
2277   _PTR(Study) aStudy = appStudy->studyDS();
2278
2279   //add Global CS
2280   ComboBox1->addItem(tr("GEOM_GCS"));
2281   gp_Pnt aOrigin = gp_Pnt(0, 0, 0);
2282   gp_Dir aDirZ = gp_Dir(0, 0, 1);
2283   gp_Dir aDirX = gp_Dir(1, 0, 0);
2284   gp_Ax3 globalCS = gp_Ax3(aOrigin, aDirZ, aDirX);
2285   myLCSList.push_back(globalCS);
2286
2287   // get GEOM component
2288   CORBA::String_var geomIOR = app->orb()->object_to_string( GeometryGUI::GetGeomGen() );
2289   _PTR(SObject) obj = aStudy->FindObjectIOR( geomIOR.in() );
2290   if (!obj)
2291     return;
2292   _PTR(SComponent) fc = obj->GetFatherComponent();
2293   QString geomComp = fc->GetID().c_str();
2294   _PTR(SObject) comp = aStudy->FindObjectID( geomComp.toLatin1().data() );
2295   if ( !comp )
2296     return;
2297
2298   // browse through all GEOM data tree
2299   _PTR(ChildIterator) it ( aStudy->NewChildIterator( comp ) );
2300   for ( it->InitEx( true ); it->More(); it->Next() ) {
2301     _PTR(SObject) child( it->Value() );
2302     CORBA::Object_var corbaObj = GeometryGUI::ClientSObjectToObject( child );
2303     GEOM::GEOM_Object_var geomObj = GEOM::GEOM_Object::_narrow( corbaObj );
2304     if( CORBA::is_nil( geomObj ) ) 
2305       continue;
2306     if (geomObj->GetType() == GEOM_MARKER) {
2307       ComboBox1->addItem(geomObj->GetName());
2308       TopoDS_Shape aShape = GEOM_Client::get_client().GetShape(GeometryGUI::GetGeomGen(), geomObj);
2309       
2310       gp_Ax3 aLCS;
2311       aLCS.Transform(aShape.Location().Transformation());
2312       if (aShape.ShapeType() == TopAbs_FACE) {
2313         Handle(Geom_Surface) aGS = BRep_Tool::Surface(TopoDS::Face(aShape));
2314         if (!aGS.IsNull() && aGS->IsKind(STANDARD_TYPE(Geom_Plane))) {
2315           Handle(Geom_Plane) aGPlane = Handle(Geom_Plane)::DownCast(aGS);
2316           gp_Pln aPln = aGPlane->Pln();
2317           aLCS = aPln.Position();
2318         }
2319       }
2320       myLCSList.push_back(aLCS);
2321     }
2322   }
2323 }
2324
2325 //=================================================================================
2326 // function : GetActiveLocalCS()
2327 // purpose  : Get Working plane
2328 //=================================================================================
2329 gp_Ax3 EntityGUI_SketcherDlg::GetActiveLocalCS()
2330 {
2331   int ind = ComboBox1->currentIndex();
2332   if (ind == -1)
2333     return myGeometryGUI->GetWorkingPlane();
2334
2335   gp_Ax3 aLCS = myLCSList.at(ind);
2336
2337   return aLCS;
2338 }
2339
2340 //=================================================================================
2341 // function : ActivateLocalCS()
2342 // purpose  : Activate & Fit Working plane
2343 //=================================================================================
2344 void EntityGUI_SketcherDlg::ActivateLocalCS()
2345 {
2346     myGeometryGUI->SetWorkingPlane( GetActiveLocalCS() );
2347     myGeometryGUI->ActiveWorkingPlane();
2348 }