Salome HOME
Merge from V5_1_4_BR 07/05/2010
[modules/smesh.git] / src / StdMeshersGUI / StdMeshersGUI_NbSegmentsCreator.cxx
index 9e8e0bda842b80b5672c123d7dacee87a15723ca..9fce3fe98541f13ac13c4fbfd1a1e2e4ff64a001 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   : StdMeshersGUI_NbSegmentsCreator.cxx
 // Author : Open CASCADE S.A.S.
 // SMESH includes
@@ -26,6 +27,7 @@
 #include "StdMeshersGUI_NbSegmentsCreator.h"
 #include "StdMeshersGUI_DistrTable.h"
 #include "StdMeshersGUI_DistrPreview.h"
+#include "StdMeshersGUI_SubShapeSelectorWdg.h"
 
 #include <SMESHGUI.h>
 #include <SMESHGUI_Utils.h>
@@ -99,7 +101,7 @@ QFrame* StdMeshersGUI_NbSegmentsCreator::buildFrame()
 
   QVBoxLayout* lay = new QVBoxLayout( fr );
   lay->setMargin( 0 );
-  lay->setSpacing( 0 );
+  lay->setSpacing( SPACING );
 
   QGroupBox* GroupC1 = new QGroupBox( tr( "SMESH_ARGUMENTS" ), fr );
   lay->addWidget( GroupC1 );
@@ -148,7 +150,7 @@ QFrame* StdMeshersGUI_NbSegmentsCreator::buildFrame()
   // 3)  scale
   myGroupLayout->addWidget( myLScale = new QLabel( tr( "SMESH_NB_SEGMENTS_SCALE_PARAM" ), GroupC1 ), row, 0 );
   myScale = new SMESHGUI_SpinBox( GroupC1 );
-  myScale->RangeStepAndValidator( 1E-5, 1E+5, 0.1, 6 );
+  myScale->RangeStepAndValidator( 1E-5, 1E+5, 0.1, "parametric_precision" );
   myGroupLayout->addWidget( myScale, row, 1 );
   row++;
 
@@ -195,11 +197,27 @@ QFrame* StdMeshersGUI_NbSegmentsCreator::buildFrame()
   myPreviewRow = row;
   row++;
 
+  // 8) reverce edge parameters
+  myReversedEdgesBox = new QGroupBox(tr( "SMESH_REVERSED_EDGES" ), fr);
+  QHBoxLayout* edgeLay = new QHBoxLayout( myReversedEdgesBox );
+
+  myDirectionWidget = new StdMeshersGUI_SubShapeSelectorWdg();
+  QString aGeomEntry = getShapeEntry();
+  QString aMainEntry = getMainShapeEntry();
+  if ( aGeomEntry == "" )
+    aGeomEntry = h->GetObjectEntry();
+  myDirectionWidget->SetGeomShapeEntry( aGeomEntry );
+  myDirectionWidget->SetMainShapeEntry( aMainEntry );
+  myDirectionWidget->SetListOfIDs( h->GetReversedEdges() );
+  edgeLay->addWidget( myDirectionWidget );
+
+  lay->addWidget( myReversedEdgesBox );
+
   connect( myNbSeg, SIGNAL( valueChanged( const QString& ) ), this, SLOT( onValueChanged() ) );
   connect( myDistr, SIGNAL( activated( int ) ), this, SLOT( onValueChanged() ) );
   connect( myTable, SIGNAL( valueChanged( int, int ) ), this, SLOT( onValueChanged() ) );
   connect( myExpr,  SIGNAL( textChanged( const QString& ) ), this, SLOT( onValueChanged() ) );
-  connect( myConv,  SIGNAL( cuttonClicked( int ) ), this, SLOT( onValueChanged() ) );
+  connect( myConv,  SIGNAL( buttonClicked( int ) ), this, SLOT( onValueChanged() ) );
 
   return fr;
 }
@@ -348,6 +366,11 @@ bool StdMeshersGUI_NbSegmentsCreator::storeParamsToHypo( const NbSegmentsHypothe
     if( distr==2 || distr==3 )
       h->SetConversionMode( h_data.myConv );
 
+    if( distr==1 || distr==2 || distr==3 ) {
+      h->SetReversedEdges( myDirectionWidget->GetListOfIDs() );
+      h->SetObjectEntry( myDirectionWidget->GetMainShapeEntry() );
+    }
+
     if( distr==2 )
       h->SetTableFunction( h_data.myTable );
 
@@ -357,7 +380,7 @@ bool StdMeshersGUI_NbSegmentsCreator::storeParamsToHypo( const NbSegmentsHypothe
     //the function will be checked with old conversion mode, so that it may occurs
     //unexpected errors for user
 
-    h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
+    h->SetParameters(aVariablesList.join(":").toLatin1().constData());
   }
   catch(const SALOME::SALOME_Exception& ex)
   {
@@ -400,6 +423,8 @@ void StdMeshersGUI_NbSegmentsCreator::onValueChanged()
 
   myScale->setShown( distr==1 );
   myLScale->setShown( distr==1 );
+  myReversedEdgesBox->setShown( !distr==0 );
+  myDirectionWidget->showPreview( !distr==0 );
 
   bool isFunc = distr==2 || distr==3;
   myPreview->setShown( isFunc );
@@ -434,8 +459,11 @@ void StdMeshersGUI_NbSegmentsCreator::onValueChanged()
 
   if ( (QtxComboBox*)sender() == myDistr && dlg() ) {
     QApplication::instance()->processEvents();
+    myGroupLayout->invalidate();
+    dlg()->layout()->invalidate();
     dlg()->updateGeometry();
-    dlg()->setMinimumSize( dlg()->minimumSizeHint().width(), dlg()->minimumSizeHint().height() );
+    dlg()->setMinimumSize( dlg()->minimumSizeHint() );
     dlg()->resize( dlg()->minimumSize() );
+    QApplication::instance()->processEvents();
   }
 }