GrabBag/AppUtils/UICommon/Inc/ToolExtrinsicWidget.h

130 lines
3.9 KiB
C
Raw Normal View History

2026-06-20 23:50:04 +08:00
#ifndef TOOLEXTRINSICWIDGET_H
#define TOOLEXTRINSICWIDGET_H
#include <QWidget>
#include <QComboBox>
#include <QGroupBox>
#include <QLabel>
#include <QLineEdit>
#include <QString>
#include <QVector>
2026-06-20 23:50:04 +08:00
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;
};
2026-06-20 23:50:04 +08:00
/**
* @brief HandEyeCalibWidget m_groupExtrinsic
*
* QWidget + .ui tab/layout
2026-06-20 23:50:04 +08:00
* + 姿 +
*/
class ToolExtrinsicWidget : public QWidget
{
Q_OBJECT
public:
explicit ToolExtrinsicWidget(QWidget *parent = nullptr);
~ToolExtrinsicWidget();
void setCameraList(const QVector<ToolExtrinsicCameraInfo>& cameras);
2026-06-20 23:50:04 +08:00
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;
2026-06-20 23:50:04 +08:00
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,
2026-06-20 23:50:04 +08:00
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;
2026-06-20 23:50:04 +08:00
void setTargetOffsetVisible(bool visible);
void setAxialAngleRangeVisible(bool visible);
private slots:
void onCameraSelectionChanged(int index);
2026-06-20 23:50:04 +08:00
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);
2026-06-20 23:50:04 +08:00
Ui::ToolExtrinsicWidget* ui = nullptr;
2026-06-20 23:50:04 +08:00
QGroupBox* m_groupExtrinsic;
QComboBox* m_comboCamera;
2026-06-20 23:50:04 +08:00
QComboBox* m_comboEulerOrder;
QLineEdit* m_editRotX;
QLineEdit* m_editRotY;
QLineEdit* m_editRotZ;
QLabel* m_labelAxialAngleRange;
QWidget* m_widgetAxialAngleRangeRow;
QLineEdit* m_editAxialAngleMin;
QLineEdit* m_editAxialAngleMax;
2026-06-20 23:50:04 +08:00
QLabel* m_labelTargetOffset;
QWidget* m_widgetTargetOffsetRow;
2026-06-20 23:50:04 +08:00
QLineEdit* m_editOffsetX;
QLineEdit* m_editOffsetY;
QLineEdit* m_editOffsetZ;
QVector<ToolExtrinsicData> m_dataCache;
int m_currentCameraIndex;
2026-06-20 23:50:04 +08:00
};
#endif // TOOLEXTRINSICWIDGET_H