#ifndef TOOLEXTRINSICWIDGET_H #define TOOLEXTRINSICWIDGET_H #include #include #include #include #include #include #include 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& 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 m_dataCache; int m_currentCameraIndex; }; #endif // TOOLEXTRINSICWIDGET_H