当前位置: 首页>>代码示例>>C++>>正文


C++ qwtMax函数代码示例

本文整理汇总了C++中qwtMax函数的典型用法代码示例。如果您正苦于以下问题:C++ qwtMax函数的具体用法?C++ qwtMax怎么用?C++ qwtMax使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了qwtMax函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: qwtMin

void PreviewPlot2D::onZoomRec(const QMouseEvent& e)
{
    // some shortcuts
    int axl= QwtPlot::yLeft, axb= QwtPlot::xBottom;
 
	// Don't invert any scales which aren't inverted
	int x1 = qwtMin(memPoint.x(), e.pos().x());
    int x2 = qwtMax(memPoint.x(), e.pos().x());
    int y1 = qwtMin(memPoint.y(), e.pos().y());
    int y2 = qwtMax(memPoint.y(), e.pos().y());
        
	// limit selected area to a minimum of 11x11 points
	int lim = 5 - (y2 - y1) / 2;
	if (lim > 0)
	{
		y1 -= lim;
		y2 += lim;
	}
	lim = 5 - (x2 - x1 + 1) / 2;
	if (lim > 0)
	{
		x1 -= lim;
		x2 += lim;
	}
        
	// Set fixed scales
	if(!autoscaleY)
		pPlot->setAxisScale(axl, pPlot->invTransform(axl,y1), pPlot->invTransform(axl,y2));
	if(!autoscaleX)
		pPlot->setAxisScale(axb, pPlot->invTransform(axb,x1), pPlot->invTransform(axb,x2));
	pPlot->replot();
}
开发者ID:cseyve,项目名称:piaf,代码行数:32,代码来源:previewplot2d.cpp

示例2: getBorderDistHint

/*!
  \return a minimum size hint
*/
QSize QwtScaleWidget::minimumSizeHint() const
{
    const Qt::Orientation o = d_data->scaleDraw->orientation();

    // Border Distance cannot be less than the scale borderDistHint
    // Note, the borderDistHint is already included in minHeight/minWidth
    int length = 0;
    int mbd1, mbd2;
    getBorderDistHint(mbd1, mbd2);
    length += qwtMax( 0, d_data->borderDist[0] - mbd1 );
    length += qwtMax( 0, d_data->borderDist[1] - mbd2 );
    length += d_data->scaleDraw->minLength(
        QPen(Qt::black, d_data->penWidth), font());

    int dim = dimForLength(length, font());
    if ( length < dim )
    {
        // compensate for long titles
        length = dim;
        dim = dimForLength(length, font());
    }

    QSize size(length + 2, dim);
    if ( o == Qt::Vertical )
        size.transpose();

    return size;
}
开发者ID:BackupTheBerlios,项目名称:qtiplot-svn,代码行数:31,代码来源:qwt_scale_widget.cpp

示例3: viewport

/*!
  Adjust contents widget and item layout to the size of the viewport().
*/
void QwtLegend::layoutContents()
{
    const QSize visibleSize = d_data->view->viewport()->size();

    const QLayout *l = d_data->view->contentsWidget->layout();
    if ( l && l->inherits("QwtDynGridLayout") )
    {
        const QwtDynGridLayout *tl = (const QwtDynGridLayout *)l;

        const int minW = int(tl->maxItemWidth()) + 2 * tl->margin();

        int w = qwtMax(visibleSize.width(), minW);
        int h = qwtMax(tl->heightForWidth(w), visibleSize.height());

        const int vpWidth = d_data->view->viewportSize(w, h).width();
        if ( w > vpWidth )
        {
            w = qwtMax(vpWidth, minW);
            h = qwtMax(tl->heightForWidth(w), visibleSize.height());
        }

        d_data->view->contentsWidget->resize(w, h);
#if QT_VERSION < 0x040000
        d_data->view->resizeContents(w, h);
#endif
    }
}
开发者ID:BackupTheBerlios,项目名称:qtiplot-svn,代码行数:30,代码来源:qwt_legend.cpp

示例4: extent

/*!
   Calculate the minimum length that is needed to draw the scale

   \param pen Pen that is used for painting backbone and ticks
   \param font Font used for painting the labels

   \sa extent()
*/
int QwtScaleDraw::minLength(const QPen &pen, const QFont &font) const
{
    int startDist, endDist;
    getBorderDistHint(font, startDist, endDist);

    const QwtScaleDiv &sd = scaleDiv();

    const uint minorCount =
        sd.ticks(QwtScaleDiv::MinorTick).count() +
        sd.ticks(QwtScaleDiv::MediumTick).count();
    const uint majorCount =
        sd.ticks(QwtScaleDiv::MajorTick).count();

    int lengthForLabels = 0;
    if ( hasComponent(QwtAbstractScaleDraw::Labels) )
    {
        if ( majorCount >= 2 )
            lengthForLabels = minLabelDist(font) * (majorCount - 1);
    }

    int lengthForTicks = 0;
    if ( hasComponent(QwtAbstractScaleDraw::Ticks) )
    {
        const int pw = qwtMax( 1, pen.width() );  // penwidth can be zero
        lengthForTicks = 2 * (majorCount + minorCount) * pw;
    }

    return startDist + endDist + qwtMax(lengthForLabels, lengthForTicks);
}
开发者ID:szmurlor,项目名称:fiver,代码行数:37,代码来源:qwt_scale_draw.cpp

示例5: qwtMin

int TimelineWidget::transform(double value) const
{
   const double min = qwtMin(mpD->map.s1(), mpD->map.s2());
   const double max = qwtMax(mpD->map.s1(), mpD->map.s2());
   value = qwtMax(qwtMin(value, max), min);
   return mpD->map.transform(value);
}
开发者ID:Siddharthk,项目名称:coan,代码行数:7,代码来源:TimelineWidget.cpp

示例6: minLength

/*!
   Calculate the width/height that is needed for a
   vertical/horizontal scale.

   The extent is calculated from the pen width of the backbone,
   the major tick length, the spacing and the maximum width/height
   of the labels.

   \param pen Pen that is used for painting backbone and ticks
   \param font Font used for painting the labels

   \sa minLength()
*/
int QwtScaleDraw::extent(const QPen &pen, const QFont &font) const
{
    int d = 0;

    if ( hasComponent(QwtAbstractScaleDraw::Labels) )
    {
        if ( orientation() == Qt::Vertical )
            d = maxLabelWidth(font);
        else
            d = maxLabelHeight(font);

        if ( d > 0 )
            d += spacing();
    }

    if ( hasComponent(QwtAbstractScaleDraw::Ticks) )
    {
        d += majTickLength();
    }

    if ( hasComponent(QwtAbstractScaleDraw::Backbone) )
    {
        const int pw = qwtMax( 1, pen.width() );  // penwidth can be zero
        d += pw;
    }

    d = qwtMax(d, minimumExtent());
    return d;
}
开发者ID:szmurlor,项目名称:fiver,代码行数:42,代码来源:qwt_scale_draw.cpp

示例7: interval

/*!
    Align and divide an interval

   \param maxNumSteps Max. number of steps
   \param x1 First limit of the interval (In/Out)
   \param x2 Second limit of the interval (In/Out)
   \param stepSize Step size (Out)

   \sa QwtScaleEngine::setAttribute()
*/
void QwtLog10ScaleEngine::autoScale(int maxNumSteps, 
    double &x1, double &x2, double &stepSize) const
{
    if ( x1 > x2 )
        qSwap(x1, x2);

    QwtDoubleInterval interval(x1 / pow(10.0, lowerMargin()), 
        x2 * pow(10.0, upperMargin()) );

    if (interval.maxValue() / interval.minValue() < 10.0)
    {
        // scale width is less than one decade -> build linear scale

        QwtLinearScaleEngine linearScaler;
        linearScaler.setAttributes(attributes());
        linearScaler.setReference(reference());
        linearScaler.setMargins(lowerMargin(), upperMargin());

        linearScaler.autoScale(maxNumSteps, x1, x2, stepSize);
        stepSize = ::log10(stepSize);

        return;
    }

    double logRef = 1.0;
    if (reference() > LOG_MIN / 2)
        logRef = qwtMin(reference(), LOG_MAX / 2);

    if (testAttribute(QwtScaleEngine::Symmetric))
    {
        const double delta = qwtMax(interval.maxValue() / logRef,  
            logRef / interval.minValue());
        interval.setInterval(logRef / delta, logRef * delta);
    }

    if (testAttribute(QwtScaleEngine::IncludeReference))
        interval = interval.extend(logRef);

    interval = interval.limited(LOG_MIN, LOG_MAX);

    if (interval.width() == 0.0)
        interval = buildInterval(interval.minValue());

    stepSize = divideInterval(log10(interval).width(), qwtMax(maxNumSteps, 1));
    if ( stepSize < 1.0 )
        stepSize = 1.0;

    if (!testAttribute(QwtScaleEngine::Floating))
        interval = align(interval, stepSize);

    x1 = interval.minValue();
    x2 = interval.maxValue();

    if (testAttribute(QwtScaleEngine::Inverted))
    {
        qSwap(x1, x2);
        stepSize = -stepSize;
    }
}
开发者ID:BackupTheBerlios,项目名称:qtiplot-svn,代码行数:69,代码来源:qwt_scale_engine.cpp

示例8: qwtMax

int DiMap::limTransform(double x) const
{
	if (x > qwtMax(d_x1, d_x2))
		x = qwtMax(d_x1, d_x2);
	else if (x < qwtMin(d_x1, d_x2))
		x = qwtMin(d_x1, d_x2);
	return transform(x);
}
开发者ID:ViktorNova,项目名称:los,代码行数:8,代码来源:dimap.cpp

示例9: QwtDoubleSize

/*!
    Returns a size with the maximum width and height of this
    size and other.
*/
QwtDoubleSize QwtDoubleSize::expandedTo(
    const QwtDoubleSize &other) const
{
    return QwtDoubleSize(
        qwtMax(d_width, other.d_width),
        qwtMax(d_height, other.d_height)
    );
}
开发者ID:luisMbedder,项目名称:SpectrumScan,代码行数:12,代码来源:qwt_double_rect.cpp

示例10: QRect

QRect QwtPicker::trackerRect(QPainter *painter) const
{
    if ( trackerMode() == AlwaysOff || 
        (trackerMode() == ActiveOnly && !isActive() ) )
    {
        return QRect();
    }

    if ( d_data->labelPosition.x() < 0 || d_data->labelPosition.y() < 0 )
        return QRect();

    QwtText text = trackerText(d_data->labelPosition);
    if ( text.isEmpty() )
        return QRect();

    QRect textRect(QPoint(0, 0), text.textSize(painter->font()));

    const QPoint &pos = d_data->labelPosition;

    int alignment = 0;
    if ( isActive() && d_data->selection.count() > 1 
        && rubberBand() != NoRubberBand )
    {
        const QPoint last = 
            d_data->selection[int(d_data->selection.count()) - 2];

        alignment |= (pos.x() >= last.x()) ? Qt::AlignRight : Qt::AlignLeft;
        alignment |= (pos.y() > last.y()) ? Qt::AlignBottom : Qt::AlignTop;
    }
    else
        alignment = Qt::AlignTop | Qt::AlignRight;

    const int margin = 5;

    int x = pos.x();
    if ( alignment & Qt::AlignLeft )
        x -= textRect.width() + margin;
    else if ( alignment & Qt::AlignRight )
        x += margin;

    int y = pos.y();
    if ( alignment & Qt::AlignBottom )
        y += margin;
    else if ( alignment & Qt::AlignTop )
        y -= textRect.height() + margin;
    
    textRect.moveTopLeft(QPoint(x, y));

    int right = qwtMin(textRect.right(), pickRect().right() - margin);
    int bottom = qwtMin(textRect.bottom(), pickRect().bottom() - margin);
    textRect.moveBottomRight(QPoint(right, bottom));

    int left = qwtMax(textRect.left(), pickRect().left() + margin);
    int top = qwtMax(textRect.top(), pickRect().top() + margin);
    textRect.moveTopLeft(QPoint(left, top));

    return textRect;
}
开发者ID:chongle,项目名称:prorata,代码行数:58,代码来源:qwt_picker.cpp

示例11: interval

/*!
    Align and divide an interval

   \param maxNumSteps Max. number of steps
   \param x1 First limit of the interval (In/Out)
   \param x2 Second limit of the interval (In/Out)
   \param stepSize Step size (Out)

   \sa QwtScaleEngine::setAttribute
*/
void LogTimeScaleEngine::autoScale(int maxNumSteps, 
    double &x1, double &x2, double &stepSize) const
{
    if ( x1 > x2 )
        qSwap(x1, x2);

    QwtDoubleInterval interval(
                               
     #if (QWT_VERSION >= 0x050200)
            x1 / pow(10.0, lowerMargin()), 
            x2 * pow(10.0, upperMargin())
     #else
            x1 / pow(10.0, loMargin()), 
            x2 * pow(10.0, hiMargin())
    #endif
    );

    double logRef = 1.0;
    if (reference() > LOG_MIN / 2)
        logRef = qwtMin(reference(), LOG_MAX / 2);

    if (testAttribute(QwtScaleEngine::Symmetric))
    {
        const double delta = qwtMax(interval.maxValue() / logRef,  
            logRef / interval.minValue());
        interval.setInterval(logRef / delta, logRef * delta);
    }

    if (testAttribute(QwtScaleEngine::IncludeReference))
        interval = interval.extend(logRef);

    interval = interval.limited(LOG_MIN, LOG_MAX);

    if (interval.width() == 0.0)
        interval = buildInterval(interval.minValue());

    stepSize = divideInterval(log10(interval).width(), qwtMax(maxNumSteps, 1));
    if ( stepSize < 1.0 )
        stepSize = 1.0;

    if (!testAttribute(QwtScaleEngine::Floating))
        interval = align(interval, stepSize);

    x1 = interval.minValue();
    x2 = interval.maxValue();

    if (testAttribute(QwtScaleEngine::Inverted))
    {
        qSwap(x1, x2);
        stepSize = -stepSize;
    }
}
开发者ID:bodylinksystems,项目名称:GoldenCheetah,代码行数:62,代码来源:LogTimeScaleEngine.cpp

示例12: qwtMax

/*!
  Move the the current zoom rectangle.

  \param x X value
  \param y Y value

  \sa QwtDoubleRect::move
  \note The changed rectangle is limited by the zoom base
*/
void QwtPlotZoomer::move(double x, double y)
{
    x = qwtMax(x, zoomBase().left());
    x = qwtMin(x, zoomBase().right() - zoomRect().width());

    y = qwtMax(y, zoomBase().top());
    y = qwtMin(y, zoomBase().bottom() - zoomRect().height());

    if ( x != zoomRect().left() || y != zoomRect().top() )
    {
        d_data->zoomStack[d_data->zoomRectIndex].moveTo(x, y);
        rescale();
    }
}
开发者ID:chongle,项目名称:prorata,代码行数:23,代码来源:qwt_plot_zoomer.cpp

示例13: QwtDoubleRect

/*!
  Returns the intersection of this rectangle and rectangle other.
  Returns an empty rectangle if there is no intersection.
*/
QwtDoubleRect QwtDoubleRect::operator&(const QwtDoubleRect &other) const
{
    if (isNull() || other.isNull())
        return QwtDoubleRect();

    const QwtDoubleRect r1 = normalized();
    const QwtDoubleRect r2 = other.normalized();

    const double minX = qwtMax(r1.left(), r2.left());
    const double maxX = qwtMin(r1.right(), r2.right());
    const double minY = qwtMax(r1.top(), r2.top());
    const double maxY = qwtMin(r1.bottom(), r2.bottom());

    return QwtDoubleRect(minX, minY, maxX - minX, maxY - minY);
}
开发者ID:luisMbedder,项目名称:SpectrumScan,代码行数:19,代码来源:qwt_double_rect.cpp

示例14: qwtMin

/*!
  Returns the bounding rectangle of this rectangle and rectangle other.
  The bounding rectangle of a nonempty rectangle and an empty or
  invalid rectangle is defined to be the nonempty rectangle.
*/
QwtDoubleRect QwtDoubleRect::operator|(const QwtDoubleRect &other) const
{
    if ( isEmpty() )
        return other;

    if ( other.isEmpty() )
        return *this;

    const double minX = qwtMin(d_left, other.d_left);
    const double maxX = qwtMax(d_right, other.d_right);
    const double minY = qwtMin(d_top, other.d_top);
    const double maxY = qwtMax(d_bottom, other.d_bottom);

    return QwtDoubleRect(minX, minY, maxX - minX, maxY - minY);
}
开发者ID:luisMbedder,项目名称:SpectrumScan,代码行数:20,代码来源:qwt_double_rect.cpp

示例15: cos

void Knob::drawMarker(QPainter *p, double arc, const QColor &c)
{

	QPen pn;
	int radius;
	double rb, re;
	double rarc;

	rarc = arc * M_PI / 180.0;
	double ca = cos(rarc);
	double sa = -sin(rarc);
	radius = kRect.width() / 2 - d_borderWidth;
	if (radius < 3) radius = 3;
	int ym = kRect.y() + radius + d_borderWidth;
	int xm = kRect.x() + radius + d_borderWidth;

	switch (d_symbol)
	{
		case Dot:

			p->setBrush(c);
			p->setPen(Qt::NoPen);
			rb = double(qwtMax(radius - 4 - d_dotWidth / 2, 0));
			p->drawEllipse(xm - int(rint(sa * rb)) - d_dotWidth / 2,
					ym - int(rint(ca * rb)) - d_dotWidth / 2,
					d_dotWidth, d_dotWidth);

			break;

		case Line:

			pn.setColor(c);
			pn.setWidth(3);
			p->setPen(pn);

			rb = qwtMax(double((radius - 4) / 3.0), 0.0);
			re = qwtMax(double(radius - 4), 0.0);

			p->drawLine(xm - int(rint(sa * rb)),
					ym - int(rint(ca * rb)),
					xm - int(rint(sa * re)),
					ym - int(rint(ca * re)));

			break;
	}


}
开发者ID:87maxi,项目名称:oom,代码行数:48,代码来源:knob.cpp


注:本文中的qwtMax函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。