2024-02-06 06:19:53 +00:00
|
|
|
|
#ifndef CREATPRINTBMP_H
|
|
|
|
|
#define CREATPRINTBMP_H
|
|
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
|
#include <QPicture>
|
|
|
|
|
#include <QPainter>
|
|
|
|
|
#include <QPicture>
|
|
|
|
|
#include <QDebug>
|
|
|
|
|
#include <QFile>
|
|
|
|
|
#include <QBitmap>
|
|
|
|
|
#include <QThread>
|
|
|
|
|
#include <QSettings>
|
|
|
|
|
#include <QDir>
|
|
|
|
|
#include "bwbmp.h"
|
|
|
|
|
#include "machine/printinfo/mcfiles.h"
|
|
|
|
|
#include "datafile/hpgl/importhpgl.h"
|
2024-03-08 08:33:05 +00:00
|
|
|
|
#include "datafile/view/drawdata.h"
|
2024-02-06 06:19:53 +00:00
|
|
|
|
|
|
|
|
|
#define PIXMAPWIDTH 1200
|
|
|
|
|
|
|
|
|
|
#define PRINTDIR "print"
|
|
|
|
|
#define PRINTMCDIR "mc"
|
|
|
|
|
#define PRINTFILEDIR "file"
|
|
|
|
|
|
|
|
|
|
class CreatPrintBmp : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
|
|
|
|
explicit CreatPrintBmp(QObject *parent = NULL);
|
|
|
|
|
virtual ~CreatPrintBmp();
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
QPicture m_picture;//绘图路径-线段
|
|
|
|
|
QString m_savePath;
|
|
|
|
|
int m_workState;
|
|
|
|
|
int m_deleteFileIdx;//删除打印文件索引
|
|
|
|
|
McPrintInfo *m_mcPrintInfo;//机器信息
|
2024-03-08 08:33:05 +00:00
|
|
|
|
int m_fileBegIdx;//开始打印和正在打印文件索引(因为打印完成一个就要删掉一个,所以正在打印的文件永远是起始文件索引)
|
2024-02-06 06:19:53 +00:00
|
|
|
|
int m_fileEndIdx;
|
2024-03-08 08:33:05 +00:00
|
|
|
|
int m_listFileIdx;//初始文件列表时将要生成文件数据的文件索引
|
2024-02-06 06:19:53 +00:00
|
|
|
|
int m_curBmpBlockIdx;//当前生成数据的位图块数索引
|
|
|
|
|
int m_conpressDir;//压缩方向
|
|
|
|
|
QString m_printFileDir;//打印文件目录
|
|
|
|
|
|
|
|
|
|
int m_moveFileIdx;//上下移动打印文件索引
|
|
|
|
|
s16 m_moveDir;//-1,上移 1,下移
|
2024-03-08 08:33:05 +00:00
|
|
|
|
double m_rotateAngle;
|
2024-02-06 06:19:53 +00:00
|
|
|
|
|
2024-03-08 08:33:05 +00:00
|
|
|
|
QFileInfoList m_autoDirFilesList;//自动绘图目录中文件列表
|
2024-02-06 06:19:53 +00:00
|
|
|
|
|
2024-03-08 08:33:05 +00:00
|
|
|
|
private:
|
|
|
|
|
int creatFileListMarker(int idx);//加载文件列表marker数据
|
2024-02-06 06:19:53 +00:00
|
|
|
|
int creatFileListDatAndSend(int idx);//创建文件列表数据并发送
|
2024-03-08 08:33:05 +00:00
|
|
|
|
int creatBmpBlockDatAndSend(int fileidx, int idx);//创建位图块数据并发送
|
2024-02-06 06:19:53 +00:00
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
void setPicture(QPicture pic);
|
|
|
|
|
void setPicture(QBitmap bitmap);
|
|
|
|
|
void setSavePath(QString path);
|
|
|
|
|
QString getSavePath();
|
|
|
|
|
void setMcPrintInfo(int fileIdx,McPrintInfo *printInfo);//设置机器信息
|
2024-03-08 08:33:05 +00:00
|
|
|
|
void stopCreatPrintDat();//停止生成打印数据
|
|
|
|
|
void setDeleteFile(McPrintInfo *printInfo, int fileIdx);//删除文件
|
|
|
|
|
void setMoveFile(McPrintInfo *printInfo, int fileIdx, int dir = -1);//上下移动文件
|
|
|
|
|
inline void setRotateAngle(double angle){m_rotateAngle = angle;}//设置旋转角度
|
2024-02-06 06:19:53 +00:00
|
|
|
|
|
|
|
|
|
signals:
|
|
|
|
|
void siCreatOneBmpFinished(int mcIdx,unsigned char *dat,int datSize);
|
|
|
|
|
void siSendFileListDatToMc(int idx);
|
2024-03-08 08:33:05 +00:00
|
|
|
|
void siSendDatToMc(QByteArray dat);
|
|
|
|
|
void siOneFilePrintFinished(int mcNum,int fileIdx,int refreshFlag);//一个文件打印完成
|
|
|
|
|
void siRefreshPrintProgress(int mcNum,int fileIdx);//刷新打印进度
|
2024-02-06 06:19:53 +00:00
|
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
|
void slotCreatBmp();
|
|
|
|
|
void slotCreatNextBmpBlockDat();//创建下一个位图块数据
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif // CREATPRINTBMP_H
|