1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // File : Plot2d_Object.h
23 // Author : Natalia ERMOLAEVA, Open CASCADE S.A.S. (natalia.donis@opencascade.com)
26 #ifndef PLOT2D_OBJECT_H
27 #define PLOT2D_OBJECT_H
35 class PLOT2D_EXPORT Plot2d_Object
39 Plot2d_Object( const Plot2d_Object& );
41 virtual ~Plot2d_Object();
42 Plot2d_Object& operator= ( const Plot2d_Object& );
44 virtual int rtti() = 0;
45 virtual QwtPlotItem* createPlotItem() = 0;
46 virtual void autoFill( const QwtPlot* );
47 virtual void updatePlotItem( QwtPlotItem* );
49 virtual QString getTableTitle() const;
51 void setHorTitle( const QString& );
52 QString getHorTitle() const;
53 void setVerTitle( const QString& );
54 QString getVerTitle() const;
56 void setHorUnits( const QString& );
57 QString getHorUnits() const;
58 void setVerUnits( const QString& );
59 QString getVerUnits() const;
61 void setName( const QString& );
62 QString getName() const;
64 void setScale( double );
65 double getScale() const;
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);
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;
83 void setText( const int, const QString& );
84 QString text( const int ) const;
89 void setAutoAssign( bool );
90 bool isAutoAssign() const;
92 void setXAxis( QwtPlot::Axis );
93 QwtPlot::Axis getXAxis() const;
94 void setYAxis( QwtPlot::Axis );
95 QwtPlot::Axis getYAxis() const;
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;
105 void setSelected(const bool);
106 bool isSelected() const;
108 static void initColors();
110 static void setSelectionColor(const QColor& c);
111 static QColor selectionColor();
113 static void setHighlightedLegendTextColor(const QColor& c);
114 static QColor highlightedLegendTextColor();
123 QwtPlot::Axis myXAxis;
124 QwtPlot::Axis myYAxis;
132 static QColor mySelectionColor; //!< Color of the selected curve or histogram
133 static QColor myHighlightedLegendTextColor; //!< Color of the selected legend item font
136 typedef QList<Plot2d_Object*> objectList;