Shape.cpp
上传用户:lj3531212
上传日期:2007-06-18
资源大小:346k
文件大小:15k
源码类别:

绘图程序

开发平台:

Visual C++

  1. // Shape.cpp: implementation of the CShape class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #include "stdafx.h"
  5. #include "GraphSoft.h"
  6. #include "Shape.h"
  7. #include "math.h"
  8. #include "GraphDefines.h"
  9. #ifdef _DEBUG
  10. #undef THIS_FILE
  11. static char THIS_FILE[]=__FILE__;
  12. #define new DEBUG_NEW
  13. #endif
  14. IMPLEMENT_SERIAL( CShape, CObject, 0 )
  15. //////////////////////////////////////////////////////////////////////
  16. // Construction/Destruction
  17. //////////////////////////////////////////////////////////////////////
  18. unsigned long    CShape::m_nObjectNum=0;
  19. CShape::CShape()
  20. {
  21. m_color=RGB(0,0,0);
  22. m_FillColor=RGB(255,255,255);
  23. m_nPenWidth = 1;
  24. m_flAngle=0;
  25. m_flScale=1;
  26. m_bSelect_flag=FALSE;
  27. m_nFillStyle=_shape_none_fill;
  28. m_nDrawPoints=1;
  29. //temp
  30. m_ptRotateCenterTemp.x=0;
  31. m_ptRotateCenterTemp.y=0;
  32. m_flAngleTemp=0;
  33. m_ptMagnifyCenterTemp.x=0;
  34. m_ptMagnifyCenterTemp.y=0;
  35. m_flScaleTemp=1;
  36. m_nSelectPtNum=-1;
  37. m_nSelectLineNum=-1;
  38. m_nID=++m_nObjectNum;
  39. }
  40. CShape::CShape(COLORREF color,int penWidth,float angle)
  41. {
  42. m_color=color;
  43. m_FillColor=RGB(255,255,255);
  44. m_nPenWidth=penWidth;
  45. m_flAngle=angle;
  46. m_flScale=1;
  47. m_bSelect_flag=FALSE;
  48. m_nFillStyle=_shape_none_fill;
  49. m_nDrawPoints=1;
  50. //temp
  51. m_ptRotateCenterTemp.x=0;
  52. m_ptRotateCenterTemp.y=0;
  53. m_flAngleTemp=0;
  54. m_ptMagnifyCenterTemp.x=0;
  55. m_ptMagnifyCenterTemp.y=0;
  56. m_flScaleTemp=1;
  57. m_nSelectPtNum=-1;
  58. m_nSelectLineNum=-1;
  59. m_nID=++m_nObjectNum;
  60. }
  61. CShape::CShape(CShape* const shape)
  62. {
  63. m_color=shape->m_color;
  64. m_FillColor=shape->m_FillColor;
  65. m_nPenWidth=shape->m_nPenWidth;
  66. m_flAngle=shape->m_flAngle;
  67. m_flScale=shape->m_flScale;
  68. m_bSelect_flag=shape->m_bSelect_flag;
  69. m_nFillStyle=shape->m_nFillStyle;
  70. m_nDrawPoints=shape->m_nDrawPoints;
  71. //temp
  72. m_ptRotateCenterTemp=shape->m_ptRotateCenterTemp;
  73. m_flAngleTemp=shape->m_flAngleTemp;
  74. m_ptMagnifyCenterTemp=shape->m_ptMagnifyCenterTemp;
  75. m_flScaleTemp=shape->m_flScaleTemp;
  76. m_nSelectPtNum=shape->m_nSelectPtNum;
  77. m_nSelectLineNum=shape->m_nSelectLineNum;
  78. m_nID=++m_nObjectNum;
  79. }
  80. CShape::~CShape()
  81. {
  82. }
  83. ////////////////////////////////////////////////////////////
  84. //Operations
  85. /////////////////////////////////////////////////////////////
  86. void CShape::Serialize( CArchive& ar )
  87. {
  88. // serialization of Base class 
  89. CObject::Serialize( ar ) ;
  90. if ( ar.IsLoading() ){
  91. int nFillStyle;
  92.         ar>>m_color;
  93. ar>>m_FillColor;
  94. ar>>m_nPenWidth;
  95. ar>>m_flAngle;
  96. ar>>m_flScale;
  97. ar>>nFillStyle;
  98. ar>>m_nDrawPoints;
  99. SetSelectFlag(FALSE);
  100. m_nFillStyle=(SHAPE_FILLSTYLE)nFillStyle;
  101. //temp
  102. m_ptRotateCenterTemp.x=0;
  103. m_ptRotateCenterTemp.y=0;
  104. m_flAngleTemp=0;
  105. m_ptMagnifyCenterTemp.x=0;
  106. m_ptMagnifyCenterTemp.y=0;
  107. m_flScaleTemp=1;
  108. m_nSelectPtNum=-1;
  109. m_nSelectLineNum=-1;
  110. } else {
  111. int nFillStyle=(int)m_nFillStyle;;
  112. ar<<m_color;
  113. ar<<m_FillColor;
  114. ar<<m_nPenWidth;
  115. ar<<m_flAngle;
  116. ar<<m_flScale;
  117. ar<<nFillStyle;
  118. ar<<m_nDrawPoints;
  119. }
  120. return ;
  121. }
  122. //////////////////////////////////////////////////////////////////////////////
  123. void CShape::Draw(CDC *pDC)
  124. {
  125. int penWidth=GetPenWidth();
  126. COLORREF color=GetColor();
  127. Draw(pDC,color,m_FillColor,penWidth);  
  128. }
  129. void CShape::Draw(CDC *pDC,COLORREF color)
  130. {
  131. int penWidth=GetPenWidth();  
  132. Draw(pDC,color,m_FillColor,penWidth);
  133. }
  134. void CShape::Draw(CDC *pDC,COLORREF color,int penWidth)
  135. {
  136.     Draw(pDC,color,m_FillColor,penWidth);
  137. }
  138. void CShape::Draw(CDC *pDC,COLORREF color,COLORREF fillColor)
  139. {
  140. int penWidth=GetPenWidth();  
  141.     Draw(pDC,color,fillColor,penWidth);
  142. }
  143. void CShape::DrawCutToRect(CDC *pDC,CFlRect m_rectFrom,CRect m_rectTo)
  144. {
  145. int penWidth=GetPenWidth();
  146. COLORREF color=GetColor();
  147. DrawCutToRect(pDC,color,m_FillColor,penWidth,m_rectFrom,m_rectTo);  
  148. }
  149. void CShape::DrawCutToRect(CDC *pDC,COLORREF color,CFlRect m_rectFrom,CRect m_rectTo)
  150. {
  151. int penWidth=GetPenWidth();  
  152. DrawCutToRect(pDC,color,m_FillColor,penWidth,m_rectFrom,m_rectTo);
  153. }
  154. void CShape::DrawCutToRect(CDC *pDC,COLORREF color,int penWidth,CFlRect m_rectFrom,CRect m_rectTo)
  155. {
  156.     DrawCutToRect(pDC,color,m_FillColor,penWidth,m_rectFrom,m_rectTo);
  157. }
  158. void CShape::DrawCutToRect(CDC *pDC,COLORREF color,COLORREF fillColor,CFlRect m_rectFrom,CRect m_rectTo)
  159. {
  160. int penWidth=GetPenWidth();  
  161.     DrawCutToRect(pDC,color,fillColor,penWidth,m_rectFrom,m_rectTo);
  162. }
  163. void CShape::InsertEdge(Edge *list,Edge *edge)
  164. {
  165. Edge *p,*q=list;
  166. p=q->next;
  167. while(p)
  168. {
  169. if(edge->x<p->x||edge->x+edge->dx<p->x+p->dx)
  170. p=0;
  171. else
  172. {
  173. q=p;
  174. p=p->next;
  175. }
  176. }
  177. edge->next=q->next;
  178. q->next=edge;
  179. }
  180. void CShape::BuildEdgeList(int cnt,POINT *pts,Edge *edges[],int nScanMin)
  181. {
  182. Edge *edge;
  183. POINT p1,p2;
  184. int i;
  185. p1=pts[cnt-1];
  186. for(i=0;i<cnt;i++)
  187. {
  188. p2=pts[i];
  189. if(p1.y!=p2.y)
  190. {
  191. edge=(Edge *)malloc(sizeof(Edge));
  192. edge->dx=-(float)(p2.x-p1.x)/(p2.y-p1.y);
  193. if(p1.y>p2.y)
  194. {
  195. edge->x=float(p1.x);
  196. edge->ymin=p2.y;
  197. InsertEdge(edges[p1.y-nScanMin],edge);
  198. }
  199. else
  200. {
  201. edge->x=float(p2.x);
  202. edge->ymin=p1.y;
  203. InsertEdge(edges[p2.y-nScanMin],edge);
  204. }  
  205. }
  206. p1=p2;
  207. }
  208. }
  209.   void CShape::BuildActiveList(int scan,Edge *active,Edge *edges[],int nScanMin)
  210.   {
  211.   Edge *p,*q;
  212.   p=edges[scan-nScanMin]->next;
  213.   while(p)
  214.   {
  215.   q=p->next;
  216.   InsertEdge(active,p);
  217.   p=q;
  218.   }
  219.   }
  220.   void CShape::FillScan(CDC *pDC,int scan,Edge *active,COLORREF color)
  221.  {
  222.   Edge *p1,*p2;   
  223.   p1=active->next;
  224.   while(p1)
  225.   {
  226.   p2=p1->next;
  227.   pDC->MoveTo(int(p1->x+0.5),scan);
  228.   pDC->LineTo(int(p2->x+0.5),scan);
  229.   p1=p2->next;
  230.   }
  231. }
  232.   void CShape::DeleteAfter(Edge *q)
  233.   {
  234.   Edge *p=q->next;
  235.   q->next=p->next;
  236.   free(p);
  237.   }  
  238.   
  239.   void CShape::UpdateActiveList(int scan,Edge *active)
  240.   {
  241.   Edge *q=active,*p=active->next;
  242.   while(p)
  243.   {
  244.   if(scan<=p->ymin)
  245.   {
  246.   p=p->next;
  247.   DeleteAfter(q);
  248.   }
  249.   else
  250.   {
  251.   p->x=p->x+p->dx;
  252.   q=p;
  253.   p=p->next;
  254.   }
  255.   }
  256.   }
  257.   
  258.   void CShape::AreaFill(CDC *pDC,int cnt,POINT *pts,COLORREF color)
  259.   {
  260.   Edge *active;
  261.   int i,scan,scanmin=1000,scanmax=0;     
  262.   for(i=0;i<cnt;i++)
  263.   {
  264.   if(scanmax<pts[i].y) scanmax=pts[i].y;
  265.   if(scanmin>pts[i].y) scanmin=pts[i].y;
  266.   }
  267.   pEdge *edges=(pEdge *)malloc((scanmax-scanmin+1)*sizeof(Edge));
  268.   for(scan=scanmin;scan<=scanmax;scan++)
  269.   {
  270.   edges[scan-scanmin]=(Edge *)malloc(sizeof(Edge));
  271.   edges[scan-scanmin]->next=0;
  272.   }
  273.   
  274.   BuildEdgeList(cnt,pts,edges,scanmin);
  275.   active=(Edge *)malloc(sizeof(Edge));
  276.   active->next=0;
  277.   for(scan=scanmax;scan>=scanmin;scan--)
  278.   {
  279.   BuildActiveList(scan,active,edges,scanmin);
  280.   FillScan(pDC,scan,active,color);
  281.   UpdateActiveList(scan-1,active);
  282.   }
  283.   
  284.   free(active);
  285.   for(scan=scanmin;scan<=scanmax;scan++)
  286.   {
  287.    free(edges[scan-scanmin]);   
  288.   }
  289.   free(edges);
  290.   }
  291. void CShape::DotLine(CDC *pDC,int x1,int y1,int x2,int y2,COLORREF color)
  292. {
  293. int i,dx,dy,di,const1,const2,inc,tmp;
  294. inc=2;
  295. i=0;
  296. dx=x2-x1;
  297. dy=y2-y1;
  298. if(fabs(dx)>fabs(dy))
  299. {
  300. if(dx<0)
  301. {
  302. tmp=x1;x1=x2;x2=tmp;
  303. tmp=y1;y1=y2;y2=tmp;
  304. dx=-dx;dy=-dy;
  305. }
  306. if(dy<0)
  307. {
  308. inc=-2;
  309. dy=-dy;
  310. }
  311. di=2*dy-dx;
  312. const1=2*(dy-dx);
  313. const2=2*dy;
  314. // for(i=0;i<m_nPenWidth;i++)
  315. // {
  316. // pDC->SetPixel(x1+i,y1,color);
  317. pDC->SetPixel(x1,y1+i,color);
  318. // }
  319. while(x1<x2)
  320. {
  321. x1+=2;
  322. if(di>=0)
  323. {
  324. y1+=inc;
  325. di+=const1;
  326. }
  327. else
  328. {
  329. di+=const2;
  330. }
  331. // for(i=0;i<m_nPenWidth;i++)
  332. // {
  333. // pDC->SetPixel(x1+i,y1,color);
  334. pDC->SetPixel(x1,y1+i,color);
  335. // }
  336. }
  337. }
  338. else
  339. {
  340. if(dy<0)
  341. {
  342. tmp=x1;x1=x2;x2=tmp;
  343. tmp=y1;y1=y2;y2=tmp;
  344. dx=-dx;dy=-dy;
  345. }
  346. if(dx<0)
  347. {
  348. inc=-2;
  349. dx=-dx;
  350. }
  351. di=2*dx-dy;
  352. const1=2*(dx-dy);
  353. const2=2*dx;
  354. // for(i=0;i<m_nPenWidth;i++)
  355. // {
  356. // pDC->SetPixel(x1+i,y1,color);
  357. pDC->SetPixel(x1,y1+i,color);
  358. // }
  359. while(y1<y2)
  360. {
  361. y1+=2;
  362. if(di>=0)
  363. {
  364. x1+=inc;
  365. di+=const1;
  366. }
  367. else
  368. {
  369. di+=const2;
  370. }
  371. // for(i=0;i<m_nPenWidth;i++)
  372. // {
  373. // pDC->SetPixel(x1+i,y1,color);
  374. pDC->SetPixel(x1,y1+i,color);
  375. // }
  376. }
  377. }
  378. }
  379. void CShape::BresenhamLine(CDC *pDC,CPoint m_pStart,CPoint m_pEnd,COLORREF color)
  380. {
  381. int x1=m_pStart.x,y1=m_pStart.y,
  382. x2=m_pEnd.x,y2=m_pEnd.y;
  383. int i,dx,dy,di,const1,const2,inc,tmp;
  384. inc=1;
  385. dx=x2-x1;
  386. dy=y2-y1;
  387. if(fabs(dx)>fabs(dy))
  388. {
  389. if(dx<0)
  390. {
  391. tmp=x1;x1=x2;x2=tmp;
  392. tmp=y1;y1=y2;y2=tmp;
  393. dx=-dx;dy=-dy;
  394. }
  395. if(dy<0)
  396. {
  397. inc=-1;
  398. dy=-dy;
  399. }
  400. di=2*dy-dx;
  401. const1=2*(dy-dx);
  402. const2=2*dy;
  403. for(i=0;i<m_nPenWidth;i++)
  404. {
  405. pDC->SetPixel(x1+i,y1,color);
  406. pDC->SetPixel(x1,y1+i,color);
  407. }
  408. while(x1<x2)
  409. {
  410. x1++;
  411. if(di>=0)
  412. {
  413. y1+=inc;
  414. di+=const1;
  415. }
  416. else
  417. {
  418. di+=const2;
  419. }
  420. for(i=0;i<m_nPenWidth;i++)
  421. {
  422. pDC->SetPixel(x1+i,y1,color);
  423. pDC->SetPixel(x1,y1+i,color);
  424. }
  425. }
  426. }
  427. else
  428. {
  429. if(dy<0)
  430. {
  431. tmp=x1;x1=x2;x2=tmp;
  432. tmp=y1;y1=y2;y2=tmp;
  433. dx=-dx;dy=-dy;
  434. }
  435. if(dx<0)
  436. {
  437. inc=-1;
  438. dx=-dx;
  439. }
  440. di=2*dx-dy;
  441. const1=2*(dx-dy);
  442. const2=2*dx;
  443. for(i=0;i<m_nPenWidth;i++)
  444. {
  445. pDC->SetPixel(x1+i,y1,color);
  446. pDC->SetPixel(x1,y1+i,color);
  447. }
  448. while(y1<y2)
  449. {
  450. y1++;
  451. if(di>=0)
  452. {
  453. x1+=inc;
  454. di+=const1;
  455. }
  456. else
  457. {
  458. di+=const2;
  459. }
  460. for(i=0;i<m_nPenWidth;i++)
  461. {
  462. pDC->SetPixel(x1+i,y1,color);
  463. pDC->SetPixel(x1,y1+i,color);
  464. }
  465. }
  466. }
  467. }
  468. void CShape::BresenhamLine(CDC *pDC,int x1,int y1,int x2,int y2,COLORREF color)
  469. {
  470. CPoint p1,p2;
  471. p1.x=x1;
  472. p1.y=y1;
  473. p2.x=x2;
  474. p2.y=y2;
  475. BresenhamLine(pDC,p1,p2,color);
  476. }
  477. void CShape::BresenhamLine(CDC *pDC,int x1,int y1,int x2,int y2,COLORREF color,CRect rect)
  478. {
  479. int i,dx,dy,di,const1,const2,inc,tmp;
  480. inc=1;
  481. dx=x2-x1;
  482. dy=y2-y1;
  483. if(fabs(dx)>fabs(dy))
  484. {
  485. if(dx<0)
  486. {
  487. tmp=x1;x1=x2;x2=tmp;
  488. tmp=y1;y1=y2;y2=tmp;
  489. dx=-dx;dy=-dy;
  490. }
  491. if(dy<0)
  492. {
  493. inc=-1;
  494. dy=-dy;
  495. }
  496. di=2*dy-dx;
  497. const1=2*(dy-dx);
  498. const2=2*dy;
  499. for(i=0;i<m_nPenWidth;i++)
  500. {
  501. if(x1+i>=rect.left&&x1+i<=rect.right&&y1>=rect.top&&y1<=rect.bottom)    
  502. pDC->SetPixel(x1+i,y1,color);
  503. if(x1>=rect.left&&x1<=rect.right&&y1+i>=rect.top&&y1+i<=rect.bottom)
  504.     pDC->SetPixel(x1,y1+i,color);
  505. }
  506. while(x1<x2)
  507. {
  508. x1++;
  509. if(di>=0)
  510. {
  511. y1+=inc;
  512. di+=const1;
  513. }
  514. else
  515. {
  516. di+=const2;
  517. }
  518. for(i=0;i<m_nPenWidth;i++)
  519. {
  520. if(x1+i>=rect.left&&x1+i<=rect.right&&y1>=rect.top&&y1<=rect.bottom)    
  521. pDC->SetPixel(x1+i,y1,color);
  522. if(x1>=rect.left&&x1<=rect.right&&y1+i>=rect.top&&y1+i<=rect.bottom)
  523.     pDC->SetPixel(x1,y1+i,color);
  524. }
  525. }
  526. }
  527. else
  528. {
  529. if(dy<0)
  530. {
  531. tmp=x1;x1=x2;x2=tmp;
  532. tmp=y1;y1=y2;y2=tmp;
  533. dx=-dx;dy=-dy;
  534. }
  535. if(dx<0)
  536. {
  537. inc=-1;
  538. dx=-dx;
  539. }
  540. di=2*dx-dy;
  541. const1=2*(dx-dy);
  542. const2=2*dx;
  543. for(i=0;i<m_nPenWidth;i++)
  544. {
  545. if(x1+i>=rect.left&&x1+i<=rect.right&&y1>=rect.top&&y1<=rect.bottom)    
  546. pDC->SetPixel(x1+i,y1,color);
  547. if(x1>=rect.left&&x1<=rect.right&&y1+i>=rect.top&&y1+i<=rect.bottom)
  548.     pDC->SetPixel(x1,y1+i,color);
  549. }
  550. while(y1<y2)
  551. {
  552. y1++;
  553. if(di>=0)
  554. {
  555. x1+=inc;
  556. di+=const1;
  557. }
  558. else
  559. {
  560. di+=const2;
  561. }
  562. for(i=0;i<m_nPenWidth;i++)
  563. {
  564. if(x1+i>=rect.left&&x1+i<=rect.right&&y1>=rect.top&&y1<=rect.bottom)    
  565. pDC->SetPixel(x1+i,y1,color);
  566. if(x1>=rect.left&&x1<=rect.right&&y1+i>=rect.top&&y1+i<=rect.bottom)
  567.     pDC->SetPixel(x1,y1+i,color);
  568. }
  569. }
  570. }
  571. }
  572. int CShape::DrawLineToRect(CDC *pDC,POINT start,POINT end,CFlRect m_rectFrom,CRect m_rectTo)
  573. {
  574.      int x1,y1,x2,y2,x3,y3,x,y,k;  
  575.  float  A,B,C,D;
  576.  int scale;
  577.  int m_oldWidth;
  578.  scale=((float)(m_rectTo.right-m_rectTo.left))/(m_rectFrom.right-m_rectFrom.left)+0.5;
  579.  x1=start.x;
  580.  y1=start.y;
  581.  x2=end.x;
  582.  y2=end.y;
  583.  int dx=m_rectFrom.left -m_rectTo.left;
  584.  int dy=m_rectFrom.top -m_rectTo.top;
  585.  unsigned c,c1,c2;
  586.  c1=PtStateToRect(x1,y1,m_rectFrom);c2=PtStateToRect(x2,y2,m_rectFrom);
  587.  x3=x2;y3=y2;k=0;
  588.  if(c1!=0) goto L4;
  589.  x2=x1;y2=y1;
  590. L1:  x1=x3;y1=y3;
  591.  if(c2==0) goto L2;
  592.  k=1;x3=x2;y3=y2;c1=c2;c2=0;goto L5;
  593. L2:  m_oldWidth=m_nPenWidth;
  594.  m_nPenWidth=scale*m_nPenWidth;
  595.      if(k==1) BresenhamLine(pDC,(x1-dx)*scale,(y1-dy)*scale,(x2-dx)*scale,(y2-dy)*scale,m_color,m_rectTo);
  596.  else     BresenhamLine(pDC,(x2-dx)*scale,(y2-dy)*scale,(x1-dx)*scale,(y1-dy)*scale,m_color,m_rectTo);
  597.  m_nPenWidth=m_nPenWidth/scale;
  598.  m_nPenWidth=m_oldWidth;
  599. L3:  return 0;
  600. L4:  if((c1&c2)!=0) goto L3;
  601. L5:  x=(x1+x2)/2;y=(y1+y2)/2;
  602.  if(x==x1&&y==y1)
  603. L6:  {x2=x;y2=y;goto L1;}
  604.  if(x==x2&&y==y2) goto L6;
  605.  c=PtStateToRect(x,y,m_rectFrom);
  606.  if((c&c1)==0) {x2=x;y2=y;goto L5;}
  607.  else {x1=x;y1=y;c1=c;goto L4;}
  608. }
  609. //////////////////////////////////////////////////////
  610. //function-----PtStateToRect
  611. //return value  rtval
  612. //reval = 0------------in
  613. //reval & 1 != 0-------left
  614. //reval & 2 != 0-------right
  615. //reval & 4 != 0-------top
  616. //reval & 8 != 0-------bottom
  617. //////////////////////////////////////////////////////
  618. int CShape::PtStateToRect(float x,float y,CRect rectRes)
  619. {
  620.     int val=0;
  621. if(x<rectRes.left) val=1;
  622. else if(x>rectRes.right) val=2;
  623. if(y<rectRes.top) val=val+4;
  624. else if(y>rectRes.bottom) val=val+8;
  625. return val;
  626. }
  627. //////////////////////////////////////////////////////
  628. //function-----PtStateToRect
  629. //return value  rtval
  630. //reval = 0------------in
  631. //reval & 1 != 0-------left
  632. //reval & 2 != 0-------right
  633. //reval & 4 != 0-------top
  634. //reval & 8 != 0-------bottom
  635. //////////////////////////////////////////////////////
  636. int CShape::PtStateToRect(CPoint point,CRect rectRes)
  637. {
  638. return PtStateToRect(point.x,point.y,rectRes);
  639. }
  640. ///////////////////////////////////////////////////////////
  641. //////////////////////////////////////////////////////////////////////
  642. // MODULE   :ExPort
  643. // ABSTRACT :Export to a txt file
  644. // FUNCTION :File->Export...
  645. // NOTE     :
  646. // RETURN   :
  647. // ARGUMENTS:
  648. //              I/O           TYPE      NAME       EXPLANATION
  649. //               O            FILE*    outStream    Out put File
  650. // CREATE   :  FNST)handwolf  2004-4-14
  651. // UPDATE   :  
  652. //          : 
  653. //////////////////////////////////////////////////////////////////////
  654. void CShape::ExPort(FILE* outStream)//增加导出txt功能时用
  655. {
  656. fprintf( outStream, " %ld %ld %d %f %f %d %d ",m_color, 
  657. m_FillColor, m_nPenWidth, m_flAngle,m_flScale,m_nFillStyle,m_nDrawPoints);
  658. }
  659. //////////////////////////////////////////////////////////////////////
  660. // MODULE   :ImPort
  661. // ABSTRACT :ImPort from a txt file
  662. // FUNCTION :File->ImPort...
  663. // NOTE     :
  664. // RETURN   :
  665. // ARGUMENTS:
  666. //              I/O           TYPE      NAME       EXPLANATION
  667. //               I            FILE*    inStream    in put File
  668. // CREATE   :  FNST)handwolf  2004-4-14
  669. // UPDATE   :  
  670. //          : 
  671. //////////////////////////////////////////////////////////////////////
  672. void CShape::ImPort(FILE* inStream)
  673. {
  674. fscanf(inStream, "%ld %ld %d %f %f %d %d",&m_color, &m_FillColor, &m_nPenWidth, &m_flAngle,&m_flScale,&m_nFillStyle,&m_nDrawPoints);
  675. }