版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
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;)/打開(kāi)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. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2024年度貴州省安全員之B證(項(xiàng)目負(fù)責(zé)人)模擬考試試卷A卷含答案
- 2024年SMT波峰焊機(jī)項(xiàng)目發(fā)展計(jì)劃
- 2024年鉆孔應(yīng)變儀項(xiàng)目發(fā)展計(jì)劃
- 2024年現(xiàn)場(chǎng)總線儀表通訊模板項(xiàng)目發(fā)展計(jì)劃
- 2024年氣體檢測(cè)監(jiān)控系統(tǒng)項(xiàng)目合作計(jì)劃書(shū)
- 環(huán)保項(xiàng)目居間服務(wù)合同
- 足療館瓷磚鋪設(shè)服務(wù)協(xié)議
- 2024版福建省水產(chǎn)品購(gòu)銷(xiāo)合同-0
- 2024版房屋出租租賃合同范本
- 2024版杭州市貨物買(mǎi)賣(mài)合同
- 頸椎損傷的固定與搬運(yùn)操作評(píng)分標(biāo)準(zhǔn)
- 急救、生命支持醫(yī)療設(shè)備日常保養(yǎng)規(guī)程
- 初探在數(shù)學(xué)教學(xué)中如何培養(yǎng)學(xué)生的科學(xué)素養(yǎng)
- 畢業(yè)實(shí)踐活動(dòng)記錄表—土木工程(管理方向)(共2頁(yè))
- 柯氏四級(jí)評(píng)估模型
- 修睿喬杉小品西游記_5人西游記小品劇本
- 摩托車(chē)車(chē)架的焊接
- 瑞文高級(jí)推理測(cè)驗(yàn)(共24頁(yè))
- 我知誰(shuí)掌管明天PPT課件
- 防火封堵設(shè)計(jì)說(shuō)明及施工大樣圖
- 外研(一起)五年級(jí)上冊(cè)期中模擬測(cè)試英語(yǔ)試卷(附答案)
評(píng)論
0/150
提交評(píng)論