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 <vtkPolyData.h>
29 #include <vtkAppendPolyData.h>
30 #include <vtkDataSetMapper.h>
34 extern VisuGUI *visuGUI;
36 #include "QAD_RightFrame.h"
37 #define GET_VTK_VIEWFRAME(aStudy) dynamic_cast<VTKViewer_ViewFrame*>(aStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())
39 bool VisuGUI_CutLinesDlg::MYGenerateTable = true;
40 bool VisuGUI_CutLinesDlg::MYGenerateCurve = true;
42 VisuGUI_CutLinesDlg::VisuGUI_CutLinesDlg(bool theIsCreation)
43 : QDialog( QAD_Application::getDesktop(), "VisuGUI_CutLinesDlg", false, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose),
45 myStudy(QAD_Application::getDesktop()->getActiveStudy())
47 myStudyFrame = myStudy -> getActiveStudyFrame();
48 setCaption( "Cut Lines Definition" );
49 setSizeGripEnabled( true );
50 myIsCreation = theIsCreation;
52 QVBoxLayout* aMainLayout = new QVBoxLayout(this, 7, 6);
53 aMainLayout->setSpacing(5);
58 QTabWidget* aTabPane = new QTabWidget(this);
61 QFrame* aPlanePane = new QFrame(this);
62 QVBoxLayout* aPlaneLayout = new QVBoxLayout( aPlanePane, 5, 6 );
64 mySelPlane = new QHButtonGroup( tr( "TXT_ORIENTATION" ), aPlanePane);
65 mySelPlane->setInsideSpacing( 5 );
66 mySelPlane->setInsideMargin( 5 );
68 QRadioButton* aBxy = new QRadioButton( tr( "|| X-Y" ), mySelPlane); // 0
69 QRadioButton* aByz = new QRadioButton( tr( "|| Y-Z" ), mySelPlane); // 1
70 QRadioButton* aBzx = new QRadioButton( tr( "|| Z-X" ), mySelPlane); // 2
71 aBzx->setChecked(true);
73 aPlaneLayout->addWidget( mySelPlane );
75 QGroupBox* aRotBox = new QGroupBox( tr( "LBL_ROTATION" ), aPlanePane );
76 aRotBox->setColumnLayout(2, Qt::Horizontal );
78 myRotXLbl = new QLabel( tr( "LBL_ROT_X" ), aRotBox);
79 myRotXSpn = new QAD_SpinBoxDbl( aRotBox, -45, 45, 5 );
80 myRotXSpn->setValue( 0 );
81 myRotYLbl = new QLabel( tr( "LBL_ROT_Y" ), aRotBox );
82 myRotYSpn = new QAD_SpinBoxDbl( aRotBox, -45, 45, 5 );
83 myRotYSpn->setValue( 0 );
85 aPlaneLayout->addWidget( aRotBox );
87 QHGroupBox* aBaseBox = new QHGroupBox( tr( "Base plane position" ), aPlanePane );
88 myBasePlanePos = new QLineEdit (aBaseBox);
89 mydvalidator = new QDoubleValidator(this);
90 mydvalidator->setDecimals(32);
91 myBasePlanePos->setValidator(mydvalidator);
93 myCBSetDef = new QCheckBox(tr("Set default"),aBaseBox);
95 aPlaneLayout->addWidget( aBaseBox );
97 QHBox* aPosBox = new QHBox(aPlanePane);
98 aPosBox->setSpacing(5);
99 QLabel* aPosLbl = new QLabel( tr( "LBL_POS" ), aPosBox );
100 myPosSpn = new QAD_SpinBoxDbl( aPosBox, 0, 1, 0.1 );
101 myPosSpn->setValue( 0.5 );
102 aPlaneLayout->addWidget( aPosBox );
104 myPreviewCheck = new QCheckBox(tr("LBL_SHOW_PREVIEW"), aPlanePane);
105 myPreviewCheck->setChecked(false);
106 aPlaneLayout->addWidget( myPreviewCheck );
108 myCreateTable = new QCheckBox(tr("LBL_GENERATE_TABLE"), aPlanePane);
109 myCreateTable->setChecked(MYGenerateTable);
110 aPlaneLayout->addWidget( myCreateTable );
112 QHBox* aCheckPane = new QHBox(aPlanePane);
113 QLabel* aLbl = new QLabel(" ", aCheckPane);
114 aCheckPane->setStretchFactor(aLbl, 0);
115 myCurvesCheck = new QCheckBox(tr("LBL_GENERATE_CURVES"), aCheckPane);
116 aCheckPane->setStretchFactor(aCheckPane, 0);
117 myCurvesCheck->setChecked(MYGenerateCurve);
118 myCurvesCheck->setEnabled(MYGenerateTable);
119 QLabel* aLbl2 = new QLabel(" ", aCheckPane);
120 aCheckPane->setStretchFactor(aLbl2, 1);
121 aPlaneLayout->addWidget( aCheckPane );
123 aPlaneLayout->addStretch();
126 aTabPane->addTab( aPlanePane, tr("LBL_LINES_PLANE") );
129 QFrame* aLinesPane = new QFrame(this);
130 QVBoxLayout* aLinesLayout = new QVBoxLayout( aLinesPane, 5, 6 );
132 mySelPlane2 = new QHButtonGroup( tr( "TXT_ORIENTATION" ), aLinesPane);
133 mySelPlane2->setInsideSpacing( 5 );
134 mySelPlane2->setInsideMargin( 5 );
136 QRadioButton* aBxy2 = new QRadioButton( tr( "|| X-Y" ), mySelPlane2); // 0
137 QRadioButton* aByz2 = new QRadioButton( tr( "|| Y-Z" ), mySelPlane2); // 1
138 QRadioButton* aBzx2 = new QRadioButton( tr( "|| Z-X" ), mySelPlane2); // 2
139 aBzx2->setEnabled(false);
140 aByz2->setChecked(true);
141 aLinesLayout->addWidget( mySelPlane2 );
143 QGroupBox* aRotBox2 = new QGroupBox( tr( "LBL_ROTATION" ), aLinesPane );
144 aRotBox2->setColumnLayout(2, Qt::Horizontal );
146 myRotXLbl2 = new QLabel( tr( "LBL_ROT_X" ), aRotBox2);
147 myRotXSpn2 = new QAD_SpinBoxDbl( aRotBox2, -45, 45, 5 );
148 myRotXSpn2->setValue( 0 );
149 myRotYLbl2 = new QLabel( tr( "LBL_ROT_Y" ), aRotBox2 );
150 myRotYSpn2 = new QAD_SpinBoxDbl( aRotBox2, -45, 45, 5 );
151 myRotYSpn2->setValue( 0 );
152 aLinesLayout->addWidget( aRotBox2 );
154 QHBox* aNbBox = new QHBox(aLinesPane);
155 aNbBox->setSpacing(5);
156 QLabel* aNbLbl = new QLabel( tr( "LBL_NB_PLANS" ), aNbBox );
157 myNbSpn = new QAD_SpinBoxDbl( aNbBox, 1, 100, 1 );
158 myNbSpn->setValue( 10 );
160 aLinesLayout->addWidget( aNbBox );
162 myPosTable = new QTable(aLinesPane, "Positions of cut planes" );
163 myPosTable->setMaximumHeight( 227 );
164 myPosTable->setMinimumWidth( 294 );
165 myPosTable->setNumCols(2);
166 myPosTable->setNumRows(0);
168 QHeader *th = myPosTable->horizontalHeader();
169 th->setLabel( 0, "Position" );
170 th->setLabel( 1, "Set default" );
172 aLinesLayout->addWidget( myPosTable );
174 QHBox* aPosBox2 = new QHBox(aLinesPane);
175 aPosBox2->setSpacing(5);
176 QLabel* aPosLbl2 = new QLabel( tr( "LBL_POS" ), aPosBox2 );
177 myPosSpn2 = new QAD_SpinBoxDbl( aPosBox2, 0, 1, 0.1 );
178 myPosSpn2->setValue( 0.5 );
179 aLinesLayout->addWidget( aPosBox2 );
180 aLinesLayout->addStretch();
182 aTabPane->addTab( aLinesPane, tr("LBL_LINES_CUT") );
184 myScalarPane = new VisuGUI_ScalarBarPane(this, false);
185 myScalarPane->setMargin( 5 );
186 aTabPane->addTab(myScalarPane, "Scalar Bar");
188 aMainLayout->addWidget(aTabPane);
191 QHBox* aBtnBox = new QHBox(this);
192 aBtnBox->setFrameStyle(QFrame::Box | QFrame::Sunken);
193 aBtnBox->setLineWidth( 1 );
194 QHBoxLayout* aBtnLayout = (QHBoxLayout*) aBtnBox->layout();
195 aBtnLayout->setAutoAdd( false );
196 aBtnLayout->setSpacing( 5 );
197 aBtnLayout->setMargin( 11 );
199 QPushButton* aOkBtn = new QPushButton(tr( "VISU_BUT_OK" ), aBtnBox);
200 aOkBtn->setAutoDefault( TRUE );
201 aOkBtn->setDefault( true );
202 aBtnLayout->addWidget(aOkBtn);
204 aBtnLayout->addStretch();
206 QPushButton* aCloseBtn = new QPushButton(tr("BUT_CANCEL"), aBtnBox);
207 aBtnLayout->addWidget(aCloseBtn);
209 aMainLayout->addWidget(aBtnBox);
213 // signals and slots connections
214 connect(mySelPlane, SIGNAL(clicked(int)), this, SLOT(onPlaneSelect(int)));
215 connect(myCBSetDef , SIGNAL( toggled(bool) ), this , SLOT( setBaseDefault() ) );
216 connect(myPosSpn , SIGNAL( valueChanged( double ) ), this , SLOT( setBaseDefault() ) );
217 connect(mySelPlane2, SIGNAL(clicked(int)), this, SLOT(onCutSelect(int)));
218 connect( myNbSpn, SIGNAL( valueChanged( double )), this, SLOT( DrawTable( ) ) );
219 connect( th, SIGNAL( clicked(int)), this, SLOT( setDefault(int) ) );
220 connect( myPosSpn2, SIGNAL( valueChanged( double )), this, SLOT( DrawTable( ) ) );
221 connect( myPreviewCheck, SIGNAL( toggled( bool )), this, SLOT( onPreviewCheck( bool ) ) );
222 connect( myPosTable, SIGNAL(valueChanged(int, int)), this, SLOT(onValueChanged(int, int)) );
223 connect( myRotXSpn, SIGNAL( valueChanged( double )), this, SLOT( onRotation( double ) ) );
224 connect( myRotYSpn, SIGNAL( valueChanged( double )), this, SLOT( onRotation( double ) ) );
225 connect( myRotXSpn2, SIGNAL( valueChanged( double )), this, SLOT( onRotation( double ) ) );
226 connect( myRotYSpn2, SIGNAL( valueChanged( double )), this, SLOT( onRotation( double ) ) );
227 connect( myBasePlanePos, SIGNAL( textChanged(const QString& )), this, SLOT( onPlanePos(const QString& ) ) );
228 connect( myCreateTable, SIGNAL( toggled(bool)), myCurvesCheck, SLOT( setEnabled(bool) ));
230 connect(aOkBtn, SIGNAL(clicked()), this, SLOT(accept()));
231 connect(aCloseBtn, SIGNAL(clicked()), this, SLOT(reject()));
232 connect( myStudy, SIGNAL(closed()), this, SLOT( reject() ) );
233 connect( myStudyFrame, SIGNAL(sfStudyFrameActivated(QAD_StudyFrame*)), this, SLOT(onFrameActivated(QAD_StudyFrame*)));
239 VisuGUI_CutLinesDlg::~VisuGUI_CutLinesDlg()
242 if(myCutLines) delete myCutLines;
243 if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy))
247 //------------------------------------------------------------------------------
248 void VisuGUI_CutLinesDlg::initFromPrsObject(VISU::CutLines_i* thePrs) {
250 myScalarPane->initFromPrsObject(thePrs);
252 myRotXSpn->setValue(thePrs->GetRotateX()*180./PI);
253 myRotYSpn->setValue(thePrs->GetRotateY()*180./PI);
254 myPosSpn->setValue(thePrs->GetDisplacement());
255 setOrientation(thePrs->GetOrientationType());
257 myNbSpn->setValue( thePrs->GetNbLines() );
258 myRotXSpn2->setValue(thePrs->GetRotateX2()*180./PI);
259 myRotYSpn2->setValue(thePrs->GetRotateY2()*180./PI);
260 myPosSpn2->setValue(thePrs->GetDisplacement2());
261 setOrientation2(thePrs->GetOrientationType2());
264 myCutLines = new VISU::CutLines_i(thePrs->GetResult(),false);
265 myCutLines->SameAs(thePrs);
266 myBasePlanePos->setText( QString::number(myCutLines->GetBasePlanePosition()) );
267 myCBSetDef->setChecked(thePrs->IsDefault());
271 if (myPreviewCheck->isChecked()) {
277 //------------------------------------------------------------------------------
278 int VisuGUI_CutLinesDlg::storeToPrsObject(VISU::CutLines_i* thePrs) {
280 myScalarPane->storeToPrsObject(thePrs);
282 thePrs->SetOrientation(getOrientaion(),myRotXSpn->value()*PI/180.,myRotYSpn->value()*PI/180.);
283 thePrs->SetDisplacement(myPosSpn->value());
284 thePrs->SetNbLines((int)myNbSpn->value());
286 thePrs->SetOrientation2(getOrientaion(false),myRotXSpn2->value()*PI/180.,myRotYSpn2->value()*PI/180.);
287 thePrs->SetDisplacement2(myPosSpn2->value());
289 if (!myCBSetDef->isChecked())
290 thePrs->SetBasePlanePosition(myBasePlanePos->text().toDouble());
291 else thePrs->SetDefault();
293 for (int i = 0; i < (int)myNbSpn->value(); ++i)
295 if (!((QCheckTableItem*)myPosTable->item( i, 1 ))->isChecked())
296 thePrs->SetLinePosition( i, myPosTable->text( i, 0 ).toDouble() );
297 else thePrs->SetDefaultPosition(i);
303 //------------------------------------------------------------------------------
304 void VisuGUI_CutLinesDlg::createPlanes() {
305 if (myStudy->getActiveStudyFrame()->getTypeView() != VIEW_VTK) return;
306 if (myCutLines == NULL) return;
307 if (myPreviewActor != 0) return;
309 vtkAppendPolyData* aPolyData = myCutLines->GetCutLinesPL()->GetAppendPolyData();
310 vtkDataSetMapper* aPlaneMapper = vtkDataSetMapper::New();
311 aPlaneMapper->SetInput(aPolyData->GetOutput());
312 aPlaneMapper->ScalarVisibilityOff();
314 myPreviewActor = SALOME_Actor::New();
315 myPreviewActor->PickableOff();
316 myPreviewActor->SetMapper(aPlaneMapper);
317 aPlaneMapper->Delete();
318 GET_VTK_VIEWFRAME(myStudy)->AddActor(myPreviewActor);
321 //------------------------------------------------------------------------------
322 void VisuGUI_CutLinesDlg::deletePlanes() {
323 if (myPreviewActor == 0) return;
324 if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy))
325 vf->RemoveActor(myPreviewActor);
326 myPreviewActor->Delete();
331 //------------------------------------------------------------------------------
332 void VisuGUI_CutLinesDlg::onPlaneSelect(int theId) {
333 for (int i = 0; i < mySelPlane2->count(); i++)
334 mySelPlane2->find(i)->setEnabled(true);
335 QButton* aBtn = mySelPlane2->find(theId);
336 aBtn->setEnabled(false);
339 myRotXLbl->setText( tr("LBL_ROT_X"));
340 myRotYLbl->setText( tr("LBL_ROT_Y"));
341 ((QRadioButton*)mySelPlane2->find(1))->setChecked(true);
342 onCutSelect(1, false);
345 myRotXLbl->setText( tr("LBL_ROT_Y"));
346 myRotYLbl->setText( tr("LBL_ROT_Z"));
347 ((QRadioButton*)mySelPlane2->find(2))->setChecked(true);
348 onCutSelect(2, false);
351 myRotXLbl->setText( tr("LBL_ROT_Z"));
352 myRotYLbl->setText( tr("LBL_ROT_X"));
353 ((QRadioButton*)mySelPlane2->find(0))->setChecked(true);
354 onCutSelect(0, false);
356 setBaseDefault(false);
360 //------------------------------------------------------------------------------
361 void VisuGUI_CutLinesDlg::onCutSelect(int theId, bool theUpdate) {
364 myRotXLbl2->setText( tr("LBL_ROT_X"));
365 myRotYLbl2->setText( tr("LBL_ROT_Y"));
368 myRotXLbl2->setText( tr("LBL_ROT_Y"));
369 myRotYLbl2->setText( tr("LBL_ROT_Z"));
372 myRotXLbl2->setText( tr("LBL_ROT_Z"));
373 myRotYLbl2->setText( tr("LBL_ROT_X"));
375 if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
376 if (theUpdate && myPreviewCheck->isChecked() && (myCutLines != NULL)) {
377 myCutLines->SetOrientation2(getOrientaion(false),myRotXSpn2->value()*PI/180.,myRotYSpn2->value()*PI/180.);
378 myCutLines->SetDisplacement2(myPosSpn2->value());
379 myCutLines->GetPL()->Update();
387 //------------------------------------------------------------------------------
388 void VisuGUI_CutLinesDlg::setBaseDefault(bool theUpdate) {
389 if (!hasInit) return;
391 if ( myCBSetDef->isChecked() )
393 if (!myCutLines->IsDefault()) myCutLines->SetDefault();
394 myCutLines->SetOrientation(getOrientaion(),myRotXSpn->value()*PI/180.,myRotYSpn->value()*PI/180.);
395 myCutLines->SetDisplacement(myPosSpn->value());
396 float aPos = myCutLines->GetBasePlanePosition();
397 myBasePlanePos->setText( QString::number(aPos) );
398 myBasePlanePos->setEnabled(false);
399 if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
400 if (theUpdate && myPreviewCheck->isChecked() && (myCutLines != NULL)) {
401 myCutLines->SetBasePlanePosition(aPos);
402 myCutLines->GetPL()->Update();
409 else myBasePlanePos->setEnabled(true);
412 //------------------------------------------------------------------------------
413 void VisuGUI_CutLinesDlg::DrawTable()
415 if (!hasInit) return;
417 int aNbRows = myPosTable->numRows();
418 int aNbPlanes = (int)myNbSpn->value();
420 myCutLines->SetOrientation(getOrientaion(),myRotXSpn->value()*PI/180.,myRotYSpn->value()*PI/180.);
422 myCutLines->SetNbLines(aNbPlanes);
423 myCutLines->SetDisplacement2(myPosSpn2->value());
424 myCutLines->SetOrientation2(getOrientaion(false),myRotXSpn2->value()*PI/180.,myRotYSpn2->value()*PI/180.);
427 for (int i = 0; i < aNbRows; ++i) {
428 QCheckTableItem* aItem = (QCheckTableItem*)myPosTable->item( i, 1 );
429 if (aItem == 0) break;
430 if (!aItem->isChecked())
431 myCutLines->SetLinePosition(i, myPosTable->text(i, 0).toDouble());
434 if (aNbPlanes > aNbRows)
435 myPosTable->insertRows(aNbRows, aNbPlanes - aNbRows );
436 else if (aNbPlanes < aNbRows)
437 myPosTable->setNumRows(aNbPlanes);
439 int aMin = (aNbRows < aNbPlanes)? aNbRows : aNbPlanes;
440 for (int i = 0; i<aMin; i++) {
441 myPosTable->setText(i, 0, QString::number(myCutLines->GetLinePosition(i)));
442 ((QCheckTableItem*)myPosTable->item( i, 1 ))->setChecked(myCutLines->IsDefaultPosition(i));
445 QHeader *vh = myPosTable->verticalHeader();
446 QString str("Plane# %1");
447 for (int i=aMin; i<aNbPlanes; i++) {
448 VisuGUI_NumEditItem* aEditItem = new VisuGUI_NumEditItem(myPosTable,
449 QTableItem::OnTyping,
450 QString::number(myCutLines->GetLinePosition(i)));
451 aEditItem->setReplaceable(false);
452 aEditItem->setEnabled(!myCutLines->IsDefaultPosition(i));
453 myPosTable->setItem(i, 0, aEditItem);
455 QCheckTableItem* aCheck = new QCheckTableItem(myPosTable, 0);
456 aCheck->setChecked(myCutLines->IsDefaultPosition(i));
457 aCheck->setReplaceable(false);
458 myPosTable->setItem(i, 1, aCheck);
460 vh->setLabel( i, str.arg(i+1) );
463 if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
464 if (myPreviewCheck->isChecked()) {
465 myCutLines->GetPL()->Update();
473 //------------------------------------------------------------------------------
474 void VisuGUI_CutLinesDlg::setDefault(int all)
476 myPosTable->setCurrentCell(-1, 1);
477 myPosTable->clearSelection();
478 if (all == 0) return;
480 for (int i = 0; i < (int)myNbSpn->value(); ++i)
481 ((QCheckTableItem*)myPosTable->item( i, 1 ))->setChecked(true);
483 for (int i = 0; i < (int)myNbSpn->value(); ++i) {
484 if ( ((QCheckTableItem*)myPosTable->item( i, 1 ))->isChecked() ) {
485 myCutLines->SetDefaultPosition(i);
486 myPosTable->setText( i, 0, QString::number(myCutLines->GetLinePosition(i)));
487 myPosTable->item( i, 0 )->setEnabled(false);
489 myPosTable->item( i, 0 )->setEnabled(true);
493 //------------------------------------------------------------------------------
494 VISU::CutPlanes::Orientation VisuGUI_CutLinesDlg::getOrientaion(bool IsBasePlane)
503 VISU::CutPlanes::Orientation orient;
504 switch (aBG->id(aBG->selected())) {
506 orient = VISU::CutPlanes::XY;
509 orient = VISU::CutPlanes::YZ;
512 orient = VISU::CutPlanes::ZX;
517 //------------------------------------------------------------------------------
518 void VisuGUI_CutLinesDlg::setOrientation( const VISU::CutPlanes::Orientation orient)
521 case VISU::CutPlanes::XY:
522 ((QRadioButton*)mySelPlane->find(0))->setChecked(true);
525 case VISU::CutPlanes::YZ:
526 ((QRadioButton*)mySelPlane->find(1))->setChecked(true);
529 case VISU::CutPlanes::ZX:
530 ((QRadioButton*)mySelPlane->find(2))->setChecked(true);
535 //------------------------------------------------------------------------------
536 void VisuGUI_CutLinesDlg::setOrientation2( const VISU::CutPlanes::Orientation orient )
539 case VISU::CutPlanes::XY:
540 ((QRadioButton*)mySelPlane2->find(0))->setChecked(true);
543 case VISU::CutPlanes::YZ:
544 ((QRadioButton*)mySelPlane2->find(1))->setChecked(true);
547 case VISU::CutPlanes::ZX:
548 ((QRadioButton*)mySelPlane2->find(2))->setChecked(true);
554 void VisuGUI_CutLinesDlg::onValueChanged(int theRow, int theCol) {
556 QString aTxt = myPosTable->text(theRow, 0);
557 bool isChanged = !aTxt.isEmpty();
558 ((QCheckTableItem*)myPosTable->item(theRow, 1))->setChecked(!isChanged);
560 if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
561 if (myPreviewCheck->isChecked()) {
563 myCutLines->SetLinePosition( theRow, aTxt.toDouble());
564 myCutLines->GetPL()->Update();
571 bool isDefault = ((QCheckTableItem*)myPosTable->item(theRow, theCol))->isChecked();
573 myCutLines->SetDefaultPosition(theRow);
574 myPosTable->setText(theRow, 0, QString::number(myCutLines->GetLinePosition(theRow)));
576 if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
577 if (myPreviewCheck->isChecked()) {
579 myCutLines->GetPL()->Update();
586 myPosTable->item(theRow, 0)->setEnabled(!isDefault);
591 void VisuGUI_CutLinesDlg::accept() {
592 MYGenerateTable = myCreateTable->isChecked();
593 MYGenerateCurve = myCurvesCheck->isChecked();
594 if (myScalarPane->check()) {
595 ((QWidget*)sender())->setDisabled(true);
596 storeToPrsObject(myPrs);
598 if (isGenerateTable()) {
599 visuGUI->GetVisuGen()->CreateTable(myPrs->GetEntry());
600 if (isGenerateCurves()) {
601 SALOMEDS::Study_var aStudy = myStudy->getStudyDocument();
602 SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(myPrs->GetEntry());
603 if(!aSObject->_is_nil()) {
604 SALOMEDS::ChildIterator_var aIter = aStudy->NewChildIterator( aSObject );
605 SALOMEDS::StudyBuilder_var aBuilder = aStudy->NewBuilder();
606 for ( ;aIter->More(); aIter->Next()) {
607 SALOMEDS::SObject_var aTblObj = aIter->Value();
608 if (!aTblObj->_is_nil()) {
609 SALOMEDS::GenericAttribute_var anAttr;
610 if (aTblObj->FindAttribute(anAttr, "AttributeName")) {
611 visuGUI->CreatePlot(aTblObj);
618 if (myStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
620 visuGUI->CreateActor(myPrs);
626 GET_VTK_VIEWFRAME(myStudy)->onViewFitAll();
629 visuGUI->RecreateActor(myPrs);
630 if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
631 if ( vf->getRenderer()->GetActors()->GetNumberOfItems () > 0 ) {
632 vf->getRenderer()->ResetCameraClippingRange();
637 SALOMEDS::Study_var aStudy = myStudy->getStudyDocument();
638 SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(myPrs->GetEntry());
639 if(!aSObject->_is_nil()) {
640 SALOMEDS::ChildIterator_var aIter = aStudy->NewChildIterator( aSObject );
641 SALOMEDS::StudyBuilder_var aBuilder = aStudy->NewBuilder();
642 for ( ;aIter->More(); aIter->Next()) {
643 SALOMEDS::SObject_var aTblObj = aIter->Value();
644 if (!aTblObj->_is_nil()) {
645 SALOMEDS::GenericAttribute_var anAttr;
646 if (aTblObj->FindAttribute(anAttr, "AttributeName")) {
647 aBuilder->RemoveObjectWithChildren(aIter->Value()); // We should have only one child
652 if (isGenerateTable()) {
653 visuGUI->GetVisuGen()->CreateTable(aSObject->GetID());
654 if (isGenerateCurves()) {
655 SALOMEDS::Study_var aStudy = myStudy->getStudyDocument();
656 SALOMEDS::ChildIterator_var aIter = aStudy->NewChildIterator( aSObject );
657 SALOMEDS::StudyBuilder_var aBuilder = aStudy->NewBuilder();
658 for ( ;aIter->More(); aIter->Next()) {
659 SALOMEDS::SObject_var aTblObj = aIter->Value();
660 if (!aTblObj->_is_nil()) {
661 SALOMEDS::GenericAttribute_var anAttr;
662 if (aTblObj->FindAttribute(anAttr, "AttributeName")) {
663 visuGUI->CreatePlot(aTblObj);
671 myStudy->updateObjBrowser();
676 void VisuGUI_CutLinesDlg::reject() {
678 visuGUI->DeletePresentation(myPrs);
679 myStudy->updateObjBrowser();
684 void VisuGUI_CutLinesDlg::onPreviewCheck(bool thePreview) {
685 if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
687 storeToPrsObject(myCutLines);
688 myCutLines->GetPL()->Update();
698 void VisuGUI_CutLinesDlg::onRotation(double theValue) {
699 if (myCutLines == NULL) return;
700 if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
701 if (myPreviewCheck->isChecked()) {
702 myCutLines->SetOrientation(getOrientaion(),myRotXSpn->value()*PI/180.,myRotYSpn->value()*PI/180.);
703 myCutLines->SetOrientation2(getOrientaion(false),myRotXSpn2->value()*PI/180.,myRotYSpn2->value()*PI/180.);
704 myCutLines->GetPL()->Update();
712 void VisuGUI_CutLinesDlg::onPlanePos(const QString& theValue) {
713 if (myCutLines == NULL) return;
714 if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
715 if (myPreviewCheck->isChecked()) {
716 myCutLines->SetBasePlanePosition(theValue.toDouble());
717 myCutLines->GetPL()->Update();
725 void VisuGUI_CutLinesDlg::onFrameActivated( QAD_StudyFrame* theFrame) {
726 if (theFrame != myStudyFrame)