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 bool VisuGUI_CutLinesDlg::MYGenerateTable = true;
44 bool VisuGUI_CutLinesDlg::MYGenerateCurve = true;
46 VisuGUI_CutLinesDlg::VisuGUI_CutLinesDlg (SalomeApp_Module* theModule,
47 bool theIsCreation, bool theIsModal)
48 : QDialog(VISU::GetDesktop(theModule), "VisuGUI_CutLinesDlg", theIsModal,
49 WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
53 setWFlags(getWFlags() | WDestructiveClose);
55 setCaption("Cut Lines Definition");
56 setSizeGripEnabled(true);
57 myIsCreation = theIsCreation;
59 QVBoxLayout* aMainLayout = new QVBoxLayout (this, 7, 6);
60 aMainLayout->setSpacing(5);
65 QTabWidget* aTabPane = new QTabWidget(this);
68 QFrame* aPlanePane = new QFrame(this);
69 QVBoxLayout* aPlaneLayout = new QVBoxLayout(aPlanePane, 5, 6);
71 mySelPlane = new QHButtonGroup( tr( "TXT_ORIENTATION" ), aPlanePane);
72 mySelPlane->setInsideSpacing( 5 );
73 mySelPlane->setInsideMargin( 5 );
75 QRadioButton* aBxy = new QRadioButton( tr( "PARALLEL_XOY" ), mySelPlane); // 0
76 QRadioButton* aByz = new QRadioButton( tr( "PARALLEL_YOZ" ), mySelPlane); // 1
77 QRadioButton* aBzx = new QRadioButton( tr( "PARALLEL_ZOX" ), mySelPlane); // 2
78 aBzx->setChecked(true);
80 aPlaneLayout->addWidget( mySelPlane );
82 QGroupBox* aRotBox = new QGroupBox( tr( "LBL_ROTATION" ), aPlanePane );
83 aRotBox->setColumnLayout(2, Qt::Horizontal );
85 myRotXLbl = new QLabel( tr( "LBL_ROT_X" ), aRotBox);
86 myRotXSpn = new QtxDblSpinBox( -45, 45, 5, aRotBox );
87 myRotXSpn->setValue( 0 );
88 myRotYLbl = new QLabel( tr( "LBL_ROT_Y" ), aRotBox );
89 myRotYSpn = new QtxDblSpinBox( -45, 45, 5, aRotBox );
90 myRotYSpn->setValue( 0 );
92 aPlaneLayout->addWidget( aRotBox );
94 QHGroupBox* aBaseBox = new QHGroupBox (tr("BASE_PLANE_POS"), aPlanePane);
95 myBasePlanePos = new QLineEdit (aBaseBox);
96 mydvalidator = new QDoubleValidator(this);
97 mydvalidator->setDecimals(32);
98 myBasePlanePos->setValidator(mydvalidator);
100 myCBSetDef = new QCheckBox (tr("SET_DEFAULT"),aBaseBox);
102 aPlaneLayout->addWidget(aBaseBox);
104 QHBox* aPosBox = new QHBox (aPlanePane);
105 aPosBox->setSpacing(5);
106 QLabel* aPosLbl = new QLabel (tr("LBL_POS"), aPosBox);
107 myPosSpn = new QtxDblSpinBox (0, 1, 0.1, aPosBox);
108 myPosSpn->setValue(0.5);
109 aPlaneLayout->addWidget(aPosBox);
111 myPreviewCheck = new QCheckBox (tr("LBL_SHOW_PREVIEW"), aPlanePane);
112 myPreviewCheck->setChecked(false);
113 aPlaneLayout->addWidget(myPreviewCheck);
115 myCreateTable = new QCheckBox (tr("LBL_GENERATE_TABLE"), aPlanePane);
116 myCreateTable->setChecked(MYGenerateTable);
117 aPlaneLayout->addWidget( myCreateTable );
119 QHBox* aCheckPane = new QHBox(aPlanePane);
120 QLabel* aLbl = new QLabel(" ", aCheckPane);
121 aCheckPane->setStretchFactor(aLbl, 0);
122 myCurvesCheck = new QCheckBox(tr("LBL_GENERATE_CURVES"), aCheckPane);
123 aCheckPane->setStretchFactor(aCheckPane, 0);
124 myCurvesCheck->setChecked(MYGenerateCurve);
125 myCurvesCheck->setEnabled(MYGenerateTable);
126 QLabel* aLbl2 = new QLabel(" ", aCheckPane);
127 aCheckPane->setStretchFactor(aLbl2, 1);
128 aPlaneLayout->addWidget( aCheckPane );
130 aPlaneLayout->addStretch();
133 aTabPane->addTab( aPlanePane, tr("LBL_LINES_PLANE") );
136 QFrame* aLinesPane = new QFrame(this);
137 QVBoxLayout* aLinesLayout = new QVBoxLayout( aLinesPane, 5, 6 );
139 mySelPlane2 = new QHButtonGroup( tr( "TXT_ORIENTATION" ), aLinesPane);
140 mySelPlane2->setInsideSpacing( 5 );
141 mySelPlane2->setInsideMargin( 5 );
143 QRadioButton* aBxy2 = new QRadioButton( tr( "PARALLEL_XOY" ), mySelPlane2); // 0
144 QRadioButton* aByz2 = new QRadioButton( tr( "PARALLEL_YOZ" ), mySelPlane2); // 1
145 QRadioButton* aBzx2 = new QRadioButton( tr( "PARALLEL_ZOX" ), mySelPlane2); // 2
146 aBzx2->setEnabled(false);
147 aByz2->setChecked(true);
148 aLinesLayout->addWidget( mySelPlane2 );
150 QGroupBox* aRotBox2 = new QGroupBox( tr( "LBL_ROTATION" ), aLinesPane );
151 aRotBox2->setColumnLayout(2, Qt::Horizontal );
153 myRotXLbl2 = new QLabel( tr( "LBL_ROT_X" ), aRotBox2);
154 myRotXSpn2 = new QtxDblSpinBox( -45, 45, 5, aRotBox2 );
155 myRotXSpn2->setValue( 0 );
156 myRotYLbl2 = new QLabel( tr( "LBL_ROT_Y" ), aRotBox2 );
157 myRotYSpn2 = new QtxDblSpinBox( -45, 45, 5, aRotBox2 );
158 myRotYSpn2->setValue( 0 );
159 aLinesLayout->addWidget( aRotBox2 );
161 QHBox* aNbBox = new QHBox(aLinesPane);
162 aNbBox->setSpacing(5);
163 QLabel* aNbLbl = new QLabel( tr( "LBL_NB_PLANS" ), aNbBox );
164 myNbSpn = new QtxDblSpinBox( 1, 100, 1, aNbBox );
165 myNbSpn->setValue( 10 );
167 aLinesLayout->addWidget( aNbBox );
169 myPosTable = new QTable(aLinesPane, "Positions of cut planes" );
170 myPosTable->setMaximumHeight( 227 );
171 myPosTable->setMinimumWidth( 294 );
172 myPosTable->setNumCols(2);
173 myPosTable->setNumRows(0);
175 QHeader *th = myPosTable->horizontalHeader();
176 th->setLabel( 0, "Position" );
177 th->setLabel( 1, "Set default" );
179 aLinesLayout->addWidget( myPosTable );
181 QHBox* aPosBox2 = new QHBox(aLinesPane);
182 aPosBox2->setSpacing(5);
183 QLabel* aPosLbl2 = new QLabel( tr( "LBL_POS" ), aPosBox2 );
184 myPosSpn2 = new QtxDblSpinBox( 0, 1, 0.1, aPosBox2 );
185 myPosSpn2->setValue( 0.5 );
186 aLinesLayout->addWidget( aPosBox2 );
187 aLinesLayout->addStretch();
189 aTabPane->addTab( aLinesPane, tr("LBL_LINES_CUT") );
191 myScalarPane = new VisuGUI_ScalarBarPane(this, false);
192 myScalarPane->setMargin( 5 );
193 aTabPane->addTab(myScalarPane, "Scalar Bar");
195 aMainLayout->addWidget(aTabPane);
198 QHBox* aBtnBox = new QHBox(this);
199 aBtnBox->setFrameStyle(QFrame::Box | QFrame::Sunken);
200 aBtnBox->setLineWidth( 1 );
201 QHBoxLayout* aBtnLayout = (QHBoxLayout*) aBtnBox->layout();
202 aBtnLayout->setAutoAdd( false );
203 aBtnLayout->setSpacing( 5 );
204 aBtnLayout->setMargin( 11 );
206 QPushButton* aOkBtn = new QPushButton (tr("BUT_OK"), aBtnBox);
207 aOkBtn->setAutoDefault( TRUE );
208 aOkBtn->setDefault( true );
209 aBtnLayout->addWidget(aOkBtn);
211 aBtnLayout->addStretch();
213 QPushButton* aCloseBtn = new QPushButton(tr("BUT_CANCEL"), aBtnBox);
214 aBtnLayout->addWidget(aCloseBtn);
216 aMainLayout->addWidget(aBtnBox);
220 // signals and slots connections
221 connect(mySelPlane , SIGNAL(clicked(int)) , this, SLOT(onPlaneSelect(int)));
222 connect(myCBSetDef , SIGNAL(toggled(bool)) , this, SLOT(setBaseDefault()));
223 connect(myPosSpn , SIGNAL(valueChanged(double)) , this, SLOT(setBaseDefault()));
224 connect(mySelPlane2 , SIGNAL(clicked(int)) , this, SLOT(onCutSelect(int)));
225 connect(myNbSpn , SIGNAL(valueChanged(double)) , this, SLOT(DrawTable()));
226 connect(th , SIGNAL(clicked(int)) , this, SLOT(setDefault(int)));
227 connect(myPosSpn2 , SIGNAL(valueChanged(double)) , this, SLOT(DrawTable()));
228 connect(myPreviewCheck, SIGNAL(toggled(bool)) , this, SLOT(onPreviewCheck(bool)));
229 connect(myPosTable , SIGNAL(valueChanged(int, int)), this, SLOT(onValueChanged(int, int)));
230 connect(myRotXSpn , SIGNAL(valueChanged(double)) , this, SLOT(onRotation(double)));
231 connect(myRotYSpn , SIGNAL(valueChanged(double)) , this, SLOT(onRotation(double)));
232 connect(myRotXSpn2 , SIGNAL(valueChanged(double)) , this, SLOT(onRotation(double)));
233 connect(myRotYSpn2 , SIGNAL(valueChanged(double)) , this, SLOT(onRotation(double)));
234 connect(myBasePlanePos, SIGNAL(textChanged(const QString&)), this, SLOT(onPlanePos(const QString&)));
235 connect(myCreateTable , SIGNAL(toggled(bool)), myCurvesCheck, SLOT(setEnabled(bool)));
237 connect(aOkBtn, SIGNAL(clicked()), this, SLOT(accept()));
238 connect(aCloseBtn, SIGNAL(clicked()), this, SLOT(reject()));
239 //connect(myMgr, SIGNAL(closeAllViews()), this, SLOT(reject()));
240 //connect(VisuGUI::application()->desktop(),
241 // SIGNAL(windowActivated(SUIT_ViewWindow*)),
242 // this, SLOT(onWindowActivated(SUIT_ViewWindow*)));
248 VisuGUI_CutLinesDlg::~VisuGUI_CutLinesDlg()
250 cout<<"### VisuGUI_CutLinesDlg::~VisuGUI_CutLinesDlg"<<endl;
252 if (myCutLines) //delete myCutLines;
253 myCutLines->Destroy();
254 if (SVTK_ViewWindow* vf = VISU::GetViewWindow())
258 //------------------------------------------------------------------------------
259 void VisuGUI_CutLinesDlg::initFromPrsObject (VISU::CutLines_i* thePrs)
262 myScalarPane->initFromPrsObject(thePrs);
264 myRotXSpn->setValue(thePrs->GetRotateX()*180./PI);
265 myRotYSpn->setValue(thePrs->GetRotateY()*180./PI);
266 myPosSpn->setValue(thePrs->GetDisplacement());
267 setOrientation(thePrs->GetOrientationType());
269 myNbSpn->setValue( (int)thePrs->GetNbLines() );
270 myRotXSpn2->setValue(thePrs->GetRotateX2()*180./PI);
271 myRotYSpn2->setValue(thePrs->GetRotateY2()*180./PI);
272 myPosSpn2->setValue(thePrs->GetDisplacement2());
273 setOrientation2(thePrs->GetOrientationType2());
276 myCutLines = new VISU::CutLines_i(thePrs->GetResult(),false);
277 myCutLines->SameAs(thePrs);
278 myBasePlanePos->setText( QString::number(myCutLines->GetBasePlanePosition()) );
279 myCBSetDef->setChecked(thePrs->IsDefault());
283 if (myPreviewCheck->isChecked()) {
288 //------------------------------------------------------------------------------
289 int VisuGUI_CutLinesDlg::storeToPrsObject (VISU::CutLines_i* thePrs)
291 myScalarPane->storeToPrsObject(thePrs);
293 thePrs->SetOrientation(getOrientaion(),
294 myRotXSpn->value()*PI/180.,
295 myRotYSpn->value()*PI/180.);
296 thePrs->SetDisplacement(myPosSpn->value());
297 thePrs->SetNbLines((int)myNbSpn->value());
299 thePrs->SetOrientation2(getOrientaion(false),
300 myRotXSpn2->value()*PI/180.,
301 myRotYSpn2->value()*PI/180.);
302 thePrs->SetDisplacement2(myPosSpn2->value());
304 if (!myCBSetDef->isChecked())
305 thePrs->SetBasePlanePosition(myBasePlanePos->text().toDouble());
306 else thePrs->SetDefault();
308 for (int i = 0; i < (int)myNbSpn->value(); ++i) {
309 if (!((QCheckTableItem*)myPosTable->item( i, 1 ))->isChecked())
310 thePrs->SetLinePosition( i, myPosTable->text( i, 0 ).toDouble() );
311 else thePrs->SetDefaultPosition(i);
316 //------------------------------------------------------------------------------
317 void VisuGUI_CutLinesDlg::createPlanes()
319 SVTK_ViewWindow* aView = VISU::GetViewWindow();
320 if (aView == NULL) return;
321 if (myCutLines == NULL) return;
322 if (myPreviewActor != 0) return;
324 storeToPrsObject(myCutLines);
325 myCutLines->GetPL()->Update();
326 vtkAppendPolyData* aPolyData = myCutLines->GetCutLinesPL()->GetAppendPolyData();
327 vtkDataSetMapper* aPlaneMapper = vtkDataSetMapper::New();
328 aPlaneMapper->SetInput(aPolyData->GetOutput());
329 aPlaneMapper->ScalarVisibilityOff();
331 myPreviewActor = SALOME_Actor::New();
332 myPreviewActor->PickableOff();
333 myPreviewActor->SetMapper(aPlaneMapper);
334 aPlaneMapper->Delete();
335 aView->AddActor(myPreviewActor);
336 aView->getRenderer()->Render();
340 //------------------------------------------------------------------------------
341 void VisuGUI_CutLinesDlg::deletePlanes()
343 if (myPreviewActor == 0) return;
344 if (SVTK_ViewWindow* aView = VISU::GetViewWindow())
345 aView->RemoveActor(myPreviewActor);
346 myPreviewActor->Delete();
351 //------------------------------------------------------------------------------
352 void VisuGUI_CutLinesDlg::onPlaneSelect (int theId)
354 for (int i = 0; i < mySelPlane2->count(); i++)
355 mySelPlane2->find(i)->setEnabled(true);
356 QButton* aBtn = mySelPlane2->find(theId);
357 aBtn->setEnabled(false);
360 myRotXLbl->setText( tr("LBL_ROT_X"));
361 myRotYLbl->setText( tr("LBL_ROT_Y"));
362 ((QRadioButton*)mySelPlane2->find(1))->setChecked(true);
363 onCutSelect(1, false);
366 myRotXLbl->setText( tr("LBL_ROT_Y"));
367 myRotYLbl->setText( tr("LBL_ROT_Z"));
368 ((QRadioButton*)mySelPlane2->find(2))->setChecked(true);
369 onCutSelect(2, false);
372 myRotXLbl->setText( tr("LBL_ROT_Z"));
373 myRotYLbl->setText( tr("LBL_ROT_X"));
374 ((QRadioButton*)mySelPlane2->find(0))->setChecked(true);
375 onCutSelect(0, false);
377 setBaseDefault(false);
381 //------------------------------------------------------------------------------
382 void VisuGUI_CutLinesDlg::onCutSelect (int theId, bool theUpdate)
386 myRotXLbl2->setText( tr("LBL_ROT_X"));
387 myRotYLbl2->setText( tr("LBL_ROT_Y"));
390 myRotXLbl2->setText( tr("LBL_ROT_Y"));
391 myRotYLbl2->setText( tr("LBL_ROT_Z"));
394 myRotXLbl2->setText( tr("LBL_ROT_Z"));
395 myRotYLbl2->setText( tr("LBL_ROT_X"));
397 if (SVTK_ViewWindow* aView = VISU::GetViewWindow()) {
398 if (theUpdate && myPreviewCheck->isChecked() && (myCutLines != NULL)) {
399 /*myCutLines->SetOrientation2(getOrientaion(false),
400 myRotXSpn2->value()*PI/180.,
401 myRotYSpn2->value()*PI/180.);
402 myCutLines->SetDisplacement2(myPosSpn2->value());*/
403 //myCutLines->GetPL()->Update();
411 //------------------------------------------------------------------------------
412 void VisuGUI_CutLinesDlg::setBaseDefault (bool theUpdate)
414 if (!hasInit) return;
416 if (myCBSetDef->isChecked()) {
417 if (!myCutLines->IsDefault()) myCutLines->SetDefault();
418 /*myCutLines->SetOrientation(getOrientaion(),
419 myRotXSpn->value()*PI/180.,
420 myRotYSpn->value()*PI/180.);
421 myCutLines->SetDisplacement(myPosSpn->value());*/
422 /* float aPos = myCutLines->GetBasePlanePosition();
423 myBasePlanePos->setText( QString::number(aPos) );
424 myBasePlanePos->setEnabled(false);*/
425 if (SVTK_ViewWindow* aView = VISU::GetViewWindow()) {
426 if (theUpdate && myPreviewCheck->isChecked() && (myCutLines != NULL)) {
427 //myCutLines->SetBasePlanePosition(aPos);
428 // myCutLines->GetPL()->Update();
434 float aPos = myCutLines->GetBasePlanePosition();
435 myBasePlanePos->setText( QString::number(aPos) );
436 myBasePlanePos->setEnabled(false);
438 myBasePlanePos->setEnabled(true);
442 //------------------------------------------------------------------------------
443 void VisuGUI_CutLinesDlg::DrawTable()
445 if (!hasInit) return;
447 int aNbRows = myPosTable->numRows();
448 int aNbPlanes = (int)myNbSpn->value();
450 myCutLines->SetOrientation(getOrientaion(),
451 myRotXSpn->value()*PI/180.,
452 myRotYSpn->value()*PI/180.);
454 myCutLines->SetNbLines(aNbPlanes);
455 myCutLines->SetDisplacement2(myPosSpn2->value());
456 myCutLines->SetOrientation2(getOrientaion(false),
457 myRotXSpn2->value()*PI/180.,
458 myRotYSpn2->value()*PI/180.);
461 for (int i = 0; i < aNbRows; ++i) {
462 QCheckTableItem* aItem = (QCheckTableItem*)myPosTable->item( i, 1 );
463 if (aItem == 0) break;
464 if (!aItem->isChecked())
465 myCutLines->SetLinePosition(i, myPosTable->text(i, 0).toDouble());
468 if (aNbPlanes > aNbRows)
469 myPosTable->insertRows(aNbRows, aNbPlanes - aNbRows );
470 else if (aNbPlanes < aNbRows)
471 myPosTable->setNumRows(aNbPlanes);
473 int aMin = (aNbRows < aNbPlanes)? aNbRows : aNbPlanes;
474 for (int i = 0; i<aMin; i++) {
475 myPosTable->setText(i, 0, QString::number(myCutLines->GetLinePosition(i)));
476 ((QCheckTableItem*)myPosTable->item( i, 1 ))->setChecked(myCutLines->IsDefaultPosition(i));
479 QHeader *vh = myPosTable->verticalHeader();
480 QString str("Plane# %1");
481 for (int i=aMin; i<aNbPlanes; i++) {
482 VisuGUI_NumEditItem* aEditItem = new VisuGUI_NumEditItem
483 (myPosTable, QTableItem::OnTyping, QString::number(myCutLines->GetLinePosition(i)));
484 aEditItem->setReplaceable(false);
485 aEditItem->setEnabled(!myCutLines->IsDefaultPosition(i));
486 myPosTable->setItem(i, 0, aEditItem);
488 QCheckTableItem* aCheck = new QCheckTableItem(myPosTable, 0);
489 aCheck->setChecked(myCutLines->IsDefaultPosition(i));
490 aCheck->setReplaceable(false);
491 myPosTable->setItem(i, 1, aCheck);
493 vh->setLabel( i, str.arg(i+1) );
496 if (SVTK_ViewWindow* aView = VISU::GetViewWindow()) {
497 if (myPreviewCheck->isChecked()) {
498 // myCutLines->GetPL()->Update();
506 //------------------------------------------------------------------------------
507 void VisuGUI_CutLinesDlg::setDefault (int all)
509 myPosTable->setCurrentCell(-1, 1);
510 myPosTable->clearSelection();
511 if (all == 0) return;
513 for (int i = 0; i < (int)myNbSpn->value(); ++i)
514 ((QCheckTableItem*)myPosTable->item( i, 1 ))->setChecked(true);
516 for (int i = 0; i < (int)myNbSpn->value(); ++i) {
517 if ( ((QCheckTableItem*)myPosTable->item( i, 1 ))->isChecked() ) {
518 myCutLines->SetDefaultPosition(i);
519 myPosTable->setText( i, 0, QString::number(myCutLines->GetLinePosition(i)));
520 myPosTable->item( i, 0 )->setEnabled(false);
522 myPosTable->item( i, 0 )->setEnabled(true);
526 //------------------------------------------------------------------------------
527 VISU::CutPlanes::Orientation VisuGUI_CutLinesDlg::getOrientaion (bool IsBasePlane)
536 VISU::CutPlanes::Orientation orient;
537 switch (aBG->id(aBG->selected())) {
539 orient = VISU::CutPlanes::XY;
542 orient = VISU::CutPlanes::YZ;
545 orient = VISU::CutPlanes::ZX;
550 //------------------------------------------------------------------------------
551 void VisuGUI_CutLinesDlg::setOrientation (const VISU::CutPlanes::Orientation orient)
554 case VISU::CutPlanes::XY:
555 ((QRadioButton*)mySelPlane->find(0))->setChecked(true);
558 case VISU::CutPlanes::YZ:
559 ((QRadioButton*)mySelPlane->find(1))->setChecked(true);
562 case VISU::CutPlanes::ZX:
563 ((QRadioButton*)mySelPlane->find(2))->setChecked(true);
568 //------------------------------------------------------------------------------
569 void VisuGUI_CutLinesDlg::setOrientation2 (const VISU::CutPlanes::Orientation orient)
572 case VISU::CutPlanes::XY:
573 ((QRadioButton*)mySelPlane2->find(0))->setChecked(true);
576 case VISU::CutPlanes::YZ:
577 ((QRadioButton*)mySelPlane2->find(1))->setChecked(true);
580 case VISU::CutPlanes::ZX:
581 ((QRadioButton*)mySelPlane2->find(2))->setChecked(true);
586 void VisuGUI_CutLinesDlg::onValueChanged (int theRow, int theCol)
589 QString aTxt = myPosTable->text(theRow, 0);
590 bool isChanged = !aTxt.isEmpty();
591 ((QCheckTableItem*)myPosTable->item(theRow, 1))->setChecked(!isChanged);
593 if (SVTK_ViewWindow* aView = VISU::GetViewWindow()) {
594 if (myPreviewCheck->isChecked()) {
596 //myCutLines->SetLinePosition( theRow, aTxt.toDouble());
597 // myCutLines->GetPL()->Update();
604 bool isDefault = ((QCheckTableItem*)myPosTable->item(theRow, theCol))->isChecked();
606 //myCutLines->SetDefaultPosition(theRow);
607 // myPosTable->setText(theRow, 0, QString::number(myCutLines->GetLinePosition(theRow)));
609 if (SVTK_ViewWindow* aView = VISU::GetViewWindow()) {
610 if (myPreviewCheck->isChecked()) {
612 // myCutLines->GetPL()->Update();
618 myPosTable->setText(theRow, 0, QString::number(myCutLines->GetLinePosition(theRow)));
620 myPosTable->item(theRow, 0)->setEnabled(!isDefault);
624 void VisuGUI_CutLinesDlg::accept()
626 //if ( !VisuGUI::CheckActiveStudyLock() ) {
630 MYGenerateTable = myCreateTable->isChecked();
631 MYGenerateCurve = myCurvesCheck->isChecked();
632 // if (myScalarPane->check()) {
633 /*jfa tmp:((QWidget*)sender())->setDisabled(true);
634 storeToPrsObject(myPrs);
636 if (isGenerateTable()) {
637 visuGUI->GetVisuGen()->CreateTable(myPrs->GetEntry());
638 if (isGenerateCurves()) {
639 SALOMEDSClient_Study* aStudy = study()->studyDS();
640 SALOMEDSClient_SObject* aSObject = aStudy->FindObjectID(myPrs->GetEntry());
642 SALOMEDSClient_ChildIterator* aIter = aStudy->NewChildIterator( aSObject );
643 SALOMEDSClient_StudyBuilder* aBuilder = aStudy->NewBuilder();
644 for ( ;aIter->More(); aIter->Next()) {
645 SALOMEDSClient_SObject* aTblObj = aIter->Value();
647 SALOMEDSClient_GenericAttribute* anAttr;
648 if (aTblObj->FindAttribute(anAttr, "AttributeName")) {
649 visuGUI->CreatePlot(aTblObj);
656 if (GET_VTK_VIEWWINDOW(myMgr)) {
658 visuGUI->CreateActor(myPrs);
663 GET_VTK_VIEWWINDOW(myMgr)->onFitAll();
666 visuGUI->RecreateActor(myPrs);
667 if (VTKViewer_ViewWindow* vf = GET_VTK_VIEWWINDOW(myMgr)) {
668 if (vf->getRenderer()->GetActors()->GetNumberOfItems() > 0) {
669 vf->getRenderer()->ResetCameraClippingRange();
674 SALOMEDSClient_Study* aStudy = study()->studyDS();
675 SALOMEDSClient_SObject* aSObject = aStudy->FindObjectID(myPrs->GetEntry());
677 SALOMEDSClient_ChildIterator* aIter = aStudy->NewChildIterator( aSObject );
678 SALOMEDSClient_StudyBuilder* aBuilder = aStudy->NewBuilder();
679 for ( ;aIter->More(); aIter->Next()) {
680 SALOMEDSClient_SObject* aTblObj = aIter->Value();
682 SALOMEDSClient_GenericAttribute* anAttr;
683 if (aTblObj->FindAttribute(anAttr, "AttributeName")) {
684 aBuilder->RemoveObjectWithChildren(aIter->Value()); // We should have only one child
689 if (isGenerateTable()) {
690 visuGUI->GetVisuGen()->CreateTable(aSObject->GetID().c_str());
691 if (isGenerateCurves()) {
692 SALOMEDSClient_Study* aStudy = study()->studyDS();
693 SALOMEDSClient_ChildIterator* aIter = aStudy->NewChildIterator( aSObject );
694 SALOMEDSClient_StudyBuilder* aBuilder = aStudy->NewBuilder();
695 for ( ;aIter->More(); aIter->Next()) {
696 SALOMEDSClient_SObject* aTblObj = aIter->Value();
698 SALOMEDSClient_GenericAttribute* anAttr;
699 if (aTblObj->FindAttribute(anAttr, "AttributeName")) {
700 visuGUI->CreatePlot(aTblObj);
708 VisuGUI::application()->objectBrowser()->updateTree();*/
714 void VisuGUI_CutLinesDlg::reject()
716 /*jfa tmp:if (myIsCreation) {
717 myPrs->RemoveFromStudy();
718 VisuGUI::application()->objectBrowser()->updateTree();
724 void VisuGUI_CutLinesDlg::onPreviewCheck (bool thePreview)
726 if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) {
728 //storeToPrsObject(myCutLines);
729 // myCutLines->GetPL()->Update();
739 void VisuGUI_CutLinesDlg::onRotation (double theValue)
741 if (myCutLines == NULL) return;
742 if (SVTK_ViewWindow* aView = VISU::GetViewWindow()) {
743 if (myPreviewCheck->isChecked()) {
745 /*myCutLines->SetOrientation(getOrientaion(),
746 myRotXSpn->value()*PI/180.,
747 myRotYSpn->value()*PI/180.);
748 myCutLines->SetOrientation2(getOrientaion(false),
749 myRotXSpn2->value()*PI/180.,
750 myRotYSpn2->value()*PI/180.);*/
751 // myCutLines->GetPL()->Update();
759 void VisuGUI_CutLinesDlg::onPlanePos (const QString& theValue)
761 if (myCutLines == NULL) return;
762 if (SVTK_ViewWindow* aView = VISU::GetViewWindow()) {
763 if (myPreviewCheck->isChecked()) {
764 //myCutLines->SetBasePlanePosition(theValue.toDouble());
765 // myCutLines->GetPL()->Update();
773 //jfa tmp:void VisuGUI_CutLinesDlg::onWindowActivated (SUIT_ViewWindow* theWnd)
775 //jfa tmp: if (theWnd != myStudyWnd)