【QT教程】使用qcustomplot完成对图像的拖动、框选缩放、自动缩放、游标等操作

news2024/10/5 14:26:25

目录

  • 1.Qt 配置qcustomplot
  • 2.图像拖拽功能
  • 3.图像框选放大
  • 4.曲线自动缩放
  • 5.图像游标
  • 6.【完整代码】将曲线抽象成一个类,以便复用

1.Qt 配置qcustomplot

首先下载qcustomplot官网(qcustomplot下载地址)下载最近的源码,我用的是2.1.1版本。下载完成后解压,得到如下文件。
在这里插入图片描述
将.h和.cpp文件加入到工程中
在这里插入图片描述
如果使用的是Qt creator的话,在.pro文件中加入printsupport

在这里插入图片描述

打开.ui文件,选中Widget模块拖入到界面当中

在这里插入图片描述
右键这个Widget,选择【提升为】
在这里插入图片描述

输入 QCustomPlot,点击添加、提升为

在这里插入图片描述
之后我们为这个控件改个名字就可以操作它啦。这里我给他重命名为widget_Force。

2.图像拖拽功能

首先在主线程中声明qcustomplot类,并实现一个对象。

    QTimer *plotTimer;//曲线刷新定时器
    /***************曲线绘制**********************/
    /*选中的曲线画笔*/
    QVector<QPen> selectedPen;
    /*选中的图例字体*/
    QFont YHfontBold;
    /*力曲线*/
    QCustomPlot *widget_Force;
    CurvePlot *curves_Force;

图像拖拽功能

		//禁用选择矩形
 		widget_Force->setSelectionRectMode(QCP::SelectionRectMode::srmNone);
 		//使能拖动
        widget_Force->setInteraction(QCP::iRangeDrag, true);

演示

在这里插入图片描述

3.图像框选放大

        widget_Force->setInteraction(QCP::iRangeDrag, false);//取消拖动
        widget_Force->setSelectionRectMode(QCP::SelectionRectMode::srmZoom);

演示
在这里插入图片描述

4.曲线自动缩放

右键曲线实现自动缩放功能需要添加一个右键菜单栏。
首先定义信号槽

    //右键菜单
    connect(widget_Force, &QCustomPlot::customContextMenuRequested, this, &MainWindow::contextMenuRequestForce);

槽函数如下

void MainWindow::contextMenuRequestForce(QPoint pos)
{
    QMenu *menu = new QMenu(this);
    menu->setStyleSheet("font:11pt;font-family:Microsoft YaHei");
    menu->setAttribute(Qt::WA_DeleteOnClose);
    menu->popup(widget_Force->mapToGlobal(pos));
    menu->addAction("调整范围", curves_Force, &CurvePlot::rescaleAxes);
    menu->addAction("清除选中曲线", curves_Force, &CurvePlot::clearCurve);
}

rescaleAxes 函数如下

void CurvePlot::rescaleAxes()//曲线全部显示
{
	//给第一个graph设置rescaleAxes(),后续所有graph都设置rescaleAxes(true)即可实现显示所有曲线。
	//rescaleAxes(true)时如果plot的X或Y轴本来能容纳下本graph的X或Y数据点,
	//那么plot的X或Y轴的可视范围就无需调整,只有plot容纳不下本graph时,才扩展plot两个轴的显示范围。
	//见博客https://www.csdn.net/gather_26/MtTaYg2sMzgxNDgtYmxvZwO0O0OO0O0O.html
	myPlot->graph(0)->rescaleAxes();
	myPlot->graph(1)->rescaleAxes(true);
	myPlot->replot();
}

演示
在这里插入图片描述

5.图像游标

使用游标的话需要配合鼠标事件完成
首先声明一下游标

	/*************游标*************/
	bool tracerEnable;//游标使能
	QCPItemTracer *tracer0 = nullptr; // 0号曲线游标
	QCPItemTracer *tracer1 = nullptr; // 1号曲线游标
	QCPItemText *tracer0Label = nullptr; // 0号曲线X游标标签
    QCPItemText *tracer1Label = nullptr;// 1号曲线Y轴游标标签
	void setVisibleTracer(bool trueorfalse);//游标可见/不可见 true/false

然后配置游标的属性

if (arg1)
	{
		qDebug() << "act_tracer is on!";
		tracerEnable = true;
		tracer0 = new QCPItemTracer(myPlot);
		tracer0->setStyle(QCPItemTracer::tsCrosshair);//游标样式:十字星、圆圈、方框
		tracer0->setPen(QPen(Qt::green));//设置tracer的颜色绿色
		tracer0->setPen(QPen(Qt::DashLine));//虚线游标
		tracer0->setBrush(QBrush(Qt::red));
		tracer0->setSize(10);
		tracer0->setInterpolating(true);//false禁用插值

		tracer1 = new QCPItemTracer(myPlot);
		tracer1->setStyle(QCPItemTracer::tsCrosshair);//游标样式:十字星、圆圈、方框
		tracer1->setPen(QPen(Qt::green));//设置tracer的颜色绿色
		tracer1->setPen(QPen(Qt::DashLine));//虚线游标
		tracer1->setBrush(QBrush(Qt::red));
		tracer1->setSize(10);
		tracer1->setInterpolating(true);//false禁用插值

		tracer0Label = new QCPItemText(myPlot);
		tracer0Label->setClipToAxisRect(false);
		tracer0Label->setLayer("overlay");
		tracer0Label->setPen(QPen(Qt::green));
		tracer0Label->setFont(QFont("Microsoft YaHei", 10));
		tracer0Label->setPadding(QMargins(2, 2, 2, 2));
		tracer0Label->setPositionAlignment(Qt::AlignLeft | Qt::AlignTop);
		//下面这个语句很重要,它将游标说明锚固在tracer位置处,实现自动跟随
		tracer0Label->position->setType(QCPItemPosition::ptAxisRectRatio);//位置类型(当前轴范围的比例为单位/实际坐标为单位)
		tracer0Label->position->setParentAnchor(tracer0->position);

		tracer1Label = new QCPItemText(myPlot);
		tracer1Label->setClipToAxisRect(false);
		tracer1Label->setLayer("overlay");
		tracer1Label->setPen(QPen(Qt::red));
		tracer1Label->setFont(QFont("Microsoft YaHei", 10));
		tracer1Label->setPadding(QMargins(2, 2, 2, 2));
		tracer1Label->setPositionAlignment(Qt::AlignLeft | Qt::AlignTop);
		//下面这个语句很重要,它将游标说明锚固在tracer位置处,实现自动跟随
		tracer1Label->position->setType(QCPItemPosition::ptAxisRectRatio);//位置类型(当前轴范围的比例为单位/实际坐标为单位)
		tracer1Label->position->setParentAnchor(tracer1->position);
	}
	else
	{
		qDebug() << "act_tracer is off !";
		tracerEnable = false;
		setVisibleTracer(false);
	}

然后编写鼠标事件,并进行信号槽绑定。

   //游标鼠标事件信号槽
    connect(widget_Force, &QCustomPlot::mouseMove, curves_Force, &CurvePlot::myMouseMoveEvent);
void CurvePlot::myMouseMoveEvent(QMouseEvent * event)//鼠标移动事件
{
	if (tracerEnable)//游标使能判断
	{
		double x = myPlot->xAxis->pixelToCoord(event->pos().x());//鼠标点的像素坐标转plot坐标

		foundRange = true;
		QrangeX0 = myPlot->graph(0)->getKeyRange(foundRange, QCP::sdBoth);//获取0号曲线X轴坐标范围
		QrangeX0_lower = QrangeX0.lower;
		QrangeX0_upper = QrangeX0.upper;

		QrangeX1 = myPlot->graph(1)->getKeyRange(foundRange, QCP::sdBoth);//获取1号曲线X轴坐标范围
		QrangeX1_lower = QrangeX1.lower;
		QrangeX1_upper = QrangeX1.upper;
		//如果鼠标移动超出0号曲线X轴范围,则0号曲线隐藏游标
		if (x < QrangeX0_upper && x > QrangeX0_lower)
		{
			tracer0->setGraph(myPlot->graph(0));//设置游标吸附在traceGraph这条曲线上
			tracer0->setGraphKey(x);//将游标横坐标(key)设置成刚获得的横坐标数据x (这就是游标随动的关键代码)
			tracer0->updatePosition(); //使得刚设置游标的横纵坐标位置生效
			double traceX0 = tracer0->position->key();
			double traceY0 = tracer0->position->value();

			tracer0Label->setText(QString::number(traceX0, 'f', 3));//游标文本框,指示游标的X值
			tracer0Label->setText(QString("x = %1\ny = %2").arg(QString::number(traceX0, 'f', 3)).arg(QString::number(traceY0, 'f', 3)));
			tracer0->setVisible(true);
			tracer0Label->setVisible(true);
		}
		else
		{
			tracer0->setVisible(false);
			tracer0Label->setVisible(false);
		}
		//如果鼠标移动超出1号曲线X轴范围,则1号曲线隐藏游标
		if (x < QrangeX1_upper && x > QrangeX1_lower)
		{
			double traceX1 = tracer1->position->key();
			double traceY1 = tracer1->position->value();
			tracer1->setGraph(myPlot->graph(1));//设置游标吸附在traceGraph这条曲线上
			tracer1->setGraphKey(x);
			tracer1->updatePosition(); //使得刚设置游标的横纵坐标位置生效

			tracer1Label->setText(QString("x = %1\ny = %2").arg(QString::number(traceX1, 'f', 3)).arg(QString::number(traceY1, 'f', 3)));

			tracer1->setVisible(true);
			tracer1Label->setVisible(true);
		}
		else
		{
			tracer1->setVisible(false);
			tracer1Label->setVisible(false);
		}
		myPlot->replot(QCustomPlot::rpQueuedReplot); //刷新图标,不能省略
	}
}

效果展示
在这里插入图片描述

6.【完整代码】将曲线抽象成一个类,以便复用

这里我写了一个CurvePlot的类,如果界面上同时有多个绘图窗口,那么就可以方便的进行复用。通过这个类可以设置曲线范围等参数,也将一些鼠标事件写了进去。这个是根据之前的一个项目做的,绘图框中绘制两条曲线,一条是目标曲线,一条是实时采集到的曲线。.大家可以在这个基础上进行修改。

CurvePlot.h如下

#ifndef CURVEPLOT_H
#define CURVEPLOT_H
#include "qcustomplot.h"

#pragma execution_character_set("utf-8")
class CurvePlot :public QObject
{
	Q_OBJECT
public:
	explicit CurvePlot(QCustomPlot * Plot);
	virtual ~CurvePlot();


	void setxAxisName(QString name);
	void setyAxisName(QString name);
	void setxAxisRange(double lower, double upper);
	void setyAxisRange(double lower, double upper);
	void setGraphName(QString name0, QString name1);
	void setSelectLegend(bool enabled);
	void setLegendFont(QFont font);

	/*************曲线数据*************/
	int curIndex;//当前曲线号 = 0, = 1, = -1时未选中曲线
	//0号曲线(目标曲线)
	QVector<double> x0;//存储x坐标的向量
	QVector<double> y0;//存储y坐标的向量
	QList<QList<QVariant>> x_y0;
	//1号曲线(采集曲线)
	QVector<double> x1;//存储x坐标的向量
	QVector<double> y1;//存储y坐标的向量
	QList<QList<QVariant>> x_y1;

public slots:
	void on_act_tracerToggled(bool arg1);
	void myMouseMoveEvent(QMouseEvent* event);//鼠标事件
	void rescaleAxes();//自动调整
	void clearCurve();//清除曲线
	void clearAllCurves();//清除所有曲线
private:
	/*绘图窗口*/
	QCustomPlot * myPlot = nullptr;

	/*画笔*/
	QVector<QPen> pen;
	/*************游标*************/
	bool tracerEnable;//游标使能
	QCPItemTracer *tracer0 = nullptr; // 0号曲线游标
	QCPItemTracer *tracer1 = nullptr; // 1号曲线游标
	QCPItemText *tracer0Label = nullptr; // 0号曲线X游标标签
    QCPItemText *tracer1Label = nullptr;// 1号曲线Y轴游标标签
	void setVisibleTracer(bool trueorfalse);//游标可见/不可见 true/false

	/*********曲线X轴范围**********/
	QCPRange QrangeX0;//0号曲线X轴范围
	double  QrangeX0_lower;
	double  QrangeX0_upper;
	QCPRange QrangeX1;//1号曲线X轴范围
	double  QrangeX1_lower;
	double  QrangeX1_upper;
	bool foundRange;
};

#endif

CurvePlot.cpp如下

#include "CurvePlot.h"

CurvePlot::CurvePlot(QCustomPlot * Plot)
{
	myPlot = Plot;
	tracerEnable = false;
	/*************绘图模块***************/
	//设置坐标轴字体
	QFont YHfont("Microsoft YaHei", 10, QFont::Normal);
	myPlot->setFont(YHfont);
	myPlot->xAxis->setLabelFont(YHfont);
	myPlot->xAxis->setTickLabelFont(YHfont);
	myPlot->yAxis->setLabelFont(YHfont);
	myPlot->yAxis->setTickLabelFont(YHfont);
	//设定右上角图例标注的字体
	myPlot->legend->setFont(YHfont);
	//设定右上角图例标注可见
	myPlot->legend->setVisible(true);

	//添加图形
	myPlot->addGraph();
	myPlot->addGraph();
	//曲线全部可见
	myPlot->graph(0)->rescaleAxes();
	myPlot->graph(1)->rescaleAxes(true);
	//设置画笔
	QPen pen0(Qt::blue, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
	QPen pen1(Qt::red, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
	pen.append(pen0);
	pen.append(pen1);
	myPlot->graph(0)->setPen(pen[0]);
	myPlot->graph(1)->setPen(pen[1]);
	//设置线型
	myPlot->graph(0)->setLineStyle(QCPGraph::lsLine);
	myPlot->graph(1)->setLineStyle(QCPGraph::lsLine);
	//设置线上点的风格
	myPlot->graph(0)->setScatterStyle(QCPScatterStyle::ssNone);
	myPlot->graph(1)->setScatterStyle(QCPScatterStyle::ssNone);
	//右键菜单自定义
	myPlot->setContextMenuPolicy(Qt::CustomContextMenu);
	/**********鼠标操作图像模块************/
	myPlot->selectionRect()->setPen(QPen(Qt::black, 1, Qt::DashLine));//设置选框的样式:虚线
	myPlot->selectionRect()->setBrush(QBrush(QColor(0, 0, 100, 50)));//设置选框的样式:半透明浅蓝
	myPlot->setInteraction(QCP::iRangeDrag, true); //鼠标单击拖动 QCPAxisRect::mousePressEvent() 左键拖动
	myPlot->setInteraction(QCP::iRangeZoom, true); //滚轮滑动缩放
	myPlot->setInteraction(QCP::iSelectAxes, true);
	myPlot->setInteraction(QCP::iSelectLegend, true); //图例可选
	myPlot->selectionRect()->setPen(QPen(Qt::black, 1, Qt::DashLine));
	myPlot->selectionRect()->setBrush(QBrush(QColor(0, 0, 100, 50)));
}

CurvePlot::~CurvePlot()
{
}
//X轴名称
void CurvePlot::setxAxisName(QString name)
{
	myPlot->xAxis->setLabel(name);
}
//Y轴名称
void CurvePlot::setyAxisName(QString name)
{
	myPlot->yAxis->setLabel(name);
}
//X轴范围
void CurvePlot::setxAxisRange(double lower, double upper)
{
	myPlot->xAxis->setRange(lower, upper);
}
//Y轴范围
void CurvePlot::setyAxisRange(double lower, double upper)
{
	myPlot->yAxis->setRange(lower, upper);
}
//曲线图例名称
void CurvePlot::setGraphName(QString name0, QString name1)
{
	//设置右上角图形标注名称
	myPlot->graph(0)->setName(name0);
	myPlot->graph(1)->setName(name1);
}
void CurvePlot::setSelectLegend(bool enabled)
{
	if (enabled)
	{
		myPlot->setInteraction(QCP::iSelectLegend, true); //图例可选
	}
	else
	{
		myPlot->setInteraction(QCP::iSelectLegend, false); //图例可选
	}
}
void CurvePlot::setLegendFont(QFont font)
{
	myPlot->legend->setFont(font);
}
void CurvePlot::on_act_tracerToggled(bool arg1)
{
	if (arg1)
	{
		qDebug() << "act_tracer is on!";
		tracerEnable = true;
		tracer0 = new QCPItemTracer(myPlot);
		tracer0->setStyle(QCPItemTracer::tsCrosshair);//游标样式:十字星、圆圈、方框
		tracer0->setPen(QPen(Qt::green));//设置tracer的颜色绿色
		tracer0->setPen(QPen(Qt::DashLine));//虚线游标
		tracer0->setBrush(QBrush(Qt::red));
		tracer0->setSize(10);
		tracer0->setInterpolating(true);//false禁用插值

		tracer1 = new QCPItemTracer(myPlot);
		tracer1->setStyle(QCPItemTracer::tsCrosshair);//游标样式:十字星、圆圈、方框
		tracer1->setPen(QPen(Qt::green));//设置tracer的颜色绿色
		tracer1->setPen(QPen(Qt::DashLine));//虚线游标
		tracer1->setBrush(QBrush(Qt::red));
		tracer1->setSize(10);
		tracer1->setInterpolating(true);//false禁用插值

		tracer0Label = new QCPItemText(myPlot);
		tracer0Label->setClipToAxisRect(false);
		tracer0Label->setLayer("overlay");
		tracer0Label->setPen(QPen(Qt::green));
		tracer0Label->setFont(QFont("Microsoft YaHei", 10));
		tracer0Label->setPadding(QMargins(2, 2, 2, 2));
		tracer0Label->setPositionAlignment(Qt::AlignLeft | Qt::AlignTop);
		//下面这个语句很重要,它将游标说明锚固在tracer位置处,实现自动跟随
		tracer0Label->position->setType(QCPItemPosition::ptAxisRectRatio);//位置类型(当前轴范围的比例为单位/实际坐标为单位)
		tracer0Label->position->setParentAnchor(tracer0->position);

		tracer1Label = new QCPItemText(myPlot);
		tracer1Label->setClipToAxisRect(false);
		tracer1Label->setLayer("overlay");
		tracer1Label->setPen(QPen(Qt::red));
		tracer1Label->setFont(QFont("Microsoft YaHei", 10));
		tracer1Label->setPadding(QMargins(2, 2, 2, 2));
		tracer1Label->setPositionAlignment(Qt::AlignLeft | Qt::AlignTop);
		//下面这个语句很重要,它将游标说明锚固在tracer位置处,实现自动跟随
		tracer1Label->position->setType(QCPItemPosition::ptAxisRectRatio);//位置类型(当前轴范围的比例为单位/实际坐标为单位)
		tracer1Label->position->setParentAnchor(tracer1->position);
	}
	else
	{
		qDebug() << "act_tracer is off !";
		tracerEnable = false;
		setVisibleTracer(false);
	}
}
void CurvePlot::myMouseMoveEvent(QMouseEvent * event)//鼠标移动事件
{
	if (tracerEnable)//游标使能判断
	{
		double x = myPlot->xAxis->pixelToCoord(event->pos().x());//鼠标点的像素坐标转plot坐标

		foundRange = true;
		QrangeX0 = myPlot->graph(0)->getKeyRange(foundRange, QCP::sdBoth);//获取0号曲线X轴坐标范围
		QrangeX0_lower = QrangeX0.lower;
		QrangeX0_upper = QrangeX0.upper;

		QrangeX1 = myPlot->graph(1)->getKeyRange(foundRange, QCP::sdBoth);//获取1号曲线X轴坐标范围
		QrangeX1_lower = QrangeX1.lower;
		QrangeX1_upper = QrangeX1.upper;
		//如果鼠标移动超出0号曲线X轴范围,则0号曲线隐藏游标
		if (x < QrangeX0_upper && x > QrangeX0_lower)
		{
			tracer0->setGraph(myPlot->graph(0));//设置游标吸附在traceGraph这条曲线上
			tracer0->setGraphKey(x);//将游标横坐标(key)设置成刚获得的横坐标数据x (这就是游标随动的关键代码)
			tracer0->updatePosition(); //使得刚设置游标的横纵坐标位置生效
			double traceX0 = tracer0->position->key();
			double traceY0 = tracer0->position->value();

			tracer0Label->setText(QString::number(traceX0, 'f', 3));//游标文本框,指示游标的X值
			tracer0Label->setText(QString("x = %1\ny = %2").arg(QString::number(traceX0, 'f', 3)).arg(QString::number(traceY0, 'f', 3)));
			tracer0->setVisible(true);
			tracer0Label->setVisible(true);
		}
		else
		{
			tracer0->setVisible(false);
			tracer0Label->setVisible(false);
		}
		//如果鼠标移动超出1号曲线X轴范围,则1号曲线隐藏游标
		if (x < QrangeX1_upper && x > QrangeX1_lower)
		{
			double traceX1 = tracer1->position->key();
			double traceY1 = tracer1->position->value();
			tracer1->setGraph(myPlot->graph(1));//设置游标吸附在traceGraph这条曲线上
			tracer1->setGraphKey(x);
			tracer1->updatePosition(); //使得刚设置游标的横纵坐标位置生效

			tracer1Label->setText(QString("x = %1\ny = %2").arg(QString::number(traceX1, 'f', 3)).arg(QString::number(traceY1, 'f', 3)));

			tracer1->setVisible(true);
			tracer1Label->setVisible(true);
		}
		else
		{
			tracer1->setVisible(false);
			tracer1Label->setVisible(false);
		}
		myPlot->replot(QCustomPlot::rpQueuedReplot); //刷新图标,不能省略
	}
}

void CurvePlot::rescaleAxes()//曲线全部显示
{
	//给第一个graph设置rescaleAxes(),后续所有graph都设置rescaleAxes(true)即可实现显示所有曲线。
	//rescaleAxes(true)时如果plot的X或Y轴本来能容纳下本graph的X或Y数据点,
	//那么plot的X或Y轴的可视范围就无需调整,只有plot容纳不下本graph时,才扩展plot两个轴的显示范围。
	//见博客https://www.csdn.net/gather_26/MtTaYg2sMzgxNDgtYmxvZwO0O0OO0O0O.html
	myPlot->graph(0)->rescaleAxes();
	myPlot->graph(1)->rescaleAxes(true);
	myPlot->replot();
}

void CurvePlot::clearCurve()
{
	switch (this->curIndex)
	{
	case 0:
		this->x0.clear();
		this->y0.clear();
		this->x_y0.clear();
		myPlot->graph(0)->setData(this->x0, this->y0);
		break;
	case 1:
		this->x1.clear();
		this->y1.clear();
		this->x_y1.clear();
		myPlot->graph(1)->setData(this->x1, this->y1);
		break;
	case -1:
		qDebug() << "未选中曲线!";
		break;
	}
	myPlot->replot(QCustomPlot::rpQueuedReplot);
}

void CurvePlot::clearAllCurves()
{
	//this->x0.clear();
	//this->y0.clear();
	//this->x_y0.clear();
	//myPlot->graph(0)->setData(this->x0, this->y0);
	this->x1.clear();
	this->y1.clear();
	this->x_y1.clear();
	myPlot->graph(1)->setData(this->x1, this->y1);
	myPlot->replot(QCustomPlot::rpQueuedReplot);
}

void CurvePlot::setVisibleTracer(bool trueorfalse)
{
	tracer0->setVisible(trueorfalse);
	tracer1->setVisible(trueorfalse);
	tracer0Label->setVisible(trueorfalse);
	tracer1Label->setVisible(trueorfalse);
	myPlot->replot(QCustomPlot::rpQueuedReplot); //刷新图标,不能省略
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1837070.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

在执行sudo apt update时提示“sudo:aapt:找不到命令”

文章目录 1、问题引入2、问题解决区别 1、问题引入 在干净的虚拟机环境发现执行不了“sudo apt update”命令 2、问题解决 我们知道linux有许多的系统&#xff0c;例如CentOS、Ubuntu等&#xff0c;而apt和yum都是linux的包管理工具&#xff0c;可以安装、升级和删除软件。那…

经纬恒润EAS.HSM:驱动硬件信息安全

概述 HSM&#xff08;Hardware Security Module&#xff09;硬件安全模块&#xff0c;是一种用于保护和管理强认证系统所使用的密钥&#xff0c;并同时提供相关密码学操作的计算机硬件设备。 HSM 在汽车信息安全中扮演着至关重要的角色。随着汽车智能化和网联化的快速发展&am…

航空电子设备 MIL-STD-1553 收发器 HI-1573 / HI-1574

Holt集成电路通过真正的单芯片双3.3V收发器继续支持MIL-STD-1553数据总线。新型HI-1573采用成熟的设计技术和最新的模拟CMOS技术&#xff0c;当以100&#xff05;占空比进行传输时&#xff0c;仅消耗340mW的功率&#xff0c;同时仍可为总线提供所需的功率。通过将RXENA或RXENB设…

想体验“时光倒流”吗?文件时光机——可道云teamOS,历史版本管理,随时回溯版本

大家在工作中&#xff0c;遇到过的最奔溃的事情是什么&#xff1f; 是工作没有做好&#xff0c;还是客户要求太离谱&#xff1f; 不知道大家有没有过这样的经历&#xff0c;根据客户要求改方案、改稿子&#xff0c;改了一版又一版&#xff0c;结果客户说还是最初版本更好………

C++ 48 之 继承的基本语法

#include <iostream> #include <string> using namespace std;// 定义一个基类&#xff0c;把公共的部分写在这里&#xff0c;以后让别的类继承即可 class BasePage{ public:void header(){cout << "公共的头部"<< endl;}void footer(){cout…

打造精致UI界面:字体设计的妙招

字体设计是UI设计的关键模块之一。字体设计是否有效可能直接实现或破坏整个UI界面。那么&#xff0c;界面设计的字体设计有哪些规范呢&#xff1f;如何设计细节字体&#xff1f;本文将解释字体设计规范的可读性、可读性和可用性&#xff0c;并介绍UI界面中的字体设计技巧。 如…

链表OJ--超详细解析

链表OJ 文章目录 链表OJ1. 反转链表2. 返回K值3. 链表的中间节点4. 回文链表5. 相交链表6. 带环链表6.1 为什么一定会相遇&#xff0c;有没有可能会错过&#xff0c;或者出现永远追不上的情况&#xff0c;请证明6.2 slow一次走一步&#xff0c;fast如果一次走3步&#xff0c;走…

读书笔记-《人人都是产品经理》

在开发工程师与产品经理的段子中&#xff0c;常看到“人人都是产品经理”这句话&#xff0c;用来调侃这个岗位似乎没有什么门槛。 很明显&#xff0c;这句话的出处&#xff0c;即本书作者想表达的是每个人都可以运用产品思维去解决问题。 01 产品 产品&#xff1a;用来解决某…

SpringMVC的使用

SpringMVC详情 RequestMapping("/hello") 负责用户的请求路径与后台服务器之间的映射关系 如果请求路径不匹配,则用户报错404 ResponseBody 作用: 将服务器的返回值转化为JSON. 如果服务器返回的是String类型,则按照自身返回. 新增: post请求类型 PostMapping("…

OKR:2024年目标和关键成果常见问题

什么是目标和关键结果&#xff08;OKR&#xff09;&#xff1f; 目标和关键结果&#xff08;#OKR#&#xff09;是一种由结果驱动的目标制定方法。在企业中&#xff0c;OKR经常被用来指导基于结果的成功。使用结果而不是任务作为驱动力&#xff0c;OKRs 鼓励通过度量指标对实现成…

LLM 理论知识

LLM 理论知识 一.大型语言模型LLM1.1 大型语言模型 LLM 的概念1.2 常见的 LLM 模型1.2.1 闭源 LLM (未公开源代码)1.2.1.1 GPT 系列1.2.1.1.1 ChatGPT1.2.1.1.2 GPT-4 1.2.1.2 Claude 系列1.2.1.1.3 PaLM/Gemini 系列1.2.1.1.4 文心一言1.2.1.1.5 星火大模型 1.2.2. 开源 LLM1.…

MapStruct对象转换

MapStruct是一个Java注解处理器&#xff0c;用于简化对象的转换 遇到的问题&#xff1a; java: Internal error in the mapping processor: java.lang.NullPointerException 解决方案&#xff1a;修改编辑器配置 -Djps.track.ap.dependenciesfalse

超长国债来了,高净值客群的机会在哪儿?

有人说&#xff0c;2024年是全球经济的“分化年”&#xff0c;也是中国经济突围的“关键年”。当前&#xff0c;我国经济恢复仍处在关键阶段&#xff0c;长期向好的基本趋势没有改变&#xff0c;但也需要克服一些挑战&#xff0c;而巩固和增强经济复苏的良好势头&#xff0c;离…

转行AI的人,都后悔了

说真的&#xff0c;很多转行AI的人&#xff0c;都后悔了&#xff0c;后悔没早点转&#xff0c;因为AI岗实在是太香了&#xff01;就连Google都开始捞****AI/ML的人才了&#x1f447; 曾经在一家IT外企研发中心做仿真工程师的小夏&#xff0c;每天加班、薪资还只有150k&#xff…

Codeforces Round 923 (Div. 3)(A~D题解)

目录 A. Make it White B. Following the String C. Choose the Different Ones! D. Find the Different Ones! A. Make it White Problem - A - Codeforces 题意&#xff1a;问在一个只含有W和B元素的字符串中&#xff0c;选择一个L到R范围&#xff0c;将之间包含的B全部变…

RK3568技术笔记八 开发环境的搭建

先按照前面的方法将 ubuntu 安装在 PC 机上。 编译开发Linux系统&#xff0c;虚拟机Ubuntu 系统要求&#xff1a; 64位系统&#xff0c;硬盘空间大于或等于200G&#xff0c;内存不小于6GB。 建议使用 Ubuntu18.04 系统进行编译。 光盘资料&#xff1a;SAIL-RK3568开发板光盘…

Ceph: vdbench 测试ceph存储rbd块设备

目录 2.搭建ceph 3.vdbench环境 准备 笔记本架构&#xff1a;x86 i5 8 代 虚拟化软件&#xff1a;virtualBox 7.0 操作系统&#xff1a;CentOS Linux release 7.9.2009 (Core) 测试虚拟机操作系统&#xff1a;CentOS Linux release 7.9.2009 (Core) 节点 外部网络 内部网…

langchain教程-(1)Prompt模板

LangChain 的核心组件 模型 I/O 封装 LLMs&#xff1a;大语言模型Chat Models&#xff1a;一般基于 LLMs&#xff0c;但按对话结构重新封装PromptTemple&#xff1a;提示词模板OutputParser&#xff1a;解析输出 数据连接封装 Document Loaders&#xff1a;各种格式文件的加载…

C# yolov8 OpenVINO 同步、异步接口视频推理

C# yolov8 OpenVINO 同步、异步接口视频推理 目录 效果 项目 代码 下载 效果 同步推理效果 异步推理效果 项目 代码 using OpenCvSharp; using System; using System.Collections.Generic; using System.Diagnostics; using System.Threading; using System.Windows.Form…

YOLOv10改进 | 主干篇 | YOLOv10引入FasterNeT替换Backbone

1. FasterNeT介绍 1.1 摘要: 为了设计快速神经网络,许多工作一直致力于减少浮点运算(FLOP)的数量。 然而,我们观察到,FLOP 的减少并不一定会导致延迟的类似程度的减少。 这主要源于每秒浮点运算 (FLOPS) 效率低下。 为了实现更快的网络,我们重新审视流行的算子,并证明…