]> SALOME platform Git repositories - modules/geom.git/blobdiff - src/BasicGUI/BasicGUI_CurveDlg.cxx
Salome HOME
[bos #39942] EDF 25230 - New problem with XYZtoUV
[modules/geom.git] / src / BasicGUI / BasicGUI_CurveDlg.cxx
index 4cd535b4dbf6823155178ad2b675f1a01d2fc7b9..5f57c81528359131fb72af18480c9b60fc05d732 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2013  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
@@ -37,7 +37,6 @@
 #include <SalomeApp_Study.h>
 #include <LightApp_SelectionMgr.h>
 
-#include <SALOME_ListIteratorOfListIO.hxx>
 #include <SALOME_ListIO.hxx>
 
 #include <TopoDS_Shape.hxx>
@@ -48,6 +47,8 @@
 
 #include <GEOMImpl_Types.hxx>
 
+#include <QButtonGroup>
+
 //=================================================================================
 // class    : BasicGUI_CurveDlg()
 // purpose  : Constructs a BasicGUI_CurveDlg which is a child of 'parent', with the
@@ -281,15 +282,15 @@ void BasicGUI_CurveDlg::SetEditCurrentArgument()
 
   if (sender() == myGroupPoints->PushButton1) {
     myEditCurrentArgument = myGroupPoints->LineEdit1;
-    localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
+    localSelection(TopAbs_VERTEX);
   }
   else if (sender() == myPushBtnV1) {
     myEditCurrentArgument = myLineEditV1;
-    localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
+    localSelection(TopAbs_EDGE);
   }
   else if (sender() == myPushBtnV2) {
     myEditCurrentArgument = myLineEditV2;
-    localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
+    localSelection(TopAbs_EDGE);
   }
 
   myEditCurrentArgument->setFocus();
@@ -347,43 +348,13 @@ bool BasicGUI_CurveDlg::ClickOnApply()
   return true;
 }
 
-//=================================================================================
-// function : SelectionIntoArgument()
-// purpose  : Called when selection as changed or other case
-//=================================================================================
-static void synchronize (QList<GEOM::GeomObjPtr>& left, QList<GEOM::GeomObjPtr>& right)
-{
-  // 1. remove items from the "left" list that are not in the "right" list
-  QMutableListIterator<GEOM::GeomObjPtr> it1 (left);
-  while (it1.hasNext()) {
-    GEOM::GeomObjPtr o1 = it1.next();
-    bool found = false;
-    QMutableListIterator<GEOM::GeomObjPtr> it2( right );
-    while ( it2.hasNext() && !found )
-      found = o1 == it2.next();
-    if ( !found )
-      it1.remove();
-  }
-  // 2. add items from the "right" list that are not in the "left" list (to keep selection order)
-  it1 = right;
-  while ( it1.hasNext() ) {
-    GEOM::GeomObjPtr o1 = it1.next();
-    bool found = false;
-    QMutableListIterator<GEOM::GeomObjPtr> it2( left );
-    while ( it2.hasNext() && !found )
-      found = o1 == it2.next();
-    if ( !found )
-      left << o1;
-  }
-}
-
 void BasicGUI_CurveDlg::SelectionIntoArgument()
 {
   myEditCurrentArgument->setText("");
 
   if (myEditCurrentArgument == myGroupPoints->LineEdit1) {
     QList<GEOM::GeomObjPtr> points = getSelected(TopAbs_VERTEX, -1);
-    synchronize(myPoints, points);
+    GEOMBase::Synchronize(myPoints, points);
     if (!myPoints.isEmpty())
       myGroupPoints->LineEdit1->setText(QString::number(myPoints.count()) + "_" +
                                         tr("GEOM_POINT") + tr("_S_"));
@@ -449,7 +420,7 @@ void BasicGUI_CurveDlg::enterEvent (QEvent*)
 //=================================================================================
 GEOM::GEOM_IOperations_ptr BasicGUI_CurveDlg::createOperation()
 {
-  return myGeomGUI->GetGeomGen()->GetICurvesOperations(getStudyId());
+  return myGeomGUI->GetGeomGen()->GetICurvesOperations();
 }
 
 //=================================================================================
@@ -503,9 +474,9 @@ bool BasicGUI_CurveDlg::execute (ObjectList& objects)
     if (myBySelectionBtn->isChecked())
       anObj = anOper->MakePolyline(points.in(), myGroupPoints->CheckButton1->isChecked());
     else
-      anObj = anOper->MakeCurveParametricNew(qPrintable(myGroupParams->myXExpr->text()),
-                                             qPrintable(myGroupParams->myYExpr->text()),
-                                             qPrintable(myGroupParams->myZExpr->text()),
+      anObj = anOper->MakeCurveParametricNew(qUtf8Printable(myGroupParams->myXExpr->text()),
+                                             qUtf8Printable(myGroupParams->myYExpr->text()),
+                                             qUtf8Printable(myGroupParams->myZExpr->text()),
                                              myGroupParams->myPMin->value(),
                                              myGroupParams->myPMax->value(),
                                              myGroupParams->myPStep->value(),
@@ -516,9 +487,9 @@ bool BasicGUI_CurveDlg::execute (ObjectList& objects)
     if (myBySelectionBtn->isChecked())
       anObj = anOper->MakeSplineBezier(points.in(), myGroupPoints->CheckButton1->isChecked());
     else
-      anObj = anOper->MakeCurveParametricNew(qPrintable(myGroupParams->myXExpr->text()),
-                                             qPrintable(myGroupParams->myYExpr->text()),
-                                             qPrintable(myGroupParams->myZExpr->text()),
+      anObj = anOper->MakeCurveParametricNew(qUtf8Printable(myGroupParams->myXExpr->text()),
+                                             qUtf8Printable(myGroupParams->myYExpr->text()),
+                                             qUtf8Printable(myGroupParams->myZExpr->text()),
                                              myGroupParams->myPMin->value(),
                                              myGroupParams->myPMax->value(),
                                              myGroupParams->myPStep->value(),
@@ -537,9 +508,9 @@ bool BasicGUI_CurveDlg::execute (ObjectList& objects)
                                                 myGroupPoints->CheckButton2->isChecked());
     }
     else
-      anObj = anOper->MakeCurveParametricNew(qPrintable(myGroupParams->myXExpr->text()),
-                                             qPrintable(myGroupParams->myYExpr->text()),
-                                             qPrintable(myGroupParams->myZExpr->text()),
+      anObj = anOper->MakeCurveParametricNew(qUtf8Printable(myGroupParams->myXExpr->text()),
+                                             qUtf8Printable(myGroupParams->myYExpr->text()),
+                                             qUtf8Printable(myGroupParams->myZExpr->text()),
                                              myGroupParams->myPMin->value(),
                                              myGroupParams->myPMax->value(),
                                              myGroupParams->myPStep->value(),
@@ -554,7 +525,7 @@ bool BasicGUI_CurveDlg::execute (ObjectList& objects)
       aParameters<<myGroupParams->myPMin->text();
       aParameters<<myGroupParams->myPMax->text();
       aParameters<<myGroupParams->myPStep->text();
-      anObj->SetParameters(aParameters.join(":").toLatin1().constData());
+      anObj->SetParameters(aParameters.join(":").toUtf8().constData());
     }
     objects.push_back(anObj._retn());
   }
@@ -572,6 +543,14 @@ void BasicGUI_CurveDlg::addSubshapesToStudy()
     GEOMBase::PublishSubObject( myPoints[i].get() );
 }
 
+//=================================================================================
+// function : getSourceObjects
+// purpose  : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> BasicGUI_CurveDlg::getSourceObjects()
+{
+  return myPoints;
+}
 //=================================================================================
 // function : CreationModeChanged
 // purpose  :