2 * KmPlot - a math. function plotter for the KDE-Desktop
4 * Copyright (C) 1998, 1999 Klaus-Dieter M�ler
5 * 2000, 2002 kd.moeller@t-online.de
7 * This file is part of the KDE Project.
8 * KmPlot is part of the KDE-EDU Project.
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 * @brief Contains the CDiagr class. */
28 #ifndef diagr_included
29 #define diagr_included
39 /// Some abbreviations for horizontal and vertical lines.
41 #define Lineh(x1, y, x2) drawLine(x1, y, x2, y)
42 #define Linev(x, y1, y2) drawLine(x, y1, x, y2)
49 #define GRID_CROSSES 2
53 /** @short This class manages the core drawing of the axes and the grid. */
57 /// Contructor. Members are set to initial values.
60 /// Nothing to do for the destructor.
63 /// Sets all members to current values.
64 void Create( QPoint Ref
,
66 double xmin
, double xmax
,
67 double ymin
, double ymax
);
68 /// Sets the current values for the scaling factors
69 void Skal( double ex
, double ey
);
70 /// Draws all requested parts of the diagram (axes, labels, grid e.g.)
71 void Plot( QPainter
* pDC
);
72 /// Returns the rectangle around the core of the plot area.
73 QRect
GetPlotArea() { return PlotArea
; }
74 /// Returns the rectangle for the frame around the plot. Extra frame is bigger.
75 QRect
GetFrame() { return m_frame
; }
77 /** @name Transformations */
79 /// These functions convert real coordinates to pixel coordinates and vice versa.
86 /** @name Style options
87 * These members hold the current options for line widths and colors
90 QRgb frameColor
; ///< color of the border frame
91 QRgb axesColor
; ///< color of the axes
92 QRgb gridColor
; ///< color of the grid
94 uint borderThickness
, ///< current line width for the border frame
95 axesLineWidth
, ///< current line width for the axes
96 gridLineWidth
, ///< current line width for the grid
97 ticWidth
, ///< current line width for the tics
98 ticLength
, ///< current length of the tic lines
100 xclipflg
, ///< clipflg is set to 1 if the plot is out of the plot aerea.
101 yclipflg
; ///< clipflg is set to 1 if the plot is out of the plot aerea.
106 /// Draw the coordinate axes.
107 void drawAxes(QPainter
*);
109 void drawGrid( QPainter
* );
111 void drawLabels(QPainter
*);
112 /// Current grid style.
117 double xmin
, xmax
, ymin
, ymax
;
124 /// Axes tic distance.
128 ///Position of the first tic.
132 /// Screen coordinates of the coordinate system origin.
136 /// Transformation factors.
141 QRect PlotArea
; ///< plot area
142 QRect m_frame
; ///< frame around the plot
145 #endif // diagr_included