Salome HOME
updated copyright message
[modules/gui.git] / src / Plot2d / Plot2d_AnalyticalCurveDlg.h
1 // Copyright (C) 2007-2023  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 // File   : Plot2d_AnalyticalCurveDlg.h
23 // Author : Roman NIKOLAEV, Open CASCADE S.A.S. (roman.nikolaev@opencascade.com)
24
25
26 #ifndef PLOT2D_ANALYTICAL_CURVE_DLG_H
27 #define PLOT2D_ANALYTICAL_CURVE_DLG_H
28
29 #include "Plot2d.h"
30 #include "Plot2d_AnalyticalCurve.h"
31
32 #include <QDialog>
33 #include <QMap>
34
35 class QListWidget;
36 class QListWidgetItem;
37 class QGroupBox;
38 class QLineEdit;
39 class QCheckBox;
40 class QComboBox;
41 class QPushButton;
42
43 class QtxIntSpinBox;
44 class QtxColorButton;
45 class QwtPlot;
46
47 class Plot2d_AnalyticalCurve;
48 class Plot2d_CurveContainer;
49 class Plot2d_ViewFrame;
50
51 class PLOT2D_EXPORT Plot2d_AnalyticalCurveDlg : public QDialog
52
53   Q_OBJECT
54
55   class Updater;
56   class UpdateLocker;
57
58   enum { ItemExisting, ItemAdded, ItemRemoved };
59
60 public:
61   Plot2d_AnalyticalCurveDlg( Plot2d_CurveContainer*, QWidget* );
62   ~Plot2d_AnalyticalCurveDlg();
63
64   void accept();
65   void reject();
66
67 private:  
68   
69   void                  init();
70   void                  initPropsFromCurve(Plot2d_AnalyticalCurve*);
71   QListWidgetItem*      selected() const;
72   Plot2d_AnalyticalCurve* selectedCurve() const;
73   QListWidgetItem*      getItem(Plot2d_AnalyticalCurve*) const;
74   bool                  processCurves();
75   QwtPlot*              getPlot();
76   int                   propStatus( Plot2d_AnalyticalCurve* = 0, const int def = ItemExisting );
77   QString               propTitle( Plot2d_AnalyticalCurve* = 0, const QString& def = "" );
78   bool                  propVisible( Plot2d_AnalyticalCurve* = 0, bool def = true );
79   QString               propFormula( Plot2d_AnalyticalCurve* = 0, const QString& def = "" );
80   int                   propIntervals( Plot2d_AnalyticalCurve* = 0, int def = 100 );
81   Plot2d::MarkerType    propMarkerType( Plot2d_AnalyticalCurve* = 0, Plot2d::MarkerType def = Plot2d::None );
82   Plot2d::LineType      propLineType( Plot2d_AnalyticalCurve* = 0, Plot2d::LineType def = Plot2d::NoPen );
83   int                   propLineWidth( Plot2d_AnalyticalCurve* = 0, int def = 0 );
84   QColor                propColor( Plot2d_AnalyticalCurve* = 0, const QColor& def = QColor() );
85   bool                  propAutoAssign( Plot2d_AnalyticalCurve* = 0, bool def = true );
86
87 private slots:
88   void addCurve();
89   void removeCurve();
90   void updateCurve();
91   void updateState();
92   void selectionChanged();
93   void help();
94   void apply();
95
96 private:
97   typedef QMap <QString, QVariant> CurveProps;
98   typedef QMap <Plot2d_AnalyticalCurve*, CurveProps> PropMap;
99
100   Plot2d_CurveContainer* myContainer;
101   PropMap                myProperties;
102   Updater*               myUpdater;
103
104   QListWidget*           myCurvesList;
105   QGroupBox*             myCurveParams;
106   QLineEdit*             myFormula;
107   QtxIntSpinBox*         myNbIntervals;
108   QGroupBox*             myCurveProps;
109   QCheckBox*             myAutoAssign;
110   QWidget*               myPropsGrp;
111   QComboBox*             myMarkerType;
112   QComboBox*             myLineType;
113   QtxIntSpinBox*         myLineWidth;
114   QtxColorButton*        myColor;
115   QPushButton*           myAddButton;
116   QPushButton*           myRemoveButton;
117 };
118
119 class Plot2d_AnalyticalCurveDlg::Updater : public QObject
120 {
121   Q_OBJECT
122 public:
123   Updater( QWidget* parent );
124   ~Updater();
125 signals:
126   void update();
127 };
128
129 #endif //PLOT2D_ANALYTICAL_CURVE_DLG_H