当前位置: 首页 > news >正文

建设网站公司是什么网络营销的未来发展趋势论文

建设网站公司是什么,网络营销的未来发展趋势论文,深圳企业网站制作报价,乌鲁木做兼职的网站目录 一、固高示波器 二、基于QCustomPlot实现示波器 三、完整源码 一、固高示波器 固高运动控制卡自带的软件有一个示波器功能,可以实时显示速度的波形,可辅助分析电机的运行状态。但是我们基于sdk开发了自己的软件,无法再使用该功能&…

目录

一、固高示波器

二、基于QCustomPlot实现示波器

三、完整源码


一、固高示波器

        固高运动控制卡自带的软件有一个示波器功能,可以实时显示速度的波形,可辅助分析电机的运行状态。但是我们基于sdk开发了自己的软件,无法再使用该功能,原因是2个软件不能同时与控制卡通信,故此需要我们自己再开发一个示波器。

固高示波器功能展示,功能包括多条曲线的显示、继续/暂停、左移、右移、设置、轴选择等。

二、基于QCustomPlot实现示波器

GCustomPlot简介与使用看官网就可以了

简介, Qt Plotting Widget QCustomPlot - Introduction

下载, Qt Plotting Widget QCustomPlot - Download

需要注意的是需要在pro文件中加入printsuppot模块,源码中使用该模块做pdf打印功能

QT       += printsupport

 参考固高的功能实现速度示波器效果如下

 QCustomPlot初始化设置

    m_customPlot = new QCustomPlot(this);m_customPlot->setObjectName(QLatin1String("customPlot"));ui->vlyPlot->addWidget(m_customPlot);m_customPlot->setBackground(QBrush(QColor("#474848")));m_customPlot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom |QCP::iSelectPlottables);  /* 可拖拽+可滚轮缩放 */m_customPlot->legend->setVisible(true);

添加两条曲线图,addGraph

    m_customPlot->addGraph();m_customPlot->graph(0)->setPen(QPen(Qt::green, 3));m_customPlot->graph(0)->setName(QStringLiteral("实际速度"));m_customPlot->addGraph();m_customPlot->graph(1)->setPen(QPen(Qt::yellow, 3));m_customPlot->graph(1)->setName(QStringLiteral("规划速度"));

 左右移动,通过设置X轴的范围来改变,再使用replot函数更新视图

m_customPlot->xAxis->setRange(m_customPlot->xAxis->range().lower - ui->spbStep->value(),m_customPlot->xAxis->range().upper - ui->spbStep->value());m_customPlot->replot();

网格线显示与隐藏

        m_customPlot->xAxis->grid()->setVisible(checked);m_customPlot->yAxis->grid()->setVisible(checked);m_customPlot->replot();

添加数据,示波器有向左自动滚动的效果,也是通过设置范围来实现

void OscilloscopeFrame::addData(double key, double actVel, double prfVel)
{m_customPlot->graph(0)->addData(key, actVel);m_customPlot->graph(1)->addData(key, prfVel);m_customPlot->xAxis->rescale();m_customPlot->graph(0)->rescaleValueAxis(false, true);m_customPlot->graph(1)->rescaleValueAxis(false, true);m_customPlot->xAxis->setRange(m_customPlot->xAxis->range().upper,m_fixedLength, Qt::AlignRight);m_customPlot->replot(QCustomPlot::rpQueuedReplot);  /* 实现重绘 */
}

实时显示数据,通过定时器实现

    m_timer = new QTimer();connect(m_timer, &QTimer::timeout, updateData);m_timer->start(OSCILLOSCOPE_UPDATE_MSEC);

鼠标放在曲线上显示当前值,关联鼠标移动信号,映射坐标pixelToCoord

    connect(m_customPlot, SIGNAL(mouseMove(QMouseEvent *)), this,SLOT(plotMouseMoveEvent(QMouseEvent *)));
void OscilloscopeFrame::plotMouseMoveEvent(QMouseEvent *event)
{if ( Qt::ControlModifier == event->modifiers()){int x_pos = event->pos().x();int x_val = m_customPlot->xAxis->pixelToCoord(x_pos);float y = m_customPlot->graph(0)->data()->at(x_val)->value;QString strToolTip = QString("%1,%2").arg(x_val).arg(y);QToolTip::showText(cursor().pos(), strToolTip, m_customPlot);}
}

三、完整源码

OscilloscopeFrame.h

#ifndef OSCILLOSCOPEFRAME_H
#define OSCILLOSCOPEFRAME_H#include <QFrame>
#include "oscilloscopelib_global.h"namespace Ui
{class OscilloscopeFrame;
}class QCustomPlot;class AbstractRobot;class OSCILLOSCOPELIBSHARED_EXPORT OscilloscopeFrame : public QFrame
{Q_OBJECTpublic:explicit OscilloscopeFrame(QWidget *parent = 0);~OscilloscopeFrame();void setFixedLength(double length);void addData(double key, double actVel, double prfVel);void installController(AbstractRobot *controller);private slots:void plotMouseMoveEvent(QMouseEvent *event);private:Ui::OscilloscopeFrame *ui;QCustomPlot *m_customPlot = nullptr;QTimer *m_timer = nullptr;double m_fixedLength;AbstractRobot *m_controller = nullptr;double m_actPos = 0;double m_count = 0;
};#endif // OSCILLOSCOPEFRAME_H

OscilloscopeFrame.cpp

#include "OscilloscopeFrame.h"
#include "qcustomplot.h"
#include "ui_OscilloscopeFrame.h"
#include <QtMath>
#include <QDebug>
#include <device/AbstractRobot.h>#define OSCILLOSCOPE_UPDATE_MSEC  60OscilloscopeFrame::OscilloscopeFrame(QWidget *parent) :QFrame(parent),ui(new Ui::OscilloscopeFrame)
{ui->setupUi(this);ui->spbStep->setValue(1);for(int i = 1; i <= 8; ++i){ui->cmbAxisId->addItem(QString::number(i));}m_customPlot = new QCustomPlot(this);m_customPlot->setObjectName(QLatin1String("customPlot"));ui->vlyPlot->addWidget(m_customPlot);m_customPlot->setBackground(QBrush(QColor("#474848")));m_customPlot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom |QCP::iSelectPlottables);  /* 可拖拽+可滚轮缩放 */m_customPlot->legend->setVisible(true);m_customPlot->addGraph();m_customPlot->graph(0)->setPen(QPen(Qt::green, 3));m_customPlot->graph(0)->setName(QStringLiteral("实际速度"));m_customPlot->addGraph();m_customPlot->graph(1)->setPen(QPen(Qt::yellow, 3));m_customPlot->graph(1)->setName(QStringLiteral("规划速度"));m_customPlot->axisRect()->setupFullAxesBox();m_customPlot->yAxis->setRange(0, 3.3);ui->btnPause2Continue->setCheckable(true);setFixedLength(100);/* 暂停/继续 */connect(ui->btnPause2Continue, &QPushButton::clicked, this, [ = ](){if(!m_timer){return;}bool isCheckable = ui->btnPause2Continue->isCheckable();if(isCheckable){m_timer->stop();ui->btnPause2Continue->setText(QStringLiteral("继续"));}else{m_timer->start(OSCILLOSCOPE_UPDATE_MSEC);ui->btnPause2Continue->setText(QStringLiteral("暂停"));}ui->btnPause2Continue->setCheckable(!isCheckable);});/* 左移 */connect(ui->btnLeftMove, &QPushButton::clicked, this, [ = ](){m_customPlot->xAxis->setRange(m_customPlot->xAxis->range().lower - ui->spbStep->value(),m_customPlot->xAxis->range().upper - ui->spbStep->value());m_customPlot->replot();});/* 右移 */connect(ui->btnRightMove, &QPushButton::clicked, this, [ = ](){m_customPlot->xAxis->setRange(m_customPlot->xAxis->range().lower  + ui->spbStep->value(),m_customPlot->xAxis->range().upper  + ui->spbStep->value());m_customPlot->replot();});/* 显示表格 */connect(ui->chkGrid, &QCheckBox::toggled, this, [ = ](bool checked){m_customPlot->xAxis->grid()->setVisible(checked);m_customPlot->yAxis->grid()->setVisible(checked);m_customPlot->replot();});auto updateData = [ & ](){if(m_controller){int axis = ui->cmbAxisId->currentText().toInt();T_AxisStatus status;int ec = m_controller->readAxisStatus(axis, &status);if(0 == ec){ui->lblActVel->setText(QString::number(status.dEncVel));ui->lblPrfVel->setText(QString::number(status.dPrfVel));ui->lblActPos->setText(QString::number(status.dEncPos));ui->lblPrfPos->setText(QString::number(status.dPrfPos));if(m_actPos != status.dEncPos){m_actPos = status.dEncPos;addData(m_count, status.dEncVel, status.dPrfVel);m_count ++;}}else{ui->lblActVel->setText("error " + QString::number(ec));ui->lblPrfVel->setText("error " + QString::number(ec));ui->lblActPos->setText("error " + QString::number(ec));ui->lblPrfPos->setText("error " + QString::number(ec));}}};m_timer = new QTimer();connect(m_timer, &QTimer::timeout, updateData);m_timer->start(OSCILLOSCOPE_UPDATE_MSEC);connect(m_customPlot, SIGNAL(mouseMove(QMouseEvent *)), this,SLOT(plotMouseMoveEvent(QMouseEvent *)));for(int i = 0; i < 500; i++){double x = qDegreesToRadians((double)i);addData(i, sin(x), cos(x));}
}OscilloscopeFrame::~OscilloscopeFrame()
{m_timer->stop();delete m_timer;m_timer = nullptr;delete ui;
}void OscilloscopeFrame::setFixedLength(double length)
{/* 显示固定长度 */m_fixedLength = length;
}void OscilloscopeFrame::addData(double key, double actVel, double prfVel)
{m_customPlot->graph(0)->addData(key, actVel);m_customPlot->graph(1)->addData(key, prfVel);m_customPlot->xAxis->rescale();m_customPlot->graph(0)->rescaleValueAxis(false, true);m_customPlot->graph(1)->rescaleValueAxis(false, true);m_customPlot->xAxis->setRange(m_customPlot->xAxis->range().upper,m_fixedLength, Qt::AlignRight);m_customPlot->replot(QCustomPlot::rpQueuedReplot);  /* 实现重绘 */
}void OscilloscopeFrame::installController(AbstractRobot *controller)
{m_controller = controller;
}void OscilloscopeFrame::plotMouseMoveEvent(QMouseEvent *event)
{if ( Qt::ControlModifier == event->modifiers()){int x_pos = event->pos().x();int x_val = m_customPlot->xAxis->pixelToCoord(x_pos);float y = m_customPlot->graph(0)->data()->at(x_val)->value;QString strToolTip = QString("%1,%2").arg(x_val).arg(y);QToolTip::showText(cursor().pos(), strToolTip, m_customPlot);}
}


文章转载自:
http://photofluorogram.c7630.cn
http://sententiousness.c7630.cn
http://strombuliform.c7630.cn
http://ccs.c7630.cn
http://benedictus.c7630.cn
http://cocoonery.c7630.cn
http://omg.c7630.cn
http://arrear.c7630.cn
http://xerography.c7630.cn
http://hydroxid.c7630.cn
http://ely.c7630.cn
http://incisory.c7630.cn
http://unpretentious.c7630.cn
http://formicarium.c7630.cn
http://chicly.c7630.cn
http://anglo.c7630.cn
http://superrace.c7630.cn
http://enology.c7630.cn
http://elohim.c7630.cn
http://typeset.c7630.cn
http://prelector.c7630.cn
http://gunfight.c7630.cn
http://gazoomph.c7630.cn
http://bursiculate.c7630.cn
http://nailhole.c7630.cn
http://delimit.c7630.cn
http://tercet.c7630.cn
http://reappear.c7630.cn
http://platinate.c7630.cn
http://flew.c7630.cn
http://dissolvent.c7630.cn
http://pupilage.c7630.cn
http://algebraize.c7630.cn
http://absinth.c7630.cn
http://stratigraphy.c7630.cn
http://slavophobe.c7630.cn
http://depancreatize.c7630.cn
http://sacramento.c7630.cn
http://conjoint.c7630.cn
http://thermae.c7630.cn
http://inlay.c7630.cn
http://rescission.c7630.cn
http://marconi.c7630.cn
http://sophism.c7630.cn
http://riboflavin.c7630.cn
http://unobjectionable.c7630.cn
http://joyance.c7630.cn
http://neuromata.c7630.cn
http://varicocele.c7630.cn
http://segmentary.c7630.cn
http://inadequacy.c7630.cn
http://pinochle.c7630.cn
http://paddybird.c7630.cn
http://dup.c7630.cn
http://coppernose.c7630.cn
http://tridimensional.c7630.cn
http://permutable.c7630.cn
http://sonship.c7630.cn
http://autobiographic.c7630.cn
http://scum.c7630.cn
http://paddywhack.c7630.cn
http://grepo.c7630.cn
http://lapstreak.c7630.cn
http://protocontinent.c7630.cn
http://windiness.c7630.cn
http://philae.c7630.cn
http://ssafa.c7630.cn
http://asterid.c7630.cn
http://cholecalciferol.c7630.cn
http://autologous.c7630.cn
http://durra.c7630.cn
http://pulka.c7630.cn
http://embolization.c7630.cn
http://baroceptor.c7630.cn
http://snagged.c7630.cn
http://skysail.c7630.cn
http://edulcorate.c7630.cn
http://dressmaker.c7630.cn
http://nub.c7630.cn
http://passional.c7630.cn
http://foulmouthed.c7630.cn
http://fickleness.c7630.cn
http://insectile.c7630.cn
http://cryoscopic.c7630.cn
http://sanbenito.c7630.cn
http://ecocide.c7630.cn
http://unmated.c7630.cn
http://darktown.c7630.cn
http://harslet.c7630.cn
http://goalpost.c7630.cn
http://abate.c7630.cn
http://sabre.c7630.cn
http://backpedal.c7630.cn
http://stuff.c7630.cn
http://rapscallion.c7630.cn
http://sunfall.c7630.cn
http://vaunty.c7630.cn
http://chafe.c7630.cn
http://core.c7630.cn
http://continuable.c7630.cn
http://www.zhongyajixie.com/news/76919.html

相关文章:

  • 长春做网站qianceyun成都关键词排名推广
  • 深圳做网站公司哪家比较好优化营商环境条例心得体会
  • 域名注册网站推荐房地产销售
  • 郑州网站+建设搜索关键词怎么让排名靠前
  • 公司做网站的招标书1688如何搜索关键词排名
  • 六安招聘网最新招聘seo网站优化方案
  • 网站开发公司基本业务流程图郑州网络营销策划
  • 如何做博客网站武汉seo报价
  • 网站建设会议议程巩义网站推广优化
  • 做学校网站的目的是什么掌门一对一辅导官网
  • html怎么制作网页windows优化大师官方免费下载
  • 网站权重怎么刷网页设计和网站制作
  • 和17做网店一样的货源网站服务器租用
  • 购买建立网站费怎么做会计凭证正规网站建设公司
  • 网站如何加链接软件外包平台
  • b2c网站价格杭州百度快照推广
  • 把自己的电脑做网站服务器2023很有可能再次封城吗
  • 泰安做网站哪家好seo外包
  • 广州市门户网站建设品牌网站排名优化怎样做
  • 国外网站建设软件宁波seo企业推广
  • 织梦品牌集团公司网站模板(精)微博推广方案
  • java网站开发工具西地那非
  • 网站桌面图标怎么做网站关键字优化
  • 阿里云虚拟主机做2个网站吗营销网站seo推广
  • 建站平台与自己做网站公司软文怎么写
  • wordpress网站科学主题在线搜索引擎
  • 濮阳市网站建设中国万网域名注册服务内容
  • 织梦 视频网站源码网站是怎么优化的
  • 做自己点击网站电商seo优化
  • 广州市建设工程项目代建局网站百度推广投诉人工电话