#ifndef _admext_h
#define _admext_h

#include "ebdef.h"
#include "varext.h"
#include "dm.h"
#include "adm.h"

//_declspec(dllimport) DIMSTYLE DimStyle;	     //尺寸标注参数的全局变量


_declspec(dllimport) CBase*	 AdmCaxPointNode;   // the node pick by SysCaxPoint;
_declspec(dllimport) CBase*	 AdmFirstNode;
_declspec(dllimport) CBase*	 AdmLastNode;


/*********************	基本操作部分 ********************************/

//将一个实数转成字符串
//short    dotmove;    //小数点自动圆整 1 = 圆整, 0 = 不圆整, 3 = 由标注参数设置确定
_declspec(dllimport) void admCreateString(double value,int dotbit,char *text,int dotmove=3);

//判断串STR是否为空串
_declspec(dllimport) BOOL admIfStrEmpty(char *str);

/*********************	根据已知几何数据建立一个对象(没有插入系统链) ********************************/


/*********************	根据已知几何数据建立一个对象并插入系统链 ********************************/

//向系统链插入点对象
_declspec(dllimport) CPot *admSavePot(XYZ p,
       unsigned char InitColor=DmCurColor,
       unsigned char InitLayer=DmCurLayer);

//向系统链插入直线对象
_declspec(dllimport) CLine *admSaveLine(XYZ p1,XYZ p2,
       unsigned char InitLtype=DmCurLtype,
       unsigned char InitColor=DmCurColor,
       unsigned char InitLayer=DmCurLayer);

//向系统链插入圆对象
_declspec(dllimport) CCircle *admSaveCircle(XYZ pc,double r,
       unsigned char InitLtype=DmCurLtype,
       unsigned char InitColor=DmCurColor,
       unsigned char InitLayer=DmCurLayer);

//向系统链插入圆弧对象
//如果 ang=NULL    则由系统计算圆心角,否则使用措定值
//如果 radius=NULL 则由系统计算半径,  否则使用措定值
_declspec(dllimport) CArc *admSaveArc(XYZ pc,XYZ ps,XYZ pe,double *ang=NULL,double *radius=NULL,
	      unsigned char InitLtype=DmCurLtype,
	      unsigned char InitColor=DmCurColor,
	      unsigned char InitLayer=DmCurLayer);




/*********************	关于对象的操作 ********************************/

//将对象 object 插入系统链头并显示
_declspec(dllimport) void admInsertDisplayObject(CBase* object);

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

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


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

//画选择集 Object
//color = NORMAL		用对象自身颜色画
//color = PICKED		用对象拾取颜色画
//color = DRAGING		用对象拖动颜色画
//color = ERASED		用对象擦除颜色画
//color = 措定颜色		用对象措定颜色画
_declspec(dllimport) void admDrawObject(CBase *pbase,char  color = DRAGING);



/*********************	关于块的操作 ********************************/

//向块中加入点对象
//_declspec(dllimport) CPot *admAddPotToBlk(CGroup *block,XYZ p,unsigned char layer=DmCurLayer,
  //     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);
*/

//向块中加入直线箭头
//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 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);
*/

//将选择集 select 加入到 块 中去
_declspec(dllimport) void admAddSelectToBlk(CGroup *block,
     CTypedPtrList<CPtrList,CBase*> &select,BOOL remove=TRUE);

//判别块是否为空(块中的元素个数为零)
_declspec(dllimport) BOOL admIfBlkEmpty(CGroup *block);

//获得块的长度(块中的元素个数)
_declspec(dllimport) int admGetBlkLength(CGroup *block);

//从块中取得第index个元素,由 0 开始计数
_declspec(dllimport) CBase *admGetObjectFromBlk(CGroup *block,int index);

//判别对象 pbase 是否在块 block 中
_declspec(dllimport) BOOL admIfObjectInBlk(CGroup *block,CBase *pbase);


//将对象 object 从 block 的子结点链中取下
_declspec(dllimport) void admDetachObject(CGroup *block,CBase* object);



/*********************	关于选择集的操作 ********************************/

//判别选择集是否为空
_declspec(dllimport) BOOL admIfSelectEmpty(CTypedPtrList<CPtrList,CBase*> &select);

//获得选择集的长度
_declspec(dllimport) int admGetSelectLength(CTypedPtrList<CPtrList,CBase*> &select);

//从选择集中取得第index个元素,由 0 开始计数
_declspec(dllimport) CBase *admGetObjectFromSelect(CTypedPtrList<CPtrList,CBase*> &select,int index);

//判别对象 pbase 是否在选择集 select 中
_declspec(dllimport) BOOL admIfObjectInSelect(CTypedPtrList<CPtrList,CBase*> &select,CBase *pbase);

//画选择集 select
//color = NORMAL		用对象自身颜色画
//color = PICKED		用对象拾取颜色画
//color = DRAGING		用对象拖动颜色画
//color = ERASED		用对象擦除颜色画
//color = 措定颜色		用对象措定颜色画
_declspec(dllimport) void admDrawSelect(CTypedPtrList<CPtrList,CBase*> &select,char	color = DRAGING);

//释放选择集 select
_declspec(dllimport) void admFreeSelect(CTypedPtrList<CPtrList,CBase*> &select);

//将选择集 select 从链头 top 中删除(选择集中的每个对象都被删除)
_declspec(dllimport) void admDeleteSelect(CTypedPtrList<CPtrList,CBase*> *top,
     CTypedPtrList<CPtrList,CBase*> &select);


//将选择集 select 从链头 top 中去除
_declspec(dllimport) void admRemoveSelect(CTypedPtrList<CPtrList,CBase*> *top,
     CTypedPtrList<CPtrList,CBase*> &select);

//将选择集 select 插入到链头 top 中去
_declspec(dllimport) void admInsertSelect(CTypedPtrList<CPtrList,CBase*> *top,
     CTypedPtrList<CPtrList,CBase*> &select,BOOL remove=TRUE);


/*********************	关于其本元素的绘制 ********************************/
//画点
//color = NORMAL		用当前颜色画
//color = PICKED		用拾取颜色画
//color = DRAGING		用拖动颜色画
//color = ERASED		用擦除颜色画
//color = 措定颜色		用措定颜色画
_declspec(dllimport) void admDrawPoint(XYZ pt,char  color = DRAGING);


//画直线
//color = NORMAL		用当前颜色画
//color = PICKED		用拾取颜色画
//color = DRAGING		用拖动颜色画
//color = ERASED		用擦除颜色画
//color = 措定颜色		用措定颜色画
_declspec(dllimport) void admDrawLine(XYZ p1,XYZ p2,char  color = DRAGING);


//画圆
//color = NORMAL		用当前颜色画
//color = PICKED		用拾取颜色画
//color = DRAGING		用拖动颜色画
//color = ERASED		用擦除颜色画
//color = 措定颜色		用措定颜色画
_declspec(dllimport) void  admDrawCircle(XYZ pc,double r,char  color = DRAGING);

//画圆弧
//color = NORMAL		用当前颜色画
//color = PICKED		用拾取颜色画
//color = DRAGING		用拖动颜色画
//color = ERASED		用擦除颜色画
//color = 措定颜色		用措定颜色画
//如果 ang=NULL    则由系统计算圆心角,否则使用措定值
//如果 radius=NULL 则由系统计算半径,  否则使用措定值
_declspec(dllimport) void admDrawArc(XYZ pc,XYZ ps,XYZ pe,double *ang=NULL,double *radius=NULL,char	color = DRAGING);

//画拾取 BOX
//color = NORMAL		用当前颜色画
//color = PICKED		用拾取颜色画
//color = DRAGING		用拖动颜色画
//color = ERASED		用擦除颜色画
//color = 措定颜色		用措定颜色画
_declspec(dllimport) void admDrawBox(XYZ p1,XYZ p2,char  color = DRAGING);

//画矩形
//color = NORMAL		用当前颜色画
//color = PICKED		用拾取颜色画
//color = DRAGING		用拖动颜色画
//color = ERASED		用擦除颜色画
//color = 措定颜色		用措定颜色画
_declspec(dllimport) void admDrawRect(XYZ p1,XYZ p2,XYZ p3,XYZ p4,char	color = DRAGING);

//画矩形
//color = NORMAL		用当前颜色画
//color = PICKED		用拾取颜色画
//color = DRAGING		用拖动颜色画
//color = ERASED		用擦除颜色画
//color = 措定颜色		用措定颜色画
_declspec(dllimport) void admDrawRectByLenWid(XYZ cen_p,double length,double width,double ang,char  color = DRAGING);



//画直线箭头
//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 admDrawLineArrow(int inside,int arrow1,int arrow2,double arrow_len,
     XYZ arr_p1,XYZ arr_p2);

//画圆弧箭头
//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 admDrawArcArrow(int inside,int arrow1,int arrow2,double arrow_len,
     XYZ pc,XYZ ps,XYZ pe,double r,double angle);

//_declspec(dllimport) void admDraw3DViewFrame(CEb3DView* p3DView, XYZ* pPtOffset = NULL, char color = DRAGING);
/*********************	关于坐标转换 ********************************/

//将点 loc_x,loc_y 从局部坐标系转到世界坐标系
_declspec(dllimport) void admTransPtToWc(double x0,double y0,double ang,
     double loc_x,double loc_y,double *wc_x,double *wc_y);

//将点 wc_x,wc_y 从世界坐标系转到局部坐标系
_declspec(dllimport) void admTransPtToLc(double x0,double y0,double ang,
     double wc_x,double wc_y,double *loc_x,double *loc_y);

//将点 loc_p 从局部坐标系转到世界坐标系
_declspec(dllimport) void admTransPtFromLcToWc(XYZ p1,XYZ p2,XYZ loc_p,XYZ *wc_p);

//将点 wc_p 从世界坐标系转到局部坐标系
_declspec(dllimport) void admTransPtFromWcToLc(XYZ p1,XYZ p2,XYZ wc_p,XYZ *loc_p);

//初始化系统UNDO缓冲区
_declspec(dllimport) void admInitUndoBuffer();

//系统UNDO
_declspec(dllimport) void admUndo();

//系统REDO
_declspec(dllimport) void admRedo();

//清除UNDO缓冲区存储的内容,当用户打开文件或者创建新文件时调用该函数
_declspec(dllimport) void admEmptyUndoBuffer();

_declspec(dllimport) void admRecordInsertCell(CCell *object,CString content);
_declspec(dllimport) void admRecordDeleteCell(CCell *object,CString content);

//更换对象的层属性
void admChangeLayer(CBase *object,unsigned char newLayer);
//判断两个3D名称是不是表示同一个含义 Zwz 2002-3-11
//_declspec(dllimport) BOOL admIsSame3dEntName(C3DEntName* p3DEntNameA, C3DEntName* p3DEntNameB);

// Lg 2004-8-10 add 记录风格Undo的函数
_declspec(dllimport) void admRecordStyleInsUndo(const CStyle& i_Style,int i_iStyleType,BOOL i_bUpdate);
_declspec(dllimport) void admRecordStyleDelUndo(const CStyle& i_Style,int i_iStyleType,BOOL i_bUpdate);
#endif



//End basext.h Define
