MCPcopy Create free account
hub / github.com/CloudCompare/CloudCompare / drawPolyline

Method drawPolyline

qCC/extern/QCustomPlot/qcustomplot.cpp:35225–35268  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35223}
35224
35225void QCPPolarGraph::drawPolyline(QCPPainter *painter, const QVector<QPointF> &lineData) const
35226{
35227 // if drawing solid line and not in PDF, use much faster line drawing instead of polyline:
35228 if (mParentPlot->plottingHints().testFlag(QCP::phFastPolylines) &&
35229 painter->pen().style() == Qt::SolidLine &&
35230 !painter->modes().testFlag(QCPPainter::pmVectorized) &&
35231 !painter->modes().testFlag(QCPPainter::pmNoCaching))
35232 {
35233 int i = 0;
35234 bool lastIsNan = false;
35235 const int lineDataSize = lineData.size();
35236 while (i < lineDataSize && (qIsNaN(lineData.at(i).y()) || qIsNaN(lineData.at(i).x()))) // make sure first point is not NaN
35237 ++i;
35238 ++i; // because drawing works in 1 point retrospect
35239 while (i < lineDataSize)
35240 {
35241 if (!qIsNaN(lineData.at(i).y()) && !qIsNaN(lineData.at(i).x())) // NaNs create a gap in the line
35242 {
35243 if (!lastIsNan)
35244 painter->drawLine(lineData.at(i-1), lineData.at(i));
35245 else
35246 lastIsNan = false;
35247 } else
35248 lastIsNan = true;
35249 ++i;
35250 }
35251 } else
35252 {
35253 int segmentStart = 0;
35254 int i = 0;
35255 const int lineDataSize = lineData.size();
35256 while (i < lineDataSize)
35257 {
35258 if (qIsNaN(lineData.at(i).y()) || qIsNaN(lineData.at(i).x()) || qIsInf(lineData.at(i).y())) // NaNs create a gap in the line. Also filter Infs which make drawPolyline block
35259 {
35260 painter->drawPolyline(lineData.constData()+segmentStart, i-segmentStart); // i, because we don't want to include the current NaN point
35261 segmentStart = i+1;
35262 }
35263 ++i;
35264 }
35265 // draw last segment:
35266 painter->drawPolyline(lineData.constData()+segmentStart, lineDataSize-segmentStart);
35267 }
35268}
35269
35270void QCPPolarGraph::getVisibleDataBounds(QCPGraphDataContainer::const_iterator &begin, QCPGraphDataContainer::const_iterator &end, const QCPDataRange &rangeRestriction) const
35271{

Callers 2

ccQCustomPlot.hFile · 0.45
drawMethod · 0.45

Calls 3

drawLineMethod · 0.80
sizeMethod · 0.45
atMethod · 0.45

Tested by

no test coverage detected