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 : QDialog(VISU::GetDesktop(theModule), "VisuGUI_CutLinesDlg", true,
48 WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
51 setCaption("Cut Lines Definition");
52 setSizeGripEnabled(true);
54 QVBoxLayout* aMainLayout = new QVBoxLayout (this, 7, 6);
55 aMainLayout->setSpacing(5);
60 QTabWidget* aTabPane = new QTabWidget(this);
63 QFrame* aPlanePane = new QFrame(this);
64 QVBoxLayout* aPlaneLayout = new QVBoxLayout(aPlanePane, 5, 6);
66 mySelPlane = new QHButtonGroup( tr( "TXT_ORIENTATION" ), aPlanePane);
67 mySelPlane->setInsideSpacing( 5 );
68 mySelPlane->setInsideMargin( 5 );
70 QRadioButton* aBxy = new QRadioButton( tr( "PARALLEL_XOY" ), mySelPlane); // 0
71 QRadioButton* aByz = new QRadioButton( tr( "PARALLEL_YOZ" ), mySelPlane); // 1
72 QRadioButton* aBzx = new QRadioButton( tr( "PARALLEL_ZOX" ), mySelPlane); // 2
73 aBzx->setChecked(true);
75 aPlaneLayout->addWidget( mySelPlane );
77 QGroupBox* aRotBox = new QGroupBox( tr( "LBL_ROTATION" ), aPlanePane );
78 aRotBox->setColumnLayout(2, Qt::Horizontal );
80 myRotXLbl = new QLabel( tr( "LBL_ROT_X" ), aRotBox);
81 myRotXSpn = new QtxDblSpinBox( -45, 45, 5, aRotBox );
82 myRotXSpn->setValue( 0 );
83 myRotYLbl = new QLabel( tr( "LBL_ROT_Y" ), aRotBox );
84 myRotYSpn = new QtxDblSpinBox( -45, 45, 5, aRotBox );
85 myRotYSpn->setValue( 0 );
87 aPlaneLayout->addWidget( aRotBox );
89 QHGroupBox* aBaseBox = new QHGroupBox (tr("BASE_PLANE_POS"), aPlanePane);
90 myBasePlanePos = new QLineEdit (aBaseBox);
91 mydvalidator = new QDoubleValidator(this);
92 mydvalidator->setDecimals(32);
93 myBasePlanePos->setValidator(mydvalidator);
95 myCBSetDef = new QCheckBox (tr("SET_DEFAULT"),aBaseBox);
97 aPlaneLayout->addWidget(aBaseBox);
99 QHBox* aPosBox = new QHBox (aPlanePane);
100 aPosBox->setSpacing(5);
101 QLabel* aPosLbl = new QLabel (tr("LBL_POS"), aPosBox);
102 myPosSpn = new QtxDblSpinBox (0, 1, 0.1, aPosBox);
103 myPosSpn->setValue(0.5);
104 aPlaneLayout->addWidget(aPosBox);
106 myPreviewCheck = new QCheckBox (tr("LBL_SHOW_PREVIEW"), aPlanePane);
107 myPreviewCheck->setChecked(false);
108 aPlaneLayout->addWidget(myPreviewCheck);
110 myCreateTable = new QCheckBox (tr("LBL_GENERATE_TABLE"), aPlanePane);
111 myCreateTable->setChecked(MYGenerateTable);
112 aPlaneLayout->addWidget( myCreateTable );
114 QHBox* aCheckPane = new QHBox(aPlanePane);
115 QLabel* aLbl = new QLabel(" ", aCheckPane);
116 aCheckPane->setStretchFactor(aLbl, 0);
117 myCurvesCheck = new QCheckBox(tr("LBL_GENERATE_CURVES"), aCheckPane);
118 aCheckPane->setStretchFactor(aCheckPane, 0);
119 myCurvesCheck->setChecked(MYGenerateCurve);
120 myCurvesCheck->setEnabled(MYGenerateTable);
121 QLabel* aLbl2 = new QLabel(" ", aCheckPane);
122 aCheckPane->setStretchFactor(aLbl2, 1);
123 aPlaneLayout->addWidget( aCheckPane );
125 aPlaneLayout->addStretch();
128 aTabPane->addTab( aPlanePane, tr("LBL_LINES_PLANE") );
131 QFrame* aLinesPane = new QFrame(this);
132 QVBoxLayout* aLinesLayout = new QVBoxLayout( aLinesPane, 5, 6 );
134 mySelPlane2 = new QHButtonGroup( tr( "TXT_ORIENTATION" ), aLinesPane);
135 mySelPlane2->setInsideSpacing( 5 );
136 mySelPlane2->setInsideMargin( 5 );
138 QRadioButton* aBxy2 = new QRadioButton( tr( "PARALLEL_XOY" ), mySelPlane2); // 0
139 QRadioButton* aByz2 = new QRadioButton( tr( "PARALLEL_YOZ" ), mySelPlane2); // 1
140 QRadioButton* aBzx2 = new QRadioButton( tr( "PARALLEL_ZOX" ), mySelPlane2); // 2
141 aBzx2->setEnabled(false);
142 aByz2->setChecked(true);
143 aLinesLayout->addWidget( mySelPlane2 );
145 QGroupBox* aRotBox2 = new QGroupBox( tr( "LBL_ROTATION" ), aLinesPane );
146 aRotBox2->setColumnLayout(2, Qt::Horizontal );
148 myRotXLbl2 = new QLabel( tr( "LBL_ROT_X" ), aRotBox2);
149 myRotXSpn2 = new QtxDblSpinBox( -45, 45, 5, aRotBox2 );
150 myRotXSpn2->setValue( 0 );
151 myRotYLbl2 = new QLabel( tr( "LBL_ROT_Y" ), aRotBox2 );
152 myRotYSpn2 = new QtxDblSpinBox( -45, 45, 5, aRotBox2 );
153 myRotYSpn2->setValue( 0 );
154 aLinesLayout->addWidget( aRotBox2 );
156 QHBox* aNbBox = new QHBox(aLinesPane);
157 aNbBox->setSpacing(5);
158 QLabel* aNbLbl = new QLabel( tr( "LBL_NB_PLANS" ), aNbBox );
159 myNbSpn = new QtxDblSpinBox( 1, 100, 1, aNbBox );
160 myNbSpn->setValue( 10 );
162 aLinesLayout->addWidget( aNbBox );
164 myPosTable = new QTable(aLinesPane, "Positions of cut planes" );
165 myPosTable->setMaximumHeight( 227 );
166 myPosTable->setMinimumWidth( 294 );
167 myPosTable->setNumCols(2);
168 myPosTable->setNumRows(0);
170 QHeader *th = myPosTable->horizontalHeader();
171 th->setLabel( 0, "Position" );
172 th->setLabel( 1, "Set default" );
174 aLinesLayout->addWidget( myPosTable );
176 QHBox* aPosBox2 = new QHBox(aLinesPane);
177 aPosBox2->setSpacing(5);
178 QLabel* aPosLbl2 = new QLabel( tr( "LBL_POS" ), aPosBox2 );
179 myPosSpn2 = new QtxDblSpinBox( 0, 1, 0.1, aPosBox2 );
180 myPosSpn2->setValue( 0.5 );
181 aLinesLayout->addWidget( aPosBox2 );
182 aLinesLayout->addStretch();
184 aTabPane->addTab( aLinesPane, tr("LBL_LINES_CUT") );
186 myScalarPane = new VisuGUI_ScalarBarPane(this, false);
187 myScalarPane->setMargin( 5 );
188 aTabPane->addTab(myScalarPane, "Scalar Bar");
190 aMainLayout->addWidget(aTabPane);
193 QHBox* aBtnBox = new QHBox(this);
194 aBtnBox->setFrameStyle(QFrame::Box | QFrame::Sunken);
195 aBtnBox->setLineWidth( 1 );
196 QHBoxLayout* aBtnLayout = (QHBoxLayout*) aBtnBox->layout();
197 aBtnLayout->setAutoAdd( false );
198 aBtnLayout->setSpacing( 5 );
199 aBtnLayout->setMargin( 11 );
201 QPushButton* aOkBtn = new QPushButton (tr("BUT_OK"), aBtnBox);
202 aOkBtn->setAutoDefault( TRUE );
203 aOkBtn->setDefault( true );
204 aBtnLayout->addWidget(aOkBtn);
206 aBtnLayout->addStretch();
208 QPushButton* aCloseBtn = new QPushButton(tr("BUT_CANCEL"), aBtnBox);
209 aBtnLayout->addWidget(aCloseBtn);
211 aMainLayout->addWidget(aBtnBox);
215 // signals and slots connections
216 connect(mySelPlane , SIGNAL(clicked(int)) , this, SLOT(onPlaneSelect(int)));
217 connect(myCBSetDef , SIGNAL(toggled(bool)) , this, SLOT(setBaseDefault()));
218 connect(myPosSpn , SIGNAL(valueChanged(double)) , this, SLOT(setBaseDefault()));
219 connect(mySelPlane2 , SIGNAL(clicked(int)) , this, SLOT(onCutSelect(int)));
220 connect(myNbSpn , SIGNAL(valueChanged(double)) , this, SLOT(DrawTable()));
221 connect(th , SIGNAL(clicked(int)) , this, SLOT(setDefault(int)));
222 connect(myPosSpn2 , SIGNAL(valueChanged(double)) , this, SLOT(DrawTable()));
223 connect(myPreviewCheck, SIGNAL(toggled(bool)) , this, SLOT(onPreviewCheck(bool)));
224 connect(myPosTable , SIGNAL(valueChanged(int, int)), this, SLOT(onValueChanged(int, int)));
225 connect(myRotXSpn , SIGNAL(valueChanged(double)) , this, SLOT(onRotation(double)));
226 connect(myRotYSpn , SIGNAL(valueChanged(double)) , this, SLOT(onRotation(double)));
227 connect(myRotXSpn2 , SIGNAL(valueChanged(double)) , this, SLOT(onRotation(double)));
228 connect(myRotYSpn2 , SIGNAL(valueChanged(double)) , this, SLOT(onRotation(double)));
229 connect(myBasePlanePos, SIGNAL(textChanged(const QString&)), this, SLOT(onPlanePos(const QString&)));
230 connect(myCreateTable , SIGNAL(toggled(bool)), myCurvesCheck, SLOT(setEnabled(bool)));
232 connect(aOkBtn, SIGNAL(clicked()), this, SLOT(accept()));
233 connect(aCloseBtn, SIGNAL(clicked()), this, SLOT(reject()));
234 //connect(myMgr, SIGNAL(closeAllViews()), this, SLOT(reject()));
235 //connect(VisuGUI::application()->desktop(),
236 // SIGNAL(windowActivated(SUIT_ViewWindow*)),
237 // this, SLOT(onWindowActivated(SUIT_ViewWindow*)));
243 VisuGUI_CutLinesDlg::~VisuGUI_CutLinesDlg()
245 cout<<"### VisuGUI_CutLinesDlg::~VisuGUI_CutLinesDlg"<<endl;
247 if (myCutLines) //delete myCutLines;
248 myCutLines->Destroy();
249 if (SVTK_ViewWindow* vf = VISU::GetViewWindow())
253 //------------------------------------------------------------------------------
254 void VisuGUI_CutLinesDlg::initFromPrsObject (VISU::CutLines_i* thePrs)
257 myScalarPane->initFromPrsObject(thePrs);
259 myRotXSpn->setValue(thePrs->GetRotateX()*180./PI);
260 myRotYSpn->setValue(thePrs->GetRotateY()*180./PI);
261 myPosSpn->setValue(thePrs->GetDisplacement());
262 setOrientation(thePrs->GetOrientationType());
264 myNbSpn->setValue( (int)thePrs->GetNbLines() );
265 myRotXSpn2->setValue(thePrs->GetRotateX2()*180./PI);
266 myRotYSpn2->setValue(thePrs->GetRotateY2()*180./PI);
267 myPosSpn2->setValue(thePrs->GetDisplacement2());
268 setOrientation2(thePrs->GetOrientationType2());
271 myCutLines = new VISU::CutLines_i(thePrs->GetResult(),false);
272 myCutLines->SameAs(thePrs);
273 myBasePlanePos->setText( QString::number(myCutLines->GetBasePlanePosition()) );
274 myCBSetDef->setChecked(thePrs->IsDefault());
278 if (myPreviewCheck->isChecked()) {
283 //------------------------------------------------------------------------------
284 int VisuGUI_CutLinesDlg::storeToPrsObject (VISU::CutLines_i* thePrs)
286 myScalarPane->storeToPrsObject(thePrs);
288 thePrs->SetOrientation(getOrientaion(),
289 myRotXSpn->value()*PI/180.,
290 myRotYSpn->value()*PI/180.);
291 thePrs->SetDisplacement(myPosSpn->value());
292 thePrs->SetNbLines((int)myNbSpn->value());
294 thePrs->SetOrientation2(getOrientaion(false),
295 myRotXSpn2->value()*PI/180.,
296 myRotYSpn2->value()*PI/180.);
297 thePrs->SetDisplacement2(myPosSpn2->value());
299 if (!myCBSetDef->isChecked())
300 thePrs->SetBasePlanePosition(myBasePlanePos->text().toDouble());
301 else thePrs->SetDefault();
303 for (int i = 0; i < (int)myNbSpn->value(); ++i) {
304 if (!((QCheckTableItem*)myPosTable->item( i, 1 ))->isChecked())
305 thePrs->SetLinePosition( i, myPosTable->text( i, 0 ).toDouble() );
306 else thePrs->SetDefaultPosition(i);
311 //------------------------------------------------------------------------------
312 void VisuGUI_CutLinesDlg::createPlanes()
314 SVTK_ViewWindow* aView = VISU::GetViewWindow();
315 if (aView == NULL) return;
316 if (myCutLines == NULL) return;
317 if (myPreviewActor != 0) return;
319 storeToPrsObject(myCutLines);
320 myCutLines->GetPL()->Update();
321 vtkAppendPolyData* aPolyData = myCutLines->GetCutLinesPL()->GetAppendPolyData();
322 vtkDataSetMapper* aPlaneMapper = vtkDataSetMapper::New();
323 aPlaneMapper->SetInput(aPolyData->GetOutput());
324 aPlaneMapper->ScalarVisibilityOff();
326 myPreviewActor = SALOME_Actor::New();
327 myPreviewActor->PickableOff();
328 myPreviewActor->SetMapper(aPlaneMapper);
329 aPlaneMapper->Delete();
330 aView->AddActor(myPreviewActor);
331 aView->getRenderer()->Render();
335 //------------------------------------------------------------------------------
336 void VisuGUI_CutLinesDlg::deletePlanes()
338 if (myPreviewActor == 0) return;
339 if (SVTK_ViewWindow* aView = VISU::GetViewWindow())
340 aView->RemoveActor(myPreviewActor);
341 myPreviewActor->Delete();
346 //------------------------------------------------------------------------------
347 void VisuGUI_CutLinesDlg::onPlaneSelect (int theId)
349 for (int i = 0; i < mySelPlane2->count(); i++)
350 mySelPlane2->find(i)->setEnabled(true);
351 QButton* aBtn = mySelPlane2->find(theId);
352 aBtn->setEnabled(false);
355 myRotXLbl->setText( tr("LBL_ROT_X"));
356 myRotYLbl->setText( tr("LBL_ROT_Y"));
357 ((QRadioButton*)mySelPlane2->find(1))->setChecked(true);
358 onCutSelect(1, false);
361 myRotXLbl->setText( tr("LBL_ROT_Y"));
362 myRotYLbl->setText( tr("LBL_ROT_Z"));
363 ((QRadioButton*)mySelPlane2->find(2))->setChecked(true);
364 onCutSelect(2, false);
367 myRotXLbl->setText( tr("LBL_ROT_Z"));
368 myRotYLbl->setText( tr("LBL_ROT_X"));
369 ((QRadioButton*)mySelPlane2->find(0))->setChecked(true);
370 onCutSelect(0, false);
372 setBaseDefault(false);
376 //------------------------------------------------------------------------------
377 void VisuGUI_CutLinesDlg::onCutSelect (int theId, bool theUpdate)
381 myRotXLbl2->setText( tr("LBL_ROT_X"));
382 myRotYLbl2->setText( tr("LBL_ROT_Y"));
385 myRotXLbl2->setText( tr("LBL_ROT_Y"));
386 myRotYLbl2->setText( tr("LBL_ROT_Z"));
389 myRotXLbl2->setText( tr("LBL_ROT_Z"));
390 myRotYLbl2->setText( tr("LBL_ROT_X"));
392 if (SVTK_ViewWindow* aView = VISU::GetViewWindow()) {
393 if (theUpdate && myPreviewCheck->isChecked() && (myCutLines != NULL)) {
394 /*myCutLines->SetOrientation2(getOrientaion(false),
395 myRotXSpn2->value()*PI/180.,
396 myRotYSpn2->value()*PI/180.);
397 myCutLines->SetDisplacement2(myPosSpn2->value());*/
398 //myCutLines->GetPL()->Update();
406 //------------------------------------------------------------------------------
407 void VisuGUI_CutLinesDlg::setBaseDefault (bool theUpdate)
409 if (!hasInit) return;
411 if (myCBSetDef->isChecked()) {
412 if (!myCutLines->IsDefault()) myCutLines->SetDefault();
413 /*myCutLines->SetOrientation(getOrientaion(),
414 myRotXSpn->value()*PI/180.,
415 myRotYSpn->value()*PI/180.);
416 myCutLines->SetDisplacement(myPosSpn->value());*/
417 /* float aPos = myCutLines->GetBasePlanePosition();
418 myBasePlanePos->setText( QString::number(aPos) );
419 myBasePlanePos->setEnabled(false);*/
420 if (SVTK_ViewWindow* aView = VISU::GetViewWindow()) {
421 if (theUpdate && myPreviewCheck->isChecked() && (myCutLines != NULL)) {
422 //myCutLines->SetBasePlanePosition(aPos);
423 // myCutLines->GetPL()->Update();
429 float aPos = myCutLines->GetBasePlanePosition();
430 myBasePlanePos->setText( QString::number(aPos) );
431 myBasePlanePos->setEnabled(false);
433 myBasePlanePos->setEnabled(true);
437 //------------------------------------------------------------------------------
438 void VisuGUI_CutLinesDlg::DrawTable()
440 if (!hasInit) return;
442 int aNbRows = myPosTable->numRows();
443 int aNbPlanes = (int)myNbSpn->value();
445 myCutLines->SetOrientation(getOrientaion(),
446 myRotXSpn->value()*PI/180.,
447 myRotYSpn->value()*PI/180.);
449 myCutLines->SetNbLines(aNbPlanes);
450 myCutLines->SetDisplacement2(myPosSpn2->value());
451 myCutLines->SetOrientation2(getOrientaion(false),
452 myRotXSpn2->value()*PI/180.,
453 myRotYSpn2->value()*PI/180.);
456 for (int i = 0; i < aNbRows; ++i) {
457 QCheckTableItem* aItem = (QCheckTableItem*)myPosTable->item( i, 1 );
458 if (aItem == 0) break;
459 if (!aItem->isChecked())
460 myCutLines->SetLinePosition(i, myPosTable->text(i, 0).toDouble());
463 if (aNbPlanes > aNbRows)
464 myPosTable->insertRows(aNbRows, aNbPlanes - aNbRows );
465 else if (aNbPlanes < aNbRows)
466 myPosTable->setNumRows(aNbPlanes);
468 int aMin = (aNbRows < aNbPlanes)? aNbRows : aNbPlanes;
469 for (int i = 0; i<aMin; i++) {
470 myPosTable->setText(i, 0, QString::number(myCutLines->GetLinePosition(i)));
471 ((QCheckTableItem*)myPosTable->item( i, 1 ))->setChecked(myCutLines->IsDefaultPosition(i));
474 QHeader *vh = myPosTable->verticalHeader();
475 QString str("Plane# %1");
476 for (int i=aMin; i<aNbPlanes; i++) {
477 VisuGUI_NumEditItem* aEditItem = new VisuGUI_NumEditItem
478 (myPosTable, QTableItem::OnTyping, QString::number(myCutLines->GetLinePosition(i)));
479 aEditItem->setReplaceable(false);
480 aEditItem->setEnabled(!myCutLines->IsDefaultPosition(i));
481 myPosTable->setItem(i, 0, aEditItem);
483 QCheckTableItem* aCheck = new QCheckTableItem(myPosTable, 0);
484 aCheck->setChecked(myCutLines->IsDefaultPosition(i));
485 aCheck->setReplaceable(false);
486 myPosTable->setItem(i, 1, aCheck);
488 vh->setLabel( i, str.arg(i+1) );
491 if (SVTK_ViewWindow* aView = VISU::GetViewWindow()) {
492 if (myPreviewCheck->isChecked()) {
493 // myCutLines->GetPL()->Update();
501 //------------------------------------------------------------------------------
502 void VisuGUI_CutLinesDlg::setDefault (int all)
504 myPosTable->setCurrentCell(-1, 1);
505 myPosTable->clearSelection();
506 if (all == 0) return;
508 for (int i = 0; i < (int)myNbSpn->value(); ++i)
509 ((QCheckTableItem*)myPosTable->item( i, 1 ))->setChecked(true);
511 for (int i = 0; i < (int)myNbSpn->value(); ++i) {
512 if ( ((QCheckTableItem*)myPosTable->item( i, 1 ))->isChecked() ) {
513 myCutLines->SetDefaultPosition(i);
514 myPosTable->setText( i, 0, QString::number(myCutLines->GetLinePosition(i)));
515 myPosTable->item( i, 0 )->setEnabled(false);
517 myPosTable->item( i, 0 )->setEnabled(true);
521 //------------------------------------------------------------------------------
522 VISU::CutPlanes::Orientation VisuGUI_CutLinesDlg::getOrientaion (bool IsBasePlane)
531 VISU::CutPlanes::Orientation orient;
532 switch (aBG->id(aBG->selected())) {
534 orient = VISU::CutPlanes::XY;
537 orient = VISU::CutPlanes::YZ;
540 orient = VISU::CutPlanes::ZX;
545 //------------------------------------------------------------------------------
546 void VisuGUI_CutLinesDlg::setOrientation (const VISU::CutPlanes::Orientation orient)
549 case VISU::CutPlanes::XY:
550 ((QRadioButton*)mySelPlane->find(0))->setChecked(true);
553 case VISU::CutPlanes::YZ:
554 ((QRadioButton*)mySelPlane->find(1))->setChecked(true);
557 case VISU::CutPlanes::ZX:
558 ((QRadioButton*)mySelPlane->find(2))->setChecked(true);
563 //------------------------------------------------------------------------------
564 void VisuGUI_CutLinesDlg::setOrientation2 (const VISU::CutPlanes::Orientation orient)
567 case VISU::CutPlanes::XY:
568 ((QRadioButton*)mySelPlane2->find(0))->setChecked(true);
571 case VISU::CutPlanes::YZ:
572 ((QRadioButton*)mySelPlane2->find(1))->setChecked(true);
575 case VISU::CutPlanes::ZX:
576 ((QRadioButton*)mySelPlane2->find(2))->setChecked(true);
581 void VisuGUI_CutLinesDlg::onValueChanged (int theRow, int theCol)
584 QString aTxt = myPosTable->text(theRow, 0);
585 bool isChanged = !aTxt.isEmpty();
586 ((QCheckTableItem*)myPosTable->item(theRow, 1))->setChecked(!isChanged);
588 if (SVTK_ViewWindow* aView = VISU::GetViewWindow()) {
589 if (myPreviewCheck->isChecked()) {
591 //myCutLines->SetLinePosition( theRow, aTxt.toDouble());
592 // myCutLines->GetPL()->Update();
599 bool isDefault = ((QCheckTableItem*)myPosTable->item(theRow, theCol))->isChecked();
601 //myCutLines->SetDefaultPosition(theRow);
602 // myPosTable->setText(theRow, 0, QString::number(myCutLines->GetLinePosition(theRow)));
604 if (SVTK_ViewWindow* aView = VISU::GetViewWindow()) {
605 if (myPreviewCheck->isChecked()) {
607 // myCutLines->GetPL()->Update();
613 myPosTable->setText(theRow, 0, QString::number(myCutLines->GetLinePosition(theRow)));
615 myPosTable->item(theRow, 0)->setEnabled(!isDefault);
619 void VisuGUI_CutLinesDlg::accept()
621 //if ( !VisuGUI::CheckActiveStudyLock() ) {
625 MYGenerateTable = myCreateTable->isChecked();
626 MYGenerateCurve = myCurvesCheck->isChecked();
627 // if (myScalarPane->check()) {
628 /*jfa tmp:((QWidget*)sender())->setDisabled(true);
629 storeToPrsObject(myPrs);
631 if (isGenerateTable()) {
632 visuGUI->GetVisuGen()->CreateTable(myPrs->GetEntry());
633 if (isGenerateCurves()) {
634 SALOMEDSClient_Study* aStudy = study()->studyDS();
635 SALOMEDSClient_SObject* aSObject = aStudy->FindObjectID(myPrs->GetEntry());
637 SALOMEDSClient_ChildIterator* aIter = aStudy->NewChildIterator( aSObject );
638 SALOMEDSClient_StudyBuilder* aBuilder = aStudy->NewBuilder();
639 for ( ;aIter->More(); aIter->Next()) {
640 SALOMEDSClient_SObject* aTblObj = aIter->Value();
642 SALOMEDSClient_GenericAttribute* anAttr;
643 if (aTblObj->FindAttribute(anAttr, "AttributeName")) {
644 visuGUI->CreatePlot(aTblObj);
651 if (GET_VTK_VIEWWINDOW(myMgr)) {
653 visuGUI->CreateActor(myPrs);
658 GET_VTK_VIEWWINDOW(myMgr)->onFitAll();
661 visuGUI->RecreateActor(myPrs);
662 if (VTKViewer_ViewWindow* vf = GET_VTK_VIEWWINDOW(myMgr)) {
663 if (vf->getRenderer()->GetActors()->GetNumberOfItems() > 0) {
664 vf->getRenderer()->ResetCameraClippingRange();
669 SALOMEDSClient_Study* aStudy = study()->studyDS();
670 SALOMEDSClient_SObject* aSObject = aStudy->FindObjectID(myPrs->GetEntry());
672 SALOMEDSClient_ChildIterator* aIter = aStudy->NewChildIterator( aSObject );
673 SALOMEDSClient_StudyBuilder* aBuilder = aStudy->NewBuilder();
674 for ( ;aIter->More(); aIter->Next()) {
675 SALOMEDSClient_SObject* aTblObj = aIter->Value();
677 SALOMEDSClient_GenericAttribute* anAttr;
678 if (aTblObj->FindAttribute(anAttr, "AttributeName")) {
679 aBuilder->RemoveObjectWithChildren(aIter->Value()); // We should have only one child
684 if (isGenerateTable()) {
685 visuGUI->GetVisuGen()->CreateTable(aSObject->GetID().c_str());
686 if (isGenerateCurves()) {
687 SALOMEDSClient_Study* aStudy = study()->studyDS();
688 SALOMEDSClient_ChildIterator* aIter = aStudy->NewChildIterator( aSObject );
689 SALOMEDSClient_StudyBuilder* aBuilder = aStudy->NewBuilder();
690 for ( ;aIter->More(); aIter->Next()) {
691 SALOMEDSClient_SObject* aTblObj = aIter->Value();
693 SALOMEDSClient_GenericAttribute* anAttr;
694 if (aTblObj->FindAttribute(anAttr, "AttributeName")) {
695 visuGUI->CreatePlot(aTblObj);
703 VisuGUI::application()->objectBrowser()->updateTree();*/
709 void VisuGUI_CutLinesDlg::reject()
711 /*jfa tmp:if (myIsCreation) {
712 myPrs->RemoveFromStudy();
713 VisuGUI::application()->objectBrowser()->updateTree();
719 void VisuGUI_CutLinesDlg::onPreviewCheck (bool thePreview)
721 if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) {
723 //storeToPrsObject(myCutLines);
724 // myCutLines->GetPL()->Update();
734 void VisuGUI_CutLinesDlg::onRotation (double theValue)
736 if (myCutLines == NULL) return;
737 if (SVTK_ViewWindow* aView = VISU::GetViewWindow()) {
738 if (myPreviewCheck->isChecked()) {
740 /*myCutLines->SetOrientation(getOrientaion(),
741 myRotXSpn->value()*PI/180.,
742 myRotYSpn->value()*PI/180.);
743 myCutLines->SetOrientation2(getOrientaion(false),
744 myRotXSpn2->value()*PI/180.,
745 myRotYSpn2->value()*PI/180.);*/
746 // myCutLines->GetPL()->Update();
754 void VisuGUI_CutLinesDlg::onPlanePos (const QString& theValue)
756 if (myCutLines == NULL) return;
757 if (SVTK_ViewWindow* aView = VISU::GetViewWindow()) {
758 if (myPreviewCheck->isChecked()) {
759 //myCutLines->SetBasePlanePosition(theValue.toDouble());
760 // myCutLines->GetPL()->Update();
768 //jfa tmp:void VisuGUI_CutLinesDlg::onWindowActivated (SUIT_ViewWindow* theWnd)
770 //jfa tmp: if (theWnd != myStudyWnd)