diff --git a/lib/jkqtcommon/jkqtpdrawingtools.cpp b/lib/jkqtcommon/jkqtpdrawingtools.cpp index a0fc2a680a..69115205cd 100644 --- a/lib/jkqtcommon/jkqtpdrawingtools.cpp +++ b/lib/jkqtcommon/jkqtpdrawingtools.cpp @@ -446,7 +446,7 @@ QList JKQTPClipPolyLines(const QList &polylines_in, cons } else if (l==lclipped) { if (out.last().size()==0) { out.last()< JKQTPClipPolyLines(const QList &polylines_in, cons } else if (l.p1()==lclipped.p1() && l.p2()!=lclipped.p2()) { if (out.last().size()==0) { out.last()< JKQTPClipPolyLines(const QList &polylines_in, cons } else if (l.p1()!=lclipped.p1() && l.p2()==lclipped.p2()) { if (out.last().size()==0) { out.last()< JKQTPClipPolyLines(const QList &polylines_in, cons } return out; } + +QList JKQTPSimplifyPolyLines(const QList &lines_in, double maxDeltaXY) +{ + QList l; + for (const QPolygonF& p: lines_in) { + l< JKQTPClipPolyLines(const QList */ JKQTCOMMON_LIB_EXPORT QList JKQTPClipPolyLine(const QPolygonF & polyline_in, const QRectF& clipRect); +/*! \brief tries to reduce the complexity of the given list of poly-lines \a lines_in, but keeping the appearance as if all lines were drawn + \ingroup jkqtptools_drawing + + \param lines_in list of poly-lines to be simplified + \param maxDeltaXY a group has to be either less wide or less high than this, typically equals the linewidth of the poly-line + \return a simplified version of lines_in +*/ +JKQTCOMMON_LIB_EXPORT QList JKQTPSimplifyPolyLines(const QList& lines_in, double maxDeltaXY=1.0); + /*! \brief tries to reduce the complexity of the given poly-line \a lines_in, but keeping the appearance as if all lines were drawn \ingroup jkqtptools_drawing diff --git a/lib/jkqtplotter/graphs/jkqtpscatter.cpp b/lib/jkqtplotter/graphs/jkqtpscatter.cpp index 4f807fecb0..d5733aacf5 100644 --- a/lib/jkqtplotter/graphs/jkqtpscatter.cpp +++ b/lib/jkqtplotter/graphs/jkqtpscatter.cpp @@ -124,11 +124,12 @@ void JKQTPXYLineGraph::draw(JKQTPEnhancedPainter& painter) { if (drawLine) { //qDebug()<<"JKQTPXYLineGraph::draw(): vec_linesP.size()=="< linesToDraw=JKQTPClipPolyLines(vec_linesP, cliprect); + QList linesToDraw; + if (getUseNonvisibleLineCompression()) linesToDraw=JKQTPClipPolyLines(JKQTPSimplifyPolyLines(vec_linesP, p.widthF()*getNonvisibleLineCompressionAgressiveness()), cliprect); + else linesToDraw=JKQTPClipPolyLines(vec_linesP, cliprect); //qDebug()<<"JKQTPXYLineGraph::draw(): linesToDraw.size()=="< linesP.size()=="<0) { if (isHighlighted()) {