added example for geometric objects

This commit is contained in:
jkriege2 2019-01-07 21:00:56 +01:00
parent ba6e929ecb
commit 5b910fc9b3
39 changed files with 742 additions and 89 deletions

1
.gitignore vendored
View File

@ -87,3 +87,4 @@ Thumbs.db
/doc/html /doc/html
.qmake.stash .qmake.stash
moc_predefs.h moc_predefs.h
/lib/jkqtplotter/*.TMP

View File

@ -62,6 +62,7 @@ addSimpleTest(paramscatterplot_image)
addSimpleTest(parametriccurve) addSimpleTest(parametriccurve)
addSimpleTest(parsedfunctionplot) addSimpleTest(parsedfunctionplot)
addSimpleTest(functionplot) addSimpleTest(functionplot)
addSimpleTest(geometric)
#addSimpleTest(imageplot_nodatastore) #addSimpleTest(imageplot_nodatastore)
#addSimpleTest(rgbimageplot_opencv) #addSimpleTest(rgbimageplot_opencv)
#addSimpleTest(imageplot_opencv) #addSimpleTest(imageplot_opencv)

View File

@ -40,7 +40,8 @@ All test-projects are Qt-projects that use qmake to build. You can load them int
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_paramscatterplot_image_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_paramscatterplot_image) | [Draw an Artistic Image with a Parametrized Scatter Graph](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_paramscatterplot_image) | `JKQTPxyParametrizedScatterGraph`<br/>C++-style QVector as plot data<br/>rectangular arrangement of scatters<br/>generative computer graphics | | [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_paramscatterplot_image_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_paramscatterplot_image) | [Draw an Artistic Image with a Parametrized Scatter Graph](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_paramscatterplot_image) | `JKQTPxyParametrizedScatterGraph`<br/>C++-style QVector as plot data<br/>rectangular arrangement of scatters<br/>generative computer graphics |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_parametriccurve_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_parametriccurve) | [Plotting Parametric Curves](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_parametriccurve) | `JKQTPxyLineGraph` and `JKQTPxyParametrizedScatterGraph`<br/>C++-style QVector as plot data<br/>parametric curve plotting | | [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_parametriccurve_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_parametriccurve) | [Plotting Parametric Curves](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_parametriccurve) | `JKQTPxyLineGraph` and `JKQTPxyParametrizedScatterGraph`<br/>C++-style QVector as plot data<br/>parametric curve plotting |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_functionplot_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_functionplot) | [Plotting Mathematical Functions as Line Graphs](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_functionplot) | `JKQTPxFunctionLineGraph` <br/>diretly plotting C/C++-functions | | [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_functionplot_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_functionplot) | [Plotting Mathematical Functions as Line Graphs](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_functionplot) | `JKQTPxFunctionLineGraph` <br/>diretly plotting C/C++-functions |
[![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_parsedfunctionplot_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_parsedfunctionplot) | [Plotting Parsed Mathematical Functions as Line Graphs](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_parsedfunctionplot) | `JKQTPxParsedFunctionLineGraph` <br/>plotting functions with the internal math equation parser/evaluator | | [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_parsedfunctionplot_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_parsedfunctionplot) | [Plotting Parsed Mathematical Functions as Line Graphs](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_parsedfunctionplot) | `JKQTPxParsedFunctionLineGraph` <br/>plotting functions with the internal math equation parser/evaluator |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_geometric_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_geometric) | [Plotting Geometric Objects](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_geometric) | plotting geometric elements |
### Styling the Plot, Keys, Axes, ... ### Styling the Plot, Keys, Axes, ...

View File

@ -2,7 +2,7 @@ TEMPLATE = subdirs
SUBDIRS += jkqtplotterlib jkqtfastplotter_test SUBDIRS += jkqtplotterlib jkqtfastplotter_test
jkqtplotterlib.file = ../../lib/jkqtplotterlib.pro jkqtplotterlib.file = ../../staticlib/jkqtplotterlib.pro
jkqtfastplotter_test.file=$$PWD/jkqtfastplotter_test.pro jkqtfastplotter_test.file=$$PWD/jkqtfastplotter_test.pro
jkqtfastplotter_test.depends = jkqtplotterlib jkqtfastplotter_test.depends = jkqtplotterlib

View File

@ -2,7 +2,7 @@ TEMPLATE = subdirs
SUBDIRS += jkqtplotterlib jkqtmathtext_simpletest SUBDIRS += jkqtplotterlib jkqtmathtext_simpletest
jkqtplotterlib.file = ../../lib/jkqtplotterlib.pro jkqtplotterlib.file = ../../staticlib/jkqtplotterlib.pro
jkqtmathtext_simpletest.file=$$PWD/jkqtmathtext_simpletest.pro jkqtmathtext_simpletest.file=$$PWD/jkqtmathtext_simpletest.pro
jkqtmathtext_simpletest.depends = jkqtplotterlib jkqtmathtext_simpletest.depends = jkqtplotterlib

View File

@ -2,7 +2,7 @@ TEMPLATE = subdirs
SUBDIRS += jkqtplotterlib jkqtmathtext_test SUBDIRS += jkqtplotterlib jkqtmathtext_test
jkqtplotterlib.file = ../../lib/jkqtplotterlib.pro jkqtplotterlib.file = ../../staticlib/jkqtplotterlib.pro
jkqtmathtext_test.file=$$PWD/jkqtmathtext_test.pro jkqtmathtext_test.file=$$PWD/jkqtmathtext_test.pro
jkqtmathtext_test.depends = jkqtplotterlib jkqtmathtext_test.depends = jkqtplotterlib

View File

@ -36,16 +36,16 @@ TestWidgetGeometry::TestWidgetGeometry(QWidget *parent) :
//plotGeo->get_plotter()->addGraph(line2); //plotGeo->get_plotter()->addGraph(line2);
JKQTPgeoRectangle* rect1=new JKQTPgeoRectangle(plotGeo->get_plotter(), 1,1,2,2, QColor("blue"),2, Qt::SolidLine, QColor("lightblue")); JKQTPgeoRectangle* rect1=new JKQTPgeoRectangle(plotGeo->get_plotter(), 1,1,2,2, QColor("blue"),2, Qt::SolidLine, QColor("lightblue"));
rect1->set_alpha(30); rect1->set_angle(30);
//plotGeo->get_plotter()->addGraph(rect1); //plotGeo->get_plotter()->addGraph(rect1);
JKQTPgeoRectangle* rect2=new JKQTPgeoRectangle(plotGeo->get_plotter(), 1,1,2,2, QColor("red"),2); JKQTPgeoRectangle* rect2=new JKQTPgeoRectangle(plotGeo->get_plotter(), 1,1,2,2, QColor("red"),2);
rect2->set_alpha(45); rect2->set_angle(45);
//plotGeo->get_plotter()->addGraph(rect2); //plotGeo->get_plotter()->addGraph(rect2);
JKQTPgeoRectangle* rect3=new JKQTPgeoRectangle(plotGeo->get_plotter(), 1,1,2,4, QColor("green"),2); JKQTPgeoRectangle* rect3=new JKQTPgeoRectangle(plotGeo->get_plotter(), 1,1,2,4, QColor("green"),2);
rect3->set_alpha(-30); rect3->set_angle(-30);
//plotGeo->get_plotter()->addGraph(rect3); //plotGeo->get_plotter()->addGraph(rect3);
JKQTPgeoEllipse* ell3=new JKQTPgeoEllipse(plotGeo->get_plotter(), 1,1,2,4, QColor("green"),2, Qt::SolidLine, QColor("lightgreen"), Qt::CrossPattern); JKQTPgeoEllipse* ell3=new JKQTPgeoEllipse(plotGeo->get_plotter(), 1,1,2,4, QColor("green"),2, Qt::SolidLine, QColor("lightgreen"), Qt::CrossPattern);
ell3->set_alpha(-30); ell3->set_angle(-30);
//plotGeo->get_plotter()->addGraph(ell3); //plotGeo->get_plotter()->addGraph(ell3);
QVector<QPointF> p; QVector<QPointF> p;
@ -57,7 +57,7 @@ TestWidgetGeometry::TestWidgetGeometry(QWidget *parent) :
// JKQTPgeoPolygon* poly=new JKQTPgeoPolygon(plotGeo->get_plotter(), p, QColor("black"), 1.5, Qt::SolidLine, QColor(128,128,0,128)); // JKQTPgeoPolygon* poly=new JKQTPgeoPolygon(plotGeo->get_plotter(), p, QColor("black"), 1.5, Qt::SolidLine, QColor(128,128,0,128));
//plotGeo->get_plotter()->addGraph(poly); //plotGeo->get_plotter()->addGraph(poly);
// JKQTPgeoLines* lines=new JKQTPgeoLines(plotGeo->get_plotter(), p, QColor(255,255,0), 3); // JKQTPgeoPolyLines* lines=new JKQTPgeoPolyLines(plotGeo->get_plotter(), p, QColor(255,255,0), 3);
//plotGeo->get_plotter()->addGraph(lines); //plotGeo->get_plotter()->addGraph(lines);
JKQTPgeoEllipse* ell1=new JKQTPgeoEllipse(plotGeo->get_plotter(), 0,0,2,4, QColor("black"),1.5, Qt::DotLine); JKQTPgeoEllipse* ell1=new JKQTPgeoEllipse(plotGeo->get_plotter(), 0,0,2,4, QColor("black"),1.5, Qt::DotLine);

View File

@ -5,4 +5,4 @@ SUBDIRS += jkqtplot_test jkqtplotterlib
jkqtplot_test.file=$$PWD/jkqtplot_test.pro jkqtplot_test.file=$$PWD/jkqtplot_test.pro
jkqtplot_test.depends = jkqtplotterlib jkqtplot_test.depends = jkqtplotterlib
jkqtplotterlib.file = ../../lib/jkqtplotterlib.pro jkqtplotterlib.file = ../../staticlib/jkqtplotterlib.pro

View File

@ -2,7 +2,7 @@ TEMPLATE = subdirs
SUBDIRS += jkqtplotterlib jkqtplotter_simpletest SUBDIRS += jkqtplotterlib jkqtplotter_simpletest
jkqtplotterlib.file = ../../lib/jkqtplotterlib.pro jkqtplotterlib.file = ../../staticlib/jkqtplotterlib.pro
jkqtplotter_simpletest.file=$$PWD/jkqtplotter_simpletest.pro jkqtplotter_simpletest.file=$$PWD/jkqtplotter_simpletest.pro
jkqtplotter_simpletest.depends = jkqtplotterlib jkqtplotter_simpletest.depends = jkqtplotterlib

View File

@ -2,7 +2,7 @@ TEMPLATE = subdirs
SUBDIRS += jkqtplotterlib jkqtplotter_simpletest_barchart SUBDIRS += jkqtplotterlib jkqtplotter_simpletest_barchart
jkqtplotterlib.file = ../../lib/jkqtplotterlib.pro jkqtplotterlib.file = ../../staticlib/jkqtplotterlib.pro
jkqtplotter_simpletest_barchart.file=$$PWD/jkqtplotter_simpletest_barchart.pro jkqtplotter_simpletest_barchart.file=$$PWD/jkqtplotter_simpletest_barchart.pro
jkqtplotter_simpletest_barchart.depends = jkqtplotterlib jkqtplotter_simpletest_barchart.depends = jkqtplotterlib

View File

@ -2,7 +2,7 @@ TEMPLATE = subdirs
SUBDIRS += jkqtplotterlib jkqtplotter_simpletest_dateaxes SUBDIRS += jkqtplotterlib jkqtplotter_simpletest_dateaxes
jkqtplotterlib.file = ../../lib/jkqtplotterlib.pro jkqtplotterlib.file = ../../staticlib/jkqtplotterlib.pro
jkqtplotter_simpletest_dateaxes.file=$$PWD/jkqtplotter_simpletest_dateaxes.pro jkqtplotter_simpletest_dateaxes.file=$$PWD/jkqtplotter_simpletest_dateaxes.pro
jkqtplotter_simpletest_dateaxes.depends = jkqtplotterlib jkqtplotter_simpletest_dateaxes.depends = jkqtplotterlib

View File

@ -2,7 +2,7 @@ TEMPLATE = subdirs
SUBDIRS += jkqtplotterlib jkqtplotter_simpletest_errorbarstyles SUBDIRS += jkqtplotterlib jkqtplotter_simpletest_errorbarstyles
jkqtplotterlib.file = ../../lib/jkqtplotterlib.pro jkqtplotterlib.file = ../../staticlib/jkqtplotterlib.pro
jkqtplotter_simpletest_errorbarstyles.file=$$PWD/jkqtplotter_simpletest_errorbarstyles.pro jkqtplotter_simpletest_errorbarstyles.file=$$PWD/jkqtplotter_simpletest_errorbarstyles.pro
jkqtplotter_simpletest_errorbarstyles.depends = jkqtplotterlib jkqtplotter_simpletest_errorbarstyles.depends = jkqtplotterlib

View File

@ -2,7 +2,7 @@ TEMPLATE = subdirs
SUBDIRS += jkqtplotterlib jkqtplotter_simpletest_filledgraphs SUBDIRS += jkqtplotterlib jkqtplotter_simpletest_filledgraphs
jkqtplotterlib.file = ../../lib/jkqtplotterlib.pro jkqtplotterlib.file = ../../staticlib/jkqtplotterlib.pro
jkqtplotter_simpletest_filledgraphs.file=$$PWD/jkqtplotter_simpletest_filledgraphs.pro jkqtplotter_simpletest_filledgraphs.file=$$PWD/jkqtplotter_simpletest_filledgraphs.pro
jkqtplotter_simpletest_filledgraphs.depends = jkqtplotterlib jkqtplotter_simpletest_filledgraphs.depends = jkqtplotterlib

View File

@ -2,7 +2,7 @@ TEMPLATE = subdirs
SUBDIRS += jkqtplotterlib jkqtplotter_simpletest_functionplot SUBDIRS += jkqtplotterlib jkqtplotter_simpletest_functionplot
jkqtplotterlib.file = ../../lib/jkqtplotterlib.pro jkqtplotterlib.file = ../../staticlib/jkqtplotterlib.pro
jkqtplotter_simpletest_functionplot.file=$$PWD/jkqtplotter_simpletest_functionplot.pro jkqtplotter_simpletest_functionplot.file=$$PWD/jkqtplotter_simpletest_functionplot.pro
jkqtplotter_simpletest_functionplot.depends = jkqtplotterlib jkqtplotter_simpletest_functionplot.depends = jkqtplotterlib

View File

@ -0,0 +1,78 @@
[Back to JKQTPlotter main page](https://github.com/jkriege2/JKQtPlotter/)
# JKQtPlotter
## Plotting Geometric Objects
This project (see `./test/simpletest_geometric/`) shows the capabilities of JKQtPlotter to also draw geometric elements, like circles, ellipses, rectangles etc.
The source code of the main application can be found in [`jkqtplotter_simpletest_geometric.cpp`](https://github.com/jkriege2/JKQtPlotter/blob/master/test/simpletest_geometric/jkqtplotter_simpletest_geometric.cpp). First a plot is generated and the axis aspect ration is set to 1, so an accurate plot is generated. Then several geometric graphs are added to the plot. Here are some examples, you can find more more examples in the source code of the example:
```c++
// a text element
plot.addGraph(new JKQTPgeoText(&plot, 0.1,0.6, "$x_{1/2}=\\frac{\\sqrt{b^2-4ac}}{2a}$", 10, QColor("red")));
// a single symbol
plot.addGraph(new JKQTPgeoSymbol(&plot, 0.1,0.6, JKQTPcircle, 5, QColor("grey")));
// a line
plot.addGraph(new JKQTPgeoLine(&plot, 1, 0.05, 1.9, 0.9, QColor("red"), 2));
// a one-sided infinite line with slope dy/dx=0.25/0.2
JKQTPgeoInfiniteLine* infLine=new JKQTPgeoInfiniteLine(&plot, 1.7, 0.2, 0.2, 0.25, QColor("green"), 1.5, Qt::PenStyle::DashLine);
infLine->set_two_sided(false);
infLine->setAlpha(0.5);
plot.addGraph(infLine);
// a polyline
QVector<QPointF> p;
p<<QPointF(1, 0.1)<<QPointF(1.3, 0.9)<<QPointF(1.6, 0.3)<<QPointF(1.9, 0.8);
plot.addGraph(new JKQTPgeoPolyLines(&plot, p, QColor("darkgreen"), 4, Qt::PenStyle::DashDotLine));
// rectangle:
plot.addGraph(new JKQTPgeoRectangle(&plot, QPointF(0.4,1.3), QPointF(0.9,1.6), QColor("blue"), 1, Qt::SolidLine, rfill));
// a rotated rectangle (rotated by 35 degrees):
plot.addGraph(new JKQTPgeoRectangle(&plot, 0.5,1.5,0.8,0.5, 35, QColor("darkblue"), 2, Qt::DashLine));
// ellipse:
plot.addGraph(new JKQTPgeoEllipse(&plot, QPointF(0.4,1.3), QPointF(0.9,1.6), QColor("blue"), 1, Qt::SolidLine, rfill));
// a rotated ellipse (rotated by 35 degrees):
plot.addGraph(new JKQTPgeoEllipse(&plot, 0.5,1.5,0.8,0.5, 35, QColor("darkblue"), 2, Qt::DashLine));
// a polygon
JKQTPgeoPolygon* polygraph=new JKQTPgeoPolygon(&plot, QColor("red"), 2, Qt::PenStyle::DashLine, QColor("salmon"));
polygraph->appendPoint(2.1, 0.5);
polygraph->appendPoint(2.9, 0.9);
polygraph->appendPoint(2.2, 0.8);
polygraph->appendPoint(2.8, 0.25);
polygraph->appendPoint(2.6, 0.6);
polygraph->setAlpha(0.75);
plot.addGraph(polygraph);
// an arc from an ellipse from -10 degrees to 117 degrees, centered at 2.5,1.5 and full axes of 0.5 and 0.5
plot.addGraph(new JKQTPgeoArc(&plot,2.5,1.5,0.5,0.5, -10, 117 , QColor("orange"), 4, Qt::PenStyle::DashLine));
// a pie centered at 2.5,2.5 with ellipse axes 0.9 and 0.9 and from angle 0 degrees to 90 degrees
plot.addGraph(new JKQTPgeoPie(&plot,2.5,2.5,0.9,0.9, 0, 90 , QColor("blue"), 4, Qt::PenStyle::SolidLine,QColor("lightblue")));
// a chord centered at 2.5,2.5 with ellipse axes 0.9 and 0.9 and from angle 0 degrees to 90 degrees
plot.addGraph(new JKQTPgeoChord(&plot,2.5,2.5,0.9,0.9, 0, 90 , QColor("blue"), 4, Qt::PenStyle::SolidLine,QColor("lightblue")));
```
The result of the example combines all these elements and looks like this:
![jkqtplotter_simpletest_geometric](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_geometric.png)
[Back to JKQTPlotter main page](https://github.com/jkriege2/JKQtPlotter/)

View File

@ -0,0 +1,151 @@
#include <QApplication>
#include "jkqtplotter/jkqtplotter.h"
#include "jkqtplotter/jkqtpgraphsgeometric.h"
int main(int argc, char* argv[])
{
QApplication app(argc, argv);
// 1. create a plotter window
JKQtPlotter plot;
// 2. format graph:
// 2.1 set the graph scales manually
plot.setXY(0,3.05,0,3.05);
// 2.2 set the asxpect ratio to 1
plot.get_plotter()->set_maintainAspectRatio(true);
plot.get_plotter()->set_aspectRatio(1);
plot.get_plotter()->set_maintainAxisAspectRatio(true);
plot.get_plotter()->set_axisAspectRatio(1);
// 2.3 set the asxpect ratio to 1
plot.get_xAxis()->set_drawGrid(false);
plot.get_yAxis()->set_drawGrid(false);
// 3. add some geometric plots
// 3.1 some text elements, also with formatting by LaTeX expressions
plot.addGraph(new JKQTPgeoText(&plot, 0.1,0.95, "\\textbf{Text:}", 14, QColor("red")));
plot.addGraph(new JKQTPgeoText(&plot, 0.1,0.1, "A text object in 10pt", 10, QColor("red")));
plot.addGraph(new JKQTPgeoSymbol(&plot, 0.1,0.1, JKQTPcircle, 5, QColor("grey")));
plot.addGraph(new JKQTPgeoText(&plot, 0.1,0.3, "A text object in 12pt", 12, QColor("red")));
plot.addGraph(new JKQTPgeoSymbol(&plot, 0.1,0.3, JKQTPcircle, 5, QColor("grey")));
plot.addGraph(new JKQTPgeoText(&plot, 0.1,0.6, "$x_{1/2}=\\frac{\\sqrt{b^2-4ac}}{2a}$", 10, QColor("red")));
plot.addGraph(new JKQTPgeoSymbol(&plot, 0.1,0.6, JKQTPcircle, 5, QColor("grey")));
// 3.2 some lines elements (single lines and polylines)
plot.addGraph(new JKQTPgeoText(&plot, 1.1,0.95, "\\textbf{Lines:}", 14, QColor("red")));
plot.addGraph(new JKQTPgeoLine(&plot, 1, 0.05, 1.9, 0.9, QColor("red"), 2));
plot.addGraph(new JKQTPgeoLine(&plot, 1, 0.1, 1.9, 0.8, QColor("blue"), 1, Qt::PenStyle::DashLine));
QVector<QPointF> p;
p<<QPointF(1, 0.1)<<QPointF(1.3, 0.9)<<QPointF(1.6, 0.3)<<QPointF(1.9, 0.8);
plot.addGraph(new JKQTPgeoPolyLines(&plot, p, QColor("darkgreen"), 4, Qt::PenStyle::DashDotLine));
JKQTPgeoInfiniteLine* infLine=new JKQTPgeoInfiniteLine(&plot, 1.7, 0.2, 0.2, 0.25, QColor("green"), 1.5, Qt::PenStyle::DashLine);
infLine->set_two_sided(false);
infLine->setAlpha(0.5);
plot.addGraph(infLine);
infLine=new JKQTPgeoInfiniteLine(&plot, 1.7, 0.2, 0.2, -0.15, QColor("blue"), 1.5, Qt::PenStyle::SolidLine);
infLine->set_two_sided(true);
infLine->setAlpha(0.5);
plot.addGraph(infLine);
// 3.3 some rectangles (you give the center and width/height of the rectangle in the contructor)
plot.addGraph(new JKQTPgeoText(&plot, 0.1,1.95, "\\textbf{Rectangles:}", 14, QColor("red")));
plot.addGraph(new JKQTPgeoRectangle(&plot, 0.5,1.5,0.8,0.8, QColor("blue"), 1, Qt::SolidLine, QColor("lightblue")));
QColor rfill("lightblue"); rfill.setAlphaF(0.5);
plot.addGraph(new JKQTPgeoRectangle(&plot, QPointF(0.4,1.3), QPointF(0.9,1.6), QColor("blue"), 1, Qt::SolidLine, rfill));
plot.addGraph(new JKQTPgeoRectangle(&plot, 0.5,1.5,0.8,0.5, 35, QColor("darkblue"), 2, Qt::DashLine));
plot.addGraph(new JKQTPgeoRectangle(&plot, 0.5,1.5,0.6,0.6, -7, QColor("orange"), 2, Qt::DotLine, QColor("salmon"), Qt::FDiagPattern));
plot.addGraph(new JKQTPgeoSymbol(&plot, 0.5,1.5, JKQTPcircle, 5, QColor("grey")));
plot.addGraph(new JKQTPgeoSymbol(&plot, 0.4,1.3, JKQTPcircle, 5, QColor("grey")));
plot.addGraph(new JKQTPgeoSymbol(&plot, 0.9,1.6, JKQTPcircle, 5, QColor("grey")));
// 3.4 some circles and elllipses
plot.addGraph(new JKQTPgeoText(&plot, 1.1,1.95, "\\textbf{Circles/Ellipses:}", 14, QColor("red")));
QColor col=QColor("blue"); col.setAlphaF(0.2);
plot.addGraph(new JKQTPgeoRectangle(&plot, 1.5,1.5,0.8,0.8, col, 0.5, Qt::SolidLine));
col.setAlphaF(1);
plot.addGraph(new JKQTPgeoEllipse(&plot, 1.5,1.5,0.8,0.8, col, 1, Qt::SolidLine, QColor("lightblue")));
col=QColor("blue"); col.setAlphaF(0.2);
plot.addGraph(new JKQTPgeoRectangle(&plot, QPointF(1.4,1.3), QPointF(1.9,1.6),col, 0.5, Qt::SolidLine));
col.setAlphaF(1);
plot.addGraph(new JKQTPgeoEllipse(&plot, QPointF(1.4,1.3), QPointF(1.9,1.6), col, 1, Qt::SolidLine, rfill));
col=QColor("darkblue"); col.setAlphaF(0.2);
plot.addGraph(new JKQTPgeoRectangle(&plot, 1.5,1.5,0.8,0.5, 35, col, 0.5, Qt::DashLine));
col.setAlphaF(1);
plot.addGraph(new JKQTPgeoEllipse(&plot, 1.5,1.5,0.8,0.5, 35, col, 2, Qt::DashLine));
col=QColor("orange"); col.setAlphaF(0.2);
plot.addGraph(new JKQTPgeoRectangle(&plot, 1.5,1.5,0.6,0.6, -7, col, 0.5, Qt::DotLine));
col.setAlphaF(1);
plot.addGraph(new JKQTPgeoEllipse(&plot, 1.5,1.5,0.6,0.6, -7, col, 2, Qt::DotLine, QColor("salmon"), Qt::FDiagPattern));
plot.addGraph(new JKQTPgeoSymbol(&plot, 1.5,1.5, JKQTPcircle, 5, QColor("grey")));
plot.addGraph(new JKQTPgeoSymbol(&plot, 1.4,1.3, JKQTPcircle, 5, QColor("grey")));
plot.addGraph(new JKQTPgeoSymbol(&plot, 1.9,1.6, JKQTPcircle, 5, QColor("grey")));
// 3.5 some polygon elements
plot.addGraph(new JKQTPgeoText(&plot, 2.1,0.95, "\\textbf{PolyLines/Polygons:}", 14, QColor("red")));
QVector<QPointF> polygon;
polygon<<QPointF(2, 0.1)<<QPointF(2.3, 0.9)<<QPointF(2.6, 0.3)<<QPointF(2, 0.8);
JKQTPgeoPolygon* polygraph=new JKQTPgeoPolygon(&plot, polygon, QColor("blue"), 2, Qt::PenStyle::DashLine, QColor("lightblue"));
polygraph->setAlpha(0.75);
plot.addGraph(polygraph);
polygraph=new JKQTPgeoPolygon(&plot, QColor("red"), 2, Qt::PenStyle::DashLine, QColor("salmon"));
polygraph->appendPoint(2.1, 0.5);
polygraph->appendPoint(2.9, 0.9);
polygraph->appendPoint(2.2, 0.8);
polygraph->appendPoint(2.8, 0.25);
polygraph->appendPoint(2.6, 0.6);
polygraph->setAlpha(0.75);
plot.addGraph(polygraph);
// 3.6 some arcs
plot.addGraph(new JKQTPgeoText(&plot, 2.1,1.95, "\\textbf{Arcs:}", 14, QColor("red")));
plot.addGraph(new JKQTPgeoRectangle(&plot, 2.5,1.5,0.9,0.9, QColor("lightgrey"), 0.5, Qt::SolidLine));
plot.addGraph(new JKQTPgeoArc(&plot,2.5,1.5,0.9,0.9, 0, 90 , QColor("blue"), 4, Qt::PenStyle::SolidLine));
plot.addGraph(new JKQTPgeoArc(&plot,2.5,1.5,0.8,0.8, 90,180 , QColor("red"), 4, Qt::PenStyle::SolidLine));
plot.addGraph(new JKQTPgeoArc(&plot,2.5,1.5,0.7,0.7, 180,270 , QColor("darkblue"), 4, Qt::PenStyle::SolidLine));
plot.addGraph(new JKQTPgeoArc(&plot,2.5,1.5,0.6,0.6, 270,360 , QColor("maroon"), 4, Qt::PenStyle::DashDotLine));
plot.addGraph(new JKQTPgeoArc(&plot,2.5,1.5,0.5,0.5, -10, 117 , QColor("orange"), 4, Qt::PenStyle::DashLine));
plot.addGraph(new JKQTPgeoArc(&plot,2.5,1.5,0.4,0.4, 85, 347 , QColor("darkgreen"), 4, Qt::PenStyle::SolidLine));
plot.addGraph(new JKQTPgeoSymbol(&plot, 2.5,1.5, JKQTPcircle, 5, QColor("grey")));
// 3.7 some pies
plot.addGraph(new JKQTPgeoText(&plot, 2.1,2.95, "\\textbf{Pies:}", 14, QColor("red")));
plot.addGraph(new JKQTPgeoRectangle(&plot, 2.5,2.5,0.9,0.9, QColor("lightgrey"), 0.5, Qt::SolidLine));
JKQTPgeoPie* pie;
plot.addGraph(pie=new JKQTPgeoPie(&plot,2.5,2.5,0.9,0.9, 0, 90 , QColor("blue"), 4, Qt::PenStyle::SolidLine,QColor("lightblue")));
plot.addGraph(pie=new JKQTPgeoPie(&plot,2.5,2.5,0.7,0.7, 180,270 , QColor("darkblue"), 4, Qt::PenStyle::SolidLine,QColor("blue")));
pie->setAlpha(0.5);
plot.addGraph(pie=new JKQTPgeoPie(&plot,2.5,2.5,0.5,0.3, -25, 117 , QColor("orange"), 4, Qt::PenStyle::DashLine,QColor("red")));
pie->setAlpha(0.5);
plot.addGraph(pie=new JKQTPgeoPie(&plot,2.5,2.5,0.25,0.8, 85, 347 , QColor("darkgreen"), 4, Qt::PenStyle::SolidLine,QColor("green")));
pie->setAlpha(0.5);
plot.addGraph(new JKQTPgeoSymbol(&plot, 2.5,2.5, JKQTPcircle, 5, QColor("grey")));
// 3.8 some chords
plot.addGraph(new JKQTPgeoText(&plot, 1.1,2.95, "\\textbf{Chords:}", 14, QColor("red")));
plot.addGraph(new JKQTPgeoRectangle(&plot, 1.5,2.5,0.9,0.9, QColor("lightgrey"), 0.5, Qt::SolidLine));
JKQTPgeoChord* chord;
plot.addGraph(chord=new JKQTPgeoChord(&plot,1.5,2.5,0.9,0.9, 0, 90 , QColor("blue"), 4, Qt::PenStyle::SolidLine,QColor("lightblue")));
plot.addGraph(chord=new JKQTPgeoChord(&plot,1.5,2.5,0.7,0.7, 180,270 , QColor("darkblue"), 4, Qt::PenStyle::SolidLine,QColor("blue")));
chord->setAlpha(0.5);
plot.addGraph(chord=new JKQTPgeoChord(&plot,1.5,2.5,0.5,0.3, -25, 117 , QColor("orange"), 4, Qt::PenStyle::DashLine,QColor("red")));
chord->setAlpha(0.5);
plot.addGraph(chord=new JKQTPgeoChord(&plot,1.5,2.5,0.25,0.8, 85, 347 , QColor("darkgreen"), 4, Qt::PenStyle::SolidLine,QColor("green")));
chord->setAlpha(0.5);
plot.addGraph(new JKQTPgeoSymbol(&plot, 1.5,2.5, JKQTPcircle, 5, QColor("grey")));
// 4. show plotter and make it a decent size
plot.show();
plot.resize(800,800);
return app.exec();
}

View File

@ -0,0 +1,25 @@
# source code for this simple demo
SOURCES = jkqtplotter_simpletest_geometric.cpp
# configure Qt
CONFIG += qt
QT += core gui xml svg
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
# output executable name
TARGET = jkqtplotter_simpletest_geometric
# include JKQtPlotter source code
DEPENDPATH += . ../../lib
INCLUDEPATH += ../../lib
CONFIG (debug, debug|release) {
LIBS += -L../../staticlib/debug -ljkqtplotterlib_debug
} else {
LIBS += -L../../staticlib/release -ljkqtplotterlib
}
message("LIBS = $$LIBS")
# here you can activate some debug options
#DEFINES += SHOW_JKQTPLOTTER_DEBUG
#DEFINES += JKQTBP_AUTOTIMER

View File

@ -0,0 +1,8 @@
TEMPLATE = subdirs
SUBDIRS += jkqtplotterlib jkqtplotter_simpletest_geometric
jkqtplotterlib.file = ../../staticlib/jkqtplotterlib.pro
jkqtplotter_simpletest_geometric.file=$$PWD/jkqtplotter_simpletest_geometric.pro
jkqtplotter_simpletest_geometric.depends = jkqtplotterlib

View File

@ -2,7 +2,7 @@ TEMPLATE = subdirs
SUBDIRS += jkqtplotterlib jkqtplotter_simpletest_imageplot SUBDIRS += jkqtplotterlib jkqtplotter_simpletest_imageplot
jkqtplotterlib.file = ../../lib/jkqtplotterlib.pro jkqtplotterlib.file = ../../staticlib/jkqtplotterlib.pro
jkqtplotter_simpletest_imageplot.file=$$PWD/jkqtplotter_simpletest_imageplot.pro jkqtplotter_simpletest_imageplot.file=$$PWD/jkqtplotter_simpletest_imageplot.pro
jkqtplotter_simpletest_imageplot.depends = jkqtplotterlib jkqtplotter_simpletest_imageplot.depends = jkqtplotterlib

View File

@ -2,7 +2,7 @@ TEMPLATE = subdirs
SUBDIRS += jkqtplotterlib jkqtplotter_simpletest_imageplot_modifier SUBDIRS += jkqtplotterlib jkqtplotter_simpletest_imageplot_modifier
jkqtplotterlib.file = ../../lib/jkqtplotterlib.pro jkqtplotterlib.file = ../../staticlib/jkqtplotterlib.pro
jkqtplotter_simpletest_imageplot_modifier.file=$$PWD/jkqtplotter_simpletest_imageplot_modifier.pro jkqtplotter_simpletest_imageplot_modifier.file=$$PWD/jkqtplotter_simpletest_imageplot_modifier.pro
jkqtplotter_simpletest_imageplot_modifier.depends = jkqtplotterlib jkqtplotter_simpletest_imageplot_modifier.depends = jkqtplotterlib

View File

@ -2,7 +2,7 @@ TEMPLATE = subdirs
SUBDIRS += jkqtplotterlib jkqtplotter_simpletest_imageplot_nodatastore SUBDIRS += jkqtplotterlib jkqtplotter_simpletest_imageplot_nodatastore
jkqtplotterlib.file = ../../lib/jkqtplotterlib.pro jkqtplotterlib.file = ../../staticlib/jkqtplotterlib.pro
jkqtplotter_simpletest_imageplot_nodatastore.file=$$PWD/jkqtplotter_simpletest_imageplot_nodatastore.pro jkqtplotter_simpletest_imageplot_nodatastore.file=$$PWD/jkqtplotter_simpletest_imageplot_nodatastore.pro
jkqtplotter_simpletest_imageplot_nodatastore.depends = jkqtplotterlib jkqtplotter_simpletest_imageplot_nodatastore.depends = jkqtplotterlib

View File

@ -2,7 +2,7 @@ TEMPLATE = subdirs
SUBDIRS += jkqtplotterlib jkqtplotter_simpletest_impulsesplot SUBDIRS += jkqtplotterlib jkqtplotter_simpletest_impulsesplot
jkqtplotterlib.file = ../../lib/jkqtplotterlib.pro jkqtplotterlib.file = ../../staticlib/jkqtplotterlib.pro
jkqtplotter_simpletest_impulsesplot.file=$$PWD/jkqtplotter_simpletest_impulsesplot.pro jkqtplotter_simpletest_impulsesplot.file=$$PWD/jkqtplotter_simpletest_impulsesplot.pro
jkqtplotter_simpletest_impulsesplot.depends = jkqtplotterlib jkqtplotter_simpletest_impulsesplot.depends = jkqtplotterlib

View File

@ -2,7 +2,7 @@ TEMPLATE = subdirs
SUBDIRS += jkqtplotterlib jkqtplotter_simpletest_logaxes SUBDIRS += jkqtplotterlib jkqtplotter_simpletest_logaxes
jkqtplotterlib.file = ../../lib/jkqtplotterlib.pro jkqtplotterlib.file = ../../staticlib/jkqtplotterlib.pro
jkqtplotter_simpletest_logaxes.file=$$PWD/jkqtplotter_simpletest_logaxes.pro jkqtplotter_simpletest_logaxes.file=$$PWD/jkqtplotter_simpletest_logaxes.pro
jkqtplotter_simpletest_logaxes.depends = jkqtplotterlib jkqtplotter_simpletest_logaxes.depends = jkqtplotterlib

View File

@ -2,7 +2,7 @@ TEMPLATE = subdirs
SUBDIRS += jkqtplotterlib jkqtplotter_simpletest_parametriccurve SUBDIRS += jkqtplotterlib jkqtplotter_simpletest_parametriccurve
jkqtplotterlib.file = ../../lib/jkqtplotterlib.pro jkqtplotterlib.file = ../../staticlib/jkqtplotterlib.pro
jkqtplotter_simpletest_parametriccurve.file=$$PWD/jkqtplotter_simpletest_parametriccurve.pro jkqtplotter_simpletest_parametriccurve.file=$$PWD/jkqtplotter_simpletest_parametriccurve.pro
jkqtplotter_simpletest_parametriccurve.depends = jkqtplotterlib jkqtplotter_simpletest_parametriccurve.depends = jkqtplotterlib

View File

@ -2,7 +2,7 @@ TEMPLATE = subdirs
SUBDIRS += jkqtplotterlib jkqtplotter_simpletest_paramscatterplot SUBDIRS += jkqtplotterlib jkqtplotter_simpletest_paramscatterplot
jkqtplotterlib.file = ../../lib/jkqtplotterlib.pro jkqtplotterlib.file = ../../staticlib/jkqtplotterlib.pro
jkqtplotter_simpletest_paramscatterplot.file=$$PWD/jkqtplotter_simpletest_paramscatterplot.pro jkqtplotter_simpletest_paramscatterplot.file=$$PWD/jkqtplotter_simpletest_paramscatterplot.pro
jkqtplotter_simpletest_paramscatterplot.depends = jkqtplotterlib jkqtplotter_simpletest_paramscatterplot.depends = jkqtplotterlib

View File

@ -2,7 +2,7 @@ TEMPLATE = subdirs
SUBDIRS += jkqtplotterlib jkqtplotter_simpletest_paramscatterplot_image SUBDIRS += jkqtplotterlib jkqtplotter_simpletest_paramscatterplot_image
jkqtplotterlib.file = ../../lib/jkqtplotterlib.pro jkqtplotterlib.file = ../../staticlib/jkqtplotterlib.pro
jkqtplotter_simpletest_paramscatterplot_image.file=$$PWD/jkqtplotter_simpletest_paramscatterplot_image.pro jkqtplotter_simpletest_paramscatterplot_image.file=$$PWD/jkqtplotter_simpletest_paramscatterplot_image.pro
jkqtplotter_simpletest_paramscatterplot_image.depends = jkqtplotterlib jkqtplotter_simpletest_paramscatterplot_image.depends = jkqtplotterlib

View File

@ -2,7 +2,7 @@ TEMPLATE = subdirs
SUBDIRS += jkqtplotterlib jkqtplotter_simpletest_parsedfunctionplot SUBDIRS += jkqtplotterlib jkqtplotter_simpletest_parsedfunctionplot
jkqtplotterlib.file = ../../lib/jkqtplotterlib.pro jkqtplotterlib.file = ../../staticlib/jkqtplotterlib.pro
jkqtplotter_simpletest_parsedfunctionplot.file=$$PWD/jkqtplotter_simpletest_parsedfunctionplot.pro jkqtplotter_simpletest_parsedfunctionplot.file=$$PWD/jkqtplotter_simpletest_parsedfunctionplot.pro
jkqtplotter_simpletest_parsedfunctionplot.depends = jkqtplotterlib jkqtplotter_simpletest_parsedfunctionplot.depends = jkqtplotterlib

View File

@ -2,7 +2,7 @@ TEMPLATE = subdirs
SUBDIRS += jkqtplotterlib jkqtplotter_simpletest_rgbimageplot_qt SUBDIRS += jkqtplotterlib jkqtplotter_simpletest_rgbimageplot_qt
jkqtplotterlib.file = ../../lib/jkqtplotterlib.pro jkqtplotterlib.file = ../../staticlib/jkqtplotterlib.pro
jkqtplotter_simpletest_rgbimageplot_qt.file=$$PWD/jkqtplotter_simpletest_rgbimageplot_qt.pro jkqtplotter_simpletest_rgbimageplot_qt.file=$$PWD/jkqtplotter_simpletest_rgbimageplot_qt.pro
jkqtplotter_simpletest_rgbimageplot_qt.depends = jkqtplotterlib jkqtplotter_simpletest_rgbimageplot_qt.depends = jkqtplotterlib

View File

@ -2,7 +2,7 @@ TEMPLATE = subdirs
SUBDIRS += jkqtplotterlib jkqtplotter_simpletest_speed SUBDIRS += jkqtplotterlib jkqtplotter_simpletest_speed
jkqtplotterlib.file = ../../lib/jkqtplotterlib.pro jkqtplotterlib.file = ../../staticlib/jkqtplotterlib.pro
jkqtplotter_simpletest_speed.file=$$PWD/jkqtplotter_simpletest_speed.pro jkqtplotter_simpletest_speed.file=$$PWD/jkqtplotter_simpletest_speed.pro
jkqtplotter_simpletest_speed.depends = jkqtplotterlib jkqtplotter_simpletest_speed.depends = jkqtplotterlib

View File

@ -2,7 +2,7 @@ TEMPLATE = subdirs
SUBDIRS += jkqtplotterlib jkqtplotter_simpletest_stackedbars SUBDIRS += jkqtplotterlib jkqtplotter_simpletest_stackedbars
jkqtplotterlib.file = ../../lib/jkqtplotterlib.pro jkqtplotterlib.file = ../../staticlib/jkqtplotterlib.pro
jkqtplotter_simpletest_stackedbars.file=$$PWD/jkqtplotter_simpletest_stackedbars.pro jkqtplotter_simpletest_stackedbars.file=$$PWD/jkqtplotter_simpletest_stackedbars.pro
jkqtplotter_simpletest_stackedbars.depends = jkqtplotterlib jkqtplotter_simpletest_stackedbars.depends = jkqtplotterlib

View File

@ -2,7 +2,7 @@ TEMPLATE = subdirs
SUBDIRS += jkqtplotterlib jkqtplotter_simpletest_stepplots SUBDIRS += jkqtplotterlib jkqtplotter_simpletest_stepplots
jkqtplotterlib.file = ../../lib/jkqtplotterlib.pro jkqtplotterlib.file = ../../staticlib/jkqtplotterlib.pro
jkqtplotter_simpletest_stepplots.file=$$PWD/jkqtplotter_simpletest_stepplots.pro jkqtplotter_simpletest_stepplots.file=$$PWD/jkqtplotter_simpletest_stepplots.pro
jkqtplotter_simpletest_stepplots.depends = jkqtplotterlib jkqtplotter_simpletest_stepplots.depends = jkqtplotterlib

View File

@ -2,7 +2,7 @@ TEMPLATE = subdirs
SUBDIRS += jkqtplotterlib jkqtplotter_simpletest_symbols_and_errors SUBDIRS += jkqtplotterlib jkqtplotter_simpletest_symbols_and_errors
jkqtplotterlib.file = ../../lib/jkqtplotterlib.pro jkqtplotterlib.file = ../../staticlib/jkqtplotterlib.pro
jkqtplotter_simpletest_symbols_and_errors.file=$$PWD/jkqtplotter_simpletest_symbols_and_errors.pro jkqtplotter_simpletest_symbols_and_errors.file=$$PWD/jkqtplotter_simpletest_symbols_and_errors.pro
jkqtplotter_simpletest_symbols_and_errors.depends = jkqtplotterlib jkqtplotter_simpletest_symbols_and_errors.depends = jkqtplotterlib

View File

@ -2,7 +2,7 @@ TEMPLATE = subdirs
SUBDIRS += jkqtplotterlib jkqtplotter_simpletest_symbols_and_styles SUBDIRS += jkqtplotterlib jkqtplotter_simpletest_symbols_and_styles
jkqtplotterlib.file = ../../lib/jkqtplotterlib.pro jkqtplotterlib.file = ../../staticlib/jkqtplotterlib.pro
jkqtplotter_simpletest_symbols_and_styles.file=$$PWD/jkqtplotter_simpletest_symbols_and_styles.pro jkqtplotter_simpletest_symbols_and_styles.file=$$PWD/jkqtplotter_simpletest_symbols_and_styles.pro
jkqtplotter_simpletest_symbols_and_styles.depends = jkqtplotterlib jkqtplotter_simpletest_symbols_and_styles.depends = jkqtplotterlib

View File

@ -2,7 +2,7 @@ TEMPLATE = subdirs
SUBDIRS += jkqtplotterlib test_multiplot SUBDIRS += jkqtplotterlib test_multiplot
jkqtplotterlib.file = ../../lib/jkqtplotterlib.pro jkqtplotterlib.file = ../../staticlib/jkqtplotterlib.pro
test_multiplot.file=$$PWD/test_multiplot.pro test_multiplot.file=$$PWD/test_multiplot.pro
test_multiplot.depends = jkqtplotterlib test_multiplot.depends = jkqtplotterlib

View File

@ -480,7 +480,7 @@ class LIB_EXPORT JKQTPhorizontalRange: public JKQTPgraph {
bool plotRange; bool plotRange;
/** \brief if \c true, draws lines at the range borders \a color */ /** \brief if \c true, draws lines at the range borders \a color */
bool plotRangeLines; bool plotRangeLines;
/** \brief if \c true, this fills the range with \a fillCOlor */ /** \brief if \c true, this fills the range with \a fillColor */
bool fillRange; bool fillRange;
/** \brief color of the graph */ /** \brief color of the graph */
QColor color; QColor color;

View File

@ -44,6 +44,11 @@ JKQTPgeoBaseLine::JKQTPgeoBaseLine(QColor color, double lineWidth, Qt::PenStyle
title=""; title="";
} }
void JKQTPgeoBaseLine::setAlpha(float alpha)
{
color.setAlphaF(alpha);
}
QPen JKQTPgeoBaseLine::getPen(JKQTPEnhancedPainter& painter) { QPen JKQTPgeoBaseLine::getPen(JKQTPEnhancedPainter& painter) {
QPen p; QPen p;
p.setColor(color); p.setColor(color);
@ -55,8 +60,8 @@ QPen JKQTPgeoBaseLine::getPen(JKQTPEnhancedPainter& painter) {
void JKQTPgeoBaseLine::drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) { void JKQTPgeoBaseLine::drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) {
painter.save(); painter.save();
painter.setPen(getPen(painter)); painter.setPen(getPen(painter));
int y=rect.top()+rect.height()/2.0; double y=rect.top()+rect.height()/2.0;
if (rect.width()>0) painter.drawLine(rect.left(), y, rect.right(), y); if (rect.width()>0) painter.drawLine(QLineF(rect.left(), y, rect.right(), y));
painter.restore(); painter.restore();
} }
@ -98,6 +103,18 @@ JKQTPgeoBaseFilled::JKQTPgeoBaseFilled(QColor color, QColor fillColor, JKQtPlott
this->fillColor=fillColor; this->fillColor=fillColor;
this->fillStyle=Qt::SolidPattern; this->fillStyle=Qt::SolidPattern;
} }
void JKQTPgeoBaseFilled::setAlpha(float alpha)
{
JKQTPgeoBaseLine::setAlpha(alpha);
fillColor.setAlphaF(alpha);
}
void JKQTPgeoBaseFilled::setAlpha(float alphaLine, float alphaFill)
{
JKQTPgeoBaseLine::setAlpha(alphaLine);
fillColor.setAlphaF(alphaFill);
}
QBrush JKQTPgeoBaseFilled::getBrush(JKQTPEnhancedPainter &/*painter*/) { QBrush JKQTPgeoBaseFilled::getBrush(JKQTPEnhancedPainter &/*painter*/) {
QBrush b; QBrush b;
b.setColor(fillColor); b.setColor(fillColor);
@ -165,8 +182,8 @@ void JKQTPgeoText::draw(JKQTPEnhancedPainter& painter) {
void JKQTPgeoText::drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) { void JKQTPgeoText::drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) {
painter.save(); painter.save();
painter.setPen(getPen(painter)); painter.setPen(getPen(painter));
int y=rect.top()+rect.height()/2.0; double y=rect.top()+rect.height()/2.0;
if (rect.width()>0) painter.drawLine(rect.left(), y, rect.right(), y); if (rect.width()>0) painter.drawLine(QLineF(rect.left(), y, rect.right(), y));
painter.restore(); painter.restore();
} }
@ -400,17 +417,29 @@ void JKQTPgeoInfiniteLine::draw(JKQTPEnhancedPainter& painter) {
JKQTPgeoLines::JKQTPgeoLines(JKQtBasePlotter* parent, QVector<QPointF> points, QColor color, double lineWidth, Qt::PenStyle style): JKQTPgeoPolyLines::JKQTPgeoPolyLines(JKQtBasePlotter* parent, const QVector<QPointF>& points, QColor color, double lineWidth, Qt::PenStyle style):
JKQTPgeoBaseLine(color, lineWidth, style, parent) JKQTPgeoBaseLine(color, lineWidth, style, parent)
{ {
this->points=points; this->points=points;
} }
JKQTPgeoLines::JKQTPgeoLines(JKQtPlotter* parent, QVector<QPointF> points, QColor color, double lineWidth, Qt::PenStyle style): JKQTPgeoPolyLines::JKQTPgeoPolyLines(JKQtPlotter* parent, const QVector<QPointF>& points, QColor color, double lineWidth, Qt::PenStyle style):
JKQTPgeoBaseLine(color, lineWidth, style, parent) JKQTPgeoBaseLine(color, lineWidth, style, parent)
{ {
this->points=points; this->points=points;
} }
bool JKQTPgeoLines::getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) { JKQTPgeoPolyLines::JKQTPgeoPolyLines(JKQtBasePlotter *parent, QColor color, double lineWidth, Qt::PenStyle style):
JKQTPgeoBaseLine(color, lineWidth, style, parent)
{
}
JKQTPgeoPolyLines::JKQTPgeoPolyLines(JKQtPlotter *parent, QColor color, double lineWidth, Qt::PenStyle style):
JKQTPgeoBaseLine(color, lineWidth, style, parent)
{
}
bool JKQTPgeoPolyLines::getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) {
minx=0; minx=0;
maxx=0; maxx=0;
smallestGreaterZero=0; smallestGreaterZero=0;
@ -430,7 +459,7 @@ bool JKQTPgeoLines::getXMinMax(double& minx, double& maxx, double& smallestGreat
//qDebug()<<"getXMinMax"<<minx<<maxx; //qDebug()<<"getXMinMax"<<minx<<maxx;
} }
bool JKQTPgeoLines::getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) { bool JKQTPgeoPolyLines::getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) {
miny=0; miny=0;
maxy=0; maxy=0;
smallestGreaterZero=0; smallestGreaterZero=0;
@ -450,7 +479,7 @@ bool JKQTPgeoLines::getYMinMax(double& miny, double& maxy, double& smallestGreat
//qDebug()<<"getYMinMax"<<miny<<maxy; //qDebug()<<"getYMinMax"<<miny<<maxy;
} }
void JKQTPgeoLines::draw(JKQTPEnhancedPainter& painter) { void JKQTPgeoPolyLines::draw(JKQTPEnhancedPainter& painter) {
QPainterPath path=transformToLinePath(points); QPainterPath path=transformToLinePath(points);
painter.save(); painter.save();
painter.setPen(getPen(painter)); painter.setPen(getPen(painter));
@ -464,7 +493,7 @@ JKQTPgeoRectangle::JKQTPgeoRectangle(JKQtBasePlotter* parent, double x, double y
{ {
this->x=x; this->x=x;
this->y=y; this->y=y;
alpha=0; angle=0;
this->width=width; this->width=width;
this->height=height; this->height=height;
} }
@ -474,14 +503,54 @@ JKQTPgeoRectangle::JKQTPgeoRectangle(JKQtPlotter* parent, double x, double y, do
{ {
this->x=x; this->x=x;
this->y=y; this->y=y;
alpha=0; angle=0;
this->width=width; this->width=width;
this->height=height; this->height=height;
} }
JKQTPgeoRectangle::JKQTPgeoRectangle(JKQtBasePlotter *parent, double x, double y, double width, double height, double angle, QColor color, double lineWidth, Qt::PenStyle style, QColor fillColor, Qt::BrushStyle fillStyle):
JKQTPgeoBaseFilled(color, fillColor, lineWidth, style, fillStyle, parent)
{
this->x=x;
this->y=y;
this->angle=angle;
this->width=width;
this->height=height;
}
JKQTPgeoRectangle::JKQTPgeoRectangle(JKQtPlotter *parent, double x, double y, double width, double height, double angle, QColor color, double lineWidth, Qt::PenStyle style, QColor fillColor, Qt::BrushStyle fillStyle):
JKQTPgeoBaseFilled(color, fillColor, lineWidth, style, fillStyle, parent)
{
this->x=x;
this->y=y;
this->angle=angle;
this->width=width;
this->height=height;
}
JKQTPgeoRectangle::JKQTPgeoRectangle(JKQtBasePlotter *parent, QPointF bottomleft, QPointF topright, QColor color, double lineWidth, Qt::PenStyle style, QColor fillColor, Qt::BrushStyle fillStyle):
JKQTPgeoBaseFilled(color, fillColor, lineWidth, style, fillStyle, parent)
{
this->angle=0;
this->width=fabs(topright.x()-bottomleft.x());
this->height=fabs(topright.y()-bottomleft.y());
this->x=bottomleft.x()+this->width/2.0;
this->y=bottomleft.y()+this->height/2.0;
}
JKQTPgeoRectangle::JKQTPgeoRectangle(JKQtPlotter *parent, QPointF bottomleft, QPointF topright, QColor color, double lineWidth, Qt::PenStyle style, QColor fillColor, Qt::BrushStyle fillStyle):
JKQTPgeoBaseFilled(color, fillColor, lineWidth, style, fillStyle, parent)
{
this->angle=0;
this->width=fabs(topright.x()-bottomleft.x());
this->height=fabs(topright.y()-bottomleft.y());
this->x=bottomleft.x()+this->width/2.0;
this->y=bottomleft.y()+this->height/2.0;
}
QMatrix JKQTPgeoRectangle::getMatrix() { QMatrix JKQTPgeoRectangle::getMatrix() {
QMatrix trans; QMatrix trans;
trans.rotate(alpha); trans.rotate(angle);
return trans; return trans;
} }
@ -545,17 +614,26 @@ void JKQTPgeoRectangle::set_bottomleftrectangle(double x, double y, double width
JKQTPgeoPolygon::JKQTPgeoPolygon(JKQtBasePlotter* parent, QVector<QPointF> points, QColor color, double lineWidth, Qt::PenStyle style, QColor fillColor, Qt::BrushStyle fillStyle): JKQTPgeoPolygon::JKQTPgeoPolygon(JKQtBasePlotter* parent, const QVector<QPointF>& points, QColor color, double lineWidth, Qt::PenStyle style, QColor fillColor, Qt::BrushStyle fillStyle):
JKQTPgeoBaseFilled(color, fillColor, lineWidth, style, fillStyle, parent) JKQTPgeoBaseFilled(color, fillColor, lineWidth, style, fillStyle, parent)
{ {
this->points=points; this->points=points;
} }
JKQTPgeoPolygon::JKQTPgeoPolygon(JKQtPlotter* parent, QVector<QPointF> points, QColor color, double lineWidth, Qt::PenStyle style, QColor fillColor, Qt::BrushStyle fillStyle): JKQTPgeoPolygon::JKQTPgeoPolygon(JKQtPlotter* parent, const QVector<QPointF>& points, QColor color, double lineWidth, Qt::PenStyle style, QColor fillColor, Qt::BrushStyle fillStyle):
JKQTPgeoBaseFilled(color, fillColor, lineWidth, style, fillStyle, parent) JKQTPgeoBaseFilled(color, fillColor, lineWidth, style, fillStyle, parent)
{ {
this->points=points; this->points=points;
} }
JKQTPgeoPolygon::JKQTPgeoPolygon(JKQtBasePlotter* parent, QColor color, double lineWidth, Qt::PenStyle style, QColor fillColor, Qt::BrushStyle fillStyle):
JKQTPgeoBaseFilled(color, fillColor, lineWidth, style, fillStyle, parent)
{
}
JKQTPgeoPolygon::JKQTPgeoPolygon(JKQtPlotter* parent, QColor color, double lineWidth, Qt::PenStyle style, QColor fillColor, Qt::BrushStyle fillStyle):
JKQTPgeoBaseFilled(color, fillColor, lineWidth, style, fillStyle, parent)
{
}
bool JKQTPgeoPolygon::getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) { bool JKQTPgeoPolygon::getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) {
minx=0; minx=0;
maxx=0; maxx=0;
@ -617,10 +695,34 @@ JKQTPgeoEllipse::JKQTPgeoEllipse(JKQtPlotter* parent, double x, double y, double
controlPoints=180; controlPoints=180;
} }
JKQTPgeoEllipse::JKQTPgeoEllipse(JKQtBasePlotter *parent, double x, double y, double width, double height, double angle, QColor color, double lineWidth, Qt::PenStyle style, QColor fillColor, Qt::BrushStyle fillStyle):
JKQTPgeoRectangle(parent, x, y, width, height, angle, color, lineWidth, style, fillColor, fillStyle)
{
controlPoints=180;
}
JKQTPgeoEllipse::JKQTPgeoEllipse(JKQtPlotter *parent, double x, double y, double width, double height, double angle, QColor color, double lineWidth, Qt::PenStyle style, QColor fillColor, Qt::BrushStyle fillStyle):
JKQTPgeoRectangle(parent, x, y, width, height, angle, color, lineWidth, style, fillColor, fillStyle)
{
controlPoints=180;
}
JKQTPgeoEllipse::JKQTPgeoEllipse(JKQtBasePlotter *parent, QPointF bottomleft, QPointF topright, QColor color, double lineWidth, Qt::PenStyle style, QColor fillColor, Qt::BrushStyle fillStyle):
JKQTPgeoRectangle(parent, bottomleft, topright, color, lineWidth, style, fillColor, fillStyle)
{
controlPoints=180;
}
JKQTPgeoEllipse::JKQTPgeoEllipse(JKQtPlotter *parent, QPointF bottomleft, QPointF topright, QColor color, double lineWidth, Qt::PenStyle style, QColor fillColor, Qt::BrushStyle fillStyle):
JKQTPgeoRectangle(parent, bottomleft, topright, color, lineWidth, style, fillColor, fillStyle)
{
controlPoints=180;
}
void JKQTPgeoEllipse::draw(JKQTPEnhancedPainter& painter) { void JKQTPgeoEllipse::draw(JKQTPEnhancedPainter& painter) {
QPainterPath rect; QPainterPath rect;
rect=transformToLinePath(JKQTPdrawEllipse(x,y,width/2.0, height/2.0,0,360,alpha, controlPoints)); rect=transformToLinePath(JKQTPdrawEllipse(x,y,width/2.0, height/2.0,0,360,angle, controlPoints));
rect.closeSubpath(); rect.closeSubpath();
@ -642,7 +744,7 @@ JKQTPgeoArc::JKQTPgeoArc(JKQtBasePlotter* parent, double x, double y, double wid
this->y=y; this->y=y;
this->width=width; this->width=width;
this->height=height; this->height=height;
this->alpha=0; this->angle=0;
this->controlPoints=180; this->controlPoints=180;
} }
@ -655,14 +757,14 @@ JKQTPgeoArc::JKQTPgeoArc(JKQtPlotter* parent, double x, double y, double width,
this->y=y; this->y=y;
this->width=width; this->width=width;
this->height=height; this->height=height;
this->alpha=0; this->angle=0;
this->controlPoints=180; this->controlPoints=180;
} }
void JKQTPgeoArc::draw(JKQTPEnhancedPainter& painter) { void JKQTPgeoArc::draw(JKQTPEnhancedPainter& painter) {
QPainterPath rect; QPainterPath rect;
rect=transformToLinePath(JKQTPdrawEllipse(x,y,width/2.0, height/2.0,angleStart,angleStop,alpha, controlPoints)); rect=transformToLinePath(JKQTPdrawEllipse(x,y,width/2.0, height/2.0,angleStart,angleStop,angle, controlPoints));
painter.save(); painter.save();
painter.setPen(getPen(painter)); painter.setPen(getPen(painter));
@ -673,7 +775,7 @@ void JKQTPgeoArc::draw(JKQTPEnhancedPainter& painter) {
bool JKQTPgeoArc::getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) { bool JKQTPgeoArc::getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) {
QPolygonF rect; QPolygonF rect;
rect=QPolygonF(JKQTPdrawEllipse(x,y,width/2.0, height/2.0,angleStart,angleStop,alpha, controlPoints)); rect=QPolygonF(JKQTPdrawEllipse(x,y,width/2.0, height/2.0,angleStart,angleStop,angle, controlPoints));
minx=rect.boundingRect().left(); minx=rect.boundingRect().left();
maxx=rect.boundingRect().right(); maxx=rect.boundingRect().right();
if (minx>maxx) std::swap(minx, maxx); if (minx>maxx) std::swap(minx, maxx);
@ -686,7 +788,7 @@ bool JKQTPgeoArc::getXMinMax(double& minx, double& maxx, double& smallestGreater
bool JKQTPgeoArc::getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) { bool JKQTPgeoArc::getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) {
QPolygonF rect; QPolygonF rect;
rect=QPolygonF(JKQTPdrawEllipse(x,y,width/2.0, height/2.0,angleStart,angleStop,alpha, controlPoints)); rect=QPolygonF(JKQTPdrawEllipse(x,y,width/2.0, height/2.0,angleStart,angleStop,angle, controlPoints));
miny=rect.boundingRect().bottom(); miny=rect.boundingRect().bottom();
maxy=rect.boundingRect().top(); maxy=rect.boundingRect().top();
if (miny>maxy) std::swap(miny, maxy); if (miny>maxy) std::swap(miny, maxy);
@ -719,7 +821,7 @@ JKQTPgeoPie::JKQTPgeoPie(JKQtPlotter* parent, double x, double y, double width,
void JKQTPgeoPie::draw(JKQTPEnhancedPainter& painter) { void JKQTPgeoPie::draw(JKQTPEnhancedPainter& painter) {
QPainterPath rect; QPainterPath rect;
rect=transformToLinePath(JKQTPdrawEllipse(x,y,width/2.0, height/2.0,angleStart,angleStop,alpha, controlPoints)); rect=transformToLinePath(JKQTPdrawEllipse(x,y,width/2.0, height/2.0,angleStart,angleStop,angle, controlPoints));
rect.lineTo(transform(x,y)); rect.lineTo(transform(x,y));
rect.closeSubpath(); rect.closeSubpath();
@ -733,7 +835,7 @@ void JKQTPgeoPie::draw(JKQTPEnhancedPainter& painter) {
bool JKQTPgeoPie::getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) { bool JKQTPgeoPie::getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) {
QPolygonF rect; QPolygonF rect;
rect=QPolygonF(JKQTPdrawEllipse(x,y,width/2.0, height/2.0,angleStart,angleStop,alpha, controlPoints)); rect=QPolygonF(JKQTPdrawEllipse(x,y,width/2.0, height/2.0,angleStart,angleStop,angle, controlPoints));
rect.append(QPointF(x,y)); rect.append(QPointF(x,y));
minx=rect.boundingRect().left(); minx=rect.boundingRect().left();
maxx=rect.boundingRect().right(); maxx=rect.boundingRect().right();
@ -747,7 +849,7 @@ bool JKQTPgeoPie::getXMinMax(double& minx, double& maxx, double& smallestGreater
bool JKQTPgeoPie::getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) { bool JKQTPgeoPie::getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) {
QPolygonF rect; QPolygonF rect;
rect=QPolygonF(JKQTPdrawEllipse(x,y,width/2.0, height/2.0,angleStart,angleStop,alpha, controlPoints)); rect=QPolygonF(JKQTPdrawEllipse(x,y,width/2.0, height/2.0,angleStart,angleStop,angle, controlPoints));
rect.append(QPointF(x,y)); rect.append(QPointF(x,y));
miny=rect.boundingRect().bottom(); miny=rect.boundingRect().bottom();
maxy=rect.boundingRect().top(); maxy=rect.boundingRect().top();
@ -777,7 +879,7 @@ JKQTPgeoChord::JKQTPgeoChord(JKQtPlotter* parent, double x, double y, double wid
void JKQTPgeoChord::draw(JKQTPEnhancedPainter& painter) { void JKQTPgeoChord::draw(JKQTPEnhancedPainter& painter) {
QPainterPath rect; QPainterPath rect;
rect=transformToLinePath(JKQTPdrawEllipse(x,y,width/2.0, height/2.0,angleStart,angleStop,alpha, controlPoints)); rect=transformToLinePath(JKQTPdrawEllipse(x,y,width/2.0, height/2.0,angleStart,angleStop,angle, controlPoints));
rect.closeSubpath(); rect.closeSubpath();
@ -790,7 +892,7 @@ void JKQTPgeoChord::draw(JKQTPEnhancedPainter& painter) {
bool JKQTPgeoChord::getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) { bool JKQTPgeoChord::getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) {
QPolygonF rect; QPolygonF rect;
rect=QPolygonF(JKQTPdrawEllipse(x,y,width/2.0, height/2.0,angleStart,angleStop,alpha, controlPoints)); rect=QPolygonF(JKQTPdrawEllipse(x,y,width/2.0, height/2.0,angleStart,angleStop,angle, controlPoints));
minx=rect.boundingRect().left(); minx=rect.boundingRect().left();
maxx=rect.boundingRect().right(); maxx=rect.boundingRect().right();
if (minx>maxx) std::swap(minx, maxx); if (minx>maxx) std::swap(minx, maxx);
@ -802,7 +904,7 @@ bool JKQTPgeoChord::getXMinMax(double& minx, double& maxx, double& smallestGreat
bool JKQTPgeoChord::getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) { bool JKQTPgeoChord::getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) {
QPolygonF rect; QPolygonF rect;
rect=QPolygonF(JKQTPdrawEllipse(x,y,width/2.0, height/2.0,angleStart,angleStop,alpha, controlPoints)); rect=QPolygonF(JKQTPdrawEllipse(x,y,width/2.0, height/2.0,angleStart,angleStop,angle, controlPoints));
miny=rect.boundingRect().bottom(); miny=rect.boundingRect().bottom();
maxy=rect.boundingRect().top(); maxy=rect.boundingRect().top();
if (miny>maxy) std::swap(miny, maxy); if (miny>maxy) std::swap(miny, maxy);
@ -812,3 +914,72 @@ bool JKQTPgeoChord::getYMinMax(double& miny, double& maxy, double& smallestGreat
return true; return true;
} }
JKQTPgeoSymbol::JKQTPgeoSymbol(JKQtBasePlotter *parent, double x, double y, JKQTPgraphSymbols symbol, double symbolSize, QColor color, QColor fillColor):
JKQTPplotObject(parent)
{
this->x=x;
this->y=y;
this->symbol=symbol;
this->symbolSize=symbolSize;
this->color=color;
this->fillColor=fillColor;
this->symbolWidth=1;
}
JKQTPgeoSymbol::JKQTPgeoSymbol(JKQtPlotter *parent, double x, double y, JKQTPgraphSymbols symbol, double symbolSize, QColor color, QColor fillColor):
JKQTPplotObject(parent)
{
this->x=x;
this->y=y;
this->symbol=symbol;
this->symbolSize=symbolSize;
this->color=color;
this->fillColor=fillColor;
this->symbolWidth=1;
}
bool JKQTPgeoSymbol::getXMinMax(double &minx, double &maxx, double &smallestGreaterZero)
{
minx=x;
maxx=x;
double xvsgz;
xvsgz=minx; SmallestGreaterZeroCompare_xvsgz();
xvsgz=maxx; SmallestGreaterZeroCompare_xvsgz();
return true;
}
bool JKQTPgeoSymbol::getYMinMax(double &miny, double &maxy, double &smallestGreaterZero)
{
miny=y;
maxy=y;
double xvsgz;
xvsgz=miny; SmallestGreaterZeroCompare_xvsgz();
xvsgz=maxy; SmallestGreaterZeroCompare_xvsgz();
return true;
}
void JKQTPgeoSymbol::draw(JKQTPEnhancedPainter &painter)
{
painter.save();
JKQTPplotSymbol(painter, transformX(x), transformY(y), symbol, symbolSize, symbolWidth, color, fillColor);
painter.restore();
}
void JKQTPgeoSymbol::drawKeyMarker(JKQTPEnhancedPainter &painter, QRectF &rect)
{
const double minSize=qMin(rect.width(), rect.height());
double symbolSize=parent->pt2px(painter, this->symbolSize);
if (symbolSize>minSize*0.9) symbolSize=minSize*0.9;
double symbolWidth=parent->pt2px(painter, this->symbolWidth*parent->get_lineWidthMultiplier());
if (symbolWidth>0.3*symbolSize) symbolWidth=0.3*symbolSize;
painter.save();
JKQTPplotSymbol(painter, rect.left()+rect.width()/2.0, rect.top()+rect.height()/2.0, symbol, symbolSize, symbolWidth, color, fillColor);
painter.restore();
}
QColor JKQTPgeoSymbol::getKeyLabelColor()
{
return color;
}

View File

@ -70,6 +70,9 @@ class LIB_EXPORT JKQTPgeoBaseLine: public JKQTPplotObject {
JKQTPGET_SET_MACRO(Qt::PenStyle, style) JKQTPGET_SET_MACRO(Qt::PenStyle, style)
JKQTPGET_SET_MACRO(double, lineWidth) JKQTPGET_SET_MACRO(double, lineWidth)
/** \brief sets the alpha-channel of the \a color (i.e. its transparency) */
virtual void setAlpha(float alpha);
/** \brief plots a key marker inside the specified rectangle \a rect */ /** \brief plots a key marker inside the specified rectangle \a rect */
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 */
@ -99,7 +102,7 @@ class LIB_EXPORT JKQTPgeoBaseFilled: public JKQTPgeoBaseLine {
/*! \brief class contructor /*! \brief class contructor
\param color color of drawing \param color color of drawing
\param fillCOlor color of the filling in the drawing \param fillColor color of the filling in the drawing
\param style line style of drawing \param style line style of drawing
\param fillStyle filling style of the graph \param fillStyle filling style of the graph
\param lineWidth lineWidth of drawing \param lineWidth lineWidth of drawing
@ -108,7 +111,7 @@ class LIB_EXPORT JKQTPgeoBaseFilled: public JKQTPgeoBaseLine {
/*! \brief class contructor /*! \brief class contructor
\param color color of drawing \param color color of drawing
\param fillCOlor color of the filling in the drawing \param fillColor color of the filling in the drawing
\param style line style of drawing \param style line style of drawing
\param fillStyle filling style of the graph \param fillStyle filling style of the graph
\param lineWidth lineWidth of drawing \param lineWidth lineWidth of drawing
@ -117,7 +120,7 @@ class LIB_EXPORT JKQTPgeoBaseFilled: public JKQTPgeoBaseLine {
/*! \brief class contructor /*! \brief class contructor
\param color color of drawing \param color color of drawing
\param fillCOlor color of the filling in the drawing \param fillColor color of the filling in the drawing
\param style line style of drawing \param style line style of drawing
\param lineWidth lineWidth of drawing \param lineWidth lineWidth of drawing
*/ */
@ -125,20 +128,25 @@ class LIB_EXPORT JKQTPgeoBaseFilled: public JKQTPgeoBaseLine {
/*! \brief class contructor /*! \brief class contructor
\param color color of drawing \param color color of drawing
\param fillCOlor color of the filling in the drawing \param fillColor color of the filling in the drawing
\param lineWidth lineWidth of drawing \param lineWidth lineWidth of drawing
*/ */
JKQTPgeoBaseFilled(QColor color, QColor fillColor, double lineWidth, JKQtPlotter* parent); JKQTPgeoBaseFilled(QColor color, QColor fillColor, double lineWidth, JKQtPlotter* parent);
/*! \brief class contructor /*! \brief class contructor
\param color color of drawing \param color color of drawing
\param fillCOlor color of the filling in the drawing \param fillColor color of the filling in the drawing
*/ */
JKQTPgeoBaseFilled(QColor color, QColor fillColor, JKQtPlotter* parent); JKQTPgeoBaseFilled(QColor color, QColor fillColor, JKQtPlotter* parent);
JKQTPGET_SET_MACRO(QColor, fillColor) JKQTPGET_SET_MACRO(QColor, fillColor)
JKQTPGET_SET_MACRO(Qt::BrushStyle, fillStyle) JKQTPGET_SET_MACRO(Qt::BrushStyle, fillStyle)
/** \brief sets the alpha-channel of the \a color and \a fillColor (i.e. its transparency) to the same value */
virtual void setAlpha(float alpha) override;
/** \brief sets the alpha-channel of the \a color and \a fillColor (i.e. its transparency) */
virtual void setAlpha(float alphaLine, float alphaFill);
/** \brief plots a key marker inside the specified rectangle \a rect */ /** \brief plots a key marker inside the specified rectangle \a rect */
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override; virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override;
protected: protected:
@ -154,6 +162,74 @@ class LIB_EXPORT JKQTPgeoBaseFilled: public JKQTPgeoBaseLine {
/*! \brief This virtual JKQTPgraph descendent may be used to display a single symbol (marker).
\ingroup jkqtplotter_geoplots
*/
class LIB_EXPORT JKQTPgeoSymbol: public JKQTPplotObject {
Q_OBJECT
public:
/*! \brief class contructor
\param parent parent plotter widget
\param x x-coordinate of symbol center
\param y y-coordinate of symbol center
\param symbol symbol type
\param symbolSize size of the symbol in pt
\param color color of drawing
\param fillColor fill color of the symbol (if filled)
*/
JKQTPgeoSymbol(JKQtBasePlotter* parent, double x, double y, JKQTPgraphSymbols symbol=JKQTPcross, double symbolSize=10, QColor color=QColor("black"), QColor fillColor=QColor("grey"));
/*! \brief class contructor
\param parent parent plotter widget
\param x x-coordinate of symbol center
\param y y-coordinate of symbol center
\param symbol symbol type
\param symbolSize size of the symbol in pt
\param color color of drawing
\param fillColor fill color of the symbol (if filled)
*/
JKQTPgeoSymbol(JKQtPlotter* parent, double x, double y, JKQTPgraphSymbols symbol=JKQTPcross, double symbolSize=10, QColor color=QColor("black"), QColor fillColor=QColor("grey"));
JKQTPGET_SET_MACRO(QColor, color)
JKQTPGET_SET_MACRO(QColor, fillColor)
JKQTPGET_SET_MACRO(JKQTPgraphSymbols, symbol)
JKQTPGET_SET_MACRO(double, symbolSize)
JKQTPGET_SET_MACRO(double, symbolWidth)
JKQTPGET_SET_MACRO(double, x)
JKQTPGET_SET_MACRO(double, y)
/** \copydoc JKQTPgraph::getXMinMax() */
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero);
/** \copydoc JKQTPgraph::getYMinMax() */
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero);
/** \brief plots the graph to the plotter object specified as parent */
virtual void draw(JKQTPEnhancedPainter& painter);
/** \brief plots a key marker inside the specified rectangle \a rect */
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect);
/** \brief returns the color to be used for the key label */
virtual QColor getKeyLabelColor();
protected:
double x,y;
/** \brief color of the graph */
QColor color;
/** \brief fill-color of the graph */
QColor fillColor;
/** \brief size of the symbol in pt */
double symbolSize;
/** \brief width of the symbol lines in pt */
double symbolWidth;
/** \brief type of the symbol */
JKQTPgraphSymbols symbol;
};
/*! \brief This JKQTPplotObject is used to display text. It uses the JKQTMathText /*! \brief This JKQTPplotObject 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_geoplots \ingroup jkqtplotter_geoplots
@ -334,33 +410,45 @@ class LIB_EXPORT JKQTPgeoInfiniteLine: public JKQTPgeoBaseLine {
\image html plot_geolines.png \image html plot_geolines.png
*/ */
class LIB_EXPORT JKQTPgeoLines: public JKQTPgeoBaseLine { class LIB_EXPORT JKQTPgeoPolyLines: public JKQTPgeoBaseLine {
Q_OBJECT Q_OBJECT
public: public:
/*! \brief class constructor /*! \brief class constructor
\param parent the parent plotter class \param parent the parent plotter class
\param x1 x-coordinate of first point of line \param points points on the polygon
\param y1 y-coordinate of first point of line
\param x2 x-coordinate of second point of line
\param y2 y-coordinate of second point of line
\param color color of line \param color color of line
\param lineWidth width of line \param lineWidth width of line
\param style line style \param style line style
*/ */
JKQTPgeoLines(JKQtBasePlotter* parent, QVector<QPointF> points, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine); JKQTPgeoPolyLines(JKQtBasePlotter* parent, const QVector<QPointF>& points, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine);
/*! \brief class constructor /*! \brief class constructor
\param parent the parent plotter class \param parent the parent plotter class
\param x1 x-coordinate of first point of line \param points points on the polygon
\param y1 y-coordinate of first point of line
\param x2 x-coordinate of second point of line
\param y2 y-coordinate of second point of line
\param color color of line \param color color of line
\param lineWidth width of line \param lineWidth width of line
\param style line style \param style line style
*/ */
JKQTPgeoLines(JKQtPlotter* parent, QVector<QPointF> points, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine); JKQTPgeoPolyLines(JKQtPlotter* parent, const QVector<QPointF>& points, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine);
/*! \brief class constructor
\param parent the parent plotter class
\param points points on the polygon
\param color color of line
\param lineWidth width of line
\param style line style
*/
JKQTPgeoPolyLines(JKQtBasePlotter* parent, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine);
/*! \brief class constructor
\param parent the parent plotter class
\param points points on the polygon
\param color color of line
\param lineWidth width of line
\param style line style
*/
JKQTPgeoPolyLines(JKQtPlotter* parent, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine);
/** \copydoc JKQTPplotObject::getXMinMax() */ /** \copydoc JKQTPplotObject::getXMinMax() */
@ -422,6 +510,60 @@ class LIB_EXPORT JKQTPgeoRectangle: public JKQTPgeoBaseFilled {
\param fillStyle filling style of rectangle \param fillStyle filling style of rectangle
*/ */
JKQTPgeoRectangle(JKQtPlotter* parent, double x, double y, double width, double height, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine, QColor fillColor=QColor("transparent"), Qt::BrushStyle fillStyle=Qt::SolidPattern); JKQTPgeoRectangle(JKQtPlotter* parent, double x, double y, double width, double height, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine, QColor fillColor=QColor("transparent"), Qt::BrushStyle fillStyle=Qt::SolidPattern);
/*! \brief class constructor
\param parent the parent plotter class
\param x x-coordinate of center of rectangle
\param y y-coordinate of center of rectangle
\param width width of rectangle
\param height of rectangle
\param angle rotation angle of the rectangle
\param color color of line
\param lineWidth width of line
\param style line style
\param fillColor filling color of rectangle
\param fillStyle filling style of rectangle
*/
JKQTPgeoRectangle(JKQtBasePlotter* parent, double x, double y, double width, double height, double angle, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine, QColor fillColor=QColor("transparent"), Qt::BrushStyle fillStyle=Qt::SolidPattern);
/*! \brief class constructor
\param parent the parent plotter class
\param x x-coordinate of center of rectangle
\param y y-coordinate of center of rectangle
\param width width of rectangle
\param height of rectangle
\param angle rotation angle of the rectangle
\param color color of line
\param lineWidth width of line
\param style line style
\param fillColor filling color of rectangle
\param fillStyle filling style of rectangle
*/
JKQTPgeoRectangle(JKQtPlotter* parent, double x, double y, double width, double height, double angle, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine, QColor fillColor=QColor("transparent"), Qt::BrushStyle fillStyle=Qt::SolidPattern);
/*! \brief class constructor
\param parent the parent plotter class
\param bottomleft bottom left corner of rectangle
\param topright top right corner of rectangle
\param color color of line
\param lineWidth width of line
\param style line style
\param fillColor filling color of rectangle
\param fillStyle filling style of rectangle
*/
JKQTPgeoRectangle(JKQtBasePlotter* parent, QPointF bottomleft, QPointF topright, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine, QColor fillColor=QColor("transparent"), Qt::BrushStyle fillStyle=Qt::SolidPattern);
/*! \brief class constructor
\param parent the parent plotter class
\param bottomleft bottom left corner of rectangle
\param topright top right corner of rectangle
\param color color of line
\param lineWidth width of line
\param style line style
\param fillColor filling color of rectangle
\param fillStyle filling style of rectangle
*/
JKQTPgeoRectangle(JKQtPlotter* parent, QPointF bottomleft, QPointF topright, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine, QColor fillColor=QColor("transparent"), Qt::BrushStyle fillStyle=Qt::SolidPattern);
@ -437,13 +579,13 @@ class LIB_EXPORT JKQTPgeoRectangle: public JKQTPgeoBaseFilled {
JKQTPGET_SET_MACRO(double, y) JKQTPGET_SET_MACRO(double, y)
JKQTPGET_SET_MACRO(double, width) JKQTPGET_SET_MACRO(double, width)
JKQTPGET_SET_MACRO(double, height) JKQTPGET_SET_MACRO(double, height)
JKQTPGET_SET_MACRO(double, alpha) JKQTPGET_SET_MACRO(double, angle)
void set_bottomleftrectangle(double x, double y, double width, double height); void set_bottomleftrectangle(double x, double y, double width, double height);
protected: protected:
double x,y,width,height; double x,y,width,height;
/** \brief rotation angle of rectangle */ /** \brief rotation angle of rectangle */
double alpha; double angle;
/** \brief returns the transformation matrix used for this rectangle */ /** \brief returns the transformation matrix used for this rectangle */
QMatrix getMatrix(); QMatrix getMatrix();
/** \brief returns a QPolygonF which represents the rectangle after rotation, but still in the world coordinate system, not in the screen/widget system */ /** \brief returns a QPolygonF which represents the rectangle after rotation, but still in the world coordinate system, not in the screen/widget system */
@ -463,27 +605,48 @@ class LIB_EXPORT JKQTPgeoPolygon: public JKQTPgeoBaseFilled {
/*! \brief class constructor /*! \brief class constructor
\param parent the parent plotter class \param parent the parent plotter class
\param x1 x-coordinate of first point of line \param points points on the polygon
\param y1 y-coordinate of first point of line
\param x2 x-coordinate of second point of line
\param y2 y-coordinate of second point of line
\param color color of line \param color color of line
\param lineWidth width of line \param lineWidth width of line
\param style line style \param style line style
\param fillColor color of the filling
\param fillStyle style of the filling
*/ */
JKQTPgeoPolygon(JKQtBasePlotter* parent, QVector<QPointF> points, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine, QColor fillColor=QColor("transparent"), Qt::BrushStyle fillStyle=Qt::SolidPattern); JKQTPgeoPolygon(JKQtBasePlotter* parent, const QVector<QPointF>& points, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine, QColor fillColor=QColor("transparent"), Qt::BrushStyle fillStyle=Qt::SolidPattern);
/*! \brief class constructor /*! \brief class constructor
\param parent the parent plotter class \param parent the parent plotter class
\param x1 x-coordinate of first point of line \param points points on the polygon
\param y1 y-coordinate of first point of line
\param x2 x-coordinate of second point of line
\param y2 y-coordinate of second point of line
\param color color of line \param color color of line
\param lineWidth width of line \param lineWidth width of line
\param style line style \param style line style
\param fillColor color of the filling
\param fillStyle style of the filling
*/ */
JKQTPgeoPolygon(JKQtPlotter* parent, QVector<QPointF> points, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine, QColor fillColor=QColor("transparent"), Qt::BrushStyle fillStyle=Qt::SolidPattern); JKQTPgeoPolygon(JKQtPlotter* parent, const QVector<QPointF>& points, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine, QColor fillColor=QColor("transparent"), Qt::BrushStyle fillStyle=Qt::SolidPattern);
/*! \brief class constructor
\param parent the parent plotter class
\param color color of line
\param lineWidth width of line
\param style line style
\param fillColor color of the filling
\param fillStyle style of the filling
*/
JKQTPgeoPolygon(JKQtBasePlotter* parent, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine, QColor fillColor=QColor("transparent"), Qt::BrushStyle fillStyle=Qt::SolidPattern);
/*! \brief class constructor
\param parent the parent plotter class
\param color color of line
\param lineWidth width of line
\param style line style
\param fillColor color of the filling
\param fillStyle style of the filling
*/
JKQTPgeoPolygon(JKQtPlotter* parent, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine, QColor fillColor=QColor("transparent"), Qt::BrushStyle fillStyle=Qt::SolidPattern);
/** \copydoc JKQTPplotObject::getXMinMax() */ /** \copydoc JKQTPplotObject::getXMinMax() */
@ -550,6 +713,60 @@ class LIB_EXPORT JKQTPgeoEllipse: public JKQTPgeoRectangle {
\param fillStyle filling style of ellipse \param fillStyle filling style of ellipse
*/ */
JKQTPgeoEllipse(JKQtPlotter* parent, double x, double y, double width, double height, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine, QColor fillColor=QColor("transparent"), Qt::BrushStyle fillStyle=Qt::SolidPattern); JKQTPgeoEllipse(JKQtPlotter* parent, double x, double y, double width, double height, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine, QColor fillColor=QColor("transparent"), Qt::BrushStyle fillStyle=Qt::SolidPattern);
/*! \brief class constructor
\param parent the parent plotter class
\param x x-coordinate of center of rectangle
\param y y-coordinate of center of rectangle
\param width width of rectangle
\param height of rectangle
\param angle rotation angle of the rectangle
\param color color of line
\param lineWidth width of line
\param style line style
\param fillColor filling color of rectangle
\param fillStyle filling style of rectangle
*/
JKQTPgeoEllipse(JKQtBasePlotter* parent, double x, double y, double width, double height, double angle, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine, QColor fillColor=QColor("transparent"), Qt::BrushStyle fillStyle=Qt::SolidPattern);
/*! \brief class constructor
\param parent the parent plotter class
\param x x-coordinate of center of rectangle
\param y y-coordinate of center of rectangle
\param width width of rectangle
\param height of rectangle
\param angle rotation angle of the rectangle
\param color color of line
\param lineWidth width of line
\param style line style
\param fillColor filling color of rectangle
\param fillStyle filling style of rectangle
*/
JKQTPgeoEllipse(JKQtPlotter* parent, double x, double y, double width, double height, double angle, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine, QColor fillColor=QColor("transparent"), Qt::BrushStyle fillStyle=Qt::SolidPattern);
/*! \brief class constructor
\param parent the parent plotter class
\param bottomleft bottom left corner of rectangle
\param topright top right corner of rectangle
\param color color of line
\param lineWidth width of line
\param style line style
\param fillColor filling color of rectangle
\param fillStyle filling style of rectangle
*/
JKQTPgeoEllipse(JKQtBasePlotter* parent, QPointF bottomleft, QPointF topright, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine, QColor fillColor=QColor("transparent"), Qt::BrushStyle fillStyle=Qt::SolidPattern);
/*! \brief class constructor
\param parent the parent plotter class
\param bottomleft bottom left corner of rectangle
\param topright top right corner of rectangle
\param color color of line
\param lineWidth width of line
\param style line style
\param fillColor filling color of rectangle
\param fillStyle filling style of rectangle
*/
JKQTPgeoEllipse(JKQtPlotter* parent, QPointF bottomleft, QPointF topright, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine, QColor fillColor=QColor("transparent"), Qt::BrushStyle fillStyle=Qt::SolidPattern);
/** \brief plots the graph to the plotter object specified as parent */ /** \brief plots the graph to the plotter object specified as parent */
@ -613,11 +830,11 @@ class LIB_EXPORT JKQTPgeoArc: public JKQTPgeoBaseLine {
JKQTPGET_SET_MACRO(double, y) JKQTPGET_SET_MACRO(double, y)
JKQTPGET_SET_MACRO(double, width) JKQTPGET_SET_MACRO(double, width)
JKQTPGET_SET_MACRO(double, height) JKQTPGET_SET_MACRO(double, height)
JKQTPGET_SET_MACRO(double, alpha) JKQTPGET_SET_MACRO(double, angle)
protected: protected:
double x,y,width,height; double x,y,width,height;
/** \brief rotation angle of rectangle */ /** \brief rotation angle of rectangle */
double alpha; double angle;
/** \brief if we only draw an arc, this is the starting angle in degrees */ /** \brief if we only draw an arc, this is the starting angle in degrees */
double angleStart; double angleStart;
/** \brief if we only draw an arc, this is the ending angle in degrees */ /** \brief if we only draw an arc, this is the ending angle in degrees */

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB