#include "CameraImageHandler.h"
#include "Group.h"

CameraImageHandler::CameraImageHandler(int iCameraId) {
    initGroup(iCameraId);
}

// void CameraImageHandler::captureAndConvertImage() {

// }

Group* CameraImageHandler::getGroup() const {
    return group;
}

void CameraImageHandler::initGroup(int CameraId) {
    QStringList dispmodel1;
    dispmodel1 << "P die align" << "D device align";

    QStringList dispmodel2;
    dispmodel2 << "D device align" << "P die align";

    QStringList dispmodel3;
    dispmodel3 << "B device align" << "P die align";

    QStringList dispmodel4;
    dispmodel4 << "U die align" << "D device align";

    if (CameraId == 1) {
        group = new Group(CameraId, ":/images/test_image/image_1.png", ":/images/test_image/image_2.png", dispmodel1, this);
    } else if (CameraId == 2) {
        group = new Group(CameraId, ":/images/test_image/image_3.png", ":/images/test_image/image_4.png", dispmodel2, this);
    } else if (CameraId == 3) {
        group = new Group(CameraId, ":/images/test_image/image_5.png", ":/images/test_image/image_6.png", dispmodel3, this);
    } else if (CameraId == 4) {
        group = new Group(CameraId, ":/images/test_image/image_7.png", ":/images/test_image/image_8.png", dispmodel4, this);
    } else if (CameraId == 5) {
        group = new Group(CameraId, ":/images/test_image/image_1.png", ":/images/test_image/image_2.png", dispmodel1, this);
    } else if (CameraId == 6) {
        group = new Group(CameraId, ":/images/test_image/image_3.png", ":/images/test_image/image_4.png", dispmodel2, this);
    } else if (CameraId == 7) {
        group = new Group(CameraId, ":/images/test_image/image_5.png", ":/images/test_image/image_6.png", dispmodel3, this);
    } else if (CameraId == 8) {
        group = new Group(CameraId, ":/images/test_image/image_7.png", ":/images/test_image/image_8.png", dispmodel4, this);
    } else {
        group = nullptr; // 如果 CameraId 不匹配，则 group 为 nullptr
    }
}
