Back to index

salome-gui  6.5.0
Plot2d_AnalyticalCurveDlg.h
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 // File   : Plot2d_AnalyticalCurveDlg.h
00023 // Author : Roman NIKOLAEV, Open CASCADE S.A.S. (roman.nikolaev@opencascade.com)
00024 
00025 
00026 #ifndef PLOT2D_ANALYTICAL_CURVE_DLG_H
00027 #define PLOT2D_ANALYTICAL_CURVE_DLG_H
00028 
00029 #include "Plot2d.h"
00030 #include "Plot2d_AnalyticalCurve.h"
00031 
00032 #include <QDialog>
00033 #include <QMap>
00034 
00035 class QListWidget;
00036 class QListWidgetItem;
00037 class QGroupBox;
00038 class QLineEdit;
00039 class QCheckBox;
00040 class QComboBox;
00041 class QPushButton;
00042 
00043 class QtxIntSpinBox;
00044 class QtxColorButton;
00045 class QwtPlot;
00046 
00047 class Plot2d_AnalyticalCurve;
00048 class Plot2d_CurveContainer;
00049 class Plot2d_ViewFrame;
00050 
00051 class PLOT2D_EXPORT Plot2d_AnalyticalCurveDlg : public QDialog
00052 { 
00053   Q_OBJECT
00054 
00055   class Updater;
00056   class UpdateLocker;
00057 
00058   enum { ItemExisting, ItemAdded, ItemRemoved };
00059 
00060 public:
00061   Plot2d_AnalyticalCurveDlg( Plot2d_CurveContainer*, QWidget* );
00062   ~Plot2d_AnalyticalCurveDlg();
00063 
00064   void accept();
00065   void reject();
00066 
00067 private:  
00068   
00069   void                  init();
00070   void                  initPropsFromCurve(Plot2d_AnalyticalCurve*);
00071   QListWidgetItem*      selected() const;
00072   Plot2d_AnalyticalCurve* selectedCurve() const;
00073   QListWidgetItem*      getItem(Plot2d_AnalyticalCurve*) const;
00074   bool                  processCurves();
00075   QwtPlot*              getPlot();
00076   int                   propStatus( Plot2d_AnalyticalCurve* = 0, const int def = ItemExisting );
00077   QString               propTitle( Plot2d_AnalyticalCurve* = 0, const QString& def = "" );
00078   bool                  propVisible( Plot2d_AnalyticalCurve* = 0, bool def = true );
00079   QString               propFormula( Plot2d_AnalyticalCurve* = 0, const QString& def = "" );
00080   int                   propIntervals( Plot2d_AnalyticalCurve* = 0, int def = 100 );
00081   Plot2d::MarkerType    propMarkerType( Plot2d_AnalyticalCurve* = 0, Plot2d::MarkerType def = Plot2d::None );
00082   Plot2d::LineType      propLineType( Plot2d_AnalyticalCurve* = 0, Plot2d::LineType def = Plot2d::NoPen );
00083   int                   propLineWidth( Plot2d_AnalyticalCurve* = 0, int def = 0 );
00084   QColor                propColor( Plot2d_AnalyticalCurve* = 0, const QColor& def = QColor() );
00085   bool                  propAutoAssign( Plot2d_AnalyticalCurve* = 0, bool def = true );
00086 
00087 private slots:
00088   void addCurve();
00089   void removeCurve();
00090   void updateCurve();
00091   void updateState();
00092   void selectionChanged();
00093   void help();
00094   void apply();
00095 
00096 private:
00097   typedef QMap <QString, QVariant> CurveProps;
00098   typedef QMap <Plot2d_AnalyticalCurve*, CurveProps> PropMap;
00099 
00100   Plot2d_CurveContainer* myContainer;
00101   PropMap                myProperties;
00102   Updater*               myUpdater;
00103 
00104   QListWidget*           myCurvesList;
00105   QGroupBox*             myCurveParams;
00106   QLineEdit*             myFormula;
00107   QtxIntSpinBox*         myNbIntervals;
00108   QGroupBox*             myCurveProps;
00109   QCheckBox*             myAutoAssign;
00110   QWidget*               myPropsGrp;
00111   QComboBox*             myMarkerType;
00112   QComboBox*             myLineType;
00113   QtxIntSpinBox*         myLineWidth;
00114   QtxColorButton*        myColor;
00115   QPushButton*           myAddButton;
00116   QPushButton*           myRemoveButton;
00117 };
00118 
00119 class Plot2d_AnalyticalCurveDlg::Updater : public QObject
00120 {
00121   Q_OBJECT
00122 public:
00123   Updater( QWidget* parent );
00124   ~Updater();
00125 signals:
00126   void update();
00127 };
00128 
00129 #endif //PLOT2D_ANALYTICAL_CURVE_DLG_H