Version: 9.16.0
Plot2d_PlotItems.h
Go to the documentation of this file.
1// Copyright (C) 2007-2026 CEA, EDF, 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{
40public:
41 enum YAxisIdentifierMode { IM_None = 0, IM_Left, IM_Right };
42
43public:
45 virtual ~Plot2d_QwtLegendLabel();
46
47public:
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
58protected:
59 virtual void drawText( QPainter*, const QRectF& );
60 virtual void paintEvent( QPaintEvent* );
61
62private:
63
64private:
71 QwtSymbol* mySymbol;
73 QPen myPen;
74};
75
77public:
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
90private:
93 QwtSymbol* myLegendSymbol;
94};
95
97{
98public:
100 virtual ~Plot2d_QwtPlotCurve();
101
102public:
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
114protected:
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
123private:
126
129};
130
132{
133public:
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
161protected:
162 virtual void drawBar( QPainter*, Qt::Orientation, const QRect& ) const;
163
164private:
165 void init();
166
167private:
169 QwtIntervalSeriesData myData;
170 QColor myColor;
172};
173
175{
176public:
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
184 virtual void updateLegend( const QwtPlotItem *,
185 const QList<QwtLegendData> & );
186 virtual void draw( QPainter*, const QwtScaleMap&,
187 const QwtScaleMap&, const QRectF& ) const;
188
189 virtual void itemChanged();
190
191 virtual QwtGraphic legendIcon( int index, const QSizeF & ) const;
192
193 void setCrossItems( bool theCross );
194 bool isCrossItems() const;
195
196protected:
197 void drawRectAndLowers( QPainter*, Qt::Orientation,
198 const QRect& ) const;
199 int getCrossedTop( const QRect& ) const;
200
201protected:
204};
205
207{
208public:
209 explicit Plot2d_QwtLegend( QWidget *parent = NULL );
210 virtual ~Plot2d_QwtLegend();
211
212protected:
213 virtual QWidget* createWidget( const QwtLegendData& ) const;
214};
215
216#endif // PLOT2D_PLOTITEMS_H
void drawText(GLuint theTextList, const char *theText, GLdouble thePosition[3], GLfloat theColor[3])
Definition: OCCViewer_Trihedron.cxx:161
#define PLOT2D_EXPORT
Definition: Plot2d.h:36
Orientation
Orientation.
Definition: SalomePyQt.h:147
Axis
Definition: SalomePyQt.h:181
@ yLeft
Definition: SalomePyQt.h:182
Definition: Plot2d_PlotItems.h:175
bool myCrossed
Definition: Plot2d_PlotItems.h:203
QList< QRect > myBarItems
Definition: Plot2d_PlotItems.h:202
Definition: Plot2d_PlotItems.h:132
QwtIntervalSeriesData myData
Definition: Plot2d_PlotItems.h:169
int myAttributes
Definition: Plot2d_PlotItems.h:168
QColor myColor
Definition: Plot2d_PlotItems.h:170
double myReference
Definition: Plot2d_PlotItems.h:171
HistogramAttribute
Definition: Plot2d_PlotItems.h:135
Definition: Plot2d_PlotItems.h:39
bool myIsSelected
Definition: Plot2d_PlotItems.h:70
YAxisIdentifierMode
Definition: Plot2d_PlotItems.h:41
@ IM_Left
Definition: Plot2d_PlotItems.h:41
QwtSymbol * mySymbol
Definition: Plot2d_PlotItems.h:71
int mySymbolType
Definition: Plot2d_PlotItems.h:72
QPixmap myYAxisRightIcon
Definition: Plot2d_PlotItems.h:67
int mySpacingCollapsed
Definition: Plot2d_PlotItems.h:68
int mySpacingExpanded
Definition: Plot2d_PlotItems.h:69
QPen myPen
Definition: Plot2d_PlotItems.h:73
QPixmap myYAxisLeftIcon
Definition: Plot2d_PlotItems.h:66
int myYAxisIdentifierMode
Definition: Plot2d_PlotItems.h:65
Definition: Plot2d_PlotItems.h:207
Definition: Plot2d_PlotItems.cxx:285
Definition: Plot2d_PlotItems.h:97
Plot2d_DeviationData * myDeviationData
Definition: Plot2d_PlotItems.h:128
bool myYAxisIdentifierEnabled
Definition: Plot2d_PlotItems.h:125
QwtPlot::Axis myYAxis
Definition: Plot2d_PlotItems.h:124
Definition: Plot2d_PlotItems.h:76
QPen myLegendPen
Definition: Plot2d_PlotItems.h:92
bool myIsSelected
Definition: Plot2d_PlotItems.h:91
QwtSymbol * myLegendSymbol
Definition: Plot2d_PlotItems.h:93
Quantity_Color color(const QColor &)
Convert QColor object to Quantity_Color object.
Definition: OCCViewer.cxx:28