1 // Copyright (C) 2019-2020 CEA/DEN, EDF R&D
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>
35 /** \brief Represent a content of the property panel to show/modify parameters of B-spline curve.
38 class PartSet_BSplineWidget : public ModuleBase_ModelWidget
43 /// \param theParent the parent object
44 /// \param theData the widget configuation. The attribute of the model widget is obtained from
45 PartSet_BSplineWidget(QWidget* theParent,
46 const Config_WidgetAPI* theData);
48 virtual ~PartSet_BSplineWidget() {}
50 /// The methiod called when widget is deactivated
51 virtual void deactivate();
53 /// Returns list of widget controls
54 /// \return a control list
55 virtual QList<QWidget*> getControls() const;
57 /// Set feature which is processing by active operation
58 /// \param theFeature a feature object
59 /// \param theToStoreValue a value about necessity to store the widget value to the feature
60 /// \param isUpdateFlushed a flag if update should be flushed on store value
61 virtual void setFeature(const FeaturePtr& theFeature, const bool theToStoreValue = false,
62 const bool isUpdateFlushed = true);
65 /// Saves the internal parameters to the given feature
66 /// \return True in success
67 virtual bool storeValueCustom();
69 /// Restore value from attribute data to the widget's control
70 virtual bool restoreValueCustom();
72 /// Create group of widgets related to coordinates of pole and its weight
75 /// Update attributes of B-spline feature
76 void storePolesAndWeights() const;
79 struct BSplinePoleWidgets {
80 ModuleBase_LabelValue* myX;
81 ModuleBase_LabelValue* myY;
82 ModuleBase_ParamSpinBox* myWeight;
85 QGroupBox* myPolesGroupBox; ///< widget to show poles and weights of B-spline curve
86 std::list<BSplinePoleWidgets> myPoles; ///< list of B-spline poles and their weights