/*! Rescales the key axis of the plottable so the whole plottable is visible. See \ref rescaleAxes for detailed behaviour. */ void QCPAbstractPlottable::rescaleKeyAxis(bool onlyEnlarge) const { QCPAxis *keyAxis = mKeyAxis.data(); if (!keyAxis) { qDebug() << Q_FUNC_INFO << "invalid key axis"; return; } SignDomain signDomain = sdBoth; if (keyAxis->scaleType() == QCPAxis::stLogarithmic) signDomain = (keyAxis->range().upper < 0 ? sdNegative : sdPositive); bool foundRange; QCPRange newRange = getKeyRange(foundRange, signDomain); if (foundRange) { if (onlyEnlarge) newRange.expand(keyAxis->range()); if (!QCPRange::validRange(newRange)) // likely due to range being zero (plottable has only constant data in this axis dimension), shift current range to at least center the plottable { double center = (newRange.lower+newRange.upper)*0.5; // upper and lower should be equal anyway, but just to make sure, incase validRange returned false for other reason if (keyAxis->scaleType() == QCPAxis::stLinear) { newRange.lower = center-keyAxis->range().size()/2.0; newRange.upper = center+keyAxis->range().size()/2.0; } else // scaleType() == stLogarithmic { newRange.lower = center/qSqrt(keyAxis->range().upper/keyAxis->range().lower); newRange.upper = center*qSqrt(keyAxis->range().upper/keyAxis->range().lower); } } keyAxis->setRange(newRange); } }
// . dddddddd dddddddd dddddddd dddddddd d = domain hash w/o collection // . uuuuuuuu uuuuuuuu uuuuuuuu uuuuuuuu u = url hash // . uuuuuuuu uuuuuuuu uuuuuuuu uuuuuuuu key_t Catdb::makeKey ( Url *site, bool isDelete ) { key_t k; // . get startKey based on "site"'s domain // . if "site"'s domain is an ip address (non-canonical) then use ip getKeyRange ( site->isIp() , site , &k , NULL); // set lower 64 bits of key to hash of this url k.n0 = hash64 ( site->getUrl() , site->getUrlLen() ); // clear low bit if we're a delete, otherwise set it if ( isDelete ) k.n0 &= 0xfffffffffffffffeLL; else k.n0 |= 0x0000000000000001LL; return k; }