SamplesPreviewWidget::SamplesPreviewWidget(const double *samples,
                                           size_t nSamples,
                                           unsigned int sampleFreq,
                                           QWidget *parent) :
    QWidget(parent),
    _playbackThread(NULL)
{
    setupUi();
    setSamples(samples, nSamples, sampleFreq);
}
Exemple #2
0
  void GaussModel::updateMembers_()
  {
    InterpolationModel::updateMembers_();

    min_ = param_.getValue("bounding_box:min");
    max_ = param_.getValue("bounding_box:max");
    statistics_.setMean(param_.getValue("statistics:mean"));
    statistics_.setVariance(param_.getValue("statistics:variance"));

    setSamples();
  }
Exemple #3
0
void SampleModel::resetModel(QVector<Sample *> sample_mass)
{
    beginResetModel();
    setHeaders();
    setWaterTypes();
    setLocation();
    setParams();
    setSamples(sample_mass);

    endResetModel();
}
// Fit a gussian and extract the parameters from it 
void FeatureGaborBlob::computeParams(){
	int nsamples = _blob.rows * _blob.cols ;
	Mat samples(nsamples, 3, CV_64F);
	Mat cov(3,3,CV_64F);
	Mat mean(3,3,CV_64F);
	Mat value(3,3, CV_64F);
	Mat vects(3,3, CV_64F);

	setSamples(samples); 
	calcCovarMatrix(samples, cov, mean, CV_COVAR_NORMAL|CV_COVAR_ROWS);
	eigen(cov, value, vects);
	_majorDirection = Point2f((float)vects.at<double>(0,0), (float)vects.at<double>(0,1)) ;
	_minorDirection = Point2f((float)vects.at<double>(1,0), (float)vects.at<double>(1,1)) ;
	setVolume() ;
}
 bool DDACEAlgorithmOptions_Impl::setSamplesForGrid(int numGridPartitions,const Problem& problem) {
   if (algorithmType() != DDACEAlgorithmType::grid) {
     LOG(Info,"This method only applies to the grid algorithm type, but '" << algorithmType() 
         << "' is selected.");
     return false;
   }
   if (!problem.allVariablesAreContinuousOrStaticTransformations()) {
     LOG(Info,"Problem '" << problem.name() << "' has un-ignorable discrete variables, which "
         << "means that the grid algorithm cannot be applied.");
     return false;
   }
   bool result = setSymbols(numGridPartitions);
   result = result && setSamples(static_cast<int>(std::pow((double)numGridPartitions,problem.numContinuousVariables())));
   return result;
 }
Exemple #6
0
void
QuasarConfig::slotDefaults()
{
    _changeStyle->setChecked(_config.changeStyle);
    _style->setEnabled(_config.changeStyle);
    _style->setCurrentItem(_config.style);
    _changeColor->setChecked(_config.changeColor);
    _color->setEnabled(_config.changeColor);
    _color->setPalette(QColor(_config.color));
    _changeFont->setChecked(_config.changeFont);
    _font->setEnabled(_config.changeFont);
    _font->font().fromString(_config.font);

    loadLocales();
    setSamples();
}
Exemple #7
0
void
QuasarConfig::slotLocaleChange()
{
    Locale locale;
    if (_locale->currentItem() == 0)
	locale = systemLocale;
    else
	locale = _locales[_locale->currentItem() - 1];

    QString localesDir = QuasarClient::localesDir();
    QString language(locale.getLanguage());
    QString country(locale.getCountry());

    bool found = false;
    QTranslator translator(0);
    if (!country.isEmpty()) {
	QString dir = localesDir + "/" + language + "_" + country;
	if (translator.load("messages.qm", dir))
	    found = true;
    }
    if (!found) {
	QString dir = localesDir + "/" + language;
	if (translator.load("messages.qm", dir))
	    found = true;
    }
    if (!found) {
	QString message = tr("Quasar has not been localized for this\n"
			     "locale so the text of the program will\n"
			     "not change but the date, time, number,\n"
			     "currency, and percent should be properly\n"
			     "localized.");
	QMessageBox::warning(this, tr("Warning"), message);
    }

    // Set default locale for ICU
    UErrorCode status = U_ZERO_ERROR;
    Locale::setDefault(locale, status);
    if (U_FAILURE(status)) {
	QString msg = tr("Failed setting locale to %1").arg(locale.getName());
	QMessageBox::critical(this, tr("Error"), msg);
    }

    loadLocales();
    setSamples();
}
  void ExtendedIsotopeModel::updateMembers_()
  {
    InterpolationModel::updateMembers_();

    charge_ = param_.getValue("charge");
    isotope_stdev_ = param_.getValue("isotope:stdev");
    monoisotopic_mz_ = param_.getValue("isotope:monoisotopic_mz");
    max_isotope_ = param_.getValue("isotope:maximum");
    trim_right_cutoff_ = param_.getValue("isotope:trim_right_cutoff");
    isotope_distance_ = param_.getValue("isotope:distance");

    averagine_[C] = param_.getValue("averagines:C");
    averagine_[H] = param_.getValue("averagines:H");
    averagine_[N] = param_.getValue("averagines:N");
    averagine_[O] = param_.getValue("averagines:O");
    averagine_[S] = param_.getValue("averagines:S");

    setSamples();
  }
Exemple #9
0
  /**
   * Construct the importer.
   *
   * @param inputName The name of the input image
   */
  TiffImporter::TiffImporter(FileName inputName) : ImageImporter(inputName) {
    // Open the TIFF image
    m_image = NULL;
    if ((m_image = TIFFOpen(inputName.expanded().toAscii().data(), "r")) == NULL) {
      throw IException(IException::Programmer,
          "Could not open incoming image", _FILEINFO_);
    }

    // Get its constant dimensions.  Note, height seems to get reset to 0 if
    // called before setting width.
    uint32 height;
    TIFFGetField(m_image, TIFFTAG_IMAGELENGTH, &height);
    setLines(height);

    uint32 width;
    TIFFGetField(m_image, TIFFTAG_IMAGEWIDTH, &width);
    setSamples(width);

    TIFFGetField(m_image, TIFFTAG_SAMPLESPERPIXEL, &m_samplesPerPixel);

    // Setup the width and height of the image
    unsigned long imagesize = lines() * samples();
    m_raster = NULL;
    if ((m_raster = (uint32 *) malloc(sizeof(uint32) * imagesize)) == NULL) {
      throw IException(IException::Programmer,
          "Could not allocate enough memory", _FILEINFO_);
    }

    // Read the image into the memory buffer
    if (TIFFReadRGBAImage(m_image, samples(), lines(), m_raster, 0) == 0) {
      throw IException(IException::Programmer,
          "Could not read image", _FILEINFO_);
    }

    // Deal with photometric interpretations
    if (TIFFGetField(m_image, TIFFTAG_PHOTOMETRIC, &m_photo) == 0) {
      throw IException(IException::Programmer,
          "Image has an undefined photometric interpretation", _FILEINFO_);
    }

    setDefaultBands();
  }
Exemple #10
0
void Plot2DHistogram::setData ( std::vector<std::pair<double,double> > dataVector ){
    int dataCount = dataVector.size();
    m_maxValueY = -1;
    m_minValueY = std::numeric_limits<double>::max();
    m_data.clear();
    for ( int i = 0; i < dataCount-1; i++ ){
        //Only add in nonzero counts
        if ( dataVector[i].second > 0 ){
            QwtIntervalSample sample( dataVector[i].second, dataVector[i].first, dataVector[i+1].first );
            m_data.push_back( sample );
            if ( dataVector[i].second > m_maxValueY ){
                m_maxValueY = dataVector[i].second;
            }
            if ( dataVector[i].second < m_minValueY ){
                m_minValueY = dataVector[i].second;
            }
        }
    }
    setSamples( m_data );
}
Exemple #11
0
bool HMC5883L::begin()
{
    Wire.begin();

    if ((fastRegister8(HMC5883L_REG_IDENT_A) != 0x48)
    || (fastRegister8(HMC5883L_REG_IDENT_B) != 0x34)
    || (fastRegister8(HMC5883L_REG_IDENT_C) != 0x33))
    {
	return false;
    }

    setRange(HMC5883L_RANGE_1_3GA);
    setMeasurementMode(HMC5883L_CONTINOUS);
    setDataRate(HMC5883L_DATARATE_15HZ);
    setSamples(HMC5883L_SAMPLES_1);

    mgPerDigit = 0.92f;

    return true;
}
Exemple #12
0
KJScope::KJScope(const QStringList &l, KJLoader *parent)
	: KJVisScope(parent), MonoScope(50)/*, blurnum(0), mOsci(0)*/
{
	int x=l[1].toInt();
	int y=l[2].toInt();
	int xs = mWidth = l[3].toInt()-x;
	int ys = mHeight = l[4].toInt()-y;

	blurnum = 0;

//	kdDebug(66666) << "Analyzer Window " << x << "," << y << " " << mWidth << "," << mHeight << endl;

	if ( parent->exist("analyzercolor") )
	{
		QStringList &col = parser()["analyzercolor"];
		mColor.setRgb ( col[1].toInt(), col[2].toInt(), col[3].toInt() );
	}
	else // FIXME: what should be default colors for Vis?
		mColor.setRgb ( 255, 255, 255 );

	// background under vis
	QPixmap tmp  = parent->pixmap(parent->item("backgroundimage")[1]);
	mBack = new KPixmap ( QSize(xs,ys) );
	bitBlt( mBack, 0, 0, &tmp, x, y, xs, ys, Qt::CopyROP );

	mOsci = new KPixmap ( QSize(xs,ys) );
	bitBlt( mOsci, 0, 0, &tmp, x, y, xs, ys, Qt::CopyROP );

	// create a gradient
	mGradient = new KPixmap ( QSize(xs,ys) );
	KPixmapEffect::gradient ( *mGradient, mColor.light(_KJ_GRADIENT_DIFF),
		mColor.dark(_KJ_GRADIENT_DIFF), KPixmapEffect::VerticalGradient );

	setRect ( x, y, xs, ys );

	// set the samplewidth to the largest integer divisible by mWidth
	setSamples ( xs );

	readConfig();
	start();
}
// Rework faceOnlySet samples.
// Take two consecutive samples
void Foam::midPointAndFaceSet::genSamples()
{
    // Generate midpoints and add to face points

    List<point> newSamplePoints(3*size());
    labelList newSampleCells(3*size());
    labelList newSampleFaces(3*size());
    labelList newSampleSegments(3*size());
    scalarList newSampleCurveDist(3*size());

    label newSampleI = 0;

    label sampleI = 0;

    while(true && size()>0)
    {
        // sampleI is start of segment

        // Add sampleI
        newSamplePoints[newSampleI] = operator[](sampleI);
        newSampleCells[newSampleI] = cells_[sampleI];
        newSampleFaces[newSampleI] = faces_[sampleI];
        newSampleSegments[newSampleI] = segments_[sampleI];
        newSampleCurveDist[newSampleI] = curveDist_[sampleI];
        newSampleI++;

        while
        (
            (sampleI < size() - 1)
         && (segments_[sampleI] == segments_[sampleI+1])
        )
        {
            // Add mid point
            const point mid = 0.5*(operator[](sampleI) + operator[](sampleI+1));

            label cell1 = getCell(faces_[sampleI], mid);
            label cell2 = getCell(faces_[sampleI+1], mid);

            if (cell1 != cell2)
            {
                FatalErrorIn("midPointAndFaceSet::genSamples()")
                    << "  sampleI:" << sampleI
                    << "  newSampleI:" << newSampleI
                    << "  pts[sampleI]:" << operator[](sampleI)
                    << "  face[sampleI]:" << faces_[sampleI]
                    << "  pts[sampleI+1]:" << operator[](sampleI+1)
                    << "  face[sampleI+1]:" << faces_[sampleI+1]
                    << "  cell1:" << cell1
                    << "  cell2:" << cell2
                    << abort(FatalError);
            }

            newSamplePoints[newSampleI] = mid;
            newSampleCells[newSampleI] = cell1;
            newSampleFaces[newSampleI] = -1;
            newSampleSegments[newSampleI] = segments_[sampleI];
            newSampleCurveDist[newSampleI] =
                mag(newSamplePoints[newSampleI] - start());

            newSampleI++;

            // Add sampleI+1
            newSamplePoints[newSampleI] = operator[](sampleI+1);
            newSampleCells[newSampleI] = cells_[sampleI+1];
            newSampleFaces[newSampleI] = faces_[sampleI+1];
            newSampleSegments[newSampleI] = segments_[sampleI+1];
            newSampleCurveDist[newSampleI] =
                mag(newSamplePoints[newSampleI] - start());

            newSampleI++;

            sampleI++;
        }

        if (sampleI == size() - 1)
        {
            break;
        }
        sampleI++;
    }

    newSamplePoints.setSize(newSampleI);
    newSampleCells.setSize(newSampleI);
    newSampleFaces.setSize(newSampleI);
    newSampleSegments.setSize(newSampleI);
    newSampleCurveDist.setSize(newSampleI);

    setSamples
    (
        newSamplePoints,
        newSampleCells,
        newSampleFaces,
        newSampleSegments,
        newSampleCurveDist
    );
}
void Foam::midPointSet::genSamples()
{
    // Generate midpoints.

    List<point> midPoints(2*size());
    labelList midCells(2*size());
    labelList midSegments(2*size());
    scalarList midCurveDist(2*size());

    label midI = 0;

    label sampleI = 0;

    while(true && size()>0)
    {
        // calculate midpoint between sampleI and sampleI+1 (if in same segment)
        while
        (
            (sampleI < size() - 1)
         && (segments_[sampleI] == segments_[sampleI+1])
        )
        {
            midPoints[midI] =
                0.5*(operator[](sampleI) + operator[](sampleI+1));

            label cell1 = getCell(faces_[sampleI], midPoints[midI]);
            label cell2 = getCell(faces_[sampleI+1], midPoints[midI]);

            if (cell1 != cell2)
            {
                FatalErrorInFunction
                    << "  midI:" << midI
                    << "  sampleI:" << sampleI
                    << "  pts[sampleI]:" << operator[](sampleI)
                    << "  face[sampleI]:" << faces_[sampleI]
                    << "  pts[sampleI+1]:" << operator[](sampleI+1)
                    << "  face[sampleI+1]:" << faces_[sampleI+1]
                    << "  cell1:" << cell1
                    << "  cell2:" << cell2
                    << abort(FatalError);
            }

            midCells[midI] = cell1;
            midSegments[midI] = segments_[sampleI];
            midCurveDist[midI] = mag(midPoints[midI] - start());

            midI++;
            sampleI++;
        }

        if (sampleI == size() - 1)
        {
            break;
        }
        sampleI++;
    }

    midPoints.setSize(midI);
    midCells.setSize(midI);
    midSegments.setSize(midI);
    midCurveDist.setSize(midI);
    setSamples
    (
        midPoints,
        midCells,
        labelList(midCells.size(), -1),
        midSegments,
        midCurveDist
    );
}
Exemple #15
0
 Dataset::Dataset(const matrixd& x, const vectord& y):
   mMinIndex(0), mMaxIndex(0)
 {
   setSamples(x,y);
 };
//---------------------------------------------------------------------------
JrkPlotDialog::JrkPlotDialog(jrk_variables *indata, jrk_pid_variables *pid_indata, QWidget *parent) :
    QDialog(parent),
    ui(new Ui::JrkPlotDialog)
{
    int i;

    ui->setupUi(this);
    setLayout(ui->mainLayout);

    interval(200);
    history(10);
    setSamples();

    data_ptr = indata;
    pid_data_ptr = pid_indata;

    timeData = (double *) malloc(SAMPLES * sizeof(double));
    reset();

    ui->jrkPlot->setAutoReplot(false);
    ui->jrkPlot->canvas()->setBorderRadius(0);
    ui->jrkPlot->plotLayout()->setAlignCanvasToScales(true);
    ui->jrkPlot->setCanvasBackground(Qt::white);

    QwtLegend *legend = new QwtLegend;
    legend->setItemMode(QwtLegend::CheckableItem);
    ui->jrkPlot->insertLegend(legend, QwtPlot::RightLegend);

    ui->jrkPlot->setAxisTitle(QwtPlot::xBottom, "Seconds");
    ui->jrkPlot->setAxisScale(QwtPlot::xBottom, timeData[0], timeData[SAMPLES - 1]);

//    ui->jrkPlot->setAxisLabelRotation( QwtPlot::xBottom, -50.0 );
    ui->jrkPlot->setAxisLabelAlignment( QwtPlot::xBottom, Qt::AlignLeft | Qt::AlignBottom );
    QwtScaleWidget *scaleWidget = ui->jrkPlot->axisWidget(QwtPlot::xBottom);
    i = QFontMetrics(scaleWidget->font()).height();
    scaleWidget->setMinBorderDist(0, i / 2);

    ui->jrkPlot->setAxisTitle(QwtPlot::yLeft, "%");
    ui->jrkPlot->setAxisScale(QwtPlot::yLeft, -100, 100);

    // picker, panner, zoomer
    plot_picker = new QwtPlotPicker(QwtPlot::xBottom, QwtPlot::yLeft,
                                    QwtPlotPicker::CrossRubberBand, QwtPicker::AlwaysOn,
                                    ui->jrkPlot->canvas());
#if 0
    plot_picker->setStateMachine(new QwtPickerDragPointMachine());
    plot_picker->setRubberBandPen(QColor(Qt::black));
    plot_picker->setRubberBand(QwtPicker::CrossRubberBand );
#endif
    plot_picker->setTrackerPen(QColor(Qt::black));

    // panning with the left mouse button
    plot_panner = new QwtPlotPanner(ui->jrkPlot->canvas());
    plot_panner->setUpdatesEnabled(true);

    // zoom in/out with the wheel
    plot_zoomer = new QwtPlotMagnifier(ui->jrkPlot->canvas());

    // grid
    QwtPlotGrid *grid = new QwtPlotGrid;
    grid->enableXMin( true );
    grid->setMajPen(QPen(Qt::black, 0, Qt::DotLine));
    grid->setMinPen(QPen(Qt::black, 0, Qt::DotLine));
    grid->attach(ui->jrkPlot);

    // curves, scale is in %
    createCurve("Input",                Qt::gray,           false,  4095);
    createCurve("Target",               Qt::blue,           false,  4095);
    createCurve("Feedback",             Qt::darkBlue,       false,  4095);
    createCurve("Scaled feedback",      Qt::magenta,        false,  4095);
    createCurve("Error",                Qt::red,            true,   4095);
    createCurve("Integral",             Qt::darkGreen,      false,  1000);
    createCurve("Derivative",           Qt::yellow,         false,  1000);
    createCurve("Duty cycle target",    Qt::darkCyan,       false,  0600);
    createCurve("Duty cycle",           Qt::darkRed,        false,  0600);
    createCurve("Current",              Qt::black,          true,   0050);

    plot_timer = new QTimer(this);
    plot_timer->setInterval(INTERVAL);

    connect(plot_timer, SIGNAL(timeout()), this, SLOT(onUpdateGraph()));
    connect(ui->jrkPlot, SIGNAL(legendChecked(QwtPlotItem *, bool)),
            SLOT(showCurve(QwtPlotItem *, bool)));

#if 0
    connect(plot_picker, SIGNAL(moved(const QPoint &)),
            SLOT(picker_moved(const QPoint &)));
    connect(plot_picker, SIGNAL(selected(const QPolygon &)),
            SLOT(picker_selected(const QPolygon &)));
#endif

    connect(this, SIGNAL(finished(int)), this, SLOT(onFinished(int)));

//    plot_timer->start();
}
void ArnoldAnimationPatch::setPreviewSamples(int preview) {
    m_preview_samples = preview;
    if (m_mode == SimulationAnimationMode::INTERACTIVE)
        setSamples(m_preview_samples);
}
Exemple #18
0
// Constructors /////////////////////////////////////////////////////////////////
// Function that handles the creation and setup of instances
LM35Sensor::LM35Sensor(void) {
  // initialize this instance's variables
  setSamples(500);	
  setHighRes(false);
}
Exemple #19
0
LM35Sensor::LM35Sensor(int pSamples, bool pHighRes) {
  // initialize this instance's variables
  setSamples(pSamples);
  setHighRes(pHighRes);
}
Exemple #20
0
 virtual void updateSamples( double phase )
 {
     setSamples( d_transform.map( points( phase ) ) );
 }
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RicGridStatisticsDialog::setHistogramData(RimGridView* view)
{
    deletePlotItems(m_historgramPlot);
    deletePlotItems(m_aggregatedPlot);

    if (view && view->overlayInfoConfig())
    {
        Rim3dOverlayInfoConfig* overlayInfo = view->overlayInfoConfig();

        auto hist = new QwtPlotHistogram("Histogram");
        auto aggr = new QwtPlotCurve("Aggregated");

        hist->setBrush(QBrush(QColor(Qt::darkCyan)));
        hist->setZ(-1);
        aggr->setStyle(QwtPlotCurve::Steps);
        aggr->setCurveAttribute(QwtPlotCurve::Inverted);

        Rim3dOverlayInfoConfig::HistogramData histogramData = overlayInfo->histogramData();

        if (histogramData.isValid())
        {
            QVector<QwtIntervalSample> histSamples;
            QVector<QPointF> aggrSamples;
            double xStep = (histogramData.max - histogramData.min) / (*histogramData.histogram).size();
            double xCurr = histogramData.min;
            double aggrValue = 0.0;
            for (size_t value : *histogramData.histogram)
            {
                double xNext = xCurr + xStep;
                histSamples.push_back(QwtIntervalSample(value, xCurr, xNext));

                aggrValue += value;
                aggrSamples.push_back(QPointF(xCurr, aggrValue));

                xCurr = xNext;
            }

            // Axis
            double xAxisSize = histogramData.max - histogramData.min;
            double xAxisExtension = xAxisSize * 0.02;
            m_historgramPlot->setAxisScale(QwtPlot::xBottom, histogramData.min - xAxisExtension, histogramData.max + xAxisExtension);
            m_aggregatedPlot->setAxisScale(QwtPlot::xBottom, histogramData.min - xAxisExtension, histogramData.max + xAxisExtension);

            // Set y axis label area width
            m_historgramPlot->axisScaleDraw(QwtPlot::yLeft)->setMinimumExtent(60);
            m_aggregatedPlot->axisScaleDraw(QwtPlot::yLeft)->setMinimumExtent(60);

            // Samples
            hist->setSamples(histSamples);
            aggr->setSamples(aggrSamples);
            hist->attach(m_historgramPlot);
            aggr->attach(m_aggregatedPlot);

            // Markers
            setMarkers(histogramData, m_historgramPlot);
            setMarkers(histogramData, m_aggregatedPlot);
        }
    }

    // Refresh plot
    m_historgramPlot->replot();
    m_aggregatedPlot->replot();
}
 D3DTextureTestMS() : D3DTextureTest()
 {
     setSamples(4);
     setMultisampleEnabled(true);
 }
 void updateData()
 {
     setSamples(m_samples);
 }
Exemple #24
0
	void PlotItem::paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget*)
	{
		const auto& rect = option->rect;
#else
	void PlotItem::paint (QPainter *painter)
	{
		const auto& rect = contentsBoundingRect ().toRect ();
#endif

		QwtPlot plot;
		plot.setFrameShape (QFrame::NoFrame);
		plot.enableAxis (QwtPlot::yLeft, LeftAxisEnabled_);
		plot.enableAxis (QwtPlot::xBottom, BottomAxisEnabled_);
		plot.setAxisTitle (QwtPlot::yLeft, LeftAxisTitle_);
		plot.setAxisTitle (QwtPlot::xBottom, BottomAxisTitle_);
		plot.resize (rect.size ());

		auto setPaletteColor = [&plot] (const QColor& color, QPalette::ColorRole role) -> void
		{
			if (!color.isValid ())
				return;

			auto pal = plot.palette ();
			pal.setColor (role, { color });
			plot.setPalette (pal);
		};

		setPaletteColor (BackgroundColor_, QPalette::Window);
		setPaletteColor (TextColor_, QPalette::WindowText);
		setPaletteColor (TextColor_, QPalette::Text);

		if (!PlotTitle_.isEmpty ())
			plot.setTitle (QwtText { PlotTitle_ });

		if (MinYValue_ < MaxYValue_)
		{
			plot.setAxisAutoScale (QwtPlot::yLeft, false);
			plot.setAxisScale (QwtPlot::yLeft, MinYValue_, MaxYValue_);
		}
		plot.setAutoFillBackground (false);
		plot.setCanvasBackground (Qt::transparent);

		if (YGridEnabled_)
		{
			auto grid = new QwtPlotGrid;
			grid->enableYMin (YMinorGridEnabled_);
			grid->enableX (false);
#if QWT_VERSION >= 0x060100
			grid->setMajorPen (QPen (GridLinesColor_, 1, Qt::SolidLine));
			grid->setMinorPen (QPen (GridLinesColor_, 1, Qt::DashLine));
#else
			grid->setMajPen (QPen (GridLinesColor_, 1, Qt::SolidLine));
			grid->setMinPen (QPen (GridLinesColor_, 1, Qt::DashLine));
#endif
			grid->attach (&plot);
		}

		auto items = Multipoints_;
		if (items.isEmpty ())
			items.push_back ({ Color_, Points_ });

		if (MinXValue_ < MaxXValue_)
			plot.setAxisScale (QwtPlot::xBottom, MinXValue_, MaxXValue_);
		else if (const auto ptsCount = items.first ().Points_.size ())
			plot.setAxisScale (QwtPlot::xBottom, 0, ptsCount - 1);

		std::vector<std::unique_ptr<QwtPlotCurve>> curves;
		for (const auto& item : items)
		{
			curves.emplace_back (new QwtPlotCurve);
			const auto curve = curves.back ().get ();

			curve->setPen (QPen (item.Color_));
			auto transpColor = item.Color_;
			transpColor.setAlphaF (Alpha_);
			curve->setBrush (transpColor);

			curve->setRenderHint (QwtPlotItem::RenderAntialiased);
			curve->attach (&plot);

			curve->setSamples (item.Points_.toVector ());
		}

		plot.replot ();

		QwtPlotRenderer {}.render (&plot, painter, rect);

		const auto xExtent = CalcXExtent (plot);
		const auto yExtent = CalcYExtent (plot);
		if (xExtent != XExtent_ || yExtent != YExtent_)
		{
			XExtent_ = xExtent;
			YExtent_ = yExtent;
			emit extentsChanged ();
		}
	}
Exemple #25
0
void AudioInfo::operator=(const IAudioInfo &info){
	setSamples(info.getSamples());
	setOffset(info.getOffset());
	setSamplerate(info.getSamplerate());
	setChannels(info.getChannels());
}