! \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),
| 21603 | \see drawLinePlot, drawImpulsePlot, drawScatterPlot |
| 21604 | */ |
| 21605 | void QCPGraph::drawFill(QCPPainter *painter, QVector<QPointF> *lines) const |
| 21606 | { |
| 21607 | if (mLineStyle == lsImpulse) return; // fill doesn't make sense for impulse plot |
| 21608 | if (painter->brush().style() == Qt::NoBrush || painter->brush().color().alpha() == 0) return; |
| 21609 | |
| 21610 | applyFillAntialiasingHint(painter); |
| 21611 | const QVector<QCPDataRange> segments = getNonNanSegments(lines, keyAxis()->orientation()); |
| 21612 | if (!mChannelFillGraph) |
| 21613 | { |
| 21614 | // draw base fill under graph, fill goes all the way to the zero-value-line: |
| 21615 | foreach (QCPDataRange segment, segments) |
| 21616 | painter->drawPolygon(getFillPolygon(lines, segment)); |
| 21617 | } else |
| 21618 | { |
| 21619 | // draw fill between this graph and mChannelFillGraph: |
| 21620 | QVector<QPointF> otherLines; |
| 21621 | mChannelFillGraph->getLines(&otherLines, QCPDataRange(0, mChannelFillGraph->dataCount())); |
| 21622 | if (!otherLines.isEmpty()) |
| 21623 | { |
| 21624 | QVector<QCPDataRange> otherSegments = getNonNanSegments(&otherLines, mChannelFillGraph->keyAxis()->orientation()); |
| 21625 | QVector<QPair<QCPDataRange, QCPDataRange> > segmentPairs = getOverlappingSegments(segments, lines, otherSegments, &otherLines); |
| 21626 | for (int i=0; i<segmentPairs.size(); ++i) |
| 21627 | painter->drawPolygon(getChannelFillPolygon(lines, segmentPairs.at(i).first, &otherLines, segmentPairs.at(i).second)); |
| 21628 | } |
| 21629 | } |
| 21630 | } |
| 21631 | |
| 21632 | /*! \internal |
| 21633 |