]> SALOME platform Git repositories - modules/gui.git/blob - src/Plot2d/Plot2d.h
Salome HOME
INT PAL 0052942: Error of geompy.MakeCurveParametric() is printed to a terminal inste...
[modules/gui.git] / src / Plot2d / Plot2d.h
1 // Copyright (C) 2007-2015  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
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
44 class QPainter;
45 class 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
52 struct PLOT2D_EXPORT Plot2d_Point
53 {
54   double x;
55   double y;
56   double* deviationPtr;
57   QString text;
58   Plot2d_Point();
59   Plot2d_Point( double theX, double theY, const QString& theText = QString() );
60   ~Plot2d_Point();
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
69 typedef QList<Plot2d_Point> pointList;
70
71
72 namespace Plot2d
73 {
74   typedef enum { None, 
75                  Circle,  
76                  Rectangle,
77                  Diamond,
78                  DTriangle,
79                  UTriangle,
80                  LTriangle,
81                  RTriangle,
82                  Cross,
83                  XCross
84   } MarkerType;
85
86   typedef enum {
87     NoPen,
88     Solid, 
89     Dash, 
90     Dot, 
91     DashDot, 
92     DashDotDot
93   } LineType;
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&,
118                                        MarkerType = Circle,
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,
124                                        MarkerType = Circle,
125                                        const QColor& = Qt::black );
126   
127   QPixmap                  markerIcon( const QSize&, const QColor&, 
128                                       Plot2d::MarkerType );
129
130   QPixmap                  lineIcon( const QSize&,  const QColor&, 
131                                      Plot2d::LineType );
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