#pragma once #include "preHeader.h" #include "IncCamera.h" #include "VideoStreamCatcher.h" #include #include #include #include "MfcLabel.h" #define CAMERAITEM_WIDTH 500 #define CAMERAITEM_HEIGHT 500 class CameraItem; typedef struct GpuData { unsigned char* pData{ nullptr }; int nWidth; int nHeight; int nPitch; ~GpuData() { if (pData != nullptr) { cudaFree(pData); pData = nullptr; } } }GPU_DATA, * LPGPUDATA; typedef struct TagCameraRowGroup { //define a vector to record the std::list CameraItemGroup; //define a vector to record the Row postion offset int nRowOffset{0}; //define a vector to record the Col postion offset int nColOffset{0}; //define a vector to record the Row Camera Index int nRowCameraIndex{0}; //define a vector to record the Row Camera Count int nRowCameraCount{0}; //define a Rect to record the Current Row Available Rect MfcLabel::Rect AvailableRect; //define a pointer to record the group that intersect with this group TagCameraRowGroup* pNextIntersectGroup{ nullptr }; //define a 2d vector to record the overlap bounding std::vector> vvGroupOverlapBounding; TagCameraRowGroup() { CameraItemGroup.resize(0); } }TAG_CAM_ROW_GROUP,*LPTAG_CAM_ROW_GROUP; class CameraItem :public QObject,public QGraphicsItem { Q_OBJECT public: //set a constructor CameraItem(QGraphicsItem* parent); //set a constructor CameraItem(); ~CameraItem(); CameraItem(const CameraItem& other); //init the CameraItem with the position bool Init(int nIndex,QPointF Pos); //boundingrect QRectF boundingRect() const; void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = nullptr); //mouse press event process slots void mousePressEvent(QGraphicsSceneMouseEvent* event); //set a signal to indicate the mouse is pressed signals: void CameraItemPressed(CameraItem* pItem); public: //Current Item position QPointF CurrentPos; //indicate the item is selected or not bool bSelected; //current item index int nItemColIndex; //current item row index int nItemRowIndex; CAMERA_INFO m_CameraInfo; //set a VideoStreamCatcher to catch the video stream VideoStreamCatcher m_VideoStreamCatcher; QRect ImageRect; //set attribute to indicate the item is intersect rect //when copy the image to pano image buffer,use this attribute to judge whether need to copy //this attribute only indicate the item itself has been overlap apart,not the other item //this Intersectrect is in pano intersect with right QRect IntersectRect; //this intersectrect is in this coordinate,intersect with left QRect PreIntersectRect; std::vector> m_vvOverlapBounding; CameraItem* pIntersectInstance; //define a cv::mat to store Current frame cv::Mat m_CurrentFrame; //设置一个真正的不变的指针,防止保存在工单内的指针失效 GPU_DATA m_CurrentGpuData; //define a bool to indicate the item is active or not bool bActive; unsigned char* pCurrentFrame{nullptr}; static bool* pCameraItemModified; }; Q_DECLARE_METATYPE(CameraItem*);