]> SALOME platform Git repositories - modules/visu.git/blobdiff - src/VISUGUI/VisuGUI_StreamLinesDlg.cxx
Salome HOME
Merge from V5_1_main 14/05/2010
[modules/visu.git] / src / VISUGUI / VisuGUI_StreamLinesDlg.cxx
index 503347116b09dee25e0ecfc45fbd7d0c9021f9ed..5fa078a0e3c6ae36c7fd324bb12e5a4fc6e75831 100644 (file)
-//  VISU VISUGUI : GUI of VISU component
+//  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
 //
-//  Copyright (C) 2003  CEA/DEN, EDF R&D
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 //
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
 //
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
 //
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
 //  File   : VisuGUI_StreamLinesDlg.cxx
 //  Author : Vitaly SMETANNIKOV
 //  Module : VISU
-
+//
 #include "VisuGUI_StreamLinesDlg.h"
-#include "VISU_StreamLines_i.hh"
+
+#include "VisuGUI.h"
+#include "VisuGUI_Tools.h"
+#include "VisuGUI_InputPane.h"
+
 #include "VISU_Mesh_i.hh"
 #include "VISU_Gen_i.hh"
+#include "VISU_StreamLines_i.hh"
+#include "VISU_ColoredPrs3dFactory.hh"
 #include "VISU_StreamLinesPL.hxx"
 #include "VISU_Actor.h"
 
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "QAD_Config.h"
-#include "QAD_MessageBox.h"
-#include "VisuGUI.h"
-#include "SALOME_Selection.h"
-#include "VTKViewer_ViewFrame.h"
+#include <SalomeApp_DoubleSpinBox.h>
+#include "SalomeApp_Application.h"
+#include "LightApp_Application.h"
+#include "LightApp_SelectionMgr.h"
+
+#include "SVTK_ViewWindow.h"
+
+#include "SUIT_Desktop.h"
+#include "SUIT_Session.h"
+#include "SUIT_ResourceMgr.h"
+#include "SUIT_MessageBox.h"
+
+#include "SALOME_ListIO.hxx"
 
-#include <limits.h>
-#include <qlayout.h>
-#include <qgroupbox.h>
-#include <qcolordialog.h>
+#include <SALOMEDSClient_SObject.hxx>
 
-using namespace std;
+#include <QtxColorButton.h>
 
-extern VisuGUI *visuGUI;
+#include <limits>
 
-VisuGUI_StreamLinesDlg::VisuGUI_StreamLinesDlg()
-    : QDialog( QAD_Application::getDesktop(), "VisuGUI_StreamLinesDlg", false, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+#include <QLayout>
+#include <QLabel>
+#include <QCheckBox>
+#include <QComboBox>
+#include <QGroupBox>
+#include <QColorDialog>
+#include <QTabWidget>
+#include <QPushButton>
+#include <QLabel>
+#include <QStringList>
+#include <QKeyEvent>
+#include <QFrame>
+
+
+VisuGUI_StreamLinesDlg::VisuGUI_StreamLinesDlg (SalomeApp_Module* theModule)
+  : VisuGUI_ScalarBarBaseDlg(theModule),
+    myVisuGUI(theModule)
 {
-  setCaption("Stream lines Preferences");
-  setSizeGripEnabled( TRUE );
+  setWindowTitle(tr("DLG_TITLE"));
+  setSizeGripEnabled(TRUE);
+
+  QVBoxLayout* aBoxLayout = new QVBoxLayout(this);
+  aBoxLayout->setSpacing( 6 );
+  aBoxLayout->setMargin( 11 );
+
+  myTabBox = new QTabWidget(this);
 
-  QGridLayout* TopLayout = new QGridLayout( this ); 
-  TopLayout->setSpacing( 6 );
+  QFrame* aTopBox = new QFrame(this);
+  //aTopBox->setMargin( 11 );
+  QGridLayout* TopLayout = new QGridLayout( aTopBox );
+  TopLayout->setAlignment( Qt::AlignTop );
+  TopLayout->setSpacing( 8 );
   TopLayout->setMargin( 11 );
 
   // Source box
-  QGroupBox* aSourceBox = new QGroupBox(tr("Source"), this);
-  aSourceBox->setColumnLayout(0, Qt::Vertical);
-  QGridLayout* aSrcLayout = new QGridLayout( aSourceBox->layout() ); 
+  QGroupBox* aSourceBox = new QGroupBox (tr("SOURCE_GRP"), aTopBox);
+  //aSourceBox->setColumnLayout(0, Qt::Vertical);
+  QGridLayout* aSrcLayout = new QGridLayout( aSourceBox );
   aSrcLayout->setSpacing( 6 );
-  aSrcLayout->setMargin( 0 );
-  
+  aSrcLayout->setMargin( 11 );
+
   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);
+  QStringList aChoise;
+  aChoise.append( "None" );
+  aChoise.append( "Entity" );
+  aChoise.append( "Family" );
+  aChoise.append( "Group" );
+  aChoise.append( "Presentation" );
+  myUseSrcCombo->addItems(aChoise);
   aSrcLayout->addWidget(myUseSrcCombo, 0, 1);
 
   mySrcCombo = new QComboBox(aSourceBox);
-  mySrcCombo->setEnabled((myUseSrcCombo->currentItem() == 0));
-  
+  mySrcCombo->setEnabled((myUseSrcCombo->currentIndex() == 0));
+
   connect(myUseSrcCombo, SIGNAL(activated(int)), this, SLOT(onSourceTypeChange(int)));
 
-  // Find All prs obj
-  QAD_Study* aActiveStudy =  VisuGUI::GetActiveStudy();
-  SALOME_Selection* aSel = SALOME_Selection::Selection( aActiveStudy->getSelection() );
-  if( aSel->IObjectCount() > 0 ) {
-    Handle(SALOME_InteractiveObject) aIO = aSel->firstIObject();
-    if (aIO->hasEntry()){
-      SALOMEDS::SObject_var aSObject = VisuGUI::GetStudyDocument()->FindObjectID(aIO->getEntry());
-      aSObject = aSObject->GetFather();
-      aSObject = aSObject->GetFather();
+  // 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());
+      VISU::VISUType aType = VISU::Storable::SObject2Type(aSObject);
+      switch (aType) {
+      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::SObjectToObject(mySelectionObj);
-      VISU::Result_var aResult;
+      CORBA::Object_var anObject = VISU::ClientSObjectToObject(mySelectionObj);
       if (CORBA::is_nil(anObject)) {
-       mySelectionObj = mySelectionObj->GetFather();
+        mySelectionObj = mySelectionObj->GetFather();
       }
-      SALOMEDS::ChildIterator_var aIter = VisuGUI::GetStudyDocument()->NewChildIterator( mySelectionObj );
-
-      for (aIter->InitEx(true); aIter->More(); aIter->Next() ) {
-       SALOMEDS::SObject_var aChildSObj = aIter->Value();
-       CORBA::Object_var aChildObject = VISU::SObjectToObject( 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)) {
-             SALOMEDS::GenericAttribute_var anAttr;
-             if ( aChildSObj->FindAttribute(anAttr, "AttributeName") ) {           
-               SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
-               myPrsLst += QString(aName->Value());
-               myPrsList.append(aPrsObj);
-               continue;
-             }
-           }
-         }
-       }
-       // else { // This is not a Prs object
-       SALOMEDS::GenericAttribute_var anAttr;
-       if (aChildSObj->FindAttribute(anAttr, "AttributeComment")) {
-         SALOMEDS::AttributeComment_var aComment = SALOMEDS::AttributeComment::_narrow(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)) { 
-             SALOMEDS::GenericAttribute_var aNameAttr;
-             if ( aChildSObj->FindAttribute(aNameAttr, "AttributeName") ) {        
-               SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(aNameAttr);
-               VISU::Prs3d_var aPrsObj = VISU::Prs3d::_narrow( aChildObject );
-               switch(aType) {
-               case VISU::TFAMILY:
-                 myFamilisLst += QString(aName->Value());
-                 myFamilyList.append(aPrsObj);
-                 break;
-               case VISU::TGROUP:
-                 myGroupsLst += QString(aName->Value());
-                 myGroupList.append(aPrsObj);
-                 break;
-               case VISU::TENTITY:
-                 myEntitiesLst += QString(aName->Value());
-                 myEntityList.append(aPrsObj);
-                 break;
-               }
-             }
-           }
-         }
-       }
+    }
+  }
+
+  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;
+            }
+          }
+        }
+      }
+
+      VISU::VISUType aType = VISU::Storable::SObject2Type(aChildSObj);
+      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);
+  aSrcLayout->addWidget(mySrcCombo, 1, 0, 1, 2);
 
-  QLabel* aPercentLbl = new QLabel( tr( "Used points (0..1)" ), aSourceBox);
+  QLabel* aPercentLbl = new QLabel (tr("LBL_USED_POINTS"), aSourceBox);
   aSrcLayout->addWidget(aPercentLbl, 2, 0);
 
-  myPntPercent = new QAD_SpinBoxDbl( aSourceBox, 0, 1, 0.1);
+  myPntPercent = new SalomeApp_DoubleSpinBox( aSourceBox );
+  VISU::initSpinBox( myPntPercent, 0., 1., .1, "parametric_precision" );
   aSrcLayout->addWidget(myPntPercent, 2, 1);
 
-  TopLayout->addMultiCellWidget(aSourceBox, 0, 0, 0, 1);
+  TopLayout->addWidget(aSourceBox, 0, 0, 1, 2);
 
-
-  QLabel* aStepLenLbl = new QLabel( tr( "Step Length" ), this);
+  QLabel* aStepLenLbl = new QLabel (tr("LBL_STEP_LENGTH"), aTopBox);
   TopLayout->addWidget(aStepLenLbl, 1, 0);
-  myStepLen = new QAD_SpinBoxDbl( this, DBL_MIN, DBL_MAX, 0.1);
+  myStepLen = new SalomeApp_DoubleSpinBox( aTopBox );
+  VISU::initSpinBox( myStepLen,
+                     std::numeric_limits<double>::min(), 
+                     std::numeric_limits<double>::max(),
+                     .1, 
+                     "parametrc_precision" );  
   myStepLen->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
   TopLayout->addWidget(myStepLen, 1, 1);
   connect(myStepLen, SIGNAL(valueChanged(double)), this, SLOT(StepLengthChanged(double)));
 
-  QLabel* aIntegStepLenLbl = new QLabel( tr( "Integration Step" ), this);
+  QLabel* aIntegStepLenLbl = new QLabel (tr("LBL_INTEGRATION_STEP"), aTopBox);
   TopLayout->addWidget(aIntegStepLenLbl, 2, 0);
-  myIntegStepLen = new QAD_SpinBoxDbl( this, DBL_MIN, DBL_MAX, 0.1);
+  myIntegStepLen = new SalomeApp_DoubleSpinBox( aTopBox );
+  VISU::initSpinBox( myIntegStepLen,
+                     std::numeric_limits<double>::min(), 
+                     std::numeric_limits<double>::max(), 
+                     .1, 
+                     "parametrc_precision" ); 
   myIntegStepLen->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
   TopLayout->addWidget(myIntegStepLen, 2, 1);
   connect(myIntegStepLen, SIGNAL(valueChanged(double)), this, SLOT(IntegrationStepChanged(double)));
-  
-  QLabel* aPropagationLbl = new QLabel( tr( "Propagation Time" ), this);
+
+  QLabel* aPropagationLbl = new QLabel (tr("LBL_PROPAGATION_TIME"), aTopBox);
   TopLayout->addWidget(aPropagationLbl, 3, 0);
-  myPropTime = new QAD_SpinBoxDbl( this, DBL_MIN, DBL_MAX, 1);
+  myPropTime = new SalomeApp_DoubleSpinBox( aTopBox );
+  VISU::initSpinBox( myPropTime,
+                     std::numeric_limits<double>::min(), 
+                     std::numeric_limits<double>::max(), 
+                     .1, 
+                     "parametrc_precision" );
   myPropTime->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
   TopLayout->addWidget(myPropTime, 3, 1);
   connect(myPropTime, SIGNAL(valueChanged(double)), this, SLOT(PropagationTimeChanged(double)));
-  
-  QLabel* aDirLbl = new QLabel( tr( "Direction" ), this);
+
+  QLabel* aDirLbl = new QLabel (tr("LBL_DIRECTION"),aTopBox);
   TopLayout->addWidget(aDirLbl, 4, 0);
-  myDirCombo = new QComboBox(this);
-  myDirCombo->insertItem("Forward");
-  myDirCombo->insertItem("Backward");
-  myDirCombo->insertItem("Both");
+  myDirCombo = new QComboBox(aTopBox);
+  myDirCombo->addItem("Forward");
+  myDirCombo->addItem("Backward");
+  myDirCombo->addItem("Both");
   TopLayout->addWidget(myDirCombo, 4, 1);
 
-  myUseScalar = new QCheckBox( tr( "Magnitude coloring" ), this, "UseMagn" );
+  myUseScalar = new QCheckBox (tr("MAGNITUDE_COLORING_CHK"), aTopBox);
   connect( myUseScalar, SIGNAL( clicked() ), this, SLOT( enableSetColor() ) );
   TopLayout->addWidget(myUseScalar, 5, 0);
 
-  SelColor = new QPushButton( tr( "Use Color" ), this, "SelColor" );
-  connect( SelColor,     SIGNAL( clicked() ), this, SLOT( setVColor() ) );
+  SelColor = new QtxColorButton( aTopBox );
+  SelColor->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+  //connect( SelColor,     SIGNAL( clicked() ), this, SLOT( setVColor() ) );
   TopLayout->addWidget( SelColor, 5, 1);
-  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() );
+
+  myTabBox->addTab(aTopBox, "Stream Lines");
+  myInputPane = new VisuGUI_InputPane(VISU::TSTREAMLINES, theModule, this);
+  myTabBox->addTab(GetScalarPane(), "Scalar Bar");
+  myTabBox->addTab(myInputPane, "Input");
+
+  aBoxLayout->addWidget(myTabBox);
+
+  QGroupBox* aGroupButtons = new QGroupBox( this );
+  //aGroupButtons->setColumnLayout(0, Qt::Vertical );
+  //aGroupButtons->layout()->setSpacing( 0 );
+  //aGroupButtons->layout()->setMargin( 0 );
+
+  QGridLayout* aGroupButtonsLayout = new QGridLayout( aGroupButtons );
   aGroupButtonsLayout->setAlignment( Qt::AlignTop );
   aGroupButtonsLayout->setSpacing( 6 );
   aGroupButtonsLayout->setMargin( 11 );
 
-  QPushButton* aOkBtn = new QPushButton( tr( "&OK" ), aGroupButtons, "buttonOk" );
+  QPushButton* aOkBtn = new QPushButton( tr( "BUT_OK" ), aGroupButtons );
   aOkBtn->setAutoDefault( TRUE );
   aOkBtn->setDefault( TRUE );
   aGroupButtonsLayout->addWidget( aOkBtn, 0, 0 );
   aGroupButtonsLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
 
-  QPushButton* aCancelBtn = new QPushButton( tr( "&Cancel" ) , aGroupButtons, "buttonCancel" );
+  QPushButton* aCancelBtn = new QPushButton( tr( "BUT_CANCEL" ) , aGroupButtons );
   aCancelBtn->setAutoDefault( TRUE );
   aGroupButtonsLayout->addWidget( aCancelBtn, 0, 2 );
+
+  QPushButton* aHelpBtn = new QPushButton( tr( "BUT_HELP" ) , aGroupButtons );
+  aHelpBtn->setAutoDefault( TRUE );
+  aGroupButtonsLayout->addWidget( aHelpBtn, 0, 3 );
+
   connect( aOkBtn,     SIGNAL( clicked() ), this, SLOT( accept() ) );
   connect( aCancelBtn, SIGNAL( clicked() ), this, SLOT( reject() ) );
-  TopLayout->addMultiCellWidget( aGroupButtons, 6, 6, 0, 1 );
-  enableSetColor();
-}
+  connect( aHelpBtn,   SIGNAL( clicked() ), this, SLOT( onHelp() ) );
 
+  aBoxLayout->addWidget(aGroupButtons);
 
+  enableSetColor();
+}
 
-void VisuGUI_StreamLinesDlg::initFromPrsObject(VISU::StreamLines_i* thePrs) {
-  myPropTime->setValue(thePrs->GetPropagationTime());
+VisuGUI_StreamLinesDlg::~VisuGUI_StreamLinesDlg()
+{}
 
-  myStepLen->setRange(VISU_StreamLinesPL::GetMinStepLength(thePrs->GetIntegrationStep()),
-                     VISU_StreamLinesPL::GetMaxStepLength(thePrs->GetPropagationTime()));
-  myStepLen->setValue(thePrs->GetStepLength());
-  
-  myIntegStepLen->setRange(thePrs->GetMinIntegrationStep(),thePrs->GetMaxIntegrationStep());
-  myIntegStepLen->setValue(thePrs->GetIntegrationStep());
-  
-  switch (thePrs->GetDirection()) {
+void VisuGUI_StreamLinesDlg::initFromPrsObject ( VISU::ColoredPrs3d_i* thePrs,
+                                                 bool theInit )
+{
+  if( theInit )
+    myPrsCopy = VISU::TSameAsFactory<VISU::TSTREAMLINES>().Create(thePrs, VISU::ColoredPrs3d_i::EDoNotPublish);
+
+  VisuGUI_ScalarBarBaseDlg::initFromPrsObject(myPrsCopy, theInit);
+
+  static int aNbOfSteps = 30;
+  VISU_StreamLinesPL* aStreamLinesPL = myPrsCopy->GetSpecificPL();
+  float aMin, aMax;
+  aMin = aStreamLinesPL->GetMinPropagationTime();
+  aMax = aStreamLinesPL->GetMaxPropagationTime();
+  myPropTime->setRange(aMin,aMax);
+  myPropTime->setValue(aStreamLinesPL->GetPropagationTime());
+  myPropTime->setSingleStep((aMax-aMin)/aNbOfSteps);
+
+  aMin = aStreamLinesPL->GetMinStepLength();
+  aMax = aStreamLinesPL->GetMaxStepLength();
+  myStepLen->setRange(aMin,aMax);
+  myStepLen->setValue(aStreamLinesPL->GetStepLength());
+  myStepLen->setSingleStep((aMax-aMin)/aNbOfSteps);
+
+  aMin = aStreamLinesPL->GetMinIntegrationStep();
+  aMax = aStreamLinesPL->GetMaxIntegrationStep();
+  myIntegStepLen->setRange(aMin,aMax);
+  myIntegStepLen->setValue(aStreamLinesPL->GetIntegrationStep());
+  myIntegStepLen->setSingleStep((aMax-aMin)/aNbOfSteps);
+
+  switch (myPrsCopy->GetDirection()) {
   case VISU::StreamLines::FORWARD:
-    myDirCombo->setCurrentItem(0);
+    myDirCombo->setCurrentIndex(0);
     break;
   case VISU::StreamLines::BACKWARD:
-    myDirCombo->setCurrentItem(1);
+    myDirCombo->setCurrentIndex(1);
     break;
   case VISU::StreamLines::BOTH:
-    myDirCombo->setCurrentItem(2);
+    myDirCombo->setCurrentIndex(2);
   }
-  myUseScalar->setChecked(thePrs->IsColored());
-  myPntPercent->setValue(thePrs->GetUsedPoints());
-  
+  myUseScalar->setChecked(myPrsCopy->IsColored());
+  myPntPercent->setValue(myPrsCopy->GetUsedPoints());
+
   mySrcCombo->setEnabled(false);
-  QString aSrcEntry = thePrs->GetSourceEntry();
-  
-  SALOMEDS::Color anOldColor = thePrs->GetColor();
+  QString aSrcEntry = myPrsCopy->GetSourceEntry();
+
+  SALOMEDS::Color anOldColor = myPrsCopy->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])); \
+      VISU::Prs3d_i* aPrs = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(PRSLIST[i]).in()); \
       if (aPrs == NULL) continue; \
-      if (aSrcEntry == aPrs->GetEntry()) { \
+      if (aSrcEntry == aPrs->GetEntry().c_str()) { \
         onSourceTypeChange(PRSNUM); \
-       myUseSrcCombo->setCurrentItem(PRSNUM); \
-       mySrcCombo->setEnabled(true); \
-       mySrcCombo->setCurrentItem(i); \
-       return; \
+        myUseSrcCombo->setCurrentIndex(PRSNUM); \
+        mySrcCombo->setEnabled(true); \
+        mySrcCombo->setCurrentIndex(i); \
+        return; \
       } \
     }
-  
+
   if (!aSrcEntry.isEmpty()) {
     INITPRS(myEntityList, 1);
     INITPRS(myFamilyList, 2);
-    INITPRS(myGroupList, 3);    
+    INITPRS(myGroupList, 3);
     INITPRS(myPrsList, 4);
   }
-  
 #undef INITPRS
 
-}
+  if( !theInit )
+    return;
 
+  myInputPane->initFromPrsObject( myPrsCopy );
+  myTabBox->setCurrentIndex( 0 );
 
+}
 
-void VisuGUI_StreamLinesDlg::storeToPrsObject(VISU::StreamLines_i* thePrs) {
-  //Order of setting of the values are important 
-  thePrs->SetIntegrationStep(myIntegStepLen->value());
-  thePrs->SetPropagationTime(myPropTime->value());
-  thePrs->SetStepLength(myStepLen->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);
-  }
-  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);
-  }
-  thePrs->SetUsedPoints(myPntPercent->value());
+int VisuGUI_StreamLinesDlg::storeToPrsObject (VISU::ColoredPrs3d_i* thePrs)
+{
+  if(!myInputPane->check() || !GetScalarPane()->check())
+    return 0;
+  
+  int anIsOk = myInputPane->storeToPrsObject( myPrsCopy );
+  anIsOk &= GetScalarPane()->storeToPrsObject( myPrsCopy );
+  
+  if (anIsOk) {
+    myPrsCopy->ShowColored(myUseScalar->isChecked());
+    if (!myPrsCopy->IsColored()) {
+      SALOMEDS::Color aColor;
+      aColor.R = SelColor->color().red()/255.;
+      aColor.G = SelColor->color().green()/255.;
+      aColor.B = SelColor->color().blue()/255.;
+      myPrsCopy->SetColor(aColor);
+    }
 
-  int aSrcSelection = myUseSrcCombo->currentItem();
-  int aSrcItem = (mySrcCombo->count() > 0)? mySrcCombo->currentItem() : -1;
-  if ((aSrcSelection > 0) && (aSrcItem > -1)) {
-    VISU::Prs3d_var aPrs;
-    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];
+    VISU::StreamLines::Direction aDirection = VISU::StreamLines::BOTH;
+    switch (myDirCombo->currentIndex()) {
+    case 0:
+      aDirection = VISU::StreamLines::FORWARD;
       break;
-    case 3: // Group
-      aPrs = myGroupList[aSrcItem];
-      aType = VISU::TGROUP;
-      aName = myGroupsLst[aSrcItem];
-      break;
-    case 4: // Presentation
-      aPrs = myPrsList[aSrcItem];
+    case 1:
+      aDirection = VISU::StreamLines::BACKWARD;
       break;
+    case 2:
+      aDirection = VISU::StreamLines::BOTH;
     }
-    if (!CORBA::is_nil( aPrs )) {
-      thePrs->SetSource(aPrs);
-    } else if (aSrcSelection == 4) {
-      thePrs->SetSource(VISU::Prs3d::_nil());
-    } else { // Create Mesh presentation
-      thePrs->SetSource(createMesh(aType, aName));
+
+    VISU::Prs3d_var aPrs;
+    int aSrcSelection = myUseSrcCombo->currentIndex();
+    int aSrcItem = (mySrcCombo->count() > 0)? mySrcCombo->currentIndex() : -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);
+      }
     }
-  } else 
-    thePrs->SetSource(VISU::Prs3d::_nil());  
+    anIsOk &= myPrsCopy->SetParams(myIntegStepLen->value(),
+                                   myPropTime->value(),
+                                   myStepLen->value(),
+                                   aPrs,
+                                   myPntPercent->value(),
+                                   aDirection);
+  }
+
+  VISU::TSameAsFactory<VISU::TSTREAMLINES>().Copy(myPrsCopy, thePrs);
+
+  return anIsOk;
 }
 
 /*!
@@ -337,20 +476,23 @@ void VisuGUI_StreamLinesDlg::storeToPrsObject(VISU::StreamLines_i* thePrs) {
 */
 void VisuGUI_StreamLinesDlg::setColor( QColor color )
 {
-  myColor = color;
-  SelColor->setPaletteBackgroundColor(myColor);
+  /*Color = color;
+  QPalette aPal = SelColor->palette();
+  aPal.setColor( SelColor->backgroundRole(), myColor );
+  SelColor->setPalette( aPal );*/
+  SelColor->setColor( color );
 }
 
 
 /*!
   Called when "Select Color" buttonx clicked
 */
-void VisuGUI_StreamLinesDlg::setVColor()
+/*void VisuGUI_StreamLinesDlg::setVColor()
 {
   QColor cnew = QColorDialog::getColor( myColor, this );
   if ( cnew.isValid() )
     setColor( cnew );
-}
+}*/
 
 
 /*!
@@ -374,12 +516,10 @@ void VisuGUI_StreamLinesDlg::StepLengthChanged(double theValue){
 }
 
 void VisuGUI_StreamLinesDlg::IntegrationStepChanged(double theValue) {
-  PropagationTimeChanged(myPropTime->value());
 }
 
 void VisuGUI_StreamLinesDlg::PropagationTimeChanged(double theValue) {
-  myStepLen->setMinValue(VISU_StreamLinesPL::GetMinStepLength(myIntegStepLen->value()));
-  myStepLen->setMaxValue(VISU_StreamLinesPL::GetMaxStepLength(myPropTime->value()));
+  myStepLen->setMaximum(theValue);
 }
 
 void VisuGUI_StreamLinesDlg::onSourceTypeChange(int theIndex) {
@@ -392,99 +532,37 @@ void VisuGUI_StreamLinesDlg::onSourceTypeChange(int theIndex) {
 
   switch(theIndex) {
   case 1: // Entity
-    mySrcCombo->insertStringList(myEntitiesLst);
+    mySrcCombo->addItems(myEntitiesLst);
     return;
   case 2: // Family
-    mySrcCombo->insertStringList(myFamilisLst);
+    mySrcCombo->addItems(myFamilisLst);
     return;
   case 3: // Group
-    mySrcCombo->insertStringList(myGroupsLst);
+    mySrcCombo->addItems(myGroupsLst);
     return;
   case 4: // Presentation
-    mySrcCombo->insertStringList(myPrsLst);
+    mySrcCombo->addItems(myPrsLst);
     return;
   }
 }
 
 
-VISU::Mesh_var VisuGUI_StreamLinesDlg::createMesh(VISU::VISUType theType, QString theName) {
-  CORBA::Object_var anObject = VISU::SObjectToObject(mySelectionObj);
-  VISU::Result_var aResult;
-  if (!CORBA::is_nil(anObject)) {
-    aResult = VISU::Result::_narrow(anObject);
-  }
-  if(CORBA::is_nil(aResult)) {
-    QAD_MessageBox::warn1(QAD_Application::getDesktop(), tr ("VISU_WARNING"),
-                         tr ("WRN_NO_AVAILABLE_DATA"),
-                         tr ("VISU_BUT_OK"));
-    return VISU::Mesh::_nil();
-  }
-  SALOMEDS::ChildIterator_var aIter = VisuGUI::GetStudyDocument()->NewChildIterator( mySelectionObj );
-  VISU::Storable::TRestoringMap aMap;
-
-  for (aIter->InitEx(true); aIter->More(); aIter->Next() ) {
-    SALOMEDS::SObject_var aChildSObj = aIter->Value();
-    SALOMEDS::GenericAttribute_var anAttr;
-    if (aChildSObj->FindAttribute(anAttr, "AttributeComment")) {
-      SALOMEDS::AttributeComment_var aComment = SALOMEDS::AttributeComment::_narrow(anAttr);
-      CORBA::String_var aComm = aComment->Value();
-      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;
-
-       SALOMEDS::GenericAttribute_var aNameAttr;
-       if ( aChildSObj->FindAttribute(aNameAttr, "AttributeName") ) {      
-         SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(aNameAttr);
-         if (QString(aName->Value()) == theName) break; //use current map
-       }
-      }
-    }
-  }
-  CORBA::Object_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;
-  }
-  VISU::Mesh_i* pPresent = NULL;
-  if(!CORBA::is_nil(aMesh)) 
-    pPresent = dynamic_cast<VISU::Mesh_i*>(VISU::GetServant(aMesh));
-  if (pPresent == NULL) {
-    QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"), 
-                           tr ("ERR_CANT_BUILD_PRESENTATION"), 
-                           tr ("VISU_BUT_OK") ); 
-    return VISU::Mesh::_nil();
-  }
-  // Create Actor
-  if(VTKViewer_ViewFrame* vf = visuGUI->GetVtkViewFrame()){
-    try{
-      pPresent->SetPresentationType(VISU::POINT);
-      VISU_Actor *anActor = pPresent->CreateActor();
-      vf->AddActor(anActor);
-    }catch(std::runtime_error& exc){
-      QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"), 
-                             tr ("ERR_CANT_CREATE_ACTOR"), 
-                             tr ("VISU_BUT_OK") ); 
-    }
-  } 
-  return pPresent->_this();
+VISU::Mesh_ptr VisuGUI_StreamLinesDlg::createMesh (VISU::VISUType theType, QString theName)
+{
+  return VISU::Mesh::_nil();
+}
+
+void VisuGUI_StreamLinesDlg::accept()
+{
+  VisuGUI_ScalarBarBaseDlg::accept();
+}
+
+void VisuGUI_StreamLinesDlg::reject()
+{
+  VisuGUI_ScalarBarBaseDlg::reject();
+}
+
+QString VisuGUI_StreamLinesDlg::GetContextHelpFilePath()
+{
+  return "stream_lines_page.html";
 }