PlotterHMI/datafile/dxf/dxflib/ReadTIIP.h
huahaiyan 9f74511e69 20240315
1、增加数据分割功能(完成)
2、更换dxf库(进行中)
2024-03-15 16:49:50 +08:00

310 lines
7.5 KiB
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#if !defined (READTIIP_H)
#define READTIIP_H
#pragma once
#include "PDSMath/StdAfx.h"
#include <iostream>
//#include <afxtempl.h>
#include <QObject>
#include "GroupCode.h"
//TIIP的块信息
class CTPBlockInfor : public QObject
{
public:
//文件中读入的数据
CString m_strBlockName; //为了记录BLOCK的块名(在组码2的后面)
CString m_strPatternName; //纸样名
CString m_strSizeName; //号型名
CStringArray m_arrComment; //注释COMMENT/ANNOTATION
CStringArray m_arrMaterial; //布料名 Fabric
CUIntArray m_arrQuantity; //布料份数 Quantity
CCurveNotchInforList m_Layer1; //第1层 边线
CCurveNotchInforList m_Layer2; //第2层缝份线
CCurveNotchInforList m_Layer5; //第5层辅助线
CCurveNotchInforList m_Layer6; //第6层 内部裁剪线
CCurveNotchInfor m_CurveLayer7; //放码线
CCurveNotchInfor m_CurveLayer4; //对称线
CCurveNotchInfor m_CurveLayer3; //布纹线
CTextDataList m_listTextData; //T文字
CDrillInforList m_listDrillInfo; //钻孔信息
public:
CTPBlockInfor(void);
CTPBlockInfor(CTPBlockInfor& a);
~CTPBlockInfor(void);
void operator=(CTPBlockInfor& a);
void Initial(void);
//位置偏移和放缩
//输入参数:
//dOffsetX/dOffsetY 偏移量
//dSin/dCos 旋转角度, 旋转点为CPoint(dOffsetX, dOffsetY), 水平为零度
//dScaleX/dScaleY 放大缩小 20220408 XQ
//说明:
// 偏移->旋转->放大缩小
void SetRotateOffset(double dOffsetX, double dOffsetY, double dSin, double dCos, double dScaleX, double dScaleY);
private:
//拷贝数据
void CopyData(CTPBlockInfor &a);
};
class CTPBlockInforList : public CList<CTPBlockInfor,CTPBlockInfor&>
{
public:
CTPBlockInforList& operator=(CTPBlockInforList& rhs); // 赋值
//获取指定索引值上的项
//输入参数:
// iIndex 索引值,从0开始,不可越界
//返回值:
CTPBlockInfor& operator[](int iIndex);
//位置偏移,旋转和放缩
//输入参数:
//dOffsetX/dOffsetY 偏移量
//dSin/dCos 旋转角度, 旋转点为CPoint(dOffsetX, dOffsetY), 水平为零度
//dScaleX/dScaleY 放大缩小 20220408 XQ
//说明:
// 偏移->旋转->放大缩小
void SetRotateOffset(double dOffsetX, double dOffsetY, double dSin, double dCos, double dScaleX, double dScaleY);
//设置放大
//输入参数:
//dScale 放大缩小比例
void SetScale(double dScale);
//将给定号型名替换成给定字符串
//输入参数:
// strOldSizeName 旧号型名
// strNewSizeName 新号型名
void ReplaceSizeName(CString strOldSizeName, CString strNewSizeName);
//在给定名称的号型对应的纸样链
//输入参数:
// strSizeName 需要查找到号型名
//输出参数:
// listBlockInfor 找到的纸样列表
//返回值:
// =true 找到;=false 没有找到
BOOL FindSizeName(CString strSizeName, CTPBlockInforList &listBlockInfor);
};
//Entities信息
class CTPEntitiesInfor : public CObject
{
public:
CString m_strStyleName; //Style Name:<string>
CString m_strSampleSize; //基码Sample Size:<string>
int m_iUnit; //= CONST_MM METRICmm= CONST_INCH ENGLISH : 英寸; 默认mm
CString m_strAuthor; //作者Author:<Vendor name>;<application>;<release #》
CString m_strVersion; //输出软件版本号
CInsertDataList m_listInsertData;
public:
CTPEntitiesInfor(void);
CTPEntitiesInfor(CTPEntitiesInfor& a);
~CTPEntitiesInfor(void);
void operator=(CTPEntitiesInfor& a);
void Initial(void);
};
class CTIIPFileInfor : public CObject
{
public:
// 注意:
//m_listBlockInfor和 m_listSameSizeBlockInfor中的数据是一样的只能选其一使用
//初始值为dxf文件中读到信息
CString m_strSampleSize; //基码, 在处理读入数据时基码以该变量为准
CList<CString, CString> m_listAllSize; //所有号型(不重复) 在处理读入数据时号型个数以该变量为准
CTPBlockInforList m_listBlockInfor; //读Block数据
CTPEntitiesInfor m_EntitiesInfor; //读Entities数据
public:
CTIIPFileInfor(void);
CTIIPFileInfor(CTIIPFileInfor& a);
~CTIIPFileInfor(void);
void operator=(CTIIPFileInfor& a);
void Initial(void);
};
//读文件
/*
说明:
1.该类中不对坐标进行转换,只是将文件中的坐标按原样读入;
*/
class CReadTIIPFile: public CObject
{
public:
CTIIPFileInfor m_FileInfo; //读入的所有文件内容
private:
FILE *m_pDXFFile; //文件指针
BOOL m_bReadWindowText; //=ture 读Window/Dos文本文件=false 读Unix/Linux下文本文件
CString m_strFileName; //读取的文件名,同时也可以作为放码文件名
CString m_strValue1, m_strValue2; //用于读组码和数据
// BOOL m_bOnlyReadBaseSize; //true 仅读基码
// BOOL m_bPattern; //=true 读纸样;=false 结构线
public:
CReadTIIPFile(void);
~CReadTIIPFile(void);
//读入文件
//输入参数:
// strFilePath 文件路径
//返回值:
// = 0 读入成功
// = 1 文件打不开
// = 2 可能是AutoCAD文件
// = 3 可能ASTM/AAMA文件
int ReadTIIPFile(CString strFilePath);
protected:
//读组码
//[输入] fFile 文件
//[输出] strString1/strString2 连续两行数据
void ReadGroupString(FILE *fFile, CString &strString1, CString &strString2);
//读入文件
//返回值:
// = 0 读入成功
// = 1 文件打不开
// = 2 可能是AutoCAD文件
// = 3 可能ASTM/AAMA文件
int ReadTIIPFile();
//读BLOCK信息
//输出参数:
// BlockInfor 读到的信息
//返回值:
// = 0 读入成功
// = 1 文件打不开
// = 2 可能是AutoCAD文件
// = 3 可能ASTM文件
//说明:
// 返回值为0时BlockInfor才有效
int ReadBlock(CTPBlockInfor &BlockInfor);
//分析组码999的字符串值
//输入参数:
// strValue 组码999的字符串值
//输出参数:
// iValue1 第一个数值 图元类型
// iValue2 第二个数值 点类型
// iValue3 第三个数值 剪口
// iValue4 第四个数值 放码ID
//说明:
// 当strValue中没有四个值时没有的等于-1
void Dispose999Value(CString strValue, int &iValue1, int &iValue2, int &iValue3, int &iValue4);
//读POLYLINE
//输出信息
// BlockInfor 块信息
//返回值:
// = 0 读入成功
// = 1 文件打不开
// = 2 可能是AutoCAD文件
// = 3 可能ASTM文件
//说明:
// 返回值为0时BlockInfor才有效
int ReadPolylineData(CTPBlockInfor &BlockInfor);
//读POLYLINE
//输出信息
// CurveInfor 读的线包含剪口
//返回值:
// = 0 读入成功
// = 1 文件打不开
// = 2 可能是AutoCAD文件
// = 3 可能ASTM文件
//说明:
// 返回值为0时CurveInfor才有效
int ReadPolylineData(CCurveNotchInfor &CurveInfor);
//读LINE
//输出信息
// BlockInfor 块信息
//返回值:
// = 0 读入成功
// = 1 文件打不开
// = 2 可能是AutoCAD文件
// = 3 可能ASTM文件
//说明:
// 返回值为0时BlockInfor才有效
int ReadLineData(CTPBlockInfor &BlockInfor);
//读LINE
//输出信息
// CurveInfor 直线两点
//返回值:
// = 0 读入成功
// = 1 文件打不开
// = 2 可能是AutoCAD文件
// = 3 可能ASTM文件
//说明:
// 返回值为0时CurveInfor才有效
int ReadLineData(CCurveNotchInfor &CurveInfor);
//读TEXT
//输出信息
// BlockInfor 块信息
void ReadTEXTData(CTPBlockInfor &BlockInfor);
//读标识符TEXT信息
BOOL ReadTEXTData(CTextData &TextData);
//纸样基本信息
//输入参数:
// BlockInfor 块信息
// strInformation 纸样的信息字符串
//返回值:
// =true表示为纸样基本信息 =false 不是为T文字
BOOL PatternInfor(CTPBlockInfor &BlockInfor, CString strInformation);
//读POINT
//输出信息
// BlockInfor 块信息
void ReadPointData(CTPBlockInfor &BlockInfor);
//读Entities信息
//输出参数:
// EntitiesInfor 读到的信息
//返回值:
// = 0 读入成功
// = 1 文件打不开
// = 2 可能是AutoCAD文件
// = 3 可能ASTM文件
int ReadEntities(CTPEntitiesInfor &EntitiesInfor);
//款式基本信息
//输入参数:
// EntitiesInfor 块信息
// strInformation 纸样的信息字符串
//返回值:
// =true表示为款式基本信息 =false 不是
BOOL StyleInfor(CTPEntitiesInfor &EntitiesInfor, CString strInformation);
BOOL ReadInsertInfor(CInsertData &InsertData);
//处理文件读入的数据
void DisposeFileData();
};
#endif