Salome HOME
0021787: [CEA 621] Desactivate preview for partition and boolean operations in prefer...
[modules/geom.git] / src / AdvancedGUI / AdvancedGUI_DividedCylinderDlg.cxx
index 7abd0bef96e36fd5e7eb3cd20b20d0b651494c62..1d6d55edb6299e8baaa55d159f8840f25b6e016b 100644 (file)
@@ -59,10 +59,21 @@ AdvancedGUI_DividedCylinderDlg::AdvancedGUI_DividedCylinderDlg (GeometryGUI* the
   mainFrame()->RadioButton3->close();
 
   GroupParams = new DlgRef_2Spin(centralWidget());
+  GroupParams->GroupBox1->setTitle(tr("GEOM_BOX_OBJ"));
+  GroupParams->TextLabel1->setText(tr("GEOM_RADIUS"));
+  GroupParams->TextLabel2->setText(tr("GEOM_HEIGHT"));
+  
+  GroupPattern = new DlgRef_3Radio(centralWidget());
+  GroupPattern->GroupBox1->setTitle(tr("GEOM_PATTERN"));
+  GroupPattern->RadioButton1->setText(tr("GEOM_SQUARE"));
+  GroupPattern->RadioButton2->setText(tr("GEOM_HEXAGON"));
+  GroupPattern->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
+  GroupPattern->RadioButton3->close();
 
   QVBoxLayout* layout = new QVBoxLayout(centralWidget());
   layout->setMargin(0); layout->setSpacing(6);
   layout->addWidget(GroupParams);
+  layout->addWidget(GroupPattern);
   /***************************************************************/
 
   setHelpFileName("create_dividedcylinder_page.html");
@@ -97,6 +108,9 @@ void AdvancedGUI_DividedCylinderDlg::Init()
   double aHeight = 300;
   GroupParams->SpinBox_DX->setValue(aRadius);
   GroupParams->SpinBox_DY->setValue(aHeight);
+  
+  GroupPattern->RadioButton1->setChecked(true);
+  myPattern = GEOM::SQUARE;
 
   // Signal/slot connections
   connect(buttonOk(),    SIGNAL(clicked()), this, SLOT(ClickOnOk()));
@@ -106,8 +120,13 @@ void AdvancedGUI_DividedCylinderDlg::Init()
   
   connect(GroupParams->SpinBox_DX,     SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
   connect(GroupParams->SpinBox_DY,     SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
+  
+  connect(GroupPattern->RadioButton1,  SIGNAL(clicked()),            this, SLOT(RadioButtonClicked()));
+  connect(GroupPattern->RadioButton2,  SIGNAL(clicked()),            this, SLOT(RadioButtonClicked()));
 
   initName(tr("GEOM_DIVIDEDCYLINDER"));
+  
+  resize(minimumSizeHint());
   displayPreview(true);
 }
 
@@ -120,6 +139,23 @@ void AdvancedGUI_DividedCylinderDlg::SetDoubleSpinBoxStep (double step)
   //@@ set double spin box step for all spin boxes here @@//
 }
 
+//=================================================================================
+// function : RadioButtonClicked()
+// purpose  : Radio button management
+//=================================================================================
+void AdvancedGUI_DividedCylinderDlg::RadioButtonClicked()
+{ 
+  QRadioButton* send = (QRadioButton*)sender();
+  
+  // Division pattern
+  if (send == GroupPattern->RadioButton1)
+    myPattern = GEOM::SQUARE;
+  else if (send == GroupPattern->RadioButton2)
+    myPattern = GEOM::HEXAGON;
+  
+  displayPreview(true);
+}
+
 //=================================================================================
 // function : ClickOnOk()
 // purpose  :
@@ -213,7 +249,7 @@ bool AdvancedGUI_DividedCylinderDlg::execute (ObjectList& objects)
   CORBA::Double theH = GroupParams->SpinBox_DY->value();
 
   // call engine function
-  anObj = anOper->MakeDividedCylinder(theR, theH);
+  anObj = anOper->MakeDividedCylinder(theR, theH, myPattern);
   res = !anObj->_is_nil();
   if (res && !IsPreview())
   {