MCPcopy Create free account
hub / github.com/CieNTi/serial_port_plotter / drawFill

Method drawFill

qcustomplot/qcustomplot.cpp:20815–20840  ·  view source on GitHub ↗

! \internal Draws the fill of the graph using the specified \a painter, with the currently set brush. Depending on whether a normal fill or a channel fill (\ref setChannelFillGraph) is needed, \ref getFillPolygon or \ref getChannelFillPolygon are used to find the according fill polygons. In order to handle NaN Data points correctly (the fill needs to be split into disjoint areas),

Source from the content-addressed store, hash-verified

20813 \see drawLinePlot, drawImpulsePlot, drawScatterPlot
20814*/
20815void QCPGraph::drawFill(QCPPainter *painter, QVector<QPointF> *lines) const
20816{
20817 if (mLineStyle == lsImpulse) return; // fill doesn't make sense for impulse plot
20818 if (painter->brush().style() == Qt::NoBrush || painter->brush().color().alpha() == 0) return;
20819
20820 applyFillAntialiasingHint(painter);
20821 QVector<QCPDataRange> segments = getNonNanSegments(lines, keyAxis()->orientation());
20822 if (!mChannelFillGraph)
20823 {
20824 // draw base fill under graph, fill goes all the way to the zero-value-line:
20825 for (int i=0; i<segments.size(); ++i)
20826 painter->drawPolygon(getFillPolygon(lines, segments.at(i)));
20827 } else
20828 {
20829 // draw fill between this graph and mChannelFillGraph:
20830 QVector<QPointF> otherLines;
20831 mChannelFillGraph->getLines(&otherLines, QCPDataRange(0, mChannelFillGraph->dataCount()));
20832 if (!otherLines.isEmpty())
20833 {
20834 QVector<QCPDataRange> otherSegments = getNonNanSegments(&otherLines, mChannelFillGraph->keyAxis()->orientation());
20835 QVector<QPair<QCPDataRange, QCPDataRange> > segmentPairs = getOverlappingSegments(segments, lines, otherSegments, &otherLines);
20836 for (int i=0; i<segmentPairs.size(); ++i)
20837 painter->drawPolygon(getChannelFillPolygon(lines, segmentPairs.at(i).first, &otherLines, segmentPairs.at(i).second));
20838 }
20839 }
20840}
20841
20842/*! \internal
20843

Callers

nothing calls this directly

Calls 8

keyAxisFunction · 0.85
alphaMethod · 0.80
colorMethod · 0.80
atMethod · 0.80
getLinesMethod · 0.80
sizeMethod · 0.45
dataCountMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected