JKQTPlotter trunk/v5.0.0
an extensive Qt5+Qt6 Plotter framework (including a feature-richt plotter widget, a speed-optimized, but limited variant and a LaTeX equation renderer!), written fully in C/C++ and without external dependencies
|
Classes | |
class | JKQTPEnhancedPainter |
this class extends the QPainter More... | |
struct | JKQTPlotterDrawingTools |
tool class with static values used by JKQTPlotter/JKQTBasePlotter More... | |
struct | JKQTPSymbolPathsInternnal |
internal datastructure used in JKQTPPlotSymbol() to precalculate certain data only once per runtime More... | |
Typedefs | |
typedef std::function< void(QPainter &p)> | JKQTPCustomGraphSymbolFunctor |
functor used to draw a custom JKQTPGraphSymbols | |
Functions | |
JKQTCOMMON_LIB_EXPORT QPolygonF | JKQTPCleanPolygon (const QPolygonF &poly, double distanceThreshold=0.3) |
cleans a polygon by uniting all consecutive points that were closer than distanceThreshold are united | |
QLineF | JKQTPClipLine (const QLineF &line, const QRectF &clipRect) |
clips the given line line to the given rectangle clipRect | |
QLineF | JKQTPClipLine (const QLineF &line, double xmin, double xmax, double ymin, double ymax) |
clips the given line line to the given rectangle rectangle xmin .. xmax and ymin ... ymax | |
bool | JKQTPClipLine (double &x1, double &y1, double &x2, double &y2, double xmin, double xmax, double ymin, double ymax) |
clips the given line (x1 , y1 ) – (x2 , y2 ) to the given rectangle xmin .. xmax and ymin ... ymax | |
JKQTCOMMON_LIB_EXPORT bool | JKQTPClipLine (QLineF &line, const QRectF &clippingRect) |
clip a QLineF line to the rectangle defines by clippingRect | |
JKQTCOMMON_LIB_EXPORT QList< QPolygonF > | JKQTPClipPolyLine (const QPolygonF &polyline_in, const QRectF &clipRect) |
clips the given poly-line polyline_in to the given rectangle clipRect | |
JKQTCOMMON_LIB_EXPORT QList< QPolygonF > | JKQTPClipPolyLines (const QList< QPolygonF > &polylines_in, const QRectF &clipRect) |
clips the given list of poly-lines polylines_in to the given rectangle clipRect | |
template<class TPainter > | |
void | JKQTPDrawTooltip (TPainter &painter, double x, double y, const QRectF &rect) |
draw a tooltip, using the current brush and pen of the provided painter | |
template<int N> | |
std::array< QPointF, N *2 > | JKQTPGetStarCoordinates (double inner_radius=0.5) |
return the consecutive ccordinates of the tips of a N-tipped star on a circle of radius 1. Inner tips are on a irle of radius inner_radius. | |
JKQTCOMMON_LIB_EXPORT QString | JKQTPGraphSymbols2NameString (JKQTPGraphSymbols pos) |
converts a JKQTPGraphSymbols variable into a human-readable string | |
JKQTCOMMON_LIB_EXPORT QString | JKQTPGraphSymbols2String (JKQTPGraphSymbols pos) |
converts a JKQTPGraphSymbols variable into a identifier string | |
JKQTCOMMON_LIB_EXPORT QString | JKQTPLineDecoratorStyle2NameString (JKQTPLineDecoratorStyle pos) |
converts a JKQTPLineDecoratorStyle variable into a human-readable string | |
JKQTCOMMON_LIB_EXPORT QString | JKQTPLineDecoratorStyle2String (JKQTPLineDecoratorStyle pos) |
converts a JKQTPLineDecoratorStyle variable into a identifier string | |
JKQTCOMMON_LIB_EXPORT double | JKQTPLineDecoratorStyleCalcDecoratorSize (double line_width, double decoratorSizeFactor) |
calculates the tail decorator size from the line width line_width, using decoratorSizeFactor and a non-linear scaling function that levels off towards small line_width and increases sub-linearly for large ones, so the arrow heads to not grow too much | |
template<class TPainter > | |
void | JKQTPPlotDecoratedLine (TPainter &painter, const QLineF &l, JKQTPLineDecoratorStyle style1, double size1, JKQTPLineDecoratorStyle style2, double size2) |
plot a line with the given decorators style1 and a style2 at the start- and end-point repsectively, using the painter's current pen | |
template<class TPainter > | |
void | JKQTPPlotLineDecorator (TPainter &painter, double x, double y, double angle_rad, JKQTPLineDecoratorStyle style, double size, QPointF *line_start=nullptr) |
plot the specified symbol at pixel position x,y. Note that this function only draws the decorator, NOT the line pointing to it! | |
JKQTCOMMON_LIB_EXPORT void | JKQTPPlotSymbol (QPaintDevice &paintDevice, double x, double y, JKQTPGraphSymbols symbol, double size, double symbolLineWidth, QColor color, QColor fillColor, const QFont &symbolFont) |
plot the specified symbol at pixel position x,y, thread-safe | |
template<class TPainter > | |
void | JKQTPPlotSymbol (TPainter &painter, double x, double y, JKQTPGraphSymbols symbol, double size, double symbolLineWidth, QColor color, QColor fillColor, QFont symbolFont) |
plot the specified symbol at pixel position x,y, thread-safe | |
JKQTCOMMON_LIB_EXPORT JKQTPGraphSymbols | JKQTPRegisterCustomGraphSymbol (const JKQTPCustomGraphSymbolFunctor &) |
register a JKQTPCustomGraphSymbolFunctor that draws a custom symbol.Returns an ID that allows to access the symbol!, thread-safe | |
JKQTCOMMON_LIB_EXPORT JKQTPGraphSymbols | JKQTPRegisterCustomGraphSymbol (JKQTPCustomGraphSymbolFunctor &&) |
register a JKQTPCustomGraphSymbolFunctor that draws a custom symbol.Returns an ID that allows to access the symbol!, thread-safe | |
JKQTCOMMON_LIB_EXPORT void | JKQTPReplaceCurrentColor (QColor &col, const QColor ¤tColor) |
check whether col equals JKQTPlotterDrawingTools::CurrentColorPlaceholder (or one of its variants) and then replace it by currentColor | |
JKQTCOMMON_LIB_EXPORT void | JKQTPReplaceCurrentColor (QGradient &grad, const QColor ¤tColor) |
check whether any color in grad equals JKQTPlotterDrawingTools::CurrentColorPlaceholder (or one of its variants) and then replace it by currentColor | |
JKQTCOMMON_LIB_EXPORT QPolygonF | jkqtpRotateRect (QRectF r, double angle) |
rotate a rectangle by given angle (rotates all points around the center of the rectangle and returns it as a QPolygonF) | |
JKQTCOMMON_LIB_EXPORT QList< QPolygonF > | JKQTPSimplifyPolyLines (const QList< QPolygonF > &lines_in, double maxDeltaXY=1.0) |
tries to reduce the complexity of the given list of poly-lines lines_in, but keeping the appearance as if all lines were drawn | |
JKQTCOMMON_LIB_EXPORT QPolygonF | JKQTPSimplifyPolyLines (const QPolygonF &lines_in, double maxDeltaXY=1.0) |
tries to reduce the complexity of the given poly-line lines_in, but keeping the appearance as if all lines were drawn | |
JKQTCOMMON_LIB_EXPORT QVector< QPointF > | JKQTPSimplyfyLineSegemnts (const QVector< QPointF > &points, double maxConsecutiveAngleDegree=0.2) |
takes a list of points and tries to reduce them. Three points are merged to two, if they form a straight line | |
JKQTCOMMON_LIB_EXPORT QVector< QPointF > | JKQTPSplitEllipseIntoPoints (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) |
represent an ellipse as a series of points on the ellipse | |
JKQTCOMMON_LIB_EXPORT QVector< QPointF > | JKQTPSplitEllipseIntoPoints (std::function< QPointF(QPointF)> fTransform, double x, double y, double a, double b, double angle_start=0, double angle_end=360, double alpha=0, QPointF *x_start=nullptr, QPointF *x_end=nullptr, QPointF *x_start_notrafo=nullptr, QPointF *x_end_notrafo=nullptr) |
represent an ellipse as a series of points on the ellipse | |
JKQTCOMMON_LIB_EXPORT QVector< QPointF > | JKQTPSplitLineIntoPoints (const QLineF &line, int controlPoints=180) |
represent a line as a series of points on the ellipse | |
JKQTCOMMON_LIB_EXPORT QVector< QPointF > | JKQTPSplitLineIntoPoints (const QLineF &line, std::function< QPointF(QPointF)> fTransform) |
represent a line as a series of points on the ellipse | |
JKQTCOMMON_LIB_EXPORT QVector< QPointF > | JKQTPSplitPolylineIntoPoints (const QVector< QPointF > &line, std::function< QPointF(QPointF)> fTransform) |
represent a poly-line as a series of points on the ellipse | |
JKQTCOMMON_LIB_EXPORT QVector< QPolygonF > | JKQTPUnifyLinesToPolygons (const QVector< QLineF > &lines, double distanceThreshold=0.3, int searchMaxSurroundingElements=10) |
takes a list of QLineF objesct lines and tries to combine as many of them as possible to QPolygonF objects. Note: This method implements an incomplete algorithm with searchMaxSurroundingElements>0, as solving the complete problem is very time-consuming (cubic runtime) | |
JKQTCOMMON_LIB_EXPORT JKQTPGraphSymbols | String2JKQTPGraphSymbols (const QString &pos) |
converts a String into a JKQTPGraphSymbols | |
JKQTCOMMON_LIB_EXPORT JKQTPLineDecoratorStyle | String2JKQTPLineDecoratorStyle (const QString &pos) |
converts a String into a JKQTPLineDecoratorStyle | |
Variables | |
static JKQTCOMMON_LIB_EXPORT JKQTPSynchronized< QVector< JKQTPCustomGraphSymbolFunctor > > | JKQTPlotterDrawingTools::JKQTPCustomGraphSymbolStore |
stores all custom JKQTPGraphSymbols registered using JKQTPRegisterCustomGraphSymbol | |
Specialized drawing functions used by the plotters and LaTeX renderers.
typedef std::function<void(QPainter& p)> JKQTPCustomGraphSymbolFunctor |
functor used to draw a custom JKQTPGraphSymbols
Draw the symbol with these properties:
p.save()
; and p.restore()
; in JKQTPPlotSymbol()As an example, the following code-snippet:
generates this symbol:
enum JKQTPGraphSymbols : uint64_t |
symbols that can be used to plot a datapoint for a graph
Enumerator | |
---|---|
JKQTPNoSymbol | plots no symbol at all (usefull together with error bars) |
JKQTPDot | a small dot |
JKQTPCross | a X cross |
JKQTPPlus | a + cross |
JKQTPCircle | an unfilled circle |
JKQTPFilledCircle | a filled circle |
JKQTPRect | an unfilled rectangle |
JKQTPFilledRect | a filled rectangle |
JKQTPTriangle | an unfilled triangle (tip at top) |
JKQTPFilledTriangle | a filled triangle (tip at top) |
JKQTPDiamond | an unfilled diamond |
JKQTPFilledDiamond | a filled diamond |
JKQTPstar | an unfilled diamond |
JKQTPFilledStar | a filled diamond |
JKQTPPentagon | an unfilled pentagon |
JKQTPFilledPentagon | a filled pentagon |
JKQTPAsterisc | an asterisc star with 5 arms |
JKQTPHourglass | an hour glass symbol |
JKQTPFilledHourglass | a filled hour glass symbol |
JKQTPCurvedTriangle | a curved triangle |
JKQTPFilledCurvedTriangle | a filled curved triangle |
JKQTPHexagon | an unfilled hexagon |
JKQTPFilledHexagon | a filled hexagon |
JKQTPRectCross | a square symbol with a cross inside |
JKQTPRectPlus | a square symbol with a plus inside |
JKQTPRectTriangle | a square symbol with a triangle inside |
JKQTPRectDownTriangle | a square symbol with a triangle (tip to the bottom) inside |
JKQTPRectLeftTriangle | a square symbol with a triangle (tip to the left) inside |
JKQTPRectRightTriangle | a square symbol with a triangle (tip to the right) inside |
JKQTPCircleCross | a circle symbol with a cross inside |
JKQTPCirclePlus | a circle symbol with a plus inside |
JKQTPCirclePeace | a circled peace symbol |
JKQTPDiamondPlus | a diamond symbol with a plus inside |
JKQTPDiamondCross | a diamond symbol with a cross inside |
JKQTPTripod | a tripod symbol |
JKQTPDownTripod | a tripod symbol, pointing down |
JKQTPLeftTripod | a tripod symbol, pointing to the left |
JKQTPRightTripod | a tripod symbol, pointing to the right |
JKQTPAsterisc6 | an asterisc star with 6 arms |
JKQTPAsterisc8 | an asterisc star with 8 arms |
JKQTPPeace | a peace symbol |
JKQTPTarget | a target symbol (circle with cross) |
JKQTPDownTriangle | an unfilled triangle (tip at bottom) |
JKQTPFilledDownTriangle | a filled triangle (tip at bottom) |
JKQTPLeftTriangle | an unfilled triangle (tip to the left) |
JKQTPFilledLeftTriangle | a filled triangle (tip to the left) |
JKQTPRightTriangle | an unfilled triangle (tip to the right) |
JKQTPFilledRightTriangle | a filled triangle (tip to the right) |
JKQTPDownCurvedTriangle | a curved triangle, pointing down |
JKQTPFilledDownCurvedTriangle | a filled curved triangle, pointing down |
JKQTPLeftCurvedTriangle | a curved triangle, pointing to the left |
JKQTPFilledLeftCurvedTriangle | a filled curved triangle, pointing to the left |
JKQTPRightCurvedTriangle | a curved triangle, pointing to the right |
JKQTPFilledRightCurvedTriangle | a filled curved triangle, pointing to the right |
JKQTPOctagon | an unfilled octagon |
JKQTPFilledOctagon | a filled octagon |
JKQTPUpDownTriangle | a overlay of an up and a down triangle symbol |
JKQTPFilledUpDownTriangle | a filled version of the overlay of an up and a down triangle |
JKQTPHorizontalHourglass | a horizontal hour glass symbol |
JKQTPFilledHorizontalHourglass | a filled horizontal hour glass symbol |
JKQTPSantaClauseHouse | a small house symbol ("Das is das haus vom Nicolaus") |
JKQTPFilledSantaClauseHouse | a filled small house symbol ("Das is das haus vom Nicolaus") |
JKQTPMale | a male symbol |
JKQTPFemale | a female symbol |
JKQTPSymbolCount | can be used to iterate over all symbols using: |
JKQTPMaxSymbolID | points to the last available symbol, can be used to iterate over all symbols: |
JKQTPDefaultSymbol | a default symbol used for plotting |
JKQTPCharacterSymbol | draw a font-character as symbol with defined fill-brush (taken from symbol-color), you can use any character from a QFont by supplying |
JKQTPFilledCharacterSymbol | draw a font-character as symbol with defined outline-pen and fill-brush, you can use any character from a QFont by supplying |
JKQTPFirstCustomSymbol | draw a completely custom symbol, defined by supplying a functor to JKQTPRegisterCustomGraphSymbol() |
symbols that can be used to plot a datapoint for a graph
Note that all arrows end at the designated line-end (here indicated by dashed grey lines), even circles and rectangle:
JKQTCOMMON_LIB_EXPORT QPolygonF JKQTPCleanPolygon | ( | const QPolygonF & | poly, |
double | distanceThreshold = 0.3 |
||
) |
cleans a polygon by uniting all consecutive points that were closer than distanceThreshold are united
poly | polygon to clean |
distanceThreshold | if two end-points are closer together as this value, they are united to a single point |
|
inline |
clips the given line line to the given rectangle clipRect
line | line to be clipped |
clipRect | rectangle to clip to |
This function implements the algorithm descripbed in https://www.researchgate.net/publication/335018076_Another_Simple_but_Faster_Method_for_2D_Line_Clipping
|
inline |
clips the given line line to the given rectangle rectangle xmin .. xmax and ymin ... ymax
This function implements the algorithm descripbed in https://www.researchgate.net/publication/335018076_Another_Simple_but_Faster_Method_for_2D_Line_Clipping
|
inline |
clips the given line (x1 , y1 ) – (x2 , y2 ) to the given rectangle xmin .. xmax and ymin ... ymax
true
if the line is still to be drawn or false
elseThis function implements the algorithm descripbed in https://www.researchgate.net/publication/335018076_Another_Simple_but_Faster_Method_for_2D_Line_Clipping i.e. in Pseudocode
// x1 , y1 , x2 , y2 , xmin , ymax , xmax , ymin // if not ( x1<xmin and x2<xmin ) and not ( x1>xmax and x2>xmax ) then if not ( y1<ymin and y2<ymin ) and not ( y1>ymax and y2>ymax ) then x[1]= x1 y[1]= y1 x[2]= x2 y[2]= y2 i =1 repeat if x[i] < xmin then x[i] = xmin y[i] = ( ( y2-y1 ) / ( x2-x1 ) ) * ( xmin-x1)+y1 elseif x[i] > xmax then x[i] = xmax y[i] = ( ( y2-y1 ) / ( x2-x1 ) ) * ( xmax-x1)+y1 endif if y[i] < ymin then y[i] = ymin x[i] = ( ( x2-x1 ) / ( y2-y1 ) ) * ( ymin-y1)+x1 elseif y[i] > ymax then y[i] = ymax x[i] = ( ( x2-x1 ) / ( y2-y1 ) ) * ( ymax-y1)+x1 endif i = i + 1 until i >2 if not ( x [1 ] < xmin and x [2 ] < xmin ) and not ( x [1 ] >xmax and x [2 ] >xmax ) then drawLine ( x[1] , y[1] , x[2] , y[2] ) endif endif endif
JKQTCOMMON_LIB_EXPORT bool JKQTPClipLine | ( | QLineF & | line, |
const QRectF & | clippingRect | ||
) |
clip a QLineF line to the rectangle defines by clippingRect
[in,out] | line | The line to clip, if clipping is possible this is modified to the clipped line. If the line is outside clippingRect this is modified to line=QLineF() i.e. a null-line! |
clippingRect | the rectangle to clip to |
true
, if the line had at least some points within clippingRect, false
otherwise. The clipped line (or a null-line) is returned in the by-refrence parameter line JKQTCOMMON_LIB_EXPORT QList< QPolygonF > JKQTPClipPolyLine | ( | const QPolygonF & | polyline_in, |
const QRectF & | clipRect | ||
) |
clips the given poly-line polyline_in to the given rectangle clipRect
polyline_in | poly-line to be clipped |
clipRect | rectangle to clip to |
JKQTCOMMON_LIB_EXPORT QList< QPolygonF > JKQTPClipPolyLines | ( | const QList< QPolygonF > & | polylines_in, |
const QRectF & | clipRect | ||
) |
clips the given list of poly-lines polylines_in to the given rectangle clipRect
polylines_in | list of poly-lines to be clipped |
clipRect | rectangle to clip to |
|
inline |
draw a tooltip, using the current brush and pen of the provided painter
TPainter | Type of painter: A class like JKQTPEnhancedPainter or QPainter |
painter | QPainter-like object to use for painting |
x | x-coordinate of position the tooltip points to |
y | y-coordinate of position the tooltip points to |
rect | rectangle of the main tooltip area |
|
inline |
return the consecutive ccordinates of the tips of a N-tipped star on a circle of radius 1. Inner tips are on a irle of radius inner_radius.
JKQTCOMMON_LIB_EXPORT QString JKQTPGraphSymbols2NameString | ( | JKQTPGraphSymbols | pos | ) |
converts a JKQTPGraphSymbols variable into a human-readable string
JKQTCOMMON_LIB_EXPORT QString JKQTPGraphSymbols2String | ( | JKQTPGraphSymbols | pos | ) |
converts a JKQTPGraphSymbols variable into a identifier string
JKQTCOMMON_LIB_EXPORT QString JKQTPLineDecoratorStyle2NameString | ( | JKQTPLineDecoratorStyle | pos | ) |
converts a JKQTPLineDecoratorStyle variable into a human-readable string
JKQTCOMMON_LIB_EXPORT QString JKQTPLineDecoratorStyle2String | ( | JKQTPLineDecoratorStyle | pos | ) |
converts a JKQTPLineDecoratorStyle variable into a identifier string
JKQTCOMMON_LIB_EXPORT double JKQTPLineDecoratorStyleCalcDecoratorSize | ( | double | line_width, |
double | decoratorSizeFactor | ||
) |
calculates the tail decorator size from the line width line_width, using decoratorSizeFactor and a non-linear scaling function that levels off towards small line_width and increases sub-linearly for large ones, so the arrow heads to not grow too much
|
inline |
plot a line with the given decorators style1 and a style2 at the start- and end-point repsectively, using the painter's current pen
TPainter | Type of painter: A class like JKQTPEnhancedPainter or QPainter |
painter | the QPainter to draw to |
l | line to draw |
style1 | type of the first decorator to plot, see JKQTPLineDecoratorStyle |
size1 | size of the first decorator |
style2 | type of the second decorator to plot, see JKQTPLineDecoratorStyle |
size2 | size of the second decorator |
x
...x+size and y-size/2
...y-size/2 (where size
is size1 or size2), but may be smaller (e.g. arrows are typically less high than the full size
pixels ).
|
inline |
plot the specified symbol at pixel position x,y. Note that this function only draws the decorator, NOT the line pointing to it!
TPainter | Type of painter: A class like JKQTPEnhancedPainter or QPainter |
painter | the QPainter to draw to | |
x | x-coordinate of the decorator tip | |
y | y-coordinate of the decorator tip | |
angle_rad | angle of the line pointing to (x,y), given in radians, 0rad points to the right, >0rad is a counter-clockwise rotation, as calculated by atan2() from dx, dy of a line! | |
style | type of the decorator to plot, see JKQTPLineDecoratorStyle | |
size | size of the decorator in pixels, the decorator fills at most the space x ...x+size and y-size/2 ...y-size/2, but may be smaller (e.g. arrows are typically less high than the full size pixels ). | |
[out] | line_start | optional output parameter: when drawing the line let it end here, not necessarily at (x,y) |
JKQTCOMMON_LIB_EXPORT void JKQTPPlotSymbol | ( | QPaintDevice & | paintDevice, |
double | x, | ||
double | y, | ||
JKQTPGraphSymbols | symbol, | ||
double | size, | ||
double | symbolLineWidth, | ||
QColor | color, | ||
QColor | fillColor, | ||
const QFont & | symbolFont | ||
) |
plot the specified symbol at pixel position x,y, thread-safe
paintDevice | the paint device to draw on |
x | x-coordinate of the symbol center |
y | y-coordinate of the symbol center |
symbol | type of the symbol to plot, see JKQTPGraphSymbols |
size | size (width/height) of the symbol around (x , y) |
symbolLineWidth | width of the lines used to draw the symbol |
color | color of the symbol lines |
fillColor | color of the symbol filling |
symbolFont | font used to draw symbols like JKQTPCharacterSymbol+QChar ('@').unicode() |
|
inline |
plot the specified symbol at pixel position x,y, thread-safe
TPainter | Type of painter: A class like JKQTPEnhancedPainter or QPainter |
painter | the QPainter to draw to |
x | x-coordinate of the symbol center |
y | y-coordinate of the symbol center |
symbol | type of the symbol to plot, see JKQTPGraphSymbols |
size | size (width/height) of the symbol around (x , y) |
symbolLineWidth | width of the lines used to draw the symbol |
color | color of the symbol lines |
fillColor | color of the symbol filling |
symbolFont | font used to draw symbols like JKQTPCharacterSymbol+QChar ('@').unicode() |
JKQTCOMMON_LIB_EXPORT JKQTPGraphSymbols JKQTPRegisterCustomGraphSymbol | ( | const JKQTPCustomGraphSymbolFunctor & | ) |
register a JKQTPCustomGraphSymbolFunctor that draws a custom symbol.Returns an ID that allows to access the symbol!, thread-safe
The functor is stored in the global/static store JKQTPlotterDrawingTools::JKQTPCustomGraphSymbolStore, i.e. these are available throughout the runtime of the program
JKQTCOMMON_LIB_EXPORT JKQTPGraphSymbols JKQTPRegisterCustomGraphSymbol | ( | JKQTPCustomGraphSymbolFunctor && | ) |
register a JKQTPCustomGraphSymbolFunctor that draws a custom symbol.Returns an ID that allows to access the symbol!, thread-safe
The functor is stored in the global/static store JKQTPlotterDrawingTools::JKQTPCustomGraphSymbolStore, i.e. these are available throughout the runtime of the program
JKQTCOMMON_LIB_EXPORT void JKQTPReplaceCurrentColor | ( | QColor & | col, |
const QColor & | currentColor | ||
) |
check whether col equals JKQTPlotterDrawingTools::CurrentColorPlaceholder (or one of its variants) and then replace it by currentColor
JKQTCOMMON_LIB_EXPORT void JKQTPReplaceCurrentColor | ( | QGradient & | grad, |
const QColor & | currentColor | ||
) |
check whether any color in grad equals JKQTPlotterDrawingTools::CurrentColorPlaceholder (or one of its variants) and then replace it by currentColor
JKQTCOMMON_LIB_EXPORT QPolygonF jkqtpRotateRect | ( | QRectF | r, |
double | angle | ||
) |
rotate a rectangle by given angle (rotates all points around the center of the rectangle and returns it as a QPolygonF)
JKQTCOMMON_LIB_EXPORT QList< QPolygonF > JKQTPSimplifyPolyLines | ( | const QList< QPolygonF > & | lines_in, |
double | maxDeltaXY = 1.0 |
||
) |
tries to reduce the complexity of the given list of poly-lines lines_in, but keeping the appearance as if all lines were drawn
lines_in | list of poly-lines to be simplified |
maxDeltaXY | a group has to be either less wide or less high than this, typically equals the linewidth of the poly-line |
JKQTCOMMON_LIB_EXPORT QPolygonF JKQTPSimplifyPolyLines | ( | const QPolygonF & | lines_in, |
double | maxDeltaXY = 1.0 |
||
) |
tries to reduce the complexity of the given poly-line lines_in, but keeping the appearance as if all lines were drawn
lines_in | poly-line to be simplified |
maxDeltaXY | a group has to be either less wide or less high than this, typically equals the linewidth of the poly-line |
JKQTCOMMON_LIB_EXPORT QVector< QPointF > JKQTPSimplyfyLineSegemnts | ( | const QVector< QPointF > & | points, |
double | maxConsecutiveAngleDegree = 0.2 |
||
) |
takes a list of points and tries to reduce them. Three points are merged to two, if they form a straight line
points | input poly-line |
maxConsecutiveAngleDegree | is two consecutive line-segments differ by an angle smaller than this, they can be merged |
JKQTCOMMON_LIB_EXPORT QVector< QPointF > JKQTPSplitEllipseIntoPoints | ( | 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 |
||
) |
represent an ellipse as a series of points on the ellipse
x | center of ellipse (x-coordinate) | |
y | center of ellipse (y-coordinate) | |
a | half axis in x-direction | |
b | half axis in y-direction | |
angle_start | starting angle of ellipse section | |
angle_end | ending angle of ellipse section | |
alpha | rotation angle of ellipse | |
controlPoints | the number of points to use for drawing | |
[out] | x_start | first point of ellipse |
[out] | x_end | last point of ellipse |
JKQTCOMMON_LIB_EXPORT QVector< QPointF > JKQTPSplitEllipseIntoPoints | ( | std::function< QPointF(QPointF)> | fTransform, |
double | x, | ||
double | y, | ||
double | a, | ||
double | b, | ||
double | angle_start = 0 , |
||
double | angle_end = 360 , |
||
double | alpha = 0 , |
||
QPointF * | x_start = nullptr , |
||
QPointF * | x_end = nullptr , |
||
QPointF * | x_start_notrafo = nullptr , |
||
QPointF * | x_end_notrafo = nullptr |
||
) |
represent an ellipse as a series of points on the ellipse
fTransform | a function that transforms a point in graph coordinate space into pixel coordinate space | |
x | center of ellipse (x-coordinate) | |
y | center of ellipse (y-coordinate) | |
a | half axis in x-direction | |
b | half axis in y-direction | |
angle_start | starting angle of ellipse section | |
angle_end | ending angle of ellipse section | |
alpha | rotation angle of ellipse | |
[out] | x_start | first point of ellipse, with fTransform applied |
[out] | x_end | last point of ellipse, with fTransform applied |
[out] | x_start_notrafo | first point of ellipse, without fTransform applied |
[out] | x_end_notrafo | last point of ellipse, without fTransform applied |
JKQTCOMMON_LIB_EXPORT QVector< QPointF > JKQTPSplitLineIntoPoints | ( | const QLineF & | line, |
int | controlPoints = 180 |
||
) |
represent a line as a series of points on the ellipse
line | the line to draw |
controlPoints | the number of points to use for drawing |
JKQTCOMMON_LIB_EXPORT QVector< QPointF > JKQTPSplitLineIntoPoints | ( | const QLineF & | line, |
std::function< QPointF(QPointF)> | fTransform | ||
) |
represent a line as a series of points on the ellipse
line | the line to draw in graph coordinate space |
fTransform | a function that transforms a point in graph coordinate space into pixel coordinate space |
JKQTCOMMON_LIB_EXPORT QVector< QPointF > JKQTPSplitPolylineIntoPoints | ( | const QVector< QPointF > & | line, |
std::function< QPointF(QPointF)> | fTransform | ||
) |
represent a poly-line as a series of points on the ellipse
line | the poly-line to draw in graph coordinate space |
fTransform | a function that transforms a point in graph coordinate space into pixel coordinate space |
JKQTCOMMON_LIB_EXPORT QVector< QPolygonF > JKQTPUnifyLinesToPolygons | ( | const QVector< QLineF > & | lines, |
double | distanceThreshold = 0.3 , |
||
int | searchMaxSurroundingElements = 10 |
||
) |
takes a list of QLineF objesct lines and tries to combine as many of them as possible to QPolygonF objects. Note: This method implements an incomplete algorithm with searchMaxSurroundingElements>0, as solving the complete problem is very time-consuming (cubic runtime)
lines | line segments to unify |
distanceThreshold | if two end-points are closer together as this value, they are united to a single point |
searchMaxSurroundingElements | limits the search for a connected polygon to at most this number of neighbors |
JKQTCOMMON_LIB_EXPORT JKQTPGraphSymbols String2JKQTPGraphSymbols | ( | const QString & | pos | ) |
converts a String into a JKQTPGraphSymbols
JKQTCOMMON_LIB_EXPORT JKQTPLineDecoratorStyle String2JKQTPLineDecoratorStyle | ( | const QString & | pos | ) |
converts a String into a JKQTPLineDecoratorStyle
|
static |
stores all custom JKQTPGraphSymbols registered using JKQTPRegisterCustomGraphSymbol