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


C++ QwtPlotItem::rtti方法代码示例

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


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

示例1: drawItems

void QwtPlot::drawItems(QPainter *painter, const QRect &rect, 
        const QwtScaleMap map[axisCnt], 
        const QwtPlotPrintFilter &pfilter) const
{
    const QwtPlotItemList& itmList = itemList();
    for ( QwtPlotItemIterator it = itmList.begin();
        it != itmList.end(); ++it )
    {
        QwtPlotItem *item = *it;
        if ( item && item->isVisible() )
        {
            if ( !(pfilter.options() & QwtPlotPrintFilter::PrintGrid)
                && item->rtti() == QwtPlotItem::Rtti_PlotGrid )
            {
                continue;
            }

            painter->save();

#if QT_VERSION >= 0x040000
            painter->setRenderHint(QPainter::Antialiasing,
                item->testRenderHint(QwtPlotItem::RenderAntialiased) );
#endif

            item->draw(painter, 
                map[item->xAxis()], map[item->yAxis()],
                rect);

            painter->restore();
        }
    }
}
开发者ID:DTUautopilot,项目名称:qgroundcontrol,代码行数:32,代码来源:qwt_plot.cpp

示例2: removeCurve

void Plot::removeCurve(int index)
{
	QwtPlotItem *c = d_curves[index];
  	if (!c)
  		return;

  	if (c->rtti() == QwtPlotItem::Rtti_PlotSpectrogram)
  	{
  		Spectrogram *sp = (Spectrogram *)c;
  	    QwtScaleWidget *colorAxis = axisWidget(sp->colorScaleAxis());
  	    if (colorAxis)
  	    	colorAxis->setColorBarEnabled(false);
  	}

	c->detach();
	QwtPlotItem* p = d_curves.take (index);
  // RNT: Making curve_key unique prevents clashes elsewhere
	//--curve_key;
	// MG: This is a rather crude but effective way of delaying the
	// deletion of the curve objects. This is necessary because in
	// a tight loop a curve may not have been completely removed 
	// but the object has been deleted.
	Detacher *detacher = new Detacher(p);
	detacher->deleteLater();
}
开发者ID:trnielsen,项目名称:mantid,代码行数:25,代码来源:Plot.cpp

示例3: showCurveBtn

void CurvesDialog::showCurveBtn(int)
{
	QwtPlotItem *it = d_graph->plotItem(contents->currentRow());
	if (!it)
		return;

    if (it->rtti() == QwtPlotItem::Rtti_PlotSpectrogram)
    {
        btnEditFunction->setEnabled(false);
        btnAssociations->setEnabled(false);
        btnRange->setEnabled(false);
        return;
    }

    PlotCurve *c = (PlotCurve *)it;
	if (c->type() == Graph::Function)
	{
		btnEditFunction->setEnabled(true);
		btnAssociations->setEnabled(false);
		btnRange->setEnabled(false);
		return;
	}

    btnAssociations->setEnabled(true);

    btnRange->setEnabled(true);
	if (c->type() == Graph::ErrorBars)
  		btnRange->setEnabled(false);
}
开发者ID:BackupTheBerlios,项目名称:qtiplot-svn,代码行数:29,代码来源:CurvesDialog.cpp

示例4: curve

QwtPlotCurve* Plot::curve(int index)
{
    QwtPlotItem *it = d_curves.value(index);
    if (it && it->rtti() != QwtPlotItem::Rtti_PlotSpectrogram)
        return (QwtPlotCurve*)it;
    else
        return 0;
}
开发者ID:trnielsen,项目名称:mantid,代码行数:8,代码来源:Plot.cpp

示例5: numberOfCurves

int LinePlot::numberOfCurves()
{
  /// multiple curves based on units
  const QwtPlotItemList &listPlotItem = m_qwtPlot->itemList();
  QwtPlotItemIterator itPlotItem;
  int curveCount = 0;
  for (itPlotItem = listPlotItem.begin();itPlotItem!=listPlotItem.end();++itPlotItem)
  {
    QwtPlotItem *plotItem = *itPlotItem;
    if ( plotItem->rtti() == QwtPlotItem::Rtti_PlotCurve)
    {
      curveCount++;
    }
  }
  return curveCount;
}
开发者ID:CUEBoxer,项目名称:OpenStudio,代码行数:16,代码来源:LinePlot.cpp

示例6: itemList

/*!
  \return List of all attached plot items of a specific type.
  \param rtti See QwtPlotItem::RttiValues
  \sa QwtPlotItem::rtti()
*/
QwtPlotItemList QwtPlotDict::itemList( int rtti ) const
{
    if ( rtti == QwtPlotItem::Rtti_PlotItem )
        return d_data->itemList;

    QwtPlotItemList items;

    PrivateData::ItemList list = d_data->itemList;
    for ( QwtPlotItemIterator it = list.begin(); it != list.end(); ++it )
    {
        QwtPlotItem *item = *it;
        if ( item->rtti() == rtti )
            items += item;
    }

    return items;
}
开发者ID:iclosure,项目名称:jdataanalyse,代码行数:22,代码来源:qwt_plot_dict.cpp

示例7: removeCurve

void Plot::removeCurve(int index)
{
	QwtPlotItem *c = d_curves[index];
  	if (!c)
  		return;

  	if (c->rtti() == QwtPlotItem::Rtti_PlotSpectrogram)
  	{
  		Spectrogram *sp = (Spectrogram *)c;
  	    QwtScaleWidget *colorAxis = axisWidget(sp->colorScaleAxis());
  	    if (colorAxis)
  	    	colorAxis->setColorBarEnabled(false);
  	}

	c->detach();
	d_curves.remove (index);
}
开发者ID:BackupTheBerlios,项目名称:qtiplot-svn,代码行数:17,代码来源:Plot.cpp

示例8: closestCurve

/**
 * Returns the index of the closest curve to a point on the canvas.
 * Also returns index of the nearest data point on that curve.
 * @param xpos :: x coordinate of a point on the canvas in pixels.
 * @param ypos :: y coordinate of a point on the canvas in pixels.
 * @param dist :: ?
 * @param point :: Output index of the nearest data point to the point with coordinates (xpos,ypos)
 */
int Plot::closestCurve(int xpos, int ypos, int &dist, int &point)
{
	QwtScaleMap map[QwtPlot::axisCnt];
	for ( int axis = 0; axis < QwtPlot::axisCnt; axis++ )
		map[axis] = canvasMap(axis);

  double dmin = std::numeric_limits<double>::max();
	int key = -1;
	for (QMap<int, QwtPlotItem *>::iterator iter = d_curves.begin(); iter != d_curves.end(); ++iter )
	{
		QwtPlotItem *item = (QwtPlotItem *)iter.data();
		if (!item)
			continue;

    if(item->rtti() != QwtPlotItem::Rtti_PlotSpectrogram)
    {
      PlotCurve *c = (PlotCurve *)item;
      DataCurve *dc = dynamic_cast<DataCurve *>(item);
      if (dc)
      {
        if (c->type() != Graph::Function && dc->hasLabels() &&
          dc->selectedLabels(QPoint(xpos, ypos))){
            dist = 0;
            return iter.key();
        } else
          dc->setLabelsSelected(false);
      }

      for (int i=0; i<c->dataSize(); i++)
      {
        double cx = map[c->xAxis()].xTransform(c->x(i)) - double(xpos);
        double cy = map[c->yAxis()].xTransform(c->y(i)) - double(ypos);
        double f = qwtSqr(cx) + qwtSqr(cy);
        if (f < dmin && c->type() != Graph::ErrorBars)
        {
          dmin = f;
          key = iter.key();
          point = i;
        }
      }
    }
  }
	dist = static_cast<int>(sqrt(dmin));
	return key;
}
开发者ID:trnielsen,项目名称:mantid,代码行数:53,代码来源:Plot.cpp

示例9: setLineThickness

void LinePlot::setLineThickness(const int &width)
{
  const QwtPlotItemList &listPlotItem = m_qwtPlot->itemList();
  QwtPlotItemIterator itPlotItem;
  for (itPlotItem = listPlotItem.begin();itPlotItem!=listPlotItem.end();++itPlotItem)
  {
    QwtPlotItem *plotItem = *itPlotItem;
    if ( plotItem->rtti() == QwtPlotItem::Rtti_PlotCurve)
    {
      QwtPlotCurve *curve = (QwtPlotCurve *) plotItem;
      QPen pen(curve->pen()); 
      pen.setWidth(width);
      curve->setPen(pen);
    }
  }
  m_qwtPlot->replot();

}
开发者ID:CUEBoxer,项目名称:OpenStudio,代码行数:18,代码来源:LinePlot.cpp

示例10: detachItems

/*!
   Detach items from the dictionary

   \param rtti In case of QwtPlotItem::Rtti_PlotItem detach all items
               otherwise only those items of the type rtti.
   \param autoDelete If true, delete all detached items
*/
void QwtPlotDict::detachItems( int rtti, bool autoDelete )
{
    PrivateData::ItemList list = d_data->itemList;
    QwtPlotItemIterator it = list.begin();
    while ( it != list.end() )
    {
        QwtPlotItem *item = *it;

        ++it; // increment before removing item from the list

        if ( rtti == QwtPlotItem::Rtti_PlotItem || item->rtti() == rtti )
        {
            item->attach( NULL );
            if ( autoDelete )
                delete item;
        }
    }
}
开发者ID:iclosure,项目名称:jdataanalyse,代码行数:25,代码来源:qwt_plot_dict.cpp

示例11: raiseItem

void Editor::raiseItem( QwtPlotShapeItem *shapeItem )
{
    const QwtPlot *plot = this->plot();
    if ( plot == NULL || shapeItem == NULL )
        return;

    const QwtPlotItemList items = plot->itemList();
    for ( int i = items.size() - 1; i >= 0; i-- )
    {
        QwtPlotItem *item = items[ i ];
        if ( shapeItem == item )
            return;

        if ( item->isVisible() &&
            item->rtti() == QwtPlotItem::Rtti_PlotShape )
        {
            shapeItem->setZ( item->z() + 1 );
            return;
        }
    }
}
开发者ID:0vermind,项目名称:NeoLoader,代码行数:21,代码来源:editor.cpp

示例12: itemAt

QwtPlotShapeItem* Editor::itemAt( const QPoint& pos ) const
{
    const QwtPlot *plot = this->plot();
    if ( plot == NULL )
        return NULL;

    // translate pos into the plot coordinates
    double coords[ QwtPlot::axisCnt ];
    coords[ QwtPlot::xBottom ] =
        plot->canvasMap( QwtPlot::xBottom ).invTransform( pos.x() );
    coords[ QwtPlot::xTop ] =
        plot->canvasMap( QwtPlot::xTop ).invTransform( pos.x() );
    coords[ QwtPlot::yLeft ] =
        plot->canvasMap( QwtPlot::yLeft ).invTransform( pos.y() );
    coords[ QwtPlot::yRight ] =
        plot->canvasMap( QwtPlot::yRight ).invTransform( pos.y() );

    QwtPlotItemList items = plot->itemList();
    for ( int i = items.size() - 1; i >= 0; i-- )
    {
        QwtPlotItem *item = items[ i ];
        if ( item->isVisible() &&
            item->rtti() == QwtPlotItem::Rtti_PlotShape )
        {
            QwtPlotShapeItem *shapeItem = static_cast<QwtPlotShapeItem *>( item );
            const QPointF p( coords[ item->xAxis() ], coords[ item->yAxis() ] );

            if ( shapeItem->boundingRect().contains( p )
                && shapeItem->shape().contains( p ) )
            {
                return shapeItem;
            }
        }
    }

    return NULL;
}
开发者ID:0vermind,项目名称:NeoLoader,代码行数:37,代码来源:editor.cpp

示例13: drawItems

void QwtPlot::drawItems(QPainter *painter, const QRect &rect, 
        const QwtArray<QwtScaleMap> &map, 
        const QwtPlotPrintFilter &pfilter) const
{
    painter->save();

    const QwtPlotItemList& itmList = itemList();
    for ( QwtPlotItemIterator it = itmList.begin();
        it != itmList.end(); ++it )
    {
        QwtPlotItem *item = *it;
        if ( item && item->isVisible() )
        {
            if ( !(pfilter.options() & QwtPlotPrintFilter::PrintGrid)
                && item->rtti() == QwtPlotItem::Rtti_PlotGrid )
            {
                continue;
            }

#if QT_VERSION >= 0x040000
            const QPaintEngine *pe = painter->device()->paintEngine();
            if (pe->hasFeature(QPaintEngine::Antialiasing) )
            {
                painter->setRenderHint(QPainter::Antialiasing,
                    item->testRenderHint(QwtPlotItem::RenderAntialiased) );
            }
#endif

            item->draw(painter, 
                map[item->xAxis()], map[item->yAxis()],
                rect);
        }
    }

    painter->restore();
}
开发者ID:BackupTheBerlios,项目名称:qtiplot-svn,代码行数:36,代码来源:qwt_plot.cpp

示例14: sigmaDetect

void sigmaDetect(SAUIInterface* ui)
{
    QList<QwtPlotItem*> curs;
    SAChart2D* chart = filter_xy_series(ui,curs);
    if(nullptr == chart || curs.size() <= 0)
    {
        saUI->showMessageInfo(TR("unsupport chart items"),SA::WarningMessage);
        return;
    }
    double sigma;
    bool isMark,isChangedPlot;
    if(!getSigmaDetectPorperty(sigma,&isMark,&isChangedPlot,ui))
    {
        return;
    }
    if(!isMark && !isChangedPlot)
    {
        return;
    }
    QStringList infos;
    QScopedPointer<SAFigureOptCommand> topCmd(new SAFigureOptCommand(chart,QString("sigma %1").arg(sigma)));
    for (int i = 0;i<curs.size();++i)
    {
        QwtPlotItem* item = curs[i];
        switch(item->rtti())
        {
        case QwtPlotItem::Rtti_PlotCurve:
        {
            QVector<double> xs,ys;
            {
                QVector<QPointF> wave;
                SAChart::getPlotCurveSample(item,wave);
                xs.reserve(wave.size());
                ys.reserve(wave.size());
                std::for_each(wave.begin(),wave.end(),[&xs](const QPointF& p){xs.push_back(p.x());});
                std::for_each(wave.begin(),wave.end(),[&ys](const QPointF& p){ys.push_back(p.y());});
            }
            QString info;
            QString title = item->title().text();
            QVector<int> indexs;
            saFun::sigmaDenoising(xs,ys,sigma,indexs);
            info = QString("sigma(\"%1\") out range datas count:%2").arg(title).arg(indexs.size());
            infos.append(info);
            if(0 == indexs.size())
            {
                continue;
            }
            if(isMark)
            {
                QVector<double> oxs,oys;
                czy::copy_inner_indexs(xs.begin(),indexs.begin(),indexs.end(),std::back_inserter(oxs));
                czy::copy_inner_indexs(ys.begin(),indexs.begin(),indexs.end(),std::back_inserter(oys));
                QwtPlotCurve* curs = new QwtPlotCurve(QString("%1_outSigmaMarker").arg(title));
                curs->setSamples(oxs,oys);
                SAChart::setCurvePenStyle(curs,Qt::NoPen);
                QwtSymbol* sym = new QwtSymbol(QwtSymbol::XCross);
                sym->setColor(SARandColorMaker::getCurveColor());
                sym->setSize(QSize(6,6));
                curs->setSymbol(sym);
                new SAFigureChartItemAddCommand(chart
                                                ,curs
                                                ,QString("%1 - sigma out rang").arg(title)
                                                ,topCmd.data());
            }
            if(isChangedPlot)
            {
                QVector<int> allIndex;
                QVector<int> innerIndex;
                const int count = xs.size();
                innerIndex.resize(count);
                allIndex.reserve(count);
                for(int i=0;i<count;++i)
                {
                    allIndex.append(i);
                }
                czy::copy_out_of_indexs(allIndex.begin(),allIndex.end(),indexs.begin(),indexs.end(),std::back_inserter(innerIndex));
                QVector<double> oxs,oys;
                czy::copy_inner_indexs(xs.begin(),innerIndex.begin(),innerIndex.end(),std::back_inserter(oxs));
                czy::copy_inner_indexs(ys.begin(),innerIndex.begin(),innerIndex.end(),std::back_inserter(oys));
                QVector<QPointF> oxys;
                saFun::makeVectorPointF(oxs,oys,oxys);;

                new SAFigureReplaceAllDatasCommand<QPointF,QwtPlotCurve,decltype(&SAChart::setPlotCurveSample)>
                        (chart
                       ,item
                       ,oxys
                       ,TR("%1 sigma %2").arg(title).arg(sigma)
                       ,&SAChart::setPlotCurveSample
                       ,&SAChart::getPlotCurveSample
                       ,topCmd.data()
                       );

            }
            break;
        }
        }

        /*
        QwtSeriesStore<QPointF>* series = dynamic_cast<QwtSeriesStore<QPointF>*>(item);
        if(nullptr == series)
//.........这里部分代码省略.........
开发者ID:czyt1988,项目名称:sa,代码行数:101,代码来源:FunDataPreprocessing.cpp

示例15: pointSmooth

void pointSmooth(SAUIInterface* ui)
{
    QList<QwtPlotItem*> curs;
    SAChart2D* chart = filter_xy_series(ui,curs);
    if(nullptr == chart || curs.size() <= 0)
    {
        ui->showMessageInfo(TR("unsupport chart items"),SA::WarningMessage);
        return;
    }
    int m,n;
    if(!getPointSmoothPorperty(m,n,ui))
    {
        return;
    }
    QStringList infos;
    QScopedPointer<SAFigureOptCommand> topCmd(new SAFigureOptCommand(chart,QString("%1 point %2 power").arg(m).arg(n)));
    for (int i = 0;i<curs.size();++i)
    {
        QwtPlotItem* item = curs[i];
        QString title = item->title().text();

        switch(item->rtti())
        {
        case QwtPlotItem::Rtti_PlotCurve:
        {
            QVector<double> xs,ys;
            {
                QVector<QPointF> wave;
                SAChart::getPlotCurveSample(item,wave);
                xs.reserve(wave.size());
                ys.reserve(wave.size());
                std::for_each(wave.begin(),wave.end(),[&xs](const QPointF& p){xs.push_back(p.x());});
                std::for_each(wave.begin(),wave.end(),[&ys](const QPointF& p){ys.push_back(p.y());});
            }
            QVector<double> res;
            if(!saFun::pointSmooth(ys,m,n,res))
            {
                continue;
            }
            QVector<QPointF> xys;
            saFun::makeVectorPointF(xs,res,xys);

            new SAFigureReplaceAllDatasCommand<QPointF,QwtPlotCurve,decltype(&SAChart::setPlotCurveSample)>
                    (chart
                   ,item
                   ,xys
                   ,TR("%1 m%2n%3").arg(title).arg(m).arg(n)
                   ,&SAChart::setPlotCurveSample
                   ,&SAChart::getPlotCurveSample
                   ,topCmd.data()
                   );
            infos.append(TR("%1 m%2n%3 smooth").arg(title).arg(m).arg(n));
            break;
        }
        }

        /*
        QwtSeriesStore<QPointF>* series = dynamic_cast<QwtSeriesStore<QPointF>*>(item);
        if(nullptr == series)
        {
            continue;
        }
        QVector<double> xs,ys;

        if(!chart->getXYData(&xs,&ys,item))
        {
            continue;
        }
        if(!chart->getXYData(&xs,&ys,item))
        {
            continue;
        }
        QVector<double> res;
        if(!saFun::pointSmooth(ys,m,n,res))
        {
            continue;
        }
        QVector<QPointF> xys;
        saFun::makeVectorPointF(xs,res,xys);
        new SAFigureChangeXYSeriesDataCommand(chart
                                             ,series
                                             ,TR("%1 m%2n%3").arg(title).arg(m).arg(n)
                                             ,xys
                                             ,topCmd.data());

        infos.append(TR("%1 m%2n%3 smooth").arg(title).arg(m).arg(n));
        */
    }
    if(topCmd->childCount() > 0)
    {
        chart->appendCommand(topCmd.take());
        ui->showNormalMessageInfo(infos.join('\n'));
    }
}
开发者ID:czyt1988,项目名称:sa,代码行数:94,代码来源:FunDataPreprocessing.cpp


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