Salome HOME
Changes for bug 0020673.
[modules/geom.git] / src / GenerationGUI / GenerationGUI_FillingDlg.cxx
index fa200559a791cc4be339e477b96403b8f869d2d5..c43b3fd2c5a24c2921d26d3dbf9a48e0badd3440 100644 (file)
@@ -45,7 +45,7 @@
 //            TRUE to construct a modal dialog.
 //=================================================================================
 GenerationGUI_FillingDlg::GenerationGUI_FillingDlg( GeometryGUI* theGeometryGUI, QWidget* parent,
-                                                   bool modal, Qt::WindowFlags fl )
+                                                    bool modal, Qt::WindowFlags fl )
   : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl )
 {
   QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_FILLING" ) ) );
@@ -70,6 +70,7 @@ GenerationGUI_FillingDlg::GenerationGUI_FillingDlg( GeometryGUI* theGeometryGUI,
   GroupPoints->TextLabel5->setText( tr( "GEOM_FILLING_MAX_DEG" ) );
   GroupPoints->TextLabel6->setText( tr( "GEOM_FILLING_TOL_3D" ) );
   GroupPoints->CheckBox1->setText( tr( "GEOM_FILLING_APPROX" ) );
+  GroupPoints->CheckBox2->setText( tr( "GEOM_FILLING_USEORI" ) );
   GroupPoints->PushButton1->setIcon( image1 );
   GroupPoints->LineEdit1->setReadOnly( true );
 
@@ -108,6 +109,7 @@ void GenerationGUI_FillingDlg::Init()
   myTol3D = 0.0001;
   myTol2D = 0.0001;
   myNbIter = 0;
+  myIsUseOri = false;
   myIsApprox = false;
   myOkCompound = false;
 
@@ -141,12 +143,16 @@ void GenerationGUI_FillingDlg::Init()
   connect( GroupPoints->SpinBox4, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
   connect( GroupPoints->SpinBox5, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
 
-  connect( GroupPoints->CheckBox1, SIGNAL( stateChanged( int ) ), this, SLOT( ApproxChanged() ) );
+  connect( GroupPoints->CheckBox1, SIGNAL( stateChanged( int ) ),
+           this, SLOT( ApproxChanged() ) );
+
+  connect( GroupPoints->CheckBox2, SIGNAL( stateChanged( int ) ),
+           this, SLOT( UseOriChanged() ) );
 
   connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), this, SLOT( SetDoubleSpinBoxStep( double ) ) );
 
   connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
-          SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
+           SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
 
   initName( tr( "GEOM_FILLING" ) );
   resize(100,100);
@@ -224,7 +230,8 @@ void GenerationGUI_FillingDlg::SelectionIntoArgument()
     if (GEOMBase::GetShape(aSelectedObject, S) && S.ShapeType() == TopAbs_COMPOUND) {
       // myCompound should be a compound of edges
       for (TopoDS_Iterator it (S); it.More(); it.Next())
-        if (it.Value().ShapeType() != TopAbs_EDGE)
+        if ( it.Value().ShapeType() != TopAbs_EDGE && 
+             it.Value().ShapeType() != TopAbs_WIRE )
           return;
       myCompound = aSelectedObject;
       myOkCompound = true;
@@ -275,7 +282,7 @@ void GenerationGUI_FillingDlg::ActivateThisDialog()
 {
   GEOMBase_Skeleton::ActivateThisDialog();
   connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
-          SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
+           SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
   globalSelection( GEOM_COMPOUND );
   displayPreview();
 }
@@ -314,6 +321,16 @@ void GenerationGUI_FillingDlg::ValueChangedInSpinBox( double newValue )
   displayPreview();
 }
 
+//=================================================================================
+// function : UseOriChanged()
+// purpose  :
+//=================================================================================
+void GenerationGUI_FillingDlg::UseOriChanged()
+{
+  myIsUseOri = GroupPoints->CheckBox2->isChecked();
+  displayPreview();
+}
+
 //=================================================================================
 // function : ApproxChanged()
 // purpose  :
@@ -324,6 +341,7 @@ void GenerationGUI_FillingDlg::ApproxChanged()
   displayPreview();
 }
 
+
 //=================================================================================
 // function : createOperation
 // purpose  :
@@ -355,9 +373,11 @@ bool GenerationGUI_FillingDlg::isValid( QString& msg )
 //=================================================================================
 bool GenerationGUI_FillingDlg::execute( ObjectList& objects )
 {
-  GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation());
-  GEOM::GEOM_Object_var anObj = anOper->MakeFilling( myCompound, myMinDeg, myMaxDeg, 
-                                                    myTol2D, myTol3D, myNbIter, myIsApprox );
+  GEOM::GEOM_I3DPrimOperations_var anOper =
+    GEOM::GEOM_I3DPrimOperations::_narrow(getOperation());
+  GEOM::GEOM_Object_var anObj =
+    anOper->MakeFilling( myCompound, myMinDeg, myMaxDeg, myTol2D, myTol3D,
+                         myNbIter, myIsUseOri, myIsApprox );
   if ( !anObj->_is_nil() )
   {
     if ( !IsPreview() )