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"
15 #include "VISU_Gen_i.hh"
16 #include "VISU_CutLines_i.hh"
18 #include "VISU_PipeLine.hxx"
19 #include "VISU_CutLinesPL.hxx"
21 #include "SalomeApp_Application.h"
22 #include "SalomeApp_Study.h"
24 #include "SUIT_Desktop.h"
26 #include "OB_Browser.h"
30 #include <qtabwidget.h>
31 #include <qhgroupbox.h>
33 #include <vtkRenderer.h>
34 #include <vtkPolyData.h>
35 #include <vtkAppendPolyData.h>
36 #include <vtkDataSetMapper.h>
40 //extern VisuGUI *visuGUI;
42 //#define GET_VTK_VIEWWINDOW(aMgr) dynamic_cast<VTKViewer_ViewWindow*>(aMgr->getActiveView())
44 bool VisuGUI_CutLinesDlg::MYGenerateTable = true;
45 bool VisuGUI_CutLinesDlg::MYGenerateCurve = true;
47 //SalomeApp_Study* study()
49 // return dynamic_cast<SalomeApp_Study*>(VisuGUI::application()->activeStudy());
52 VisuGUI_CutLinesDlg::VisuGUI_CutLinesDlg (QWidget* parent, bool theIsCreation, bool theIsModal)
53 : QDialog(parent, "VisuGUI_CutLinesDlg", theIsModal, WStyle_Customize |
54 WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
56 //,myMgr(VisuGUI::application()->activeViewManager())
58 //myStudyWnd = myMgr->getActiveView();
60 setWFlags(getWFlags() | WDestructiveClose);
62 setCaption("Cut Lines Definition");
63 setSizeGripEnabled(true);
64 myIsCreation = theIsCreation;
66 QVBoxLayout* aMainLayout = new QVBoxLayout (this, 7, 6);
67 aMainLayout->setSpacing(5);
72 QTabWidget* aTabPane = new QTabWidget(this);
75 QFrame* aPlanePane = new QFrame(this);
76 QVBoxLayout* aPlaneLayout = new QVBoxLayout(aPlanePane, 5, 6);
78 mySelPlane = new QHButtonGroup( tr( "TXT_ORIENTATION" ), aPlanePane);
79 mySelPlane->setInsideSpacing( 5 );
80 mySelPlane->setInsideMargin( 5 );
82 QRadioButton* aBxy = new QRadioButton( tr( "PARALLEL_XOY" ), mySelPlane); // 0
83 QRadioButton* aByz = new QRadioButton( tr( "PARALLEL_YOZ" ), mySelPlane); // 1
84 QRadioButton* aBzx = new QRadioButton( tr( "PARALLEL_ZOX" ), mySelPlane); // 2
85 aBzx->setChecked(true);
87 aPlaneLayout->addWidget( mySelPlane );
89 QGroupBox* aRotBox = new QGroupBox( tr( "LBL_ROTATION" ), aPlanePane );
90 aRotBox->setColumnLayout(2, Qt::Horizontal );
92 myRotXLbl = new QLabel( tr( "LBL_ROT_X" ), aRotBox);
93 myRotXSpn = new QtxDblSpinBox( -45, 45, 5, aRotBox );
94 myRotXSpn->setValue( 0 );
95 myRotYLbl = new QLabel( tr( "LBL_ROT_Y" ), aRotBox );
96 myRotYSpn = new QtxDblSpinBox( -45, 45, 5, aRotBox );
97 myRotYSpn->setValue( 0 );
99 aPlaneLayout->addWidget( aRotBox );
101 QHGroupBox* aBaseBox = new QHGroupBox (tr("BASE_PLANE_POS"), aPlanePane);
102 myBasePlanePos = new QLineEdit (aBaseBox);
103 mydvalidator = new QDoubleValidator(this);
104 mydvalidator->setDecimals(32);
105 myBasePlanePos->setValidator(mydvalidator);
107 myCBSetDef = new QCheckBox (tr("SET_DEFAULT"),aBaseBox);
109 aPlaneLayout->addWidget(aBaseBox);
111 QHBox* aPosBox = new QHBox (aPlanePane);
112 aPosBox->setSpacing(5);
113 QLabel* aPosLbl = new QLabel (tr("LBL_POS"), aPosBox);
114 myPosSpn = new QtxDblSpinBox (0, 1, 0.1, aPosBox);
115 myPosSpn->setValue(0.5);
116 aPlaneLayout->addWidget(aPosBox);
118 myPreviewCheck = new QCheckBox (tr("LBL_SHOW_PREVIEW"), aPlanePane);
119 myPreviewCheck->setChecked(false);
120 aPlaneLayout->addWidget(myPreviewCheck);
122 myCreateTable = new QCheckBox (tr("LBL_GENERATE_TABLE"), aPlanePane);
123 myCreateTable->setChecked(MYGenerateTable);
124 aPlaneLayout->addWidget( myCreateTable );
126 QHBox* aCheckPane = new QHBox(aPlanePane);
127 QLabel* aLbl = new QLabel(" ", aCheckPane);
128 aCheckPane->setStretchFactor(aLbl, 0);
129 myCurvesCheck = new QCheckBox(tr("LBL_GENERATE_CURVES"), aCheckPane);
130 aCheckPane->setStretchFactor(aCheckPane, 0);
131 myCurvesCheck->setChecked(MYGenerateCurve);
132 myCurvesCheck->setEnabled(MYGenerateTable);
133 QLabel* aLbl2 = new QLabel(" ", aCheckPane);
134 aCheckPane->setStretchFactor(aLbl2, 1);
135 aPlaneLayout->addWidget( aCheckPane );
137 aPlaneLayout->addStretch();
140 aTabPane->addTab( aPlanePane, tr("LBL_LINES_PLANE") );
143 QFrame* aLinesPane = new QFrame(this);
144 QVBoxLayout* aLinesLayout = new QVBoxLayout( aLinesPane, 5, 6 );
146 mySelPlane2 = new QHButtonGroup( tr( "TXT_ORIENTATION" ), aLinesPane);
147 mySelPlane2->setInsideSpacing( 5 );
148 mySelPlane2->setInsideMargin( 5 );
150 QRadioButton* aBxy2 = new QRadioButton( tr( "PARALLEL_XOY" ), mySelPlane2); // 0
151 QRadioButton* aByz2 = new QRadioButton( tr( "PARALLEL_YOZ" ), mySelPlane2); // 1
152 QRadioButton* aBzx2 = new QRadioButton( tr( "PARALLEL_ZOX" ), mySelPlane2); // 2
153 aBzx2->setEnabled(false);
154 aByz2->setChecked(true);
155 aLinesLayout->addWidget( mySelPlane2 );
157 QGroupBox* aRotBox2 = new QGroupBox( tr( "LBL_ROTATION" ), aLinesPane );
158 aRotBox2->setColumnLayout(2, Qt::Horizontal );
160 myRotXLbl2 = new QLabel( tr( "LBL_ROT_X" ), aRotBox2);
161 myRotXSpn2 = new QtxDblSpinBox( -45, 45, 5, aRotBox2 );
162 myRotXSpn2->setValue( 0 );
163 myRotYLbl2 = new QLabel( tr( "LBL_ROT_Y" ), aRotBox2 );
164 myRotYSpn2 = new QtxDblSpinBox( -45, 45, 5, aRotBox2 );
165 myRotYSpn2->setValue( 0 );
166 aLinesLayout->addWidget( aRotBox2 );
168 QHBox* aNbBox = new QHBox(aLinesPane);
169 aNbBox->setSpacing(5);
170 QLabel* aNbLbl = new QLabel( tr( "LBL_NB_PLANS" ), aNbBox );
171 myNbSpn = new QtxDblSpinBox( 1, 100, 1, aNbBox );
172 myNbSpn->setValue( 10 );
174 aLinesLayout->addWidget( aNbBox );
176 myPosTable = new QTable(aLinesPane, "Positions of cut planes" );
177 myPosTable->setMaximumHeight( 227 );
178 myPosTable->setMinimumWidth( 294 );
179 myPosTable->setNumCols(2);
180 myPosTable->setNumRows(0);
182 QHeader *th = myPosTable->horizontalHeader();
183 th->setLabel( 0, "Position" );
184 th->setLabel( 1, "Set default" );
186 aLinesLayout->addWidget( myPosTable );
188 QHBox* aPosBox2 = new QHBox(aLinesPane);
189 aPosBox2->setSpacing(5);
190 QLabel* aPosLbl2 = new QLabel( tr( "LBL_POS" ), aPosBox2 );
191 myPosSpn2 = new QtxDblSpinBox( 0, 1, 0.1, aPosBox2 );
192 myPosSpn2->setValue( 0.5 );
193 aLinesLayout->addWidget( aPosBox2 );
194 aLinesLayout->addStretch();
196 aTabPane->addTab( aLinesPane, tr("LBL_LINES_CUT") );
198 myScalarPane = new VisuGUI_ScalarBarPane(this, false);
199 myScalarPane->setMargin( 5 );
200 aTabPane->addTab(myScalarPane, "Scalar Bar");
202 aMainLayout->addWidget(aTabPane);
205 QHBox* aBtnBox = new QHBox(this);
206 aBtnBox->setFrameStyle(QFrame::Box | QFrame::Sunken);
207 aBtnBox->setLineWidth( 1 );
208 QHBoxLayout* aBtnLayout = (QHBoxLayout*) aBtnBox->layout();
209 aBtnLayout->setAutoAdd( false );
210 aBtnLayout->setSpacing( 5 );
211 aBtnLayout->setMargin( 11 );
213 QPushButton* aOkBtn = new QPushButton (tr("BUT_OK"), aBtnBox);
214 aOkBtn->setAutoDefault( TRUE );
215 aOkBtn->setDefault( true );
216 aBtnLayout->addWidget(aOkBtn);
218 aBtnLayout->addStretch();
220 QPushButton* aCloseBtn = new QPushButton(tr("BUT_CANCEL"), aBtnBox);
221 aBtnLayout->addWidget(aCloseBtn);
223 aMainLayout->addWidget(aBtnBox);
227 // signals and slots connections
228 connect(mySelPlane , SIGNAL(clicked(int)) , this, SLOT(onPlaneSelect(int)));
229 connect(myCBSetDef , SIGNAL(toggled(bool)) , this, SLOT(setBaseDefault()));
230 connect(myPosSpn , SIGNAL(valueChanged(double)) , this, SLOT(setBaseDefault()));
231 connect(mySelPlane2 , SIGNAL(clicked(int)) , this, SLOT(onCutSelect(int)));
232 connect(myNbSpn , SIGNAL(valueChanged(double)) , this, SLOT(DrawTable()));
233 connect(th , SIGNAL(clicked(int)) , this, SLOT(setDefault(int)));
234 connect(myPosSpn2 , SIGNAL(valueChanged(double)) , this, SLOT(DrawTable()));
235 connect(myPreviewCheck, SIGNAL(toggled(bool)) , this, SLOT(onPreviewCheck(bool)));
236 connect(myPosTable , SIGNAL(valueChanged(int, int)), this, SLOT(onValueChanged(int, int)));
237 connect(myRotXSpn , SIGNAL(valueChanged(double)) , this, SLOT(onRotation(double)));
238 connect(myRotYSpn , SIGNAL(valueChanged(double)) , this, SLOT(onRotation(double)));
239 connect(myRotXSpn2 , SIGNAL(valueChanged(double)) , this, SLOT(onRotation(double)));
240 connect(myRotYSpn2 , SIGNAL(valueChanged(double)) , this, SLOT(onRotation(double)));
241 connect(myBasePlanePos, SIGNAL(textChanged(const QString&)), this, SLOT(onPlanePos(const QString&)));
242 connect(myCreateTable , SIGNAL(toggled(bool)), myCurvesCheck, SLOT(setEnabled(bool)));
244 connect(aOkBtn, SIGNAL(clicked()), this, SLOT(accept()));
245 connect(aCloseBtn, SIGNAL(clicked()), this, SLOT(reject()));
246 //connect(myMgr, SIGNAL(closeAllViews()), this, SLOT(reject()));
247 //connect(VisuGUI::application()->desktop(),
248 // SIGNAL(windowActivated(SUIT_ViewWindow*)),
249 // this, SLOT(onWindowActivated(SUIT_ViewWindow*)));
255 VisuGUI_CutLinesDlg::~VisuGUI_CutLinesDlg()
258 if (myCutLines) delete myCutLines;
259 //jfa tmp:if (VTKViewer_ViewWindow* vf = GET_VTK_VIEWWINDOW(myMgr))
260 //jfa tmp: vf->Repaint();
263 //------------------------------------------------------------------------------
264 void VisuGUI_CutLinesDlg::initFromPrsObject (VISU::CutLines_i* thePrs)
267 myScalarPane->initFromPrsObject(thePrs);
269 myRotXSpn->setValue(thePrs->GetRotateX()*180./PI);
270 myRotYSpn->setValue(thePrs->GetRotateY()*180./PI);
271 myPosSpn->setValue(thePrs->GetDisplacement());
272 setOrientation(thePrs->GetOrientationType());
274 myNbSpn->setValue( (int)thePrs->GetNbLines() );
275 myRotXSpn2->setValue(thePrs->GetRotateX2()*180./PI);
276 myRotYSpn2->setValue(thePrs->GetRotateY2()*180./PI);
277 myPosSpn2->setValue(thePrs->GetDisplacement2());
278 setOrientation2(thePrs->GetOrientationType2());
281 myCutLines = new VISU::CutLines_i(thePrs->GetResult(),false);
282 myCutLines->SameAs(thePrs);
283 myBasePlanePos->setText( QString::number(myCutLines->GetBasePlanePosition()) );
284 myCBSetDef->setChecked(thePrs->IsDefault());
288 if (myPreviewCheck->isChecked()) {
293 //------------------------------------------------------------------------------
294 int VisuGUI_CutLinesDlg::storeToPrsObject (VISU::CutLines_i* thePrs)
296 myScalarPane->storeToPrsObject(thePrs);
298 thePrs->SetOrientation(getOrientaion(),
299 myRotXSpn->value()*PI/180.,
300 myRotYSpn->value()*PI/180.);
301 thePrs->SetDisplacement(myPosSpn->value());
302 thePrs->SetNbLines((int)myNbSpn->value());
304 thePrs->SetOrientation2(getOrientaion(false),
305 myRotXSpn2->value()*PI/180.,
306 myRotYSpn2->value()*PI/180.);
307 thePrs->SetDisplacement2(myPosSpn2->value());
309 if (!myCBSetDef->isChecked())
310 thePrs->SetBasePlanePosition(myBasePlanePos->text().toDouble());
311 else thePrs->SetDefault();
313 for (int i = 0; i < (int)myNbSpn->value(); ++i) {
314 if (!((QCheckTableItem*)myPosTable->item( i, 1 ))->isChecked())
315 thePrs->SetLinePosition( i, myPosTable->text( i, 0 ).toDouble() );
316 else thePrs->SetDefaultPosition(i);
321 //------------------------------------------------------------------------------
322 void VisuGUI_CutLinesDlg::createPlanes()
324 //jfa tmp:if (GET_VTK_VIEWWINDOW(myMgr) == NULL)
326 if (myCutLines == NULL) return;
327 if (myPreviewActor != 0) return;
329 vtkAppendPolyData* aPolyData = myCutLines->GetCutLinesPL()->GetAppendPolyData();
330 vtkDataSetMapper* aPlaneMapper = vtkDataSetMapper::New();
331 aPlaneMapper->SetInput(aPolyData->GetOutput());
332 aPlaneMapper->ScalarVisibilityOff();
334 myPreviewActor = SALOME_Actor::New();
335 myPreviewActor->PickableOff();
336 myPreviewActor->SetMapper(aPlaneMapper);
337 aPlaneMapper->Delete();
338 //jfa tmp:GET_VTK_VIEWWINDOW(myMgr)->AddActor(myPreviewActor);
341 //------------------------------------------------------------------------------
342 void VisuGUI_CutLinesDlg::deletePlanes()
344 if (myPreviewActor == 0) return;
345 //jfa tmp:if (VTKViewer_ViewWindow* vf = GET_VTK_VIEWWINDOW(myMgr))
346 //jfa tmp: vf->RemoveActor(myPreviewActor);
347 myPreviewActor->Delete();
352 //------------------------------------------------------------------------------
353 void VisuGUI_CutLinesDlg::onPlaneSelect (int theId)
355 for (int i = 0; i < mySelPlane2->count(); i++)
356 mySelPlane2->find(i)->setEnabled(true);
357 QButton* aBtn = mySelPlane2->find(theId);
358 aBtn->setEnabled(false);
361 myRotXLbl->setText( tr("LBL_ROT_X"));
362 myRotYLbl->setText( tr("LBL_ROT_Y"));
363 ((QRadioButton*)mySelPlane2->find(1))->setChecked(true);
364 onCutSelect(1, false);
367 myRotXLbl->setText( tr("LBL_ROT_Y"));
368 myRotYLbl->setText( tr("LBL_ROT_Z"));
369 ((QRadioButton*)mySelPlane2->find(2))->setChecked(true);
370 onCutSelect(2, false);
373 myRotXLbl->setText( tr("LBL_ROT_Z"));
374 myRotYLbl->setText( tr("LBL_ROT_X"));
375 ((QRadioButton*)mySelPlane2->find(0))->setChecked(true);
376 onCutSelect(0, false);
378 setBaseDefault(false);
382 //------------------------------------------------------------------------------
383 void VisuGUI_CutLinesDlg::onCutSelect (int theId, bool theUpdate)
387 myRotXLbl2->setText( tr("LBL_ROT_X"));
388 myRotYLbl2->setText( tr("LBL_ROT_Y"));
391 myRotXLbl2->setText( tr("LBL_ROT_Y"));
392 myRotYLbl2->setText( tr("LBL_ROT_Z"));
395 myRotXLbl2->setText( tr("LBL_ROT_Z"));
396 myRotYLbl2->setText( tr("LBL_ROT_X"));
398 //jfa tmp:if (VTKViewer_ViewWindow* vf = GET_VTK_VIEWWINDOW(myMgr)) {
399 if (theUpdate && myPreviewCheck->isChecked() && (myCutLines != NULL)) {
400 myCutLines->SetOrientation2(getOrientaion(false),
401 myRotXSpn2->value()*PI/180.,
402 myRotYSpn2->value()*PI/180.);
403 myCutLines->SetDisplacement2(myPosSpn2->value());
404 myCutLines->GetPL()->Update();
407 //jfa tmp:vf->Repaint();
412 //------------------------------------------------------------------------------
413 void VisuGUI_CutLinesDlg::setBaseDefault (bool theUpdate)
415 if (!hasInit) return;
417 if (myCBSetDef->isChecked()) {
418 if (!myCutLines->IsDefault()) myCutLines->SetDefault();
419 myCutLines->SetOrientation(getOrientaion(),
420 myRotXSpn->value()*PI/180.,
421 myRotYSpn->value()*PI/180.);
422 myCutLines->SetDisplacement(myPosSpn->value());
423 float aPos = myCutLines->GetBasePlanePosition();
424 myBasePlanePos->setText( QString::number(aPos) );
425 myBasePlanePos->setEnabled(false);
426 //jfa tmp:if (VTKViewer_ViewWindow* vf = GET_VTK_VIEWWINDOW(myMgr)) {
427 if (theUpdate && myPreviewCheck->isChecked() && (myCutLines != NULL)) {
428 myCutLines->SetBasePlanePosition(aPos);
429 myCutLines->GetPL()->Update();
432 //jfa tmp:vf->Repaint();
436 myBasePlanePos->setEnabled(true);
440 //------------------------------------------------------------------------------
441 void VisuGUI_CutLinesDlg::DrawTable()
443 if (!hasInit) return;
445 int aNbRows = myPosTable->numRows();
446 int aNbPlanes = (int)myNbSpn->value();
448 myCutLines->SetOrientation(getOrientaion(),
449 myRotXSpn->value()*PI/180.,
450 myRotYSpn->value()*PI/180.);
452 myCutLines->SetNbLines(aNbPlanes);
453 myCutLines->SetDisplacement2(myPosSpn2->value());
454 myCutLines->SetOrientation2(getOrientaion(false),
455 myRotXSpn2->value()*PI/180.,
456 myRotYSpn2->value()*PI/180.);
459 for (int i = 0; i < aNbRows; ++i) {
460 QCheckTableItem* aItem = (QCheckTableItem*)myPosTable->item( i, 1 );
461 if (aItem == 0) break;
462 if (!aItem->isChecked())
463 myCutLines->SetLinePosition(i, myPosTable->text(i, 0).toDouble());
466 if (aNbPlanes > aNbRows)
467 myPosTable->insertRows(aNbRows, aNbPlanes - aNbRows );
468 else if (aNbPlanes < aNbRows)
469 myPosTable->setNumRows(aNbPlanes);
471 int aMin = (aNbRows < aNbPlanes)? aNbRows : aNbPlanes;
472 for (int i = 0; i<aMin; i++) {
473 myPosTable->setText(i, 0, QString::number(myCutLines->GetLinePosition(i)));
474 ((QCheckTableItem*)myPosTable->item( i, 1 ))->setChecked(myCutLines->IsDefaultPosition(i));
477 QHeader *vh = myPosTable->verticalHeader();
478 QString str("Plane# %1");
479 for (int i=aMin; i<aNbPlanes; i++) {
480 VisuGUI_NumEditItem* aEditItem = new VisuGUI_NumEditItem
481 (myPosTable, QTableItem::OnTyping, QString::number(myCutLines->GetLinePosition(i)));
482 aEditItem->setReplaceable(false);
483 aEditItem->setEnabled(!myCutLines->IsDefaultPosition(i));
484 myPosTable->setItem(i, 0, aEditItem);
486 QCheckTableItem* aCheck = new QCheckTableItem(myPosTable, 0);
487 aCheck->setChecked(myCutLines->IsDefaultPosition(i));
488 aCheck->setReplaceable(false);
489 myPosTable->setItem(i, 1, aCheck);
491 vh->setLabel( i, str.arg(i+1) );
494 //jfa tmp:if (VTKViewer_ViewWindow* vf = GET_VTK_VIEWWINDOW(myMgr)) {
495 if (myPreviewCheck->isChecked()) {
496 myCutLines->GetPL()->Update();
499 //jfa tmp:vf->Repaint();
504 //------------------------------------------------------------------------------
505 void VisuGUI_CutLinesDlg::setDefault (int all)
507 myPosTable->setCurrentCell(-1, 1);
508 myPosTable->clearSelection();
509 if (all == 0) return;
511 for (int i = 0; i < (int)myNbSpn->value(); ++i)
512 ((QCheckTableItem*)myPosTable->item( i, 1 ))->setChecked(true);
514 for (int i = 0; i < (int)myNbSpn->value(); ++i) {
515 if ( ((QCheckTableItem*)myPosTable->item( i, 1 ))->isChecked() ) {
516 myCutLines->SetDefaultPosition(i);
517 myPosTable->setText( i, 0, QString::number(myCutLines->GetLinePosition(i)));
518 myPosTable->item( i, 0 )->setEnabled(false);
520 myPosTable->item( i, 0 )->setEnabled(true);
524 //------------------------------------------------------------------------------
525 VISU::CutPlanes::Orientation VisuGUI_CutLinesDlg::getOrientaion (bool IsBasePlane)
534 VISU::CutPlanes::Orientation orient;
535 switch (aBG->id(aBG->selected())) {
537 orient = VISU::CutPlanes::XY;
540 orient = VISU::CutPlanes::YZ;
543 orient = VISU::CutPlanes::ZX;
548 //------------------------------------------------------------------------------
549 void VisuGUI_CutLinesDlg::setOrientation (const VISU::CutPlanes::Orientation orient)
552 case VISU::CutPlanes::XY:
553 ((QRadioButton*)mySelPlane->find(0))->setChecked(true);
556 case VISU::CutPlanes::YZ:
557 ((QRadioButton*)mySelPlane->find(1))->setChecked(true);
560 case VISU::CutPlanes::ZX:
561 ((QRadioButton*)mySelPlane->find(2))->setChecked(true);
566 //------------------------------------------------------------------------------
567 void VisuGUI_CutLinesDlg::setOrientation2 (const VISU::CutPlanes::Orientation orient)
570 case VISU::CutPlanes::XY:
571 ((QRadioButton*)mySelPlane2->find(0))->setChecked(true);
574 case VISU::CutPlanes::YZ:
575 ((QRadioButton*)mySelPlane2->find(1))->setChecked(true);
578 case VISU::CutPlanes::ZX:
579 ((QRadioButton*)mySelPlane2->find(2))->setChecked(true);
584 void VisuGUI_CutLinesDlg::onValueChanged (int theRow, int theCol)
587 QString aTxt = myPosTable->text(theRow, 0);
588 bool isChanged = !aTxt.isEmpty();
589 ((QCheckTableItem*)myPosTable->item(theRow, 1))->setChecked(!isChanged);
591 //jfa tmp:if (VTKViewer_ViewWindow* vf = GET_VTK_VIEWWINDOW(myMgr)) {
592 if (myPreviewCheck->isChecked()) {
594 myCutLines->SetLinePosition( theRow, aTxt.toDouble());
595 myCutLines->GetPL()->Update();
598 //jfa tmp:vf->Repaint();
602 bool isDefault = ((QCheckTableItem*)myPosTable->item(theRow, theCol))->isChecked();
604 myCutLines->SetDefaultPosition(theRow);
605 myPosTable->setText(theRow, 0, QString::number(myCutLines->GetLinePosition(theRow)));
607 //jfa tmp:if (VTKViewer_ViewWindow* vf = GET_VTK_VIEWWINDOW(myMgr)) {
608 if (myPreviewCheck->isChecked()) {
610 myCutLines->GetPL()->Update();
613 //jfa tmp:vf->Repaint();
617 myPosTable->item(theRow, 0)->setEnabled(!isDefault);
621 void VisuGUI_CutLinesDlg::accept()
623 MYGenerateTable = myCreateTable->isChecked();
624 MYGenerateCurve = myCurvesCheck->isChecked();
625 if (myScalarPane->check()) {
626 /*jfa tmp:((QWidget*)sender())->setDisabled(true);
627 storeToPrsObject(myPrs);
629 if (isGenerateTable()) {
630 visuGUI->GetVisuGen()->CreateTable(myPrs->GetEntry());
631 if (isGenerateCurves()) {
632 SALOMEDSClient_Study* aStudy = study()->studyDS();
633 SALOMEDSClient_SObject* aSObject = aStudy->FindObjectID(myPrs->GetEntry());
635 SALOMEDSClient_ChildIterator* aIter = aStudy->NewChildIterator( aSObject );
636 SALOMEDSClient_StudyBuilder* aBuilder = aStudy->NewBuilder();
637 for ( ;aIter->More(); aIter->Next()) {
638 SALOMEDSClient_SObject* aTblObj = aIter->Value();
640 SALOMEDSClient_GenericAttribute* anAttr;
641 if (aTblObj->FindAttribute(anAttr, "AttributeName")) {
642 visuGUI->CreatePlot(aTblObj);
649 if (GET_VTK_VIEWWINDOW(myMgr)) {
651 visuGUI->CreateActor(myPrs);
656 GET_VTK_VIEWWINDOW(myMgr)->onFitAll();
659 visuGUI->RecreateActor(myPrs);
660 if (VTKViewer_ViewWindow* vf = GET_VTK_VIEWWINDOW(myMgr)) {
661 if (vf->getRenderer()->GetActors()->GetNumberOfItems() > 0) {
662 vf->getRenderer()->ResetCameraClippingRange();
667 SALOMEDSClient_Study* aStudy = study()->studyDS();
668 SALOMEDSClient_SObject* aSObject = aStudy->FindObjectID(myPrs->GetEntry());
670 SALOMEDSClient_ChildIterator* aIter = aStudy->NewChildIterator( aSObject );
671 SALOMEDSClient_StudyBuilder* aBuilder = aStudy->NewBuilder();
672 for ( ;aIter->More(); aIter->Next()) {
673 SALOMEDSClient_SObject* aTblObj = aIter->Value();
675 SALOMEDSClient_GenericAttribute* anAttr;
676 if (aTblObj->FindAttribute(anAttr, "AttributeName")) {
677 aBuilder->RemoveObjectWithChildren(aIter->Value()); // We should have only one child
682 if (isGenerateTable()) {
683 visuGUI->GetVisuGen()->CreateTable(aSObject->GetID().c_str());
684 if (isGenerateCurves()) {
685 SALOMEDSClient_Study* aStudy = study()->studyDS();
686 SALOMEDSClient_ChildIterator* aIter = aStudy->NewChildIterator( aSObject );
687 SALOMEDSClient_StudyBuilder* aBuilder = aStudy->NewBuilder();
688 for ( ;aIter->More(); aIter->Next()) {
689 SALOMEDSClient_SObject* aTblObj = aIter->Value();
691 SALOMEDSClient_GenericAttribute* anAttr;
692 if (aTblObj->FindAttribute(anAttr, "AttributeName")) {
693 visuGUI->CreatePlot(aTblObj);
701 VisuGUI::application()->objectBrowser()->updateTree();*/
706 void VisuGUI_CutLinesDlg::reject()
708 /*jfa tmp:if (myIsCreation) {
709 visuGUI->DeletePresentation(myPrs);
710 VisuGUI::application()->objectBrowser()->updateTree();
715 void VisuGUI_CutLinesDlg::onPreviewCheck (bool thePreview)
717 /*jfa tmp:if (VTKViewer_ViewWindow* vf = GET_VTK_VIEWWINDOW(myMgr)) {
719 storeToPrsObject(myCutLines);
720 myCutLines->GetPL()->Update();
730 void VisuGUI_CutLinesDlg::onRotation (double theValue)
732 if (myCutLines == NULL) return;
733 //jfa tmp:if (VTKViewer_ViewWindow* vf = GET_VTK_VIEWWINDOW(myMgr)) {
734 if (myPreviewCheck->isChecked()) {
735 myCutLines->SetOrientation(getOrientaion(),
736 myRotXSpn->value()*PI/180.,
737 myRotYSpn->value()*PI/180.);
738 myCutLines->SetOrientation2(getOrientaion(false),
739 myRotXSpn2->value()*PI/180.,
740 myRotYSpn2->value()*PI/180.);
741 myCutLines->GetPL()->Update();
744 //jfa tmp:vf->Repaint();
749 void VisuGUI_CutLinesDlg::onPlanePos (const QString& theValue)
751 if (myCutLines == NULL) return;
752 //jfa tmp:if (VTKViewer_ViewWindow* vf = GET_VTK_VIEWWINDOW(myMgr)) {
753 if (myPreviewCheck->isChecked()) {
754 myCutLines->SetBasePlanePosition(theValue.toDouble());
755 myCutLines->GetPL()->Update();
758 //jfa tmp:vf->Repaint();
763 //jfa tmp:void VisuGUI_CutLinesDlg::onWindowActivated (SUIT_ViewWindow* theWnd)
765 //jfa tmp: if (theWnd != myStudyWnd)