diff --git a/doc/dox/jkqtplotter.dox b/doc/dox/jkqtplotter.dox index 2bf565d748..18e38f9856 100644 --- a/doc/dox/jkqtplotter.dox +++ b/doc/dox/jkqtplotter.dox @@ -211,7 +211,6 @@ This group assembles all classes that represent different elements of a plot (ma There are these major subgroups: - \ref jkqtpbaseplotter_elements contains all non-graph objects, i.e. things like coordinate axes and so on - \ref jkqtplotter_graphsgroup contains the actual graph classes - - \ref jkqtplotter_overlays contains classes for overlay elements (lines, marker ...) that can be drawn quickly on top of a plot . \defgroup jkqtpbaseplotter_elements Basic (non-graph) Plot Elements (coordinate axes, ...) @@ -558,24 +557,6 @@ Examples: JKQTPContourPlot, JKQTPColumnContourPlot -\defgroup jkqtplotter_overlays Overlay Elements -\ingroup jkqtplotter_elements - - - - - - -
Screenshot - Classes -
- JKQTPOverlayVerticalLine, JKQTPOverlayLine -
- JKQTPOverlayVerticalRange -
- JKQTPOverlayRectangle -
- \defgroup jkqtpplotter_styling JKQTPlotter Styling System diff --git a/doc/dox/whatsnew.dox b/doc/dox/whatsnew.dox index eeb0b137b5..d75c7fd76a 100644 --- a/doc/dox/whatsnew.dox +++ b/doc/dox/whatsnew.dox @@ -20,10 +20,11 @@ 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
  • -
  • removed the usage of some deprecated functions and objects (e.g. QMatrix)
  • -
  • improved: geometric objects now use an adaptive drawing algorithm to represent curves (before e.g. ellipses were always separated into a fixed number of line-segments)
  • +
  • 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.
  • +
  • improved/breaking change: geometric objects now use an adaptive drawing algorithm to represent curves (before e.g. ellipses were always separated into a fixed number of line-segments)
  • improved: constructors and access functions for several geometric objects (e.g. more constructors, additional functions to retrieve parameters in diferent forms, iterators for polygons, ...)
  • -
  • improved: reworked class hirarchy of parsed function plots and declared several setters as slots.
  • +
  • improved/breaking change: reworked class hirarchy of parsed function plots and declared several setters as slots.
  • new: added geometric plot objects JKQTPGeoArrow to draw arrows (aka lines with added line-end decorators, also extended JKQTPGeoLine, JKQTPGeoInfiniteLine, JKQTPGeoPolyLines to draw line-end decorator (aka arrows)
  • new: all geometric objects can either be drawn as graphic element (i.e. lines are straight line, even on non-linear axes), or as mathematical curve (i.e. on non-linear axes, lines become the appropriate curve representing the linear function, connecting the given start/end-points). The only exceptions are ellipses (and the derived arcs,pies,chords), which are always drawn as mathematical curves
  • new: a new graph class JKQTPXYFunctionLineGraph draws parametric 2D curves ( \f$ [x,y] = f(t) \f$ ), see \ref JKQTPlotterEvalCurves for an example
  • diff --git a/examples/jkqtplot_test/TestWidgetBarcharts.h b/examples/jkqtplot_test/TestWidgetBarcharts.h index b35d0b6dca..a969949449 100644 --- a/examples/jkqtplot_test/TestWidgetBarcharts.h +++ b/examples/jkqtplot_test/TestWidgetBarcharts.h @@ -13,7 +13,6 @@ #include "jkqtplotter/jkqtplotter.h" #include "jkqtplotter/graphs/jkqtpgeometric.h" #include "jkqtplotter/graphs/jkqtpimage.h" -#include "jkqtplotter/overlays/jkqtpbasicoverlays.h" #include "jkqtplotter/graphs/jkqtpparsedfunction.h" #include "jkqtplotter/jkqtpbaseelements.h" #include "jkqtplotter/gui/jkqtpgraphsmodel.h" diff --git a/examples/jkqtplot_test/TestWidgetContourPlots.h b/examples/jkqtplot_test/TestWidgetContourPlots.h index 834676d1da..6ff642eef1 100644 --- a/examples/jkqtplot_test/TestWidgetContourPlots.h +++ b/examples/jkqtplot_test/TestWidgetContourPlots.h @@ -14,7 +14,6 @@ #include "jkqtplotter/graphs/jkqtpgeometric.h" #include "jkqtplotter/graphs/jkqtpimage.h" #include "jkqtplotter/graphs/jkqtpcontour.h" -#include "jkqtplotter/overlays/jkqtpbasicoverlays.h" #include "jkqtplotter/graphs/jkqtpparsedfunction.h" #include "jkqtplotter/jkqtpbaseelements.h" #include "jkqtplotter/gui/jkqtpgraphsmodel.h" diff --git a/examples/jkqtplot_test/TestWidgetEmptyPlot.cpp b/examples/jkqtplot_test/TestWidgetEmptyPlot.cpp index 2d7fe03e8b..5655187a44 100644 --- a/examples/jkqtplot_test/TestWidgetEmptyPlot.cpp +++ b/examples/jkqtplot_test/TestWidgetEmptyPlot.cpp @@ -3,6 +3,7 @@ #include #include #include +#include "jkqtplotter/graphs/jkqtpscatter.h" diff --git a/examples/jkqtplot_test/TestWidgetEmptyPlot.h b/examples/jkqtplot_test/TestWidgetEmptyPlot.h index ca2229e51e..7d567cf802 100644 --- a/examples/jkqtplot_test/TestWidgetEmptyPlot.h +++ b/examples/jkqtplot_test/TestWidgetEmptyPlot.h @@ -11,12 +11,7 @@ #include #include #include "jkqtplotter/jkqtplotter.h" -#include "jkqtplotter/graphs/jkqtpgeometric.h" -#include "jkqtplotter/graphs/jkqtpimage.h" -#include "jkqtplotter/overlays/jkqtpbasicoverlays.h" -#include "jkqtplotter/graphs/jkqtpparsedfunction.h" #include "jkqtplotter/jkqtpbaseelements.h" -#include "jkqtplotter/gui/jkqtpgraphsmodel.h" #include "jkqtplotter/jkqtptools.h" #define N1 200 diff --git a/examples/jkqtplot_test/TestWidgetFunctionPlots.h b/examples/jkqtplot_test/TestWidgetFunctionPlots.h index fb8cbaec78..2b2fa04c28 100644 --- a/examples/jkqtplot_test/TestWidgetFunctionPlots.h +++ b/examples/jkqtplot_test/TestWidgetFunctionPlots.h @@ -11,9 +11,6 @@ #include #include #include "jkqtplotter/jkqtplotter.h" -#include "jkqtplotter/graphs/jkqtpgeometric.h" -#include "jkqtplotter/graphs/jkqtpimage.h" -#include "jkqtplotter/overlays/jkqtpbasicoverlays.h" #include "jkqtplotter/graphs/jkqtpparsedfunction.h" #include "jkqtplotter/jkqtpbaseelements.h" #include "jkqtplotter/gui/jkqtpgraphsmodel.h" diff --git a/examples/jkqtplot_test/TestWidgetGeometry.h b/examples/jkqtplot_test/TestWidgetGeometry.h index eaafc0c5ea..a5e1752753 100644 --- a/examples/jkqtplot_test/TestWidgetGeometry.h +++ b/examples/jkqtplot_test/TestWidgetGeometry.h @@ -12,9 +12,6 @@ #include #include "jkqtplotter/jkqtplotter.h" #include "jkqtplotter/graphs/jkqtpgeometric.h" -#include "jkqtplotter/graphs/jkqtpimage.h" -#include "jkqtplotter/overlays/jkqtpbasicoverlays.h" -#include "jkqtplotter/graphs/jkqtpparsedfunction.h" #include "jkqtplotter/jkqtpbaseelements.h" #include "jkqtplotter/gui/jkqtpgraphsmodel.h" #include "jkqtplotter/jkqtptools.h" diff --git a/examples/jkqtplot_test/TestWidgetGraphs.cpp b/examples/jkqtplot_test/TestWidgetGraphs.cpp index 44a69be223..039011aa10 100644 --- a/examples/jkqtplot_test/TestWidgetGraphs.cpp +++ b/examples/jkqtplot_test/TestWidgetGraphs.cpp @@ -16,16 +16,11 @@ TestWidgetGraphs::TestWidgetGraphs(QWidget *parent) : QWidget(parent) { - ovlCnt=0; - ovlTime.start(); - plot=new JKQTPlotter(true, this); plot->setPlotUpdateEnabled(false); plotBot=new JKQTPlotter(false, this, plot->getDatastore()); plotBot2=new JKQTPlotter(false, this, plot->getDatastore()); - ovl1=new JKQTPOverlayVerticalLine(0.0, tr("test"), plot->getPlotter()); - plot->getPlotter()->addOverlayElement(ovl1); plot->setObjectName("plot"); plotBot->setObjectName("plotBot"); plotBot2->setObjectName("plotBot2"); @@ -309,33 +304,6 @@ TestWidgetGraphs::TestWidgetGraphs(QWidget *parent) : - - - - - - - - - - - - QTimer::singleShot(50, this, SLOT(moveovl())); - -} - -void TestWidgetGraphs::moveovl() { - ovl1->setPosition(ovl1->getPosition()+0.1); - if (ovl1->getPosition()>30) ovl1->setPosition(0); - ovlCnt++; - if (ovlCnt>20) { - double fps=double(ovlCnt)/(double(ovlTime.elapsed())/1000.0); - ovl1->setText(QString("%1 fps").arg(fps)); - ovlCnt=0; - ovlTime.start(); - } - plot->redrawOverlays(); - QTimer::singleShot(10, this, SLOT(moveovl())); } diff --git a/examples/jkqtplot_test/TestWidgetGraphs.h b/examples/jkqtplot_test/TestWidgetGraphs.h index b4cfff7262..7cd690a4f1 100644 --- a/examples/jkqtplot_test/TestWidgetGraphs.h +++ b/examples/jkqtplot_test/TestWidgetGraphs.h @@ -12,9 +12,6 @@ #include #include "jkqtplotter/jkqtplotter.h" #include "jkqtplotter/graphs/jkqtpgeometric.h" -#include "jkqtplotter/graphs/jkqtpimage.h" -#include "jkqtplotter/overlays/jkqtpbasicoverlays.h" -#include "jkqtplotter/graphs/jkqtpparsedfunction.h" #include "jkqtplotter/jkqtpbaseelements.h" #include "jkqtplotter/gui/jkqtpgraphsmodel.h" #include "jkqtplotter/jkqtptools.h" @@ -34,8 +31,7 @@ class TestWidgetGraphs : public QWidget signals: - public slots: - void moveovl(); + protected slots: void setErrorLineStyle(int index); void setESSymbol(int index); @@ -53,7 +49,6 @@ class TestWidgetGraphs : public QWidget double b1[N3], b2[N3], b3[N3]; - JKQTPOverlayVerticalLine* ovl1; JKQTPlotter* plot; JKQTPlotter* plotLOG; JKQTPlotter* plotBot; @@ -64,8 +59,6 @@ class TestWidgetGraphs : public QWidget JKQTPXYLineErrorGraph* pltePlot2; - int ovlCnt; - QElapsedTimer ovlTime; }; diff --git a/examples/jkqtplot_test/TestWidgetImages.h b/examples/jkqtplot_test/TestWidgetImages.h index 0ad733bc9b..470d111abb 100644 --- a/examples/jkqtplot_test/TestWidgetImages.h +++ b/examples/jkqtplot_test/TestWidgetImages.h @@ -11,12 +11,7 @@ #include #include #include "jkqtplotter/jkqtplotter.h" -#include "jkqtplotter/graphs/jkqtpgeometric.h" #include "jkqtplotter/graphs/jkqtpimage.h" -#include "jkqtplotter/overlays/jkqtpbasicoverlays.h" -#include "jkqtplotter/graphs/jkqtpparsedfunction.h" -#include "jkqtplotter/jkqtpbaseelements.h" -#include "jkqtplotter/gui/jkqtpgraphsmodel.h" #include "jkqtplotter/jkqtptools.h" #define N1 200 diff --git a/examples/jkqtplot_test/TestWidgetLogGraphs.h b/examples/jkqtplot_test/TestWidgetLogGraphs.h index 069fd726a4..8abc92ac0f 100644 --- a/examples/jkqtplot_test/TestWidgetLogGraphs.h +++ b/examples/jkqtplot_test/TestWidgetLogGraphs.h @@ -13,7 +13,6 @@ #include "jkqtplotter/jkqtplotter.h" #include "jkqtplotter/graphs/jkqtpgeometric.h" #include "jkqtplotter/graphs/jkqtpimage.h" -#include "jkqtplotter/overlays/jkqtpbasicoverlays.h" #include "jkqtplotter/graphs/jkqtpparsedfunction.h" #include "jkqtplotter/jkqtpbaseelements.h" #include "jkqtplotter/gui/jkqtpgraphsmodel.h" diff --git a/examples/jkqtplot_test/TestWidgetParamScatterPlots.h b/examples/jkqtplot_test/TestWidgetParamScatterPlots.h index a1eb6c7c24..146b6ec29d 100644 --- a/examples/jkqtplot_test/TestWidgetParamScatterPlots.h +++ b/examples/jkqtplot_test/TestWidgetParamScatterPlots.h @@ -13,7 +13,6 @@ #include "jkqtplotter/jkqtplotter.h" #include "jkqtplotter/graphs/jkqtpgeometric.h" #include "jkqtplotter/graphs/jkqtpimage.h" -#include "jkqtplotter/overlays/jkqtpbasicoverlays.h" #include "jkqtplotter/graphs/jkqtpparsedfunction.h" #include "jkqtplotter/jkqtpbaseelements.h" #include "jkqtplotter/gui/jkqtpgraphsmodel.h" diff --git a/examples/jkqtplot_test/TestWidgetRGBImages.h b/examples/jkqtplot_test/TestWidgetRGBImages.h index 400f192428..d45c5edd6e 100644 --- a/examples/jkqtplot_test/TestWidgetRGBImages.h +++ b/examples/jkqtplot_test/TestWidgetRGBImages.h @@ -14,7 +14,6 @@ #include "jkqtplotter/graphs/jkqtpgeometric.h" #include "jkqtplotter/graphs/jkqtpimage.h" #include "jkqtplotter/graphs/jkqtpimagergb.h" -#include "jkqtplotter/overlays/jkqtpbasicoverlays.h" #include "jkqtplotter/graphs/jkqtpparsedfunction.h" #include "jkqtplotter/jkqtpbaseelements.h" #include "jkqtplotter/gui/jkqtpgraphsmodel.h" diff --git a/lib/jkqtplotter.pri b/lib/jkqtplotter.pri index 40eee0af72..4c25baeb98 100644 --- a/lib/jkqtplotter.pri +++ b/lib/jkqtplotter.pri @@ -24,7 +24,6 @@ isEmpty(JKQTP_PLOTTER_PRI_INCLUDED) { $$PWD/jkqtplotter/jkqtpcoordinateaxes.h \ $$PWD/jkqtplotter/jkqtpcoordinateaxesstyle.h \ $$PWD/jkqtplotter/jkqtpimagetools.h \ - $$PWD/jkqtplotter/jkqtpoverlaysbase.h \ $$PWD/jkqtplotter/graphs/jkqtpboxplot.h \ $$PWD/jkqtplotter/graphs/jkqtpboxplotstylingmixins.h \ $$PWD/jkqtplotter/graphs/jkqtpevaluatedfunctionbase.h \ @@ -51,7 +50,6 @@ isEmpty(JKQTP_PLOTTER_PRI_INCLUDED) { $$PWD/jkqtplotter/graphs/jkqtpspecialline.h \ $$PWD/jkqtplotter/graphs/jkqtpbarchart.h \ $$PWD/jkqtplotter/graphs/jkqtpevaluatedparametriccurve.h \ - $$PWD/jkqtplotter/overlays/jkqtpbasicoverlays.h \ $$PWD/jkqtplotter/gui/jkqtpcomboboxes.h \ $$PWD/jkqtplotter/gui/jkqtpenhancedspinboxes.h \ $$PWD/jkqtplotter/gui/jkqtpenhancedtableview.h \ @@ -75,7 +73,6 @@ isEmpty(JKQTP_PLOTTER_PRI_INCLUDED) { $$PWD/jkqtplotter/jkqtpbaseplotterstyle.cpp \ $$PWD/jkqtplotter/jkqtpcoordinateaxes.cpp \ $$PWD/jkqtplotter/jkqtpcoordinateaxesstyle.cpp \ - $$PWD/jkqtplotter/jkqtpoverlaysbase.cpp \ $$PWD/jkqtplotter/graphs/jkqtpboxplot.cpp \ $$PWD/jkqtplotter/graphs/jkqtpboxplotstylingmixins.cpp \ $$PWD/jkqtplotter/graphs/jkqtpevaluatedfunctionbase.cpp \ @@ -102,7 +99,6 @@ isEmpty(JKQTP_PLOTTER_PRI_INCLUDED) { $$PWD/jkqtplotter/graphs/jkqtpspecialline.cpp \ $$PWD/jkqtplotter/graphs/jkqtpbarchart.cpp \ $$PWD/jkqtplotter/graphs/jkqtpevaluatedparametriccurve.cpp \ - $$PWD/jkqtplotter/overlays/jkqtpbasicoverlays.cpp \ $$PWD/jkqtplotter/gui/jkqtpcomboboxes.cpp \ $$PWD/jkqtplotter/gui/jkqtpenhancedspinboxes.cpp \ $$PWD/jkqtplotter/gui/jkqtpenhancedtableview.cpp \ diff --git a/lib/jkqtplotter/CMakeLists.txt b/lib/jkqtplotter/CMakeLists.txt index e6d452e761..91b8ce34eb 100644 --- a/lib/jkqtplotter/CMakeLists.txt +++ b/lib/jkqtplotter/CMakeLists.txt @@ -25,7 +25,6 @@ set(SOURCES jkqtpbaseelements.cpp jkqtpbaseplotter.cpp jkqtpdatastorage.cpp - jkqtpoverlaysbase.cpp jkqtpgraphsbase.cpp jkqtpgraphsbaseerrors.cpp jkqtpgraphsbasestylingmixins.cpp @@ -65,9 +64,6 @@ set(SOURCES_GRAPHS graphs/jkqtpstatisticsadaptors.cpp graphs/jkqtpevaluatedparametriccurve.cpp ) -set(SOURCES_OVERLAYS - overlays/jkqtpbasicoverlays.cpp -) set(SOURCES_GUI gui/jkqtpcomboboxes.cpp gui/jkqtpenhancedspinboxes.cpp @@ -82,7 +78,6 @@ set(HEADERS jkqtpbaseelements.h jkqtpbaseplotter.h jkqtpdatastorage.h - jkqtpoverlaysbase.h jkqtpgraphsbase.h jkqtpgraphsbaseerrors.h jkqtpgraphsbasestylingmixins.h @@ -123,9 +118,6 @@ set(HEADERS_GRAPHS graphs/jkqtpbarchart.h graphs/jkqtpevaluatedparametriccurve.h ) -set(HEADERS_OVERLAY - overlays/jkqtpbasicoverlays.h -) set(HEADERS_GUI gui/jkqtpcomboboxes.h gui/jkqtpenhancedspinboxes.h @@ -143,7 +135,7 @@ include(CMakePackageConfigHelpers) if(JKQtPlotter_BUILD_SHARED_LIBS) - add_library(${libsh_name} SHARED ${SOURCES} ${SOURCES_GRAPHS} ${SOURCES_GUI} ${SOURCES_OVERLAYS} ${HEADERS} ${HEADERS_GRAPHS} ${HEADERS_GUI} ${HEADERS_OVERLAYS} ${RESOURCES}) + add_library(${libsh_name} SHARED ${SOURCES} ${SOURCES_GRAPHS} ${SOURCES_GUI} ${HEADERS} ${HEADERS_GRAPHS} ${HEADERS_GUI} ${RESOURCES}) set_property(TARGET ${libsh_name} PROPERTY VERSION "${PROJECT_VERSION}") set_property(TARGET ${libsh_name} PROPERTY OUTPUT_NAME "${libsh_name_decorated}") target_link_libraries(${libsh_name} PUBLIC Qt5::Core Qt5::Gui Qt5::Widgets Qt5::PrintSupport Qt5::Svg Qt5::Xml JKQTCommonSharedLib JKQTMathTextSharedLib) @@ -171,7 +163,7 @@ if(JKQtPlotter_BUILD_SHARED_LIBS) endif() if(JKQtPlotter_BUILD_STATIC_LIBS) - add_library(${lib_name} STATIC ${SOURCES} ${SOURCES_GRAPHS} ${SOURCES_GUI} ${SOURCES_OVERLAYS} ${HEADERS} ${HEADERS_GRAPHS} ${HEADERS_GUI} ${HEADERS_OVERLAYS} ${RESOURCES}) + add_library(${lib_name} STATIC ${SOURCES} ${SOURCES_GRAPHS} ${SOURCES_GUI} ${HEADERS} ${HEADERS_GRAPHS} ${HEADERS_GUI} ${RESOURCES}) set_property(TARGET ${lib_name} PROPERTY VERSION "${PROJECT_VERSION}") set_property(TARGET ${lib_name} PROPERTY OUTPUT_NAME "${lib_name_decorated}") set_property(TARGET ${lib_name} PROPERTY CXX_STANDARD 11) @@ -252,10 +244,6 @@ install(FILES ${HEADERS_GUI} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${libIncludeSubdir}/gui COMPONENT Headers) -install(FILES ${HEADERS_OVERLAY} - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${libIncludeSubdir}/overlays - COMPONENT Headers) - configure_file(${CMAKE_SOURCE_DIR}/readme.txt.in ${CMAKE_CURRENT_BINARY_DIR}/${lib_name}_Readme.txt @ONLY) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${lib_name}_Readme.txt" DESTINATION doc/JKQtPlotter ) install(FILES "${CMAKE_SOURCE_DIR}/LICENSE" DESTINATION doc/JKQtPlotter RENAME "${lib_name}_LICENSE.txt" ) diff --git a/lib/jkqtplotter/jkqtpbaseplotter.cpp b/lib/jkqtplotter/jkqtpbaseplotter.cpp index 2845e310b2..35d7196eaf 100644 --- a/lib/jkqtplotter/jkqtpbaseplotter.cpp +++ b/lib/jkqtplotter/jkqtpbaseplotter.cpp @@ -1205,7 +1205,7 @@ void JKQTBasePlotter::drawKey(JKQTPEnhancedPainter& painter) { -void JKQTBasePlotter::drawPlot(JKQTPEnhancedPainter& painter, bool showOverlays) { +void JKQTBasePlotter::drawPlot(JKQTPEnhancedPainter& painter) { #ifdef JKQTBP_AUTOTIMER JKQTPAutoOutputTimer jkaaot("JKQTBasePlotter::paintPlot"); #endif @@ -1283,7 +1283,6 @@ void JKQTBasePlotter::drawPlot(JKQTPEnhancedPainter& painter, bool showOverlays) painter.setRenderHint(JKQTPEnhancedPainter::TextAntialiasing, plotterStyle.useAntiAliasingForText); if (plotterStyle.keyStyle.visible) drawKey(painter); painter.setRenderHint(JKQTPEnhancedPainter::TextAntialiasing, plotterStyle.useAntiAliasingForText); - if (showOverlays) drawOverlaysWithHints(painter); if (plotterStyle.debugShowRegionBoxes) { painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();}); @@ -1312,31 +1311,6 @@ void JKQTBasePlotter::drawPlot(JKQTPEnhancedPainter& painter, bool showOverlays) //qDebug()<<" end JKQTBasePlotter::paintPlot"; } -void JKQTBasePlotter::drawOverlaysWithHints(JKQTPEnhancedPainter &painter) { - painter.setRenderHint(JKQTPEnhancedPainter::NonCosmeticDefaultPen, true); - painter.setRenderHint(JKQTPEnhancedPainter::Antialiasing, plotterStyle.useAntiAliasingForGraphs); - painter.setRenderHint(JKQTPEnhancedPainter::TextAntialiasing, plotterStyle.useAntiAliasingForText); - painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();}); -#ifdef JKQTBP_AUTOTIMER - JKQTPAutoOutputTimer jkaaot("JKQTBasePlotter::drawOverlaysWithHints"); -#endif - if (overlays.isEmpty()) return; - if (useClipping) { - QRegion cregion(static_cast(internalPlotBorderLeft), static_cast(internalPlotBorderTop), static_cast(internalPlotWidth), static_cast(internalPlotHeight)); - painter.setClipping(true); - painter.setClipRegion(cregion); - } - - for (int j=0; jisVisible()) g->draw(painter); - } - - if (useClipping) { - painter.setClipping(false); - } - -} void JKQTBasePlotter::gridPrintingCalc() { gridPrintingRows.clear(); @@ -1380,7 +1354,7 @@ void JKQTBasePlotter::gridPrintingCalc() { } } -void JKQTBasePlotter::gridPaint(JKQTPEnhancedPainter& painter, QSizeF pageRect, bool showOverlays, bool scaleIfTooLarge, bool scaleIfTooSmall) { +void JKQTBasePlotter::gridPaint(JKQTPEnhancedPainter& painter, QSizeF pageRect, bool scaleIfTooLarge, bool scaleIfTooSmall) { #ifdef JKQTBP_AUTOTIMER JKQTPAutoOutputTimer jkaaot("JKQTBasePlotter::gridPaint"); #endif @@ -1399,7 +1373,7 @@ void JKQTBasePlotter::gridPaint(JKQTPEnhancedPainter& painter, QSizeF pageRect, painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();}); // scale the plot so it fits on the page painter.scale(scale, scale); - drawPlot(painter, showOverlays); + drawPlot(painter); } else { @@ -1440,7 +1414,7 @@ void JKQTBasePlotter::gridPaint(JKQTPEnhancedPainter& painter, QSizeF pageRect, for (size_t i=0; i(gridPrintingRows[static_cast(i)]); } //std::cout<<"printing this @ "<(gridPrintingRows[static_cast(j)]); } //std::cout<<"printing "<drawPlot(painter, showOverlays); + gridPrintingList[i].plotter->drawPlot(painter); } @@ -1475,64 +1449,6 @@ void JKQTBasePlotter::gridPaint(JKQTPEnhancedPainter& painter, QSizeF pageRect, } -void JKQTBasePlotter::gridPaintOverlays(JKQTPEnhancedPainter &painter, QSizeF pageRect) -{ - if (!gridPrinting) { - double scale=static_cast(pageRect.width())/static_cast(widgetWidth)*paintMagnification; - if (/*(scale*static_cast(widgetWidth)/paintMagnification>static_cast(pageRect.width())) ||*/ (scale*static_cast(widgetHeight)>static_cast(pageRect.height()))) { - scale=static_cast(pageRect.height())/static_cast(widgetHeight); - } - painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();}); - // scale the plot so it fits on the page - painter.scale(scale, scale); - drawOverlaysWithHints(painter); - - } else { - gridPrintingCalc(); // ensure the grid plot has been calculated - // scale the plot so it fits on the page - double scale=static_cast(pageRect.width())/static_cast(gridPrintingSize.width()); - if (/*(scale*static_cast(gridPrintingSize.width())>static_cast(pageRect.width())) ||*/ (scale*static_cast(gridPrintingSize.height())>static_cast(pageRect.height()))) { - scale=static_cast(pageRect.height())/static_cast(gridPrintingSize.height()); - } - painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();}); - painter.scale(scale, scale); - - { - // plot this plotter - painter.save(); auto __finalpaintinner=JKQTPFinally([&painter]() {painter.restore();}); - size_t t_x=0; - size_t t_y=0; - //std::cout<<"printing this ...\n"; - for (size_t i=0; i(i)]; } - for (size_t i=0; i(i)]; } - //std::cout<<"printing this @ "<(gridPrintingColumns[static_cast(j)]); } - for (size_t j=0; j(gridPrintingRows[static_cast(j)]); } - //std::cout<<"printing "<drawOverlaysWithHints(painter); - - } - - } - - - } -} - void JKQTBasePlotter::print(QPrinter* printer, bool displayPreview) { loadUserSettings(); @@ -2041,7 +1957,7 @@ void JKQTBasePlotter::printpreviewPaintRequested(QPrinter* printer) { qDebug()<<"x-axis label fontsize = "<getLabelFontSize()<<" pt"; qDebug()<<"y-axis label fontsize = "<getLabelFontSize()<<" pt"; #endif - gridPaint(painter, printer->pageRect().size(), true, printScaleToPagesize, printScaleToPagesize); + gridPaint(painter, printer->pageRect().size(), printScaleToPagesize, printScaleToPagesize); painter.end(); widgetWidth=oldWidgetWidth; widgetHeight=oldWidgetHeight; @@ -2141,9 +2057,9 @@ void JKQTBasePlotter::printpreviewPaintRequestedNew(QPaintDevice *paintDevice) qDebug()<<"x-axis label fontsize = "<getLabelFontSize()<<" pt"; qDebug()<<"y-axis label fontsize = "<getLabelFontSize()<<" pt"; #endif - if (printer) gridPaint(painter, printer->pageRect().size(), true, printScaleToPagesize, printScaleToPagesize); - else if (svg) gridPaint(painter, svg->size(), true, printScaleToPagesize, printScaleToPagesize); - else gridPaint(painter, QSizeF(paintDevice->width(), paintDevice->height()), true, printScaleToPagesize, printScaleToPagesize); + if (printer) gridPaint(painter, printer->pageRect().size(), printScaleToPagesize, printScaleToPagesize); + else if (svg) gridPaint(painter, svg->size(), printScaleToPagesize, printScaleToPagesize); + else gridPaint(painter, QSizeF(paintDevice->width(), paintDevice->height()), printScaleToPagesize, printScaleToPagesize); painter.end(); widgetWidth=oldWidgetWidth; widgetHeight=oldWidgetHeight; @@ -2289,9 +2205,9 @@ void JKQTBasePlotter::printpreviewUpdate() } } -void JKQTBasePlotter::draw(JKQTPEnhancedPainter& painter, const QRect& rect, bool showOverlays) { +void JKQTBasePlotter::draw(JKQTPEnhancedPainter& painter, const QRect& rect) { #ifdef JKQTBP_AUTOTIMER - JKQTPAutoOutputTimer jkaaot(QString("JKQTBasePlotter::draw(rect, %1)").arg(showOverlays)); + JKQTPAutoOutputTimer jkaaot(QString("JKQTBasePlotter::draw(rect, %1)")); #endif bool oldEmitPlotSignals=emitPlotSignals; emitPlotSignals=false; @@ -2310,7 +2226,7 @@ void JKQTBasePlotter::draw(JKQTPEnhancedPainter& painter, const QRect& rect, boo QElapsedTimer time; time.start(); #endif - gridPaint(painter, rect.size(), showOverlays); + gridPaint(painter, rect.size()); #ifdef JKQTBP_DEBUGTIMING qDebug()<(rect.width())/static_cast(widgetWidth)*paintMagnification; - if ((scale*static_cast(widgetWidth)/paintMagnification>static_cast(rect.width())) || (scale*static_cast(widgetHeight)/paintMagnification>static_cast(rect.height()))) { - scale=static_cast(rect.height())/static_cast(widgetHeight)*paintMagnification; - } - { - painter.save(); auto __finalpaintinner=JKQTPFinally([&painter]() {painter.restore();}); - // scale the plot so it fits on the page - painter.scale(scale, scale); - drawOverlaysWithHints(painter); - } - - -} - void JKQTBasePlotter::setEmittingPlotSignalsEnabled(bool __value) { this->emitPlotSignals = __value; @@ -4719,84 +4603,6 @@ void JKQTBasePlotter::zoomToFit(bool zoomX, bool zoomY, bool includeX0, bool inc -JKQTPOverlayElement *JKQTBasePlotter::getOverlayElement(size_t i) { - return overlays[static_cast(i)]; -} - -size_t JKQTBasePlotter::getOverlayElementCount() { - return static_cast(overlays.size()); -} - -void JKQTBasePlotter::deleteOverlayElement(size_t i, bool deletegraph) { - if (long(i)<0 || long(i)>=overlays.size()) return; - JKQTPOverlayElement* g=overlays[static_cast(i)]; - overlays.removeAt(static_cast(i)); - if (deletegraph && g) delete g; - if (emitPlotSignals) emit overlaysUpdated(); -} - -void JKQTBasePlotter::deleteOverlayElement(JKQTPOverlayElement *gr, bool deletegraph) { - int i=overlays.indexOf(gr); - while (i>=0) { - overlays.removeAt(i); - i=overlays.indexOf(gr); - } - - if (deletegraph && gr) delete gr; - if (emitPlotSignals) emit overlaysUpdated(); -} - -void JKQTBasePlotter::clearOverlayElement(bool deleteGraphs) { - for (int i=0; isetParent(this); - for (size_t i=0; i(overlays.size()); i++) { - if (overlays[static_cast(i)]==gr) return i; - } - overlays.push_back(gr); - if (emitPlotSignals) emit overlaysUpdated(); - return static_cast(overlays.size()-1); -} - -bool JKQTBasePlotter::containsOverlayElement(JKQTPOverlayElement *gr) const { - for (int i=0; isetParent(this); - for (int i=0; i(overlays.size()-1); - } - } - overlays.push_back(gr); - if (emitPlotSignals) emit overlaysUpdated(); - return static_cast(overlays.size()-1); -} - -void JKQTBasePlotter::addOverlayElements(const QList &gr) { - for (int i=0; i< gr.size(); i++) { - addOverlayElement(gr[i]); - } -} - - diff --git a/lib/jkqtplotter/jkqtpbaseplotter.h b/lib/jkqtplotter/jkqtpbaseplotter.h index 87b6d01cb2..e0f28789c4 100644 --- a/lib/jkqtplotter/jkqtpbaseplotter.h +++ b/lib/jkqtplotter/jkqtpbaseplotter.h @@ -22,7 +22,6 @@ #include "jkqtplotter/jkqtpbaseplotterstyle.h" #include "jkqtmathtext/jkqtmathtext.h" #include "jkqtplotter/jkqtpbaseelements.h" -#include "jkqtplotter/overlays/jkqtpbasicoverlays.h" #include "jkqtcommon/jkqtpenhancedpainter.h" #include "jkqtplotter/gui/jkqtpenhancedspinboxes.h" @@ -98,7 +97,6 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPPaintDeviceAdapter { * -# coordinate transforms * -# a set of properties for the graphs (colors, widthes ...) and also a system (see getNextStyle() to automatically * choose a drawing style for different graphs. - * -# plot a set of overlay elements (may be used for fast plotting of indicators onto a complex plot) * -# drawing the coordinate axes, grids ... (logarithmic and linear) * -# saveing and printing the resulting plots * . @@ -620,48 +618,33 @@ class JKQTPLOTTER_LIB_EXPORT JKQTBasePlotter: public QObject { /*! \brief draw the contained graph (including grid prints) into the given JKQTPEnhancedPainter \param painter JKQTPEnhancedPainter to which the plot should be drawn \param rect rectangle to plot into - \param showOverlays decides whether to draw overlays */ - void draw(JKQTPEnhancedPainter& painter, const QRect& rect, bool showOverlays=true); + void draw(JKQTPEnhancedPainter& painter, const QRect& rect); + + /*! \brief draw the contained graph (including grid prints) into the given JKQTPEnhancedPainter + \param painter JKQTPEnhancedPainter to which the plot should be drawn + \param pos where to plot the painter (left-top corner) + */ + void draw(JKQTPEnhancedPainter& painter, const QPoint& pos=QPoint(0,0)); /*! \brief draw the contained graph (including grid prints) into the given JKQTPEnhancedPainter \param painter JKQTPEnhancedPainter to which the plot should be drawn \param rect rectangle to plot into */ - void drawOverlays(JKQTPEnhancedPainter& painter, const QRect& rect); + void drawNonGrid(JKQTPEnhancedPainter& painter, const QRect& rect); /*! \brief draw the contained graph (including grid prints) into the given JKQTPEnhancedPainter \param painter JKQTPEnhancedPainter to which the plot should be drawn \param pos where to plot the painter (left-top corner) - \param showOverlays decides whether to draw overlays */ - void draw(JKQTPEnhancedPainter& painter, const QPoint& pos=QPoint(0,0), bool showOverlays=true); - - /*! \brief draw the contained graph (including grid prints) into the given JKQTPEnhancedPainter - \param painter JKQTPEnhancedPainter to which the plot should be drawn - \param rect rectangle to plot into - \param showOverlays decides whether to draw overlays - */ - void drawNonGrid(JKQTPEnhancedPainter& painter, const QRect& rect, bool showOverlays=true); - - /*! \brief draw the contained graph (including grid prints) into the given JKQTPEnhancedPainter - \param painter JKQTPEnhancedPainter to which the plot should be drawn - \param pos where to plot the painter (left-top corner) - \param showOverlays decides whether to draw overlays - */ - void drawNonGrid(JKQTPEnhancedPainter& painter, const QPoint& pos=QPoint(0,0), bool showOverlays=true); - /*! \brief draw the contained graph overlays (including grid prints) into the given JKQTPEnhancedPainter - \param painter JKQTPEnhancedPainter to which the plot should be drawn - \param pos where to plot the painter (left-top corner) - */ - void drawNonGridOverlays(JKQTPEnhancedPainter &painter, const QPoint& pos=QPoint(0,0)); + void drawNonGrid(JKQTPEnhancedPainter& painter, const QPoint& pos=QPoint(0,0)); /** \brief emit plotUpdated() */ void redrawPlot() { if (emitPlotSignals) emit plotUpdated(); } - /** \brief controls, whether the signals plotUpdated() and overlaysUpdated() are emitted */ + /** \brief controls, whether the signals plotUpdated() are emitted */ void setEmittingPlotSignalsEnabled(bool __value); - /** \brief returns, whether the signals plotUpdated() and overlaysUpdated() are emitted */ + /** \brief returns, whether the signals plotUpdated() are emitted */ bool isEmittingPlotSignalsEnabled() const; /** \copydoc JKQTBasePlotterStyle::plotBorderTop */ @@ -1021,35 +1004,6 @@ class JKQTPLOTTER_LIB_EXPORT JKQTBasePlotter: public QObject { - /** \brief returns description of i'th overlay element */ - JKQTPOverlayElement* getOverlayElement(size_t i); - - /** \brief returns the number of overlay elements */ - size_t getOverlayElementCount(); - - /** \brief remove the i-th overlay element */ - void deleteOverlayElement(size_t i, bool deletegraph=true); - - /** \brief remove the given overlay element, if it is contained */ - void deleteOverlayElement(JKQTPOverlayElement* gr, bool deletegraph=true); - - /** \brief remove all overlay elements - * - * \param deleteGraphs if set \c true (default) the overlay element objects will also be deleted - */ - void clearOverlayElement(bool deleteGraphs=true); - - /** \brief add a new overlay element, returns it's position in the overlay elements list, if the overlay element is already in the plot, this returns the index in the list */ - size_t addOverlayElement(JKQTPOverlayElement* gr); - - /** \brief returns \c true, if the given overlay element is in this plot */ - bool containsOverlayElement(JKQTPOverlayElement* gr) const; - - /** \brief move the given overlay element to the top, or add it, if it is not yet contained */ - size_t moveOverlayElementTop(JKQTPOverlayElement* gr); - - /** \brief add a new overlay elements from a QList */ - void addOverlayElements(const QList& gr); /** \brief save the current plot data as a Comma Separated Values (CSV) file * @@ -1129,9 +1083,6 @@ class JKQTPLOTTER_LIB_EXPORT JKQTBasePlotter: public QObject { /** \brief emitted when the plot has to be updated */ void plotUpdated(); - /** \brief emitted when the overlay elements have to be updated */ - void overlaysUpdated(); - /** \brief emitted when the plot scaling had to be recalculated */ void plotScalingRecalculated(); @@ -1631,9 +1582,8 @@ class JKQTPLOTTER_LIB_EXPORT JKQTBasePlotter: public QObject { /** \brief paints the plot onto the given JKQTPEnhancedPainter object * * \param painter JKQTPEnhancedPainter to draw on - * \param showOverlays decides whether to draw overlays */ - void drawPlot(JKQTPEnhancedPainter& painter, bool showOverlays=true); + void drawPlot(JKQTPEnhancedPainter& painter); /** \brief simply calls paintPlot() if grid printing mode is deactivated and prints the graph grid otherwise * \a pageRect is used to determine the size of the page to draw on. If this does not coincide with * the widget extents this function calculates a scaling factor so the graphs fit onto the page. This @@ -1641,12 +1591,10 @@ class JKQTPLOTTER_LIB_EXPORT JKQTBasePlotter: public QObject { * * \param painter JKQTPEnhancedPainter to draw on * \param pageRect size of the page - * \param showOverlays decides whether to draw overlays * \param scaleIfTooLarge scale image if it is too large for pageRect * \param scaleIfTooSmall scale image if it is smaller than pageRect */ - void gridPaint(JKQTPEnhancedPainter& painter, QSizeF pageRect, bool showOverlays=true, bool scaleIfTooLarge=true, bool scaleIfTooSmall=true); - void gridPaintOverlays(JKQTPEnhancedPainter& painter, QSizeF pageRect); + void gridPaint(JKQTPEnhancedPainter& painter, QSizeF pageRect, bool scaleIfTooLarge=true, bool scaleIfTooSmall=true); /** \brief This method goes through all registered plotters and calculates the width of every column and * height of every row as the max over the row/column. The reults are stored in the private datamembers @@ -1664,8 +1612,6 @@ class JKQTPLOTTER_LIB_EXPORT JKQTBasePlotter: public QObject { void drawGraphs(JKQTPEnhancedPainter& painter); /** \brief plot a key */ void drawKey(JKQTPEnhancedPainter& painter); - /** \brief plot all overlay elements, also sets the render hints in \a painter */ - void drawOverlaysWithHints(JKQTPEnhancedPainter& painter); /** \brief plot the key contents * @@ -2064,10 +2010,6 @@ class JKQTPLOTTER_LIB_EXPORT JKQTBasePlotter: public QObject { QList graphs; - QList overlays; - - - /** \brief indicates whether to use clipping (hack for printing, see print() ) */ @@ -2125,7 +2067,7 @@ class JKQTPLOTTER_LIB_EXPORT JKQTBasePlotter: public QObject { bool masterSynchronizeHeight; - /** \brief controls, whether the signals plotUpdated() and overlaysUpdated() are emitted */ + /** \brief controls, whether the signals plotUpdated() are emitted */ bool emitPlotSignals; diff --git a/lib/jkqtplotter/jkqtplotter.cpp b/lib/jkqtplotter/jkqtplotter.cpp index 23581372af..71a4e04447 100644 --- a/lib/jkqtplotter/jkqtplotter.cpp +++ b/lib/jkqtplotter/jkqtplotter.cpp @@ -51,7 +51,7 @@ JKQTPlotter::JKQTPlotter(bool datastore_internal, QWidget* parent, JKQTPDatastor mouseDragRectYEndPixel(0), mouseDragRectXEnd(0), mouseDragRectYStart(0), mouseDragRectYStartPixel(0), mouseDragRectYEnd(0), mouseDragMarkers(), - image(), imageNoOverlays(), oldImage(), + image(), oldImage(), menuSpecialContextMenu(nullptr),toolbar(nullptr), masterPlotterX(nullptr), masterPlotterY(nullptr), mousePosX(0), mousePosY(0), magnification(1), @@ -75,13 +75,11 @@ JKQTPlotter::JKQTPlotter(bool datastore_internal, QWidget* parent, JKQTPDatastor connect(plotter, SIGNAL(plotUpdated()), this, SLOT(redrawPlot())); - connect(plotter, SIGNAL(overlaysUpdated()), this, SLOT(redrawOverlays())); connect(plotter, SIGNAL(beforePlotScalingRecalculate()), this, SLOT(intBeforePlotScalingRecalculate())); connect(plotter, SIGNAL(zoomChangedLocally(double, double, double, double, JKQTBasePlotter*)), this, SLOT(pzoomChangedLocally(double, double, double, double, JKQTBasePlotter*))); image=QImage(width(), height(), QImage::Format_ARGB32); oldImage=image; - imageNoOverlays=image; // enable mouse-tracking, so mouseMoved-Events can be caught setMouseTracking(true); @@ -149,7 +147,6 @@ JKQTPlotter::JKQTPlotter(QWidget *parent): JKQTPlotter::~JKQTPlotter() { resetContextMenu(false); disconnect(plotter, SIGNAL(plotUpdated()), this, SLOT(redrawPlot())); - disconnect(plotter, SIGNAL(overlaysUpdated()), this, SLOT(redrawOverlays())); disconnect(plotter, SIGNAL(beforePlotScalingRecalculate()), this, SLOT(intBeforePlotScalingRecalculate())); disconnect(plotter, SIGNAL(zoomChangedLocally(double, double, double, double, JKQTBasePlotter*)), this, SLOT(pzoomChangedLocally(double, double, double, double, JKQTBasePlotter*))); delete plotter; @@ -1123,24 +1120,6 @@ void JKQTPlotter::synchronizeXYAxis(double newxmin, double newxmax, double newym setXY(newxmin, newxmax, newymin, newymax); } -void JKQTPlotter::redrawOverlays() { -#ifdef JKQTBP_AUTOTIMER - JKQTPAutoOutputTimer jkaaot(QString("JKQTPlotter::redrawOverlays()")); -#endif - if (!doDrawing) return; - disconnect(plotter, SIGNAL(plotUpdated()), this, SLOT(redrawPlot())); - disconnect(plotter, SIGNAL(overlaysUpdated()), this, SLOT(redrawOverlays())); - image=imageNoOverlays; - JKQTPEnhancedPainter painter(&image); - if (painter.isActive()) { - painter.scale(magnification, magnification); - plotter->drawNonGridOverlays(painter); - } - oldImage=image; - connect(plotter, SIGNAL(plotUpdated()), this, SLOT(redrawPlot())); - connect(plotter, SIGNAL(overlaysUpdated()), this, SLOT(redrawOverlays())); - repaint(); -} void JKQTPlotter::redrawPlot() { @@ -1149,21 +1128,17 @@ void JKQTPlotter::redrawPlot() { #endif if (!doDrawing) return; disconnect(plotter, SIGNAL(plotUpdated()), this, SLOT(redrawPlot())); - disconnect(plotter, SIGNAL(overlaysUpdated()), this, SLOT(redrawOverlays())); plotter->setWidgetSize(jkqtp_roundTo(width()/magnification), jkqtp_roundTo(height()/magnification-getPlotYOffset())); JKQTPEnhancedPainter painter(&image); if (painter.isActive()) { painter.scale(magnification, magnification); //QTime t; //t.start(); - plotter->drawNonGrid(painter, QPoint(0,0), false);//, QRect(QPoint(0,0), QSize(plotter->getPlotWidth(), plotter->getPlotHeight()))); + plotter->drawNonGrid(painter, QPoint(0,0));//, QRect(QPoint(0,0), QSize(plotter->getPlotWidth(), plotter->getPlotHeight()))); //qDebug()<<"drawNonGrid"<drawNonGridOverlays(painter); } oldImage=image; connect(plotter, SIGNAL(plotUpdated()), this, SLOT(redrawPlot())); - connect(plotter, SIGNAL(overlaysUpdated()), this, SLOT(redrawOverlays())); update(); } diff --git a/lib/jkqtplotter/jkqtplotter.h b/lib/jkqtplotter/jkqtplotter.h index 54ca185b8e..a10c498802 100644 --- a/lib/jkqtplotter/jkqtplotter.h +++ b/lib/jkqtplotter/jkqtplotter.h @@ -1034,14 +1034,6 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPlotter: public QWidget { /** \brief update the plot and the overlays */ void redrawPlot(); - /** \brief replot overlays only (use redrawPlot() to replot the plot and the overlays) - * - * You can use this function, if you only changed the overlays but not the graphs in this plotter. - * Then only the overlas are redrawn and the old (saved) image of the graphs and the coordinate syste, - * is used as a base. This is significantly faster than redrawing the whole plot. - */ - void redrawOverlays(); - /** \brief allows to activate/deactivate toolbar buttons that can activate certain mouse drag actions * * \see getActMouseLeftAsDefault(), getActMouseLeftAsRuler(), getActMouseLeftAsToolTip() @@ -1498,9 +1490,6 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPlotter: public QWidget { /** \brief this stores the currently displayed plot */ QImage image; - /** \brief this stores the currently displayed plot */ - QImage imageNoOverlays; - /** \brief this can be used when drawing a zoom rectangle to store an unchanged * copy of the currently displayed image. */ diff --git a/lib/jkqtplotter/jkqtpoverlaysbase.cpp b/lib/jkqtplotter/jkqtpoverlaysbase.cpp deleted file mode 100644 index 160986b58c..0000000000 --- a/lib/jkqtplotter/jkqtpoverlaysbase.cpp +++ /dev/null @@ -1,176 +0,0 @@ -/* - Copyright (c) 2008-2020 Jan W. Krieger () - - - - This software is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License (LGPL) as published by - the Free Software Foundation, either version 2.1 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License (LGPL) for more details. - - You should have received a copy of the GNU Lesser General Public License (LGPL) - along with this program. If not, see . -*/ - - - -#include "jkqtplotter/jkqtpoverlaysbase.h" -#include "jkqtplotter/jkqtpbaseplotter.h" -#include "jkqtplotter/jkqtptools.h" -#include "jkqtcommon/jkqtpdrawingtools.h" -#include -#include - - - -JKQTPOverlayElement::JKQTPOverlayElement(JKQTBasePlotter *parent) : - QObject(parent) -{ - visible=true; -} - -void JKQTPOverlayElement::setParent(JKQTBasePlotter *parent) { - this->parent=parent; - QObject::setParent(parent); -} - -void JKQTPOverlayElement::setVisible(bool __value) -{ - this->visible = __value; -} - -bool JKQTPOverlayElement::isVisible() const -{ - return this->visible; -} - -QPointF JKQTPOverlayElement::transform(const QPointF &x) { - return QPointF(parent->x2p(x.x()), parent->y2p(x.y())); -} - -double JKQTPOverlayElement::transfromX(double x) -{ - return parent->x2p(x); -} - -double JKQTPOverlayElement::transfromY(double y) -{ - return parent->y2p(y); -} - -QPointF JKQTPOverlayElement::backTransform(const QPointF &x) { - return QPointF(parent->p2x(x.x()), parent->p2y(x.y())); -} - -QVector JKQTPOverlayElement::transform(const QVector &x) { - QVector res; - for (int i=0; i &x) { - QPainterPath res; - if (x.size()>0) { - res.moveTo(transform(x[0])); - for (int i=1; iposition=pos; -} - -void JKQTPOverlayOneCoordOverlay::setPosition(double __value) -{ - this->position = __value; -} - -double JKQTPOverlayOneCoordOverlay::getPosition() const -{ - return this->position; -} - - - - - - -JKQTPOverlayTwoCoordOverlay::JKQTPOverlayTwoCoordOverlay(double pos, double pos2, JKQTBasePlotter *parent): - JKQTPOverlayOneCoordOverlay(pos, parent) -{ - position2=pos2; -} - -void JKQTPOverlayTwoCoordOverlay::setPosition2(double __value) -{ - this->position2 = __value; -} - -double JKQTPOverlayTwoCoordOverlay::getPosition2() const -{ - return this->position2; -} - -JKQTPOverlayTwoPositionOverlay::JKQTPOverlayTwoPositionOverlay(double x1, double y1, double x2, double y2, JKQTBasePlotter *parent): - JKQTPOverlayElement(parent) -{ - this->x1=x1; - this->y1=y1; - this->x2=x2; - this->y2=y2; -} - -void JKQTPOverlayTwoPositionOverlay::setX1(double __value) -{ - this->x1 = __value; -} - -double JKQTPOverlayTwoPositionOverlay::getX1() const -{ - return this->x1; -} - -void JKQTPOverlayTwoPositionOverlay::setX2(double __value) -{ - this->x2 = __value; -} - -double JKQTPOverlayTwoPositionOverlay::getX2() const -{ - return this->x2; -} - -void JKQTPOverlayTwoPositionOverlay::setY1(double __value) -{ - this->y1 = __value; -} - -double JKQTPOverlayTwoPositionOverlay::getY1() const -{ - return this->y1; -} - -void JKQTPOverlayTwoPositionOverlay::setY2(double __value) -{ - this->y2 = __value; -} - -double JKQTPOverlayTwoPositionOverlay::getY2() const -{ - return this->y2; -} diff --git a/lib/jkqtplotter/jkqtpoverlaysbase.h b/lib/jkqtplotter/jkqtpoverlaysbase.h deleted file mode 100644 index a37625ea04..0000000000 --- a/lib/jkqtplotter/jkqtpoverlaysbase.h +++ /dev/null @@ -1,181 +0,0 @@ -/* - Copyright (c) 2008-2020 Jan W. Krieger () - - - - This software is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License (LGPL) as published by - the Free Software Foundation, either version 2.1 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License (LGPL) for more details. - - You should have received a copy of the GNU Lesser General Public License (LGPL) - along with this program. If not, see . -*/ - - -#include -#include -#include -#include -#include "jkqtplotter/jkqtptools.h" -#include "jkqtplotter/jkqtplotter_imexport.h" -#include "jkqtplotter/jkqtpgraphsbasestylingmixins.h" - -#ifndef jkqtpelementsoverlay_H -#define jkqtpelementsoverlay_H - -// forward declarations -class JKQTBasePlotter; - -/*! \brief this virtual base class describes an interface for graph overlay elements, which are simple geometric - forms drawn ONTO the graphe, so a redraw of the overlays does NOT require a redraw of the graph. - \ingroup jkqtplotter_overlays - - These simple primitive elements can be used to e.g. display fast changing indicators on the graph ... - */ -class JKQTPLOTTER_LIB_EXPORT JKQTPOverlayElement : public QObject { - Q_OBJECT - public: - explicit JKQTPOverlayElement(JKQTBasePlotter *parent = nullptr); - - /** \brief plots the graph to the plotter object specified as parent */ - virtual void draw(JKQTPEnhancedPainter& painter)=0; - - /** \brief returns the parent painter class */ - inline JKQTBasePlotter* getParent() { return parent; } - - /** \brief sets the parent painter class */ - virtual void setParent(JKQTBasePlotter* parent); - - - - /*! \copydoc visible */ - void setVisible(bool __value); - /*! \copydoc visible */ - bool isVisible() const; - - protected: - /** \brief the plotter object this object belongs to */ - JKQTBasePlotter* parent; - - /** \brief indictaes whether the overlay is visible (at all) */ - bool visible; - - - /** \brief tool routine that transforms a QPointF according to the parent's transformation rules */ - QPointF transform(const QPointF& x); - - double transfromX(double x); - double transfromY(double y); - - /** \brief tool routine that back-transforms a QPointF according to the parent's transformation rules */ - QPointF backTransform(const QPointF& x); - - /** \brief tool routine that transforms a QPointF according to the parent's transformation rules */ - inline QPointF transform(double x, double y) { - return transform(QPointF(x,y)); - } - /** \brief tool routine that back-transforms a QPointF according to the parent's transformation rules */ - inline QPointF backTransform(double x, double y) { - return backTransform(QPointF(x,y)); - } - /** \brief tool routine that transforms a QVector according to the parent's transformation rules */ - QVector transform(const QVector& x); - - /** \brief tool routine that transforms a QVector according to the parent's transformation rules - * and returns a (non-closed) path consisting of lines */ - QPainterPath transformToLinePath(const QVector& x); - - /** \brief tool routine that transforms a QVector according to the parent's transformation rules - * and returns a polygon */ - inline QPolygonF transformToPolygon(const QVector& x) { - return QPolygonF(transform(x)); - } - - - -}; - - - -/*! \brief baseclass for a two-position overlay - \ingroup jkqtplotter_overlays - */ -class JKQTPLOTTER_LIB_EXPORT JKQTPOverlayTwoPositionOverlay : public JKQTPOverlayElement { - Q_OBJECT - public: - explicit JKQTPOverlayTwoPositionOverlay(double x1, double y1, double x2, double y2, JKQTBasePlotter *parent = nullptr); - - /*! \copydoc x1 */ - void setX1(double __value); - /*! \copydoc x1 */ - double getX1() const; - /*! \copydoc x2 */ - void setX2(double __value); - /*! \copydoc x2 */ - double getX2() const; - /*! \copydoc y1 */ - void setY1(double __value); - /*! \copydoc y1 */ - double getY1() const; - /*! \copydoc y2 */ - void setY2(double __value); - /*! \copydoc y2 */ - double getY2() const; - protected: - /** \brief x-coordinate of first point of overlay */ - double x1; - /** \brief y-coordinate of first point of overlay */ - double y1; - /** \brief x-coordinate of first second of overlay */ - double x2; - /** \brief y-coordinate of first second of overlay */ - double y2; -}; - - - -/*! \brief baseclass for one-coordinate indicator overlays (horizontal/vertical lines - \ingroup jkqtplotter_overlays - */ -class JKQTPLOTTER_LIB_EXPORT JKQTPOverlayOneCoordOverlay : public JKQTPOverlayElement { - Q_OBJECT - public: - explicit JKQTPOverlayOneCoordOverlay(double pos, JKQTBasePlotter *parent = nullptr); - - /*! \copydoc position */ - void setPosition(double __value); - /*! \copydoc position */ - double getPosition() const; - protected: - /** \brief second position for the element */ - double position; -}; - - - -/*! \brief baseclass for two-coordinate indicator overlays (horizontal/vertical lines - \ingroup jkqtplotter_overlays - */ -class JKQTPLOTTER_LIB_EXPORT JKQTPOverlayTwoCoordOverlay : public JKQTPOverlayOneCoordOverlay { - Q_OBJECT - public: - explicit JKQTPOverlayTwoCoordOverlay(double pos, double pos2, JKQTBasePlotter *parent = nullptr); - - /*! \copydoc position2 */ - void setPosition2(double __value); - /*! \copydoc position2 */ - double getPosition2() const; - protected: - /** \brief second position for the element */ - double position2; -}; - - - -#endif // jkqtpelementsoverlay_H diff --git a/lib/jkqtplotter/overlays/jkqtpbasicoverlays.cpp b/lib/jkqtplotter/overlays/jkqtpbasicoverlays.cpp deleted file mode 100644 index 1283c86aae..0000000000 --- a/lib/jkqtplotter/overlays/jkqtpbasicoverlays.cpp +++ /dev/null @@ -1,249 +0,0 @@ -/* - Copyright (c) 2008-2020 Jan W. Krieger () - - - - This software is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License (LGPL) as published by - the Free Software Foundation, either version 2.1 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License (LGPL) for more details. - - You should have received a copy of the GNU Lesser General Public License (LGPL) - along with this program. If not, see . -*/ - - - -#include "jkqtplotter/overlays/jkqtpbasicoverlays.h" -#include "jkqtplotter/jkqtpbaseplotter.h" -#include "jkqtplotter/jkqtptools.h" -#include "jkqtcommon/jkqtpdrawingtools.h" -#include -#include - - -JKQTPOverlayVerticalLine::JKQTPOverlayVerticalLine(double pos, JKQTBasePlotter *parent): - JKQTPOverlayOneCoordOverlay(pos, parent), JKQTPGraphTextStyleMixin(parent) -{ - -} - -JKQTPOverlayVerticalLine::JKQTPOverlayVerticalLine(double pos, const QString& text, JKQTBasePlotter *parent): - JKQTPOverlayOneCoordOverlay(pos, parent), JKQTPGraphTextStyleMixin(parent) -{ - setText(text); -} - - -void JKQTPOverlayVerticalLine::draw(JKQTPEnhancedPainter &painter) { - if (!parent) return; - double ymin=parent->getYMin(); - double ymax=parent->getYMax(); - QPointF p1=transform(position, ymin); - QPointF p2=transform(position, ymax); - QPointF p3=p2-QPointF(0, (p2.y()-p1.y())*0.1); - painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();}); - painter.setPen(getLinePen(painter, parent)); - painter.drawLine(p1, p2); - - if (!text.isEmpty()) { - - //JKQTMathText mt(this); - JKQTMathText* mt=parent->getMathText(); - mt->setFontSize(getTextFontSize()); - mt->setFontColor(getTextColor()); - mt->setFontRomanOrSpecial(getTextFontName()); - mt->parse(text); - mt->draw(painter, p3.x(), p3.y()); - } - - -} - -void JKQTPOverlayVerticalLine::setColor(QColor c) -{ - setLineColor(c); - setTextColor(c); -} - -void JKQTPOverlayVerticalLine::setText(const QString &__value) -{ - this->text = __value; -} - -QString JKQTPOverlayVerticalLine::getText() const -{ - return this->text; -} - - -JKQTPOverlayVerticalRange::JKQTPOverlayVerticalRange(double pos, double pos2, JKQTBasePlotter *parent): - JKQTPOverlayTwoCoordOverlay(pos, pos2, parent), JKQTPGraphTextStyleMixin(parent) -{ - inverted=false; -} - -JKQTPOverlayVerticalRange::JKQTPOverlayVerticalRange(double pos, double pos2, const QString& text, JKQTBasePlotter *parent): - JKQTPOverlayTwoCoordOverlay(pos, pos2, parent), JKQTPGraphTextStyleMixin(parent) -{ - setText(text); - inverted=false; -} - -void JKQTPOverlayVerticalRange::draw(JKQTPEnhancedPainter &painter) { - if (!parent) return; - double ymin=parent->getYMin(); - double ymax=parent->getYMax(); - double xmin=parent->getXMin(); - double xmax=parent->getXMax(); - QPointF p1=transform(position, ymin); - QPointF p2=transform(position, ymax); - QPointF p3=p2-QPointF(0, (p2.y()-p1.y())*0.1); - - QPointF p21=transform(position2, ymin); - QPointF p22=transform(position2, ymax); - //QPointF p23=p2-QPointF(0, (p2.y()-p1.y())*0.1); - painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();}); - if (getFillColor()!=QColor(Qt::transparent)) { - if (inverted) { - painter.fillRect(QRectF(transform(xmin, ymin), p2), getFillBrush(painter, parent)); - painter.fillRect(QRectF(p21, transform(xmax, ymax)), getFillBrush(painter, parent)); - } else { - painter.fillRect(QRectF(p2, p21), getFillBrush(painter, parent)); - } - } - painter.setPen(getLinePen(painter, parent)); - painter.drawLine(p1, p2); - painter.drawLine(p21, p22); - - if (!text.isEmpty()) { - //JKQTMathText mt(this); - JKQTMathText* mt=parent->getMathText(); - mt->setFontSize(getTextFontSize()); - mt->setFontColor(getTextColor()); - mt->setFontRomanOrSpecial(getTextFontName()); - mt->parse(text); - mt->draw(painter, p3.x(), p3.y()); - } - - -} - -void JKQTPOverlayVerticalRange::setColor(QColor c) -{ - setLineColor(c); - setFillColor(JKQTPGetDerivedColor(parent->getCurrentPlotterStyle().graphFillColorDerivationMode, c)); - setTextColor(c); -} - -void JKQTPOverlayVerticalRange::setInverted(bool __value) -{ - this->inverted = __value; -} - -bool JKQTPOverlayVerticalRange::getInverted() const -{ - return this->inverted; -} - -void JKQTPOverlayVerticalRange::setText(const QString &__value) -{ - text=__value; -} - -QString JKQTPOverlayVerticalRange::getText() const -{ - return text; -} - - - - - - - - -JKQTPOverlayLine::JKQTPOverlayLine(double x1, double y1, double x2, double y2, JKQTBasePlotter *parent): - JKQTPOverlayTwoPositionOverlay(x1,y1,x2,y2,parent) -{ - infinite=false; -} - - -void JKQTPOverlayLine::draw(JKQTPEnhancedPainter &painter) { - if (!parent) return; - double xmin=parent->getXMin(); - double xmax=parent->getXMax(); - QPointF p1=transform(x1, y1); - QPointF p2=transform(x2, y2); - - - - painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();}); - painter.setPen(getLinePen(painter, parent)); - if (infinite) { - double alpha=(p2.y()-p1.y())/(p2.x()-p1.x()); - double offset=p1.y()-alpha*p1.x(); - - double pxmin=transfromX(xmin); - double pxmax=transfromX(xmax); - - QPointF pmin=QPointF(pxmin, pxmin*alpha+offset); - QPointF pmax=QPointF(pxmax, pxmax*alpha+offset); - painter.drawLine(pmin, pmax); - } else { - painter.drawLine(p1,p2); - } - - - - -} - -void JKQTPOverlayLine::setInfinite(bool __value) -{ - this->infinite = __value; -} - -bool JKQTPOverlayLine::getInfinite() const -{ - return this->infinite; -} - -void JKQTPOverlayLine::setColor(QColor c) -{ - setLineColor(c); -} - - -JKQTPOverlayRectangle::JKQTPOverlayRectangle(double x1, double y1, double x2, double y2, JKQTBasePlotter *parent): - JKQTPOverlayTwoPositionOverlay(x1,y1,x2,y2,parent) -{ - -} - -void JKQTPOverlayRectangle::draw(JKQTPEnhancedPainter &painter) -{ - if (!parent) return; - QPointF p1=transform(x1, y1); - QPointF p2=transform(x2, y2); - QRectF rect(qMin(p1.x(), p2.x()), qMin(p1.y(), p2.y()), fabs(p1.x()-p2.x()), fabs(p1.y()-p2.y())); - - painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();}); - painter.setPen(getLinePen(painter, parent)); - painter.setBrush(getFillBrush(painter, parent)); - //painter.fillRect(rect); - painter.drawRect(rect); - -} - -void JKQTPOverlayRectangle::setColor(QColor c) -{ - setLineColor(c); - setFillColor(JKQTPGetDerivedColor(parent->getCurrentPlotterStyle().graphFillColorDerivationMode, c)); -} diff --git a/lib/jkqtplotter/overlays/jkqtpbasicoverlays.h b/lib/jkqtplotter/overlays/jkqtpbasicoverlays.h deleted file mode 100644 index ef3fa67db1..0000000000 --- a/lib/jkqtplotter/overlays/jkqtpbasicoverlays.h +++ /dev/null @@ -1,137 +0,0 @@ -/* - Copyright (c) 2008-2020 Jan W. Krieger () - - - - This software is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License (LGPL) as published by - the Free Software Foundation, either version 2.1 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License (LGPL) for more details. - - You should have received a copy of the GNU Lesser General Public License (LGPL) - along with this program. If not, see . -*/ - - -#include -#include -#include -#include -#include "jkqtplotter/jkqtptools.h" -#include "jkqtplotter/jkqtpoverlaysbase.h" -#include "jkqtplotter/jkqtplotter_imexport.h" -#include "jkqtplotter/jkqtpgraphsbasestylingmixins.h" - -#ifndef jkqtpbasicoverlays_H -#define jkqtpbasicoverlays_H - -// forward declarations -class JKQTBasePlotter; - - - -/*! \brief draws a vertical line as an overlay - \ingroup jkqtplotter_overlays - - These simple primitive elements can be used to e.g. display fast changing indicators on the graph ... - */ -class JKQTPLOTTER_LIB_EXPORT JKQTPOverlayVerticalLine : public JKQTPOverlayOneCoordOverlay, public JKQTPGraphLineStyleMixin, public JKQTPGraphTextStyleMixin { - Q_OBJECT - public: - explicit JKQTPOverlayVerticalLine(double pos, JKQTBasePlotter *parent = nullptr); - explicit JKQTPOverlayVerticalLine(double pos, const QString& text, JKQTBasePlotter *parent = nullptr); - - /** \brief plots the graph to the plotter object specified as parent */ - virtual void draw(JKQTPEnhancedPainter& painter); - /** \brief set element color */ - virtual void setColor(QColor c); - - /*! \copydoc text */ - void setText(const QString & __value); - /*! \copydoc text */ - QString getText() const; - protected: - /** \brief a text to display next to the vertical line */ - QString text; -}; - - - -/*! \brief draws a vertical range as an overlay - \ingroup jkqtplotter_overlays - - These simple primitive elements can be used to e.g. display fast changing indicators on the graph ... - */ -class JKQTPLOTTER_LIB_EXPORT JKQTPOverlayVerticalRange : public JKQTPOverlayTwoCoordOverlay, public JKQTPGraphLineStyleMixin, public JKQTPGraphFillStyleMixin, public JKQTPGraphTextStyleMixin { - Q_OBJECT - public: - explicit JKQTPOverlayVerticalRange(double pos, double pos2, JKQTBasePlotter *parent = nullptr); - explicit JKQTPOverlayVerticalRange(double pos, double pos2, const QString& text, JKQTBasePlotter *parent = nullptr); - - /** \brief plots the graph to the plotter object specified as parent */ - virtual void draw(JKQTPEnhancedPainter& painter); - /** \brief set element color */ - virtual void setColor(QColor c); - - /*! \copydoc inverted */ - void setInverted(bool __value); - /*! \copydoc inverted */ - bool getInverted() const; - - /*! \copydoc text */ - void setText(const QString & __value); - /*! \copydoc text */ - QString getText() const; - protected: - /** \brief a text to display next to the range */ - QString text; - /** \brief if set \c false, the range is filled, otherwise everything outside the range is filled */ - bool inverted; -}; - -/*! \brief draws a line throught two points - \ingroup jkqtplotter_overlays - - */ -class JKQTPLOTTER_LIB_EXPORT JKQTPOverlayLine : public JKQTPOverlayTwoPositionOverlay, public JKQTPGraphLineStyleMixin { - Q_OBJECT - public: - explicit JKQTPOverlayLine(double x1, double y1, double x2, double y2, JKQTBasePlotter *parent = nullptr); - - /** \brief plots the graph to the plotter object specified as parent */ - virtual void draw(JKQTPEnhancedPainter& painter); - - /*! \copydoc infinite */ - void setInfinite(bool __value); - /*! \copydoc infinite */ - bool getInfinite() const; - /** \brief set element color */ - virtual void setColor(QColor c); - protected: - /** \brief the line goes on infinitely */ - bool infinite; -}; - -/*! \brief draws a rectangle, spanned by two points - \ingroup jkqtplotter_overlays - - */ -class JKQTPLOTTER_LIB_EXPORT JKQTPOverlayRectangle : public JKQTPOverlayTwoPositionOverlay, public JKQTPGraphLineStyleMixin, public JKQTPGraphFillStyleMixin { - Q_OBJECT - public: - explicit JKQTPOverlayRectangle(double x1, double y1, double x2, double y2, JKQTBasePlotter *parent = nullptr); - - /** \brief plots the graph to the plotter object specified as parent */ - virtual void draw(JKQTPEnhancedPainter& painter); - /** \brief set element color */ - virtual void setColor(QColor c); - - protected: -}; - -#endif // jkqtpbasicoverlays_H