GeometryMeasureDialog.cs 127 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082
  1. using Metis.ParameterSet;
  2. using PaintDotNet;
  3. using PaintDotNet.Annotation;
  4. using PaintDotNet.Annotation.Enum;
  5. using PaintDotNet.Annotation.Measure;
  6. using PaintDotNet.Base.CommTool;
  7. using PaintDotNet.Base.SettingModel;
  8. using System;
  9. using System.Collections;
  10. using System.Collections.Generic;
  11. using System.ComponentModel;
  12. using System.Data;
  13. using System.Drawing;
  14. using System.IO;
  15. using System.Linq;
  16. using System.Text;
  17. using System.Threading.Tasks;
  18. using System.Windows.Forms;
  19. namespace Metis.Measuring
  20. {
  21. internal partial class GeometryMeasureDialog : FloatingToolForm
  22. {
  23. /// <summary>
  24. /// 展开前宽度
  25. /// </summary>
  26. private int smallHeight = 339;
  27. /// <summary>
  28. /// 展开后宽度
  29. /// </summary>
  30. private int bigHelght = 996;
  31. /// <summary>
  32. /// 是否展开
  33. /// </summary>
  34. private bool isEnlarge = false;
  35. /// <summary>
  36. /// 测量属性实体
  37. /// </summary>
  38. private MeasureListSetModel measureListSetModel;
  39. private ImageList imageList1 = new ImageList();
  40. /// <summary>
  41. /// 工具集合
  42. /// </summary>
  43. private List<string> toolNameList = new List<string>();
  44. /// <summary>
  45. /// 工具别名集合
  46. /// </summary>
  47. private List<string> toolNickNameList = new List<string>();
  48. private Dictionary<int, List<ListViewItem>> filterDict = new Dictionary<int, List<ListViewItem>>();
  49. private AppWorkspace appWorkspace;
  50. private MeasureListInteractiveDataModel measureListInteractiveDataModel;
  51. /// <summary>
  52. /// 多值类型
  53. /// </summary>
  54. private List<string> moreTypeList = new List<string>() { "MeasureMulLine", "MeasureMulHVLine", "MeasureMulSegment", "MeasureMulVLine",
  55. "MeasureMulPLine", "MeasureHMulPLine","MeasureVMulPLine","MeasureMulParallelLine","MeasureVMulParallelLine","MeasureHMulParallelLine", };
  56. private GroupBox groupBox2;
  57. private GroupBox groupBox3;
  58. private Label label1;
  59. private ComboBox comboBox1;
  60. private Label label6;
  61. private Label label5;
  62. private Label label4;
  63. private Label label3;
  64. private Label label2;
  65. public NumericUpDown numericUpDown5;
  66. private Button button3;
  67. private Button button2;
  68. private Button button1;
  69. private GroupBox groupBox4;
  70. private GroupBox groupBox5;
  71. private GroupBox groupBox6;
  72. private GroupBox groupBox7;
  73. private GroupBox groupBox8;
  74. private Button button4;
  75. private PaintDotNet.CustomControl.TreeViewEnhanced treeView1;
  76. private PaintDotNet.CustomControl.TreeViewEnhanced treeView2;
  77. private Button button8;
  78. private Button button7;
  79. private Button button6;
  80. private Button button5;
  81. private Button button12;
  82. private Button button11;
  83. private Button button10;
  84. private Button button9;
  85. private ListView listView2;
  86. private RadioButton radioButton8;
  87. private RadioButton radioButton7;
  88. private RadioButton radioButton6;
  89. private RadioButton radioButton5;
  90. private RadioButton radioButton4;
  91. private RadioButton radioButton3;
  92. private RadioButton radioButton2;
  93. private RadioButton radioButton1;
  94. private TextBox textBox2;
  95. private TextBox textBox1;
  96. private TextBox textBox4;
  97. private TextBox textBox3;
  98. private TextBox textBox8;
  99. private TextBox textBox7;
  100. private TextBox textBox6;
  101. private TextBox textBox5;
  102. private ListView listView1;
  103. private GroupBox groupBox1;
  104. public GeometryMeasureDialog(AppWorkspace appWorkspace)
  105. {
  106. InitializeComponent();
  107. this.Width = this.smallHeight;
  108. this.textBox1.Focus();
  109. this.appWorkspace = appWorkspace;
  110. this.comboBox1.SelectedIndex = 0;
  111. #region [初始化listView1]
  112. this.listView1.View = View.Details;
  113. ColumnHeader header1 = new ColumnHeader();
  114. header1.Text = "参数";
  115. header1.TextAlign = HorizontalAlignment.Center;
  116. header1.Width = 0;
  117. this.listView1.Columns.Add(header1);
  118. ColumnHeader header5 = new ColumnHeader();
  119. header5.Text = "参数";
  120. header5.TextAlign = HorizontalAlignment.Center;
  121. header5.Width = 73;
  122. this.listView1.Columns.Add(header5);
  123. ColumnHeader header2 = new ColumnHeader();
  124. header2.Text = "长度";
  125. header2.TextAlign = HorizontalAlignment.Center;
  126. header2.Width = 73;
  127. this.listView1.Columns.Add(header2);
  128. ColumnHeader header3 = new ColumnHeader();
  129. header3.Text = "角度";
  130. header3.TextAlign = HorizontalAlignment.Center;
  131. header3.Width = 73;
  132. this.listView1.Columns.Add(header3);
  133. ColumnHeader header4 = new ColumnHeader();
  134. header4.Text = "面积";
  135. header4.TextAlign = HorizontalAlignment.Center;
  136. header4.Width = 73;
  137. this.listView1.Columns.Add(header4);
  138. this.imageList1.ImageSize = new System.Drawing.Size(2, 30);
  139. this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
  140. this.listView1.SmallImageList = this.imageList1;
  141. #endregion
  142. #region [初始化listView2]
  143. this.listView2.View = View.Details;
  144. ColumnHeader header = new ColumnHeader();
  145. header.Text = "类型";
  146. header.TextAlign = HorizontalAlignment.Center;
  147. header.Width = 70;
  148. this.listView2.Columns.Add(header);
  149. this.imageList1.ImageSize = new System.Drawing.Size(2, 30);
  150. this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
  151. this.listView2.SmallImageList = this.imageList1;
  152. #endregion
  153. #region [获取测量属性实体]
  154. measureListSetModel = XmlSerializeHelper.DESerializer<MeasureListSetModel>(FileOperationHelper.ReadStringFromFile(System.Windows.Forms.Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\MeasureListInteractiveModel.xml", FileMode.Open));
  155. #endregion
  156. #region [数据属性初始化]
  157. this.treeView1.ItemHeight = 18;
  158. this.treeView2.ItemHeight = 18;
  159. this.allDataTree();
  160. #endregion
  161. #region [元素属性初始化]
  162. this.allToolTree();
  163. #endregion
  164. #region [默认展示长度及角度]
  165. if (this.appWorkspace.Units == null)
  166. {
  167. label3.Text = "µm";
  168. }
  169. else
  170. {
  171. switch (this.appWorkspace.Units)
  172. {
  173. case MeasurementUnit.Inch://英寸
  174. label3.Text = "in";
  175. break;
  176. case MeasurementUnit.Mil://米尔
  177. label3.Text = "mil";
  178. break;
  179. case MeasurementUnit.Centimeter://厘米
  180. label3.Text = "cm";
  181. break;
  182. case MeasurementUnit.Millimeter://毫米
  183. label3.Text = "mm";
  184. break;
  185. case MeasurementUnit.Micron://微米
  186. label3.Text = "µm";
  187. break;
  188. case MeasurementUnit.Nano://纳米
  189. label3.Text = "nm";
  190. break;
  191. default:
  192. label3.Text = "µm";
  193. break;
  194. }
  195. }
  196. MeasureStyleModel model = XmlSerializeHelper.DESerializer<MeasureStyleModel>(FileOperationHelper.ReadStringFromFile(Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\Measure\\" + Startup.instance.configModel.MeasurementStyle, FileMode.Open));
  197. label5.Text = model.measureThreePointAngle.isAngle ? "密位" : "度";
  198. #endregion
  199. #region [获取参数]
  200. this.getLastData();
  201. #endregion
  202. this.appWorkspace.ActiveDocumentWorkspaceChanged += new EventHandler(RefreshListView);
  203. this.FormClosing += new FormClosingEventHandler(this.saveLastData);
  204. }
  205. private void InitializeComponent()
  206. {
  207. this.groupBox1 = new System.Windows.Forms.GroupBox();
  208. this.textBox8 = new System.Windows.Forms.TextBox();
  209. this.textBox7 = new System.Windows.Forms.TextBox();
  210. this.textBox6 = new System.Windows.Forms.TextBox();
  211. this.textBox5 = new System.Windows.Forms.TextBox();
  212. this.textBox2 = new System.Windows.Forms.TextBox();
  213. this.textBox1 = new System.Windows.Forms.TextBox();
  214. this.textBox4 = new System.Windows.Forms.TextBox();
  215. this.textBox3 = new System.Windows.Forms.TextBox();
  216. this.radioButton8 = new System.Windows.Forms.RadioButton();
  217. this.radioButton7 = new System.Windows.Forms.RadioButton();
  218. this.radioButton6 = new System.Windows.Forms.RadioButton();
  219. this.radioButton5 = new System.Windows.Forms.RadioButton();
  220. this.radioButton4 = new System.Windows.Forms.RadioButton();
  221. this.radioButton3 = new System.Windows.Forms.RadioButton();
  222. this.radioButton2 = new System.Windows.Forms.RadioButton();
  223. this.radioButton1 = new System.Windows.Forms.RadioButton();
  224. this.groupBox2 = new System.Windows.Forms.GroupBox();
  225. this.listView1 = new System.Windows.Forms.ListView();
  226. this.comboBox1 = new System.Windows.Forms.ComboBox();
  227. this.label1 = new System.Windows.Forms.Label();
  228. this.groupBox3 = new System.Windows.Forms.GroupBox();
  229. this.button4 = new System.Windows.Forms.Button();
  230. this.button3 = new System.Windows.Forms.Button();
  231. this.button2 = new System.Windows.Forms.Button();
  232. this.button1 = new System.Windows.Forms.Button();
  233. this.numericUpDown5 = new System.Windows.Forms.NumericUpDown();
  234. this.label6 = new System.Windows.Forms.Label();
  235. this.label5 = new System.Windows.Forms.Label();
  236. this.label4 = new System.Windows.Forms.Label();
  237. this.label3 = new System.Windows.Forms.Label();
  238. this.label2 = new System.Windows.Forms.Label();
  239. this.groupBox4 = new System.Windows.Forms.GroupBox();
  240. this.listView2 = new System.Windows.Forms.ListView();
  241. this.groupBox5 = new System.Windows.Forms.GroupBox();
  242. this.treeView1 = new PaintDotNet.CustomControl.TreeViewEnhanced();
  243. this.groupBox6 = new System.Windows.Forms.GroupBox();
  244. this.button8 = new System.Windows.Forms.Button();
  245. this.button7 = new System.Windows.Forms.Button();
  246. this.button6 = new System.Windows.Forms.Button();
  247. this.button5 = new System.Windows.Forms.Button();
  248. this.groupBox7 = new System.Windows.Forms.GroupBox();
  249. this.button12 = new System.Windows.Forms.Button();
  250. this.button11 = new System.Windows.Forms.Button();
  251. this.button10 = new System.Windows.Forms.Button();
  252. this.button9 = new System.Windows.Forms.Button();
  253. this.groupBox8 = new System.Windows.Forms.GroupBox();
  254. this.treeView2 = new PaintDotNet.CustomControl.TreeViewEnhanced();
  255. this.groupBox1.SuspendLayout();
  256. this.groupBox2.SuspendLayout();
  257. this.groupBox3.SuspendLayout();
  258. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown5)).BeginInit();
  259. this.groupBox4.SuspendLayout();
  260. this.groupBox5.SuspendLayout();
  261. this.groupBox6.SuspendLayout();
  262. this.groupBox7.SuspendLayout();
  263. this.groupBox8.SuspendLayout();
  264. this.SuspendLayout();
  265. //
  266. // groupBox1
  267. //
  268. this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  269. | System.Windows.Forms.AnchorStyles.Left)));
  270. this.groupBox1.Controls.Add(this.textBox8);
  271. this.groupBox1.Controls.Add(this.textBox7);
  272. this.groupBox1.Controls.Add(this.textBox6);
  273. this.groupBox1.Controls.Add(this.textBox5);
  274. this.groupBox1.Controls.Add(this.textBox2);
  275. this.groupBox1.Controls.Add(this.textBox1);
  276. this.groupBox1.Controls.Add(this.textBox4);
  277. this.groupBox1.Controls.Add(this.textBox3);
  278. this.groupBox1.Controls.Add(this.radioButton8);
  279. this.groupBox1.Controls.Add(this.radioButton7);
  280. this.groupBox1.Controls.Add(this.radioButton6);
  281. this.groupBox1.Controls.Add(this.radioButton5);
  282. this.groupBox1.Controls.Add(this.radioButton4);
  283. this.groupBox1.Controls.Add(this.radioButton3);
  284. this.groupBox1.Controls.Add(this.radioButton2);
  285. this.groupBox1.Controls.Add(this.radioButton1);
  286. this.groupBox1.Location = new System.Drawing.Point(8, 3);
  287. this.groupBox1.Name = "groupBox1";
  288. this.groupBox1.Size = new System.Drawing.Size(310, 181);
  289. this.groupBox1.TabIndex = 3;
  290. this.groupBox1.TabStop = false;
  291. this.groupBox1.Text = "快捷工具";
  292. //
  293. // textBox8
  294. //
  295. this.textBox8.Location = new System.Drawing.Point(238, 130);
  296. this.textBox8.Name = "textBox8";
  297. this.textBox8.Size = new System.Drawing.Size(61, 21);
  298. this.textBox8.TabIndex = 15;
  299. this.textBox8.Leave += new System.EventHandler(this.textBox1_TextChanged);
  300. //
  301. // textBox7
  302. //
  303. this.textBox7.Location = new System.Drawing.Point(83, 130);
  304. this.textBox7.Name = "textBox7";
  305. this.textBox7.Size = new System.Drawing.Size(70, 21);
  306. this.textBox7.TabIndex = 14;
  307. this.textBox7.Leave += new System.EventHandler(this.textBox1_TextChanged);
  308. //
  309. // textBox6
  310. //
  311. this.textBox6.Location = new System.Drawing.Point(238, 96);
  312. this.textBox6.Name = "textBox6";
  313. this.textBox6.Size = new System.Drawing.Size(61, 21);
  314. this.textBox6.TabIndex = 13;
  315. this.textBox6.Leave += new System.EventHandler(this.textBox1_TextChanged);
  316. //
  317. // textBox5
  318. //
  319. this.textBox5.Location = new System.Drawing.Point(84, 96);
  320. this.textBox5.Name = "textBox5";
  321. this.textBox5.Size = new System.Drawing.Size(69, 21);
  322. this.textBox5.TabIndex = 12;
  323. this.textBox5.Leave += new System.EventHandler(this.textBox1_TextChanged);
  324. //
  325. // textBox2
  326. //
  327. this.textBox2.Location = new System.Drawing.Point(238, 26);
  328. this.textBox2.Name = "textBox2";
  329. this.textBox2.Size = new System.Drawing.Size(61, 21);
  330. this.textBox2.TabIndex = 11;
  331. this.textBox2.Leave += new System.EventHandler(this.textBox1_TextChanged);
  332. //
  333. // textBox1
  334. //
  335. this.textBox1.Location = new System.Drawing.Point(84, 26);
  336. this.textBox1.Name = "textBox1";
  337. this.textBox1.Size = new System.Drawing.Size(69, 21);
  338. this.textBox1.TabIndex = 10;
  339. this.textBox1.Leave += new System.EventHandler(this.textBox1_TextChanged);
  340. //
  341. // textBox4
  342. //
  343. this.textBox4.Location = new System.Drawing.Point(238, 61);
  344. this.textBox4.Name = "textBox4";
  345. this.textBox4.Size = new System.Drawing.Size(61, 21);
  346. this.textBox4.TabIndex = 9;
  347. this.textBox4.Leave += new System.EventHandler(this.textBox1_TextChanged);
  348. //
  349. // textBox3
  350. //
  351. this.textBox3.Location = new System.Drawing.Point(84, 62);
  352. this.textBox3.Name = "textBox3";
  353. this.textBox3.Size = new System.Drawing.Size(69, 21);
  354. this.textBox3.TabIndex = 8;
  355. this.textBox3.Leave += new System.EventHandler(this.textBox1_TextChanged);
  356. //
  357. // radioButton8
  358. //
  359. this.radioButton8.AutoSize = true;
  360. this.radioButton8.Location = new System.Drawing.Point(165, 132);
  361. this.radioButton8.Name = "radioButton8";
  362. this.radioButton8.Size = new System.Drawing.Size(59, 16);
  363. this.radioButton8.TabIndex = 7;
  364. this.radioButton8.TabStop = true;
  365. this.radioButton8.Text = "未设置";
  366. this.radioButton8.UseVisualStyleBackColor = true;
  367. this.radioButton8.Click += new System.EventHandler(this.radioButton_SelectedChanged);
  368. //
  369. // radioButton7
  370. //
  371. this.radioButton7.AutoSize = true;
  372. this.radioButton7.Location = new System.Drawing.Point(11, 132);
  373. this.radioButton7.Name = "radioButton7";
  374. this.radioButton7.Size = new System.Drawing.Size(59, 16);
  375. this.radioButton7.TabIndex = 6;
  376. this.radioButton7.TabStop = true;
  377. this.radioButton7.Text = "未设置";
  378. this.radioButton7.UseVisualStyleBackColor = true;
  379. this.radioButton7.Click += new System.EventHandler(this.radioButton_SelectedChanged);
  380. //
  381. // radioButton6
  382. //
  383. this.radioButton6.AutoSize = true;
  384. this.radioButton6.Location = new System.Drawing.Point(165, 97);
  385. this.radioButton6.Name = "radioButton6";
  386. this.radioButton6.Size = new System.Drawing.Size(59, 16);
  387. this.radioButton6.TabIndex = 5;
  388. this.radioButton6.TabStop = true;
  389. this.radioButton6.Text = "未设置";
  390. this.radioButton6.UseVisualStyleBackColor = true;
  391. this.radioButton6.Click += new System.EventHandler(this.radioButton_SelectedChanged);
  392. //
  393. // radioButton5
  394. //
  395. this.radioButton5.AutoSize = true;
  396. this.radioButton5.Location = new System.Drawing.Point(11, 97);
  397. this.radioButton5.Name = "radioButton5";
  398. this.radioButton5.Size = new System.Drawing.Size(59, 16);
  399. this.radioButton5.TabIndex = 4;
  400. this.radioButton5.TabStop = true;
  401. this.radioButton5.Text = "未设置";
  402. this.radioButton5.UseVisualStyleBackColor = true;
  403. this.radioButton5.Click += new System.EventHandler(this.radioButton_SelectedChanged);
  404. //
  405. // radioButton4
  406. //
  407. this.radioButton4.AutoSize = true;
  408. this.radioButton4.Location = new System.Drawing.Point(163, 62);
  409. this.radioButton4.Name = "radioButton4";
  410. this.radioButton4.Size = new System.Drawing.Size(59, 16);
  411. this.radioButton4.TabIndex = 3;
  412. this.radioButton4.TabStop = true;
  413. this.radioButton4.Text = "未设置";
  414. this.radioButton4.UseVisualStyleBackColor = true;
  415. this.radioButton4.Click += new System.EventHandler(this.radioButton_SelectedChanged);
  416. //
  417. // radioButton3
  418. //
  419. this.radioButton3.AutoSize = true;
  420. this.radioButton3.Location = new System.Drawing.Point(11, 62);
  421. this.radioButton3.Name = "radioButton3";
  422. this.radioButton3.Size = new System.Drawing.Size(59, 16);
  423. this.radioButton3.TabIndex = 2;
  424. this.radioButton3.TabStop = true;
  425. this.radioButton3.Text = "未设置";
  426. this.radioButton3.UseVisualStyleBackColor = true;
  427. this.radioButton3.Click += new System.EventHandler(this.radioButton_SelectedChanged);
  428. //
  429. // radioButton2
  430. //
  431. this.radioButton2.AutoSize = true;
  432. this.radioButton2.Location = new System.Drawing.Point(163, 27);
  433. this.radioButton2.Name = "radioButton2";
  434. this.radioButton2.Size = new System.Drawing.Size(59, 16);
  435. this.radioButton2.TabIndex = 1;
  436. this.radioButton2.TabStop = true;
  437. this.radioButton2.Text = "未设置";
  438. this.radioButton2.UseVisualStyleBackColor = true;
  439. this.radioButton2.Click += new System.EventHandler(this.radioButton_SelectedChanged);
  440. //
  441. // radioButton1
  442. //
  443. this.radioButton1.AutoSize = true;
  444. this.radioButton1.Location = new System.Drawing.Point(11, 27);
  445. this.radioButton1.Name = "radioButton1";
  446. this.radioButton1.Size = new System.Drawing.Size(59, 16);
  447. this.radioButton1.TabIndex = 0;
  448. this.radioButton1.TabStop = true;
  449. this.radioButton1.Text = "未设置";
  450. this.radioButton1.UseVisualStyleBackColor = true;
  451. this.radioButton1.Click += new System.EventHandler(this.radioButton_SelectedChanged);
  452. //
  453. // groupBox2
  454. //
  455. this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  456. | System.Windows.Forms.AnchorStyles.Left)));
  457. this.groupBox2.Controls.Add(this.listView1);
  458. this.groupBox2.Controls.Add(this.comboBox1);
  459. this.groupBox2.Controls.Add(this.label1);
  460. this.groupBox2.Location = new System.Drawing.Point(8, 190);
  461. this.groupBox2.Name = "groupBox2";
  462. this.groupBox2.Size = new System.Drawing.Size(310, 305);
  463. this.groupBox2.TabIndex = 4;
  464. this.groupBox2.TabStop = false;
  465. this.groupBox2.Text = "数据表";
  466. //
  467. // listView1
  468. //
  469. this.listView1.FullRowSelect = true;
  470. this.listView1.GridLines = true;
  471. this.listView1.HideSelection = false;
  472. this.listView1.Location = new System.Drawing.Point(6, 56);
  473. this.listView1.Name = "listView1";
  474. this.listView1.Size = new System.Drawing.Size(293, 243);
  475. this.listView1.TabIndex = 2;
  476. this.listView1.UseCompatibleStateImageBehavior = false;
  477. //
  478. // comboBox1
  479. //
  480. this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
  481. this.comboBox1.FormattingEnabled = true;
  482. this.comboBox1.Items.AddRange(new object[] {
  483. "全部",
  484. "单值",
  485. "多值"});
  486. this.comboBox1.Location = new System.Drawing.Point(45, 30);
  487. this.comboBox1.Name = "comboBox1";
  488. this.comboBox1.Size = new System.Drawing.Size(254, 20);
  489. this.comboBox1.TabIndex = 1;
  490. this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
  491. //
  492. // label1
  493. //
  494. this.label1.AutoSize = true;
  495. this.label1.Location = new System.Drawing.Point(6, 33);
  496. this.label1.Name = "label1";
  497. this.label1.Size = new System.Drawing.Size(41, 12);
  498. this.label1.TabIndex = 0;
  499. this.label1.Text = "筛选:";
  500. //
  501. // groupBox3
  502. //
  503. this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  504. | System.Windows.Forms.AnchorStyles.Left)));
  505. this.groupBox3.Controls.Add(this.button4);
  506. this.groupBox3.Controls.Add(this.button3);
  507. this.groupBox3.Controls.Add(this.button2);
  508. this.groupBox3.Controls.Add(this.button1);
  509. this.groupBox3.Controls.Add(this.numericUpDown5);
  510. this.groupBox3.Controls.Add(this.label6);
  511. this.groupBox3.Controls.Add(this.label5);
  512. this.groupBox3.Controls.Add(this.label4);
  513. this.groupBox3.Controls.Add(this.label3);
  514. this.groupBox3.Controls.Add(this.label2);
  515. this.groupBox3.Location = new System.Drawing.Point(8, 501);
  516. this.groupBox3.Name = "groupBox3";
  517. this.groupBox3.Size = new System.Drawing.Size(310, 110);
  518. this.groupBox3.TabIndex = 5;
  519. this.groupBox3.TabStop = false;
  520. this.groupBox3.Text = "操作";
  521. //
  522. // button4
  523. //
  524. this.button4.Location = new System.Drawing.Point(259, 18);
  525. this.button4.Name = "button4";
  526. this.button4.Size = new System.Drawing.Size(40, 23);
  527. this.button4.TabIndex = 10;
  528. this.button4.Text = ">>";
  529. this.button4.UseVisualStyleBackColor = true;
  530. this.button4.Click += new System.EventHandler(this.button4_Click);
  531. //
  532. // button3
  533. //
  534. this.button3.Location = new System.Drawing.Point(165, 18);
  535. this.button3.Name = "button3";
  536. this.button3.Size = new System.Drawing.Size(38, 23);
  537. this.button3.TabIndex = 9;
  538. this.button3.Text = "删除";
  539. this.button3.UseVisualStyleBackColor = true;
  540. this.button3.Click += new System.EventHandler(this.button3_Click);
  541. //
  542. // button2
  543. //
  544. this.button2.Location = new System.Drawing.Point(211, 18);
  545. this.button2.Name = "button2";
  546. this.button2.Size = new System.Drawing.Size(40, 23);
  547. this.button2.TabIndex = 8;
  548. this.button2.Text = "清空";
  549. this.button2.UseVisualStyleBackColor = true;
  550. this.button2.Click += new System.EventHandler(this.button2_Click);
  551. //
  552. // button1
  553. //
  554. this.button1.Location = new System.Drawing.Point(259, 63);
  555. this.button1.Name = "button1";
  556. this.button1.Size = new System.Drawing.Size(40, 23);
  557. this.button1.TabIndex = 7;
  558. this.button1.Text = "输出";
  559. this.button1.UseVisualStyleBackColor = true;
  560. this.button1.Click += new System.EventHandler(this.button1_Click);
  561. //
  562. // numericUpDown5
  563. //
  564. this.numericUpDown5.Location = new System.Drawing.Point(165, 64);
  565. this.numericUpDown5.Maximum = new decimal(new int[] {
  566. 10,
  567. 0,
  568. 0,
  569. 0});
  570. this.numericUpDown5.Minimum = new decimal(new int[] {
  571. 2,
  572. 0,
  573. 0,
  574. 0});
  575. this.numericUpDown5.Name = "numericUpDown5";
  576. this.numericUpDown5.Size = new System.Drawing.Size(86, 21);
  577. this.numericUpDown5.TabIndex = 6;
  578. this.numericUpDown5.Value = new decimal(new int[] {
  579. 2,
  580. 0,
  581. 0,
  582. 0});
  583. this.numericUpDown5.ValueChanged += new System.EventHandler(this.numericUpDown5_ValueChanged);
  584. //
  585. // label6
  586. //
  587. this.label6.AutoSize = true;
  588. this.label6.Location = new System.Drawing.Point(82, 68);
  589. this.label6.Name = "label6";
  590. this.label6.Size = new System.Drawing.Size(77, 12);
  591. this.label6.TabIndex = 4;
  592. this.label6.Text = "小数点位数:";
  593. //
  594. // label5
  595. //
  596. this.label5.AutoSize = true;
  597. this.label5.Location = new System.Drawing.Point(113, 23);
  598. this.label5.Name = "label5";
  599. this.label5.Size = new System.Drawing.Size(17, 12);
  600. this.label5.TabIndex = 3;
  601. this.label5.Text = "度";
  602. //
  603. // label4
  604. //
  605. this.label4.AutoSize = true;
  606. this.label4.Location = new System.Drawing.Point(76, 23);
  607. this.label4.Name = "label4";
  608. this.label4.Size = new System.Drawing.Size(41, 12);
  609. this.label4.TabIndex = 2;
  610. this.label4.Text = "角度:";
  611. //
  612. // label3
  613. //
  614. this.label3.AutoSize = true;
  615. this.label3.Location = new System.Drawing.Point(43, 23);
  616. this.label3.Name = "label3";
  617. this.label3.Size = new System.Drawing.Size(17, 12);
  618. this.label3.TabIndex = 1;
  619. this.label3.Text = "mm";
  620. //
  621. // label2
  622. //
  623. this.label2.AutoSize = true;
  624. this.label2.Location = new System.Drawing.Point(6, 23);
  625. this.label2.Name = "label2";
  626. this.label2.Size = new System.Drawing.Size(41, 12);
  627. this.label2.TabIndex = 0;
  628. this.label2.Text = "长度:";
  629. //
  630. // groupBox4
  631. //
  632. this.groupBox4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  633. | System.Windows.Forms.AnchorStyles.Left)));
  634. this.groupBox4.Controls.Add(this.listView2);
  635. this.groupBox4.Location = new System.Drawing.Point(324, 3);
  636. this.groupBox4.Name = "groupBox4";
  637. this.groupBox4.Size = new System.Drawing.Size(83, 608);
  638. this.groupBox4.TabIndex = 6;
  639. this.groupBox4.TabStop = false;
  640. this.groupBox4.Text = "快捷工具";
  641. //
  642. // listView2
  643. //
  644. this.listView2.FullRowSelect = true;
  645. this.listView2.GridLines = true;
  646. this.listView2.HideSelection = false;
  647. this.listView2.Location = new System.Drawing.Point(6, 20);
  648. this.listView2.Name = "listView2";
  649. this.listView2.Size = new System.Drawing.Size(71, 578);
  650. this.listView2.TabIndex = 0;
  651. this.listView2.UseCompatibleStateImageBehavior = false;
  652. //
  653. // groupBox5
  654. //
  655. this.groupBox5.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  656. | System.Windows.Forms.AnchorStyles.Left)));
  657. this.groupBox5.Controls.Add(this.treeView1);
  658. this.groupBox5.Location = new System.Drawing.Point(413, 3);
  659. this.groupBox5.Name = "groupBox5";
  660. this.groupBox5.Size = new System.Drawing.Size(220, 608);
  661. this.groupBox5.TabIndex = 7;
  662. this.groupBox5.TabStop = false;
  663. this.groupBox5.Text = "数据属性";
  664. //
  665. // treeView1
  666. //
  667. this.treeView1.Location = new System.Drawing.Point(6, 20);
  668. this.treeView1.Name = "treeView1";
  669. this.treeView1.Size = new System.Drawing.Size(208, 578);
  670. this.treeView1.TabIndex = 17;
  671. //
  672. // groupBox6
  673. //
  674. this.groupBox6.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  675. | System.Windows.Forms.AnchorStyles.Left)));
  676. this.groupBox6.Controls.Add(this.button8);
  677. this.groupBox6.Controls.Add(this.button7);
  678. this.groupBox6.Controls.Add(this.button6);
  679. this.groupBox6.Controls.Add(this.button5);
  680. this.groupBox6.Location = new System.Drawing.Point(639, 3);
  681. this.groupBox6.Name = "groupBox6";
  682. this.groupBox6.Size = new System.Drawing.Size(107, 301);
  683. this.groupBox6.TabIndex = 8;
  684. this.groupBox6.TabStop = false;
  685. this.groupBox6.Text = "工具";
  686. //
  687. // button8
  688. //
  689. this.button8.Location = new System.Drawing.Point(16, 219);
  690. this.button8.Name = "button8";
  691. this.button8.Size = new System.Drawing.Size(75, 23);
  692. this.button8.TabIndex = 3;
  693. this.button8.Text = "向下";
  694. this.button8.UseVisualStyleBackColor = true;
  695. this.button8.Click += new System.EventHandler(this.button8_Click);
  696. //
  697. // button7
  698. //
  699. this.button7.Location = new System.Drawing.Point(16, 164);
  700. this.button7.Name = "button7";
  701. this.button7.Size = new System.Drawing.Size(75, 23);
  702. this.button7.TabIndex = 2;
  703. this.button7.Text = "向上";
  704. this.button7.UseVisualStyleBackColor = true;
  705. this.button7.Click += new System.EventHandler(this.button7_Click);
  706. //
  707. // button6
  708. //
  709. this.button6.Location = new System.Drawing.Point(16, 109);
  710. this.button6.Name = "button6";
  711. this.button6.Size = new System.Drawing.Size(75, 23);
  712. this.button6.TabIndex = 1;
  713. this.button6.Text = ">移除";
  714. this.button6.UseVisualStyleBackColor = true;
  715. this.button6.Click += new System.EventHandler(this.button6_Click);
  716. //
  717. // button5
  718. //
  719. this.button5.Location = new System.Drawing.Point(16, 54);
  720. this.button5.Name = "button5";
  721. this.button5.Size = new System.Drawing.Size(75, 23);
  722. this.button5.TabIndex = 0;
  723. this.button5.Text = "<添加";
  724. this.button5.UseVisualStyleBackColor = true;
  725. this.button5.Click += new System.EventHandler(this.button5_Click);
  726. //
  727. // groupBox7
  728. //
  729. this.groupBox7.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  730. | System.Windows.Forms.AnchorStyles.Left)));
  731. this.groupBox7.Controls.Add(this.button12);
  732. this.groupBox7.Controls.Add(this.button11);
  733. this.groupBox7.Controls.Add(this.button10);
  734. this.groupBox7.Controls.Add(this.button9);
  735. this.groupBox7.Location = new System.Drawing.Point(639, 310);
  736. this.groupBox7.Name = "groupBox7";
  737. this.groupBox7.Size = new System.Drawing.Size(107, 301);
  738. this.groupBox7.TabIndex = 9;
  739. this.groupBox7.TabStop = false;
  740. this.groupBox7.Text = "数据";
  741. //
  742. // button12
  743. //
  744. this.button12.Location = new System.Drawing.Point(16, 214);
  745. this.button12.Name = "button12";
  746. this.button12.Size = new System.Drawing.Size(75, 23);
  747. this.button12.TabIndex = 3;
  748. this.button12.Text = "向下";
  749. this.button12.UseVisualStyleBackColor = true;
  750. this.button12.Click += new System.EventHandler(this.button12_Click);
  751. //
  752. // button11
  753. //
  754. this.button11.Location = new System.Drawing.Point(16, 159);
  755. this.button11.Name = "button11";
  756. this.button11.Size = new System.Drawing.Size(75, 23);
  757. this.button11.TabIndex = 2;
  758. this.button11.Text = "向上";
  759. this.button11.UseVisualStyleBackColor = true;
  760. this.button11.Click += new System.EventHandler(this.button11_Click);
  761. //
  762. // button10
  763. //
  764. this.button10.Location = new System.Drawing.Point(16, 104);
  765. this.button10.Name = "button10";
  766. this.button10.Size = new System.Drawing.Size(75, 23);
  767. this.button10.TabIndex = 1;
  768. this.button10.Text = ">移除";
  769. this.button10.UseVisualStyleBackColor = true;
  770. this.button10.Click += new System.EventHandler(this.button10_Click);
  771. //
  772. // button9
  773. //
  774. this.button9.Location = new System.Drawing.Point(16, 49);
  775. this.button9.Name = "button9";
  776. this.button9.Size = new System.Drawing.Size(75, 23);
  777. this.button9.TabIndex = 0;
  778. this.button9.Text = "<添加";
  779. this.button9.UseVisualStyleBackColor = true;
  780. this.button9.Click += new System.EventHandler(this.button9_Click);
  781. //
  782. // groupBox8
  783. //
  784. this.groupBox8.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  785. | System.Windows.Forms.AnchorStyles.Left)));
  786. this.groupBox8.Controls.Add(this.treeView2);
  787. this.groupBox8.Location = new System.Drawing.Point(752, 3);
  788. this.groupBox8.Name = "groupBox8";
  789. this.groupBox8.Size = new System.Drawing.Size(220, 608);
  790. this.groupBox8.TabIndex = 10;
  791. this.groupBox8.TabStop = false;
  792. this.groupBox8.Text = "元素属性";
  793. //
  794. // treeView2
  795. //
  796. this.treeView2.Location = new System.Drawing.Point(6, 20);
  797. this.treeView2.Name = "treeView2";
  798. this.treeView2.Size = new System.Drawing.Size(208, 578);
  799. this.treeView2.TabIndex = 18;
  800. //
  801. // GeometryMeasureDialog
  802. //
  803. this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
  804. this.BackColor = System.Drawing.SystemColors.Control;
  805. this.ClientSize = new System.Drawing.Size(980, 621);
  806. this.Controls.Add(this.groupBox8);
  807. this.Controls.Add(this.groupBox7);
  808. this.Controls.Add(this.groupBox6);
  809. this.Controls.Add(this.groupBox5);
  810. this.Controls.Add(this.groupBox4);
  811. this.Controls.Add(this.groupBox3);
  812. this.Controls.Add(this.groupBox2);
  813. this.Controls.Add(this.groupBox1);
  814. this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
  815. this.Name = "GeometryMeasureDialog";
  816. this.Text = "交互测量";
  817. this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.GeometryMeasureDialog_FormClosing);
  818. this.Controls.SetChildIndex(this.groupBox1, 0);
  819. this.Controls.SetChildIndex(this.groupBox2, 0);
  820. this.Controls.SetChildIndex(this.groupBox3, 0);
  821. this.Controls.SetChildIndex(this.groupBox4, 0);
  822. this.Controls.SetChildIndex(this.groupBox5, 0);
  823. this.Controls.SetChildIndex(this.groupBox6, 0);
  824. this.Controls.SetChildIndex(this.groupBox7, 0);
  825. this.Controls.SetChildIndex(this.groupBox8, 0);
  826. this.groupBox1.ResumeLayout(false);
  827. this.groupBox1.PerformLayout();
  828. this.groupBox2.ResumeLayout(false);
  829. this.groupBox2.PerformLayout();
  830. this.groupBox3.ResumeLayout(false);
  831. this.groupBox3.PerformLayout();
  832. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown5)).EndInit();
  833. this.groupBox4.ResumeLayout(false);
  834. this.groupBox5.ResumeLayout(false);
  835. this.groupBox6.ResumeLayout(false);
  836. this.groupBox7.ResumeLayout(false);
  837. this.groupBox8.ResumeLayout(false);
  838. this.ResumeLayout(false);
  839. }
  840. /// <summary>
  841. /// 获取参数保存
  842. /// </summary>
  843. private void getLastData()
  844. {
  845. string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\ParameterSaving\\MeasureListInteractiveDataModel.xml";
  846. if (!File.Exists(filePath))
  847. {
  848. measureListInteractiveDataModel = new MeasureListInteractiveDataModel();
  849. }
  850. else {
  851. measureListInteractiveDataModel = XmlSerializeHelper.DESerializer<MeasureListInteractiveDataModel>(FileOperationHelper.ReadStringFromFile(filePath, FileMode.Open));
  852. if (measureListInteractiveDataModel != null) {
  853. this.numericUpDown5.Value = measureListInteractiveDataModel.num;
  854. this.comboBox1.SelectedIndex = measureListInteractiveDataModel.selectIndex;
  855. foreach (var item in measureListInteractiveDataModel.FastToolList)
  856. {
  857. var index = measureListInteractiveDataModel.FastToolList.IndexOf(item) + 1;
  858. string name = item.name;
  859. if (name.Length >= 5)
  860. {
  861. name = $"{name.Substring(0, 4)}\r\n{name.Substring(4, name.Length - 4)}";
  862. }
  863. switch (index) {
  864. case 1:
  865. radioButton1.Text = name;
  866. textBox1.Text = item.nickName;
  867. break;
  868. case 2:
  869. radioButton2.Text = name;
  870. textBox2.Text = item.nickName;
  871. break;
  872. case 3:
  873. radioButton3.Text = name;
  874. textBox3.Text = item.nickName;
  875. break;
  876. case 4:
  877. radioButton4.Text = name;
  878. textBox4.Text = item.nickName;
  879. break;
  880. case 5:
  881. radioButton5.Text = name;
  882. textBox5.Text = item.nickName;
  883. break;
  884. case 6:
  885. radioButton6.Text = name;
  886. textBox6.Text = item.nickName;
  887. break;
  888. case 7:
  889. radioButton7.Text = name;
  890. textBox7.Text = item.nickName;
  891. break;
  892. case 8:
  893. radioButton8.Text = name;
  894. textBox8.Text = item.nickName;
  895. break;
  896. }
  897. toolNameList.Add(item.name);
  898. toolNickNameList.Add(item.nickName);
  899. ListViewItem lvi = new ListViewItem();
  900. lvi.Text = item.name;
  901. this.listView2.Items.Add(lvi);
  902. }
  903. if (measureListInteractiveDataModel.FastToolList.Count > 0) {
  904. radioButton_SelectedChanged(radioButton1, null);
  905. }
  906. }
  907. }
  908. }
  909. /// <summary>
  910. /// 数据属性初始化
  911. /// </summary>
  912. private void allDataTree()
  913. {
  914. if (measureListSetModel != null && measureListSetModel.AttributeMapAllDataNodes != null)
  915. {
  916. for (int i = 0; i < measureListSetModel.AttributeMapAllDataNodes.Count; i++)
  917. {
  918. TreeNode firstNode = new TreeNode();
  919. firstNode.Text = measureListSetModel.AttributeMapAllDataNodes[i].Name;
  920. for (int j = 0; j < measureListSetModel.AttributeMapAllDataNodes[i].Attribute.Count; j++)
  921. {
  922. TreeNode scondNode = new TreeNode();
  923. scondNode.Text = measureListSetModel.AttributeMapAllDataNodes[i].Attribute[j].Text;
  924. scondNode.Name = measureListSetModel.AttributeMapAllDataNodes[i].Attribute[j].Name;
  925. for (int k = 0; k < measureListSetModel.AttributeMapAllDataNodes[i].Attribute[j].Attribute.Count; k++)
  926. {
  927. if (measureListSetModel.AttributeMapAllDataNodes[i].Attribute[j].Attribute.Count > 0)
  928. {
  929. TreeNode thirdNode = new TreeNode();
  930. thirdNode.Text = measureListSetModel.AttributeMapAllDataNodes[i].Attribute[j].Attribute[k].Text;
  931. thirdNode.Name = measureListSetModel.AttributeMapAllDataNodes[i].Attribute[j].Attribute[k].Name;
  932. scondNode.Nodes.Add(thirdNode);
  933. }
  934. }
  935. firstNode.Nodes.Add(scondNode);
  936. }
  937. this.treeView2.Nodes.Add(firstNode);
  938. }
  939. }
  940. }
  941. /// <summary>
  942. /// 元素属性初始化
  943. /// </summary>
  944. private void allToolTree()
  945. {
  946. if (measureListSetModel != null && measureListSetModel.AttributeMapDataNodes != null)
  947. {
  948. for (int i = 0; i < measureListSetModel.AttributeMapDataNodes.Count; i++)
  949. {
  950. TreeNode firstNode = new TreeNode();
  951. firstNode.Text = measureListSetModel.AttributeMapDataNodes[i].Name;
  952. for (int j = 0; j < measureListSetModel.AttributeMapDataNodes[i].Attribute.Count; j++)
  953. {
  954. TreeNode scondNode = new TreeNode();
  955. scondNode.Text = measureListSetModel.AttributeMapDataNodes[i].Attribute[j].Text;
  956. scondNode.Name = measureListSetModel.AttributeMapDataNodes[i].Attribute[j].Name;
  957. for (int k = 0; k < measureListSetModel.AttributeMapDataNodes[i].Attribute[j].Attribute.Count; k++)
  958. {
  959. if (measureListSetModel.AttributeMapDataNodes[i].Attribute[j].Attribute.Count > 0)
  960. {
  961. TreeNode thirdNode = new TreeNode();
  962. thirdNode.Text = measureListSetModel.AttributeMapDataNodes[i].Attribute[j].Attribute[k].Text;
  963. thirdNode.Name = measureListSetModel.AttributeMapDataNodes[i].Attribute[j].Attribute[k].Name;
  964. scondNode.Nodes.Add(thirdNode);
  965. }
  966. }
  967. firstNode.Nodes.Add(scondNode);
  968. }
  969. this.treeView1.Nodes.Add(firstNode);
  970. }
  971. }
  972. }
  973. /// <summary>
  974. /// 面板伸缩事件
  975. /// </summary>
  976. /// <param name="sender"></param>
  977. /// <param name="e"></param>
  978. private void button4_Click(object sender, EventArgs e)
  979. {
  980. if (isEnlarge)
  981. {
  982. this.Width = this.smallHeight;
  983. this.button4.Text = ">>";
  984. }
  985. else {
  986. this.Width = this.bigHelght;
  987. this.button4.Text = "<<";
  988. }
  989. this.isEnlarge = !isEnlarge;
  990. }
  991. #region [数据面板操作]
  992. /// <summary>
  993. /// 数据添加
  994. /// </summary>
  995. /// <param name="sender"></param>
  996. /// <param name="e"></param>
  997. private void button9_Click(object sender, EventArgs e)
  998. {
  999. if (this.treeView2.SelectedNode != null && this.treeView2.SelectedNode.Level == 2)
  1000. {
  1001. string name = string.Empty;
  1002. string orName = this.treeView2.SelectedNode.Name;
  1003. if (this.treeView2.SelectedNode.Parent != null)
  1004. name = this.treeView2.SelectedNode.Parent.Name;
  1005. TreeNode treeNode = this.treeView2.SelectedNode;
  1006. int count = treeView1.Nodes.Count;
  1007. for (int i = 0; i < count; i++)
  1008. {
  1009. foreach (TreeNode node in this.treeView1.Nodes[i].Nodes)
  1010. {
  1011. if (node.Name == name)
  1012. {
  1013. this.treeView2.SelectedNode.Remove();
  1014. node.Nodes.Add(treeNode);
  1015. }
  1016. }
  1017. }
  1018. MeasureListSetModel.FirstNode.SecondNode.Item hasAttr = null;
  1019. foreach (var item in measureListSetModel.AttributeMapAllDataNodes)
  1020. {
  1021. var tool = item.Attribute.Where(m => m.Name.Equals(name)).FirstOrDefault();
  1022. if (tool != null)
  1023. {
  1024. hasAttr = tool.Attribute.Where(m => m.Name.Equals(orName)).FirstOrDefault();
  1025. if (hasAttr != null) {
  1026. tool.Attribute.Remove(hasAttr);
  1027. }
  1028. }
  1029. }
  1030. foreach (var item in measureListSetModel.AttributeMapDataNodes)
  1031. {
  1032. var tool = item.Attribute.Where(m => m.Name.Equals(name)).FirstOrDefault();
  1033. if (tool != null)
  1034. {
  1035. if (hasAttr != null) {
  1036. tool.Attribute.Add(hasAttr);
  1037. }
  1038. }
  1039. }
  1040. RefreshListView(null, null);
  1041. }
  1042. }
  1043. /// <summary>
  1044. /// 数据移除
  1045. /// </summary>
  1046. /// <param name="sender"></param>
  1047. /// <param name="e"></param>
  1048. private void button10_Click(object sender, EventArgs e)
  1049. {
  1050. if (this.treeView1.SelectedNode != null && this.treeView1.SelectedNode.Level == 2)
  1051. {
  1052. string name = string.Empty;
  1053. string orName = this.treeView1.SelectedNode.Name;
  1054. if (this.treeView1.SelectedNode.Parent != null)
  1055. name = this.treeView1.SelectedNode.Parent.Name;
  1056. TreeNode treeNode = this.treeView1.SelectedNode;
  1057. int count = treeView2.Nodes.Count;
  1058. for (int i = 0; i < count; i++)
  1059. {
  1060. foreach (TreeNode node in this.treeView2.Nodes[i].Nodes)
  1061. {
  1062. if (node.Name == name)
  1063. {
  1064. this.treeView1.SelectedNode.Remove();
  1065. node.Nodes.Add(treeNode);
  1066. }
  1067. }
  1068. }
  1069. MeasureListSetModel.FirstNode.SecondNode.Item hasAttr = null;
  1070. foreach (var item in measureListSetModel.AttributeMapDataNodes)
  1071. {
  1072. var tool = item.Attribute.Where(m => m.Name.Equals(name)).FirstOrDefault();
  1073. if (tool != null)
  1074. {
  1075. hasAttr = tool.Attribute.Where(m => m.Name.Equals(orName)).FirstOrDefault();
  1076. if (hasAttr != null)
  1077. {
  1078. tool.Attribute.Remove(hasAttr);
  1079. }
  1080. }
  1081. }
  1082. foreach (var item in measureListSetModel.AttributeMapAllDataNodes)
  1083. {
  1084. var tool = item.Attribute.Where(m => m.Name.Equals(name)).FirstOrDefault();
  1085. if (tool != null)
  1086. {
  1087. if (hasAttr != null)
  1088. {
  1089. tool.Attribute.Add(hasAttr);
  1090. }
  1091. }
  1092. }
  1093. RefreshListView(null, null);
  1094. }
  1095. }
  1096. /// <summary>
  1097. /// 数据向上
  1098. /// </summary>
  1099. /// <param name="sender"></param>
  1100. /// <param name="e"></param>
  1101. private void button11_Click(object sender, EventArgs e)
  1102. {
  1103. if (this.treeView1.SelectedNode == null || this.treeView1.SelectedNode.Level != 2)
  1104. {
  1105. return;
  1106. }
  1107. #region [树状图信息向上]
  1108. string name = string.Empty;
  1109. if (this.treeView1.SelectedNode.Parent != null)
  1110. {
  1111. name = this.treeView1.SelectedNode.Parent.Name;
  1112. }
  1113. TreeNode treeNode = this.treeView1.SelectedNode;
  1114. int count = treeView1.Nodes.Count;
  1115. for (int i = 0; i < count; i++)
  1116. {
  1117. foreach (TreeNode node in this.treeView1.Nodes[i].Nodes)
  1118. {
  1119. if (node.Name != name)
  1120. {
  1121. continue;
  1122. }
  1123. int index = node.Nodes.IndexOf(treeNode);
  1124. if (index != 0)
  1125. {
  1126. TreeNode lastNode = node.Nodes[index - 1];
  1127. node.Nodes.RemoveAt(index);
  1128. node.Nodes.RemoveAt(index - 1);
  1129. node.Nodes.Insert(index, lastNode);
  1130. node.Nodes.Insert(index - 1, treeNode);
  1131. treeView1.Focus();
  1132. treeView1.SelectedNode = treeNode;
  1133. }
  1134. }
  1135. }
  1136. #endregion
  1137. #region [表格信息向上]
  1138. #endregion
  1139. }
  1140. /// <summary>
  1141. /// 数据向下
  1142. /// </summary>
  1143. /// <param name="sender"></param>
  1144. /// <param name="e"></param>
  1145. private void button12_Click(object sender, EventArgs e)
  1146. {
  1147. if (this.treeView1.SelectedNode == null || this.treeView1.SelectedNode.Level != 2)
  1148. {
  1149. return;
  1150. }
  1151. #region [树状图信息向下]
  1152. string name = string.Empty;
  1153. if (this.treeView1.SelectedNode.Parent != null)
  1154. {
  1155. name = this.treeView1.SelectedNode.Parent.Name;
  1156. }
  1157. TreeNode treeNode = this.treeView1.SelectedNode;
  1158. int count = treeView1.Nodes.Count;
  1159. for (int i = 0; i < count; i++)
  1160. {
  1161. foreach (TreeNode node in this.treeView1.Nodes[i].Nodes)
  1162. {
  1163. if (node.Name != name)
  1164. {
  1165. continue;
  1166. }
  1167. int index = node.Nodes.IndexOf(treeNode);
  1168. if (index != node.Nodes.Count - 1)
  1169. {
  1170. TreeNode lastNode = node.Nodes[index + 1];
  1171. node.Nodes.RemoveAt(index + 1);
  1172. node.Nodes.RemoveAt(index);
  1173. node.Nodes.Insert(index, lastNode);
  1174. node.Nodes.Insert(index + 1, treeNode);
  1175. treeView1.Focus();
  1176. treeView1.SelectedNode = treeNode;
  1177. }
  1178. }
  1179. }
  1180. #endregion
  1181. #region [表格信息向下]
  1182. #endregion
  1183. }
  1184. #endregion
  1185. #region [工具面板操作]
  1186. /// <summary>
  1187. /// 工具添加
  1188. /// </summary>
  1189. /// <param name="sender"></param>
  1190. /// <param name="e"></param>
  1191. private void button5_Click(object sender, EventArgs e)
  1192. {
  1193. if (this.treeView2.SelectedNode == null || this.treeView2.SelectedNode.Level != 1)
  1194. {
  1195. return;
  1196. }
  1197. if (this.listView2.Items.Count >= 8)
  1198. {
  1199. MessageBox.Show("最多只能添加8个快捷工具!");
  1200. return;
  1201. }
  1202. if (this.toolNameList.Contains(this.treeView2.SelectedNode.Text)) {
  1203. MessageBox.Show("不可添加重复的快捷工具!");
  1204. return;
  1205. }
  1206. #region [快捷工具列表中添加]
  1207. ListViewItem lvi = new ListViewItem();
  1208. lvi.Text = this.treeView2.SelectedNode.Text;
  1209. this.listView2.Items.Add(lvi);
  1210. #endregion
  1211. #region [快捷工具中添加]
  1212. this.addToolName(this.listView2.Items.Count, this.treeView2.SelectedNode.Text);
  1213. this.toolNameList.Add(this.treeView2.SelectedNode.Text);
  1214. this.toolNickNameList.Add("");
  1215. if (toolNameList.Count == 1) {
  1216. radioButton_SelectedChanged(radioButton1, e);
  1217. }
  1218. #endregion
  1219. }
  1220. /// <summary>
  1221. /// 工具移除
  1222. /// </summary>
  1223. /// <param name="sender"></param>
  1224. /// <param name="e"></param>
  1225. private void button6_Click(object sender, EventArgs e)
  1226. {
  1227. if (this.listView2.FocusedItem != null && this.listView2.FocusedItem.Selected)
  1228. {
  1229. int index = this.listView2.FocusedItem.Index;
  1230. this.removeToolName(index, this.listView2.FocusedItem.Text);
  1231. this.listView2.Items.RemoveAt(index);
  1232. }
  1233. }
  1234. /// <summary>
  1235. /// 工具向上
  1236. /// </summary>
  1237. /// <param name="sender"></param>
  1238. /// <param name="e"></param>
  1239. private void button7_Click(object sender, EventArgs e)
  1240. {
  1241. if (this.treeView2.SelectedNode == null || this.treeView2.SelectedNode.Level != 1)
  1242. {
  1243. return;
  1244. }
  1245. #region [快捷工具列表中向上]
  1246. if (this.listView2.FocusedItem != null && this.listView2.FocusedItem.Selected)
  1247. {
  1248. int index = this.listView2.FocusedItem.Index;
  1249. if (index != 0)
  1250. {
  1251. ListViewItem item = this.listView2.FocusedItem;
  1252. ListViewItem lastItem = this.listView2.Items[index - 1];
  1253. this.listView2.Items.RemoveAt(index);
  1254. this.listView2.Items.RemoveAt(index - 1);
  1255. this.listView2.Items.Insert(index - 1, item);
  1256. this.listView2.Items.Insert(index, lastItem);
  1257. moveToolName(index, 1);
  1258. }
  1259. }
  1260. #endregion
  1261. }
  1262. /// <summary>
  1263. /// 工具向下
  1264. /// </summary>
  1265. /// <param name="sender"></param>
  1266. /// <param name="e"></param>
  1267. private void button8_Click(object sender, EventArgs e)
  1268. {
  1269. if (this.treeView2.SelectedNode == null || this.treeView2.SelectedNode.Level != 1)
  1270. {
  1271. return;
  1272. }
  1273. #region [快捷工具列表中向下]
  1274. if (this.listView2.FocusedItem != null && this.listView2.FocusedItem.Selected)
  1275. {
  1276. int index = this.listView2.FocusedItem.Index;
  1277. if (index != this.listView2.Items.Count - 1)
  1278. {
  1279. ListViewItem item = this.listView2.FocusedItem;
  1280. ListViewItem lastItem = this.listView2.Items[index + 1];
  1281. this.listView2.Items.RemoveAt(index + 1);
  1282. this.listView2.Items.RemoveAt(index);
  1283. this.listView2.Items.Insert(index, lastItem);
  1284. this.listView2.Items.Insert(index + 1, item);
  1285. moveToolName(index, 2);
  1286. }
  1287. }
  1288. #endregion
  1289. }
  1290. /// <summary>
  1291. /// 添加快捷工具面板
  1292. /// </summary>
  1293. private void addToolName(int index, string name,string textName = "")
  1294. {
  1295. if (name.Length >= 5) {
  1296. name = $"{name.Substring(0, 4)}\r\n{name.Substring(4, name.Length - 4)}";
  1297. }
  1298. switch (index)
  1299. {
  1300. case 1:
  1301. this.radioButton1.Text = name;
  1302. if (!string.IsNullOrEmpty(textName))
  1303. textBox1.Text = textName;
  1304. break;
  1305. case 2:
  1306. this.radioButton2.Text = name;
  1307. if (!string.IsNullOrEmpty(textName))
  1308. textBox2.Text = textName;
  1309. break;
  1310. case 3:
  1311. this.radioButton3.Text = name;
  1312. if (!string.IsNullOrEmpty(textName))
  1313. textBox3.Text = textName;
  1314. break;
  1315. case 4:
  1316. this.radioButton4.Text = name;
  1317. if (!string.IsNullOrEmpty(textName))
  1318. textBox4.Text = textName;
  1319. break;
  1320. case 5:
  1321. this.radioButton5.Text = name;
  1322. if (!string.IsNullOrEmpty(textName))
  1323. textBox5.Text = textName;
  1324. break;
  1325. case 6:
  1326. this.radioButton6.Text = name;
  1327. if (!string.IsNullOrEmpty(textName))
  1328. textBox6.Text = textName;
  1329. break;
  1330. case 7:
  1331. this.radioButton7.Text = name;
  1332. if (!string.IsNullOrEmpty(textName))
  1333. textBox7.Text = textName;
  1334. break;
  1335. case 8:
  1336. this.radioButton8.Text = name;
  1337. if (!string.IsNullOrEmpty(textName))
  1338. textBox8.Text = textName;
  1339. break;
  1340. }
  1341. }
  1342. /// <summary>
  1343. /// 移除快捷工具面板
  1344. /// </summary>
  1345. private void removeToolName(int index, string name)
  1346. {
  1347. this.toolNameList.RemoveAt(index);
  1348. this.toolNickNameList.RemoveAt(index);
  1349. this.resetButton();
  1350. for (int i = 0; i < toolNameList.Count; i++)
  1351. {
  1352. addToolName(i + 1, toolNameList[i], toolNickNameList[i]);
  1353. }
  1354. }
  1355. /// <summary>
  1356. /// 重置状态
  1357. /// </summary>
  1358. private void resetButton()
  1359. {
  1360. this.radioButton1.Text = "未设置";
  1361. this.radioButton2.Text = "未设置";
  1362. this.radioButton3.Text = "未设置";
  1363. this.radioButton4.Text = "未设置";
  1364. this.radioButton5.Text = "未设置";
  1365. this.radioButton6.Text = "未设置";
  1366. this.radioButton7.Text = "未设置";
  1367. this.radioButton8.Text = "未设置";
  1368. this.textBox1.Text = "";
  1369. this.textBox2.Text = "";
  1370. this.textBox3.Text = "";
  1371. this.textBox4.Text = "";
  1372. this.textBox5.Text = "";
  1373. this.textBox6.Text = "";
  1374. this.textBox7.Text = "";
  1375. this.textBox8.Text = "";
  1376. #region [取消选中状态]
  1377. if (radioButton1.Checked)
  1378. {
  1379. radioButton1.Checked = false;
  1380. }
  1381. else if (radioButton2.Checked)
  1382. {
  1383. radioButton2.Checked = false;
  1384. }
  1385. else if (radioButton3.Checked)
  1386. {
  1387. radioButton3.Checked = false;
  1388. }
  1389. else if (radioButton4.Checked)
  1390. {
  1391. radioButton4.Checked = false;
  1392. }
  1393. else if (radioButton5.Checked)
  1394. {
  1395. radioButton5.Checked = false;
  1396. }
  1397. else if (radioButton6.Checked)
  1398. {
  1399. radioButton6.Checked = false;
  1400. }
  1401. else if (radioButton7.Checked)
  1402. {
  1403. radioButton7.Checked = false;
  1404. }
  1405. else if (radioButton8.Checked)
  1406. {
  1407. radioButton8.Checked = false;
  1408. }
  1409. #endregion
  1410. if (this.appWorkspace.ActiveDocumentWorkspace != null)
  1411. {
  1412. this.appWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.Pointer;
  1413. }
  1414. }
  1415. /// <summary>
  1416. /// 向上/向下移动快捷工具面板
  1417. /// </summary>
  1418. private void moveToolName(int index,int type)
  1419. {
  1420. switch (type)
  1421. {
  1422. case 1:
  1423. string toolName = this.toolNameList[index];
  1424. string lastToolName = this.toolNameList[index - 1];
  1425. string toolNickName = this.toolNickNameList[index];
  1426. string lastNickName = this.toolNickNameList[index - 1];
  1427. this.toolNameList.RemoveAt(index);
  1428. this.toolNameList.RemoveAt(index - 1);
  1429. this.toolNickNameList.RemoveAt(index);
  1430. this.toolNickNameList.RemoveAt(index - 1);
  1431. this.toolNameList.Insert(index - 1, toolName);
  1432. this.toolNameList.Insert(index, lastToolName);
  1433. this.toolNickNameList.Insert(index - 1, toolNickName);
  1434. this.toolNickNameList.Insert(index, lastNickName);
  1435. break;
  1436. case 2:
  1437. string toolName1 = this.toolNameList[index];
  1438. string lastToolName1 = this.toolNameList[index + 1];
  1439. string toolNickName1 = this.toolNickNameList[index];
  1440. string lastNickName1 = this.toolNickNameList[index + 1];
  1441. this.toolNameList.RemoveAt(index + 1);
  1442. this.toolNameList.RemoveAt(index);
  1443. this.toolNickNameList.RemoveAt(index + 1);
  1444. this.toolNickNameList.RemoveAt(index);
  1445. this.toolNameList.Insert(index, lastToolName1);
  1446. this.toolNameList.Insert(index + 1, toolName1);
  1447. this.toolNickNameList.Insert(index, lastNickName1);
  1448. this.toolNickNameList.Insert(index + 1, toolNickName1);
  1449. break;
  1450. }
  1451. for (int i = 0; i < toolNameList.Count; i++)
  1452. {
  1453. addToolName(i + 1, toolNameList[i], toolNickNameList[i]);
  1454. }
  1455. }
  1456. #endregion
  1457. /// <summary>
  1458. /// 修改别名
  1459. /// </summary>
  1460. /// <param name="sender"></param>
  1461. /// <param name="e"></param>
  1462. private void textBox1_TextChanged(object sender, EventArgs e)
  1463. {
  1464. var textbox = (TextBox)sender;
  1465. int type = Convert.ToInt32(textbox.Name.Substring(textbox.Name.Length - 1, 1));
  1466. if (toolNickNameList.Count > 0 && toolNickNameList.Count >= type)
  1467. {
  1468. toolNickNameList[type - 1] = textbox.Text;
  1469. RefreshListView(null, null);
  1470. }
  1471. }
  1472. /// <summary>
  1473. /// 选择快捷工具
  1474. /// </summary>
  1475. /// <param name="sender"></param>
  1476. /// <param name="e"></param>
  1477. private void radioButton_SelectedChanged(object sender, EventArgs e)
  1478. {
  1479. if (this.appWorkspace.ActiveDocumentWorkspace == null)
  1480. {
  1481. return;
  1482. }
  1483. var radioButto = (RadioButton)sender;
  1484. if (!radioButto.Checked) {
  1485. return;
  1486. }
  1487. int type = Convert.ToInt32(radioButto.Name.Substring(radioButto.Name.Length - 1, 1));
  1488. if (toolNameList.Count < type) {
  1489. this.appWorkspace.ActiveDocumentWorkspace.ActiveTool = new DrawToolType();
  1490. return;
  1491. }
  1492. var toolName = toolNameList[type - 1];
  1493. //获取工具英文
  1494. string enName = string.Empty;
  1495. foreach (var item in measureListSetModel.AttributeMapAllDataNodes)
  1496. {
  1497. var tool = item.Attribute.Where(m => m.Text.Equals(toolName)).FirstOrDefault();
  1498. if (tool == null) {
  1499. continue;
  1500. }
  1501. enName = tool.Name;
  1502. }
  1503. if (!string.IsNullOrEmpty(enName)) {
  1504. if (this.appWorkspace.ActiveDocumentWorkspace != null)
  1505. {
  1506. this.appWorkspace.ActiveDocumentWorkspace.ToolNumber = -1;
  1507. this.appWorkspace.ActiveDocumentWorkspace.ActiveTool = (DrawToolType)Enum.Parse(typeof(DrawToolType), enName);
  1508. if (this.appWorkspace.Widgets != null && this.appWorkspace.Widgets.GeometryMeasureDialog.Visible)
  1509. {
  1510. ContinuousDrawingAction();
  1511. }
  1512. }
  1513. }
  1514. }
  1515. /// <summary>
  1516. /// 连续绘制
  1517. /// </summary>
  1518. /// <param name="sender"></param>
  1519. /// <param name="e"></param>
  1520. private void ContinuousDrawingAction()
  1521. {
  1522. if ( this.appWorkspace.ActiveDocumentWorkspace != null)
  1523. {
  1524. this.appWorkspace.ActiveDocumentWorkspace.ContinuousDrawingMeasure = true;
  1525. this.appWorkspace.continuousDrawingMeasure = true;
  1526. for (int i = 0; i < this.appWorkspace.DocumentWorkspaces.Length; i++)
  1527. {
  1528. this.appWorkspace.DocumentWorkspaces[i].ContinuousDrawingMeasure = true;
  1529. }
  1530. this.appWorkspace.toolBar.RefreshBtnSelect(this.appWorkspace.ActiveDocumentWorkspace.ContinuousDrawingMeasure, "ContinuousDrawingMeasure");
  1531. this.appWorkspace.toolsPanel.RefreshBtnSelect(this.appWorkspace.ActiveDocumentWorkspace.ContinuousDrawingMeasure, "ContinuousDrawingMeasure");
  1532. if (! this.appWorkspace.ActiveDocumentWorkspace.ContinuousDrawingMeasure
  1533. && this.appWorkspace.ActiveDocumentWorkspace.activeTool >= DrawToolType.MeasureLine && this.appWorkspace.ActiveDocumentWorkspace.activeTool <= DrawToolType.MeasureThreePointArc)
  1534. {
  1535. this.appWorkspace.ActiveDocumentWorkspace.ToolNumber = -1;
  1536. this.appWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.Pointer;
  1537. }
  1538. this.appWorkspace.ActiveDocumentWorkspace.ContinuousDrawingMeasure = true;
  1539. }
  1540. if ( this.appWorkspace.cameraPreviewDialog != null && ! this.appWorkspace.cameraPreviewDialog.IsDisposed)
  1541. {
  1542. this.appWorkspace.cameraPreviewDialog.documentWorkspace.ContinuousDrawingMeasure = true;
  1543. if ( this.appWorkspace.ActiveDocumentWorkspace != null) this.appWorkspace.continuousDrawingMeasure = true;
  1544. for (int i = 0; i < this.appWorkspace.DocumentWorkspaces.Length; i++)
  1545. {
  1546. this.appWorkspace.DocumentWorkspaces[i].ContinuousDrawingMeasure = true;
  1547. }
  1548. this.appWorkspace.toolBar.RefreshBtnSelect(this.appWorkspace.cameraPreviewDialog.documentWorkspace.ContinuousDrawingMeasure, "ContinuousDrawingMeasure");
  1549. this.appWorkspace.toolsPanel.RefreshBtnSelect(this.appWorkspace.cameraPreviewDialog.documentWorkspace.ContinuousDrawingMeasure, "ContinuousDrawingMeasure");
  1550. if (! this.appWorkspace.cameraPreviewDialog.documentWorkspace.ContinuousDrawingMeasure)
  1551. {
  1552. this.appWorkspace.cameraPreviewDialog.documentWorkspace.ActiveTool = DrawToolType.Pointer;
  1553. }
  1554. if ( this.appWorkspace.ActiveDocumentWorkspace != null
  1555. && this.appWorkspace.ActiveDocumentWorkspace.activeTool >= DrawToolType.MeasureLine
  1556. && this.appWorkspace.ActiveDocumentWorkspace.activeTool <= DrawToolType.MeasureThreePointArc)
  1557. {
  1558. this.appWorkspace.ActiveDocumentWorkspace.ToolNumber = -1;
  1559. }
  1560. this.appWorkspace.ActiveDocumentWorkspace.ContinuousDrawingMeasure = true;
  1561. }
  1562. }
  1563. /// <summary>
  1564. /// 删除一条数据
  1565. /// </summary>
  1566. /// <param name="sender"></param>
  1567. /// <param name="e"></param>
  1568. private void button3_Click(object sender, EventArgs e)
  1569. {
  1570. if (this.listView1.FocusedItem != null && this.listView1.FocusedItem.Selected)
  1571. {
  1572. var index = this.listView1.FocusedItem.Index;
  1573. DrawObject drawObject = (DrawObject)this.listView1.Items[index].Tag;
  1574. this.listView1.Items.RemoveAt(index);
  1575. if (this.appWorkspace.DocumentWorkspaces != null && this.appWorkspace.DocumentWorkspaces.Length > 0)
  1576. {
  1577. for (int k = 0; k <= this.appWorkspace.DocumentWorkspaces.Length - 1; k++)
  1578. {
  1579. for (int i = 0; i < this.appWorkspace.DocumentWorkspaces[k].GraphicsList.Count; i++)
  1580. {
  1581. if (!this.appWorkspace.DocumentWorkspaces[k].GraphicsList[i].Equals(drawObject))
  1582. {
  1583. continue;
  1584. }
  1585. this.appWorkspace.DocumentWorkspaces[k].GraphicsList.RemoveObj(drawObject);
  1586. this.appWorkspace.DocumentWorkspaces[k].Refresh();
  1587. }
  1588. }
  1589. }
  1590. }
  1591. }
  1592. /// <summary>
  1593. /// 清空数据
  1594. /// </summary>
  1595. /// <param name="sender"></param>
  1596. /// <param name="e"></param>
  1597. private void button2_Click(object sender, EventArgs e)
  1598. {
  1599. this.listView1.Items.Clear();
  1600. //this.appWorkspace.ActiveDocumentWorkspace.GraphicsList.Clear();
  1601. //this.appWorkspace.ActiveDocumentWorkspace.Refresh();
  1602. if (this.appWorkspace.DocumentWorkspaces != null && this.appWorkspace.DocumentWorkspaces.Length > 0)
  1603. {
  1604. for (int k = 0; k <= this.appWorkspace.DocumentWorkspaces.Length - 1; k++)
  1605. {
  1606. this.appWorkspace.DocumentWorkspaces[k].GraphicsList.Clear();
  1607. this.appWorkspace.DocumentWorkspaces[k].Refresh();
  1608. }
  1609. }
  1610. }
  1611. /// <summary>
  1612. /// 获取别名
  1613. /// </summary>
  1614. /// <returns></returns>
  1615. private string getNickName(DrawObject measureDrawObject)
  1616. {
  1617. try
  1618. {
  1619. var enName = measureDrawObject.drawToolType.ToString();
  1620. foreach (var item in measureListSetModel.AttributeMapAllDataNodes)
  1621. {
  1622. var tool = item.Attribute.Where(m => m.Name.Equals(enName)).FirstOrDefault();
  1623. if (tool == null)
  1624. {
  1625. continue;
  1626. }
  1627. if (toolNameList.Contains(tool.Text)) {
  1628. var index = toolNameList.IndexOf(tool.Text);
  1629. return string.IsNullOrEmpty(toolNickNameList[index]) ? toolNameList[index] : toolNickNameList[index];
  1630. }
  1631. return tool.Text;
  1632. }
  1633. return "";
  1634. }
  1635. catch (Exception)
  1636. {
  1637. return "默认";
  1638. }
  1639. }
  1640. /// <summary>
  1641. /// 获取数据
  1642. /// </summary>
  1643. /// <param name="drawToolType"></param>
  1644. /// <returns></returns>
  1645. private void getLstViewItem(DrawObject measureDrawObject)
  1646. {
  1647. double length;
  1648. double area;
  1649. double angle;
  1650. string name = getNickName(measureDrawObject);
  1651. MeasureDrawObject measureData = (MeasureDrawObject)measureDrawObject;
  1652. Dictionary<System.Enum, object> data = measureData.GetData();
  1653. switch (measureDrawObject.drawToolType)
  1654. {
  1655. case DrawToolType.MeasureLine:
  1656. if (data.ContainsKey(MeasureAttributes.PhysicalLength))
  1657. {
  1658. object val;
  1659. data.TryGetValue(MeasureAttributes.PhysicalLength, out val);
  1660. length = Convert.ToDouble(val);
  1661. }
  1662. else
  1663. {
  1664. length = 0;
  1665. }
  1666. area = 0;
  1667. angle = 0;
  1668. addListViewData(name, length, area, angle, measureDrawObject,1);
  1669. break;
  1670. case DrawToolType.MeasureDistanceLine:
  1671. if (data.ContainsKey(MeasureAttributes.PhysicalLength))
  1672. {
  1673. object val;
  1674. data.TryGetValue(MeasureAttributes.PhysicalLength, out val);
  1675. length = Convert.ToDouble(val);
  1676. }
  1677. else
  1678. {
  1679. length = 0;
  1680. }
  1681. area = 0;
  1682. angle = 0;
  1683. addListViewData(name, length, area, angle, measureDrawObject, 1);
  1684. break;
  1685. case DrawToolType.MeasureLength:
  1686. if (data.ContainsKey(MeasureAttributes.PhysicalLength))
  1687. {
  1688. object val;
  1689. data.TryGetValue(MeasureAttributes.PhysicalLength, out val);
  1690. length = Convert.ToDouble(val);
  1691. }
  1692. else
  1693. {
  1694. length = 0;
  1695. }
  1696. area = 0;
  1697. angle = 0;
  1698. addListViewData(name, length, area, angle, measureDrawObject, 1);
  1699. break;
  1700. case DrawToolType.MeasureHLine:
  1701. if (data.ContainsKey(MeasureAttributes.PhysicalLength))
  1702. {
  1703. object val;
  1704. data.TryGetValue(MeasureAttributes.PhysicalLength, out val);
  1705. length = Convert.ToDouble(val);
  1706. }
  1707. else
  1708. {
  1709. length = 0;
  1710. }
  1711. area = 0;
  1712. angle = 0;
  1713. addListViewData(name, length, area, angle, measureDrawObject, 1);
  1714. break;
  1715. case DrawToolType.MeasureVLine:
  1716. if (data.ContainsKey(MeasureAttributes.PhysicalLength))
  1717. {
  1718. object val;
  1719. data.TryGetValue(MeasureAttributes.PhysicalLength, out val);
  1720. length = Convert.ToDouble(val);
  1721. }
  1722. else
  1723. {
  1724. length = 0;
  1725. }
  1726. area = 0;
  1727. angle = 0;
  1728. addListViewData(name, length, area, angle, measureDrawObject, 1);
  1729. break;
  1730. case DrawToolType.MeasureMulLine:
  1731. MeasureMulLine line = (MeasureMulLine)measureDrawObject;
  1732. area = 0;
  1733. angle = 0;
  1734. if (data.ContainsKey(MeasureAttributes.PhysicalLength))
  1735. {
  1736. for (int i = 0; i <= line.lengthParagraphs.Count - 1; i++)
  1737. {
  1738. addListViewData(name, Convert.ToDouble(line.lengthParagraphs[i]), area, angle, measureDrawObject);
  1739. }
  1740. }
  1741. else
  1742. {
  1743. for (int i = 0; i <= line.lengthParagraphs.Count - 1; i++)
  1744. {
  1745. addListViewData(name, 0, area, angle, measureDrawObject);
  1746. }
  1747. }
  1748. break;
  1749. case DrawToolType.MeasureMulHVLine:
  1750. MeasureMulHVLine measureMulHVLine = (MeasureMulHVLine)measureDrawObject;
  1751. area = 0;
  1752. angle = 0;
  1753. if (data.ContainsKey(MeasureAttributes.PhysicalLength))
  1754. {
  1755. for (int i = 0; i <= measureMulHVLine.lengthParagraphs.Count - 1; i++)
  1756. {
  1757. addListViewData(name, Convert.ToDouble(measureMulHVLine.lengthParagraphs[i]), area, angle, measureDrawObject);
  1758. }
  1759. }
  1760. else
  1761. {
  1762. for (int i = 0; i <= measureMulHVLine.lengthParagraphs.Count - 1; i++)
  1763. {
  1764. addListViewData(name, 0, area, angle, measureDrawObject);
  1765. }
  1766. }
  1767. break;
  1768. case DrawToolType.MeasureMulSegment:
  1769. MeasureMulSegment measureMulSegment = (MeasureMulSegment)measureDrawObject;
  1770. area = 0;
  1771. angle = 0;
  1772. if (data.ContainsKey(MeasureAttributes.PhysicalLength))
  1773. {
  1774. for (int i = 0; i <= measureMulSegment.lengthParagraphs.Count - 1; i++)
  1775. {
  1776. addListViewData(name, Convert.ToDouble(measureMulSegment.lengthParagraphs[i]), area, angle, measureDrawObject);
  1777. }
  1778. }
  1779. else
  1780. {
  1781. for (int i = 0; i <= measureMulSegment.lengthParagraphs.Count - 1; i++)
  1782. {
  1783. addListViewData(name, 0, area, angle, measureDrawObject);
  1784. }
  1785. }
  1786. break;
  1787. case DrawToolType.MeasureMulVLine:
  1788. MeasureMulVLine measureMulVLine = (MeasureMulVLine)measureDrawObject;
  1789. area = 0;
  1790. angle = 0;
  1791. if (data.ContainsKey(MeasureAttributes.PhysicalLength))
  1792. {
  1793. for (int i = 0; i <= measureMulVLine.lengthParagraphs.Count - 1; i++)
  1794. {
  1795. addListViewData(name, Convert.ToDouble(measureMulVLine.lengthParagraphs[i]), area, angle, measureDrawObject);
  1796. }
  1797. }
  1798. else
  1799. {
  1800. for (int i = 0; i <= measureMulVLine.lengthParagraphs.Count - 1; i++)
  1801. {
  1802. addListViewData(name, 0, area, angle, measureDrawObject);
  1803. }
  1804. }
  1805. break;
  1806. case DrawToolType.MeasureBrokenLine:
  1807. if (data.ContainsKey(MeasureAttributes.PhysicalLength))
  1808. {
  1809. object val;
  1810. data.TryGetValue(MeasureAttributes.PhysicalLength, out val);
  1811. length = Convert.ToDouble(val);
  1812. }
  1813. else
  1814. {
  1815. length = 0;
  1816. }
  1817. area = 0;
  1818. angle = 0;
  1819. addListViewData(name, length, area, angle, measureDrawObject, 1);
  1820. break;
  1821. case DrawToolType.MeasureTraceCurve:
  1822. if (data.ContainsKey(MeasureAttributes.PhysicalLength))
  1823. {
  1824. object val;
  1825. data.TryGetValue(MeasureAttributes.PhysicalLength, out val);
  1826. length = Convert.ToDouble(val);
  1827. }
  1828. else
  1829. {
  1830. length = 0;
  1831. }
  1832. area = 0;
  1833. angle = 0;
  1834. addListViewData(name, length, area, angle, measureDrawObject, 1);
  1835. break;
  1836. case DrawToolType.MeasureCurveLine:
  1837. if (data.ContainsKey(MeasureAttributes.PhysicalLength))
  1838. {
  1839. object val;
  1840. data.TryGetValue(MeasureAttributes.PhysicalLength, out val);
  1841. length = Convert.ToDouble(val);
  1842. }
  1843. else
  1844. {
  1845. length = 0;
  1846. }
  1847. area = 0;
  1848. angle = 0;
  1849. addListViewData(name, length, area, angle, measureDrawObject, 1);
  1850. break;
  1851. case DrawToolType.MeasurePLine:
  1852. if (data.ContainsKey(MeasureAttributes.PhysicalLength))
  1853. {
  1854. object val;
  1855. data.TryGetValue(MeasureAttributes.PhysicalLength, out val);
  1856. length = Convert.ToDouble(val);
  1857. }
  1858. else
  1859. {
  1860. length = 0;
  1861. }
  1862. area = 0;
  1863. angle = 0;
  1864. addListViewData(name, length, area, angle, measureDrawObject, 1);
  1865. break;
  1866. case DrawToolType.MeasureMulPLine:
  1867. MeasureMulPLine measureMulPLine = (MeasureMulPLine)measureDrawObject;
  1868. area = 0;
  1869. angle = 0;
  1870. if (data.ContainsKey(MeasureAttributes.PhysicalLength))
  1871. {
  1872. for (int i = 0; i <= measureMulPLine.lengthParagraphs.Count - 1; i++)
  1873. {
  1874. addListViewData(name, Convert.ToDouble(measureMulPLine.lengthParagraphs[i]), area, angle, measureDrawObject);
  1875. }
  1876. }
  1877. else
  1878. {
  1879. for (int i = 0; i <= measureMulPLine.lengthParagraphs.Count - 1; i++)
  1880. {
  1881. addListViewData(name, 0, area, angle, measureDrawObject);
  1882. }
  1883. }
  1884. break;
  1885. case DrawToolType.MeasureHMulPLine:
  1886. MeasureHMulPLine measureHMulPLine = (MeasureHMulPLine)measureDrawObject;
  1887. area = 0;
  1888. angle = 0;
  1889. if (data.ContainsKey(MeasureAttributes.PhysicalLength))
  1890. {
  1891. for (int i = 0; i <= measureHMulPLine.lengthParagraphs.Count - 1; i++)
  1892. {
  1893. addListViewData(name, Convert.ToDouble(measureHMulPLine.lengthParagraphs[i]), area, angle, measureDrawObject);
  1894. }
  1895. }
  1896. else
  1897. {
  1898. for (int i = 0; i <= measureHMulPLine.lengthParagraphs.Count - 1; i++)
  1899. {
  1900. addListViewData(name, 0, area, angle, measureDrawObject);
  1901. }
  1902. }
  1903. break;
  1904. case DrawToolType.MeasureVMulPLine:
  1905. MeasureVMulPLine measureVMulPLine = (MeasureVMulPLine)measureDrawObject;
  1906. area = 0;
  1907. angle = 0;
  1908. if (data.ContainsKey(MeasureAttributes.PhysicalLength))
  1909. {
  1910. for (int i = 0; i <= measureVMulPLine.lengthParagraphs.Count - 1; i++)
  1911. {
  1912. addListViewData(name, Convert.ToDouble(measureVMulPLine.lengthParagraphs[i]), area, angle, measureDrawObject);
  1913. }
  1914. }
  1915. else
  1916. {
  1917. for (int i = 0; i <= measureVMulPLine.lengthParagraphs.Count - 1; i++)
  1918. {
  1919. addListViewData(name, 0, area, angle, measureDrawObject);
  1920. }
  1921. }
  1922. break;
  1923. case DrawToolType.MeasurePointHLine:
  1924. if (data.ContainsKey(MeasureAttributes.PhysicalLength))
  1925. {
  1926. object val;
  1927. data.TryGetValue(MeasureAttributes.PhysicalLength, out val);
  1928. length = Convert.ToDouble(val);
  1929. }
  1930. else
  1931. {
  1932. length = 0;
  1933. }
  1934. area = 0;
  1935. angle = 0;
  1936. addListViewData(name, length, area, angle, measureDrawObject, 1);
  1937. break;
  1938. case DrawToolType.MeasureParallelLine:
  1939. if (data.ContainsKey(MeasureAttributes.PhysicalLength))
  1940. {
  1941. object val;
  1942. data.TryGetValue(MeasureAttributes.PhysicalLength, out val);
  1943. length = Convert.ToDouble(val);
  1944. }
  1945. else
  1946. {
  1947. length = 0;
  1948. }
  1949. area = 0;
  1950. angle = 0;
  1951. addListViewData(name, length, area, angle, measureDrawObject, 1);
  1952. break;
  1953. case DrawToolType.MeasureMulParallelLine:
  1954. MeasureMulParallelLine measureVMulPLine1 = (MeasureMulParallelLine)measureDrawObject;
  1955. area = 0;
  1956. angle = 0;
  1957. if (data.ContainsKey(MeasureAttributes.PhysicalLength))
  1958. {
  1959. for (int i = 0; i <= measureVMulPLine1.lengthParagraphs.Count - 1; i++)
  1960. {
  1961. addListViewData(name, Convert.ToDouble(measureVMulPLine1.lengthParagraphs[i]), area, angle, measureDrawObject);
  1962. }
  1963. }
  1964. else
  1965. {
  1966. for (int i = 0; i <= measureVMulPLine1.lengthParagraphs.Count - 1; i++)
  1967. {
  1968. addListViewData(name, 0, area, angle, measureDrawObject);
  1969. }
  1970. }
  1971. break;
  1972. case DrawToolType.MeasureVMulParallelLine:
  1973. MeasureVMulParallelLine measureVMulParallelLine = (MeasureVMulParallelLine)measureDrawObject;
  1974. area = 0;
  1975. angle = 0;
  1976. if (data.ContainsKey(MeasureAttributes.PhysicalLength))
  1977. {
  1978. for (int i = 0; i <= measureVMulParallelLine.lengthParagraphs.Count - 1; i++)
  1979. {
  1980. addListViewData(name, Convert.ToDouble(measureVMulParallelLine.lengthParagraphs[i]), area, angle, measureDrawObject);
  1981. }
  1982. }
  1983. else
  1984. {
  1985. for (int i = 0; i <= measureVMulParallelLine.lengthParagraphs.Count - 1; i++)
  1986. {
  1987. addListViewData(name, 0, area, angle, measureDrawObject);
  1988. }
  1989. }
  1990. break;
  1991. case DrawToolType.MeasureHMulParallelLine:
  1992. MeasureHMulParallelLine measureHMulParallelLine = (MeasureHMulParallelLine)measureDrawObject;
  1993. area = 0;
  1994. angle = 0;
  1995. if (data.ContainsKey(MeasureAttributes.PhysicalLength))
  1996. {
  1997. for (int i = 0; i <= measureHMulParallelLine.lengthParagraphs.Count - 1; i++)
  1998. {
  1999. addListViewData(name, Convert.ToDouble(measureHMulParallelLine.lengthParagraphs[i]), area, angle, measureDrawObject);
  2000. }
  2001. }
  2002. else
  2003. {
  2004. for (int i = 0; i <= measureHMulParallelLine.lengthParagraphs.Count - 1; i++)
  2005. {
  2006. addListViewData(name, 0, area, angle, measureDrawObject);
  2007. }
  2008. }
  2009. break;
  2010. case DrawToolType.MeasureClosedCurve:
  2011. if (data.ContainsKey(MeasureAttributes.PhysicalLength))
  2012. {
  2013. object val;
  2014. data.TryGetValue(MeasureAttributes.PhysicalLength, out val);
  2015. length = Convert.ToDouble(val);
  2016. }
  2017. else
  2018. {
  2019. length = 0;
  2020. }
  2021. if (data.ContainsKey(MeasureAttributes.PhysicalArea))
  2022. {
  2023. object val;
  2024. data.TryGetValue(MeasureAttributes.PhysicalArea, out val);
  2025. area = Convert.ToDouble(val);
  2026. }
  2027. else {
  2028. area = 0;
  2029. }
  2030. angle = 0;
  2031. addListViewData(name, length, area, angle, measureDrawObject, 1);
  2032. break;
  2033. case DrawToolType.MeasurePolygon:
  2034. if (data.ContainsKey(MeasureAttributes.PhysicalLength))
  2035. {
  2036. object val;
  2037. data.TryGetValue(MeasureAttributes.PhysicalLength, out val);
  2038. length = Convert.ToDouble(val);
  2039. }
  2040. else
  2041. {
  2042. length = 0;
  2043. }
  2044. if (data.ContainsKey(MeasureAttributes.PhysicalArea))
  2045. {
  2046. object val;
  2047. data.TryGetValue(MeasureAttributes.PhysicalArea, out val);
  2048. area = Convert.ToDouble(val);
  2049. }
  2050. else
  2051. {
  2052. area = 0;
  2053. }
  2054. angle = 0;
  2055. addListViewData(name, length, area, angle, measureDrawObject, 1);
  2056. break;
  2057. case DrawToolType.MeasureRectangle:
  2058. if (data.ContainsKey(MeasureAttributes.PhysicalLength))
  2059. {
  2060. object val;
  2061. data.TryGetValue(MeasureAttributes.PhysicalLength, out val);
  2062. length = Convert.ToDouble(val);
  2063. }
  2064. else
  2065. {
  2066. length = 0;
  2067. }
  2068. if (data.ContainsKey(MeasureAttributes.PhysicalArea))
  2069. {
  2070. object val;
  2071. data.TryGetValue(MeasureAttributes.PhysicalArea, out val);
  2072. area = Convert.ToDouble(val);
  2073. }
  2074. else
  2075. {
  2076. area = 0;
  2077. }
  2078. angle = 0;
  2079. addListViewData(name, length, area, angle, measureDrawObject, 1);
  2080. break;
  2081. case DrawToolType.MeasureRandRectangle:
  2082. if (data.ContainsKey(MeasureAttributes.PhysicalLength))
  2083. {
  2084. object val;
  2085. data.TryGetValue(MeasureAttributes.PhysicalLength, out val);
  2086. length = Convert.ToDouble(val);
  2087. }
  2088. else
  2089. {
  2090. length = 0;
  2091. }
  2092. if (data.ContainsKey(MeasureAttributes.PhysicalArea))
  2093. {
  2094. object val;
  2095. data.TryGetValue(MeasureAttributes.PhysicalArea, out val);
  2096. area = Convert.ToDouble(val);
  2097. }
  2098. else
  2099. {
  2100. area = 0;
  2101. }
  2102. angle = 0;
  2103. addListViewData(name, length, area, angle, measureDrawObject, 1);
  2104. break;
  2105. case DrawToolType.MeasureSquare:
  2106. if (data.ContainsKey(MeasureAttributes.PhysicalLength))
  2107. {
  2108. object val;
  2109. data.TryGetValue(MeasureAttributes.PhysicalLength, out val);
  2110. length = Convert.ToDouble(val);
  2111. }
  2112. else
  2113. {
  2114. length = 0;
  2115. }
  2116. if (data.ContainsKey(MeasureAttributes.PhysicalArea))
  2117. {
  2118. object val;
  2119. data.TryGetValue(MeasureAttributes.PhysicalArea, out val);
  2120. area = Convert.ToDouble(val);
  2121. }
  2122. else
  2123. {
  2124. area = 0;
  2125. }
  2126. angle = 0;
  2127. addListViewData(name, length, area, angle, measureDrawObject, 1);
  2128. break;
  2129. case DrawToolType.MeasureRandSquare:
  2130. MeasureDrawObject measureRandSquare = (MeasureDrawObject)measureDrawObject;
  2131. if (data.ContainsKey(MeasureAttributes.PhysicalLength))
  2132. {
  2133. object val;
  2134. data.TryGetValue(MeasureAttributes.PhysicalLength, out val);
  2135. length = Convert.ToDouble(val);
  2136. }
  2137. else
  2138. {
  2139. length = 0;
  2140. }
  2141. if (data.ContainsKey(MeasureAttributes.PhysicalArea))
  2142. {
  2143. object val;
  2144. data.TryGetValue(MeasureAttributes.PhysicalArea, out val);
  2145. area = Convert.ToDouble(val);
  2146. }
  2147. else
  2148. {
  2149. area = 0;
  2150. }
  2151. angle = 0;
  2152. addListViewData(name, length, area, angle, measureDrawObject, 1);
  2153. break;
  2154. case DrawToolType.MeasureTracePolygon:
  2155. if (data.ContainsKey(MeasureAttributes.PhysicalLength))
  2156. {
  2157. object val;
  2158. data.TryGetValue(MeasureAttributes.PhysicalLength, out val);
  2159. length = Convert.ToDouble(val);
  2160. }
  2161. else
  2162. {
  2163. length = 0;
  2164. }
  2165. if (data.ContainsKey(MeasureAttributes.PhysicalArea))
  2166. {
  2167. object val;
  2168. data.TryGetValue(MeasureAttributes.PhysicalArea, out val);
  2169. area = Convert.ToDouble(val);
  2170. }
  2171. else
  2172. {
  2173. area = 0;
  2174. }
  2175. angle = 0;
  2176. addListViewData(name, length, area, angle, measureDrawObject, 1);
  2177. break;
  2178. case DrawToolType.MeasureCircle:
  2179. if (data.ContainsKey(MeasureAttributes.PhysicalRadius))
  2180. {
  2181. object val;
  2182. data.TryGetValue(MeasureAttributes.PhysicalRadius, out val);
  2183. length = Convert.ToDouble(val);
  2184. }
  2185. else
  2186. {
  2187. length = 0;
  2188. }
  2189. if (data.ContainsKey(MeasureAttributes.PhysicalArea))
  2190. {
  2191. object val;
  2192. data.TryGetValue(MeasureAttributes.PhysicalArea, out val);
  2193. area = Convert.ToDouble(val);
  2194. }
  2195. else
  2196. {
  2197. area = 0;
  2198. }
  2199. angle = 0;
  2200. addListViewData(name, length, area, angle, measureDrawObject, 1);
  2201. break;
  2202. case DrawToolType.MeasureInnerCircle:
  2203. if (data.ContainsKey(MeasureAttributes.PhysicalRadius))
  2204. {
  2205. object val;
  2206. data.TryGetValue(MeasureAttributes.PhysicalRadius, out val);
  2207. length = Convert.ToDouble(val);
  2208. }
  2209. else
  2210. {
  2211. length = 0;
  2212. }
  2213. if (data.ContainsKey(MeasureAttributes.PhysicalArea))
  2214. {
  2215. object val;
  2216. data.TryGetValue(MeasureAttributes.PhysicalArea, out val);
  2217. area = Convert.ToDouble(val);
  2218. }
  2219. else
  2220. {
  2221. area = 0;
  2222. }
  2223. angle = 0;
  2224. addListViewData(name, length, area, angle, measureDrawObject, 1);
  2225. break;
  2226. case DrawToolType.MeasureOuterCircle:
  2227. if (data.ContainsKey(MeasureAttributes.PhysicalRadius))
  2228. {
  2229. object val;
  2230. data.TryGetValue(MeasureAttributes.PhysicalRadius, out val);
  2231. length = Convert.ToDouble(val);
  2232. }
  2233. else
  2234. {
  2235. length = 0;
  2236. }
  2237. if (data.ContainsKey(MeasureAttributes.PhysicalArea))
  2238. {
  2239. object val;
  2240. data.TryGetValue(MeasureAttributes.PhysicalArea, out val);
  2241. area = Convert.ToDouble(val);
  2242. }
  2243. else
  2244. {
  2245. area = 0;
  2246. }
  2247. angle = 0;
  2248. addListViewData(name, length, area, angle, measureDrawObject, 1);
  2249. break;
  2250. case DrawToolType.MeasureDiameterCircle:
  2251. if (data.ContainsKey(MeasureAttributes.PhysicalRadius))
  2252. {
  2253. object val;
  2254. data.TryGetValue(MeasureAttributes.PhysicalRadius, out val);
  2255. length = Convert.ToDouble(val);
  2256. }
  2257. else
  2258. {
  2259. length = 0;
  2260. }
  2261. if (data.ContainsKey(MeasureAttributes.PhysicalArea))
  2262. {
  2263. object val;
  2264. data.TryGetValue(MeasureAttributes.PhysicalArea, out val);
  2265. area = Convert.ToDouble(val);
  2266. }
  2267. else
  2268. {
  2269. area = 0;
  2270. }
  2271. angle = 0;
  2272. addListViewData(name, length, area, angle, measureDrawObject, 1);
  2273. break;
  2274. case DrawToolType.MeasurePointCenterSize:
  2275. if (data.ContainsKey(MeasureAttributes.PhysicalDistance))
  2276. {
  2277. object val;
  2278. data.TryGetValue(MeasureAttributes.PhysicalDistance, out val);
  2279. length = Convert.ToDouble(val);
  2280. }
  2281. else
  2282. {
  2283. length = 0;
  2284. }
  2285. if (data.ContainsKey(MeasureAttributes.PhysicalArea))
  2286. {
  2287. object val;
  2288. data.TryGetValue(MeasureAttributes.PhysicalArea, out val);
  2289. area = Convert.ToDouble(val);
  2290. }
  2291. else
  2292. {
  2293. area = 0;
  2294. }
  2295. angle = 0;
  2296. addListViewData(name, length, area, angle, measureDrawObject, 1);
  2297. break;
  2298. case DrawToolType.MeasureCenterCenterSize:
  2299. if (data.ContainsKey(MeasureAttributes.PhysicalDistance))
  2300. {
  2301. object val;
  2302. data.TryGetValue(MeasureAttributes.PhysicalDistance, out val);
  2303. length = Convert.ToDouble(val);
  2304. }
  2305. else
  2306. {
  2307. length = 0;
  2308. }
  2309. if (data.ContainsKey(MeasureAttributes.PhysicalArea))
  2310. {
  2311. object val;
  2312. data.TryGetValue(MeasureAttributes.PhysicalArea, out val);
  2313. area = Convert.ToDouble(val);
  2314. }
  2315. else
  2316. {
  2317. area = 0;
  2318. }
  2319. angle = 0;
  2320. addListViewData(name, length, area, angle, measureDrawObject, 1);
  2321. break;
  2322. case DrawToolType.MeasurePointArcSize:
  2323. if (data.ContainsKey(MeasureAttributes.PhysicalDistance))
  2324. {
  2325. object val;
  2326. data.TryGetValue(MeasureAttributes.PhysicalDistance, out val);
  2327. length = Convert.ToDouble(val);
  2328. }
  2329. else
  2330. {
  2331. length = 0;
  2332. }
  2333. if (data.ContainsKey(MeasureAttributes.PhysicalArea))
  2334. {
  2335. object val;
  2336. data.TryGetValue(MeasureAttributes.PhysicalArea, out val);
  2337. area = Convert.ToDouble(val);
  2338. }
  2339. else
  2340. {
  2341. area = 0;
  2342. }
  2343. angle = 0;
  2344. addListViewData(name, length, area, angle, measureDrawObject, 1);
  2345. break;
  2346. case DrawToolType.MeasureTwoLineVLDistance:
  2347. if (data.ContainsKey(MeasureAttributes.PhysicalLength))
  2348. {
  2349. object val;
  2350. data.TryGetValue(MeasureAttributes.PhysicalLength, out val);
  2351. length = Convert.ToDouble(val);
  2352. }
  2353. else
  2354. {
  2355. length = 0;
  2356. }
  2357. area = 0;
  2358. angle = 0;
  2359. addListViewData(name, length, area, angle, measureDrawObject, 1);
  2360. break;
  2361. case DrawToolType.MeasurePointEdgeSize:
  2362. if (data.ContainsKey(MeasureAttributes.PhysicalDistance))
  2363. {
  2364. object val;
  2365. data.TryGetValue(MeasureAttributes.PhysicalDistance, out val);
  2366. length = Convert.ToDouble(val);
  2367. }
  2368. else
  2369. {
  2370. length = 0;
  2371. }
  2372. if (data.ContainsKey(MeasureAttributes.PhysicalArea))
  2373. {
  2374. object val;
  2375. data.TryGetValue(MeasureAttributes.PhysicalArea, out val);
  2376. area = Convert.ToDouble(val);
  2377. }
  2378. else
  2379. {
  2380. area = 0;
  2381. }
  2382. angle = 0;
  2383. addListViewData(name, length, area, angle, measureDrawObject, 1);
  2384. break;
  2385. case DrawToolType.MeasureThreePointAngle:
  2386. length = 0;
  2387. area = 0;
  2388. if (data.ContainsKey(MeasureAttributes.Angle))
  2389. {
  2390. object val;
  2391. data.TryGetValue(MeasureAttributes.Angle, out val);
  2392. angle = Convert.ToDouble(val);
  2393. }
  2394. else
  2395. {
  2396. angle = 0;
  2397. }
  2398. addListViewData(name, length, area, angle, measureDrawObject, 1);
  2399. break;
  2400. case DrawToolType.MeasureFourPointAngle:
  2401. length = 0;
  2402. area = 0;
  2403. if (data.ContainsKey(MeasureAttributes.Angle))
  2404. {
  2405. object val;
  2406. data.TryGetValue(MeasureAttributes.Angle, out val);
  2407. angle = Convert.ToDouble(val);
  2408. }
  2409. else
  2410. {
  2411. angle = 0;
  2412. }
  2413. addListViewData(name, length, area, angle, measureDrawObject, 1);
  2414. break;
  2415. case DrawToolType.MeasureThreePointArc:
  2416. if (data.ContainsKey(MeasureAttributes.PhysicalRadius))
  2417. {
  2418. object val;
  2419. data.TryGetValue(MeasureAttributes.PhysicalRadius, out val);
  2420. length = Convert.ToDouble(val);
  2421. }
  2422. else
  2423. {
  2424. length = 0;
  2425. }
  2426. if (data.ContainsKey(MeasureAttributes.PhysicalArea))
  2427. {
  2428. object val;
  2429. data.TryGetValue(MeasureAttributes.PhysicalArea, out val);
  2430. area = Convert.ToDouble(val);
  2431. }
  2432. else
  2433. {
  2434. area = 0;
  2435. }
  2436. if (data.ContainsKey(MeasureAttributes.Angle))
  2437. {
  2438. object val;
  2439. data.TryGetValue(MeasureAttributes.Angle, out val);
  2440. angle = Convert.ToDouble(val);
  2441. }
  2442. else
  2443. {
  2444. angle = 0;
  2445. }
  2446. addListViewData(name, length, area, angle, measureDrawObject, 1);
  2447. break;
  2448. }
  2449. }
  2450. /// <summary>
  2451. /// 添加数据
  2452. /// </summary>
  2453. /// <param name="name"></param>
  2454. /// <param name="length"></param>
  2455. /// <param name="area"></param>
  2456. /// <param name="angle"></param>
  2457. /// <param name="drawObject"></param>
  2458. /// <param name="type"></param>
  2459. private void addListViewData(string name, double length, double area, double angle,DrawObject drawObject,int type = 2)
  2460. {
  2461. if (!hasAttributes(drawObject.drawToolType.ToString(), "PhysicalLength") && !hasAttributes(drawObject.drawToolType.ToString(), "PhysicalRadius") && !hasAttributes(drawObject.drawToolType.ToString(), "PhysicalDistance") && !hasAttributes(drawObject.drawToolType.ToString(), "PhysicalCircumference"))
  2462. {
  2463. length = 0;
  2464. }
  2465. if (!hasAttributes(drawObject.drawToolType.ToString(), "PhysicalArea"))
  2466. {
  2467. area = 0;
  2468. }
  2469. if (!hasAttributes(drawObject.drawToolType.ToString(), "Angle"))
  2470. {
  2471. angle = 0;
  2472. }
  2473. int round = Convert.ToInt32(this.numericUpDown5.Value);
  2474. length = Math.Round(length, round);
  2475. area = Math.Round(area, round);
  2476. angle = Math.Round(angle, round);
  2477. ListViewItem lvi = new ListViewItem();
  2478. lvi.Text = name;
  2479. lvi.SubItems.Add(name);
  2480. lvi.SubItems.Add(length.ToString());
  2481. lvi.SubItems.Add(angle.ToString());
  2482. lvi.SubItems.Add(area.ToString());
  2483. lvi.Tag = drawObject;
  2484. if (comboBox1.SelectedIndex == 0 || comboBox1.SelectedIndex == type)
  2485. {
  2486. this.listView1.Items.Add(lvi);
  2487. }
  2488. if (this.filterDict.ContainsKey(type))
  2489. {
  2490. this.filterDict[type].Add(lvi);
  2491. }
  2492. else
  2493. {
  2494. this.filterDict.Add(type, new List<ListViewItem>() { lvi });
  2495. }
  2496. }
  2497. /// <summary>
  2498. /// 刷新列表数据
  2499. /// </summary>
  2500. /// <param name="sender"></param>
  2501. /// <param name="e"></param>
  2502. public void RefreshListView(object sender, EventArgs e)
  2503. {
  2504. this.listView1.Items.Clear();
  2505. this.filterDict.Clear();
  2506. if (this.appWorkspace.DocumentWorkspaces != null && this.appWorkspace.DocumentWorkspaces.Length > 0)
  2507. {
  2508. for (int k = 0; k <= this.appWorkspace.DocumentWorkspaces.Length - 1; k++)
  2509. {
  2510. for (int i = 0; i < this.appWorkspace.DocumentWorkspaces[k].GraphicsList.Count; i++)
  2511. {
  2512. if (this.appWorkspace.DocumentWorkspaces[k].GraphicsList[i].objectType == DrawClass.Measure)
  2513. {
  2514. var drawTool = (MeasureDrawObject)this.appWorkspace.DocumentWorkspaces[k].GraphicsList[i];
  2515. getLstViewItem(drawTool);
  2516. }
  2517. }
  2518. }
  2519. }
  2520. }
  2521. /// <summary>
  2522. /// 小数位数修改
  2523. /// </summary>
  2524. /// <param name="sender"></param>
  2525. /// <param name="e"></param>
  2526. private void numericUpDown5_ValueChanged(object sender, EventArgs e)
  2527. {
  2528. if (this.appWorkspace.Widgets != null)
  2529. this.appWorkspace.Widgets.MeasureListDialog.numericUpDown1.Value = numericUpDown5.Value;
  2530. RefreshListView(null, null);
  2531. }
  2532. /// <summary>
  2533. /// 输出
  2534. /// </summary>
  2535. /// <param name="sender"></param>
  2536. /// <param name="e"></param>
  2537. private void button1_Click(object sender, EventArgs e)
  2538. {
  2539. if (this.listView1.Items.Count > 0)
  2540. {
  2541. this.InitialDataExcel();
  2542. }
  2543. else
  2544. MessageBox.Show("暂无数据可导出");
  2545. }
  2546. /// <summary>
  2547. /// 导出Excel
  2548. /// </summary>
  2549. private void InitialDataExcel()
  2550. {
  2551. DataTable dtb = new DataTable();
  2552. for (int c = 0; c < 5; c++)
  2553. {
  2554. dtb.Columns.Add(c.ToString());
  2555. }
  2556. // 单位
  2557. DataRow dataRow = dtb.NewRow();
  2558. dataRow[0] = "单位";
  2559. dataRow[1] = this.appWorkspace.GetPxPerUnit()[2];
  2560. dtb.Rows.Add(dataRow);
  2561. // 标题
  2562. dataRow = dtb.NewRow();
  2563. dataRow[0] = "图片名称";
  2564. dataRow[1] = "分组";
  2565. dataRow[2] = "测量工具名称";
  2566. dataRow[3] = "测量属性名称";
  2567. dataRow[4] = "值";
  2568. dtb.Rows.Add(dataRow);
  2569. // 所有图片
  2570. for (int i = 0; i < this.appWorkspace.DocumentWorkspaces.Length; i++)
  2571. {
  2572. // 图片名称
  2573. string imgName = this.appWorkspace.DocumentWorkspaces[i].GetFriendlyName();
  2574. List<string> measures = new List<string>();
  2575. // 所有测量工具
  2576. for (int g = this.appWorkspace.DocumentWorkspaces[i].GraphicsList.Count - 1; g >= 0; g--)
  2577. {
  2578. if (this.appWorkspace.DocumentWorkspaces[i].GraphicsList[g].objectType == DrawClass.Measure)
  2579. {
  2580. if (comboBox1.SelectedIndex != 0) {
  2581. //判断是单值还是多值,能否通过
  2582. if (!isOddOrven(this.appWorkspace.DocumentWorkspaces[i].GraphicsList[g])) {
  2583. continue;
  2584. }
  2585. }
  2586. measures.Add(this.appWorkspace.DocumentWorkspaces[i].GraphicsList[g].drawToolType.ToString());
  2587. // 测量数据
  2588. Dictionary<System.Enum, object> data = ((MeasureDrawObject)this.appWorkspace.DocumentWorkspaces[i].GraphicsList[g]).GetData();
  2589. // 测量工具名称
  2590. string drawName = PdnResources.GetString("Menu.MeasureAction." + this.appWorkspace.DocumentWorkspaces[i].GraphicsList[g].drawToolType.ToString() + ".Text");
  2591. List<string> drawingPropertiesList = new List<string>();
  2592. var name = this.appWorkspace.DocumentWorkspaces[i].GraphicsList[g].drawToolType.ToString();
  2593. foreach (var item in measureListSetModel.AttributeMapDataNodes)
  2594. {
  2595. var tool = item.Attribute.Where(m => m.Name.Equals(name)).FirstOrDefault();
  2596. if (tool != null)
  2597. {
  2598. foreach (var str in tool.Attribute)
  2599. {
  2600. drawingPropertiesList.Add(str.Name);
  2601. }
  2602. }
  2603. }
  2604. //((MeasureDrawObject)this.appWorkspace.DocumentWorkspaces[i].GraphicsList[g]).drawingProperties.TryGetValue(this.appWorkspace.DocumentWorkspaces[i].GraphicsList[g].drawToolType, out drawingPropertiesList);
  2605. int addCount = 0;
  2606. foreach (var measure in measures)
  2607. {
  2608. if (measure.Equals(this.appWorkspace.DocumentWorkspaces[i].GraphicsList[g].drawToolType.ToString()))
  2609. addCount++;
  2610. }
  2611. int round = Convert.ToInt32(this.numericUpDown5.Value);
  2612. // 所有可见的属性
  2613. foreach (var item in drawingPropertiesList)
  2614. {
  2615. dataRow = dtb.NewRow();
  2616. string itemFirst = item.Substring(0, 1);
  2617. string itemToLower = item.Substring(1, item.Length - 1).ToLower();
  2618. string itemAll = itemFirst + itemToLower;
  2619. // 测量属性名称
  2620. string attributeName = PdnResources.GetString("Menu." + itemAll + ".text");
  2621. // 属性值
  2622. object value;
  2623. MeasureAttributes type = (MeasureAttributes)System.Enum.Parse(typeof(MeasureAttributes), item);
  2624. data.TryGetValue(type, out value);
  2625. dataRow[0] = imgName;
  2626. dataRow[1] = addCount;
  2627. dataRow[2] = drawName;
  2628. dataRow[3] = attributeName;
  2629. dataRow[4] = Math.Round(Convert.ToDouble(value), round);
  2630. dtb.Rows.Add(dataRow);
  2631. }
  2632. if (((MeasureDrawObject)this.appWorkspace.DocumentWorkspaces[i].GraphicsList[g]).lengthParagraphs != null
  2633. && ((MeasureDrawObject)this.appWorkspace.DocumentWorkspaces[i].GraphicsList[g]).lengthParagraphs.Count > 0)
  2634. {
  2635. int length = 0;
  2636. foreach (var lengthParagraph in ((MeasureDrawObject)this.appWorkspace.DocumentWorkspaces[i].GraphicsList[g]).lengthParagraphs)
  2637. {
  2638. length++;
  2639. dataRow = dtb.NewRow();
  2640. dataRow[0] = imgName;
  2641. dataRow[1] = addCount;
  2642. dataRow[2] = drawName;
  2643. dataRow[3] = "物理长度(段" + length + ")";
  2644. dataRow[4] = Math.Round(Convert.ToDouble(lengthParagraph), round);
  2645. dtb.Rows.Add(dataRow);
  2646. }
  2647. }
  2648. }
  2649. }
  2650. }
  2651. MeasureListSettingDialog measureListSettingDialog = new MeasureListSettingDialog(this, "Template.Manager.item1.MeasureListAll", this.appWorkspace, dtb);
  2652. if (measureListSettingDialog.hasModule)
  2653. {
  2654. measureListSettingDialog.StartPosition = FormStartPosition.CenterScreen;
  2655. measureListSettingDialog.ShowDialog();
  2656. }
  2657. else
  2658. {
  2659. measureListSettingDialog = null;
  2660. }
  2661. }
  2662. /// <summary>
  2663. /// 判断是单值还是多值
  2664. /// </summary>
  2665. /// <param name="drawObject"></param>
  2666. /// <returns></returns>
  2667. private bool isOddOrven(DrawObject drawObject)
  2668. {
  2669. int index = this.comboBox1.SelectedIndex;
  2670. switch (index) {
  2671. case 1:
  2672. if (moreTypeList.Contains(drawObject.drawToolType.ToString())) {
  2673. return false;
  2674. }
  2675. break;
  2676. case 2:
  2677. if (!moreTypeList.Contains(drawObject.drawToolType.ToString()))
  2678. {
  2679. return false;
  2680. }
  2681. break;
  2682. }
  2683. return true;
  2684. }
  2685. /// <summary>
  2686. /// 判断是否含有属性
  2687. /// </summary>
  2688. /// <returns></returns>
  2689. private bool hasAttributes(string enMapName,string AttributesName)
  2690. {
  2691. foreach (var item in measureListSetModel.AttributeMapDataNodes)
  2692. {
  2693. var tool = item.Attribute.Where(m => m.Name.Equals(enMapName)).FirstOrDefault();
  2694. if (tool != null)
  2695. {
  2696. var hasAttr = tool.Attribute.Where(m => m.Name.Equals(AttributesName)).FirstOrDefault();
  2697. if (hasAttr != null)
  2698. {
  2699. return true;
  2700. }
  2701. }
  2702. }
  2703. return false;
  2704. }
  2705. /// <summary>
  2706. /// 筛选
  2707. /// </summary>
  2708. /// <param name="sender"></param>
  2709. /// <param name="e"></param>
  2710. private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
  2711. {
  2712. this.listView1.Items.Clear();
  2713. switch (comboBox1.SelectedIndex) {
  2714. case 0:
  2715. foreach (var item in filterDict) {
  2716. listView1.Items.AddRange(item.Value.ToArray());
  2717. }
  2718. break;
  2719. case 1:
  2720. List<ListViewItem> list;
  2721. filterDict.TryGetValue(1, out list);
  2722. if (list != null) {
  2723. listView1.Items.AddRange(list.ToArray());
  2724. }
  2725. break;
  2726. case 2:
  2727. List<ListViewItem> list2;
  2728. filterDict.TryGetValue(2, out list2);
  2729. if (list2 != null)
  2730. {
  2731. listView1.Items.AddRange(list2.ToArray());
  2732. }
  2733. break;
  2734. }
  2735. }
  2736. private void saveLastData(object sender, EventArgs e)
  2737. {
  2738. #region [树状信息保存]
  2739. // 数据属性树状图保存
  2740. measureListSetModel.AttributeMapDataNodes = new List<MeasureListSetModel.FirstNode>();
  2741. for (int i = 0; i < this.treeView1.Nodes.Count; i++)
  2742. {
  2743. MeasureListSetModel.FirstNode firstNode = new MeasureListSetModel.FirstNode();
  2744. firstNode.Attribute = new List<MeasureListSetModel.FirstNode.SecondNode>();
  2745. firstNode.Name = this.treeView1.Nodes[i].Text;
  2746. if (this.treeView1.Nodes[i].Nodes.Count > 0)
  2747. {
  2748. for (int j = 0; j < this.treeView1.Nodes[i].Nodes.Count; j++)
  2749. {
  2750. MeasureListSetModel.FirstNode.SecondNode second = new MeasureListSetModel.FirstNode.SecondNode();
  2751. second.Attribute = new List<MeasureListSetModel.FirstNode.SecondNode.Item>();
  2752. second.Text = this.treeView1.Nodes[i].Nodes[j].Text;
  2753. second.Name = this.treeView1.Nodes[i].Nodes[j].Name;
  2754. foreach (TreeNode Node in this.treeView1.Nodes[i].Nodes[j].Nodes)
  2755. {
  2756. MeasureListSetModel.FirstNode.SecondNode.Item item = new MeasureListSetModel.FirstNode.SecondNode.Item();
  2757. item.Text = Node.Text;
  2758. item.Name = Node.Name;
  2759. second.Attribute.Add(item);
  2760. }
  2761. firstNode.Attribute.Add(second);
  2762. }
  2763. }
  2764. measureListSetModel.AttributeMapDataNodes.Add(firstNode);
  2765. }
  2766. // 数据属性(元素)树状图保存
  2767. measureListSetModel.AttributeMapAllDataNodes = new List<MeasureListSetModel.FirstNode>();
  2768. for (int i = 0; i < this.treeView2.Nodes.Count; i++)
  2769. {
  2770. MeasureListSetModel.FirstNode firstNode = new MeasureListSetModel.FirstNode();
  2771. firstNode.Attribute = new List<MeasureListSetModel.FirstNode.SecondNode>();
  2772. firstNode.Name = this.treeView2.Nodes[i].Text;
  2773. if (this.treeView2.Nodes[i].Nodes.Count > 0)
  2774. {
  2775. for (int j = 0; j < this.treeView2.Nodes[i].Nodes.Count; j++)
  2776. {
  2777. MeasureListSetModel.FirstNode.SecondNode second = new MeasureListSetModel.FirstNode.SecondNode();
  2778. second.Attribute = new List<MeasureListSetModel.FirstNode.SecondNode.Item>();
  2779. second.Text = this.treeView2.Nodes[i].Nodes[j].Text;
  2780. second.Name = this.treeView2.Nodes[i].Nodes[j].Name;
  2781. foreach (TreeNode Node in this.treeView2.Nodes[i].Nodes[j].Nodes)
  2782. {
  2783. MeasureListSetModel.FirstNode.SecondNode.Item item = new MeasureListSetModel.FirstNode.SecondNode.Item();
  2784. item.Text = Node.Text;
  2785. item.Name = Node.Name;
  2786. second.Attribute.Add(item);
  2787. }
  2788. firstNode.Attribute.Add(second);
  2789. }
  2790. }
  2791. measureListSetModel.AttributeMapAllDataNodes.Add(firstNode);
  2792. }
  2793. string configXml = XmlSerializeHelper.XmlSerialize(measureListSetModel);
  2794. string filePath = System.Windows.Forms.Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\MeasureListInteractiveModel.xml";
  2795. FileOperationHelper.WriteStringToFile(configXml, filePath, FileMode.Create);
  2796. #endregion
  2797. #region [保存参数]
  2798. if (measureListInteractiveDataModel == null)
  2799. {
  2800. measureListInteractiveDataModel = new MeasureListInteractiveDataModel();
  2801. }
  2802. measureListInteractiveDataModel.FastToolList = new List<FastTool>();
  2803. foreach (var item in toolNameList)
  2804. {
  2805. var index = toolNameList.IndexOf(item);
  2806. string enName = string.Empty;
  2807. foreach (var item1 in measureListSetModel.AttributeMapAllDataNodes)
  2808. {
  2809. var tool = item1.Attribute.Where(m => m.Text.Equals(item)).FirstOrDefault();
  2810. if (tool == null)
  2811. {
  2812. continue;
  2813. }
  2814. enName = tool.Name;
  2815. }
  2816. var fastTool = new FastTool();
  2817. fastTool.name = item;
  2818. fastTool.enName = enName;
  2819. fastTool.nickName = toolNickNameList[index];
  2820. measureListInteractiveDataModel.FastToolList.Add(fastTool);
  2821. }
  2822. measureListInteractiveDataModel.hasUsed = true;
  2823. measureListInteractiveDataModel.num = Convert.ToInt32(this.numericUpDown5.Value);
  2824. measureListInteractiveDataModel.selectIndex = comboBox1.SelectedIndex;
  2825. filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\ParameterSaving\\MeasureListInteractiveDataModel.xml";
  2826. string porosityInfoXml = XmlSerializeHelper.XmlSerialize<MeasureListInteractiveDataModel>(measureListInteractiveDataModel);
  2827. FileOperationHelper.WriteStringToFile(porosityInfoXml, filePath, FileMode.Create);
  2828. #endregion
  2829. }
  2830. private void GeometryMeasureDialog_FormClosing(object sender, FormClosingEventArgs e)
  2831. {
  2832. this.appWorkspace.toolBar.RefreshBtnSelect(false, "Geometry");
  2833. this.appWorkspace.toolsPanel.RefreshBtnSelect(false, "Geometry");
  2834. }
  2835. }
  2836. }