Salome HOME
[bos #39942] EDF 25230 - New problem with XYZtoUV
[modules/geom.git] / src / TransformationGUI / TransformationGUI_ScaleDlg.cxx
index ff31ede297451f818e7bbaf94592461fda1f54d1..83ed162b1453c49facfc6b506ccc57222d2a8f7b 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2023  CEA, EDF, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -6,7 +6,7 @@
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -294,7 +294,7 @@ void TransformationGUI_ScaleDlg::SelectionIntoArgument()
       myEditCurrentArgument->setText( aName );
       myPoint = aSelectedObject;
       if ( myObjects.isEmpty() )
-       PushButton1->click();
+        PushButton1->click();
     }
     else {
       myPoint.nullify();
@@ -325,7 +325,7 @@ void TransformationGUI_ScaleDlg::SetEditCurrentArgument()
   else if (send == PushButton2) {
     myEditCurrentArgument = LineEdit2;
 
-    localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
+    localSelection(TopAbs_VERTEX);
 
     PushButton1->setDown(false);
     LineEdit1->setEnabled(false);
@@ -392,7 +392,7 @@ void TransformationGUI_ScaleDlg::SetDoubleSpinBoxStep(double step)
 //=================================================================================
 GEOM::GEOM_IOperations_ptr TransformationGUI_ScaleDlg::createOperation()
 {
-  return getGeomEngine()->GetITransformOperations(getStudyId());
+  return getGeomEngine()->GetITransformOperations();
 }
 
 //=================================================================================
@@ -442,7 +442,7 @@ bool TransformationGUI_ScaleDlg::execute (ObjectList& objects)
           anObj = anOper->ScaleShapeCopy(myObjects[i].get(), myPoint.get(), SpinBox_FX->value());
           if (!anObj->_is_nil()) {
             if(!IsPreview()) 
-              anObj->SetParameters(SpinBox_FX->text().toLatin1().constData());
+              anObj->SetParameters(SpinBox_FX->text().toUtf8().constData());
             objects.push_back(anObj._retn());
           }
         }
@@ -466,15 +466,16 @@ bool TransformationGUI_ScaleDlg::execute (ObjectList& objects)
         {
           anObj = anOper->ScaleShapeAlongAxesCopy(myObjects[i].get(), myPoint.get(), SpinBox_FX->value(),
                                                   SpinBox_FY->value(), SpinBox_FZ->value());
-          if (!anObj->_is_nil())
+          if (!anObj->_is_nil()) {
             if(!IsPreview()) {
               QStringList aParameters;
               aParameters<<SpinBox_FX->text();
               aParameters<<SpinBox_FY->text();
               aParameters<<SpinBox_FZ->text();
-              anObj->SetParameters(aParameters.join(":").toLatin1().constData());
+              anObj->SetParameters(aParameters.join(":").toUtf8().constData());
             }
             objects.push_back(anObj._retn());
+          }
         }
       }
       else
@@ -500,12 +501,11 @@ bool TransformationGUI_ScaleDlg::execute (ObjectList& objects)
 // function : restoreSubShapes
 // purpose  :
 //=================================================================================
-void TransformationGUI_ScaleDlg::restoreSubShapes (SALOMEDS::Study_ptr   theStudy,
-                                                   SALOMEDS::SObject_ptr theSObject)
+void TransformationGUI_ScaleDlg::restoreSubShapes (SALOMEDS::SObject_ptr theSObject)
 {
   if (mainFrame()->CheckBoxRestoreSS->isChecked()) {
     // empty list of arguments means that all arguments should be restored
-    getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, GEOM::ListOfGO(),
+    getGeomEngine()->RestoreSubShapesSO(theSObject, GEOM::ListOfGO(),
                                         /*theFindMethod=*/GEOM::FSM_Transformed,
                                         /*theInheritFirstArg=*/true,
                                         mainFrame()->CheckBoxAddPrefix->isChecked());
@@ -533,3 +533,15 @@ void TransformationGUI_ScaleDlg::addSubshapesToStudy()
     GEOMBase::PublishSubObject( myPoint.get() );
   }
 }
+
+//=================================================================================
+// function : getSourceObjects
+// purpose  : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> TransformationGUI_ScaleDlg::getSourceObjects()
+{
+  QList<GEOM::GeomObjPtr> res(myObjects);
+  if ( CheckBoxCopy->isChecked() )
+    res << myPoint;
+  return res;
+}