1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
-
-
- using Autodesk.AutoCAD.Geometry;
- using Autodesk.AutoCAD.DatabaseServices;
- using Autodesk.AutoCAD.ApplicationServices;
- using Autodesk.AutoCAD.EditorInput;
- using System.IO;
-
- namespace T_cad
- {
- class LSTKAllCls
- {
- public LSTKAllCls()
- {
-
- }
- /// <summary>
- /// 测试函数
- /// </summary>
- public void Function()
- {
- #region//后台打开一个dwg文件,最后用DataBase.saveas()进行保存
- try
- {
-
- //for (int i = 0; i < 10; i++)
- //{
- var filenamemuban = @"D:\test\1000tk.dwg";
- Database myDB = new Database(false, true);
- myDB.ReadDwgFile(filenamemuban, System.IO.FileShare.ReadWrite, false, "");
-
- ////选中所有对象进行平移
- using (var myTran = myDB.TransactionManager.StartTransaction())
- {
- var bt = (BlockTable)(myTran.GetObject(myDB.BlockTableId, OpenMode.ForWrite));
-
- foreach (ObjectId blid in bt)
- {
- var btr = (BlockTableRecord)(myTran.GetObject(blid, OpenMode.ForWrite));
- BlockTableRecordEnumerator btrenu = btr.GetEnumerator();
- while (btrenu.MoveNext())
- {
- ObjectId myobjid = btrenu.Current;
- Entity myentity = myTran.GetObject(myobjid, OpenMode.ForWrite) as Entity;
-
- //测试后台可否执行的代码
- //myentity.Color = Autodesk.AutoCAD.Colors.Color.FromColor(System.Drawing.Color.Blue);
- myentity.ColorIndex = 5;
-
- Point3d basept = new Point3d(0, 0, 0);
- Point3d targetpt = new Point3d(3000, 3000, 0);
- Vector3d vec = targetpt - basept;
- Matrix3d mt3d = Matrix3d.Displacement(vec);
- myentity.TransformBy(mt3d);
-
- // //平移代码
- // /// <summary>
- ///// 指定基点与目标移动实体
- ///// </summary>
- ///// <param name="ent">实体移动</param>
- ///// <param name="BasePt">基点</param>
- ///// <param name="TargetPt">目标点</param>
- //public static void Move(Entity ent, Point3d basePt, Point3d targetPt)
- //{
- //Vector3d vec = targetPt - basePt;
- //Matrix3d mt = Matrix3d.Displacement(vec);
- //ent.TransformBy(mt);
- //}
-
- }
- btrenu.Dispose();
- btr.Dispose();
- }
- bt.Dispose();
- myTran.Commit();
- myTran.Dispose();
- }
-
- var resultfilename = @"D:\test\result\1.dwg";
- //var resultfilename = @"D:\test\result\1000tk" + i.ToString() + ".dwg";
- myDB.SaveAs(resultfilename, DwgVersion.Current);
- myDB.CloseInput(true);
- myDB.Dispose();
-
- //}//end for
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.ToString());
- }
- #endregion/////////////
- }
-
-
- public void mianfunction()
- {
- FolderBrowserDialog fbd = new FolderBrowserDialog();
- fbd.Description = "请设置DOM路径";
- if (fbd.ShowDialog() == DialogResult.OK)
- {
- string pathdirectory = fbd.SelectedPath;
- DirectoryInfo di = new DirectoryInfo(pathdirectory);
- FileInfo[] fiarray = di.GetFiles();
- foreach (FileInfo fi in fiarray)
- {
- string filename = fi.FullName;
- if (filename.Contains(".tfw"))
- {
- DOMAndDWGfunction(fi);
- }
-
- }
- }
- MessageBox.Show("程序运行结束");
- }
- public void DOMAndDWGfunction(FileInfo fi)
- {
- string filename = fi.FullName;
- //读取tfwcode
- string tfwfilename = filename;
- string imageName = filename.Replace(".tfw", ".tif");
- string dwgfilename = filename.Replace(".tfw", ".dwg");
-
- string myName = fi.Name.Replace(".tfw", "");//图幅号名
-
- double scale = 0;
- double X = 0, Y = 0;
- try
- {
- StreamReader sr = new StreamReader(tfwfilename);
- scale = Convert.ToDouble(sr.ReadLine());
- sr.ReadLine();
- sr.ReadLine();
- sr.ReadLine();
- X = Convert.ToDouble(sr.ReadLine());
- Y = Convert.ToDouble(sr.ReadLine());
- sr.Close();
- sr.Dispose();
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.ToString ());
- }
-
-
- //移动dwg图框code
- //var filenamemuban = @"E:\2015Work\20150309DOM套图库程序\moban\1000lstk.dwg";
- var filenamemuban = @"E:\2015Work\20150309DOM套图库程序\moban\1000lstkcode.dwg";
- Database myDB = new Database(false, true);
- myDB.ReadDwgFile(filenamemuban, System.IO.FileShare.ReadWrite, false, "");
- myDB.CloseInput(true);
- //左上角坐标除去外扩
- double xmove = X + 10;
- double ymove = Y - 10;
-
- //左上 left top
- double xlt = xmove/1000.0;
- double ylt = ymove / 1000.0;
- string xltstr = xlt.ToString("f1");
- string yltstr = ylt.ToString("f1");
- //右上 right top
- double xrt = (xmove + 500) / 1000.0;
- double yrt = ymove / 1000.0;
- string xrtstr = xrt.ToString("f1");
- string yrtstr = yrt.ToString("f1");
- //左下 left bottom
- double xlb = xmove / 1000.0;
- double ylb = (ymove - 500) / 1000.0;
- string xlbstr = xlb.ToString("f1");
- string ylbstr = ylb.ToString("f1");
- //右下 right bottom
- double xrb = (xmove + 500) / 1000.0;
- double yrb = (ymove - 500) / 1000.0;
- string xrbstr = xrb.ToString("f1");
- string yrbstr = yrb.ToString("f1");
-
- ////X = 559000.000 Y = 3349500.000 Z = 2874.000
-
- ////选中所有对象进行平移
- using (var myTran = myDB.TransactionManager.StartTransaction())
- {
- try
- {
- var bt = (BlockTable)(myTran.GetObject(myDB.BlockTableId, OpenMode.ForWrite));
-
- foreach (ObjectId blid in bt)
- {
- var btr = (BlockTableRecord)(myTran.GetObject(blid, OpenMode.ForWrite));
- BlockTableRecordEnumerator btrenu = btr.GetEnumerator();
- while (btrenu.MoveNext())
- {
- ObjectId myobjid = btrenu.Current;
- Entity myentity = myTran.GetObject(myobjid, OpenMode.ForWrite) as Entity;
-
- //////测试后台可否执行的代码
- ////myentity.Color = Autodesk.AutoCAD.Colors.Color.FromColor(System.Drawing.Color.Blue);
- ////myentity.ColorIndex = 5;
- //////修改文字代码
- if (myentity is DBText)
- {
- DBText text = myentity as DBText;
- string str = text.TextString;
-
- switch (str)
- {
- case "aaaa":
- break;
- case "bbbb":
- break;
- case "cccc":
- break;
- case "eeee":
- break;
- case "ffff":
- break;
- case "xxxx":
- break;
- case "yyyy":
- break;
- case "zzzz":
- break;
- //case "Name":
- // text.TextString = "邻水县农村土地经营权DOM"; //"邻水县" + "XXX镇XXX村" + "农村土地经营权DOM";
- // break;
- case "ididid":
- text.TextString = myName;
- break;
- case "xlt":
- text.TextString = xltstr.Substring(0, xltstr.Length - 4);
- break;
- case "xlt2":
- text.TextString = xltstr.Substring(xltstr.Length - 4, 4);
- break;
- case "ylt":
- text.TextString = yltstr.Substring(0,yltstr .Length -5);
- break;
- case "ylt2":
- text.TextString = yltstr.Substring(yltstr.Length - 5, 5);
- break;
- case "xrt":
- text.TextString = xrtstr.Substring(0, xrtstr.Length - 4);
- break;
- case "xrt2":
- text.TextString = xrtstr.Substring(xrtstr.Length - 4, 4);
- break;
- case "yrt":
- text.TextString = yrtstr.Substring(0, yrtstr.Length - 5);
- break;
- case "yrt2":
- text.TextString = yrtstr.Substring(yrtstr.Length - 5, 5);
- break;
- case "xlb":
- text.TextString = xlbstr.Substring(0, xlbstr.Length - 4);
- break;
- case "xlb2":
- text.TextString = xlbstr.Substring(xlbstr.Length - 4, 4);
- break;
- case "ylb":
- text.TextString = ylbstr.Substring(0, ylbstr.Length - 5);
- break;
- case "ylb2":
- text.TextString = ylbstr.Substring( ylbstr.Length - 5,5);
- break;
- case "xrb":
- text.TextString = xrbstr.Substring(0, xrtstr.Length - 4);
- break;
- case "xrb2":
- text.TextString = xrbstr.Substring(xrbstr.Length - 4, 4);
- break;
- case "yrb":
- text.TextString = yrbstr.Substring(0, yrbstr.Length - 5);
- break;
- case "yrb2":
- text.TextString = yrbstr.Substring(yrbstr.Length - 5, 5);
- break;
- //case "":
- // break;
- default: break;
- }
- myentity = text;
- }
-
- Point3d basept = new Point3d(0, 0, 0);
- Point3d targetpt = new Point3d(xmove, ymove, 0);
- Vector3d vec = targetpt - basept;
- Matrix3d mt3d = Matrix3d.Displacement(vec);
- myentity.TransformBy(mt3d);
-
- }
- btrenu.Dispose();
- btr.Dispose();
- }
- bt.Dispose();
- myTran.Commit();
- myTran.Dispose();
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.ToString ());
- }
- }
-
- //////DOM
- //using (var myTran = myDB.TransactionManager.StartTransaction())
- //{
- // try
- // {
- // BlockTable blktbl = myTran.GetObject(myDB.BlockTableId, OpenMode.ForRead) as BlockTable;
- // BlockTableRecord blktblrec = myTran.GetObject(blktbl[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;
-
- // DrawOrderTable dot = myTran.GetObject(blktblrec.DrawOrderTableId, OpenMode.ForWrite) as DrawOrderTable;
-
- // //////////////////////创建图像定义对象
- // ObjectId imgid = RasterImageDef.GetImageDictionary(myDB);
-
- // if (imgid == ObjectId.Null)
- // imgid = RasterImageDef.CreateImageDictionary(myDB);
- // DBDictionary imgdict = myTran.GetObject(imgid, OpenMode.ForWrite) as DBDictionary;
- // RasterImageDef imgdef = new RasterImageDef();
- // imgdef.SourceFileName = imageName;
- // imgdef.Load();
- // ObjectId imgdefid = imgdict.SetAt(imageName, imgdef);
- // myTran.AddNewlyCreatedDBObject(imgdef, true);
-
-
- // RasterImage image = new RasterImage();
- // image.ImageDefId = imgdefid;
- // //image.Layer = "DOM";
- // blktblrec.AppendEntity(image);
- // myTran.AddNewlyCreatedDBObject(image, true);
-
- // double height = imgdef.Size.Y;
- // Vector3d vt1 = scale * image.Orientation.Xaxis;
- // Vector3d vt2 = scale * image.Orientation.Yaxis;
-
- // image.AssociateRasterDef(imgdef);
- // image.Draw();
- // image.Orientation = new CoordinateSystem3d(new Point3d(X, Y - height * scale, 0), vt1, vt2);
-
- // ObjectIdCollection obidcoll = new ObjectIdCollection();
- // //影像后置
- // obidcoll.Add(image.ObjectId);
- // dot.MoveToBottom(obidcoll);
- // obidcoll = new ObjectIdCollection();
-
- // myTran.Commit();
- // myTran.Dispose();
-
- // //Autodesk.AutoCAD.ApplicationServices.Application.UpdateScreen();
- // MessageBox.Show(imageName + "影像已按照参数正确加载;");
-
-
- // }
- // catch (Exception ex)
- // {
- // MessageBox.Show(ex.ToString());
- // }
-
- //}
-
- ////保存为dwg code
- var resultfilename = dwgfilename;
- ////var resultfilename = @"D:\test\result\1000tk" + i.ToString() + ".dwg";
- myDB.SaveAs(resultfilename, DwgVersion.Current);
- //myDB.CloseInput(true);
- myDB.Dispose();
- }
-
-
- public void DWGXiugai()
- {
- FolderBrowserDialog fbd = new FolderBrowserDialog();
- fbd.Description = "请设置成果路径";
- if (fbd.ShowDialog() == DialogResult.OK)
- {
- string pathdirectory = fbd.SelectedPath;
- DirectoryInfo di = new DirectoryInfo(pathdirectory);
- FileInfo[] fiarray = di.GetFiles();
- foreach (FileInfo fi in fiarray)
- {
- string filename = fi.FullName;
- if (filename.Contains(".dwg"))
- {
- //DOMAndDWGfunction(fi);
- DWGTextXiugai(fi);
- }
-
- }
- }
- MessageBox.Show("程序运行结束");
- }
-
- public void DWGTextXiugai(FileInfo fi)
- {
- var filenamemuban = fi.FullName;
- Database myDB = new Database(false, true);
- myDB.ReadDwgFile(filenamemuban, System.IO.FileShare.ReadWrite, false, "");
- //myDB.CloseInput(true);
-
- ////选中所有对象进行平移
- using (var myTran = myDB.TransactionManager.StartTransaction())
- {
- try
- {
- var bt = (BlockTable)(myTran.GetObject(myDB.BlockTableId, OpenMode.ForWrite));
-
-
- //int count = 0;
- foreach (ObjectId blid in bt)
- {
- var btr = (BlockTableRecord)(myTran.GetObject(blid, OpenMode.ForWrite));
- BlockTableRecordEnumerator btrenu = btr.GetEnumerator();
- while (btrenu.MoveNext())
- {
- ObjectId myobjid = btrenu.Current;
- Entity myentity = myTran.GetObject(myobjid, OpenMode.ForWrite) as Entity;
-
- //测试后台可否执行的代码
- //myentity.Color = Autodesk.AutoCAD.Colors.Color.FromColor(System.Drawing.Color.Blue);
- //myentity.ColorIndex = 5;
- ////修改文字代码
- if (myentity is DBText)
- {
- DBText text = myentity as DBText;
- string str = text.TextString;
- // switch (str)
- // {
- // // case " 201503":
- // // text.TextString = "";
- // // break;
- // // case "( )":
- // // text.TextString = "";
- // // break;
- // // ////////////////////////
-
-
-
- // // //case "邻水县八斗丘村农村土地经营权DOM":
- // // // text.TextString = "邻水县" + "柳塘乡"+"八斗坵村" + "农村土地承包经营权确权登记工作底图";
- // // // Point3d pt = text.Position;
- // // // text.Position = new Point3d(pt.X - 28, pt.Y, pt.Z);
- // // // break;
- // // //case "邻水县大步口村农村土地经营权DOM":
- // // // text.TextString = "邻水县" + "石滓乡" + "大步口村" + "农村土地承包经营权确权登记工作底图";
- // // // Point3d pt = text.Position;
- // // // text.Position = new Point3d(pt.X - 28, pt.Y, pt.Z);
- // // // break;
- // // //case "邻水县大河坝村农村土地经营权DOM":
- // // // text.TextString = "邻水县" + "柳塘乡" + "大河坝村" + "农村土地承包经营权确权登记工作底图";
- // // // Point3d pt = text.Position;
- // // // text.Position = new Point3d(pt.X - 28, pt.Y, pt.Z);
- // // // break;
- // // //case "邻水县沙帽石村农村土地经营权DOM":
- // // // text.TextString = "邻水县" + "柳塘乡" + "沙帽石村" + "农村土地承包经营权确权登记工作底图";
- // // // Point3d pt = text.Position;
- // // // text.Position = new Point3d(pt.X - 28, pt.Y, pt.Z);
- // // // break;
- // // //case "邻水县双桥居委会农村土地经营权DOM":
- // // // text.TextString = "邻水县" + "柳塘乡" + "双桥居委会" + "农村土地承包经营权确权登记工作底图";
- // // // Point3d pt = text.Position;
- // // // text.Position = new Point3d(pt.X - 28, pt.Y, pt.Z);
- // // // break;
- // // //case "邻水县雄码头村农村土地经营权DOM":
- // // // text.TextString = "邻水县" + "柳塘乡" + "雄码头村" + "农村土地承包经营权确权登记工作底图";
- // // // Point3d pt = text.Position;
- // // // text.Position = new Point3d(pt.X - 28, pt.Y, pt.Z);
- // // // break;
-
-
-
-
- // // //////////////////
- // // case "邻水县袁市镇增产村农村土地经营权DOM":
- // // text.TextString = "邻水县" + "袁市镇" + "增产村" + "农村土地承包经营权确权登记工作底图";
- // // Point3d pt = text.Position;
- // // text.Position = new Point3d(pt.X - 28, pt.Y, pt.Z);
- // // break;
-
- // // case "投影方式:高斯投影。中央子午线106.5度。":
- // // text.TextString = "国家2000坐标系。";
- // // break;
- // // case "国家2000坐标系。":
- // // text.TextString = "投影方式:高斯投影,中央子午线经度106.5。";
- // // break;
- // // case "1985年黄海高程系。":
- // // text.TextString = "1985国家高程系统。";
- // // break;
- // // case "2015年03月数字成图。":
- // // text.TextString = "影像2015年01月摄。";
- // // break;
- // // case "测图员 ":
- // // text.TextString = "调绘者: ";
- // // break;
- // // case "土调员 ":
- // // text.TextString = "指界人: ";
- // // break;
- // // case "数化员 ":
- // // text.TextString = "组长联系方式:";
- // // break;
- // // case "检查员 ":
- // // text.TextString = "";
- // // break;
- // // case "复查员 ":
- // // text.TextString = "";
- // // break;
- // ////////////////////////////
-
-
-
- // /////////////////////////////
- // //case "投影方式:高斯投影。":
- // // text.TextString = "国家2000坐标系。";
- // // break;
- // //case "国家2000坐标系。":
- // // text.TextString = "投影方式:高斯投影,中央子午线经度106.5。";
- // // break;
- // //case "1985年黄海高程系。":
- // // text.TextString = "1985国家高程系统。";
- // // break;
- // //case "2015年03月数字成图。":
- // // text.TextString = "影像2015年01月摄。";
- // // break;
- // //case "数化员 陈步清":
- // // text.TextString = "调绘者: ";
- // // break;
- // //case "检查员 李 敏":
- // // text.TextString = "指界人: ";
- // // break;
- // //case "复查员 ":
- // // text.TextString = "组长联系方式:";
- // // break;
-
- // case "影像2015年01月摄。":
- // text.TextString = "2015年01月摄。";
- // break;
- // default: break;
- // }
-
- switch (str)
- {
- //case "投影方式:高斯投影,中央子午线经度106.5。":
- // if (count == 0)
- // text.TextString = "国家2000坐标系。";
- // count++;
-
- // break ;
- //case "投影方式:高斯投影,中央子午线经度106.5。":
- // text.TextString = "国家2000坐标系。";
- // break;
- //case "国家2000坐标系。":
- // text.TextString = "投影方式:高斯投影,中央子午线经度106.5。";
- // break;
- case "邻水县八斗坵村农村土地经营权DOM":
- text.TextString = "邻水县柳塘乡八斗坵村农村土地承包经营权确权登记工作底图";
- break;
- default :break ;
- }
- myentity = text;
- }
-
- }
- btrenu.Dispose();
- btr.Dispose();
- }
- bt.Dispose();
- myTran.Commit();
- myTran.Dispose();
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.ToString());
- }
- }
-
-
-
- ////保存为dwg code
- //var resultfilename = dwgfilename;
- ////var resultfilename = @"D:\test\result\1000tk" + i.ToString() + ".dwg";
- myDB.SaveAs(filenamemuban, DwgVersion.Current);
- //myDB.CloseInput(true);
- myDB.Dispose();
- }
-
- public void openfunction()
- {
- try
- {
- //for (int i = 0; i < 10; i++)
- //{
- var filenamemuban = @"D:\test\1000tk.dwg";
- //Document document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
-
- var docMgr = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager;
- var doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.Open(filenamemuban);
- docMgr.MdiActiveDocument = doc;
-
- //doc.Editor.WriteMessage("文档已打开0.0");
-
- var resultfilename = @"D:\test\result\1.dwg";
- //var resultfilename = @"D:\test\result\1000tk"+i.ToString ()+".dwg";
- //doc.CloseAndSave(resultfilename);
-
- //Database db= doc.Database;
- Database database = HostApplicationServices.WorkingDatabase;
- database.SaveAs(resultfilename, DwgVersion.Current);
-
-
-
- //}
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.ToString());
- }
- }
-
-
- /// <summary>
- /// 20150611code
- /// </summary>
- public void DGWTKfunctionnew ()
- {
-
- //OpenFileDialog ofd = new OpenFileDialog();
- //if (ofd.ShowDialog() == DialogResult.OK)
- //{
- char[] chspilt = new char[] { ',' };
- try
- {
- //string fileresult = ofd.FileName;
- string fileresult = @"H:\2015Work\20150309DOMLS_TKCode\moban\myResult.txt";
- string outfilapth = @"H:\2015Work\20150309DOMLS_TKCode\DWGResult\";
- StreamReader sr = new StreamReader(fileresult);
-
- ////////
- int i = 0;
- while (sr.Peek() != -1)
- {
- //i++;
- //if (i > 2)
- // break;
- string temp = sr.ReadLine();
- string[] spilt = temp.Split(chspilt, StringSplitOptions.RemoveEmptyEntries);
- if (spilt.Length >= 11)
- {
- string name = spilt[0];
- double minX = Convert.ToDouble(spilt[1]);
- double minY = Convert.ToDouble(spilt[2]);
- string name1 = spilt[3];
- string name2 = spilt[4];
- string name3 = spilt[5];
- string name4 = spilt[6];
- string name5 = spilt[7];
- string name6 = spilt[8];
- string name7 = spilt[9];
- string name8 = spilt[10];
-
- string dwgfilename = outfilapth + name+".dwg";
- {
- //移动dwg图框code
- //var filenamemuban = @"E:\2015Work\20150309DOM套图库程序\moban\1000lstk.dwg";
- var filenamemuban = @"H:\2015Work\20150309DOMLS_TKCode\moban\1000lstkcode.dwg";
- Database myDB = new Database(false, true);
- myDB.ReadDwgFile(filenamemuban, System.IO.FileShare.ReadWrite, false, "");
- myDB.CloseInput(true);
- //左下角坐标
- double xmove = minX;
- double ymove =minY;
-
- double len = 500;
-
-
- //左上 left top
- double xlt = minX / 1000.0;
- double ylt = (minY +len) / 1000.0;
- string xltstr = xlt.ToString("f1");
- string yltstr = ylt.ToString("f1");
- //右上 right top
- double xrt = (minX +len) / 1000.0;
- double yrt = (minY+len) / 1000.0;
- string xrtstr = xrt.ToString("f1");
- string yrtstr = yrt.ToString("f1");
- //左下 left bottom
- double xlb = minX / 1000.0;
- double ylb = minY/ 1000.0;
- string xlbstr = xlb.ToString("f1");
- string ylbstr = ylb.ToString("f1");
- //右下 right bottom
- double xrb = (minX+len) / 1000.0;
- double yrb = minY/ 1000.0;
- string xrbstr = xrb.ToString("f1");
- string yrbstr = yrb.ToString("f1");
-
- ////X = 559000.000 Y = 3349500.000 Z = 2874.000
- ////左上角坐标除去外扩
- //double xmove = X + 10;
- //double ymove = Y - 10;
-
- ////左上 left top
- //double xlt = xmove / 1000.0;
- //double ylt = ymove / 1000.0;
- //string xltstr = xlt.ToString("f1");
- //string yltstr = ylt.ToString("f1");
- ////右上 right top
- //double xrt = (xmove + 500) / 1000.0;
- //double yrt = ymove / 1000.0;
- //string xrtstr = xrt.ToString("f1");
- //string yrtstr = yrt.ToString("f1");
- ////左下 left bottom
- //double xlb = xmove / 1000.0;
- //double ylb = (ymove - 500) / 1000.0;
- //string xlbstr = xlb.ToString("f1");
- //string ylbstr = ylb.ToString("f1");
- ////右下 right bottom
- //double xrb = (xmove + 500) / 1000.0;
- //double yrb = (ymove - 500) / 1000.0;
- //string xrbstr = xrb.ToString("f1");
- //string yrbstr = yrb.ToString("f1");
-
- //////X = 559000.000 Y = 3349500.000 Z = 2874.000
-
- ////选中所有对象进行平移
- using (var myTran = myDB.TransactionManager.StartTransaction())
- {
- try
- {
- var bt = (BlockTable)(myTran.GetObject(myDB.BlockTableId, OpenMode.ForWrite));
-
- foreach (ObjectId blid in bt)
- {
- var btr = (BlockTableRecord)(myTran.GetObject(blid, OpenMode.ForWrite));
- BlockTableRecordEnumerator btrenu = btr.GetEnumerator();
- while (btrenu.MoveNext())
- {
- ObjectId myobjid = btrenu.Current;
- Entity myentity = myTran.GetObject(myobjid, OpenMode.ForWrite) as Entity;
-
- //////测试后台可否执行的代码
- ////myentity.Color = Autodesk.AutoCAD.Colors.Color.FromColor(System.Drawing.Color.Blue);
- ////myentity.ColorIndex = 5;
- //////修改文字代码
- if (myentity is DBText)
- {
- DBText text = myentity as DBText;
- string str = text.TextString;
-
- switch (str)
- {
- case "name1":
- if (name1 == "NULL")
- text.TextString = " ";
- else
- text.TextString =name1;
- break;
- case "name2":
- if (name2 == "NULL")
- text.TextString = " ";
- else
- text.TextString =name2;
- break;
- case "name3":
- if (name3 == "NULL")
- text.TextString = " ";
- else
- text.TextString =name3;
- break;
- case "name4":
- if (name4 == "NULL")
- text.TextString = " ";
- else
- text.TextString =name4;
- break;
- case "name5":
- if (name5 == "NULL")
- text.TextString = " ";
- else
- text.TextString =name5;
- break;
- case "name6":
- if (name6 == "NULL")
- text.TextString = " ";
- else
- text.TextString = name6;
- break;
- case "name7":
- if (name7 == "NULL")
- text.TextString = " ";
- else
- text.TextString =name7;
- break;
- case "name8":
- if (name8 == "NULL")
- text.TextString = " ";
- else
- text.TextString =name8;
- break;
- //case "Name":
- // text.TextString = "邻水县农村土地经营权DOM"; //"邻水县" + "XXX镇XXX村" + "农村土地经营权DOM";
- // break;
- case "(ididid)":
- text.TextString = "("+name+")";
- break;
- case "xlt":
- text.TextString = xltstr.Substring(0, xltstr.Length - 4);
- break;
- case "xlt2":
- text.TextString = xltstr.Substring(xltstr.Length - 4, 4);
- break;
- case "ylt":
- text.TextString = yltstr.Substring(0, yltstr.Length - 5);
- break;
- case "ylt2":
- text.TextString = yltstr.Substring(yltstr.Length - 5, 5);
- break;
- case "xrt":
- text.TextString = xrtstr.Substring(0, xrtstr.Length - 4);
- break;
- case "xrt2":
- text.TextString = xrtstr.Substring(xrtstr.Length - 4, 4);
- break;
- case "yrt":
- text.TextString = yrtstr.Substring(0, yrtstr.Length - 5);
- break;
- case "yrt2":
- text.TextString = yrtstr.Substring(yrtstr.Length - 5, 5);
- break;
- case "xlb":
- text.TextString = xlbstr.Substring(0, xlbstr.Length - 4);
- break;
- case "xlb2":
- text.TextString = xlbstr.Substring(xlbstr.Length - 4, 4);
- break;
- case "ylb":
- text.TextString = ylbstr.Substring(0, ylbstr.Length - 5);
- break;
- case "ylb2":
- text.TextString = ylbstr.Substring(ylbstr.Length - 5, 5);
- break;
- case "xrb":
- text.TextString = xrbstr.Substring(0, xrtstr.Length - 4);
- break;
- case "xrb2":
- text.TextString = xrbstr.Substring(xrbstr.Length - 4, 4);
- break;
- case "yrb":
- text.TextString = yrbstr.Substring(0, yrbstr.Length - 5);
- break;
- case "yrb2":
- text.TextString = yrbstr.Substring(yrbstr.Length - 5, 5);
- break;
- //case "":
- // break;
- default: break;
- }
- myentity = text;
- }
-
- Point3d basept = new Point3d(0, 0, 0);
- Point3d targetpt = new Point3d(xmove, ymove, 0);
- Vector3d vec = targetpt - basept;
- Matrix3d mt3d = Matrix3d.Displacement(vec);
- myentity.TransformBy(mt3d);
-
- }
- btrenu.Dispose();
- btr.Dispose();
- }
- bt.Dispose();
- myTran.Commit();
- myTran.Dispose();
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.ToString());
- }
- }
-
- //////DOM
- //using (var myTran = myDB.TransactionManager.StartTransaction())
- //{
- // try
- // {
- // BlockTable blktbl = myTran.GetObject(myDB.BlockTableId, OpenMode.ForRead) as BlockTable;
- // BlockTableRecord blktblrec = myTran.GetObject(blktbl[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;
-
- // DrawOrderTable dot = myTran.GetObject(blktblrec.DrawOrderTableId, OpenMode.ForWrite) as DrawOrderTable;
-
- // //////////////////////创建图像定义对象
- // ObjectId imgid = RasterImageDef.GetImageDictionary(myDB);
-
- // if (imgid == ObjectId.Null)
- // imgid = RasterImageDef.CreateImageDictionary(myDB);
- // DBDictionary imgdict = myTran.GetObject(imgid, OpenMode.ForWrite) as DBDictionary;
- // RasterImageDef imgdef = new RasterImageDef();
- // imgdef.SourceFileName = imageName;
- // imgdef.Load();
- // ObjectId imgdefid = imgdict.SetAt(imageName, imgdef);
- // myTran.AddNewlyCreatedDBObject(imgdef, true);
-
-
- // RasterImage image = new RasterImage();
- // image.ImageDefId = imgdefid;
- // //image.Layer = "DOM";
- // blktblrec.AppendEntity(image);
- // myTran.AddNewlyCreatedDBObject(image, true);
-
- // double height = imgdef.Size.Y;
- // Vector3d vt1 = scale * image.Orientation.Xaxis;
- // Vector3d vt2 = scale * image.Orientation.Yaxis;
-
- // image.AssociateRasterDef(imgdef);
- // image.Draw();
- // image.Orientation = new CoordinateSystem3d(new Point3d(X, Y - height * scale, 0), vt1, vt2);
-
- // ObjectIdCollection obidcoll = new ObjectIdCollection();
- // //影像后置
- // obidcoll.Add(image.ObjectId);
- // dot.MoveToBottom(obidcoll);
- // obidcoll = new ObjectIdCollection();
-
- // myTran.Commit();
- // myTran.Dispose();
-
- // //Autodesk.AutoCAD.ApplicationServices.Application.UpdateScreen();
- // MessageBox.Show(imageName + "影像已按照参数正确加载;");
-
-
- // }
- // catch (Exception ex)
- // {
- // MessageBox.Show(ex.ToString());
- // }
-
- //}
-
- ////保存为dwg code
- var resultfilename = dwgfilename;
- ////var resultfilename = @"D:\test\result\1000tk" + i.ToString() + ".dwg";
- myDB.SaveAs(resultfilename, DwgVersion.Current);
- //myDB.CloseInput(true);
- myDB.Dispose();
-
- }
- }
- }
-
- }
- catch (Exception ex0)
- {
- MessageBox.Show(ex0.ToString());
- }
- //}
- //else
- // return;
-
-
- }
- ///end
- ///
- public string str3(string strpama)
- {
- if (strpama == "NULL")
- { return strpama; }
- else
- { return strpama.Substring(strpama.Length - 3); }
- }
- /// <summary>
- /// 20200807code
- /// 20230301 update
- /// </summary>
- public void DGWTKfunction2020()
- {
-
- //OpenFileDialog ofd = new OpenFileDialog();
- //if (ofd.ShowDialog() == DialogResult.OK)
- //{
- char[] chspilt = new char[] { ',' };
- try
- {
-
- Document document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
- Database database = HostApplicationServices.WorkingDatabase;
- PromptStringOptions pStrOpts = new PromptStringOptions("\nEnter daihao 代号(默认无代号): ");
- pStrOpts.AllowSpaces = true;
- PromptResult pStrRes = document.Editor.GetString(pStrOpts);
- //代号
- string ssssssss = pStrRes.StringResult;
- //MessageBox.Show(ssssssss);
- pStrOpts = new PromptStringOptions("\nEnter 小数位数(默认为2位): ");
- pStrOpts.AllowSpaces = true;
- pStrRes = document.Editor.GetString(pStrOpts);
- //小数位数
- string xsws = pStrRes.StringResult;
- string ffff111222="f2";
- if (xsws == "1")
- ffff111222 = "f1";
-
- //////////////////////////////////////////////////////
-
- //////////////////////////////////////////////////////
- //string fileresult = ofd.FileName;
- string fileresult = "";
- string filenamemuban = "";
- OpenFileDialog ofd = new OpenFileDialog();
- ofd.Title = "请选择导出的txt文件";
- if (ofd.ShowDialog() == DialogResult.OK)
- {
- fileresult = ofd.FileName;
- }
- else
- return;
- ofd.Dispose();
- OpenFileDialog od222 = new OpenFileDialog();
- od222.Title = "请选择模板.dwg文件";
- if (od222.ShowDialog() == DialogResult.OK)
- {
- filenamemuban = od222.FileName;
- }
- else
- return;
- od222.Dispose();
- string outfilapth = Path.GetDirectoryName(fileresult);
- StreamReader sr = new StreamReader(fileresult);
-
- ////////
- int i = 0;
- while (sr.Peek() != -1)
- {
- //i++;
- //if (i > 2)
- // break;
- string temp = sr.ReadLine();
- string[] spilt = temp.Split(chspilt, StringSplitOptions.RemoveEmptyEntries);
- if (spilt.Length >= 11)
- {
- string name = spilt[0];
- double minX = Convert.ToDouble(spilt[1]);
- double minY = Convert.ToDouble(spilt[2]);
- double maxX = Convert.ToDouble(spilt[3]);
- double maxY = Convert.ToDouble(spilt[4]);
- string name1 = spilt[5];
- string name2 = spilt[6];
- string name3 = spilt[7];
- string name4 = spilt[8];
- string name5 = spilt[9];
- string name6 = spilt[10];
- string name7 = spilt[11];
- string name8 = spilt[12];
- /////////////////////////
- /////////////////////////
- string dwgfilename = outfilapth + "\\"+name + ".dwg";
- //MessageBox.Show(dwgfilename);
- {
- //移动dwg图框code
- //var filenamemuban = @"E:\2015Work\20150309DOM套图库程序\moban\1000lstk.dwg";
- Database myDB = new Database(false, true);
- myDB.ReadDwgFile(filenamemuban, System.IO.FileShare.ReadWrite, false, "");
- myDB.CloseInput(true);
- //左下角坐标
- double xmove = minX;
- double ymove = minY;
- Point3d basept = new Point3d(0, 0, 0);
- Point3d targetpt = new Point3d(xmove, ymove, 0);
- Vector3d vec = targetpt - basept;
- Matrix3d mt3d = Matrix3d.Displacement(vec);
-
- //double len = 500;
-
- ////左上 left top 2020 code
- //double xlt = minX / 1000.0;
- //double ylt = maxY / 1000.0;
- //string xltstr = xlt.ToString("f1");
- //string yltstr = ylt.ToString("f1");
- ////右上 right top
- //double xrt = maxX / 1000.0;
- //double yrt = maxY / 1000.0;
- //string xrtstr = xrt.ToString("f1");
- //string yrtstr = yrt.ToString("f1");
- ////左下 left bottom
- //double xlb = minX / 1000.0;
- //double ylb = minY / 1000.0;
- //string xlbstr = xlb.ToString("f1");
- //string ylbstr = ylb.ToString("f1");
- ////右下 right bottom
- //double xrb =maxX / 1000.0;
- //double yrb = minY / 1000.0;
- //string xrbstr = xrb.ToString("f1");
- //string yrbstr = yrb.ToString("f1");
-
- ////左上 left top
- //double xlt = minX / 1000.0;
- //double ylt = maxY / 1000.0;
- //string xltstr = xlt.ToString("f2");
- //string yltstr = ylt.ToString("f2");
- ////右上 right top
- //double xrt = maxX / 1000.0;
- //double yrt = maxY / 1000.0;
- //string xrtstr = xrt.ToString("f2");
- //string yrtstr = yrt.ToString("f2");
- ////左下 left bottom
- //double xlb = minX / 1000.0;
- //double ylb = minY / 1000.0;
- //string xlbstr = xlb.ToString("f2");
- //string ylbstr = ylb.ToString("f2");
- ////右下 right bottom
- //double xrb = maxX / 1000.0;
- //double yrb = minY / 1000.0;
- //string xrbstr = xrb.ToString("f2");
- //string yrbstr = yrb.ToString("f2");
-
- //左上 left top 2021 code
- double xlt = minX / 1000.0;
- double ylt = maxY / 1000.0;
- string xltstr = xlt.ToString(ffff111222);
- string yltstr = ylt.ToString(ffff111222);
- //右上 right top
- double xrt = maxX / 1000.0;
- double yrt = maxY / 1000.0;
- string xrtstr = xrt.ToString(ffff111222);
- string yrtstr = yrt.ToString(ffff111222);
- //左下 left bottom
- double xlb = minX / 1000.0;
- double ylb = minY / 1000.0;
- string xlbstr = xlb.ToString(ffff111222);
- string ylbstr = ylb.ToString(ffff111222);
- //右下 right bottom
- double xrb = maxX / 1000.0;
- double yrb = minY / 1000.0;
- string xrbstr = xrb.ToString(ffff111222);
- string yrbstr = yrb.ToString(ffff111222);
-
- //////////////////////////////////////////////////////
-
- //////////////////////////////////////////////////////
- string daihao = ssssssss;
-
- //////////////////////////////////////////////////////
-
- //////////////////////////////////////////////////////
- #region//old 2020 code
- //////选中所有对象进行平移
- //using (var myTran = myDB.TransactionManager.StartTransaction())
- //{
- // try
- // {
- // var bt = (BlockTable)(myTran.GetObject(myDB.BlockTableId, OpenMode.ForWrite));
-
- // foreach (ObjectId blid in bt)
- // {
- // var btr = (BlockTableRecord)(myTran.GetObject(blid, OpenMode.ForWrite));
- // BlockTableRecordEnumerator btrenu = btr.GetEnumerator();
- // while (btrenu.MoveNext())
- // {
- // ObjectId myobjid = btrenu.Current;
- // Entity myentity = myTran.GetObject(myobjid, OpenMode.ForWrite) as Entity;
- // //////测试后台可否执行的代码
- // ////myentity.Color = Autodesk.AutoCAD.Colors.Color.FromColor(System.Drawing.Color.Blue);
- // ////myentity.ColorIndex = 5;
- // //////修改文字代码
- // if (myentity is DBText)
- // {
- // DBText text = myentity as DBText;
- // string str = text.TextString;
-
- // #region
- // switch (str)
- // {
- // case "name1":
- // if (name1 == "NULL")
- // text.TextString = " ";
- // else
- // text.TextString = name1;
- // break;
- // case "name2":
- // if (name2 == "NULL")
- // text.TextString = " ";
- // else
- // text.TextString = name2;
- // break;
- // case "name3":
- // if (name3 == "NULL")
- // text.TextString = " ";
- // else
- // text.TextString = name3;
- // break;
- // case "name4":
- // if (name4 == "NULL")
- // text.TextString = " ";
- // else
- // text.TextString = name4;
- // break;
- // case "name5":
- // if (name5 == "NULL")
- // text.TextString = " ";
- // else
- // text.TextString = name5;
- // break;
- // case "name6":
- // if (name6 == "NULL")
- // text.TextString = " ";
- // else
- // text.TextString = name6;
- // break;
- // case "name7":
- // if (name7 == "NULL")
- // text.TextString = " ";
- // else
- // text.TextString = name7;
- // break;
- // case "name8":
- // if (name8 == "NULL")
- // text.TextString = " ";
- // else
- // text.TextString = name8;
- // break;
- // //case "Name":
- // // text.TextString = "邻水县农村土地经营权DOM"; //"邻水县" + "XXX镇XXX村" + "农村土地经营权DOM";
- // // break;
- // //case "ididid":
- // // //text.TextString = "(" + name + ")";
- // // //text.TextString = name .Substring(name.Length - 3);
- // // text.TextString = name;
- // // break;
- // case "(ididid)":
- // //text.TextString = "(" + name + ")";
- // //text.TextString = name .Substring(name.Length - 3);
- // text.TextString = "("+name+")";
- // break;
- // case "xlt":
- // //text.TextString =daihao+ xltstr.Substring(0, xltstr.Length - 4);
- // text.TextString = daihao + xltstr.Substring(0, xltstr.Length - 5);
- // break;
- // case "xlt2":
- // //text.TextString = xltstr.Substring(xltstr.Length - 4, 4);
- // text.TextString = xltstr.Substring(xltstr.Length - 5, 5);
- // break;
- // case "ylt":
- // text.TextString = yltstr.Substring(0, yltstr.Length - 5);
- // //text.TextString = yltstr.Substring(0, yltstr.Length - 4);
- // break;
- // case "ylt2":
- // text.TextString = yltstr.Substring(yltstr.Length - 5, 5);
- // //text.TextString = yltstr.Substring(yltstr.Length - 4, 4);
- // break;
- // case "xrt":
- // //text.TextString = daihao + xrtstr.Substring(0, xrtstr.Length - 4);
- // text.TextString = daihao + xrtstr.Substring(0, xrtstr.Length - 5);
- // break;
- // case "xrt2":
- // //text.TextString = xrtstr.Substring(xrtstr.Length - 4, 4);
- // text.TextString = xrtstr.Substring(xrtstr.Length - 5, 5);
- // break;
- // case "yrt":
- // text.TextString = yrtstr.Substring(0, yrtstr.Length - 5);
- // //text.TextString = yrtstr.Substring(0, yrtstr.Length - 4);
- // break;
- // case "yrt2":
- // text.TextString = yrtstr.Substring(yrtstr.Length - 5, 5);
- // //text.TextString = yrtstr.Substring(yrtstr.Length - 4, 4);
- // break;
- // case "xlb":
- // //text.TextString = daihao + xlbstr.Substring(0, xlbstr.Length - 4);
- // text.TextString = daihao + xlbstr.Substring(0, xlbstr.Length - 5);
- // break;
- // case "xlb2":
- // //text.TextString = xlbstr.Substring(xlbstr.Length - 4, 4);
- // text.TextString = xlbstr.Substring(xlbstr.Length - 5, 5);
- // break;
- // case "ylb":
- // text.TextString = ylbstr.Substring(0, ylbstr.Length - 5);
- // //text.TextString = ylbstr.Substring(0, ylbstr.Length - 4);
- // break;
- // case "ylb2":
- // text.TextString = ylbstr.Substring(ylbstr.Length - 5, 5);
- // //text.TextString = ylbstr.Substring(ylbstr.Length - 4, 4);
- // break;
- // case "xrb":
- // //text.TextString = daihao + xrbstr.Substring(0, xrtstr.Length - 4);
- // text.TextString = daihao + xrbstr.Substring(0, xrtstr.Length - 5);
- // break;
- // case "xrb2":
- // //text.TextString = xrbstr.Substring(xrbstr.Length - 4, 4);
- // text.TextString = xrbstr.Substring(xrbstr.Length - 5, 5);
- // break;
- // case "yrb":
- // text.TextString = yrbstr.Substring(0, yrbstr.Length - 5);
- // //text.TextString = yrbstr.Substring(0, yrbstr.Length - 4);
- // break;
- // case "yrb2":
- // text.TextString = yrbstr.Substring(yrbstr.Length - 5, 5);
- // //text.TextString = yrbstr.Substring(yrbstr.Length - 4, 4);
- // break;
- // //case "":
- // // break;
- // default: break;
- // }
- // #endregion
- // myentity = text;
- // }
- // myentity.TransformBy(mt3d);
- // }
- // btrenu.Dispose();
- // btr.Dispose();
- // }
- // bt.Dispose();
- // myTran.Commit();
- // myTran.Dispose();
- // }
- // catch (Exception ex)
- // {
- // MessageBox.Show(ex.ToString());
- // }
- //}
- #endregion
-
- #region//old 2021 2023 code
- // 2023 edit code
- ////选中所有对象进行平移
- using (var myTran = myDB.TransactionManager.StartTransaction())
- {
- try
- {
- var bt = (BlockTable)(myTran.GetObject(myDB.BlockTableId, OpenMode.ForWrite));
-
- foreach (ObjectId blid in bt)
- {
- var btr = (BlockTableRecord)(myTran.GetObject(blid, OpenMode.ForWrite));
- BlockTableRecordEnumerator btrenu = btr.GetEnumerator();
- while (btrenu.MoveNext())
- {
- ObjectId myobjid = btrenu.Current;
- Entity myentity = myTran.GetObject(myobjid, OpenMode.ForWrite) as Entity;
- //////测试后台可否执行的代码
- ////myentity.Color = Autodesk.AutoCAD.Colors.Color.FromColor(System.Drawing.Color.Blue);
- ////myentity.ColorIndex = 5;
- //////修改文字代码
- if (myentity is DBText)
- {
- DBText text = myentity as DBText;
- string str = text.TextString;
-
- #region
- switch (str)
- {
- case "name1":
- if (name1 == "NULL")
- text.TextString = " ";
- else
- text.TextString = name1;
- break;
- case "name2":
- if (name2 == "NULL")
- text.TextString = " ";
- else
- text.TextString = name2;
- break;
- case "name3":
- if (name3 == "NULL")
- text.TextString = " ";
- else
- text.TextString = name3;
- break;
- case "name4":
- if (name4 == "NULL")
- text.TextString = " ";
- else
- text.TextString = name4;
- break;
- case "name5":
- if (name5 == "NULL")
- text.TextString = " ";
- else
- text.TextString = name5;
- break;
- case "name6":
- if (name6 == "NULL")
- text.TextString = " ";
- else
- text.TextString = name6;
- break;
- case "name7":
- if (name7 == "NULL")
- text.TextString = " ";
- else
- text.TextString = name7;
- break;
- case "name8":
- if (name8 == "NULL")
- text.TextString = " ";
- else
- text.TextString = name8;
- break;
- //case "Name":
- // text.TextString = "邻水县农村土地经营权DOM"; //"邻水县" + "XXX镇XXX村" + "农村土地经营权DOM";
- // break;
- //case "ididid":
- // //text.TextString = "(" + name + ")";
- // //text.TextString = name .Substring(name.Length - 3);
- // text.TextString = name;
- // break;
- case "(ididid)":
- //text.TextString = "(" + name + ")";
- //text.TextString = name .Substring(name.Length - 3);
- text.TextString = "(" + name + ")";
- break;
- case "xlt":
- //text.TextString = daihao + xltstr.Substring(0, xltstr.Length - 4);
- text.TextString = daihao + xltstr.Substring(0, xltstr.Length - 5);
- if (xsws == "1")
- text.TextString = daihao + xltstr.Substring(0, xltstr.Length - 4);
- break;
- case "xlt2":
- //text.TextString = xltstr.Substring(xltstr.Length - 4, 4);
- text.TextString = xltstr.Substring(xltstr.Length - 5, 5);
- if (xsws == "1")
- text.TextString = xltstr.Substring(xltstr.Length - 4, 4);
- break;
- case "ylt":
- text.TextString = yltstr.Substring(0, yltstr.Length - 5);
- if (xsws == "1")
- text.TextString = yltstr.Substring(0, yltstr.Length - 4);
- //text.TextString = yltstr.Substring(0, yltstr.Length - 4);
- break;
- case "ylt2":
- text.TextString = yltstr.Substring(yltstr.Length - 5, 5);
- //text.TextString = yltstr.Substring(yltstr.Length - 4, 4);
- if (xsws == "1")
- text.TextString = yltstr.Substring(yltstr.Length - 4, 4);
- break;
- case "xrt":
- //text.TextString = daihao + xrtstr.Substring(0, xrtstr.Length - 4);
- text.TextString = daihao + xrtstr.Substring(0, xrtstr.Length - 5);
- if (xsws == "1")
- text.TextString = daihao + xrtstr.Substring(0, xrtstr.Length - 4);
- break;
- case "xrt2":
- //text.TextString = xrtstr.Substring(xrtstr.Length - 4, 4);
- text.TextString = xrtstr.Substring(xrtstr.Length - 5, 5);
- if (xsws == "1")
- text.TextString = xrtstr.Substring(xrtstr.Length - 4, 4);
- break;
- case "yrt":
- text.TextString = yrtstr.Substring(0, yrtstr.Length - 5);
- //text.TextString = yrtstr.Substring(0, yrtstr.Length - 4);
- if (xsws == "1")
- text.TextString = yrtstr.Substring(0, yrtstr.Length - 4);
- break;
- case "yrt2":
- text.TextString = yrtstr.Substring(yrtstr.Length - 5, 5);
- //text.TextString = yrtstr.Substring(yrtstr.Length - 4, 4);
- if (xsws == "1")
- text.TextString = yrtstr.Substring(yrtstr.Length - 4, 4);
- break;
- case "xlb":
- //text.TextString = daihao + xlbstr.Substring(0, xlbstr.Length - 4);
- text.TextString = daihao + xlbstr.Substring(0, xlbstr.Length - 5);
- if (xsws == "1")
- text.TextString = daihao + xlbstr.Substring(0, xlbstr.Length - 4);
- break;
- case "xlb2":
- //text.TextString = xlbstr.Substring(xlbstr.Length - 4, 4);
- text.TextString = xlbstr.Substring(xlbstr.Length - 5, 5);
- if (xsws == "1")
- text.TextString = xlbstr.Substring(xlbstr.Length - 4, 4);
- break;
- case "ylb":
- text.TextString = ylbstr.Substring(0, ylbstr.Length - 5);
- //text.TextString = ylbstr.Substring(0, ylbstr.Length - 4);
- if (xsws == "1")
- text.TextString = ylbstr.Substring(0, ylbstr.Length - 4);
- break;
- case "ylb2":
- text.TextString = ylbstr.Substring(ylbstr.Length - 5, 5);
- //text.TextString = ylbstr.Substring(ylbstr.Length - 4, 4);
- if (xsws == "1")
- text.TextString = ylbstr.Substring(ylbstr.Length - 4, 4);
- break;
- case "xrb":
- //text.TextString = daihao + xrbstr.Substring(0, xrtstr.Length - 4);
- text.TextString = daihao + xrbstr.Substring(0, xrtstr.Length - 5);
- if (xsws == "1")
- text.TextString = daihao + xrbstr.Substring(0, xrtstr.Length - 4);
- break;
- case "xrb2":
- //text.TextString = xrbstr.Substring(xrbstr.Length - 4, 4);
- text.TextString = xrbstr.Substring(xrbstr.Length - 5, 5);
- if (xsws == "1")
- text.TextString = xrbstr.Substring(xrbstr.Length - 4, 4);
- break;
- case "yrb":
- text.TextString = yrbstr.Substring(0, yrbstr.Length - 5);
- //text.TextString = yrbstr.Substring(0, yrbstr.Length - 4);
- if (xsws == "1")
- text.TextString = yrbstr.Substring(0, yrbstr.Length - 4);
- break;
- case "yrb2":
- text.TextString = yrbstr.Substring(yrbstr.Length - 5, 5);
- //text.TextString = yrbstr.Substring(yrbstr.Length - 4, 4);
- if (xsws == "1")
- text.TextString = yrbstr.Substring(yrbstr.Length - 4, 4);
- break;
- case "xltxx2":
- string xltxx2222 = (Convert.ToDouble(xltstr) + 0.5).ToString(ffff111222);
- text.TextString = xltxx2222.Substring(1, xltxx2222.Length - 1);
- break;
- case "xltxx3":
- string xltxx3333=(Convert.ToDouble(xltstr) + 1).ToString(ffff111222);
- text.TextString = xltxx3333.Substring(1, xltxx3333.Length - 1);
- break;
- case "xltxx4":
- string xltxx4444=(Convert.ToDouble(xltstr) + 1.5).ToString(ffff111222);
- text.TextString = xltxx4444.Substring(1, xltxx4444.Length - 1);
- break;
- case "xltxx5":
- string xltxx5555=(Convert.ToDouble(xltstr) + 2).ToString(ffff111222);
- text.TextString = xltxx5555.Substring(1, xltxx5555.Length - 1);
- break;
- case "ylbyy2":
- string ylbyy2222=(Convert.ToDouble(ylbstr) + 0.5).ToString(ffff111222);
- text.TextString = ylbyy2222.Substring(2, ylbyy2222.Length - 2);
- break;
- case "ylbyy3":
- string ylbyy3333=(Convert.ToDouble(ylbstr) +1).ToString(ffff111222);
- text.TextString = ylbyy3333.Substring(2, ylbyy3333.Length - 2);
- break;
- case "ylbyy4":
- string ylbyy4444=(Convert.ToDouble(ylbstr) + 1.5).ToString(ffff111222);
- text.TextString = ylbyy4444.Substring(2, ylbyy4444.Length - 2);
- break;
- case "ylbyy5":
- string ylbyy5555=(Convert.ToDouble(ylbstr) +2).ToString(ffff111222);
- text.TextString = ylbyy5555.Substring(2, ylbyy5555.Length - 2);
- break;
- //case "":
- // break;
- //case "":
- // break;
- //case "":
- // break;
- default: break;
- }
- #endregion
- myentity = text;
- }
- myentity.TransformBy(mt3d);
- }
- btrenu.Dispose();
- btr.Dispose();
- }
- bt.Dispose();
- myTran.Commit();
- myTran.Dispose();
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.ToString());
- }
- }
- #endregion
- ////保存为dwg code
- var resultfilename = dwgfilename;
- ////var resultfilename = @"D:\test\result\1000tk" + i.ToString() + ".dwg";
- myDB.SaveAs(resultfilename, DwgVersion.Current);
- //myDB.CloseInput(true);
- myDB.Dispose();
-
- }
- }
- }
-
- }
- catch (Exception ex0)
- {
- MessageBox.Show(ex0.ToString());
- }
- //}
- //else
- // return;
-
-
- }
-
- public void InsertDOM()
- {
- string[] filelist;
- string domfilename = string.Empty;
- string tfwfilename = string.Empty;
- string imageName = string.Empty;
- System.Windows.Forms.OpenFileDialog ofd = new System.Windows.Forms.OpenFileDialog();
- ofd.Title = "请选择要插入的DOM(必须有相应的.tfw文件且在同一文件夹中)";
- ofd.Filter = "(DOM)*tif|*.tif";
- ofd.Multiselect = true;
- ofd.RestoreDirectory = true;
- if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
- {
- filelist = ofd.FileNames;
-
- Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
- Database db = doc.Database;
- Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
-
- ObjectIdCollection obidcoll = new ObjectIdCollection();
-
- for (int i = 0; i < filelist.Length; i++)
- {
- domfilename = filelist[i];
-
- imageName = new FileInfo(domfilename).Name;
-
- if (domfilename.Contains("tif"))
-
- tfwfilename = domfilename.Replace(".tif", ".tfw");
- else
- {
- tfwfilename = domfilename.Replace(".TIF", ".tfw");
- }
-
- double scale = 0;
- double X = 0, Y = 0;
- try
- {
- StreamReader sr = new StreamReader(tfwfilename);
- scale = Convert.ToDouble(sr.ReadLine());
- sr.ReadLine();
- sr.ReadLine();
- sr.ReadLine();
- X = Convert.ToDouble(sr.ReadLine());
- Y = Convert.ToDouble(sr.ReadLine());
- sr.Close();
- sr.Dispose();
- }
- catch (System.Exception ex)
- {
- //MessageBox.Show("警告:"+domfilename +"图像没有相应的.tfw文件,无法正确插入!!!\r\n\r\n" + ex.ToString());
- MessageBox.Show("警告:" + domfilename + "图像没有相应的.tfw文件,无法正确插入!!!\r\n\r\n");
- continue;
- }
-
- using (Transaction tran = db.TransactionManager.StartTransaction())
- {
- LayerTable lt = tran.GetObject(db.LayerTableId, OpenMode.ForWrite) as LayerTable;
-
- try
- {
- if (!lt.Has("DOM"))
- {
-
- LayerTableRecord ltrec = new LayerTableRecord();
- ltrec.Name = "DOM";
- ObjectId obid = lt.Add(ltrec);
- tran.AddNewlyCreatedDBObject(ltrec, true);
- //db.Clayer = obid;
- }
- }
- catch (Autodesk.AutoCAD.Runtime.Exception ex)
- {
- MessageBox.Show(ex.ToString());
- }
- tran.Commit();
- }
- using (Transaction tran = db.TransactionManager.StartTransaction())
- {
- BlockTable blktbl = tran.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable;
- BlockTableRecord blktblrec = tran.GetObject(blktbl[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;
-
- DrawOrderTable dot = tran.GetObject(blktblrec.DrawOrderTableId, OpenMode.ForWrite) as DrawOrderTable;
-
- try
- {
- #region
- //RasterImageDef dom = new RasterImageDef();
-
- ////domimage.TransformBy();
- //dom.ActiveFileName = domfilename;
- ////dom.OpenImage();
- //dom.Load();
- //dom.ImageModified = true;
- //dom.OpenImage();
- //dom.Embed();
-
- //RasterImage domimage = new RasterImage();
-
- ////Matrix3d.Mirroring();//将栅格图像坐标关于Y轴镜像还原
- ////Matrix3d.Displacement();//在Y轴正方向上移动图像原始高度距离
- ////domimage.TransformBy();//最后用6参数组织缩放、旋转、移动的变换矩阵
-
-
- //tran.AddNewlyCreatedDBObject(dom, true);
- //tran.Commit();
-
- ///////////////////
- //RasterImage domimage = new RasterImage();
- //PromptEntityOptions prent = new PromptEntityOptions("\n请选择山歌图像");
- //prent.SetRejectMessage("\n选择的不是栅格图像");
- //prent.AddAllowedClass(typeof(RasterImage), true);
- //PromptEntityResult prentres = ed.GetEntity(prent);
- //if (prentres.Status != PromptStatus.OK)
- // return;
- //Matrix3d transform;
-
- //ObjectId imgid = prentres.ObjectId;
- //domimage = (RasterImage)tran.GetObject(imgid, OpenMode.ForRead);
- //transform = domimage.PixelToModelTransform;
- #endregion
-
-
-
- //////////////////////创建图像定义对象
- ObjectId imgid = RasterImageDef.GetImageDictionary(db);
-
- if (imgid == ObjectId.Null)
- imgid = RasterImageDef.CreateImageDictionary(db);
- DBDictionary imgdict = tran.GetObject(imgid, OpenMode.ForWrite) as DBDictionary;
- RasterImageDef imgdef = new RasterImageDef();
- imgdef.SourceFileName = domfilename;
- imgdef.Load();
- ObjectId imgdefid = imgdict.SetAt(imageName, imgdef);
- tran.AddNewlyCreatedDBObject(imgdef, true);
-
-
- RasterImage image = new RasterImage();
- image.ImageDefId = imgdefid;
- image.Layer = "DOM";
- blktblrec.AppendEntity(image);
- tran.AddNewlyCreatedDBObject(image, true);
-
- double height = imgdef.Size.Y;
- Vector3d vt1 = scale * image.Orientation.Xaxis;
- Vector3d vt2 = scale * image.Orientation.Yaxis;
-
- image.AssociateRasterDef(imgdef);
- image.Draw();
- image.Orientation = new CoordinateSystem3d(new Point3d(X, Y - height * scale, 0), vt1, vt2);
-
- //影像后置
- obidcoll.Add(image.ObjectId);
- dot.MoveToBottom(obidcoll);
- obidcoll = new ObjectIdCollection();
-
- tran.Commit();
-
- Autodesk.AutoCAD.ApplicationServices.Application.UpdateScreen();
- doc.Editor.WriteMessage(imageName + "影像已按照参数正确加载;");
-
-
- }
- catch (Autodesk.AutoCAD.Runtime.Exception ex)
- {
- MessageBox.Show(ex.ToString());
- }
- }
- }
- }
- }
- public List<double> getxyscale(string filename)
- {
- List<double> result = new List<double>();
- try
- {
- StreamReader sr = new StreamReader(filename);
- double scale = Convert.ToDouble(sr.ReadLine());
- sr.ReadLine();
- sr.ReadLine();
- sr.ReadLine();
- double X = Convert.ToDouble(sr.ReadLine());
- double Y = Convert.ToDouble(sr.ReadLine());
- sr.Close();
- sr.Dispose();
- result.Add(X);
- result.Add(Y);
- result.Add(scale);
- return result;
- }
- catch
- {
- return new List<double>();
- }
-
- }
- public void InserDOMbatch2021()
- {
- string dompath1 = "";
- string dwgpath2 = "";
- string strdomtype = ".jpg";
- string strdomxyztype = ".jgw";
- FolderBrowserDialog domfbd1 = new FolderBrowserDialog();
- domfbd1.Description = "select dom filepath 111";
- FolderBrowserDialog dwgfbd2 = new FolderBrowserDialog();
- dwgfbd2.Description = "select dwg filepath 222";
- if (domfbd1.ShowDialog() == DialogResult.OK)
- {
- dompath1 = domfbd1.SelectedPath;
- }
- if (dwgfbd2.ShowDialog() == DialogResult.OK)
- {
- dwgpath2 = dwgfbd2.SelectedPath;
- }
- DirectoryInfo di = new DirectoryInfo(dwgpath2);
- foreach (FileInfo fi in di.GetFiles())
- {
- string filenamedwg = fi.FullName;
- string namedwg = fi.Name;
- string tfhname = namedwg.Replace(".dwg", "");
- //MessageBox.Show(filenamedwg);
- if (filenamedwg.Contains(".dwg"))
- {
- //MessageBox.Show(filenamedwg);
- string filenamedom = dompath1 + "\\" + tfhname + strdomtype;
- string filenamedomxyz = dompath1 + "\\" + tfhname + strdomxyztype;
- string savefile = dompath1 + "\\" + tfhname + ".dwg";
- //MessageBox.Show("1 "+filenamedom);
- //MessageBox.Show("2 "+filenamedomxyz);
-
- if (File.Exists(filenamedom))
- {
- //MessageBox.Show(filenamedom);
- }
- else
- {
- MessageBox.Show("not " + filenamedom);
- continue;
- }
- if (File.Exists(filenamedomxyz))
- {
-
- //MessageBox.Show(filenamedomxyz);
- }
- else
- {
- MessageBox.Show("not " + filenamedomxyz);
- continue;
- }
- List<double> xyslist = new List<double>();
- xyslist = getxyscale(filenamedomxyz);
- //MessageBox.Show(xyslist.Count.ToString());
- double X =xyslist[0] ;
- double Y=xyslist[1];
- double scale=xyslist[2];
- if (xyslist.Count < 2)
- continue;
- //MessageBox.Show(X.ToString()+Y.ToString()+scale.ToString());
- ObjectIdCollection obidcoll = new ObjectIdCollection();
- Database db = new Database(false, true);
- db.ReadDwgFile(filenamedwg, System.IO.FileShare.ReadWrite, false, "");
- db.CloseInput(true);
- using (var tran = db.TransactionManager.StartTransaction())
- {
- try
- {
- //var bt = (BlockTable)(myTran.GetObject(myDB.BlockTableId, OpenMode.ForWrite));
- LayerTable lt = tran.GetObject(db.LayerTableId, OpenMode.ForWrite) as LayerTable;
- if (!lt.Has("DOM"))
- {
-
- LayerTableRecord ltrec = new LayerTableRecord();
- ltrec.Name = "DOM";
- ObjectId obid = lt.Add(ltrec);
- tran.AddNewlyCreatedDBObject(ltrec, true);
- //db.Clayer = obid;
- //MessageBox.Show("111");
- }
- //MessageBox.Show("222");
- }
- catch
- {
- MessageBox.Show("DOM layer created failed");
- }
- }
- using (var tran = db.TransactionManager.StartTransaction())
- {
- try
- {
- //MessageBox.Show("333");
- BlockTable blktbl = tran.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable;
- BlockTableRecord blktblrec = tran.GetObject(blktbl[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;
-
- DrawOrderTable dot = tran.GetObject(blktblrec.DrawOrderTableId, OpenMode.ForWrite) as DrawOrderTable;
- //////////////////////创建图像定义对象
- ObjectId imgid = RasterImageDef.GetImageDictionary(db);
-
- if (imgid == ObjectId.Null)
- imgid = RasterImageDef.CreateImageDictionary(db);
- DBDictionary imgdict = tran.GetObject(imgid, OpenMode.ForWrite) as DBDictionary;
- RasterImageDef imgdef = new RasterImageDef();
- imgdef.SourceFileName = filenamedom;
- imgdef.Load();
- ObjectId imgdefid = imgdict.SetAt(tfhname, imgdef);
- tran.AddNewlyCreatedDBObject(imgdef, true);
- //MessageBox.Show("444");
-
- RasterImage image = new RasterImage();
- image.ImageDefId = imgdefid;
- //image.Layer = "DOM";
- blktblrec.AppendEntity(image);
- tran.AddNewlyCreatedDBObject(image, true);
-
- //MessageBox.Show("555");
-
- double height = imgdef.Size.Y;
- Vector3d vt1 = scale * image.Orientation.Xaxis;
- Vector3d vt2 = scale * image.Orientation.Yaxis;
-
- //MessageBox.Show(vt1.X.ToString() + ',' + vt1.Y.ToString());
- //MessageBox.Show(vt2.X.ToString() + ',' + vt2.Y.ToString());
-
- image.AssociateRasterDef(imgdef);
- //image.Draw();
- //MessageBox.Show(X.ToString() + "+++" + (Y - height * scale).ToString());
- //////////////
- /////////////////
- //dhkjahhdflhkflhkflkflkflkjfflhkjflhkflhkflhk
- ///////////
- image.Orientation = new CoordinateSystem3d(new Point3d(X, Y - height * scale, 0), vt1, vt2);
- //image.Orientation = new CoordinateSystem3d(new Point3d(X, Y , 0), vt1, vt2);
- //MessageBox.Show("112");
- //影像后置
- obidcoll.Add(image.ObjectId);
- dot.MoveToBottom(obidcoll);
- obidcoll = new ObjectIdCollection();
-
- //MessageBox.Show("555");
- tran.Commit();
- //MessageBox.Show("777");
- //Autodesk.AutoCAD.ApplicationServices.Application.UpdateScreen();
- //doc.Editor.WriteMessage(imageName + "影像已按照参数正确加载;");
- }
- catch(Exception ex)
- {
- MessageBox.Show(ex.ToString());
- }
- }
- //////////////
- //MessageBox.Show("666");
- //db.Save();
- db.SaveAs(savefile, DwgVersion.Current);
- db.Dispose();
- }
-
- }
- }
- ///end
- ///
- //////////////////////////////////////////////////////////
- }
- }
|