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"
14 #include "VisuGUI_Tools.h"
16 #include "VISU_Gen_i.hh"
17 #include "VISU_CutLines_i.hh"
19 #include "VISU_PipeLine.hxx"
20 #include "VISU_CutLinesPL.hxx"
22 #include "SVTK_ViewWindow.h"
24 #include "SalomeApp_Application.h"
25 #include "SalomeApp_Study.h"
27 #include "SUIT_Desktop.h"
29 #include "OB_Browser.h"
33 #include <qtabwidget.h>
34 #include <qhgroupbox.h>
36 #include <vtkRenderer.h>
37 #include <vtkPolyData.h>
38 #include <vtkAppendPolyData.h>
39 #include <vtkDataSetMapper.h>
43 //extern VisuGUI *visuGUI;
45 //#define GET_VTK_VIEWWINDOW(aMgr) dynamic_cast<VTKViewer_ViewWindow*>(aMgr->getActiveView())
47 bool VisuGUI_CutLinesDlg::MYGenerateTable = true;
48 bool VisuGUI_CutLinesDlg::MYGenerateCurve = true;
50 //SalomeApp_Study* study()
52 // return dynamic_cast<SalomeApp_Study*>(VisuGUI::application()->activeStudy());
55 VisuGUI_CutLinesDlg::VisuGUI_CutLinesDlg (QWidget* parent, bool theIsCreation, bool theIsModal)
56 : QDialog(parent, "VisuGUI_CutLinesDlg", theIsModal, WStyle_Customize |
57 WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
59 //,myMgr(VisuGUI::application()->activeViewManager())
61 //myStudyWnd = myMgr->getActiveView();
63 setWFlags(getWFlags() | WDestructiveClose);
65 setCaption("Cut Lines Definition");
66 setSizeGripEnabled(true);
67 myIsCreation = theIsCreation;
69 QVBoxLayout* aMainLayout = new QVBoxLayout (this, 7, 6);
70 aMainLayout->setSpacing(5);
75 QTabWidget* aTabPane = new QTabWidget(this);
78 QFrame* aPlanePane = new QFrame(this);
79 QVBoxLayout* aPlaneLayout = new QVBoxLayout(aPlanePane, 5, 6);
81 mySelPlane = new QHButtonGroup( tr( "TXT_ORIENTATION" ), aPlanePane);
82 mySelPlane->setInsideSpacing( 5 );
83 mySelPlane->setInsideMargin( 5 );
85 QRadioButton* aBxy = new QRadioButton( tr( "PARALLEL_XOY" ), mySelPlane); // 0
86 QRadioButton* aByz = new QRadioButton( tr( "PARALLEL_YOZ" ), mySelPlane); // 1
87 QRadioButton* aBzx = new QRadioButton( tr( "PARALLEL_ZOX" ), mySelPlane); // 2
88 aBzx->setChecked(true);
90 aPlaneLayout->addWidget( mySelPlane );
92 QGroupBox* aRotBox = new QGroupBox( tr( "LBL_ROTATION" ), aPlanePane );
93 aRotBox->setColumnLayout(2, Qt::Horizontal );
95 myRotXLbl = new QLabel( tr( "LBL_ROT_X" ), aRotBox);
96 myRotXSpn = new QtxDblSpinBox( -45, 45, 5, aRotBox );
97 myRotXSpn->setValue( 0 );
98 myRotYLbl = new QLabel( tr( "LBL_ROT_Y" ), aRotBox );
99 myRotYSpn = new QtxDblSpinBox( -45, 45, 5, aRotBox );
100 myRotYSpn->setValue( 0 );
102 aPlaneLayout->addWidget( aRotBox );
104 QHGroupBox* aBaseBox = new QHGroupBox (tr("BASE_PLANE_POS"), aPlanePane);
105 myBasePlanePos = new QLineEdit (aBaseBox);
106 mydvalidator = new QDoubleValidator(this);
107 mydvalidator->setDecimals(32);
108 myBasePlanePos->setValidator(mydvalidator);
110 myCBSetDef = new QCheckBox (tr("SET_DEFAULT"),aBaseBox);
112 aPlaneLayout->addWidget(aBaseBox);
114 QHBox* aPosBox = new QHBox (aPlanePane);
115 aPosBox->setSpacing(5);
116 QLabel* aPosLbl = new QLabel (tr("LBL_POS"), aPosBox);
117 myPosSpn = new QtxDblSpinBox (0, 1, 0.1, aPosBox);
118 myPosSpn->setValue(0.5);
119 aPlaneLayout->addWidget(aPosBox);
121 myPreviewCheck = new QCheckBox (tr("LBL_SHOW_PREVIEW"), aPlanePane);
122 myPreviewCheck->setChecked(false);
123 aPlaneLayout->addWidget(myPreviewCheck);
125 myCreateTable = new QCheckBox (tr("LBL_GENERATE_TABLE"), aPlanePane);
126 myCreateTable->setChecked(MYGenerateTable);
127 aPlaneLayout->addWidget( myCreateTable );
129 QHBox* aCheckPane = new QHBox(aPlanePane);
130 QLabel* aLbl = new QLabel(" ", aCheckPane);
131 aCheckPane->setStretchFactor(aLbl, 0);
132 myCurvesCheck = new QCheckBox(tr("LBL_GENERATE_CURVES"), aCheckPane);
133 aCheckPane->setStretchFactor(aCheckPane, 0);
134 myCurvesCheck->setChecked(MYGenerateCurve);
135 myCurvesCheck->setEnabled(MYGenerateTable);
136 QLabel* aLbl2 = new QLabel(" ", aCheckPane);
137 aCheckPane->setStretchFactor(aLbl2, 1);
138 aPlaneLayout->addWidget( aCheckPane );
140 aPlaneLayout->addStretch();
143 aTabPane->addTab( aPlanePane, tr("LBL_LINES_PLANE") );
146 QFrame* aLinesPane = new QFrame(this);
147 QVBoxLayout* aLinesLayout = new QVBoxLayout( aLinesPane, 5, 6 );
149 mySelPlane2 = new QHButtonGroup( tr( "TXT_ORIENTATION" ), aLinesPane);
150 mySelPlane2->setInsideSpacing( 5 );
151 mySelPlane2->setInsideMargin( 5 );
153 QRadioButton* aBxy2 = new QRadioButton( tr( "PARALLEL_XOY" ), mySelPlane2); // 0
154 QRadioButton* aByz2 = new QRadioButton( tr( "PARALLEL_YOZ" ), mySelPlane2); // 1
155 QRadioButton* aBzx2 = new QRadioButton( tr( "PARALLEL_ZOX" ), mySelPlane2); // 2
156 aBzx2->setEnabled(false);
157 aByz2->setChecked(true);
158 aLinesLayout->addWidget( mySelPlane2 );
160 QGroupBox* aRotBox2 = new QGroupBox( tr( "LBL_ROTATION" ), aLinesPane );
161 aRotBox2->setColumnLayout(2, Qt::Horizontal );
163 myRotXLbl2 = new QLabel( tr( "LBL_ROT_X" ), aRotBox2);
164 myRotXSpn2 = new QtxDblSpinBox( -45, 45, 5, aRotBox2 );
165 myRotXSpn2->setValue( 0 );
166 myRotYLbl2 = new QLabel( tr( "LBL_ROT_Y" ), aRotBox2 );
167 myRotYSpn2 = new QtxDblSpinBox( -45, 45, 5, aRotBox2 );
168 myRotYSpn2->setValue( 0 );
169 aLinesLayout->addWidget( aRotBox2 );
171 QHBox* aNbBox = new QHBox(aLinesPane);
172 aNbBox->setSpacing(5);
173 QLabel* aNbLbl = new QLabel( tr( "LBL_NB_PLANS" ), aNbBox );
174 myNbSpn = new QtxDblSpinBox( 1, 100, 1, aNbBox );
175 myNbSpn->setValue( 10 );
177 aLinesLayout->addWidget( aNbBox );
179 myPosTable = new QTable(aLinesPane, "Positions of cut planes" );
180 myPosTable->setMaximumHeight( 227 );
181 myPosTable->setMinimumWidth( 294 );
182 myPosTable->setNumCols(2);
183 myPosTable->setNumRows(0);
185 QHeader *th = myPosTable->horizontalHeader();
186 th->setLabel( 0, "Position" );
187 th->setLabel( 1, "Set default" );
189 aLinesLayout->addWidget( myPosTable );
191 QHBox* aPosBox2 = new QHBox(aLinesPane);
192 aPosBox2->setSpacing(5);
193 QLabel* aPosLbl2 = new QLabel( tr( "LBL_POS" ), aPosBox2 );
194 myPosSpn2 = new QtxDblSpinBox( 0, 1, 0.1, aPosBox2 );
195 myPosSpn2->setValue( 0.5 );
196 aLinesLayout->addWidget( aPosBox2 );
197 aLinesLayout->addStretch();
199 aTabPane->addTab( aLinesPane, tr("LBL_LINES_CUT") );
201 myScalarPane = new VisuGUI_ScalarBarPane(this, false);
202 myScalarPane->setMargin( 5 );
203 aTabPane->addTab(myScalarPane, "Scalar Bar");
205 aMainLayout->addWidget(aTabPane);
208 QHBox* aBtnBox = new QHBox(this);
209 aBtnBox->setFrameStyle(QFrame::Box | QFrame::Sunken);
210 aBtnBox->setLineWidth( 1 );
211 QHBoxLayout* aBtnLayout = (QHBoxLayout*) aBtnBox->layout();
212 aBtnLayout->setAutoAdd( false );
213 aBtnLayout->setSpacing( 5 );
214 aBtnLayout->setMargin( 11 );
216 QPushButton* aOkBtn = new QPushButton (tr("BUT_OK"), aBtnBox);
217 aOkBtn->setAutoDefault( TRUE );
218 aOkBtn->setDefault( true );
219 aBtnLayout->addWidget(aOkBtn);
221 aBtnLayout->addStretch();
223 QPushButton* aCloseBtn = new QPushButton(tr("BUT_CANCEL"), aBtnBox);
224 aBtnLayout->addWidget(aCloseBtn);
226 aMainLayout->addWidget(aBtnBox);
230 // signals and slots connections
231 connect(mySelPlane , SIGNAL(clicked(int)) , this, SLOT(onPlaneSelect(int)));
232 connect(myCBSetDef , SIGNAL(toggled(bool)) , this, SLOT(setBaseDefault()));
233 connect(myPosSpn , SIGNAL(valueChanged(double)) , this, SLOT(setBaseDefault()));
234 connect(mySelPlane2 , SIGNAL(clicked(int)) , this, SLOT(onCutSelect(int)));
235 connect(myNbSpn , SIGNAL(valueChanged(double)) , this, SLOT(DrawTable()));
236 connect(th , SIGNAL(clicked(int)) , this, SLOT(setDefault(int)));
237 connect(myPosSpn2 , SIGNAL(valueChanged(double)) , this, SLOT(DrawTable()));
238 connect(myPreviewCheck, SIGNAL(toggled(bool)) , this, SLOT(onPreviewCheck(bool)));
239 connect(myPosTable , SIGNAL(valueChanged(int, int)), this, SLOT(onValueChanged(int, int)));
240 connect(myRotXSpn , SIGNAL(valueChanged(double)) , this, SLOT(onRotation(double)));
241 connect(myRotYSpn , SIGNAL(valueChanged(double)) , this, SLOT(onRotation(double)));
242 connect(myRotXSpn2 , SIGNAL(valueChanged(double)) , this, SLOT(onRotation(double)));
243 connect(myRotYSpn2 , SIGNAL(valueChanged(double)) , this, SLOT(onRotation(double)));
244 connect(myBasePlanePos, SIGNAL(textChanged(const QString&)), this, SLOT(onPlanePos(const QString&)));
245 connect(myCreateTable , SIGNAL(toggled(bool)), myCurvesCheck, SLOT(setEnabled(bool)));
247 connect(aOkBtn, SIGNAL(clicked()), this, SLOT(accept()));
248 connect(aCloseBtn, SIGNAL(clicked()), this, SLOT(reject()));
249 //connect(myMgr, SIGNAL(closeAllViews()), this, SLOT(reject()));
250 //connect(VisuGUI::application()->desktop(),
251 // SIGNAL(windowActivated(SUIT_ViewWindow*)),
252 // this, SLOT(onWindowActivated(SUIT_ViewWindow*)));
258 VisuGUI_CutLinesDlg::~VisuGUI_CutLinesDlg()
260 cout<<"### VisuGUI_CutLinesDlg::~VisuGUI_CutLinesDlg"<<endl;
262 if (myCutLines) //delete myCutLines;
263 myCutLines->Destroy();
264 if (SVTK_ViewWindow* vf = VISU::GetViewWindow())
268 //------------------------------------------------------------------------------
269 void VisuGUI_CutLinesDlg::initFromPrsObject (VISU::CutLines_i* thePrs)
272 myScalarPane->initFromPrsObject(thePrs);
274 myRotXSpn->setValue(thePrs->GetRotateX()*180./PI);
275 myRotYSpn->setValue(thePrs->GetRotateY()*180./PI);
276 myPosSpn->setValue(thePrs->GetDisplacement());
277 setOrientation(thePrs->GetOrientationType());
279 myNbSpn->setValue( (int)thePrs->GetNbLines() );
280 myRotXSpn2->setValue(thePrs->GetRotateX2()*180./PI);
281 myRotYSpn2->setValue(thePrs->GetRotateY2()*180./PI);
282 myPosSpn2->setValue(thePrs->GetDisplacement2());
283 setOrientation2(thePrs->GetOrientationType2());
286 myCutLines = new VISU::CutLines_i(thePrs->GetResult(),false);
287 myCutLines->SameAs(thePrs);
288 myBasePlanePos->setText( QString::number(myCutLines->GetBasePlanePosition()) );
289 myCBSetDef->setChecked(thePrs->IsDefault());
293 if (myPreviewCheck->isChecked()) {
298 //------------------------------------------------------------------------------
299 int VisuGUI_CutLinesDlg::storeToPrsObject (VISU::CutLines_i* thePrs)
301 myScalarPane->storeToPrsObject(thePrs);
303 thePrs->SetOrientation(getOrientaion(),
304 myRotXSpn->value()*PI/180.,
305 myRotYSpn->value()*PI/180.);
306 thePrs->SetDisplacement(myPosSpn->value());
307 thePrs->SetNbLines((int)myNbSpn->value());
309 thePrs->SetOrientation2(getOrientaion(false),
310 myRotXSpn2->value()*PI/180.,
311 myRotYSpn2->value()*PI/180.);
312 thePrs->SetDisplacement2(myPosSpn2->value());
314 if (!myCBSetDef->isChecked())
315 thePrs->SetBasePlanePosition(myBasePlanePos->text().toDouble());
316 else thePrs->SetDefault();
318 for (int i = 0; i < (int)myNbSpn->value(); ++i) {
319 if (!((QCheckTableItem*)myPosTable->item( i, 1 ))->isChecked())
320 thePrs->SetLinePosition( i, myPosTable->text( i, 0 ).toDouble() );
321 else thePrs->SetDefaultPosition(i);
326 //------------------------------------------------------------------------------
327 void VisuGUI_CutLinesDlg::createPlanes()
329 SVTK_ViewWindow* aView = VISU::GetViewWindow();
330 if (aView == NULL) return;
331 if (myCutLines == NULL) return;
332 if (myPreviewActor != 0) return;
334 storeToPrsObject(myCutLines);
335 myCutLines->GetPL()->Update();
336 vtkAppendPolyData* aPolyData = myCutLines->GetCutLinesPL()->GetAppendPolyData();
337 vtkDataSetMapper* aPlaneMapper = vtkDataSetMapper::New();
338 aPlaneMapper->SetInput(aPolyData->GetOutput());
339 aPlaneMapper->ScalarVisibilityOff();
341 myPreviewActor = SALOME_Actor::New();
342 myPreviewActor->PickableOff();
343 myPreviewActor->SetMapper(aPlaneMapper);
344 aPlaneMapper->Delete();
345 aView->AddActor(myPreviewActor);
346 aView->getRenderer()->Render();
350 //------------------------------------------------------------------------------
351 void VisuGUI_CutLinesDlg::deletePlanes()
353 if (myPreviewActor == 0) return;
354 if (SVTK_ViewWindow* aView = VISU::GetViewWindow())
355 aView->RemoveActor(myPreviewActor);
356 myPreviewActor->Delete();
361 //------------------------------------------------------------------------------
362 void VisuGUI_CutLinesDlg::onPlaneSelect (int theId)
364 for (int i = 0; i < mySelPlane2->count(); i++)
365 mySelPlane2->find(i)->setEnabled(true);
366 QButton* aBtn = mySelPlane2->find(theId);
367 aBtn->setEnabled(false);
370 myRotXLbl->setText( tr("LBL_ROT_X"));
371 myRotYLbl->setText( tr("LBL_ROT_Y"));
372 ((QRadioButton*)mySelPlane2->find(1))->setChecked(true);
373 onCutSelect(1, false);
376 myRotXLbl->setText( tr("LBL_ROT_Y"));
377 myRotYLbl->setText( tr("LBL_ROT_Z"));
378 ((QRadioButton*)mySelPlane2->find(2))->setChecked(true);
379 onCutSelect(2, false);
382 myRotXLbl->setText( tr("LBL_ROT_Z"));
383 myRotYLbl->setText( tr("LBL_ROT_X"));
384 ((QRadioButton*)mySelPlane2->find(0))->setChecked(true);
385 onCutSelect(0, false);
387 setBaseDefault(false);
391 //------------------------------------------------------------------------------
392 void VisuGUI_CutLinesDlg::onCutSelect (int theId, bool theUpdate)
396 myRotXLbl2->setText( tr("LBL_ROT_X"));
397 myRotYLbl2->setText( tr("LBL_ROT_Y"));
400 myRotXLbl2->setText( tr("LBL_ROT_Y"));
401 myRotYLbl2->setText( tr("LBL_ROT_Z"));
404 myRotXLbl2->setText( tr("LBL_ROT_Z"));
405 myRotYLbl2->setText( tr("LBL_ROT_X"));
407 if (SVTK_ViewWindow* aView = VISU::GetViewWindow()) {
408 if (theUpdate && myPreviewCheck->isChecked() && (myCutLines != NULL)) {
409 /*myCutLines->SetOrientation2(getOrientaion(false),
410 myRotXSpn2->value()*PI/180.,
411 myRotYSpn2->value()*PI/180.);
412 myCutLines->SetDisplacement2(myPosSpn2->value());*/
413 //myCutLines->GetPL()->Update();
421 //------------------------------------------------------------------------------
422 void VisuGUI_CutLinesDlg::setBaseDefault (bool theUpdate)
424 if (!hasInit) return;
426 if (myCBSetDef->isChecked()) {
427 if (!myCutLines->IsDefault()) myCutLines->SetDefault();
428 /*myCutLines->SetOrientation(getOrientaion(),
429 myRotXSpn->value()*PI/180.,
430 myRotYSpn->value()*PI/180.);
431 myCutLines->SetDisplacement(myPosSpn->value());*/
432 /* float aPos = myCutLines->GetBasePlanePosition();
433 myBasePlanePos->setText( QString::number(aPos) );
434 myBasePlanePos->setEnabled(false);*/
435 if (SVTK_ViewWindow* aView = VISU::GetViewWindow()) {
436 if (theUpdate && myPreviewCheck->isChecked() && (myCutLines != NULL)) {
437 //myCutLines->SetBasePlanePosition(aPos);
438 // myCutLines->GetPL()->Update();
444 float aPos = myCutLines->GetBasePlanePosition();
445 myBasePlanePos->setText( QString::number(aPos) );
446 myBasePlanePos->setEnabled(false);
448 myBasePlanePos->setEnabled(true);
452 //------------------------------------------------------------------------------
453 void VisuGUI_CutLinesDlg::DrawTable()
455 if (!hasInit) return;
457 int aNbRows = myPosTable->numRows();
458 int aNbPlanes = (int)myNbSpn->value();
460 myCutLines->SetOrientation(getOrientaion(),
461 myRotXSpn->value()*PI/180.,
462 myRotYSpn->value()*PI/180.);
464 myCutLines->SetNbLines(aNbPlanes);
465 myCutLines->SetDisplacement2(myPosSpn2->value());
466 myCutLines->SetOrientation2(getOrientaion(false),
467 myRotXSpn2->value()*PI/180.,
468 myRotYSpn2->value()*PI/180.);
471 for (int i = 0; i < aNbRows; ++i) {
472 QCheckTableItem* aItem = (QCheckTableItem*)myPosTable->item( i, 1 );
473 if (aItem == 0) break;
474 if (!aItem->isChecked())
475 myCutLines->SetLinePosition(i, myPosTable->text(i, 0).toDouble());
478 if (aNbPlanes > aNbRows)
479 myPosTable->insertRows(aNbRows, aNbPlanes - aNbRows );
480 else if (aNbPlanes < aNbRows)
481 myPosTable->setNumRows(aNbPlanes);
483 int aMin = (aNbRows < aNbPlanes)? aNbRows : aNbPlanes;
484 for (int i = 0; i<aMin; i++) {
485 myPosTable->setText(i, 0, QString::number(myCutLines->GetLinePosition(i)));
486 ((QCheckTableItem*)myPosTable->item( i, 1 ))->setChecked(myCutLines->IsDefaultPosition(i));
489 QHeader *vh = myPosTable->verticalHeader();
490 QString str("Plane# %1");
491 for (int i=aMin; i<aNbPlanes; i++) {
492 VisuGUI_NumEditItem* aEditItem = new VisuGUI_NumEditItem
493 (myPosTable, QTableItem::OnTyping, QString::number(myCutLines->GetLinePosition(i)));
494 aEditItem->setReplaceable(false);
495 aEditItem->setEnabled(!myCutLines->IsDefaultPosition(i));
496 myPosTable->setItem(i, 0, aEditItem);
498 QCheckTableItem* aCheck = new QCheckTableItem(myPosTable, 0);
499 aCheck->setChecked(myCutLines->IsDefaultPosition(i));
500 aCheck->setReplaceable(false);
501 myPosTable->setItem(i, 1, aCheck);
503 vh->setLabel( i, str.arg(i+1) );
506 if (SVTK_ViewWindow* aView = VISU::GetViewWindow()) {
507 if (myPreviewCheck->isChecked()) {
508 // myCutLines->GetPL()->Update();
516 //------------------------------------------------------------------------------
517 void VisuGUI_CutLinesDlg::setDefault (int all)
519 myPosTable->setCurrentCell(-1, 1);
520 myPosTable->clearSelection();
521 if (all == 0) return;
523 for (int i = 0; i < (int)myNbSpn->value(); ++i)
524 ((QCheckTableItem*)myPosTable->item( i, 1 ))->setChecked(true);
526 for (int i = 0; i < (int)myNbSpn->value(); ++i) {
527 if ( ((QCheckTableItem*)myPosTable->item( i, 1 ))->isChecked() ) {
528 myCutLines->SetDefaultPosition(i);
529 myPosTable->setText( i, 0, QString::number(myCutLines->GetLinePosition(i)));
530 myPosTable->item( i, 0 )->setEnabled(false);
532 myPosTable->item( i, 0 )->setEnabled(true);
536 //------------------------------------------------------------------------------
537 VISU::CutPlanes::Orientation VisuGUI_CutLinesDlg::getOrientaion (bool IsBasePlane)
546 VISU::CutPlanes::Orientation orient;
547 switch (aBG->id(aBG->selected())) {
549 orient = VISU::CutPlanes::XY;
552 orient = VISU::CutPlanes::YZ;
555 orient = VISU::CutPlanes::ZX;
560 //------------------------------------------------------------------------------
561 void VisuGUI_CutLinesDlg::setOrientation (const VISU::CutPlanes::Orientation orient)
564 case VISU::CutPlanes::XY:
565 ((QRadioButton*)mySelPlane->find(0))->setChecked(true);
568 case VISU::CutPlanes::YZ:
569 ((QRadioButton*)mySelPlane->find(1))->setChecked(true);
572 case VISU::CutPlanes::ZX:
573 ((QRadioButton*)mySelPlane->find(2))->setChecked(true);
578 //------------------------------------------------------------------------------
579 void VisuGUI_CutLinesDlg::setOrientation2 (const VISU::CutPlanes::Orientation orient)
582 case VISU::CutPlanes::XY:
583 ((QRadioButton*)mySelPlane2->find(0))->setChecked(true);
586 case VISU::CutPlanes::YZ:
587 ((QRadioButton*)mySelPlane2->find(1))->setChecked(true);
590 case VISU::CutPlanes::ZX:
591 ((QRadioButton*)mySelPlane2->find(2))->setChecked(true);
596 void VisuGUI_CutLinesDlg::onValueChanged (int theRow, int theCol)
599 QString aTxt = myPosTable->text(theRow, 0);
600 bool isChanged = !aTxt.isEmpty();
601 ((QCheckTableItem*)myPosTable->item(theRow, 1))->setChecked(!isChanged);
603 if (SVTK_ViewWindow* aView = VISU::GetViewWindow()) {
604 if (myPreviewCheck->isChecked()) {
606 //myCutLines->SetLinePosition( theRow, aTxt.toDouble());
607 // myCutLines->GetPL()->Update();
614 bool isDefault = ((QCheckTableItem*)myPosTable->item(theRow, theCol))->isChecked();
616 //myCutLines->SetDefaultPosition(theRow);
617 // myPosTable->setText(theRow, 0, QString::number(myCutLines->GetLinePosition(theRow)));
619 if (SVTK_ViewWindow* aView = VISU::GetViewWindow()) {
620 if (myPreviewCheck->isChecked()) {
622 // myCutLines->GetPL()->Update();
628 myPosTable->setText(theRow, 0, QString::number(myCutLines->GetLinePosition(theRow)));
630 myPosTable->item(theRow, 0)->setEnabled(!isDefault);
634 void VisuGUI_CutLinesDlg::accept()
636 //if ( !VisuGUI::CheckActiveStudyLock() ) {
640 MYGenerateTable = myCreateTable->isChecked();
641 MYGenerateCurve = myCurvesCheck->isChecked();
642 // if (myScalarPane->check()) {
643 /*jfa tmp:((QWidget*)sender())->setDisabled(true);
644 storeToPrsObject(myPrs);
646 if (isGenerateTable()) {
647 visuGUI->GetVisuGen()->CreateTable(myPrs->GetEntry());
648 if (isGenerateCurves()) {
649 SALOMEDSClient_Study* aStudy = study()->studyDS();
650 SALOMEDSClient_SObject* aSObject = aStudy->FindObjectID(myPrs->GetEntry());
652 SALOMEDSClient_ChildIterator* aIter = aStudy->NewChildIterator( aSObject );
653 SALOMEDSClient_StudyBuilder* aBuilder = aStudy->NewBuilder();
654 for ( ;aIter->More(); aIter->Next()) {
655 SALOMEDSClient_SObject* aTblObj = aIter->Value();
657 SALOMEDSClient_GenericAttribute* anAttr;
658 if (aTblObj->FindAttribute(anAttr, "AttributeName")) {
659 visuGUI->CreatePlot(aTblObj);
666 if (GET_VTK_VIEWWINDOW(myMgr)) {
668 visuGUI->CreateActor(myPrs);
673 GET_VTK_VIEWWINDOW(myMgr)->onFitAll();
676 visuGUI->RecreateActor(myPrs);
677 if (VTKViewer_ViewWindow* vf = GET_VTK_VIEWWINDOW(myMgr)) {
678 if (vf->getRenderer()->GetActors()->GetNumberOfItems() > 0) {
679 vf->getRenderer()->ResetCameraClippingRange();
684 SALOMEDSClient_Study* aStudy = study()->studyDS();
685 SALOMEDSClient_SObject* aSObject = aStudy->FindObjectID(myPrs->GetEntry());
687 SALOMEDSClient_ChildIterator* aIter = aStudy->NewChildIterator( aSObject );
688 SALOMEDSClient_StudyBuilder* aBuilder = aStudy->NewBuilder();
689 for ( ;aIter->More(); aIter->Next()) {
690 SALOMEDSClient_SObject* aTblObj = aIter->Value();
692 SALOMEDSClient_GenericAttribute* anAttr;
693 if (aTblObj->FindAttribute(anAttr, "AttributeName")) {
694 aBuilder->RemoveObjectWithChildren(aIter->Value()); // We should have only one child
699 if (isGenerateTable()) {
700 visuGUI->GetVisuGen()->CreateTable(aSObject->GetID().c_str());
701 if (isGenerateCurves()) {
702 SALOMEDSClient_Study* aStudy = study()->studyDS();
703 SALOMEDSClient_ChildIterator* aIter = aStudy->NewChildIterator( aSObject );
704 SALOMEDSClient_StudyBuilder* aBuilder = aStudy->NewBuilder();
705 for ( ;aIter->More(); aIter->Next()) {
706 SALOMEDSClient_SObject* aTblObj = aIter->Value();
708 SALOMEDSClient_GenericAttribute* anAttr;
709 if (aTblObj->FindAttribute(anAttr, "AttributeName")) {
710 visuGUI->CreatePlot(aTblObj);
718 VisuGUI::application()->objectBrowser()->updateTree();*/
724 void VisuGUI_CutLinesDlg::reject()
726 /*jfa tmp:if (myIsCreation) {
727 myPrs->RemoveFromStudy();
728 VisuGUI::application()->objectBrowser()->updateTree();
734 void VisuGUI_CutLinesDlg::onPreviewCheck (bool thePreview)
736 if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) {
738 //storeToPrsObject(myCutLines);
739 // myCutLines->GetPL()->Update();
749 void VisuGUI_CutLinesDlg::onRotation (double theValue)
751 if (myCutLines == NULL) return;
752 if (SVTK_ViewWindow* aView = VISU::GetViewWindow()) {
753 if (myPreviewCheck->isChecked()) {
755 /*myCutLines->SetOrientation(getOrientaion(),
756 myRotXSpn->value()*PI/180.,
757 myRotYSpn->value()*PI/180.);
758 myCutLines->SetOrientation2(getOrientaion(false),
759 myRotXSpn2->value()*PI/180.,
760 myRotYSpn2->value()*PI/180.);*/
761 // myCutLines->GetPL()->Update();
769 void VisuGUI_CutLinesDlg::onPlanePos (const QString& theValue)
771 if (myCutLines == NULL) return;
772 if (SVTK_ViewWindow* aView = VISU::GetViewWindow()) {
773 if (myPreviewCheck->isChecked()) {
774 //myCutLines->SetBasePlanePosition(theValue.toDouble());
775 // myCutLines->GetPL()->Update();
783 //jfa tmp:void VisuGUI_CutLinesDlg::onWindowActivated (SUIT_ViewWindow* theWnd)
785 //jfa tmp: if (theWnd != myStudyWnd)