SpecialMeasureLengthDialog.cs 115 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Data.SQLite;
  6. using System.Drawing;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using System.Windows.Forms;
  11. using PaintDotNet.Annotation.Enum;
  12. using PaintDotNet.Annotation.Measure;
  13. using PaintDotNet.Base.CommTool;
  14. using PaintDotNet.Base.SettingModel;
  15. using PaintDotNet.CustomControl;
  16. using PaintDotNet.GeneralAnalysis.Special;
  17. using PaintDotNet.DbOpreate.DbModel;
  18. using PaintDotNet.DbOpreate.DbBll;
  19. using System.IO;
  20. using PaintDotNet.Base.Functionodel;
  21. using PaintDotNet.Annotation;
  22. using PaintDotNet.Instrument;
  23. using Metis.ParameterSet;
  24. namespace PaintDotNet.GeneralAnalysis
  25. {
  26. /// <summary>
  27. /// 专项测量 - 长度
  28. /// </summary>
  29. internal class SpecialMeasureLengthDialog : PdnBaseForm
  30. {
  31. #region
  32. /// <summary>
  33. /// Required designer variable.
  34. /// </summary>
  35. private System.ComponentModel.IContainer components = null;
  36. /// <summary>
  37. /// Clean up any resources being used.
  38. /// </summary>
  39. /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
  40. protected override void Dispose(bool disposing)
  41. {
  42. if (disposing && (components != null))
  43. {
  44. components.Dispose();
  45. }
  46. base.Dispose(disposing);
  47. }
  48. #region Windows Form Designer generated code
  49. private void InitializeLanguageText()
  50. {
  51. this.groupBox1.Text = PdnResources.GetString("Menu.operation.text");
  52. this.btnSave.Text = PdnResources.GetString("Menu.Saveresult.text");
  53. this.btnSetting.Text = PdnResources.GetString("Menu.Setting.Text");
  54. this.chkOpenSetting.Text = PdnResources.GetString("Menu.Opensettingsatingreport.text");
  55. this.btnMeasure.Text = PdnResources.GetString("Menu.Startmeasuring.text");
  56. this.groupBox2.Text = PdnResources.GetString("Menu.Tools.ImageIndex.Text");
  57. this.groupBox3.Text = PdnResources.GetString("Menu.LabelAction.DrawLine.Text");
  58. this.btnStraightLineMeasure.Text = PdnResources.GetString("Menu.measuring.text");
  59. this.label3.Text = PdnResources.GetString("Menu.Linewidth.text") + ":";
  60. this.label2.Text = PdnResources.GetString("Menu.style.text") + ":";
  61. this.label1.Text = PdnResources.GetString("Menu.color.text") + ":";
  62. this.groupBox4.Text = PdnResources.GetString("Menu.Preview.text");
  63. this.btnDelete.Text = PdnResources.GetString("Menu.Edit.Delete.Text");
  64. this.groupBox5.Text = PdnResources.GetString("Menu.MeasureAction.MeasureLength.Text");
  65. this.btnLengthLineMeasure.Text = PdnResources.GetString("Menu.measuring.text");
  66. this.label4.Text = PdnResources.GetString("Menu.Linewidth.text") + ":";
  67. this.label5.Text = PdnResources.GetString("Menu.style.text") + ":";
  68. this.label6.Text = PdnResources.GetString("Menu.color.text") + ":";
  69. this.groupBox6.Text = PdnResources.GetString("Menu.MeasureAction.MeasureParallelLine.Text");
  70. this.btnParallelLineMeasure.Text = PdnResources.GetString("Menu.measuring.text");
  71. this.label7.Text = PdnResources.GetString("Menu.Linewidth.text") + ":";
  72. this.label8.Text = PdnResources.GetString("Menu.style.text") + ":";
  73. this.label9.Text = PdnResources.GetString("Menu.color.text") + ":";
  74. this.groupBox7.Text = PdnResources.GetString("Menu.Resultspreview.text");
  75. this.label12.Text = PdnResources.GetString("Menu.Correspondinglevel.text") + ":";
  76. this.label10.Text = PdnResources.GetString("Menu.averagevalue.text") + ":";
  77. this.name.HeaderText = PdnResources.GetString("Menu.Levelname.text");
  78. this.minValue.HeaderText = PdnResources.GetString("Menu.Begintovalue.Text");
  79. this.maxValue.HeaderText = PdnResources.GetString("Menu.Theendvalu.Text");
  80. this.groupBox8.Text = PdnResources.GetString("Menu.Analysisresult.text");
  81. this.btnResultDel.Text = PdnResources.GetString("Menu.Edit.Delete.Text");
  82. this.btnAllShow.Text = PdnResources.GetString("Menu.Showall.text");
  83. this.picName.HeaderText = PdnResources.GetString("Menu.picture.Text");
  84. this.level.HeaderText = PdnResources.GetString("Menu.Levelname.text");
  85. this.avg.HeaderText = PdnResources.GetString("Menu.averagevalue.text");
  86. this.label11.Text = PdnResources.GetString("Menu.Decimal.text");
  87. this.btnExport.Text = PdnResources.GetString("Menu.Exportresults.text");
  88. this.btnCreate.Text = PdnResources.GetString("Menu.Tools.CreateReport.Text");
  89. this.btnExportProject.Text = PdnResources.GetString("Menu.Exportproject.text");
  90. this.Text = PdnResources.GetString("Menu.Generalanalysis.Specialmeasurement.Specialmeth.text");
  91. }
  92. /// <summary>
  93. /// Required method for Designer support - do not modify
  94. /// the contents of this method with the code editor.
  95. /// </summary>
  96. private void InitializeComponent()
  97. {
  98. this.components = new System.ComponentModel.Container();
  99. this.groupBox1 = new System.Windows.Forms.GroupBox();
  100. this.btnSave = new System.Windows.Forms.Button();
  101. this.btnSetting = new System.Windows.Forms.Button();
  102. this.chkOpenSetting = new System.Windows.Forms.CheckBox();
  103. this.btnMeasure = new System.Windows.Forms.Button();
  104. this.cmbSpecial = new System.Windows.Forms.ComboBox();
  105. this.groupBox2 = new System.Windows.Forms.GroupBox();
  106. this.lstPic = new System.Windows.Forms.ListView();
  107. this.imageList1 = new System.Windows.Forms.ImageList(this.components);
  108. this.groupBox3 = new System.Windows.Forms.GroupBox();
  109. this.btnStraightLineMeasure = new System.Windows.Forms.Button();
  110. this.cmbStraightLine = new System.Windows.Forms.ComboBox();
  111. this.pnlStraightLineColor = new System.Windows.Forms.Panel();
  112. this.nudStraightLineWidth = new System.Windows.Forms.NumericUpDown();
  113. this.label3 = new System.Windows.Forms.Label();
  114. this.label2 = new System.Windows.Forms.Label();
  115. this.label1 = new System.Windows.Forms.Label();
  116. this.groupBox4 = new System.Windows.Forms.GroupBox();
  117. this.pnlTools = new System.Windows.Forms.Panel();
  118. this.btnDelete = new System.Windows.Forms.Button();
  119. this.pnlShow = new System.Windows.Forms.Panel();
  120. this.groupBox5 = new System.Windows.Forms.GroupBox();
  121. this.btnLengthLineMeasure = new System.Windows.Forms.Button();
  122. this.cmbLengthLine = new System.Windows.Forms.ComboBox();
  123. this.pnlLengthLineColor = new System.Windows.Forms.Panel();
  124. this.nudLengthLineWidth = new System.Windows.Forms.NumericUpDown();
  125. this.label4 = new System.Windows.Forms.Label();
  126. this.label5 = new System.Windows.Forms.Label();
  127. this.label6 = new System.Windows.Forms.Label();
  128. this.groupBox6 = new System.Windows.Forms.GroupBox();
  129. this.btnParallelLineMeasure = new System.Windows.Forms.Button();
  130. this.cmbParallelLine = new System.Windows.Forms.ComboBox();
  131. this.pnlParallelLineColor = new System.Windows.Forms.Panel();
  132. this.nudParallelLineWidth = new System.Windows.Forms.NumericUpDown();
  133. this.label7 = new System.Windows.Forms.Label();
  134. this.label8 = new System.Windows.Forms.Label();
  135. this.label9 = new System.Windows.Forms.Label();
  136. this.groupBox7 = new System.Windows.Forms.GroupBox();
  137. this.lblLevel = new System.Windows.Forms.Label();
  138. this.label12 = new System.Windows.Forms.Label();
  139. this.lblAvg = new System.Windows.Forms.Label();
  140. this.label10 = new System.Windows.Forms.Label();
  141. this.dgvLevelList = new System.Windows.Forms.DataGridView();
  142. this.name = new System.Windows.Forms.DataGridViewTextBoxColumn();
  143. this.minValue = new System.Windows.Forms.DataGridViewTextBoxColumn();
  144. this.maxValue = new System.Windows.Forms.DataGridViewTextBoxColumn();
  145. this.groupBox8 = new System.Windows.Forms.GroupBox();
  146. this.lstResult = new System.Windows.Forms.ListView();
  147. this.btnResultDel = new System.Windows.Forms.Button();
  148. this.btnAllShow = new System.Windows.Forms.Button();
  149. this.groupBox9 = new System.Windows.Forms.GroupBox();
  150. this.dgvResult = new System.Windows.Forms.DataGridView();
  151. this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  152. this.picName = new System.Windows.Forms.DataGridViewTextBoxColumn();
  153. this.level = new System.Windows.Forms.DataGridViewTextBoxColumn();
  154. this.avg = new System.Windows.Forms.DataGridViewTextBoxColumn();
  155. this.groupBox10 = new System.Windows.Forms.GroupBox();
  156. this.btnExportProject = new System.Windows.Forms.Button();
  157. this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
  158. this.label11 = new System.Windows.Forms.Label();
  159. this.btnExport = new System.Windows.Forms.Button();
  160. this.btnCreate = new System.Windows.Forms.Button();
  161. this.groupBox1.SuspendLayout();
  162. this.groupBox2.SuspendLayout();
  163. this.groupBox3.SuspendLayout();
  164. ((System.ComponentModel.ISupportInitialize)(this.nudStraightLineWidth)).BeginInit();
  165. this.groupBox4.SuspendLayout();
  166. this.groupBox5.SuspendLayout();
  167. ((System.ComponentModel.ISupportInitialize)(this.nudLengthLineWidth)).BeginInit();
  168. this.groupBox6.SuspendLayout();
  169. ((System.ComponentModel.ISupportInitialize)(this.nudParallelLineWidth)).BeginInit();
  170. this.groupBox7.SuspendLayout();
  171. ((System.ComponentModel.ISupportInitialize)(this.dgvLevelList)).BeginInit();
  172. this.groupBox8.SuspendLayout();
  173. this.groupBox9.SuspendLayout();
  174. ((System.ComponentModel.ISupportInitialize)(this.dgvResult)).BeginInit();
  175. this.groupBox10.SuspendLayout();
  176. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
  177. this.SuspendLayout();
  178. //
  179. // groupBox1
  180. //
  181. this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  182. | System.Windows.Forms.AnchorStyles.Right)));
  183. this.groupBox1.Controls.Add(this.btnSave);
  184. this.groupBox1.Controls.Add(this.btnSetting);
  185. this.groupBox1.Controls.Add(this.chkOpenSetting);
  186. this.groupBox1.Controls.Add(this.btnMeasure);
  187. this.groupBox1.Controls.Add(this.cmbSpecial);
  188. this.groupBox1.Location = new System.Drawing.Point(12, 12);
  189. this.groupBox1.Name = "groupBox1";
  190. this.groupBox1.Size = new System.Drawing.Size(1210, 73);
  191. this.groupBox1.TabIndex = 0;
  192. this.groupBox1.TabStop = false;
  193. this.groupBox1.Text = "操作";
  194. //
  195. // btnSave
  196. //
  197. this.btnSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  198. this.btnSave.Location = new System.Drawing.Point(1091, 24);
  199. this.btnSave.Name = "btnSave";
  200. this.btnSave.Size = new System.Drawing.Size(101, 35);
  201. this.btnSave.TabIndex = 4;
  202. this.btnSave.Text = "保存结果";
  203. this.btnSave.UseVisualStyleBackColor = true;
  204. this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
  205. //
  206. // btnSetting
  207. //
  208. this.btnSetting.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  209. this.btnSetting.Location = new System.Drawing.Point(987, 24);
  210. this.btnSetting.Name = "btnSetting";
  211. this.btnSetting.Size = new System.Drawing.Size(85, 35);
  212. this.btnSetting.TabIndex = 3;
  213. this.btnSetting.Text = "设置";
  214. this.btnSetting.UseVisualStyleBackColor = true;
  215. this.btnSetting.Click += new System.EventHandler(this.btnSetting_Click);
  216. //
  217. // chkOpenSetting
  218. //
  219. this.chkOpenSetting.AutoSize = true;
  220. this.chkOpenSetting.Checked = true;
  221. this.chkOpenSetting.CheckState = System.Windows.Forms.CheckState.Checked;
  222. this.chkOpenSetting.Location = new System.Drawing.Point(433, 31);
  223. this.chkOpenSetting.Name = "chkOpenSetting";
  224. this.chkOpenSetting.Size = new System.Drawing.Size(15, 14);
  225. this.chkOpenSetting.TabIndex = 2;
  226. this.chkOpenSetting.UseVisualStyleBackColor = true;
  227. this.chkOpenSetting.CheckedChanged += new System.EventHandler(this.chkOpenSetting_CheckedChanged);
  228. //
  229. // btnMeasure
  230. //
  231. this.btnMeasure.Location = new System.Drawing.Point(268, 24);
  232. this.btnMeasure.Name = "btnMeasure";
  233. this.btnMeasure.Size = new System.Drawing.Size(137, 35);
  234. this.btnMeasure.TabIndex = 1;
  235. this.btnMeasure.UseVisualStyleBackColor = true;
  236. this.btnMeasure.Click += new System.EventHandler(this.btnMeasure_Click);
  237. //
  238. // cmbSpecial
  239. //
  240. this.cmbSpecial.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
  241. this.cmbSpecial.FormattingEnabled = true;
  242. this.cmbSpecial.Location = new System.Drawing.Point(17, 29);
  243. this.cmbSpecial.Name = "cmbSpecial";
  244. this.cmbSpecial.Size = new System.Drawing.Size(231, 20);
  245. this.cmbSpecial.TabIndex = 0;
  246. this.cmbSpecial.SelectedIndexChanged += new System.EventHandler(this.cmbSpecial_SelectedIndexChanged);
  247. //
  248. // groupBox2
  249. //
  250. this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  251. | System.Windows.Forms.AnchorStyles.Left)));
  252. this.groupBox2.Controls.Add(this.lstPic);
  253. this.groupBox2.Location = new System.Drawing.Point(12, 88);
  254. this.groupBox2.Name = "groupBox2";
  255. this.groupBox2.Size = new System.Drawing.Size(200, 500);
  256. this.groupBox2.TabIndex = 1;
  257. this.groupBox2.TabStop = false;
  258. this.groupBox2.Text = "图像索引";
  259. //
  260. // lstPic
  261. //
  262. this.lstPic.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  263. | System.Windows.Forms.AnchorStyles.Left)));
  264. this.lstPic.HideSelection = false;
  265. this.lstPic.LargeImageList = this.imageList1;
  266. this.lstPic.Location = new System.Drawing.Point(17, 27);
  267. this.lstPic.MultiSelect = false;
  268. this.lstPic.Name = "lstPic";
  269. this.lstPic.Size = new System.Drawing.Size(166, 460);
  270. this.lstPic.TabIndex = 0;
  271. this.lstPic.UseCompatibleStateImageBehavior = false;
  272. this.lstPic.SelectedIndexChanged += new System.EventHandler(this.lstPic_SelectedIndexChanged);
  273. //
  274. // imageList1
  275. //
  276. this.imageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
  277. this.imageList1.ImageSize = new System.Drawing.Size(64, 64);
  278. this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
  279. //
  280. // groupBox3
  281. //
  282. this.groupBox3.Controls.Add(this.btnStraightLineMeasure);
  283. this.groupBox3.Controls.Add(this.cmbStraightLine);
  284. this.groupBox3.Controls.Add(this.pnlStraightLineColor);
  285. this.groupBox3.Controls.Add(this.nudStraightLineWidth);
  286. this.groupBox3.Controls.Add(this.label3);
  287. this.groupBox3.Controls.Add(this.label2);
  288. this.groupBox3.Controls.Add(this.label1);
  289. this.groupBox3.Location = new System.Drawing.Point(218, 91);
  290. this.groupBox3.Name = "groupBox3";
  291. this.groupBox3.Size = new System.Drawing.Size(360, 100);
  292. this.groupBox3.TabIndex = 2;
  293. this.groupBox3.TabStop = false;
  294. this.groupBox3.Text = "直线";
  295. //
  296. // btnStraightLineMeasure
  297. //
  298. this.btnStraightLineMeasure.Enabled = false;
  299. this.btnStraightLineMeasure.Location = new System.Drawing.Point(263, 60);
  300. this.btnStraightLineMeasure.Name = "btnStraightLineMeasure";
  301. this.btnStraightLineMeasure.Size = new System.Drawing.Size(75, 25);
  302. this.btnStraightLineMeasure.TabIndex = 6;
  303. this.btnStraightLineMeasure.Text = "测量";
  304. this.btnStraightLineMeasure.UseVisualStyleBackColor = true;
  305. this.btnStraightLineMeasure.Click += new System.EventHandler(this.btnStraightLineMeasure_Click);
  306. //
  307. // cmbStraightLine
  308. //
  309. this.cmbStraightLine.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
  310. this.cmbStraightLine.FormattingEnabled = true;
  311. this.cmbStraightLine.Location = new System.Drawing.Point(62, 60);
  312. this.cmbStraightLine.Name = "cmbStraightLine";
  313. this.cmbStraightLine.Size = new System.Drawing.Size(190, 20);
  314. this.cmbStraightLine.TabIndex = 5;
  315. this.cmbStraightLine.SelectedIndexChanged += new System.EventHandler(this.cmbStraightLine_SelectedIndexChanged);
  316. //
  317. // pnlStraightLineColor
  318. //
  319. this.pnlStraightLineColor.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(128)))), ((int)(((byte)(255)))));
  320. this.pnlStraightLineColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  321. this.pnlStraightLineColor.Location = new System.Drawing.Point(62, 24);
  322. this.pnlStraightLineColor.Name = "pnlStraightLineColor";
  323. this.pnlStraightLineColor.Size = new System.Drawing.Size(91, 25);
  324. this.pnlStraightLineColor.TabIndex = 4;
  325. this.pnlStraightLineColor.BackColorChanged += new System.EventHandler(this.pnlStraightLineColor_BackColorChanged);
  326. this.pnlStraightLineColor.Click += new System.EventHandler(this.pnlStraightLineColor_Click);
  327. //
  328. // nudStraightLineWidth
  329. //
  330. this.nudStraightLineWidth.Location = new System.Drawing.Point(263, 24);
  331. this.nudStraightLineWidth.Maximum = new decimal(new int[] {
  332. 5,
  333. 0,
  334. 0,
  335. 0});
  336. this.nudStraightLineWidth.Minimum = new decimal(new int[] {
  337. 1,
  338. 0,
  339. 0,
  340. 0});
  341. this.nudStraightLineWidth.Name = "nudStraightLineWidth";
  342. this.nudStraightLineWidth.Size = new System.Drawing.Size(78, 21);
  343. this.nudStraightLineWidth.TabIndex = 3;
  344. this.nudStraightLineWidth.Value = new decimal(new int[] {
  345. 1,
  346. 0,
  347. 0,
  348. 0});
  349. this.nudStraightLineWidth.ValueChanged += new System.EventHandler(this.nudStraightLineWidth_ValueChanged);
  350. this.nudStraightLineWidth.KeyUp += new System.Windows.Forms.KeyEventHandler(this.nudStraightLineWidth_KeyUp);
  351. //
  352. // label3
  353. //
  354. this.label3.AutoSize = true;
  355. this.label3.Location = new System.Drawing.Point(205, 30);
  356. this.label3.Name = "label3";
  357. this.label3.Size = new System.Drawing.Size(41, 12);
  358. this.label3.TabIndex = 2;
  359. this.label3.Text = "线宽:";
  360. //
  361. // label2
  362. //
  363. this.label2.AutoSize = true;
  364. this.label2.Location = new System.Drawing.Point(16, 68);
  365. this.label2.Name = "label2";
  366. this.label2.Size = new System.Drawing.Size(41, 12);
  367. this.label2.TabIndex = 1;
  368. this.label2.Text = "样式:";
  369. //
  370. // label1
  371. //
  372. this.label1.AutoSize = true;
  373. this.label1.Location = new System.Drawing.Point(16, 30);
  374. this.label1.Name = "label1";
  375. this.label1.Size = new System.Drawing.Size(41, 12);
  376. this.label1.TabIndex = 0;
  377. this.label1.Text = "颜色:";
  378. //
  379. // groupBox4
  380. //
  381. this.groupBox4.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  382. | System.Windows.Forms.AnchorStyles.Left)
  383. | System.Windows.Forms.AnchorStyles.Right)));
  384. this.groupBox4.Controls.Add(this.pnlTools);
  385. this.groupBox4.Controls.Add(this.btnDelete);
  386. this.groupBox4.Controls.Add(this.pnlShow);
  387. this.groupBox4.Location = new System.Drawing.Point(584, 91);
  388. this.groupBox4.Name = "groupBox4";
  389. this.groupBox4.Size = new System.Drawing.Size(638, 497);
  390. this.groupBox4.TabIndex = 3;
  391. this.groupBox4.TabStop = false;
  392. this.groupBox4.Text = "预览";
  393. //
  394. // pnlTools
  395. //
  396. this.pnlTools.Location = new System.Drawing.Point(6, 22);
  397. this.pnlTools.Name = "pnlTools";
  398. this.pnlTools.Size = new System.Drawing.Size(305, 32);
  399. this.pnlTools.TabIndex = 2;
  400. //
  401. // btnDelete
  402. //
  403. this.btnDelete.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  404. this.btnDelete.Location = new System.Drawing.Point(519, 22);
  405. this.btnDelete.Name = "btnDelete";
  406. this.btnDelete.Size = new System.Drawing.Size(101, 32);
  407. this.btnDelete.TabIndex = 1;
  408. this.btnDelete.Text = "删除";
  409. this.btnDelete.UseVisualStyleBackColor = true;
  410. this.btnDelete.Click += new System.EventHandler(this.btnDelete_Click);
  411. //
  412. // pnlShow
  413. //
  414. this.pnlShow.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  415. | System.Windows.Forms.AnchorStyles.Left)
  416. | System.Windows.Forms.AnchorStyles.Right)));
  417. this.pnlShow.Location = new System.Drawing.Point(6, 60);
  418. this.pnlShow.Name = "pnlShow";
  419. this.pnlShow.Size = new System.Drawing.Size(626, 431);
  420. this.pnlShow.TabIndex = 0;
  421. //
  422. // groupBox5
  423. //
  424. this.groupBox5.Controls.Add(this.btnLengthLineMeasure);
  425. this.groupBox5.Controls.Add(this.cmbLengthLine);
  426. this.groupBox5.Controls.Add(this.pnlLengthLineColor);
  427. this.groupBox5.Controls.Add(this.nudLengthLineWidth);
  428. this.groupBox5.Controls.Add(this.label4);
  429. this.groupBox5.Controls.Add(this.label5);
  430. this.groupBox5.Controls.Add(this.label6);
  431. this.groupBox5.Location = new System.Drawing.Point(218, 197);
  432. this.groupBox5.Name = "groupBox5";
  433. this.groupBox5.Size = new System.Drawing.Size(360, 100);
  434. this.groupBox5.TabIndex = 4;
  435. this.groupBox5.TabStop = false;
  436. this.groupBox5.Text = "长度";
  437. //
  438. // btnLengthLineMeasure
  439. //
  440. this.btnLengthLineMeasure.Enabled = false;
  441. this.btnLengthLineMeasure.Location = new System.Drawing.Point(263, 60);
  442. this.btnLengthLineMeasure.Name = "btnLengthLineMeasure";
  443. this.btnLengthLineMeasure.Size = new System.Drawing.Size(75, 25);
  444. this.btnLengthLineMeasure.TabIndex = 6;
  445. this.btnLengthLineMeasure.Text = "测量";
  446. this.btnLengthLineMeasure.UseVisualStyleBackColor = true;
  447. this.btnLengthLineMeasure.Click += new System.EventHandler(this.btnLengthLineMeasure_Click);
  448. //
  449. // cmbLengthLine
  450. //
  451. this.cmbLengthLine.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
  452. this.cmbLengthLine.FormattingEnabled = true;
  453. this.cmbLengthLine.Location = new System.Drawing.Point(62, 60);
  454. this.cmbLengthLine.Name = "cmbLengthLine";
  455. this.cmbLengthLine.Size = new System.Drawing.Size(190, 20);
  456. this.cmbLengthLine.TabIndex = 5;
  457. this.cmbLengthLine.SelectedIndexChanged += new System.EventHandler(this.cmbLengthLine_SelectedIndexChanged);
  458. //
  459. // pnlLengthLineColor
  460. //
  461. this.pnlLengthLineColor.BackColor = System.Drawing.Color.Red;
  462. this.pnlLengthLineColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  463. this.pnlLengthLineColor.Location = new System.Drawing.Point(62, 24);
  464. this.pnlLengthLineColor.Name = "pnlLengthLineColor";
  465. this.pnlLengthLineColor.Size = new System.Drawing.Size(91, 25);
  466. this.pnlLengthLineColor.TabIndex = 4;
  467. this.pnlLengthLineColor.BackColorChanged += new System.EventHandler(this.pnlLengthLineColor_BackColorChanged);
  468. this.pnlLengthLineColor.Click += new System.EventHandler(this.pnlLengthLineColor_Click);
  469. //
  470. // nudLengthLineWidth
  471. //
  472. this.nudLengthLineWidth.Location = new System.Drawing.Point(263, 28);
  473. this.nudLengthLineWidth.Maximum = new decimal(new int[] {
  474. 5,
  475. 0,
  476. 0,
  477. 0});
  478. this.nudLengthLineWidth.Minimum = new decimal(new int[] {
  479. 1,
  480. 0,
  481. 0,
  482. 0});
  483. this.nudLengthLineWidth.Name = "nudLengthLineWidth";
  484. this.nudLengthLineWidth.Size = new System.Drawing.Size(78, 21);
  485. this.nudLengthLineWidth.TabIndex = 3;
  486. this.nudLengthLineWidth.Value = new decimal(new int[] {
  487. 1,
  488. 0,
  489. 0,
  490. 0});
  491. this.nudLengthLineWidth.ValueChanged += new System.EventHandler(this.nudLengthLineWidth_ValueChanged);
  492. this.nudLengthLineWidth.KeyUp += new System.Windows.Forms.KeyEventHandler(this.nudLengthLineWidth_KeyUp);
  493. //
  494. // label4
  495. //
  496. this.label4.AutoSize = true;
  497. this.label4.Location = new System.Drawing.Point(205, 30);
  498. this.label4.Name = "label4";
  499. this.label4.Size = new System.Drawing.Size(41, 12);
  500. this.label4.TabIndex = 2;
  501. this.label4.Text = "线宽:";
  502. //
  503. // label5
  504. //
  505. this.label5.AutoSize = true;
  506. this.label5.Location = new System.Drawing.Point(16, 68);
  507. this.label5.Name = "label5";
  508. this.label5.Size = new System.Drawing.Size(41, 12);
  509. this.label5.TabIndex = 1;
  510. this.label5.Text = "样式:";
  511. //
  512. // label6
  513. //
  514. this.label6.AutoSize = true;
  515. this.label6.Location = new System.Drawing.Point(16, 30);
  516. this.label6.Name = "label6";
  517. this.label6.Size = new System.Drawing.Size(41, 12);
  518. this.label6.TabIndex = 0;
  519. this.label6.Text = "颜色:";
  520. //
  521. // groupBox6
  522. //
  523. this.groupBox6.Controls.Add(this.btnParallelLineMeasure);
  524. this.groupBox6.Controls.Add(this.cmbParallelLine);
  525. this.groupBox6.Controls.Add(this.pnlParallelLineColor);
  526. this.groupBox6.Controls.Add(this.nudParallelLineWidth);
  527. this.groupBox6.Controls.Add(this.label7);
  528. this.groupBox6.Controls.Add(this.label8);
  529. this.groupBox6.Controls.Add(this.label9);
  530. this.groupBox6.Location = new System.Drawing.Point(218, 303);
  531. this.groupBox6.Name = "groupBox6";
  532. this.groupBox6.Size = new System.Drawing.Size(360, 100);
  533. this.groupBox6.TabIndex = 5;
  534. this.groupBox6.TabStop = false;
  535. this.groupBox6.Text = "平行线";
  536. //
  537. // btnParallelLineMeasure
  538. //
  539. this.btnParallelLineMeasure.Enabled = false;
  540. this.btnParallelLineMeasure.Location = new System.Drawing.Point(263, 60);
  541. this.btnParallelLineMeasure.Name = "btnParallelLineMeasure";
  542. this.btnParallelLineMeasure.Size = new System.Drawing.Size(75, 25);
  543. this.btnParallelLineMeasure.TabIndex = 6;
  544. this.btnParallelLineMeasure.Text = "测量";
  545. this.btnParallelLineMeasure.UseVisualStyleBackColor = true;
  546. this.btnParallelLineMeasure.Click += new System.EventHandler(this.btnParallelLineMeasure_Click);
  547. //
  548. // cmbParallelLine
  549. //
  550. this.cmbParallelLine.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
  551. this.cmbParallelLine.FormattingEnabled = true;
  552. this.cmbParallelLine.Location = new System.Drawing.Point(62, 60);
  553. this.cmbParallelLine.Name = "cmbParallelLine";
  554. this.cmbParallelLine.Size = new System.Drawing.Size(190, 20);
  555. this.cmbParallelLine.TabIndex = 5;
  556. this.cmbParallelLine.SelectedIndexChanged += new System.EventHandler(this.cmbParallelLine_SelectedIndexChanged);
  557. //
  558. // pnlParallelLineColor
  559. //
  560. this.pnlParallelLineColor.BackColor = System.Drawing.Color.Green;
  561. this.pnlParallelLineColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  562. this.pnlParallelLineColor.Location = new System.Drawing.Point(62, 24);
  563. this.pnlParallelLineColor.Name = "pnlParallelLineColor";
  564. this.pnlParallelLineColor.Size = new System.Drawing.Size(91, 25);
  565. this.pnlParallelLineColor.TabIndex = 4;
  566. this.pnlParallelLineColor.BackColorChanged += new System.EventHandler(this.pnlParallelLineColor_BackColorChanged);
  567. this.pnlParallelLineColor.Click += new System.EventHandler(this.pnlParallelLineColor_Click);
  568. //
  569. // nudParallelLineWidth
  570. //
  571. this.nudParallelLineWidth.Location = new System.Drawing.Point(263, 24);
  572. this.nudParallelLineWidth.Maximum = new decimal(new int[] {
  573. 5,
  574. 0,
  575. 0,
  576. 0});
  577. this.nudParallelLineWidth.Minimum = new decimal(new int[] {
  578. 1,
  579. 0,
  580. 0,
  581. 0});
  582. this.nudParallelLineWidth.Name = "nudParallelLineWidth";
  583. this.nudParallelLineWidth.Size = new System.Drawing.Size(78, 21);
  584. this.nudParallelLineWidth.TabIndex = 3;
  585. this.nudParallelLineWidth.Value = new decimal(new int[] {
  586. 1,
  587. 0,
  588. 0,
  589. 0});
  590. this.nudParallelLineWidth.ValueChanged += new System.EventHandler(this.nudParallelLineWidth_ValueChanged);
  591. this.nudParallelLineWidth.KeyUp += new System.Windows.Forms.KeyEventHandler(this.nudParallelLineWidth_KeyUp);
  592. //
  593. // label7
  594. //
  595. this.label7.AutoSize = true;
  596. this.label7.Location = new System.Drawing.Point(205, 30);
  597. this.label7.Name = "label7";
  598. this.label7.Size = new System.Drawing.Size(41, 12);
  599. this.label7.TabIndex = 2;
  600. this.label7.Text = "线宽:";
  601. //
  602. // label8
  603. //
  604. this.label8.AutoSize = true;
  605. this.label8.Location = new System.Drawing.Point(16, 68);
  606. this.label8.Name = "label8";
  607. this.label8.Size = new System.Drawing.Size(41, 12);
  608. this.label8.TabIndex = 1;
  609. this.label8.Text = "样式:";
  610. //
  611. // label9
  612. //
  613. this.label9.AutoSize = true;
  614. this.label9.Location = new System.Drawing.Point(16, 30);
  615. this.label9.Name = "label9";
  616. this.label9.Size = new System.Drawing.Size(41, 12);
  617. this.label9.TabIndex = 0;
  618. this.label9.Text = "颜色:";
  619. //
  620. // groupBox7
  621. //
  622. this.groupBox7.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  623. | System.Windows.Forms.AnchorStyles.Left)));
  624. this.groupBox7.Controls.Add(this.lblLevel);
  625. this.groupBox7.Controls.Add(this.label12);
  626. this.groupBox7.Controls.Add(this.lblAvg);
  627. this.groupBox7.Controls.Add(this.label10);
  628. this.groupBox7.Controls.Add(this.dgvLevelList);
  629. this.groupBox7.Location = new System.Drawing.Point(218, 406);
  630. this.groupBox7.Name = "groupBox7";
  631. this.groupBox7.Size = new System.Drawing.Size(360, 182);
  632. this.groupBox7.TabIndex = 6;
  633. this.groupBox7.TabStop = false;
  634. this.groupBox7.Text = "结果预览";
  635. //
  636. // lblLevel
  637. //
  638. this.lblLevel.AutoSize = true;
  639. this.lblLevel.Location = new System.Drawing.Point(255, 25);
  640. this.lblLevel.Name = "lblLevel";
  641. this.lblLevel.Size = new System.Drawing.Size(11, 12);
  642. this.lblLevel.TabIndex = 4;
  643. this.lblLevel.Text = "0";
  644. //
  645. // label12
  646. //
  647. this.label12.AutoSize = true;
  648. this.label12.Location = new System.Drawing.Point(170, 25);
  649. this.label12.Name = "label12";
  650. this.label12.Size = new System.Drawing.Size(65, 12);
  651. this.label12.TabIndex = 3;
  652. this.label12.Text = "对应级别:";
  653. //
  654. // lblAvg
  655. //
  656. this.lblAvg.AutoSize = true;
  657. this.lblAvg.Location = new System.Drawing.Point(75, 25);
  658. this.lblAvg.Name = "lblAvg";
  659. this.lblAvg.Size = new System.Drawing.Size(11, 12);
  660. this.lblAvg.TabIndex = 2;
  661. this.lblAvg.Text = "0";
  662. //
  663. // label10
  664. //
  665. this.label10.AutoSize = true;
  666. this.label10.Location = new System.Drawing.Point(6, 25);
  667. this.label10.Name = "label10";
  668. this.label10.Size = new System.Drawing.Size(53, 12);
  669. this.label10.TabIndex = 1;
  670. this.label10.Text = "平均值:";
  671. //
  672. // dgvLevelList
  673. //
  674. this.dgvLevelList.AllowUserToAddRows = false;
  675. this.dgvLevelList.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  676. | System.Windows.Forms.AnchorStyles.Left)));
  677. this.dgvLevelList.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
  678. this.dgvLevelList.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
  679. this.dgvLevelList.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
  680. this.name,
  681. this.minValue,
  682. this.maxValue});
  683. this.dgvLevelList.Location = new System.Drawing.Point(6, 51);
  684. this.dgvLevelList.Name = "dgvLevelList";
  685. this.dgvLevelList.ReadOnly = true;
  686. this.dgvLevelList.RowHeadersVisible = false;
  687. this.dgvLevelList.RowHeadersWidth = 51;
  688. this.dgvLevelList.RowTemplate.Height = 27;
  689. this.dgvLevelList.Size = new System.Drawing.Size(348, 125);
  690. this.dgvLevelList.TabIndex = 0;
  691. //
  692. // name
  693. //
  694. this.name.MinimumWidth = 6;
  695. this.name.Name = "name";
  696. this.name.ReadOnly = true;
  697. //
  698. // minValue
  699. //
  700. this.minValue.MinimumWidth = 6;
  701. this.minValue.Name = "minValue";
  702. this.minValue.ReadOnly = true;
  703. //
  704. // maxValue
  705. //
  706. this.maxValue.MinimumWidth = 6;
  707. this.maxValue.Name = "maxValue";
  708. this.maxValue.ReadOnly = true;
  709. //
  710. // groupBox8
  711. //
  712. this.groupBox8.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
  713. this.groupBox8.Controls.Add(this.lstResult);
  714. this.groupBox8.Controls.Add(this.btnResultDel);
  715. this.groupBox8.Controls.Add(this.btnAllShow);
  716. this.groupBox8.Location = new System.Drawing.Point(12, 594);
  717. this.groupBox8.Name = "groupBox8";
  718. this.groupBox8.Size = new System.Drawing.Size(200, 220);
  719. this.groupBox8.TabIndex = 7;
  720. this.groupBox8.TabStop = false;
  721. this.groupBox8.Text = "分析结果";
  722. //
  723. // lstResult
  724. //
  725. this.lstResult.HideSelection = false;
  726. this.lstResult.Location = new System.Drawing.Point(17, 55);
  727. this.lstResult.Name = "lstResult";
  728. this.lstResult.Size = new System.Drawing.Size(166, 145);
  729. this.lstResult.TabIndex = 11;
  730. this.lstResult.UseCompatibleStateImageBehavior = false;
  731. this.lstResult.View = System.Windows.Forms.View.Tile;
  732. this.lstResult.SelectedIndexChanged += new System.EventHandler(this.lstResult_SelectedIndexChanged);
  733. //
  734. // btnResultDel
  735. //
  736. this.btnResultDel.Location = new System.Drawing.Point(108, 26);
  737. this.btnResultDel.Name = "btnResultDel";
  738. this.btnResultDel.Size = new System.Drawing.Size(75, 23);
  739. this.btnResultDel.TabIndex = 10;
  740. this.btnResultDel.Text = "删除";
  741. this.btnResultDel.UseVisualStyleBackColor = true;
  742. this.btnResultDel.Click += new System.EventHandler(this.btnResultDel_Click);
  743. //
  744. // btnAllShow
  745. //
  746. this.btnAllShow.Location = new System.Drawing.Point(19, 26);
  747. this.btnAllShow.Name = "btnAllShow";
  748. this.btnAllShow.Size = new System.Drawing.Size(75, 23);
  749. this.btnAllShow.TabIndex = 9;
  750. this.btnAllShow.Text = "全部显示";
  751. this.btnAllShow.UseVisualStyleBackColor = true;
  752. this.btnAllShow.Click += new System.EventHandler(this.btnAllShow_Click);
  753. //
  754. // groupBox9
  755. //
  756. this.groupBox9.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
  757. | System.Windows.Forms.AnchorStyles.Right)));
  758. this.groupBox9.Controls.Add(this.dgvResult);
  759. this.groupBox9.Location = new System.Drawing.Point(218, 594);
  760. this.groupBox9.Name = "groupBox9";
  761. this.groupBox9.Size = new System.Drawing.Size(816, 220);
  762. this.groupBox9.TabIndex = 8;
  763. this.groupBox9.TabStop = false;
  764. //
  765. // dgvResult
  766. //
  767. this.dgvResult.AllowUserToAddRows = false;
  768. this.dgvResult.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
  769. | System.Windows.Forms.AnchorStyles.Right)));
  770. this.dgvResult.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
  771. this.dgvResult.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
  772. this.dgvResult.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
  773. this.Column1,
  774. this.picName,
  775. this.level,
  776. this.avg});
  777. this.dgvResult.Location = new System.Drawing.Point(8, 16);
  778. this.dgvResult.Name = "dgvResult";
  779. this.dgvResult.ReadOnly = true;
  780. this.dgvResult.RowHeadersVisible = false;
  781. this.dgvResult.RowHeadersWidth = 51;
  782. this.dgvResult.RowTemplate.Height = 27;
  783. this.dgvResult.Size = new System.Drawing.Size(801, 197);
  784. this.dgvResult.TabIndex = 0;
  785. //
  786. // Column1
  787. //
  788. this.Column1.HeaderText = "tag";
  789. this.Column1.MinimumWidth = 6;
  790. this.Column1.Name = "Column1";
  791. this.Column1.ReadOnly = true;
  792. this.Column1.Visible = false;
  793. //
  794. // picName
  795. //
  796. this.picName.MinimumWidth = 6;
  797. this.picName.Name = "picName";
  798. this.picName.ReadOnly = true;
  799. //
  800. // level
  801. //
  802. this.level.MinimumWidth = 6;
  803. this.level.Name = "level";
  804. this.level.ReadOnly = true;
  805. //
  806. // avg
  807. //
  808. this.avg.MinimumWidth = 6;
  809. this.avg.Name = "avg";
  810. this.avg.ReadOnly = true;
  811. //
  812. // groupBox10
  813. //
  814. this.groupBox10.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
  815. this.groupBox10.Controls.Add(this.btnExportProject);
  816. this.groupBox10.Controls.Add(this.numericUpDown1);
  817. this.groupBox10.Controls.Add(this.label11);
  818. this.groupBox10.Controls.Add(this.btnExport);
  819. this.groupBox10.Controls.Add(this.btnCreate);
  820. this.groupBox10.Location = new System.Drawing.Point(1040, 594);
  821. this.groupBox10.Name = "groupBox10";
  822. this.groupBox10.Size = new System.Drawing.Size(182, 220);
  823. this.groupBox10.TabIndex = 9;
  824. this.groupBox10.TabStop = false;
  825. //
  826. // btnExportProject
  827. //
  828. this.btnExportProject.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
  829. this.btnExportProject.Location = new System.Drawing.Point(28, 100);
  830. this.btnExportProject.Name = "btnExportProject";
  831. this.btnExportProject.Size = new System.Drawing.Size(136, 32);
  832. this.btnExportProject.TabIndex = 10;
  833. this.btnExportProject.Text = "导出项目";
  834. this.btnExportProject.UseVisualStyleBackColor = true;
  835. this.btnExportProject.Click += new System.EventHandler(this.btnExportProject_Click);
  836. //
  837. // numericUpDown1
  838. //
  839. this.numericUpDown1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
  840. this.numericUpDown1.Location = new System.Drawing.Point(81, 161);
  841. this.numericUpDown1.Maximum = new decimal(new int[] {
  842. 10,
  843. 0,
  844. 0,
  845. 0});
  846. this.numericUpDown1.Name = "numericUpDown1";
  847. this.numericUpDown1.Size = new System.Drawing.Size(62, 21);
  848. this.numericUpDown1.TabIndex = 8;
  849. this.numericUpDown1.Value = new decimal(new int[] {
  850. 2,
  851. 0,
  852. 0,
  853. 0});
  854. this.numericUpDown1.ValueChanged += new System.EventHandler(this.numericUpDown1_ValueChanged);
  855. //
  856. // label11
  857. //
  858. this.label11.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
  859. this.label11.AutoSize = true;
  860. this.label11.Location = new System.Drawing.Point(38, 166);
  861. this.label11.Name = "label11";
  862. this.label11.Size = new System.Drawing.Size(41, 12);
  863. this.label11.TabIndex = 7;
  864. this.label11.Text = "小数:";
  865. //
  866. // btnExport
  867. //
  868. this.btnExport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
  869. this.btnExport.Location = new System.Drawing.Point(28, 62);
  870. this.btnExport.Name = "btnExport";
  871. this.btnExport.Size = new System.Drawing.Size(137, 32);
  872. this.btnExport.TabIndex = 1;
  873. this.btnExport.Text = "导出结果";
  874. this.btnExport.UseVisualStyleBackColor = true;
  875. this.btnExport.Click += new System.EventHandler(this.btnExport_Click);
  876. //
  877. // btnCreate
  878. //
  879. this.btnCreate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
  880. this.btnCreate.Location = new System.Drawing.Point(28, 24);
  881. this.btnCreate.Name = "btnCreate";
  882. this.btnCreate.Size = new System.Drawing.Size(137, 32);
  883. this.btnCreate.TabIndex = 0;
  884. this.btnCreate.Text = "生成报告";
  885. this.btnCreate.UseVisualStyleBackColor = true;
  886. this.btnCreate.Click += new System.EventHandler(this.btnCreate_Click);
  887. //
  888. // SpecialMeasureLengthDialog
  889. //
  890. this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
  891. this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
  892. this.ClientSize = new System.Drawing.Size(1234, 823);
  893. this.Controls.Add(this.groupBox10);
  894. this.Controls.Add(this.groupBox9);
  895. this.Controls.Add(this.groupBox8);
  896. this.Controls.Add(this.groupBox7);
  897. this.Controls.Add(this.groupBox6);
  898. this.Controls.Add(this.groupBox5);
  899. this.Controls.Add(this.groupBox4);
  900. this.Controls.Add(this.groupBox3);
  901. this.Controls.Add(this.groupBox2);
  902. this.Controls.Add(this.groupBox1);
  903. this.Name = "SpecialMeasureLengthDialog";
  904. this.Text = "专项测量 - 长度";
  905. this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.SpecialMeasureLengthDialog_FormClosing);
  906. this.Controls.SetChildIndex(this.groupBox1, 0);
  907. this.Controls.SetChildIndex(this.groupBox2, 0);
  908. this.Controls.SetChildIndex(this.groupBox3, 0);
  909. this.Controls.SetChildIndex(this.groupBox4, 0);
  910. this.Controls.SetChildIndex(this.groupBox5, 0);
  911. this.Controls.SetChildIndex(this.groupBox6, 0);
  912. this.Controls.SetChildIndex(this.groupBox7, 0);
  913. this.Controls.SetChildIndex(this.groupBox8, 0);
  914. this.Controls.SetChildIndex(this.groupBox9, 0);
  915. this.Controls.SetChildIndex(this.groupBox10, 0);
  916. this.groupBox1.ResumeLayout(false);
  917. this.groupBox1.PerformLayout();
  918. this.groupBox2.ResumeLayout(false);
  919. this.groupBox3.ResumeLayout(false);
  920. this.groupBox3.PerformLayout();
  921. ((System.ComponentModel.ISupportInitialize)(this.nudStraightLineWidth)).EndInit();
  922. this.groupBox4.ResumeLayout(false);
  923. this.groupBox5.ResumeLayout(false);
  924. this.groupBox5.PerformLayout();
  925. ((System.ComponentModel.ISupportInitialize)(this.nudLengthLineWidth)).EndInit();
  926. this.groupBox6.ResumeLayout(false);
  927. this.groupBox6.PerformLayout();
  928. ((System.ComponentModel.ISupportInitialize)(this.nudParallelLineWidth)).EndInit();
  929. this.groupBox7.ResumeLayout(false);
  930. this.groupBox7.PerformLayout();
  931. ((System.ComponentModel.ISupportInitialize)(this.dgvLevelList)).EndInit();
  932. this.groupBox8.ResumeLayout(false);
  933. this.groupBox9.ResumeLayout(false);
  934. ((System.ComponentModel.ISupportInitialize)(this.dgvResult)).EndInit();
  935. this.groupBox10.ResumeLayout(false);
  936. this.groupBox10.PerformLayout();
  937. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
  938. this.ResumeLayout(false);
  939. }
  940. #endregion
  941. private System.Windows.Forms.GroupBox groupBox1;
  942. private System.Windows.Forms.CheckBox chkOpenSetting;
  943. private System.Windows.Forms.Button btnMeasure;
  944. private System.Windows.Forms.ComboBox cmbSpecial;
  945. private System.Windows.Forms.Button btnSave;
  946. private System.Windows.Forms.Button btnSetting;
  947. private System.Windows.Forms.GroupBox groupBox2;
  948. private System.Windows.Forms.GroupBox groupBox3;
  949. private System.Windows.Forms.GroupBox groupBox4;
  950. private System.Windows.Forms.Button btnStraightLineMeasure;
  951. private System.Windows.Forms.ComboBox cmbStraightLine;
  952. private System.Windows.Forms.Panel pnlStraightLineColor;
  953. private System.Windows.Forms.NumericUpDown nudStraightLineWidth;
  954. private System.Windows.Forms.Label label3;
  955. private System.Windows.Forms.Label label2;
  956. private System.Windows.Forms.Label label1;
  957. private System.Windows.Forms.GroupBox groupBox5;
  958. private System.Windows.Forms.Button btnLengthLineMeasure;
  959. private System.Windows.Forms.ComboBox cmbLengthLine;
  960. private System.Windows.Forms.Panel pnlLengthLineColor;
  961. private System.Windows.Forms.NumericUpDown nudLengthLineWidth;
  962. private System.Windows.Forms.Label label4;
  963. private System.Windows.Forms.Label label5;
  964. private System.Windows.Forms.Label label6;
  965. private System.Windows.Forms.GroupBox groupBox6;
  966. private System.Windows.Forms.Button btnParallelLineMeasure;
  967. private System.Windows.Forms.ComboBox cmbParallelLine;
  968. private System.Windows.Forms.Panel pnlParallelLineColor;
  969. private System.Windows.Forms.NumericUpDown nudParallelLineWidth;
  970. private System.Windows.Forms.Label label7;
  971. private System.Windows.Forms.Label label8;
  972. private System.Windows.Forms.Label label9;
  973. private System.Windows.Forms.GroupBox groupBox7;
  974. private System.Windows.Forms.DataGridView dgvLevelList;
  975. private System.Windows.Forms.DataGridViewTextBoxColumn name;
  976. private System.Windows.Forms.DataGridViewTextBoxColumn minValue;
  977. private System.Windows.Forms.DataGridViewTextBoxColumn maxValue;
  978. private System.Windows.Forms.Label lblAvg;
  979. private System.Windows.Forms.Label label10;
  980. private System.Windows.Forms.Label lblLevel;
  981. private System.Windows.Forms.Label label12;
  982. private System.Windows.Forms.GroupBox groupBox8;
  983. private System.Windows.Forms.GroupBox groupBox9;
  984. private System.Windows.Forms.DataGridView dgvResult;
  985. private System.Windows.Forms.GroupBox groupBox10;
  986. private System.Windows.Forms.Button btnExport;
  987. private System.Windows.Forms.Button btnCreate;
  988. private System.Windows.Forms.Panel pnlShow;
  989. private System.Windows.Forms.Button btnDelete;
  990. private System.Windows.Forms.Panel pnlTools;
  991. private System.Windows.Forms.ListView lstPic;
  992. private System.Windows.Forms.ImageList imageList1;
  993. private System.Windows.Forms.NumericUpDown numericUpDown1;
  994. private System.Windows.Forms.Label label11;
  995. private System.Windows.Forms.Button btnResultDel;
  996. private System.Windows.Forms.Button btnAllShow;
  997. private System.Windows.Forms.DataGridViewTextBoxColumn Column1;
  998. private System.Windows.Forms.DataGridViewTextBoxColumn picName;
  999. private System.Windows.Forms.DataGridViewTextBoxColumn level;
  1000. private System.Windows.Forms.DataGridViewTextBoxColumn avg;
  1001. private System.Windows.Forms.ListView lstResult;
  1002. private System.Windows.Forms.Button btnExportProject;
  1003. #endregion
  1004. /// <summary>
  1005. /// 网格调色板
  1006. /// </summary>
  1007. private ColorsForm colorsFormGrid;
  1008. private AppWorkspace appWorkspace;
  1009. private DocumentWorkspaceWindow m_documentWorkspace;
  1010. private SQLiteHelper m_sqlHelper;
  1011. private DataTable m_specialList;
  1012. private DataTable m_levelList;
  1013. private SpecialItem m_specialItem = SpecialItem.LENGTH;
  1014. private int m_specialSelectedIndex = 0;
  1015. private string m_specialId;
  1016. /// <summary>
  1017. /// 原图
  1018. /// </summary>
  1019. private OpenCvSharp.Mat imageMat;
  1020. /// <summary>
  1021. /// 原图带原相测量等
  1022. /// </summary>
  1023. private Bitmap m_originalBit;
  1024. private ArtworkControlButtons m_controlButtons;
  1025. private object m_currentColorPanel;
  1026. private bool m_isMeasure;
  1027. private bool m_isOpenSetting;
  1028. private bool m_isMeasureByStraightLine;
  1029. private bool m_isMeasureByLengthLine;
  1030. private bool m_isMeasureByParallelLine;
  1031. private MeasureStyleModel m_measureStyleModel;
  1032. private List<MeasureLengthResult> m_measureResults = new List<MeasureLengthResult>();
  1033. private MeasureLengthResult m_measureCurrent;
  1034. /// <summary>
  1035. /// 图片名称
  1036. /// </summary>
  1037. private string m_graphName;
  1038. private List<DrawObject> m_oldDrawList = new List<DrawObject>();
  1039. private bool m_showAll;
  1040. /// <summary>
  1041. /// 中间数据
  1042. /// </summary>
  1043. private List<ExportProjectModel> tempDataModel = new List<ExportProjectModel>();
  1044. // 小数位
  1045. private int decnum = 2;
  1046. /// <summary>
  1047. /// 保存用于生成报告的图片
  1048. /// </summary>
  1049. private List<Bitmap> bitList = new List<Bitmap>();
  1050. /// <summary>
  1051. /// 储存点击保存结果后的所有原图与分析图
  1052. /// </summary>
  1053. private Dictionary<string, List<Bitmap>> bitDic = new Dictionary<string, List<Bitmap>>();
  1054. // 统一全局设置的线颜色、线宽、样式
  1055. private int m_straightLineColor;
  1056. private int m_straightLineWidth;
  1057. private int m_straightLineStyle;
  1058. private int m_lengthLineColor;
  1059. private int m_lengthLineWidth;
  1060. private int m_lengthLineStyle;
  1061. private int m_parallelLineColor;
  1062. private int m_parallelLineWidth;
  1063. private int m_parallelLineStyle;
  1064. private int defaultIndex = -1;
  1065. private GeneralAnalysisModel generalAnalysisModel = new GeneralAnalysisModel();
  1066. public SpecialMeasureLengthDialog(AppWorkspace workspace)
  1067. {
  1068. appWorkspace = workspace;
  1069. m_measureStyleModel = appWorkspace.GetMeasureStyleModel();
  1070. m_sqlHelper = new SQLiteHelper(); //连接数据库
  1071. m_sqlHelper.Connect();
  1072. this.colorsFormGrid = new ColorsForm();
  1073. this.colorsFormGrid.StartPosition = FormStartPosition.CenterScreen;
  1074. InitializeComponent();
  1075. InitializeLanguageText();
  1076. InitPicList();
  1077. InitSpecialCmb();
  1078. InitDocumentView();
  1079. InitDocumentViewTools();
  1080. InitLineStyles();
  1081. InitCurrentMeasure();
  1082. GetAttributeFromConfigurationFile();
  1083. SetAnalyzeModelFromXml("Template.Manager.item2.SpecialLength");
  1084. }
  1085. private void ShowImgEvent(object sender, EventArgs e)
  1086. {
  1087. lstPic.Focus();
  1088. if (this.defaultIndex != -1)
  1089. {
  1090. this.lstPic.Items[defaultIndex].Focused = true;
  1091. this.lstPic.Items[defaultIndex].Selected = true;
  1092. getLastData();
  1093. }
  1094. }
  1095. /// <summary>
  1096. /// 初始化专项数据
  1097. /// </summary>
  1098. public void InitSpecialCmb()
  1099. {
  1100. cmbSpecial.Items.Clear();
  1101. string select_sql = "select * from mic_special_definition where delete_flag = 0 and special_type = ? "; //查询的SQL语句
  1102. SQLiteParameter[] para = new SQLiteParameter[1];
  1103. para[0] = new SQLiteParameter("special_type", m_specialItem);
  1104. m_specialList = m_sqlHelper.ExecuteDataTable(select_sql, para); //执行查询操作,结果存放在dt中
  1105. this.cmbSpecial.Items.Clear();
  1106. if (m_specialList.Rows.Count > 0)
  1107. {
  1108. for (int i = 0; i < m_specialList.Rows.Count; ++i)
  1109. {
  1110. this.cmbSpecial.Items.Add(m_specialList.Rows[i]["special_name"].ToString());
  1111. }
  1112. this.cmbSpecial.SelectedIndex = m_specialSelectedIndex;
  1113. m_specialId = m_specialList.Rows[m_specialSelectedIndex]["id"].ToString();
  1114. }
  1115. }
  1116. /// <summary>
  1117. /// 初始化当前测量数据
  1118. /// </summary>
  1119. public void InitCurrentMeasure()
  1120. {
  1121. m_measureCurrent = new MeasureLengthResult();
  1122. m_measureCurrent.GraphName = m_graphName;
  1123. m_measureCurrent.LevelName = "";
  1124. m_measureCurrent.MeasureAvg = 0;
  1125. lblLevel.Text = "";
  1126. lblAvg.Text = "0";
  1127. }
  1128. /// <summary>
  1129. /// 初始化图片列表数据
  1130. /// </summary>
  1131. public void InitPicList()
  1132. {
  1133. //初始化图片列表
  1134. for (int i = 0; i < this.appWorkspace.DocumentWorkspaces.Length; i++)
  1135. {
  1136. this.imageList1.Images.Add("img" + i, this.appWorkspace.DocumentWorkspaces[i].BinarizationThumbnail);
  1137. this.lstPic.Items.Add("", i);
  1138. this.lstPic.Items[i].ImageIndex = i;
  1139. this.lstPic.Items[i].Text = this.appWorkspace.DocumentWorkspaces[i].GetFriendlyName();
  1140. this.lstPic.Items[i].Name = this.appWorkspace.DocumentWorkspaces[i].GetFriendlyName();
  1141. if (this.appWorkspace.DocumentWorkspaces[i].Equals(this.appWorkspace.ActiveDocumentWorkspace))
  1142. {
  1143. defaultIndex = i;
  1144. }
  1145. }
  1146. this.Shown += ShowImgEvent;
  1147. }
  1148. /// <summary>
  1149. /// 初始化DocumentView
  1150. /// </summary>
  1151. public void InitDocumentView()
  1152. {
  1153. this.pnlShow.Controls.Clear();
  1154. this.m_documentWorkspace = new DocumentWorkspaceWindow(appWorkspace);
  1155. this.m_documentWorkspace.AppWorkspaceTop = appWorkspace;
  1156. this.m_documentWorkspace.Visible = true;
  1157. this.m_documentWorkspace.Dock = DockStyle.Fill;
  1158. this.m_documentWorkspace.Units = MeasurementUnit.Micron;
  1159. if (this.lstPic.FocusedItem != null)
  1160. {
  1161. this.m_documentWorkspace.xmlSaveModel = this.appWorkspace.DocumentWorkspaces[this.lstPic.FocusedItem.Index].xmlSaveModel;
  1162. this.m_documentWorkspace.rules = this.appWorkspace.DocumentWorkspaces[this.lstPic.FocusedItem.Index].rules;
  1163. }
  1164. this.pnlShow.Controls.Add(this.m_documentWorkspace);
  1165. this.m_documentWorkspace.ContinuousDrawingMeasure = true;
  1166. }
  1167. private void GraphicsList_SelectChanged(object sender, EventArgs e)
  1168. {
  1169. this.GetDataAndAvg();
  1170. }
  1171. #region 初始化DocumentView工具
  1172. public void InitDocumentViewTools()
  1173. {
  1174. this.m_controlButtons = new ArtworkControlButtons();
  1175. this.m_controlButtons.Dock = DockStyle.Top;
  1176. this.m_controlButtons.Height = 30;
  1177. this.m_controlButtons.HideZoomToWindowAndActualSize();
  1178. this.m_controlButtons.HideMovingDirection();
  1179. this.pnlTools.Controls.Add(m_controlButtons);
  1180. this.m_controlButtons.zoomInButton.Click += new EventHandler(zoomInButton_Click);
  1181. this.m_controlButtons.zoomOutButton.Click += new EventHandler(zoomOutButton_Click);
  1182. this.m_controlButtons.pointerButton.Click += new EventHandler(pointerButton_Click);
  1183. this.m_controlButtons.mobileModeButton.Click += new EventHandler(mobileModeButton_Click);
  1184. }
  1185. private void mobileModeButton_Click(object sender, EventArgs e)
  1186. {
  1187. this.m_documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.MoveMode;
  1188. }
  1189. private void pointerButton_Click(object sender, EventArgs e)
  1190. {
  1191. this.m_documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.Pointer;
  1192. }
  1193. private void zoomOutButton_Click(object sender, EventArgs e)
  1194. {
  1195. if (this.m_documentWorkspace.CompositionSurface != null)
  1196. this.m_documentWorkspace.ZoomOut();
  1197. }
  1198. private void zoomInButton_Click(object sender, EventArgs e)
  1199. {
  1200. if (this.m_documentWorkspace.CompositionSurface != null)
  1201. this.m_documentWorkspace.ZoomIn();
  1202. }
  1203. #endregion
  1204. /// <summary>
  1205. /// 初始化线样式
  1206. /// </summary>
  1207. public void InitLineStyles()
  1208. {
  1209. m_straightLineColor = m_measureStyleModel.measureLine.lineColor;
  1210. m_straightLineWidth = m_measureStyleModel.measureLine.lineWidth;
  1211. m_straightLineStyle = m_measureStyleModel.measureLine.lineStyle;
  1212. m_lengthLineColor = m_measureStyleModel.measureLength.lineColor;
  1213. m_lengthLineWidth = m_measureStyleModel.measureLength.lineWidth;
  1214. m_lengthLineStyle = m_measureStyleModel.measureLength.lineStyle;
  1215. m_parallelLineColor = m_measureStyleModel.measureParallelLine.lineColor;
  1216. m_parallelLineWidth = m_measureStyleModel.measureParallelLine.lineWidth;
  1217. m_parallelLineStyle = m_measureStyleModel.measureParallelLine.lineStyle;
  1218. //绑定线样式数据
  1219. this.cmbStraightLine.Items.AddRange(InvariantData.dashStyles);
  1220. this.cmbStraightLine.SelectedIndex = 0;
  1221. this.cmbLengthLine.Items.AddRange(InvariantData.dashStyles);
  1222. this.cmbLengthLine.SelectedIndex = 0;
  1223. this.cmbParallelLine.Items.AddRange(InvariantData.dashStyles);
  1224. this.cmbParallelLine.SelectedIndex = 0;
  1225. }
  1226. private void btnSetting_Click(object sender, EventArgs e)
  1227. {
  1228. OpenSettingDialog();
  1229. }
  1230. private void OpenSettingDialog()
  1231. {
  1232. AnalyzeSettingDialog recombinationRateSetDialog = new AnalyzeSettingDialog(this, "Template.Manager.item2.SpecialLength");
  1233. if (recombinationRateSetDialog.hasModule)
  1234. {
  1235. recombinationRateSetDialog.StartPosition = FormStartPosition.CenterScreen;
  1236. recombinationRateSetDialog.ShowDialog();
  1237. }
  1238. else
  1239. {
  1240. recombinationRateSetDialog = null;
  1241. }
  1242. }
  1243. private void cmbSpecial_SelectedIndexChanged(object sender, EventArgs e)
  1244. {
  1245. //m_specialSelectedIndex = this.cmbSpecial.SelectedIndex;
  1246. this.InitSpecialLevelList();
  1247. }
  1248. /// <summary>
  1249. /// 初始化专项级别列表
  1250. /// </summary>
  1251. public void InitSpecialLevelList()
  1252. {
  1253. m_specialId = m_specialList.Rows[this.cmbSpecial.SelectedIndex]["id"].ToString();
  1254. dgvLevelList.AutoGenerateColumns = false;
  1255. dgvLevelList.AllowUserToAddRows = false;
  1256. dgvLevelList.ReadOnly = true;
  1257. this.dgvLevelList.Rows.Clear();
  1258. string select_sql = "select * from mic_special_definition_info where special_id = '" + m_specialId + "'"; //查询的SQL语句
  1259. m_levelList = m_sqlHelper.ExecuteDataTable(select_sql, null); //执行查询操作,结果存放在dt中
  1260. if (m_levelList.Rows.Count > 0)
  1261. {
  1262. dgvLevelList.Rows.Add(m_levelList.Rows.Count);
  1263. for (int i = 0; i < m_levelList.Rows.Count; ++i)
  1264. {
  1265. dgvLevelList.Rows[i].Cells["name"].Value = m_levelList.Rows[i]["name"].ToString();
  1266. dgvLevelList.Rows[i].Cells["minValue"].Value = m_levelList.Rows[i]["minValue"];
  1267. dgvLevelList.Rows[i].Cells["maxValue"].Value = m_levelList.Rows[i]["maxValue"];
  1268. }
  1269. }
  1270. }
  1271. /// <summary>
  1272. /// 图像索引切换
  1273. /// </summary>
  1274. /// <param name="sender"></param>
  1275. /// <param name="e"></param>
  1276. private void lstPic_SelectedIndexChanged(object sender, EventArgs e)
  1277. {
  1278. this.NewGraphicsListClear();
  1279. if (this.lstPic.FocusedItem != null && this.lstPic.FocusedItem.Selected)
  1280. {
  1281. InitDocumentView();
  1282. m_graphName = this.lstPic.FocusedItem.Text;
  1283. InitCurrentMeasure();
  1284. this.imageMat = this.appWorkspace.DocumentWorkspaces[this.lstPic.FocusedItem.Index].CompositionSurface.CreatedAliasedMat();
  1285. Document document = Document.FromImageMat(imageMat.Clone()/* //待测试.Clone()*/);
  1286. this.m_documentWorkspace.Document = document;
  1287. this.m_documentWorkspace.Units = MeasurementUnit.Micron;
  1288. this.m_documentWorkspace.GraphicsList = new GraphicsList(this.m_documentWorkspace);
  1289. //this.appWorkspace.DocumentWorkspaces[this.lstPic.FocusedItem.Index].GraphicsList.GetDrawClassList(DrawClass.Measure).ForEach(i => m_oldDrawList.Add(i));
  1290. //this.m_documentWorkspace.GraphicsList = this.appWorkspace.DocumentWorkspaces[this.lstPic.FocusedItem.Index].GraphicsList;
  1291. this.m_documentWorkspace.phaseModels = this.appWorkspace.DocumentWorkspaces[this.lstPic.FocusedItem.Index].phaseModels;
  1292. this.m_documentWorkspace.GraphicsList.SelectChanged += GraphicsList_SelectChanged;
  1293. // 选择了图片
  1294. Bitmap m_bitmap = this.appWorkspace.DocumentWorkspaces[this.lstPic.FocusedItem.Index].CompositionSurface.CreateAliasedBitmap();
  1295. m_originalBit = m_bitmap.Clone(new Rectangle(0, 0, m_bitmap.Width, m_bitmap.Height), m_bitmap.PixelFormat);
  1296. Graphics graphics = Graphics.FromImage(m_originalBit);
  1297. Draw(graphics);
  1298. ExistenceMeasure();
  1299. //this.selectPicture = true;
  1300. }
  1301. }
  1302. #region 线颜色选择
  1303. private void ShowColorsForm(object sender)
  1304. {
  1305. Panel panel = (Panel)sender;
  1306. this.colorsFormGrid.UserPrimaryColor = ColorBgra.FromColor(panel.BackColor);
  1307. this.colorsFormGrid.setSaveBtn_Click(new System.EventHandler(this.gridColorChanged));
  1308. this.colorsFormGrid.ShowDialog();
  1309. }
  1310. /// <summary>
  1311. /// 网格Panel的调色板颜色改变
  1312. /// </summary>
  1313. /// <param name="sender"></param>
  1314. /// <param name="e"></param>
  1315. private void gridColorChanged(object sender, EventArgs e)
  1316. {
  1317. Panel panel = (Panel)m_currentColorPanel;
  1318. Color color = this.colorsFormGrid.UserPrimaryColor.ToColor();
  1319. panel.BackColor = color;
  1320. this.colorsFormGrid.Close();
  1321. }
  1322. private void pnlStraightLineColor_Click(object sender, EventArgs e)
  1323. {
  1324. m_currentColorPanel = sender;
  1325. ShowColorsForm(sender);
  1326. }
  1327. private void pnlLengthLineColor_Click(object sender, EventArgs e)
  1328. {
  1329. m_currentColorPanel = sender;
  1330. ShowColorsForm(sender);
  1331. }
  1332. private void pnlParallelLineColor_Click(object sender, EventArgs e)
  1333. {
  1334. m_currentColorPanel = sender;
  1335. ShowColorsForm(sender);
  1336. }
  1337. #endregion
  1338. private void nudStraightLineWidth_KeyUp(object sender, KeyEventArgs e)
  1339. {
  1340. try
  1341. {
  1342. nudStraightLineWidth.Value = Convert.ToInt32(this.nudStraightLineWidth.Text);
  1343. }
  1344. catch (Exception)
  1345. { }
  1346. }
  1347. private void nudLengthLineWidth_KeyUp(object sender, KeyEventArgs e)
  1348. {
  1349. try
  1350. {
  1351. nudLengthLineWidth.Value = Convert.ToInt32(this.nudLengthLineWidth.Text);
  1352. }
  1353. catch (Exception)
  1354. { }
  1355. }
  1356. private void nudParallelLineWidth_KeyUp(object sender, KeyEventArgs e)
  1357. {
  1358. try
  1359. {
  1360. nudParallelLineWidth.Value = Convert.ToInt32(this.nudParallelLineWidth.Text);
  1361. }
  1362. catch (Exception)
  1363. { }
  1364. }
  1365. /// <summary>
  1366. /// 开启/结束测量
  1367. /// </summary>
  1368. /// <param name="sender"></param>
  1369. /// <param name="e"></param>
  1370. private void btnMeasure_Click(object sender, EventArgs e)
  1371. {
  1372. if (cmbSpecial.SelectedItem == null || m_levelList == null || m_levelList.Rows.Count <= 0)
  1373. {
  1374. MessageBox.Show(PdnResources.GetString("Menu.Pleasefirstsetthespecialdefinitionlength.Text"));
  1375. return;
  1376. }
  1377. m_isMeasure = !m_isMeasure;
  1378. UpdateMeasureUIAndState();
  1379. }
  1380. private void UpdateMeasureUIAndState()
  1381. {
  1382. if (m_isMeasure)
  1383. {
  1384. this.NewGraphicsListClear();
  1385. this.InitCurrentMeasure();
  1386. if (m_measureResults.Count > 0)
  1387. {
  1388. if (m_specialSelectedIndex != this.cmbSpecial.SelectedIndex)
  1389. {
  1390. DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.learthelastmeasuremen.Text")+"?", PdnResources.GetString("Menu.alert.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
  1391. if (dr == DialogResult.OK)
  1392. {
  1393. this.lstResult.Items.Clear();
  1394. this.m_measureResults.Clear();
  1395. this.bitDic.Clear();
  1396. this.dgvResult.Rows.Clear();
  1397. }
  1398. else
  1399. {
  1400. m_isMeasure = false;
  1401. return;
  1402. }
  1403. }
  1404. }
  1405. btnMeasure.Text = PdnResources.GetString("Menu.Stopmeasure.text");
  1406. btnStraightLineMeasure.Enabled = true;
  1407. btnLengthLineMeasure.Enabled = true;
  1408. btnParallelLineMeasure.Enabled = true;
  1409. cmbSpecial.Enabled = false;
  1410. }
  1411. else
  1412. {
  1413. btnMeasure.Text = PdnResources.GetString("Menu.Pleasestartmeasuring.text");
  1414. cmbSpecial.Enabled = true;
  1415. btnStraightLineMeasure.Enabled = false;
  1416. btnLengthLineMeasure.Enabled = false;
  1417. btnParallelLineMeasure.Enabled = false;
  1418. if (m_isMeasureByStraightLine)
  1419. {
  1420. btnStraightLineMeasure.Text = PdnResources.GetString("Menu.measuring.text");
  1421. m_isMeasureByStraightLine = false;
  1422. }
  1423. if (m_isMeasureByLengthLine)
  1424. {
  1425. btnLengthLineMeasure.Text = PdnResources.GetString("Menu.measuring.text");
  1426. m_isMeasureByLengthLine = false;
  1427. }
  1428. if (m_isMeasureByParallelLine)
  1429. {
  1430. btnParallelLineMeasure.Text = PdnResources.GetString("Menu.measuring.text");
  1431. m_isMeasureByParallelLine = false;
  1432. }
  1433. this.m_documentWorkspace.ActiveTool = DrawToolType.Pointer;
  1434. }
  1435. }
  1436. private void chkOpenSetting_CheckedChanged(object sender, EventArgs e)
  1437. {
  1438. m_isOpenSetting = chkOpenSetting.Checked;
  1439. }
  1440. private void btnStraightLineMeasure_Click(object sender, EventArgs e)
  1441. {
  1442. if (imageMat == null)
  1443. {
  1444. MessageBox.Show(PdnResources.GetString("Menu.Pleaseselecttheimagefirst.Text"));
  1445. return;
  1446. }
  1447. m_isMeasureByStraightLine = !m_isMeasureByStraightLine;
  1448. if (m_isMeasureByStraightLine)
  1449. {
  1450. btnStraightLineMeasure.Text = PdnResources.GetString("Menu.stop.text");
  1451. m_isMeasureByLengthLine = false;
  1452. btnLengthLineMeasure.Text = PdnResources.GetString("Menu.measuring.text");
  1453. m_isMeasureByParallelLine = false;
  1454. btnParallelLineMeasure.Text = PdnResources.GetString("Menu.measuring.text");
  1455. m_measureStyleModel.measureLine.lineColor = pnlStraightLineColor.BackColor.ToArgb();
  1456. m_measureStyleModel.measureLine.lineWidth = (int)nudStraightLineWidth.Value;
  1457. m_measureStyleModel.measureLine.lineStyle = cmbStraightLine.SelectedIndex;
  1458. this.m_documentWorkspace.ActiveTool = DrawToolType.MeasureLine;
  1459. }
  1460. else
  1461. {
  1462. btnStraightLineMeasure.Text = PdnResources.GetString("Menu.measuring.text");
  1463. this.m_documentWorkspace.ActiveTool = DrawToolType.Pointer;
  1464. this.GetDataAndAvg();
  1465. }
  1466. UpdateMeasureDecimalPlaces((int)numericUpDown1.Value);
  1467. }
  1468. /// <summary>
  1469. /// 是否存在测量,有则选择工具
  1470. /// </summary>
  1471. /// <returns></returns>
  1472. public void ExistenceMeasure()
  1473. {
  1474. if (PdnResources.GetString("Menu.stop.text").Equals(btnStraightLineMeasure.Text))
  1475. this.m_documentWorkspace.ActiveTool = DrawToolType.MeasureLine;
  1476. if (PdnResources.GetString("Menu.stop.text").Equals(btnLengthLineMeasure.Text))
  1477. this.m_documentWorkspace.ActiveTool = DrawToolType.MeasureLength;
  1478. if (PdnResources.GetString("Menu.stop.text").Equals(btnParallelLineMeasure.Text))
  1479. this.m_documentWorkspace.ActiveTool = DrawToolType.MeasureParallelLine;
  1480. }
  1481. private void btnLengthLineMeasure_Click(object sender, EventArgs e)
  1482. {
  1483. if (imageMat == null)
  1484. {
  1485. MessageBox.Show(PdnResources.GetString("Menu.Pleaseselecttheimagefirst.Text"));
  1486. return;
  1487. }
  1488. m_isMeasureByLengthLine = !m_isMeasureByLengthLine;
  1489. if (m_isMeasureByLengthLine)
  1490. {
  1491. btnLengthLineMeasure.Text = PdnResources.GetString("Menu.stop.text");
  1492. m_isMeasureByStraightLine = false;
  1493. btnStraightLineMeasure.Text = PdnResources.GetString("Menu.measuring.text");
  1494. m_isMeasureByParallelLine = false;
  1495. btnParallelLineMeasure.Text = PdnResources.GetString("Menu.measuring.text");
  1496. m_measureStyleModel.measureLength.lineColor = pnlLengthLineColor.BackColor.ToArgb();
  1497. m_measureStyleModel.measureLength.lineWidth = (int)nudLengthLineWidth.Value;
  1498. m_measureStyleModel.measureLength.lineStyle = cmbLengthLine.SelectedIndex;
  1499. this.m_documentWorkspace.ActiveTool = DrawToolType.MeasureLength;
  1500. }
  1501. else
  1502. {
  1503. btnLengthLineMeasure.Text = PdnResources.GetString("Menu.measuring.text");
  1504. this.m_documentWorkspace.ActiveTool = DrawToolType.Pointer;
  1505. this.GetDataAndAvg();
  1506. }
  1507. UpdateMeasureDecimalPlaces((int)numericUpDown1.Value);
  1508. }
  1509. private void btnParallelLineMeasure_Click(object sender, EventArgs e)
  1510. {
  1511. if (imageMat == null)
  1512. {
  1513. MessageBox.Show(PdnResources.GetString("Menu.Pleaseselecttheimagefirst.Text"));
  1514. return;
  1515. }
  1516. m_isMeasureByParallelLine = !m_isMeasureByParallelLine;
  1517. if (m_isMeasureByParallelLine)
  1518. {
  1519. btnParallelLineMeasure.Text = PdnResources.GetString("Menu.stop.text");
  1520. m_isMeasureByStraightLine = false;
  1521. btnStraightLineMeasure.Text = PdnResources.GetString("Menu.measuring.text");
  1522. m_isMeasureByLengthLine = false;
  1523. btnLengthLineMeasure.Text = PdnResources.GetString("Menu.measuring.text");
  1524. m_measureStyleModel.measureParallelLine.lineColor = pnlParallelLineColor.BackColor.ToArgb();
  1525. m_measureStyleModel.measureParallelLine.lineWidth = (int)nudParallelLineWidth.Value;
  1526. m_measureStyleModel.measureParallelLine.lineStyle = cmbParallelLine.SelectedIndex;
  1527. this.m_documentWorkspace.ActiveTool = DrawToolType.MeasureParallelLine;
  1528. }
  1529. else
  1530. {
  1531. btnParallelLineMeasure.Text = PdnResources.GetString("Menu.measuring.text");
  1532. this.m_documentWorkspace.ActiveTool = DrawToolType.Pointer;
  1533. this.GetDataAndAvg();
  1534. }
  1535. UpdateMeasureDecimalPlaces((int)numericUpDown1.Value);
  1536. }
  1537. private TreeView drawTreeView;
  1538. /// <summary>
  1539. /// 从配置文件中读取设置信息
  1540. /// </summary>
  1541. private void GetAttributeFromConfigurationFile()
  1542. {
  1543. MeasureListSetModel measureListSetModel = XmlSerializeHelper.DESerializer<MeasureListSetModel>(FileOperationHelper.ReadStringFromFile(System.Windows.Forms.Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\MeasureListSetModel.xml", FileMode.Open));
  1544. drawTreeView = new TreeView();
  1545. if (measureListSetModel != null && measureListSetModel.AttributeMapDrawNodes != null)
  1546. {
  1547. for (int i = 0; i < measureListSetModel.AttributeMapDrawNodes.Count; i++)
  1548. {
  1549. TreeNode firstNode = new TreeNode();
  1550. firstNode.Text = measureListSetModel.AttributeMapDrawNodes[i].Name;
  1551. for (int j = 0; j < measureListSetModel.AttributeMapDrawNodes[i].Attribute.Count; j++)
  1552. {
  1553. TreeNode scondNode = new TreeNode();
  1554. scondNode.Text = measureListSetModel.AttributeMapDrawNodes[i].Attribute[j].Text;
  1555. scondNode.Name = measureListSetModel.AttributeMapDrawNodes[i].Attribute[j].Name;
  1556. for (int k = 0; k < measureListSetModel.AttributeMapDrawNodes[i].Attribute[j].Attribute.Count; k++)
  1557. {
  1558. if (measureListSetModel.AttributeMapDrawNodes[i].Attribute[j].Attribute.Count > 0)
  1559. {
  1560. TreeNode thirdNode = new TreeNode();
  1561. thirdNode.Text = measureListSetModel.AttributeMapDrawNodes[i].Attribute[j].Attribute[k].Text;
  1562. thirdNode.Name = measureListSetModel.AttributeMapDrawNodes[i].Attribute[j].Attribute[k].Name;
  1563. scondNode.Nodes.Add(thirdNode);
  1564. }
  1565. }
  1566. firstNode.Nodes.Add(scondNode);
  1567. }
  1568. drawTreeView.Nodes.Add(firstNode);
  1569. }
  1570. }
  1571. }
  1572. /// <summary>
  1573. /// 获取计算测量结果
  1574. /// </summary>
  1575. private void GetDataAndAvg()
  1576. {
  1577. string level = "";
  1578. double avg = 0;
  1579. double sum = 0;
  1580. int count = this.m_documentWorkspace.GraphicsList.Count;
  1581. int no = 0;
  1582. for (int i = 0; i < count; i++)
  1583. {
  1584. if (this.m_documentWorkspace.GraphicsList[i].objectType == DrawClass.Measure)
  1585. {
  1586. no++;
  1587. Dictionary<System.Enum, object> data = ((MeasureDrawObject)this.m_documentWorkspace.GraphicsList[i]).GetData();
  1588. foreach (var keys in data)
  1589. {
  1590. /// <summary>
  1591. /// 像素长度
  1592. /// </summary>
  1593. //PixelLength
  1594. /// <summary>
  1595. /// 物理长度
  1596. /// </summary>
  1597. //PhysicalLength
  1598. object v;
  1599. InvariantData.measureAttributes.TryGetValue((MeasureAttributes)keys.Key, out v);
  1600. if (((MeasureAttributes)keys.Key).ToString() == "PhysicalLength")
  1601. {
  1602. double length = double.Parse(keys.Value.ToString());
  1603. if (length > 0)
  1604. {
  1605. sum += length;
  1606. this.ShowMeasureInfo(i);
  1607. }
  1608. else
  1609. {
  1610. no--;
  1611. }
  1612. break;
  1613. }
  1614. }
  1615. }
  1616. }
  1617. if(no > 0)
  1618. {
  1619. avg = sum / no;
  1620. }
  1621. if (m_levelList != null && m_levelList.Rows.Count > 0)
  1622. {
  1623. for (int i = 0; i < m_levelList.Rows.Count; ++i)
  1624. {
  1625. double minValue = double.Parse(m_levelList.Rows[i]["minValue"].ToString());
  1626. double maxValue = double.Parse(m_levelList.Rows[i]["maxValue"].ToString());
  1627. if (avg >= minValue && avg < maxValue)
  1628. {
  1629. level = m_levelList.Rows[i]["name"].ToString();
  1630. break;
  1631. }
  1632. }
  1633. }
  1634. lblLevel.Text = level;
  1635. lblAvg.Text = AnalysisTools.GetDecNum(avg, decnum); ;
  1636. m_measureCurrent.LevelName = level;
  1637. m_measureCurrent.MeasureAvg = avg;
  1638. }
  1639. private void ShowMeasureInfo(int index)
  1640. {
  1641. int i = index;
  1642. int count1 = drawTreeView.Nodes.Count;
  1643. ((MeasureDrawObject)(this.m_documentWorkspace.GraphicsList[i])).drawingProperties.Clear();
  1644. ((MeasureDrawObject)(this.m_documentWorkspace.GraphicsList[i])).pointChangeObject.Clear();
  1645. for (int k = 0; k < count1; k++)
  1646. {
  1647. int count2 = drawTreeView.Nodes[k].Nodes.Count;
  1648. for (int j = 0; j < count2; j++)
  1649. {
  1650. if (this.m_documentWorkspace.GraphicsList[i].drawToolType == (DrawToolType)Enum.Parse(typeof(DrawToolType), drawTreeView.Nodes[k].Nodes[j].Name))
  1651. {
  1652. bool drawb = false;
  1653. if (drawTreeView.Nodes[k].Nodes[j].Nodes.Count == 0)
  1654. {
  1655. ((MeasureDrawObject)(this.m_documentWorkspace.GraphicsList[i])).drawingProperties.Add((DrawToolType)Enum.Parse(typeof(DrawToolType), drawTreeView.Nodes[k].Nodes[j].Name), new string[] { "nothing" });
  1656. if (this.m_documentWorkspace.oldDrawTreeView != null)
  1657. {
  1658. if (this.m_documentWorkspace.oldDrawTreeView.Nodes[k].Nodes[j].Nodes.Count != 0)
  1659. ((MeasureDrawObject)(this.m_documentWorkspace.GraphicsList[i])).pointChangeObject.Add((DrawToolType)Enum.Parse(typeof(DrawToolType), drawTreeView.Nodes[k].Nodes[j].Name), true);
  1660. }
  1661. else
  1662. {
  1663. ((MeasureDrawObject)(this.m_documentWorkspace.GraphicsList[i])).pointChangeObject.Add((DrawToolType)Enum.Parse(typeof(DrawToolType), drawTreeView.Nodes[k].Nodes[j].Name), true);
  1664. }
  1665. }
  1666. else
  1667. {
  1668. int a = 0;
  1669. string[] arr = new string[drawTreeView.Nodes[k].Nodes[j].Nodes.Count];
  1670. foreach (TreeNode node2 in drawTreeView.Nodes[k].Nodes[j].Nodes)
  1671. {
  1672. arr[a] = node2.Name;
  1673. a++;
  1674. }
  1675. ((MeasureDrawObject)(this.m_documentWorkspace.GraphicsList[i])).drawingProperties.Add((DrawToolType)Enum.Parse(typeof(DrawToolType), drawTreeView.Nodes[k].Nodes[j].Name), arr);
  1676. if (this.m_documentWorkspace.oldDrawTreeView != null)
  1677. {
  1678. if (drawTreeView.Nodes[k].Nodes[j].Nodes.Count != this.m_documentWorkspace.oldDrawTreeView.Nodes[k].Nodes[j].Nodes.Count)
  1679. {
  1680. ((MeasureDrawObject)(this.m_documentWorkspace.GraphicsList[i])).pointChangeObject.Add((DrawToolType)Enum.Parse(typeof(DrawToolType), drawTreeView.Nodes[k].Nodes[j].Name), true);
  1681. }
  1682. else
  1683. {
  1684. foreach (TreeNode oldNode in this.m_documentWorkspace.oldDrawTreeView.Nodes[k].Nodes[j].Nodes)
  1685. {
  1686. if (!arr.Contains(oldNode.Name))
  1687. {
  1688. drawb = true;
  1689. }
  1690. }
  1691. if (drawb)
  1692. ((MeasureDrawObject)(this.m_documentWorkspace.GraphicsList[i])).pointChangeObject.Add((DrawToolType)Enum.Parse(typeof(DrawToolType), drawTreeView.Nodes[k].Nodes[j].Name), drawb);
  1693. }
  1694. }
  1695. else
  1696. {
  1697. ((MeasureDrawObject)(this.m_documentWorkspace.GraphicsList[i])).pointChangeObject.Add((DrawToolType)Enum.Parse(typeof(DrawToolType), drawTreeView.Nodes[k].Nodes[j].Name), true);
  1698. }
  1699. }
  1700. this.Refresh();
  1701. }
  1702. }
  1703. }
  1704. }
  1705. /// <summary>
  1706. /// 删除测量
  1707. /// </summary>
  1708. /// <param name="sender"></param>
  1709. /// <param name="e"></param>
  1710. private void btnDelete_Click(object sender, EventArgs e)
  1711. {
  1712. NewGraphicsListClear();
  1713. this.GetDataAndAvg();
  1714. }
  1715. private void SpecialMeasureLengthDialog_FormClosing(object sender, FormClosingEventArgs e)
  1716. {
  1717. m_measureStyleModel.measureLine.lineColor = m_straightLineColor;
  1718. m_measureStyleModel.measureLine.lineWidth = m_straightLineWidth;
  1719. m_measureStyleModel.measureLine.lineStyle = m_straightLineStyle;
  1720. m_measureStyleModel.measureLength.lineColor = m_lengthLineColor;
  1721. m_measureStyleModel.measureLength.lineWidth = m_lengthLineWidth;
  1722. m_measureStyleModel.measureLength.lineStyle = m_lengthLineStyle;
  1723. m_measureStyleModel.measureParallelLine.lineColor = m_parallelLineColor;
  1724. m_measureStyleModel.measureParallelLine.lineWidth = m_parallelLineWidth;
  1725. m_measureStyleModel.measureParallelLine.lineStyle = m_parallelLineStyle;
  1726. Startup.instance.measureStyleModel = m_measureStyleModel;
  1727. saveLastData();
  1728. m_sqlHelper.DisConnect();
  1729. }
  1730. private void numericUpDown1_ValueChanged(object sender, EventArgs e)
  1731. {
  1732. this.decnum = (int)numericUpDown1.Value;
  1733. this.UpdateMeasureDecimalPlaces((int)numericUpDown1.Value);
  1734. this.RefreshDgvResult();
  1735. this.GetDataAndAvg();
  1736. }
  1737. /// <summary>
  1738. /// 更新小数位数
  1739. /// </summary>
  1740. /// <param name="decimalPlaces"></param>
  1741. public void UpdateMeasureDecimalPlaces(int praDecimalPlaces)
  1742. {
  1743. MeasureDrawObject.decimalPlaces = praDecimalPlaces;
  1744. this.m_documentWorkspace.Refresh();
  1745. }
  1746. /// <summary>
  1747. /// 全部显示
  1748. /// </summary>
  1749. /// <param name="sender"></param>
  1750. /// <param name="e"></param>
  1751. private void btnAllShow_Click(object sender, EventArgs e)
  1752. {
  1753. m_showAll = true;
  1754. this.RefreshDgvResult();
  1755. }
  1756. /// <summary>
  1757. /// 删除测量结果
  1758. /// </summary>
  1759. /// <param name="sender"></param>
  1760. /// <param name="e"></param>
  1761. private void btnResultDel_Click(object sender, EventArgs e)
  1762. {
  1763. if (this.lstResult.SelectedItems != null && this.lstResult.SelectedItems.Count > 0)
  1764. {
  1765. DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Determineallmeasurementsimage.Text")+"?", PdnResources.GetString("Menu.alert.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
  1766. if (dr == DialogResult.OK)
  1767. {
  1768. foreach (ListViewItem item in this.lstResult.Items)
  1769. {
  1770. if (item.Selected)
  1771. {
  1772. this.lstResult.Items.Remove(item);
  1773. this.m_measureResults.RemoveAll(u => u.Tag == item.Name.ToString());
  1774. if (bitDic.ContainsKey(item.Name.ToString()))
  1775. {
  1776. bitDic[item.Name.ToString()].Clear();
  1777. }
  1778. }
  1779. }
  1780. RefreshDgvResult();
  1781. }
  1782. }
  1783. }
  1784. private void RefreshDgvResult()
  1785. {
  1786. dgvResult.Rows.Clear();
  1787. if (m_showAll)
  1788. {
  1789. for (int i = 0; i < m_measureResults.Count; i++)
  1790. {
  1791. MeasureLengthResult aResult = m_measureResults[i];
  1792. dgvResult.Rows.Add(aResult.Tag, aResult.GraphName, aResult.LevelName, AnalysisTools.GetDecNum(aResult.MeasureAvg, decnum));
  1793. }
  1794. }
  1795. else
  1796. {
  1797. if (this.lstResult.SelectedItems != null && this.lstResult.SelectedItems.Count > 0)
  1798. {
  1799. for (int i = 0; i < this.lstResult.SelectedItems.Count; i++)
  1800. {
  1801. string tag = this.lstResult.SelectedItems[i].Name.ToString();
  1802. List<MeasureLengthResult> findResults = m_measureResults.FindAll(item => item.Tag.Equals(tag));
  1803. for (int j = 0; j < findResults.Count; j++)
  1804. {
  1805. MeasureLengthResult aResult = findResults[j];
  1806. dgvResult.Rows.Add(aResult.Tag, aResult.GraphName, aResult.LevelName, AnalysisTools.GetDecNum(aResult.MeasureAvg, decnum));
  1807. }
  1808. }
  1809. }
  1810. }
  1811. }
  1812. /// <summary>
  1813. /// 保存测量结果
  1814. /// </summary>
  1815. /// <param name="sender"></param>
  1816. /// <param name="e"></param>
  1817. private void btnSave_Click(object sender, EventArgs e)
  1818. {
  1819. if (!m_isMeasure)
  1820. {
  1821. MessageBox.Show(PdnResources.GetString("Menu.tyetmeasured.Text"));
  1822. return;
  1823. }
  1824. if (lstPic.SelectedItems.Count == 0)
  1825. {
  1826. MessageBox.Show(PdnResources.GetString("Menu.selectthepictureyoanttomeasure.Text"));
  1827. return;
  1828. }
  1829. // 重新计算一下
  1830. this.GetDataAndAvg();
  1831. if (lstPic.FocusedItem != null && this.lstPic.SelectedItems.Count > 0)
  1832. {
  1833. string imgName = this.appWorkspace.DocumentWorkspaces[this.lstPic.FocusedItem.Index].GetFriendlyName();
  1834. string tag = this.imageList1.Images.Keys[this.lstPic.SelectedItems[0].Index];
  1835. if (m_measureResults.FindAll(item => item.Tag.Equals(tag)).Count == 0)
  1836. {
  1837. ListViewItem listViewItem = new ListViewItem();
  1838. listViewItem.Name = tag;
  1839. listViewItem.SubItems[0].Text = imgName;
  1840. this.lstResult.Items.Add(listViewItem);
  1841. this.lstResult.SelectedItems.Clear();
  1842. this.lstResult.Items[this.lstResult.Items.Count - 1].Selected = true;
  1843. MeasureLengthResult aResult = m_measureCurrent;
  1844. aResult.Tag = tag;
  1845. dgvResult.Rows.Add(tag, aResult.GraphName, aResult.LevelName, AnalysisTools.GetDecNum(aResult.MeasureAvg, decnum));
  1846. m_measureResults.Add(aResult);
  1847. }
  1848. else
  1849. {
  1850. DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Theanalysisreertoreplaceit.text") + "?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
  1851. if (dr == DialogResult.Cancel)
  1852. {
  1853. return;
  1854. }
  1855. m_measureCurrent.Tag = tag;
  1856. m_measureResults.RemoveAll(u => u.Tag == tag);
  1857. m_measureResults.Add(m_measureCurrent);
  1858. dgvResult.Rows.Clear();
  1859. for (int i = 0; i < m_measureResults.Count; i++)
  1860. {
  1861. MeasureLengthResult aResult = m_measureResults[i];
  1862. dgvResult.Rows.Add(aResult.Tag, aResult.GraphName, aResult.LevelName, AnalysisTools.GetDecNum(aResult.MeasureAvg, decnum));
  1863. }
  1864. }
  1865. //保存处理后的图片
  1866. double pantographRatio = (double)this.appWorkspace.DocumentWorkspaces[this.lstPic.FocusedItem.Index].GetRulerMultiple(MeasurementUnit.Micron);//标尺*放大倍数
  1867. List<Bitmap> tempBit = new List<Bitmap>();
  1868. //Bitmap originalBit = this.appWorkspace.DocumentWorkspaces[this.lstPic.FocusedItem.Index].CompositionSurface.CreateAliasedBitmap();
  1869. m_originalBit.Tag = pantographRatio;
  1870. tempBit.Add(m_originalBit);
  1871. Bitmap newBit = m_originalBit.Clone(new Rectangle(0, 0, m_originalBit.Width, m_originalBit.Height), m_originalBit.PixelFormat);
  1872. Graphics graphics = Graphics.FromImage(newBit);
  1873. Draw(graphics);
  1874. newBit.Tag = pantographRatio;
  1875. tempBit.Add(newBit);
  1876. if (bitDic.ContainsKey(tag))
  1877. {
  1878. bitDic[tag].Clear();
  1879. bitDic[tag] = tempBit;
  1880. }
  1881. else
  1882. {
  1883. bitDic.Add(tag, tempBit);
  1884. }
  1885. //拼接中间数据
  1886. List<List<string>> dataList = new List<List<string>>();
  1887. List<string> columnName = new List<string>();
  1888. columnName.Add(PdnResources.GetString("Menu.Imagement.Measurementlist.ordernumber.text"));
  1889. columnName.Add(PdnResources.GetString("Menu.hectuallength.Text"));
  1890. dataList.Add(columnName);
  1891. int count = this.m_documentWorkspace.GraphicsList.Count;
  1892. int no = 0;
  1893. for (int i = 0; i < count; i++)
  1894. {
  1895. if (this.m_documentWorkspace.GraphicsList[i].objectType == DrawClass.Measure)
  1896. {
  1897. Dictionary<System.Enum, object> data = ((MeasureDrawObject)this.m_documentWorkspace.GraphicsList[i]).GetData();
  1898. foreach (var keys in data)
  1899. {
  1900. object v;
  1901. InvariantData.measureAttributes.TryGetValue((MeasureAttributes)keys.Key, out v);
  1902. if (((MeasureAttributes)keys.Key).ToString() == "PhysicalLength")
  1903. {
  1904. double length = double.Parse(keys.Value.ToString());
  1905. if (length > 0)
  1906. {
  1907. no++;
  1908. List<string> strList = new List<string>();
  1909. strList.Add(no.ToString());
  1910. strList.Add(length.ToString());
  1911. dataList.Add(strList);
  1912. }
  1913. }
  1914. }
  1915. }
  1916. }
  1917. bool isExist = false;//是否已存在进行替换
  1918. int modelIndex = -1;//要替换的下标
  1919. for (int j = 0; j < tempDataModel.Count; j++)
  1920. {
  1921. if (tempDataModel[j].tagName.Equals(tag))
  1922. {
  1923. isExist = true;
  1924. modelIndex = j;
  1925. break;
  1926. }
  1927. }
  1928. if (isExist && modelIndex > -1)
  1929. tempDataModel[modelIndex].dataList = dataList;
  1930. else
  1931. {
  1932. ExportProjectModel newModel = new ExportProjectModel();
  1933. newModel.tagName = tag;
  1934. newModel.picName = imgName;
  1935. newModel.dataList = dataList;
  1936. tempDataModel.Add(newModel);
  1937. }
  1938. //if (m_measureCurrent.LevelName.Equals(""))
  1939. //{
  1940. // MessageBox.Show(PdnResources.GetString("Menu.tnocorrespondinglevel.Text"));
  1941. //}
  1942. //else
  1943. //{
  1944. // MessageBox.Show(PdnResources.GetString("Menu.Successfullysaved.text"));
  1945. //}
  1946. }
  1947. }
  1948. private void Draw(Graphics graphics)
  1949. {
  1950. if (this.m_documentWorkspace.GraphicsList.Count > 0)
  1951. {
  1952. this.m_documentWorkspace.GraphicsList.Draw(graphics);
  1953. }
  1954. if (this.m_documentWorkspace.phaseModels.Count > 0)
  1955. {
  1956. foreach (PhaseModel model in this.m_documentWorkspace.phaseModels)
  1957. {
  1958. if (model.choise && model.mat != null)
  1959. {
  1960. Bitmap map = OpenCvSharp.Extensions.BitmapConverter.ToBitmap(model.mat);
  1961. graphics.DrawImage(map, 0, 0, map.Width, map.Height);
  1962. }
  1963. }
  1964. }
  1965. }
  1966. private void NewGraphicsListClear()
  1967. {
  1968. if (this.m_documentWorkspace != null && this.m_documentWorkspace.GraphicsList.Count > 0)
  1969. {
  1970. this.m_documentWorkspace.GraphicsList.Clear();
  1971. this.m_documentWorkspace.Refresh();
  1972. //List<DrawObject> drawList = this.m_documentWorkspace.GraphicsList.GetDrawClassList(DrawClass.Measure);
  1973. //List<DrawObject> lstInfo = drawList.FindAll(delegate (DrawObject lst) { return !m_oldDrawList.Contains(lst); });
  1974. //lstInfo.ForEach(i => this.m_documentWorkspace.GraphicsList.RemoveObj(i));
  1975. }
  1976. }
  1977. private void lstResult_SelectedIndexChanged(object sender, EventArgs e)
  1978. {
  1979. this.m_showAll = false;
  1980. this.RefreshDgvResult();
  1981. }
  1982. /// <summary>
  1983. /// 生成报告
  1984. /// </summary>
  1985. /// <param name="sender"></param>
  1986. /// <param name="e"></param>
  1987. private void btnCreate_Click(object sender, EventArgs e)
  1988. {
  1989. if(this.dgvResult.Rows.Count <= 0)
  1990. {
  1991. MessageBox.Show(PdnResources.GetString("Menu.nodata.text"));
  1992. return;
  1993. }
  1994. if (chkOpenSetting.Checked)
  1995. {
  1996. OpenSettingDialog();
  1997. }
  1998. bitList.Clear();
  1999. if (this.analyzeSettingModel != null && !string.IsNullOrEmpty(this.analyzeSettingModel.analyzeClassify))
  2000. {
  2001. //获取word书签与excel单元格的关系,以字典方式存储
  2002. List<mic_module_infos> mic_module_infos = mic_module_infos_BLL.FindAll().FindAll(a => a.analyze_classify == this.analyzeSettingModel.analyzeClassify);
  2003. Dictionary<string, string> tagInfos = new Dictionary<string, string>();
  2004. if (mic_module_infos != null && mic_module_infos.Count > 0)
  2005. {
  2006. foreach (mic_module_infos info in mic_module_infos)
  2007. {
  2008. tagInfos.Add(info.tag_name, info.cell_position);
  2009. }
  2010. }
  2011. List<List<string>> analysisContent = new List<List<string>>();
  2012. for (int i = 0; i < this.dgvResult.Rows.Count; i++)
  2013. {
  2014. List<string> content1 = new List<string>();
  2015. if (i == 0)
  2016. {
  2017. content1.Add(this.dgvResult.Columns[1].HeaderText);
  2018. content1.Add(this.dgvResult.Columns[2].HeaderText);
  2019. content1.Add(this.dgvResult.Columns[3].HeaderText);
  2020. analysisContent.Add(content1);
  2021. }
  2022. content1 = new List<string>();
  2023. content1.Add(this.dgvResult.Rows[i].Cells[1].Value.ToString());
  2024. content1.Add(this.dgvResult.Rows[i].Cells[2].Value.ToString());
  2025. content1.Add(this.dgvResult.Rows[i].Cells[3].Value.ToString());
  2026. analysisContent.Add(content1);
  2027. //图片
  2028. string tag = this.dgvResult.Rows[i].Cells[0].Value.ToString();
  2029. if (bitDic.ContainsKey(tag))
  2030. {
  2031. bitList.Add(bitDic[tag][0]);
  2032. bitList.Add(bitDic[tag][1]);
  2033. }
  2034. }
  2035. appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, bitList, tagInfos);
  2036. }
  2037. else
  2038. {
  2039. MessageBox.Show(PdnResources.GetString("Menu.Pleasesetiirst.Text")+"!");
  2040. }
  2041. }
  2042. /// <summary>
  2043. /// 导出结果
  2044. /// </summary>
  2045. /// <param name="sender"></param>
  2046. /// <param name="e"></param>
  2047. private void btnExport_Click(object sender, EventArgs e)
  2048. {
  2049. if (this.dgvResult.Rows.Count > 0)
  2050. {
  2051. SaveFileDialog exe = new SaveFileDialog();
  2052. exe.Filter = "Execl files (*.xlsx)|*.xlsx";
  2053. exe.FilterIndex = 0;
  2054. exe.RestoreDirectory = true;
  2055. exe.Title = "Export Excel File";
  2056. exe.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
  2057. exe.FileName = PdnResources.GetString("Menu.Speciasurveyresultsoflengthsurvey.Text") + DateTime.Now.ToString("yyyyMMddhhmmss");
  2058. DialogResult dr = exe.ShowDialog();
  2059. if (dr == DialogResult.OK)
  2060. {
  2061. DataTable dtb = new DataTable();
  2062. for(int i = 1; i< this.dgvResult.Columns.Count; i++)
  2063. {
  2064. dtb.Columns.Add(this.dgvResult.Columns[i].HeaderText);
  2065. }
  2066. for (int r = 0; r < this.dgvResult.Rows.Count; r++)
  2067. {
  2068. DataRow dataRow = dtb.NewRow();
  2069. for (int c = 1; c < this.dgvResult.Rows[r].Cells.Count; c++)
  2070. {
  2071. dataRow[this.dgvResult.Columns[c].HeaderText] = this.dgvResult.Rows[r].Cells[c].Value;
  2072. }
  2073. dtb.Rows.Add(dataRow);
  2074. }
  2075. List<DataTable> list = new List<DataTable>();
  2076. list.Add(dtb);
  2077. this.appWorkspace.ExportDataToExcelWithProgress(list, exe.FileName, true, false, true);
  2078. }
  2079. }
  2080. else
  2081. {
  2082. MessageBox.Show(PdnResources.GetString("Menu.Noanalysisresults.text")+"!");
  2083. }
  2084. }
  2085. private void nudStraightLineWidth_ValueChanged(object sender, EventArgs e)
  2086. {
  2087. m_measureStyleModel.measureLine.lineWidth = (int)nudStraightLineWidth.Value;
  2088. m_documentWorkspace.Refresh();
  2089. }
  2090. private void cmbStraightLine_SelectedIndexChanged(object sender, EventArgs e)
  2091. {
  2092. m_measureStyleModel.measureLine.lineStyle = cmbStraightLine.SelectedIndex;
  2093. m_documentWorkspace.Refresh();
  2094. }
  2095. private void pnlStraightLineColor_BackColorChanged(object sender, EventArgs e)
  2096. {
  2097. m_measureStyleModel.measureLine.lineColor = pnlStraightLineColor.BackColor.ToArgb();
  2098. m_documentWorkspace.Refresh();
  2099. }
  2100. private void nudLengthLineWidth_ValueChanged(object sender, EventArgs e)
  2101. {
  2102. m_measureStyleModel.measureLength.lineWidth = (int)nudLengthLineWidth.Value;
  2103. m_documentWorkspace.Refresh();
  2104. }
  2105. private void cmbLengthLine_SelectedIndexChanged(object sender, EventArgs e)
  2106. {
  2107. m_measureStyleModel.measureLength.lineStyle = cmbLengthLine.SelectedIndex;
  2108. m_documentWorkspace.Refresh();
  2109. }
  2110. private void pnlLengthLineColor_BackColorChanged(object sender, EventArgs e)
  2111. {
  2112. m_measureStyleModel.measureLength.lineColor = pnlLengthLineColor.BackColor.ToArgb();
  2113. m_documentWorkspace.Refresh();
  2114. }
  2115. private void nudParallelLineWidth_ValueChanged(object sender, EventArgs e)
  2116. {
  2117. m_measureStyleModel.measureParallelLine.lineWidth = (int)nudParallelLineWidth.Value;
  2118. m_documentWorkspace.Refresh();
  2119. }
  2120. private void pnlParallelLineColor_BackColorChanged(object sender, EventArgs e)
  2121. {
  2122. m_measureStyleModel.measureParallelLine.lineColor = pnlParallelLineColor.BackColor.ToArgb();
  2123. m_documentWorkspace.Refresh();
  2124. }
  2125. private void cmbParallelLine_SelectedIndexChanged(object sender, EventArgs e)
  2126. {
  2127. m_measureStyleModel.measureParallelLine.lineStyle = cmbParallelLine.SelectedIndex;
  2128. m_documentWorkspace.Refresh();
  2129. }
  2130. /// <summary>
  2131. /// 导出项目
  2132. /// </summary>
  2133. /// <param name="sender"></param>
  2134. /// <param name="e"></param>
  2135. private void btnExportProject_Click(object sender, EventArgs e)
  2136. {
  2137. try
  2138. {
  2139. if (this.analyzeSettingModel == null)
  2140. {
  2141. MessageBox.Show(PdnResources.GetString("Menu.Settheexporteitemfirst.Text"));
  2142. return;
  2143. }
  2144. //获取项目工程内的文件夹路径
  2145. ProjectEngineering.NodeItem item = this.appWorkspace.GetInsertProjectPath(2, "Menu.GeneralAnalysis.SpecialMeasure.Text", this.analyzeSettingModel.savePath);
  2146. bitList.Clear();
  2147. if (item != null)
  2148. {
  2149. //向文件夹内保存图片和报告
  2150. if (!string.IsNullOrEmpty(this.analyzeSettingModel.analyzeClassify))
  2151. {
  2152. //获取word书签与excel单元格的关系,以字典方式存储
  2153. List<mic_module_infos> mic_module_infos = mic_module_infos_BLL.FindAll().FindAll(a => a.analyze_classify == this.analyzeSettingModel.analyzeClassify);
  2154. Dictionary<string, string> tagInfos = new Dictionary<string, string>();
  2155. if (mic_module_infos != null && mic_module_infos.Count > 0)
  2156. {
  2157. foreach (mic_module_infos info in mic_module_infos)
  2158. {
  2159. tagInfos.Add(info.tag_name, info.cell_position);
  2160. }
  2161. }
  2162. List<ExportProjectModel> dataModel = new List<ExportProjectModel>();
  2163. List<List<string>> analysisContent = new List<List<string>>();
  2164. for (int i = 0; i < this.dgvResult.Rows.Count; i++)
  2165. {
  2166. List<string> content1 = new List<string>();
  2167. if (i == 0)
  2168. {
  2169. content1.Add(this.dgvResult.Columns[1].HeaderText);
  2170. content1.Add(this.dgvResult.Columns[2].HeaderText);
  2171. content1.Add(this.dgvResult.Columns[3].HeaderText);
  2172. analysisContent.Add(content1);
  2173. }
  2174. content1 = new List<string>();
  2175. content1.Add(this.dgvResult.Rows[i].Cells[1].Value.ToString());
  2176. content1.Add(this.dgvResult.Rows[i].Cells[2].Value.ToString());
  2177. content1.Add(this.dgvResult.Rows[i].Cells[3].Value.ToString());
  2178. analysisContent.Add(content1);
  2179. //图片
  2180. string tag = this.dgvResult.Rows[i].Cells[0].Value.ToString();
  2181. if (bitDic.ContainsKey(tag))
  2182. {
  2183. bitList.Add(bitDic[tag][0]);
  2184. bitList.Add(bitDic[tag][1]);
  2185. }
  2186. // 中间数据
  2187. foreach(ExportProjectModel data in tempDataModel)
  2188. {
  2189. if (data.tagName.Equals(tag))
  2190. {
  2191. dataModel.Add(data);
  2192. }
  2193. }
  2194. }
  2195. this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, dataModel, bitList, tagInfos, item.path, item.code);
  2196. }
  2197. else
  2198. {
  2199. MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text")+"!");
  2200. return;
  2201. }
  2202. //保存项目信息到数据库
  2203. this.appWorkspace.InsertIntoDB(this.analyzeSettingModel, item);
  2204. }
  2205. }
  2206. catch (Exception)
  2207. {
  2208. }
  2209. }
  2210. /// <summary>
  2211. /// 获取上次操作参数
  2212. /// </summary>
  2213. private void getLastData()
  2214. {
  2215. string filePath = Application.StartupPath + "\\Config\\Default\\ParameterSaving\\ParameterGeneralAnalysis.xml";
  2216. if (!System.IO.File.Exists(filePath))
  2217. {
  2218. generalAnalysisModel = new GeneralAnalysisModel();
  2219. generalAnalysisModel.PolyphaseMutiAreaContentModels = new GeneralAnalysisModel.PolyphaseMutiAreaContentModel();
  2220. generalAnalysisModel.PolyphaseCounterAnalysisModels = new GeneralAnalysisModel.PolyphaseCounterAnalysisModel();
  2221. generalAnalysisModel.TwoPhaseScaleModels = new GeneralAnalysisModel.TwoPhaseScaleModel();
  2222. generalAnalysisModel.PolyphaseContentModels = new GeneralAnalysisModel.PolyphaseContentModel();
  2223. generalAnalysisModel.PolyphaseDistanceModels = new GeneralAnalysisModel.PolyphaseDistanceModel();
  2224. generalAnalysisModel.DebrisSelectionModels = new GeneralAnalysisModel.DebrisSelectionModel();
  2225. generalAnalysisModel.CountNumberAnalysisModels = new GeneralAnalysisModel.CountNumberAnalysisModel();
  2226. generalAnalysisModel.PolyphaseMutiAreaContentModels.hasUsed = false;
  2227. generalAnalysisModel.PolyphaseCounterAnalysisModels.hasUsed = false;
  2228. generalAnalysisModel.TwoPhaseScaleModels.hasUsed = false;
  2229. generalAnalysisModel.PolyphaseContentModels.hasUsed = false;
  2230. generalAnalysisModel.PolyphaseDistanceModels.hasUsed = false;
  2231. generalAnalysisModel.DebrisSelectionModels.hasUsed = false;
  2232. generalAnalysisModel.CountNumberAnalysisModels.hasUsed = false;
  2233. string porosityInfoXml = XmlSerializeHelper.XmlSerialize<GeneralAnalysisModel>(generalAnalysisModel);
  2234. Directory.CreateDirectory(Application.StartupPath + "\\Config\\Default\\ParameterSaving\\");
  2235. FileOperationHelper.WriteStringToFile(porosityInfoXml, filePath, FileMode.CreateNew);
  2236. }
  2237. else
  2238. {
  2239. generalAnalysisModel = XmlSerializeHelper.DESerializer<GeneralAnalysisModel>(FileOperationHelper.ReadStringFromFile(filePath, FileMode.Open));
  2240. if (generalAnalysisModel.SpecialMeasureLengthModels == null)
  2241. {
  2242. generalAnalysisModel.SpecialMeasureLengthModels = new GeneralAnalysisModel.SpecialMeasureLengthModel();
  2243. }
  2244. if (generalAnalysisModel.SpecialMeasureLengthModels.hasUsed)
  2245. {
  2246. if (cmbSpecial.Items.Count >= (generalAnalysisModel.SpecialMeasureLengthModels.parameter1 - 1))
  2247. {
  2248. cmbSpecial.SelectedIndex = generalAnalysisModel.SpecialMeasureLengthModels.parameter1;
  2249. }
  2250. else
  2251. {
  2252. cmbSpecial.SelectedIndex = 0;
  2253. }
  2254. pnlStraightLineColor.BackColor = Color.FromArgb(generalAnalysisModel.SpecialMeasureLengthModels.parameter2);
  2255. nudStraightLineWidth.Value = generalAnalysisModel.SpecialMeasureLengthModels.parameter3;
  2256. cmbStraightLine.SelectedIndex = generalAnalysisModel.SpecialMeasureLengthModels.parameter4;
  2257. pnlLengthLineColor.BackColor = Color.FromArgb(generalAnalysisModel.SpecialMeasureLengthModels.parameter5);
  2258. nudLengthLineWidth.Value = generalAnalysisModel.SpecialMeasureLengthModels.parameter6;
  2259. cmbLengthLine.SelectedIndex = generalAnalysisModel.SpecialMeasureLengthModels.parameter7;
  2260. pnlParallelLineColor.BackColor = Color.FromArgb(generalAnalysisModel.SpecialMeasureLengthModels.parameter8);
  2261. nudParallelLineWidth.Value = generalAnalysisModel.SpecialMeasureLengthModels.parameter9;
  2262. cmbParallelLine.SelectedIndex = generalAnalysisModel.SpecialMeasureLengthModels.parameter10;
  2263. chkOpenSetting.Checked = generalAnalysisModel.SpecialMeasureLengthModels.parameter11;
  2264. numericUpDown1.Value = generalAnalysisModel.SpecialMeasureLengthModels.parameter12;
  2265. }
  2266. }
  2267. }
  2268. /// <summary>
  2269. /// 保存上次操作参数
  2270. /// </summary>
  2271. private void saveLastData()
  2272. {
  2273. if (generalAnalysisModel.SpecialMeasureLengthModels == null)
  2274. {
  2275. generalAnalysisModel.SpecialMeasureLengthModels = new GeneralAnalysisModel.SpecialMeasureLengthModel();
  2276. }
  2277. generalAnalysisModel.SpecialMeasureLengthModels.hasUsed = true;
  2278. generalAnalysisModel.SpecialMeasureLengthModels.parameter1 = cmbSpecial.SelectedIndex;
  2279. generalAnalysisModel.SpecialMeasureLengthModels.parameter2 = pnlStraightLineColor.BackColor.ToArgb();
  2280. generalAnalysisModel.SpecialMeasureLengthModels.parameter3 = (int)nudStraightLineWidth.Value;
  2281. generalAnalysisModel.SpecialMeasureLengthModels.parameter4 = cmbStraightLine.SelectedIndex;
  2282. generalAnalysisModel.SpecialMeasureLengthModels.parameter5 = pnlLengthLineColor.BackColor.ToArgb();
  2283. generalAnalysisModel.SpecialMeasureLengthModels.parameter6 = (int)nudLengthLineWidth.Value;
  2284. generalAnalysisModel.SpecialMeasureLengthModels.parameter7 = cmbLengthLine.SelectedIndex;
  2285. generalAnalysisModel.SpecialMeasureLengthModels.parameter8 = pnlParallelLineColor.BackColor.ToArgb();
  2286. generalAnalysisModel.SpecialMeasureLengthModels.parameter9 = (int)nudParallelLineWidth.Value;
  2287. generalAnalysisModel.SpecialMeasureLengthModels.parameter10 = cmbParallelLine.SelectedIndex;
  2288. generalAnalysisModel.SpecialMeasureLengthModels.parameter11 = chkOpenSetting.Checked;
  2289. generalAnalysisModel.SpecialMeasureLengthModels.parameter12 = (int)numericUpDown1.Value;
  2290. string filePath = Application.StartupPath + "\\Config\\Default\\ParameterSaving\\ParameterGeneralAnalysis.xml";
  2291. string porosityInfoXml = XmlSerializeHelper.XmlSerialize<GeneralAnalysisModel>(generalAnalysisModel);
  2292. FileOperationHelper.WriteStringToFile(porosityInfoXml, filePath, FileMode.Create);
  2293. }
  2294. }
  2295. }