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_ViewFrame.h"
16 #include "VISU_CutLinesPL.hxx"
17 #include "VISU_Gen_i.hh"
19 #include "QAD_Application.h"
20 #include "QAD_Desktop.h"
24 #include <qtabwidget.h>
25 #include <qhgroupbox.h>
27 #include <vtkRenderer.h>
28 #include <vtkAppendPolyData.h>
29 #include <vtkDataSetMapper.h>
33 extern VisuGUI *visuGUI;
35 #include "QAD_RightFrame.h"
36 #define GET_VTK_VIEWFRAME(aStudy) dynamic_cast<VTKViewer_ViewFrame*>(aStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())
38 bool VisuGUI_CutLinesDlg::MYGenerateTable = true;
39 bool VisuGUI_CutLinesDlg::MYGenerateCurve = true;
41 VisuGUI_CutLinesDlg::VisuGUI_CutLinesDlg(bool theIsCreation)
42 : QDialog( QAD_Application::getDesktop(), "VisuGUI_CutLinesDlg", false, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose),
44 myStudy(QAD_Application::getDesktop()->getActiveStudy())
46 myStudyFrame = myStudy -> getActiveStudyFrame();
47 setCaption( "Cut Lines Definition" );
48 setSizeGripEnabled( true );
49 myIsCreation = theIsCreation;
51 QVBoxLayout* aMainLayout = new QVBoxLayout(this, 7, 6);
52 aMainLayout->setSpacing(5);
57 QTabWidget* aTabPane = new QTabWidget(this);
60 QFrame* aPlanePane = new QFrame(this);
61 QVBoxLayout* aPlaneLayout = new QVBoxLayout( aPlanePane, 5, 6 );
63 mySelPlane = new QHButtonGroup( tr( "TXT_ORIENTATION" ), aPlanePane);
64 mySelPlane->setInsideSpacing( 5 );
65 mySelPlane->setInsideMargin( 5 );
67 QRadioButton* aBxy = new QRadioButton( tr( "|| X-Y" ), mySelPlane); // 0
68 QRadioButton* aByz = new QRadioButton( tr( "|| Y-Z" ), mySelPlane); // 1
69 QRadioButton* aBzx = new QRadioButton( tr( "|| Z-X" ), mySelPlane); // 2
70 aBzx->setChecked(true);
72 aPlaneLayout->addWidget( mySelPlane );
74 QGroupBox* aRotBox = new QGroupBox( tr( "LBL_ROTATION" ), aPlanePane );
75 aRotBox->setColumnLayout(2, Qt::Horizontal );
77 myRotXLbl = new QLabel( tr( "LBL_ROT_X" ), aRotBox);
78 myRotXSpn = new QAD_SpinBoxDbl( aRotBox, -45, 45, 5 );
79 myRotXSpn->setValue( 0 );
80 myRotYLbl = new QLabel( tr( "LBL_ROT_Y" ), aRotBox );
81 myRotYSpn = new QAD_SpinBoxDbl( aRotBox, -45, 45, 5 );
82 myRotYSpn->setValue( 0 );
84 aPlaneLayout->addWidget( aRotBox );
86 QHGroupBox* aBaseBox = new QHGroupBox( tr( "Base plane position" ), aPlanePane );
87 myBasePlanePos = new QLineEdit (aBaseBox);
88 mydvalidator = new QDoubleValidator(this);
89 mydvalidator->setDecimals(32);
90 myBasePlanePos->setValidator(mydvalidator);
92 myCBSetDef = new QCheckBox(tr("Set default"),aBaseBox);
94 aPlaneLayout->addWidget( aBaseBox );
96 QHBox* aPosBox = new QHBox(aPlanePane);
97 aPosBox->setSpacing(5);
98 QLabel* aPosLbl = new QLabel( tr( "LBL_POS" ), aPosBox );
99 myPosSpn = new QAD_SpinBoxDbl( aPosBox, 0, 1, 0.1 );
100 myPosSpn->setValue( 0.5 );
101 aPlaneLayout->addWidget( aPosBox );
103 myPreviewCheck = new QCheckBox(tr("LBL_SHOW_PREVIEW"), aPlanePane);
104 myPreviewCheck->setChecked(false);
105 aPlaneLayout->addWidget( myPreviewCheck );
107 myCreateTable = new QCheckBox(tr("LBL_GENERATE_TABLE"), aPlanePane);
108 myCreateTable->setChecked(MYGenerateTable);
109 aPlaneLayout->addWidget( myCreateTable );
111 QHBox* aCheckPane = new QHBox(aPlanePane);
112 QLabel* aLbl = new QLabel(" ", aCheckPane);
113 aCheckPane->setStretchFactor(aLbl, 0);
114 myCurvesCheck = new QCheckBox(tr("LBL_GENERATE_CURVES"), aCheckPane);
115 aCheckPane->setStretchFactor(aCheckPane, 0);
116 myCurvesCheck->setChecked(MYGenerateCurve);
117 myCurvesCheck->setEnabled(MYGenerateTable);
118 QLabel* aLbl2 = new QLabel(" ", aCheckPane);
119 aCheckPane->setStretchFactor(aLbl2, 1);
120 aPlaneLayout->addWidget( aCheckPane );
122 aPlaneLayout->addStretch();
125 aTabPane->addTab( aPlanePane, tr("LBL_LINES_PLANE") );
128 QFrame* aLinesPane = new QFrame(this);
129 QVBoxLayout* aLinesLayout = new QVBoxLayout( aLinesPane, 5, 6 );
131 mySelPlane2 = new QHButtonGroup( tr( "TXT_ORIENTATION" ), aLinesPane);
132 mySelPlane2->setInsideSpacing( 5 );
133 mySelPlane2->setInsideMargin( 5 );
135 QRadioButton* aBxy2 = new QRadioButton( tr( "|| X-Y" ), mySelPlane2); // 0
136 QRadioButton* aByz2 = new QRadioButton( tr( "|| Y-Z" ), mySelPlane2); // 1
137 QRadioButton* aBzx2 = new QRadioButton( tr( "|| Z-X" ), mySelPlane2); // 2
138 aBzx2->setEnabled(false);
139 aByz2->setChecked(true);
140 aLinesLayout->addWidget( mySelPlane2 );
142 QGroupBox* aRotBox2 = new QGroupBox( tr( "LBL_ROTATION" ), aLinesPane );
143 aRotBox2->setColumnLayout(2, Qt::Horizontal );
145 myRotXLbl2 = new QLabel( tr( "LBL_ROT_X" ), aRotBox2);
146 myRotXSpn2 = new QAD_SpinBoxDbl( aRotBox2, -45, 45, 5 );
147 myRotXSpn2->setValue( 0 );
148 myRotYLbl2 = new QLabel( tr( "LBL_ROT_Y" ), aRotBox2 );
149 myRotYSpn2 = new QAD_SpinBoxDbl( aRotBox2, -45, 45, 5 );
150 myRotYSpn2->setValue( 0 );
151 aLinesLayout->addWidget( aRotBox2 );
153 QHBox* aNbBox = new QHBox(aLinesPane);
154 aNbBox->setSpacing(5);
155 QLabel* aNbLbl = new QLabel( tr( "LBL_NB_PLANS" ), aNbBox );
156 myNbSpn = new QAD_SpinBoxDbl( aNbBox, 1, 100, 1 );
157 myNbSpn->setValue( 10 );
159 aLinesLayout->addWidget( aNbBox );
161 myPosTable = new QTable(aLinesPane, "Positions of cut planes" );
162 myPosTable->setMaximumHeight( 227 );
163 myPosTable->setMinimumWidth( 294 );
164 myPosTable->setNumCols(2);
165 myPosTable->setNumRows(0);
167 QHeader *th = myPosTable->horizontalHeader();
168 th->setLabel( 0, "Position" );
169 th->setLabel( 1, "Set default" );
171 aLinesLayout->addWidget( myPosTable );
173 QHBox* aPosBox2 = new QHBox(aLinesPane);
174 aPosBox2->setSpacing(5);
175 QLabel* aPosLbl2 = new QLabel( tr( "LBL_POS" ), aPosBox2 );
176 myPosSpn2 = new QAD_SpinBoxDbl( aPosBox2, 0, 1, 0.1 );
177 myPosSpn2->setValue( 0.5 );
178 aLinesLayout->addWidget( aPosBox2 );
179 aLinesLayout->addStretch();
181 aTabPane->addTab( aLinesPane, tr("LBL_LINES_CUT") );
183 myScalarPane = new VisuGUI_ScalarBarPane(this, false);
184 myScalarPane->setMargin( 5 );
185 aTabPane->addTab(myScalarPane, "Scalar Bar");
187 aMainLayout->addWidget(aTabPane);
190 QHBox* aBtnBox = new QHBox(this);
191 aBtnBox->setFrameStyle(QFrame::Box | QFrame::Sunken);
192 aBtnBox->setLineWidth( 1 );
193 QHBoxLayout* aBtnLayout = (QHBoxLayout*) aBtnBox->layout();
194 aBtnLayout->setAutoAdd( false );
195 aBtnLayout->setSpacing( 5 );
196 aBtnLayout->setMargin( 11 );
198 QPushButton* aOkBtn = new QPushButton(tr( "VISU_BUT_OK" ), aBtnBox);
199 aOkBtn->setAutoDefault( TRUE );
200 aOkBtn->setDefault( true );
201 aBtnLayout->addWidget(aOkBtn);
203 aBtnLayout->addStretch();
205 QPushButton* aCloseBtn = new QPushButton(tr("BUT_CANCEL"), aBtnBox);
206 aBtnLayout->addWidget(aCloseBtn);
208 aMainLayout->addWidget(aBtnBox);
212 // signals and slots connections
213 connect(mySelPlane, SIGNAL(clicked(int)), this, SLOT(onPlaneSelect(int)));
214 connect(myCBSetDef , SIGNAL( toggled(bool) ), this , SLOT( setBaseDefault() ) );
215 connect(myPosSpn , SIGNAL( valueChanged( double ) ), this , SLOT( setBaseDefault() ) );
216 connect(mySelPlane2, SIGNAL(clicked(int)), this, SLOT(onCutSelect(int)));
217 connect( myNbSpn, SIGNAL( valueChanged( double )), this, SLOT( DrawTable( ) ) );
218 connect( th, SIGNAL( clicked(int)), this, SLOT( setDefault(int) ) );
219 connect( myPosSpn2, SIGNAL( valueChanged( double )), this, SLOT( DrawTable( ) ) );
220 connect( myPreviewCheck, SIGNAL( toggled( bool )), this, SLOT( onPreviewCheck( bool ) ) );
221 connect( myPosTable, SIGNAL(valueChanged(int, int)), this, SLOT(onValueChanged(int, int)) );
222 connect( myRotXSpn, SIGNAL( valueChanged( double )), this, SLOT( onRotation( double ) ) );
223 connect( myRotYSpn, SIGNAL( valueChanged( double )), this, SLOT( onRotation( double ) ) );
224 connect( myRotXSpn2, SIGNAL( valueChanged( double )), this, SLOT( onRotation( double ) ) );
225 connect( myRotYSpn2, SIGNAL( valueChanged( double )), this, SLOT( onRotation( double ) ) );
226 connect( myBasePlanePos, SIGNAL( textChanged(const QString& )), this, SLOT( onPlanePos(const QString& ) ) );
227 connect( myCreateTable, SIGNAL( toggled(bool)), myCurvesCheck, SLOT( setEnabled(bool) ));
229 connect(aOkBtn, SIGNAL(clicked()), this, SLOT(accept()));
230 connect(aCloseBtn, SIGNAL(clicked()), this, SLOT(reject()));
231 connect( myStudy, SIGNAL(closed()), this, SLOT( reject() ) );
232 connect( myStudyFrame, SIGNAL(sfStudyFrameActivated(QAD_StudyFrame*)), this, SLOT(onFrameActivated(QAD_StudyFrame*)));
238 VisuGUI_CutLinesDlg::~VisuGUI_CutLinesDlg()
241 if(myCutLines) delete myCutLines;
242 if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy))
246 //------------------------------------------------------------------------------
247 void VisuGUI_CutLinesDlg::initFromPrsObject(VISU::CutLines_i* thePrs) {
249 myScalarPane->initFromPrsObject(thePrs);
251 myRotXSpn->setValue(thePrs->GetRotateX()*180./PI);
252 myRotYSpn->setValue(thePrs->GetRotateY()*180./PI);
253 myPosSpn->setValue(thePrs->GetDisplacement());
254 setOrientation(thePrs->GetOrientationType());
256 myNbSpn->setValue( thePrs->GetNbLines() );
257 myRotXSpn2->setValue(thePrs->GetRotateX2()*180./PI);
258 myRotYSpn2->setValue(thePrs->GetRotateY2()*180./PI);
259 myPosSpn2->setValue(thePrs->GetDisplacement2());
260 setOrientation2(thePrs->GetOrientationType2());
263 myCutLines = new VISU::CutLines_i(thePrs->GetResult(),false);
264 myCutLines->SameAs(thePrs);
265 myBasePlanePos->setText( QString::number(myCutLines->GetBasePlanePosition()) );
266 myCBSetDef->setChecked(thePrs->IsDefault());
270 if (myPreviewCheck->isChecked()) {
276 //------------------------------------------------------------------------------
277 int VisuGUI_CutLinesDlg::storeToPrsObject(VISU::CutLines_i* thePrs) {
279 myScalarPane->storeToPrsObject(thePrs);
281 thePrs->SetOrientation(getOrientaion(),myRotXSpn->value()*PI/180.,myRotYSpn->value()*PI/180.);
282 thePrs->SetDisplacement(myPosSpn->value());
283 thePrs->SetNbLines((int)myNbSpn->value());
285 thePrs->SetOrientation2(getOrientaion(false),myRotXSpn2->value()*PI/180.,myRotYSpn2->value()*PI/180.);
286 thePrs->SetDisplacement2(myPosSpn2->value());
288 if (!myCBSetDef->isChecked())
289 thePrs->SetBasePlanePosition(myBasePlanePos->text().toDouble());
290 else thePrs->SetDefault();
292 for (int i = 0; i < (int)myNbSpn->value(); ++i)
294 if (!((QCheckTableItem*)myPosTable->item( i, 1 ))->isChecked())
295 thePrs->SetLinePosition( i, myPosTable->text( i, 0 ).toDouble() );
296 else thePrs->SetDefaultPosition(i);
302 //------------------------------------------------------------------------------
303 void VisuGUI_CutLinesDlg::createPlanes() {
304 if (myStudy->getActiveStudyFrame()->getTypeView() != VIEW_VTK) return;
305 if (myCutLines == NULL) return;
306 if (myPreviewActor != 0) return;
308 vtkAppendPolyData* aPolyData = myCutLines->GetCutLinesPL()->GetAppendPolyData();
309 vtkDataSetMapper* aPlaneMapper = vtkDataSetMapper::New();
310 aPlaneMapper->SetInput(aPolyData->GetOutput());
311 aPlaneMapper->ScalarVisibilityOff();
313 myPreviewActor = SALOME_Actor::New();
314 myPreviewActor->PickableOff();
315 myPreviewActor->SetMapper(aPlaneMapper);
316 aPlaneMapper->Delete();
317 GET_VTK_VIEWFRAME(myStudy)->AddActor(myPreviewActor);
320 //------------------------------------------------------------------------------
321 void VisuGUI_CutLinesDlg::deletePlanes() {
322 if (myPreviewActor == 0) return;
323 if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy))
324 vf->RemoveActor(myPreviewActor);
325 myPreviewActor->Delete();
330 //------------------------------------------------------------------------------
331 void VisuGUI_CutLinesDlg::onPlaneSelect(int theId) {
332 for (int i = 0; i < mySelPlane2->count(); i++)
333 mySelPlane2->find(i)->setEnabled(true);
334 QButton* aBtn = mySelPlane2->find(theId);
335 aBtn->setEnabled(false);
338 myRotXLbl->setText( tr("LBL_ROT_X"));
339 myRotYLbl->setText( tr("LBL_ROT_Y"));
340 ((QRadioButton*)mySelPlane2->find(1))->setChecked(true);
341 onCutSelect(1, false);
344 myRotXLbl->setText( tr("LBL_ROT_Y"));
345 myRotYLbl->setText( tr("LBL_ROT_Z"));
346 ((QRadioButton*)mySelPlane2->find(2))->setChecked(true);
347 onCutSelect(2, false);
350 myRotXLbl->setText( tr("LBL_ROT_Z"));
351 myRotYLbl->setText( tr("LBL_ROT_X"));
352 ((QRadioButton*)mySelPlane2->find(0))->setChecked(true);
353 onCutSelect(0, false);
355 setBaseDefault(false);
359 //------------------------------------------------------------------------------
360 void VisuGUI_CutLinesDlg::onCutSelect(int theId, bool theUpdate) {
363 myRotXLbl2->setText( tr("LBL_ROT_X"));
364 myRotYLbl2->setText( tr("LBL_ROT_Y"));
367 myRotXLbl2->setText( tr("LBL_ROT_Y"));
368 myRotYLbl2->setText( tr("LBL_ROT_Z"));
371 myRotXLbl2->setText( tr("LBL_ROT_Z"));
372 myRotYLbl2->setText( tr("LBL_ROT_X"));
374 if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
375 if (theUpdate && myPreviewCheck->isChecked() && (myCutLines != NULL)) {
376 myCutLines->SetOrientation2(getOrientaion(false),myRotXSpn2->value()*PI/180.,myRotYSpn2->value()*PI/180.);
377 myCutLines->SetDisplacement2(myPosSpn2->value());
378 myCutLines->GetPL()->Update();
386 //------------------------------------------------------------------------------
387 void VisuGUI_CutLinesDlg::setBaseDefault(bool theUpdate) {
388 if (!hasInit) return;
390 if ( myCBSetDef->isChecked() )
392 if (!myCutLines->IsDefault()) myCutLines->SetDefault();
393 myCutLines->SetOrientation(getOrientaion(),myRotXSpn->value()*PI/180.,myRotYSpn->value()*PI/180.);
394 myCutLines->SetDisplacement(myPosSpn->value());
395 float aPos = myCutLines->GetBasePlanePosition();
396 myBasePlanePos->setText( QString::number(aPos) );
397 myBasePlanePos->setEnabled(false);
398 if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
399 if (theUpdate && myPreviewCheck->isChecked() && (myCutLines != NULL)) {
400 myCutLines->SetBasePlanePosition(aPos);
401 myCutLines->GetPL()->Update();
408 else myBasePlanePos->setEnabled(true);
411 //------------------------------------------------------------------------------
412 void VisuGUI_CutLinesDlg::DrawTable()
414 if (!hasInit) return;
416 int aNbRows = myPosTable->numRows();
417 int aNbPlanes = (int)myNbSpn->value();
419 myCutLines->SetOrientation(getOrientaion(),myRotXSpn->value()*PI/180.,myRotYSpn->value()*PI/180.);
421 myCutLines->SetNbLines(aNbPlanes);
422 myCutLines->SetDisplacement2(myPosSpn2->value());
423 myCutLines->SetOrientation2(getOrientaion(false),myRotXSpn2->value()*PI/180.,myRotYSpn2->value()*PI/180.);
426 for (int i = 0; i < aNbRows; ++i) {
427 QCheckTableItem* aItem = (QCheckTableItem*)myPosTable->item( i, 1 );
428 if (aItem == 0) break;
429 if (!aItem->isChecked())
430 myCutLines->SetLinePosition(i, myPosTable->text(i, 0).toDouble());
433 if (aNbPlanes > aNbRows)
434 myPosTable->insertRows(aNbRows, aNbPlanes - aNbRows );
435 else if (aNbPlanes < aNbRows)
436 myPosTable->setNumRows(aNbPlanes);
438 int aMin = (aNbRows < aNbPlanes)? aNbRows : aNbPlanes;
439 for (int i = 0; i<aMin; i++) {
440 myPosTable->setText(i, 0, QString::number(myCutLines->GetLinePosition(i)));
441 ((QCheckTableItem*)myPosTable->item( i, 1 ))->setChecked(myCutLines->IsDefaultPosition(i));
444 QHeader *vh = myPosTable->verticalHeader();
445 QString str("Plane# %1");
446 for (int i=aMin; i<aNbPlanes; i++) {
447 VisuGUI_NumEditItem* aEditItem = new VisuGUI_NumEditItem(myPosTable,
448 QTableItem::OnTyping,
449 QString::number(myCutLines->GetLinePosition(i)));
450 aEditItem->setReplaceable(false);
451 aEditItem->setEnabled(!myCutLines->IsDefaultPosition(i));
452 myPosTable->setItem(i, 0, aEditItem);
454 QCheckTableItem* aCheck = new QCheckTableItem(myPosTable, 0);
455 aCheck->setChecked(myCutLines->IsDefaultPosition(i));
456 aCheck->setReplaceable(false);
457 myPosTable->setItem(i, 1, aCheck);
459 vh->setLabel( i, str.arg(i+1) );
462 if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
463 if (myPreviewCheck->isChecked()) {
464 myCutLines->GetPL()->Update();
472 //------------------------------------------------------------------------------
473 void VisuGUI_CutLinesDlg::setDefault(int all)
475 myPosTable->setCurrentCell(-1, 1);
476 myPosTable->clearSelection();
477 if (all == 0) return;
479 for (int i = 0; i < (int)myNbSpn->value(); ++i)
480 ((QCheckTableItem*)myPosTable->item( i, 1 ))->setChecked(true);
482 for (int i = 0; i < (int)myNbSpn->value(); ++i) {
483 if ( ((QCheckTableItem*)myPosTable->item( i, 1 ))->isChecked() ) {
484 myCutLines->SetDefaultPosition(i);
485 myPosTable->setText( i, 0, QString::number(myCutLines->GetLinePosition(i)));
486 myPosTable->item( i, 0 )->setEnabled(false);
488 myPosTable->item( i, 0 )->setEnabled(true);
492 //------------------------------------------------------------------------------
493 VISU::CutPlanes::Orientation VisuGUI_CutLinesDlg::getOrientaion(bool IsBasePlane)
502 VISU::CutPlanes::Orientation orient;
503 switch (aBG->id(aBG->selected())) {
505 orient = VISU::CutPlanes::XY;
508 orient = VISU::CutPlanes::YZ;
511 orient = VISU::CutPlanes::ZX;
516 //------------------------------------------------------------------------------
517 void VisuGUI_CutLinesDlg::setOrientation( const VISU::CutPlanes::Orientation orient)
520 case VISU::CutPlanes::XY:
521 ((QRadioButton*)mySelPlane->find(0))->setChecked(true);
524 case VISU::CutPlanes::YZ:
525 ((QRadioButton*)mySelPlane->find(1))->setChecked(true);
528 case VISU::CutPlanes::ZX:
529 ((QRadioButton*)mySelPlane->find(2))->setChecked(true);
534 //------------------------------------------------------------------------------
535 void VisuGUI_CutLinesDlg::setOrientation2( const VISU::CutPlanes::Orientation orient )
538 case VISU::CutPlanes::XY:
539 ((QRadioButton*)mySelPlane2->find(0))->setChecked(true);
542 case VISU::CutPlanes::YZ:
543 ((QRadioButton*)mySelPlane2->find(1))->setChecked(true);
546 case VISU::CutPlanes::ZX:
547 ((QRadioButton*)mySelPlane2->find(2))->setChecked(true);
553 void VisuGUI_CutLinesDlg::onValueChanged(int theRow, int theCol) {
555 QString aTxt = myPosTable->text(theRow, 0);
556 bool isChanged = !aTxt.isEmpty();
557 ((QCheckTableItem*)myPosTable->item(theRow, 1))->setChecked(!isChanged);
559 if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
560 if (myPreviewCheck->isChecked()) {
562 myCutLines->SetLinePosition( theRow, aTxt.toDouble());
563 myCutLines->GetPL()->Update();
570 bool isDefault = ((QCheckTableItem*)myPosTable->item(theRow, theCol))->isChecked();
572 myCutLines->SetDefaultPosition(theRow);
573 myPosTable->setText(theRow, 0, QString::number(myCutLines->GetLinePosition(theRow)));
575 if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
576 if (myPreviewCheck->isChecked()) {
578 myCutLines->GetPL()->Update();
585 myPosTable->item(theRow, 0)->setEnabled(!isDefault);
590 void VisuGUI_CutLinesDlg::accept() {
591 MYGenerateTable = myCreateTable->isChecked();
592 MYGenerateCurve = myCurvesCheck->isChecked();
593 if (myScalarPane->check()) {
594 ((QWidget*)sender())->setDisabled(true);
595 storeToPrsObject(myPrs);
597 if (isGenerateTable()) {
598 visuGUI->GetVisuGen()->CreateTable(myPrs->GetEntry());
599 if (isGenerateCurves()) {
600 SALOMEDS::Study_var aStudy = myStudy->getStudyDocument();
601 SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(myPrs->GetEntry());
602 if(!aSObject->_is_nil()) {
603 SALOMEDS::ChildIterator_var aIter = aStudy->NewChildIterator( aSObject );
604 SALOMEDS::StudyBuilder_var aBuilder = aStudy->NewBuilder();
605 for ( ;aIter->More(); aIter->Next()) {
606 SALOMEDS::SObject_var aTblObj = aIter->Value();
607 if (!aTblObj->_is_nil()) {
608 SALOMEDS::GenericAttribute_var anAttr;
609 if (aTblObj->FindAttribute(anAttr, "AttributeName")) {
610 visuGUI->CreatePlot(aTblObj);
617 if (myStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
619 visuGUI->CreateActor(myPrs);
625 GET_VTK_VIEWFRAME(myStudy)->onViewFitAll();
628 visuGUI->RecreateActor(myPrs);
629 if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
630 if ( vf->getRenderer()->GetActors()->GetNumberOfItems () > 0 ) {
631 vf->getRenderer()->ResetCameraClippingRange();
636 SALOMEDS::Study_var aStudy = myStudy->getStudyDocument();
637 SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(myPrs->GetEntry());
638 if(!aSObject->_is_nil()) {
639 SALOMEDS::ChildIterator_var aIter = aStudy->NewChildIterator( aSObject );
640 SALOMEDS::StudyBuilder_var aBuilder = aStudy->NewBuilder();
641 for ( ;aIter->More(); aIter->Next()) {
642 SALOMEDS::SObject_var aTblObj = aIter->Value();
643 if (!aTblObj->_is_nil()) {
644 SALOMEDS::GenericAttribute_var anAttr;
645 if (aTblObj->FindAttribute(anAttr, "AttributeName")) {
646 aBuilder->RemoveObjectWithChildren(aIter->Value()); // We should have only one child
651 if (isGenerateTable()) {
652 visuGUI->GetVisuGen()->CreateTable(aSObject->GetID());
653 if (isGenerateCurves()) {
654 SALOMEDS::Study_var aStudy = myStudy->getStudyDocument();
655 SALOMEDS::ChildIterator_var aIter = aStudy->NewChildIterator( aSObject );
656 SALOMEDS::StudyBuilder_var aBuilder = aStudy->NewBuilder();
657 for ( ;aIter->More(); aIter->Next()) {
658 SALOMEDS::SObject_var aTblObj = aIter->Value();
659 if (!aTblObj->_is_nil()) {
660 SALOMEDS::GenericAttribute_var anAttr;
661 if (aTblObj->FindAttribute(anAttr, "AttributeName")) {
662 visuGUI->CreatePlot(aTblObj);
670 myStudy->updateObjBrowser();
675 void VisuGUI_CutLinesDlg::reject() {
677 visuGUI->DeletePresentation(myPrs);
678 myStudy->updateObjBrowser();
683 void VisuGUI_CutLinesDlg::onPreviewCheck(bool thePreview) {
684 if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
686 storeToPrsObject(myCutLines);
687 myCutLines->GetPL()->Update();
697 void VisuGUI_CutLinesDlg::onRotation(double theValue) {
698 if (myCutLines == NULL) return;
699 if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
700 if (myPreviewCheck->isChecked()) {
701 myCutLines->SetOrientation(getOrientaion(),myRotXSpn->value()*PI/180.,myRotYSpn->value()*PI/180.);
702 myCutLines->SetOrientation2(getOrientaion(false),myRotXSpn2->value()*PI/180.,myRotYSpn2->value()*PI/180.);
703 myCutLines->GetPL()->Update();
711 void VisuGUI_CutLinesDlg::onPlanePos(const QString& theValue) {
712 if (myCutLines == NULL) return;
713 if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
714 if (myPreviewCheck->isChecked()) {
715 myCutLines->SetBasePlanePosition(theValue.toDouble());
716 myCutLines->GetPL()->Update();
724 void VisuGUI_CutLinesDlg::onFrameActivated( QAD_StudyFrame* theFrame) {
725 if (theFrame != myStudyFrame)