-// 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
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
// GEOM GEOMGUI : GUI for Geometry component
// File : TransformationGUI_MultiRotationDlg.cxx
// Author : Damien COQUERET, Open CASCADE S.A.S.
mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
mainFrame()->RadioButton3->close();
- GroupPoints = new DlgRef_2Sel1Spin(centralWidget());
+ GroupPoints = new DlgRef_2Sel1SpinInt(centralWidget());
GroupPoints->GroupBox1->setTitle(tr("GEOM_MULTIROTATION_SIMPLE"));
GroupPoints->TextLabel1->setText(tr("GEOM_MAIN_OBJECT"));
GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR"));
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
double step = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100);
- double SpecificStep1 = 5;
- double SpecificStep2 = 1;
+ int SpecificStep1 = 5;
+ int SpecificStep2 = 1;
// min, max, step and decimals for spin boxes & initial values
- initSpinBox(GroupPoints->SpinBox_DX, 1.0, 999, SpecificStep2, 10);
+ initSpinBox(GroupPoints->SpinBox_DX, 1, 999, SpecificStep2);
GroupPoints->SpinBox_DX->setValue(myNbTimes1);
- GroupPoints->SpinBox_DX->setDecimals(0);
- initSpinBox(GroupDimensions->SpinBox_DX1, COORD_MIN, COORD_MAX, SpecificStep1, 10); // VSR: TODO: DBL_DIGITS_DISPLAY
- initSpinBox(GroupDimensions->SpinBox_DY1, 1.0, 999, SpecificStep2, 10);
- initSpinBox(GroupDimensions->SpinBox_DX2, COORD_MIN, COORD_MAX, step, 10); // VSR: TODO: DBL_DIGITS_DISPLAY
- initSpinBox(GroupDimensions->SpinBox_DY2, 1.0, 999, SpecificStep2, 10);
+ initSpinBox(GroupDimensions->SpinBox_DX1, COORD_MIN, COORD_MAX, SpecificStep1, "angle_precision" );
+ initSpinBox(GroupDimensions->SpinBox_DY1, 1, 999, SpecificStep2);
+ initSpinBox(GroupDimensions->SpinBox_DX2, COORD_MIN, COORD_MAX, step,"length_precision" );
+ initSpinBox(GroupDimensions->SpinBox_DY2, 1, 999, SpecificStep2);
GroupDimensions->SpinBox_DX1->setValue(myAng);
GroupDimensions->SpinBox_DY1->setValue(myNbTimes1);
GroupDimensions->SpinBox_DX2->setValue(myStep);
GroupDimensions->SpinBox_DY2->setValue(myNbTimes2);
- GroupDimensions->SpinBox_DY1->setDecimals(0);
- GroupDimensions->SpinBox_DY2->setDecimals(0);
// init variables
myAng = 45.0;
myBase = myVector = GEOM::GEOM_Object::_nil();
+ mainFrame()->GroupBoxPublish->show();
+
// signals and slots connections
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
connect(GroupDimensions->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(GroupDimensions->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
- connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
+ connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(int)), this, SLOT(ValueChangedInSpinBox(int)));
connect(GroupDimensions->SpinBox_DX1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
- connect(GroupDimensions->SpinBox_DY1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
+ connect(GroupDimensions->SpinBox_DY1, SIGNAL(valueChanged(int)), this, SLOT(ValueChangedInSpinBox(int)));
connect(GroupDimensions->SpinBox_DX2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
- connect(GroupDimensions->SpinBox_DY2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
+ connect(GroupDimensions->SpinBox_DY2, SIGNAL(valueChanged(int)), this, SLOT(ValueChangedInSpinBox(int)));
connect(GroupDimensions->SpinBox_DX1,SIGNAL(textChanged( const QString& )),
this, SLOT(TextValueChangedInSpinBox( const QString& )));
//=================================================================================
void TransformationGUI_MultiRotationDlg::SetDoubleSpinBoxStep (double step)
{
- GroupPoints->SpinBox_DX->setSingleStep(step);
- GroupDimensions->SpinBox_DX1->setSingleStep(step);
- GroupDimensions->SpinBox_DY1->setSingleStep(step);
GroupDimensions->SpinBox_DX2->setSingleStep(step);
- GroupDimensions->SpinBox_DY2->setSingleStep(step);
+
+ // san: Commented so as not to override specific step settings
+ //GroupPoints->SpinBox_DX->setSingleStep((int)step);
+ //GroupDimensions->SpinBox_DX1->setSingleStep(step);
+ //GroupDimensions->SpinBox_DY1->setSingleStep((int)step);
+ //GroupDimensions->SpinBox_DY2->setSingleStep((int)step);
}
//=================================================================================
//Find SubShape Object in Father
GEOM::GEOM_Object_var aFindedObject = findObjectInFather(aSelectedObject, aName);
- if (aFindedObject == GEOM::GEOM_Object::_nil()) { // Object not found in study
+ if (aFindedObject->_is_nil()) { // Object not found in study
GEOM::GEOM_IShapesOperations_var aShapesOp =
getGeomEngine()->GetIShapesOperations(getStudyId());
myVector = aShapesOp->GetSubShape(aSelectedObject, anIndex);
{
GEOMBase_Skeleton::ActivateThisDialog();
connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
- this, SLOT( SelectionIntoArgument() ) );
+ this, SLOT( SelectionIntoArgument() ) );
ConstructorsClicked( getConstructorId() );
}
GroupDimensions->CheckButton1->setChecked(false);
GroupDimensions->CheckButton1->setEnabled(isDigit);
}
+
//=================================================================================
// function : ValueChangedInSpinBox()
// purpose :
{
QObject* send = (QObject*)sender();
- if (send == GroupPoints->SpinBox_DX || send == GroupDimensions->SpinBox_DY1)
- myNbTimes1 = (int)newValue;
- else if (send == GroupDimensions->SpinBox_DX1)
+ if (send == GroupDimensions->SpinBox_DX1)
myAng = newValue;
else if (send == GroupDimensions->SpinBox_DX2)
myStep = newValue;
+
+ displayPreview();
+}
+
+//=================================================================================
+// function : ValueChangedInSpinBox()
+// purpose :
+//=================================================================================
+void TransformationGUI_MultiRotationDlg::ValueChangedInSpinBox (int newValue)
+{
+ QObject* send = (QObject*)sender();
+
+ if (send == GroupPoints->SpinBox_DX || send == GroupDimensions->SpinBox_DY1)
+ myNbTimes1 = newValue;
else if (send == GroupDimensions->SpinBox_DY2)
- myNbTimes2 = (int)newValue;
+ myNbTimes2 = newValue;
displayPreview();
}
int aConstructorId = getConstructorId();
- if (aConstructorId == 0)
- GroupPoints->SpinBox_DX->setValue(myAng);
- else if (aConstructorId == 1)
+ if (aConstructorId == 1)
GroupDimensions->SpinBox_DX1->setValue(myAng);
displayPreview();
GEOM::GEOM_Object_var anObj;
QStringList aParameters;
+ GEOM::GEOM_ITransformOperations_var anOper = GEOM::GEOM_ITransformOperations::_narrow(getOperation());
+
switch (getConstructorId()) {
case 0:
if (!CORBA::is_nil(myBase) && !CORBA::is_nil(myVector)) {
- anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
- MultiRotate1D(myBase, myVector, myNbTimes1);
+ anObj = anOper->MultiRotate1D(myBase, myVector, myNbTimes1);
if(!IsPreview())
aParameters<<GroupPoints->SpinBox_DX->text();
res = true;
break;
case 1:
if (!CORBA::is_nil(myBase) && !CORBA::is_nil(myVector)) {
- anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
- MultiRotate2D(myBase, myVector, myAng, myNbTimes1, myStep, myNbTimes2);
+ anObj = anOper->MultiRotate2D(myBase, myVector, myAng, myNbTimes1, myStep, myNbTimes2);
if(!IsPreview()) {
aParameters<<GroupDimensions->SpinBox_DX1->text();
aParameters<<GroupDimensions->SpinBox_DY1->text();
if (!anObj->_is_nil()) {
if(!IsPreview())
- anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+ anObj->SetParameters(aParameters.join(":").toLatin1().constData());
objects.push_back(anObj._retn());
}
}
addSubshapesToFather(objMap);
}
+
+//=================================================================================
+// function : restoreSubShapes
+// purpose :
+//=================================================================================
+void TransformationGUI_MultiRotationDlg::restoreSubShapes (SALOMEDS::Study_ptr theStudy,
+ SALOMEDS::SObject_ptr theSObject)
+{
+ if (mainFrame()->CheckBoxRestoreSS->isChecked()) {
+ // we pass here the first operation argument (object) through the list of arguments
+ // because the rotation operation place its arguments in the data structure in another order,
+ // and we need to point the first argument directly
+ GEOM::ListOfGO_var anArgs = new GEOM::ListOfGO;
+ anArgs->length(1);
+ anArgs[0] = myBase;
+ getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, anArgs,
+ /*theFindMethod=*/GEOM::FSM_Transformed,
+ /*theInheritFirstArg=*/true,
+ mainFrame()->CheckBoxAddPrefix->isChecked());
+ }
+}