Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Plot2d_PlotItems.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_HistogramItem.h
23 // Author : Natalia ERMOLAEVA, Open CASCADE S.A.S. (natalia.donis@opencascade.com)
24 
25 #ifndef PLOT2D_PLOTITEMS_H
26 #define PLOT2D_PLOTITEMS_H
27 
28 #include "Plot2d.h"
29 
30 #include <qwt_legend_label.h>
31 #include <qwt_legend.h>
32 #include <qwt_plot_item.h>
33 #include <qwt_plot_curve.h>
34 #include <qwt_plot.h>
35 #include <qwt_series_data.h>
36 #include <qwt_compat.h>
37 
39 {
40 public:
41  enum YAxisIdentifierMode { IM_None = 0, IM_Left, IM_Right };
42 
43 public:
45  virtual ~Plot2d_QwtLegendLabel();
46 
47 public:
48  void setYAxisIdentifierMode( const int );
49  void updateHighlit();
50  void setSelected( const bool on );
51  bool isSelected() const;
52  QColor getColorFromPalette( QPalette::ColorRole role );
53  void drawIdentifier( QPainter*, const QRect& );
54  void setSymbol( const QwtSymbol* );
55  void setSymbolType( const int );
56  void setPen( const QPen& );
57 
58 protected:
59  virtual void drawText( QPainter*, const QRectF& );
60  virtual void paintEvent( QPaintEvent* );
61 
62 private:
63 
64 private:
66  QPixmap myYAxisLeftIcon;
71  QwtSymbol* mySymbol;
73  QPen myPen;
74 };
75 
77 public:
80 
81  void setSelected( const bool );
82  bool isSelected() const;
83 
84  void setLegendPen( const QPen& );
85  QPen legendPen() const;
86 
87  void setLegendSymbol( const QwtSymbol* );
88  QwtSymbol* legendSymbol() const;
89 
90 private:
93  QwtSymbol* myLegendSymbol;
94 };
95 
97 {
98 public:
100  virtual ~Plot2d_QwtPlotCurve();
101 
102 public:
103  virtual void setYAxisIdentifierEnabled( const bool );
104  virtual void drawSeries( QPainter* p,
105  const QwtScaleMap& xMap,
106  const QwtScaleMap& yMap,
107  const QRectF& canvasRect,
108  int from, int to) const;
109 
110  void setDeviationData( const double* min, const double* max, const QList<int>& idx );
111  bool hasDeviationData() const;
112  void clearDeviationData();
113 
114 protected:
115  virtual void updateLegend( const QwtPlotItem*,
116  const QList<QwtLegendData>& );
117  virtual void itemChanged();
118 
119  QColor deviationMarkerColor() const;
120  int deviationMarkerLineWidth() const;
121  int deviationMarkerTickSize() const;
122 
123 private:
126 
129 };
130 
132 {
133 public:
135  {
136  Auto = 0,
137  Xfy = 1
138  };
139 
140  explicit Plot2d_HistogramQwtItem( const QString& = QString() );
141  explicit Plot2d_HistogramQwtItem( const QwtText& );
142  virtual ~Plot2d_HistogramQwtItem();
143 
144  void setData( const QwtIntervalSeriesData& );
145  const QwtIntervalSeriesData& data() const;
146 
147  void setColor( const QColor& );
148  QColor color() const;
149 
150  virtual QwtDoubleRect boundingRect() const;
151  virtual int rtti() const;
152  virtual void draw( QPainter*, const QwtScaleMap&,
153  const QwtScaleMap&, const QRectF& ) const;
154 
155  void setBaseline( double );
156  double baseline() const;
157 
158  void setHistogramAttribute( HistogramAttribute, bool = true );
159  bool testHistogramAttribute( HistogramAttribute ) const;
160 
161 protected:
162  virtual void drawBar( QPainter*, Qt::Orientation, const QRect& ) const;
163 
164 private:
165  void init();
166 
167 private:
169  QwtIntervalSeriesData myData;
170  QColor myColor;
171  double myReference;
172 };
173 
175 {
176 public:
177  explicit Plot2d_HistogramItem( const QString& = QString() );
178  explicit Plot2d_HistogramItem( const QwtText& );
179  virtual ~Plot2d_HistogramItem();
180 
181  QList<QRect> getBars() const;
182 
183  virtual void updateLegend( QwtPlotItem*,
185  virtual void draw( QPainter*, const QwtScaleMap&,
186  const QwtScaleMap&, const QRectF& ) const;
187 
188  void setCrossItems( bool theCross );
189  bool isCrossItems() const;
190 
191 protected:
192  void drawRectAndLowers( QPainter*, Qt::Orientation,
193  const QRect& ) const;
194  int getCrossedTop( const QRect& ) const;
195 
196 protected:
198  bool myCrossed;
199 };
200 
202 {
203 public:
204  explicit Plot2d_QwtLegend( QWidget *parent = NULL );
205  virtual ~Plot2d_QwtLegend();
206 
207 protected:
208  virtual QWidget* createWidget( const QwtLegendData& ) const;
209 };
210 
211 #endif // PLOT2D_PLOTITEMS_H