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

Method bounded

qcustomplot/qcustomplot.cpp:2002–2023  ·  view source on GitHub ↗

! Returns this range, possibly modified to not exceed the bounds provided as \a lowerBound and \a upperBound. If possible, the size of the current range is preserved in the process. If the range shall only be bounded at the lower side, you can set \a upperBound to \ref QCPRange::maxRange. If it shall only be bounded at the upper side, set \a lowerBound to -\ref QCPRange::maxRange. */

Source from the content-addressed store, hash-verified

2000 QCPRange::maxRange.
2001*/
2002QCPRange QCPRange::bounded(double lowerBound, double upperBound) const
2003{
2004 if (lowerBound > upperBound)
2005 qSwap(lowerBound, upperBound);
2006
2007 QCPRange result(lower, upper);
2008 if (result.lower < lowerBound)
2009 {
2010 result.lower = lowerBound;
2011 result.upper = lowerBound + size();
2012 if (result.upper > upperBound || qFuzzyCompare(size(), upperBound-lowerBound))
2013 result.upper = upperBound;
2014 } else if (result.upper > upperBound)
2015 {
2016 result.upper = upperBound;
2017 result.lower = upperBound - size();
2018 if (result.lower < lowerBound || qFuzzyCompare(size(), upperBound-lowerBound))
2019 result.lower = lowerBound;
2020 }
2021
2022 return result;
2023}
2024
2025/*!
2026 Returns a sanitized version of the range. Sanitized means for logarithmic scales, that

Callers 2

getVisibleDataBoundsMethod · 0.80

Calls 2

sizeFunction · 0.85
isEmptyMethod · 0.45

Tested by

no test coverage detected