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