MCPcopy Create free account
hub / github.com/cutechess/cutechess / getFillBasePoint

Method getFillBasePoint

projects/gui/3rdparty/qcustomplot/qcustomplot.cpp:22153–22194  ·  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

22151 y value of the returned point, respectively.
22152*/
22153QPointF QCPGraph::getFillBasePoint(QPointF matchingDataPoint) const
22154{
22155 QCPAxis *keyAxis = mKeyAxis.data();
22156 QCPAxis *valueAxis = mValueAxis.data();
22157 if (!keyAxis || !valueAxis) { qDebug() << Q_FUNC_INFO << "invalid key or value axis"; return {}; }
22158
22159 QPointF result;
22160 if (valueAxis->scaleType() == QCPAxis::stLinear)
22161 {
22162 if (keyAxis->orientation() == Qt::Horizontal)
22163 {
22164 result.setX(matchingDataPoint.x());
22165 result.setY(valueAxis->coordToPixel(0));
22166 } else // keyAxis->orientation() == Qt::Vertical
22167 {
22168 result.setX(valueAxis->coordToPixel(0));
22169 result.setY(matchingDataPoint.y());
22170 }
22171 } else // valueAxis->mScaleType == QCPAxis::stLogarithmic
22172 {
22173 // In logarithmic scaling we can't just draw to value 0 so we just fill all the way
22174 // to the axis which is in the direction towards 0
22175 if (keyAxis->orientation() == Qt::Vertical)
22176 {
22177 if ((valueAxis->range().upper < 0 && !valueAxis->rangeReversed()) ||
22178 (valueAxis->range().upper > 0 && valueAxis->rangeReversed())) // if range is negative, zero is on opposite side of key axis
22179 result.setX(keyAxis->axisRect()->right());
22180 else
22181 result.setX(keyAxis->axisRect()->left());
22182 result.setY(matchingDataPoint.y());
22183 } else if (keyAxis->axisType() == QCPAxis::atTop || keyAxis->axisType() == QCPAxis::atBottom)
22184 {
22185 result.setX(matchingDataPoint.x());
22186 if ((valueAxis->range().upper < 0 && !valueAxis->rangeReversed()) ||
22187 (valueAxis->range().upper > 0 && valueAxis->rangeReversed())) // if range is negative, zero is on opposite side of key axis
22188 result.setY(keyAxis->axisRect()->top());
22189 else
22190 result.setY(keyAxis->axisRect()->bottom());
22191 }
22192 }
22193 return result;
22194}
22195
22196/*! \internal
22197

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