1 // Copyright (C) 2019-2023 CEA, EDF
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef PartSet_BSplineWidget_H
21 #define PartSet_BSplineWidget_H
26 #include <ModelAPI_Feature.h>
28 #include <ModuleBase_LabelValue.h>
29 #include <ModuleBase_ModelWidget.h>
30 #include <ModuleBase_ParamSpinBox.h>
36 /** \brief Represent a content of the property panel to show/modify parameters of B-spline curve.
39 class PartSet_BSplineWidget : public ModuleBase_ModelWidget
44 /// \param theParent the parent object
45 /// \param theData the widget configuation. The attribute of the model widget is obtained from
46 PartSet_BSplineWidget(QWidget* theParent,
47 const Config_WidgetAPI* theData);
49 virtual ~PartSet_BSplineWidget() {}
51 /// The methiod called when widget is deactivated
52 virtual void deactivate();
54 /// Returns list of widget controls
55 /// \return a control list
56 virtual QList<QWidget*> getControls() const;
58 /// Set feature which is processing by active operation
59 /// \param theFeature a feature object
60 /// \param theToStoreValue a value about necessity to store the widget value to the feature
61 /// \param isUpdateFlushed a flag if update should be flushed on store value
62 virtual void setFeature(const FeaturePtr& theFeature, const bool theToStoreValue = false,
63 const bool isUpdateFlushed = true);
66 /// Saves the internal parameters to the given feature
67 /// \return True in success
68 virtual bool storeValueCustom();
70 /// Restore value from attribute data to the widget's control
71 virtual bool restoreValueCustom();
73 /// Create group of widgets related to coordinates of pole and its weight
76 /// Update attributes of B-spline feature
77 void storePolesAndWeights() const;
83 struct BSplinePoleWidgets {
84 ModuleBase_LabelValue* myX;
85 ModuleBase_LabelValue* myY;
86 ModuleBase_ParamSpinBox* myWeight;
87 QToolButton* myAddBtn;
90 QGroupBox* createPoleWidget(BSplinePoleWidgets& thePole,
91 const QString& theName,
94 QWidget* myPolesWgt; ///< widget to show poles and weights of B-spline curve
95 QGroupBox* myPolesGroupBox;
96 QScrollArea* myScrollArea;
97 std::list<BSplinePoleWidgets> myPoles; ///< list of B-spline poles and their weights