本文整理汇总了C++中QwtPlotMarker类的典型用法代码示例。如果您正苦于以下问题:C++ QwtPlotMarker类的具体用法?C++ QwtPlotMarker怎么用?C++ QwtPlotMarker使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QwtPlotMarker类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: T
void Variog_plot::mouseReleaseEvent(QMouseEvent * event)
{
std::cerr << "show_pairs_count() called " << std::endl;
if( event->button() != Qt::RightButton ) return;
const float offset=1.02;
QFont font;
font.setPointSize( 7 );
if( !pairs_shown_ ) {
for( unsigned int i=0; i < pairs_.size(); i++ ) {
QString label;
label.setNum( pairs_[i] );
QwtText T(label);
QwtPlotMarker * marker = new QwtPlotMarker();
marker->attach(this);
T.setFont(font);
marker->setValue(pairs_coord_x_[i], pairs_coord_y_[i]*offset);
marker->setLabel(T);
}
pairs_shown_ = true;
}
else {
detachItems(QwtPlotItem::Rtti_PlotMarker);
pairs_shown_ = false;
}
replot();
}
示例2: switch
/*!
This function is a shortcut to insert a horizontal or vertical
line marker, dependent on the specified axis.
\param label Label
\param axis Axis to be attached
\return New key if the marker could be inserted, 0 if not.
*/
long QwtPlot::insertLineMarker(const QString &label, int axis)
{
QwtMarker::LineStyle lineStyle = QwtMarker::NoLine;
int xAxis = QwtPlot::xBottom;
int yAxis = QwtPlot::yLeft;
switch(axis)
{
case yLeft:
case yRight:
yAxis = axis;
lineStyle = QwtMarker::HLine;
break;
case xTop:
case xBottom:
xAxis = axis;
lineStyle = QwtMarker::VLine;
break;
}
QwtPlotMarker *marker = new QwtPlotMarker(this);
if ( marker == 0 )
return 0;
marker->setAxis(xAxis, yAxis);
marker->setLabel(label);
marker->setLineStyle(lineStyle);
marker->setLabelAlignment(Qt::AlignRight|Qt::AlignTop);
long key = insertMarker(marker);
if ( key == 0 )
delete marker;
return key;
}
示例3: itemList
// Select the point at a position.
void XtalOptPlot::select(const QPoint& pos)
{
QwtPlotMarker* selection = nullptr;
// Must be within 10 pixels at least
double dist = 10.0;
const QwtPlotItemList& itmList = itemList();
for (QwtPlotItemIterator it = itmList.begin(); it != itmList.end(); ++it) {
if ((*it)->rtti() == QwtPlotItem::Rtti_PlotMarker) {
QwtPlotMarker* m = static_cast<QwtPlotMarker*>(*it);
// We have to map the plot coordinates onto widget coordinates before
// comparing
const QwtScaleMap& xMap = canvasMap(m->xAxis());
const QwtScaleMap& yMap = canvasMap(m->yAxis());
double mx = xMap.transform(m->xValue());
double my = yMap.transform(m->yValue());
double d = distance(QPointF(mx, my), pos);
if (d < dist) {
selection = m;
dist = d;
}
}
}
selectMarker(selection);
}
示例4: QDialog
SimDialog::SimDialog( QWidget * parent, Qt::WFlags f)
: QDialog(parent, f)
{
setupUi(this);
// setup the plot ...
m_plot->setTitle("Comparing Similarity Measures");
m_plot->insertLegend(new QwtLegend(), QwtPlot::BottomLegend);
// set up the axes ...
m_plot->setAxisTitle(QwtPlot::xBottom, "Variations");
m_plot->setAxisScale(QwtPlot::xBottom, -10, 10);
m_plot->setAxisTitle(QwtPlot::yLeft, "Similarity");
m_plot->setAxisScale(QwtPlot::yLeft, -1.5, 1.5);
// enable grid ...
QwtPlotGrid *grid = new QwtPlotGrid;
grid->enableXMin(true);
grid->enableYMin(true);
grid->setMajPen(QPen(Qt::black, 0, Qt::DotLine));
grid->setMinPen(QPen(Qt::gray, 0 , Qt::DotLine));
grid->attach(m_plot);
// Insert zero line at y = 0
QwtPlotMarker *mY = new QwtPlotMarker();
mY->setLabelAlignment(Qt::AlignRight|Qt::AlignTop);
mY->setLineStyle(QwtPlotMarker::HLine);
mY->setYValue(0.0);
mY->attach(m_plot);
// Insert zero line at x = 0
QwtPlotMarker *mX = new QwtPlotMarker();
mX->setLabelAlignment(Qt::AlignRight|Qt::AlignTop);
mX->setLineStyle(QwtPlotMarker::VLine);
mX->setXValue(0.0);
mX->attach(m_plot);
// Insert new curves
cReg = new QwtPlotCurve("Regular Similarity Measure");
cReg->attach(m_plot);
cOct = new QwtPlotCurve("Octree based Similarity Measure");
cOct->attach(m_plot);
// Set curve styles
cReg->setPen(QPen(Qt::red, 2));
cOct->setPen(QPen(Qt::blue, 2));
// Populate the volume combos ...
MainWindow* _win = (MainWindow *)this->parent();
viewer3d * _view = (viewer3d *) _win->getViewer();
QList<Volume*> _vols = _view->getVolumes();
// append Volume names to combo boxes ...
// Need to modify Volume class so that it stored patient name ...
// More importantly modify PatientBrowser so that the data can be directly
// loaded.
}
示例5: QwtPlot
DataPlot::DataPlot(QWidget *parent, TelemetryStateReceiver* collector, OdometryStateReceiver* odometryReceiver,QMap<QString, QStringList> *list) :
QwtPlot(parent),
d_interval(0),
d_timerId(-1)
{
node=collector;
odom_receiver=odometryReceiver;
connect_status=false;
QObject::connect( node, SIGNAL( parameterReceived( )), this, SLOT( onParameterReceived( )));
data_count=0;
posicionBuffer=PLOT_SIZE;
colors_list <<"red"<<"blue"<<"green"<<"black"<<"yellow"<<"magenta"<<"cyan"<<"gray"<<"darkCyan"<<"darkMagenta"<<"darkYellow"<<"darkGray"<<"darkRed"<<"darkBlue"<<"darkGreen"<<"lightGray" <<"red"<<"blue"<<"green"<<"black"<<"yellow"<<"magenta"<<"cyan"<<"gray"<<"darkCyan"<<"darkMagenta"<<"darkYellow"<<"darkGray"<<"darkRed"<<"darkBlue"<<"darkGreen"<<"lightGray" <<"red"<<"blue"<<"green"<<"black"<<"yellow"<<"magenta"<<"cyan"<<"gray"<<"darkCyan"<<"darkMagenta"<<"darkYellow"<<"darkGray"<<"darkRed"<<"darkBlue"<<"darkGreen"<<"lightGray" <<"red"<<"blue"<<"green"<<"black"<<"yellow"<<"magenta"<<"cyan"<<"gray"<<"darkCyan"<<"darkMagenta"<<"darkYellow"<<"darkGray"<<"darkRed"<<"darkBlue"<<"darkGreen"<<"lightGray";
iterator_colors=0;
is_stop_pressed=false;
alignScales();
setAutoReplot(false);
parameters_list = setCurveLabels(*list);
current_min_limit=0;
current_max_limit=0;
QwtPlotZoomer* zoomer = new MyZoomer(canvas());
QwtPlotPanner *panner = new QwtPlotPanner(canvas());
panner->setAxisEnabled(QwtPlot::yRight, true);
panner->setMouseButton(Qt::MidButton);
// Avoid jumping when labels with more/less digits
// appear/disappear when scrolling vertically
const QFontMetrics fm(axisWidget(QwtPlot::yLeft)->font());
QwtScaleDraw *sd = axisScaleDraw(QwtPlot::yLeft);
sd->setMinimumExtent( fm.width("100.00") );
const QColor c(Qt::darkBlue);
zoomer->setRubberBandPen(c);
zoomer->setTrackerPen(c);
setGridPlot();
initTimeData();
#if 0
// Insert zero line at y = 0
QwtPlotMarker *mY = new QwtPlotMarker();
mY->setLabelAlignment(Qt::AlignRight|Qt::AlignTop);
mY->setLineStyle(QwtPlotMarker::HLine);
mY->setYValue(0.0);
mY->attach(this);
#endif
initAxisX();
initAxisY();
initCurves();
setTimerInterval(1000);// 1 second = 1000
}
示例6: markerSymbol
/*!
\return a marker's symbol
\param key Marker key
*/
QwtSymbol QwtPlot::markerSymbol(long key) const
{
QwtPlotMarker *m = d_markers->find(key);
if (m)
return m->symbol();
else
return QwtSymbol();
}
示例7: markerLineStyle
/*!
\return a marker's line style
\param key Marker key
*/
QwtMarker::LineStyle QwtPlot::markerLineStyle(long key) const
{
QwtPlotMarker *m = d_markers->find(key);
if (m)
return m->lineStyle();
else
return QwtMarker::NoLine;
}
示例8: markerLabel
/*!
\return a marker's label
\param key Marker key
*/
const QString QwtPlot::markerLabel(long key) const
{
QwtPlotMarker *m = d_markers->find(key);
if (m)
return m->label();
else
return QString::null;
}
示例9: markerLabelAlign
/*!
\return a marker's label alignment
\param key Marker key
*/
int QwtPlot::markerLabelAlign(long key) const
{
QwtPlotMarker *m = d_markers->find(key);
if (m)
return m->labelAlignment();
else
return 0;
}
示例10: markerFont
/*!
\return the font of a marker
*/
QFont QwtPlot::markerFont(long key) const
{
QwtPlotMarker *m = d_markers->find(key);
if (m)
return m->font();
else
return QFont();
}
示例11: removeMarker
void Plot::removeMarker(int index)
{
QwtPlotMarker *m = d_markers[index];
if(!m)
return;
m->detach();
d_markers.remove (index);
}
示例12: Plot_AddHLine
void Plot_AddHLine(QwtPlot* plot, double value , double r , double g, double b)
{
QwtPlotMarker *marker = new QwtPlotMarker();
marker->setLineStyle ( QwtPlotMarker::HLine );
marker->setLinePen(QPen(QColor(r, g, b, 128), 1, Qt::DashDotLine));
marker->attach( plot );
marker->setYValue( value );
}
示例13: QwtPlotMarker
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QwtPlotMarker* RicGridStatisticsDialog::createVerticalPlotMarker(const QColor& color, double xValue)
{
QwtPlotMarker* marker = new QwtPlotMarker();
marker->setXValue(xValue);
marker->setLineStyle(QwtPlotMarker::VLine);
marker->setLinePen(color, 2, Qt::SolidLine);
return marker;
}
示例14: markerLinePen
/*!
\return a marker's line pen
\param key Marker key
*/
QPen QwtPlot::markerLinePen(long key) const
{
QwtPlotMarker *m = d_markers->find(key);
if (m)
return m->linePen();
else
return QPen();
}
示例15: markerYAxis
/*!
\return the y axis to which a marker is attached
\param key Marker key
*/
int QwtPlot::markerYAxis(long key) const
{
QwtPlotMarker *m = d_markers->find(key);
if (m)
return m->yAxis();
else
return -1;
}