示例#1
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent)

{

    Settings settings;
    settings.s_plot.Xfrom = 0;
    settings.s_plot.Xto = 500;
    settings.s_plot.Yfrom = 0;
    settings.s_plot.Yto = 500;
    settings.s_plot.x_name = "X";
    settings.s_plot.y_name = "Y";


    d_panel = new Panel();
    d_panel->setSettings(settings);

    QWidget *w = new QWidget( this );

    graf = new Graf();

    QHBoxLayout *hLayout = new QHBoxLayout( w );
    hLayout->addWidget( d_panel );
    hLayout->addWidget( graf, 10 );

    setCentralWidget( w );

    updatePlot();

    connect( d_panel, SIGNAL( edited() ), SLOT( updatePlot() ) );

    createAction();
    createToolBar();

}
示例#2
0
MainWindow::MainWindow( QWidget *parent ):
    QMainWindow( parent )
{
    Settings settings;
#if 1
    settings.startDateTime = QDateTime( QDate( 2012, 10, 27 ), QTime( 18, 5, 0, 0 ) );
    settings.endDateTime = QDateTime( QDate( 2012, 10, 28 ), QTime( 12, 12, 0, 0 ) );
#else
    settings.startDateTime = QDateTime( QDate( 2011, 5, 3 ), QTime( 0, 6, 0, 0 ) );
    settings.endDateTime = QDateTime( QDate( 2012, 3, 10 ), QTime( 0, 5, 0, 0 ) );
#endif
    settings.maxMajorSteps = 10;
    settings.maxMinorSteps = 8;
    settings.maxWeeks = -1;

    d_plot = new Plot();
    d_panel = new Panel();
    d_panel->setSettings( settings );

    QWidget *box = new QWidget( this );

    QHBoxLayout *layout = new QHBoxLayout( box );
    layout->addWidget( d_plot, 10 );
    layout->addWidget( d_panel );

    setCentralWidget( box );

    updatePlot();

    connect( d_panel, SIGNAL( edited() ), SLOT( updatePlot() ) );
    connect( d_plot->axisWidget( QwtAxis::yLeft ), 
        SIGNAL( scaleDivChanged() ), SLOT( updatePanel() ) );
}
示例#3
0
void Plot3DDialog::pickAxisLabelFont()
{
    bool ok;
    QFont font;
    switch(axesList2->currentRow())
    {
    case 0:
        font = QFontDialog::getFont(&ok, xAxisFont, this);
        if ( ok ) {
            xAxisFont=font;
            updatePlot();
        } else
            return;
        break;

    case 1:
        font = QFontDialog::getFont(&ok, yAxisFont, this);
        if ( ok ) {
            yAxisFont = font;
            updatePlot();
        } else
            return;
        break;

    case 2:
        font = QFontDialog::getFont(&ok, zAxisFont, this);
        if ( ok ) {
            zAxisFont = font;
            updatePlot();
        } else
            return;
        break;
    }
}
示例#4
0
void caWaterfallPlot::TimeOut()
{
    // demo curve
    if(thisUnits != Monitor) {
        if(!disableDemo) {
            datamutex->lock();
            GausCurv(position);
            m_data->setData(reducedArray, countRows, ActualNumberOfColumns, getRows(), ActualNumberOfColumns);
            setCols(ActualNumberOfColumns);

            if(firstDemoPlot) {
                updatePlot();
                m_data->setLimits(0., getCols(), 0., getRows(), thisIntensityMin, thisIntensityMax);
                firstDemoPlot = false;
            }

            datamutex->unlock();
            if(drift > 0 && position >= NumberOfColumns) drift = -1;
            if(drift < 0 && position <= 0)  drift = 1;
            position += drift;
        } else {
            if(reducedArray != (double*) 0) {
                datamutex->lock();
                m_data->setData(reducedArray, countRows, ActualNumberOfColumns, getRows(),  ActualNumberOfColumns);
                if(firstTimerPlot) {
                    updatePlot();
                    m_data->setLimits(0., getCols(), 0., getRows(), thisIntensityMin, thisIntensityMax);
                    firstTimerPlot = false;
                }
                datamutex->unlock();
            }
        }
        myReplot();
    }
}
void AnalysisDEA::slotDEAComputed()
{
    // stop progress bar
    m_ui->progressBar->setMaximum(10);
    // enable run button
    m_ui->run->setEnabled(true);

    // check that the DE genes were computed
    if (m_results_rows.empty() || m_results_cols.empty() || m_results.empty()) {
        QMessageBox::critical(this,
                              tr("DEA Analysis"),
                              tr("There was an error performing the DEA"));
        return;
    }

    // enable controls
    m_ui->exportTable->setEnabled(true);
    m_ui->exportPlot->setEnabled(true);
    m_ui->searchField->setEnabled(true);

    // update table with fdr and foldchange
    updateTable();

    // update plot with fdr and foldchange
    updatePlot();
}
void AnalysisDEA::slotGeneSelected(QModelIndex index)
{
    // Check if the selection is valid
    if (!index.isValid() || m_proxy.isNull()) {
        m_gene_highlight = QPointF();
        return;
    }

    const QItemSelection &selected = m_ui->tableview->selectionModel()->selection();
    const QModelIndexList &selected_indexes = m_proxy->mapSelectionToSource(selected).indexes();

    // Check if only elements are selected
    if (selected_indexes.empty()) {
        m_gene_highlight = QPointF();
        return;
    }

    // update the highlight coordinate and refresh the plot
    const bool DESEQ2 = m_method == AnalysisDEA::DESEQ2;
    const int row_index = selected_indexes.first().row();
    const int pvalue_index = DESEQ2 ? 4 : 2;
    const int fc_index = DESEQ2 ? 1 : 0;
    const double pvalue = -log10(m_results.at(row_index, pvalue_index) + std::numeric_limits<double>::epsilon());
    const double foldchange = m_results.at(row_index, fc_index);
    m_gene_highlight = QPointF(foldchange, pvalue);
    updatePlot();
}
示例#7
0
InterpolatingGraph::InterpolatingGraph(QCustomPlot *plot, const DoubleSeries &d, PlotSettings::ScalingMode scalingMode, PlotSettings::ScaleType scaleType) :
    Graph(plot),
    series(d),
    plot(plot),
    lastUpdate(-1),
    currentMin(std::numeric_limits<double>::max()),
    currentMax(std::numeric_limits<double>::min()),
    currentScalingMode(PlotSettings::NOSCALING),
    currentScaleType(PlotSettings::LINSCALE)
{
    setObjectName("InterpolatingGraph");
    connect(&series, SIGNAL(newData(qint64)), this, SLOT(onNewData(qint64)));
    connect(&series, SIGNAL(offsetChanged()), this, SLOT(onOffsetChanged()));

    graph = plot->addGraph();
    // Ensure value axis is visible.
    plot->yAxis->setVisible(true);
    plot->yAxis->setGrid(true);

    configureAppearance(graph);
    initialize(graph, series);
    rescale(scalingMode, scaleType);

    updatePlot(scalingMode);
}
示例#8
0
void InterpolatingGraph::onOffsetChanged()
{
    graph->clearData();
    initialize(graph, series);
    rescale(currentScalingMode, currentScaleType);
    updatePlot(currentScalingMode);
}
示例#9
0
void CopasiPlot::output(const Activity & activity)
{
  size_t i, imax;
  C_INT32 ItemActivity;

  if (mHaveBefore && (activity == COutputInterface::BEFORE)) mDataBefore++;
  else if (mHaveDuring && (activity == COutputInterface::DURING)) mDataDuring++;
  else if (mHaveAfter && (activity == COutputInterface::AFTER)) mDataAfter++;

  for (ItemActivity = 0; ItemActivity < ActivitySize; ItemActivity++)
    if ((ItemActivity & activity) && mData[ItemActivity].size())
      {
        std::vector< CVector< double > * > & data = mData[ItemActivity];
        size_t & ndata = mDataSize[ItemActivity];

        if ((imax = data.size()) != 0)
          {
            if (ndata >= data[0]->size())
              {
                resizeCurveData(ItemActivity);
              }

            //the data that needs to be stored internally:
            for (i = 0; i < imax; ++i)
              if (mObjectInteger[ItemActivity][i])
                (*data[i])[ndata] = *(C_INT32 *)mObjectValues[ItemActivity][i];
              else
                (*data[i])[ndata] = *mObjectValues[ItemActivity][i];

            ++ndata;
          }
      }

  updatePlot();
}
示例#10
0
void HistogramPage::SetStatistics(HistogramCollection &collection)
{
	CloseStatistics();
	_histograms = new HistogramCollection(collection);
	_summedPolarizationHistograms = _histograms->CreateSummedPolarizationCollection();
	updatePlot();
}
StatisticsDialog::StatisticsDialog(QWidget *parent, CommunicationService* communicationService) :
    QDialog(parent),
    ui(new Ui::StatisticsDialog)
{
    ui->setupUi(this);
    this->setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
    ui->customPlot->setLocale(QLocale(QLocale::Polish, QLocale::Poland));
    ui->customPlot->setBackground(QBrush(QColor(235,235,235,255)));
    this->communicationService = communicationService;
    setStartPack();
    updatePlot();
    connect(ui->isoffer_rbtn_true,SIGNAL(clicked()),this,SLOT(updatePlot()));
    connect(ui->isoffer_rbtn_false,SIGNAL(clicked()),this,SLOT(updatePlot()));
    connect(ui->startdateEdit,SIGNAL(userDateChanged(QDate)),this,SLOT(updatePlot()));
    connect(ui->enddateEdit,SIGNAL(userDateChanged(QDate)),this,SLOT(updatePlot()));
}
void MainWindow::onPacketParsed(Packet packet)
{
    _packetsReceivedCount++;

    if(!packet.isCrcValid())
    {
        _crcErrorCount++;
    }

    QString sourceId = ByteArrayUtils::toString(packet.sourceId()).replace(" 0x", "").replace("0x", "");
    if(!_rssValues.contains(sourceId))
    {
        _rssValues.insert(sourceId, QVector<double>());
        _timestampValues.insert(sourceId, QVector<double>());

        QCPGraph* deviceGraph = ui->plotWidget->addGraph();
        deviceGraph->setScatterStyle(QCP::ssDisc);
        deviceGraph->setScatterSize(5);
        deviceGraph->setName(sourceId);
        ensureDistinctColors();
    }

    _rssValues[sourceId].append(packet.rss());
    _timestampValues[sourceId].append(packet.timestamp().toTime_t());
    updatePlot();

    updateStatus();
}
示例#13
0
void Nmr::on_isotopeCombo_currentIndexChanged(QString const& text)
{
   QString isotope(currentIsotope(text));

   Data::NmrReferenceLibrary& library(Data::NmrReferenceLibrary::instance());
   QList<Data::NmrReference const*> refs(library.filter(isotope));

   QStringList systems;
   QList<Data::NmrReference const*>::iterator iter;
   for (iter = refs.begin(); iter != refs.end(); ++iter) {
       QString system((*iter)->system());
       if (!systems.contains(system)) systems.append(system);
   }

   QComboBox* combo(m_ui->systemCombo);
   combo->clear();
   combo->addItems(systems);

   loadShifts(currentReference(), isotope);

   QPair<double, double> range(standardRange(isotope));
   m_plot->xAxis->setRange(range.first, range.second);

   updatePlot();
}
示例#14
0
void BurnUpChartCreator::showControls()
{
    updateProjectChooser();

    updatePlot();

    ProjectAnalyzer::showControls();
}
void Frequencies::on_scaleFactor_valueChanged(double scale)
{
   QTableWidget* table(m_configurator.frequencyTable);
   for (int mode = 0; mode < m_rawData.size(); ++mode) {
       table->item(mode, 0)->setText(QString::number(m_rawData[mode].first * scale,'f', 2));
   }
   
   updatePlot();
}
void StatisticsDialog::on_endDate_cbox_clicked(){
    if(ui->endDate_cbox->isChecked()){
        ui->enddateEdit->setEnabled(true);
    }
    else{
        ui->enddateEdit->setEnabled(false);
    }
    updatePlot();
}
void CurveWidget::mouseMoveEvent(QMouseEvent *mouseEvent)
{
	if (leftPressed || rightPressed)
	{
		drawRubberBand(mousePressBeginPoint, mousePressEndPoint, DASH_SIZE, RUBBER_BAND_COLOR);
		mousePressEndPoint = mouseEvent->pos();
		updatePlot();
	}
}
示例#18
0
void Plot3DDialog::pickNumbersFont()
{
    bool ok;
    QFont font = QFontDialog::getFont(&ok,numbersFont,this);
    if ( ok ) {
        numbersFont = font;
        updatePlot();
    } else
        return;
}
int TimePlotWidget::addTimeData(GenericTimeData * gtd) {
    if (!gtd) return -1;
    m_curveList.append(gtd);
    gtd->getCurve()->setZ(m_curveList.length());
    gtd->getCurve()->attach(this);
    Q_ASSERT(connect(gtd,SIGNAL(dataChanged()),this,SLOT(recalcAndUpdatePlot())));
    Q_ASSERT(connect(gtd,SIGNAL(curveAttributeChanged()),this,SLOT(updatePlot())));
    emit curveListChanged();
    return (m_curveList.length()-1);
}
void QgsVectorGradientColorRampV2Dialog::on_cboType_currentIndexChanged( int index )
{
  if (( index == 0 && mRamp->isDiscrete() ) ||
      ( index == 1 && !mRamp->isDiscrete() ) )
    return;
  mRamp->convertToDiscrete( index == 0 );
  updateColorButtons();
  updateStopEditor();
  updatePlot();
}
示例#21
0
void Plot3DDialog::pickTitleFont()
{
    bool ok;
    QFont font = QFontDialog::getFont(&ok,titleFont,this);
    if (ok) {
        titleFont = font;
        updatePlot();
    } else
        return;
}
示例#22
0
void QgsGradientColorRampDialog::setRamp( const QgsGradientColorRamp &ramp )
{
  mRamp = ramp;

  updateColorButtons();
  updateStopEditor();
  updatePlot();

  emit changed();
}
void MainWindow::on_restartAction_triggered()
{
    ui->parsedOutputPlainTextEdit->clear();
    _packetsReceivedCount = 0;
    _crcErrorCount = 0;
    updateStatus();

    _timestampValues.clear();
    _rssValues.clear();
    updatePlot();
}
void StatisticsDialog::on_isoffer_cbox_clicked(){
    if(ui->isoffer_cbox->isChecked()){
        ui->isoffer_rbtn_false->setEnabled(true);
        ui->isoffer_rbtn_true->setEnabled(true);
    }
    else{
        ui->isoffer_rbtn_true->setEnabled(false);
        ui->isoffer_rbtn_false->setEnabled(false);
    }
    updatePlot();
}
示例#25
0
void MainWindow::BoxChecked(bool t) {
	if (ui->LowPass->isChecked()) {
		set_filter_type(0);
	} else if (ui->HighPass->isChecked()) {
		set_filter_type(1);
	}	else if (ui->BandPass->isChecked()) {
		set_filter_type(2);
	}	else if (ui->BandStop->isChecked()) {
		set_filter_type(3);
	}
	updatePlot();
}
示例#26
0
void QgsCurveEditorWidget::plotMousePress( QPointF point )
{
  mCurrentPlotMarkerIndex = findNearestControlPoint( point );
  if ( mCurrentPlotMarkerIndex < 0 )
  {
    // add a new point
    mCurve.addControlPoint( point.x(), point.y() );
    mCurrentPlotMarkerIndex = findNearestControlPoint( point );
    emit changed();
  }
  updatePlot();
}
示例#27
0
void Plot3DDialog::initConnections()
{
    // scales page connections
    connect(boxFrom, SIGNAL(valueChanged(double)), this, SLOT(updatePlot()));
    connect(boxTo, SIGNAL(valueChanged(double)), this, SLOT(updatePlot()));
    connect(boxMajors, SIGNAL(valueChanged(int)), this, SLOT(updatePlot()));
    connect(boxMinors, SIGNAL(valueChanged(int)), this, SLOT(updatePlot()));
    connect(boxPrecision, SIGNAL(valueChanged(int)), this, SLOT(updatePlot()));
    connect(boxTickLabelsFormat, SIGNAL(activated(int)), this, SLOT(updatePlot()));
    connect(axesList, SIGNAL(currentRowChanged(int)), this, SLOT(viewScaleLimits(int)));

    // axes page connections
    connect(boxMajorLength, SIGNAL(valueChanged(double)), this, SLOT(updatePlot()));
    connect(boxMinorLength, SIGNAL(valueChanged(double)), this, SLOT(updatePlot()));
    connect(axesList2, SIGNAL(currentRowChanged(int)), this, SLOT(viewAxisOptions(int)));

    //grid page connections
    connect(boxMajorGrids, SIGNAL(toggled(bool)), this, SLOT(enableMajorGrids(bool)));
    connect(boxMajorGrids, SIGNAL(toggled(bool)), this, SLOT(updatePlot()));
    connect(boxMinorGrids, SIGNAL(toggled(bool)), this, SLOT(enableMinorGrids(bool)));
    connect(boxMinorGrids, SIGNAL(toggled(bool)), this, SLOT(updatePlot()));
    connect(boxMajorGridStyle, SIGNAL(activated(int)), this, SLOT(updatePlot()));
    connect(boxMinorGridStyle, SIGNAL(activated(int)), this, SLOT(updatePlot()));
    connect(boxMajorGridWidth, SIGNAL(valueChanged(double)), this, SLOT(updatePlot()));
    connect(boxMinorGridWidth, SIGNAL(valueChanged(double)), this, SLOT(updatePlot()));
    connect(btnGrid, SIGNAL(colorChanged()), this, SLOT(updatePlot()));
    connect(btnGridMinor, SIGNAL(colorChanged()), this, SLOT(updatePlot()));

    //color page connections
    connect(btnAxes, SIGNAL(colorChanged()), this, SLOT(updatePlot()));
    connect(btnLabels, SIGNAL(colorChanged()), this, SLOT(updatePlot()));
    connect(btnNumbers, SIGNAL(colorChanged()), this, SLOT(updatePlot()));
    connect(btnMesh, SIGNAL(colorChanged()), this, SLOT(updatePlot()));
    connect(btnBackground, SIGNAL(colorChanged()), this, SLOT(updatePlot()));
    connect(d_color_map_editor, SIGNAL(scalingChanged()), this, SLOT(updatePlot()));

    connect(boxMeshLineWidth, SIGNAL(valueChanged(double)), d_plot, SLOT(setMeshLineWidth(double)));
    connect(boxOrthogonal, SIGNAL(toggled(bool)), d_plot, SLOT(setOrthogonal(bool)));
    connect(boxLegend, SIGNAL(toggled(bool)), d_plot, SLOT(showColorLegend(bool)));
    connect(boxResolution, SIGNAL(valueChanged(int)), d_plot, SLOT(setResolution(int)));
    connect(boxDistance, SIGNAL(valueChanged(int)), d_plot, SLOT(setLabelsDistance(int)));

    //title page connections
    connect(btnTitleColor, SIGNAL(colorChanged()), this, SLOT(updatePlot()));
}
void SIM_PLOT_FRAME::onSimFinished( wxCommandEvent& aEvent )
{
    m_toolBar->SetToolNormalBitmap( ID_SIM_RUN, KiBitmap( sim_run_xpm ) );
    SetCursor( wxCURSOR_ARROW );

    SIM_TYPE simType = m_exporter->GetSimType();

    if( simType == ST_UNKNOWN )
        return;

    SIM_PLOT_PANEL* plotPanel = CurrentPlot();

    if( !plotPanel || plotPanel->GetType() != simType )
        plotPanel = NewPlotPanel( simType );

    if( IsSimulationRunning() )
        return;

    // If there are any signals plotted, update them
    if( SIM_PLOT_PANEL::IsPlottable( simType ) )
    {
        TRACE_MAP& traceMap = m_plots[plotPanel].m_traces;

        for( auto it = traceMap.begin(); it != traceMap.end(); /* iteration occurs in the loop */)
        {
            if( !updatePlot( it->second, plotPanel ) )
            {
                removePlot( it->first, false );
                it = traceMap.erase( it );       // remove a plot that does not exist anymore
            }
            else
            {
                ++it;
            }
        }

        updateSignalList();
        plotPanel->UpdateAll();
        plotPanel->ResetScales();
    }
    else
    {
        /// @todo do not make it hardcoded for ngspice
        for( const auto& net : m_exporter->GetNetIndexMap() )
        {
            int node = net.second;

            if( node > 0 )
                m_simulator->Command( wxString::Format( "print v(%d)", node ).ToStdString() );
        }
    }
}
示例#29
0
void InstrumentWindowPickTab::updateSelectionInfo(int detid)
{
  if (m_instrWindow->blocked()) 
  {
    m_selectionInfoDisplay->clear();
    return;
  }
  if (detid >= 0)
  {
    InstrumentActor* instrActor = m_instrWindow->getInstrumentActor();
    Mantid::Geometry::IDetector_const_sptr det = instrActor->getInstrument()->getDetector(detid);
    QString text = "Selected detector: " + QString::fromStdString(det->getName()) + "\n";
    text += "Detector ID: " + QString::number(detid) + '\n';
    QString wsIndex;
    try {
      wsIndex = QString::number(instrActor->getWorkspaceIndex(detid));
      updatePlot(detid); // Update the plot if the detector links to some data
    } catch (Mantid::Kernel::Exception::NotFoundError) {
      // Detector doesn't have a workspace index relating to it
      wsIndex = "None";
      m_plot->clearCurve(); // Clear the plot window
      m_plot->replot();
    }
    text += "Workspace index: " + wsIndex + '\n';
    Mantid::Kernel::V3D pos = det->getPos();
    text += "xyz: " + QString::number(pos.X()) + "," + QString::number(pos.Y()) + "," + QString::number(pos.Z())  + '\n';
    double r,t,p;
    pos.getSpherical(r,t,p);
    text += "rtp: " + QString::number(r) + "," + QString::number(t) + "," + QString::number(p)  + '\n';
    Mantid::Geometry::ICompAssembly_const_sptr parent = boost::dynamic_pointer_cast<const Mantid::Geometry::ICompAssembly>(det->getParent());
    if (parent)
    {
      QString textpath;
      while (parent)
      {
        textpath="/"+QString::fromStdString(parent->getName())+textpath;
        parent=boost::dynamic_pointer_cast<const Mantid::Geometry::ICompAssembly>(parent->getParent());
      }
      text += "Component path:" +textpath+"/"+ QString::fromStdString(det->getName()) +'\n';
    }
    const double integrated = instrActor->getIntegratedCounts(detid);
    const QString counts = integrated == -1.0 ? "N/A" : QString::number(integrated);
    text += "Counts: " + counts + '\n';
    m_selectionInfoDisplay->setText(text);
  }
  else
  {
    m_selectionInfoDisplay->clear();
    m_plot->clearCurve(); // Clear the plot window
    m_plot->replot();
  }
}
void SIM_PLOT_FRAME::addPlot( const wxString& aName, SIM_PLOT_TYPE aType, const wxString& aParam )
{
    SIM_TYPE simType = m_exporter->GetSimType();

    if( !SIM_PLOT_PANEL::IsPlottable( simType ) )
        return; // TODO else write out in console?

    // Create a new plot if the current one displays a different type
    SIM_PLOT_PANEL* plotPanel = CurrentPlot();

    if( !plotPanel || plotPanel->GetType() != simType )
        plotPanel = NewPlotPanel( simType );

    TRACE_DESC descriptor( *m_exporter, aName, aType, aParam );

    bool updated = false;
    SIM_PLOT_TYPE xAxisType = GetXAxisType( simType );

    if( xAxisType == SPT_LIN_FREQUENCY || xAxisType == SPT_LOG_FREQUENCY )
    {
        int baseType = descriptor.GetType() & ~( SPT_AC_MAG | SPT_AC_PHASE );

        // Add two plots: magnitude & phase
        TRACE_DESC mag_desc( *m_exporter, descriptor, (SIM_PLOT_TYPE)( baseType | SPT_AC_MAG ) );
        TRACE_DESC phase_desc( *m_exporter, descriptor, (SIM_PLOT_TYPE)( baseType | SPT_AC_PHASE ) );

        updated |= updatePlot( mag_desc, plotPanel );
        updated |= updatePlot( phase_desc, plotPanel );
    }
    else
    {
        updated = updatePlot( descriptor, plotPanel );
    }

    if( updated )
    {
        updateSignalList();
    }
}