From 25fcb2a74ae337aafc3a1d41bde5f8ba5a10300c Mon Sep 17 00:00:00 2001 From: jkriege2 Date: Sat, 10 Feb 2024 00:26:45 +0100 Subject: [PATCH] NEW add JKQTPParametrizedVectorFieldGraph, which draws color-coded vector fields (color from length, angle, or user-supplied data column) + example --- doc/CMakeLists.txt | 2 + doc/dox/examples_and_tutorials.dox | 3 + doc/dox/jkqtplotter_plotelements_classdoc.dox | 3 + doc/dox/whatsnew.dox | 4 +- .../JKQTPParametrizedVectorFieldGraph.png | Bin 0 -> 38610 bytes ...metrizedVectorFieldGraphColorFromAngle.png | Bin 0 -> 39031 bytes ...izedVectorFieldGraphColorFromMagnitude.png | Bin 0 -> 38864 bytes ...rametrizedVectorFieldGraphDefaultColor.png | Bin 0 -> 41442 bytes .../JKQTPVectorFieldGraphIgnoreLength.png | Bin 58766 -> 32269 bytes ...noreLengthAutoscaleLineWidthFromLength.png | Bin 43962 -> 13501 bytes examples/CMakeLists.txt | 1 + examples/paramvectorfield/CMakeLists.txt | 25 ++ examples/paramvectorfield/README.md | 63 +++++ .../paramvectorfield/paramvectorfield.cpp | 86 ++++++ examples/vectorfield/README.md | 2 +- examples/vectorfield/vectorfield.cpp | 2 +- lib/jkqtplotter/graphs/jkqtpbarchartbase.h | 4 +- lib/jkqtplotter/graphs/jkqtpboxplot.h | 2 +- lib/jkqtplotter/graphs/jkqtpscatter.cpp | 1 + lib/jkqtplotter/graphs/jkqtpvectorfield.cpp | 263 +++++++++++++++++- lib/jkqtplotter/graphs/jkqtpvectorfield.h | 141 +++++++++- lib/jkqtplotter/jkqtpgraphsbase.h | 18 +- screenshots/paramvectorfield.png | Bin 0 -> 35910 bytes screenshots/paramvectorfield_small.png | Bin 0 -> 14970 bytes 24 files changed, 595 insertions(+), 25 deletions(-) create mode 100644 doc/images/JKQTPParametrizedVectorFieldGraph.png create mode 100644 doc/images/JKQTPParametrizedVectorFieldGraphColorFromAngle.png create mode 100644 doc/images/JKQTPParametrizedVectorFieldGraphColorFromMagnitude.png create mode 100644 doc/images/JKQTPParametrizedVectorFieldGraphDefaultColor.png create mode 100644 examples/paramvectorfield/CMakeLists.txt create mode 100644 examples/paramvectorfield/README.md create mode 100644 examples/paramvectorfield/paramvectorfield.cpp create mode 100644 screenshots/paramvectorfield.png create mode 100644 screenshots/paramvectorfield_small.png diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 581818fd9c..5825a6a1de 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -246,6 +246,7 @@ if(JKQtPlotter_BUILD_EXAMPLES) #"multithreaded_complex[multithreaded]/multithreaded_complex/--mdfile=${CMAKE_CURRENT_LIST_DIR}/../examples/multithreaded/README.md --complexlabel" graphlabels/graphlabels,graphlabels_hor vectorfield + paramvectorfield ) @@ -275,6 +276,7 @@ if(JKQtPlotter_BUILD_EXAMPLES) second_axis/JKQTBasePlotter_addSecondaryYAxis,JKQTBasePlotter_addSecondaryXAxis graphlabels/JKQTPGLabelAwayFromXAxis,JKQTPGLabelAwayFromYAxis,JKQTPGLabelTowardsXAxis,JKQTPGLabelTowardsYAxis,JKQTPGLabelAboveData,JKQTPGLabelRightHandSide,JKQTPGLabelBelowData,JKQTPGLabelLeftHandSide,JKQTPGLabelCenteredOnData,JKQTPGLabelCenteredOnDataVertical,JKQTPGLSimpleBox,JKQTPGLSimpleBoxVertical,JKQTPGLSimpleBoxAndLine,JKQTPGLSimpleBoxAndLineVertical,JKQTPGLSimpleBoxAndLineONLYLABELS,JKQTPGLSimpleBoxAndLineONLYLABELSVertical/--iteratefunctorsteps--smallscreenshotplot vectorfield/JKQTPVectorFieldGraph,JKQTPVectorFieldGraphAnchorBottom,JKQTPVectorFieldGraphAnchorMid,JKQTPVectorFieldGraphAnchorTip,JKQTPVectorFieldGraphAutoscaleLength,JKQTPVectorFieldGraphLengthFromData,JKQTPVectorFieldGraphIgnoreLength,JKQTPVectorFieldGraphIgnoreLengthAutoscaleLineWidthFromLength,JKQTPVectorFieldGraphAutoscaleLengthAutoscaleLineWidthFromLength/--iteratefunctorsteps + paramvectorfield/JKQTPParametrizedVectorFieldGraph,JKQTPParametrizedVectorFieldGraphColorFromMagnitude,JKQTPParametrizedVectorFieldGraphColorFromAngle,JKQTPParametrizedVectorFieldGraphDefaultColor/--iteratefunctorsteps ) diff --git a/doc/dox/examples_and_tutorials.dox b/doc/dox/examples_and_tutorials.dox index 7319c8323c..0153e751b0 100644 --- a/doc/dox/examples_and_tutorials.dox +++ b/doc/dox/examples_and_tutorials.dox @@ -97,6 +97,9 @@ All test-projects are Qt-projects that use qmake to build. You can load them int \image html vectorfield_small.png \subpage JKQTPlotterVectorFieldExample `JKQTPVectorFieldGraph` + \image html paramvectorfield_small.png + \subpage JKQTPParametrizedVectorFieldGraphExample + `JKQTPParametrizedVectorFieldGraph` diff --git a/doc/dox/jkqtplotter_plotelements_classdoc.dox b/doc/dox/jkqtplotter_plotelements_classdoc.dox index 517287d21e..3660ba5d73 100644 --- a/doc/dox/jkqtplotter_plotelements_classdoc.dox +++ b/doc/dox/jkqtplotter_plotelements_classdoc.dox @@ -297,6 +297,9 @@ This group assembles graphs that represent vector fields (i.e. sets of quadruple \image html vectorfield_small.png JKQTPVectorFieldGraph + + \image html paramvectorfield_small.png + JKQTPParametrizedVectorFieldGraph diff --git a/doc/dox/whatsnew.dox b/doc/dox/whatsnew.dox index 25054c5088..2cd007ef0c 100644 --- a/doc/dox/whatsnew.dox +++ b/doc/dox/whatsnew.dox @@ -128,7 +128,9 @@ Changes, compared to \ref page_whatsnew_V4_0_0 "v4.0.0" include:
  • NEW: allow linear-gradient(), currentcolor, ... in brush definitions of style.ini-file ... and using it is cyberpunk and dark styles
  • NEW: style simple_noaxes.ini
  • NEW: JKQTPXYGraphLabels which can draw a label next to each datapoint in the given x/y-dataset. The labels can be x-/y- or x&y-coordinates or custom, then defined by a user-supplied functor (+example \ref JKQTPlotterGraphLabelsExample)
  • -
  • NEW: Base class JKQTPXYAndVectorGraph for graphs like vector fields, e.g. (x,y,dx,dy) or (x,y,angle,length) and an actual implementation JKQTPVectorFieldGraph (+example \ref JKQTPlotterVectorFieldExample)
  • +
  • NEW: Base class JKQTPXYAndVectorGraph for graphs like vector fields, e.g. (x,y,dx,dy) or (x,y,angle,length)
  • +
  • NEW: JKQTPVectorFieldGraph for drawing "simple" vector fields/quiver plots (+example \ref JKQTPlotterVectorFieldExample)
  • +
  • NEW: JKQTPParametrizedVectorFieldGraph for drawing color-coded vector fields/quiver plots (+example \ref JKQTPParametrizedVectorFieldGraphExample)
  • JKQTMathText: