MCPcopy Create free account
hub / github.com/LUX-Core/lux / getFillBasePoint

Method getFillBasePoint

src/qt/qcustomplot.cpp:21308–21349  ·  view source on GitHub ↗

! \internal Returns the point which closes the fill polygon on the zero-value-line parallel to the key axis. The logarithmic axis scale case is a bit special, since the zero-value-line in pixel coordinates is in positive or negative infinity. So this case is handled separately by just closing the fill polygon on the axis which lies in the direction towards the zero value. \a matching

Source from the content-addressed store, hash-verified

21306 y value of the returned point, respectively.
21307*/
21308QPointF QCPGraph::getFillBasePoint(QPointF matchingDataPoint) const
21309{
21310 QCPAxis *keyAxis = mKeyAxis.data();
21311 QCPAxis *valueAxis = mValueAxis.data();
21312 if (!keyAxis || !valueAxis) { qDebug() << Q_FUNC_INFO << "invalid key or value axis"; return QPointF(); }
21313
21314 QPointF result;
21315 if (valueAxis->scaleType() == QCPAxis::stLinear)
21316 {
21317 if (keyAxis->orientation() == Qt::Horizontal)
21318 {
21319 result.setX(matchingDataPoint.x());
21320 result.setY(valueAxis->coordToPixel(0));
21321 } else // keyAxis->orientation() == Qt::Vertical
21322 {
21323 result.setX(valueAxis->coordToPixel(0));
21324 result.setY(matchingDataPoint.y());
21325 }
21326 } else // valueAxis->mScaleType == QCPAxis::stLogarithmic
21327 {
21328 // In logarithmic scaling we can't just draw to value 0 so we just fill all the way
21329 // to the axis which is in the direction towards 0
21330 if (keyAxis->orientation() == Qt::Vertical)
21331 {
21332 if ((valueAxis->range().upper < 0 && !valueAxis->rangeReversed()) ||
21333 (valueAxis->range().upper > 0 && valueAxis->rangeReversed())) // if range is negative, zero is on opposite side of key axis
21334 result.setX(keyAxis->axisRect()->right());
21335 else
21336 result.setX(keyAxis->axisRect()->left());
21337 result.setY(matchingDataPoint.y());
21338 } else if (keyAxis->axisType() == QCPAxis::atTop || keyAxis->axisType() == QCPAxis::atBottom)
21339 {
21340 result.setX(matchingDataPoint.x());
21341 if ((valueAxis->range().upper < 0 && !valueAxis->rangeReversed()) ||
21342 (valueAxis->range().upper > 0 && valueAxis->rangeReversed())) // if range is negative, zero is on opposite side of key axis
21343 result.setY(keyAxis->axisRect()->top());
21344 else
21345 result.setY(keyAxis->axisRect()->bottom());
21346 }
21347 }
21348 return result;
21349}
21350
21351/*! \internal
21352

Callers

nothing calls this directly

Calls 4

coordToPixelMethod · 0.80
rangeMethod · 0.80
axisRectMethod · 0.80
dataMethod · 0.45

Tested by

no test coverage detected