Salome HOME
Join modifications from branch OCC_development_for_3_2_0a2
[modules/visu.git] / src / VISUGUI / VisuGUI_StreamLinesDlg.cxx
index aaa91c6f2b9e832fc4878b6ec85b0c453ca019fb..e6fa3cc2990d31d80e38b22352cb6d40a2045515 100644 (file)
-//  File      : VisuGUI_StreamLinesDlg.cxx
-//  Created   : 06 / 03 / 2003
-//  Author    : Vitaly SMETANNIKOV
-//  Project   : SALOME 
-//  Module    : VISUGUI
-//  Copyright : Open CASCADE 
-
+//  VISU VISUGUI : GUI of VISU component
+//
+//  Copyright (C) 2003  CEA/DEN, EDF R&D
+//
+//
+//
+//  File   : VisuGUI_StreamLinesDlg.cxx
+//  Author : Vitaly SMETANNIKOV
+//  Module : VISU
 
 #include "VisuGUI_StreamLinesDlg.h"
+
+#include "VisuGUI.h"
+#include "VisuGUI_Tools.h"
+
+#include "VISU_Mesh_i.hh"
+#include "VISU_Gen_i.hh"
+#include "VISU_StreamLines_i.hh"
+#include "VISU_StreamLinesPL.hxx"
+#include "VISU_Actor.h"
+
+#include "SalomeApp_Application.h"
+#include "LightApp_SelectionMgr.h"
+
+#include "SVTK_ViewWindow.h"
+
+#include "SUIT_Desktop.h"
+#include "SUIT_ResourceMgr.h"
+#include "SUIT_MessageBox.h"
+
+#include "SALOME_ListIO.hxx"
+
+#include <SALOMEDSClient_SObject.hxx>
+
+#include <limits.h>
 #include <qlayout.h>
 #include <qgroupbox.h>
 #include <qcolordialog.h>
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "QAD_Config.h"
+#include <qtabwidget.h>
 
+using namespace std;
 
-VisuGUI_StreamLinesDlg::VisuGUI_StreamLinesDlg()
-    : QDialog( QAD_Application::getDesktop(), "VisuGUI_StreamLinesDlg", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+VisuGUI_StreamLinesDlg::VisuGUI_StreamLinesDlg (SalomeApp_Module* theModule)
+     : QDialog(VISU::GetDesktop(theModule), "VisuGUI_StreamLinesDlg", false,
+               WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
+       myVisuGUI(theModule)
 {
-  setCaption("Stream lines Preferences");
-  setSizeGripEnabled( TRUE );
+  myPrs = NULL;
+  setCaption(tr("DLG_TITLE"));
+  setSizeGripEnabled(TRUE);
+
+  QVBoxLayout* aBoxLayout = new QVBoxLayout(this);
+  aBoxLayout->setSpacing( 6 );
+  aBoxLayout->setMargin( 11 );
 
-  QGridLayout* TopLayout = new QGridLayout( this ); 
-  TopLayout->setSpacing( 6 );
+  QTabWidget* aTabBox = new QTabWidget(this);
+
+  QFrame* aTopBox = new QFrame(this);
+  aTopBox->setMargin( 11 );
+  QGridLayout* TopLayout = new QGridLayout( aTopBox );
+  TopLayout->setAlignment( Qt::AlignTop );
+  TopLayout->setSpacing( 8 );
   TopLayout->setMargin( 11 );
 
-  QLabel* aStepLenLbl = new QLabel( tr( "Step Length" ), this);
-  TopLayout->addWidget(aStepLenLbl, 0, 0);
-  myStepLen = new QAD_SpinBoxDbl( this);
+  // Source box
+  QGroupBox* aSourceBox = new QGroupBox (tr("SOURCE_GRP"), aTopBox);
+  aSourceBox->setColumnLayout(0, Qt::Vertical);
+  QGridLayout* aSrcLayout = new QGridLayout( aSourceBox->layout() );
+  aSrcLayout->setSpacing( 6 );
+  aSrcLayout->setMargin( 0 );
+
+  QLabel* aTypeLbl = new QLabel( tr( "LBL_SOURCE_TYPE" ), aSourceBox);
+  aSrcLayout->addWidget(aTypeLbl, 0, 0);
+
+  myUseSrcCombo = new QComboBox(aSourceBox);
+  const char* aChoise[] = { "None", "Entity", "Family", "Group", "Presentation", 0 };
+  myUseSrcCombo->insertStrList(aChoise);
+  aSrcLayout->addWidget(myUseSrcCombo, 0, 1);
+
+  mySrcCombo = new QComboBox(aSourceBox);
+  mySrcCombo->setEnabled((myUseSrcCombo->currentItem() == 0));
+
+  connect(myUseSrcCombo, SIGNAL(activated(int)), this, SLOT(onSourceTypeChange(int)));
+
+  // Find all fields and time stamps on it
+  _PTR(Study) aActiveStudy = VISU::GetCStudy(VISU::GetAppStudy(myVisuGUI));
+  LightApp_SelectionMgr* aSel = VISU::GetSelectionMgr(myVisuGUI);
+  SALOME_ListIO selected;
+  aSel->selectedObjects(selected);
+  if (selected.Extent() > 0) {
+    Handle(SALOME_InteractiveObject) aIO = selected.First();
+    if (aIO->hasEntry()) {
+      _PTR(SObject) aSObject = aActiveStudy->FindObjectID(aIO->getEntry());
+
+      _PTR(GenericAttribute) anTmpAttr;
+      if (aSObject->FindAttribute(anTmpAttr, "AttributeComment")) {
+        _PTR(AttributeComment) aTmpComment (anTmpAttr);
+        string aTmpComm = aTmpComment->Value();
+        QString aTmpstrIn (aTmpComm.c_str());
+        VISU::Storable::TRestoringMap aTmpaMap;
+        VISU::Storable::StrToMap(aTmpstrIn,aTmpaMap);
+        bool aTmpisExist;
+        VISU::VISUType aTmpType =
+          (VISU::VISUType)VISU::Storable::FindValue(aTmpaMap,"myType",&aTmpisExist).toInt();
+        switch (aTmpType) {
+        case VISU::TTIMESTAMP:
+          {
+            aSObject = aSObject->GetFather();
+            aSObject = aSObject->GetFather();
+            break;
+          }
+        case VISU::TFIELD:
+          {
+            _PTR(SObject) newSObject;
+            if(aSObject->ReferencedObject(newSObject)) aSObject = newSObject;
+            aSObject = aSObject->GetFather();
+            break;
+          }
+        case VISU::TANIMATION:
+          {
+            _PTR(ChildIterator) aTmpIter = aActiveStudy->NewChildIterator(aSObject);
+            for (aTmpIter->InitEx(true); aTmpIter->More(); aTmpIter->Next()) {
+              _PTR(SObject) aTmpChildSObj = aTmpIter->Value();
+              _PTR(SObject) newSObject;
+              if(aTmpChildSObj->ReferencedObject(newSObject)){
+                aSObject = newSObject;
+                aSObject->GetFather();
+                break;
+              }
+            }
+            break;
+          }
+        }
+      }
+
+      aSObject = aSObject->GetFather();
+      aSObject = aSObject->GetFather();
+
+      mySelectionObj = aSObject;
+      CORBA::Object_var anObject = VISU::ClientSObjectToObject(mySelectionObj);
+      if (CORBA::is_nil(anObject)) {
+       mySelectionObj = mySelectionObj->GetFather();
+      }
+    }
+  }
+
+  if (mySelectionObj) {
+    _PTR(ChildIterator) aIter = aActiveStudy->NewChildIterator(mySelectionObj);
+
+    for (aIter->InitEx(true); aIter->More(); aIter->Next()) {
+      _PTR(SObject) aChildSObj = aIter->Value();
+      CORBA::Object_var aChildObject = VISU::ClientSObjectToObject(aChildSObj);
+
+      if (!CORBA::is_nil(aChildObject)) {
+        VISU::Prs3d_var aPrsObj = VISU::Prs3d::_narrow(aChildObject);
+        if (!CORBA::is_nil(aPrsObj)) { // if this is a Prs object
+          if ((aPrsObj->GetType() != VISU::TSTREAMLINES) &&
+              (aPrsObj->GetType() != VISU::TMESH)) {
+            _PTR(GenericAttribute) anAttr;
+            if (aChildSObj->FindAttribute(anAttr, "AttributeName")) {
+              _PTR(AttributeName) aName (anAttr);
+              myPrsLst += QString(aName->Value().c_str());
+              myPrsList.append(aPrsObj);
+              continue;
+            }
+          }
+        }
+      }
+
+      _PTR(GenericAttribute) anAttr;
+      if (aChildSObj->FindAttribute(anAttr, "AttributeComment")) {
+        _PTR(AttributeComment) aComment (anAttr);
+        string aComm = aComment->Value();
+        QString strIn (aComm.c_str());
+        VISU::Storable::TRestoringMap aMap;
+        VISU::Storable::StrToMap(strIn,aMap);
+        bool isExist;
+        VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt();
+        if (isExist) {
+          if ((aType == VISU::TFAMILY) || (aType == VISU::TGROUP) || (aType == VISU::TENTITY)) {
+            _PTR(GenericAttribute) aNameAttr;
+            if (aChildSObj->FindAttribute(aNameAttr, "AttributeName")) {
+              _PTR(AttributeName) aName (aNameAttr);
+              VISU::Prs3d_var aPrsObj = VISU::Prs3d::_narrow(aChildObject);
+              switch (aType) {
+              case VISU::TFAMILY:
+                myFamilisLst += QString(aName->Value().c_str());
+                myFamilyList.append(aPrsObj);
+                break;
+              case VISU::TGROUP:
+                myGroupsLst += QString(aName->Value().c_str());
+                myGroupList.append(aPrsObj);
+                break;
+              case VISU::TENTITY:
+                myEntitiesLst += QString(aName->Value().c_str());
+                myEntityList.append(aPrsObj);
+                break;
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+
+  //  connect(myUseSrcChk, SIGNAL(toggled(bool)), mySrcCombo, SLOT(setEnabled(bool)));
+  aSrcLayout->addMultiCellWidget(mySrcCombo, 1, 1, 0, 1);
+
+  QLabel* aPercentLbl = new QLabel (tr("LBL_USED_POINTS"), aSourceBox);
+  aSrcLayout->addWidget(aPercentLbl, 2, 0);
+
+  myPntPercent = new QtxDblSpinBox( 0, 1, 0.1, aSourceBox );
+  aSrcLayout->addWidget(myPntPercent, 2, 1);
+
+  TopLayout->addMultiCellWidget(aSourceBox, 0, 0, 0, 1);
+
+  QLabel* aStepLenLbl = new QLabel (tr("LBL_STEP_LENGTH"), aTopBox);
+  TopLayout->addWidget(aStepLenLbl, 1, 0);
+  myStepLen = new QtxDblSpinBox( DBL_MIN, DBL_MAX, 0.1, aTopBox );
   myStepLen->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
-  TopLayout->addWidget(myStepLen, 0, 1);
+  TopLayout->addWidget(myStepLen, 1, 1);
+  connect(myStepLen, SIGNAL(valueChanged(double)), this, SLOT(StepLengthChanged(double)));
 
-  QLabel* aIntegStepLenLbl = new QLabel( tr( "Integration Step" ), this);
-  TopLayout->addWidget(aIntegStepLenLbl, 1, 0);
-  myIntegStepLen = new QAD_SpinBoxDbl( this);
+  QLabel* aIntegStepLenLbl = new QLabel (tr("LBL_INTEGRATION_STEP"), aTopBox);
+  TopLayout->addWidget(aIntegStepLenLbl, 2, 0);
+  myIntegStepLen = new QtxDblSpinBox( DBL_MIN, DBL_MAX, 0.1, aTopBox );
   myIntegStepLen->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
-  TopLayout->addWidget(myIntegStepLen, 1, 1);
-  
-  QLabel* aPropagationLbl = new QLabel( tr( "Propagation Time" ), this);
-  TopLayout->addWidget(aPropagationLbl, 2, 0);
-  myPropTime = new QAD_SpinBoxDbl( this, 0, 1000, 10);
+  TopLayout->addWidget(myIntegStepLen, 2, 1);
+  connect(myIntegStepLen, SIGNAL(valueChanged(double)), this, SLOT(IntegrationStepChanged(double)));
+
+  QLabel* aPropagationLbl = new QLabel (tr("LBL_PROPAGATION_TIME"), aTopBox);
+  TopLayout->addWidget(aPropagationLbl, 3, 0);
+  myPropTime = new QtxDblSpinBox( DBL_MIN, DBL_MAX, 1, aTopBox );
   myPropTime->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
-  TopLayout->addWidget(myPropTime, 2, 1);
-  
-  QLabel* aDirLbl = new QLabel( tr( "Direction" ), this);
-  TopLayout->addWidget(aDirLbl, 3, 0);
-  myDirCombo = new QComboBox(this);
+  TopLayout->addWidget(myPropTime, 3, 1);
+  connect(myPropTime, SIGNAL(valueChanged(double)), this, SLOT(PropagationTimeChanged(double)));
+
+  QLabel* aDirLbl = new QLabel (tr("LBL_DIRECTION"),aTopBox);
+  TopLayout->addWidget(aDirLbl, 4, 0);
+  myDirCombo = new QComboBox(aTopBox);
   myDirCombo->insertItem("Forward");
   myDirCombo->insertItem("Backward");
   myDirCombo->insertItem("Both");
-  TopLayout->addWidget(myDirCombo, 3, 1);
+  TopLayout->addWidget(myDirCombo, 4, 1);
 
-  myUseScalar = new QCheckBox( tr( "Magnitude coloring" ), this, "UseMagn" );
-  //  TopLayout->addMultiCellWidget(myUseScalar, 4, 4, 0, 1);
+  myUseScalar = new QCheckBox (tr("MAGNITUDE_COLORING_CHK"), aTopBox, "UseMagn");
   connect( myUseScalar, SIGNAL( clicked() ), this, SLOT( enableSetColor() ) );
-  TopLayout->addWidget(myUseScalar, 4, 0);
+  TopLayout->addWidget(myUseScalar, 5, 0);
 
-  SelColor = new QPushButton( tr( "Use Color" ), this, "SelColor" );
+  SelColor = new QPushButton (tr("USE_COLOR_BTN"), aTopBox, "SelColor");
   connect( SelColor,     SIGNAL( clicked() ), this, SLOT( setVColor() ) );
-  TopLayout->addWidget( SelColor, 4, 1);
+  TopLayout->addWidget( SelColor, 5, 1);
+
+  aTabBox->addTab(aTopBox, "Stream Lines");
+  myScalarPane = new VisuGUI_ScalarBarPane(this, false);
+  myScalarPane->setMargin( 5 );
+  aTabBox->addTab(myScalarPane, "Scalar Bar");
+
+  aBoxLayout->addWidget(aTabBox);
+
   QGroupBox* aGroupButtons = new QGroupBox( this, "GroupButtons" );
   aGroupButtons->setColumnLayout(0, Qt::Vertical );
   aGroupButtons->layout()->setSpacing( 0 );
   aGroupButtons->layout()->setMargin( 0 );
-  
+
   QGridLayout* aGroupButtonsLayout = new QGridLayout( aGroupButtons->layout() );
   aGroupButtonsLayout->setAlignment( Qt::AlignTop );
   aGroupButtonsLayout->setSpacing( 6 );
@@ -81,16 +279,39 @@ VisuGUI_StreamLinesDlg::VisuGUI_StreamLinesDlg()
   aGroupButtonsLayout->addWidget( aCancelBtn, 0, 2 );
   connect( aOkBtn,     SIGNAL( clicked() ), this, SLOT( accept() ) );
   connect( aCancelBtn, SIGNAL( clicked() ), this, SLOT( reject() ) );
-  TopLayout->addMultiCellWidget( aGroupButtons, 5, 5, 0, 1 );
+
+  aBoxLayout->addWidget(aGroupButtons);
+
   enableSetColor();
 }
 
 
+void VisuGUI_StreamLinesDlg::initFromPrsObject (VISU::StreamLines_i* thePrs)
+{
+  myScalarPane->initFromPrsObject(thePrs);
+
+  myPrs = thePrs;
+  static int aNbOfSteps = 30;
+  VISU_StreamLinesPL* aStreamLinesPL = thePrs->GetStreamLinesPL();
+  float aMin, aMax;
+  aMin = aStreamLinesPL->GetMinPropagationTime();
+  aMax = aStreamLinesPL->GetMaxPropagationTime();
+  myPropTime->setRange(aMin,aMax);
+  myPropTime->setValue(aStreamLinesPL->GetPropagationTime());
+  myPropTime->setLineStep((aMax-aMin)/aNbOfSteps);
+
+  aMin = aStreamLinesPL->GetMinStepLength();
+  aMax = aStreamLinesPL->GetMaxStepLength();
+  myStepLen->setRange(aMin,aMax);
+  myStepLen->setValue(aStreamLinesPL->GetStepLength());
+  myStepLen->setLineStep((aMax-aMin)/aNbOfSteps);
+
+  aMin = aStreamLinesPL->GetMinIntegrationStep();
+  aMax = aStreamLinesPL->GetMaxIntegrationStep();
+  myIntegStepLen->setRange(aMin,aMax);
+  myIntegStepLen->setValue(aStreamLinesPL->GetIntegrationStep());
+  myIntegStepLen->setLineStep((aMax-aMin)/aNbOfSteps);
 
-void VisuGUI_StreamLinesDlg::initFromPrsObject(VISU::StreamLines_i* thePrs) {
-  myStepLen->setValue(thePrs->GetStepLength());
-  myIntegStepLen->setValue(thePrs->GetIntegrationStep());
-  myPropTime->setValue(thePrs->GetPropagationTime());
   switch (thePrs->GetDirection()) {
   case VISU::StreamLines::FORWARD:
     myDirCombo->setCurrentItem(0);
@@ -101,38 +322,106 @@ void VisuGUI_StreamLinesDlg::initFromPrsObject(VISU::StreamLines_i* thePrs) {
   case VISU::StreamLines::BOTH:
     myDirCombo->setCurrentItem(2);
   }
-  myUseScalar->setChecked(thePrs->isColored());
+  myUseScalar->setChecked(thePrs->IsColored());
+  myPntPercent->setValue(thePrs->GetUsedPoints());
 
-  setColor(QColor(thePrs->GetColor()[0]*255,
-                 thePrs->GetColor()[1]*255,
-                 thePrs->GetColor()[2]*255));
-  enableSetColor();
-}
+  mySrcCombo->setEnabled(false);
+  QString aSrcEntry = thePrs->GetSourceEntry();
 
+  SALOMEDS::Color anOldColor = thePrs->GetColor();
+  QColor aColor = QColor(int(255*anOldColor.R),int(255*anOldColor.G),int(255*anOldColor.B));
+  setColor(aColor);
+  enableSetColor();
 
+#define INITPRS(PRSLIST, PRSNUM) \
+    for (int i = 0; i < PRSLIST.count(); i++) { \
+      VISU::Prs3d_i* aPrs = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(PRSLIST[i]).in()); \
+      if (aPrs == NULL) continue; \
+      if (aSrcEntry == aPrs->GetEntry()) { \
+        onSourceTypeChange(PRSNUM); \
+       myUseSrcCombo->setCurrentItem(PRSNUM); \
+       mySrcCombo->setEnabled(true); \
+       mySrcCombo->setCurrentItem(i); \
+       return; \
+      } \
+    }
 
-void VisuGUI_StreamLinesDlg::storeToPrsObject(VISU::StreamLines_i* thePrs) {
-  thePrs->SetStepLength(myStepLen->value());
-  thePrs->SetIntegrationStep(myIntegStepLen->value());
-  thePrs->SetPropagationTime(myPropTime->value());
-  switch (myDirCombo->currentItem()) {
-  case 0:
-    thePrs->SetDirection(VISU::StreamLines::FORWARD);
-    break;
-  case 1:
-    thePrs->SetDirection(VISU::StreamLines::BACKWARD);
-    break;
-  case 2:
-    thePrs->SetDirection(VISU::StreamLines::BOTH);
+  if (!aSrcEntry.isEmpty()) {
+    INITPRS(myEntityList, 1);
+    INITPRS(myFamilyList, 2);
+    INITPRS(myGroupList, 3);
+    INITPRS(myPrsList, 4);
   }
-  thePrs->setColored(myUseScalar->isChecked());
+#undef INITPRS
+}
+
+int VisuGUI_StreamLinesDlg::storeToPrsObject (VISU::StreamLines_i* thePrs)
+{
+  bool isAccepted = myScalarPane->storeToPrsObject(thePrs);
+  if (isAccepted) {
+    thePrs->ShowColored(myUseScalar->isChecked());
+    if (!thePrs->IsColored()) {
+      SALOMEDS::Color aColor;
+      aColor.R = myColor.red()/255.;
+      aColor.G = myColor.green()/255.;
+      aColor.B = myColor.blue()/255.;
+      thePrs->SetColor(aColor);
+    }
 
-  float aColor[3];
-  aColor[0] = myColor.red()/255.;
-  aColor[1] = myColor.green()/255.;
-  aColor[2] = myColor.blue()/255.;
+    VISU::StreamLines::Direction aDirection = VISU::StreamLines::BOTH;
+    switch (myDirCombo->currentItem()) {
+    case 0:
+      aDirection = VISU::StreamLines::FORWARD;
+      break;
+    case 1:
+      aDirection = VISU::StreamLines::BACKWARD;
+      break;
+    case 2:
+      aDirection = VISU::StreamLines::BOTH;
+    }
 
-  thePrs->SetColor(aColor);
+    VISU::Prs3d_var aPrs;
+    int aSrcSelection = myUseSrcCombo->currentItem();
+    int aSrcItem = (mySrcCombo->count() > 0)? mySrcCombo->currentItem() : -1;
+    if ((aSrcSelection > 0) && (aSrcItem > -1)) {
+      VISU::VISUType aType;
+      QString aName;
+      switch (aSrcSelection) {
+      case 1: // Entity
+       aPrs = myEntityList[aSrcItem];
+       aType = VISU::TENTITY;
+       aName = myEntitiesLst[aSrcItem];
+       break;
+      case 2: // Family
+       aPrs = myFamilyList[aSrcItem];
+       aType = VISU::TFAMILY;
+       aName = myFamilisLst[aSrcItem];
+       break;
+      case 3: // Group
+       aPrs = myGroupList[aSrcItem];
+       aType = VISU::TGROUP;
+       aName = myGroupsLst[aSrcItem];
+       break;
+      case 4: // Presentation
+       aPrs = myPrsList[aSrcItem];
+       break;
+      }
+      if (CORBA::is_nil(aPrs) && aSrcSelection != 4) {
+       aPrs = createMesh(aType, aName);
+      }
+    }
+    isAccepted = thePrs->SetParams(myIntegStepLen->value(),
+                                  myPropTime->value(),
+                                  myStepLen->value(),
+                                  aPrs,
+                                  myPntPercent->value(),
+                                  aDirection);
+  }
+  //if (!isAccepted)
+  //  SUIT_MessageBox::warn1(VisuGUI::application()->desktop(), tr("WRN_VISU"),
+  //                         tr("ERR_CANT_BUILD_PRESENTATION"),
+  //                         tr("BUT_OK"));
+  return isAccepted;
 }
 
 /*!
@@ -173,3 +462,134 @@ void VisuGUI_StreamLinesDlg::enableSetColor()
   SelColor->setEnabled(!myUseScalar->isChecked() );
 }
 
+void VisuGUI_StreamLinesDlg::StepLengthChanged(double theValue){
+}
+
+void VisuGUI_StreamLinesDlg::IntegrationStepChanged(double theValue) {
+}
+
+void VisuGUI_StreamLinesDlg::PropagationTimeChanged(double theValue) {
+  myStepLen->setMaxValue(theValue);
+}
+
+void VisuGUI_StreamLinesDlg::onSourceTypeChange(int theIndex) {
+  mySrcCombo->clear();
+  if (theIndex == 0) {
+    mySrcCombo->setEnabled(false);
+    return;
+  } else
+    mySrcCombo->setEnabled(true);
+
+  switch(theIndex) {
+  case 1: // Entity
+    mySrcCombo->insertStringList(myEntitiesLst);
+    return;
+  case 2: // Family
+    mySrcCombo->insertStringList(myFamilisLst);
+    return;
+  case 3: // Group
+    mySrcCombo->insertStringList(myGroupsLst);
+    return;
+  case 4: // Presentation
+    mySrcCombo->insertStringList(myPrsLst);
+    return;
+  }
+}
+
+
+VISU::Mesh_ptr VisuGUI_StreamLinesDlg::createMesh (VISU::VISUType theType, QString theName)
+{
+  return VISU::Mesh::_nil();
+/*
+  CORBA::Object_var anObject = VISU::ClientSObjectToObject(mySelectionObj);
+  VISU::Result_var aResult;
+  if (!CORBA::is_nil(anObject)) {
+    aResult = VISU::Result::_narrow(anObject);
+  }
+  if (CORBA::is_nil(aResult)) {
+    SUIT_MessageBox::warn1(VisuGUI::application()->desktop(), tr("VISU_WARNING"),
+                           tr("WRN_NO_AVAILABLE_DATA"),
+                           tr("BUT_OK"));
+    return VISU::Mesh::_nil();
+  }
+  SALOMEDSClient_ChildIterator* aIter = VisuGUI::GetStudyDocument()->NewChildIterator( mySelectionObj );
+  VISU::Storable::TRestoringMap aMap;
+
+  for (aIter->InitEx(true); aIter->More(); aIter->Next() ) {
+    SALOMEDSClient_SObject* aChildSObj = aIter->Value();
+    SALOMEDSClient_GenericAttribute* anAttr;
+    if (aChildSObj->FindAttribute(anAttr, "AttributeComment")) {
+      SALOMEDSClient_AttributeComment* aComment = dynamic_cast<SALOMEDSClient_AttributeComment*>( anAttr );
+      CORBA::String_var aComm = aComment->Value().c_str();
+      QString strIn(aComm.in());
+      aMap.clear();
+      VISU::Storable::StrToMap(strIn,aMap);
+      bool isExist;
+      VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt();
+      if (isExist) {
+       if (aType != theType) continue;
+
+       SALOMEDSClient_GenericAttribute* aNameAttr;
+       if ( aChildSObj->FindAttribute(aNameAttr, "AttributeName") ) {
+         SALOMEDSClient_AttributeName* aName = dynamic_cast<SALOMEDSClient_AttributeName*>(aNameAttr);
+         if (QString(aName->Value()) == theName) break; //use current map
+       }
+      }
+    }
+  }
+  VISU::Mesh_var aMesh;
+  QString aMeshName = VISU::Storable::FindValue(aMap,"myMeshName");
+  switch (theType) {
+  case VISU::TFAMILY:
+    {
+      VISU::Entity anEntity = (VISU::Entity)VISU::Storable::FindValue(aMap,"myEntityId").toInt();
+      aMesh = VisuGUI::GetVisuGen()->FamilyMeshOnEntity(aResult,aMeshName.latin1(),anEntity,theName.latin1());
+    }
+    break;
+  case VISU::TGROUP:
+    {
+      aMesh = VisuGUI::GetVisuGen()->GroupMesh(aResult,aMeshName.latin1(), theName.latin1());
+    }
+    break;
+  case VISU::TENTITY:
+    {
+      VISU::Entity anEntity = (VISU::Entity)VISU::Storable::FindValue(aMap,"myId").toInt();
+      aMesh = VisuGUI::GetVisuGen()->MeshOnEntity(aResult,aMeshName.latin1(),anEntity);
+    }
+    break;
+  }
+  if(!CORBA::is_nil(aMesh)){ // Create Actor
+    VISU::Mesh_i* pPresent = dynamic_cast<VISU::Mesh_i*>(VISU::GetServant(aMesh).in());
+    if(SVTK_ViewWindow* vf = VISU::GetViewWindow()){
+      try{
+       pPresent->SetPresentationType(VISU::POINT);
+       VISU_Actor *anActor = pPresent->CreateActor();
+       vf->AddActor(anActor);
+      }catch(...){
+       SUIT_MessageBox::warn1 ( VisuGUI::application()->desktop(), tr("VISU_WARNING"),
+                               tr("ERR_CANT_CREATE_ACTOR"),
+                               tr("BUT_OK") );
+      }
+    }
+  } else {
+    SUIT_MessageBox::warn1(VisuGUI::application()->desktop(), tr("VISU_WARNING"),
+                           tr("ERR_CANT_BUILD_PRESENTATION"),
+                           tr("BUT_OK"));
+  }
+  return aMesh._retn();
+*/
+}
+
+void VisuGUI_StreamLinesDlg::accept() {
+  if (myScalarPane->check())
+    {
+      myScalarPane->deletePreview();
+      QDialog::accept();
+    }
+}
+
+void VisuGUI_StreamLinesDlg::reject()
+{
+  myScalarPane->deletePreview();
+  QDialog::reject();
+}