44 lines
1.0 KiB
C++
44 lines
1.0 KiB
C++
#ifndef IMAGEPROCESSINGWORKER_H
|
|
#define IMAGEPROCESSINGWORKER_H
|
|
|
|
#include <QObject>
|
|
#include <QImage>
|
|
#include <vector>
|
|
#include <thread>
|
|
#include <atomic>
|
|
#include <mutex>
|
|
#include <condition_variable>
|
|
#include "VZNL_Types.h"
|
|
|
|
class ImageProcessingWorker : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit ImageProcessingWorker(QObject *parent = nullptr);
|
|
~ImageProcessingWorker();
|
|
|
|
void requestImageGeneration(const std::vector<std::vector<SVzNL3DPosition>>& scanLines);
|
|
void stop();
|
|
|
|
bool isProcessing() const;
|
|
|
|
signals:
|
|
void imageGenerated(const QImage& image);
|
|
|
|
private:
|
|
void workerThreadFunction();
|
|
void processImageGeneration(const std::vector<std::vector<SVzNL3DPosition>>& scanLines);
|
|
|
|
private:
|
|
std::thread m_workerThread;
|
|
std::atomic<bool> m_stopped;
|
|
std::atomic<bool> m_processing;
|
|
|
|
std::mutex m_dataMutex;
|
|
std::condition_variable m_condition;
|
|
std::vector<std::vector<SVzNL3DPosition>> m_currentTask;
|
|
bool m_hasNewTask;
|
|
};
|
|
|
|
#endif // IMAGEPROCESSINGWORKER_H
|