]> 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 169f7e12b81bfc7ccfc298dee3a9d42f8c9bf702..5fa078a0e3c6ae36c7fd324bb12e5a4fc6e75831 100644 (file)
@@ -1,4 +1,4 @@
-//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+//  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -19,6 +19,7 @@
 //
 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+
 //  File   : VisuGUI_StreamLinesDlg.cxx
 //  Author : Vitaly SMETANNIKOV
 //  Module : VISU
@@ -36,6 +37,7 @@
 #include "VISU_StreamLinesPL.hxx"
 #include "VISU_Actor.h"
 
+#include <SalomeApp_DoubleSpinBox.h>
 #include "SalomeApp_Application.h"
 #include "LightApp_Application.h"
 #include "LightApp_SelectionMgr.h"
 
 #include <SALOMEDSClient_SObject.hxx>
 
-#include <QtxDoubleSpinBox.h>
 #include <QtxColorButton.h>
 
-#include <limits.h>
+#include <limits>
 
 #include <QLayout>
 #include <QLabel>
@@ -70,8 +71,6 @@
 #include <QFrame>
 
 
-using namespace std;
-
 VisuGUI_StreamLinesDlg::VisuGUI_StreamLinesDlg (SalomeApp_Module* theModule)
   : VisuGUI_ScalarBarBaseDlg(theModule),
     myVisuGUI(theModule)
@@ -129,28 +128,28 @@ VisuGUI_StreamLinesDlg::VisuGUI_StreamLinesDlg (SalomeApp_Module* theModule)
       VISU::VISUType aType = VISU::Storable::SObject2Type(aSObject);
       switch (aType) {
       case VISU::TTIMESTAMP: {
-       aSObject = aSObject->GetFather();
-       aSObject = aSObject->GetFather();
-       break;
+        aSObject = aSObject->GetFather();
+        aSObject = aSObject->GetFather();
+        break;
       }
       case VISU::TFIELD: {
-       _PTR(SObject) newSObject;
-       if(aSObject->ReferencedObject(newSObject)) aSObject = newSObject;
-       aSObject = aSObject->GetFather();
-       break;
+        _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;
+        _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();
@@ -159,7 +158,7 @@ VisuGUI_StreamLinesDlg::VisuGUI_StreamLinesDlg (SalomeApp_Module* theModule)
       mySelectionObj = aSObject;
       CORBA::Object_var anObject = VISU::ClientSObjectToObject(mySelectionObj);
       if (CORBA::is_nil(anObject)) {
-       mySelectionObj = mySelectionObj->GetFather();
+        mySelectionObj = mySelectionObj->GetFather();
       }
     }
   }
@@ -189,23 +188,23 @@ VisuGUI_StreamLinesDlg::VisuGUI_StreamLinesDlg (SalomeApp_Module* theModule)
 
       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;
+        _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;
           }
         }
       }
@@ -218,32 +217,44 @@ VisuGUI_StreamLinesDlg::VisuGUI_StreamLinesDlg (SalomeApp_Module* theModule)
   QLabel* aPercentLbl = new QLabel (tr("LBL_USED_POINTS"), aSourceBox);
   aSrcLayout->addWidget(aPercentLbl, 2, 0);
 
-  myPntPercent = new QtxDoubleSpinBox( aSourceBox );
-  VISU::initSpinBox(myPntPercent, 0, 1);
+  myPntPercent = new SalomeApp_DoubleSpinBox( aSourceBox );
+  VISU::initSpinBox( myPntPercent, 0., 1., .1, "parametric_precision" );
   aSrcLayout->addWidget(myPntPercent, 2, 1);
 
   TopLayout->addWidget(aSourceBox, 0, 0, 1, 2);
 
   QLabel* aStepLenLbl = new QLabel (tr("LBL_STEP_LENGTH"), aTopBox);
   TopLayout->addWidget(aStepLenLbl, 1, 0);
-  myStepLen = new QtxDoubleSpinBox( aTopBox );
-  VISU::initSpinBox(myStepLen, DBL_MIN, DBL_MAX);
+  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("LBL_INTEGRATION_STEP"), aTopBox);
   TopLayout->addWidget(aIntegStepLenLbl, 2, 0);
-  myIntegStepLen = new QtxDoubleSpinBox( aTopBox );
-  VISU::initSpinBox(myIntegStepLen, DBL_MIN, DBL_MAX);
+  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("LBL_PROPAGATION_TIME"), aTopBox);
   TopLayout->addWidget(aPropagationLbl, 3, 0);
-  myPropTime = new QtxDoubleSpinBox( aTopBox );
-  VISU::initSpinBox(myPropTime, DBL_MIN, DBL_MAX);
+  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)));
@@ -309,7 +320,7 @@ VisuGUI_StreamLinesDlg::~VisuGUI_StreamLinesDlg()
 {}
 
 void VisuGUI_StreamLinesDlg::initFromPrsObject ( VISU::ColoredPrs3d_i* thePrs,
-                                                bool theInit )
+                                                 bool theInit )
 {
   if( theInit )
     myPrsCopy = VISU::TSameAsFactory<VISU::TSTREAMLINES>().Create(thePrs, VISU::ColoredPrs3d_i::EDoNotPublish);
@@ -364,10 +375,10 @@ void VisuGUI_StreamLinesDlg::initFromPrsObject ( VISU::ColoredPrs3d_i* thePrs,
       if (aPrs == NULL) continue; \
       if (aSrcEntry == aPrs->GetEntry().c_str()) { \
         onSourceTypeChange(PRSNUM); \
-       myUseSrcCombo->setCurrentIndex(PRSNUM); \
-       mySrcCombo->setEnabled(true); \
-       mySrcCombo->setCurrentIndex(i); \
-       return; \
+        myUseSrcCombo->setCurrentIndex(PRSNUM); \
+        mySrcCombo->setEnabled(true); \
+        mySrcCombo->setCurrentIndex(i); \
+        return; \
       } \
     }
 
@@ -425,34 +436,34 @@ int VisuGUI_StreamLinesDlg::storeToPrsObject (VISU::ColoredPrs3d_i* thePrs)
       QString aName;
       switch (aSrcSelection) {
       case 1: // Entity
-       aPrs = myEntityList[aSrcItem];
-       aType = VISU::TENTITY;
-       aName = myEntitiesLst[aSrcItem];
-       break;
+        aPrs = myEntityList[aSrcItem];
+        aType = VISU::TENTITY;
+        aName = myEntitiesLst[aSrcItem];
+        break;
       case 2: // Family
-       aPrs = myFamilyList[aSrcItem];
-       aType = VISU::TFAMILY;
-       aName = myFamilisLst[aSrcItem];
-       break;
+        aPrs = myFamilyList[aSrcItem];
+        aType = VISU::TFAMILY;
+        aName = myFamilisLst[aSrcItem];
+        break;
       case 3: // Group
-       aPrs = myGroupList[aSrcItem];
-       aType = VISU::TGROUP;
-       aName = myGroupsLst[aSrcItem];
-       break;
+        aPrs = myGroupList[aSrcItem];
+        aType = VISU::TGROUP;
+        aName = myGroupsLst[aSrcItem];
+        break;
       case 4: // Presentation
-       aPrs = myPrsList[aSrcItem];
-       break;
+        aPrs = myPrsList[aSrcItem];
+        break;
       }
       if (CORBA::is_nil(aPrs) && aSrcSelection != 4) {
-       aPrs = createMesh(aType, aName);
+        aPrs = createMesh(aType, aName);
       }
     }
     anIsOk &= myPrsCopy->SetParams(myIntegStepLen->value(),
-                                  myPropTime->value(),
-                                  myStepLen->value(),
-                                  aPrs,
-                                  myPntPercent->value(),
-                                  aDirection);
+                                   myPropTime->value(),
+                                   myStepLen->value(),
+                                   aPrs,
+                                   myPntPercent->value(),
+                                   aDirection);
   }
 
   VISU::TSameAsFactory<VISU::TSTREAMLINES>().Copy(myPrsCopy, thePrs);