Reader.h
上传用户:hell82222
上传日期:2013-12-19
资源大小:1872k
文件大小:6k
- // Reader.h: interface for the CReader class.
- //
- //////////////////////////////////////////////////////////////////////
- #if !defined(AFX_READER_H__2EA28741_8172_4787_B979_D2E85A846B82__INCLUDED_)
- #define AFX_READER_H__2EA28741_8172_4787_B979_D2E85A846B82__INCLUDED_
- #if _MSC_VER > 1000
- #pragma once
- #endif // _MSC_VER > 1000
- //#ifdef _DEBUG
- #define _CONV_OPEN
- {
- if(g_mode==1)
- {
- TCHAR szFileName[MAX_PATH];
- ::GetModuleFileName(::GetModuleHandle(_T("FileSwitch.dll")),szFileName,MAX_PATH);
- (*_tcsrchr(szFileName,'\'))=' ';
- _tcscat(szFileName,_T("\Censorial.txt"));
- g_CensorialFile.Open(szFileName,CFile::modeCreate|CFile::modeReadWrite|CFile::typeText|CFile::shareDenyRead);
- g_mode=2;
- }
- else
- {
- g_mode=0;
- }
- }
- //#else
- //#define _CONV_OPEN
- //#endif
- //#ifdef _DEBUG
- #define _CONV_CLOSE
- {
- if(g_mode==2)
- {
- if(g_CensorialFile.m_pStream)
- {
- g_CensorialFile.Close();
- }
- g_mode=0;
- }
- }
- //#else
- //#define _CONV_CLOSE
- //#endif
- //#ifdef _DEBUG
- #define _WRITE(x)
- {
- if(g_mode==2)
- {
- if(g_CensorialFile.m_pStream)
- {
- CString str;
- (x);
- str+="n";
- g_CensorialFile.WriteString(str);
- TRACE(str);
- }
- }
- }
- //#else
- //#define _WRITE(x)
- //#endif
- //#ifdef _DEBUG
- #define _WRITE2(x)
- {
- if(g_mode==3)
- {
- if(g_CensorialFile.m_pStream)
- {
- CString str;
- (x);
- str+="n";
- g_CensorialFile.WriteString(str);
- TRACE(str);
- }
- }
- }
- //#else
- //#define _WRITE2(x)
- //#endif
- //#ifdef _DEBUG
- #define _ERROR
- {
- if(g_mode==2)
- {
- ::AfxMessageBox("STOP");
- if(g_CensorialFile.m_pStream)
- {
- short sErrorCode=adError();
- if(sErrorCode!=0)
- {
- CString str;
- str.Format("第%d号错误:%s",sErrorCode,adErrorStr(sErrorCode));
- str+="n";
- g_CensorialFile.WriteString(str);
- TRACE(str);
- }
- }
- }
- }
- //#else
- //#define _ERROR
- //#endif
- #include "kmshare.h"
- #include "vector.h"
- #include "kmsection.h"
- #include "kmentity.h"
- class CReader
- {
- public:
- CReader();
- virtual ~CReader();
- CMap<UINT,UINT,UINT,UINT> m_aCharMap;
- protected:
- int calculate_findstringlength(CString& strEnter);
- double calculate_3d2pdistance(double x1,double y1,double z1,double x2,double y2,double z2);
- double calculate_3ddpdistance(double dx,double dy,double dz);
- double calculate_2dangle(double dx,double dy);
- KmPoint calculate_2drotate(double xo,double yo,double dx,double dy,double ra);
- void calculate_path_bugleline(PATH2* path,double x1,double x2,double bugle,double y1,double y2);
- void calculate_path_line(PATH2* path,double x1,double y1,double x2,double y2);
- void calculate_path_arc(PATH2* path,double x1,double y1,double r,double ba,double ea,short full);
- void calculate_path_object(PATH2* path,KmObject* pObj);
- void calculate_Get_CIRCLE(CIRCLE &rCircle,double bugle,KmPoint Point_X1,KmPoint Point_X2);
- void calculate_three_point_Getcircle(CIRCLE &rCircle,KmPoint KmPoint1,KmPoint KmPoint2,KmPoint KmPoint3,BOOL bccw);
- int calculate_get_r_xyo(double rxyo[3],double x1,double y1,double x2,double y2,double x3,double y3);
- int calculate_cal_r_xyo(double rxyo[3],double first_seed_x,double first_seed_y,double second_seed_x,double second_seed_y,double third_seed_x,double third_seed_y);
- //以下为从字体文件分析出字体名称的函数.
- static unsigned int calculate_findint16(__int16 data);
- static unsigned long calculate_findint32(__int32 data);
- static BOOL calculate_findname(__int32 data);
- public:
- static BOOL calculate_findfontname(CString strfontfile2,CString strfontfile,CString &strfontname);
- static void calculate_DefaultExamineFile(CString &filename2,CString sondir,CString sonkmdir="");
- static CString m_strACADpath;//AutoCAD文件搜索路径
- static CString m_strAddPath;
- static CString calculate_CopyFile(CString fullfilename,CString filename,CString sondir);
- static BOOL CALLBACK AFX_EXPORT EnumFamScreenCallBack(
- ENUMLOGFONT* pelf, NEWTEXTMETRICEX* /*lpntm*/, int FontType,
- LPVOID pThis);
- static BOOL CALLBACK AFX_EXPORT EnumFamScreenCallBackEx(
- ENUMLOGFONTEX* pelf, NEWTEXTMETRICEX* /*lpntm*/, int FontType,
- LPVOID pThis);
- void calculate_findfonts(CTypedPtrMap<CMapStringToPtr, CString, void*>* pMapFont);
- //说明: text_h/bound_high=scale text_w=1
- BOOL calculate_findshape(AD_DB_HANDLE dwghandle,AD_OBJHANDLE shapefileobjhandle,int whichshape,double *px,double *py,double dAng,int bound_high,double text_h, double text_w,KmBuffer* pBuffer);
- void CreateShape(AD_DB_HANDLE dwghandle,AD_OBJHANDLE shapefileobjhandle,char *str,int len, double* px, double* py, double dAng, int bound_high,double text_h, double text_w, KmBuffer* pBuffer);
- void TransRotate(double x, double y, double dAng, double& x1, double& y1);
- void BulgeArc(double x0, double y0, double x1, double y1,
- int hArc, double& r ,double& xCen, double& yCen);
- void FractionalArc(double begX,double begY, int s_off,int e_off,int h_rad,int l_rad,int OSC,
- double dAmplify,double& endX,double& endY,double& cenX,double& cenY);
- void OctantArc(double begX,double begY,double Rad,int OSC,
- double& endX,double& endY,double& cenX,double& cenY);
- void TranXY(int direct,double len,double& x1,double& y1);
- void DrawLine(double x1,double y1,double x2, double y2, KmBuffer* pBuffer=NULL);
- void DrawEllipse(double dBaseX, double dBaseY,double xCen, double yCen,
- double xr, double yr, double dAng, double bx, double by,double ex,
- double ey, BOOL bCounterClolckWise, KmBuffer* pBuffer);
- void DrawArc(double x1, double y1, double x2, double y2,
- double xCen, double yCen, int nWise, KmBuffer* pBuffer);
- };
- double calculate_findTTFHightRate(CString strFontName);
- double calculate_findTTFPosRate(CString strFontName);
- double calculate_findTTFWidthRate(CString strFontName);
- #endif // !defined(AFX_READER_H__2EA28741_8172_4787_B979_D2E85A846B82__INCLUDED_)