Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Plot2d_Object.h
Go to the documentation of this file.
1 // Copyright (C) 2007-2016 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_Object.h
23 // Author : Natalia ERMOLAEVA, Open CASCADE S.A.S. (natalia.donis@opencascade.com)
24 //
25 
26 #ifndef PLOT2D_OBJECT_H
27 #define PLOT2D_OBJECT_H
28 
29 #include "Plot2d.h"
30 
31 #include <QList>
32 #include <qwt_plot.h>
33 
34 
36 {
37 public:
38  Plot2d_Object();
39  Plot2d_Object( const Plot2d_Object& );
40 
41  virtual ~Plot2d_Object();
43 
44  virtual int rtti() = 0;
45  virtual QwtPlotItem* createPlotItem() = 0;
46  virtual void autoFill( const QwtPlot* );
47  virtual void updatePlotItem( QwtPlotItem* );
48 
49  virtual QString getTableTitle() const;
50 
51  void setHorTitle( const QString& );
52  QString getHorTitle() const;
53  void setVerTitle( const QString& );
54  QString getVerTitle() const;
55 
56  void setHorUnits( const QString& );
57  QString getHorUnits() const;
58  void setVerUnits( const QString& );
59  QString getVerUnits() const;
60 
61  void setName( const QString& );
62  QString getName() const;
63 
64  void setScale( double );
65  double getScale() const;
66 
67  void addPoint( double, double, const QString& = QString() );
68  void addPoint( const Plot2d_Point& );
69  void insertPoint( int, double, double, const QString& = QString() );
70  void insertPoint( int, const Plot2d_Point& );
71  void deletePoint( int );
72  void clearAllPoints();
73  pointList getPointList() const;
74  void setPointList( const pointList& points );
75  Plot2d_Point& getPoint(int index);
76 
77  void setData( const double*, const double*,
78  long, const QStringList& = QStringList() );
79  double* horData() const;
80  double* verData() const;
81  long getData( double**, double** ) const;
82 
83  void setText( const int, const QString& );
84  QString text( const int ) const;
85 
86  int nbPoints() const;
87  bool isEmpty() const;
88 
89  void setAutoAssign( bool );
90  bool isAutoAssign() const;
91 
92  void setXAxis( QwtPlot::Axis );
93  QwtPlot::Axis getXAxis() const;
94  void setYAxis( QwtPlot::Axis );
95  QwtPlot::Axis getYAxis() const;
96 
97  // Protection against QwtObject::drawLines() bug in Qwt 0.4.x:
98  // it crashes if switched to X/Y logarithmic mode, when one or more points have
99  // non-positive X/Y coordinate
100  virtual double getMinX() const;
101  virtual double getMaxX() const;
102  virtual double getMinY() const;
103  virtual double getMaxY() const;
104 
105  void setSelected(const bool);
106  bool isSelected() const;
107 
108  static void setSelectionColor(const QColor& c);
109  static QColor selectionColor();
110 
111  static void setHighlightedLegendTextColor(const QColor& c);
112  static QColor highlightedLegendTextColor();
113 
114 protected:
116  QString myHorTitle;
117  QString myVerTitle;
118  QString myHorUnits;
119  QString myVerUnits;
120  QString myName;
123 
124  double myScale;
125 
128 
129  private:
130  static QColor mySelectionColor;
132 };
133 
135 
136 #endif