Version: 9.16.0
Plot2d.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
23// File : Plot2d.h
24// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
25//
26#ifndef PLOT2D_H
27#define PLOT2D_H
28
29#ifdef WIN32
30# if defined PLOT2D_EXPORTS || defined Plot2d_EXPORTS
31# define PLOT2D_EXPORT __declspec(dllexport)
32# else
33# define PLOT2D_EXPORT __declspec(dllimport)
34# endif
35#else
36# define PLOT2D_EXPORT
37#endif
38
39#include <qwt_symbol.h>
40#include <QString>
41#include <QColor>
42#include <QPixmap>
43
44class QPainter;
45class QwtPlot;
46
47// Properties on the deviation marker.
48#define PLOT2D_DEVIATION_COLOR "DEVIATION_COLOR"
49#define PLOT2D_DEVIATION_LW "DEVIATION_LW"
50#define PLOT2D_DEVIATION_TS "DEVIATION_TS"
51
53{
54 double x;
55 double y;
56 double* deviationPtr;
57 QString text;
59 Plot2d_Point( double theX, double theY, const QString& theText = QString() );
61 bool deviation(double& min, double& max) const;
62 bool hasDeviation() const;
63 void setDeviation(double min, double max);
64 void clearDeviation();
65 bool minDeviation(double& min) const;
66 bool maxDeviation(double& max) const;
67};
68
70
71
72namespace Plot2d
73{
74 typedef enum { None,
83 XCross
85
86 typedef enum {
94
95 QwtSymbol::Style plot2qwtMarker( MarkerType );
96 MarkerType qwt2plotMarker( QwtSymbol::Style );
97
98 Qt::PenStyle plot2qwtLine( LineType );
99 LineType qwt2plotLine( Qt::PenStyle );
100
101 void drawLine( QPainter*, const QPoint&, const QPoint&,
102 Qt::PenStyle = Qt::SolidLine,
103 const QColor& = Qt::black, int = 0 );
104 void drawLine( QPainter*, const QPoint&, const QPoint&,
105 LineType = Solid,
106 const QColor& = Qt::black, int = 0 );
107 void drawLine( QPainter*, int, int, int, int,
108 Qt::PenStyle = Qt::SolidLine,
109 const QColor& = Qt::black, int = 0 );
110 void drawLine( QPainter*, int, int, int, int,
111 LineType = Solid,
112 const QColor& = Qt::black, int = 0 );
113
114 void drawMarker( QPainter*, const QPoint&, const QRect&,
115 QwtSymbol::Style = QwtSymbol::Ellipse,
116 const QColor& = Qt::black );
117 void drawMarker( QPainter*, const QPoint&, const QRect&,
119 const QColor& = Qt::black );
120 void drawMarker( QPainter*, int, int, int, int,
121 QwtSymbol::Style = QwtSymbol::Ellipse,
122 const QColor& = Qt::black );
123 void drawMarker( QPainter*, int, int, int, int,
125 const QColor& = Qt::black );
126
127 QPixmap markerIcon( const QSize&, const QColor&,
129
130 QPixmap lineIcon( const QSize&, const QColor&,
132
133 void getNextMarker( const int rtti, const QwtPlot*, QwtSymbol::Style&,
134 QColor&, Qt::PenStyle& );
135
136 bool existMarker( const int rtti , const QwtPlot*, const QwtSymbol::Style,
137 const QColor&, const Qt::PenStyle );
138
139
140 bool closeColors( const QColor&,
141 const QColor&,
142 int distance = -1 );
143
144}
145
146#if defined WIN32
147# pragma warning ( disable: 4251 )
148#endif
149
150#endif // PLOT2D_H
QList< Plot2d_Point > pointList
Definition: Plot2d.h:69
#define PLOT2D_EXPORT
Definition: Plot2d.h:36
Definition: Plot2d.h:73
QPixmap lineIcon(const QSize &, const QColor &, Plot2d::LineType)
Create icon pixmap according to the line type.
Definition: Plot2d.cxx:477
LineType qwt2plotLine(Qt::PenStyle)
Convert Qt/Qwt line type to Plot2d line type.
Definition: Plot2d.cxx:225
void getNextMarker(const int rtti, const QwtPlot *, QwtSymbol::Style &, QColor &, Qt::PenStyle &)
Definition: Plot2d.cxx:491
MarkerType qwt2plotMarker(QwtSymbol::Style)
Convert Qwt marker type to Plot2d marker type.
Definition: Plot2d.cxx:165
void drawMarker(QPainter *, const QPoint &, const QRect &, QwtSymbol::Style=QwtSymbol::Ellipse, const QColor &=Qt::black)
Draw marker.
Definition: Plot2d.cxx:325
QwtSymbol::Style plot2qwtMarker(MarkerType)
Convert Plot2d marker type to Qwt marker type.
Definition: Plot2d.cxx:131
bool closeColors(const QColor &, const QColor &, int distance=-1)
Definition: Plot2d.cxx:548
QPixmap markerIcon(const QSize &, const QColor &, Plot2d::MarkerType)
Create icon pixmap according to the marker type.
Definition: Plot2d.cxx:459
MarkerType
Definition: Plot2d.h:74
@ RTriangle
Definition: Plot2d.h:81
@ LTriangle
Definition: Plot2d.h:80
@ DTriangle
Definition: Plot2d.h:78
@ UTriangle
Definition: Plot2d.h:79
@ Rectangle
Definition: Plot2d.h:76
@ XCross
Definition: Plot2d.h:83
@ Circle
Definition: Plot2d.h:75
@ Diamond
Definition: Plot2d.h:77
@ None
Definition: Plot2d.h:74
@ Cross
Definition: Plot2d.h:82
LineType
Definition: Plot2d.h:86
@ DashDotDot
Definition: Plot2d.h:92
@ NoPen
Definition: Plot2d.h:87
@ Dot
Definition: Plot2d.h:90
@ Dash
Definition: Plot2d.h:89
@ DashDot
Definition: Plot2d.h:91
@ Solid
Definition: Plot2d.h:88
void drawLine(QPainter *, const QPoint &, const QPoint &, Qt::PenStyle=Qt::SolidLine, const QColor &=Qt::black, int=0)
Draw line.
Definition: Plot2d.cxx:255
Qt::PenStyle plot2qwtLine(LineType)
Convert Plot2d line type to Qt/Qwt line type.
Definition: Plot2d.cxx:199
bool existMarker(const int rtti, const QwtPlot *, const QwtSymbol::Style, const QColor &, const Qt::PenStyle)
Definition: Plot2d.cxx:514
std::size_t distance(const Iterator &theStartIt, const Iterator &theFinalIt)
Compensates lack of std::distance(..) prior to C++17. Does not check whether the iterators iterate th...
Definition: SUIT_extensions.h:38
Definition: Plot2d.h:53
double x
Definition: Plot2d.h:54
QString text
Definition: Plot2d.h:57
double y
Definition: Plot2d.h:55
double * deviationPtr
Definition: Plot2d.h:56