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


C++ QCPRange::size方法代码示例

本文整理汇总了C++中QCPRange::size方法的典型用法代码示例。如果您正苦于以下问题:C++ QCPRange::size方法的具体用法?C++ QCPRange::size怎么用?C++ QCPRange::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QCPRange的用法示例。


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

示例1: scaleRulesForAxis

void RgbImageWindow::scaleRulesForAxis(QCPAxis *axis, double rangeUpper, QCPRange newRange, QCPRange oldRange)
{

    QCPRange boundedRange = newRange;
    double lowerRangeBound = 0;
    double upperRangeBound = rangeUpper;
    const int MAX_ZOOM = 4;
    if((upperRangeBound - lowerRangeBound)/boundedRange.size() > MAX_ZOOM)
    {
        axis->setRange(oldRange);
        return;
    }

    if (boundedRange.size() > upperRangeBound-lowerRangeBound)
    {
        boundedRange = QCPRange(lowerRangeBound, upperRangeBound);
    } else
    {
        double oldSize = boundedRange.size();
        if (boundedRange.lower < lowerRangeBound)
        {
            boundedRange.lower = lowerRangeBound;
            boundedRange.upper = lowerRangeBound+oldSize;
        }
        if (boundedRange.upper > upperRangeBound)
        {
            boundedRange.lower = upperRangeBound-oldSize;
            boundedRange.upper = upperRangeBound;
        }
    }
    axis->setRange(boundedRange);
}
开发者ID:remsens,项目名称:Peleng,代码行数:32,代码来源:rgbimagewindow.cpp

示例2: tickStep

double ProfilePlotView::tickStep(const QCPRange & range, int nSteps)
{
	double step = range.size() / (double)(nSteps+1e-10);
	double factor = qPow(10.0, qFloor(qLn(step) / qLn(10.0)));
	double mantissa = step / factor;

	if (mantissa >= 7)
	{
		factor *= 10.0;
		step = 1;
	}
	else if (mantissa >= 5)
		step = 5;
	else if (mantissa >= 2)
		step = 2;
	else if (mantissa >= 1)
		step = 1;
	else
	{
		factor /= 10.0;
		step = 5;
	}

	return step * factor;
}
开发者ID:asymworks,项目名称:benthos-app,代码行数:25,代码来源:profile_plot.cpp

示例3: onXRangeChanged

void MainWindow::onXRangeChanged(const QCPRange newRange, const QCPRange oldRange)
{
    double newSize = newRange.size();
    bool sizeToSmall = false;

    /* Plot range can't be larger than the time elapsed */
    if (newSize > (plotXAxis_maxRange - plotXAxis_minRange))
        newSize = plotXAxis_maxRange - plotXAxis_minRange;

    /* Don't want the plot to zoom to much */
    else if (newSize < 0.5)
        sizeToSmall = true;

    for (int i = 0; i < controller->getNumSensors(); i++) {
        /* Plot range can't go below the minimal value */
        if (newRange.lower < plotXAxis_minRange) {
            ui->plot_sensors->axisRect(i)->axis(QCPAxis::atBottom)->setRange(plotXAxis_minRange, plotXAxis_minRange + newSize);
            ui->plot_CoM->axisRect()->axis(QCPAxis::atBottom)->setRange(plotXAxis_minRange, plotXAxis_minRange + newSize);
        }

        /* Plot range can't go above the maximal value */
        else if (newRange.upper > plotXAxis_maxRange) {
            ui->plot_sensors->axisRect(i)->axis(QCPAxis::atBottom)->setRange(plotXAxis_maxRange - newSize, plotXAxis_maxRange);
            ui->plot_CoM->axisRect()->axis(QCPAxis::atBottom)->setRange(plotXAxis_maxRange - newSize, plotXAxis_maxRange);
        }

        /* Plot can't zoom infinitely */
        else if (sizeToSmall) {
            ui->plot_sensors->axisRect(i)->axis(QCPAxis::atBottom)->setRange(oldRange.lower, oldRange.upper);
            ui->plot_CoM->axisRect()->axis(QCPAxis::atBottom)->setRange(oldRange.lower, oldRange.upper);
            newSize = oldRange.size();
        }
    }

    ui->plot_sensors->replot();
    ui->plot_CoM->replot();

    /* Adjust the horizontal drag sliders */
    ui->plot_horizontalDrag->setRange(plotXAxis_minRange + newSize / 2, plotXAxis_maxRange - newSize / 2);
    ui->plot_horizontalDrag->setValue(ui->plot_sensors->axisRect()->axis(QCPAxis::atBottom)->range().lower + newSize / 2);

    ui->plotCoM_horizontalDrag->setRange(plotXAxis_minRange + newSize / 2, plotXAxis_maxRange - newSize / 2);
    ui->plotCoM_horizontalDrag->setValue(ui->plot_sensors->axisRect()->axis(QCPAxis::atBottom)->range().lower + newSize / 2);
}
开发者ID:Burn2539,项目名称:CoRo_PW_Qt,代码行数:44,代码来源:mainwindow.cpp

示例4: on_horizontalSlider_valueChanged

void Window::on_horizontalSlider_valueChanged(int value)
{
    QCPRange range = ui->plot->xAxis->range();

    double real_size = range.size() / old_x_slider_scale;
    double new_size = real_size * value;

    old_x_slider_scale = value;

    ui->plot->xAxis->setRange(QCPRange(range.center() - new_size / 2, range.center() + new_size / 2));
    ui->plot->xAxis2->setRange(QCPRange(range.center() - new_size / 2, range.center() + new_size / 2));
    ui->plot->replot();
}
开发者ID:romcsmv,项目名称:Rasp,代码行数:13,代码来源:window.cpp

示例5: integerTickStepCase_yRangeChanged

void MainWindow::integerTickStepCase_yRangeChanged(QCPRange newRange)
{
	// Generate tick positions according to linear scaling:
	double mTickStep = newRange.size()/(double)(5+1e-10); // mAutoTickCount ticks on average, the small addition is to prevent jitter on exact integers
	double magnitudeFactor = qPow(10.0, qFloor(qLn(mTickStep)/qLn(10.0))); // get magnitude factor e.g. 0.01, 1, 10, 1000 etc.
	double tickStepMantissa = mTickStep/magnitudeFactor;
	if (tickStepMantissa < 5)
	{
		// round digit after decimal point to 0.5
		mTickStep = (int)(tickStepMantissa*2)/2.0*magnitudeFactor;
	} else
	{
		// round to first digit in multiples of 2
		mTickStep = (int)((tickStepMantissa/10.0)*5)/5.0*10*magnitudeFactor;
	}
	mCustomPlot->yAxis->setTickStep(qCeil(mTickStep));
}
开发者ID:shenglonglinapple,项目名称:slin_code,代码行数:17,代码来源:mainwindow.cpp

示例6: yAxisChanged

void MainWindow::yAxisChanged(QCPRange range)
{
    ui->verticalScrollBar->setValue(qRound(-range.center()*100.0)); // adjust position of scroll bar slider
    ui->verticalScrollBar->setPageStep(qRound(range.size()*100.0)); // adjust size of scroll bar slider
}
开发者ID:tikhoncheva,项目名称:work,代码行数:5,代码来源:mainwindow.cpp

示例7:

void AP2DataPlot2D::xAxisChanged(QCPRange range)
{
    ui.horizontalScrollBar->setValue(qRound(range.center())); // adjust position of scroll bar slider
    ui.horizontalScrollBar->setPageStep(qRound(range.size())); // adjust size of scroll bar slider
}
开发者ID:Blackflappybird,项目名称:apm_planner,代码行数:5,代码来源:AP2DataPlot2D.cpp

示例8: yAxisChanged

void SequenceDialog::yAxisChanged(QCPRange range)
{
    ui->verticalScrollBar->setValue(qRound(range.center()*100.0));
    ui->verticalScrollBar->setPageStep(qRound(range.size()*100.0));
}
开发者ID:JunichiWatanuki,项目名称:wireshark,代码行数:5,代码来源:sequence_dialog.cpp

示例9: xAxisChanged

void ChartPage::xAxisChanged(QCPRange range)
{
  ui->horizontalScrollBar->setValue(qRound(range.center()/1000000.0)); // adjust position of scroll bar slider
  ui->horizontalScrollBar->setPageStep(qRound(range.size()*1000000.0)); // adjust size of scroll bar slider
}
开发者ID:unitecoin-org,项目名称:Unitecoin,代码行数:5,代码来源:chartpage.cpp

示例10: yAxisChanged

void LBMUIMFlowDialog::yAxisChanged(QCPRange range)
{
    m_ui->verticalScrollBar->setValue(qRound(range.center() * 100.0));
    m_ui->verticalScrollBar->setPageStep(qRound(range.size() * 100.0));
}
开发者ID:appneta,项目名称:wireshark,代码行数:5,代码来源:lbm_uimflow_dialog.cpp


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