454 lines
11 KiB
C++
454 lines
11 KiB
C++
#pragma once
|
|
|
|
#include "ACString.h"
|
|
#include "ACStringList.h"
|
|
#include "WCString.h"
|
|
#include "WCStringList.h"
|
|
#include "UString.h"
|
|
#include "AString.h"
|
|
#include "DimOptionData.h"
|
|
|
|
#define DIM_CONFIG_NAME_IN_DIC _T("{C444878A}")
|
|
#define DIM_CONFIG_RELOAD_FLAG _T("{C777A9C7}")
|
|
#define DIM_CONFIG_NAME_IN_XDATA _T("{A7BA4B17}")
|
|
|
|
#ifdef _UNICODE
|
|
#define TString UString
|
|
#define CmpLabel GlobalFunc::UCmpLabel
|
|
#define _US(s) s
|
|
#define _AS(s) AString(s).GetBuffer()
|
|
#else
|
|
#define TString AString
|
|
#define CmpLabel GlobalFunc::ACmpLabel
|
|
#define _US(s) UString(s).GetBuffer()
|
|
#define _AS(s) s
|
|
#endif/*_UNICODE*/
|
|
|
|
#ifdef _UNICODE
|
|
#define TCString WCString
|
|
#define tstrchr_new GlobalFunc::WStrchrNew
|
|
#define tstrnew GlobalFunc::WStrNew
|
|
#define TCStringList WCStringList
|
|
#else
|
|
#define TCString ACString
|
|
#define tstrchr_new GlobalFunc::StrchrNew
|
|
#define tstrnew GlobalFunc::StrNew
|
|
#define TCStringList ACStringList
|
|
#endif
|
|
|
|
#define REWIND 1
|
|
#define CONTINUE 0
|
|
|
|
//系统单位相对于毫米的数值比例
|
|
#define _UNIT_SCALE (g_DimOption::instance().g_bMeterUnitDraw ? 0.001 : 1.0)
|
|
|
|
//把MM单位换算为系统单位
|
|
#define _AS_SYS_UNIT(nMM) (nMM * _UNIT_SCALE)
|
|
|
|
//把系统的距离单位换算为毫米
|
|
#define _AS_MM(nDist) ((nDist) / _UNIT_SCALE)
|
|
|
|
//把系统的距离单位换算为米
|
|
#define _AS_METER(nDist) (_AS_MM(nDist) / 1000.0)
|
|
|
|
#define _AS_SQMETER(nArea) ((nArea) / (1000.0 * _UNIT_SCALE) / (1000.0 * _UNIT_SCALE))
|
|
|
|
#define TCHXD _T("_SHS") //扩展实体数据的应用程序名称
|
|
|
|
#define Q_YES 1
|
|
#define Q_NO 0
|
|
|
|
#define LAYSTAT_ON 0x01
|
|
#define LAYSTAT_OFF 0x02
|
|
#define LAYSTAT_THAW 0x04
|
|
#define LAYSTAT_FREEZE 0x08
|
|
#define LAYSTAT_UNLOCK 0x10
|
|
#define LAYSTAT_LOCK 0x20
|
|
#define LAYSTAT_CURRENT 0x40
|
|
|
|
#define MXYZ 0
|
|
#define SXYZ 1
|
|
#define RX 2
|
|
#define RY 3
|
|
#define RZ 4
|
|
#define NOP 5
|
|
#define EXIT 6
|
|
|
|
#define OS_NON 0
|
|
#define OS_END 1
|
|
#define OS_MID 2
|
|
#define OS_CEN 4
|
|
#define OS_NOD 8
|
|
#define OS_QUA 16
|
|
#define OS_INT 32
|
|
#define OS_INS 64
|
|
#define OS_PER 128
|
|
#define OS_TAN 256
|
|
#define OS_NEA 512
|
|
#define OS_QUI 1024
|
|
#define OS_APP 2048
|
|
|
|
#define XD_SHORT 1070
|
|
#define XD_INT 1070
|
|
#define XD_STR 1000
|
|
#define XD_REAL 1040
|
|
#define XD_LONG 1071
|
|
#define XD_POINT 1010
|
|
#define XD_HANDLE 1005
|
|
|
|
#define ads_abort(s) assert(0)
|
|
#define RTSTRUCT 5011
|
|
|
|
#define EX_INT 11000
|
|
#define EX_REAL 11100
|
|
#define EX_STRING 11200
|
|
#define EX_HANDLE 11300
|
|
#define EX_STRUCT 11400
|
|
#define EX_END 11500
|
|
|
|
#define EX_NEW 20000
|
|
#define EX_BIND 20000
|
|
|
|
#define NOT_FOUND -1
|
|
|
|
#if !defined(_WIN64) && !defined (_AC64) && ARX >= 21
|
|
#define TLong_ptr int32_t
|
|
#else
|
|
#define TLong_ptr LONG_PTR
|
|
#endif
|
|
|
|
#define SS_CREATE 0x01
|
|
#define SS_FREE 0x02
|
|
#define SS_MARK 0x04
|
|
|
|
// line style 线形
|
|
#define LS_FINITE 1
|
|
#define LS_INFINITE 0
|
|
|
|
#define OFFSET_LEFT 0
|
|
#define OFFSET_RIGHT 1
|
|
|
|
// position realationship 位置关系
|
|
#define PR_OUTSIDE 0
|
|
#define PR_ONPT1 1
|
|
#define PR_ONCIRCLE 1
|
|
#define PR_ONPT2 2
|
|
#define PR_INSIDE 3
|
|
#define PR_EXTEND 4
|
|
#define PR_EDGE 5
|
|
#define PR_INTERS 6
|
|
|
|
#define PRIV_STR(s) s
|
|
|
|
#define MULTI_LINE 0x0001
|
|
#define ACAD_ENTITY 0x0002 //非上华对象
|
|
|
|
#define PI 3.1415926
|
|
|
|
#define LINE_SEGMENT (RTNORM + 1)
|
|
#define ARC_SEGMENT (RTNORM + 2)
|
|
|
|
//词典操作宏,数据类型
|
|
#define TYPE_WDictItem -1
|
|
#define TYPE_WDict 0
|
|
#define TYPE_WBoolItem 1
|
|
#define TYPE_WCharItem 2
|
|
#define TYPE_WLongItem 3
|
|
#define TYPE_WDoubleItem 4
|
|
#define TYPE_WCStringItem 5
|
|
#define TYPE_WSelectItem 6
|
|
|
|
#define BLOCK_SWAP _T("_$001$_")
|
|
|
|
#define OPENOBJ_BEGIN(Ent, OpenMode, ClassName, VariableName) {\
|
|
AcDbObjectPtr tObj##VariableName(Ent, OpenMode); \
|
|
ClassName *VariableName=!tObj##VariableName? NULL: ClassName::cast(tObj##VariableName.m_pObject);
|
|
|
|
#define OPENOBJ_END() }
|
|
|
|
#define append_rblists(xdata, tag_xdata) LinkResbufList(*xdata, tag_xdata)
|
|
#define Cpoint(to, from) {to[0] = from[0]; to[1] = from[1]; to[2] = from[2];}
|
|
#define Spoint(pt, x, y, z) {pt[0] = (x); pt[1] = (y); pt[2] = (z);}
|
|
|
|
#define INITGET_BEG(nFlag, szKeyTable) { GlobalFunc::InitGetBegin(nFlag, szKeyTable);
|
|
#define INITGET_END() GlobalFunc::InitLocalMsg(FALSE); }
|
|
|
|
#define RealEqual(num1, num2, prec) (fabs((num1) - (num2)) < (prec))
|
|
#define IsSameDrt(drt1, drt2, prec) (fabs(sin((drt1) - (drt2))) < prec? 1 : 0)
|
|
#define IsOrthDrt(drt1, drt2, prec) (fabs(cos((drt1) - (drt2))) < prec? 1 : 0)
|
|
|
|
#define AS_INT(f) (f < 0.0 ? int((f) - 0.5) : int((f) + 0.5))
|
|
|
|
#define MAX_MIN(mn, type) \
|
|
{ \
|
|
va_list vlst; \
|
|
va_start(vlst, r1); \
|
|
type res = r1; \
|
|
for(int i = 0; i < n-1; i++) { \
|
|
type r = va_arg(vlst, type); \
|
|
res = mn(res, r); \
|
|
} \
|
|
va_end(vlst); \
|
|
return res; \
|
|
}
|
|
|
|
#define Midpoint(p1, p2, dest) \
|
|
{ \
|
|
dest[0] = (p1[0] + p2[0]) / 2.0; \
|
|
dest[1] = (p1[1] + p2[1]) / 2.0; \
|
|
dest[2] = (p1[2] + p2[2]) / 2.0; \
|
|
}
|
|
|
|
#define ELEMENTS(array) (sizeof(array) / sizeof((array)[0]))
|
|
|
|
#ifndef TARCH_SETTING_MSG_UPDATA
|
|
#define TARCH_SETTING_MSG_UPDATA WM_USER+102
|
|
#define TARCH_SETTING_MSG_BUTTONSTATION WM_USER+103
|
|
#endif
|
|
|
|
//打开dict
|
|
#define OPEN_DICT(dict) \
|
|
{\
|
|
WDict*pCurSubDict=&dict;\
|
|
{
|
|
|
|
//打开dict的下层词典
|
|
#define OPEN_DICT_EX(dict,KeyPath) \
|
|
{\
|
|
WDict *pCurSubDict=dict.FindOrAddDict(KeyPath);\
|
|
if(pCurSubDict!=NULL)\
|
|
{
|
|
|
|
//关闭当前词典
|
|
#define CLOSE_DICT() \
|
|
}\
|
|
}
|
|
|
|
//嵌套打开下层词典,如不存在则自动建立
|
|
#define OPEN_SUB_DICT(KeyPath) \
|
|
{\
|
|
WDict* pCurSubDict0 = pCurSubDict;\
|
|
pCurSubDict = pCurSubDict0->FindOrAddDict(KeyPath);\
|
|
if(pCurSubDict != NULL)\
|
|
{\
|
|
//关闭嵌套打开的下层词典
|
|
#define CLOSE_SUB_DICT() \
|
|
}\
|
|
pCurSubDict = pCurSubDict0;\
|
|
}
|
|
|
|
//打开dict的子键(也可以是子字典)
|
|
#define OPEN_KEY(dict,KeyPath) (dict.FindItem(KeyPath))
|
|
|
|
//打开当前打开字典的子键(也可以是子字典)
|
|
#define OPEN_SUB_KEY(KeyPath) (pCurSubDict->FindItem(KeyPath))
|
|
|
|
//读入键数据,如果Key不存在,value不变
|
|
#define GET_VALUE(KeyPath,value) (pCurSubDict->GetValue(KeyPath,value))
|
|
|
|
#define GET_CMB_VALUE(KeyPath,value) (pCurSubDict->GetCombValue(KeyPath,value))
|
|
|
|
//写入键数据,如果Key不存在,首先建立之
|
|
#define SET_VALUE(KeyPath,value) (pCurSubDict->SetValue(KeyPath,value))
|
|
|
|
//读入BOOL数据
|
|
#define GET_BOOL(KeyPath,value) \
|
|
{\
|
|
bool value0;\
|
|
if(pCurSubDict->GetValue(KeyPath,value0))\
|
|
value=value0;\
|
|
}
|
|
|
|
//写入键数据,如果Key不存在,首先建立之
|
|
#define SET_BOOL(KeyPath,value) \
|
|
{\
|
|
bool value0 = value;\
|
|
pCurSubDict->SetValue(KeyPath,value0);\
|
|
}
|
|
|
|
#define DF_BIND 0x01 //绑定对象
|
|
#define DF_POSITION 0x02 //移动文字位置
|
|
#define DF_TEXT 0x04 //给过文字内容
|
|
#define DF_DSSCALE 0x08 //采用DimStyle的比例
|
|
#define DF_ANGULAR 0x10 //是否为圆弧标注
|
|
#define DF_DIAMETER 0x10 //是否为直径标注,用于TDbRadiusDim
|
|
#define DF_CHORD 0x20 //是否标注弦长
|
|
#define DF_ARCLEN 0x40 //是否标注弧长 DF_CHORD,DF_ARCLEN只能有一位有效
|
|
#define DF_ASSOCIATE 0x80 //是否线性标注,TArch7.0
|
|
|
|
typedef ads_real ads_vector[3];
|
|
|
|
typedef int (*TConvertTextPtr)(const TCHAR *pszText, TCString &sResult, void *pData); //RTNORM/RTERROR/RTNONEv
|
|
|
|
enum ShapeType
|
|
{
|
|
SHAPE_UNKNOWN,
|
|
SHAPE_CIRCLE,
|
|
SHAPE_RECTANGLE,
|
|
SHAPE_POLY
|
|
};
|
|
|
|
typedef struct STBinary
|
|
{
|
|
short length;
|
|
char *buffer;
|
|
}*STBINARY, *PSTBINARY;
|
|
|
|
struct STPlanePara
|
|
{
|
|
double A, B, C, D;
|
|
};
|
|
|
|
enum CurveType
|
|
{
|
|
CURVE_LINE,
|
|
CURVE_ARC,
|
|
CURVE_CIRCLE
|
|
};
|
|
|
|
enum FormatType
|
|
{
|
|
WS_CHAR,
|
|
WS_INT,
|
|
WS_DOUBLE,
|
|
WS_STRING,
|
|
WS_FORMAT
|
|
};
|
|
|
|
// TextStyle
|
|
enum TDimStyle {
|
|
DS_STANDARD = 0, //默认
|
|
DS_LINEAR = 1, //线性
|
|
DS_ANGLE = 2, //角度
|
|
DS_RADIUS = 3, //半径
|
|
};
|
|
|
|
enum TTextStyle {
|
|
TS_NULL = 9, // 占为标准名称使用
|
|
TS_STANDARD = 0, // 默认
|
|
TS_AXIS = 1, // 轴号
|
|
TS_WINDOW = 2, // 门窗编号
|
|
TS_LABEL = 3, // 索引圆圈文字
|
|
TS_DIM = 4, // 尺寸标注
|
|
TS_DIMFONT = 5, // 旧版上华的尺寸文字样式
|
|
TS_WDTABLE = 6, // 门窗表
|
|
TS_SPACE = 7, // 房间标注
|
|
TS_SUNANA = 8, // 日照分析
|
|
// sg add 120106,根据建筑9.0增加的新文字样式
|
|
TS_TABLE = 10, // 表格文字
|
|
TS_INDEXSCALE = 11, // 索引图名比例
|
|
TS_SECTION = 12, // 剖切符号
|
|
TS_DRAWINGNAME = 13, // 图名标注
|
|
TS_NORTHTHUMB = 14, // 指北针文字
|
|
TS_SYMBOL = 15, // 其他符号
|
|
TS_PKNGTSRP = 16, // 停车位
|
|
};
|
|
|
|
struct STIniStruct
|
|
{
|
|
TCHAR *desc_handle;
|
|
TCHAR *desc_value;
|
|
struct STIniStruct *next;
|
|
};
|
|
|
|
//插入图块的高级方法
|
|
#define IBF_ROT90 0x01 //转90度
|
|
#define IBF_MIRLR 0x02 //左右翻转
|
|
#define IBF_MIRUD 0x04 //上下翻转
|
|
#define IBF_FRAME 0x08 //改外框
|
|
#define IBF_ROTATE 0x10 //改转角
|
|
#define IBF_BASEPT 0x20 //改基点
|
|
#define IBF_RESEL 0x40 //重选择图块
|
|
#define IBF_MINSERT 0x80 //多重插入
|
|
#define IBF_SCALE 0x800 //改比例
|
|
#define IBF_TINSERT 0x100 //上华图块
|
|
#define IBF_ALIGN 0x200
|
|
#define IBF_MULTVIEW 0x400 //多视图
|
|
|
|
#define EDF_XSCALE 0x01 // for Text
|
|
#define EDF_NO_AUTOPROP 0x04 // only for explode control
|
|
|
|
#define ZOOME SHads_command(RTSTR, _T("ZOOM"), RTSTR, _T("E"), RTNONE)
|
|
#define ZOOMP SHads_command(RTSTR, _T("ZOOM"), RTSTR, _T("P"), RTNONE)
|
|
#define UNDOB SHads_command(RTSTR, _T(".UNDO"), RTSTR, _T("BE"),RTNONE)
|
|
#define UNDOE SHads_command(RTSTR, _T(".UNDO"), RTSTR, _T("E"), RTNONE)
|
|
|
|
#define XString TCString
|
|
#define XPoint ADSGePoint3d
|
|
#define CT_std_angle GlobalFunc::AngleRangeTo2PI
|
|
#define XPoly2D GePoly2D
|
|
#define XCurveSegment GeCurveSegment
|
|
#define XLine GeLine
|
|
#define XPushVar GlobalFunc::PushAcadVar
|
|
#define XSymbolList SymbolStringList
|
|
#define XStringList TCStringList
|
|
#define CTemporaryResourceOverride CAcModuleResourceOverride
|
|
#define Entity EntitySet
|
|
#define XDirectionCurve GeDirectionCurve
|
|
#define XArc GeArc
|
|
#define PickSet PickEntSet
|
|
#define xg_getvar GlobalFunc::TGGetVar
|
|
#define XVector3D Vector3D
|
|
#define DList PtrList
|
|
#define XPointList ADSGePointList
|
|
#define XCircle GeCircle
|
|
#define xg_setvar GlobalFunc::TGSetVar
|
|
#define XPushMemVar PushMemVar
|
|
#define XGetPoint GlobalFunc::GetPickPoint
|
|
#define XRectAngle GeRectAngle
|
|
#define XPointDir2d ADSGePointDir2d
|
|
|
|
#define INITGET_BEG(nFlag, szKeyTable) { GlobalFunc::InitGetBegin(nFlag, szKeyTable);
|
|
#define INITGET_END() GlobalFunc::InitLocalMsg(FALSE); }
|
|
|
|
#define g_csDwbPath GlobalFunc::getDwbPath()
|
|
#define g_csTkPath GlobalFunc::getTkPath()
|
|
#define PS_SNAP (20.0*g_DimOption::instance()._distSnap)
|
|
|
|
#define MIRROR_XAXIS 0x01 // x轴镜像
|
|
#define MIRROR_YAXIS 0x02 // y轴镜像 //how many byte in the buffer?
|
|
#define PACKSIZE 8192
|
|
#define HEADLENGTH 40
|
|
#define SUCCEED 0 //return flag to note succeed operation
|
|
#define NOMEMORY 1 //can not alloc enough memory
|
|
#define WRONGDATA 2 //input file has wrong data
|
|
#define ILLFORMAT 3 //can decompress only our file format
|
|
#define NOCONTENT 4
|
|
#define COMPRESSFLAG "AS LZW 1.0 "
|
|
#define MAXBUFSIZE 1000
|
|
#define BIF_T6BETA1 0x08
|
|
#define BIF_MULTIVIEW 0x04 //多视图
|
|
|
|
|
|
|
|
typedef struct
|
|
{
|
|
short l;
|
|
short r;
|
|
unsigned char k;
|
|
} STPACKTREE; //internal use in PackFile()
|
|
|
|
typedef struct
|
|
{
|
|
short p;
|
|
unsigned char k;
|
|
} STUNPACKTREE;
|
|
|
|
struct STCatalogue
|
|
{ //幻灯库的目录结构
|
|
char itemName[32];
|
|
long addr;
|
|
public:
|
|
|
|
STCatalogue()
|
|
{
|
|
for (int i = 0; i < 32; i++)
|
|
{
|
|
itemName[i] = 0;
|
|
}
|
|
addr = 0;
|
|
}
|
|
};
|
|
|
|
|