Esempio n. 1
0
QwtDoubleRect QwtHistogram::boundingRect() const
{
	QwtDoubleRect rect = QwtPlotCurve::boundingRect();
	rect.setLeft(rect.left()-x(1));
	rect.setRight(rect.right()+x(dataSize()-1));
	rect.setTop(0);
	rect.setBottom(1.2*rect.bottom());
	return rect;
}
/*!
  Draw a subset of the points

  \param painter Painter
  \param xMap Maps x-values into pixel coordinates.
  \param yMap Maps y-values into pixel coordinates.
  \param canvasRect Contents rect of the canvas
  \param from Index of the first sample to be painted
  \param to Index of the last sample to be painted. If to < 0 the
         series will be painted to its last sample.

  \sa drawDots()
*/
void QwtPlotSpectroCurve::drawSeries( QPainter *painter,
    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
    const QRectF &canvasRect, int from, int to ) const
{
    if ( !painter || dataSize() <= 0 )
        return;

    if ( to < 0 )
        to = dataSize() - 1;

    if ( from < 0 )
        from = 0;

    if ( from > to )
        return;

    drawDots( painter, xMap, yMap, canvasRect, from, to );
}
Esempio n. 3
0
File: dev.cpp Progetto: nyorain/ny
	void draw(const ny::EventData*) override
	{
		if(!surface) return;

		auto bufferGuard = surface->buffer();
		auto buffer = bufferGuard.get();
		auto size = dataSize(buffer);
		std::memset(buffer.data, 0xCC, size);
	}
Esempio n. 4
0
PropertyTable::PropertyTable(VM& vm, unsigned initialCapacity)
    : JSCell(vm, vm.propertyTableStructure.get())
    , m_indexSize(sizeForCapacity(initialCapacity))
    , m_indexMask(m_indexSize - 1)
    , m_index(static_cast<unsigned*>(fastZeroedMalloc(dataSize())))
    , m_keyCount(0)
    , m_deletedCount(0)
{
    ASSERT(isPowerOf2(m_indexSize));
}
Esempio n. 5
0
void BoxCurve::draw(QPainter *painter, const QwtScaleMap &xMap,
                    const QwtScaleMap &yMap, int from, int to) const {
  if (!painter || dataSize() <= 0) return;

  int size = dataSize();
  if (to < 0) to = size - 1;

  painter->save();
  painter->setPen(QwtPlotCurve::pen());

  double *dat = new double[size];
  for (int i = from; i <= to; i++) dat[i] = y(i);

  drawBox(painter, xMap, yMap, dat, size);
  drawSymbols(painter, xMap, yMap, dat, size);

  painter->restore();
  delete[] dat;
}
double QwtBarCurve::dataOffset()
{
	if (bar_style == Vertical)
	{
		const QwtScaleMap &xMap = plot()->canvasMap(xAxis());
		int dx = abs(xMap.transform(x(1))-xMap.transform(x(0)));
		double bar_width = dx*(1-bar_gap*0.01);
		if (plot()->isVisible())
		{
			for (int i = 2; i<dataSize(); i++)
			{
				int min = abs(xMap.transform(x(i+1))-xMap.transform(x(i)));
				if (min <= dx)
					dx=min;
			}
			int x1 = xMap.transform(minXValue()) + int(bar_offset*0.01*bar_width);
			return xMap.invTransform(x1) - minXValue();
		}
		else
			return 0.5*bar_offset*0.01*bar_width;
	}
	else
	{
		const QwtScaleMap &yMap = plot()->canvasMap(yAxis());
		int dy = abs(yMap.transform(y(1))-yMap.transform(y(0)));
		double bar_width = dy*(1-bar_gap*0.01);
		if (plot()->isVisible())
		{
			for (int i=2; i<dataSize(); i++)
			{
				int min = abs(yMap.transform(y(i+1))-yMap.transform(y(i)));
				if (min <= dy)
					dy=min;
			}
			int y1 = yMap.transform(minYValue()) + int(bar_offset*0.01*bar_width);
			return yMap.invTransform(y1) - minYValue();
		}
		else
			return 0.5*bar_offset*0.01*bar_width;
	}
return 0;
}
Esempio n. 7
0
bool MobileRecordStore::_resetDataSizeIfNeeded(OperationContext* opCtx, int64_t newDataSize) {
    bool wasReset = false;
    int64_t currDataSize = dataSize(opCtx);

    if (currDataSize != _dataSize) {
        wasReset = true;
        stdx::lock_guard<stdx::mutex> lock(_dataSizeMutex);
        _dataSize = newDataSize;
    }
    return wasReset;
}
Esempio n. 8
0
/**
 * SQLite does not directly support truncate. The SQLite documentation recommends a DELETE
 * statement without a WHERE clause. A Truncate Optimizer deletes all of the table content
 * without having to visit each row of the table individually.
 */
Status MobileRecordStore::truncate(OperationContext* opCtx) {
    MobileSession* session = MobileRecoveryUnit::get(opCtx)->getSession(opCtx, false);

    int64_t numRecsBefore = numRecords(opCtx);
    _changeNumRecs(opCtx, -numRecsBefore);
    int64_t dataSizeBefore = dataSize(opCtx);
    _changeDataSize(opCtx, -dataSizeBefore);

    SqliteStatement::execQuery(session, "DELETE FROM \"", _ident, "\";");

    return Status::OK();
}
Esempio n. 9
0
/*!
  \brief Checks if a range of indices is valid and corrects it if necessary
  \param i1 Index 1
  \param i2 Index 2
*/
int QwtCurve::verifyRange(int &i1, int &i2)
{
    int size = dataSize();

    if (size < 1) return 0;

    i1 = qwtLim(i1, 0, size-1);
    i2 = qwtLim(i2, 0, size-1);
    qwtSort(i1, i2, i1, i2);

    return (i2 - i1 + 1);
}
EXPORT_C HBufC8* Roap::RRoapStorageClient::GetMeteringDataL(
    TDesC8& aRiId,
    TDes8& aMacKey,
    TDes8& aEncKeyHash,
    HBufC8*& aEncryptedMekAndMak )
    {
    TInt error = KErrNone;
    HBufC8* meteringData = NULL;
    HBufC8* csBuffer = NULL;

    if ( aRiId.Length() )
        {
        TInt mekAndMakSize = 0;
        TInt meteringDataSize = 0;
        TPckg<TInt> MakMek( mekAndMakSize );
        TPckg<TInt> dataSize( meteringDataSize );

        error = SendReceive( Roap::EGetMeteringData, TIpcArgs( &aRiId,
            &MakMek, &dataSize ) );

        if ( error == KErrNotFound )
            {
            return NULL;
            }

        User::LeaveIfError( error );

        csBuffer = HBufC8::NewMaxLC( OmaCrypto::KMacSize + SHA1_HASH
            + mekAndMakSize + meteringDataSize );

        // Package 'object' into TPtr8.
        TPtr8 objectPkg( const_cast<TUint8*> ( csBuffer->Ptr() ),
            OmaCrypto::KMacSize + SHA1_HASH + mekAndMakSize
                + meteringDataSize, OmaCrypto::KMacSize + SHA1_HASH
                + mekAndMakSize + meteringDataSize );

        User::LeaveIfError( SendReceive( Roap::EGetData,
            TIpcArgs( &objectPkg ) ) );

        aMacKey = objectPkg.Mid( 0, OmaCrypto::KMacSize );
        aEncKeyHash = objectPkg.Mid( OmaCrypto::KMacSize, SHA1_HASH );
        aEncryptedMekAndMak = objectPkg.Mid( OmaCrypto::KMacSize + SHA1_HASH,
            mekAndMakSize ).AllocL();
        meteringData = objectPkg.Mid( OmaCrypto::KMacSize + SHA1_HASH
            + mekAndMakSize, meteringDataSize ).AllocL();
        CleanupStack::PopAndDestroy( csBuffer );
        }
    else
        {
        User::Leave( KErrArgument );
        }
    return meteringData;
    }
Esempio n. 11
0
PropertyTable::PropertyTable(VM& vm, const PropertyTable& other)
    : JSCell(vm, vm.propertyTableStructure.get())
    , m_indexSize(other.m_indexSize)
    , m_indexMask(other.m_indexMask)
    , m_index(static_cast<unsigned*>(fastMalloc(dataSize())))
    , m_keyCount(other.m_keyCount)
    , m_deletedCount(other.m_deletedCount)
{
    ASSERT(isPowerOf2(m_indexSize));

    memcpy(m_index, other.m_index, dataSize());

    iterator end = this->end();
    for (iterator iter = begin(); iter != end; ++iter)
        iter->key->ref();

    // Copy the m_deletedOffsets vector.
    Vector<PropertyOffset>* otherDeletedOffsets = other.m_deletedOffsets.get();
    if (otherDeletedOffsets)
        m_deletedOffsets = std::make_unique<Vector<PropertyOffset>>(*otherDeletedOffsets);
}
Esempio n. 12
0
void
AAKR::add(Math::Matrix v)
{
    if (dataSize() == 0)
        throw std::runtime_error("unable to add: data window size is undefined.");

    if (v.rows() != 1)
        throw std::runtime_error("unable to add: new sample is not a row vector.");

    if (sampleSize() == 0)
        m_data.resize(dataSize(), v.columns());

    if ((unsigned)v.columns() != sampleSize())
        throw std::runtime_error("unable to add: sample size does not match.");

    // Write to the data set.
    m_data.set(m_index, m_index, 0, sampleSize() - 1, v);

    // Increment data set index.
    increment();
}
Esempio n. 13
0
/*!
  Draw a subset of the points

  \param painter Painter
  \param xMap Maps x-values into pixel coordinates.
  \param yMap Maps y-values into pixel coordinates.
  \param canvasRect Contents rectangle of the canvas
  \param from Index of the first sample to be painted
  \param to Index of the last sample to be painted. If to < 0 the
         series will be painted to its last sample.

  \sa drawDots()
*/
void
CpPlotCurve::drawSeries( QPainter *painter,
    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
    const QRectF &canvasRect, int from, int to ) const
{
    if ( !painter || dataSize() <= 0 )
        return;

    if ( to < 0 )
        to = dataSize() - 1;

    if ( from < 0 )
        from = 0;

    if ( from > to )
        return;

    //drawDots( painter, xMap, yMap, canvasRect, from, to );

    // Not working, to debug...
    drawLines( painter, xMap, yMap, canvasRect, from, to );
}
Esempio n. 14
0
    bool KVRecordStoreCapped::needsDelete(OperationContext* txn) const {
        if (dataSize(txn) >= _cappedMaxSize) {
            // .. too many bytes
            return true;
        }

        if ((_cappedMaxDocs != -1) && (numRecords(txn) > _cappedMaxDocs)) {
            // .. too many documents
            return true;
        }

        // we're ok
        return false;
    }
Esempio n. 15
0
PropertyTable::PropertyTable(VM& vm, JSCell* owner, const PropertyTable& other)
    : JSCell(vm, vm.propertyTableStructure.get())
    , m_indexSize(other.m_indexSize)
    , m_indexMask(other.m_indexMask)
    , m_index(static_cast<unsigned*>(fastMalloc(dataSize())))
    , m_keyCount(other.m_keyCount)
    , m_deletedCount(other.m_deletedCount)
{
    ASSERT(isPowerOf2(m_indexSize));

    memcpy(m_index, other.m_index, dataSize());

    iterator end = this->end();
    for (iterator iter = begin(); iter != end; ++iter) {
        iter->key->ref();
        Heap::writeBarrier(owner, iter->specificValue.get());
    }

    // Copy the m_deletedOffsets vector.
    Vector<PropertyOffset>* otherDeletedOffsets = other.m_deletedOffsets.get();
    if (otherDeletedOffsets)
        m_deletedOffsets = adoptPtr(new Vector<PropertyOffset>(*otherDeletedOffsets));
}
Esempio n. 16
0
void QwtPieCurve::draw(QPainter *painter, const QwtScaleMap &xMap,
                       const QwtScaleMap &yMap, int from, int to) const {
  int size = dataSize();
  if (!painter || size <= 0)
    return;

  if (to < 0)
    to = size - 1;

  if (size > 1)
    drawSlices(painter, xMap, yMap, from, to);
  else
    drawDisk(painter, xMap, yMap);
}
void SftpIncomingPacket::consumeData(QByteArray &newData)
{
#ifdef CREATOR_SSH_DEBUG
    qDebug("%s: current data size = %d, new data size = %d", Q_FUNC_INFO,
        m_data.size(), newData.size());
#endif

    if (isComplete() || dataSize() + newData.size() < sizeof m_length)
        return;

    if (dataSize() < sizeof m_length) {
        moveFirstBytes(m_data, newData, sizeof m_length - m_data.size());
        m_length = SshPacketParser::asUint32(m_data, static_cast<quint32>(0));
        if (m_length < static_cast<quint32>(TypeOffset + 1)
            || m_length > MaxPacketSize) {
            throw SSH_SERVER_EXCEPTION(SSH_DISCONNECT_PROTOCOL_ERROR,
                "Invalid length field in SFTP packet.");
        }
    }

    moveFirstBytes(m_data, newData,
        qMin<quint32>(m_length - dataSize() + 4, newData.size()));
}
Esempio n. 18
0
void
AAKR::resize(unsigned r, unsigned c)
{
    m_index = 0;
    m_num_values = 0;

    if (r == dataSize() && c == sampleSize())
        return;

    m_data.resizeAndFill(r, c, 0.0);
    m_norm = m_data;
    m_distances.resizeAndFill(r, 1, 0.0);
    m_weights.resizeAndFill(r, 1, 0.0);
}
Esempio n. 19
0
void QwtPlotCurve::drawCurve(QPainter *painter, int style,
    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
    int from, int to) const
{
	const int numPoints = (int)dataSize();
	if (!painter || numPoints < 1)
		return;

	if (to < 0 || to >= numPoints)
		to = numPoints - 1;

    switch (style)
    {
        case Lines:
            if ( testCurveAttribute(Fitted) )
            {
                // we always need the complete
                // curve for fitting
                from = 0;
                to = dataSize() - 1;
            }
            drawLines(painter, xMap, yMap, from, to);
            break;
        case Sticks:
            drawSticks(painter, xMap, yMap, from, to);
            break;
        case Steps:
            drawSteps(painter, xMap, yMap, from, to);
            break;
        case Dots:
            drawDots(painter, xMap, yMap, from, to);
            break;
        case NoCurve:
        default:
            break;
    }
}
Esempio n. 20
0
QVector<QVector4D> QAttribute::asVector4D() const
{
    Q_D(const QAttribute);
    const QByteArray buffer = d->m_buffer->data();
    const char *rawBuffer = buffer.constData();
    rawBuffer += d->m_byteOffset;
    const float* fptr;
    int stride;

    switch (dataType()) {
    case QAttribute::Float:
        stride = sizeof(float) * dataSize();
        break;

    default:
        qCDebug(Render::Io) << Q_FUNC_INFO << "can't convert" << dataType() << "x" << dataSize() << "to QVector3D";
        return QVector<QVector4D>();
    }

    if (d->m_byteStride != 0)
        stride = d->m_byteStride;
    QVector<QVector4D> result;
    result.resize(d->m_count);

    for (uint c = 0; c < d->m_count; ++c) {
        QVector4D v;
        fptr = reinterpret_cast<const float*>(rawBuffer);

        for (uint i = 0, m = dataSize(); i < m; ++i)
            v[i] = fptr[i];

        result[c] = v;
        rawBuffer += stride;
    }

    return result;
}
Esempio n. 21
0
MemoryTablePrivate::Error MemoryTablePrivate::insert(const key_type &key, const value_type &value, TableMetadata *table)
{
    const quint32 valueSize = dataSize(value);

    IndexElement *tableEnd = end(table);
    IndexElement *position = std::lower_bound(begin(table), tableEnd, key);
    if (position != tableEnd && position->key == key) {
        // This is a replacement - the item has an allocation already
        Allocation *allocation = allocationAt(position->offset, table);
        if (allocation->size < requiredSpace(valueSize)) {
            // Replace the existing allocation with a bigger one
            quint32 newOffset = allocate(valueSize, table, false);
            if (!newOffset)
                return MemoryTable::InsufficientSpace;

            deallocate(position->offset, table);
            position->offset = newOffset;
        } else {
            // Reuse this allocation
            // TODO: swap with a better fit from the free list?
        }
    } else {
        // This item needs to be added to the index
        if (table->count == std::numeric_limits<quint32>::max())
            return MemoryTable::InsufficientSpace;

        quint32 offset = allocate(valueSize, table, true);
        if (!offset)
            return MemoryTable::InsufficientSpace;

        // For index insertion, move the displaced elements of the index
        if (position != tableEnd)
            std::memmove(position + 1, position, (tableEnd - position) * sizeof(IndexElement));

        ++(table->count);
        position->key = key;
        position->offset = offset;
    }

    Q_ASSERT(contains(key, table));

    // Ensure that the data allocation does not overlap the index space
    Q_ASSERT((reinterpret_cast<char *>(table) + table->freeOffset) >= reinterpret_cast<char *>(end(table)));

    // Update the value stored at the position
    updateValue(value, valueSize, position->offset, table);

    return MemoryTable::NoError;
}
// This overload is needed when using autoscale. It is a slow implementation:
// it might be worth to cache valid data ranges.
QRectF QwtPlotPiecewiseCurve::boundingRect() const
{
  if (dataSize() <= 0) {
    return QRectF(1.0, 1.0, 2.0, 2.0); // Empty data.
  }

  size_t first = 0;
  while (first < dataSize() && ignorePoint(x(first),y(first))) {
    ++first;
  }

  if (first == dataSize()) {
    return QRectF(1.0, 1.0, 2.0, 2.0); // Empty data.
  }

  double minX, maxX, minY, maxY;
  minX = maxX = x(first);
  minY = maxY = y(first);
  for (size_t i = first + 1; i < dataSize(); ++i) {
    const double xv = x(i);
    const double yv = y(i);

    if (!ignorePoint(xv,yv)) {
      if (xv < minX)
        minX = xv;
      if (xv > maxX)
        maxX = xv;
      if (yv < minY)
        minY = yv;
      if (yv > maxY)
        maxY = yv;
    }
  }

  return QRectF(minX, minY, maxX - minX, maxY - minY);
}
QwtDoubleRect QwtErrorPlotCurve::boundingRect() const
{
	QwtDoubleRect rect = QwtPlotCurve::boundingRect();

	int size = dataSize();

	QwtArray <double> X(size), Y(size), min(size), max(size);
	for (int i=0; i<size; i++)
	{
		X[i]=x(i);
		Y[i]=y(i);
		if (type == Vertical)
		{
			min[i] = y(i) - err[i];
			max[i] = y(i) + err[i];
		}
		else
		{
			min[i] = x(i) - err[i];
			max[i] = x(i) + err[i];
		}
	}

	QwtArrayData *erMin, *erMax;
	if (type == Vertical)
	{
		erMin=new QwtArrayData(X, min);
		erMax=new QwtArrayData(X, max);
	}
	else
	{
		erMin=new QwtArrayData(min, Y);
		erMax=new QwtArrayData(max, Y);
	}

	QwtDoubleRect minrect = erMin->boundingRect();
	QwtDoubleRect maxrect = erMax->boundingRect();

	rect.setTop(QMIN(minrect.top(), maxrect.top()));
	rect.setBottom(QMAX(minrect.bottom(), maxrect.bottom()));
	rect.setLeft(QMIN(minrect.left(), maxrect.left()));
	rect.setRight(QMAX(minrect.right(), maxrect.right()));

	delete erMin;
	delete erMax;

	return rect;
}
Esempio n. 24
0
QwtDoubleRect QwtBarCurve::boundingRect() const {
  QwtDoubleRect rect = QwtPlotCurve::boundingRect();
  double n = (double)dataSize();

  if (bar_style == Vertical) {
    double dx = (rect.right() - rect.left()) / n;
    rect.setLeft(rect.left() - dx);
    rect.setRight(rect.right() + dx);
  } else {
    double dy = (rect.bottom() - rect.top()) / n;
    rect.setTop(rect.top() - dy);
    rect.setBottom(rect.bottom() + dy);
  }

  return rect;
}
Esempio n. 25
0
void QQmlVMEVariant::cleanup()
{
    if (type == QVariant::Invalid) {
    } else if (type == QMetaType::Int ||
               type == QMetaType::Bool ||
               type == QMetaType::Double) {
        type = QVariant::Invalid;
    } else if (type == QMetaType::QObjectStar) {
        ((QQmlVMEVariantQObjectPtr*)dataPtr())->~QQmlVMEVariantQObjectPtr();
        type = QVariant::Invalid;
    } else if (type == QMetaType::QString) {
        ((QString *)dataPtr())->~QString();
        type = QVariant::Invalid;
    } else if (type == QMetaType::QUrl) {
        ((QUrl *)dataPtr())->~QUrl();
        type = QVariant::Invalid;
    } else if (type == QMetaType::QTime) {
        ((QTime *)dataPtr())->~QTime();
        type = QVariant::Invalid;
    } else if (type == QMetaType::QDate) {
        ((QDate *)dataPtr())->~QDate();
        type = QVariant::Invalid;
    } else if (type == QMetaType::QDateTime) {
        ((QDateTime *)dataPtr())->~QDateTime();
        type = QVariant::Invalid;
    } else if (type == QMetaType::QRectF) {
        ((QRectF *)dataPtr())->~QRectF();
        type = QVariant::Invalid;
    } else if (type == QMetaType::QPointF) {
        ((QPointF *)dataPtr())->~QPointF();
        type = QVariant::Invalid;
    } else if (type == QMetaType::QSizeF) {
        ((QSizeF *)dataPtr())->~QSizeF();
        type = QVariant::Invalid;
    } else if (type == qMetaTypeId<QVariant>()) {
        ((QVariant *)dataPtr())->~QVariant();
        type = QVariant::Invalid;
    } else if (type == qMetaTypeId<QJSValue>()) {
        ((QJSValue *)dataPtr())->~QJSValue();
        type = QVariant::Invalid;
    } else {
        if (QQml_valueTypeProvider()->destroyValueType(type, dataPtr(), dataSize())) {
            type = QVariant::Invalid;
        }
    }
}
Esempio n. 26
0
Status WiredTigerRecordStore::truncate(OperationContext* txn) {
    WiredTigerCursor startWrap(_uri, _tableId, true, txn);
    WT_CURSOR* start = startWrap.get();
    int ret = WT_OP_CHECK(start->next(start));
    // Empty collections don't have anything to truncate.
    if (ret == WT_NOTFOUND) {
        return Status::OK();
    }
    invariantWTOK(ret);

    WT_SESSION* session = WiredTigerRecoveryUnit::get(txn)->getSession(txn)->getSession();
    invariantWTOK(WT_OP_CHECK(session->truncate(session, NULL, start, NULL, NULL)));
    _changeNumRecords(txn, -numRecords(txn));
    _increaseDataSize(txn, -dataSize(txn));

    return Status::OK();
}
Esempio n. 27
0
void QwtPieCurve::initLabels() {
  int size = abs(d_end_row - d_start_row) + 1;
  int dataPoints = dataSize();
  double sum = 0.0;
  for (int i = 0; i < dataPoints; i++)
    sum += y(i);

  Plot *d_plot = static_cast<Plot *>(plot());
  QLocale locale = d_plot->locale();
  for (int i = 0; i < size; i++) {
    PieLabel *l = new PieLabel(d_plot, this);
    d_texts_list << l;
    if (i < dataPoints)
      l->setText(locale.toString(y(i) / sum * 100, 'g', 4) + "%");
    else
      l->hide();
  }
}
Esempio n. 28
0
void
SamplingCurve::drawSeries(QPainter *p,
		const QwtScaleMap &xMap, const QwtScaleMap &yMap,
		const QRectF &canvasRect, int from, int to) const
{
    int okFrom, okTo = from;
    int size = (to > 0) ? to : dataSize();

    while (okTo < size) {
	okFrom = okTo;
	while (qIsNaN(sample(okFrom).y()) && okFrom < size)
	    ++okFrom;
	okTo = okFrom;
	while (!qIsNaN(sample(okTo).y()) && okTo < size)
	    ++okTo;
	if (okFrom < size)
	    QwtPlotCurve::drawSeries(p, xMap, yMap, canvasRect, okFrom, okTo-1);
    }
}
Esempio n. 29
0
/*!
  \return Bounding rectangle of all samples.
  For an empty series the rectangle is invalid.
*/
QRectF QwtPlotBarChart::boundingRect() const
{
    const size_t numSamples = dataSize();
    if ( numSamples == 0 )
        return QwtPlotSeriesItem::boundingRect();

    const double baseLine = baseline();

    QRectF rect = QwtPlotSeriesItem::boundingRect();
    if ( rect.bottom() < baseLine )
        rect.setBottom( baseLine );
    if ( rect.top() > baseLine )
        rect.setTop( baseLine );

    if ( rect.isValid() && ( orientation() == Qt::Horizontal ) )
        rect.setRect( rect.y(), rect.x(), rect.height(), rect.width() );

    return rect;
}
Esempio n. 30
0
QwtDoubleRect QwtBarCurve::boundingRect() const
{
QwtDoubleRect rect = QwtCurve::boundingRect();
double n= (double)dataSize();

if (bar_style == Vertical)
	{	
	double dx=(rect.x2()-rect.x1())/n;
	rect.setX1(rect.x1()-dx);
	rect.setX2(rect.x2()+dx);
	}
else
	{	
	double dy=(rect.y2()-rect.y1())/n;
	rect.setY1(rect.y1()-dy);
	rect.setY2(rect.y2()+dy);
	}
	
return rect;
}