added optimized line-drawing to JKQTPSpecialLineGraphBase

This commit is contained in:
jkriege2 2022-08-25 22:33:07 +02:00
parent 064f01d0b0
commit a90cbecd9d
2 changed files with 10 additions and 7 deletions

View File

@ -268,13 +268,14 @@ void JKQTPSpecialLineHorizontalGraph::draw(JKQTPEnhancedPainter& painter) {
QList<QPolygonF> pl_fordrawing;
if (isHighlighted() || getDrawLine()) {
pl_fordrawing=JKQTPClipPolyLine(pl, cliprect);
if (getUseNonvisibleLineCompression()) pl_fordrawing=JKQTPClipPolyLine(JKQTPSimplifyPolyLines(pl, p.widthF()*getNonvisibleLineCompressionAgressiveness()), cliprect);
else pl_fordrawing=JKQTPClipPolyLine(pl, cliprect);
}
if (isHighlighted()) {
painter.setBrush(Qt::NoBrush);
painter.setPen(ph);
for (const QPolygonF lines : pl_fordrawing) {
for (const QPolygonF& lines : pl_fordrawing) {
painter.drawPolyline(lines);
}
}
@ -282,11 +283,12 @@ void JKQTPSpecialLineHorizontalGraph::draw(JKQTPEnhancedPainter& painter) {
if (getDrawLine()) {
painter.setBrush(Qt::NoBrush);
painter.setPen(p);
for (const QPolygonF lines : pl_fordrawing) {
for (const QPolygonF& lines : pl_fordrawing) {
painter.drawPolyline(lines);
}
}
if (m_drawSymbols) {
painter.save();
auto __finalpaintsym=JKQTPFinally([&painter]() {painter.restore();});
@ -454,13 +456,14 @@ void JKQTPSpecialLineVerticalGraph::draw(JKQTPEnhancedPainter& painter) {
QList<QPolygonF> pl_fordrawing;
if (isHighlighted() || getDrawLine()) {
pl_fordrawing=JKQTPClipPolyLine(pl, cliprect);
if (getUseNonvisibleLineCompression()) pl_fordrawing=JKQTPClipPolyLine(JKQTPSimplifyPolyLines(pl, p.widthF()*getNonvisibleLineCompressionAgressiveness()), cliprect);
else pl_fordrawing=JKQTPClipPolyLine(pl, cliprect);
}
if (isHighlighted()) {
painter.setBrush(Qt::NoBrush);
painter.setPen(ph);
for (const QPolygonF lines : pl_fordrawing) {
for (const QPolygonF& lines : pl_fordrawing) {
painter.drawPolyline(lines);
}
}
@ -468,7 +471,7 @@ void JKQTPSpecialLineVerticalGraph::draw(JKQTPEnhancedPainter& painter) {
if (getDrawLine()) {
painter.setBrush(Qt::NoBrush);
painter.setPen(p);
for (const QPolygonF lines : pl_fordrawing) {
for (const QPolygonF& lines : pl_fordrawing) {
painter.drawPolyline(lines);
}
}

View File

@ -50,7 +50,7 @@ class JKQTPDatastore;
*
* \see JKQTPSpecialLineHorizontalGraph, JKQTPSpecialLineVerticalGraph
*/
class JKQTPLOTTER_LIB_EXPORT JKQTPSpecialLineGraphBase: public JKQTPXYBaselineGraph, public JKQTPGraphLineAndFillStyleMixin, public JKQTPGraphSymbolStyleMixin {
class JKQTPLOTTER_LIB_EXPORT JKQTPSpecialLineGraphBase: public JKQTPXYBaselineGraph, public JKQTPGraphLineAndFillStyleMixin, public JKQTPGraphSymbolStyleMixin, public JKQTPGraphLinesCompressionMixin {
Q_OBJECT
public:
/** \brief class constructor */