GrabBag/AppUtils/UICommon/Inc/ToolExtrinsicWidget.h

130 lines
3.9 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef TOOLEXTRINSICWIDGET_H
#define TOOLEXTRINSICWIDGET_H
#include <QWidget>
#include <QComboBox>
#include <QGroupBox>
#include <QLabel>
#include <QLineEdit>
#include <QString>
#include <QVector>
namespace Ui {
class ToolExtrinsicWidget;
}
struct ToolExtrinsicCameraInfo
{
int cameraIndex = 0;
QString displayName;
};
struct ToolExtrinsicData
{
int cameraIndex = 0;
int eulerOrder = 11;
double rotX = 0.0;
double rotY = 0.0;
double rotZ = 0.0;
double axialAngleMin = -180.0;
double axialAngleMax = 180.0;
double offsetX = 0.0;
double offsetY = 0.0;
double offsetZ = 0.0;
};
/**
* @brief 工具外参编辑控件(从 HandEyeCalibWidget 中抽取 m_groupExtrinsic
*
* QWidget + .ui可嵌入任意 tab/layout。
* 包含:欧拉角顺序 + 姿态调整 + 目标点偏移。
*/
class ToolExtrinsicWidget : public QWidget
{
Q_OBJECT
public:
explicit ToolExtrinsicWidget(QWidget *parent = nullptr);
~ToolExtrinsicWidget();
void setCameraList(const QVector<ToolExtrinsicCameraInfo>& cameras);
void setData(int eulerOrder,
double rotX, double rotY, double rotZ,
double offsetX, double offsetY, double offsetZ);
void setData(int eulerOrder,
double rotX, double rotY, double rotZ,
double offsetX, double offsetY, double offsetZ,
double axialAngleMin, double axialAngleMax);
void getData(int& eulerOrder,
double& rotX, double& rotY, double& rotZ,
double& offsetX, double& offsetY, double& offsetZ) const;
void getData(int& eulerOrder,
double& rotX, double& rotY, double& rotZ,
double& offsetX, double& offsetY, double& offsetZ,
double& axialAngleMin, double& axialAngleMax) const;
void setData(int cameraIndex,
int eulerOrder,
double rotX, double rotY, double rotZ,
double offsetX, double offsetY, double offsetZ);
void setData(int cameraIndex,
int eulerOrder,
double rotX, double rotY, double rotZ,
double offsetX, double offsetY, double offsetZ,
double axialAngleMin, double axialAngleMax);
bool getData(int cameraIndex,
int& eulerOrder,
double& rotX, double& rotY, double& rotZ,
double& offsetX, double& offsetY, double& offsetZ) const;
bool getData(int cameraIndex,
int& eulerOrder,
double& rotX, double& rotY, double& rotZ,
double& offsetX, double& offsetY, double& offsetZ,
double& axialAngleMin, double& axialAngleMax) const;
int currentCameraIndex() const;
void setTargetOffsetVisible(bool visible);
void setAxialAngleRangeVisible(bool visible);
private slots:
void onCameraSelectionChanged(int index);
private:
void setupUI();
void initEulerOrderComboBox();
void loadDataToUi(const ToolExtrinsicData& data);
void saveCurrentUiToCache();
ToolExtrinsicData* findData(int cameraIndex);
const ToolExtrinsicData* findData(int cameraIndex) const;
ToolExtrinsicData& ensureData(int cameraIndex);
Ui::ToolExtrinsicWidget* ui = nullptr;
QGroupBox* m_groupExtrinsic;
QComboBox* m_comboCamera;
QComboBox* m_comboEulerOrder;
QLineEdit* m_editRotX;
QLineEdit* m_editRotY;
QLineEdit* m_editRotZ;
QLabel* m_labelAxialAngleRange;
QWidget* m_widgetAxialAngleRangeRow;
QLineEdit* m_editAxialAngleMin;
QLineEdit* m_editAxialAngleMax;
QLabel* m_labelTargetOffset;
QWidget* m_widgetTargetOffsetRow;
QLineEdit* m_editOffsetX;
QLineEdit* m_editOffsetY;
QLineEdit* m_editOffsetZ;
QVector<ToolExtrinsicData> m_dataCache;
int m_currentCameraIndex;
};
#endif // TOOLEXTRINSICWIDGET_H