diff --git a/README.md b/README.md index c3dd59dfe8..c1114a655c 100644 --- a/README.md +++ b/README.md @@ -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) - contour plots - 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 - CMake-based build system - extensive set of [Examples/Tutorials](./examples/README.md) diff --git a/doc/dot/jkqtplotter_graphhirarchy.dot b/doc/dot/jkqtplotter_graphhirarchy.dot deleted file mode 100644 index f00451413c..0000000000 --- a/doc/dot/jkqtplotter_graphhirarchy.dot +++ /dev/null @@ -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 - -} diff --git a/doc/dot/jkqtplotter_graphhirarchy.gv b/doc/dot/jkqtplotter_graphhirarchy.gv new file mode 100644 index 0000000000..b5f3f41832 --- /dev/null +++ b/doc/dot/jkqtplotter_graphhirarchy.gv @@ -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 + +} diff --git a/doc/dox/examples_and_tutorials.dox b/doc/dox/examples_and_tutorials.dox index 339105de08..ac51abefff 100644 --- a/doc/dox/examples_and_tutorials.dox +++ b/doc/dox/examples_and_tutorials.dox @@ -74,7 +74,7 @@ All test-projects are Qt-projects that use qmake to build. You can load them int Screenshot Description Notes \image html geometric_small.png \subpage JKQTPlotterGeometricGraphs - `JKQTPPlotObject`, `JKQTPGeoArc`, `JKQTPGeoLine`, `JKQTPGeoRectangle`, ... + `JKQTPGeometricPlotElement`, `JKQTPGeoArc`, `JKQTPGeoLine`, `JKQTPGeoRectangle`, ... \image html geo_arrows_small.png \subpage JKQTPlotterGeometricArrows `JKQTPGeoArrow`, ... diff --git a/doc/dox/jkqtplotter.dox b/doc/dox/jkqtplotter.dox index 617290f60c..8865997175 100644 --- a/doc/dox/jkqtplotter.dox +++ b/doc/dox/jkqtplotter.dox @@ -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 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 diff --git a/doc/dox/mainpage.dox b/doc/dox/mainpage.dox index 4a62cba11e..36969a01d8 100644 --- a/doc/dox/mainpage.dox +++ b/doc/dox/mainpage.dox @@ -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_contour "contour plots" - \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 - OPTIONAL: Interfaces to external libraries - \ref jkqtpinterfaceopencv "OpenCV interface" - \ref jkqtpinterfacecimg "CImg interface" diff --git a/doc/dox/whatsnew.dox b/doc/dox/whatsnew.dox index 944b6d4563..99ad0d72fa 100644 --- a/doc/dox/whatsnew.dox +++ b/doc/dox/whatsnew.dox @@ -20,6 +20,7 @@ Changes, compared to \ref page_whatsnew_V2019_11 "v2019.11" include:
  • fixed issue #41: Build error when JKQtPlotter_BUILD_INCLUDE_XITS_FONTS set to OFF , thanks to user:smistad
  • fixed issue #37: CMake installs things into $PREFIX/doc/*.txt , thanks to user:certik
  • fixed issue #45: Build error on mac jkqtfastplotter.cpp:342:28: Variable has incomplete type 'QPainterPath', thanks to user:abdedixit
  • +
  • renamed/breaking change: renamed JKQTPPlotObject->JKQTPGeometricPlotElement and added new base class JKQTPPlotAnnotationElement
  • renamed/breaking change: renamed JKQTPColorPaletteStyleAndToolsMixin::setPalette() -> JKQTPColorPaletteStyleAndToolsMixin::setColorPalette()
  • removed/breaking change: removed the usage of some deprecated functions and objects (e.g. QMatrix)
  • removed/breaking change: removed the overlay elements (derived from JKQTPOverlayElement), which were not very well set up and are more confusing than useful.
  • diff --git a/doc/images/JKQTPPlotObject_DrawAsGraphicElement.png b/doc/images/JKQTPGeometricPlotElement_DrawAsGraphicElement.png similarity index 100% rename from doc/images/JKQTPPlotObject_DrawAsGraphicElement.png rename to doc/images/JKQTPGeometricPlotElement_DrawAsGraphicElement.png diff --git a/doc/images/JKQTPPlotObject_DrawAsMathematicalCurve.png b/doc/images/JKQTPGeometricPlotElement_DrawAsMathematicalCurve.png similarity index 100% rename from doc/images/JKQTPPlotObject_DrawAsMathematicalCurve.png rename to doc/images/JKQTPGeometricPlotElement_DrawAsMathematicalCurve.png diff --git a/doc/qtmarketplace_metadata/jkqtplotter_decsription.md b/doc/qtmarketplace_metadata/jkqtplotter_decsription.md index b8c3580c29..af00d642eb 100644 --- a/doc/qtmarketplace_metadata/jkqtplotter_decsription.md +++ b/doc/qtmarketplace_metadata/jkqtplotter_decsription.md @@ -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) - contour plots - 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 - 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) diff --git a/examples/geo_simple/geo_simple.cpp b/examples/geo_simple/geo_simple.cpp index 1ef5c5264f..4e2d2ca7f3 100644 --- a/examples/geo_simple/geo_simple.cpp +++ b/examples/geo_simple/geo_simple.cpp @@ -124,16 +124,16 @@ int main(int argc, char* argv[]) cmb->setCurrentIndex(0); QObject::connect(cmb, static_cast(&QComboBox::currentIndexChanged), [&](int index) { for (size_t i=0; igetPlotter()->getGraphCount(); i++) { - JKQTPPlotObject* obj=dynamic_cast(plot->getPlotter()->getGraph(i)); + JKQTPGeometricPlotElement* obj=dynamic_cast(plot->getPlotter()->getGraph(i)); if (obj) { - obj->setDrawMode((index==0)?JKQTPPlotObject::DrawAsGraphicElement:JKQTPPlotObject::DrawAsMathematicalCurve); + obj->setDrawMode((index==0)?JKQTPGeometricPlotElement::DrawAsGraphicElement:JKQTPGeometricPlotElement::DrawAsMathematicalCurve); } } plot->redrawPlot(); for (size_t i=0; igetPlotter()->getGraphCount(); i++) { - JKQTPPlotObject* obj=dynamic_cast(plotlog->getPlotter()->getGraph(i)); + JKQTPGeometricPlotElement* obj=dynamic_cast(plotlog->getPlotter()->getGraph(i)); if (obj) { - obj->setDrawMode((index==0)?JKQTPPlotObject::DrawAsGraphicElement:JKQTPPlotObject::DrawAsMathematicalCurve); + obj->setDrawMode((index==0)?JKQTPGeometricPlotElement::DrawAsGraphicElement:JKQTPGeometricPlotElement::DrawAsMathematicalCurve); } } plotlog->redrawPlot(); diff --git a/examples/geometric/README.md b/examples/geometric/README.md index ff32c4b2be..b839e98477 100644 --- a/examples/geometric/README.md +++ b/examples/geometric/README.md @@ -113,22 +113,22 @@ The example also adds some control-widgets that allow to change the properties o cmb->setCurrentIndex(0); QObject::connect(cmb, static_cast(&QComboBox::currentIndexChanged), [plot](int index) { for (size_t i=0; igetPlotter()->getGraphCount(); i++) { - JKQTPPlotObject* obj=dynamic_cast(plot->getPlotter()->getGraph(i)); + JKQTPGeometricPlotElement* obj=dynamic_cast(plot->getPlotter()->getGraph(i)); if (obj) { - obj->setDrawMode((index==0)?JKQTPPlotObject::DrawAsGraphicElement:JKQTPPlotObject::DrawAsMathematicalCurve); + obj->setDrawMode((index==0)?JKQTPGeometricPlotElement::DrawAsGraphicElement:JKQTPGeometricPlotElement::DrawAsMathematicalCurve); } } 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) -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) diff --git a/examples/geometric/geometric.cpp b/examples/geometric/geometric.cpp index deaa347eb7..eba52b029d 100644 --- a/examples/geometric/geometric.cpp +++ b/examples/geometric/geometric.cpp @@ -46,9 +46,9 @@ int main(int argc, char* argv[]) cmb->setCurrentIndex(0); QObject::connect(cmb, static_cast(&QComboBox::currentIndexChanged), [plot](int index) { for (size_t i=0; igetPlotter()->getGraphCount(); i++) { - JKQTPPlotObject* obj=dynamic_cast(plot->getPlotter()->getGraph(i)); + JKQTPGeometricPlotElement* obj=dynamic_cast(plot->getPlotter()->getGraph(i)); if (obj) { - obj->setDrawMode((index==0)?JKQTPPlotObject::DrawAsGraphicElement:JKQTPPlotObject::DrawAsMathematicalCurve); + obj->setDrawMode((index==0)?JKQTPGeometricPlotElement::DrawAsGraphicElement:JKQTPGeometricPlotElement::DrawAsMathematicalCurve); } } plot->redrawPlot(); diff --git a/lib/jkqtplotter/graphs/jkqtpboxplot.cpp b/lib/jkqtplotter/graphs/jkqtpboxplot.cpp index 60a4ed2c99..5c643205ca 100644 --- a/lib/jkqtplotter/graphs/jkqtpboxplot.cpp +++ b/lib/jkqtplotter/graphs/jkqtpboxplot.cpp @@ -730,7 +730,7 @@ void JKQTPBoxplotHorizontalGraph::draw(JKQTPEnhancedPainter& painter) { JKQTPBoxplotVerticalElement::JKQTPBoxplotVerticalElement(JKQTBasePlotter* parent): - JKQTPPlotObject(DrawAsGraphicElement, parent) + JKQTPGeometricPlotElement(DrawAsGraphicElement, parent) { pos=JKQTP_NAN; median=JKQTP_NAN; diff --git a/lib/jkqtplotter/graphs/jkqtpboxplot.h b/lib/jkqtplotter/graphs/jkqtpboxplot.h index 44c8dc1c6a..30edf7fdb6 100644 --- a/lib/jkqtplotter/graphs/jkqtpboxplot.h +++ b/lib/jkqtplotter/graphs/jkqtpboxplot.h @@ -309,7 +309,7 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPBoxplotHorizontalGraph: public JKQTPBoxplotVer \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 public: /** \brief class constructor */ diff --git a/lib/jkqtplotter/graphs/jkqtpgeoannotations.cpp b/lib/jkqtplotter/graphs/jkqtpgeoannotations.cpp index a80df7f615..7c79d430ab 100644 --- a/lib/jkqtplotter/graphs/jkqtpgeoannotations.cpp +++ b/lib/jkqtplotter/graphs/jkqtpgeoannotations.cpp @@ -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_): - 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): - JKQTPPlotObject(DrawAsGraphicElement, parent) + JKQTPPlotAnnotationElement(parent) { this->x=x; this->y=y; diff --git a/lib/jkqtplotter/graphs/jkqtpgeoannotations.h b/lib/jkqtplotter/graphs/jkqtpgeoannotations.h index c85a2fe554..6e7dd53622 100644 --- a/lib/jkqtplotter/graphs/jkqtpgeoannotations.h +++ b/lib/jkqtplotter/graphs/jkqtpgeoannotations.h @@ -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 \see \ref JKQTPlotterGeometricGraphs */ -class JKQTPLOTTER_LIB_EXPORT JKQTPGeoSymbol: public JKQTPPlotObject, public JKQTPGraphSymbolStyleMixin { +class JKQTPLOTTER_LIB_EXPORT JKQTPGeoSymbol: public JKQTPPlotAnnotationElement, public JKQTPGraphSymbolStyleMixin { Q_OBJECT public: /*! \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")); - /*! set the symbol color and symbol fill color */ - virtual void setColor(QColor c); - - /*! \copydoc x */ - void setX(double __value); /*! \copydoc x */ double getX() const; /*! \copydoc y */ - void setY(double __value); - /*! \copydoc y */ double getY() const; - /** \copydoc JKQTPGraph::getXMinMax() */ + /** \copydoc JKQTPPlotAnnotationElement::getXMinMax() */ 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; /** \brief plots the graph to the plotter object specified as parent */ @@ -89,7 +82,15 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPGeoSymbol: public JKQTPPlotObject, public JKQT virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override; /** \brief returns the color to be used for the key label */ 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: /** \brief x-position (in plot coordinates) of the symbol (symbol center) */ double x; @@ -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. \ingroup jkqtplotter_annotations \see \ref JKQTPlotterGeometricGraphs */ -class JKQTPLOTTER_LIB_EXPORT JKQTPGeoText: public JKQTPPlotObject, public JKQTPGraphTextStyleMixin { +class JKQTPLOTTER_LIB_EXPORT JKQTPGeoText: public JKQTPPlotAnnotationElement, public JKQTPGraphTextStyleMixin { Q_OBJECT public: /*! \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); - /*! \copydoc text */ - void setText(const QString & __value); /*! \copydoc text */ QString getText() const; /*! \copydoc x */ - void setX(double __value); - /*! \copydoc x */ double getX() const; /*! \copydoc y */ - void setY(double __value); - /*! \copydoc y */ 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; - /** \copydoc JKQTPPlotObject::getYMinMax() */ + /** \copydoc JKQTPPlotAnnotationElement::getYMinMax() */ virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override; /** \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; /** \brief returns the color to be used for the key label */ 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: /** \brief x-position (in plot coordinates) of the text (left/baseline) */ diff --git a/lib/jkqtplotter/graphs/jkqtpgeobase.cpp b/lib/jkqtplotter/graphs/jkqtpgeobase.cpp index 30feb3049d..1933e27ab8 100644 --- a/lib/jkqtplotter/graphs/jkqtpgeobase.cpp +++ b/lib/jkqtplotter/graphs/jkqtpgeobase.cpp @@ -28,7 +28,7 @@ #define SmallestGreaterZeroCompare_xvsgz() if ((xvsgz>10.0*DBL_MIN)&&((smallestGreaterZero<10.0*DBL_MIN) || (xvsgztransform(p); }, this, std::placeholders::_1); + auto fTransform=std::bind([](const JKQTPGeometricPlotElement* plot, const QPointF& p) { return plot->transform(p); }, this, std::placeholders::_1); QVector points=JKQTPSplitLineIntoPoints(line, fTransform); points=JKQTPSimplyfyLineSegemnts(points); if (points.size()>1) { @@ -447,7 +447,7 @@ void JKQTPGeoInfiniteLine::draw(JKQTPEnhancedPainter& painter) { } 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) // 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 points=JKQTPSplitLineIntoPoints(QLineF(x1,y1,x2,y2), fTransform); points=JKQTPSimplyfyLineSegemnts(points); if (points.size()>1) { @@ -630,7 +630,7 @@ void JKQTPGeoPolyLines::draw(JKQTPEnhancedPainter& painter) { } 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) // 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 points_poly=JKQTPSplitPolylineIntoPoints(points, fTransform); points_poly=JKQTPSimplyfyLineSegemnts(points_poly); if (points_poly.size()>1) { @@ -747,7 +747,7 @@ JKQTPGeoArc::JKQTPGeoArc(JKQTPlotter* parent, double x, double y, double width, 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); painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();}); diff --git a/lib/jkqtplotter/graphs/jkqtpgeolines.h b/lib/jkqtplotter/graphs/jkqtpgeolines.h index bae80f06c9..886bf9829f 100644 --- a/lib/jkqtplotter/graphs/jkqtpgeolines.h +++ b/lib/jkqtplotter/graphs/jkqtpgeolines.h @@ -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 * * \image html JKQTPGeoLine_HeadTail.png @@ -40,10 +40,10 @@ * * \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 * 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: * \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; - /** \copydoc JKQTPPlotObject::getYMinMax() */ + /** \copydoc JKQTPGeometricPlotElement::getYMinMax() */ virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override; /** \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, * 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 * * 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 * * - * \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 * 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 . * @@ -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); - /** \copydoc JKQTPPlotObject::getXMinMax() */ + /** \copydoc JKQTPGeometricPlotElement::getXMinMax() */ 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; /** \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, * 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 * * \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 * 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. * * 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); - /** \copydoc JKQTPPlotObject::getXMinMax() */ + /** \copydoc JKQTPGeometricPlotElement::getXMinMax() */ 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; /** \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 * 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. */ 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 * * @@ -512,7 +512,7 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPGeoPolyLines: public JKQTPGeoBaseDecoratedLine * * \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 * 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); - /** \copydoc JKQTPPlotObject::getXMinMax() */ + /** \copydoc JKQTPGeometricPlotElement::getXMinMax() */ 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; /** \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 * parametrization for arcs on non-linear axes could be found! */ diff --git a/lib/jkqtplotter/graphs/jkqtpgeoshapes.cpp b/lib/jkqtplotter/graphs/jkqtpgeoshapes.cpp index 3da651b028..d5642df9b4 100644 --- a/lib/jkqtplotter/graphs/jkqtpgeoshapes.cpp +++ b/lib/jkqtplotter/graphs/jkqtpgeoshapes.cpp @@ -77,25 +77,25 @@ JKQTPGeoRectangle::JKQTPGeoRectangle(JKQTPlotter *parent, QPointF bottomleft, QP { } -JKQTPGeoRectangle::JKQTPGeoRectangle(JKQTBasePlotter *parent, const QPointF ¢er, 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 ¢er, 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::JKQTPGeoRectangle(JKQTPlotter *parent, const QPointF ¢er, 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 ¢er, 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::JKQTPGeoRectangle(JKQTBasePlotter *parent, const QPointF ¢er, const QSizeF &size, QColor color, double lineWidth, Qt::PenStyle style, QColor fillColor, Qt::BrushStyle fillStyle, JKQTPPlotObject::DrawMode drawMode): +JKQTPGeoRectangle::JKQTPGeoRectangle(JKQTBasePlotter *parent, const QPointF ¢er, 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::JKQTPGeoRectangle(JKQTPlotter *parent, const QPointF ¢er, const QSizeF &size, QColor color, double lineWidth, Qt::PenStyle style, QColor fillColor, Qt::BrushStyle fillStyle, JKQTPPlotObject::DrawMode drawMode): +JKQTPGeoRectangle::JKQTPGeoRectangle(JKQTPlotter *parent, const QPointF ¢er, 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) { @@ -152,7 +152,7 @@ void JKQTPGeoRectangle::draw(JKQTPEnhancedPainter& painter) { if ((getDrawMode()==DrawAsGraphicElement) || (getParent()->getXAxis()->isLinearAxis() && getParent()->getYAxis()->isLinearAxis())) { rect=transform(poly); } 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); } for (const auto& p:poly) { @@ -331,7 +331,7 @@ void JKQTPGeoPolygon::draw(JKQTPEnhancedPainter& painter) { } 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) // 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 polyp=points; if (polyp.first()!=polyp.last()) polyp.push_back(polyp.first()); QPolygonF path=JKQTPSplitPolylineIntoPoints(polyp, fTransform); @@ -462,7 +462,7 @@ void JKQTPGeoEllipse::drawInternal(JKQTPEnhancedPainter& painter, double angleSt 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; if(mode==InternalDrawMode::Ellipse) { rect=JKQTPSplitEllipseIntoPoints(fTransform, x,y,width/2.0, height/2.0,0,360, angle); diff --git a/lib/jkqtplotter/graphs/jkqtpgeoshapes.h b/lib/jkqtplotter/graphs/jkqtpgeoshapes.h index 388ed238b5..cf9d4ca269 100644 --- a/lib/jkqtplotter/graphs/jkqtpgeoshapes.h +++ b/lib/jkqtplotter/graphs/jkqtpgeoshapes.h @@ -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 * * \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 * 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. * * \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; - /** \copydoc JKQTPPlotObject::getYMinMax() */ + /** \copydoc JKQTPGeometricPlotElement::getYMinMax() */ virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override; /** \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 * 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 * * \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 * 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); - /** \copydoc JKQTPPlotObject::getXMinMax() */ + /** \copydoc JKQTPGeometricPlotElement::getXMinMax() */ 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; /** \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 * connected by curves, instead of straight lines. */ @@ -364,17 +364,17 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPGeoPolygon: public JKQTPGeoBaseFilled { QVector points; }; -/** \brief This JKQTPPlotObject is used to draw an ellipse +/** \brief This JKQTPGeometricPlotElement is used to draw an ellipse * \ingroup jkqtplotter_geoplots * * \image html plot_geoellipse.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 * 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. * * \see http://www.codeguru.com/cpp/g-m/gdi/article.php/c131 and @@ -472,7 +472,7 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPGeoEllipse: public JKQTPGeoRectangle { /** \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 * parametrization for ellipses on non-linear axes could be found!*/ 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 * * @@ -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"))); * \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 * 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); - /** \copydoc JKQTPPlotObject::getXMinMax() */ + /** \copydoc JKQTPGeometricPlotElement::getXMinMax() */ 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; /** \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 * parametrization for pies on non-linear axes could be found!*/ 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 * * A chord on linear and log-log axes (start angle: 10deg and end-angle 110deg): * * \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 * 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); - /** \copydoc JKQTPPlotObject::getXMinMax() */ + /** \copydoc JKQTPGeometricPlotElement::getXMinMax() */ 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; /** \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 * parametrization for chords on non-linear axes could be found! */ diff --git a/lib/jkqtplotter/graphs/jkqtpviolinplot.cpp b/lib/jkqtplotter/graphs/jkqtpviolinplot.cpp index 7fa2225aac..a1a8c1b4b5 100644 --- a/lib/jkqtplotter/graphs/jkqtpviolinplot.cpp +++ b/lib/jkqtplotter/graphs/jkqtpviolinplot.cpp @@ -40,7 +40,7 @@ JKQTPViolinplotVerticalElement::JKQTPViolinplotVerticalElement(JKQTBasePlotter* parent): - JKQTPPlotObject(DrawAsGraphicElement, parent) + JKQTPGeometricPlotElement(DrawAsGraphicElement, parent) { pos=JKQTP_NAN; median=JKQTP_NAN; diff --git a/lib/jkqtplotter/graphs/jkqtpviolinplot.h b/lib/jkqtplotter/graphs/jkqtpviolinplot.h index 8c1336b0db..ec1abe48ef 100644 --- a/lib/jkqtplotter/graphs/jkqtpviolinplot.h +++ b/lib/jkqtplotter/graphs/jkqtpviolinplot.h @@ -60,7 +60,7 @@ \see \ref JKQTPlotterViolinplotGraphs */ -class JKQTPLOTTER_LIB_EXPORT JKQTPViolinplotVerticalElement: public JKQTPPlotObject, public JKQTPGraphViolinplotStyleMixin { +class JKQTPLOTTER_LIB_EXPORT JKQTPViolinplotVerticalElement: public JKQTPGeometricPlotElement, public JKQTPGraphViolinplotStyleMixin { Q_OBJECT public: /** \brief class constructor */ diff --git a/lib/jkqtplotter/jkqtpgraphsbase.cpp b/lib/jkqtplotter/jkqtpgraphsbase.cpp index 9e3e36f31a..4a1c3d8f49 100644 --- a/lib/jkqtplotter/jkqtpgraphsbase.cpp +++ b/lib/jkqtplotter/jkqtpgraphsbase.cpp @@ -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) { } -void JKQTPPlotObject::setDrawMode(JKQTPPlotObject::DrawMode mode) +void JKQTPGeometricPlotElement::setDrawMode(JKQTPGeometricPlotElement::DrawMode mode) { m_drawMode=mode; } -JKQTPPlotObject::DrawMode JKQTPPlotObject::getDrawMode() const +JKQTPGeometricPlotElement::DrawMode JKQTPGeometricPlotElement::getDrawMode() const { return m_drawMode; } -JKQTPPlotObject::~JKQTPPlotObject() +JKQTPGeometricPlotElement::~JKQTPGeometricPlotElement() = default; @@ -988,3 +988,13 @@ void JKQTPXYBaselineGraph::setBaseline(double __value) { m_baseline=__value; } + +JKQTPPlotAnnotationElement::JKQTPPlotAnnotationElement(JKQTBasePlotter *parent) +{ + +} + +JKQTPPlotAnnotationElement::~JKQTPPlotAnnotationElement() +{ + +} diff --git a/lib/jkqtplotter/jkqtpgraphsbase.h b/lib/jkqtplotter/jkqtpgraphsbase.h index 005a47073a..f3cd827c31 100644 --- a/lib/jkqtplotter/jkqtpgraphsbase.h +++ b/lib/jkqtplotter/jkqtpgraphsbase.h @@ -436,68 +436,91 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPGraph: public JKQTPPlotElement { /** \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 * * \see \ref jkqtplotter_graphsgroup_classstructure, \ref JKQTPlotterGeometricGraphs * - * \section JKQTPPlotObject_coordinates Coordinate Systems - * JKQTPPlotObject's have extended coordinate transform capabilities, because in addition to using + * \section JKQTPGeometricPlotElement_coordinates Coordinate Systems + * 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. * - * \section JKQTPPlotObject_DrawMode Draw Modes + * \section JKQTPGeometricPlotElement_DrawMode Draw Modes * * \copydetails m_drawMode */ -class JKQTPLOTTER_LIB_EXPORT JKQTPPlotObject: public JKQTPPlotElement { - Q_OBJECT - public: +class JKQTPLOTTER_LIB_EXPORT JKQTPGeometricPlotElement: public JKQTPPlotElement { + Q_OBJECT +public: - /** \brief indicates how to draw the geometric object */ - enum DrawMode { - DrawAsGraphicElement, /*!< \brief draw lines as lines (i.e. graphic elements) \image html JKQTPPlotObject_DrawAsGraphicElement.png */ - DrawAsMathematicalCurve /*!< \brief draw lines as the mathematically correct curve \image html JKQTPPlotObject_DrawAsMathematicalCurve.png */ - }; - Q_ENUM(DrawMode) + /** \brief indicates how to draw the geometric object */ + enum DrawMode { + 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 JKQTPGeometricPlotElement_DrawAsMathematicalCurve.png */ + }; + Q_ENUM(DrawMode) - /** \brief class constructor */ - explicit JKQTPPlotObject(DrawMode drawMode=DrawAsGraphicElement, JKQTBasePlotter* parent=nullptr); + /** \brief class constructor */ + explicit JKQTPGeometricPlotElement(DrawMode drawMode=DrawAsGraphicElement, JKQTBasePlotter* parent=nullptr); - /** \brief default wirtual destructor */ - virtual ~JKQTPPlotObject() ; - /** \copybrief m_drawMode + /** \brief default wirtual destructor */ + virtual ~JKQTPGeometricPlotElement() ; + /** \copybrief m_drawMode * * \return the currently set DrawMode * \see m_drawMode, DrawMode */ - DrawMode getDrawMode() const; + DrawMode getDrawMode() const; - Q_PROPERTY(DrawMode drawMode READ getDrawMode WRITE setDrawMode) - public slots: - /** \copybrief m_drawMode + Q_PROPERTY(DrawMode drawMode READ getDrawMode WRITE setDrawMode) +public slots: + /** \copybrief m_drawMode * * \param mode the DrawMode to use from now on * \see m_drawMode, DrawMode */ - void setDrawMode(DrawMode mode); - protected: - /** \brief indicated whether to draw lines as graphic elements (even on non-linear coordinate systems), + void setDrawMode(DrawMode mode); +protected: + /** \brief indicated whether to draw lines as graphic elements (even on non-linear coordinate systems), * or as mathematically correct curves * * 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) * 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 - * 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() */ - DrawMode m_drawMode; + DrawMode m_drawMode; + +}; + + +/** \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: };