2020-08-26 16:36:07 +08:00
|
|
|
/*
|
|
|
|
Copyright (c) 2008-2020 Jan W. Krieger (<jan@jkrieger.de>)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This software is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU Lesser General Public License (LGPL) as published by
|
|
|
|
the Free Software Foundation, either version 2.1 of the License, or
|
|
|
|
(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
|
|
|
|
GNU Lesser General Public License (LGPL) for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public License (LGPL)
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include <QString>
|
|
|
|
#include <QPainter>
|
|
|
|
#include <QPair>
|
|
|
|
#include "jkqtplotter/graphs/jkqtpscatter.h"
|
|
|
|
#include "jkqtplotter/jkqtpgraphsbasestylingmixins.h"
|
|
|
|
#include "jkqtplotter/jkqtptools.h"
|
|
|
|
#include "jkqtplotter/jkqtplotter_imexport.h"
|
|
|
|
#include "jkqtmathtext/jkqtmathtext.h"
|
|
|
|
|
|
|
|
#ifndef jkqtpgeobase_H_INCLUDED
|
|
|
|
#define jkqtpgeobase_H_INCLUDED
|
|
|
|
|
|
|
|
|
2020-09-21 19:15:57 +08:00
|
|
|
/*! \brief This JKQTPGeometricPlotElement is used as base class for geometric drawing
|
2020-08-26 16:36:07 +08:00
|
|
|
elements that only consist of lines (i.e. no filling of any kind is done)
|
|
|
|
\ingroup jkqtplotter_geoplots
|
|
|
|
|
|
|
|
*/
|
2020-09-21 19:15:57 +08:00
|
|
|
class JKQTPLOTTER_LIB_EXPORT JKQTPGeoBaseLine: public JKQTPGeometricPlotElement, public JKQTPGraphLineStyleMixin {
|
2020-08-26 16:36:07 +08:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
/*! \brief class contructor
|
|
|
|
|
|
|
|
\param parent the parent plotter object
|
2020-09-26 21:58:58 +08:00
|
|
|
\param drawMode how to draw te element (as geometric or graphic element)
|
2020-08-26 16:36:07 +08:00
|
|
|
*/
|
- improved: geometric objects now use an adaptive drawing algorithm to represent curves (before e.g. ellipses were always separated into a fixed number of line-segments)
- improved: constructors and access functions for several geometric objects (e.g. more constructors, additional functions to retrieve parameters in diferent forms, iterators for polygons, ...)
- new: all geometric objects can either be drawn as graphic element (i.e. lines are straight line, even on non-linear axes), or as mathematical curve (i.e. on non-linear axes, lines become the appropriate curve representing the linear function, connecting the given start/end-points). The only exceptions are ellipses (and the derived arcs,pies,chords), which are always drawn as mathematical curves
2020-09-04 05:08:52 +08:00
|
|
|
explicit JKQTPGeoBaseLine(JKQTBasePlotter* parent, DrawMode drawMode=DrawAsGraphicElement);
|
2020-08-26 16:36:07 +08:00
|
|
|
|
2020-09-26 21:58:58 +08:00
|
|
|
/** \brief set several of the style properties with one call */
|
|
|
|
virtual void setStyle(QColor color, double lineWidth);
|
|
|
|
/** \brief set several of the style properties with one call */
|
|
|
|
virtual void setStyle(QColor color, double lineWidth, Qt::PenStyle style);
|
|
|
|
/** \brief set several of the style properties with one call */
|
|
|
|
virtual void setStyle(QColor color, Qt::PenStyle style);
|
|
|
|
|
2020-08-26 16:36:07 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** \brief sets the alpha-channel of the \a color (i.e. its transparency) */
|
|
|
|
virtual void setAlpha(float alpha);
|
|
|
|
/** \brief set line color */
|
|
|
|
virtual void setColor(QColor c);
|
|
|
|
|
|
|
|
/** \brief plots a key marker inside the specified rectangle \a rect */
|
|
|
|
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override;
|
|
|
|
/** \brief returns the color to be used for the key label */
|
|
|
|
virtual QColor getKeyLabelColor() const override;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-09-21 19:15:57 +08:00
|
|
|
/*! \brief This JKQTPGeometricPlotElement is used as base class for geometric drawing
|
2020-08-26 16:36:07 +08:00
|
|
|
elements that consist of lines with one decorated end (i.e. no filling of any kind is done)
|
|
|
|
\ingroup jkqtplotter_geoplots
|
|
|
|
|
|
|
|
*/
|
2020-09-21 19:15:57 +08:00
|
|
|
class JKQTPLOTTER_LIB_EXPORT JKQTPGeoBaseDecoratedHeadLine: public JKQTPGeometricPlotElement, public JKQTPGraphDecoratedHeadLineStyleMixin {
|
2020-08-26 16:36:07 +08:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
/*! \brief class contructor
|
|
|
|
|
|
|
|
\param headStyle style of the head decoration
|
|
|
|
\param parent the parent plotter object
|
2020-09-26 21:58:58 +08:00
|
|
|
\param drawMode how to draw te element (as geometric or graphic element)
|
2020-08-26 16:36:07 +08:00
|
|
|
*/
|
2020-09-26 21:58:58 +08:00
|
|
|
explicit JKQTPGeoBaseDecoratedHeadLine(JKQTPLineDecoratorStyle headStyle, JKQTBasePlotter* parent, DrawMode drawMode=DrawAsGraphicElement);
|
2020-08-26 16:36:07 +08:00
|
|
|
|
|
|
|
/*! \brief class contructor
|
|
|
|
|
2020-09-26 21:58:58 +08:00
|
|
|
\param parent the parent plotter object
|
|
|
|
\param drawMode how to draw te element (as geometric or graphic element)
|
2020-08-26 16:36:07 +08:00
|
|
|
*/
|
- improved: geometric objects now use an adaptive drawing algorithm to represent curves (before e.g. ellipses were always separated into a fixed number of line-segments)
- improved: constructors and access functions for several geometric objects (e.g. more constructors, additional functions to retrieve parameters in diferent forms, iterators for polygons, ...)
- new: all geometric objects can either be drawn as graphic element (i.e. lines are straight line, even on non-linear axes), or as mathematical curve (i.e. on non-linear axes, lines become the appropriate curve representing the linear function, connecting the given start/end-points). The only exceptions are ellipses (and the derived arcs,pies,chords), which are always drawn as mathematical curves
2020-09-04 05:08:52 +08:00
|
|
|
explicit JKQTPGeoBaseDecoratedHeadLine(JKQTBasePlotter* parent, DrawMode drawMode=DrawAsGraphicElement);
|
2020-08-26 16:36:07 +08:00
|
|
|
|
|
|
|
|
2020-09-26 21:58:58 +08:00
|
|
|
/** \brief set several of the style properties with one call */
|
|
|
|
virtual void setStyle(QColor color, double lineWidth);
|
|
|
|
/** \brief set several of the style properties with one call */
|
|
|
|
virtual void setStyle(QColor color, double lineWidth, Qt::PenStyle style);
|
|
|
|
/** \brief set several of the style properties with one call */
|
|
|
|
virtual void setStyle(QColor color, Qt::PenStyle style);
|
2020-08-26 16:36:07 +08:00
|
|
|
|
|
|
|
|
|
|
|
/** \brief sets the alpha-channel of the \a color (i.e. its transparency) */
|
|
|
|
virtual void setAlpha(float alpha);
|
|
|
|
/** \brief set line color */
|
|
|
|
virtual void setColor(QColor c);
|
|
|
|
|
|
|
|
/** \brief plots a key marker inside the specified rectangle \a rect */
|
|
|
|
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override;
|
|
|
|
/** \brief returns the color to be used for the key label */
|
|
|
|
virtual QColor getKeyLabelColor() const override;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-09-21 19:15:57 +08:00
|
|
|
/*! \brief This JKQTPGeometricPlotElement is used as base class for geometric drawing
|
2020-08-26 16:36:07 +08:00
|
|
|
elements that consist of lines with decorated ends (i.e. no filling of any kind is done)
|
|
|
|
\ingroup jkqtplotter_geoplots
|
|
|
|
|
|
|
|
*/
|
2020-09-21 19:15:57 +08:00
|
|
|
class JKQTPLOTTER_LIB_EXPORT JKQTPGeoBaseDecoratedLine: public JKQTPGeometricPlotElement, public JKQTPGraphDecoratedLineStyleMixin {
|
2020-08-26 16:36:07 +08:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
/*! \brief class contructor
|
|
|
|
|
|
|
|
\param headStyle style of the head decoration
|
|
|
|
\param tailStyle style of the tail decoration
|
|
|
|
\param parent the parent plotter object
|
2020-09-26 21:58:58 +08:00
|
|
|
\param drawMode how to draw te element (as geometric or graphic element)
|
2020-08-26 16:36:07 +08:00
|
|
|
*/
|
2020-09-26 21:58:58 +08:00
|
|
|
explicit JKQTPGeoBaseDecoratedLine(JKQTPLineDecoratorStyle headStyle, JKQTPLineDecoratorStyle tailStyle, JKQTBasePlotter* parent, DrawMode drawMode=DrawAsGraphicElement);
|
|
|
|
/** \brief class contructor
|
|
|
|
*
|
|
|
|
* \param parent the parent plotter object
|
|
|
|
* \param drawMode how to draw te element (as geometric or graphic element)
|
|
|
|
*/
|
- improved: geometric objects now use an adaptive drawing algorithm to represent curves (before e.g. ellipses were always separated into a fixed number of line-segments)
- improved: constructors and access functions for several geometric objects (e.g. more constructors, additional functions to retrieve parameters in diferent forms, iterators for polygons, ...)
- new: all geometric objects can either be drawn as graphic element (i.e. lines are straight line, even on non-linear axes), or as mathematical curve (i.e. on non-linear axes, lines become the appropriate curve representing the linear function, connecting the given start/end-points). The only exceptions are ellipses (and the derived arcs,pies,chords), which are always drawn as mathematical curves
2020-09-04 05:08:52 +08:00
|
|
|
explicit JKQTPGeoBaseDecoratedLine(JKQTBasePlotter* parent, DrawMode drawMode=DrawAsGraphicElement);
|
2020-08-26 16:36:07 +08:00
|
|
|
|
2020-09-26 21:58:58 +08:00
|
|
|
/** \brief set several of the style properties with one call */
|
|
|
|
virtual void setStyle(QColor color, double lineWidth);
|
|
|
|
/** \brief set several of the style properties with one call */
|
|
|
|
virtual void setStyle(QColor color, double lineWidth, Qt::PenStyle style);
|
|
|
|
/** \brief set several of the style properties with one call */
|
|
|
|
virtual void setStyle(QColor color, Qt::PenStyle style);
|
|
|
|
|
2020-08-26 16:36:07 +08:00
|
|
|
|
|
|
|
|
|
|
|
/** \brief sets the alpha-channel of the \a color (i.e. its transparency) */
|
|
|
|
virtual void setAlpha(float alpha);
|
|
|
|
/** \brief set line color */
|
|
|
|
virtual void setColor(QColor c);
|
|
|
|
|
|
|
|
/** \brief plots a key marker inside the specified rectangle \a rect */
|
|
|
|
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override;
|
|
|
|
/** \brief returns the color to be used for the key label */
|
|
|
|
virtual QColor getKeyLabelColor() const override;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2020-09-21 19:15:57 +08:00
|
|
|
/*! \brief This JKQTPGeometricPlotElement is used as base class for geometric drawing
|
2020-08-26 16:36:07 +08:00
|
|
|
elements that only consist of lines (i.e. no filling of any kind is done)
|
|
|
|
\ingroup jkqtplotter_geoplots
|
|
|
|
|
|
|
|
*/
|
|
|
|
class JKQTPLOTTER_LIB_EXPORT JKQTPGeoBaseFilled: public JKQTPGeoBaseLine, public JKQTPGraphFillStyleMixin {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
/*! \brief class contructor
|
|
|
|
|
|
|
|
\param parent the parent plotter object
|
2020-09-26 21:58:58 +08:00
|
|
|
\param drawMode how to draw te element (as geometric or graphic element)
|
2020-08-26 16:36:07 +08:00
|
|
|
*/
|
2020-09-26 21:58:58 +08:00
|
|
|
JKQTPGeoBaseFilled(JKQTBasePlotter *parent, DrawMode drawMode=DrawAsGraphicElement);
|
2020-08-26 16:36:07 +08:00
|
|
|
|
|
|
|
/** \brief sets the alpha-channel of the \a color and \a fillColor (i.e. its transparency) to the same value */
|
|
|
|
virtual void setAlpha(float alpha) override;
|
|
|
|
/** \brief sets the alpha-channel of the \a color and \a fillColor (i.e. its transparency) */
|
|
|
|
virtual void setAlpha(float alphaLine, float alphaFill);
|
|
|
|
/** \brief set line and fill color */
|
|
|
|
virtual void setColor(QColor c) override;
|
2020-09-26 21:58:58 +08:00
|
|
|
/** \brief set several of the style properties with one call */
|
|
|
|
virtual void setStyle(QColor color, double lineWidth, Qt::PenStyle style, QColor fillColor, Qt::BrushStyle fillStyle) ;
|
|
|
|
/** \brief set several of the style properties with one call */
|
|
|
|
virtual void setStyle(QColor color, double lineWidth, Qt::PenStyle style) override;
|
|
|
|
/** \brief set several of the style properties with one call */
|
|
|
|
virtual void setStyle(QColor color, Qt::PenStyle style) override;
|
|
|
|
/** \brief set several of the style properties with one call */
|
|
|
|
virtual void setStyle(QColor color, double lineWidth) override;
|
|
|
|
/** \brief set several of the style properties with one call */
|
|
|
|
void setStyle(QColor color, QColor fillColor);
|
|
|
|
/** \brief set several of the style properties with one call, sets fill to transparent */
|
|
|
|
void setStyleTransparentFill(QColor color, double lineWidth, Qt::PenStyle style);
|
|
|
|
/** \brief set several of the style properties with one call, sets fill to transparent */
|
|
|
|
void setStyleTransparentFill(QColor color, Qt::PenStyle style);
|
|
|
|
/** \brief set several of the style properties with one call, sets fill to transparent */
|
|
|
|
void setStyleTransparentFill(QColor color, double lineWidth);
|
|
|
|
/** \brief set several of the style properties with one call, sets fill to transparent */
|
|
|
|
void setStyleTransparentFill(QColor color);
|
2020-08-26 16:36:07 +08:00
|
|
|
|
|
|
|
/** \brief plots a key marker inside the specified rectangle \a rect */
|
|
|
|
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override;
|
|
|
|
protected:
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // jkqtpgeobase_H_INCLUDED
|