Reader.h
上传用户:hell82222
上传日期:2013-12-19
资源大小:1872k
文件大小:6k
源码类别:

CAD

开发平台:

Visual C++

  1. // Reader.h: interface for the CReader class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #if !defined(AFX_READER_H__2EA28741_8172_4787_B979_D2E85A846B82__INCLUDED_)
  5. #define AFX_READER_H__2EA28741_8172_4787_B979_D2E85A846B82__INCLUDED_
  6. #if _MSC_VER > 1000
  7. #pragma once
  8. #endif // _MSC_VER > 1000
  9. //#ifdef _DEBUG
  10. #define _CONV_OPEN 
  11. if(g_mode==1) 
  12. TCHAR szFileName[MAX_PATH]; 
  13. ::GetModuleFileName(::GetModuleHandle(_T("FileSwitch.dll")),szFileName,MAX_PATH); 
  14. (*_tcsrchr(szFileName,'\'))=''; 
  15. _tcscat(szFileName,_T("\Censorial.txt")); 
  16. g_CensorialFile.Open(szFileName,CFile::modeCreate|CFile::modeReadWrite|CFile::typeText|CFile::shareDenyRead); 
  17. g_mode=2; 
  18. else 
  19. g_mode=0; 
  20. //#else
  21. //#define _CONV_OPEN 
  22. //#endif
  23. //#ifdef _DEBUG
  24. #define _CONV_CLOSE 
  25. if(g_mode==2) 
  26. if(g_CensorialFile.m_pStream)  
  27. g_CensorialFile.Close(); 
  28. g_mode=0; 
  29. }
  30. //#else
  31. //#define _CONV_CLOSE
  32. //#endif
  33. //#ifdef _DEBUG
  34. #define _WRITE(x) 
  35.     if(g_mode==2) 
  36. if(g_CensorialFile.m_pStream)  
  37. CString str; 
  38. (x); 
  39. str+="n"; 
  40. g_CensorialFile.WriteString(str); 
  41. TRACE(str); 
  42. }
  43. //#else
  44. //#define _WRITE(x)
  45. //#endif
  46. //#ifdef _DEBUG
  47. #define _WRITE2(x) 
  48.     if(g_mode==3) 
  49. if(g_CensorialFile.m_pStream)  
  50. CString str; 
  51. (x); 
  52. str+="n"; 
  53. g_CensorialFile.WriteString(str); 
  54. TRACE(str); 
  55. }
  56. //#else
  57. //#define _WRITE2(x)
  58. //#endif
  59. //#ifdef _DEBUG
  60. #define _ERROR 
  61. if(g_mode==2) 
  62. ::AfxMessageBox("STOP"); 
  63. if(g_CensorialFile.m_pStream)  
  64. short sErrorCode=adError(); 
  65. if(sErrorCode!=0) 
  66. CString str; 
  67. str.Format("第%d号错误:%s",sErrorCode,adErrorStr(sErrorCode)); 
  68. str+="n"; 
  69. g_CensorialFile.WriteString(str); 
  70. TRACE(str); 
  71. }
  72. //#else 
  73. //#define _ERROR
  74. //#endif
  75. #include "kmshare.h"
  76. #include "vector.h"
  77. #include "kmsection.h"
  78. #include "kmentity.h"
  79. class CReader  
  80. {
  81. public:
  82. CReader();
  83. virtual ~CReader();
  84. CMap<UINT,UINT,UINT,UINT> m_aCharMap;
  85. protected:
  86. int calculate_findstringlength(CString& strEnter);
  87. double calculate_3d2pdistance(double x1,double y1,double z1,double x2,double y2,double z2);
  88. double calculate_3ddpdistance(double dx,double dy,double dz);
  89. double calculate_2dangle(double dx,double dy);
  90. KmPoint calculate_2drotate(double xo,double yo,double dx,double dy,double ra);
  91. void calculate_path_bugleline(PATH2* path,double x1,double x2,double bugle,double y1,double y2);
  92. void calculate_path_line(PATH2* path,double x1,double y1,double x2,double y2);
  93. void calculate_path_arc(PATH2* path,double x1,double y1,double r,double ba,double ea,short full);
  94. void calculate_path_object(PATH2* path,KmObject* pObj);
  95. void calculate_Get_CIRCLE(CIRCLE &rCircle,double bugle,KmPoint Point_X1,KmPoint Point_X2);
  96. void calculate_three_point_Getcircle(CIRCLE &rCircle,KmPoint KmPoint1,KmPoint KmPoint2,KmPoint KmPoint3,BOOL bccw);
  97. int calculate_get_r_xyo(double rxyo[3],double x1,double y1,double x2,double y2,double x3,double y3);
  98. 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);
  99. //以下为从字体文件分析出字体名称的函数.
  100. static unsigned int calculate_findint16(__int16 data);
  101. static unsigned long calculate_findint32(__int32 data);
  102. static BOOL calculate_findname(__int32 data);
  103. public:
  104. static BOOL calculate_findfontname(CString strfontfile2,CString strfontfile,CString &strfontname);
  105. static void calculate_DefaultExamineFile(CString &filename2,CString sondir,CString sonkmdir="");
  106. static CString m_strACADpath;//AutoCAD文件搜索路径
  107. static CString m_strAddPath;
  108. static CString calculate_CopyFile(CString fullfilename,CString filename,CString sondir);
  109. static BOOL CALLBACK AFX_EXPORT EnumFamScreenCallBack( 
  110. ENUMLOGFONT* pelf, NEWTEXTMETRICEX* /*lpntm*/, int FontType,  
  111. LPVOID pThis);
  112. static BOOL CALLBACK AFX_EXPORT EnumFamScreenCallBackEx( 
  113. ENUMLOGFONTEX* pelf, NEWTEXTMETRICEX* /*lpntm*/, int FontType,  
  114. LPVOID pThis);
  115. void calculate_findfonts(CTypedPtrMap<CMapStringToPtr, CString, void*>* pMapFont);
  116. //说明: text_h/bound_high=scale text_w=1
  117. 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);
  118. 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);
  119. void TransRotate(double x, double y, double dAng, double& x1, double& y1);
  120. void BulgeArc(double x0, double y0, double x1, double y1, 
  121.   int hArc, double& r ,double& xCen, double& yCen);
  122. void FractionalArc(double begX,double begY, int s_off,int e_off,int h_rad,int l_rad,int OSC,
  123.   double dAmplify,double& endX,double& endY,double& cenX,double& cenY);
  124. void OctantArc(double begX,double begY,double Rad,int OSC,
  125.   double& endX,double& endY,double& cenX,double& cenY);
  126. void TranXY(int direct,double len,double&  x1,double&  y1);
  127. void DrawLine(double x1,double y1,double x2, double y2, KmBuffer* pBuffer=NULL);
  128. void DrawEllipse(double dBaseX, double dBaseY,double xCen, double yCen,
  129. double xr, double yr, double dAng, double bx, double by,double ex, 
  130. double ey, BOOL bCounterClolckWise, KmBuffer* pBuffer);
  131. void DrawArc(double x1, double y1, double x2, double y2,
  132.  double xCen, double yCen, int nWise, KmBuffer* pBuffer);
  133. };
  134. double calculate_findTTFHightRate(CString strFontName);
  135. double calculate_findTTFPosRate(CString strFontName);
  136. double calculate_findTTFWidthRate(CString strFontName);
  137. #endif // !defined(AFX_READER_H__2EA28741_8172_4787_B979_D2E85A846B82__INCLUDED_)