renamed JKQTPPlotObject->JKQTPGeometricPlotElement and added new base class JKQTPPlotAnnotationElement

This commit is contained in:
jkriege2 2020-09-21 13:15:57 +02:00
parent f4767072a4
commit f368855076
27 changed files with 313 additions and 215 deletions

View File

@ -58,7 +58,7 @@ This software is licensed under the term of the [GNU Lesser General Public Licen
- extensive library of image plots (inclusing different color-scale modes, RGBA-plots, overlays/masks) - extensive library of image plots (inclusing different color-scale modes, RGBA-plots, overlays/masks)
- contour plots - contour plots
- geometric forms/annotations - geometric forms/annotations
- can be easily extended by deriving a new graph from JKQTPPlotElement or JKQTPPlotObject - can be easily extended by deriving a new graph from JKQTPPlotElement, JKQTPPlotAnnotationElement, JKQTPGeometricPlotElement, JKQTPGraph
- optional: OpenCV, CImg interfaces - optional: OpenCV, CImg interfaces
- CMake-based build system - CMake-based build system
- extensive set of [Examples/Tutorials](./examples/README.md) - extensive set of [Examples/Tutorials](./examples/README.md)

View File

@ -1,64 +0,0 @@
digraph
{
// LATEX_PDF_SIZE
bgcolor="transparent";
edge [fontname="FreeSans",fontsize="12",labelfontname="FreeSans",labelfontsize="12"];
node [fontname="FreeSans",fontsize="12",shape=record];
rankdir="LR";
{
rank=same;
JKQTPPlotElement [URL="\link JKQTPPlotElement"];
noteJKQTPPlotElement [shape="note", color="lightyellow",style=filled,fontsize=8,label="base class for all\nelements drawn\nonto a plot"];
JKQTPPlotElement -> noteJKQTPPlotElement [style=dashed,arrowhead=none];
}
{
rank=same;
JKQTPGraph [URL="\link JKQTPPlotElement"];
noteJKQTPGraph [shape="note", color="lightyellow",style=filled,fontsize=8,label="base class for all\nactual graphs"];
JKQTPGraph -> noteJKQTPGraph [style=dashed,arrowhead=none];
JKQTPPlotObject [URL="\link JKQTPPlotObject"];
noteJKQTPPlotObject [shape="note", color="lightyellow",style=filled,fontsize=8,label="base class for all\nnon-graph elements,\ne.g. geometric elements"];
JKQTPPlotObject -> noteJKQTPPlotObject [style=dashed,arrowhead=none];
}
{
rank=same;
JKQTPXYGraph [URL="\link JKQTPXYGraph"]
noteJKQTPXYGraph [shape="note", color="lightyellow",style=filled,fontsize=8,label="base class for all\ngraphs based on\n (x,y) data pairs"];
JKQTPXYGraph -> noteJKQTPXYGraph [style=dashed,arrowhead=none];
JKQTPSingleColumnGraph [URL="\link JKQTPSingleColumnGraph"]
noteJKQTPSingleColumnGraph [shape="note", color="lightyellow",style=filled,fontsize=8,label="base class for all\ngraphs based on only\n a single column of data"];
JKQTPSingleColumnGraph -> noteJKQTPSingleColumnGraph [style=dashed,arrowhead=none];
JKQTPImageBase [URL="\link JKQTPImageBase"]
noteJKQTPImageBase [shape="note", color="lightyellow",style=filled,fontsize=8,label="base class for all\ngraphsthat represent \n2D images/matrices"];
JKQTPImageBase -> noteJKQTPImageBase [style=dashed,arrowhead=none];
JKQTPGeoBaseLine [URL="\link JKQTPGeoBaseLine"];
noteJKQTPGeoBaseLine [shape="note", color="lightyellow",style=filled,fontsize=8,label="base class for all\ngeometric elements\nthat need line properties\n (color, width, ...)"];
JKQTPGeoBaseLine -> noteJKQTPGeoBaseLine [style=dashed,arrowhead=none];
}
{
rank=same;
JKQTPMathImageBase [URL="\link JKQTPMathImageBase"]
noteJKQTPMathImageBase [shape="note", color="lightyellow",style=filled,fontsize=8,label="base class for all\ngeometric elements\nthat need area fill properties\n (fillcolor, pattern, ...)"];
JKQTPMathImageBase -> noteJKQTPMathImageBase [style=dashed,arrowhead=none];
JKQTPGeoBaseFilled [URL="\link JKQTPGeoBaseFilled"];
noteJKQTPGeoBaseFilled [shape="note", color="lightyellow",style=filled,fontsize=8,label="base class for all\ngeometric elements\nthat need area fill properties\n (fillcolor, pattern, ...)"];
JKQTPGeoBaseFilled -> noteJKQTPGeoBaseFilled [style=dashed,arrowhead=none];
}
JKQTPGraph -> JKQTPXYGraph
JKQTPGraph -> JKQTPSingleColumnGraph
JKQTPGraph -> JKQTPImageBase -> JKQTPMathImageBase
JKQTPPlotElement -> JKQTPGraph
JKQTPPlotElement -> JKQTPPlotObject
JKQTPPlotObject -> JKQTPGeoBaseLine -> JKQTPGeoBaseFilled
}

View File

@ -0,0 +1,125 @@
digraph
{
// LATEX_PDF_SIZE
bgcolor="transparent";
edge [fontname="FreeSans",fontsize="12",labelfontname="FreeSans",labelfontsize="12"];
node [fontname="FreeSans",fontsize="12",shape=record];
rankdir="LR";
{
rank=same;
JKQTPPlotElement [URL="\link JKQTPPlotElement"];
noteJKQTPPlotElement [shape="note", color="lightyellow",style=filled,fontsize=8,label="base class for all\nelements drawn\nonto a plot"];
JKQTPPlotElement -> noteJKQTPPlotElement [style=dashed,arrowhead=none];
}
{
rank=same;
JKQTPGraph [URL="\link JKQTPPlotElement"];
noteJKQTPGraph [shape="note", color="lightyellow",style=filled,fontsize=8,label="base class for all\nactual graphs"];
JKQTPGraph -> noteJKQTPGraph [style=dashed,arrowhead=none];
JKQTPGeometricPlotElement [URL="\link JKQTPGeometricPlotElement"];
noteJKQTPGeometricPlotElement [shape="note", color="lightyellow",style=filled,fontsize=8,label="base class for all\nnon-graph elements,\ne.g. geometric elements"];
JKQTPGeometricPlotElement -> noteJKQTPGeometricPlotElement [style=dashed,arrowhead=none];
JKQTPPlotAnnotationElement [URL="\link JKQTPPlotAnnotationElement"];
noteJKQTPPlotAnnotationElement [shape="note", color="lightyellow",style=filled,fontsize=8,label="base class for all\ngraph annotation elements,\ne.g. text, symbols, ranges ..."];
JKQTPPlotAnnotationElement -> noteJKQTPPlotAnnotationElement [style=dashed,arrowhead=none];
}
{
rank=same;
JKQTPXYGraph [URL="\link JKQTPXYGraph"]
noteJKQTPXYGraph [shape="note", color="lightyellow",style=filled,fontsize=8,label="base class for all\ngraphs based on\n (x,y) data pairs"];
JKQTPXYGraph -> noteJKQTPXYGraph [style=dashed,arrowhead=none];
JKQTPSingleColumnGraph [URL="\link JKQTPSingleColumnGraph"]
noteJKQTPSingleColumnGraph [shape="note", color="lightyellow",style=filled,fontsize=8,label="base class for all\ngraphs based on only\n a single column of data"];
JKQTPSingleColumnGraph -> noteJKQTPSingleColumnGraph [style=dashed,arrowhead=none];
JKQTPImageBase [URL="\link JKQTPImageBase"]
noteJKQTPImageBase [shape="note", color="lightyellow",style=filled,fontsize=8,label="base class for all\ngraphs that represent \n2D images/matrices"];
JKQTPImageBase -> noteJKQTPImageBase [style=dashed,arrowhead=none];
}
{
rank=same;
JKQTPXYYGraph [URL="\link JKQTPXYYGraph"]
noteJKQTPXYYGraph [shape="note", color="lightyellow",style=filled,fontsize=8,label="base class for all\ngraphs based on\n (x, y1, y2) data tripels"];
JKQTPXYYGraph -> noteJKQTPXYYGraph [style=dashed,arrowhead=none];
JKQTPXXYGraph [URL="\link JKQTPXXYGraph"]
noteJKQTPXXYGraph [shape="note", color="lightyellow",style=filled,fontsize=8,label="base class for all\ngraphs based on\n (x1, x2, y) data tripels"];
JKQTPXXYGraph -> noteJKQTPXXYGraph [style=dashed,arrowhead=none];
JKQTPXYBaselineGraph [URL="\link JKQTPXYBaselineGraph"]
noteJJKQTPXYBaselineGraph [shape="note", color="lightyellow",style=filled,fontsize=8,label="base class for all\ngraphs based on\n (x,y) data pairs and a baseline"];
JKQTPXYBaselineGraph -> noteJJKQTPXYBaselineGraph [style=dashed,arrowhead=none];
JKQTPEvaluatedFunctionGraphBase [URL="\link JKQTPEvaluatedFunctionGraphBase"]
noteJKQTPEvaluatedFunctionGraphBase [shape="note", color="lightyellow",style=filled,fontsize=8,label="base class for all\ngraphs that represent \ndynamically evaluated functions"];
JKQTPEvaluatedFunctionGraphBase -> noteJKQTPEvaluatedFunctionGraphBase [style=dashed,arrowhead=none];
JKQTPMathImageBase [URL="\link JKQTPMathImageBase"]
noteJKQTPMathImageBase [shape="note", color="lightyellow",style=filled,fontsize=8,label="base class for all\ndata-based images"];
JKQTPMathImageBase -> noteJKQTPMathImageBase [style=dashed,arrowhead=none];
}
{
rank=same;
JKQTPBarGraphBase [URL="\link JKQTPBarGraphBase"]
noteJKQTPBarGraphBase [shape="note", color="lightyellow",style=filled,fontsize=8,label="base class for all\nbarcharts"];
JKQTPBarGraphBase -> noteJKQTPBarGraphBase [style=dashed,arrowhead=none];
JKQTPFilledCurveGraphBase [URL="\link JKQTPFilledCurveGraphBase"]
noteJKQTPFilledCurveGraphBase [shape="note", color="lightyellow",style=filled,fontsize=8,label="base class for all\nfilled graphs"];
JKQTPFilledCurveGraphBase -> noteJKQTPFilledCurveGraphBase [style=dashed,arrowhead=none];
JKQTPImpulsesGraphBase [URL="\link JKQTPImpulsesGraphBase"]
noteJKQTPImpulsesGraphBase [shape="note", color="lightyellow",style=filled,fontsize=8,label="base class for all\nimpulse graphs"];
JKQTPImpulsesGraphBase -> noteJKQTPImpulsesGraphBase [style=dashed,arrowhead=none];
JKQTPSpecialLineGraphBase [URL="\link JKQTPSpecialLineGraphBase"]
noteJKQTPSpecialLineGraphBase [shape="note", color="lightyellow",style=filled,fontsize=8,label="base class for all\nspecial line graphs"];
JKQTPSpecialLineGraphBase -> noteJKQTPSpecialLineGraphBase [style=dashed,arrowhead=none];
JKQTPBoxplotGraphBase [URL="\link JKQTPBoxplotGraphBase"]
noteJKQTPBoxplotGraphBase [shape="note", color="lightyellow",style=filled,fontsize=8,label="base class for all\ngraphs that represent \na set of boxplots"];
JKQTPBoxplotGraphBase -> noteJKQTPBoxplotGraphBase [style=dashed,arrowhead=none];
JKQTPRangeBase [URL="\link JKQTPRangeBase"];
noteJKQTPRangeBase [shape="note", color="lightyellow",style=filled,fontsize=8,label="base class for all\nrange annotations"];
JKQTPRangeBase -> noteJKQTPRangeBase [style=dashed,arrowhead=none];
JKQTPBoxplotElementBase [URL="\link JKQTPBoxplotElementBase"]
noteJKQTPBoxplotElementBase [shape="note", color="lightyellow",style=filled,fontsize=8,label="base class for all\ngraphs that represent \na single boxplot"];
JKQTPBoxplotElementBase -> noteJKQTPBoxplotElementBase [style=dashed,arrowhead=none];
}
JKQTPPlotElement -> JKQTPGraph
JKQTPPlotElement -> JKQTPGeometricPlotElement
JKQTPPlotElement -> JKQTPPlotAnnotationElement
JKQTPPlotElement -> JKQTPRangeBase
JKQTPPlotElement -> JKQTPBoxplotElementBase
JKQTPGraph -> JKQTPXYGraph
JKQTPGraph -> JKQTPSingleColumnGraph
JKQTPGraph -> JKQTPImageBase -> JKQTPMathImageBase
JKQTPGraph -> JKQTPEvaluatedFunctionGraphBase
JKQTPGraph -> JKQTPBoxplotGraphBase
JKQTPXYGraph -> JKQTPXYYGraph
JKQTPXYGraph -> JKQTPXXYGraph
JKQTPXYGraph -> JKQTPXYBaselineGraph
JKQTPXYBaselineGraph -> JKQTPBarGraphBase
JKQTPXYBaselineGraph -> JKQTPFilledCurveGraphBase
JKQTPXYBaselineGraph -> JKQTPImpulsesGraphBase
JKQTPXYBaselineGraph -> JKQTPSpecialLineGraphBase
}

View File

@ -74,7 +74,7 @@ All test-projects are Qt-projects that use qmake to build. You can load them int
<tr><th> Screenshot <th> Description <th> Notes <tr><th> Screenshot <th> Description <th> Notes
<tr><td> \image html geometric_small.png <tr><td> \image html geometric_small.png
<td> \subpage JKQTPlotterGeometricGraphs <td> \subpage JKQTPlotterGeometricGraphs
<td> `JKQTPPlotObject`, `JKQTPGeoArc`, `JKQTPGeoLine`, `JKQTPGeoRectangle`, ... <td> `JKQTPGeometricPlotElement`, `JKQTPGeoArc`, `JKQTPGeoLine`, `JKQTPGeoRectangle`, ...
<tr><td> \image html geo_arrows_small.png <tr><td> \image html geo_arrows_small.png
<td> \subpage JKQTPlotterGeometricArrows <td> \subpage JKQTPlotterGeometricArrows
<td> `JKQTPGeoArrow`, ... <td> `JKQTPGeoArrow`, ...

View File

@ -248,7 +248,7 @@ These are used to e.g. add color-scales to the side of the graph:
Usually if writing a new graph, one would not directly Usually if writing a new graph, one would not directly
derive from JKQTPPlotElement, but from a cass in it's hirarchy of children. These children already provide certain facilities for certain types of graphs. derive from JKQTPPlotElement, but from a cass in it's hirarchy of children. These children already provide certain facilities for certain types of graphs.
\dotfile jkqtplotter_graphhirarchy.dot \dotfile jkqtplotter_graphhirarchy.gv
\subsection jkqtplotter_graphsgroup_classstructure_mixins Mix-In Classes for Graphs \subsection jkqtplotter_graphsgroup_classstructure_mixins Mix-In Classes for Graphs

View File

@ -42,7 +42,7 @@
- \ref jkqtplotter_imagelots_elements "extensive library of image plots" (inclusing different color-scale modes, RGBA-plots, overlays/masks) - \ref jkqtplotter_imagelots_elements "extensive library of image plots" (inclusing different color-scale modes, RGBA-plots, overlays/masks)
- \ref jkqtplotter_imagelots_contour "contour plots" - \ref jkqtplotter_imagelots_contour "contour plots"
- \ref jkqtplotter_geoplots "geometric forms/annotations" - \ref jkqtplotter_geoplots "geometric forms/annotations"
- can be easily extended by deriving a new graph from JKQTPPlotElement or JKQTPPlotObject - can be easily extended by deriving a new graph from JKQTPPlotElement or JKQTPGeometricPlotElement
- <b>OPTIONAL: Interfaces to external libraries</b> - <b>OPTIONAL: Interfaces to external libraries</b>
- \ref jkqtpinterfaceopencv "OpenCV interface" - \ref jkqtpinterfaceopencv "OpenCV interface"
- \ref jkqtpinterfacecimg "CImg interface" - \ref jkqtpinterfacecimg "CImg interface"

View File

@ -20,6 +20,7 @@ Changes, compared to \ref page_whatsnew_V2019_11 "v2019.11" include:
<li> fixed issue <a href="https://github.com/jkriege2/JKQtPlotter/pull/41">#41: Build error when JKQtPlotter_BUILD_INCLUDE_XITS_FONTS set to OFF </a>, thanks to <a href="https://github.com/smistad">user:smistad</a></li> <li> fixed issue <a href="https://github.com/jkriege2/JKQtPlotter/pull/41">#41: Build error when JKQtPlotter_BUILD_INCLUDE_XITS_FONTS set to OFF </a>, thanks to <a href="https://github.com/smistad">user:smistad</a></li>
<li> fixed issue <a href="https://github.com/jkriege2/JKQtPlotter/pull/37">#37: CMake installs things into $PREFIX/doc/*.txt </a>, thanks to <a href="https://github.com/certik">user:certik</a></li> <li> fixed issue <a href="https://github.com/jkriege2/JKQtPlotter/pull/37">#37: CMake installs things into $PREFIX/doc/*.txt </a>, thanks to <a href="https://github.com/certik">user:certik</a></li>
<li> fixed issue <a href="https://github.com/jkriege2/JKQtPlotter/pull/45">#45: Build error on mac jkqtfastplotter.cpp:342:28: Variable has incomplete type 'QPainterPath'</a>, thanks to <a href="https://github.com/abdedixit">user:abdedixit</a></li> <li> fixed issue <a href="https://github.com/jkriege2/JKQtPlotter/pull/45">#45: Build error on mac jkqtfastplotter.cpp:342:28: Variable has incomplete type 'QPainterPath'</a>, thanks to <a href="https://github.com/abdedixit">user:abdedixit</a></li>
<li>renamed/breaking change: renamed JKQTPPlotObject->JKQTPGeometricPlotElement and added new base class JKQTPPlotAnnotationElement</li>
<li>renamed/breaking change: renamed JKQTPColorPaletteStyleAndToolsMixin::setPalette() -> JKQTPColorPaletteStyleAndToolsMixin::setColorPalette()</li> <li>renamed/breaking change: renamed JKQTPColorPaletteStyleAndToolsMixin::setPalette() -> JKQTPColorPaletteStyleAndToolsMixin::setColorPalette()</li>
<li>removed/breaking change: removed the usage of some deprecated functions and objects (e.g. QMatrix)</li> <li>removed/breaking change: removed the usage of some deprecated functions and objects (e.g. QMatrix)</li>
<li>removed/breaking change: removed the overlay elements (derived from JKQTPOverlayElement), which were not very well set up and are more confusing than useful.</li> <li>removed/breaking change: removed the overlay elements (derived from JKQTPOverlayElement), which were not very well set up and are more confusing than useful.</li>

View File

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

View File

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View File

@ -43,7 +43,7 @@ This software is licensed under the term of the [GNU Lesser General Public Licen
- extensive library of image plots (inclusing different color-scale modes, RGBA-plots, overlays/masks) - extensive library of image plots (inclusing different color-scale modes, RGBA-plots, overlays/masks)
- contour plots - contour plots
- geometric forms/annotations - geometric forms/annotations
- can be easily extended by deriving a new graph from JKQTPPlotElement or JKQTPPlotObject - can be easily extended by deriving a new graph from JKQTPPlotElement or JKQTPGeometricPlotElement
- optional: OpenCV, CImg interfaces - optional: OpenCV, CImg interfaces
- CMake-based build system - CMake-based build system
- extensive set of Examples/Tutorials: [https://jkriege2.github.io/JKQtPlotter/example\_tutorial\_projects.html](https://jkriege2.github.io/JKQtPlotter/example_tutorial_projects.html) - extensive set of Examples/Tutorials: [https://jkriege2.github.io/JKQtPlotter/example\_tutorial\_projects.html](https://jkriege2.github.io/JKQtPlotter/example_tutorial_projects.html)

View File

@ -124,16 +124,16 @@ int main(int argc, char* argv[])
cmb->setCurrentIndex(0); cmb->setCurrentIndex(0);
QObject::connect(cmb, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), [&](int index) { QObject::connect(cmb, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), [&](int index) {
for (size_t i=0; i<plot->getPlotter()->getGraphCount(); i++) { for (size_t i=0; i<plot->getPlotter()->getGraphCount(); i++) {
JKQTPPlotObject* obj=dynamic_cast<JKQTPPlotObject*>(plot->getPlotter()->getGraph(i)); JKQTPGeometricPlotElement* obj=dynamic_cast<JKQTPGeometricPlotElement*>(plot->getPlotter()->getGraph(i));
if (obj) { if (obj) {
obj->setDrawMode((index==0)?JKQTPPlotObject::DrawAsGraphicElement:JKQTPPlotObject::DrawAsMathematicalCurve); obj->setDrawMode((index==0)?JKQTPGeometricPlotElement::DrawAsGraphicElement:JKQTPGeometricPlotElement::DrawAsMathematicalCurve);
} }
} }
plot->redrawPlot(); plot->redrawPlot();
for (size_t i=0; i<plotlog->getPlotter()->getGraphCount(); i++) { for (size_t i=0; i<plotlog->getPlotter()->getGraphCount(); i++) {
JKQTPPlotObject* obj=dynamic_cast<JKQTPPlotObject*>(plotlog->getPlotter()->getGraph(i)); JKQTPGeometricPlotElement* obj=dynamic_cast<JKQTPGeometricPlotElement*>(plotlog->getPlotter()->getGraph(i));
if (obj) { if (obj) {
obj->setDrawMode((index==0)?JKQTPPlotObject::DrawAsGraphicElement:JKQTPPlotObject::DrawAsMathematicalCurve); obj->setDrawMode((index==0)?JKQTPGeometricPlotElement::DrawAsGraphicElement:JKQTPGeometricPlotElement::DrawAsMathematicalCurve);
} }
} }
plotlog->redrawPlot(); plotlog->redrawPlot();

View File

@ -113,22 +113,22 @@ The example also adds some control-widgets that allow to change the properties o
cmb->setCurrentIndex(0); cmb->setCurrentIndex(0);
QObject::connect(cmb, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), [plot](int index) { QObject::connect(cmb, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), [plot](int index) {
for (size_t i=0; i<plot->getPlotter()->getGraphCount(); i++) { for (size_t i=0; i<plot->getPlotter()->getGraphCount(); i++) {
JKQTPPlotObject* obj=dynamic_cast<JKQTPPlotObject*>(plot->getPlotter()->getGraph(i)); JKQTPGeometricPlotElement* obj=dynamic_cast<JKQTPGeometricPlotElement*>(plot->getPlotter()->getGraph(i));
if (obj) { if (obj) {
obj->setDrawMode((index==0)?JKQTPPlotObject::DrawAsGraphicElement:JKQTPPlotObject::DrawAsMathematicalCurve); obj->setDrawMode((index==0)?JKQTPGeometricPlotElement::DrawAsGraphicElement:JKQTPGeometricPlotElement::DrawAsMathematicalCurve);
} }
} }
plot->redrawPlot(); plot->redrawPlot();
}); });
``` ```
Now you can play with these controls and see how the different shapes get distorted when these properties change, in dependence of whether the DrawMode is `JKQTPPlotObject::DrawAsMathematicalCurve` or `JKQTPPlotObject::DrawAsGraphicElement`. Now you can play with these controls and see how the different shapes get distorted when these properties change, in dependence of whether the DrawMode is `JKQTPGeometricPlotElement::DrawAsMathematicalCurve` or `JKQTPGeometricPlotElement::DrawAsGraphicElement`.
Here is an example on log-log axes and DrawMode = `JKQTPPlotObject::DrawAsGraphicElement`: Here is an example on log-log axes and DrawMode = `JKQTPGeometricPlotElement::DrawAsGraphicElement`:
![geometric](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/geometric_loglog_DrawAsGraphicElement.png) ![geometric](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/geometric_loglog_DrawAsGraphicElement.png)
Here is an example on log-log axes and DrawMode = `JKQTPPlotObject::DrawAsMathematicalCurve`: Observe how straight lines are bent to the appropriate curve! Here is an example on log-log axes and DrawMode = `JKQTPGeometricPlotElement::DrawAsMathematicalCurve`: Observe how straight lines are bent to the appropriate curve!
![geometric](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/geometric_loglog_DrawAsMathematicalCurve.png) ![geometric](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/geometric_loglog_DrawAsMathematicalCurve.png)

View File

@ -46,9 +46,9 @@ int main(int argc, char* argv[])
cmb->setCurrentIndex(0); cmb->setCurrentIndex(0);
QObject::connect(cmb, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), [plot](int index) { QObject::connect(cmb, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), [plot](int index) {
for (size_t i=0; i<plot->getPlotter()->getGraphCount(); i++) { for (size_t i=0; i<plot->getPlotter()->getGraphCount(); i++) {
JKQTPPlotObject* obj=dynamic_cast<JKQTPPlotObject*>(plot->getPlotter()->getGraph(i)); JKQTPGeometricPlotElement* obj=dynamic_cast<JKQTPGeometricPlotElement*>(plot->getPlotter()->getGraph(i));
if (obj) { if (obj) {
obj->setDrawMode((index==0)?JKQTPPlotObject::DrawAsGraphicElement:JKQTPPlotObject::DrawAsMathematicalCurve); obj->setDrawMode((index==0)?JKQTPGeometricPlotElement::DrawAsGraphicElement:JKQTPGeometricPlotElement::DrawAsMathematicalCurve);
} }
} }
plot->redrawPlot(); plot->redrawPlot();

View File

@ -730,7 +730,7 @@ void JKQTPBoxplotHorizontalGraph::draw(JKQTPEnhancedPainter& painter) {
JKQTPBoxplotVerticalElement::JKQTPBoxplotVerticalElement(JKQTBasePlotter* parent): JKQTPBoxplotVerticalElement::JKQTPBoxplotVerticalElement(JKQTBasePlotter* parent):
JKQTPPlotObject(DrawAsGraphicElement, parent) JKQTPGeometricPlotElement(DrawAsGraphicElement, parent)
{ {
pos=JKQTP_NAN; pos=JKQTP_NAN;
median=JKQTP_NAN; median=JKQTP_NAN;

View File

@ -309,7 +309,7 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPBoxplotHorizontalGraph: public JKQTPBoxplotVer
\see jkqtpstatVAddBoxplot(), \ref JKQTPlotterBasicJKQTPDatastoreStatistics, \ref JKQTPlotterBoxplotsGraphs, \ref JKQTPlotterBoxplotStyling, jkqtpstatAddVBoxplotAndOutliers() \see jkqtpstatVAddBoxplot(), \ref JKQTPlotterBasicJKQTPDatastoreStatistics, \ref JKQTPlotterBoxplotsGraphs, \ref JKQTPlotterBoxplotStyling, jkqtpstatAddVBoxplotAndOutliers()
*/ */
class JKQTPLOTTER_LIB_EXPORT JKQTPBoxplotVerticalElement: public JKQTPPlotObject, public JKQTPGraphBoxplotStyleMixin { class JKQTPLOTTER_LIB_EXPORT JKQTPBoxplotVerticalElement: public JKQTPGeometricPlotElement, public JKQTPGraphBoxplotStyleMixin {
Q_OBJECT Q_OBJECT
public: public:
/** \brief class constructor */ /** \brief class constructor */

View File

@ -43,7 +43,7 @@ JKQTPGeoText::JKQTPGeoText(JKQTPlotter* parent, double x, double y, const QStrin
} }
JKQTPGeoText::JKQTPGeoText(JKQTBasePlotter *parent, double x_, double y_, const QString& text_): JKQTPGeoText::JKQTPGeoText(JKQTBasePlotter *parent, double x_, double y_, const QString& text_):
JKQTPPlotObject(DrawAsGraphicElement, parent), JKQTPGraphTextStyleMixin(parent), x(x_),y(y_),text(text_) JKQTPPlotAnnotationElement(parent), JKQTPGraphTextStyleMixin(parent), x(x_),y(y_),text(text_)
{ {
} }
@ -131,7 +131,7 @@ QColor JKQTPGeoText::getKeyLabelColor() const {
JKQTPGeoSymbol::JKQTPGeoSymbol(JKQTBasePlotter *parent, double x, double y, JKQTPGraphSymbols symbol, double symbolSize, QColor color, QColor fillColor): JKQTPGeoSymbol::JKQTPGeoSymbol(JKQTBasePlotter *parent, double x, double y, JKQTPGraphSymbols symbol, double symbolSize, QColor color, QColor fillColor):
JKQTPPlotObject(DrawAsGraphicElement, parent) JKQTPPlotAnnotationElement(parent)
{ {
this->x=x; this->x=x;
this->y=y; this->y=y;

View File

@ -33,13 +33,13 @@
/*! \brief This virtual JKQTPGraph descendent may be used to display a single symbol (marker). /*! \brief This virtual JKQTPPlotAnnotationElement descendent may be used to display a single symbol (marker).
\ingroup jkqtplotter_annotations \ingroup jkqtplotter_annotations
\see \ref JKQTPlotterGeometricGraphs \see \ref JKQTPlotterGeometricGraphs
*/ */
class JKQTPLOTTER_LIB_EXPORT JKQTPGeoSymbol: public JKQTPPlotObject, public JKQTPGraphSymbolStyleMixin { class JKQTPLOTTER_LIB_EXPORT JKQTPGeoSymbol: public JKQTPPlotAnnotationElement, public JKQTPGraphSymbolStyleMixin {
Q_OBJECT Q_OBJECT
public: public:
/*! \brief class contructor /*! \brief class contructor
@ -65,21 +65,14 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPGeoSymbol: public JKQTPPlotObject, public JKQT
*/ */
JKQTPGeoSymbol(JKQTPlotter* parent, double x, double y, JKQTPGraphSymbols symbol=JKQTPCross, double symbolSize=10, QColor color=QColor("black"), QColor fillColor=QColor("grey")); JKQTPGeoSymbol(JKQTPlotter* parent, double x, double y, JKQTPGraphSymbols symbol=JKQTPCross, double symbolSize=10, QColor color=QColor("black"), QColor fillColor=QColor("grey"));
/*! set the symbol color and symbol fill color */
virtual void setColor(QColor c);
/*! \copydoc x */
void setX(double __value);
/*! \copydoc x */ /*! \copydoc x */
double getX() const; double getX() const;
/*! \copydoc y */ /*! \copydoc y */
void setY(double __value);
/*! \copydoc y */
double getY() const; double getY() const;
/** \copydoc JKQTPGraph::getXMinMax() */ /** \copydoc JKQTPPlotAnnotationElement::getXMinMax() */
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override; virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override;
/** \copydoc JKQTPGraph::getYMinMax() */ /** \copydoc JKQTPPlotAnnotationElement::getYMinMax() */
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override; virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
/** \brief plots the graph to the plotter object specified as parent */ /** \brief plots the graph to the plotter object specified as parent */
@ -89,6 +82,14 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPGeoSymbol: public JKQTPPlotObject, public JKQT
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override; virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override;
/** \brief returns the color to be used for the key label */ /** \brief returns the color to be used for the key label */
virtual QColor getKeyLabelColor() const override; virtual QColor getKeyLabelColor() const override;
public slots:
/*! set the symbol color and symbol fill color */
virtual void setColor(QColor c);
/*! \copydoc x */
void setX(double __value);
/*! \copydoc y */
void setY(double __value);
protected: protected:
/** \brief x-position (in plot coordinates) of the symbol (symbol center) */ /** \brief x-position (in plot coordinates) of the symbol (symbol center) */
@ -99,13 +100,13 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPGeoSymbol: public JKQTPPlotObject, public JKQT
}; };
/*! \brief This JKQTPPlotObject is used to display text. It uses the JKQTMathText /*! \brief This JKQTPPlotAnnotationElement is used to display text. It uses the JKQTMathText
class in order to display LaTeX formulas. class in order to display LaTeX formulas.
\ingroup jkqtplotter_annotations \ingroup jkqtplotter_annotations
\see \ref JKQTPlotterGeometricGraphs \see \ref JKQTPlotterGeometricGraphs
*/ */
class JKQTPLOTTER_LIB_EXPORT JKQTPGeoText: public JKQTPPlotObject, public JKQTPGraphTextStyleMixin { class JKQTPLOTTER_LIB_EXPORT JKQTPGeoText: public JKQTPPlotAnnotationElement, public JKQTPGraphTextStyleMixin {
Q_OBJECT Q_OBJECT
public: public:
/*! \brief class contructor /*! \brief class contructor
@ -145,25 +146,17 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPGeoText: public JKQTPPlotObject, public JKQTPG
*/ */
JKQTPGeoText(JKQTPlotter* parent, double x, double y, const QString& text); JKQTPGeoText(JKQTPlotter* parent, double x, double y, const QString& text);
/*! \copydoc text */
void setText(const QString & __value);
/*! \copydoc text */ /*! \copydoc text */
QString getText() const; QString getText() const;
/*! \copydoc x */ /*! \copydoc x */
void setX(double __value);
/*! \copydoc x */
double getX() const; double getX() const;
/*! \copydoc y */ /*! \copydoc y */
void setY(double __value);
/*! \copydoc y */
double getY() const; double getY() const;
/** \brief set line and fill color */
virtual void setColor(QColor c) ;
/** \copydoc JKQTPPlotObject::getXMinMax() */ /** \copydoc JKQTPPlotAnnotationElement::getXMinMax() */
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override; virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override;
/** \copydoc JKQTPPlotObject::getYMinMax() */ /** \copydoc JKQTPPlotAnnotationElement::getYMinMax() */
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override; virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
/** \brief plots the graph to the plotter object specified as parent */ /** \brief plots the graph to the plotter object specified as parent */
@ -173,6 +166,16 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPGeoText: public JKQTPPlotObject, public JKQTPG
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override; virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override;
/** \brief returns the color to be used for the key label */ /** \brief returns the color to be used for the key label */
virtual QColor getKeyLabelColor() const override; virtual QColor getKeyLabelColor() const override;
public slots:
/** \brief set line and fill color */
virtual void setColor(QColor c) ;
/*! \copydoc text */
void setText(const QString & __value);
/*! \copydoc x */
void setX(double __value);
/*! \copydoc y */
void setY(double __value);
protected: protected:
/** \brief x-position (in plot coordinates) of the text (left/baseline) */ /** \brief x-position (in plot coordinates) of the text (left/baseline) */

View File

@ -28,7 +28,7 @@
#define SmallestGreaterZeroCompare_xvsgz() if ((xvsgz>10.0*DBL_MIN)&&((smallestGreaterZero<10.0*DBL_MIN) || (xvsgz<smallestGreaterZero))) smallestGreaterZero=xvsgz; #define SmallestGreaterZeroCompare_xvsgz() if ((xvsgz>10.0*DBL_MIN)&&((smallestGreaterZero<10.0*DBL_MIN) || (xvsgz<smallestGreaterZero))) smallestGreaterZero=xvsgz;
JKQTPGeoBaseLine::JKQTPGeoBaseLine(QColor color, double lineWidth, Qt::PenStyle style, JKQTBasePlotter* parent, DrawMode drawMode): JKQTPGeoBaseLine::JKQTPGeoBaseLine(QColor color, double lineWidth, Qt::PenStyle style, JKQTBasePlotter* parent, DrawMode drawMode):
JKQTPPlotObject(drawMode, parent) JKQTPGeometricPlotElement(drawMode, parent)
{ {
setLineColor(color); setLineColor(color);
setLineWidth(lineWidth); setLineWidth(lineWidth);
@ -36,7 +36,7 @@ JKQTPGeoBaseLine::JKQTPGeoBaseLine(QColor color, double lineWidth, Qt::PenStyle
} }
JKQTPGeoBaseLine::JKQTPGeoBaseLine(JKQTBasePlotter *parent, DrawMode drawMode): JKQTPGeoBaseLine::JKQTPGeoBaseLine(JKQTBasePlotter *parent, DrawMode drawMode):
JKQTPPlotObject(drawMode, parent) JKQTPGeometricPlotElement(drawMode, parent)
{ {
} }
@ -124,7 +124,7 @@ void JKQTPGeoBaseFilled::drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& re
JKQTPGeoBaseDecoratedHeadLine::JKQTPGeoBaseDecoratedHeadLine(QColor color, double lineWidth, JKQTPLineDecoratorStyle headStyle, Qt::PenStyle style, JKQTBasePlotter *parent, DrawMode drawMode): JKQTPGeoBaseDecoratedHeadLine::JKQTPGeoBaseDecoratedHeadLine(QColor color, double lineWidth, JKQTPLineDecoratorStyle headStyle, Qt::PenStyle style, JKQTBasePlotter *parent, DrawMode drawMode):
JKQTPPlotObject(drawMode, parent) JKQTPGeometricPlotElement(drawMode, parent)
{ {
setLineColor(color); setLineColor(color);
setLineWidth(lineWidth); setLineWidth(lineWidth);
@ -133,7 +133,7 @@ JKQTPGeoBaseDecoratedHeadLine::JKQTPGeoBaseDecoratedHeadLine(QColor color, doubl
} }
JKQTPGeoBaseDecoratedHeadLine::JKQTPGeoBaseDecoratedHeadLine(JKQTBasePlotter *parent, DrawMode drawMode): JKQTPGeoBaseDecoratedHeadLine::JKQTPGeoBaseDecoratedHeadLine(JKQTBasePlotter *parent, DrawMode drawMode):
JKQTPPlotObject(drawMode, parent) JKQTPGeometricPlotElement(drawMode, parent)
{ {
} }
@ -165,7 +165,7 @@ QColor JKQTPGeoBaseDecoratedHeadLine::getKeyLabelColor() const
JKQTPGeoBaseDecoratedLine::JKQTPGeoBaseDecoratedLine(QColor color, double lineWidth, JKQTPLineDecoratorStyle headStyle, JKQTPLineDecoratorStyle tailStyle, Qt::PenStyle style, JKQTBasePlotter *parent, DrawMode drawMode): JKQTPGeoBaseDecoratedLine::JKQTPGeoBaseDecoratedLine(QColor color, double lineWidth, JKQTPLineDecoratorStyle headStyle, JKQTPLineDecoratorStyle tailStyle, Qt::PenStyle style, JKQTBasePlotter *parent, DrawMode drawMode):
JKQTPPlotObject(drawMode, parent) JKQTPGeometricPlotElement(drawMode, parent)
{ {
setLineColor(color); setLineColor(color);
setLineWidth(lineWidth); setLineWidth(lineWidth);
@ -175,7 +175,7 @@ JKQTPGeoBaseDecoratedLine::JKQTPGeoBaseDecoratedLine(QColor color, double lineWi
} }
JKQTPGeoBaseDecoratedLine::JKQTPGeoBaseDecoratedLine(JKQTBasePlotter *parent, DrawMode drawMode): JKQTPGeoBaseDecoratedLine::JKQTPGeoBaseDecoratedLine(JKQTBasePlotter *parent, DrawMode drawMode):
JKQTPPlotObject(drawMode, parent) JKQTPGeometricPlotElement(drawMode, parent)
{ {
} }

View File

@ -31,12 +31,12 @@
#define jkqtpgeobase_H_INCLUDED #define jkqtpgeobase_H_INCLUDED
/*! \brief This JKQTPPlotObject is used as base class for geometric drawing /*! \brief This JKQTPGeometricPlotElement is used as base class for geometric drawing
elements that only consist of lines (i.e. no filling of any kind is done) elements that only consist of lines (i.e. no filling of any kind is done)
\ingroup jkqtplotter_geoplots \ingroup jkqtplotter_geoplots
*/ */
class JKQTPLOTTER_LIB_EXPORT JKQTPGeoBaseLine: public JKQTPPlotObject, public JKQTPGraphLineStyleMixin { class JKQTPLOTTER_LIB_EXPORT JKQTPGeoBaseLine: public JKQTPGeometricPlotElement, public JKQTPGraphLineStyleMixin {
Q_OBJECT Q_OBJECT
public: public:
/*! \brief class contructor /*! \brief class contructor
@ -73,12 +73,12 @@ protected:
/*! \brief This JKQTPPlotObject is used as base class for geometric drawing /*! \brief This JKQTPGeometricPlotElement is used as base class for geometric drawing
elements that consist of lines with one decorated end (i.e. no filling of any kind is done) elements that consist of lines with one decorated end (i.e. no filling of any kind is done)
\ingroup jkqtplotter_geoplots \ingroup jkqtplotter_geoplots
*/ */
class JKQTPLOTTER_LIB_EXPORT JKQTPGeoBaseDecoratedHeadLine: public JKQTPPlotObject, public JKQTPGraphDecoratedHeadLineStyleMixin { class JKQTPLOTTER_LIB_EXPORT JKQTPGeoBaseDecoratedHeadLine: public JKQTPGeometricPlotElement, public JKQTPGraphDecoratedHeadLineStyleMixin {
Q_OBJECT Q_OBJECT
public: public:
/*! \brief class contructor /*! \brief class contructor
@ -116,12 +116,12 @@ protected:
/*! \brief This JKQTPPlotObject is used as base class for geometric drawing /*! \brief This JKQTPGeometricPlotElement is used as base class for geometric drawing
elements that consist of lines with decorated ends (i.e. no filling of any kind is done) elements that consist of lines with decorated ends (i.e. no filling of any kind is done)
\ingroup jkqtplotter_geoplots \ingroup jkqtplotter_geoplots
*/ */
class JKQTPLOTTER_LIB_EXPORT JKQTPGeoBaseDecoratedLine: public JKQTPPlotObject, public JKQTPGraphDecoratedLineStyleMixin { class JKQTPLOTTER_LIB_EXPORT JKQTPGeoBaseDecoratedLine: public JKQTPGeometricPlotElement, public JKQTPGraphDecoratedLineStyleMixin {
Q_OBJECT Q_OBJECT
public: public:
/*! \brief class contructor /*! \brief class contructor
@ -154,7 +154,7 @@ protected:
}; };
/*! \brief This JKQTPPlotObject is used as base class for geometric drawing /*! \brief This JKQTPGeometricPlotElement is used as base class for geometric drawing
elements that only consist of lines (i.e. no filling of any kind is done) elements that only consist of lines (i.e. no filling of any kind is done)
\ingroup jkqtplotter_geoplots \ingroup jkqtplotter_geoplots

View File

@ -160,7 +160,7 @@ void JKQTPGeoLine::draw(JKQTPEnhancedPainter& painter) {
// for non-linear axes, a line might not be drawn as a line, so we need to segment the line (i.e. linear function in coordinate space) // for non-linear axes, a line might not be drawn as a line, so we need to segment the line (i.e. linear function in coordinate space)
// and transform each node to draw the corresponding non-linear curve in pixel-space! // and transform each node to draw the corresponding non-linear curve in pixel-space!
auto fTransform=std::bind([](const JKQTPPlotObject* plot, const QPointF& p) { return plot->transform(p); }, this, std::placeholders::_1); auto fTransform=std::bind([](const JKQTPGeometricPlotElement* plot, const QPointF& p) { return plot->transform(p); }, this, std::placeholders::_1);
QVector<QPointF> points=JKQTPSplitLineIntoPoints(line, fTransform); QVector<QPointF> points=JKQTPSplitLineIntoPoints(line, fTransform);
points=JKQTPSimplyfyLineSegemnts(points); points=JKQTPSimplyfyLineSegemnts(points);
if (points.size()>1) { if (points.size()>1) {
@ -447,7 +447,7 @@ void JKQTPGeoInfiniteLine::draw(JKQTPEnhancedPainter& painter) {
} else { } else {
// for non-linear axes, a line might not be drawn as a line, so we need to segment the line (i.e. linear function in coordinate space) // for non-linear axes, a line might not be drawn as a line, so we need to segment the line (i.e. linear function in coordinate space)
// and transform each node to draw the corresponding non-linear curve in pixel-space! // and transform each node to draw the corresponding non-linear curve in pixel-space!
auto fTransform=std::bind([](const JKQTPPlotObject* plot, const QPointF& p) { return plot->transform(p); }, this, std::placeholders::_1); auto fTransform=std::bind([](const JKQTPGeometricPlotElement* plot, const QPointF& p) { return plot->transform(p); }, this, std::placeholders::_1);
QVector<QPointF> points=JKQTPSplitLineIntoPoints(QLineF(x1,y1,x2,y2), fTransform); QVector<QPointF> points=JKQTPSplitLineIntoPoints(QLineF(x1,y1,x2,y2), fTransform);
points=JKQTPSimplyfyLineSegemnts(points); points=JKQTPSimplyfyLineSegemnts(points);
if (points.size()>1) { if (points.size()>1) {
@ -630,7 +630,7 @@ void JKQTPGeoPolyLines::draw(JKQTPEnhancedPainter& painter) {
} else { } else {
// for non-linear axes, a line might not be drawn as a line, so we need to segment the line (i.e. linear function in coordinate space) // for non-linear axes, a line might not be drawn as a line, so we need to segment the line (i.e. linear function in coordinate space)
// and transform each node to draw the corresponding non-linear curve in pixel-space! // and transform each node to draw the corresponding non-linear curve in pixel-space!
auto fTransform=std::bind([](const JKQTPPlotObject* plot, const QPointF& p) { return plot->transform(p); }, this, std::placeholders::_1); auto fTransform=std::bind([](const JKQTPGeometricPlotElement* plot, const QPointF& p) { return plot->transform(p); }, this, std::placeholders::_1);
QVector<QPointF> points_poly=JKQTPSplitPolylineIntoPoints(points, fTransform); QVector<QPointF> points_poly=JKQTPSplitPolylineIntoPoints(points, fTransform);
points_poly=JKQTPSimplyfyLineSegemnts(points_poly); points_poly=JKQTPSimplyfyLineSegemnts(points_poly);
if (points_poly.size()>1) { if (points_poly.size()>1) {
@ -747,7 +747,7 @@ JKQTPGeoArc::JKQTPGeoArc(JKQTPlotter* parent, double x, double y, double width,
void JKQTPGeoArc::draw(JKQTPEnhancedPainter& painter) { void JKQTPGeoArc::draw(JKQTPEnhancedPainter& painter) {
auto fTransform=std::bind([](const JKQTPPlotObject* plot, const QPointF& p) { return plot->transform(p); }, this, std::placeholders::_1); auto fTransform=std::bind([](const JKQTPGeometricPlotElement* plot, const QPointF& p) { return plot->transform(p); }, this, std::placeholders::_1);
const QPolygonF rect=JKQTPSplitEllipseIntoPoints(fTransform, x,y,width/2.0, height/2.0,angleStart,angleStop, angle); const QPolygonF rect=JKQTPSplitEllipseIntoPoints(fTransform, x,y,width/2.0, height/2.0,angleStart,angleStop, angle);
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();}); painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});

View File

@ -32,7 +32,7 @@
/** \brief This JKQTPPlotObject is used to draw a line, optionally line-end decorations (aka arrows) are pssible, but switched off by default. /** \brief This JKQTPGeometricPlotElement is used to draw a line, optionally line-end decorations (aka arrows) are pssible, but switched off by default.
* \ingroup jkqtplotter_geoplots * \ingroup jkqtplotter_geoplots
* *
* \image html JKQTPGeoLine_HeadTail.png * \image html JKQTPGeoLine_HeadTail.png
@ -40,10 +40,10 @@
* *
* \image html plot_geoline.png * \image html plot_geoline.png
* *
* \note This class support JKQTPPlotObject::DrawMode::DrawAsMathematicalCurve. If set, * \note This class support JKQTPGeometricPlotElement::DrawMode::DrawAsMathematicalCurve. If set,
* and non-linear axes are chosen, the line is drawn as a curves, instead of straight * and non-linear axes are chosen, the line is drawn as a curves, instead of straight
* a straight line. In the mode * a straight line. In the mode
* JKQTPPlotObject::DrawMode::DrawAsGraphicElement the line is drawn as a straight line. * JKQTPGeometricPlotElement::DrawMode::DrawAsGraphicElement the line is drawn as a straight line.
* *
* You can also activate line-end decorators (aka arrows) for this poly-line, by using code like this: * You can also activate line-end decorators (aka arrows) for this poly-line, by using code like this:
* \code * \code
@ -188,14 +188,14 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPGeoLine: public JKQTPGeoBaseDecoratedLine {
/** \copydoc JKQTPPlotObject::getXMinMax() */ /** \copydoc JKQTPGeometricPlotElement::getXMinMax() */
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override; virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override;
/** \copydoc JKQTPPlotObject::getYMinMax() */ /** \copydoc JKQTPGeometricPlotElement::getYMinMax() */
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override; virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
/** \brief plots the graph to the plotter object specified as parent /** \brief plots the graph to the plotter object specified as parent
* *
* \note This function support JKQTPPlotObject::DrawMode::DrawAsMathematicalCurve. If set, * \note This function support JKQTPGeometricPlotElement::DrawMode::DrawAsMathematicalCurve. If set,
* and non-linear axes are chosen, the line will possibly be represented as a curve, * and non-linear axes are chosen, the line will possibly be represented as a curve,
* instead of a straight line. * instead of a straight line.
*/ */
@ -291,7 +291,7 @@ public:
/** \brief This JKQTPPlotObject is used to draw an infinite line /** \brief This JKQTPGeometricPlotElement is used to draw an infinite line
* \ingroup jkqtplotter_geoplots * \ingroup jkqtplotter_geoplots
* *
* an infinite line has a starting point and then goes on in a given direction * an infinite line has a starting point and then goes on in a given direction
@ -300,10 +300,10 @@ public:
* \image html plot_geoinfiniteline.png * \image html plot_geoinfiniteline.png
* *
* *
* \note This class support JKQTPPlotObject::DrawMode::DrawAsMathematicalCurve. If set, * \note This class support JKQTPGeometricPlotElement::DrawMode::DrawAsMathematicalCurve. If set,
* and non-linear axes are chosen, the line is drawn as a curves, instead of straight * and non-linear axes are chosen, the line is drawn as a curves, instead of straight
* a straight line. In the mode * a straight line. In the mode
* JKQTPPlotObject::DrawMode::DrawAsGraphicElement the line is drawn as a straight line. * JKQTPGeometricPlotElement::DrawMode::DrawAsGraphicElement the line is drawn as a straight line.
* *
* You can add a decorator to the head of the line (i.e. the given start point (x,y) ) iff this line is one-sided, i.e. two_sided \c ==false . * You can add a decorator to the head of the line (i.e. the given start point (x,y) ) iff this line is one-sided, i.e. two_sided \c ==false .
* *
@ -339,14 +339,14 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPGeoInfiniteLine: public JKQTPGeoBaseDecoratedH
JKQTPGeoInfiniteLine(JKQTPlotter* parent, double x, double y, double dx, double dy, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine); JKQTPGeoInfiniteLine(JKQTPlotter* parent, double x, double y, double dx, double dy, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine);
/** \copydoc JKQTPPlotObject::getXMinMax() */ /** \copydoc JKQTPGeometricPlotElement::getXMinMax() */
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override; virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override;
/** \copydoc JKQTPPlotObject::getYMinMax() */ /** \copydoc JKQTPGeometricPlotElement::getYMinMax() */
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override; virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
/** \brief plots the graph to the plotter object specified as parent /** \brief plots the graph to the plotter object specified as parent
* *
* \note This function support JKQTPPlotObject::DrawMode::DrawAsMathematicalCurve. If set, * \note This function support JKQTPGeometricPlotElement::DrawMode::DrawAsMathematicalCurve. If set,
* and non-linear axes are chosen, the line will possibly be represented as a curve, * and non-linear axes are chosen, the line will possibly be represented as a curve,
* instead of a straight line. * instead of a straight line.
*/ */
@ -391,15 +391,15 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPGeoInfiniteLine: public JKQTPGeoBaseDecoratedH
}; };
/** \brief This JKQTPPlotObject is used to draw a poly line /** \brief This JKQTPGeometricPlotElement is used to draw a poly line
* \ingroup jkqtplotter_geoplots * \ingroup jkqtplotter_geoplots
* *
* \image html plot_geolines.png * \image html plot_geolines.png
* *
* \note This class support JKQTPPlotObject::DrawMode::DrawAsMathematicalCurve. If set, * \note This class support JKQTPGeometricPlotElement::DrawMode::DrawAsMathematicalCurve. If set,
* and non-linear axes are chosen, the points of the poly-line will be possibly * and non-linear axes are chosen, the points of the poly-line will be possibly
* connected by curves, instead of straight lines. In the mode * connected by curves, instead of straight lines. In the mode
* JKQTPPlotObject::DrawMode::DrawAsGraphicElement the points are connected by straight * JKQTPGeometricPlotElement::DrawMode::DrawAsGraphicElement the points are connected by straight
* lines, independent of the linearity or non-linearity of the coordinate axes. * lines, independent of the linearity or non-linearity of the coordinate axes.
* *
* You can also activate line-end decorators (aka arrows) for this poly-line, by using code like this: * You can also activate line-end decorators (aka arrows) for this poly-line, by using code like this:
@ -454,17 +454,17 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPGeoPolyLines: public JKQTPGeoBaseDecoratedLine
JKQTPGeoPolyLines(JKQTPlotter* parent, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine); JKQTPGeoPolyLines(JKQTPlotter* parent, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine);
/** \copydoc JKQTPPlotObject::getXMinMax() */ /** \copydoc JKQTPGeometricPlotElement::getXMinMax() */
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override; virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override;
/** \copydoc JKQTPPlotObject::getYMinMax() */ /** \copydoc JKQTPGeometricPlotElement::getYMinMax() */
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override; virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
/** \brief plots the graph to the plotter object specified as parent /** \brief plots the graph to the plotter object specified as parent
* *
* \note This function support JKQTPPlotObject::DrawMode::DrawAsMathematicalCurve. If set, * \note This function support JKQTPGeometricPlotElement::DrawMode::DrawAsMathematicalCurve. If set,
* and non-linear axes are chosen, the points of the poly-line will be possibly * and non-linear axes are chosen, the points of the poly-line will be possibly
* connected by curves, instead of straight lines. In the mode * connected by curves, instead of straight lines. In the mode
* JKQTPPlotObject::DrawMode::DrawAsGraphicElement the points are connected by straight * JKQTPGeometricPlotElement::DrawMode::DrawAsGraphicElement the points are connected by straight
* lines, independent of the linearity or non-linearity of the coordinate axes. * lines, independent of the linearity or non-linearity of the coordinate axes.
*/ */
virtual void draw(JKQTPEnhancedPainter& painter) override; virtual void draw(JKQTPEnhancedPainter& painter) override;
@ -504,7 +504,7 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPGeoPolyLines: public JKQTPGeoBaseDecoratedLine
}; };
/** \brief This JKQTPPlotObject is used to draw an arc /** \brief This JKQTPGeometricPlotElement is used to draw an arc
* \ingroup jkqtplotter_geoplots * \ingroup jkqtplotter_geoplots
* *
* *
@ -512,7 +512,7 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPGeoPolyLines: public JKQTPGeoBaseDecoratedLine
* *
* \image html plot_geopie.png * \image html plot_geopie.png
* *
* \note This class support the JKQTPPlotObject::DrawMode::DrawAsMathematicalCurve only. * \note This class support the JKQTPGeometricPlotElement::DrawMode::DrawAsMathematicalCurve only.
* This means that arcs are always treated as mathematical curves, as no meaningful * This means that arcs are always treated as mathematical curves, as no meaningful
* parametrization for arcs on non-linear axes could be found! * parametrization for arcs on non-linear axes could be found!
* *
@ -552,15 +552,15 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPGeoArc: public JKQTPGeoBaseLine {
*/ */
JKQTPGeoArc(JKQTPlotter* parent, double x, double y, double width, double height, double angleStart, double angleStop, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine); JKQTPGeoArc(JKQTPlotter* parent, double x, double y, double width, double height, double angleStart, double angleStop, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine);
/** \copydoc JKQTPPlotObject::getXMinMax() */ /** \copydoc JKQTPGeometricPlotElement::getXMinMax() */
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override; virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override;
/** \copydoc JKQTPPlotObject::getYMinMax() */ /** \copydoc JKQTPGeometricPlotElement::getYMinMax() */
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override; virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
/** \brief plots the graph to the plotter object specified as parent /** \brief plots the graph to the plotter object specified as parent
* *
* \note This function support the JKQTPPlotObject::DrawMode::DrawAsMathematicalCurve only. * \note This function support the JKQTPGeometricPlotElement::DrawMode::DrawAsMathematicalCurve only.
* This means that arcs are always treated as mathematical curves, as no meaningful * This means that arcs are always treated as mathematical curves, as no meaningful
* parametrization for arcs on non-linear axes could be found! * parametrization for arcs on non-linear axes could be found!
*/ */

View File

@ -77,25 +77,25 @@ JKQTPGeoRectangle::JKQTPGeoRectangle(JKQTPlotter *parent, QPointF bottomleft, QP
{ {
} }
JKQTPGeoRectangle::JKQTPGeoRectangle(JKQTBasePlotter *parent, const QPointF &center, const QSizeF &size, double angle, QColor color, double lineWidth, Qt::PenStyle style, QColor fillColor, Qt::BrushStyle fillStyle, JKQTPPlotObject::DrawMode drawMode): JKQTPGeoRectangle::JKQTPGeoRectangle(JKQTBasePlotter *parent, const QPointF &center, const QSizeF &size, double angle, QColor color, double lineWidth, Qt::PenStyle style, QColor fillColor, Qt::BrushStyle fillStyle, JKQTPGeometricPlotElement::DrawMode drawMode):
JKQTPGeoRectangle(parent, center.x(), center.y(), size.width(), size.height(), angle, color, lineWidth, style, fillColor, fillStyle, drawMode) JKQTPGeoRectangle(parent, center.x(), center.y(), size.width(), size.height(), angle, color, lineWidth, style, fillColor, fillStyle, drawMode)
{ {
} }
JKQTPGeoRectangle::JKQTPGeoRectangle(JKQTPlotter *parent, const QPointF &center, const QSizeF &size, double angle, QColor color, double lineWidth, Qt::PenStyle style, QColor fillColor, Qt::BrushStyle fillStyle, JKQTPPlotObject::DrawMode drawMode): JKQTPGeoRectangle::JKQTPGeoRectangle(JKQTPlotter *parent, const QPointF &center, const QSizeF &size, double angle, QColor color, double lineWidth, Qt::PenStyle style, QColor fillColor, Qt::BrushStyle fillStyle, JKQTPGeometricPlotElement::DrawMode drawMode):
JKQTPGeoRectangle(parent->getPlotter(), center, size, angle, color, lineWidth, style, fillColor, fillStyle, drawMode) JKQTPGeoRectangle(parent->getPlotter(), center, size, angle, color, lineWidth, style, fillColor, fillStyle, drawMode)
{ {
} }
JKQTPGeoRectangle::JKQTPGeoRectangle(JKQTBasePlotter *parent, const QPointF &center, const QSizeF &size, QColor color, double lineWidth, Qt::PenStyle style, QColor fillColor, Qt::BrushStyle fillStyle, JKQTPPlotObject::DrawMode drawMode): JKQTPGeoRectangle::JKQTPGeoRectangle(JKQTBasePlotter *parent, const QPointF &center, const QSizeF &size, QColor color, double lineWidth, Qt::PenStyle style, QColor fillColor, Qt::BrushStyle fillStyle, JKQTPGeometricPlotElement::DrawMode drawMode):
JKQTPGeoRectangle(parent, center.x(), center.y(), size.width(), size.height(), color, lineWidth, style, fillColor, fillStyle, drawMode) JKQTPGeoRectangle(parent, center.x(), center.y(), size.width(), size.height(), color, lineWidth, style, fillColor, fillStyle, drawMode)
{ {
} }
JKQTPGeoRectangle::JKQTPGeoRectangle(JKQTPlotter *parent, const QPointF &center, const QSizeF &size, QColor color, double lineWidth, Qt::PenStyle style, QColor fillColor, Qt::BrushStyle fillStyle, JKQTPPlotObject::DrawMode drawMode): JKQTPGeoRectangle::JKQTPGeoRectangle(JKQTPlotter *parent, const QPointF &center, const QSizeF &size, QColor color, double lineWidth, Qt::PenStyle style, QColor fillColor, Qt::BrushStyle fillStyle, JKQTPGeometricPlotElement::DrawMode drawMode):
JKQTPGeoRectangle(parent->getPlotter(), center, size, color, lineWidth, style, fillColor, fillStyle, drawMode) JKQTPGeoRectangle(parent->getPlotter(), center, size, color, lineWidth, style, fillColor, fillStyle, drawMode)
{ {
@ -152,7 +152,7 @@ void JKQTPGeoRectangle::draw(JKQTPEnhancedPainter& painter) {
if ((getDrawMode()==DrawAsGraphicElement) || (getParent()->getXAxis()->isLinearAxis() && getParent()->getYAxis()->isLinearAxis())) { if ((getDrawMode()==DrawAsGraphicElement) || (getParent()->getXAxis()->isLinearAxis() && getParent()->getYAxis()->isLinearAxis())) {
rect=transform(poly); rect=transform(poly);
} else { } else {
auto fTransform=std::bind([](const JKQTPPlotObject* plot, const QPointF& p) { return plot->transform(p); }, this, std::placeholders::_1); auto fTransform=std::bind([](const JKQTPGeometricPlotElement* plot, const QPointF& p) { return plot->transform(p); }, this, std::placeholders::_1);
rect=JKQTPSplitPolylineIntoPoints(poly, fTransform); rect=JKQTPSplitPolylineIntoPoints(poly, fTransform);
} }
for (const auto& p:poly) { for (const auto& p:poly) {
@ -331,7 +331,7 @@ void JKQTPGeoPolygon::draw(JKQTPEnhancedPainter& painter) {
} else { } else {
// for non-linear axes, a line might not be drawn as a line, so we need to segment the line (i.e. linear function in coordinate space) // for non-linear axes, a line might not be drawn as a line, so we need to segment the line (i.e. linear function in coordinate space)
// and transform each node to draw the corresponding non-linear curve in pixel-space! // and transform each node to draw the corresponding non-linear curve in pixel-space!
auto fTransform=std::bind([](const JKQTPPlotObject* plot, const QPointF& p) { return plot->transform(p); }, this, std::placeholders::_1); auto fTransform=std::bind([](const JKQTPGeometricPlotElement* plot, const QPointF& p) { return plot->transform(p); }, this, std::placeholders::_1);
QVector<QPointF> polyp=points; QVector<QPointF> polyp=points;
if (polyp.first()!=polyp.last()) polyp.push_back(polyp.first()); if (polyp.first()!=polyp.last()) polyp.push_back(polyp.first());
QPolygonF path=JKQTPSplitPolylineIntoPoints(polyp, fTransform); QPolygonF path=JKQTPSplitPolylineIntoPoints(polyp, fTransform);
@ -462,7 +462,7 @@ void JKQTPGeoEllipse::drawInternal(JKQTPEnhancedPainter& painter, double angleSt
painter.setBrush(getFillBrush(painter, parent)); painter.setBrush(getFillBrush(painter, parent));
auto fTransform=std::bind([](const JKQTPPlotObject* plot, const QPointF& p) { return plot->transform(p); }, this, std::placeholders::_1); auto fTransform=std::bind([](const JKQTPGeometricPlotElement* plot, const QPointF& p) { return plot->transform(p); }, this, std::placeholders::_1);
QPolygonF rect; QPolygonF rect;
if(mode==InternalDrawMode::Ellipse) { if(mode==InternalDrawMode::Ellipse) {
rect=JKQTPSplitEllipseIntoPoints(fTransform, x,y,width/2.0, height/2.0,0,360, angle); rect=JKQTPSplitEllipseIntoPoints(fTransform, x,y,width/2.0, height/2.0,0,360, angle);

View File

@ -33,15 +33,15 @@
/** \brief This JKQTPPlotObject is used to draw a rectangle /** \brief This JKQTPGeometricPlotElement is used to draw a rectangle
* \ingroup jkqtplotter_geoplots * \ingroup jkqtplotter_geoplots
* *
* \image html plot_georectangle.png * \image html plot_georectangle.png
* *
* \note This class support JKQTPPlotObject::DrawMode::DrawAsMathematicalCurve. If set, * \note This class support JKQTPGeometricPlotElement::DrawMode::DrawAsMathematicalCurve. If set,
* and non-linear axes are chosen, the corner points of the rectangle will be possibly * and non-linear axes are chosen, the corner points of the rectangle will be possibly
* connected by curves, instead of straight lines. In the mode * connected by curves, instead of straight lines. In the mode
* JKQTPPlotObject::DrawMode::DrawAsGraphicElement the corners are connected by straight * JKQTPGeometricPlotElement::DrawMode::DrawAsGraphicElement the corners are connected by straight
* lines, independent of the linearity or non-linearity of the coordinate axes. * lines, independent of the linearity or non-linearity of the coordinate axes.
* *
* \see \ref JKQTPlotterGeometricGraphs * \see \ref JKQTPlotterGeometricGraphs
@ -184,14 +184,14 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPGeoRectangle: public JKQTPGeoBaseFilled {
/** \copydoc JKQTPPlotObject::getXMinMax() */ /** \copydoc JKQTPGeometricPlotElement::getXMinMax() */
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override; virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override;
/** \copydoc JKQTPPlotObject::getYMinMax() */ /** \copydoc JKQTPGeometricPlotElement::getYMinMax() */
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override; virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
/** \brief plots the graph to the plotter object specified as parent /** \brief plots the graph to the plotter object specified as parent
* *
* \note This function support JKQTPPlotObject::DrawMode::DrawAsMathematicalCurve. If set, * \note This function support JKQTPGeometricPlotElement::DrawMode::DrawAsMathematicalCurve. If set,
* and non-linear axes are chosen, the corner points of the rectangle will be possibly * and non-linear axes are chosen, the corner points of the rectangle will be possibly
* connected by curves, instead of straight lines. * connected by curves, instead of straight lines.
*/ */
@ -256,12 +256,12 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPGeoRectangle: public JKQTPGeoBaseFilled {
}; };
/** \brief This JKQTPPlotObject is used to draw a polygon /** \brief This JKQTPGeometricPlotElement is used to draw a polygon
* \ingroup jkqtplotter_geoplots * \ingroup jkqtplotter_geoplots
* *
* \image html plot_geopolygon.png * \image html plot_geopolygon.png
* *
* \note This function support JKQTPPlotObject::DrawMode::DrawAsMathematicalCurve. If set, * \note This function support JKQTPGeometricPlotElement::DrawMode::DrawAsMathematicalCurve. If set,
* and non-linear axes are chosen, the points of the polygon will be possibly * and non-linear axes are chosen, the points of the polygon will be possibly
* connected by curves, instead of straight lines. * connected by curves, instead of straight lines.
* *
@ -316,14 +316,14 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPGeoPolygon: public JKQTPGeoBaseFilled {
JKQTPGeoPolygon(JKQTPlotter* parent, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine, QColor fillColor=QColor("transparent"), Qt::BrushStyle fillStyle=Qt::SolidPattern, DrawMode drawMode=DrawAsGraphicElement); JKQTPGeoPolygon(JKQTPlotter* parent, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine, QColor fillColor=QColor("transparent"), Qt::BrushStyle fillStyle=Qt::SolidPattern, DrawMode drawMode=DrawAsGraphicElement);
/** \copydoc JKQTPPlotObject::getXMinMax() */ /** \copydoc JKQTPGeometricPlotElement::getXMinMax() */
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override; virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override;
/** \copydoc JKQTPPlotObject::getYMinMax() */ /** \copydoc JKQTPGeometricPlotElement::getYMinMax() */
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override; virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
/** \brief plots the graph to the plotter object specified as parent /** \brief plots the graph to the plotter object specified as parent
* *
* \note This function support JKQTPPlotObject::DrawMode::DrawAsMathematicalCurve. If set, * \note This function support JKQTPGeometricPlotElement::DrawMode::DrawAsMathematicalCurve. If set,
* and non-linear axes are chosen, the points of the polygon will be possibly * and non-linear axes are chosen, the points of the polygon will be possibly
* connected by curves, instead of straight lines. * connected by curves, instead of straight lines.
*/ */
@ -364,17 +364,17 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPGeoPolygon: public JKQTPGeoBaseFilled {
QVector<QPointF> points; QVector<QPointF> points;
}; };
/** \brief This JKQTPPlotObject is used to draw an ellipse /** \brief This JKQTPGeometricPlotElement is used to draw an ellipse
* \ingroup jkqtplotter_geoplots * \ingroup jkqtplotter_geoplots
* *
* \image html plot_geoellipse.png * \image html plot_geoellipse.png
* *
* \image html plot_geoellipse_rotated.png * \image html plot_geoellipse_rotated.png
* *
* \note This function support the JKQTPPlotObject::DrawMode::DrawAsMathematicalCurve only. * \note This function support the JKQTPGeometricPlotElement::DrawMode::DrawAsMathematicalCurve only.
* This means that ellipses are always treated as mathematical curves, as no meaningful * This means that ellipses are always treated as mathematical curves, as no meaningful
* parametrization for ellipses on non-linear axes could be found! In the mode * parametrization for ellipses on non-linear axes could be found! In the mode
* JKQTPPlotObject::DrawMode::DrawAsGraphicElement the points are connected by straight * JKQTPGeometricPlotElement::DrawMode::DrawAsGraphicElement the points are connected by straight
* lines, independent of the linearity or non-linearity of the coordinate axes. * lines, independent of the linearity or non-linearity of the coordinate axes.
* *
* \see <a href="http://www.codeguru.com/cpp/g-m/gdi/article.php/c131">http://www.codeguru.com/cpp/g-m/gdi/article.php/c131</a> and * \see <a href="http://www.codeguru.com/cpp/g-m/gdi/article.php/c131">http://www.codeguru.com/cpp/g-m/gdi/article.php/c131</a> and
@ -472,7 +472,7 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPGeoEllipse: public JKQTPGeoRectangle {
/** \brief plots the graph to the plotter object specified as parent /** \brief plots the graph to the plotter object specified as parent
* *
* \note This function support the JKQTPPlotObject::DrawMode::DrawAsMathematicalCurve only. * \note This function support the JKQTPGeometricPlotElement::DrawMode::DrawAsMathematicalCurve only.
* This means that ellipses are always treated as mathematical curves, as no meaningful * This means that ellipses are always treated as mathematical curves, as no meaningful
* parametrization for ellipses on non-linear axes could be found!*/ * parametrization for ellipses on non-linear axes could be found!*/
virtual void draw(JKQTPEnhancedPainter& painter) override; virtual void draw(JKQTPEnhancedPainter& painter) override;
@ -493,7 +493,7 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPGeoEllipse: public JKQTPGeoRectangle {
/** \brief This JKQTPPlotObject is used to draw a pie /** \brief This JKQTPGeometricPlotElement is used to draw a pie
* \ingroup jkqtplotter_geoplots * \ingroup jkqtplotter_geoplots
* *
* *
@ -512,7 +512,7 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPGeoEllipse: public JKQTPGeoRectangle {
* plot->addGraph(new JKQTPGeoText(plot, 3.5+0.55*cos(110.0/180.0*JKQTPSTATISTICS_PI),0.5+0.55*sin(110.0/180.0*JKQTPSTATISTICS_PI), "110\\degree", 10, QColor("grey"))); * plot->addGraph(new JKQTPGeoText(plot, 3.5+0.55*cos(110.0/180.0*JKQTPSTATISTICS_PI),0.5+0.55*sin(110.0/180.0*JKQTPSTATISTICS_PI), "110\\degree", 10, QColor("grey")));
* \endcode * \endcode
* *
* \note This function support the JKQTPPlotObject::DrawMode::DrawAsMathematicalCurve only. * \note This function support the JKQTPGeometricPlotElement::DrawMode::DrawAsMathematicalCurve only.
* This means that pies are always treated as mathematical curves, as no meaningful * This means that pies are always treated as mathematical curves, as no meaningful
* parametrization for pies on non-linear axes could be found! * parametrization for pies on non-linear axes could be found!
* *
@ -555,15 +555,15 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPGeoPie: public JKQTPGeoEllipse {
JKQTPGeoPie(JKQTPlotter* parent, double x, double y, double width, double height, double angleStart, double angleStop, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine, QColor fillColor=QColor("transparent"), Qt::BrushStyle fillStyle=Qt::SolidPattern, DrawMode drawMode=DrawAsGraphicElement); JKQTPGeoPie(JKQTPlotter* parent, double x, double y, double width, double height, double angleStart, double angleStop, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine, QColor fillColor=QColor("transparent"), Qt::BrushStyle fillStyle=Qt::SolidPattern, DrawMode drawMode=DrawAsGraphicElement);
/** \copydoc JKQTPPlotObject::getXMinMax() */ /** \copydoc JKQTPGeometricPlotElement::getXMinMax() */
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override; virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override;
/** \copydoc JKQTPPlotObject::getYMinMax() */ /** \copydoc JKQTPGeometricPlotElement::getYMinMax() */
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override; virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
/** \brief plots the graph to the plotter object specified as parent /** \brief plots the graph to the plotter object specified as parent
* *
* \note This function support the JKQTPPlotObject::DrawMode::DrawAsMathematicalCurve only. * \note This function support the JKQTPGeometricPlotElement::DrawMode::DrawAsMathematicalCurve only.
* This means that pies are always treated as mathematical curves, as no meaningful * This means that pies are always treated as mathematical curves, as no meaningful
* parametrization for pies on non-linear axes could be found!*/ * parametrization for pies on non-linear axes could be found!*/
virtual void draw(JKQTPEnhancedPainter& painter) override; virtual void draw(JKQTPEnhancedPainter& painter) override;
@ -586,14 +586,14 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPGeoPie: public JKQTPGeoEllipse {
/** \brief This JKQTPPlotObject is used to draw a chord /** \brief This JKQTPGeometricPlotElement is used to draw a chord
* \ingroup jkqtplotter_geoplots * \ingroup jkqtplotter_geoplots
* *
* A chord on linear and log-log axes (start angle: 10deg and end-angle 110deg): * A chord on linear and log-log axes (start angle: 10deg and end-angle 110deg):
* *
* \image html plot_geochord.png * \image html plot_geochord.png
* *
* \note This function support the JKQTPPlotObject::DrawMode::DrawAsMathematicalCurve only. * \note This function support the JKQTPGeometricPlotElement::DrawMode::DrawAsMathematicalCurve only.
* This means that chords are always treated as mathematical curves, as no meaningful * This means that chords are always treated as mathematical curves, as no meaningful
* parametrization for chords on non-linear axes could be found! * parametrization for chords on non-linear axes could be found!
* *
@ -635,14 +635,14 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPGeoChord: public JKQTPGeoPie {
*/ */
JKQTPGeoChord(JKQTPlotter* parent, double x, double y, double width, double height, double angleStart, double angleStop, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine, QColor fillColor=QColor("transparent"), Qt::BrushStyle fillStyle=Qt::SolidPattern, DrawMode drawMode=DrawAsGraphicElement); JKQTPGeoChord(JKQTPlotter* parent, double x, double y, double width, double height, double angleStart, double angleStop, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine, QColor fillColor=QColor("transparent"), Qt::BrushStyle fillStyle=Qt::SolidPattern, DrawMode drawMode=DrawAsGraphicElement);
/** \copydoc JKQTPPlotObject::getXMinMax() */ /** \copydoc JKQTPGeometricPlotElement::getXMinMax() */
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override; virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override;
/** \copydoc JKQTPPlotObject::getYMinMax() */ /** \copydoc JKQTPGeometricPlotElement::getYMinMax() */
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override; virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
/** \brief plots the graph to the plotter object specified as parent /** \brief plots the graph to the plotter object specified as parent
* *
* \note This function support the JKQTPPlotObject::DrawMode::DrawAsMathematicalCurve only. * \note This function support the JKQTPGeometricPlotElement::DrawMode::DrawAsMathematicalCurve only.
* This means that chords are always treated as mathematical curves, as no meaningful * This means that chords are always treated as mathematical curves, as no meaningful
* parametrization for chords on non-linear axes could be found! * parametrization for chords on non-linear axes could be found!
*/ */

View File

@ -40,7 +40,7 @@
JKQTPViolinplotVerticalElement::JKQTPViolinplotVerticalElement(JKQTBasePlotter* parent): JKQTPViolinplotVerticalElement::JKQTPViolinplotVerticalElement(JKQTBasePlotter* parent):
JKQTPPlotObject(DrawAsGraphicElement, parent) JKQTPGeometricPlotElement(DrawAsGraphicElement, parent)
{ {
pos=JKQTP_NAN; pos=JKQTP_NAN;
median=JKQTP_NAN; median=JKQTP_NAN;

View File

@ -60,7 +60,7 @@
\see \ref JKQTPlotterViolinplotGraphs \see \ref JKQTPlotterViolinplotGraphs
*/ */
class JKQTPLOTTER_LIB_EXPORT JKQTPViolinplotVerticalElement: public JKQTPPlotObject, public JKQTPGraphViolinplotStyleMixin { class JKQTPLOTTER_LIB_EXPORT JKQTPViolinplotVerticalElement: public JKQTPGeometricPlotElement, public JKQTPGraphViolinplotStyleMixin {
Q_OBJECT Q_OBJECT
public: public:
/** \brief class constructor */ /** \brief class constructor */

View File

@ -666,24 +666,24 @@ bool JKQTPXYGraph::getIndexRange(int& imin, int& imax) const
JKQTPPlotObject::JKQTPPlotObject(DrawMode drawMode, JKQTBasePlotter *parent): JKQTPGeometricPlotElement::JKQTPGeometricPlotElement(DrawMode drawMode, JKQTBasePlotter *parent):
JKQTPPlotElement(parent), m_drawMode(drawMode) JKQTPPlotElement(parent), m_drawMode(drawMode)
{ {
} }
void JKQTPPlotObject::setDrawMode(JKQTPPlotObject::DrawMode mode) void JKQTPGeometricPlotElement::setDrawMode(JKQTPGeometricPlotElement::DrawMode mode)
{ {
m_drawMode=mode; m_drawMode=mode;
} }
JKQTPPlotObject::DrawMode JKQTPPlotObject::getDrawMode() const JKQTPGeometricPlotElement::DrawMode JKQTPGeometricPlotElement::getDrawMode() const
{ {
return m_drawMode; return m_drawMode;
} }
JKQTPPlotObject::~JKQTPPlotObject() JKQTPGeometricPlotElement::~JKQTPGeometricPlotElement()
= default; = default;
@ -988,3 +988,13 @@ void JKQTPXYBaselineGraph::setBaseline(double __value)
{ {
m_baseline=__value; m_baseline=__value;
} }
JKQTPPlotAnnotationElement::JKQTPPlotAnnotationElement(JKQTBasePlotter *parent)
{
}
JKQTPPlotAnnotationElement::~JKQTPPlotAnnotationElement()
{
}

View File

@ -436,35 +436,35 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPGraph: public JKQTPPlotElement {
/** \brief this is the virtual base class of all JKQTPPlotElement's in a JKQTPlotter plot that /** \brief this is the virtual base class of all JKQTPPlotElement's in a JKQTPlotter plot that
* represent geometric forms or annotations. * represent geometric forms.
* \ingroup jkqtplotter_basegraphs * \ingroup jkqtplotter_basegraphs
* *
* \see \ref jkqtplotter_graphsgroup_classstructure, \ref JKQTPlotterGeometricGraphs * \see \ref jkqtplotter_graphsgroup_classstructure, \ref JKQTPlotterGeometricGraphs
* *
* \section JKQTPPlotObject_coordinates Coordinate Systems * \section JKQTPGeometricPlotElement_coordinates Coordinate Systems
* JKQTPPlotObject's have extended coordinate transform capabilities, because in addition to using * JKQTPGeometricPlotElement's have extended coordinate transform capabilities, because in addition to using
* the plot coordinates, you can also choose to use different other coordinate systems. * the plot coordinates, you can also choose to use different other coordinate systems.
* *
* \section JKQTPPlotObject_DrawMode Draw Modes * \section JKQTPGeometricPlotElement_DrawMode Draw Modes
* *
* \copydetails m_drawMode * \copydetails m_drawMode
*/ */
class JKQTPLOTTER_LIB_EXPORT JKQTPPlotObject: public JKQTPPlotElement { class JKQTPLOTTER_LIB_EXPORT JKQTPGeometricPlotElement: public JKQTPPlotElement {
Q_OBJECT Q_OBJECT
public: public:
/** \brief indicates how to draw the geometric object */ /** \brief indicates how to draw the geometric object */
enum DrawMode { enum DrawMode {
DrawAsGraphicElement, /*!< \brief draw lines as lines (i.e. graphic elements) \image html JKQTPPlotObject_DrawAsGraphicElement.png */ DrawAsGraphicElement, /*!< \brief draw lines as lines (i.e. graphic elements) \image html JKQTPGeometricPlotElement_DrawAsGraphicElement.png */
DrawAsMathematicalCurve /*!< \brief draw lines as the mathematically correct curve \image html JKQTPPlotObject_DrawAsMathematicalCurve.png */ DrawAsMathematicalCurve /*!< \brief draw lines as the mathematically correct curve \image html JKQTPGeometricPlotElement_DrawAsMathematicalCurve.png */
}; };
Q_ENUM(DrawMode) Q_ENUM(DrawMode)
/** \brief class constructor */ /** \brief class constructor */
explicit JKQTPPlotObject(DrawMode drawMode=DrawAsGraphicElement, JKQTBasePlotter* parent=nullptr); explicit JKQTPGeometricPlotElement(DrawMode drawMode=DrawAsGraphicElement, JKQTBasePlotter* parent=nullptr);
/** \brief default wirtual destructor */ /** \brief default wirtual destructor */
virtual ~JKQTPPlotObject() ; virtual ~JKQTPGeometricPlotElement() ;
/** \copybrief m_drawMode /** \copybrief m_drawMode
* *
* \return the currently set DrawMode * \return the currently set DrawMode
@ -473,27 +473,27 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPPlotObject: public JKQTPPlotElement {
DrawMode getDrawMode() const; DrawMode getDrawMode() const;
Q_PROPERTY(DrawMode drawMode READ getDrawMode WRITE setDrawMode) Q_PROPERTY(DrawMode drawMode READ getDrawMode WRITE setDrawMode)
public slots: public slots:
/** \copybrief m_drawMode /** \copybrief m_drawMode
* *
* \param mode the DrawMode to use from now on * \param mode the DrawMode to use from now on
* \see m_drawMode, DrawMode * \see m_drawMode, DrawMode
*/ */
void setDrawMode(DrawMode mode); void setDrawMode(DrawMode mode);
protected: protected:
/** \brief indicated whether to draw lines as graphic elements (even on non-linear coordinate systems), /** \brief indicated whether to draw lines as graphic elements (even on non-linear coordinate systems),
* or as mathematically correct curves * or as mathematically correct curves
* *
* It is possible to define in which ways the forms shall be treated/drawn into non-linear * It is possible to define in which ways the forms shall be treated/drawn into non-linear
* coordinate systems (e.g. semi-log or log-log plots). Imagine drawing a line from (x1,y1) to (x2,y2) * coordinate systems (e.g. semi-log or log-log plots). Imagine drawing a line from (x1,y1) to (x2,y2)
* In a linear coordinate system, this is always a line, but in a non-linear system, the line might * In a linear coordinate system, this is always a line, but in a non-linear system, the line might
* have to be represented by a curve instead. Depending on how you want to use the JKQTPPlotObject you * have to be represented by a curve instead. Depending on how you want to use the JKQTPGeometricPlotElement you
* can choose to still draw it as a line connecting the points (x1,y1) and (x2,y2), or as the - * can choose to still draw it as a line connecting the points (x1,y1) and (x2,y2), or as the -
* mathematically correct - curve connecting these two points: * mathematically correct - curve connecting these two points:
* *
* \image html JKQTPPlotObject_DrawAsMathematicalCurve.png * \image html JKQTPGeometricPlotElement_DrawAsMathematicalCurve.png
* *
* \image html JKQTPPlotObject_DrawAsGraphicElement.png * \image html JKQTPGeometricPlotElement_DrawAsGraphicElement.png
* *
* \see DrawMode, setDrawMode(), getDrawMode() * \see DrawMode, setDrawMode(), getDrawMode()
*/ */
@ -502,6 +502,29 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPPlotObject: public JKQTPPlotElement {
}; };
/** \brief this is the virtual base class of all JKQTPPlotElement's in a JKQTPlotter plot that
* represent annotations of a plot. It differs from JKQTPGeometricPlotElement by not providing a
* selection of drawModes, as annotations are always drawn as graphic elements.
* \ingroup jkqtplotter_basegraphs
*
*/
class JKQTPLOTTER_LIB_EXPORT JKQTPPlotAnnotationElement: public JKQTPPlotElement {
Q_OBJECT
public:
/** \brief class constructor */
explicit JKQTPPlotAnnotationElement(JKQTBasePlotter* parent=nullptr);
/** \brief default wirtual destructor */
virtual ~JKQTPPlotAnnotationElement() ;
public slots:
protected:
};
/** \brief This virtual JKQTPGraph descendent may be used as base for all graphs that use at least two columns /** \brief This virtual JKQTPGraph descendent may be used as base for all graphs that use at least two columns
* that specify x and y coordinates for the single plot points. * that specify x and y coordinates for the single plot points.