]> SALOME platform Git repositories - modules/visu.git/blob - src/VISUGUI/VisuGUI_CutPlanesDlg.cxx
Salome HOME
Merge with version on tag OCC-V2_1_0d
[modules/visu.git] / src / VISUGUI / VisuGUI_CutPlanesDlg.cxx
1 //  VISU VISUGUI : GUI of VISU component
2 //
3 //  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : VisuGUI_CutPlanesDlg.cxx
25 //  Author : Laurent CORNABE & Hubert ROLLAND 
26 //  Module : VISU
27 //  $Header$
28
29 #include "VisuGUI_CutPlanesDlg.h"
30 #include "VISU_CutPlanes_i.hh"
31 #include "VISU_CutPlanesPL.hxx"
32
33 #include "VisuGUI.h"
34 #include "VTKViewer_ViewFrame.h"
35
36 #include "QAD_Application.h"
37 #include "QAD_Desktop.h"
38 #include "QAD_RightFrame.h"
39
40 #include <qlayout.h>
41 #include <qcheckbox.h>
42 #include <qstyle.h>
43 #include <qstring.h>
44 #include <qvalidator.h>
45 #include <qlineedit.h>
46 #include <qtabwidget.h>
47
48 #include <vtkRenderer.h>
49 #include <vtkPolyData.h>
50 #include <vtkAppendPolyData.h>
51 #include <vtkDataSetMapper.h>
52
53
54 #define GET_VTK_VIEWFRAME(aStudy) dynamic_cast<VTKViewer_ViewFrame*>(aStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())
55
56 using namespace std;
57
58 extern VisuGUI *visuGUI;
59
60 VisuGUI_CutPlanesPane::VisuGUI_CutPlanesPane(QWidget* theParent, QAD_Study* theStudy)
61   :QFrame(theParent), myPreviewActor(0),myStudy(theStudy)
62 {
63   QGridLayout* TopLayout = new QGridLayout( this ); 
64   TopLayout->setSpacing( 6 );
65   TopLayout->setMargin( 10 );
66
67   QButtonGroup* SelPlane = new QButtonGroup( tr( "Orientation" ), this, "SelPlane" );
68   SelPlane->setTitle( tr( "Orientation" ) );
69   SelPlane->setColumnLayout(0, Qt::Vertical );
70   SelPlane->layout()->setSpacing( 0 );
71   SelPlane->layout()->setMargin( 0 );
72   QGridLayout* SelPlaneLayout = new QGridLayout( SelPlane->layout() );
73   SelPlaneLayout->setAlignment( Qt::AlignTop );
74   SelPlaneLayout->setSpacing( 6 );
75   SelPlaneLayout->setMargin( 11 );
76
77   RBxy = new QRadioButton( tr( "// X-Y" ), SelPlane, "RBxy" );
78   RByz = new QRadioButton( tr( "// Y-Z" ), SelPlane, "RByz" );
79   RBzx = new QRadioButton( tr( "// Z-X" ), SelPlane, "RBzx" );
80   SelPlaneLayout->addWidget( RBxy, 0, 0 );
81   SelPlaneLayout->addWidget( RByz, 0, 1 );
82   SelPlaneLayout->addWidget( RBzx, 0, 2 );
83
84   QLabel* LabelPosi_3 = new QLabel( tr( "Number of planes:" ), this, "LabelPosi_3" );
85
86   nbPlan = new QSpinBox( 1, 100, 1, this, "nbPlan" );
87   nbPlan->setValue( 1 );
88   nbPlan->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
89
90   myPosTable = new QTable(this, "Positions of planes" );
91   myPosTable->setMaximumHeight( 227 );
92   myPosTable->setMinimumWidth( 294 );
93   myPosTable->setNumCols(2);
94   myPosTable->setNumRows(0);
95   connect( myPosTable, SIGNAL(valueChanged(int, int)), this, SLOT(onValueChanged(int, int)) );
96   
97   QHeader *th = myPosTable->horizontalHeader();
98   th->setLabel( 0, "Position" );
99   th->setLabel( 1, "Set default" );
100   th->setStyle("QStyle::CE_PushButton");
101     
102   QGroupBox* GBrot = new QGroupBox( tr( "Rotations" ), this, "GBrot" );
103   GBrot->setColumnLayout(0, Qt::Vertical );
104   GBrot->layout()->setSpacing( 0 );
105   GBrot->layout()->setMargin( 0 );
106   QGridLayout* GBrotLayout = new QGridLayout( GBrot->layout() );
107   GBrotLayout->setAlignment( Qt::AlignTop );
108   GBrotLayout->setSpacing( 6 );
109   GBrotLayout->setMargin( 11 );
110
111   LabelRot1 = new QLabel( tr( "Rotation around X (Y to Z):" ), GBrot, "LabelRot1" );
112   GBrotLayout->addWidget( LabelRot1, 0, 0 );
113
114   Rot1 = new QAD_SpinBoxDbl( GBrot, -180, 180, 10 );
115   Rot1->setValue( 0 );
116   Rot1->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
117   connect( Rot1, SIGNAL( valueChanged( double )), this, SLOT( onRotation( double ) ) );
118   GBrotLayout->addWidget( Rot1, 0, 1 );
119
120   LabelRot2 = new QLabel( tr( "Rotation around Y (Z to X):" ), GBrot, "LabelRot2" );
121   GBrotLayout->addWidget( LabelRot2, 1, 0 );
122   
123   Rot2 = new QAD_SpinBoxDbl( GBrot, -180, 180, 10 );
124   Rot2->setValue( 0 );
125   Rot2->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
126   connect( Rot2, SIGNAL( valueChanged( double )), this, SLOT( onRotation( double ) ) );
127   GBrotLayout->addWidget( Rot2, 1, 1 );
128
129   QLabel* aPosLbl = new QLabel(tr( "LBL_POS" ), this);
130   myPosSpn = new QAD_SpinBoxDbl( this, 0, 1, 0.1 );
131
132   myPreviewCheck = new QCheckBox(tr("LBL_SHOW_PREVIEW"), this);
133   myPreviewCheck->setChecked(false);
134   connect( myPreviewCheck, SIGNAL( toggled( bool )), this, SLOT( onPreviewCheck( bool ) ) );
135
136   TopLayout->addMultiCellWidget( SelPlane, 0, 0, 0, 1 );
137   TopLayout->addMultiCellWidget( GBrot, 1, 1, 0, 1 );
138   TopLayout->addWidget( LabelPosi_3,   2, 0 );
139   TopLayout->addWidget( nbPlan,        2, 1 );
140   TopLayout->addMultiCellWidget( myPosTable, 3, 3, 0, 1 );
141   TopLayout->setRowStretch ( 3, 3 );
142   TopLayout->addWidget(aPosLbl, 4, 0 );
143   TopLayout->addWidget(myPosSpn, 4, 1 );
144   TopLayout->addMultiCellWidget( myPreviewCheck, 5, 5, 0, 1 );
145
146   // signals and slots connections
147   connect( SelPlane, SIGNAL( clicked( int )), this, SLOT( orientationChanged( int ) ) );
148   connect( nbPlan, SIGNAL( valueChanged( int )), this, SLOT( DrawTable( ) ) );
149   connect( myPosSpn, SIGNAL( valueChanged( double )), this, SLOT( DrawTable( ) ) );
150   connect( th, SIGNAL( clicked(int)), this, SLOT( setDefault(int) ) );
151
152   // default values
153   myCutPlanes = NULL;
154   hasInit = false;
155   X1 = 0; X2 = 0;
156   Y1 = 0; Y2 = 0;
157   Z1 = 0; Z2 = 0;
158   RByz->setChecked( true );
159   
160 } // End of Constructor
161
162
163 VisuGUI_CutPlanesPane::~VisuGUI_CutPlanesPane()
164 {
165   deletePlanes();
166   if(myCutPlanes) myCutPlanes->Destroy();
167   if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy))
168     vf->Repaint();
169 }
170
171
172 void VisuGUI_CutPlanesPane::initFromPrsObject(VISU::CutPlanes_i* thePrs) {
173   setNbPlanes(thePrs->GetNbPlanes());
174   setRotation(thePrs->GetRotateX()*180./PI, thePrs->GetRotateY()*180./PI);
175   setPlanePos(thePrs->GetOrientationType());
176   myPosSpn->setValue(thePrs->GetDisplacement());
177   hasInit = true;
178   // init table
179   myCutPlanes = new VISU::CutPlanes_i(thePrs->GetResult(),false);
180   myCutPlanes->SameAs(thePrs);
181   DrawTable();
182
183   // Draw Preview
184   if (myPreviewCheck->isChecked()) {
185     createPlanes();
186   }
187 }
188
189
190 void VisuGUI_CutPlanesPane::createPlanes() {
191   if (myStudy->getActiveStudyFrame()->getTypeView() != VIEW_VTK) return;
192   if (myCutPlanes == NULL) return;
193   if (myPreviewActor != 0) return;
194
195   vtkAppendPolyData* aPolyData = myCutPlanes->GetCutPlanesPL()->GetAppendPolyData();
196   vtkDataSetMapper* aPlaneMapper = vtkDataSetMapper::New();
197   if (!aPolyData->GetOutput()->GetNumberOfCells()) {
198     onPreviewCheck(false);
199     return;
200   }
201   aPlaneMapper->SetInput(aPolyData->GetOutput());
202   aPlaneMapper->ScalarVisibilityOff();
203
204   myPreviewActor = SALOME_Actor::New();
205   myPreviewActor->PickableOff();
206   myPreviewActor->SetMapper(aPlaneMapper);
207   aPlaneMapper->Delete();
208   GET_VTK_VIEWFRAME(myStudy)->AddActor(myPreviewActor);
209 }
210
211
212
213 int VisuGUI_CutPlanesPane::storeToPrsObject(VISU::CutPlanes_i* thePrs) {
214   thePrs->SetOrientation(getOrientaion(),getRotation1()*PI/180.,getRotation2()*PI/180.);
215   thePrs->SetNbPlanes(getNbPlanes());
216   thePrs->SetDisplacement(myPosSpn->value());
217   for (int i = 0; i < getNbPlanes(); ++i) 
218     {
219       if (!((QCheckTableItem*)myPosTable->item(i, 1))->isChecked())
220         thePrs->SetPlanePosition( i, myPosTable->text(i, 0).toDouble());
221       else thePrs->SetDefault(i);
222     }
223   return 1;
224 }
225
226
227 /*!
228   Called when orientation is changed
229 */
230 void VisuGUI_CutPlanesPane::orientationChanged( int Id )
231 {
232   if ( Id == 0 ) { // RBxy->isChecked()
233     LabelRot1->setText( tr( "Rotation around X (Y to Z):" ) );
234     LabelRot2->setText( tr( "Rotation around Y (Z to X):" ) );
235   } else if ( Id == 1 ) { // RByz->isChecked()
236     LabelRot1->setText( tr( "Rotation around Y (Z to X):" ) );
237     LabelRot2->setText( tr( "Rotation around Z (X to Y):" ) );
238   } else { 
239     LabelRot1->setText( tr( "Rotation around Z (X to Y):" ) );
240     LabelRot2->setText( tr( "Rotation around X (Y to Z):" ) );
241   }
242   DrawTable();
243 }
244
245
246
247
248 /*!
249   Sets planes orientation and position
250 */
251 void VisuGUI_CutPlanesPane::setPlanePos( const VISU::CutPlanes::Orientation  orient)
252 {
253   if ( orient == VISU::CutPlanes::XY )           // xy
254     {
255       RBxy->setChecked( true );
256       orientationChanged( 0 );
257     }
258   else if ( orient == VISU::CutPlanes::YZ )       // yz
259     {
260       RByz->setChecked( true );
261       orientationChanged( 1 );
262     }
263   else                         // zx
264    {
265      RBzx->setChecked( true );
266      orientationChanged( 2 );
267    }
268   
269 }
270
271 /*!
272   Gets planes orientation
273 */
274 VISU::CutPlanes::Orientation VisuGUI_CutPlanesPane::getOrientaion()
275 {
276   VISU::CutPlanes::Orientation orient;
277   if ( RBxy->isChecked() )     // xy
278     orient = VISU::CutPlanes::XY;
279   else if ( RByz->isChecked() )     // yz
280     orient = VISU::CutPlanes::YZ;
281   else if ( RBzx->isChecked() )     // zx
282     orient = VISU::CutPlanes::ZX;
283   return orient;
284 }
285
286 /*!
287   Sets planes rotation
288 */
289 void VisuGUI_CutPlanesPane::setRotation( const double r1, const double r2 )
290 {
291   Rot1->setValue( r1 );
292   Rot2->setValue( r2 );
293 }
294
295 /*!
296   Draw the table of planes positions
297 */
298
299 void VisuGUI_CutPlanesPane::DrawTable()
300 {
301   if (myCutPlanes == NULL) return;
302   if (!hasInit) return;
303
304   int aNbRows = myPosTable->numRows();
305   int aNbPlanes = getNbPlanes();  
306
307   myCutPlanes->SetOrientation(getOrientaion(),getRotation1()*PI/180.,getRotation2()*PI/180.);
308   myCutPlanes->SetNbPlanes(aNbPlanes);
309   myCutPlanes->SetDisplacement(myPosSpn->value());
310   if (aNbRows>0)
311     for (int i = 0; i < aNbRows; ++i) {
312       QCheckTableItem* aItem = (QCheckTableItem*)myPosTable->item( i, 1 );
313       if (aItem == 0) break;
314       if (!aItem->isChecked())
315         myCutPlanes->SetPlanePosition(i, myPosTable->text(i, 0).toDouble());
316     }
317   
318   if (aNbPlanes > aNbRows)
319     myPosTable->insertRows(aNbRows, aNbPlanes - aNbRows );
320   else if (aNbPlanes < aNbRows)
321     myPosTable->setNumRows(aNbPlanes);
322
323   int aMin = (aNbRows < aNbPlanes)? aNbRows : aNbPlanes;
324   for (int i = 0; i<aMin; i++) {
325     myPosTable->setText(i, 0, QString::number(myCutPlanes->GetPlanePosition(i)));
326     ((QCheckTableItem*)myPosTable->item( i, 1 ))->setChecked(myCutPlanes->IsDefault(i));
327   }
328
329   QHeader *vh = myPosTable->verticalHeader();
330   QString str("Plane# %1");
331   for (int i=aMin; i<aNbPlanes; i++) {
332     VisuGUI_NumEditItem* aEditItem = new VisuGUI_NumEditItem(myPosTable, 
333                                                              QTableItem::OnTyping, 
334                                                              QString::number(myCutPlanes->GetPlanePosition(i)));
335     aEditItem->setReplaceable(false);
336     aEditItem->setEnabled(!myCutPlanes->IsDefault(i));
337     myPosTable->setItem(i, 0, aEditItem);
338
339     QCheckTableItem* aCheck = new QCheckTableItem(myPosTable, 0);
340     aCheck->setChecked(myCutPlanes->IsDefault(i));
341     aCheck->setReplaceable(false);
342     myPosTable->setItem(i, 1, aCheck);
343     
344     vh->setLabel( i, str.arg(i+1) );
345   }
346
347   // Update preview
348   if (myPreviewCheck->isChecked()) {
349     if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
350       myCutPlanes->GetPL()->Update();
351       deletePlanes();
352       createPlanes();
353       vf->Repaint();
354     }
355   }
356 }
357
358 void VisuGUI_CutPlanesPane::setDefault(int all)
359 {
360   myPosTable->setCurrentCell(-1, 1);
361   myPosTable->clearSelection();
362   if (all == 0) return;
363   if (all == 1)
364     for (int i = 0; i < getNbPlanes(); ++i) 
365       ((QCheckTableItem*)myPosTable->item( i, 1 ))->setChecked(true);
366         
367   for (int i = 0; i < getNbPlanes(); ++i) {
368     if ( ((QCheckTableItem*)myPosTable->item( i, 1 ))->isChecked() ) {
369       myCutPlanes->SetDefault(i);
370       myPosTable->setText( i, 0, QString::number(myCutPlanes->GetPlanePosition(i)));
371       myPosTable->item( i, 0 )->setEnabled(false);
372     } else 
373       myPosTable->item( i, 0 )->setEnabled(true); 
374   }
375 }
376
377 void VisuGUI_CutPlanesPane::onValueChanged(int theRow, int theCol) {
378   if (theCol == 0) {
379     QString aTxt = myPosTable->text(theRow, 0);
380     bool isChanged = !aTxt.isEmpty();
381     ((QCheckTableItem*)myPosTable->item(theRow, 1))->setChecked(!isChanged);
382
383     if (myPreviewCheck->isChecked()) {
384       //Update Preview
385       if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
386         myCutPlanes->SetPlanePosition( theRow, aTxt.toDouble());
387         myCutPlanes->GetPL()->Update();
388         deletePlanes();
389         createPlanes();
390         vf->Repaint();
391       }
392     }
393   } else {
394     bool isDefault = ((QCheckTableItem*)myPosTable->item(theRow, theCol))->isChecked();
395     if (isDefault) {
396       myCutPlanes->SetDefault(theRow);
397       myPosTable->setText(theRow, 0, QString::number(myCutPlanes->GetPlanePosition(theRow)));
398
399       if (myPreviewCheck->isChecked()) {
400         if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
401           //Update Preview
402           myCutPlanes->GetPL()->Update();
403           deletePlanes();
404           createPlanes();
405           vf->Repaint();
406         }
407       }
408     }
409     myPosTable->item(theRow, 0)->setEnabled(!isDefault);
410   }
411 }
412
413
414 void VisuGUI_CutPlanesPane::deletePlanes() {
415   if (myPreviewActor == 0) return;
416   if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy))
417     vf->RemoveActor(myPreviewActor);
418   myPreviewActor->Delete();
419   myPreviewActor = 0;
420 }
421
422 void VisuGUI_CutPlanesPane::onRotation(double theValue) {
423   if (myCutPlanes == NULL) return;
424   if (myPreviewCheck->isChecked()) {
425     if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
426       myCutPlanes->SetOrientation(getOrientaion(),getRotation1()*PI/180.,getRotation2()*PI/180.);
427       myCutPlanes->GetPL()->Update();
428       deletePlanes();
429       createPlanes();  
430       vf->Repaint();  
431     }
432   }
433 }
434
435
436 void VisuGUI_CutPlanesPane::onPreviewCheck(bool thePreview) {
437   if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
438     if (thePreview) {
439       storeToPrsObject(myCutPlanes);
440       myCutPlanes->GetPL()->Update();
441       createPlanes();
442       vf->onViewFitAll();
443     } else {
444       deletePlanes();
445       vf->Repaint();
446     }
447   }
448 }
449
450
451
452
453 //###################################################################
454
455
456
457 /*!
458   Constructor
459 */
460 VisuGUI_CutPlanesDlg::VisuGUI_CutPlanesDlg(bool theIsCreation, bool theIsModal)
461   : QDialog(  QAD_Application::getDesktop(), "VisuGUI_CutPlanesDlg", theIsModal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu/* | WDestructiveClose */),
462     myStudy(QAD_Application::getDesktop()->getActiveStudy())
463 {
464   myStudyFrame = myStudy -> getActiveStudyFrame();
465   if (!theIsModal) {
466     setWFlags(getWFlags() | WDestructiveClose);
467   }
468   setCaption( tr( "Cut Planes Definition" ) );
469   setSizeGripEnabled( TRUE );
470   myIsCreation = theIsCreation;
471
472   QVBoxLayout* TopLayout = new QVBoxLayout( this ); 
473   TopLayout->setSpacing( 6 );
474   TopLayout->setMargin( 11 );
475  
476   QTabWidget* aTabBox = new QTabWidget(this);
477   myCutPane = new  VisuGUI_CutPlanesPane(this, myStudy);
478   aTabBox->addTab(myCutPane, "Cut Planes");
479   myScalarPane = new VisuGUI_ScalarBarPane(this, false);
480   myScalarPane->setMargin( 5 );
481   aTabBox->addTab(myScalarPane, "Scalar Bar");
482
483   TopLayout->addWidget(aTabBox);
484
485   QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
486   GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); 
487   GroupButtons->setTitle( tr( ""  ) );
488   GroupButtons->setColumnLayout(0, Qt::Vertical );
489   GroupButtons->layout()->setSpacing( 0 );
490   GroupButtons->layout()->setMargin( 0 );
491   QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
492   GroupButtonsLayout->setAlignment( Qt::AlignTop );
493   GroupButtonsLayout->setSpacing( 6 );
494   GroupButtonsLayout->setMargin( 11 );
495
496   QPushButton* buttonOk = new QPushButton( tr( "&OK" ), GroupButtons, "buttonOk" );
497   buttonOk->setAutoDefault( TRUE );
498   buttonOk->setDefault( TRUE );
499   GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
500   GroupButtonsLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 1 );
501
502   QPushButton* buttonCancel = new QPushButton( tr( "&Cancel" ), GroupButtons, "buttonCancel" );
503   buttonCancel->setAutoDefault( TRUE );
504   GroupButtonsLayout->addWidget( buttonCancel, 0, 2 );
505
506   TopLayout->addWidget(GroupButtons);
507
508   connect( buttonOk,     SIGNAL( clicked() ), this, SLOT( accept() ) );
509   connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
510   connect( myStudy, SIGNAL(closed()), this, SLOT( reject() ) );
511   connect( myStudyFrame, SIGNAL(sfStudyFrameActivated(QAD_StudyFrame*)), this, SLOT(onFrameActivated(QAD_StudyFrame*)));
512 }
513
514
515 void VisuGUI_CutPlanesDlg::accept() {
516   if (myScalarPane->check()) {
517     if (!isModal()) {
518       if (storeToPrsObject(myPrs)) {
519         if (myIsCreation) { 
520           if (myStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
521             try {
522             visuGUI->CreateActor(myPrs);
523             }
524             catch (...) {
525               reject();
526               return;
527             }
528             GET_VTK_VIEWFRAME(myStudy)->onViewFitAll(); 
529           }
530         } else {
531           visuGUI->RecreateActor(myPrs);
532           if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
533             if ( vf->getRenderer()->GetActors()->GetNumberOfItems () > 0 ) {
534               vf->getRenderer()->ResetCameraClippingRange();
535               vf->Repaint();
536             }
537           }
538         }
539       } else {
540         if (myIsCreation) {
541           visuGUI->DeletePresentation(myPrs);
542         }
543       }
544     }
545     QDialog::accept();
546   }
547 }
548
549 void VisuGUI_CutPlanesDlg::reject() {
550   if (myIsCreation && (!isModal())) {
551     visuGUI->DeletePresentation(myPrs);
552     myStudy -> updateObjBrowser();
553   }
554   QDialog::reject();
555 }
556
557 void VisuGUI_CutPlanesDlg::onFrameActivated( QAD_StudyFrame* theFrame) {
558   if (theFrame != myStudyFrame) 
559     reject();
560 }
561
562 //###################################################################
563
564
565
566 QWidget* VisuGUI_NumEditItem::createEditor() const 
567 {
568   QLineEdit *editline = new QLineEdit(text(), table()->viewport());
569   QDoubleValidator *dvalidator = new QDoubleValidator(table()->viewport());
570   dvalidator->setDecimals(32);
571   editline->setValidator(dvalidator);
572   return editline;
573 }