SpecialMeasureLengthDialog.cs 115 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444
  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 Bitmap m_bitmap;
  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.m_bitmap = this.appWorkspace.DocumentWorkspaces[this.lstPic.FocusedItem.Index].CompositionSurface.CreateAliasedBitmap();
  1285. Document document = Document.FromImage(m_bitmap);
  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. m_originalBit = m_bitmap.Clone(new Rectangle(0, 0, m_bitmap.Width, m_bitmap.Height), m_bitmap.PixelFormat);
  1295. Graphics graphics = Graphics.FromImage(m_originalBit);
  1296. Draw(graphics);
  1297. ExistenceMeasure();
  1298. //this.selectPicture = true;
  1299. }
  1300. }
  1301. #region 线颜色选择
  1302. private void ShowColorsForm(object sender)
  1303. {
  1304. Panel panel = (Panel)sender;
  1305. this.colorsFormGrid.UserPrimaryColor = ColorBgra.FromColor(panel.BackColor);
  1306. this.colorsFormGrid.setSaveBtn_Click(new System.EventHandler(this.gridColorChanged));
  1307. this.colorsFormGrid.ShowDialog();
  1308. }
  1309. /// <summary>
  1310. /// 网格Panel的调色板颜色改变
  1311. /// </summary>
  1312. /// <param name="sender"></param>
  1313. /// <param name="e"></param>
  1314. private void gridColorChanged(object sender, EventArgs e)
  1315. {
  1316. Panel panel = (Panel)m_currentColorPanel;
  1317. Color color = this.colorsFormGrid.UserPrimaryColor.ToColor();
  1318. panel.BackColor = color;
  1319. this.colorsFormGrid.Close();
  1320. }
  1321. private void pnlStraightLineColor_Click(object sender, EventArgs e)
  1322. {
  1323. m_currentColorPanel = sender;
  1324. ShowColorsForm(sender);
  1325. }
  1326. private void pnlLengthLineColor_Click(object sender, EventArgs e)
  1327. {
  1328. m_currentColorPanel = sender;
  1329. ShowColorsForm(sender);
  1330. }
  1331. private void pnlParallelLineColor_Click(object sender, EventArgs e)
  1332. {
  1333. m_currentColorPanel = sender;
  1334. ShowColorsForm(sender);
  1335. }
  1336. #endregion
  1337. private void nudStraightLineWidth_KeyUp(object sender, KeyEventArgs e)
  1338. {
  1339. try
  1340. {
  1341. nudStraightLineWidth.Value = Convert.ToInt32(this.nudStraightLineWidth.Text);
  1342. }
  1343. catch (Exception)
  1344. { }
  1345. }
  1346. private void nudLengthLineWidth_KeyUp(object sender, KeyEventArgs e)
  1347. {
  1348. try
  1349. {
  1350. nudLengthLineWidth.Value = Convert.ToInt32(this.nudLengthLineWidth.Text);
  1351. }
  1352. catch (Exception)
  1353. { }
  1354. }
  1355. private void nudParallelLineWidth_KeyUp(object sender, KeyEventArgs e)
  1356. {
  1357. try
  1358. {
  1359. nudParallelLineWidth.Value = Convert.ToInt32(this.nudParallelLineWidth.Text);
  1360. }
  1361. catch (Exception)
  1362. { }
  1363. }
  1364. /// <summary>
  1365. /// 开启/结束测量
  1366. /// </summary>
  1367. /// <param name="sender"></param>
  1368. /// <param name="e"></param>
  1369. private void btnMeasure_Click(object sender, EventArgs e)
  1370. {
  1371. if (cmbSpecial.SelectedItem == null || m_levelList == null || m_levelList.Rows.Count <= 0)
  1372. {
  1373. MessageBox.Show(PdnResources.GetString("Menu.Pleasefirstsetthespecialdefinitionlength.Text"));
  1374. return;
  1375. }
  1376. m_isMeasure = !m_isMeasure;
  1377. UpdateMeasureUIAndState();
  1378. }
  1379. private void UpdateMeasureUIAndState()
  1380. {
  1381. if (m_isMeasure)
  1382. {
  1383. this.NewGraphicsListClear();
  1384. this.InitCurrentMeasure();
  1385. if (m_measureResults.Count > 0)
  1386. {
  1387. if (m_specialSelectedIndex != this.cmbSpecial.SelectedIndex)
  1388. {
  1389. DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.learthelastmeasuremen.Text")+"?", PdnResources.GetString("Menu.alert.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
  1390. if (dr == DialogResult.OK)
  1391. {
  1392. this.lstResult.Items.Clear();
  1393. this.m_measureResults.Clear();
  1394. this.bitDic.Clear();
  1395. this.dgvResult.Rows.Clear();
  1396. }
  1397. else
  1398. {
  1399. m_isMeasure = false;
  1400. return;
  1401. }
  1402. }
  1403. }
  1404. btnMeasure.Text = PdnResources.GetString("Menu.Stopmeasure.text");
  1405. btnStraightLineMeasure.Enabled = true;
  1406. btnLengthLineMeasure.Enabled = true;
  1407. btnParallelLineMeasure.Enabled = true;
  1408. cmbSpecial.Enabled = false;
  1409. }
  1410. else
  1411. {
  1412. btnMeasure.Text = PdnResources.GetString("Menu.Pleasestartmeasuring.text");
  1413. cmbSpecial.Enabled = true;
  1414. btnStraightLineMeasure.Enabled = false;
  1415. btnLengthLineMeasure.Enabled = false;
  1416. btnParallelLineMeasure.Enabled = false;
  1417. if (m_isMeasureByStraightLine)
  1418. {
  1419. btnStraightLineMeasure.Text = PdnResources.GetString("Menu.measuring.text");
  1420. m_isMeasureByStraightLine = false;
  1421. }
  1422. if (m_isMeasureByLengthLine)
  1423. {
  1424. btnLengthLineMeasure.Text = PdnResources.GetString("Menu.measuring.text");
  1425. m_isMeasureByLengthLine = false;
  1426. }
  1427. if (m_isMeasureByParallelLine)
  1428. {
  1429. btnParallelLineMeasure.Text = PdnResources.GetString("Menu.measuring.text");
  1430. m_isMeasureByParallelLine = false;
  1431. }
  1432. this.m_documentWorkspace.ActiveTool = DrawToolType.Pointer;
  1433. }
  1434. }
  1435. private void chkOpenSetting_CheckedChanged(object sender, EventArgs e)
  1436. {
  1437. m_isOpenSetting = chkOpenSetting.Checked;
  1438. }
  1439. private void btnStraightLineMeasure_Click(object sender, EventArgs e)
  1440. {
  1441. if (m_bitmap == null)
  1442. {
  1443. MessageBox.Show(PdnResources.GetString("Menu.Pleaseselecttheimagefirst.Text"));
  1444. return;
  1445. }
  1446. m_isMeasureByStraightLine = !m_isMeasureByStraightLine;
  1447. if (m_isMeasureByStraightLine)
  1448. {
  1449. btnStraightLineMeasure.Text = PdnResources.GetString("Menu.stop.text");
  1450. m_isMeasureByLengthLine = false;
  1451. btnLengthLineMeasure.Text = PdnResources.GetString("Menu.measuring.text");
  1452. m_isMeasureByParallelLine = false;
  1453. btnParallelLineMeasure.Text = PdnResources.GetString("Menu.measuring.text");
  1454. m_measureStyleModel.measureLine.lineColor = pnlStraightLineColor.BackColor.ToArgb();
  1455. m_measureStyleModel.measureLine.lineWidth = (int)nudStraightLineWidth.Value;
  1456. m_measureStyleModel.measureLine.lineStyle = cmbStraightLine.SelectedIndex;
  1457. this.m_documentWorkspace.ActiveTool = DrawToolType.MeasureLine;
  1458. }
  1459. else
  1460. {
  1461. btnStraightLineMeasure.Text = PdnResources.GetString("Menu.measuring.text");
  1462. this.m_documentWorkspace.ActiveTool = DrawToolType.Pointer;
  1463. this.GetDataAndAvg();
  1464. }
  1465. UpdateMeasureDecimalPlaces((int)numericUpDown1.Value);
  1466. }
  1467. /// <summary>
  1468. /// 是否存在测量,有则选择工具
  1469. /// </summary>
  1470. /// <returns></returns>
  1471. public void ExistenceMeasure()
  1472. {
  1473. if (PdnResources.GetString("Menu.stop.text").Equals(btnStraightLineMeasure.Text))
  1474. this.m_documentWorkspace.ActiveTool = DrawToolType.MeasureLine;
  1475. if (PdnResources.GetString("Menu.stop.text").Equals(btnLengthLineMeasure.Text))
  1476. this.m_documentWorkspace.ActiveTool = DrawToolType.MeasureLength;
  1477. if (PdnResources.GetString("Menu.stop.text").Equals(btnParallelLineMeasure.Text))
  1478. this.m_documentWorkspace.ActiveTool = DrawToolType.MeasureParallelLine;
  1479. }
  1480. private void btnLengthLineMeasure_Click(object sender, EventArgs e)
  1481. {
  1482. if (m_bitmap == null)
  1483. {
  1484. MessageBox.Show(PdnResources.GetString("Menu.Pleaseselecttheimagefirst.Text"));
  1485. return;
  1486. }
  1487. m_isMeasureByLengthLine = !m_isMeasureByLengthLine;
  1488. if (m_isMeasureByLengthLine)
  1489. {
  1490. btnLengthLineMeasure.Text = PdnResources.GetString("Menu.stop.text");
  1491. m_isMeasureByStraightLine = false;
  1492. btnStraightLineMeasure.Text = PdnResources.GetString("Menu.measuring.text");
  1493. m_isMeasureByParallelLine = false;
  1494. btnParallelLineMeasure.Text = PdnResources.GetString("Menu.measuring.text");
  1495. m_measureStyleModel.measureLength.lineColor = pnlLengthLineColor.BackColor.ToArgb();
  1496. m_measureStyleModel.measureLength.lineWidth = (int)nudLengthLineWidth.Value;
  1497. m_measureStyleModel.measureLength.lineStyle = cmbLengthLine.SelectedIndex;
  1498. this.m_documentWorkspace.ActiveTool = DrawToolType.MeasureLength;
  1499. }
  1500. else
  1501. {
  1502. btnLengthLineMeasure.Text = PdnResources.GetString("Menu.measuring.text");
  1503. this.m_documentWorkspace.ActiveTool = DrawToolType.Pointer;
  1504. this.GetDataAndAvg();
  1505. }
  1506. UpdateMeasureDecimalPlaces((int)numericUpDown1.Value);
  1507. }
  1508. private void btnParallelLineMeasure_Click(object sender, EventArgs e)
  1509. {
  1510. if (m_bitmap == null)
  1511. {
  1512. MessageBox.Show(PdnResources.GetString("Menu.Pleaseselecttheimagefirst.Text"));
  1513. return;
  1514. }
  1515. m_isMeasureByParallelLine = !m_isMeasureByParallelLine;
  1516. if (m_isMeasureByParallelLine)
  1517. {
  1518. btnParallelLineMeasure.Text = PdnResources.GetString("Menu.stop.text");
  1519. m_isMeasureByStraightLine = false;
  1520. btnStraightLineMeasure.Text = PdnResources.GetString("Menu.measuring.text");
  1521. m_isMeasureByLengthLine = false;
  1522. btnLengthLineMeasure.Text = PdnResources.GetString("Menu.measuring.text");
  1523. m_measureStyleModel.measureParallelLine.lineColor = pnlParallelLineColor.BackColor.ToArgb();
  1524. m_measureStyleModel.measureParallelLine.lineWidth = (int)nudParallelLineWidth.Value;
  1525. m_measureStyleModel.measureParallelLine.lineStyle = cmbParallelLine.SelectedIndex;
  1526. this.m_documentWorkspace.ActiveTool = DrawToolType.MeasureParallelLine;
  1527. }
  1528. else
  1529. {
  1530. btnParallelLineMeasure.Text = PdnResources.GetString("Menu.measuring.text");
  1531. this.m_documentWorkspace.ActiveTool = DrawToolType.Pointer;
  1532. this.GetDataAndAvg();
  1533. }
  1534. UpdateMeasureDecimalPlaces((int)numericUpDown1.Value);
  1535. }
  1536. private TreeView drawTreeView;
  1537. /// <summary>
  1538. /// 从配置文件中读取设置信息
  1539. /// </summary>
  1540. private void GetAttributeFromConfigurationFile()
  1541. {
  1542. MeasureListSetModel measureListSetModel = XmlSerializeHelper.DESerializer<MeasureListSetModel>(FileOperationHelper.ReadStringFromFile(System.Windows.Forms.Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\MeasureListSetModel.xml", FileMode.Open));
  1543. drawTreeView = new TreeView();
  1544. if (measureListSetModel != null && measureListSetModel.AttributeMapDrawNodes != null)
  1545. {
  1546. for (int i = 0; i < measureListSetModel.AttributeMapDrawNodes.Count; i++)
  1547. {
  1548. TreeNode firstNode = new TreeNode();
  1549. firstNode.Text = measureListSetModel.AttributeMapDrawNodes[i].Name;
  1550. for (int j = 0; j < measureListSetModel.AttributeMapDrawNodes[i].Attribute.Count; j++)
  1551. {
  1552. TreeNode scondNode = new TreeNode();
  1553. scondNode.Text = measureListSetModel.AttributeMapDrawNodes[i].Attribute[j].Text;
  1554. scondNode.Name = measureListSetModel.AttributeMapDrawNodes[i].Attribute[j].Name;
  1555. for (int k = 0; k < measureListSetModel.AttributeMapDrawNodes[i].Attribute[j].Attribute.Count; k++)
  1556. {
  1557. if (measureListSetModel.AttributeMapDrawNodes[i].Attribute[j].Attribute.Count > 0)
  1558. {
  1559. TreeNode thirdNode = new TreeNode();
  1560. thirdNode.Text = measureListSetModel.AttributeMapDrawNodes[i].Attribute[j].Attribute[k].Text;
  1561. thirdNode.Name = measureListSetModel.AttributeMapDrawNodes[i].Attribute[j].Attribute[k].Name;
  1562. scondNode.Nodes.Add(thirdNode);
  1563. }
  1564. }
  1565. firstNode.Nodes.Add(scondNode);
  1566. }
  1567. drawTreeView.Nodes.Add(firstNode);
  1568. }
  1569. }
  1570. }
  1571. /// <summary>
  1572. /// 获取计算测量结果
  1573. /// </summary>
  1574. private void GetDataAndAvg()
  1575. {
  1576. string level = "";
  1577. double avg = 0;
  1578. double sum = 0;
  1579. int count = this.m_documentWorkspace.GraphicsList.Count;
  1580. int no = 0;
  1581. for (int i = 0; i < count; i++)
  1582. {
  1583. if (this.m_documentWorkspace.GraphicsList[i].objectType == DrawClass.Measure)
  1584. {
  1585. no++;
  1586. Dictionary<System.Enum, object> data = ((MeasureDrawObject)this.m_documentWorkspace.GraphicsList[i]).GetData();
  1587. foreach (var keys in data)
  1588. {
  1589. /// <summary>
  1590. /// 像素长度
  1591. /// </summary>
  1592. //PixelLength
  1593. /// <summary>
  1594. /// 物理长度
  1595. /// </summary>
  1596. //PhysicalLength
  1597. object v;
  1598. InvariantData.measureAttributes.TryGetValue((MeasureAttributes)keys.Key, out v);
  1599. if (((MeasureAttributes)keys.Key).ToString() == "PhysicalLength")
  1600. {
  1601. double length = double.Parse(keys.Value.ToString());
  1602. if (length > 0)
  1603. {
  1604. sum += length;
  1605. this.ShowMeasureInfo(i);
  1606. }
  1607. else
  1608. {
  1609. no--;
  1610. }
  1611. break;
  1612. }
  1613. }
  1614. }
  1615. }
  1616. if(no > 0)
  1617. {
  1618. avg = sum / no;
  1619. }
  1620. if (m_levelList != null && m_levelList.Rows.Count > 0)
  1621. {
  1622. for (int i = 0; i < m_levelList.Rows.Count; ++i)
  1623. {
  1624. double minValue = double.Parse(m_levelList.Rows[i]["minValue"].ToString());
  1625. double maxValue = double.Parse(m_levelList.Rows[i]["maxValue"].ToString());
  1626. if (avg >= minValue && avg < maxValue)
  1627. {
  1628. level = m_levelList.Rows[i]["name"].ToString();
  1629. break;
  1630. }
  1631. }
  1632. }
  1633. lblLevel.Text = level;
  1634. lblAvg.Text = AnalysisTools.GetDecNum(avg, decnum); ;
  1635. m_measureCurrent.LevelName = level;
  1636. m_measureCurrent.MeasureAvg = avg;
  1637. }
  1638. private void ShowMeasureInfo(int index)
  1639. {
  1640. int i = index;
  1641. int count1 = drawTreeView.Nodes.Count;
  1642. ((MeasureDrawObject)(this.m_documentWorkspace.GraphicsList[i])).drawingProperties.Clear();
  1643. ((MeasureDrawObject)(this.m_documentWorkspace.GraphicsList[i])).pointChangeObject.Clear();
  1644. for (int k = 0; k < count1; k++)
  1645. {
  1646. int count2 = drawTreeView.Nodes[k].Nodes.Count;
  1647. for (int j = 0; j < count2; j++)
  1648. {
  1649. if (this.m_documentWorkspace.GraphicsList[i].drawToolType == (DrawToolType)Enum.Parse(typeof(DrawToolType), drawTreeView.Nodes[k].Nodes[j].Name))
  1650. {
  1651. bool drawb = false;
  1652. if (drawTreeView.Nodes[k].Nodes[j].Nodes.Count == 0)
  1653. {
  1654. ((MeasureDrawObject)(this.m_documentWorkspace.GraphicsList[i])).drawingProperties.Add((DrawToolType)Enum.Parse(typeof(DrawToolType), drawTreeView.Nodes[k].Nodes[j].Name), new string[] { "nothing" });
  1655. if (this.m_documentWorkspace.oldDrawTreeView != null)
  1656. {
  1657. if (this.m_documentWorkspace.oldDrawTreeView.Nodes[k].Nodes[j].Nodes.Count != 0)
  1658. ((MeasureDrawObject)(this.m_documentWorkspace.GraphicsList[i])).pointChangeObject.Add((DrawToolType)Enum.Parse(typeof(DrawToolType), drawTreeView.Nodes[k].Nodes[j].Name), true);
  1659. }
  1660. else
  1661. {
  1662. ((MeasureDrawObject)(this.m_documentWorkspace.GraphicsList[i])).pointChangeObject.Add((DrawToolType)Enum.Parse(typeof(DrawToolType), drawTreeView.Nodes[k].Nodes[j].Name), true);
  1663. }
  1664. }
  1665. else
  1666. {
  1667. int a = 0;
  1668. string[] arr = new string[drawTreeView.Nodes[k].Nodes[j].Nodes.Count];
  1669. foreach (TreeNode node2 in drawTreeView.Nodes[k].Nodes[j].Nodes)
  1670. {
  1671. arr[a] = node2.Name;
  1672. a++;
  1673. }
  1674. ((MeasureDrawObject)(this.m_documentWorkspace.GraphicsList[i])).drawingProperties.Add((DrawToolType)Enum.Parse(typeof(DrawToolType), drawTreeView.Nodes[k].Nodes[j].Name), arr);
  1675. if (this.m_documentWorkspace.oldDrawTreeView != null)
  1676. {
  1677. if (drawTreeView.Nodes[k].Nodes[j].Nodes.Count != this.m_documentWorkspace.oldDrawTreeView.Nodes[k].Nodes[j].Nodes.Count)
  1678. {
  1679. ((MeasureDrawObject)(this.m_documentWorkspace.GraphicsList[i])).pointChangeObject.Add((DrawToolType)Enum.Parse(typeof(DrawToolType), drawTreeView.Nodes[k].Nodes[j].Name), true);
  1680. }
  1681. else
  1682. {
  1683. foreach (TreeNode oldNode in this.m_documentWorkspace.oldDrawTreeView.Nodes[k].Nodes[j].Nodes)
  1684. {
  1685. if (!arr.Contains(oldNode.Name))
  1686. {
  1687. drawb = true;
  1688. }
  1689. }
  1690. if (drawb)
  1691. ((MeasureDrawObject)(this.m_documentWorkspace.GraphicsList[i])).pointChangeObject.Add((DrawToolType)Enum.Parse(typeof(DrawToolType), drawTreeView.Nodes[k].Nodes[j].Name), drawb);
  1692. }
  1693. }
  1694. else
  1695. {
  1696. ((MeasureDrawObject)(this.m_documentWorkspace.GraphicsList[i])).pointChangeObject.Add((DrawToolType)Enum.Parse(typeof(DrawToolType), drawTreeView.Nodes[k].Nodes[j].Name), true);
  1697. }
  1698. }
  1699. this.Refresh();
  1700. }
  1701. }
  1702. }
  1703. }
  1704. /// <summary>
  1705. /// 删除测量
  1706. /// </summary>
  1707. /// <param name="sender"></param>
  1708. /// <param name="e"></param>
  1709. private void btnDelete_Click(object sender, EventArgs e)
  1710. {
  1711. NewGraphicsListClear();
  1712. this.GetDataAndAvg();
  1713. }
  1714. private void SpecialMeasureLengthDialog_FormClosing(object sender, FormClosingEventArgs e)
  1715. {
  1716. m_measureStyleModel.measureLine.lineColor = m_straightLineColor;
  1717. m_measureStyleModel.measureLine.lineWidth = m_straightLineWidth;
  1718. m_measureStyleModel.measureLine.lineStyle = m_straightLineStyle;
  1719. m_measureStyleModel.measureLength.lineColor = m_lengthLineColor;
  1720. m_measureStyleModel.measureLength.lineWidth = m_lengthLineWidth;
  1721. m_measureStyleModel.measureLength.lineStyle = m_lengthLineStyle;
  1722. m_measureStyleModel.measureParallelLine.lineColor = m_parallelLineColor;
  1723. m_measureStyleModel.measureParallelLine.lineWidth = m_parallelLineWidth;
  1724. m_measureStyleModel.measureParallelLine.lineStyle = m_parallelLineStyle;
  1725. Startup.instance.measureStyleModel = m_measureStyleModel;
  1726. saveLastData();
  1727. m_sqlHelper.DisConnect();
  1728. }
  1729. private void numericUpDown1_ValueChanged(object sender, EventArgs e)
  1730. {
  1731. this.decnum = (int)numericUpDown1.Value;
  1732. this.UpdateMeasureDecimalPlaces((int)numericUpDown1.Value);
  1733. this.RefreshDgvResult();
  1734. this.GetDataAndAvg();
  1735. }
  1736. /// <summary>
  1737. /// 更新小数位数
  1738. /// </summary>
  1739. /// <param name="decimalPlaces"></param>
  1740. public void UpdateMeasureDecimalPlaces(int praDecimalPlaces)
  1741. {
  1742. MeasureDrawObject.decimalPlaces = praDecimalPlaces;
  1743. this.m_documentWorkspace.Refresh();
  1744. }
  1745. /// <summary>
  1746. /// 全部显示
  1747. /// </summary>
  1748. /// <param name="sender"></param>
  1749. /// <param name="e"></param>
  1750. private void btnAllShow_Click(object sender, EventArgs e)
  1751. {
  1752. m_showAll = true;
  1753. this.RefreshDgvResult();
  1754. }
  1755. /// <summary>
  1756. /// 删除测量结果
  1757. /// </summary>
  1758. /// <param name="sender"></param>
  1759. /// <param name="e"></param>
  1760. private void btnResultDel_Click(object sender, EventArgs e)
  1761. {
  1762. if (this.lstResult.SelectedItems != null && this.lstResult.SelectedItems.Count > 0)
  1763. {
  1764. DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Determineallmeasurementsimage.Text")+"?", PdnResources.GetString("Menu.alert.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
  1765. if (dr == DialogResult.OK)
  1766. {
  1767. foreach (ListViewItem item in this.lstResult.Items)
  1768. {
  1769. if (item.Selected)
  1770. {
  1771. this.lstResult.Items.Remove(item);
  1772. this.m_measureResults.RemoveAll(u => u.Tag == item.Name.ToString());
  1773. if (bitDic.ContainsKey(item.Name.ToString()))
  1774. {
  1775. bitDic[item.Name.ToString()].Clear();
  1776. }
  1777. }
  1778. }
  1779. RefreshDgvResult();
  1780. }
  1781. }
  1782. }
  1783. private void RefreshDgvResult()
  1784. {
  1785. dgvResult.Rows.Clear();
  1786. if (m_showAll)
  1787. {
  1788. for (int i = 0; i < m_measureResults.Count; i++)
  1789. {
  1790. MeasureLengthResult aResult = m_measureResults[i];
  1791. dgvResult.Rows.Add(aResult.Tag, aResult.GraphName, aResult.LevelName, AnalysisTools.GetDecNum(aResult.MeasureAvg, decnum));
  1792. }
  1793. }
  1794. else
  1795. {
  1796. if (this.lstResult.SelectedItems != null && this.lstResult.SelectedItems.Count > 0)
  1797. {
  1798. for (int i = 0; i < this.lstResult.SelectedItems.Count; i++)
  1799. {
  1800. string tag = this.lstResult.SelectedItems[i].Name.ToString();
  1801. List<MeasureLengthResult> findResults = m_measureResults.FindAll(item => item.Tag.Equals(tag));
  1802. for (int j = 0; j < findResults.Count; j++)
  1803. {
  1804. MeasureLengthResult aResult = findResults[j];
  1805. dgvResult.Rows.Add(aResult.Tag, aResult.GraphName, aResult.LevelName, AnalysisTools.GetDecNum(aResult.MeasureAvg, decnum));
  1806. }
  1807. }
  1808. }
  1809. }
  1810. }
  1811. /// <summary>
  1812. /// 保存测量结果
  1813. /// </summary>
  1814. /// <param name="sender"></param>
  1815. /// <param name="e"></param>
  1816. private void btnSave_Click(object sender, EventArgs e)
  1817. {
  1818. if (!m_isMeasure)
  1819. {
  1820. MessageBox.Show(PdnResources.GetString("Menu.tyetmeasured.Text"));
  1821. return;
  1822. }
  1823. if (lstPic.SelectedItems.Count == 0)
  1824. {
  1825. MessageBox.Show(PdnResources.GetString("Menu.selectthepictureyoanttomeasure.Text"));
  1826. return;
  1827. }
  1828. // 重新计算一下
  1829. this.GetDataAndAvg();
  1830. if (lstPic.FocusedItem != null && this.lstPic.SelectedItems.Count > 0)
  1831. {
  1832. string imgName = this.appWorkspace.DocumentWorkspaces[this.lstPic.FocusedItem.Index].GetFriendlyName();
  1833. string tag = this.imageList1.Images.Keys[this.lstPic.SelectedItems[0].Index];
  1834. if (m_measureResults.FindAll(item => item.Tag.Equals(tag)).Count == 0)
  1835. {
  1836. ListViewItem listViewItem = new ListViewItem();
  1837. listViewItem.Name = tag;
  1838. listViewItem.SubItems[0].Text = imgName;
  1839. this.lstResult.Items.Add(listViewItem);
  1840. this.lstResult.SelectedItems.Clear();
  1841. this.lstResult.Items[this.lstResult.Items.Count - 1].Selected = true;
  1842. MeasureLengthResult aResult = m_measureCurrent;
  1843. aResult.Tag = tag;
  1844. dgvResult.Rows.Add(tag, aResult.GraphName, aResult.LevelName, AnalysisTools.GetDecNum(aResult.MeasureAvg, decnum));
  1845. m_measureResults.Add(aResult);
  1846. }
  1847. else
  1848. {
  1849. DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Theanalysisreertoreplaceit.text") + "?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
  1850. if (dr == DialogResult.Cancel)
  1851. {
  1852. return;
  1853. }
  1854. m_measureCurrent.Tag = tag;
  1855. m_measureResults.RemoveAll(u => u.Tag == tag);
  1856. m_measureResults.Add(m_measureCurrent);
  1857. dgvResult.Rows.Clear();
  1858. for (int i = 0; i < m_measureResults.Count; i++)
  1859. {
  1860. MeasureLengthResult aResult = m_measureResults[i];
  1861. dgvResult.Rows.Add(aResult.Tag, aResult.GraphName, aResult.LevelName, AnalysisTools.GetDecNum(aResult.MeasureAvg, decnum));
  1862. }
  1863. }
  1864. //保存处理后的图片
  1865. double pantographRatio = (double)this.appWorkspace.DocumentWorkspaces[this.lstPic.FocusedItem.Index].GetRulerMultiple(MeasurementUnit.Micron);//标尺*放大倍数
  1866. List<Bitmap> tempBit = new List<Bitmap>();
  1867. //Bitmap originalBit = this.appWorkspace.DocumentWorkspaces[this.lstPic.FocusedItem.Index].CompositionSurface.CreateAliasedBitmap();
  1868. m_originalBit.Tag = pantographRatio;
  1869. tempBit.Add(m_originalBit);
  1870. Bitmap newBit = m_originalBit.Clone(new Rectangle(0, 0, m_originalBit.Width, m_originalBit.Height), m_originalBit.PixelFormat);
  1871. Graphics graphics = Graphics.FromImage(newBit);
  1872. Draw(graphics);
  1873. newBit.Tag = pantographRatio;
  1874. tempBit.Add(newBit);
  1875. if (bitDic.ContainsKey(tag))
  1876. {
  1877. bitDic[tag].Clear();
  1878. bitDic[tag] = tempBit;
  1879. }
  1880. else
  1881. {
  1882. bitDic.Add(tag, tempBit);
  1883. }
  1884. //拼接中间数据
  1885. List<List<string>> dataList = new List<List<string>>();
  1886. List<string> columnName = new List<string>();
  1887. columnName.Add(PdnResources.GetString("Menu.Imagement.Measurementlist.ordernumber.text"));
  1888. columnName.Add(PdnResources.GetString("Menu.hectuallength.Text"));
  1889. dataList.Add(columnName);
  1890. int count = this.m_documentWorkspace.GraphicsList.Count;
  1891. int no = 0;
  1892. for (int i = 0; i < count; i++)
  1893. {
  1894. if (this.m_documentWorkspace.GraphicsList[i].objectType == DrawClass.Measure)
  1895. {
  1896. Dictionary<System.Enum, object> data = ((MeasureDrawObject)this.m_documentWorkspace.GraphicsList[i]).GetData();
  1897. foreach (var keys in data)
  1898. {
  1899. object v;
  1900. InvariantData.measureAttributes.TryGetValue((MeasureAttributes)keys.Key, out v);
  1901. if (((MeasureAttributes)keys.Key).ToString() == "PhysicalLength")
  1902. {
  1903. double length = double.Parse(keys.Value.ToString());
  1904. if (length > 0)
  1905. {
  1906. no++;
  1907. List<string> strList = new List<string>();
  1908. strList.Add(no.ToString());
  1909. strList.Add(length.ToString());
  1910. dataList.Add(strList);
  1911. }
  1912. }
  1913. }
  1914. }
  1915. }
  1916. bool isExist = false;//是否已存在进行替换
  1917. int modelIndex = -1;//要替换的下标
  1918. for (int j = 0; j < tempDataModel.Count; j++)
  1919. {
  1920. if (tempDataModel[j].tagName.Equals(tag))
  1921. {
  1922. isExist = true;
  1923. modelIndex = j;
  1924. break;
  1925. }
  1926. }
  1927. if (isExist && modelIndex > -1)
  1928. tempDataModel[modelIndex].dataList = dataList;
  1929. else
  1930. {
  1931. ExportProjectModel newModel = new ExportProjectModel();
  1932. newModel.tagName = tag;
  1933. newModel.picName = imgName;
  1934. newModel.dataList = dataList;
  1935. tempDataModel.Add(newModel);
  1936. }
  1937. //if (m_measureCurrent.LevelName.Equals(""))
  1938. //{
  1939. // MessageBox.Show(PdnResources.GetString("Menu.tnocorrespondinglevel.Text"));
  1940. //}
  1941. //else
  1942. //{
  1943. // MessageBox.Show(PdnResources.GetString("Menu.Successfullysaved.text"));
  1944. //}
  1945. }
  1946. }
  1947. private void Draw(Graphics graphics)
  1948. {
  1949. if (this.m_documentWorkspace.GraphicsList.Count > 0)
  1950. {
  1951. this.m_documentWorkspace.GraphicsList.Draw(graphics);
  1952. }
  1953. if (this.m_documentWorkspace.phaseModels.Count > 0)
  1954. {
  1955. foreach (PhaseModel model in this.m_documentWorkspace.phaseModels)
  1956. {
  1957. if (model.choise && model.mat != null)
  1958. {
  1959. Bitmap map = OpenCvSharp.Extensions.BitmapConverter.ToBitmap(model.mat);
  1960. graphics.DrawImage(map, 0, 0, map.Width, map.Height);
  1961. }
  1962. }
  1963. }
  1964. }
  1965. private void NewGraphicsListClear()
  1966. {
  1967. if (this.m_documentWorkspace != null && this.m_documentWorkspace.GraphicsList.Count > 0)
  1968. {
  1969. this.m_documentWorkspace.GraphicsList.Clear();
  1970. this.m_documentWorkspace.Refresh();
  1971. //List<DrawObject> drawList = this.m_documentWorkspace.GraphicsList.GetDrawClassList(DrawClass.Measure);
  1972. //List<DrawObject> lstInfo = drawList.FindAll(delegate (DrawObject lst) { return !m_oldDrawList.Contains(lst); });
  1973. //lstInfo.ForEach(i => this.m_documentWorkspace.GraphicsList.RemoveObj(i));
  1974. }
  1975. }
  1976. private void lstResult_SelectedIndexChanged(object sender, EventArgs e)
  1977. {
  1978. this.m_showAll = false;
  1979. this.RefreshDgvResult();
  1980. }
  1981. /// <summary>
  1982. /// 生成报告
  1983. /// </summary>
  1984. /// <param name="sender"></param>
  1985. /// <param name="e"></param>
  1986. private void btnCreate_Click(object sender, EventArgs e)
  1987. {
  1988. if(this.dgvResult.Rows.Count <= 0)
  1989. {
  1990. MessageBox.Show(PdnResources.GetString("Menu.nodata.text"));
  1991. return;
  1992. }
  1993. if (chkOpenSetting.Checked)
  1994. {
  1995. OpenSettingDialog();
  1996. }
  1997. bitList.Clear();
  1998. if (this.analyzeSettingModel != null && !string.IsNullOrEmpty(this.analyzeSettingModel.analyzeClassify))
  1999. {
  2000. //获取word书签与excel单元格的关系,以字典方式存储
  2001. List<mic_module_infos> mic_module_infos = mic_module_infos_BLL.FindAll().FindAll(a => a.analyze_classify == this.analyzeSettingModel.analyzeClassify);
  2002. Dictionary<string, string> tagInfos = new Dictionary<string, string>();
  2003. if (mic_module_infos != null && mic_module_infos.Count > 0)
  2004. {
  2005. foreach (mic_module_infos info in mic_module_infos)
  2006. {
  2007. tagInfos.Add(info.tag_name, info.cell_position);
  2008. }
  2009. }
  2010. List<List<string>> analysisContent = new List<List<string>>();
  2011. for (int i = 0; i < this.dgvResult.Rows.Count; i++)
  2012. {
  2013. List<string> content1 = new List<string>();
  2014. if (i == 0)
  2015. {
  2016. content1.Add(this.dgvResult.Columns[1].HeaderText);
  2017. content1.Add(this.dgvResult.Columns[2].HeaderText);
  2018. content1.Add(this.dgvResult.Columns[3].HeaderText);
  2019. analysisContent.Add(content1);
  2020. }
  2021. content1 = new List<string>();
  2022. content1.Add(this.dgvResult.Rows[i].Cells[1].Value.ToString());
  2023. content1.Add(this.dgvResult.Rows[i].Cells[2].Value.ToString());
  2024. content1.Add(this.dgvResult.Rows[i].Cells[3].Value.ToString());
  2025. analysisContent.Add(content1);
  2026. //图片
  2027. string tag = this.dgvResult.Rows[i].Cells[0].Value.ToString();
  2028. if (bitDic.ContainsKey(tag))
  2029. {
  2030. bitList.Add(bitDic[tag][0]);
  2031. bitList.Add(bitDic[tag][1]);
  2032. }
  2033. }
  2034. appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, bitList, tagInfos);
  2035. }
  2036. else
  2037. {
  2038. MessageBox.Show(PdnResources.GetString("Menu.Pleasesetiirst.Text")+"!");
  2039. }
  2040. }
  2041. /// <summary>
  2042. /// 导出结果
  2043. /// </summary>
  2044. /// <param name="sender"></param>
  2045. /// <param name="e"></param>
  2046. private void btnExport_Click(object sender, EventArgs e)
  2047. {
  2048. if (this.dgvResult.Rows.Count > 0)
  2049. {
  2050. SaveFileDialog exe = new SaveFileDialog();
  2051. exe.Filter = "Execl files (*.xlsx)|*.xlsx";
  2052. exe.FilterIndex = 0;
  2053. exe.RestoreDirectory = true;
  2054. exe.Title = "Export Excel File";
  2055. exe.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
  2056. exe.FileName = PdnResources.GetString("Menu.Speciasurveyresultsoflengthsurvey.Text") + DateTime.Now.ToString("yyyyMMddhhmmss");
  2057. DialogResult dr = exe.ShowDialog();
  2058. if (dr == DialogResult.OK)
  2059. {
  2060. DataTable dtb = new DataTable();
  2061. for(int i = 1; i< this.dgvResult.Columns.Count; i++)
  2062. {
  2063. dtb.Columns.Add(this.dgvResult.Columns[i].HeaderText);
  2064. }
  2065. for (int r = 0; r < this.dgvResult.Rows.Count; r++)
  2066. {
  2067. DataRow dataRow = dtb.NewRow();
  2068. for (int c = 1; c < this.dgvResult.Rows[r].Cells.Count; c++)
  2069. {
  2070. dataRow[this.dgvResult.Columns[c].HeaderText] = this.dgvResult.Rows[r].Cells[c].Value;
  2071. }
  2072. dtb.Rows.Add(dataRow);
  2073. }
  2074. List<DataTable> list = new List<DataTable>();
  2075. list.Add(dtb);
  2076. this.appWorkspace.ExportDataToExcelWithProgress(list, exe.FileName, true, false, true);
  2077. }
  2078. }
  2079. else
  2080. {
  2081. MessageBox.Show(PdnResources.GetString("Menu.Noanalysisresults.text")+"!");
  2082. }
  2083. }
  2084. private void nudStraightLineWidth_ValueChanged(object sender, EventArgs e)
  2085. {
  2086. m_measureStyleModel.measureLine.lineWidth = (int)nudStraightLineWidth.Value;
  2087. m_documentWorkspace.Refresh();
  2088. }
  2089. private void cmbStraightLine_SelectedIndexChanged(object sender, EventArgs e)
  2090. {
  2091. m_measureStyleModel.measureLine.lineStyle = cmbStraightLine.SelectedIndex;
  2092. m_documentWorkspace.Refresh();
  2093. }
  2094. private void pnlStraightLineColor_BackColorChanged(object sender, EventArgs e)
  2095. {
  2096. m_measureStyleModel.measureLine.lineColor = pnlStraightLineColor.BackColor.ToArgb();
  2097. m_documentWorkspace.Refresh();
  2098. }
  2099. private void nudLengthLineWidth_ValueChanged(object sender, EventArgs e)
  2100. {
  2101. m_measureStyleModel.measureLength.lineWidth = (int)nudLengthLineWidth.Value;
  2102. m_documentWorkspace.Refresh();
  2103. }
  2104. private void cmbLengthLine_SelectedIndexChanged(object sender, EventArgs e)
  2105. {
  2106. m_measureStyleModel.measureLength.lineStyle = cmbLengthLine.SelectedIndex;
  2107. m_documentWorkspace.Refresh();
  2108. }
  2109. private void pnlLengthLineColor_BackColorChanged(object sender, EventArgs e)
  2110. {
  2111. m_measureStyleModel.measureLength.lineColor = pnlLengthLineColor.BackColor.ToArgb();
  2112. m_documentWorkspace.Refresh();
  2113. }
  2114. private void nudParallelLineWidth_ValueChanged(object sender, EventArgs e)
  2115. {
  2116. m_measureStyleModel.measureParallelLine.lineWidth = (int)nudParallelLineWidth.Value;
  2117. m_documentWorkspace.Refresh();
  2118. }
  2119. private void pnlParallelLineColor_BackColorChanged(object sender, EventArgs e)
  2120. {
  2121. m_measureStyleModel.measureParallelLine.lineColor = pnlParallelLineColor.BackColor.ToArgb();
  2122. m_documentWorkspace.Refresh();
  2123. }
  2124. private void cmbParallelLine_SelectedIndexChanged(object sender, EventArgs e)
  2125. {
  2126. m_measureStyleModel.measureParallelLine.lineStyle = cmbParallelLine.SelectedIndex;
  2127. m_documentWorkspace.Refresh();
  2128. }
  2129. /// <summary>
  2130. /// 导出项目
  2131. /// </summary>
  2132. /// <param name="sender"></param>
  2133. /// <param name="e"></param>
  2134. private void btnExportProject_Click(object sender, EventArgs e)
  2135. {
  2136. try
  2137. {
  2138. if (this.analyzeSettingModel == null)
  2139. {
  2140. MessageBox.Show(PdnResources.GetString("Menu.Settheexporteitemfirst.Text"));
  2141. return;
  2142. }
  2143. //获取项目工程内的文件夹路径
  2144. ProjectEngineering.NodeItem item = this.appWorkspace.GetInsertProjectPath(2, "Menu.GeneralAnalysis.SpecialMeasure.Text", this.analyzeSettingModel.savePath);
  2145. bitList.Clear();
  2146. if (item != null)
  2147. {
  2148. //向文件夹内保存图片和报告
  2149. if (!string.IsNullOrEmpty(this.analyzeSettingModel.analyzeClassify))
  2150. {
  2151. //获取word书签与excel单元格的关系,以字典方式存储
  2152. List<mic_module_infos> mic_module_infos = mic_module_infos_BLL.FindAll().FindAll(a => a.analyze_classify == this.analyzeSettingModel.analyzeClassify);
  2153. Dictionary<string, string> tagInfos = new Dictionary<string, string>();
  2154. if (mic_module_infos != null && mic_module_infos.Count > 0)
  2155. {
  2156. foreach (mic_module_infos info in mic_module_infos)
  2157. {
  2158. tagInfos.Add(info.tag_name, info.cell_position);
  2159. }
  2160. }
  2161. List<ExportProjectModel> dataModel = new List<ExportProjectModel>();
  2162. List<List<string>> analysisContent = new List<List<string>>();
  2163. for (int i = 0; i < this.dgvResult.Rows.Count; i++)
  2164. {
  2165. List<string> content1 = new List<string>();
  2166. if (i == 0)
  2167. {
  2168. content1.Add(this.dgvResult.Columns[1].HeaderText);
  2169. content1.Add(this.dgvResult.Columns[2].HeaderText);
  2170. content1.Add(this.dgvResult.Columns[3].HeaderText);
  2171. analysisContent.Add(content1);
  2172. }
  2173. content1 = new List<string>();
  2174. content1.Add(this.dgvResult.Rows[i].Cells[1].Value.ToString());
  2175. content1.Add(this.dgvResult.Rows[i].Cells[2].Value.ToString());
  2176. content1.Add(this.dgvResult.Rows[i].Cells[3].Value.ToString());
  2177. analysisContent.Add(content1);
  2178. //图片
  2179. string tag = this.dgvResult.Rows[i].Cells[0].Value.ToString();
  2180. if (bitDic.ContainsKey(tag))
  2181. {
  2182. bitList.Add(bitDic[tag][0]);
  2183. bitList.Add(bitDic[tag][1]);
  2184. }
  2185. // 中间数据
  2186. foreach(ExportProjectModel data in tempDataModel)
  2187. {
  2188. if (data.tagName.Equals(tag))
  2189. {
  2190. dataModel.Add(data);
  2191. }
  2192. }
  2193. }
  2194. this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, dataModel, bitList, tagInfos, item.path, item.code);
  2195. }
  2196. else
  2197. {
  2198. MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text")+"!");
  2199. return;
  2200. }
  2201. //保存项目信息到数据库
  2202. this.appWorkspace.InsertIntoDB(this.analyzeSettingModel, item);
  2203. }
  2204. }
  2205. catch (Exception)
  2206. {
  2207. }
  2208. }
  2209. /// <summary>
  2210. /// 获取上次操作参数
  2211. /// </summary>
  2212. private void getLastData()
  2213. {
  2214. string filePath = Application.StartupPath + "\\Config\\Default\\ParameterSaving\\ParameterGeneralAnalysis.xml";
  2215. if (!System.IO.File.Exists(filePath))
  2216. {
  2217. generalAnalysisModel = new GeneralAnalysisModel();
  2218. generalAnalysisModel.PolyphaseMutiAreaContentModels = new GeneralAnalysisModel.PolyphaseMutiAreaContentModel();
  2219. generalAnalysisModel.PolyphaseCounterAnalysisModels = new GeneralAnalysisModel.PolyphaseCounterAnalysisModel();
  2220. generalAnalysisModel.TwoPhaseScaleModels = new GeneralAnalysisModel.TwoPhaseScaleModel();
  2221. generalAnalysisModel.PolyphaseContentModels = new GeneralAnalysisModel.PolyphaseContentModel();
  2222. generalAnalysisModel.PolyphaseDistanceModels = new GeneralAnalysisModel.PolyphaseDistanceModel();
  2223. generalAnalysisModel.DebrisSelectionModels = new GeneralAnalysisModel.DebrisSelectionModel();
  2224. generalAnalysisModel.CountNumberAnalysisModels = new GeneralAnalysisModel.CountNumberAnalysisModel();
  2225. generalAnalysisModel.PolyphaseMutiAreaContentModels.hasUsed = false;
  2226. generalAnalysisModel.PolyphaseCounterAnalysisModels.hasUsed = false;
  2227. generalAnalysisModel.TwoPhaseScaleModels.hasUsed = false;
  2228. generalAnalysisModel.PolyphaseContentModels.hasUsed = false;
  2229. generalAnalysisModel.PolyphaseDistanceModels.hasUsed = false;
  2230. generalAnalysisModel.DebrisSelectionModels.hasUsed = false;
  2231. generalAnalysisModel.CountNumberAnalysisModels.hasUsed = false;
  2232. string porosityInfoXml = XmlSerializeHelper.XmlSerialize<GeneralAnalysisModel>(generalAnalysisModel);
  2233. Directory.CreateDirectory(Application.StartupPath + "\\Config\\Default\\ParameterSaving\\");
  2234. FileOperationHelper.WriteStringToFile(porosityInfoXml, filePath, FileMode.CreateNew);
  2235. }
  2236. else
  2237. {
  2238. generalAnalysisModel = XmlSerializeHelper.DESerializer<GeneralAnalysisModel>(FileOperationHelper.ReadStringFromFile(filePath, FileMode.Open));
  2239. if (generalAnalysisModel.SpecialMeasureLengthModels == null)
  2240. {
  2241. generalAnalysisModel.SpecialMeasureLengthModels = new GeneralAnalysisModel.SpecialMeasureLengthModel();
  2242. }
  2243. if (generalAnalysisModel.SpecialMeasureLengthModels.hasUsed)
  2244. {
  2245. if (cmbSpecial.Items.Count >= (generalAnalysisModel.SpecialMeasureLengthModels.parameter1 - 1))
  2246. {
  2247. cmbSpecial.SelectedIndex = generalAnalysisModel.SpecialMeasureLengthModels.parameter1;
  2248. }
  2249. else
  2250. {
  2251. cmbSpecial.SelectedIndex = 0;
  2252. }
  2253. pnlStraightLineColor.BackColor = Color.FromArgb(generalAnalysisModel.SpecialMeasureLengthModels.parameter2);
  2254. nudStraightLineWidth.Value = generalAnalysisModel.SpecialMeasureLengthModels.parameter3;
  2255. cmbStraightLine.SelectedIndex = generalAnalysisModel.SpecialMeasureLengthModels.parameter4;
  2256. pnlLengthLineColor.BackColor = Color.FromArgb(generalAnalysisModel.SpecialMeasureLengthModels.parameter5);
  2257. nudLengthLineWidth.Value = generalAnalysisModel.SpecialMeasureLengthModels.parameter6;
  2258. cmbLengthLine.SelectedIndex = generalAnalysisModel.SpecialMeasureLengthModels.parameter7;
  2259. pnlParallelLineColor.BackColor = Color.FromArgb(generalAnalysisModel.SpecialMeasureLengthModels.parameter8);
  2260. nudParallelLineWidth.Value = generalAnalysisModel.SpecialMeasureLengthModels.parameter9;
  2261. cmbParallelLine.SelectedIndex = generalAnalysisModel.SpecialMeasureLengthModels.parameter10;
  2262. chkOpenSetting.Checked = generalAnalysisModel.SpecialMeasureLengthModels.parameter11;
  2263. numericUpDown1.Value = generalAnalysisModel.SpecialMeasureLengthModels.parameter12;
  2264. }
  2265. }
  2266. }
  2267. /// <summary>
  2268. /// 保存上次操作参数
  2269. /// </summary>
  2270. private void saveLastData()
  2271. {
  2272. if (generalAnalysisModel.SpecialMeasureLengthModels == null)
  2273. {
  2274. generalAnalysisModel.SpecialMeasureLengthModels = new GeneralAnalysisModel.SpecialMeasureLengthModel();
  2275. }
  2276. generalAnalysisModel.SpecialMeasureLengthModels.hasUsed = true;
  2277. generalAnalysisModel.SpecialMeasureLengthModels.parameter1 = cmbSpecial.SelectedIndex;
  2278. generalAnalysisModel.SpecialMeasureLengthModels.parameter2 = pnlStraightLineColor.BackColor.ToArgb();
  2279. generalAnalysisModel.SpecialMeasureLengthModels.parameter3 = (int)nudStraightLineWidth.Value;
  2280. generalAnalysisModel.SpecialMeasureLengthModels.parameter4 = cmbStraightLine.SelectedIndex;
  2281. generalAnalysisModel.SpecialMeasureLengthModels.parameter5 = pnlLengthLineColor.BackColor.ToArgb();
  2282. generalAnalysisModel.SpecialMeasureLengthModels.parameter6 = (int)nudLengthLineWidth.Value;
  2283. generalAnalysisModel.SpecialMeasureLengthModels.parameter7 = cmbLengthLine.SelectedIndex;
  2284. generalAnalysisModel.SpecialMeasureLengthModels.parameter8 = pnlParallelLineColor.BackColor.ToArgb();
  2285. generalAnalysisModel.SpecialMeasureLengthModels.parameter9 = (int)nudParallelLineWidth.Value;
  2286. generalAnalysisModel.SpecialMeasureLengthModels.parameter10 = cmbParallelLine.SelectedIndex;
  2287. generalAnalysisModel.SpecialMeasureLengthModels.parameter11 = chkOpenSetting.Checked;
  2288. generalAnalysisModel.SpecialMeasureLengthModels.parameter12 = (int)numericUpDown1.Value;
  2289. string filePath = Application.StartupPath + "\\Config\\Default\\ParameterSaving\\ParameterGeneralAnalysis.xml";
  2290. string porosityInfoXml = XmlSerializeHelper.XmlSerialize<GeneralAnalysisModel>(generalAnalysisModel);
  2291. FileOperationHelper.WriteStringToFile(porosityInfoXml, filePath, FileMode.Create);
  2292. }
  2293. }
  2294. }