• 大小: 2.13MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-09-07
  • 语言: 其他
  • 标签: vc  cad  画图  

资源简介

该程序实现了简单的画点,直线,圆,圆弧,水平或垂直线,长方形,多边形,表格,标注等,还有对画布的放大缩小等功能。菜单栏工具栏,功能齐全,是很好的vc开发cad的参考资料。

资源截图

代码片段和文件信息

#include “stdafx.h“
#include “arrowobject.h“
#include “Arcobject.h“
#include “Circleobject.h“
#include 

CArcobject::CArcobject()
{
m_Type=W_ARC;
}
void CArcobject::Draw(CDC *pDC)
{

   CPen newpen(m_PenTypem_PenWidthm_PenColor);
   CPen *oldpen=pDC->Selectobject(&newpen);
   int R=(int)sqrt((double)((m_Sp.x-m_Cenp.x)*(m_Sp.x-m_Cenp.x)+(m_Sp.y-m_Cenp.y)*(m_Sp.y-m_Cenp.y)));
   CRect rect(CPoint(m_Cenp.x-Rm_Cenp.y-R)CPoint(m_Cenp.x+Rm_Cenp.y+R));
       pDC->Arc(rectm_Spm_Ep);
   pDC->Selectobject(oldpen);
//pDC->Polyline(m_objects[i]->GetData()m_objects[i]->GetSize());

}

bool CArcobject::Findobject(CPoint p)
{
CCircleobject cirobject;
double angleangle1angle2anglemaxangleminpxpy;

angle=atan2(p.y-m_Cenp.yp.x-m_Cenp.x);
if(angle<0)
angle=fabs(angle)+PI;
angle1=atan2(m_Sp.y-m_Cenp.ym_Sp.x-m_Cenp.x);
if(angle1<0)
angle1=fabs(angle1)+PI;
angle2=atan2(m_Ep.y-m_Cenp.ym_Ep.x-m_Cenp.x);
if(angle2<0)
angle2=fabs(angle2)+PI;

cirobject.m_Cenp=m_Cenp;
cirobject.m_R=m_R;
anglemax=(angle1>angle2)?angle1:angle2;
anglemin=(angle1 if(cirobject.Findobject(p)&&angle>anglemin&&angle return true;
else
return false;
}

bool CArcobject::Findobject(CRect rect)
{
CRect arect(m_Spm_Ep);
arect.NormalizeRect( );
CRgn rgn;
rgn.CreateRectRgnIndirect(&rect);
if(rgn.RectInRegion(arect))
return true;
else
return false;
}
void CArcobject::SelectDraw(CDC *pDC)
{
CMarker marker;
   CPen newpen(PS_DOT0m_PenColor);
   CPen *oldpen=pDC->Selectobject(&newpen);
   ////
   int R=(int)sqrt((double)((m_Sp.x-m_Cenp.x)*(m_Sp.x-m_Cenp.x)+(m_Sp.y-m_Cenp.y)*(m_Sp.y-m_Cenp.y)));
   CRect rect(CPoint(m_Cenp.x-Rm_Cenp.y-R)CPoint(m_Cenp.x+Rm_Cenp.y+R));
       pDC->Arc(rectm_Spm_Ep);
///
    marker.Create(PRECISION RGB(00255) MARKER_RECTANGLE MARKER_LINE);
marker.SetCenter(m_Cenp);
marker.DrawMarker(pDC);
   pDC->Selectobject(oldpen);

}
CADobject * CArcobject::Clone()
{
CArcobject *parc=new CArcobject();
parc->m_BrushColor=m_BrushColor;
parc->m_PenColor=m_PenColor;
parc->m_PenType=m_PenType;
parc->m_PenWidth=m_PenWidth;
parc->m_Type=m_Type;
parc->m_layer=m_layer;
parc->m_Cenp=m_Cenp;
parc->m_Ep=m_Ep;
parc->m_Sp=m_Sp;
parc->m_R=m_R;
return parc;
}

CADobject* CArcobject::Mirror(CPoint spCPoint ep)
{

double anglepxpy;
CPoint sp0sp1sp2ep0ep1ep2;
angle=atan2(ep.y-sp.yep.x-sp.x);
angle=angle-PI/2;
int dist;
CArcobject *parc=new CArcobject();
parc->m_BrushColor=m_BrushColor;
parc->m_PenColor=m_PenColor;
parc->m_PenType=m_PenType;
parc->m_PenWidth=m_PenWidth;
parc->m_Type=m_Type;
parc->m_layer=m_layer;
parc->m_R=m_R;
dist=-((ep.y-sp.y)*m_Sp.x-(ep.x-sp.x)*m_Sp.y+ep.x*sp.y-sp.x*ep.y)
/sqrt((ep.y-sp.y)*(ep.y-sp.y)+(ep.x-sp.x)*(ep.x-sp.x));
parc->m_Sp.x=m_Sp.x+2*dist*cos(angle);
parc->m_Sp.y=m_Sp.y+2*dist*sin(angle);

dist=-((ep.y

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       6530  2002-08-25 18:49  WCAD\Arcobject.cpp

     文件        972  2002-08-18 20:30  WCAD\Arcobject.h

     文件      13143  2002-07-16 22:13  WCAD\Arrowobject.cpp

     文件       1060  2002-07-16 22:12  WCAD\Arrowobject.h

     文件       7888  2002-07-11 11:35  WCAD\AutoFont.cpp

     文件       2380  2000-02-11 11:37  WCAD\AutoFont.h

     文件       1317  2002-07-12 21:22  WCAD\Cadobject.cpp

     文件       5291  2002-08-20 22:08  WCAD\CADobject.h

     文件      11699  2002-05-17 00:38  WCAD\calculator.cpp

     文件       1546  2002-05-16 22:27  WCAD\Calculator.h

     文件       3686  1998-11-30 11:25  WCAD\CELLRANGE.H

     文件       6915  2002-08-25 17:34  WCAD\Circleobject.cpp

     文件        892  2002-08-18 17:03  WCAD\Circleobject.h

     文件       8531  2002-06-20 21:19  WCAD\COLORPICKERCB.CPP

     文件       2956  2002-06-20 21:18  WCAD\COLORPICKERCB.H

     文件       9980  2002-08-25 17:59  WCAD\ColorToolBar.cpp

     文件       3502  2002-08-18 15:40  WCAD\ColorToolBar.h

     文件       1863  2002-05-28 20:39  WCAD\CommandView.cpp

     文件       1664  2002-05-28 20:35  WCAD\CommandView.h

     文件       1529  2002-06-22 10:54  WCAD\CurSizeWnd.cpp

     文件       1128  2002-06-22 10:27  WCAD\CurSizeWnd.h

     文件       4341  2002-07-21 16:43  WCAD\dwgfile.cpp

     文件        677  2002-07-21 16:43  WCAD\dwgfile.h

     文件       9347  2002-07-20 20:19  WCAD\DxfFile.cpp

     文件       1682  2002-07-20 17:38  WCAD\DxfFile.h

     文件      16105  2002-07-09 20:20  WCAD\EnumPrinters.cpp

     文件       2028  2002-06-24 15:31  WCAD\EnumPrinters.h

     文件     159141  1998-12-04 01:13  WCAD\GRIDCTRL.CPP

     文件      24589  1998-12-04 00:51  WCAD\GRIDCTRL.H

     文件       3554  1998-08-07 15:33  WCAD\GRIDDROPTARGET.CPP

............此处省略150个文件信息

评论

共有 条评论