Salome HOME
Join modifications from branch OCC_development_for_3_2_0a2
[modules/visu.git] / src / VISUGUI / VisuGUI_StreamLinesDlg.cxx
1 //  VISU VISUGUI : GUI of VISU component
2 //
3 //  Copyright (C) 2003  CEA/DEN, EDF R&D
4 //
5 //
6 //
7 //  File   : VisuGUI_StreamLinesDlg.cxx
8 //  Author : Vitaly SMETANNIKOV
9 //  Module : VISU
10
11 #include "VisuGUI_StreamLinesDlg.h"
12
13 #include "VisuGUI.h"
14 #include "VisuGUI_Tools.h"
15
16 #include "VISU_Mesh_i.hh"
17 #include "VISU_Gen_i.hh"
18 #include "VISU_StreamLines_i.hh"
19 #include "VISU_StreamLinesPL.hxx"
20 #include "VISU_Actor.h"
21
22 #include "SalomeApp_Application.h"
23 #include "LightApp_SelectionMgr.h"
24
25 #include "SVTK_ViewWindow.h"
26
27 #include "SUIT_Desktop.h"
28 #include "SUIT_ResourceMgr.h"
29 #include "SUIT_MessageBox.h"
30
31 #include "SALOME_ListIO.hxx"
32
33 #include <SALOMEDSClient_SObject.hxx>
34
35 #include <limits.h>
36 #include <qlayout.h>
37 #include <qgroupbox.h>
38 #include <qcolordialog.h>
39 #include <qtabwidget.h>
40
41 using namespace std;
42
43 VisuGUI_StreamLinesDlg::VisuGUI_StreamLinesDlg (SalomeApp_Module* theModule)
44      : QDialog(VISU::GetDesktop(theModule), "VisuGUI_StreamLinesDlg", false,
45                WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
46        myVisuGUI(theModule)
47 {
48   myPrs = NULL;
49   setCaption(tr("DLG_TITLE"));
50   setSizeGripEnabled(TRUE);
51
52   QVBoxLayout* aBoxLayout = new QVBoxLayout(this);
53   aBoxLayout->setSpacing( 6 );
54   aBoxLayout->setMargin( 11 );
55
56   QTabWidget* aTabBox = new QTabWidget(this);
57
58   QFrame* aTopBox = new QFrame(this);
59   aTopBox->setMargin( 11 );
60   QGridLayout* TopLayout = new QGridLayout( aTopBox );
61   TopLayout->setAlignment( Qt::AlignTop );
62   TopLayout->setSpacing( 8 );
63   TopLayout->setMargin( 11 );
64
65   // Source box
66   QGroupBox* aSourceBox = new QGroupBox (tr("SOURCE_GRP"), aTopBox);
67   aSourceBox->setColumnLayout(0, Qt::Vertical);
68   QGridLayout* aSrcLayout = new QGridLayout( aSourceBox->layout() );
69   aSrcLayout->setSpacing( 6 );
70   aSrcLayout->setMargin( 0 );
71
72   QLabel* aTypeLbl = new QLabel( tr( "LBL_SOURCE_TYPE" ), aSourceBox);
73   aSrcLayout->addWidget(aTypeLbl, 0, 0);
74
75   myUseSrcCombo = new QComboBox(aSourceBox);
76   const char* aChoise[] = { "None", "Entity", "Family", "Group", "Presentation", 0 };
77   myUseSrcCombo->insertStrList(aChoise);
78   aSrcLayout->addWidget(myUseSrcCombo, 0, 1);
79
80   mySrcCombo = new QComboBox(aSourceBox);
81   mySrcCombo->setEnabled((myUseSrcCombo->currentItem() == 0));
82
83   connect(myUseSrcCombo, SIGNAL(activated(int)), this, SLOT(onSourceTypeChange(int)));
84
85   // Find all fields and time stamps on it
86   _PTR(Study) aActiveStudy = VISU::GetCStudy(VISU::GetAppStudy(myVisuGUI));
87   LightApp_SelectionMgr* aSel = VISU::GetSelectionMgr(myVisuGUI);
88   SALOME_ListIO selected;
89   aSel->selectedObjects(selected);
90   if (selected.Extent() > 0) {
91     Handle(SALOME_InteractiveObject) aIO = selected.First();
92     if (aIO->hasEntry()) {
93       _PTR(SObject) aSObject = aActiveStudy->FindObjectID(aIO->getEntry());
94
95       _PTR(GenericAttribute) anTmpAttr;
96       if (aSObject->FindAttribute(anTmpAttr, "AttributeComment")) {
97         _PTR(AttributeComment) aTmpComment (anTmpAttr);
98         string aTmpComm = aTmpComment->Value();
99         QString aTmpstrIn (aTmpComm.c_str());
100         VISU::Storable::TRestoringMap aTmpaMap;
101         VISU::Storable::StrToMap(aTmpstrIn,aTmpaMap);
102         bool aTmpisExist;
103         VISU::VISUType aTmpType =
104           (VISU::VISUType)VISU::Storable::FindValue(aTmpaMap,"myType",&aTmpisExist).toInt();
105         switch (aTmpType) {
106         case VISU::TTIMESTAMP:
107           {
108             aSObject = aSObject->GetFather();
109             aSObject = aSObject->GetFather();
110             break;
111           }
112         case VISU::TFIELD:
113           {
114             _PTR(SObject) newSObject;
115             if(aSObject->ReferencedObject(newSObject)) aSObject = newSObject;
116             aSObject = aSObject->GetFather();
117             break;
118           }
119         case VISU::TANIMATION:
120           {
121             _PTR(ChildIterator) aTmpIter = aActiveStudy->NewChildIterator(aSObject);
122             for (aTmpIter->InitEx(true); aTmpIter->More(); aTmpIter->Next()) {
123               _PTR(SObject) aTmpChildSObj = aTmpIter->Value();
124               _PTR(SObject) newSObject;
125               if(aTmpChildSObj->ReferencedObject(newSObject)){
126                 aSObject = newSObject;
127                 aSObject->GetFather();
128                 break;
129               }
130             }
131             break;
132           }
133         }
134       }
135
136       aSObject = aSObject->GetFather();
137       aSObject = aSObject->GetFather();
138
139       mySelectionObj = aSObject;
140       CORBA::Object_var anObject = VISU::ClientSObjectToObject(mySelectionObj);
141       if (CORBA::is_nil(anObject)) {
142         mySelectionObj = mySelectionObj->GetFather();
143       }
144     }
145   }
146
147   if (mySelectionObj) {
148     _PTR(ChildIterator) aIter = aActiveStudy->NewChildIterator(mySelectionObj);
149
150     for (aIter->InitEx(true); aIter->More(); aIter->Next()) {
151       _PTR(SObject) aChildSObj = aIter->Value();
152       CORBA::Object_var aChildObject = VISU::ClientSObjectToObject(aChildSObj);
153
154       if (!CORBA::is_nil(aChildObject)) {
155         VISU::Prs3d_var aPrsObj = VISU::Prs3d::_narrow(aChildObject);
156         if (!CORBA::is_nil(aPrsObj)) { // if this is a Prs object
157           if ((aPrsObj->GetType() != VISU::TSTREAMLINES) &&
158               (aPrsObj->GetType() != VISU::TMESH)) {
159             _PTR(GenericAttribute) anAttr;
160             if (aChildSObj->FindAttribute(anAttr, "AttributeName")) {
161               _PTR(AttributeName) aName (anAttr);
162               myPrsLst += QString(aName->Value().c_str());
163               myPrsList.append(aPrsObj);
164               continue;
165             }
166           }
167         }
168       }
169
170       _PTR(GenericAttribute) anAttr;
171       if (aChildSObj->FindAttribute(anAttr, "AttributeComment")) {
172         _PTR(AttributeComment) aComment (anAttr);
173         string aComm = aComment->Value();
174         QString strIn (aComm.c_str());
175         VISU::Storable::TRestoringMap aMap;
176         VISU::Storable::StrToMap(strIn,aMap);
177         bool isExist;
178         VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt();
179         if (isExist) {
180           if ((aType == VISU::TFAMILY) || (aType == VISU::TGROUP) || (aType == VISU::TENTITY)) {
181             _PTR(GenericAttribute) aNameAttr;
182             if (aChildSObj->FindAttribute(aNameAttr, "AttributeName")) {
183               _PTR(AttributeName) aName (aNameAttr);
184               VISU::Prs3d_var aPrsObj = VISU::Prs3d::_narrow(aChildObject);
185               switch (aType) {
186               case VISU::TFAMILY:
187                 myFamilisLst += QString(aName->Value().c_str());
188                 myFamilyList.append(aPrsObj);
189                 break;
190               case VISU::TGROUP:
191                 myGroupsLst += QString(aName->Value().c_str());
192                 myGroupList.append(aPrsObj);
193                 break;
194               case VISU::TENTITY:
195                 myEntitiesLst += QString(aName->Value().c_str());
196                 myEntityList.append(aPrsObj);
197                 break;
198               }
199             }
200           }
201         }
202       }
203     }
204   }
205
206   //  connect(myUseSrcChk, SIGNAL(toggled(bool)), mySrcCombo, SLOT(setEnabled(bool)));
207   aSrcLayout->addMultiCellWidget(mySrcCombo, 1, 1, 0, 1);
208
209   QLabel* aPercentLbl = new QLabel (tr("LBL_USED_POINTS"), aSourceBox);
210   aSrcLayout->addWidget(aPercentLbl, 2, 0);
211
212   myPntPercent = new QtxDblSpinBox( 0, 1, 0.1, aSourceBox );
213   aSrcLayout->addWidget(myPntPercent, 2, 1);
214
215   TopLayout->addMultiCellWidget(aSourceBox, 0, 0, 0, 1);
216
217   QLabel* aStepLenLbl = new QLabel (tr("LBL_STEP_LENGTH"), aTopBox);
218   TopLayout->addWidget(aStepLenLbl, 1, 0);
219   myStepLen = new QtxDblSpinBox( DBL_MIN, DBL_MAX, 0.1, aTopBox );
220   myStepLen->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
221   TopLayout->addWidget(myStepLen, 1, 1);
222   connect(myStepLen, SIGNAL(valueChanged(double)), this, SLOT(StepLengthChanged(double)));
223
224   QLabel* aIntegStepLenLbl = new QLabel (tr("LBL_INTEGRATION_STEP"), aTopBox);
225   TopLayout->addWidget(aIntegStepLenLbl, 2, 0);
226   myIntegStepLen = new QtxDblSpinBox( DBL_MIN, DBL_MAX, 0.1, aTopBox );
227   myIntegStepLen->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
228   TopLayout->addWidget(myIntegStepLen, 2, 1);
229   connect(myIntegStepLen, SIGNAL(valueChanged(double)), this, SLOT(IntegrationStepChanged(double)));
230
231   QLabel* aPropagationLbl = new QLabel (tr("LBL_PROPAGATION_TIME"), aTopBox);
232   TopLayout->addWidget(aPropagationLbl, 3, 0);
233   myPropTime = new QtxDblSpinBox( DBL_MIN, DBL_MAX, 1, aTopBox );
234   myPropTime->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
235   TopLayout->addWidget(myPropTime, 3, 1);
236   connect(myPropTime, SIGNAL(valueChanged(double)), this, SLOT(PropagationTimeChanged(double)));
237
238   QLabel* aDirLbl = new QLabel (tr("LBL_DIRECTION"),aTopBox);
239   TopLayout->addWidget(aDirLbl, 4, 0);
240   myDirCombo = new QComboBox(aTopBox);
241   myDirCombo->insertItem("Forward");
242   myDirCombo->insertItem("Backward");
243   myDirCombo->insertItem("Both");
244   TopLayout->addWidget(myDirCombo, 4, 1);
245
246   myUseScalar = new QCheckBox (tr("MAGNITUDE_COLORING_CHK"), aTopBox, "UseMagn");
247   connect( myUseScalar, SIGNAL( clicked() ), this, SLOT( enableSetColor() ) );
248   TopLayout->addWidget(myUseScalar, 5, 0);
249
250   SelColor = new QPushButton (tr("USE_COLOR_BTN"), aTopBox, "SelColor");
251   connect( SelColor,     SIGNAL( clicked() ), this, SLOT( setVColor() ) );
252   TopLayout->addWidget( SelColor, 5, 1);
253
254   aTabBox->addTab(aTopBox, "Stream Lines");
255   myScalarPane = new VisuGUI_ScalarBarPane(this, false);
256   myScalarPane->setMargin( 5 );
257   aTabBox->addTab(myScalarPane, "Scalar Bar");
258
259   aBoxLayout->addWidget(aTabBox);
260
261   QGroupBox* aGroupButtons = new QGroupBox( this, "GroupButtons" );
262   aGroupButtons->setColumnLayout(0, Qt::Vertical );
263   aGroupButtons->layout()->setSpacing( 0 );
264   aGroupButtons->layout()->setMargin( 0 );
265
266   QGridLayout* aGroupButtonsLayout = new QGridLayout( aGroupButtons->layout() );
267   aGroupButtonsLayout->setAlignment( Qt::AlignTop );
268   aGroupButtonsLayout->setSpacing( 6 );
269   aGroupButtonsLayout->setMargin( 11 );
270
271   QPushButton* aOkBtn = new QPushButton( tr( "&OK" ), aGroupButtons, "buttonOk" );
272   aOkBtn->setAutoDefault( TRUE );
273   aOkBtn->setDefault( TRUE );
274   aGroupButtonsLayout->addWidget( aOkBtn, 0, 0 );
275   aGroupButtonsLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
276
277   QPushButton* aCancelBtn = new QPushButton( tr( "&Cancel" ) , aGroupButtons, "buttonCancel" );
278   aCancelBtn->setAutoDefault( TRUE );
279   aGroupButtonsLayout->addWidget( aCancelBtn, 0, 2 );
280   connect( aOkBtn,     SIGNAL( clicked() ), this, SLOT( accept() ) );
281   connect( aCancelBtn, SIGNAL( clicked() ), this, SLOT( reject() ) );
282
283   aBoxLayout->addWidget(aGroupButtons);
284
285   enableSetColor();
286 }
287
288
289 void VisuGUI_StreamLinesDlg::initFromPrsObject (VISU::StreamLines_i* thePrs)
290 {
291   myScalarPane->initFromPrsObject(thePrs);
292
293   myPrs = thePrs;
294   static int aNbOfSteps = 30;
295   VISU_StreamLinesPL* aStreamLinesPL = thePrs->GetStreamLinesPL();
296   float aMin, aMax;
297   aMin = aStreamLinesPL->GetMinPropagationTime();
298   aMax = aStreamLinesPL->GetMaxPropagationTime();
299   myPropTime->setRange(aMin,aMax);
300   myPropTime->setValue(aStreamLinesPL->GetPropagationTime());
301   myPropTime->setLineStep((aMax-aMin)/aNbOfSteps);
302
303   aMin = aStreamLinesPL->GetMinStepLength();
304   aMax = aStreamLinesPL->GetMaxStepLength();
305   myStepLen->setRange(aMin,aMax);
306   myStepLen->setValue(aStreamLinesPL->GetStepLength());
307   myStepLen->setLineStep((aMax-aMin)/aNbOfSteps);
308
309   aMin = aStreamLinesPL->GetMinIntegrationStep();
310   aMax = aStreamLinesPL->GetMaxIntegrationStep();
311   myIntegStepLen->setRange(aMin,aMax);
312   myIntegStepLen->setValue(aStreamLinesPL->GetIntegrationStep());
313   myIntegStepLen->setLineStep((aMax-aMin)/aNbOfSteps);
314
315   switch (thePrs->GetDirection()) {
316   case VISU::StreamLines::FORWARD:
317     myDirCombo->setCurrentItem(0);
318     break;
319   case VISU::StreamLines::BACKWARD:
320     myDirCombo->setCurrentItem(1);
321     break;
322   case VISU::StreamLines::BOTH:
323     myDirCombo->setCurrentItem(2);
324   }
325   myUseScalar->setChecked(thePrs->IsColored());
326   myPntPercent->setValue(thePrs->GetUsedPoints());
327
328   mySrcCombo->setEnabled(false);
329   QString aSrcEntry = thePrs->GetSourceEntry();
330
331   SALOMEDS::Color anOldColor = thePrs->GetColor();
332   QColor aColor = QColor(int(255*anOldColor.R),int(255*anOldColor.G),int(255*anOldColor.B));
333   setColor(aColor);
334   enableSetColor();
335
336 #define INITPRS(PRSLIST, PRSNUM) \
337     for (int i = 0; i < PRSLIST.count(); i++) { \
338       VISU::Prs3d_i* aPrs = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(PRSLIST[i]).in()); \
339       if (aPrs == NULL) continue; \
340       if (aSrcEntry == aPrs->GetEntry()) { \
341         onSourceTypeChange(PRSNUM); \
342         myUseSrcCombo->setCurrentItem(PRSNUM); \
343         mySrcCombo->setEnabled(true); \
344         mySrcCombo->setCurrentItem(i); \
345         return; \
346       } \
347     }
348
349   if (!aSrcEntry.isEmpty()) {
350     INITPRS(myEntityList, 1);
351     INITPRS(myFamilyList, 2);
352     INITPRS(myGroupList, 3);
353     INITPRS(myPrsList, 4);
354   }
355 #undef INITPRS
356 }
357
358 int VisuGUI_StreamLinesDlg::storeToPrsObject (VISU::StreamLines_i* thePrs)
359 {
360   bool isAccepted = myScalarPane->storeToPrsObject(thePrs);
361   if (isAccepted) {
362     thePrs->ShowColored(myUseScalar->isChecked());
363     if (!thePrs->IsColored()) {
364       SALOMEDS::Color aColor;
365       aColor.R = myColor.red()/255.;
366       aColor.G = myColor.green()/255.;
367       aColor.B = myColor.blue()/255.;
368       thePrs->SetColor(aColor);
369     }
370
371     VISU::StreamLines::Direction aDirection = VISU::StreamLines::BOTH;
372     switch (myDirCombo->currentItem()) {
373     case 0:
374       aDirection = VISU::StreamLines::FORWARD;
375       break;
376     case 1:
377       aDirection = VISU::StreamLines::BACKWARD;
378       break;
379     case 2:
380       aDirection = VISU::StreamLines::BOTH;
381     }
382
383     VISU::Prs3d_var aPrs;
384     int aSrcSelection = myUseSrcCombo->currentItem();
385     int aSrcItem = (mySrcCombo->count() > 0)? mySrcCombo->currentItem() : -1;
386     if ((aSrcSelection > 0) && (aSrcItem > -1)) {
387       VISU::VISUType aType;
388       QString aName;
389       switch (aSrcSelection) {
390       case 1: // Entity
391         aPrs = myEntityList[aSrcItem];
392         aType = VISU::TENTITY;
393         aName = myEntitiesLst[aSrcItem];
394         break;
395       case 2: // Family
396         aPrs = myFamilyList[aSrcItem];
397         aType = VISU::TFAMILY;
398         aName = myFamilisLst[aSrcItem];
399         break;
400       case 3: // Group
401         aPrs = myGroupList[aSrcItem];
402         aType = VISU::TGROUP;
403         aName = myGroupsLst[aSrcItem];
404         break;
405       case 4: // Presentation
406         aPrs = myPrsList[aSrcItem];
407         break;
408       }
409       if (CORBA::is_nil(aPrs) && aSrcSelection != 4) {
410         aPrs = createMesh(aType, aName);
411       }
412     }
413     isAccepted = thePrs->SetParams(myIntegStepLen->value(),
414                                    myPropTime->value(),
415                                    myStepLen->value(),
416                                    aPrs,
417                                    myPntPercent->value(),
418                                    aDirection);
419   }
420   //if (!isAccepted)
421   //  SUIT_MessageBox::warn1(VisuGUI::application()->desktop(), tr("WRN_VISU"),
422   //                         tr("ERR_CANT_BUILD_PRESENTATION"),
423   //                         tr("BUT_OK"));
424   return isAccepted;
425 }
426
427 /*!
428   Sets color
429 */
430 void VisuGUI_StreamLinesDlg::setColor( QColor color )
431 {
432   myColor = color;
433   SelColor->setPaletteBackgroundColor(myColor);
434 }
435
436
437 /*!
438   Called when "Select Color" buttonx clicked
439 */
440 void VisuGUI_StreamLinesDlg::setVColor()
441 {
442   QColor cnew = QColorDialog::getColor( myColor, this );
443   if ( cnew.isValid() )
444     setColor( cnew );
445 }
446
447
448 /*!
449   Enbled/disables magnitude coloring
450 */
451 void VisuGUI_StreamLinesDlg::enableMagnColor( bool enable )
452 {
453   myUseScalar->setEnabled( enable );
454   enableSetColor();
455 }
456
457 /*!
458   Called when "Magnitude Coloring" check box clicked
459 */
460 void VisuGUI_StreamLinesDlg::enableSetColor()
461 {
462   SelColor->setEnabled(!myUseScalar->isChecked() );
463 }
464
465 void VisuGUI_StreamLinesDlg::StepLengthChanged(double theValue){
466 }
467
468 void VisuGUI_StreamLinesDlg::IntegrationStepChanged(double theValue) {
469 }
470
471 void VisuGUI_StreamLinesDlg::PropagationTimeChanged(double theValue) {
472   myStepLen->setMaxValue(theValue);
473 }
474
475 void VisuGUI_StreamLinesDlg::onSourceTypeChange(int theIndex) {
476   mySrcCombo->clear();
477   if (theIndex == 0) {
478     mySrcCombo->setEnabled(false);
479     return;
480   } else
481     mySrcCombo->setEnabled(true);
482
483   switch(theIndex) {
484   case 1: // Entity
485     mySrcCombo->insertStringList(myEntitiesLst);
486     return;
487   case 2: // Family
488     mySrcCombo->insertStringList(myFamilisLst);
489     return;
490   case 3: // Group
491     mySrcCombo->insertStringList(myGroupsLst);
492     return;
493   case 4: // Presentation
494     mySrcCombo->insertStringList(myPrsLst);
495     return;
496   }
497 }
498
499
500 VISU::Mesh_ptr VisuGUI_StreamLinesDlg::createMesh (VISU::VISUType theType, QString theName)
501 {
502   return VISU::Mesh::_nil();
503 /*
504   CORBA::Object_var anObject = VISU::ClientSObjectToObject(mySelectionObj);
505   VISU::Result_var aResult;
506   if (!CORBA::is_nil(anObject)) {
507     aResult = VISU::Result::_narrow(anObject);
508   }
509   if (CORBA::is_nil(aResult)) {
510     SUIT_MessageBox::warn1(VisuGUI::application()->desktop(), tr("VISU_WARNING"),
511                            tr("WRN_NO_AVAILABLE_DATA"),
512                            tr("BUT_OK"));
513     return VISU::Mesh::_nil();
514   }
515   SALOMEDSClient_ChildIterator* aIter = VisuGUI::GetStudyDocument()->NewChildIterator( mySelectionObj );
516   VISU::Storable::TRestoringMap aMap;
517
518   for (aIter->InitEx(true); aIter->More(); aIter->Next() ) {
519     SALOMEDSClient_SObject* aChildSObj = aIter->Value();
520     SALOMEDSClient_GenericAttribute* anAttr;
521     if (aChildSObj->FindAttribute(anAttr, "AttributeComment")) {
522       SALOMEDSClient_AttributeComment* aComment = dynamic_cast<SALOMEDSClient_AttributeComment*>( anAttr );
523       CORBA::String_var aComm = aComment->Value().c_str();
524       QString strIn(aComm.in());
525       aMap.clear();
526       VISU::Storable::StrToMap(strIn,aMap);
527       bool isExist;
528       VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt();
529       if (isExist) {
530         if (aType != theType) continue;
531
532         SALOMEDSClient_GenericAttribute* aNameAttr;
533         if ( aChildSObj->FindAttribute(aNameAttr, "AttributeName") ) {
534           SALOMEDSClient_AttributeName* aName = dynamic_cast<SALOMEDSClient_AttributeName*>(aNameAttr);
535           if (QString(aName->Value()) == theName) break; //use current map
536         }
537       }
538     }
539   }
540   VISU::Mesh_var aMesh;
541   QString aMeshName = VISU::Storable::FindValue(aMap,"myMeshName");
542   switch (theType) {
543   case VISU::TFAMILY:
544     {
545       VISU::Entity anEntity = (VISU::Entity)VISU::Storable::FindValue(aMap,"myEntityId").toInt();
546       aMesh = VisuGUI::GetVisuGen()->FamilyMeshOnEntity(aResult,aMeshName.latin1(),anEntity,theName.latin1());
547     }
548     break;
549   case VISU::TGROUP:
550     {
551       aMesh = VisuGUI::GetVisuGen()->GroupMesh(aResult,aMeshName.latin1(), theName.latin1());
552     }
553     break;
554   case VISU::TENTITY:
555     {
556       VISU::Entity anEntity = (VISU::Entity)VISU::Storable::FindValue(aMap,"myId").toInt();
557       aMesh = VisuGUI::GetVisuGen()->MeshOnEntity(aResult,aMeshName.latin1(),anEntity);
558     }
559     break;
560   }
561   if(!CORBA::is_nil(aMesh)){ // Create Actor
562     VISU::Mesh_i* pPresent = dynamic_cast<VISU::Mesh_i*>(VISU::GetServant(aMesh).in());
563     if(SVTK_ViewWindow* vf = VISU::GetViewWindow()){
564       try{
565         pPresent->SetPresentationType(VISU::POINT);
566         VISU_Actor *anActor = pPresent->CreateActor();
567         vf->AddActor(anActor);
568       }catch(...){
569         SUIT_MessageBox::warn1 ( VisuGUI::application()->desktop(), tr("VISU_WARNING"),
570                                 tr("ERR_CANT_CREATE_ACTOR"),
571                                 tr("BUT_OK") );
572       }
573     }
574   } else {
575     SUIT_MessageBox::warn1(VisuGUI::application()->desktop(), tr("VISU_WARNING"),
576                            tr("ERR_CANT_BUILD_PRESENTATION"),
577                            tr("BUT_OK"));
578   }
579   return aMesh._retn();
580 */
581 }
582
583 void VisuGUI_StreamLinesDlg::accept() {
584   if (myScalarPane->check())
585     {
586       myScalarPane->deletePreview();
587       QDialog::accept();
588     }
589 }
590
591 void VisuGUI_StreamLinesDlg::reject()
592 {
593   myScalarPane->deletePreview();
594   QDialog::reject();
595 }