ARX源代码Word下载.docx
《ARX源代码Word下载.docx》由会员分享,可在线阅读,更多相关《ARX源代码Word下载.docx(21页珍藏版)》请在冰豆网上搜索。
//TODO:
Implementthecommand
CDatabaseprojectbase;
CStringstr="
ODBC;
SourceDB=E:
\\研一课程\\道路与铁道CAD作业\\xljs.dbc;
"
;
if(!
projectbase.Open("
VisualFoxProDatabase"
false,false,str,true))
{
MessageBox(NULL,"
项目数据库打开失败"
"
数据库错误"
MB_ICONERROR);
return;
}
if(projectbase.IsOpen())//检查连接状态
MessageBox(NULL,"
数据库连接成功"
NULL,MB_OK);
}
Cdata_arxsetprojectdata(&
projectbase);
if(!
projectdata.Open(CRecordset:
:
snapshot,_T("
[data_arx]"
),CRecordset:
none))
数据表打开失败"
return;
intcount=0;
for(;
!
projectdata.IsEOF();
)
projectdata.MoveNext();
count++;
}//count=8个交点,count从0-7
double*m_fwj=newdouble[count-1];
double*m_jdjj=newdouble[count-1];
projectdata.MoveFirst();
for(inti=0;
i<
count-1;
i++)//计算方位角和交点间距
projectdata.Edit();
doubletemp_e=projectdata.m_e;
doubletemp_n=projectdata.m_n;
Cfwj_jdjj_calfwj_jdjj_cal;
m_fwj[i]=fwj_jdjj_cal.fwj_cal(temp_e,temp_n,projectdata.m_e,projectdata.m_n);
m_jdjj[i]=fwj_jdjj_cal.jdjj_cal(temp_e,temp_n,projectdata.m_e,projectdata.m_n);
AcGePoint3dstartpt(temp_e,temp_n,0.0);
AcGePoint3dendpt(projectdata.m_e,projectdata.m_n,0.0);
Cdraw_defdraw_def;
draw_def.drawLine(startpt,endpt);
//绘出直线段
double*m_zy_e=newdouble[count-2];
double*m_zy_n=newdouble[count-2];
double*m_yz_e=newdouble[count-2];
double*m_yz_n=newdouble[count-2];
double*m_center_e=newdouble[count-2];
double*m_center_n=newdouble[count-2];
double*m_angle1=newdouble[count-2];
double*m_angle2=newdouble[count-2];
//计算转角、切线长和曲线长
for(intj=0;
j<
count-2;
j++)
Calpha_tk_calalpha_tk_cal;
projectdata.m_Alpha=alpha_tk_cal.Alpha_cal(m_fwj[j],m_fwj[j+1]);
projectdata.m_T=alpha_tk_cal.T_cal(projectdata.m_Alpha,projectdata.m_R);
projectdata.m_K=alpha_tk_cal.K_cal(projectdata.m_Alpha,projectdata.m_R);
projectdata.Update();
//直圆点相关计算
for(intk=0;
k<
k++)
m_zy_e[k]=projectdata.m_e-(projectdata.m_e-temp_e)*projectdata.m_T/m_jdjj[k];
m_zy_n[k]=projectdata.m_n-(projectdata.m_n-temp_n)*projectdata.m_T/m_jdjj[k];
if(projectdata.m_Alpha>
0)
{
m_center_e[k]=m_zy_e[k]+projectdata.m_R*sin(m_fwj[k]+pi/2.0);
m_center_n[k]=m_zy_n[k]+projectdata.m_R*cos(m_fwj[k]+pi/2.0);
m_angle1[k]=pi-m_fwj[k+1];
m_angle2[k]=pi-m_fwj[k+1]+projectdata.m_Alpha;
Cdraw_defdraw_def;
AcGePoint3dzy(m_zy_e[k],m_zy_n[k],0.0);
AcGePoint3dendptzy(m_zy_e[k]+50*sin(m_fwj[k]+pi/2.0),
m_zy_n[k]+50*cos(m_fwj[k]+pi/2.0),0.0);
draw_def.drawLine(zy,endptzy);
}
else
m_center_e[k]=m_zy_e[k]+projectdata.m_R*sin(m_fwj[k]-pi/2.0);
m_center_n[k]=m_zy_n[k]+projectdata.m_R*cos(m_fwj[k]-pi/2.0);
m_angle1[k]=2.0*pi-m_fwj[k+1]+projectdata.m_Alpha;
m_angle2[k]=2.0*pi-m_fwj[k+1];
AcGePoint3dendptzy(m_zy_e[k]+50*sin(m_fwj[k]-pi/2.0),
m_zy_n[k]+50*cos(m_fwj[k]-pi/2.0),0.0);
//绘出圆曲线
for(intm=0;
m<
m++)
AcGePoint3dcenter(m_center_e[m],m_center_n[m],0.0);
draw_def.drawArc(center,projectdata.m_R,m_angle1[m],m_angle2[m]);
//圆直点相关计算
projectdata.MoveNext();
for(intl=0;
l<
l++)
doubletemp_T=projectdata.m_T;
doubletemp_Alpha=projectdata.m_Alpha;
m_yz_e[l]=temp_e+(projectdata.m_e-temp_e)*temp_T/m_jdjj[l+1];
m_yz_n[l]=temp_n+(projectdata.m_n-temp_n)*temp_T/m_jdjj[l+1];
if(temp_Alpha>
AcGePoint3dyz(m_yz_e[l],m_yz_n[l],0.0);
AcGePoint3dendptyz(m_yz_e[l]+50*sin(m_fwj[l+1]+pi/2.0),
m_yz_n[l]+50*cos(m_fwj[l+1]+pi/2.0),0.0);
draw_def.drawLine(yz,endptyz);
AcGePoint3dendptyz(m_yz_e[l]+50*sin(m_fwj[l+1]-pi/2.0),
m_yz_n[l]+50*cos(m_fwj[l+1]-pi/2.0),0.0);
for(intn=0;
n<
n++)
AcGePoint3dJD(projectdata.m_e,projectdata.m_n,0.0);
AcGePoint3dzy(m_zy_e[n],m_zy_n[n],0.0);
AcGePoint3dyz(m_yz_e[n],m_yz_n[n],0.0);
CStringJDnum;
//将JD号转化为字符串