
#ifndef _basext_h
#define _basext_h


#include "3dviewbase.h"//"dm.h" // Zwz 2002-4-29
#include "HATCH.H"	//sue Add. 2002-4-28
#include "dim.h"// Lg 2004-3-12 
#include "eb_const.h"// Lg 2004-3-12

// Lg 2004-3-11 moved from dmext.h
_declspec(dllimport) CTxtStyleList g_TxtStyle;
_declspec(dllimport) CTxtStyle g_CurTxtPara;	//当前文字标注参数
_declspec(dllimport) CMap <int, int &, int, int &> g_TxtStyleIDMap;	//读入标题栏或图框中的文字风格ID

//_declspec(dllimport) DIMSTYLE DimStyle;// Lg 01-7-20
_declspec(dllimport) CDimStyle DimStyle;// Lg 2004-3-8 风格调整为类实现
_declspec(dllimport) CDimStyleList g_DimStyle;

//_declspec(dllimport) CBomStyle g_CurBomPara;
_declspec(dllimport) CBomStyleList g_BomStyle;
_declspec(dllimport) CPartnoStyle  g_PartnoPara;
_declspec(dllimport) char PartNo[7];			//当前序号字符串

_declspec(dllimport) CBase* EditPickNode;
_declspec(dllimport) double ext_Wide;
_declspec(dllimport) double ext_Slender;
// Lg 2004-3-11 end

// Lg 01-7-20 add
//////////
_declspec(dllimport) int nIfDefMod;
_declspec(dllimport) int nIfFreeDat;
_declspec(dllimport) int nAimType;
_declspec(dllimport) int usrChoice;
_declspec(dllimport) char szUpText[8];
_declspec(dllimport) char szDownText[4];
_declspec(dllimport) char	szDatum[4];
_declspec(dllimport) char szToleDimText[128];
_declspec(dllimport) char	szBaseList[4];
_declspec(dllimport) char    szBaseList1[7];
_declspec(dllimport) char	szMainList[4][4];
_declspec(dllimport) int		nCurRow;
_declspec(dllimport) int		nArrowType;
_declspec(dllimport) int     nDirection;
_declspec(dllimport) int		nTotal;
_declspec(dllimport) int		nLocation; // 符号位置，0－上、1－下
_declspec(dllimport) int nPreview ;
_declspec(dllimport) int	nRoughKind; // 0简单标注、1标准标注
_declspec(dllimport) int nLeader; // 0加引线，1不加引线
_declspec(dllimport) double dLen1,dLen2;// Lg 2001-6-6
_declspec(dllimport) double	dToleLen[3];
_declspec(dllimport) TOLE	curtole[3];
_declspec(dllimport) TOLE	oldtole[3];
_declspec(dllimport) WELD	curweld;
_declspec(dllimport) WELD	oldweld;
_declspec(dllimport) WELDTXTLEN	weldtxtlen;
_declspec(dllimport) ROUGH	currough;
_declspec(dllimport) ROUGH	oldrough;
_declspec(dllimport) ROUGHTXTLEN roughtxtlen;
_declspec(dllimport) bool bNoMem;
_declspec(dllimport) COLORREF g_CellGndColor;
////////////
_declspec(dllimport) double	  dmCoeffA,dmCoeffB,dmCoeffC,dmCoeffD;
_declspec(dllimport) unsigned  char	   DmBlockColor ;
_declspec(dllimport) unsigned  char	   DmBlockLtype ;
_declspec(dllimport) unsigned  char	   DmBlockLayer ;
_declspec(dllimport) unsigned  char	   DmBlockLLayer ;

//capp
_declspec(dllimport) CCell *DmCurCell;
_declspec(dllimport) CColumn *DmColumnOfCurCell;
_declspec(dllimport) int   dmDrawCellFlag;
_declspec(dllimport) char  DmCellStrBuf[4096];
_declspec(dllimport) int   DmCellCurPos;
//_declspec(dllimport) bool  bSelectFlag;
_declspec(dllimport) CTypedPtrList<CPtrList,CBase *> 	DmTemplateChain;
_declspec(dllimport) CTypedPtrList<CPtrList,CCard *>	DmCardChain;
_declspec(dllimport) CTypedPtrList<CPtrList,CCommonAttrib*>    DmCommonAttribChain;
_declspec(dllimport) CBlock  DmCurCardTemplate;
_declspec(dllimport) CCard  *DmCurCard;
_declspec(dllimport) CCard  *DmCardFromeCV2Capp; // Zwz 2001-12-18 纪录capp通过CaxaView获取的卡片内容
_declspec(dllimport) int     DmCurCardPage;
_declspec(dllimport) int     DmPickCardPage;
_declspec(dllimport) long    DmMaxLocCardID;	//CJL Add, 2003-12 记录当前最大的卡片ID号
_declspec(dllimport) CString  DmCurRegulationName;
_declspec(dllimport) int  DmCurProduct;
_declspec(dllimport) BOX	 DmBackTemplateWin;
_declspec(dllimport) BOX	 DmBackCardWin;
_declspec(dllimport) BOOL  ShowRegTree;
_declspec(dllimport) BOOL  ShowCardTree;
_declspec(dllimport) CTypedPtrList<CPtrList,CBase *>		*DmBackEntityTop;
_declspec(dllimport) BOOL  DmDocStatusChange;

_declspec(dllimport) CColumn* dmGetColumnOfCell(CTypedPtrList<CPtrList,CBase *>	*top,int ColumnId);

_declspec(dllimport) void dmDeleteCardCellList(CTypedPtrList<CPtrList,CCardCell*> &entList);
_declspec(dllimport) void dmDeleteCardList(CTypedPtrList<CPtrList,CCard*> &entList);
_declspec(dllimport) int DmGetSelectedCellsByBox(XYZ *p1,XYZ *p2);
_declspec(dllimport) CCell* DmGetPickCell(double PosX,double PosY);
_declspec(dllimport) CCell* DmGetHorNextCell(CCell *CurCell );
_declspec(dllimport) CCell* DmGetHorPrevCell(CCell *CurCell );
_declspec(dllimport) CCell* DmGetVerNextCell(CCell *CurCell );
_declspec(dllimport) CCell* DmGetVerPrevCell(CCell *CurCell );

//将对象 object 插入链头 top
_declspec(dllimport) void DmInsertCardObject(CTypedPtrList<CPtrList,CCard*> *top,CCard* object);

//将对象 object 从 链头 top 中取下
_declspec(dllimport) void DmRemoveCardObject(CTypedPtrList<CPtrList,CCard*> *top,CCard* object);

//将对象 object 从链头 top 中删除
_declspec(dllimport) void DmDeleteCardObject(CTypedPtrList<CPtrList,CCard*> *top,CCard* object);

_declspec(dllimport) void dmCommonAttribListSerialize(CTypedPtrList<CPtrList,CCommonAttrib*> &entList,CArchive &ar);

_declspec(dllimport) void dmDeleteCommonAttribList(CTypedPtrList<CPtrList,CCommonAttrib*> &entList);

_declspec(dllimport) int dmCopyCommonAttribList(CTypedPtrList<CPtrList,CCommonAttrib*> &select,
												CTypedPtrList<CPtrList,CCommonAttrib*> &copy_select);

//将对象 object 插入链头 top
_declspec(dllimport) void DmInsertCommonAttribObject(CTypedPtrList<CPtrList,CCommonAttrib*> *top,CCommonAttrib* object);

//将对象 object 从 链头 top 中取下
_declspec(dllimport) void DmRemoveCommonAttribObject(CTypedPtrList<CPtrList,CCommonAttrib*> *top,CCommonAttrib* object);

//将对象 object 从链头 top 中删除
_declspec(dllimport) void DmDeleteCommonAttribObject(CTypedPtrList<CPtrList,CCommonAttrib*> *top,CCommonAttrib* object);

_declspec(dllimport) void DmAddTemplateToCurCardTemplate(CBlock *blk);
_declspec(dllimport) void DmDeleteTemplateFromCurCardTemplate();

_declspec(dllimport) CCard*  DmGetChildCard(CCard *pCard);
_declspec(dllimport) CCard*  DmGetChildTailCard(CCard *pCard);
_declspec(dllimport) CCard*  DmGetParentCard(CCard *pCard);
_declspec(dllimport) CCard*  DmGetPrevSiblingCard(CCard *pCard);
_declspec(dllimport) CCard*  DmGetNextSiblingCard(CCard *pCard);
_declspec(dllimport) int  DmGetCardPageNo(CCard *pCard);
_declspec(dllimport) CCard*  DmGetCurCard();
_declspec(dllimport) CBlock*  DmGetCurCardTemplate();
_declspec(dllimport) int DmInsertCardNode(CCard *pCard,CCard *pParent=NULL,CCard *pInsertAfter=NULL);

_declspec(dllimport) CCard*  DmGetCardByName(CString &Card_Name,short recordno,short pageno=0,int c_pageno=0);
_declspec(dllimport) CBlock*  DmGetCardTemplateByName(CString &Template_Name);

//ssss
_declspec(dllimport) CString   DmTableName;
_declspec(dllimport) CString   DmFieldName;
_declspec(dllimport) CTypedPtrList<CPtrList,CCell *>   DmRowset;
_declspec(dllimport) CString   DmPickCardName;
_declspec(dllimport) DWORD     DmPickCardId;
_declspec(dllimport) CCard     *DmPickCard;
_declspec(dllimport) CTable    DmRecordset;
_declspec(dllimport) BOOL      dmSetFillXOR;
_declspec(dllimport) int  DmGetRecordset(double PosX,double PosY,int record_or_row=0);  //0=record,1=row
_declspec(dllimport) void DmFreeRecordset();
_declspec(dllimport) BOOL DmCurRecordsetIsEmpty();
_declspec(dllimport) CTable* DmGetSelectTable(CTypedPtrList<CPtrList,CBase*> &entList,double PosX,double PosY);
_declspec(dllimport) CColumn* DmGetSelectColumn(CTypedPtrList<CPtrList,CBase*> &entList,double PosX,double PosY);
_declspec(dllimport) int DmGetRowset(double PosX,double PosY);
_declspec(dllimport) void DmFreeRowset();
_declspec(dllimport) BOOL DmCurRowsetIsEmpty();

_declspec(dllimport) void DmEnableFillXOR();
_declspec(dllimport) void DmDisableFillXOR();
_declspec(dllimport) void DmHighLightRecordset();
_declspec(dllimport) void DmNormalRecordset();

_declspec(dllimport) CTypedPtrList<CPtrList,CBase *>		*DmEntityTop;
_declspec(dllimport) CEb3dInfo								*Dm3dInfo;
//_declspec(dllimport) CTypedPtrList<CPtrList,CEb3DView*>		*Dm3DViewTop; // Zwz 2002-3-4 3D视图链

_declspec(dllimport) CTypedPtrList<CPtrList,CBase *>		 ResBuffer;

_declspec(dllimport) CTypedPtrList<CPtrList,CBase *>		 DmTempNodeTop;		 //系统临时结点链,用于透名命令时显示临时结点
_declspec(dllimport) CTypedPtrList<CPtrList,CBase *>		 DmSelect;
_declspec(dllimport) CTypedPtrList<CPtrList,CBase *>		 DmViewportSelect;
_declspec(dllimport) DMPARAMETER				 DmParameter;

_declspec(dllimport) BOX	 DmSaveLogicalWin;
_declspec(dllimport) BOX	 DmLogicalWin;

_declspec(dllimport) CLtype	   DmLtypeDefine;
_declspec(dllimport) CLayer	   DmLayerDefine;
_declspec(dllimport) CColor	   DmColorDefine;

_declspec(dllimport) void dmBaseSerialize(CBase *pBase,CArchive &ar);

//拷贝一个点
_declspec(dllimport) void dmCopyPoint(XYZ *copy_p,XYZ *old_p);

//拷贝一个选择集
_declspec(dllimport) int  dmCopySelect(CTypedPtrList<CPtrList,CBase*> &select,
     CTypedPtrList<CPtrList,CBase*> &copy_select);

//拷贝一个CardCell
_declspec(dllimport) int  dmCopyCardCellChain(CTypedPtrList<CPtrList,CCardCell*> &select,
     CTypedPtrList<CPtrList,CCardCell*> &copy_select);
//拷贝一个CardChain
_declspec(dllimport) int  dmCopyCardChain(CTypedPtrList<CPtrList,CCard*> &select,
     CTypedPtrList<CPtrList,CCard*> &copy_select);

//系统对选择集进行矩阵变换
_declspec(dllimport) void dmTransSelect(CTypedPtrList<CPtrList,CBase*> &select);

//系统画选择集通过矩阵变换
_declspec(dllimport) void dmDrawSelectByMatrix(CTypedPtrList<CPtrList,CBase*> &select);

//拷贝一个选择集
_declspec(dllimport) int  dmCopyBuffer(CTypedPtrList<CPtrList,CEbBuffer*> &buffer,
     CTypedPtrList<CPtrList,CEbBuffer*> &copy_buffer);

//系统对选择集进行矩阵变换
_declspec(dllimport) void dmTransBuffer(CTypedPtrList<CPtrList,CEbBuffer*> &buffer);

//设置缓冲区链中type组的值
// 0   到 9    字符串		char *
// 10  到 39   点		XYZ
// 40  到 59   实数		double
// 60  到 79   整数		int
// 80  到 99   无符号整数	unsigned char
// 100 到 159  CString	对象
// 160 到 179  短整数		short
_declspec(dllimport) BOOL dmSetListBuffer(CBase *pBase,unsigned char type,void *value);

//获得缓冲区链中type组的值
// 0   到 9    字符串		char *
// 10  到 39   点		XYZ
// 40  到 59   实数		double
// 60  到 79   整数		int
// 80  到 99   无符号整数	unsigned char
// 100 到 159  CString	对象
// 160 到 179  短整数		short
_declspec(dllimport) BOOL dmGetListBuffer(CBase *pBase,unsigned char type,void *value);

//从缓冲区链中删除一组定义
// 0   到 9    字符串		char *
// 10  到 39   点		XYZ
// 40  到 59   实数		double
// 60  到 79   整数		int
// 80  到 99   无符号整数	unsigned char
// 100 到 159  CString	对象
// 160 到 179  短整数		short
_declspec(dllimport) void dmDeleteTypeBuffer(CBase *pBase,unsigned char type);

//从缓冲区链中删除所有定义
_declspec(dllimport) void dmDeleteBuffer(CBase *pBase);

//设置用户显示窗口和视口 for  CDC
//x, y 为视口的角点坐标, 通常取为 0,0
//width  为视口宽度
//height 为视口高度
_declspec(dllimport) void dmSetViewportWin(double winLeft,double winRight,double winBottom,double winTop,
     int x=0,int y=0,int width=0,int height=0);

//逻辑坐标转化为用户坐标
_declspec(dllimport) XYZ  dmScToWc(int x,int y);

//用户坐标转化为逻辑坐标
_declspec(dllimport) POINT  dmWcToSc(double x,double y,double z);

//0   关,   1  开
_declspec(dllimport) int  dmGetLayerStatus(unsigned char layer);

_declspec(dllimport) void  dmSetColor(unsigned char index);

_declspec(dllimport) int dmCalArcDivSegNum(double r,double a);

//将一个实数转成字符串
_declspec(dllimport) void baseCreateString(double i_dVal,const CDimStyle& i_Style,char* o_pcText,int i_iType=0);

//将选择集 select 插入到链头 top 中去
_declspec(dllimport) void admAttachSelect(CTypedPtrList<CPtrList,CBase*> *top,
     CTypedPtrList<CPtrList,CBase*> &select,BOOL remove=TRUE);
//向块中加入圆弧对象
//如果 ang=NULL    则由系统计算圆心角,否则使用措定值
//如果 radius=NULL 则由系统计算半径,  否则使用措定值
_declspec(dllimport) CArc *admAddArcToBlk(CGroup *block,XYZ pc,XYZ ps,XYZ pe,double *ang,double *radius,
       unsigned char ltype=L_SOLID,unsigned char layer=DmCurLayer,
       unsigned char color=C_BYBLOCK);
//向块中加入直线对象
_declspec(dllimport) CLine *admAddLineToBlk(CGroup *block,XYZ p1,XYZ p2,
       unsigned char ltype=L_SOLID,unsigned char layer=DmCurLayer,
       unsigned char color=C_BYBLOCK);
//将对象 object 加入 block 的子结点链
_declspec(dllimport) void admAttachObject(CGroup *block,CBase* object);
//将对象 pbase 加到选择集 select 中
_declspec(dllimport) void admAddObjectToSelect(CTypedPtrList<CPtrList,CBase*> &select,CBase *pbase);

_declspec(dllimport) void admEntListFree(CTypedPtrList<CPtrList,CBase*> &list);
//得到选择集的包容矩形
_declspec(dllimport) int admGetSelectBox(CTypedPtrList<CPtrList,CBase*> &select,BOX *box);
/////////////// Lg 01-7-7 add
//向块中加入点对象
_declspec(dllimport) CPot *admAddPotToBlk(CGroup *block,XYZ p,unsigned char layer=DmCurLayer,
       unsigned char color=C_BYBLOCK);
//向块中加入直线箭头
_declspec(dllimport) void admAddLineArrowToBlk(int inside,int arrow1,int arrow2,double arrow_len,
     XYZ arr_p1,XYZ arr_p2,CGroup *block,
     unsigned char layer=DmCurLayer,
     unsigned char ltype=L_SOLID,
     unsigned char color=C_BYBLOCK);
//向块中加入圆弧箭头
//inside = 1,  箭头朝内, inside = 0,  箭头朝外
//arrow1 = NOARROW,    无箭头
//arrow1 = ARROW,      有箭头
//arrow1 = ARROWLINE,  箭头为斜线
//arrow1 = ARROWDOT,   箭头为点
//arrow2 = NOARROW,    无箭头
//arrow2 = ARROW,      有箭头
//arrow2 = ARROWLINE,  箭头为斜线
//arrow2 = ARROWDOT,   箭头为点
//arrow_len,	       箭头长度
_declspec(dllimport) void admAddArcArrowToBlk(int inside,int arrow1,int arrow2,double arrow_len,
											  XYZ pc,XYZ ps,XYZ pe,double r,double angle,CGroup *block,
											  unsigned char layer=DmCurLayer,
											  unsigned char ltype=L_SOLID,
											  unsigned char color=C_BYBLOCK);

//向块中加入圆对象
_declspec(dllimport) CCircle *admAddCircleToBlk(CGroup *block,XYZ pc,double r,
       unsigned char ltype=L_SOLID,unsigned char layer=DmCurLayer,
       unsigned char color=C_BYBLOCK);
//获得缓冲区链中type组的值
_declspec(dllimport) bool  GetListBuffer( BUFFER list, int type, void * value );
// DOS-EB 文件读入剖切符号
_declspec(dllimport) CBlock* GetCutsBlkFromDosNode (NODE dosnode, int nLayer, int nLtype, int nColor);
//把基准代号DOS节点转换成块
_declspec(dllimport) CBlock* GetDatumBlkFromDosNode (NODE dosnode, int nLayer, int nLtype, int nColor);
// DOS-EB 文件读入形位公差
_declspec(dllimport) CBlock* GetToleBlkFromDosNode (NODE dosnode, int nLayer, int nLtype, int nColor);
// DOS-EB 文件读入焊接符号
_declspec(dllimport) CBlock* GetWeldBlkFromDosNode (NODE dosnode, int nLayer, int nLtype, int nColor);
//DOS-EB 文件读入粗糙度
_declspec(dllimport) CBlock* GetRoughBlkFromDosNode (NODE dosnode, int nLayer, int nLtype, int nColor);
// 生成基准代号块
_declspec(dllimport) CBlock* GetDatumBlock (XYZ xyzPos, XYZ xyzDrag, CBase* pObj);
// 生成基准代号块中的符号
_declspec(dllimport) void BuildDatum (XYZ xyzPos, XYZ xyzPnt,double dAng, CBlock* pBlock,const CDimStyle& i_Style);
//生成形位公差块并记录扩充数据
_declspec(dllimport) CBlock* GetToleBlock (XYZ xyzPnt, XYZ xyzPos, int nPreview,
					  TOLE *addtole=NULL,int nRow=-1,
					  int nDir=-1,int nArrow=-1);
// 生成公差代号并加入到形位公差块中
//_declspec(dllimport) void AddToleSymbolToBlk (CBlock* pBlock, XYZ xyzPc, int nSymbol);
// 生成形位公差某行除了公差代号以外其余的元素并加入到形位公差块中
//_declspec(dllimport) void AddToleTextToBlk (CBlock* pBlock, XYZ xyzPos, TOLE addtole);
// 计算形位公差某行中除了公差代号之外其余的总长度
_declspec(dllimport) double GetToleTxtLength (TOLE addtole,const CDimStyle& i_Style);
// 生成焊接符号块
_declspec(dllimport) CBlock* GetWeldBlock (XYZ xyzPnt, XYZ xyzPos, int nBlk);
// 记录扩充数据到焊接符号块节点里
_declspec(dllimport) void AppendWeldBlock (CBlock* pBlock);
//生成粗糙度块
_declspec(dllimport) CBlock* GetRoughBlock (XYZ xyzPos, XYZ xyzDrag, CBase* pObj);
// 生成粗糙度块中的符号
_declspec(dllimport) void BuildRough (XYZ xyzPos, double dAng, CBlock* pBlock,const CDimStyle& i_Style);
//计算粗糙度符号边长	
_declspec(dllimport) void GetRoughLength(const CDimStyle& i_Style) ;

// 读取一个实体结点
_declspec(dllimport) NODE  ReadOldNode( ifstream & oldFile, bool bAtt, short  deep );
// 将一个实体结点转化为新格式
_declspec(dllimport) CBase *  TranEntNode( NODE node );
//为缓冲区结点申请空间,申请串类则直接传入字符串,否则传入""
BUFFER dmMallocBuffer( int type, char * vstring );
//在缓冲区链中插入新结点
_declspec(dllimport) void  dmInsertBuffer( BUFFER *top, BUFFER buf );
//系统申请一结点空间
_declspec(dllimport) NODE dmMallocNode( void );
_declspec (dllimport) void   dmDeleteNode( NODE  node );
//删除一缓冲区链, 返回后执行listtop = NULL;
_declspec (dllimport) void  dmDeleteList(BUFFER listtop);
_declspec (dllimport) void  dmDeleteTree(NODE treetop);
/////////////////////////////
_declspec(dllimport) void InitEbbaseDll();//WZH Add. 2001-6-8
//非扩展dll调用entlib的时候初始化其资源
_declspec(dllimport) void InitEbEntLibDll();// Zwz 2001-9-26
//# SamePoint() 判断空间点是否相同
/*@
函数原形: int  SamePoint(PXYZ i_p0,PXYZ i_p1)
参数说明: PXYZ i_p0      空间点1
		  PXYZ i_p1      空间点2
使用说明: 固定精度,判断两空间点是否相同
函数返值:   int  1   相同点
				  0  不同点
参    考
*/
//_declspec(dllimport) int SamePoint(PXYZ i_p0,PXYZ i_p1);//lg 2001-12-29
////更新形位公差块
_declspec(dllimport) void AppendToleBlock (CBlock* pOldBlk, CBlock* pNewBlk);//lg 2001-12-29
// 生成焊接符号块扩展部分
_declspec(dllimport) void AppendWeldBlockEx (CBlock* pOldBlk, CBlock* pNewBlk);//lg 2001-12-29

//根据行文件名称以及图形位置索引解析图形
_declspec(dllimport) int dmGetShapeBlock(CString sShapeFileName, unsigned long ulPos, unsigned long ulLength, CBlock** ppEbBlock);

_declspec(dllimport) int dmDealShapeFileForInterface(char* sFileName, 
								CMap<unsigned short, unsigned short, unsigned long, unsigned long>* pShapIndexMap,
								CMap<unsigned short, unsigned short, unsigned long, unsigned long>* pShapLengthMap);

//绘制剖面线的相关函数,Moved in by sue. 2002-4-28
_declspec(dllimport) void GetLoopsFromNodes(CTypedPtrList<CPtrList,CBase*> &loop, CTypedPtrList <CPtrList, CBase*> &HeadLoop);	//sue Add. 2002-4-19
_declspec(dllimport) int JudgeTwoPtSame(XYZ p1,XYZ p2);
_declspec(dllimport) CHatch* DrawHatchByPattern(CTypedPtrList<CPtrList,CBase*> &loop,
			double scale,double ang,double hatch_diff,
			unsigned char layer,unsigned char ltype,unsigned char color,
						   char pattern[32]);
_declspec(dllimport) CHatch* DrawHatchByLoop(CTypedPtrList<CPtrList,CBase*> &loop,
			double dist,double angle,double hatch_diff,
			unsigned char layer,unsigned char ltype,unsigned char color);
_declspec(dllimport) CHatch *DrawHatchByDxfPattern(CTypedPtrList<CPtrList,CBase*> &loop,
			double scale,double ang,double hatch_diff,int line_num,HATCHPATTERN pat_line[10],
			unsigned char layer,unsigned char ltype,unsigned char color,
			char pattern[32]);
// sue
//EB97转换颜色 tzg 2002-5-21
_declspec(dllimport) UCHAR	AttTranseColor(int old_color);
//将新形式的填充转化成EB2的填充
_declspec(dllimport) int GenOldSolid(CSolid* pNewSolid, CTypedPtrList<CPtrList,CBase *> &Selection);
//根据打印机DC计算出图纸是A0、A1、A2、A3、A4、其他,分别返回0-5;
_declspec(dllimport) int GetPrintPaperSize(CDC *pDC);

_declspec(dllimport) COLORLWMAP g_ColorLWMap;	//颜色同线宽的对应关系  Zwz 2003-6-25


// Lg 2004-3-12 add begin 
//_declspec(dllimport) double OffSetDist;
//_declspec(dllimport) double DimTextLen;	    //尺寸文本的长度

_declspec(dllimport) int SpecialFlag;//编辑线性尺寸文字位置，当尺寸线方向水平，文字方向水平时，特殊处理

_declspec(dllimport) double DraDimValue;    //尺寸值
_declspec(dllimport) int    DraOrthoDim;  //线性标注正交水平
//_declspec(dllimport) XYZ DraOrigin;
//_declspec(dllimport) double  DraOrigin_Ang;
//_declspec(dllimport) double	DraD_XCoor;
//_declspec(dllimport) double	DraD_YCoor;
//_declspec(dllimport) char   DraInputDimText[128];  //用户输入的尺寸文本值
_declspec(dllimport) CString DraInputDimText;//用户输入的尺寸文本值// Lg 2004-4-12
/*********************	基本操作部分 ********************************/
//生成线性尺寸
//zgs mod 2001.4.30增加文本框开关tbox  默认值(0--没有)
//_declspec(dllimport) CDimension* GenerateLinearDim(char *text,double dimline_ang,double border_ang,
  //                            XYZ p1,XYZ p2,XYZ p3,unsigned char layer=DmCurLayer,int tbox=0);
//生成两线夹角尺寸
//zgs mod 2001.4.30增加文本框开关tbox  默认值(0--没有)
//_declspec(dllimport) CDimension* GenerateTwoLineAngDim(char *text,XYZ ap1,XYZ ap2,XYZ bp1,XYZ bp2,
//							     XYZ dimloc,unsigned char layer=DmCurLayer,int tbox=0);
//zgs mod 2001.4.30增加文本框开关tbox  默认值(0--没有)
//wj modify 2000.1.10 增加参数txt_loc
//_declspec(dllimport) CDimension* GenerateDiameterDim(char *text,XYZ ip1,XYZ ip2,XYZ dimloc,int txt_loc=0,unsigned char layer=DmCurLayer,int tbox=0);
//zgs mod 2001.4.30增加文本框开关tbox  默认值(0--没有)
//wj modify 2000.1.10 增加参数txt_loc
//_declspec(dllimport) CDimension* GenerateRadiusDim(char *text,XYZ ip1,XYZ ip2,XYZ dimloc,int txt_loc=0,unsigned char layer=DmCurLayer,int tbox=0);
//zgs mod 2001.4.30增加文本框开关tbox  默认值(0--没有)
//_declspec(dllimport) CDimension* GenerateThrPtAngDim(char *text,XYZ top_p,XYZ start_p,XYZ end_p,XYZ dimloc,unsigned char layer=DmCurLayer,int tbox=0);
//zgs mod 2001.4.30增加文本框开关tbox  默认值(0--没有)
//_declspec(dllimport) CDimension* GenerateContinusDim(char *text,double dimline_ang,double border_ang,
//								double dist,XYZ sp1,XYZ sp2,XYZ dimloc,int tbox=0);

//zgs mod 2001.4.30增加文本框开关tbox  默认值(0--没有)
//_declspec(dllimport) CDimension* GenerateHalfDim(char *text,double d,double dimline_ang,double border_ang,
//												 XYZ sp1,XYZ sp2,XYZ dimloc,unsigned char layer=DmCurLayer,int tbox=0);
//zgs mod 2001.4.30增加文本框开关tbox  默认值(0--没有)
//_declspec(dllimport) CDimension* GenerateBigArcDim(char *text,XYZ ip1,XYZ ip2,unsigned char layer=DmCurLayer,int tbox=0);

//zgs mod 2001.4.30增加文本框开关tbox  默认值(0--没有)
//_declspec(dllimport) CDimension* GenerateRayDim(char *text,XYZ sp1,XYZ sp2,XYZ dimloc,unsigned char layer=DmCurLayer,int tbox=0);

//zgs mod 2001.4.30增加文本框开关tbox  默认值(0--没有)
//_declspec(dllimport) CDimension* GeneratePyramidDim(char *text,int manner,int direct,int leader,
//							   int quadrant,double txtang,XYZ p1,XYZ p2,unsigned char layer=DmCurLayer,int tbox=0);
//生成坐标标注尺寸结点
//_declspec(dllimport) CDimension* GenerateOrdinateDim(char *text,int dim_line,int arrow,int num_text,
//                              XYZ orient,XYZ ip1,XYZ ip2,unsigned char layer=DmCurLayer);
//_declspec(dllimport) void GenTwoLineAngDim(char *text,XYZ ap1,XYZ ap2,XYZ bp1,XYZ bp2,
//										   XYZ txt_mid_p,XYZ p3,CDimension *pdim,unsigned char layer=DmCurLayer);
//_declspec(dllimport) void GenOutTwoLineAngDim(char *text,XYZ ap1,XYZ ap2,XYZ bp1,XYZ bp2,
//											  XYZ txt_mid_p,XYZ dimloc,CDimension* dim,unsigned char layer=DmCurLayer);
//_declspec(dllimport) void GenThrPtAngDim(char *text,XYZ top_p,XYZ start_p,XYZ end_p,
//										 XYZ txt_mid_p,XYZ dimloc,CDimension *pdim,unsigned char layer=DmCurLayer);
//_declspec(dllimport) void GenOutThrPtAngDim(char *text,XYZ top_p,XYZ start_p,XYZ end_p,
//											XYZ txt_mid_p,XYZ dimloc,CDimension* dim,unsigned char layer=DmCurLayer);
//_declspec(dllimport) void GenLeaderDim(char *text,int arrow,double dist,XYZ p1,XYZ p2,CDimension* pdim,unsigned char layer=DmCurLayer);
//_declspec(dllimport) void GenLinearDim(char *text,int textloc,double dimline_ang,double border_ang,double txtang,XYZ txt_mid_p,XYZ p1,XYZ p2,XYZ p3,CDimension* pdim,unsigned char layer=DmCurLayer);
//_declspec(dllimport) void GenDiameterDim(char *text,int textloc,double txtang,XYZ txt_mid_p,XYZ ip1,XYZ ip2,CDimension* pdim,unsigned char layer=DmCurLayer);
//_declspec(dllimport) void GenHoleDim(char *text,XYZ cen_p,XYZ p,CDimension* pdim,unsigned char layer=DmCurLayer);
//_declspec(dllimport) void GenBigArcDim(char *text,XYZ ip1,XYZ ip2,CDimension* pdim,unsigned char layer=DmCurLayer);
//_declspec(dllimport) void GenRayDim(char *text,XYZ ip1,XYZ ip2,XYZ dimloc,CDimension* pdim,unsigned char layer=DmCurLayer);
//_declspec(dllimport) void GenPyramidDim(char *text,int manner,int direct,int leader,int quadrant,double txtang,XYZ pp1,XYZ pp2,CDimension* pdim,unsigned char layer=DmCurLayer);
//// Lg 2002-4-17
////_declspec(dllimport) void GenPyramidDim(char *text,int manner,int direct,int leader,int quadrant,double txtang,XYZ pp1,XYZ pp2,CDimension* pdim,unsigned char layer=DmCurLayer,int Locate=0);
//_declspec(dllimport) void GenHalfDim(char *text,double d,double dimline_ang,double border_ang,XYZ sp1,XYZ sp2,XYZ dimloc,CDimension* pdim,unsigned char layer=DmCurLayer);
//_declspec(dllimport) void GenLinearDim_s(char *text,int textloc,double dimline_ang,double border_ang,
//										 double txtang,XYZ txt_mid_p,XYZ p1,XYZ p2,XYZ p3,CDimension* pdim,unsigned char layer=DmCurLayer);
//_declspec(dllimport) void GenDiameterDim_s(char *text,int textloc,double txtang,XYZ txt_mid_p,
//										   XYZ ip1,XYZ ip2,CDimension* pdim,unsigned char layer=DmCurLayer);
//_declspec(dllimport) void GenRadiusDim_s(char *text,int textloc,double txtang,XYZ txt_mid_p,
//										 XYZ ip1,XYZ ip2,CDimension* pdim,unsigned char layer=DmCurLayer);
//_declspec(dllimport) void GenChamferDim(char *text,XYZ p1,XYZ p2,XYZ dimloc,CDimension* pdim,unsigned char layer=DmCurLayer);

//_declspec(dllimport) CDimension* GenerateHoleDim(char *text,XYZ cen_p,XYZ p,unsigned char layer=DmCurLayer);
//_declspec(dllimport) CDimension* GenerateChamferDim(char *text,XYZ p1,XYZ p2,XYZ dimloc,unsigned char layer=DmCurLayer);
//生成引出说明结点
//_declspec(dllimport) CDimension* GenerateLeaderDim(char *text,int arrow,double dist,XYZ p1,XYZ p2,unsigned char layer=DmCurLayer);
//_declspec(dllimport) void GenOrdinateDim(char *text,int dim_line,int arrow,int num_text,
//										 XYZ orient,XYZ ip1,XYZ ip2,CDimension* pdim,unsigned char layer=DmCurLayer);

//_declspec(dllimport) void TransRealValueIntoString(char *pre,char *post,double distance,
//							  int dotbit,char *dim_text);
_declspec(dllimport) int TransRealValueIntoString(const CString& i_sPre,const CString& i_sPost,double i_dVal,const CDimStyle& i_Style,
							 CString& o_sText,BOOL i_bAng = FALSE);
_declspec(dllimport) void GetDimAngTolDFM(double angtol,int *d,int *f,int *m);
_declspec(dllimport) void TransRealValueIntoDFM(double i_dAng,const CDimStyle& i_Style,CString& o_sText);

_declspec(dllimport) void IfDimHorOrVer(XYZ p1,XYZ p2,XYZ p3,int *dimtype);

_declspec(dllimport) int CalAngularDimLine(XYZ ap1,XYZ ap2,XYZ bp1,XYZ bp2,XYZ p3,
					  XYZ *pc,XYZ *ps,XYZ *pe,double *r,double *angle);


_declspec(dllimport) int GetDiameterDimLine(XYZ pc,XYZ ps,XYZ pe,double r,double a,XYZ dimloc,
                       XYZ *ip1,XYZ *ip2);
_declspec(dllimport) int GetRadiusDimLine(XYZ pc,XYZ ps,XYZ pe,double r,double a,XYZ dimloc,
                     XYZ *ip1,XYZ *ip2);
_declspec(dllimport) void GetDiameterLinearDimLine(int manner,double angle,XYZ pc,double r,
						      XYZ dimloc,XYZ *ip1,XYZ *ip2);


_declspec(dllimport) int GetLinearDimLine(double dimline_ang,double border_ang,XYZ p1,XYZ p2,
                      XYZ p3,XYZ *ip1,XYZ *ip2);


_declspec(dllimport) void CalEndPtOfAngLine(int retval,XYZ p1,XYZ p2,
                     double csa,double sna,double line_length,XYZ *pp2);
//计算线性尺寸文字角度
_declspec(dllimport) double CalLinearDimTextDir(const CDimStyle& i_Style,const XYZ& i_LeftPt,
						   const XYZ& i_RightPt);
_declspec(dllimport) int IsStyleBeUsed(int i_iID,int i_iType,CTypedPtrList<CPtrList,CBase*> *i_pFindEnt);



_declspec(dllimport) int CalCoorOriginLine(const XYZ& i_UCSOri,double i_dUCSAng,
										   int control,int manner,int symetry,double length,
										   XYZ p1,XYZ p2,XYZ *pp1,XYZ *pp2);
_declspec(dllimport) double CalTwoPtYDistInLc(XYZ p1,XYZ p2,int sign_flag=0);
_declspec(dllimport) double CalTwoPtXDistInLc(XYZ p1,XYZ p2,int sign_flag=0);

_declspec(dllimport) int IfPtInLc(const XYZ& i_UCSOri,const XYZ& i_Pt );


_declspec(dllimport) void CalLeaderLineTextLoc(const CDimStyle& i_Style,const CString& i_sText,XYZ p1,XYZ p2,
                          XYZ *lead_p,XYZ *txt_mid_p);

_declspec(dllimport) void GenChamferDimString(const CDimStyle& i_Style,XYZ p1,XYZ p2,char *text,int axistype=0,CLine* pAxis =NULL);



_declspec(dllimport) double CalTwoRowTextMaxLength(const CDimStyle& i_Style,const CString& i_sText,const CString& i_sSeps,
												   CString& o_sUp,CString& o_sDown);

//wj modify 2000.1.10 增加参数txt_loc
_declspec(dllimport) int GetDimTextLoc(const CDimStyle& i_Style,int dimtype,const CString& i_sText,double txtang,XYZ ip1,XYZ ip2,XYZ p3,
									   XYZ *txt_mid_p,int txt_loc=0);

_declspec(dllimport) void GetTextLeaderLoc(const CDimStyle& i_Style,XYZ p1,XYZ p2,XYZ dimloc,XYZ text_mid_p,int textloc,
										   double textlen,double i_dHeight,XYZ *lead_p1,XYZ *lead_p2);

//from api.cpp
_declspec(dllimport) int drvFindFirstText(CString dimtext,char *text);
_declspec(dllimport) int GetDimTextLoc_s(const CDimStyle& i_Style,int dimtype,const CString& i_sText,double txtang,XYZ ip1,XYZ ip2,XYZ p3,
                  XYZ *txt_mid_p);


_declspec(dllimport) void SetTwoObjectAttribSame(CBase* picknode,CBase* newnode);
_declspec(dllimport) int admCalHorVerLineEndPt(const XYZ& i_UCSOri,double i_dUCSAng,
						  const XYZ& i_P1,const XYZ& i_P2,double i_dLen,
						  int i_iManner,XYZ& o_Pt);
//二次开发调用的函数
//生成线性尺寸
//dim_type:尺寸类型：0，水平尺寸；1，铅锤尺寸；2，平行尺寸
//p1,p2:第一引出点，第二引出点
//dim_loc:尺寸定位点
//txtdir:文字方向。0，平行；1，水平。
//text:尺寸标注文本。当text＝NULL时，系统按尺寸类型自动生成尺寸文本
//返回生成的尺寸结点
_declspec(dllimport) CDimension* eb_BuildLinearDim(int dim_type,EB_POINT p1,EB_POINT p2,
							 EB_POINT dim_loc,int txtdir,char* text=NULL,unsigned char layer=DmCurLayer);
//生成半径尺寸
//拾取的实体（圆或弧）
//dim_loc:尺寸定位点
//txtdir:文字方向。0，平行；1，水平。
//text:尺寸标注文本。当text＝NULL时，系统按尺寸类型自动生成尺寸文本
//返回生成的尺寸结点
_declspec(dllimport) CDimension* eb_BuildRadiusDim(EB_NODE node,EB_POINT dim_loc,int txtdir,char* text=NULL,unsigned char layer=DmCurLayer);
//生成直径尺寸
//拾取的实体（圆或弧）
//dim_loc:尺寸定位点
//txtdir:文字方向。0，平行；1，水平。
//text:尺寸标注文本。当text＝NULL时，系统按尺寸类型自动生成尺寸文本
//返回生成的尺寸结点
_declspec(dllimport) CDimension* eb_BuildDiameterDim(EB_NODE node,EB_POINT dim_loc,int txtdir,char* text=NULL,unsigned char layer=DmCurLayer);
//生成两线夹角尺寸
//node1:直线结点
//node2:直线结点
//dim_doc:尺寸定位点
//text:尺寸标注文本。当text＝NULL时，系统按尺寸类型自动生成尺寸文本
//返回生成的尺寸结点
_declspec(dllimport) CDimension* eb_BuildTwoLAngDim(EB_NODE node1,EB_NODE node2,EB_POINT dim_loc,char *text=NULL,unsigned char layer=DmCurLayer);
//生成三点角度尺寸
//top_p:角顶点
//start_p:角起点
//end_p:角终点
//dim_loc:尺寸定位点
//text:尺寸标注文本。当text＝NULL时，系统按尺寸类型自动生成尺寸文本
//返回生成的尺寸结点
_declspec(dllimport) CDimension* eb_BuildThrPAngDim(EB_POINT top_p,EB_POINT start_p,EB_POINT end_p,
							  EB_POINT dim_loc,char* text=NULL,unsigned char layer=DmCurLayer);
//生成倒角尺寸
//line:直线结点（倒角线）
//dim_loc:尺寸定位点
//text:尺寸标注文本。当text＝NULL时，系统按尺寸类型自动生成尺寸文本
//返回生成的尺寸结点
_declspec(dllimport) CDimension* eb_BuildChamferDim(EB_NODE line,EB_POINT dim_loc,char* text=NULL,unsigned char layer=DmCurLayer);
//得到尺寸数据
//dim:尺寸结点
//type:尺寸类型
//text:尺寸标注文本
//value:实际尺寸数值
//如果结点不是尺寸，返回0；否则，返回1。
_declspec(dllimport) int eb_GetDimData(EB_NODE dim,int *type,char* text,double* value);
//_declspec(dllimport) void DrawTwoCirSamePcDim(char *text,double dimline_ang,XYZ ip1,XYZ ip2,XYZ p3);
_declspec(dllimport) int GetTwoCirSamePcLeaderPt(CBase* node1,CBase* node2,XYZ dim_p,XYZ *p0,XYZ *p1);
_declspec(dllimport) int GetTwoCirMinDistLeaderPt(CBase* node1,CBase* node2,XYZ *p0,XYZ *p1);
//zgs mod 2001.4.30增加文本框开关tbox  默认值(0--没有)
//_declspec(dllimport) CDimension* GenerateTwoCirSamePcDim(char *text,double dimline_ang,XYZ ip1,XYZ ip2,XYZ p3,unsigned char layer=DmCurLayer,int tbox=0);
_declspec(dllimport) CDimension* ModifyDimTextLoc(char *text,int leader,double txtang,XYZ txt_mid_p,CDimension* picknode);
_declspec(dllimport) void DraCopyDimObjectInfo(CDimension *picknode,CDimension **o_ppDim);

_declspec(dllimport) CDimStyle GetStyleOfSelEnt();
_declspec(dllimport) void  DimGetBorder(const CDimStyle& i_Style,XYZ p1,XYZ p2,XYZ ip1,XYZ ip2,XYZ *sp1,XYZ *sp2,XYZ *ep1,XYZ *ep2);
_declspec(dllimport) int GetDimLineOutPt(const CDimStyle& i_Style, const CString& i_sText,int textloc,BOOL i_bLeadLn,double txtang,
										 XYZ dimloc,XYZ txt_mid_p,XYZ ip1,XYZ ip2, XYZ *dp1,XYZ *dp2,XYZ *lead_p);
_declspec(dllimport) int IfPlaceTextInAngle(const CDimStyle& i_Style,const CString& i_sText,XYZ txt_mid_p,
											double i_dTxtAng,XYZ pc,XYZ ps,XYZ pe,double r,double angle,XYZ *dp1,XYZ *dp2);
_declspec(dllimport) void  DimGetBorderPtep1(const CDimStyle& i_Style,XYZ p1,XYZ p2,XYZ ip1,XYZ ip2,XYZ *sp1,XYZ *sp2,XYZ *ep1,XYZ *ep2);
_declspec(dllimport) void  DimGetBorderPtep2(const CDimStyle& i_Style,XYZ p1,XYZ p2,XYZ ip1,XYZ ip2,XYZ *sp1,XYZ *sp2,XYZ *ep1,XYZ *ep2);
_declspec(dllimport) void DimGetParlTextBoxMidPt(const CDimStyle& i_Style,XYZ ip1,XYZ ip2,double dist,XYZ *mid_p);
_declspec(dllimport) double CalParllelTextDir(XYZ ip1,XYZ ip2);
_declspec(dllimport) int GetParTextLoc(const CDimStyle& i_Style,int dimtype,const CString& i_sText,double txtang,XYZ ip1,XYZ ip2,
									   XYZ p3,XYZ *txt_mid_p,int txt_loc=0);
_declspec(dllimport) int GetDimLineOutPtForParlText(const CDimStyle& i_Style,const CString& i_sText,int textloc,BOOL i_bLeadLn,double txtang,XYZ txt_mid_p,XYZ ip1,XYZ ip2,XYZ *dp1,XYZ *dp2);
// Lg 2004-3-12 end

//dbf add 04.8.30
_declspec(dllimport)    double ext_dPointRatio;//点的大小（像素或绝对值）
_declspec(dllimport)	int ext_iSelPtSyle;//当前选择的点的风格(按从左向右，从上向下排序）
_declspec(dllimport)	BOOL   ext_bRelScr;//ture-点大小是相对于屏幕,false-点大小是绝对大小
//dbf end

_declspec(dllimport) int baseChgRGBToIndex(COLORREF colorRGB);

_declspec(dllimport) int CalNavigation(XYZ *p);

_declspec(dllimport) CBlock* GetGDirBlock ( XYZ xyzPos);

_declspec(dllimport) int SplitDimText(const CDimStyle& i_Style,const CString& i_sDimText,
				 const CTol* i_pTol,CString& o_sPref,CString& o_sSuf,CString& o_sVal);
//
//风格更新后的标注更新函数
_declspec(dllimport) int UpdateEntByStyle(int i_iID,int i_iType,CTypedPtrList<CPtrList,CBase*> *i_pUpdateEnt);
_declspec(dllimport) int RegenAnnt(CBlock* i_pBlock);
_declspec(dllimport) CBlock* GetList1Block(const XYZ& i_Pos,const XYZ& i_InsPt,int i_iLeader,const CString& i_sText,const CDimStyle& i_Style);

_declspec(dllimport) int InquireTolerence(double base,char *str,double *es,double *ei);

_declspec(dllimport) BOOL IsBeyondLimitNum(CTypedPtrList<CPtrList,CBase*> &select);

//整理明细表: 将旧的明细表块转换为新的明细表CBomTable
_declspec(dllimport) void TransTableBlockIntoBomtable(CTypedPtrList<CPtrList,CBase*>* pSelect);

//清空表头链,并删除其中的元素
_declspec(dllimport) void RemoveCTableCellList(CTypedPtrList<CPtrList, CTableCell*>* pTableCellList);

//重画选择集中的明细表
_declspec(dllimport) void ReDrawTable(double PreviouseScale, CTypedPtrList<CPtrList,CBase*> &i_Select);

//从选择集中获得明细表
_declspec(dllimport) CBomTable* GetBomTable(CTypedPtrList<CPtrList,CBase*> &i_Select);

//重置当前零件序号为1
_declspec(dllimport) void ResetCurParno();

//生成旧的明细表表头，如果i_bWithTable不等于0，同时生成明细栏内容 
_declspec(dllimport) void GenOldHeadAndTableBlock(CBomTable* i_pTable, CTypedPtrList<CPtrList,CBase*>* o_pEntList,
												 BOOL i_bWithTable);

//按零件序号顺序生成零件序号及文字
_declspec(dllimport) void GenPartNoByOrder(const XYZ p1,const XYZ p2,CBlock *block,const CString prefix,const int value,
					  const int flag3,const int flag4,const int flag5,const int index,CBlock *pBLOCK);
//生成垂直方向的号及前缀
_declspec(dllimport) void GenPartNoByOrderVertical(const XYZ p1,const XYZ p2,CBlock *block,const CString prefix,const int value,
							  const int flag3,const int flag4,const int flag5,const int index);
//方式3中按序号值排序生成零件序号
_declspec(dllimport) void GenPartNoByOrderStyle3(const XYZ p1,const XYZ p2,CBlock *block,const CString prefix,const int value,
							const int flag3,const int flag4,const int flag5,const int index,CBlock *pBLOCK);


#endif



//End basext.h Define
