1 // VISU VISUGUI : GUI of VISU component
3 // Copyright (C) 2003 CEA/DEN, EDF R&D
7 // File : VisuGUI_CutLinesDlg.cxx
11 #include "VisuGUI_CutLinesDlg.h"
12 #include "VISU_CutLines_i.hh"
14 #include "VISU_PipeLine.hxx"
15 //#include "VTKViewer_ViewWindow.h"
16 #include "VISU_CutLinesPL.hxx"
17 #include "VISU_Gen_i.hh"
19 #include "SalomeApp_Application.h"
20 #include "SalomeApp_Study.h"
22 #include "SUIT_Desktop.h"
24 #include "OB_Browser.h"
28 #include <qtabwidget.h>
29 #include <qhgroupbox.h>
31 #include <vtkRenderer.h>
32 #include <vtkPolyData.h>
33 #include <vtkAppendPolyData.h>
34 #include <vtkDataSetMapper.h>
38 //extern VisuGUI *visuGUI;
40 //#define GET_VTK_VIEWWINDOW(aMgr) dynamic_cast<VTKViewer_ViewWindow*>(aMgr->getActiveView())
42 bool VisuGUI_CutLinesDlg::MYGenerateTable = true;
43 bool VisuGUI_CutLinesDlg::MYGenerateCurve = true;
45 //SalomeApp_Study* study()
47 // return dynamic_cast<SalomeApp_Study*>(VisuGUI::application()->activeStudy());
50 VisuGUI_CutLinesDlg::VisuGUI_CutLinesDlg (QWidget* parent, bool theIsCreation, bool theIsModal)
51 : QDialog(parent, "VisuGUI_CutLinesDlg", theIsModal, WStyle_Customize |
52 WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
54 //,myMgr(VisuGUI::application()->activeViewManager())
56 //myStudyWnd = myMgr->getActiveView();
58 setWFlags(getWFlags() | WDestructiveClose);
60 setCaption("Cut Lines Definition");
61 setSizeGripEnabled(true);
62 myIsCreation = theIsCreation;
64 QVBoxLayout* aMainLayout = new QVBoxLayout (this, 7, 6);
65 aMainLayout->setSpacing(5);
70 QTabWidget* aTabPane = new QTabWidget(this);
73 QFrame* aPlanePane = new QFrame(this);
74 QVBoxLayout* aPlaneLayout = new QVBoxLayout(aPlanePane, 5, 6);
76 mySelPlane = new QHButtonGroup( tr( "TXT_ORIENTATION" ), aPlanePane);
77 mySelPlane->setInsideSpacing( 5 );
78 mySelPlane->setInsideMargin( 5 );
80 QRadioButton* aBxy = new QRadioButton( tr( "PARALLEL_XOY" ), mySelPlane); // 0
81 QRadioButton* aByz = new QRadioButton( tr( "PARALLEL_YOZ" ), mySelPlane); // 1
82 QRadioButton* aBzx = new QRadioButton( tr( "PARALLEL_ZOX" ), mySelPlane); // 2
83 aBzx->setChecked(true);
85 aPlaneLayout->addWidget( mySelPlane );
87 QGroupBox* aRotBox = new QGroupBox( tr( "LBL_ROTATION" ), aPlanePane );
88 aRotBox->setColumnLayout(2, Qt::Horizontal );
90 myRotXLbl = new QLabel( tr( "LBL_ROT_X" ), aRotBox);
91 myRotXSpn = new QtxDblSpinBox( -45, 45, 5, aRotBox );
92 myRotXSpn->setValue( 0 );
93 myRotYLbl = new QLabel( tr( "LBL_ROT_Y" ), aRotBox );
94 myRotYSpn = new QtxDblSpinBox( -45, 45, 5, aRotBox );
95 myRotYSpn->setValue( 0 );
97 aPlaneLayout->addWidget( aRotBox );
99 QHGroupBox* aBaseBox = new QHGroupBox (tr("BASE_PLANE_POS"), aPlanePane);
100 myBasePlanePos = new QLineEdit (aBaseBox);
101 mydvalidator = new QDoubleValidator(this);
102 mydvalidator->setDecimals(32);
103 myBasePlanePos->setValidator(mydvalidator);
105 myCBSetDef = new QCheckBox (tr("SET_DEFAULT"),aBaseBox);
107 aPlaneLayout->addWidget(aBaseBox);
109 QHBox* aPosBox = new QHBox (aPlanePane);
110 aPosBox->setSpacing(5);
111 QLabel* aPosLbl = new QLabel (tr("LBL_POS"), aPosBox);
112 myPosSpn = new QtxDblSpinBox (0, 1, 0.1, aPosBox);
113 myPosSpn->setValue(0.5);
114 aPlaneLayout->addWidget(aPosBox);
116 myPreviewCheck = new QCheckBox (tr("LBL_SHOW_PREVIEW"), aPlanePane);
117 myPreviewCheck->setChecked(false);
118 aPlaneLayout->addWidget(myPreviewCheck);
120 myCreateTable = new QCheckBox (tr("LBL_GENERATE_TABLE"), aPlanePane);
121 myCreateTable->setChecked(MYGenerateTable);
122 aPlaneLayout->addWidget( myCreateTable );
124 QHBox* aCheckPane = new QHBox(aPlanePane);
125 QLabel* aLbl = new QLabel(" ", aCheckPane);
126 aCheckPane->setStretchFactor(aLbl, 0);
127 myCurvesCheck = new QCheckBox(tr("LBL_GENERATE_CURVES"), aCheckPane);
128 aCheckPane->setStretchFactor(aCheckPane, 0);
129 myCurvesCheck->setChecked(MYGenerateCurve);
130 myCurvesCheck->setEnabled(MYGenerateTable);
131 QLabel* aLbl2 = new QLabel(" ", aCheckPane);
132 aCheckPane->setStretchFactor(aLbl2, 1);
133 aPlaneLayout->addWidget( aCheckPane );
135 aPlaneLayout->addStretch();
138 aTabPane->addTab( aPlanePane, tr("LBL_LINES_PLANE") );
141 QFrame* aLinesPane = new QFrame(this);
142 QVBoxLayout* aLinesLayout = new QVBoxLayout( aLinesPane, 5, 6 );
144 mySelPlane2 = new QHButtonGroup( tr( "TXT_ORIENTATION" ), aLinesPane);
145 mySelPlane2->setInsideSpacing( 5 );
146 mySelPlane2->setInsideMargin( 5 );
148 QRadioButton* aBxy2 = new QRadioButton( tr( "PARALLEL_XOY" ), mySelPlane2); // 0
149 QRadioButton* aByz2 = new QRadioButton( tr( "PARALLEL_YOZ" ), mySelPlane2); // 1
150 QRadioButton* aBzx2 = new QRadioButton( tr( "PARALLEL_ZOX" ), mySelPlane2); // 2
151 aBzx2->setEnabled(false);
152 aByz2->setChecked(true);
153 aLinesLayout->addWidget( mySelPlane2 );
155 QGroupBox* aRotBox2 = new QGroupBox( tr( "LBL_ROTATION" ), aLinesPane );
156 aRotBox2->setColumnLayout(2, Qt::Horizontal );
158 myRotXLbl2 = new QLabel( tr( "LBL_ROT_X" ), aRotBox2);
159 myRotXSpn2 = new QtxDblSpinBox( -45, 45, 5, aRotBox2 );
160 myRotXSpn2->setValue( 0 );
161 myRotYLbl2 = new QLabel( tr( "LBL_ROT_Y" ), aRotBox2 );
162 myRotYSpn2 = new QtxDblSpinBox( -45, 45, 5, aRotBox2 );
163 myRotYSpn2->setValue( 0 );
164 aLinesLayout->addWidget( aRotBox2 );
166 QHBox* aNbBox = new QHBox(aLinesPane);
167 aNbBox->setSpacing(5);
168 QLabel* aNbLbl = new QLabel( tr( "LBL_NB_PLANS" ), aNbBox );
169 myNbSpn = new QtxDblSpinBox( 1, 100, 1, aNbBox );
170 myNbSpn->setValue( 10 );
172 aLinesLayout->addWidget( aNbBox );
174 myPosTable = new QTable(aLinesPane, "Positions of cut planes" );
175 myPosTable->setMaximumHeight( 227 );
176 myPosTable->setMinimumWidth( 294 );
177 myPosTable->setNumCols(2);
178 myPosTable->setNumRows(0);
180 QHeader *th = myPosTable->horizontalHeader();
181 th->setLabel( 0, "Position" );
182 th->setLabel( 1, "Set default" );
184 aLinesLayout->addWidget( myPosTable );
186 QHBox* aPosBox2 = new QHBox(aLinesPane);
187 aPosBox2->setSpacing(5);
188 QLabel* aPosLbl2 = new QLabel( tr( "LBL_POS" ), aPosBox2 );
189 myPosSpn2 = new QtxDblSpinBox( 0, 1, 0.1, aPosBox2 );
190 myPosSpn2->setValue( 0.5 );
191 aLinesLayout->addWidget( aPosBox2 );
192 aLinesLayout->addStretch();
194 aTabPane->addTab( aLinesPane, tr("LBL_LINES_CUT") );
196 myScalarPane = new VisuGUI_ScalarBarPane(this, false);
197 myScalarPane->setMargin( 5 );
198 aTabPane->addTab(myScalarPane, "Scalar Bar");
200 aMainLayout->addWidget(aTabPane);
203 QHBox* aBtnBox = new QHBox(this);
204 aBtnBox->setFrameStyle(QFrame::Box | QFrame::Sunken);
205 aBtnBox->setLineWidth( 1 );
206 QHBoxLayout* aBtnLayout = (QHBoxLayout*) aBtnBox->layout();
207 aBtnLayout->setAutoAdd( false );
208 aBtnLayout->setSpacing( 5 );
209 aBtnLayout->setMargin( 11 );
211 QPushButton* aOkBtn = new QPushButton (tr("BUT_OK"), aBtnBox);
212 aOkBtn->setAutoDefault( TRUE );
213 aOkBtn->setDefault( true );
214 aBtnLayout->addWidget(aOkBtn);
216 aBtnLayout->addStretch();
218 QPushButton* aCloseBtn = new QPushButton(tr("BUT_CANCEL"), aBtnBox);
219 aBtnLayout->addWidget(aCloseBtn);
221 aMainLayout->addWidget(aBtnBox);
225 // signals and slots connections
226 connect(mySelPlane , SIGNAL(clicked(int)) , this, SLOT(onPlaneSelect(int)));
227 connect(myCBSetDef , SIGNAL(toggled(bool)) , this, SLOT(setBaseDefault()));
228 connect(myPosSpn , SIGNAL(valueChanged(double)) , this, SLOT(setBaseDefault()));
229 connect(mySelPlane2 , SIGNAL(clicked(int)) , this, SLOT(onCutSelect(int)));
230 connect(myNbSpn , SIGNAL(valueChanged(double)) , this, SLOT(DrawTable()));
231 connect(th , SIGNAL(clicked(int)) , this, SLOT(setDefault(int)));
232 connect(myPosSpn2 , SIGNAL(valueChanged(double)) , this, SLOT(DrawTable()));
233 connect(myPreviewCheck, SIGNAL(toggled(bool)) , this, SLOT(onPreviewCheck(bool)));
234 connect(myPosTable , SIGNAL(valueChanged(int, int)), this, SLOT(onValueChanged(int, int)));
235 connect(myRotXSpn , SIGNAL(valueChanged(double)) , this, SLOT(onRotation(double)));
236 connect(myRotYSpn , SIGNAL(valueChanged(double)) , this, SLOT(onRotation(double)));
237 connect(myRotXSpn2 , SIGNAL(valueChanged(double)) , this, SLOT(onRotation(double)));
238 connect(myRotYSpn2 , SIGNAL(valueChanged(double)) , this, SLOT(onRotation(double)));
239 connect(myBasePlanePos, SIGNAL(textChanged(const QString&)), this, SLOT(onPlanePos(const QString&)));
240 connect(myCreateTable , SIGNAL(toggled(bool)), myCurvesCheck, SLOT(setEnabled(bool)));
242 connect(aOkBtn, SIGNAL(clicked()), this, SLOT(accept()));
243 connect(aCloseBtn, SIGNAL(clicked()), this, SLOT(reject()));
244 //connect(myMgr, SIGNAL(closeAllViews()), this, SLOT(reject()));
245 //connect(VisuGUI::application()->desktop(),
246 // SIGNAL(windowActivated(SUIT_ViewWindow*)),
247 // this, SLOT(onWindowActivated(SUIT_ViewWindow*)));
253 VisuGUI_CutLinesDlg::~VisuGUI_CutLinesDlg()
256 if (myCutLines) delete myCutLines;
257 //jfa tmp:if (VTKViewer_ViewWindow* vf = GET_VTK_VIEWWINDOW(myMgr))
258 //jfa tmp: vf->Repaint();
261 //------------------------------------------------------------------------------
262 void VisuGUI_CutLinesDlg::initFromPrsObject (VISU::CutLines_i* thePrs)
265 myScalarPane->initFromPrsObject(thePrs);
267 myRotXSpn->setValue(thePrs->GetRotateX()*180./PI);
268 myRotYSpn->setValue(thePrs->GetRotateY()*180./PI);
269 myPosSpn->setValue(thePrs->GetDisplacement());
270 setOrientation(thePrs->GetOrientationType());
272 myNbSpn->setValue( (int)thePrs->GetNbLines() );
273 myRotXSpn2->setValue(thePrs->GetRotateX2()*180./PI);
274 myRotYSpn2->setValue(thePrs->GetRotateY2()*180./PI);
275 myPosSpn2->setValue(thePrs->GetDisplacement2());
276 setOrientation2(thePrs->GetOrientationType2());
279 myCutLines = new VISU::CutLines_i(thePrs->GetResult(),false);
280 myCutLines->SameAs(thePrs);
281 myBasePlanePos->setText( QString::number(myCutLines->GetBasePlanePosition()) );
282 myCBSetDef->setChecked(thePrs->IsDefault());
286 if (myPreviewCheck->isChecked()) {
291 //------------------------------------------------------------------------------
292 int VisuGUI_CutLinesDlg::storeToPrsObject (VISU::CutLines_i* thePrs)
294 myScalarPane->storeToPrsObject(thePrs);
296 thePrs->SetOrientation(getOrientaion(),
297 myRotXSpn->value()*PI/180.,
298 myRotYSpn->value()*PI/180.);
299 thePrs->SetDisplacement(myPosSpn->value());
300 thePrs->SetNbLines((int)myNbSpn->value());
302 thePrs->SetOrientation2(getOrientaion(false),
303 myRotXSpn2->value()*PI/180.,
304 myRotYSpn2->value()*PI/180.);
305 thePrs->SetDisplacement2(myPosSpn2->value());
307 if (!myCBSetDef->isChecked())
308 thePrs->SetBasePlanePosition(myBasePlanePos->text().toDouble());
309 else thePrs->SetDefault();
311 for (int i = 0; i < (int)myNbSpn->value(); ++i) {
312 if (!((QCheckTableItem*)myPosTable->item( i, 1 ))->isChecked())
313 thePrs->SetLinePosition( i, myPosTable->text( i, 0 ).toDouble() );
314 else thePrs->SetDefaultPosition(i);
319 //------------------------------------------------------------------------------
320 void VisuGUI_CutLinesDlg::createPlanes()
322 //jfa tmp:if (GET_VTK_VIEWWINDOW(myMgr) == NULL)
324 if (myCutLines == NULL) return;
325 if (myPreviewActor != 0) return;
327 vtkAppendPolyData* aPolyData = myCutLines->GetCutLinesPL()->GetAppendPolyData();
328 vtkDataSetMapper* aPlaneMapper = vtkDataSetMapper::New();
329 aPlaneMapper->SetInput(aPolyData->GetOutput());
330 aPlaneMapper->ScalarVisibilityOff();
332 myPreviewActor = SALOME_Actor::New();
333 myPreviewActor->PickableOff();
334 myPreviewActor->SetMapper(aPlaneMapper);
335 aPlaneMapper->Delete();
336 //jfa tmp:GET_VTK_VIEWWINDOW(myMgr)->AddActor(myPreviewActor);
339 //------------------------------------------------------------------------------
340 void VisuGUI_CutLinesDlg::deletePlanes()
342 if (myPreviewActor == 0) return;
343 //jfa tmp:if (VTKViewer_ViewWindow* vf = GET_VTK_VIEWWINDOW(myMgr))
344 //jfa tmp: vf->RemoveActor(myPreviewActor);
345 myPreviewActor->Delete();
350 //------------------------------------------------------------------------------
351 void VisuGUI_CutLinesDlg::onPlaneSelect (int theId)
353 for (int i = 0; i < mySelPlane2->count(); i++)
354 mySelPlane2->find(i)->setEnabled(true);
355 QButton* aBtn = mySelPlane2->find(theId);
356 aBtn->setEnabled(false);
359 myRotXLbl->setText( tr("LBL_ROT_X"));
360 myRotYLbl->setText( tr("LBL_ROT_Y"));
361 ((QRadioButton*)mySelPlane2->find(1))->setChecked(true);
362 onCutSelect(1, false);
365 myRotXLbl->setText( tr("LBL_ROT_Y"));
366 myRotYLbl->setText( tr("LBL_ROT_Z"));
367 ((QRadioButton*)mySelPlane2->find(2))->setChecked(true);
368 onCutSelect(2, false);
371 myRotXLbl->setText( tr("LBL_ROT_Z"));
372 myRotYLbl->setText( tr("LBL_ROT_X"));
373 ((QRadioButton*)mySelPlane2->find(0))->setChecked(true);
374 onCutSelect(0, false);
376 setBaseDefault(false);
380 //------------------------------------------------------------------------------
381 void VisuGUI_CutLinesDlg::onCutSelect (int theId, bool theUpdate)
385 myRotXLbl2->setText( tr("LBL_ROT_X"));
386 myRotYLbl2->setText( tr("LBL_ROT_Y"));
389 myRotXLbl2->setText( tr("LBL_ROT_Y"));
390 myRotYLbl2->setText( tr("LBL_ROT_Z"));
393 myRotXLbl2->setText( tr("LBL_ROT_Z"));
394 myRotYLbl2->setText( tr("LBL_ROT_X"));
396 //jfa tmp:if (VTKViewer_ViewWindow* vf = GET_VTK_VIEWWINDOW(myMgr)) {
397 if (theUpdate && myPreviewCheck->isChecked() && (myCutLines != NULL)) {
398 myCutLines->SetOrientation2(getOrientaion(false),
399 myRotXSpn2->value()*PI/180.,
400 myRotYSpn2->value()*PI/180.);
401 myCutLines->SetDisplacement2(myPosSpn2->value());
402 myCutLines->GetPL()->Update();
405 //jfa tmp:vf->Repaint();
410 //------------------------------------------------------------------------------
411 void VisuGUI_CutLinesDlg::setBaseDefault (bool theUpdate)
413 if (!hasInit) return;
415 if (myCBSetDef->isChecked()) {
416 if (!myCutLines->IsDefault()) myCutLines->SetDefault();
417 myCutLines->SetOrientation(getOrientaion(),
418 myRotXSpn->value()*PI/180.,
419 myRotYSpn->value()*PI/180.);
420 myCutLines->SetDisplacement(myPosSpn->value());
421 float aPos = myCutLines->GetBasePlanePosition();
422 myBasePlanePos->setText( QString::number(aPos) );
423 myBasePlanePos->setEnabled(false);
424 //jfa tmp:if (VTKViewer_ViewWindow* vf = GET_VTK_VIEWWINDOW(myMgr)) {
425 if (theUpdate && myPreviewCheck->isChecked() && (myCutLines != NULL)) {
426 myCutLines->SetBasePlanePosition(aPos);
427 myCutLines->GetPL()->Update();
430 //jfa tmp:vf->Repaint();
434 myBasePlanePos->setEnabled(true);
438 //------------------------------------------------------------------------------
439 void VisuGUI_CutLinesDlg::DrawTable()
441 if (!hasInit) return;
443 int aNbRows = myPosTable->numRows();
444 int aNbPlanes = (int)myNbSpn->value();
446 myCutLines->SetOrientation(getOrientaion(),
447 myRotXSpn->value()*PI/180.,
448 myRotYSpn->value()*PI/180.);
450 myCutLines->SetNbLines(aNbPlanes);
451 myCutLines->SetDisplacement2(myPosSpn2->value());
452 myCutLines->SetOrientation2(getOrientaion(false),
453 myRotXSpn2->value()*PI/180.,
454 myRotYSpn2->value()*PI/180.);
457 for (int i = 0; i < aNbRows; ++i) {
458 QCheckTableItem* aItem = (QCheckTableItem*)myPosTable->item( i, 1 );
459 if (aItem == 0) break;
460 if (!aItem->isChecked())
461 myCutLines->SetLinePosition(i, myPosTable->text(i, 0).toDouble());
464 if (aNbPlanes > aNbRows)
465 myPosTable->insertRows(aNbRows, aNbPlanes - aNbRows );
466 else if (aNbPlanes < aNbRows)
467 myPosTable->setNumRows(aNbPlanes);
469 int aMin = (aNbRows < aNbPlanes)? aNbRows : aNbPlanes;
470 for (int i = 0; i<aMin; i++) {
471 myPosTable->setText(i, 0, QString::number(myCutLines->GetLinePosition(i)));
472 ((QCheckTableItem*)myPosTable->item( i, 1 ))->setChecked(myCutLines->IsDefaultPosition(i));
475 QHeader *vh = myPosTable->verticalHeader();
476 QString str("Plane# %1");
477 for (int i=aMin; i<aNbPlanes; i++) {
478 VisuGUI_NumEditItem* aEditItem = new VisuGUI_NumEditItem
479 (myPosTable, QTableItem::OnTyping, QString::number(myCutLines->GetLinePosition(i)));
480 aEditItem->setReplaceable(false);
481 aEditItem->setEnabled(!myCutLines->IsDefaultPosition(i));
482 myPosTable->setItem(i, 0, aEditItem);
484 QCheckTableItem* aCheck = new QCheckTableItem(myPosTable, 0);
485 aCheck->setChecked(myCutLines->IsDefaultPosition(i));
486 aCheck->setReplaceable(false);
487 myPosTable->setItem(i, 1, aCheck);
489 vh->setLabel( i, str.arg(i+1) );
492 //jfa tmp:if (VTKViewer_ViewWindow* vf = GET_VTK_VIEWWINDOW(myMgr)) {
493 if (myPreviewCheck->isChecked()) {
494 myCutLines->GetPL()->Update();
497 //jfa tmp:vf->Repaint();
502 //------------------------------------------------------------------------------
503 void VisuGUI_CutLinesDlg::setDefault (int all)
505 myPosTable->setCurrentCell(-1, 1);
506 myPosTable->clearSelection();
507 if (all == 0) return;
509 for (int i = 0; i < (int)myNbSpn->value(); ++i)
510 ((QCheckTableItem*)myPosTable->item( i, 1 ))->setChecked(true);
512 for (int i = 0; i < (int)myNbSpn->value(); ++i) {
513 if ( ((QCheckTableItem*)myPosTable->item( i, 1 ))->isChecked() ) {
514 myCutLines->SetDefaultPosition(i);
515 myPosTable->setText( i, 0, QString::number(myCutLines->GetLinePosition(i)));
516 myPosTable->item( i, 0 )->setEnabled(false);
518 myPosTable->item( i, 0 )->setEnabled(true);
522 //------------------------------------------------------------------------------
523 VISU::CutPlanes::Orientation VisuGUI_CutLinesDlg::getOrientaion (bool IsBasePlane)
532 VISU::CutPlanes::Orientation orient;
533 switch (aBG->id(aBG->selected())) {
535 orient = VISU::CutPlanes::XY;
538 orient = VISU::CutPlanes::YZ;
541 orient = VISU::CutPlanes::ZX;
546 //------------------------------------------------------------------------------
547 void VisuGUI_CutLinesDlg::setOrientation (const VISU::CutPlanes::Orientation orient)
550 case VISU::CutPlanes::XY:
551 ((QRadioButton*)mySelPlane->find(0))->setChecked(true);
554 case VISU::CutPlanes::YZ:
555 ((QRadioButton*)mySelPlane->find(1))->setChecked(true);
558 case VISU::CutPlanes::ZX:
559 ((QRadioButton*)mySelPlane->find(2))->setChecked(true);
564 //------------------------------------------------------------------------------
565 void VisuGUI_CutLinesDlg::setOrientation2 (const VISU::CutPlanes::Orientation orient)
568 case VISU::CutPlanes::XY:
569 ((QRadioButton*)mySelPlane2->find(0))->setChecked(true);
572 case VISU::CutPlanes::YZ:
573 ((QRadioButton*)mySelPlane2->find(1))->setChecked(true);
576 case VISU::CutPlanes::ZX:
577 ((QRadioButton*)mySelPlane2->find(2))->setChecked(true);
582 void VisuGUI_CutLinesDlg::onValueChanged (int theRow, int theCol)
585 QString aTxt = myPosTable->text(theRow, 0);
586 bool isChanged = !aTxt.isEmpty();
587 ((QCheckTableItem*)myPosTable->item(theRow, 1))->setChecked(!isChanged);
589 //jfa tmp:if (VTKViewer_ViewWindow* vf = GET_VTK_VIEWWINDOW(myMgr)) {
590 if (myPreviewCheck->isChecked()) {
592 myCutLines->SetLinePosition( theRow, aTxt.toDouble());
593 myCutLines->GetPL()->Update();
596 //jfa tmp:vf->Repaint();
600 bool isDefault = ((QCheckTableItem*)myPosTable->item(theRow, theCol))->isChecked();
602 myCutLines->SetDefaultPosition(theRow);
603 myPosTable->setText(theRow, 0, QString::number(myCutLines->GetLinePosition(theRow)));
605 //jfa tmp:if (VTKViewer_ViewWindow* vf = GET_VTK_VIEWWINDOW(myMgr)) {
606 if (myPreviewCheck->isChecked()) {
608 myCutLines->GetPL()->Update();
611 //jfa tmp:vf->Repaint();
615 myPosTable->item(theRow, 0)->setEnabled(!isDefault);
619 void VisuGUI_CutLinesDlg::accept()
621 MYGenerateTable = myCreateTable->isChecked();
622 MYGenerateCurve = myCurvesCheck->isChecked();
623 if (myScalarPane->check()) {
624 /*((QWidget*)sender())->setDisabled(true);
625 storeToPrsObject(myPrs);
627 jfa tmp:if (isGenerateTable()) {
628 visuGUI->GetVisuGen()->CreateTable(myPrs->GetEntry());
629 if (isGenerateCurves()) {
630 SALOMEDSClient_Study* aStudy = study()->studyDS();
631 SALOMEDSClient_SObject* aSObject = aStudy->FindObjectID(myPrs->GetEntry());
633 SALOMEDSClient_ChildIterator* aIter = aStudy->NewChildIterator( aSObject );
634 SALOMEDSClient_StudyBuilder* aBuilder = aStudy->NewBuilder();
635 for ( ;aIter->More(); aIter->Next()) {
636 SALOMEDSClient_SObject* aTblObj = aIter->Value();
638 SALOMEDSClient_GenericAttribute* anAttr;
639 if (aTblObj->FindAttribute(anAttr, "AttributeName")) {
640 visuGUI->CreatePlot(aTblObj);
647 if (GET_VTK_VIEWWINDOW(myMgr)) {
649 visuGUI->CreateActor(myPrs);
654 GET_VTK_VIEWWINDOW(myMgr)->onFitAll();
657 visuGUI->RecreateActor(myPrs);
658 if (VTKViewer_ViewWindow* vf = GET_VTK_VIEWWINDOW(myMgr)) {
659 if (vf->getRenderer()->GetActors()->GetNumberOfItems() > 0) {
660 vf->getRenderer()->ResetCameraClippingRange();
665 SALOMEDSClient_Study* aStudy = study()->studyDS();
666 SALOMEDSClient_SObject* aSObject = aStudy->FindObjectID(myPrs->GetEntry());
668 SALOMEDSClient_ChildIterator* aIter = aStudy->NewChildIterator( aSObject );
669 SALOMEDSClient_StudyBuilder* aBuilder = aStudy->NewBuilder();
670 for ( ;aIter->More(); aIter->Next()) {
671 SALOMEDSClient_SObject* aTblObj = aIter->Value();
673 SALOMEDSClient_GenericAttribute* anAttr;
674 if (aTblObj->FindAttribute(anAttr, "AttributeName")) {
675 aBuilder->RemoveObjectWithChildren(aIter->Value()); // We should have only one child
680 if (isGenerateTable()) {
681 visuGUI->GetVisuGen()->CreateTable(aSObject->GetID().c_str());
682 if (isGenerateCurves()) {
683 SALOMEDSClient_Study* aStudy = study()->studyDS();
684 SALOMEDSClient_ChildIterator* aIter = aStudy->NewChildIterator( aSObject );
685 SALOMEDSClient_StudyBuilder* aBuilder = aStudy->NewBuilder();
686 for ( ;aIter->More(); aIter->Next()) {
687 SALOMEDSClient_SObject* aTblObj = aIter->Value();
689 SALOMEDSClient_GenericAttribute* anAttr;
690 if (aTblObj->FindAttribute(anAttr, "AttributeName")) {
691 visuGUI->CreatePlot(aTblObj);
699 VisuGUI::application()->objectBrowser()->updateTree();*/
704 void VisuGUI_CutLinesDlg::reject()
706 /*if (myIsCreation) {
707 visuGUI->DeletePresentation(myPrs);
708 VisuGUI::application()->objectBrowser()->updateTree();
713 void VisuGUI_CutLinesDlg::onPreviewCheck (bool thePreview)
715 /*jfa tmp:if (VTKViewer_ViewWindow* vf = GET_VTK_VIEWWINDOW(myMgr)) {
717 storeToPrsObject(myCutLines);
718 myCutLines->GetPL()->Update();
728 void VisuGUI_CutLinesDlg::onRotation (double theValue)
730 if (myCutLines == NULL) return;
731 //jfa tmp:if (VTKViewer_ViewWindow* vf = GET_VTK_VIEWWINDOW(myMgr)) {
732 if (myPreviewCheck->isChecked()) {
733 myCutLines->SetOrientation(getOrientaion(),
734 myRotXSpn->value()*PI/180.,
735 myRotYSpn->value()*PI/180.);
736 myCutLines->SetOrientation2(getOrientaion(false),
737 myRotXSpn2->value()*PI/180.,
738 myRotYSpn2->value()*PI/180.);
739 myCutLines->GetPL()->Update();
742 //jfa tmp:vf->Repaint();
747 void VisuGUI_CutLinesDlg::onPlanePos (const QString& theValue)
749 if (myCutLines == NULL) return;
750 //jfa tmp:if (VTKViewer_ViewWindow* vf = GET_VTK_VIEWWINDOW(myMgr)) {
751 if (myPreviewCheck->isChecked()) {
752 myCutLines->SetBasePlanePosition(theValue.toDouble());
753 myCutLines->GetPL()->Update();
756 //jfa tmp:vf->Repaint();
761 //jfa tmp:void VisuGUI_CutLinesDlg::onWindowActivated (SUIT_ViewWindow* theWnd)
763 //jfa tmp: if (theWnd != myStudyWnd)