




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Text;usingSystem.Windows.Forms;usingSystem.IO;usingSystem.Collections;namespaceDXF(publicpartialclassForml:Form(privateFileStreamfs;privateStreamReadersr;privateArrayListLayerList=
2、newArrayList();privateArrayListLineList=newArrayList();privateArrayListArcList=newArrayList();privateArrayListEllipseList=newArrayList();privateArrayListLwopolylineList=newArrayListprivateArrayListSplineList=newArrayList();privatestringstr=newstring2;privateintcount;privatedoubleleftx;privatedoublel
3、efty;0;privatedoublerightx;privatedoublerighty;publicForm1()(lnitializeComponent();)privatestringReadPair()(stringcode=sr.ReadLine().Trim();stringcodedata=sr.ReadLine().Trim();count+=2;stringresult=newstring2code,codedata;returnresult;)privatevoidRead()while(sr.Peek()!=-1)str=ReadPair();if(str1=&quo
4、t;SECTION)(str=ReadPair();switch(str1)case"HEADER"ReadHeader();break;case"TABLES'!ReadTable();break;case"ENTITIES":ReadEntities();break;)sr.Close();fs.Close();btDraw.Enabled=true;label1.Text=count.ToString();count=0;)privatevoidReadTable()(while(str1!="ENDSEQ"(
5、while(strO!="2"|str1!="LAYER')(str=ReadPairQ;while(strO!="LAYER')str=ReadPair();)while(strO=(ReadLAYER();)while(str1!=(str=ReadPair();)"0"&&str1="LAYER')"ENDSEQ"privatevoidReadLAYER()LAYEFbewlayer=newLAYEI0;while(str1!="ENDTAB)
6、9;str=ReadPair();switch(strO)(case"2":=str1;break;case"62":newlayer.colornum=str1;break;case"6":newlayer.lstyle=str1;break;case"370":newlayer.lwidth=str1;break;)if(str0="0"&&str1="LAYER')(LayerList.Add(newlayer);return;)
7、LayerList.Add(newlayer);)privatevoidReadEntities()(while(str1!="ENDSEQ"(switch(str1)(case"LINE":ReadLine();break;case"ARC"ReadArc();break;case"CIRCLE":ReadArcQ;break;case"ELLIPSE":ReadEllipse();break;case"LWPOLYLINE:"ReadLwpolyline();break;
8、case"SPLINE":ReadSpline();break;default:str=ReadPair();break;privatevoidReadArc()ARCnewarc=newARC();while(str1!="ENDSEC)"str=ReadPair();switch(str0)case"8":newarc.LName=str1;break;case"10":newarc.CenterX=Double.Parse(str1);break;Double.Parse(str1);Double.Parse
9、(str1);Double.Parse(str1);Double.Parse(str1);case"20":newarc.CenterY=break;case"40":newarc.Radiu=break;case"50":newarc.SAngle=break;case"51":newarc.EAngle=break;case"370":newarc.lwidth=str1;break;case"0":ArcList.Add(newarc);return;privatevo
10、idReadLine()LINEnewline=newLINE();while(str1!="ENDSEC)"str=ReadPair();switch(str0)case"8":newline.LName=str1;break;Double.Parse(str1);Double.Parse(str1);Double.Parse(str1);Double.Parse(str1);case"10":newline.StartX=break;case"20":newline.StartY=break;case"
11、;11":newline.EndX=break;case"21":newline.EndY=break;case"62":newline.colornum=str1;break;case"370":newline.lwidth=str1;break;case"0":LineList.Add(newline);return;privatevoidReadEllipse()ELLIPSEnewellipse=newELLIPSE();while(str1!="ENDSEC)"str=Rea
12、dPair();switch(str0)case"8":newellipse.LName=str1;break;case"10":newellipse.CenterX=break;case"20":newellipse.CenterY=break;case"11":newellipse.DeltaX=break;case"21":newellipse.DeltaY=break;case"40":newellipse.Radio=break;case"41"
13、:newellipse.PSAngle=break;case"42":newellipse.PEAngle=break;Double.Parse(str1);Double.Parse(str1);Double.Parse(str1);Double.Parse(str1);Double.Parse(str1);Double.Parse(str1);Double.Parse(str1);case"370":newellipse.lwidth=str1;break;case"0":EllipseList.Add(newellipse);re
14、turn;privatevoidReadLwpolyline()LWPOLYLINnEewlw=newLWPOLYLIN()E;while(str1!="ENDSEC)"str=ReadPair();switch(str0)case"8":newlw.LName=str1;break;case"370":newlw.lwidth=str1;break;case"62":newlw.colornum=str1;break;case"90":newlw.PointCount=Int32.Parse(
15、str1);break;case"70":newlw.Flag=Int32.Parse(str1);break;case"10":newlw.pointx=newdoublenewlw.PointCount;newlw.pointy=newdoublenewlw.PointCount;/if(newlw.Flag=1)newlw.converxity=newdoublenewlw.PointCount;/else/newlw.converxity=newdoublenewlw.PointCount-1;newlw.pointx0=Double.Parse
16、(str1);str=ReadPair();newlw.pointy0=Double.Parse(str1);for(inti=1;i<newlw.PointCount;i+)stringtemp=sr.ReadLine().Trim();if(temp="42")newlw.converxityi-1=Double.Parse(sr.ReadLine().Trim();i-;elseif(temp="20")stringr=sr.ReadLine().Trim();newlw.pointyi=Double.Parse(r);elsestringr
17、=sr.ReadLine().Trim();newlw.pointxi=Double.Parse(r);i-;strings=sr.ReadLine().Trim();if(s="42")newlw.converxitynewlw.PointCount-1=Double.Parse(sr.ReadLine().Trim();elseif(s="0")sr.ReadLine();LwopolylineList.Add(newlw);returnelsesr.ReadLine();break;case"0":LwopolylineList
18、.Add(newlw);return;publicvoidReadSpline()SPLINEnewspline=newSPLINE();while(str1!="ENDSEC)"str=ReadPair();switch(str0)case"8":newspline.LName=str1;break;case"370":newspline.lwidth=str1;break;case"62":newspline.colornum=str1;break;case"70":newspline.Fl
19、ag=Int32.Parse(str1);break;case"74":newspline.Count=Int32.Parse(str1);newspline.throughpx=newdoubleInt32.Parse(str1);newspline.throughpy=break;newdoubleInt32.Parse(str1);case"12":newspline.SVertorX=break;case"22":newspline.SVertorY=break;case"13":newspline.EVe
20、rtorX=break;case"23":newspline.EVertorY=break;Double.Parse(str1);Double.Parse(str1);Double.Parse(str1);Double.Parse(str1);case"11":newspline.throughpx0=Double.Parse(str1);str=ReadPair();newspline.throughpy0=str=ReadPair();Double.Parse(str1);for(inti=1;i<newspline.throughpx.Len
21、gth;i+)str=ReadPair();if(str0="11")newspline.throughpxi=Double.Parse(str1);i-;elseif(str0="21")newspline.throughpyi=i-;)if(newspline.Flag=11)(for(inti=0;i<3;i+)(str=ReadPair();)break;case"0":SplineList.Add(newspline);return;)publicvoidReadHeader()(while(str1!="E
22、NDSEQ"(str=ReadPair();switch(str1)(case"$EXTMINnstr=ReadPairQ;Double.Parse(str1);Double.Parse(str1);leftx=str=ReadPair();lefty=Double.Parse(str1);break;case"$EXTMAX"str=ReadPair();rightx=Double.Parse(str1);str=ReadPair();righty=Double.Parse(str1);break;)/打开DX改件privatevoidbtOpen_C
23、lick(objectsender,EventArgse)btDraw.Enabled=false;LayerList.Clear();LineList.Clear();ArcList.Clear();EllipseList.Clear();LwopolylineList.Clear();SplineList.Clear();this.openFileDialogl.ShowDialogO;if(this.openFileDialogl.FileName.Trim()!="")fs =sr =Read();stringpath=this.openFileDialog1.FileName;newFileStream(path,FileMode.Open,FileAccess.Read);newStreamReader(fs);privatevoidbtDraw_Click(objectsender,EventArgse)Math.Ceiling(leftx) + 40;Math.Ceiling(lefty) + 40; int )height);doublewi
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 1 我们爱整洁 (1)( 教学设计)2023-2024学年统编版道德与法治一年级下册
- 2024-2025学年新教材高中生物 第3章 细胞的代谢 第5节 第2课时 光合作用的过程与影响光合作用的环境因素教学实录 浙科版必修第一册
- 2025人教版小学四年级数学下册知识点全册教案
- 6《千人糕》教学设计-2023-2024学年统编版语文二年级下册
- 2024年六年级品社下册《让科学技术走进生活》教学实录2 冀教版
- 3 主动拒绝烟酒与毒品(教学设计)-2024-2025学年统编版道德与法治五年级上册
- 10 我们所了解的环境污染《从白色污染说起》(教学设计)-部编版道德与法治四年级上册
- 6-2金属的性质及应用-2024-2025学年九年级上学期沪教版(2024)教学设计
- 2 平行四边形的初步认识(教学设计)-2024-2025学年二年级上册数学 苏教版
- 2024-2025学年高中历史 第六单元 第3课 资产阶级民主革命的酝酿和爆发教学实录1 新人教版选修2
- 经典美味的宫保鸡丁
- 孤独症儿童心智解读能力
- 2023-2024学年人教版(2019)必修 第三册Unit 2 Morals and Virtues Reading and Thinking 课件(22张)
- 特需病房服务流程
- 横贯性脊髓炎演示课件
- 《警察现场急救》课件
- 于永正教育文集:于永正:我怎样教语文
- 阴道炎的预防和治疗
- 国家义务教育质量监测德育-道德与法治四年级创新作业测试卷附答案
- 零食店食品安全管理制度范本
- 检测试验项目计划
评论
0/150
提交评论