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


C++ Plot类代码示例

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


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

示例1: pit

void
PlotWidget::saveMarkers (DataBase &db)
{
  // save plot markers
  QHashIterator<QString, Plot *> pit(_plots);
  while (pit.hasNext())
  {
    pit.next();
    Plot *p = pit.value();
    
    QHash<QString, Marker *> markers = p->markers();
    QHashIterator<QString, Marker *> mit(markers);
    while (mit.hasNext())
    {
      mit.next();
      Marker *m = mit.value();
    
      if (m->readOnly())
        continue;
      
      if (! m->modified())
        continue;
      
      Entity *e = m->settings();
      e->setName(mit.key());
      
      db.transaction();
      db.set(e);
      db.commit();
      
      m->setModified(FALSE);
    }
  }
}
开发者ID:abhikalitra,项目名称:qtstalker,代码行数:34,代码来源:PlotWidget.cpp

示例2: SkASSERT

GrLayerAtlas::GrLayerAtlas(GrTextureProvider* texProvider, GrPixelConfig config, 
                           GrSurfaceFlags flags,
                           const SkISize& backingTextureSize,
                           int numPlotsX, int numPlotsY) {
    fTexProvider = texProvider;
    fPixelConfig = config;
    fFlags = flags;
    fBackingTextureSize = backingTextureSize;

    int textureWidth = fBackingTextureSize.width();
    int textureHeight = fBackingTextureSize.height();

    int plotWidth = textureWidth / numPlotsX;
    int plotHeight = textureHeight / numPlotsY;

    SkASSERT(plotWidth * numPlotsX == textureWidth);
    SkASSERT(plotHeight * numPlotsY == textureHeight);

    // We currently do not support compressed atlases...
    SkASSERT(!GrPixelConfigIsCompressed(config));

    // set up allocated plots
    fPlotArray = new Plot[numPlotsX * numPlotsY];

    Plot* currPlot = fPlotArray;
    for (int y = numPlotsY-1; y >= 0; --y) {
        for (int x = numPlotsX-1; x >= 0; --x) {
            currPlot->init(y*numPlotsX+x, x, y, plotWidth, plotHeight);

            // build LRU list
            fPlotList.addToHead(currPlot);
            ++currPlot;
        }
    }
}
开发者ID:YangchenVR,项目名称:skia,代码行数:35,代码来源:GrLayerAtlas.cpp

示例3: it

void
PlotWidget::setScrollBarSize ()
{
  bool flag = FALSE;
  int page = 0;
  int max = 0;
  QHashIterator<QString, Plot *> it(_plots);
  while (it.hasNext())
  {
    it.next();
    Plot *plot = it.value();
    
    int tpage, tmax;
    plot->scrollBarSize(tpage, tmax);
    
    if (! flag)
    {
      page = tpage;
      max = tmax;
      flag = TRUE;
    }
    else
    {
      if (tpage > page)
        page = tpage;
      if (tmax > max)
        max = tmax;
    }
  }

  _cw->setScrollBar(0, max, page);
}
开发者ID:abhikalitra,项目名称:qtstalker,代码行数:32,代码来源:PlotWidget.cpp

示例4: computeWaterfallOffsets

void PlotCurve::computeWaterfallOffsets() {
  Plot *plot = static_cast<Plot *>(this->plot());
  Graph *g = static_cast<Graph *>(plot->parent());

  // reset the offsets
  d_x_offset = 0.0;
  d_y_offset = 0.0;

  if (g->isWaterfallPlot()) {
    int index = g->curveIndex(this);
    int curves = g->curves();
    auto firstCurve = g->curve(0);
    // Get the minimum value of the first curve in this plot
    double ymin = firstCurve ? firstCurve->minYValue() : 0.0;
    PlotCurve *c = dynamic_cast<PlotCurve *>(g->curve(0));
    if (index > 0 && c) {
      // Compute offsets based on the maximum value for the curve
      d_x_offset = index * g->waterfallXOffset() * 0.01 *
                   g->curve(0)->maxXValue() / (double)(curves - 1);
      d_y_offset = index * g->waterfallYOffset() * 0.01 *
                   g->curve(0)->maxYValue() / (double)(curves - 1);

      setZ(-index);
      setBaseline(ymin -
                  d_y_offset); // Fill down to minimum value of first curve

    } else {
      setZ(0);
      setBaseline(ymin); // This is for when 'fill under curve' is turn on
    }
    if (g->grid())
      g->grid()->setZ(-g->curves() /*Count()*/ - 1);
  } 
}
开发者ID:Mantid-Test-Account,项目名称:mantid,代码行数:34,代码来源:PlotCurve.cpp

示例5: db

void
PlotWidget::removePlot (QString name)
{
  Plot *plot = _plots.value(name);
  if (! plot)
    return;
  
  Entity *e = _settings.value(name);
  if (! e)
    return;
  
  // remove markers
  DataBase db(g_session);
  db.transaction();
  
  QHash<QString, Marker *> markers = plot->markers();
  QList<QString> ml = markers.keys();
  db.remove(ml);
  
  // remove indicator settings
  db.remove(QStringList() << name);
  
  db.commit();
  
  delete plot;
  delete e;
  _plots.remove(name);
  _settings.remove(name);
}
开发者ID:abhikalitra,项目名称:qtstalker,代码行数:29,代码来源:PlotWidget.cpp

示例6: printer

void plotsDialog::print()
{
    QPrinter printer( QPrinter::HighResolution );

    Plot* currentPlot = dynamic_cast<Plot*>(tabs->currentWidget());
    QString docName = currentPlot->title().text();
    if ( !docName.isEmpty() )
    {
        docName.replace ( QRegExp ( QString::fromLatin1 ( "\n" ) ), tr ( " -- " ) );
        printer.setDocName ( docName );
    }

    printer.setCreator( currentPlot->title().text());
    printer.setOrientation( QPrinter::Landscape );

    QPrintDialog dialog( &printer );
    if ( dialog.exec() )
    {
        QwtPlotRenderer renderer;

        if ( printer.colorMode() == QPrinter::GrayScale )
        {
            renderer.setDiscardFlag( QwtPlotRenderer::DiscardBackground );
            renderer.setDiscardFlag( QwtPlotRenderer::DiscardCanvasBackground );
            renderer.setDiscardFlag( QwtPlotRenderer::DiscardCanvasFrame );
            renderer.setLayoutFlag( QwtPlotRenderer::FrameWithScales );
        }

        renderer.renderTo( currentPlot, printer );
    }
}
开发者ID:oabdelaziz,项目名称:SorpSim,代码行数:31,代码来源:plotsdialog.cpp

示例7: handlePlotData

void Plotter::handlePlotData(const plot_msgs::PlotConstPtr& data)
{
	if(m_blocked || m_ui->pauseButton->isChecked())
		return;

	for(std::size_t i = 0; i < data->points.size(); ++i)
	{
		const plot_msgs::PlotPoint& point = data->points[i];
		QString name = QString::fromStdString(point.name);

		if(name.isEmpty())
			continue;

		Plot* plot = m_plotModel->rootPlot()->findOrCreatePlotByPath(name);
		plot->put(data->header.stamp, point.value, NULL, true, false);
	}

	for(std::size_t i = 0; i < data->events.size(); ++i)
	{
		const std::string& event = data->events[i];
		QString name = QString::fromStdString(event);

		if(name.isEmpty())
			continue;

		Plot* plot = m_plotModel->rootPlot()->findOrCreatePlotByPath(name);
		plot->setIsEventChannel(true);
		plot->put(data->header.stamp, NAN, &m_labelY, true, false);
	}
}
开发者ID:AIS-Bonn,项目名称:humanoid_op_ros,代码行数:30,代码来源:plotter.cpp

示例8: Zoomer

void plotsDialog::resetZoomer(int i)
{

    Plot* currentPlot = dynamic_cast<Plot*>(tabs->currentWidget());

    d_zoomer[0] = new Zoomer( QwtPlot::xBottom, QwtPlot::yLeft,
                              currentPlot->canvas() );
    d_zoomer[0]->setRubberBand( QwtPicker::RectRubberBand );
    d_zoomer[0]->setRubberBandPen( QColor( Qt::green ) );
    d_zoomer[0]->setTrackerMode( QwtPicker::ActiveOnly );
    d_zoomer[0]->setTrackerPen( QColor( Qt::white ) );

    d_zoomer[1] = new Zoomer( QwtPlot::xTop, QwtPlot::yRight,
                              currentPlot->canvas() );

    d_panner = new QwtPlotPanner( currentPlot->canvas() );
    d_panner->setMouseButton( Qt::MidButton );

    d_picker = new QwtPlotPicker( QwtPlot::xBottom, QwtPlot::yLeft,
                                  QwtPlotPicker::CrossRubberBand, QwtPicker::AlwaysOn,
                                  currentPlot->canvas() );
    d_picker->setStateMachine( new QwtPickerDragPointMachine() );
    d_picker->setRubberBandPen( QColor( Qt::green ) );
    d_picker->setRubberBand( QwtPicker::CrossRubberBand );
    d_picker->setTrackerPen( QColor( Qt::white ) );

    connect(d_picker,SIGNAL(moved(QPoint)),SLOT(moved(QPoint)));

    ui->overlayButton->setHidden(currentPlot->isParametric);
    ui->dataSelectButton->setHidden(!currentPlot->isParametric);

    enableZoomMode(false);
}
开发者ID:oabdelaziz,项目名称:SorpSim,代码行数:33,代码来源:plotsdialog.cpp

示例9: main

int main ( int argc, char **argv )
{
#if USE_OPENGL
#if QT_VERSION >= 0x040600 && QT_VERSION < 0x050000
    // on my box QPaintEngine::OpenGL2 has serious problems, f.e:
    // the lines of a simple drawRect are wrong.

    QGL::setPreferredPaintEngine( QPaintEngine::OpenGL );
#endif
#endif

    QApplication a( argc, argv );

    Plot plot;

#if USE_OPENGL
    QwtPlotGLCanvas *canvas = new QwtPlotGLCanvas();
    canvas->setFrameStyle( QwtPlotGLCanvas::NoFrame );
#else
    QwtPlotCanvas *canvas = new QwtPlotCanvas();
    canvas->setFrameStyle( QFrame::NoFrame );
    canvas->setPaintAttribute( QwtPlotCanvas::BackingStore, false );
#endif

    plot.setCanvas( canvas );
    plot.setCanvasBackground( QColor( 30, 30, 50 ) );

    plot.resize( 400, 400 );
    plot.show();

    return a.exec();
}
开发者ID:iclosure,项目名称:jdataanalyse,代码行数:32,代码来源:main.cpp

示例10: Plot

bool TestPlotWithArea::DoTest()
{
    Plot *plot;
    plot = new Plot();

    Area *area = new Area2D();

    Box *box1, *box2;
    box1 = new Box(plot);

    box2 = new Box(plot);

    Series *series;
    series = new Series2D("Series");

    DataTyped<int> *xdata;
    xdata = new DataTyped<int>();

    series->SetData(xdata, AXIS_X);

    area->AddSeries(series);
    plot->AddArea(area);

    delete box1;


    delete plot;

    return true;
}
开发者ID:ainur-giniyatov,项目名称:wxPlot,代码行数:30,代码来源:Test.cpp

示例11: main

int main(int argc, char **argv)
{
    QApplication a(argc, argv);
    Plot plot;
    plot.resize(800,600);
    plot.show();
    return a.exec();
}
开发者ID:herocodemaster,项目名称:qwtplot3d,代码行数:8,代码来源:simpleplot.cpp

示例12: curvesetting

void plotsDialog::edit()
{
    Plot* currentPlot = dynamic_cast<Plot*>(tabs->currentWidget());
    curvesetting * dialog = new curvesetting(&currentPlot->curvelist,currentPlot,this);
    dialog->setModal(true);
    if (dialog->exec()== QDialog::Accepted)
        currentPlot->replot();
}
开发者ID:oabdelaziz,项目名称:SorpSim,代码行数:8,代码来源:plotsdialog.cpp

示例13: saveCurveLayout

QString PlotCurve::saveCurveLayout()
{
  Plot *plot = static_cast<Plot *>(this->plot());
  Graph *g = static_cast<Graph *>(plot->parent());

  int index = g->curveIndex(static_cast<QwtPlotCurve *>(this));
  int style = g->curveType(index);
  QString s = "<Style>" + QString::number(style) + "</Style>\n";

  if (style == Graph::Spline)
    s += "<LineStyle>5</LineStyle>\n";
  else if (style == Graph::VerticalSteps)
    s += "<LineStyle>6</LineStyle>\n";
  else
    s += "<LineStyle>" + QString::number(this->style()) + "</LineStyle>\n";

  QPen pen = this->pen();
  if (pen.style() != Qt::NoPen){
    s += "<Pen>\n";
    s += "\t<Color>" + pen.color().name() + "</Color>\n";
    s += "\t<Style>" + QString::number(pen.style()-1) + "</Style>\n";
    s += "\t<Width>" + QString::number(pen.widthF()) + "</Width>\n";
    s += "</Pen>\n";
  }

  QBrush brush = this->brush();
  if (brush.style() != Qt::NoBrush){
    s += "<Brush>\n";
    s += "\t<Color>" + brush.color().name() + "</Color>\n";
    s += "\t<Style>" + QString::number(PatternBox::patternIndex(brush.style())) + "</Style>\n";
    s += "</Brush>\n";
  }

  const QwtSymbol symbol = this->symbol();
  if (symbol.style() != QwtSymbol::NoSymbol){
    s += "<Symbol>\n";
    s += "\t<Style>" + QString::number(SymbolBox::symbolIndex(symbol.style())) + "</Style>\n";
    s += "\t<Size>" + QString::number(symbol.size().width()) + "</Size>\n";

    s += "\t<SymbolPen>\n";
    s += "\t\t<Color>" + symbol.pen().color().name() + "</Color>\n";
    s += "\t\t<Width>" + QString::number(symbol.pen().widthF()) + "</Width>\n";
    s += "\t</SymbolPen>\n";

    brush = this->brush();
    if (brush.style() != Qt::NoBrush){
      s += "\t<SymbolBrush>\n";
      s += "\t\t<Color>" + symbol.brush().color().name() + "</Color>\n";
      s += "\t\t<Style>" + QString::number(PatternBox::patternIndex(symbol.brush().style())) + "</Style>\n";
      s += "\t</SymbolBrush>\n";
    }
    s += "</Symbol>\n";
  }
  s += "<xAxis>" + QString::number(xAxis()) + "</xAxis>\n";
  s += "<yAxis>" + QString::number(yAxis()) + "</yAxis>\n";
  s += "<Visible>" + QString::number(isVisible()) + "</Visible>\n";
  return s;
}
开发者ID:jkrueger1,项目名称:mantid,代码行数:58,代码来源:PlotCurve.cpp

示例14: moved

void plotsDialog::moved(const QPoint &pos)
{
    Plot* currentPlot = dynamic_cast<Plot*>(tabs->currentWidget());
    QString info;
    info.sprintf( "X=%g, Y=%g",currentPlot->invTransform(QwtPlot::xBottom,pos.x())
                  ,currentPlot->invTransform(QwtPlot::yLeft,pos.y()));

    showInfo( info );
}
开发者ID:oabdelaziz,项目名称:SorpSim,代码行数:9,代码来源:plotsdialog.cpp

示例15: PlotTab

    PlotTab( bool parametric,  QWidget *parent ):
        QMainWindow( parent )
    {
        Plot *plot = new Plot( parametric, this );
        setCentralWidget( plot );
    
        QToolBar *toolBar = new QToolBar( this );

#ifndef QT_NO_PRINTER
        ToolButton *btnPrint = new ToolButton( "Print", toolBar );
        toolBar->addWidget( btnPrint );
        QObject::connect( btnPrint, SIGNAL( clicked() ),
            plot, SLOT( printPlot() ) );
#endif
    
        ToolButton *btnOverlay = new ToolButton( "Overlay", toolBar );
        btnOverlay->setCheckable( true );
        toolBar->addWidget( btnOverlay );
        QObject::connect( btnOverlay, SIGNAL( toggled( bool ) ),
            plot, SLOT( setOverlaying( bool ) ) );
    
        if ( parametric )
        {
            QComboBox *parameterBox = new QComboBox( toolBar );

            parameterBox->addItem( "Uniform" );
            parameterBox->addItem( "Centripetral" );
            parameterBox->addItem( "Chordal" );
            parameterBox->addItem( "Manhattan" );
            toolBar->addWidget( parameterBox );
            connect( parameterBox, SIGNAL( activated( const QString & ) ),
                plot, SLOT( setParametric( const QString & ) ) );

            parameterBox->setCurrentIndex( 2 ); // chordal
            plot->setParametric( parameterBox->currentText() );

            ToolButton *btnClosed = new ToolButton( "Closed", toolBar );
            btnClosed->setCheckable( true );
            toolBar->addWidget( btnClosed );
            QObject::connect( btnClosed, SIGNAL( toggled( bool ) ),
                plot, SLOT( setClosed( bool ) ) );
        }

        QComboBox *boundaryBox = new QComboBox( toolBar );

        boundaryBox->addItem( "Natural" );
        boundaryBox->addItem( "Linear Runout" );
        boundaryBox->addItem( "Parabolic Runout" );
        boundaryBox->addItem( "Cubic Runout" );
        boundaryBox->addItem( "Not a Knot" );

        toolBar->addWidget( boundaryBox );
        connect( boundaryBox, SIGNAL( activated( const QString & ) ),
            plot, SLOT( setBoundaryCondition( const QString & ) ) );
    
        addToolBar( toolBar );
    }
开发者ID:Au-Zone,项目名称:qwt,代码行数:57,代码来源:main.cpp


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