-// 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
// 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
#include <SalomeApp_Study.h>
#include <LightApp_SelectionMgr.h>
-#include <SALOME_ListIteratorOfListIO.hxx>
#include <SALOME_ListIO.hxx>
#include <TopoDS_Shape.hxx>
#include <GEOMImpl_Types.hxx>
+#include <QButtonGroup>
+
//=================================================================================
// class : BasicGUI_CurveDlg()
// purpose : Constructs a BasicGUI_CurveDlg which is a child of 'parent', with the
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();
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_"));
//=================================================================================
GEOM::GEOM_IOperations_ptr BasicGUI_CurveDlg::createOperation()
{
- return myGeomGUI->GetGeomGen()->GetICurvesOperations(getStudyId());
+ return myGeomGUI->GetGeomGen()->GetICurvesOperations();
}
//=================================================================================
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(),
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(),
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(),
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());
}
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 :