2018-12-19 00:13:18 +08:00
|
|
|
/*
|
2019-01-12 23:01:55 +08:00
|
|
|
Copyright (c) 2008-2019 Jan W. Krieger (<jan@jkrieger.de>, <j.krieger@dkfz.de>)
|
2018-12-19 00:13:18 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This software is free software: you can redistribute it and/or modify
|
2019-02-08 00:24:46 +08:00
|
|
|
it under the terms of the GNU Lesser General Public License as published by
|
|
|
|
the Free Software Foundation, either version 2.1 of the License, or
|
2018-12-19 00:13:18 +08:00
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2019-02-08 00:24:46 +08:00
|
|
|
GNU Lesser General Public License for more details.
|
2018-12-19 00:13:18 +08:00
|
|
|
|
2019-02-08 00:24:46 +08:00
|
|
|
You should have received a copy of the GNU Lesser General Public License
|
2018-12-19 00:13:18 +08:00
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef JKQTPDRAWINGTOOLS_H_INCLUDED
|
|
|
|
#define JKQTPDRAWINGTOOLS_H_INCLUDED
|
|
|
|
#include "jkqtplottertools/jkqtp_imexport.h"
|
|
|
|
#include "jkqtplottertools/jkqtptools.h"
|
|
|
|
#include <QPaintDevice>
|
|
|
|
|
|
|
|
class JKQTPEnhancedPainter; // forward
|
|
|
|
|
2019-02-08 00:24:46 +08:00
|
|
|
|
|
|
|
/*! \brief tool class with static values used by JKQTPlotter/JKQTBasePlotter
|
|
|
|
\ingroup jkqtptools_drawing
|
|
|
|
*/
|
2019-05-13 04:22:48 +08:00
|
|
|
JKQTP_LIB_EXPORT struct JKQTPlotterDrawingTools {
|
2019-02-08 00:24:46 +08:00
|
|
|
/** \brief smallest linewidth any line in JKQTPlotter/JKQTBasePlotter may have
|
|
|
|
*/
|
|
|
|
static const double ABS_MIN_LINEWIDTH;
|
|
|
|
};
|
|
|
|
|
2018-12-19 00:13:18 +08:00
|
|
|
/*! \brief plot the specified symbol at pixel position x,y
|
2019-01-13 01:53:16 +08:00
|
|
|
\ingroup jkqtptools_drawing
|
2018-12-19 00:13:18 +08:00
|
|
|
|
2019-01-26 20:00:40 +08:00
|
|
|
\param painter the <a href="http://doc.qt.io/qt-5/qpainter.html">QPainter</a> to draw to
|
2018-12-19 00:13:18 +08:00
|
|
|
\param x x-coordinate of the symbol center
|
|
|
|
\param y y-coordinate of the symbol center
|
2019-01-20 17:49:29 +08:00
|
|
|
\param symbol type of the symbol to plot, see JKQTPGraphSymbols
|
2018-12-19 00:13:18 +08:00
|
|
|
\param size size (width/height) of the symbol around (\a x , \a y)
|
|
|
|
\param symbolLineWidth width of the lines used to draw the symbol
|
|
|
|
\param color color of the symbol lines
|
|
|
|
\param fillColor color of the symbol filling
|
|
|
|
*/
|
2019-02-03 21:04:48 +08:00
|
|
|
JKQTP_LIB_EXPORT void JKQTPPlotSymbol(JKQTPEnhancedPainter& painter, double x, double y, JKQTPGraphSymbols symbol, double size, double symbolLineWidth, QColor color, QColor fillColor);
|
2018-12-19 00:13:18 +08:00
|
|
|
|
|
|
|
/*! \brief plot the specified symbol at pixel position x,y
|
2019-01-13 01:53:16 +08:00
|
|
|
\ingroup jkqtptools_drawing
|
2018-12-19 00:13:18 +08:00
|
|
|
|
|
|
|
\param paintDevice the paint device to draw on
|
|
|
|
\param x x-coordinate of the symbol center
|
|
|
|
\param y y-coordinate of the symbol center
|
2019-01-20 17:49:29 +08:00
|
|
|
\param symbol type of the symbol to plot, see JKQTPGraphSymbols
|
2018-12-19 00:13:18 +08:00
|
|
|
\param size size (width/height) of the symbol around (\a x , \a y)
|
|
|
|
\param symbolLineWidth width of the lines used to draw the symbol
|
|
|
|
\param color color of the symbol lines
|
|
|
|
\param fillColor color of the symbol filling
|
|
|
|
*/
|
2019-02-03 21:04:48 +08:00
|
|
|
JKQTP_LIB_EXPORT void JKQTPPlotSymbol(QPaintDevice& paintDevice, double x, double y, JKQTPGraphSymbols symbol, double size, double symbolLineWidth, QColor color, QColor fillColor);
|
2018-12-19 00:13:18 +08:00
|
|
|
|
|
|
|
|
|
|
|
/*! \brief plot an arrow between positions (x1,y1) and (x2,y2)
|
2019-01-13 01:53:16 +08:00
|
|
|
\ingroup jkqtptools_drawing
|
2018-12-19 00:13:18 +08:00
|
|
|
|
2019-01-26 20:00:40 +08:00
|
|
|
\param painter the <a href="http://doc.qt.io/qt-5/qpainter.html">QPainter</a> to draw to
|
2018-12-19 00:13:18 +08:00
|
|
|
\param x1 first x-coordinate of the arrow
|
|
|
|
\param y1 first y-coordinate of the arrow
|
|
|
|
\param x2 second x-coordinate of the arrow
|
|
|
|
\param y2 second y-coordinate of the arrow
|
2019-01-20 17:49:29 +08:00
|
|
|
\param symbol type of the symbol to plot, see JKQTPGraphSymbols
|
2018-12-19 00:13:18 +08:00
|
|
|
\param size size (width/height) of the symbol around (\a x , \a y)
|
|
|
|
\param symbolLineWidth width of the lines used to draw the symbol
|
|
|
|
\param color color of the symbol lines
|
|
|
|
\param fillColor color of the symbol filling
|
|
|
|
*/
|
2019-02-03 21:04:48 +08:00
|
|
|
//JKQTP_LIB_EXPORT void JKQTPPlotArrow(JKQTPEnhancedPainter& painter, int x, int y, JKQTPGraphSymbols symbol, double size, double symbolLineWidth, QColor color, QColor fillColor);
|
2018-12-19 00:13:18 +08:00
|
|
|
|
|
|
|
|
|
|
|
/*! \brief draw an ellipse without setting pen or brush, or saving the painter!
|
2019-01-13 01:53:16 +08:00
|
|
|
\ingroup jkqtptools_drawing
|
2018-12-19 00:13:18 +08:00
|
|
|
|
|
|
|
\return a QVector<QPointF> with points that may be used for drawing
|
|
|
|
\param x center of ellipse (x-coordinate)
|
|
|
|
\param y center of ellipse (y-coordinate)
|
|
|
|
\param a half axis in x-direction
|
|
|
|
\param b half axis in y-direction
|
|
|
|
\param angle_start starting angle of ellipse section
|
|
|
|
\param angle_end ending angle of ellipse section
|
|
|
|
\param alpha rotation angle of ellipse
|
|
|
|
\param controlPoints the number of points to use for drawing
|
|
|
|
\param[out] x_start first point of ellipse
|
|
|
|
\param[out] x_end last point of ellipse
|
|
|
|
|
|
|
|
\note all angles are given in degrees [0..360]
|
|
|
|
*/
|
2019-02-03 21:04:48 +08:00
|
|
|
JKQTP_LIB_EXPORT QVector<QPointF> JKQTPDrawEllipse(double x, double y, double a, double b, double angle_start=0, double angle_end=360, double alpha=0, int controlPoints=180, QPointF* x_start=nullptr, QPointF* x_end=nullptr);
|
2018-12-19 00:13:18 +08:00
|
|
|
|
2019-05-06 01:31:20 +08:00
|
|
|
/*! \brief draw a tooltip, using the current brush and pen of the provided painter
|
|
|
|
\ingroup jkqtptools_drawing
|
|
|
|
|
|
|
|
\param painter JKQTPEnhancedPainter to use for painting
|
|
|
|
\param x x-coordinate of position the tooltip points to
|
|
|
|
\param y y-coordinate of position the tooltip points to
|
|
|
|
\param rect rectangle of the main tooltip area
|
|
|
|
*/
|
|
|
|
JKQTP_LIB_EXPORT void JKQTPDrawTooltip(JKQTPEnhancedPainter& painter, double x, double y, const QRectF& rect);
|
|
|
|
|
2018-12-19 00:13:18 +08:00
|
|
|
|
|
|
|
#endif // JKQTPDRAWINGTOOLS_H_INCLUDED
|