auto-create doc-iages from datastore example

This commit is contained in:
jkriege2 2023-08-14 12:37:22 +02:00
parent b1954af38b
commit 474e511073
18 changed files with 43 additions and 5 deletions

7
.gitignore vendored
View File

@ -129,3 +129,10 @@ Sicherungskopie_*
/screenshots/imageplot__smallscalecolor_small.png
/screenshots/imageplot__smallscalelimitcolor_small.png
/screenshots/imageplot__smallscaletransparent_small.png
/screenshots/datastore_calccolumns_small.png
/screenshots/datastore_image_small.png
/screenshots/datastore_image_sorted_small.png
/screenshots/datastore_linkedcarray_small.png
/screenshots/datastore_map_small.png
/screenshots/datastore_sine_small.png
/screenshots/datastore_sineimg_small.png

View File

@ -200,6 +200,7 @@ if(JKQtPlotter_BUILD_EXAMPLES)
second_axis/second_axis,second_axis_hor
logaxes/logaxes,logaxes_nolog,logaxes_nominorgrid/--iteratefunctorsteps
#speed
datastore/datastore,datastore_sine,datastore_linkedcarray,datastore_map,datastore_calccolumns,datastore_image,datastore_image_sorted,datastore_sineimg/--iteratefunctorsteps
)

View File

@ -10,6 +10,7 @@
#include "jkqtplotter/graphs/jkqtpscatter.h"
#include "jkqtplotter/graphs/jkqtpimage.h"
#include <algorithm>
#include <set>
int main(int argc, char* argv[])
{
@ -118,11 +119,12 @@ int main(int argc, char* argv[])
datastore->set(imgColumn, i, cos((x-15.0))/(x-15.0)*cos((y-2.0))/(x-2.0));
}
// alternatively you can access image pixels with setPixel():
//for (int iy=0; iy<10; iy++) {
// for (int ix=0; ix<10; ix++) {
// datastore->setPixel(imgColumn, ix, iy, sin(ix*iy/30.0));
// }
//}
size_t imgColumn2=datastore->addImageColumn(10, 10, "sine image values");
for (int iy=0; iy<10; iy++) {
for (int ix=0; ix<10; ix++) {
datastore->setPixel(imgColumn2, ix, iy, sin(ix*iy/30.0));
}
}
// the loop above can be written more compact using addColumnCalculatedFromColumn():
//imgColumn=datastore->addColumnCalculatedFromColumn(colLinXY.first, colLinXY.second, [](double x, double y)->double { return cos((x-15.0))/(x-15.0)*cos((y-2.0))/(x-2.0); }, "image value");
// finally we can use a JKQTPXYParametrizedScatterGraph to display the data from our three columns
@ -141,6 +143,14 @@ int main(int argc, char* argv[])
imggraph->setHeight(1.5);
imggraph->setTitle(QObject::tr("imgColumn"));
plot.addGraph(imggraph=new JKQTPColumnMathImage(&plot));
imggraph->setImageColumn(imgColumn2);
imggraph->setX(10);
imggraph->setY(3.5);
imggraph->setWidth(10);
imggraph->setHeight(10);
imggraph->setTitle(QObject::tr("imgColumn: simple"));
@ -151,5 +161,25 @@ int main(int argc, char* argv[])
plot.show();
plot.resize(600,400);
auto setVisibleV=[&](const std::set<int>& iVis) {
int i=0;
for (auto g=plot.beginGraphs(); g!=plot.endGraphs(); ++g) {
(*g)->setVisible(iVis.find(i)!=iVis.end());
qDebug()<<i<<": "<<(*g)->isVisible();
i++;
}
};
auto setVisible=[&](int iVis) {
setVisibleV({iVis});
};
app.addExportStepFunctor([&]() { setVisible(0); plot.getPlotter()->setShowKey(false); plot.zoomToFit(); plot.redrawPlot(); plot.resize(400,400*4/6); });
app.addExportStepFunctor([&]() { setVisible(1); plot.getPlotter()->setShowKey(false); plot.zoomToFit(); plot.redrawPlot(); plot.resize(400,400*4/6); });
app.addExportStepFunctor([&]() { setVisible(2); plot.getPlotter()->setShowKey(false); plot.zoomToFit(); plot.redrawPlot(); plot.resize(400,400*4/6); });
app.addExportStepFunctor([&]() { setVisible(3); plot.getPlotter()->setShowKey(false); plot.zoomToFit(); plot.redrawPlot(); plot.resize(400,400*4/6); });
app.addExportStepFunctor([&]() { setVisibleV({4,5}); plot.getPlotter()->setShowKey(false); plot.zoomToFit(); plot.redrawPlot(); plot.resize(400,400*4/6); });
app.addExportStepFunctor([&]() { std::sort(datastore->begin(colLinXY.second), datastore->end(colLinXY.second)); setVisibleV({4,5});plot.getPlotter()->setShowKey(false); plot.zoomToFit(); plot.redrawPlot(); });
app.addExportStepFunctor([&]() { setVisible(6); plot.zoomToFit(); plot.getPlotter()->setShowKey(false); plot.redrawPlot(); plot.resize(400,400); });
return app.exec();
}

BIN
screenshots/datastore.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB