Salome HOME
Update copyright information
[modules/visu.git] / src / VISUGUI / VisuGUI_StreamLinesDlg.cxx
1 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 //  File   : VisuGUI_StreamLinesDlg.cxx
24 //  Author : Vitaly SMETANNIKOV
25 //  Module : VISU
26 //
27 #include "VisuGUI_StreamLinesDlg.h"
28
29 #include "VisuGUI.h"
30 #include "VisuGUI_Tools.h"
31 #include "VisuGUI_InputPane.h"
32
33 #include "VISU_Mesh_i.hh"
34 #include "VISU_Gen_i.hh"
35 #include "VISU_StreamLines_i.hh"
36 #include "VISU_ColoredPrs3dFactory.hh"
37 #include "VISU_StreamLinesPL.hxx"
38 #include "VISU_Actor.h"
39
40 #include <SalomeApp_DoubleSpinBox.h>
41 #include "SalomeApp_Application.h"
42 #include "LightApp_Application.h"
43 #include "LightApp_SelectionMgr.h"
44
45 #include "SVTK_ViewWindow.h"
46
47 #include "SUIT_Desktop.h"
48 #include "SUIT_Session.h"
49 #include "SUIT_ResourceMgr.h"
50 #include "SUIT_MessageBox.h"
51
52 #include "SALOME_ListIO.hxx"
53
54 #include <SALOMEDSClient_SObject.hxx>
55
56 #include <QtxColorButton.h>
57
58 #include <limits>
59
60 #include <QLayout>
61 #include <QLabel>
62 #include <QCheckBox>
63 #include <QComboBox>
64 #include <QGroupBox>
65 #include <QColorDialog>
66 #include <QTabWidget>
67 #include <QPushButton>
68 #include <QLabel>
69 #include <QStringList>
70 #include <QKeyEvent>
71 #include <QFrame>
72
73
74 VisuGUI_StreamLinesDlg::VisuGUI_StreamLinesDlg (SalomeApp_Module* theModule)
75   : VisuGUI_ScalarBarBaseDlg(theModule),
76     myVisuGUI(theModule),
77     myStatus(false)
78 {
79   setWindowTitle(tr("DLG_TITLE"));
80   setSizeGripEnabled(TRUE);
81
82   QVBoxLayout* aBoxLayout = new QVBoxLayout(this);
83   aBoxLayout->setSpacing( 6 );
84   aBoxLayout->setMargin( 11 );
85
86   myTabBox = new QTabWidget(this);
87
88   QFrame* aTopBox = new QFrame(this);
89   //aTopBox->setMargin( 11 );
90   QGridLayout* TopLayout = new QGridLayout( aTopBox );
91   TopLayout->setAlignment( Qt::AlignTop );
92   TopLayout->setSpacing( 8 );
93   TopLayout->setMargin( 11 );
94
95   // Source box
96   QGroupBox* aSourceBox = new QGroupBox (tr("SOURCE_GRP"), aTopBox);
97   //aSourceBox->setColumnLayout(0, Qt::Vertical);
98   QGridLayout* aSrcLayout = new QGridLayout( aSourceBox );
99   aSrcLayout->setSpacing( 6 );
100   aSrcLayout->setMargin( 11 );
101
102   QLabel* aTypeLbl = new QLabel( tr( "LBL_SOURCE_TYPE" ), aSourceBox);
103   aSrcLayout->addWidget(aTypeLbl, 0, 0);
104
105   myUseSrcCombo = new QComboBox(aSourceBox);
106   QStringList aChoise;
107   aChoise.append( "None" );
108   aChoise.append( "Entity" );
109   aChoise.append( "Family" );
110   aChoise.append( "Group" );
111   aChoise.append( "Presentation" );
112   myUseSrcCombo->addItems(aChoise);
113   aSrcLayout->addWidget(myUseSrcCombo, 0, 1);
114
115   mySrcCombo = new QComboBox(aSourceBox);
116   mySrcCombo->setEnabled((myUseSrcCombo->currentIndex() == 0));
117
118   connect(myUseSrcCombo, SIGNAL(activated(int)), this, SLOT(onSourceTypeChange(int)));
119
120   // Find all fields and time stamps on it
121   _PTR(Study) aActiveStudy = VISU::GetCStudy(VISU::GetAppStudy(myVisuGUI));
122   LightApp_SelectionMgr* aSel = VISU::GetSelectionMgr(myVisuGUI);
123   SALOME_ListIO selected;
124   aSel->selectedObjects(selected);
125   if (selected.Extent() > 0) {
126     Handle(SALOME_InteractiveObject) aIO = selected.First();
127     if (aIO->hasEntry()) {
128       _PTR(SObject) aSObject = aActiveStudy->FindObjectID(aIO->getEntry());
129       VISU::VISUType aType = VISU::Storable::SObject2Type(aSObject);
130       switch (aType) {
131       case VISU::TTIMESTAMP: {
132         aSObject = aSObject->GetFather();
133         aSObject = aSObject->GetFather();
134         break;
135       }
136       case VISU::TFIELD: {
137         _PTR(SObject) newSObject;
138         if(aSObject->ReferencedObject(newSObject)) aSObject = newSObject;
139         aSObject = aSObject->GetFather();
140         break;
141       }
142       case VISU::TANIMATION: {
143         _PTR(ChildIterator) aTmpIter = aActiveStudy->NewChildIterator(aSObject);
144         for (aTmpIter->InitEx(true); aTmpIter->More(); aTmpIter->Next()) {
145           _PTR(SObject) aTmpChildSObj = aTmpIter->Value();
146           _PTR(SObject) newSObject;
147           if(aTmpChildSObj->ReferencedObject(newSObject)){
148             aSObject = newSObject;
149             aSObject->GetFather();
150             break;
151           }
152         }
153         break;
154       }}
155       
156       aSObject = aSObject->GetFather();
157       aSObject = aSObject->GetFather();
158
159       mySelectionObj = aSObject;
160       CORBA::Object_var anObject = VISU::ClientSObjectToObject(mySelectionObj);
161       if (CORBA::is_nil(anObject)) {
162         mySelectionObj = mySelectionObj->GetFather();
163       }
164     }
165   }
166
167   if (mySelectionObj) {
168     _PTR(ChildIterator) aIter = aActiveStudy->NewChildIterator(mySelectionObj);
169
170     for (aIter->InitEx(true); aIter->More(); aIter->Next()) {
171       _PTR(SObject) aChildSObj = aIter->Value();
172       CORBA::Object_var aChildObject = VISU::ClientSObjectToObject(aChildSObj);
173
174       if (!CORBA::is_nil(aChildObject)) {
175         VISU::Prs3d_var aPrsObj = VISU::Prs3d::_narrow(aChildObject);
176         if (!CORBA::is_nil(aPrsObj)) { // if this is a Prs object
177           if ((aPrsObj->GetType() != VISU::TSTREAMLINES) &&
178               (aPrsObj->GetType() != VISU::TMESH)) {
179             _PTR(GenericAttribute) anAttr;
180             if (aChildSObj->FindAttribute(anAttr, "AttributeName")) {
181               _PTR(AttributeName) aName (anAttr);
182               myPrsLst += QString(aName->Value().c_str());
183               myPrsList.append(aPrsObj);
184               continue;
185             }
186           }
187         }
188       }
189
190       VISU::VISUType aType = VISU::Storable::SObject2Type(aChildSObj);
191       if ((aType == VISU::TFAMILY) || (aType == VISU::TGROUP) || (aType == VISU::TENTITY)) {
192         _PTR(GenericAttribute) aNameAttr;
193         if (aChildSObj->FindAttribute(aNameAttr, "AttributeName")) {
194           _PTR(AttributeName) aName (aNameAttr);
195           VISU::Prs3d_var aPrsObj = VISU::Prs3d::_narrow(aChildObject);
196           switch (aType) {
197           case VISU::TFAMILY:
198             myFamilisLst += QString(aName->Value().c_str());
199             myFamilyList.append(aPrsObj);
200             break;
201           case VISU::TGROUP:
202             myGroupsLst += QString(aName->Value().c_str());
203             myGroupList.append(aPrsObj);
204             break;
205           case VISU::TENTITY:
206             myEntitiesLst += QString(aName->Value().c_str());
207             myEntityList.append(aPrsObj);
208             break;
209           }
210         }
211       }
212     }
213   }
214
215   //  connect(myUseSrcChk, SIGNAL(toggled(bool)), mySrcCombo, SLOT(setEnabled(bool)));
216   aSrcLayout->addWidget(mySrcCombo, 1, 0, 1, 2);
217
218   QLabel* aPercentLbl = new QLabel (tr("LBL_USED_POINTS"), aSourceBox);
219   aSrcLayout->addWidget(aPercentLbl, 2, 0);
220
221   myPntPercent = new SalomeApp_DoubleSpinBox( aSourceBox );
222   VISU::initSpinBox( myPntPercent, 0., 1., .1, "parametric_precision" );
223   aSrcLayout->addWidget(myPntPercent, 2, 1);
224
225   TopLayout->addWidget(aSourceBox, 0, 0, 1, 2);
226
227   QLabel* aStepLenLbl = new QLabel (tr("LBL_STEP_LENGTH"), aTopBox);
228   TopLayout->addWidget(aStepLenLbl, 1, 0);
229   myStepLen = new SalomeApp_DoubleSpinBox( aTopBox );
230   VISU::initSpinBox( myStepLen,
231                      std::numeric_limits<double>::min(), 
232                      std::numeric_limits<double>::max(),
233                      .1, 
234                      "parametric_precision" );
235   myStepLen->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
236   TopLayout->addWidget(myStepLen, 1, 1);
237   connect(myStepLen, SIGNAL(valueChanged(double)), this, SLOT(StepLengthChanged(double)));
238
239   QLabel* aIntegStepLenLbl = new QLabel (tr("LBL_INTEGRATION_STEP"), aTopBox);
240   TopLayout->addWidget(aIntegStepLenLbl, 2, 0);
241   myIntegStepLen = new SalomeApp_DoubleSpinBox( aTopBox );
242   VISU::initSpinBox( myIntegStepLen,
243                      std::numeric_limits<double>::min(), 
244                      std::numeric_limits<double>::max(), 
245                      .1, 
246                      "parametric_precision" ); 
247   myIntegStepLen->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
248   TopLayout->addWidget(myIntegStepLen, 2, 1);
249   connect(myIntegStepLen, SIGNAL(valueChanged(double)), this, SLOT(IntegrationStepChanged(double)));
250
251   QLabel* aPropagationLbl = new QLabel (tr("LBL_PROPAGATION_TIME"), aTopBox);
252   TopLayout->addWidget(aPropagationLbl, 3, 0);
253   myPropTime = new SalomeApp_DoubleSpinBox( aTopBox );
254   VISU::initSpinBox( myPropTime,
255                      std::numeric_limits<double>::min(), 
256                      std::numeric_limits<double>::max(), 
257                      .1, 
258                      "parametric_precision" );
259   myPropTime->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
260   TopLayout->addWidget(myPropTime, 3, 1);
261   connect(myPropTime, SIGNAL(valueChanged(double)), this, SLOT(PropagationTimeChanged(double)));
262
263   QLabel* aDirLbl = new QLabel (tr("LBL_DIRECTION"),aTopBox);
264   TopLayout->addWidget(aDirLbl, 4, 0);
265   myDirCombo = new QComboBox(aTopBox);
266   myDirCombo->addItem("Forward");
267   myDirCombo->addItem("Backward");
268   myDirCombo->addItem("Both");
269   TopLayout->addWidget(myDirCombo, 4, 1);
270
271   myUseScalar = new QCheckBox (tr("MAGNITUDE_COLORING_CHK"), aTopBox);
272   connect( myUseScalar, SIGNAL( clicked() ), this, SLOT( enableSetColor() ) );
273   TopLayout->addWidget(myUseScalar, 5, 0);
274
275   SelColor = new QtxColorButton( aTopBox );
276   SelColor->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
277   //connect( SelColor,     SIGNAL( clicked() ), this, SLOT( setVColor() ) );
278   TopLayout->addWidget( SelColor, 5, 1);
279
280   myTabBox->addTab(aTopBox, "Stream Lines");
281   myInputPane = new VisuGUI_InputPane(VISU::TSTREAMLINES, theModule, this);
282   myTabBox->addTab(GetScalarPane(), "Scalar Bar");
283   myTabBox->addTab(myInputPane, "Input");
284
285   aBoxLayout->addWidget(myTabBox);
286
287   QGroupBox* aGroupButtons = new QGroupBox( this );
288   //aGroupButtons->setColumnLayout(0, Qt::Vertical );
289   //aGroupButtons->layout()->setSpacing( 0 );
290   //aGroupButtons->layout()->setMargin( 0 );
291
292   QGridLayout* aGroupButtonsLayout = new QGridLayout( aGroupButtons );
293   aGroupButtonsLayout->setAlignment( Qt::AlignTop );
294   aGroupButtonsLayout->setSpacing( 6 );
295   aGroupButtonsLayout->setMargin( 11 );
296
297   QPushButton* aOkBtn = new QPushButton( tr( "BUT_OK" ), aGroupButtons );
298   aOkBtn->setAutoDefault( TRUE );
299   aOkBtn->setDefault( TRUE );
300   aGroupButtonsLayout->addWidget( aOkBtn, 0, 0 );
301   aGroupButtonsLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
302
303   QPushButton* aCancelBtn = new QPushButton( tr( "BUT_CANCEL" ) , aGroupButtons );
304   aCancelBtn->setAutoDefault( TRUE );
305   aGroupButtonsLayout->addWidget( aCancelBtn, 0, 2 );
306
307   QPushButton* aHelpBtn = new QPushButton( tr( "BUT_HELP" ) , aGroupButtons );
308   aHelpBtn->setAutoDefault( TRUE );
309   aGroupButtonsLayout->addWidget( aHelpBtn, 0, 3 );
310
311   connect( aOkBtn,     SIGNAL( clicked() ), this, SLOT( accept() ) );
312   connect( aCancelBtn, SIGNAL( clicked() ), this, SLOT( reject() ) );
313   connect( aHelpBtn,   SIGNAL( clicked() ), this, SLOT( onHelp() ) );
314
315   aBoxLayout->addWidget(aGroupButtons);
316
317   enableSetColor();
318 }
319
320 VisuGUI_StreamLinesDlg::~VisuGUI_StreamLinesDlg()
321 {}
322
323 void VisuGUI_StreamLinesDlg::initFromPrsObject ( VISU::ColoredPrs3d_i* thePrs,
324                                                  bool theInit )
325 {
326   if( theInit )
327     myPrsCopy = VISU::TSameAsFactory<VISU::TSTREAMLINES>().Create(thePrs, VISU::ColoredPrs3d_i::EDoNotPublish);
328
329   VisuGUI_ScalarBarBaseDlg::initFromPrsObject(myPrsCopy, theInit);
330
331   static int aNbOfSteps = 30;
332   VISU_StreamLinesPL* aStreamLinesPL = myPrsCopy->GetSpecificPL();
333   float aMin, aMax;
334   aMin = aStreamLinesPL->GetMinPropagationTime();
335   aMax = aStreamLinesPL->GetMaxPropagationTime();
336   myPropTime->setRange(aMin,aMax);
337   myPropTime->setValue(aStreamLinesPL->GetPropagationTime());
338   myPropTime->setSingleStep((aMax-aMin)/aNbOfSteps);
339
340   aMin = aStreamLinesPL->GetMinStepLength();
341   aMax = aStreamLinesPL->GetMaxStepLength();
342   myStepLen->setRange(aMin,aMax);
343   myStepLen->setValue(aStreamLinesPL->GetStepLength());
344   myStepLen->setSingleStep((aMax-aMin)/aNbOfSteps);
345
346   aMin = aStreamLinesPL->GetMinIntegrationStep();
347   aMax = aStreamLinesPL->GetMaxIntegrationStep();
348   myIntegStepLen->setRange(aMin,aMax);
349   myIntegStepLen->setValue(aStreamLinesPL->GetIntegrationStep());
350   myIntegStepLen->setSingleStep((aMax-aMin)/aNbOfSteps);
351
352   switch (myPrsCopy->GetDirection()) {
353   case VISU::StreamLines::FORWARD:
354     myDirCombo->setCurrentIndex(0);
355     break;
356   case VISU::StreamLines::BACKWARD:
357     myDirCombo->setCurrentIndex(1);
358     break;
359   case VISU::StreamLines::BOTH:
360     myDirCombo->setCurrentIndex(2);
361   }
362   myUseScalar->setChecked(myPrsCopy->IsColored());
363   myPntPercent->setValue(myPrsCopy->GetUsedPoints());
364
365   mySrcCombo->setEnabled(false);
366   QString aSrcEntry = myPrsCopy->GetSourceEntry();
367
368   SALOMEDS::Color anOldColor = myPrsCopy->GetColor();
369   QColor aColor = QColor(int(255*anOldColor.R),int(255*anOldColor.G),int(255*anOldColor.B));
370   setColor(aColor);
371   enableSetColor();
372
373 #define INITPRS(PRSLIST, PRSNUM) \
374     for (int i = 0; i < PRSLIST.count(); i++) { \
375       VISU::Prs3d_i* aPrs = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(PRSLIST[i]).in()); \
376       if (aPrs == NULL) continue; \
377       if (aSrcEntry == aPrs->GetEntry().c_str()) { \
378         onSourceTypeChange(PRSNUM); \
379         myUseSrcCombo->setCurrentIndex(PRSNUM); \
380         mySrcCombo->setEnabled(true); \
381         mySrcCombo->setCurrentIndex(i); \
382         return; \
383       } \
384     }
385
386   if (!aSrcEntry.isEmpty()) {
387     INITPRS(myEntityList, 1);
388     INITPRS(myFamilyList, 2);
389     INITPRS(myGroupList, 3);
390     INITPRS(myPrsList, 4);
391   }
392 #undef INITPRS
393
394   if( !theInit )
395     return;
396
397   myInputPane->initFromPrsObject( myPrsCopy );
398   myTabBox->setCurrentIndex( 0 );
399
400 }
401
402 int VisuGUI_StreamLinesDlg::storeToPrsObject (VISU::ColoredPrs3d_i* thePrs)
403 {  
404   VISU::TSameAsFactory<VISU::TSTREAMLINES>().Copy(myPrsCopy, thePrs);
405   return myStatus;
406 }
407
408 /*!
409   Sets color
410 */
411 void VisuGUI_StreamLinesDlg::setColor( QColor color )
412 {
413   /*Color = color;
414   QPalette aPal = SelColor->palette();
415   aPal.setColor( SelColor->backgroundRole(), myColor );
416   SelColor->setPalette( aPal );*/
417   SelColor->setColor( color );
418 }
419
420
421 /*!
422   Called when "Select Color" buttonx clicked
423 */
424 /*void VisuGUI_StreamLinesDlg::setVColor()
425 {
426   QColor cnew = QColorDialog::getColor( myColor, this );
427   if ( cnew.isValid() )
428     setColor( cnew );
429 }*/
430
431
432 /*!
433   Enbled/disables magnitude coloring
434 */
435 void VisuGUI_StreamLinesDlg::enableMagnColor( bool enable )
436 {
437   myUseScalar->setEnabled( enable );
438   enableSetColor();
439 }
440
441 /*!
442   Called when "Magnitude Coloring" check box clicked
443 */
444 void VisuGUI_StreamLinesDlg::enableSetColor()
445 {
446   SelColor->setEnabled(!myUseScalar->isChecked() );
447 }
448
449 void VisuGUI_StreamLinesDlg::StepLengthChanged(double theValue){
450 }
451
452 void VisuGUI_StreamLinesDlg::IntegrationStepChanged(double theValue) {
453 }
454
455 void VisuGUI_StreamLinesDlg::PropagationTimeChanged(double theValue) {
456   myStepLen->setMaximum(theValue);
457 }
458
459 void VisuGUI_StreamLinesDlg::onSourceTypeChange(int theIndex) {
460   mySrcCombo->clear();
461   if (theIndex == 0) {
462     mySrcCombo->setEnabled(false);
463     return;
464   } else
465     mySrcCombo->setEnabled(true);
466
467   switch(theIndex) {
468   case 1: // Entity
469     mySrcCombo->addItems(myEntitiesLst);
470     return;
471   case 2: // Family
472     mySrcCombo->addItems(myFamilisLst);
473     return;
474   case 3: // Group
475     mySrcCombo->addItems(myGroupsLst);
476     return;
477   case 4: // Presentation
478     mySrcCombo->addItems(myPrsLst);
479     return;
480   }
481 }
482
483
484 void VisuGUI_StreamLinesDlg::storeToPrsCopy() {
485
486   if(!myInputPane->check() || !GetScalarPane()->check()) {
487     myStatus = false;
488     return;
489   }
490
491   myStatus = myInputPane->storeToPrsObject( myPrsCopy );
492   myStatus &= GetScalarPane()->storeToPrsObject( myPrsCopy );
493     
494   if (myStatus) {
495     myPrsCopy->ShowColored(myUseScalar->isChecked());
496     if (!myPrsCopy->IsColored()) {
497       SALOMEDS::Color aColor;
498       aColor.R = SelColor->color().red()/255.;
499       aColor.G = SelColor->color().green()/255.;
500       aColor.B = SelColor->color().blue()/255.;
501       myPrsCopy->SetColor(aColor);
502     }
503     
504     VISU::StreamLines::Direction aDirection = VISU::StreamLines::BOTH;
505     switch (myDirCombo->currentIndex()) {
506     case 0:
507       aDirection = VISU::StreamLines::FORWARD;
508       break;
509     case 1:
510       aDirection = VISU::StreamLines::BACKWARD;
511       break;
512     case 2:
513       aDirection = VISU::StreamLines::BOTH;
514     }
515     
516     VISU::Prs3d_var aPrs;
517     int aSrcSelection = myUseSrcCombo->currentIndex();
518     int aSrcItem = (mySrcCombo->count() > 0)? mySrcCombo->currentIndex() : -1;
519     if ((aSrcSelection > 0) && (aSrcItem > -1)) {
520       VISU::VISUType aType;
521       QString aName;
522       switch (aSrcSelection) {
523       case 1: // Entity
524         aPrs = myEntityList[aSrcItem];
525         aType = VISU::TENTITY;
526         aName = myEntitiesLst[aSrcItem];
527         break;
528       case 2: // Family
529         aPrs = myFamilyList[aSrcItem];
530         aType = VISU::TFAMILY;
531         aName = myFamilisLst[aSrcItem];
532         break;
533       case 3: // Group
534         aPrs = myGroupList[aSrcItem];
535         aType = VISU::TGROUP;
536         aName = myGroupsLst[aSrcItem];
537         break;
538       case 4: // Presentation
539         aPrs = myPrsList[aSrcItem];
540         break;
541       }
542       if (CORBA::is_nil(aPrs) && aSrcSelection != 4) {
543         aPrs = createMesh(aType, aName);
544       }
545     }
546     myStatus &= myPrsCopy->SetParams(myIntegStepLen->value(),
547                                      myPropTime->value(),
548                                      myStepLen->value(),
549                                      aPrs,
550                                      myPntPercent->value(),
551                                      aDirection);
552   }
553 }
554
555
556 VISU::Mesh_ptr VisuGUI_StreamLinesDlg::createMesh (VISU::VISUType theType, QString theName)
557 {
558   return VISU::Mesh::_nil();
559 }
560
561 void VisuGUI_StreamLinesDlg::accept()
562 {
563   
564   //rnv: To fix the IPAL21920: WinTC5.1.4: parameters of StreamLines are not taken in account.
565   //rnv: Show confirmation message in case if 'Used points' and 'Step length' were re-calculated.  
566   //1. Store parameters to the myPrsCopy
567   storeToPrsCopy();
568
569   //2. Check 'Used points' and 'Step length' parameters
570   if( myStepLen->value() > myPrsCopy->GetStepLength() || 
571       myPntPercent->value() > myPrsCopy->GetUsedPoints() ) {
572     QString aWarning = tr("STREAM_MEMORY_ALERT");
573     if( SUIT_MessageBox::warning( this, tr( "WRN_VISU_WARNING" ), aWarning, tr( "BUT_OK" ), tr( "CANCEL" ) ) == 1 ) {
574       // Set re-calculated values
575       myStepLen->setValue(myPrsCopy->GetStepLength());
576       myPntPercent->setValue(myPrsCopy->GetUsedPoints());
577       return;
578     }
579   }
580   
581   VisuGUI_ScalarBarBaseDlg::accept();
582 }
583
584 void VisuGUI_StreamLinesDlg::reject()
585 {
586   VisuGUI_ScalarBarBaseDlg::reject();
587 }
588
589 QString VisuGUI_StreamLinesDlg::GetContextHelpFilePath()
590 {
591   return "stream_lines_page.html";
592 }