CountNumberAnalysisDialog.cs 157 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364
  1. using Microsoft.Win32;
  2. using PaintDotNet.Annotation;
  3. using PaintDotNet.Annotation.Enum;
  4. using PaintDotNet.Annotation.Label;
  5. using PaintDotNet.Base.CommTool;
  6. using PaintDotNet.Base.SettingModel;
  7. using PaintDotNet.CustomControl;
  8. using PaintDotNet.GeneralAnalysis.AnalysisResultTemplate;
  9. using System;
  10. using System.Collections.Generic;
  11. using System.ComponentModel;
  12. using System.Data;
  13. using System.Drawing;
  14. using System.IO;
  15. using System.Linq;
  16. using System.Text;
  17. using System.Threading.Tasks;
  18. using System.Windows.Forms;
  19. using static PaintDotNet.Base.SettingModel.LabelStyleModel;
  20. using SaveFileDialog = System.Windows.Forms.SaveFileDialog;
  21. using PaintDotNet.DbOpreate.DbBll;
  22. using PaintDotNet.DbOpreate.DbModel;
  23. using PaintDotNet.Base.Functionodel;
  24. using OpenCvSharp;
  25. using Point = System.Drawing.Point;
  26. using PaintDotNet.Instrument;
  27. using OpenCvSharp.Extensions;
  28. using static PaintDotNet.Base.DedicatedAnalysis.Inclusions.MethodOfAssessment;
  29. using System.Collections;
  30. using Metis.ParameterSet;
  31. using PaintDotNet.Data.Param;
  32. using PaintDotNet.Base;
  33. namespace PaintDotNet.GeneralAnalysis
  34. {
  35. /// <summary>
  36. /// 计数统计
  37. /// </summary>
  38. internal class CountNumberAnalysisDialog : PdnBaseForm
  39. {
  40. #region 控件
  41. private System.Windows.Forms.GroupBox groupBox4;
  42. private System.Windows.Forms.ListView listView1;
  43. private System.Windows.Forms.GroupBox groupBox1;
  44. private System.Windows.Forms.Button button2;
  45. private System.Windows.Forms.CheckBox checkBox1;
  46. private System.Windows.Forms.Button button1;
  47. private System.Windows.Forms.GroupBox groupBox2;
  48. private System.Windows.Forms.GroupBox groupBox_review;
  49. private System.Windows.Forms.GroupBox groupBox5;
  50. private System.Windows.Forms.GroupBox groupBox6;
  51. private System.Windows.Forms.GroupBox groupBox7;
  52. private System.Windows.Forms.Label label1;
  53. private System.Windows.Forms.Button button4;
  54. private System.Windows.Forms.Button button3;
  55. private System.Windows.Forms.ImageList imageList1;
  56. private GroupBox groupBox3;
  57. private DataGridView dataGridView_results;
  58. private Button button5;
  59. private GroupBox groupBox8;
  60. private DataGridView dataGridView1;
  61. private Label label2;
  62. private RadioButton rb_LeftSquare;
  63. private RadioButton rb_LeftCircle;
  64. private Label label5;
  65. private TextBox txt_LeftSize;
  66. private Label label4;
  67. private TextBox txt_LeftLineWeight;
  68. private Label label6;
  69. private Label label7;
  70. private TextBox txt_RightLineWeight;
  71. private Label label8;
  72. private TextBox txt_RightSize;
  73. private Label label9;
  74. private RadioButton rb_RightSquare;
  75. private RadioButton rb_RightCircle;
  76. private Label label11;
  77. private GroupBox groupBox9;
  78. private RadioButton rb_RightFill;
  79. private GroupBox groupBox10;
  80. private RadioButton rb_leftNoFill;
  81. private RadioButton rb_leftFill;
  82. private Panel panel2;
  83. private Panel panel1;
  84. private Button But_DelPhase;
  85. private Button but_AddPhase;
  86. private Button but_Clear;
  87. private NumericUpDown numericUpDown1;
  88. private Label label3;
  89. private Label label10;
  90. private IContainer components;
  91. #endregion
  92. /// <summary>
  93. /// 选中图片的mat
  94. /// </summary>
  95. private Mat imageMat;
  96. private Dictionary<int, DocumentItem> documentItems;
  97. /// <summary>
  98. /// 选中图片的bitmap
  99. /// </summary>
  100. private Bitmap workmap;
  101. /// <summary>
  102. /// 是否全部显示
  103. /// </summary>
  104. private bool allShow = false;
  105. /// <summary>
  106. /// 主空间
  107. /// </summary>
  108. private AppWorkspace appWorkspace;
  109. /// <summary>
  110. /// 中间数据
  111. /// </summary>
  112. private List<ExportProjectModel> tempDataModel = new List<ExportProjectModel>();
  113. /// <summary>
  114. /// 图像面板
  115. /// </summary>
  116. private DocumentWorkspaceWindow documentWorkspace;
  117. private DrawAnalysisModel leftStyle, rightStyle;
  118. private int leftNumber, rightNumber;
  119. private List<CounterNumberResult> activeResults;
  120. private List<CounterNumberResult> allResults;
  121. private List<CounterNumberResult> finalViewResults;
  122. private int selectIndex;
  123. private bool isFirstClick = true;
  124. private bool isDoubleClick = false;
  125. private int milliseconds = 0;
  126. private Timer clickTimer;
  127. private ColorsForm colorsFormGrid;
  128. private ColorsForm halfColorsFormGrid;
  129. /// <summary>
  130. /// 1 面积 2 面积比 3
  131. /// </summary>
  132. private int workType = 0;
  133. private int decnum = 2;
  134. BindingSource bindingSource = new BindingSource();
  135. private GeneralAnalysisCommonControlButtons commonControlButtons;
  136. /// <summary>
  137. /// 书签分类名
  138. /// </summary>
  139. private string analyzeClassify;
  140. private List<Bitmap> bitList = new List<Bitmap>();
  141. private Button button6;
  142. private DataGridViewTextBoxColumn Column5;
  143. private DataGridViewTextBoxColumn Column1;
  144. private DataGridViewTextBoxColumn Column8;
  145. private DataGridViewTextBoxColumn Column9;
  146. private DataGridViewTextBoxColumn Column10;
  147. private DataGridViewTextBoxColumn Column11;
  148. private ListView listView2;
  149. private Button button16;
  150. private Button button11;
  151. private Button button12;
  152. private NumericUpDown numericUpDown3;
  153. private NumericUpDown numericUpDown2;
  154. private NumericUpDown numericUpDown5;
  155. private NumericUpDown numericUpDown4;
  156. private Dictionary<string, List<Bitmap>> bitDic = new Dictionary<string, List<Bitmap>>();
  157. private Dictionary<string, List<Bitmap>> bitDic1 = new Dictionary<string, List<Bitmap>>();
  158. /// <summary>
  159. /// 所有截点
  160. /// </summary>
  161. public List<List<RectangleF>> p1RectangleFs = new List<List<RectangleF>>();
  162. public List<List<RectangleF>> p2RectangleFs = new List<List<RectangleF>>();
  163. private DataGridViewTextBoxColumn Column2;
  164. private DataGridViewTextBoxColumn Column3;
  165. private DataGridViewTextBoxColumn Column4;
  166. private DataGridViewTextBoxColumn Column6;
  167. private DataGridViewTextBoxColumn Column7;
  168. private int mutuallyIndex = 1;
  169. private int defaultIndex = -1;
  170. private RadioButton rb_RightNoFill;
  171. private GeneralAnalysisModel generalAnalysisModel = new GeneralAnalysisModel();
  172. private Dictionary<string, GeneralAnalysisModel.CountNumberAnalysisModel> everyImgData = new Dictionary<string, GeneralAnalysisModel.CountNumberAnalysisModel>();
  173. private string selectedImg = string.Empty;
  174. private int menuId;
  175. private string menuName;
  176. /// <summary>
  177. /// 是否脚本运行
  178. /// </summary>
  179. private Boolean initScriptValues = false;
  180. public CountNumberAnalysisDialog()
  181. {
  182. InitializeComponent();
  183. }
  184. public CountNumberAnalysisDialog(AppWorkspace appWorkspace, PdnMenuItem menuItem)
  185. {
  186. InitializeComponent();
  187. InitializeLanguageText();
  188. this.colorsFormGrid = new ColorsForm();
  189. this.colorsFormGrid.StartPosition = FormStartPosition.CenterScreen;
  190. this.menuId = menuItem.MenuId;
  191. this.menuName = menuItem.Text;
  192. this.halfColorsFormGrid = new ColorsForm();
  193. this.halfColorsFormGrid.StartPosition = FormStartPosition.CenterScreen;
  194. this.appWorkspace = appWorkspace;
  195. this.documentWorkspace = new DocumentWorkspaceWindow(appWorkspace);
  196. this.documentWorkspace.Dock = DockStyle.Fill;
  197. this.documentWorkspace.HookMouseEvents();
  198. this.documentWorkspace.AuxiliaryLineEnabled = false;
  199. this.documentWorkspace.Visible = false;
  200. this.groupBox_review.Controls.Add(this.documentWorkspace);
  201. this.commonControlButtons = new GeneralAnalysisCommonControlButtons();
  202. this.commonControlButtons.Dock = DockStyle.Top;
  203. this.commonControlButtons.Height = 30;
  204. this.commonControlButtons.HideZoomToWindowAndActualSize();
  205. this.commonControlButtons.trackLabel.Text = PdnResources.GetString("Menu.1point:clicktelete:doubleclick.text");
  206. this.commonControlButtons.trackLabel.Visible = true;
  207. this.commonControlButtons.trackLabel.Width = 300;
  208. this.groupBox_review.Controls.Add(commonControlButtons);
  209. Graphics g = this.documentWorkspace.panel.CreateGraphics();
  210. this.documentWorkspace.panel.MouseDown += Panel_MouseDown;
  211. InitPicList();
  212. //BindingResults();
  213. this.listView1.SelectedIndexChanged += new EventHandler(this.ListViewSelectedIndexChanged);
  214. SetStyle(ControlStyles.UserPaint, true);
  215. SetStyle(ControlStyles.AllPaintingInWmPaint, true); // 禁止擦除背景.
  216. SetStyle(ControlStyles.DoubleBuffer, true); // 双缓冲
  217. //初始化头
  218. this.listView2.View = View.Details;
  219. ColumnHeader header0 = new ColumnHeader();
  220. header0.Text = "";
  221. header0.Width = 191;
  222. this.listView2.Columns.Add(header0);
  223. dataGridView1.SelectionChanged += DataGridView1_SelectionChanged;
  224. SetAnalyzeModelFromXml("Template.Manager.item2.CountNumberAnalysis");
  225. allResults = new List<CounterNumberResult>();
  226. activeResults = new List<CounterNumberResult>();
  227. finalViewResults = new List<CounterNumberResult>();
  228. this.button11.Visible = true;
  229. this.button16.Visible = false;
  230. InitCommonButtonEvent();
  231. this.documentWorkspace.panel.Paint += Panel_Paint;
  232. for (int i = 0; i < this.dataGridView1.Columns.Count; i++)
  233. {
  234. this.dataGridView1.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;
  235. }
  236. for (int i = 0; i < this.dataGridView_results.Columns.Count; i++)
  237. {
  238. this.dataGridView_results.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;
  239. }
  240. this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.saveLastData);
  241. }
  242. #region 公共按钮
  243. private void InitCommonButtonEvent()
  244. {
  245. this.commonControlButtons.zoomInButton.Click += new EventHandler(zoomInButton_Click);
  246. this.commonControlButtons.zoomOutButton.Click += new EventHandler(zoomOutButton_Click);
  247. this.commonControlButtons.zoomToWindowButton.Click += new EventHandler(zoomToWindowButton_Click);
  248. this.commonControlButtons.actualSizeButton.Click += new EventHandler(actualSizeButton_Click);
  249. this.commonControlButtons.pointerButton.Click += new EventHandler(pointerButton_Click);
  250. this.commonControlButtons.mobileModeButton.Click += new EventHandler(mobileModeButton_Click);
  251. }
  252. private void zoomInButton_Click(object sender, EventArgs e)
  253. {
  254. if(this.imageMat != null)
  255. this.documentWorkspace.ZoomIn();
  256. }
  257. private void zoomOutButton_Click(object sender, EventArgs e)
  258. {
  259. if (this.imageMat != null)
  260. this.documentWorkspace.ZoomOut();
  261. }
  262. private void zoomToWindowButton_Click(object sender, EventArgs e)
  263. {
  264. this.documentWorkspace.ZoomBasis = ZoomBasis.FitToWindow;
  265. }
  266. private void actualSizeButton_Click(object sender, EventArgs e)
  267. {
  268. this.documentWorkspace.ZoomBasis = ZoomBasis.ScaleFactor;
  269. this.documentWorkspace.ScaleFactor = ScaleFactor.OneToOne;
  270. }
  271. private void pointerButton_Click(object sender, EventArgs e)
  272. {
  273. this.documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.Pointer;
  274. }
  275. private void mobileModeButton_Click(object sender, EventArgs e)
  276. {
  277. this.documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.MoveMode;
  278. }
  279. #endregion
  280. private void Init()
  281. {
  282. this.activeResults.Clear();
  283. this.documentWorkspace.GraphicsList.Clear();
  284. this.p1RectangleFs.Clear();
  285. this.p2RectangleFs.Clear();
  286. //this.documentWorkspace.phaseModels.RemoveAll(u=>u.)
  287. }
  288. private void ShowImgEvent(object sender, EventArgs e)
  289. {
  290. listView1.Focus();
  291. if (this.defaultIndex != -1)
  292. {
  293. this.listView1.Items[defaultIndex].Focused = true;
  294. this.listView1.Items[defaultIndex].Selected = true;
  295. //如果是脚本执行,将参数带入
  296. if (appWorkspace.ScriptRunning && appWorkspace.ScriptCurrentParam != null)
  297. {
  298. this.initScriptValues = true;//ScriptAutomatic
  299. //Boolean initScriptValues = true;
  300. ////在这里反射出对应功能的参数类
  301. string className = InvariantData.path_Action + ".Action" + menuId;
  302. ParamObject param = (ParamObject)System.Reflection.Assembly.Load(InvariantData.assembly_Data).CreateInstance(className);
  303. foreach (Args arg in param.Lists)
  304. {
  305. Args param1 = appWorkspace.ScriptCurrentParam.Lists.Find(m => m.Key.Equals(arg.Key));
  306. if (param1.value != null)
  307. arg.Value = param1.value;
  308. getValue(arg.key, arg.Value);
  309. }
  310. appWorkspace.ScriptCurrentParam = null;//阻止第二次进入仍然被赋值参数
  311. }
  312. else
  313. {//读取上次关闭窗口时保存的参数
  314. getLastData();
  315. }
  316. }
  317. }
  318. /// <summary>
  319. /// 获取上次操作参数
  320. /// </summary>
  321. private void getLastData()
  322. {
  323. string filePath = Application.StartupPath + "\\Config\\Default\\ParameterSaving\\ParameterGeneralAnalysis.xml";
  324. if (!System.IO.File.Exists(filePath))
  325. {
  326. generalAnalysisModel = new GeneralAnalysisModel();
  327. generalAnalysisModel.PolyphaseMutiAreaContentModels = new GeneralAnalysisModel.PolyphaseMutiAreaContentModel();
  328. generalAnalysisModel.PolyphaseCounterAnalysisModels = new GeneralAnalysisModel.PolyphaseCounterAnalysisModel();
  329. generalAnalysisModel.TwoPhaseScaleModels = new GeneralAnalysisModel.TwoPhaseScaleModel();
  330. generalAnalysisModel.PolyphaseContentModels = new GeneralAnalysisModel.PolyphaseContentModel();
  331. generalAnalysisModel.PolyphaseDistanceModels = new GeneralAnalysisModel.PolyphaseDistanceModel();
  332. generalAnalysisModel.DebrisSelectionModels = new GeneralAnalysisModel.DebrisSelectionModel();
  333. generalAnalysisModel.CountNumberAnalysisModels = new GeneralAnalysisModel.CountNumberAnalysisModel();
  334. generalAnalysisModel.PolyphaseMutiAreaContentModels.hasUsed = false;
  335. generalAnalysisModel.PolyphaseCounterAnalysisModels.hasUsed = false;
  336. generalAnalysisModel.TwoPhaseScaleModels.hasUsed = false;
  337. generalAnalysisModel.PolyphaseContentModels.hasUsed = false;
  338. generalAnalysisModel.PolyphaseDistanceModels.hasUsed = false;
  339. generalAnalysisModel.DebrisSelectionModels.hasUsed = false;
  340. generalAnalysisModel.CountNumberAnalysisModels.hasUsed = false;
  341. string porosityInfoXml = XmlSerializeHelper.XmlSerialize<GeneralAnalysisModel>(generalAnalysisModel);
  342. Directory.CreateDirectory(Application.StartupPath + "\\Config\\Default\\ParameterSaving\\");
  343. FileOperationHelper.WriteStringToFile(porosityInfoXml, filePath, FileMode.CreateNew);
  344. }
  345. else
  346. {
  347. generalAnalysisModel = XmlSerializeHelper.DESerializer<GeneralAnalysisModel>(FileOperationHelper.ReadStringFromFile(filePath, FileMode.Open));
  348. if (generalAnalysisModel.CountNumberAnalysisModels == null) {
  349. generalAnalysisModel.CountNumberAnalysisModels = new GeneralAnalysisModel.CountNumberAnalysisModel();
  350. }
  351. if (generalAnalysisModel.CountNumberAnalysisModels.hasUsed)
  352. {
  353. rb_LeftCircle.Checked = generalAnalysisModel.CountNumberAnalysisModels.parameter1 == 1 ? true : false;
  354. rb_LeftSquare.Checked = generalAnalysisModel.CountNumberAnalysisModels.parameter1 == 1 ? false : true;
  355. rb_leftFill.Checked = generalAnalysisModel.CountNumberAnalysisModels.parameter2 == 1 ? true : false;
  356. rb_leftNoFill.Checked = generalAnalysisModel.CountNumberAnalysisModels.parameter2 == 1 ? false : true;
  357. numericUpDown2.Value = generalAnalysisModel.CountNumberAnalysisModels.parameter3;
  358. numericUpDown3.Value = generalAnalysisModel.CountNumberAnalysisModels.parameter4;
  359. panel1.BackColor = Color.FromArgb(generalAnalysisModel.CountNumberAnalysisModels.parameter5);
  360. rb_RightCircle.Checked = generalAnalysisModel.CountNumberAnalysisModels.parameter6 == 1 ? true : false;
  361. rb_RightSquare.Checked = generalAnalysisModel.CountNumberAnalysisModels.parameter6 == 1 ? false : true;
  362. rb_RightFill.Checked = generalAnalysisModel.CountNumberAnalysisModels.parameter7 == 1 ? true : false;
  363. rb_RightNoFill.Checked = generalAnalysisModel.CountNumberAnalysisModels.parameter7 == 1 ? false : true;
  364. numericUpDown4.Value = generalAnalysisModel.CountNumberAnalysisModels.parameter8;
  365. numericUpDown5.Value = generalAnalysisModel.CountNumberAnalysisModels.parameter9;
  366. panel2.BackColor = Color.FromArgb(generalAnalysisModel.CountNumberAnalysisModels.parameter10);
  367. numericUpDown1.Value = generalAnalysisModel.CountNumberAnalysisModels.parameter11;
  368. checkBox1.Checked = generalAnalysisModel.CountNumberAnalysisModels.parameter12;
  369. for (int i = 0; i < listView1.Items.Count; i++)
  370. {
  371. if (everyImgData.ContainsKey(listView1.Items[i].Name))
  372. {
  373. everyImgData[listView1.Items[i].Name] = generalAnalysisModel.CountNumberAnalysisModels;
  374. }
  375. else
  376. {
  377. everyImgData.Add(listView1.Items[i].Name, generalAnalysisModel.CountNumberAnalysisModels);
  378. }
  379. }
  380. }
  381. }
  382. }
  383. /// <summary>
  384. /// 保存上次操作参数
  385. /// </summary>
  386. private void saveLastData(object sender, EventArgs e)
  387. {
  388. #region [开启脚本录制]
  389. if (appWorkspace.startScriptRecording)
  390. {
  391. getScriptRecording();
  392. }
  393. #endregion
  394. if (generalAnalysisModel.CountNumberAnalysisModels == null)
  395. {
  396. generalAnalysisModel.CountNumberAnalysisModels = new GeneralAnalysisModel.CountNumberAnalysisModel();
  397. }
  398. generalAnalysisModel.CountNumberAnalysisModels.hasUsed = true;
  399. if (rb_LeftCircle.Checked)
  400. {
  401. generalAnalysisModel.CountNumberAnalysisModels.parameter1 = 1;
  402. }
  403. else if (rb_LeftSquare.Checked)
  404. {
  405. generalAnalysisModel.CountNumberAnalysisModels.parameter1 = 2;
  406. }
  407. else
  408. {
  409. generalAnalysisModel.CountNumberAnalysisModels.parameter1 = 3;
  410. }
  411. if (rb_leftFill.Checked)
  412. {
  413. generalAnalysisModel.CountNumberAnalysisModels.parameter2 = 1;
  414. }
  415. else if (rb_leftNoFill.Checked)
  416. {
  417. generalAnalysisModel.CountNumberAnalysisModels.parameter2 = 2;
  418. }
  419. else
  420. {
  421. generalAnalysisModel.CountNumberAnalysisModels.parameter2 = 3;
  422. }
  423. if (rb_RightCircle.Checked)
  424. {
  425. generalAnalysisModel.CountNumberAnalysisModels.parameter6 = 1;
  426. }
  427. else if (rb_RightSquare.Checked)
  428. {
  429. generalAnalysisModel.CountNumberAnalysisModels.parameter6 = 2;
  430. }
  431. else
  432. {
  433. generalAnalysisModel.CountNumberAnalysisModels.parameter6 = 3;
  434. }
  435. if (rb_RightFill.Checked)
  436. {
  437. generalAnalysisModel.CountNumberAnalysisModels.parameter7 = 1;
  438. }
  439. else if (rb_RightNoFill.Checked)
  440. {
  441. generalAnalysisModel.CountNumberAnalysisModels.parameter7 = 2;
  442. }
  443. else
  444. {
  445. generalAnalysisModel.CountNumberAnalysisModels.parameter7 = 3;
  446. }
  447. generalAnalysisModel.CountNumberAnalysisModels.parameter3 = (int)numericUpDown2.Value;
  448. generalAnalysisModel.CountNumberAnalysisModels.parameter4 = (int)numericUpDown3.Value;
  449. generalAnalysisModel.CountNumberAnalysisModels.parameter5 = panel1.BackColor.ToArgb();
  450. generalAnalysisModel.CountNumberAnalysisModels.parameter8 = (int)numericUpDown4.Value;
  451. generalAnalysisModel.CountNumberAnalysisModels.parameter9 = (int)numericUpDown5.Value;
  452. generalAnalysisModel.CountNumberAnalysisModels.parameter10 = panel2.BackColor.ToArgb();
  453. generalAnalysisModel.CountNumberAnalysisModels.parameter11 = (int)numericUpDown1.Value;
  454. generalAnalysisModel.CountNumberAnalysisModels.parameter12 = checkBox1.Checked;
  455. string filePath = Application.StartupPath + "\\Config\\Default\\ParameterSaving\\ParameterGeneralAnalysis.xml";
  456. string porosityInfoXml = XmlSerializeHelper.XmlSerialize<GeneralAnalysisModel>(generalAnalysisModel);
  457. FileOperationHelper.WriteStringToFile(porosityInfoXml, filePath, FileMode.Create);
  458. }
  459. private void Panel_MouseDown(object sender, MouseEventArgs e)
  460. {
  461. if (dataGridView1.CurrentRow == null)
  462. {
  463. MessageBox.Show(PdnResources.GetString("Menu.seselectthephaseIfnotaddphasefirs.Text"));
  464. return;
  465. }
  466. // 换算后的点
  467. PointF point1 = documentWorkspace.GetScalePoint(e.Location);
  468. bool canAdd1 = true;
  469. bool canAdd2 = true;
  470. if (p2RectangleFs.Count > 0)
  471. {
  472. foreach (var rectangleF in p2RectangleFs[this.dataGridView1.SelectedRows[0].Index])
  473. {
  474. if (rectangleF.Contains(point1))
  475. {
  476. canAdd1 = false;
  477. if (e.Button == MouseButtons.Left && e.Clicks == 2)
  478. {
  479. p2RectangleFs[this.dataGridView1.SelectedRows[0].Index].Remove(rectangleF);
  480. break;
  481. }
  482. }
  483. }
  484. }
  485. if (p1RectangleFs.Count > 0)
  486. {
  487. foreach (var rectangleF in p1RectangleFs[this.dataGridView1.SelectedRows[0].Index])
  488. {
  489. if (rectangleF.Contains(point1))
  490. {
  491. canAdd2 = false;
  492. if (e.Button == MouseButtons.Left && e.Clicks == 2)
  493. {
  494. p1RectangleFs[this.dataGridView1.SelectedRows[0].Index].Remove(rectangleF);
  495. break;
  496. }
  497. }
  498. }
  499. }
  500. if (e.Button == MouseButtons.Left)
  501. {
  502. if (canAdd1 && canAdd2)
  503. {
  504. p1RectangleFs[this.dataGridView1.SelectedRows[0].Index].Add(new RectangleF(point1.X - Convert.ToInt32(txt_LeftSize.Text) / 2
  505. , point1.Y - Convert.ToInt32(txt_LeftSize.Text) / 2, Convert.ToInt32(txt_LeftSize.Text), Convert.ToInt32(txt_LeftSize.Text)));
  506. }
  507. }
  508. if (e.Button == MouseButtons.Right)
  509. {
  510. if (canAdd1 && canAdd2)
  511. {
  512. p2RectangleFs[this.dataGridView1.SelectedRows[0].Index].Add(new RectangleF(point1.X - Convert.ToInt32(txt_RightSize.Text) / 2
  513. , point1.Y - Convert.ToInt32(txt_RightSize.Text) / 2, Convert.ToInt32(txt_RightSize.Text), Convert.ToInt32(txt_RightSize.Text)));
  514. }
  515. }
  516. double count = 0;
  517. if (this.p1RectangleFs.Count > 0)
  518. {
  519. this.dataGridView1.Rows[this.dataGridView1.SelectedRows[0].Index].Cells[1].Value = p1RectangleFs[this.dataGridView1.SelectedRows[0].Index].Count;
  520. count += p1RectangleFs[this.dataGridView1.SelectedRows[0].Index].Count;
  521. }
  522. else
  523. this.dataGridView1.Rows[this.dataGridView1.SelectedRows[0].Index].Cells[1].Value = 0;
  524. if (this.p2RectangleFs.Count > 0)
  525. {
  526. this.dataGridView1.Rows[this.dataGridView1.SelectedRows[0].Index].Cells[2].Value = p2RectangleFs[this.dataGridView1.SelectedRows[0].Index].Count;
  527. count += Convert.ToDouble(p2RectangleFs[this.dataGridView1.SelectedRows[0].Index].Count) / 2;
  528. }
  529. else
  530. this.dataGridView1.Rows[this.dataGridView1.SelectedRows[0].Index].Cells[2].Value = 0;
  531. double allCount = 0;
  532. foreach (var item in p1RectangleFs)
  533. {
  534. allCount += item.Count;
  535. }
  536. foreach (var item in p2RectangleFs)
  537. {
  538. allCount += Convert.ToDouble(item.Count) / 2;
  539. }
  540. this.dataGridView1.Rows[this.dataGridView1.SelectedRows[0].Index].Cells[3].Value = Math.Round(count, Convert.ToInt32(this.numericUpDown1.Value));
  541. for (int i = 0; i < this.dataGridView1.Rows.Count; i++)
  542. {
  543. double percentage = 0;
  544. if (Convert.ToInt32(this.dataGridView1.Rows[i].Cells[3].Value) > 0)
  545. {
  546. percentage = Convert.ToDouble((Convert.ToInt32(this.dataGridView1.Rows[i].Cells[1].Value)
  547. + Convert.ToDouble(Convert.ToInt32(this.dataGridView1.Rows[i].Cells[2].Value) * 0.5))
  548. / allCount) * 100;
  549. }
  550. this.dataGridView1.Rows[i].Cells[4].Value = Math.Round(percentage, Convert.ToInt32(this.numericUpDown1.Value));
  551. }
  552. this.documentWorkspace.Refresh();
  553. }
  554. private void DataGridView1_SelectionChanged(object sender, EventArgs e)
  555. {
  556. this.documentWorkspace.Refresh();
  557. }
  558. private void updateResults()
  559. {
  560. dataGridView1.Rows.Clear();
  561. AddTwoRow();
  562. for (int i = 0; i < activeResults.Count; i++)
  563. {
  564. activeResults[i].OneNumber = activeResults[i].LeftObjectIds.Count;
  565. activeResults[i].HalfNumber = activeResults[i].RightObjectIds.Count;
  566. activeResults[i].AllNumber = activeResults[i].OneNumber + (Single)activeResults[i].HalfNumber/2;
  567. }
  568. for (int j=0;j<activeResults.Count;j++)
  569. {
  570. if (activeResults.Sum(a => a.AllNumber) > 0)
  571. {
  572. activeResults[j].RateFromAll = (Single)activeResults[j].AllNumber / activeResults.Sum(a => a.AllNumber);
  573. }else
  574. {
  575. activeResults[j].RateFromAll = 0;
  576. }
  577. dataGridView1.Rows.Add(activeResults[j].PhaseName, activeResults[j].OneNumber, activeResults[j].HalfNumber, AnalysisTools.GetDecNum(activeResults[j].AllNumber,decnum), AnalysisTools.GetDecNum(activeResults[j].RateFromAll,decnum));
  578. }
  579. if (dataGridView1.Rows.Count > 0)
  580. {
  581. dataGridView1.Rows[selectIndex].Selected = true;
  582. dataGridView1.CurrentCell = this.dataGridView1.Rows[selectIndex].Cells[0];
  583. }
  584. }
  585. public void InitPicList()
  586. {
  587. this.documentItems = new Dictionary<int, DocumentItem>();
  588. // 构造工作结构
  589. for (int i = 0; i < this.appWorkspace.DocumentWorkspaces.Length; i++)
  590. {
  591. GraphicsList graphicsList = new GraphicsList();
  592. for (int j = 0; j < this.appWorkspace.DocumentWorkspaces[i].GraphicsList.Count; j++)
  593. {
  594. graphicsList.Add(this.appWorkspace.DocumentWorkspaces[i].GraphicsList[j]);
  595. }
  596. List<PhaseModel> phaseModels = new List<PhaseModel>();
  597. //二值化相关
  598. PhaseModel analysisModel = this.appWorkspace.DocumentWorkspaces[i].AnalysisPhaseModel;
  599. if (analysisModel == null)
  600. {
  601. }
  602. else
  603. phaseModels.Add(analysisModel);
  604. this.documentItems.Add(i, new DocumentItem(graphicsList, phaseModels));
  605. }
  606. //初始化图片列表
  607. for (int i = 0; i < this.appWorkspace.DocumentWorkspaces.Length; i++)
  608. {
  609. this.imageList1.Images.Add("img" + i, this.appWorkspace.DocumentWorkspaces[i].BinarizationThumbnail);
  610. this.listView1.Items.Add("", i);
  611. this.listView1.Items[i].ImageIndex = i;
  612. this.listView1.Items[i].Text = this.appWorkspace.DocumentWorkspaces[i].GetFriendlyName();
  613. this.listView1.Items[i].Name = this.appWorkspace.DocumentWorkspaces[i].GetFriendlyName();
  614. if (this.appWorkspace.DocumentWorkspaces[i].Equals(this.appWorkspace.ActiveDocumentWorkspace))
  615. {
  616. defaultIndex = i;
  617. }
  618. }
  619. this.Shown += ShowImgEvent;
  620. }
  621. internal class DocumentItem
  622. {
  623. public GraphicsList graphicsList;
  624. public List<PhaseModel> phaseModels;
  625. public AnalysisResult analysisResult;
  626. public DocumentItem(GraphicsList graphicsList, List<PhaseModel> phaseModels)
  627. {
  628. this.graphicsList = graphicsList;
  629. this.phaseModels = phaseModels;
  630. }
  631. }
  632. private void rb_LeftSquare_CheckedChanged(object sender, EventArgs e)
  633. {
  634. this.documentWorkspace.Refresh();
  635. }
  636. private void rb_RightSquare_CheckedChanged(object sender, EventArgs e)
  637. {
  638. this.documentWorkspace.Refresh();
  639. }
  640. private void rb_leftFill_CheckedChanged(object sender, EventArgs e)
  641. {
  642. this.documentWorkspace.Refresh();
  643. }
  644. private void rb_RightFill_CheckedChanged(object sender, EventArgs e)
  645. {
  646. this.documentWorkspace.Refresh();
  647. }
  648. private void rb_RightNoFill_CheckedChanged(object sender, EventArgs e)
  649. {
  650. this.documentWorkspace.Refresh();
  651. }
  652. private void rb_leftNoFill_CheckedChanged(object sender, EventArgs e)
  653. {
  654. this.documentWorkspace.Refresh();
  655. }
  656. private void panel1_Click(object sender, EventArgs e)
  657. {
  658. this.colorsFormGrid.UserPrimaryColor = ColorBgra.FromColor(this.panel1.BackColor);
  659. this.colorsFormGrid.setSaveBtn_Click(new System.EventHandler(this.gridColorChanged));
  660. this.colorsFormGrid.ShowDialog();
  661. }
  662. /// <summary>
  663. /// Panel2的调色板颜色改变
  664. /// </summary>
  665. /// <param name="sender"></param>
  666. /// <param name="e"></param>
  667. private void gridColorChanged(object sender, EventArgs e)
  668. {
  669. Color color = this.colorsFormGrid.UserPrimaryColor.ToColor();
  670. //更改背景色,触发事件
  671. this.panel1.BackColor = color;
  672. //改变配置文件里面的相颜色
  673. //this.binaryExtractionModel.PhaseColor = color.ToArgb();
  674. //关闭色板
  675. this.documentWorkspace.Refresh();
  676. this.colorsFormGrid.Close();
  677. }
  678. private void panel2_Click(object sender, EventArgs e)
  679. {
  680. this.halfColorsFormGrid.UserPrimaryColor = ColorBgra.FromColor(this.panel2.BackColor);
  681. this.halfColorsFormGrid.setSaveBtn_Click(new System.EventHandler(this.gridColor2Changed));
  682. this.halfColorsFormGrid.ShowDialog();
  683. }
  684. /// <summary>
  685. /// Panel2的调色板颜色改变
  686. /// </summary>
  687. /// <param name="sender"></param>
  688. /// <param name="e"></param>
  689. private void gridColor2Changed(object sender, EventArgs e)
  690. {
  691. Color color = this.halfColorsFormGrid.UserPrimaryColor.ToColor();
  692. //更改背景色,触发事件
  693. this.panel2.BackColor = color;
  694. //改变配置文件里面的相颜色
  695. this.documentWorkspace.Refresh();
  696. this.halfColorsFormGrid.Close();
  697. }
  698. private void rb_LeftCircle_CheckedChanged(object sender, EventArgs e)
  699. {
  700. this.documentWorkspace.Refresh();
  701. }
  702. private void rb_RightCircle_CheckedChanged(object sender, EventArgs e)
  703. {
  704. this.documentWorkspace.Refresh();
  705. }
  706. private void txt_LeftSize_TextChanged(object sender, EventArgs e)
  707. {
  708. this.documentWorkspace.Refresh();
  709. }
  710. private void txt_LeftLineWeight_TextChanged(object sender, EventArgs e)
  711. {
  712. this.documentWorkspace.Refresh();
  713. }
  714. private void txt_RightSize_TextChanged(object sender, EventArgs e)
  715. {
  716. this.documentWorkspace.Refresh();
  717. }
  718. private void txt_RightLineWeight_TextChanged(object sender, EventArgs e)
  719. {
  720. this.documentWorkspace.Refresh();
  721. }
  722. private void button5_Click(object sender, EventArgs e)
  723. {
  724. this.documentWorkspace.GraphicsList.Clear();
  725. this.documentWorkspace.Refresh();
  726. this.Close();
  727. }
  728. /// <summary>
  729. /// 图片测量记录
  730. /// </summary>
  731. private List<DataTable> pictureDataTables = new List<DataTable>();
  732. private void button2_Click(object sender, EventArgs e)
  733. {
  734. if (dataGridView1.Rows.Count == 0)
  735. {
  736. MessageBox.Show(PdnResources.GetString("Menu.Pleaseaddaphoto.text"));
  737. return;
  738. }
  739. this.listView2.SelectedItems.Clear();
  740. string imgName = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetFriendlyName();
  741. string tag = this.imageList1.Images.Keys[this.listView1.SelectedItems[0].Index];
  742. if (listView1.SelectedItems.Count > 0)
  743. {
  744. DataTable dataTable1 = new DataTable();
  745. bool replace = false;
  746. int add = 0;
  747. foreach (ListViewItem item in this.listView2.Items)
  748. {
  749. if (item.Tag.Equals(tag))
  750. {
  751. add++;
  752. DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Themeasurementdertoreplace.text")+"?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
  753. if (dr == DialogResult.OK)
  754. {
  755. replace = true;
  756. this.listView2.Items.Remove(item);
  757. }
  758. break;
  759. }
  760. }
  761. double allCount = 0;
  762. foreach (var item in p1RectangleFs)
  763. {
  764. allCount += item.Count;
  765. }
  766. foreach (var item in p2RectangleFs)
  767. {
  768. allCount += Convert.ToDouble(item.Count) / 2;
  769. }
  770. if (replace || this.listView2.Items.Count == 0 || add == 0)
  771. {
  772. ListViewItem listViewItem = new ListViewItem();
  773. listViewItem.SubItems[0].Text = imgName;
  774. listViewItem.Tag = tag;
  775. if (this.listView2.Items.Count == 0)
  776. this.listView2.Items.Add(listViewItem);
  777. else
  778. this.listView2.Items.Insert(0, listViewItem);
  779. dataTable1.TableName = tag;
  780. this.dataGridView_results.Rows.Clear();
  781. foreach (DataGridViewRow Row in this.dataGridView1.Rows)
  782. {
  783. DataGridViewRow dgvr = new DataGridViewRow();
  784. dgvr.Tag = tag;
  785. foreach (DataGridViewColumn Column in this.dataGridView_results.Columns)
  786. {
  787. dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
  788. }
  789. dgvr.Cells[0].Value = imgName;
  790. dgvr.Cells[1].Value = Row.Cells[0].Value;
  791. dgvr.Cells[2].Value = Row.Cells[1].Value;
  792. dgvr.Cells[3].Value = Row.Cells[2].Value;
  793. dgvr.Cells[4].Value = Row.Cells[3].Value;
  794. dgvr.Cells[5].Value = Row.Cells[4].Value;
  795. this.dataGridView_results.Rows.Add(dgvr);
  796. }
  797. foreach (DataTable dataTable2 in pictureDataTables)
  798. {
  799. if (dataTable2.TableName.Equals(dataTable1.TableName))
  800. {
  801. pictureDataTables.Remove(dataTable2);
  802. break;
  803. }
  804. }
  805. foreach (DataGridViewColumn c in this.dataGridView_results.Columns)
  806. {
  807. dataTable1.Columns.Add(c.HeaderText);
  808. }
  809. for (int r = 0; r < this.dataGridView1.Rows.Count; r++)
  810. {
  811. double count = 0;
  812. if (this.p1RectangleFs.Count > 0)
  813. {
  814. count += p1RectangleFs[r].Count;
  815. }
  816. if (this.p2RectangleFs.Count > 0)
  817. {
  818. count += Convert.ToDouble(p2RectangleFs[r].Count) / 2;
  819. }
  820. DataRow dataRow = dataTable1.NewRow();
  821. for (int c = 0; c < this.dataGridView1.Rows[r].Cells.Count + 1; c++)
  822. {
  823. if (c == 0)
  824. dataRow[this.dataGridView_results.Columns[0].HeaderText] = imgName;
  825. else
  826. {
  827. if (c == this.dataGridView1.Rows[r].Cells.Count)
  828. {
  829. double percentage = 0;
  830. if (Convert.ToInt32(this.dataGridView1.Rows[r].Cells[4].Value) > 0)
  831. {
  832. percentage = Convert.ToDouble((Convert.ToInt32(this.dataGridView1.Rows[r].Cells[1].Value)
  833. + Convert.ToDouble(Convert.ToInt32(this.dataGridView1.Rows[r].Cells[2].Value) * 0.5))
  834. / allCount) * 100;
  835. }
  836. dataRow[this.dataGridView_results.Columns[c].HeaderText] = percentage;
  837. }
  838. else if (c == this.dataGridView1.Rows[r].Cells.Count - 1)
  839. dataRow[this.dataGridView_results.Columns[c].HeaderText] = count;
  840. else
  841. dataRow[this.dataGridView_results.Columns[c].HeaderText] = this.dataGridView1.Rows[r].Cells[c - 1].Value;
  842. }
  843. }
  844. dataTable1.Rows.Add(dataRow);
  845. }
  846. this.pictureDataTables.Add(dataTable1);
  847. if (this.allShow)
  848. AllShow();
  849. this.listView2.Items[0].Selected = true;
  850. this.bitDic.Clear();
  851. foreach (var item in this.bitDic1)
  852. {
  853. this.bitDic.Add(item.Key, item.Value);
  854. }
  855. //拼接中间数据
  856. List<List<string>> dataList = new List<List<string>>();
  857. List<string> columnName = new List<string>();
  858. columnName.Add(PdnResources.GetString("Menu.Imagement.Measurementlist.ordernumber.text"));
  859. foreach (DataGridViewColumn Column in this.dataGridView_results.Columns)
  860. {
  861. columnName.Add(Column.HeaderText);
  862. }
  863. dataList.Add(columnName);
  864. for (int r = 0; r < this.dataGridView1.Rows.Count; r++)
  865. {
  866. double count = 0;
  867. if (this.p1RectangleFs.Count > 0)
  868. {
  869. count += p1RectangleFs[r].Count;
  870. }
  871. if (this.p2RectangleFs.Count > 0)
  872. {
  873. count += Convert.ToDouble(p2RectangleFs[r].Count) / 2;
  874. }
  875. List<string> strList = new List<string>();
  876. strList.Add((r + 1).ToString());
  877. for (int c = 0; c < this.dataGridView1.Rows[r].Cells.Count + 1; c++)
  878. {
  879. if (c == 0)
  880. strList.Add(imgName);
  881. else
  882. {
  883. if (c == this.dataGridView1.Rows[r].Cells.Count)
  884. {
  885. double percentage = 0;
  886. if (!this.dataGridView1.Rows[r].Cells[4].Value.ToString().Equals("0"))
  887. {
  888. percentage = Convert.ToDouble((Convert.ToDouble(this.dataGridView1.Rows[r].Cells[2].Value)
  889. + Convert.ToDouble(Convert.ToDouble(this.dataGridView1.Rows[r].Cells[3].Value) * 0.5))
  890. / allCount) * 100;
  891. }
  892. strList.Add(percentage.ToString());
  893. }
  894. else if (c == this.dataGridView1.Rows[r].Cells.Count - 1)
  895. strList.Add(count.ToString());
  896. else
  897. strList.Add(this.dataGridView1.Rows[r].Cells[c - 1].Value.ToString());
  898. }
  899. }
  900. dataList.Add(strList);
  901. }
  902. bool isExist = false;//是否已存在进行替换
  903. int modelIndex = -1;//要替换的下标
  904. for (int j = 0; j < tempDataModel.Count; j++)
  905. {
  906. if (tempDataModel[j].tagName.Equals(tag))
  907. {
  908. isExist = true;
  909. modelIndex = j;
  910. break;
  911. }
  912. }
  913. if (isExist && modelIndex > -1)
  914. tempDataModel[modelIndex].dataList = dataList;
  915. else
  916. {
  917. ExportProjectModel newModel = new ExportProjectModel();
  918. newModel.tagName = tag;
  919. newModel.picName = imgName;
  920. newModel.dataList = dataList;
  921. tempDataModel.Add(newModel);
  922. }
  923. }
  924. }
  925. else
  926. {
  927. MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectthepicturetosave.text")+"!");
  928. }
  929. }
  930. private void Draw(Graphics graphics)
  931. {
  932. if (this.p1RectangleFs.Count > 0 && this.dataGridView1.SelectedRows.Count > 0)
  933. {
  934. // 1截点
  935. foreach (var pointRectangleF in this.p1RectangleFs[this.dataGridView1.SelectedRows[0].Index])
  936. {
  937. // 绘制点
  938. PointF pointF = new PointF(pointRectangleF.X + pointRectangleF.Width / 2, pointRectangleF.Y + pointRectangleF.Height / 2);
  939. int size = Convert.ToInt32(this.txt_LeftSize.Text);
  940. // 圆形
  941. if (this.rb_LeftCircle.Checked)
  942. {
  943. // 实心
  944. if (this.rb_leftFill.Checked)
  945. graphics.FillEllipse(new SolidBrush(this.panel1.BackColor), pointF.X - (float)size / 2, pointF.Y - (float)size / 2
  946. , size, size);
  947. // 空心
  948. else
  949. graphics.DrawEllipse(new Pen(this.panel1.BackColor, Convert.ToInt32(this.txt_LeftLineWeight.Text))
  950. , pointF.X - (float)size / 2, pointF.Y - (float)size / 2, size, size);
  951. }
  952. // 方形
  953. else
  954. {
  955. // 实心
  956. if (this.rb_leftFill.Checked)
  957. graphics.FillRectangle(new SolidBrush(this.panel1.BackColor)
  958. , pointF.X - (float)size / 2, pointF.Y - (float)size / 2, size, size);
  959. // 空心
  960. else
  961. graphics.DrawRectangle(new Pen(this.panel1.BackColor, Convert.ToInt32(this.txt_LeftLineWeight.Text))
  962. , pointF.X - (float)size / 2, pointF.Y - (float)size / 2, size, size);
  963. }
  964. }
  965. }
  966. if (this.p2RectangleFs.Count > 0 && this.dataGridView1.SelectedRows.Count > 0)
  967. {
  968. // 0.5截点
  969. foreach (var pointRectangleF in this.p2RectangleFs[this.dataGridView1.SelectedRows[0].Index])
  970. {
  971. // 绘制点
  972. PointF pointF = new PointF(pointRectangleF.X + pointRectangleF.Width / 2, pointRectangleF.Y + pointRectangleF.Height / 2);
  973. int size = Convert.ToInt32(this.txt_RightSize.Text);
  974. // 圆形
  975. if (this.rb_RightCircle.Checked)
  976. {
  977. // 实心
  978. if (this.rb_RightFill.Checked)
  979. graphics.FillEllipse(new SolidBrush(this.panel2.BackColor)
  980. , pointF.X - (float)size / 2, pointF.Y - (float)size / 2, size, size);
  981. // 空心
  982. else
  983. graphics.DrawEllipse(new Pen(this.panel2.BackColor, Convert.ToInt32(this.txt_RightLineWeight.Text))
  984. , pointF.X - (float)size / 2, pointF.Y - (float)size / 2, size, size);
  985. }
  986. // 方形
  987. else
  988. {
  989. // 实心
  990. if (this.rb_RightFill.Checked)
  991. graphics.FillRectangle(new SolidBrush(this.panel2.BackColor)
  992. , pointF.X - (float)size / 2, pointF.Y - (float)size / 2, size, size);
  993. // 空心
  994. else
  995. graphics.DrawRectangle(new Pen(this.panel2.BackColor, Convert.ToInt32(this.txt_RightLineWeight.Text))
  996. , pointF.X - (float)size / 2, pointF.Y - (float)size / 2, size, size);
  997. }
  998. }
  999. }
  1000. if (this.documentWorkspace.phaseModels.Count > 0)
  1001. {
  1002. foreach (PhaseModel model in this.documentWorkspace.phaseModels)
  1003. {
  1004. if (model.choise && model.mat != null)
  1005. {
  1006. Bitmap map = OpenCvSharp.Extensions.BitmapConverter.ToBitmap(model.mat);
  1007. graphics.DrawImage(map, 0, 0, map.Width, map.Height);
  1008. }
  1009. }
  1010. }
  1011. }
  1012. private void DrawObjects(Graphics graphics,GraphicsList graphicsList)
  1013. {
  1014. if (graphicsList != null)
  1015. {
  1016. graphicsList.Draw(graphics);
  1017. }
  1018. }
  1019. private void but_Clear_Click(object sender, EventArgs e)
  1020. {
  1021. if(this.dataGridView1.Rows.Count == 0)
  1022. {
  1023. MessageBox.Show(PdnResources.GetString("Menu.Nonedata.Text") + "!");
  1024. return;
  1025. }
  1026. string tag = listView1.FocusedItem.Text + "|" + this.dataGridView1.SelectedRows[0].Cells[1].Value.ToString();
  1027. string key = tag.Substring(0, tag.IndexOf("|"));
  1028. DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Whethertocleartheresults.text")+"?", "", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
  1029. if (dr == DialogResult.OK)
  1030. {
  1031. for (int i = 0; i < bitDic1.Count; i++)
  1032. {
  1033. foreach (var item in bitDic1)
  1034. {
  1035. string keyDe = item.Key.Substring(0, item.Key.IndexOf("|"));
  1036. if (key.Equals(keyDe))
  1037. {
  1038. bitDic1.Remove(item.Key);
  1039. break;
  1040. }
  1041. }
  1042. }
  1043. this.p1RectangleFs.Clear();
  1044. this.p2RectangleFs.Clear();
  1045. dataGridView1.Rows.Clear();
  1046. mutuallyIndex = 1;
  1047. documentWorkspace.Refresh();
  1048. }
  1049. }
  1050. /// <summary>
  1051. /// 默认添加两个相
  1052. /// </summary>
  1053. private void AddTwoRow()
  1054. {
  1055. //bitDic1.Clear();多图保存生成报告只保存最后一张,所以注掉
  1056. for (int i = 0; i < 2; i++)
  1057. {
  1058. DataGridViewRow dgvr = new DataGridViewRow();
  1059. foreach (DataGridViewColumn c in this.dataGridView1.Columns)
  1060. {
  1061. dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  1062. }
  1063. dgvr.Cells[0].Value = "相" + mutuallyIndex;
  1064. dgvr.Cells[1].Value = 0;
  1065. dgvr.Cells[2].Value = 0;
  1066. dgvr.Cells[3].Value = 0;
  1067. dgvr.Cells[4].Value = 0;
  1068. this.dataGridView1.Rows.Add(dgvr);
  1069. this.p1RectangleFs.Add(new List<RectangleF>());
  1070. this.p2RectangleFs.Add(new List<RectangleF>());
  1071. string tag = this.imageList1.Images.Keys[this.listView1.SelectedItems[0].Index] + "|" + mutuallyIndex;
  1072. mutuallyIndex++;
  1073. if (this.dataGridView1.Rows.Count > 0)
  1074. this.dataGridView1.Rows[this.dataGridView1.Rows.Count - 1].Selected = true;
  1075. //保存处理后的图片
  1076. double pantographRatio = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetRulerMultiple(MeasurementUnit.Micron);//标尺*放大倍数
  1077. List<Bitmap> tempBit = new List<Bitmap>();
  1078. Bitmap originalBit = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].CompositionSurface.CreateAliasedBitmap();
  1079. originalBit.Tag = pantographRatio;
  1080. tempBit.Add(originalBit);
  1081. Graphics graphics;
  1082. Bitmap newBit;
  1083. Bitmap processedBit;
  1084. if (this.documentItems[this.listView1.FocusedItem.Index].phaseModels.Count != 0
  1085. && this.documentItems[this.listView1.FocusedItem.Index].phaseModels[0].mat != null)
  1086. {
  1087. processedBit = BitmapConverter.ToBitmap(this.documentWorkspace.PhaseModels[0].mat);
  1088. newBit = originalBit.Clone(new Rectangle(0, 0, originalBit.Width, originalBit.Height), originalBit.PixelFormat);
  1089. graphics = Graphics.FromImage(newBit);
  1090. graphics.DrawImage(processedBit, new PointF(0, 0));
  1091. Draw(graphics);
  1092. newBit.Tag = pantographRatio;
  1093. tempBit.Add(newBit);
  1094. }
  1095. else
  1096. {
  1097. newBit = originalBit.Clone(new Rectangle(0, 0, originalBit.Width, originalBit.Height), originalBit.PixelFormat);
  1098. graphics = Graphics.FromImage(newBit);
  1099. Draw(graphics);
  1100. newBit.Tag = pantographRatio;
  1101. tempBit.Add(newBit);
  1102. }
  1103. if (bitDic1.ContainsKey(tag))
  1104. bitDic1[tag] = tempBit;
  1105. else
  1106. bitDic1.Add(tag, tempBit);
  1107. }
  1108. }
  1109. private void but_AddPhase_Click(object sender, EventArgs e)
  1110. {
  1111. if(this.listView1.SelectedItems.Count == 0)
  1112. {
  1113. MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectapicturefirst.text"));
  1114. return;
  1115. }
  1116. DataGridViewRow dgvr = new DataGridViewRow();
  1117. foreach (DataGridViewColumn c in this.dataGridView1.Columns)
  1118. {
  1119. dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  1120. }
  1121. dgvr.Cells[0].Value = "相" + mutuallyIndex;
  1122. dgvr.Cells[1].Value = 0;
  1123. dgvr.Cells[2].Value = 0;
  1124. dgvr.Cells[3].Value = 0;
  1125. dgvr.Cells[4].Value = 0;
  1126. this.dataGridView1.Rows.Add(dgvr);
  1127. this.p1RectangleFs.Add(new List<RectangleF>());
  1128. this.p2RectangleFs.Add(new List<RectangleF>());
  1129. string tag = this.imageList1.Images.Keys[this.listView1.SelectedItems[0].Index] + "|" + mutuallyIndex;
  1130. mutuallyIndex++;
  1131. if (this.dataGridView1.Rows.Count > 0)
  1132. this.dataGridView1.Rows[this.dataGridView1.Rows.Count-1].Selected = true;
  1133. //保存处理后的图片
  1134. double pantographRatio = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetRulerMultiple(MeasurementUnit.Micron);//标尺*放大倍数
  1135. List<Bitmap> tempBit = new List<Bitmap>();
  1136. Bitmap originalBit = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].CompositionSurface.CreateAliasedBitmap();
  1137. originalBit.Tag = pantographRatio;
  1138. tempBit.Add(originalBit);
  1139. Graphics graphics;
  1140. Bitmap newBit;
  1141. Bitmap processedBit;
  1142. if (this.documentItems[this.listView1.FocusedItem.Index].phaseModels.Count != 0
  1143. && this.documentItems[this.listView1.FocusedItem.Index].phaseModels[0].mat != null)
  1144. {
  1145. processedBit = BitmapConverter.ToBitmap(this.documentWorkspace.PhaseModels[0].mat);
  1146. newBit = originalBit.Clone(new Rectangle(0, 0, originalBit.Width, originalBit.Height), originalBit.PixelFormat);
  1147. graphics = Graphics.FromImage(newBit);
  1148. graphics.DrawImage(processedBit, new PointF(0, 0));
  1149. Draw(graphics);
  1150. newBit.Tag = pantographRatio;
  1151. tempBit.Add(newBit);
  1152. }
  1153. else
  1154. {
  1155. newBit = originalBit.Clone(new Rectangle(0, 0, originalBit.Width, originalBit.Height), originalBit.PixelFormat);
  1156. graphics = Graphics.FromImage(newBit);
  1157. Draw(graphics);
  1158. newBit.Tag = pantographRatio;
  1159. tempBit.Add(newBit);
  1160. }
  1161. if (bitDic1.ContainsKey(tag))
  1162. bitDic1[tag] = tempBit;
  1163. else
  1164. bitDic1.Add(tag, tempBit);
  1165. }
  1166. private void But_DelPhase_Click(object sender, EventArgs e)
  1167. {
  1168. if (dataGridView1.Rows.Count == 0)
  1169. {
  1170. MessageBox.Show(PdnResources.GetString("Menu.Nophaseselectedtodelete.text")+"!");
  1171. return;
  1172. }
  1173. DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.deleteornot.text") + dataGridView1.Rows[this.dataGridView1.SelectedRows[0].Index].Cells[0].Value + PdnResources.GetString("Menu.Phaseresult.text")+" ?", PdnResources.GetString("Menu.Edit.Delete.Text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
  1174. if (dr == DialogResult.OK)
  1175. {
  1176. int selIndex = this.dataGridView1.SelectedRows[0].Index;
  1177. if (this.dataGridView1.Rows.Count > 0)
  1178. {
  1179. this.p1RectangleFs.RemoveAt(this.dataGridView1.SelectedRows[0].Index);
  1180. this.p2RectangleFs.RemoveAt(this.dataGridView1.SelectedRows[0].Index);
  1181. }
  1182. else
  1183. {
  1184. this.p1RectangleFs.RemoveAt(0);
  1185. this.p2RectangleFs.RemoveAt(0);
  1186. }
  1187. string tag = this.imageList1.Images.Keys[this.listView1.SelectedItems[0].Index] + "|" + this.dataGridView1.SelectedRows[0].Cells[0].Value.ToString().Replace("相", string.Empty);
  1188. //int num =Convert.ToInt32(tag.Substring(tag.IndexOf("|") + 1, tag.Length - tag.IndexOf("|") - 1));
  1189. if (bitDic1.ContainsKey(tag))
  1190. bitDic1.Remove(tag);
  1191. //foreach (string key in bitDic.Keys.ToArray())
  1192. //{
  1193. // int num1 = Convert.ToInt32(key.Substring(key.IndexOf("|") + 1, key.Length - key.IndexOf("|") - 1));
  1194. // if(num1 > num)
  1195. // {
  1196. // List<Bitmap> bitmaps = new List<Bitmap>();
  1197. // bitmaps = bitDic[key];
  1198. // string newKeyNum = key.Substring(key.IndexOf("|") + 1, key.Length - key.IndexOf("|") - 1);
  1199. // string newKey = key.Substring(0, key.IndexOf("|")) + "|" + (Convert.ToInt32(newKeyNum) - 1);
  1200. // bitDic.Remove(key);
  1201. // bitDic.Add(newKey, bitmaps);
  1202. // }
  1203. //}
  1204. //for (int i = 0; i < dataGridView1.Rows.Count; i++)
  1205. //{
  1206. // int num1 = Convert.ToInt32(dataGridView1.Rows[i].Cells[0].Value.ToString().Replace("相",string.Empty));
  1207. // if (num1 > num)
  1208. // {
  1209. // dataGridView1.Rows[i].Cells[0].Value = "相" + (num1 - 1);
  1210. // }
  1211. //}
  1212. this.dataGridView1.Rows.Remove(this.dataGridView1.SelectedRows[0]);
  1213. if (this.dataGridView1.Rows.Count > 0)
  1214. this.dataGridView1.Rows[this.dataGridView1.Rows.Count - 1].Selected = true;
  1215. //mutuallyIndex--;
  1216. documentWorkspace.Refresh();
  1217. }
  1218. }
  1219. private void numericUpDown1_ValueChanged(object sender, EventArgs e)
  1220. {
  1221. double allCount = 0;
  1222. foreach (var item in p1RectangleFs)
  1223. {
  1224. allCount += item.Count;
  1225. }
  1226. foreach (var item in p2RectangleFs)
  1227. {
  1228. allCount += Convert.ToDouble(item.Count) / 2;
  1229. }
  1230. for (int i = 0; i < this.dataGridView1.Rows.Count; i++)
  1231. {
  1232. double count = 0;
  1233. if (this.p1RectangleFs.Count > 0)
  1234. {
  1235. count += p1RectangleFs[i].Count;
  1236. }
  1237. if (this.p2RectangleFs.Count > 0)
  1238. {
  1239. count += Convert.ToDouble(p2RectangleFs[i].Count) / 2;
  1240. }
  1241. double percentage = 0;
  1242. if (Convert.ToInt32(this.dataGridView1.Rows[i].Cells[4].Value) > 0)
  1243. {
  1244. percentage = Convert.ToDouble((Convert.ToInt32(this.dataGridView1.Rows[i].Cells[1].Value)
  1245. + Convert.ToDouble(Convert.ToInt32(this.dataGridView1.Rows[i].Cells[2].Value) * 0.5))
  1246. / allCount) * 100;
  1247. }
  1248. this.dataGridView1.Rows[i].Cells[3].Value = Math.Round(count, Convert.ToInt32(this.numericUpDown1.Value));
  1249. this.dataGridView1.Rows[i].Cells[4].Value = Math.Round(percentage, Convert.ToInt32(this.numericUpDown1.Value));
  1250. }
  1251. RefreshDataGridView4();
  1252. }
  1253. private void groupBox10_Paint(object sender, PaintEventArgs e)
  1254. {
  1255. e.Graphics.Clear(this.BackColor);
  1256. }
  1257. private void groupBox9_Paint(object sender, PaintEventArgs e)
  1258. {
  1259. e.Graphics.Clear(this.BackColor);
  1260. }
  1261. private void button1_Click(object sender, EventArgs e)
  1262. {
  1263. AnalyzeSettingDialog recombinationRateSetDialog = new AnalyzeSettingDialog(this, "Template.Manager.item2.CountNumberAnalysis");
  1264. if (recombinationRateSetDialog.hasModule)
  1265. {
  1266. recombinationRateSetDialog.StartPosition = FormStartPosition.CenterScreen;
  1267. recombinationRateSetDialog.ShowDialog();
  1268. }
  1269. else
  1270. {
  1271. recombinationRateSetDialog = null;
  1272. }
  1273. }
  1274. private void button4_Click(object sender, EventArgs e)
  1275. {
  1276. if (this.dataGridView_results.Rows.Count > 0)
  1277. {
  1278. SaveFileDialog exe = new SaveFileDialog();
  1279. exe.Filter = "Execl files (*.xlsx)|*.xlsx";
  1280. exe.FilterIndex = 0;
  1281. exe.RestoreDirectory = true;
  1282. //exe.CreatePrompt = true;
  1283. exe.Title = "Export Excel File";
  1284. exe.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
  1285. exe.FileName = PdnResources.GetString("Menu.GeneralAnalysis.CountStatistics.Text")+ PdnResources.GetString("Menu.Analysisresult.text") + DateTime.Now.ToString("yyyyMMddhhmmss");
  1286. DialogResult dr = exe.ShowDialog();
  1287. if (dr == DialogResult.OK)
  1288. {
  1289. DataTable dtb = new DataTable();
  1290. foreach (DataGridViewColumn c in this.dataGridView_results.Columns)
  1291. {
  1292. dtb.Columns.Add(c.HeaderText);
  1293. }
  1294. for (int r = 0; r < this.dataGridView_results.Rows.Count; r++)
  1295. {
  1296. DataRow dataRow = dtb.NewRow();
  1297. for (int c = 0; c < this.dataGridView_results.Rows[r].Cells.Count; c++)
  1298. {
  1299. dataRow[this.dataGridView_results.Columns[c].HeaderText] = this.dataGridView_results.Rows[r].Cells[c].Value;
  1300. }
  1301. dtb.Rows.Add(dataRow);
  1302. }
  1303. List<DataTable> list = new List<DataTable>();
  1304. list.Add(dtb);
  1305. this.appWorkspace.ExportDataToExcelWithProgress(list, exe.FileName, true, false, true);
  1306. }
  1307. }
  1308. else
  1309. {
  1310. MessageBox.Show(PdnResources.GetString("Menu.Noanalysisresults.text")+"!");
  1311. }
  1312. }
  1313. private void button3_Click(object sender, EventArgs e)
  1314. {
  1315. if(checkBox1.Checked)
  1316. {
  1317. AnalyzeSettingDialog recombinationRateSetDialog = new AnalyzeSettingDialog(this, "Template.Manager.item2.CountNumberAnalysis");
  1318. if (recombinationRateSetDialog.hasModule)
  1319. {
  1320. recombinationRateSetDialog.StartPosition = FormStartPosition.CenterScreen;
  1321. recombinationRateSetDialog.ShowDialog();
  1322. }
  1323. else
  1324. {
  1325. recombinationRateSetDialog = null;
  1326. }
  1327. }
  1328. if (this.analyzeSettingModel != null && !string.IsNullOrEmpty(this.analyzeSettingModel.analyzeClassify))
  1329. {
  1330. //获取word书签与excel单元格的关系,以字典方式存储
  1331. List<mic_module_infos> mic_module_infos = mic_module_infos_BLL.FindAll().FindAll(a => a.analyze_classify == this.analyzeSettingModel.analyzeClassify);
  1332. Dictionary<string, string> tagInfos = new Dictionary<string, string>();
  1333. if (mic_module_infos != null && mic_module_infos.Count > 0)
  1334. {
  1335. foreach (mic_module_infos info in mic_module_infos)
  1336. {
  1337. tagInfos.Add(info.tag_name, info.cell_position);
  1338. }
  1339. }
  1340. List<List<string>> analysisContent = new List<List<string>>();
  1341. for (int i = 0; i < this.dataGridView_results.Rows.Count; i++)
  1342. {
  1343. List<string> content1 = new List<string>();
  1344. if (i == 0)
  1345. {
  1346. content1.Add(this.dataGridView_results.Columns[0].HeaderText);
  1347. content1.Add(this.dataGridView_results.Columns[1].HeaderText);
  1348. content1.Add(this.dataGridView_results.Columns[2].HeaderText);
  1349. content1.Add(this.dataGridView_results.Columns[3].HeaderText);
  1350. content1.Add(this.dataGridView_results.Columns[4].HeaderText);
  1351. content1.Add(this.dataGridView_results.Columns[5].HeaderText);
  1352. analysisContent.Add(content1);
  1353. }
  1354. content1 = new List<string>();
  1355. content1.Add(this.dataGridView_results.Rows[i].Cells[0].Value.ToString());
  1356. content1.Add(this.dataGridView_results.Rows[i].Cells[1].Value.ToString());
  1357. content1.Add(this.dataGridView_results.Rows[i].Cells[2].Value.ToString());
  1358. content1.Add(this.dataGridView_results.Rows[i].Cells[3].Value.ToString());
  1359. content1.Add(this.dataGridView_results.Rows[i].Cells[4].Value.ToString());
  1360. content1.Add(this.dataGridView_results.Rows[i].Cells[5].Value.ToString());
  1361. analysisContent.Add(content1);
  1362. }
  1363. bitList = new List<Bitmap>();
  1364. if (this.allShow)
  1365. {
  1366. foreach (KeyValuePair<string, List<Bitmap>> kv in this.bitDic)
  1367. {
  1368. bitList.Add(kv.Value[0]);
  1369. bitList.Add(kv.Value[1]);
  1370. }
  1371. }
  1372. else
  1373. {
  1374. if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)
  1375. {
  1376. foreach (DataGridViewRow itemRow in this.dataGridView_results.Rows)
  1377. {
  1378. foreach (ListViewItem item in this.listView2.SelectedItems)
  1379. {
  1380. if (bitDic.ContainsKey(item.Tag.ToString() + "|" + itemRow.Cells[1].Value.ToString().Replace("相", string.Empty)) && itemRow.Tag.Equals(item.Tag))
  1381. {
  1382. bitList.Add(bitDic[item.Tag.ToString() + "|" + itemRow.Cells[1].Value.ToString().Replace("相", string.Empty)][0]);
  1383. bitList.Add(bitDic[item.Tag.ToString() + "|" + itemRow.Cells[1].Value.ToString().Replace("相", string.Empty)][1]);
  1384. }
  1385. }
  1386. }
  1387. }
  1388. }
  1389. this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, bitList, tagInfos);
  1390. }
  1391. else
  1392. MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text")+"!");
  1393. }
  1394. private void checkBox1_CheckedChanged(object sender, EventArgs e)
  1395. {
  1396. }
  1397. /// <summary>
  1398. /// 导出项目
  1399. /// </summary>
  1400. /// <param name="sender"></param>
  1401. /// <param name="e"></param>
  1402. private void button6_Click(object sender, EventArgs e)
  1403. {
  1404. try
  1405. {
  1406. if (this.analyzeSettingModel == null)
  1407. {
  1408. MessageBox.Show(PdnResources.GetString("Menu.Settheexporteitemfirst.Text"));
  1409. return;
  1410. }
  1411. //获取项目工程内的文件夹路径
  1412. ProjectEngineering.NodeItem item = this.appWorkspace.GetInsertProjectPath(2, "Menu.GeneralAnalysis.CountStatistics.Text", this.analyzeSettingModel.savePath);
  1413. if (item != null)
  1414. {
  1415. //向文件夹内保存图片和报告
  1416. if (!string.IsNullOrEmpty(this.analyzeSettingModel.analyzeClassify))
  1417. {
  1418. //获取word书签与excel单元格的关系,以字典方式存储
  1419. List<mic_module_infos> mic_module_infos = mic_module_infos_BLL.FindAll().FindAll(a => a.analyze_classify == this.analyzeSettingModel.analyzeClassify);
  1420. Dictionary<string, string> tagInfos = new Dictionary<string, string>();
  1421. if (mic_module_infos != null && mic_module_infos.Count > 0)
  1422. {
  1423. foreach (mic_module_infos info in mic_module_infos)
  1424. {
  1425. tagInfos.Add(info.tag_name, info.cell_position);
  1426. }
  1427. }
  1428. //分析结果
  1429. List<List<string>> analysisContent = new List<List<string>>();
  1430. for (int i = 0; i < this.dataGridView_results.Rows.Count; i++)
  1431. {
  1432. List<string> content1 = new List<string>();
  1433. if (i == 0)
  1434. {
  1435. content1.Add(this.dataGridView_results.Columns[0].HeaderText);
  1436. content1.Add(this.dataGridView_results.Columns[1].HeaderText);
  1437. content1.Add(this.dataGridView_results.Columns[2].HeaderText);
  1438. content1.Add(this.dataGridView_results.Columns[3].HeaderText);
  1439. content1.Add(this.dataGridView_results.Columns[4].HeaderText);
  1440. content1.Add(this.dataGridView_results.Columns[5].HeaderText);
  1441. analysisContent.Add(content1);
  1442. }
  1443. content1 = new List<string>();
  1444. content1.Add(this.dataGridView_results.Rows[i].Cells[0].Value.ToString());
  1445. content1.Add(this.dataGridView_results.Rows[i].Cells[1].Value.ToString());
  1446. content1.Add(this.dataGridView_results.Rows[i].Cells[2].Value.ToString());
  1447. content1.Add(this.dataGridView_results.Rows[i].Cells[3].Value.ToString());
  1448. content1.Add(this.dataGridView_results.Rows[i].Cells[4].Value.ToString());
  1449. content1.Add(this.dataGridView_results.Rows[i].Cells[5].Value.ToString());
  1450. analysisContent.Add(content1);
  1451. }
  1452. bitList = new List<Bitmap>();
  1453. if (this.allShow)
  1454. {
  1455. foreach (KeyValuePair<string, List<Bitmap>> kv in this.bitDic)
  1456. {
  1457. bitList.Add(kv.Value[0]);
  1458. bitList.Add(kv.Value[1]);
  1459. }
  1460. }
  1461. else
  1462. {
  1463. if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)
  1464. {
  1465. foreach (DataGridViewRow itemRow in this.dataGridView_results.Rows)
  1466. {
  1467. foreach (ListViewItem itemL2 in this.listView2.SelectedItems)
  1468. {
  1469. if (bitDic.ContainsKey(itemL2.Tag.ToString() + "|" + itemRow.Cells[1].Value.ToString().Replace("相", string.Empty)) && itemRow.Tag.Equals(itemL2.Tag))
  1470. {
  1471. bitList.Add(bitDic[itemL2.Tag.ToString() + "|" + itemRow.Cells[1].Value.ToString().Replace("相", string.Empty)][0]);
  1472. bitList.Add(bitDic[itemL2.Tag.ToString() + "|" + itemRow.Cells[1].Value.ToString().Replace("相", string.Empty)][1]);
  1473. }
  1474. }
  1475. }
  1476. }
  1477. }
  1478. //中间数据
  1479. if (!this.allShow)
  1480. {
  1481. if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)
  1482. {
  1483. List<ExportProjectModel> exportModel = new List<ExportProjectModel>();
  1484. foreach (ListViewItem rowItem in this.listView2.SelectedItems)
  1485. {
  1486. foreach (ExportProjectModel model in this.tempDataModel)
  1487. {
  1488. if (model.tagName.Equals(rowItem.Tag))
  1489. {
  1490. ExportProjectModel tempModel = new ExportProjectModel();
  1491. tempModel.tagName = model.tagName;
  1492. tempModel.picName = model.picName;
  1493. tempModel.dataList = model.dataList;
  1494. exportModel.Add(tempModel);
  1495. break;
  1496. }
  1497. }
  1498. }
  1499. this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, exportModel, bitList, tagInfos, item.path, item.code);
  1500. }
  1501. }
  1502. else
  1503. {
  1504. MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text") + "!");
  1505. return;
  1506. }
  1507. //保存项目信息到数据库
  1508. this.appWorkspace.InsertIntoDB(this.analyzeSettingModel, item);
  1509. }
  1510. }
  1511. }
  1512. catch (Exception)
  1513. {
  1514. }
  1515. }
  1516. /// <summary>
  1517. /// ListView图片选择改变事件
  1518. /// </summary>
  1519. /// <param name="sender"></param>
  1520. /// <param name="e"></param>
  1521. private void ListViewSelectedIndexChanged(object sender, EventArgs e)
  1522. {
  1523. if (this.listView1.FocusedItem != null && this.listView1.FocusedItem.Selected)
  1524. {
  1525. Init();
  1526. if (!string.IsNullOrEmpty(this.selectedImg)) {
  1527. #region [保存参数]
  1528. var model = new GeneralAnalysisModel.CountNumberAnalysisModel();
  1529. if (rb_LeftCircle.Checked)
  1530. {
  1531. model.parameter1 = 1;
  1532. }
  1533. else if (rb_LeftSquare.Checked)
  1534. {
  1535. model.parameter1 = 2;
  1536. }
  1537. else
  1538. {
  1539. model.parameter1 = 3;
  1540. }
  1541. if (rb_leftFill.Checked)
  1542. {
  1543. model.parameter2 = 1;
  1544. }
  1545. else if (rb_leftNoFill.Checked)
  1546. {
  1547. model.parameter2 = 2;
  1548. }
  1549. else
  1550. {
  1551. model.parameter2 = 3;
  1552. }
  1553. if (rb_RightCircle.Checked)
  1554. {
  1555. model.parameter6 = 1;
  1556. }
  1557. else if (rb_RightSquare.Checked)
  1558. {
  1559. model.parameter6 = 2;
  1560. }
  1561. else
  1562. {
  1563. model.parameter6 = 3;
  1564. }
  1565. if (rb_RightFill.Checked)
  1566. {
  1567. model.parameter7 = 1;
  1568. }
  1569. else if (rb_RightNoFill.Checked)
  1570. {
  1571. model.parameter7 = 2;
  1572. }
  1573. else
  1574. {
  1575. model.parameter7 = 3;
  1576. }
  1577. model.parameter3 = (int)numericUpDown2.Value;
  1578. model.parameter4 = (int)numericUpDown3.Value;
  1579. model.parameter5 = panel1.BackColor.ToArgb();
  1580. model.parameter8 = (int)numericUpDown4.Value;
  1581. model.parameter9 = (int)numericUpDown5.Value;
  1582. model.parameter10 = panel2.BackColor.ToArgb();
  1583. model.parameter11 = (int)numericUpDown1.Value;
  1584. model.parameter12 = checkBox1.Checked;
  1585. if (everyImgData.ContainsKey(this.selectedImg))
  1586. {
  1587. everyImgData[this.selectedImg] = model;
  1588. }
  1589. else {
  1590. everyImgData.Add(this.selectedImg,model);
  1591. }
  1592. #endregion
  1593. }
  1594. this.imageMat = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].CompositionSurface.CreatedAliasedMat();
  1595. Document document = Document.FromImageMat(imageMat.Clone());
  1596. this.documentWorkspace.Document = document;
  1597. this.documentWorkspace.Visible = true;
  1598. //this.documentWorkspace.GraphicsList = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GraphicsList;
  1599. this.documentWorkspace.phaseModels = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].phaseModels;
  1600. mutuallyIndex = 1;
  1601. updateResults();
  1602. selectIndex = 0;
  1603. #region [设置参数]
  1604. this.selectedImg = this.listView1.FocusedItem.Name;
  1605. if (everyImgData.ContainsKey(this.selectedImg))
  1606. {
  1607. var thisModel = everyImgData[this.selectedImg];
  1608. rb_LeftCircle.Checked = thisModel.parameter1 == 1 ? true : false;
  1609. rb_LeftSquare.Checked = thisModel.parameter1 == 1 ? false : true;
  1610. rb_leftFill.Checked = thisModel.parameter2 == 1 ? true : false;
  1611. rb_leftNoFill.Checked = thisModel.parameter2 == 1 ? false : true;
  1612. if (thisModel.parameter3 <= numericUpDown2.Maximum && thisModel.parameter3 >= numericUpDown2.Minimum)
  1613. {
  1614. numericUpDown2.Value = thisModel.parameter3;
  1615. }
  1616. if (thisModel.parameter4 <= numericUpDown3.Maximum && thisModel.parameter4 >= numericUpDown3.Minimum)
  1617. {
  1618. numericUpDown3.Value = thisModel.parameter4;
  1619. }
  1620. panel1.BackColor = Color.FromArgb(thisModel.parameter5);
  1621. rb_RightCircle.Checked = thisModel.parameter6 == 1 ? true : false;
  1622. rb_RightSquare.Checked = thisModel.parameter6 == 1 ? false : true;
  1623. rb_RightFill.Checked = thisModel.parameter7 == 1 ? true : false;
  1624. rb_RightNoFill.Checked = thisModel.parameter7 == 1 ? false : true;
  1625. if (thisModel.parameter8 <= numericUpDown4.Maximum && thisModel.parameter8 >= numericUpDown4.Minimum)
  1626. {
  1627. numericUpDown4.Value = thisModel.parameter8;
  1628. }
  1629. if (thisModel.parameter9 <= numericUpDown5.Maximum && thisModel.parameter9 >= numericUpDown5.Minimum)
  1630. {
  1631. numericUpDown5.Value = thisModel.parameter9;
  1632. }
  1633. panel2.BackColor = Color.FromArgb(thisModel.parameter10);
  1634. if (thisModel.parameter11 <= numericUpDown1.Maximum && thisModel.parameter11 >= numericUpDown1.Minimum)
  1635. {
  1636. numericUpDown1.Value = thisModel.parameter11;
  1637. }
  1638. checkBox1.Checked = thisModel.parameter12;
  1639. }
  1640. #endregion
  1641. }
  1642. }
  1643. #region InitializeComponent
  1644. private void InitializeLanguageText()
  1645. {
  1646. this.groupBox8.Text = PdnResources.GetString("Menu.0.5pointsetting.text");
  1647. this.label3.Text = PdnResources.GetString("Menu.style.text");
  1648. this.rb_RightNoFill.Text = PdnResources.GetString("Menu.Hollow.text");
  1649. this.rb_RightFill.Text = PdnResources.GetString("Menu.solid.text");
  1650. this.label7.Text = PdnResources.GetString("Menu.color.text");
  1651. this.label8.Text = PdnResources.GetString("Menu.Linewidth.text");
  1652. this.label9.Text = PdnResources.GetString("Menu.sizeed.text");
  1653. this.rb_RightSquare.Text = PdnResources.GetString("Menu.Square.text");
  1654. this.rb_RightCircle.Text = PdnResources.GetString("Menu.circular.Text");
  1655. this.label11.Text = PdnResources.GetString("Menu.shape.text");
  1656. this.Text = PdnResources.GetString("Menu.GeneralAnalysis.CountStatistics.Text");
  1657. this.button6.Text = PdnResources.GetString("Menu.Exportproject.text");
  1658. this.label1.Text = PdnResources.GetString("Menu.Decimal.text");
  1659. this.button4.Text = PdnResources.GetString("Menu.Exportresults.text");
  1660. this.button3.Text = PdnResources.GetString("Menu.Tools.CreateReport.Text");
  1661. this.groupBox3.Text = PdnResources.GetString("Menu.Resultspreview.text");
  1662. this.But_DelPhase.Text = PdnResources.GetString("Menu.Deletephase.text");
  1663. this.but_AddPhase.Text = PdnResources.GetString("Menu.Addphase.text");
  1664. this.but_Clear.Text = PdnResources.GetString("Menu.Empty.text");
  1665. this.Column2.HeaderText = PdnResources.GetString("Menu.phase.text");
  1666. this.Column6.HeaderText = PdnResources.GetString("Menu.total.text");
  1667. this.Column7.HeaderText = PdnResources.GetString("Menu.percent.text");
  1668. this.groupBox5.Text = PdnResources.GetString("Menu.Analysisresult.text");
  1669. this.Column5.HeaderText = PdnResources.GetString("Menu.Generalanalysis.Countingstatistics.imagename.text");
  1670. this.Column1.HeaderText = PdnResources.GetString("Menu.phase.text");
  1671. this.Column10.HeaderText = PdnResources.GetString("Menu.total.text");
  1672. this.Column11.HeaderText = PdnResources.GetString("Menu.percent.text");
  1673. this.rb_leftFill.Text = PdnResources.GetString("Menu.solid.text");
  1674. this.label6.Text = PdnResources.GetString("Menu.color.text");
  1675. this.label5.Text = PdnResources.GetString("Menu.Linewidth.text");
  1676. this.label4.Text = PdnResources.GetString("Menu.sizeed.text");
  1677. this.rb_LeftCircle.Text = PdnResources.GetString("Menu.circular.Text");
  1678. this.label2.Text = PdnResources.GetString("Menu.shape.text");
  1679. this.groupBox_review.Text = PdnResources.GetString("Menu.Preview.text");
  1680. this.rb_LeftSquare.Text = PdnResources.GetString("Menu.Square.text");
  1681. this.groupBox4.Text = PdnResources.GetString("Menu.Tools.ImageIndex.Text");
  1682. this.groupBox1.Text = PdnResources.GetString("Menu.operation.text");
  1683. this.button5.Text = PdnResources.GetString("Menu.File.Close.Text");
  1684. this.button2.Text = PdnResources.GetString("Menu.Saveresult.text");
  1685. this.checkBox1.Text = PdnResources.GetString("Menu.Opensettingsatingreport.text");
  1686. this.button1.Text = PdnResources.GetString("Menu.Setting.Text");
  1687. this.groupBox2.Text = PdnResources.GetString("Menu.1SpotSet.text");
  1688. this.label10.Text = PdnResources.GetString("Menu.style.text");
  1689. this.rb_leftNoFill.Text = PdnResources.GetString("Menu.Hollow.text");
  1690. this.button16.Text = PdnResources.GetString("Menu.Cancelshowall.text");
  1691. this.button12.Text = PdnResources.GetString("Menu.Edit.Delete.Text");
  1692. this.button11.Text = PdnResources.GetString("Menu.Showall.text");
  1693. }
  1694. /// <summary>
  1695. /// 切换分析结果
  1696. /// </summary>
  1697. /// <param name="sender"></param>
  1698. /// <param name="e"></param>
  1699. private void listView2_SelectedIndexChanged(object sender, EventArgs e)
  1700. {
  1701. if (!this.allShow)
  1702. {
  1703. if (this.listView2.SelectedItems.Count > 0)
  1704. {
  1705. List<int> dataTableIndex = new List<int>();
  1706. if (this.pictureDataTables.Count == 0)
  1707. return;
  1708. for (int i = 0; i < this.pictureDataTables.Count; i++)
  1709. {
  1710. foreach (ListViewItem item in this.listView2.SelectedItems)
  1711. {
  1712. if (this.pictureDataTables[i].TableName.Equals(item.Tag))
  1713. dataTableIndex.Add(i);
  1714. }
  1715. }
  1716. this.dataGridView_results.Rows.Clear();
  1717. foreach (var item in dataTableIndex)
  1718. {
  1719. if (this.pictureDataTables[item].Rows.Count > 0)
  1720. {
  1721. for (int r = 0; r < this.pictureDataTables[item].Rows.Count; r++)
  1722. {
  1723. DataGridViewRow dgvr = new DataGridViewRow();
  1724. dgvr.Tag = this.pictureDataTables[item].TableName;
  1725. foreach (DataGridViewColumn Column in this.dataGridView_results.Columns)
  1726. {
  1727. dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
  1728. }
  1729. for (int c = 0; c < this.pictureDataTables[item].Columns.Count; c++)
  1730. {
  1731. if (c == this.pictureDataTables[item].Columns.Count - 1 || c == this.pictureDataTables[item].Columns.Count - 2)
  1732. dgvr.Cells[c].Value = Math.Round((double)Convert.ToDecimal(this.pictureDataTables[item].Rows[r][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString();
  1733. else
  1734. dgvr.Cells[c].Value = this.pictureDataTables[item].Rows[r][c].ToString();
  1735. }
  1736. this.dataGridView_results.Rows.Add(dgvr);
  1737. }
  1738. }
  1739. }
  1740. }
  1741. }
  1742. }
  1743. /// <summary>
  1744. /// 未选择分析结果
  1745. /// </summary>
  1746. /// <param name="sender"></param>
  1747. /// <param name="e"></param>
  1748. private void listView2_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
  1749. {
  1750. if (!this.allShow)
  1751. {
  1752. if (this.listView2.SelectedItems.Count == 0)
  1753. this.dataGridView_results.Rows.Clear();
  1754. }
  1755. }
  1756. /// <summary>
  1757. /// 取消全部显示
  1758. /// </summary>
  1759. /// <param name="sender"></param>
  1760. /// <param name="e"></param>
  1761. private void button16_Click(object sender, EventArgs e)
  1762. {
  1763. this.allShow = false;
  1764. this.button11.Visible = true;
  1765. this.button16.Visible = false;
  1766. if (this.listView2.Items.Count > 0)
  1767. {
  1768. if (this.listView2.SelectedItems.Count > 0)
  1769. {
  1770. List<int> dataTableIndex = new List<int>();
  1771. if (this.pictureDataTables.Count == 0)
  1772. return;
  1773. for (int i = 0; i < this.pictureDataTables.Count; i++)
  1774. {
  1775. foreach (ListViewItem item in this.listView2.SelectedItems)
  1776. {
  1777. if (this.pictureDataTables[i].TableName.Equals(item.Tag))
  1778. dataTableIndex.Add(i);
  1779. }
  1780. }
  1781. this.dataGridView_results.Rows.Clear();
  1782. foreach (var item in dataTableIndex)
  1783. {
  1784. if (this.pictureDataTables[item].Rows.Count > 0)
  1785. {
  1786. for (int r = 0; r < this.pictureDataTables[item].Rows.Count; r++)
  1787. {
  1788. DataGridViewRow dgvr = new DataGridViewRow();
  1789. dgvr.Tag = this.pictureDataTables[item].TableName;
  1790. foreach (DataGridViewColumn Column in this.dataGridView_results.Columns)
  1791. {
  1792. dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
  1793. }
  1794. for (int c = 0; c < this.pictureDataTables[item].Columns.Count; c++)
  1795. {
  1796. if (c == this.pictureDataTables[item].Columns.Count - 1 || c == this.pictureDataTables[item].Columns.Count - 2)
  1797. dgvr.Cells[c].Value = Math.Round((double)Convert.ToDecimal(this.pictureDataTables[item].Rows[r][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString();
  1798. else
  1799. dgvr.Cells[c].Value = this.pictureDataTables[item].Rows[r][c].ToString();
  1800. }
  1801. this.dataGridView_results.Rows.Add(dgvr);
  1802. }
  1803. }
  1804. }
  1805. }
  1806. else
  1807. {
  1808. this.listView2.Items[0].Selected = true;
  1809. if (this.pictureDataTables.Count > 0
  1810. && this.pictureDataTables[this.pictureDataTables.Count - 1].Rows.Count > 0)
  1811. {
  1812. this.dataGridView_results.Rows.Clear();
  1813. for (int r = 0; r < this.pictureDataTables[this.pictureDataTables.Count - 1].Rows.Count; r++)
  1814. {
  1815. DataGridViewRow dgvr = new DataGridViewRow();
  1816. dgvr.Tag = this.pictureDataTables[this.pictureDataTables.Count - 1].TableName;
  1817. foreach (DataGridViewColumn Column in this.dataGridView_results.Columns)
  1818. {
  1819. dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
  1820. }
  1821. for (int c = 0; c < this.pictureDataTables[this.pictureDataTables.Count - 1].Columns.Count; c++)
  1822. {
  1823. if (c == this.pictureDataTables[this.pictureDataTables.Count - 1].Columns.Count - 1 || c == this.pictureDataTables[this.pictureDataTables.Count - 1].Columns.Count - 2)
  1824. dgvr.Cells[c].Value = Math.Round((double)Convert.ToDecimal(this.pictureDataTables[this.pictureDataTables.Count - 1].Rows[r][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString();
  1825. else
  1826. dgvr.Cells[c].Value = this.pictureDataTables[this.pictureDataTables.Count - 1].Rows[r][c].ToString();
  1827. }
  1828. this.dataGridView_results.Rows.Add(dgvr);
  1829. }
  1830. }
  1831. }
  1832. }
  1833. }
  1834. /// <summary>
  1835. /// 全部显示
  1836. /// </summary>
  1837. /// <param name="sender"></param>
  1838. /// <param name="e"></param>
  1839. private void button11_Click(object sender, EventArgs e)
  1840. {
  1841. this.allShow = true;
  1842. this.button11.Visible = false;
  1843. this.button16.Visible = true;
  1844. this.button16.Focus();
  1845. AllShow();
  1846. }
  1847. private void AllShow()
  1848. {
  1849. this.dataGridView_results.Rows.Clear();
  1850. DataTable dataTable = new DataTable();
  1851. for (int i = this.pictureDataTables.Count - 1; i >= 0; i--)
  1852. {
  1853. dataTable = this.pictureDataTables[i];
  1854. for (int r = 0; r < dataTable.Rows.Count; r++)
  1855. {
  1856. DataGridViewRow dgvr = new DataGridViewRow();
  1857. dgvr.Tag = dataTable.TableName;
  1858. foreach (DataGridViewColumn Column in this.dataGridView_results.Columns)
  1859. {
  1860. dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
  1861. }
  1862. for (int c = 0; c < dataTable.Columns.Count; c++)
  1863. {
  1864. if (c == dataTable.Columns.Count - 1 || c == dataTable.Columns.Count - 2)
  1865. dgvr.Cells[c].Value = Math.Round((double)Convert.ToDecimal(dataTable.Rows[r][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString();
  1866. else
  1867. dgvr.Cells[c].Value = dataTable.Rows[r][c].ToString();
  1868. }
  1869. this.dataGridView_results.Rows.Add(dgvr);
  1870. }
  1871. }
  1872. }
  1873. /// <summary>
  1874. /// 分析结果删除
  1875. /// </summary>
  1876. /// <param name="sender"></param>
  1877. /// <param name="e"></param>
  1878. private void button12_Click(object sender, EventArgs e)
  1879. {
  1880. if (this.listView2.Items.Count > 0)
  1881. {
  1882. if (this.listView2.SelectedItems.Count > 0)
  1883. {
  1884. DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Areyousuretodeletethisanalysisresult.text")+"?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
  1885. if (dr == DialogResult.OK)
  1886. {
  1887. List<string> detaleName = new List<string>();
  1888. int selectIndex = this.listView2.SelectedItems[0].Index;
  1889. foreach (ListViewItem item in this.listView2.SelectedItems)
  1890. {
  1891. detaleName.Add(item.Tag.ToString());
  1892. this.listView2.Items.Remove(item);
  1893. }
  1894. foreach (string tag in detaleName)
  1895. {
  1896. foreach (DataTable dataTable in this.pictureDataTables)
  1897. {
  1898. if (dataTable.TableName.Equals(tag))
  1899. {
  1900. this.pictureDataTables.Remove(dataTable);
  1901. break;
  1902. }
  1903. }
  1904. for (int i = 0; i < bitDic.Count; i++)
  1905. {
  1906. foreach (var item in bitDic)
  1907. {
  1908. string keyDe = item.Key.Substring(0, item.Key.IndexOf("|"));
  1909. if (tag.Equals(keyDe))
  1910. {
  1911. bitDic.Remove(item.Key);
  1912. break;
  1913. }
  1914. }
  1915. }
  1916. foreach (ExportProjectModel model in this.tempDataModel)
  1917. {
  1918. if (model.tagName.Equals(tag))
  1919. {
  1920. this.tempDataModel.Remove(model);
  1921. break;
  1922. }
  1923. }
  1924. }
  1925. if (this.listView2.Items.Count > 0)
  1926. {
  1927. if (selectIndex == 0)
  1928. this.listView2.Items[0].Selected = true;
  1929. else
  1930. this.listView2.Items[selectIndex - 1].Selected = true;
  1931. RefreshDataGridView4();
  1932. }
  1933. else
  1934. {
  1935. this.dataGridView_results.Rows.Clear();
  1936. }
  1937. }
  1938. }
  1939. else
  1940. {
  1941. MessageBox.Show(PdnResources.GetString("Menu.Pleaseselecttheanalysisresulttodelete.text")+"!");
  1942. }
  1943. }
  1944. else
  1945. {
  1946. MessageBox.Show(PdnResources.GetString("Menu.Nodataintheanalysisresults.text")+"!");
  1947. }
  1948. }
  1949. /// <summary>
  1950. /// 刷新分析结果数据
  1951. /// </summary>
  1952. private void RefreshDataGridView4()
  1953. {
  1954. if (!this.allShow)
  1955. {
  1956. if (this.listView2.SelectedItems.Count > 0)
  1957. {
  1958. List<int> dataTableIndex = new List<int>();
  1959. for (int i = 0; i < this.pictureDataTables.Count; i++)
  1960. {
  1961. foreach (ListViewItem item in this.listView2.SelectedItems)
  1962. {
  1963. if (this.pictureDataTables[i].TableName.Equals(item.Tag))
  1964. dataTableIndex.Add(i);
  1965. }
  1966. }
  1967. if (this.pictureDataTables.Count == 0)
  1968. return;
  1969. this.dataGridView_results.Rows.Clear();
  1970. foreach (var item in dataTableIndex)
  1971. {
  1972. if (this.pictureDataTables[item].Rows.Count > 0)
  1973. {
  1974. for (int r = 0; r < this.pictureDataTables[item].Rows.Count; r++)
  1975. {
  1976. DataGridViewRow dgvr = new DataGridViewRow();
  1977. dgvr.Tag = this.pictureDataTables[item].TableName;
  1978. foreach (DataGridViewColumn Column in this.dataGridView_results.Columns)
  1979. {
  1980. dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
  1981. }
  1982. for (int c = 0; c < this.pictureDataTables[item].Columns.Count; c++)
  1983. {
  1984. if (c != this.pictureDataTables[item].Columns.Count - 1 && c != this.pictureDataTables[item].Columns.Count - 2)
  1985. dgvr.Cells[c].Value = this.pictureDataTables[item].Rows[r][c].ToString();
  1986. else
  1987. dgvr.Cells[c].Value = Math.Round((double)Convert.ToDecimal(this.pictureDataTables[item].Rows[r][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString();
  1988. }
  1989. this.dataGridView_results.Rows.Add(dgvr);
  1990. }
  1991. }
  1992. }
  1993. }
  1994. }
  1995. else
  1996. {
  1997. this.dataGridView_results.Rows.Clear();
  1998. DataTable dataTable = new DataTable();
  1999. for (int i = this.pictureDataTables.Count - 1; i >= 0; i--)
  2000. {
  2001. dataTable = this.pictureDataTables[i];
  2002. for (int r = 0; r < dataTable.Rows.Count; r++)
  2003. {
  2004. DataGridViewRow dgvr = new DataGridViewRow();
  2005. dgvr.Tag = dataTable.TableName;
  2006. foreach (DataGridViewColumn Column in this.dataGridView_results.Columns)
  2007. {
  2008. dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
  2009. }
  2010. for (int c = 0; c < dataTable.Columns.Count; c++)
  2011. {
  2012. if (c != dataTable.Columns.Count - 1 && c != dataTable.Columns.Count - 2)
  2013. dgvr.Cells[c].Value = dataTable.Rows[r][c].ToString();
  2014. else
  2015. dgvr.Cells[c].Value = Math.Round((double)Convert.ToDecimal(dataTable.Rows[r][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString();
  2016. }
  2017. this.dataGridView_results.Rows.Add(dgvr);
  2018. }
  2019. }
  2020. }
  2021. }
  2022. private void numericUpDown2_ValueChanged(object sender, EventArgs e)
  2023. {
  2024. txt_LeftSize.Text = numericUpDown2.Value.ToString();
  2025. }
  2026. private void numericUpDown3_ValueChanged(object sender, EventArgs e)
  2027. {
  2028. txt_LeftLineWeight.Text = numericUpDown3.Value.ToString();
  2029. }
  2030. private void numericUpDown4_ValueChanged(object sender, EventArgs e)
  2031. {
  2032. txt_RightSize.Text = numericUpDown4.Value.ToString();
  2033. }
  2034. private void numericUpDown5_ValueChanged(object sender, EventArgs e)
  2035. {
  2036. txt_RightLineWeight.Text = numericUpDown5.Value.ToString();
  2037. }
  2038. /// <summary>
  2039. /// 不可点击空白区域
  2040. /// </summary>
  2041. /// <param name="sender"></param>
  2042. /// <param name="e"></param>
  2043. private void listView1_MouseUp(object sender, MouseEventArgs e)
  2044. {
  2045. if (e.Button == MouseButtons.Left)
  2046. {
  2047. if (listView1.SelectedItems.Count > 0)
  2048. {
  2049. }
  2050. else if (listView1.SelectedItems.Count <= 0)//点击空白区
  2051. {
  2052. if (this.listView1.FocusedItem != null)
  2053. {
  2054. ListViewItem item = this.listView1.GetItemAt(e.X, e.Y);
  2055. if (item == null)
  2056. {
  2057. this.listView1.FocusedItem.Selected = true;
  2058. }
  2059. }
  2060. }
  2061. }
  2062. }
  2063. private void InitializeComponent()
  2064. {
  2065. this.components = new System.ComponentModel.Container();
  2066. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
  2067. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
  2068. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
  2069. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
  2070. this.groupBox4 = new System.Windows.Forms.GroupBox();
  2071. this.listView1 = new System.Windows.Forms.ListView();
  2072. this.imageList1 = new System.Windows.Forms.ImageList(this.components);
  2073. this.groupBox1 = new System.Windows.Forms.GroupBox();
  2074. this.button5 = new System.Windows.Forms.Button();
  2075. this.button2 = new System.Windows.Forms.Button();
  2076. this.checkBox1 = new System.Windows.Forms.CheckBox();
  2077. this.button1 = new System.Windows.Forms.Button();
  2078. this.groupBox2 = new System.Windows.Forms.GroupBox();
  2079. this.numericUpDown3 = new System.Windows.Forms.NumericUpDown();
  2080. this.numericUpDown2 = new System.Windows.Forms.NumericUpDown();
  2081. this.groupBox10 = new System.Windows.Forms.GroupBox();
  2082. this.label10 = new System.Windows.Forms.Label();
  2083. this.rb_leftNoFill = new System.Windows.Forms.RadioButton();
  2084. this.rb_leftFill = new System.Windows.Forms.RadioButton();
  2085. this.panel1 = new System.Windows.Forms.Panel();
  2086. this.label6 = new System.Windows.Forms.Label();
  2087. this.txt_LeftLineWeight = new System.Windows.Forms.TextBox();
  2088. this.label5 = new System.Windows.Forms.Label();
  2089. this.txt_LeftSize = new System.Windows.Forms.TextBox();
  2090. this.label4 = new System.Windows.Forms.Label();
  2091. this.rb_LeftSquare = new System.Windows.Forms.RadioButton();
  2092. this.rb_LeftCircle = new System.Windows.Forms.RadioButton();
  2093. this.label2 = new System.Windows.Forms.Label();
  2094. this.groupBox_review = new System.Windows.Forms.GroupBox();
  2095. this.groupBox5 = new System.Windows.Forms.GroupBox();
  2096. this.button12 = new System.Windows.Forms.Button();
  2097. this.button16 = new System.Windows.Forms.Button();
  2098. this.button11 = new System.Windows.Forms.Button();
  2099. this.listView2 = new System.Windows.Forms.ListView();
  2100. this.groupBox6 = new System.Windows.Forms.GroupBox();
  2101. this.dataGridView_results = new System.Windows.Forms.DataGridView();
  2102. this.Column5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  2103. this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  2104. this.Column8 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  2105. this.Column9 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  2106. this.Column10 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  2107. this.Column11 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  2108. this.groupBox7 = new System.Windows.Forms.GroupBox();
  2109. this.button6 = new System.Windows.Forms.Button();
  2110. this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
  2111. this.label1 = new System.Windows.Forms.Label();
  2112. this.button4 = new System.Windows.Forms.Button();
  2113. this.button3 = new System.Windows.Forms.Button();
  2114. this.groupBox3 = new System.Windows.Forms.GroupBox();
  2115. this.But_DelPhase = new System.Windows.Forms.Button();
  2116. this.but_AddPhase = new System.Windows.Forms.Button();
  2117. this.but_Clear = new System.Windows.Forms.Button();
  2118. this.dataGridView1 = new System.Windows.Forms.DataGridView();
  2119. this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  2120. this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  2121. this.Column4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  2122. this.Column6 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  2123. this.Column7 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  2124. this.groupBox8 = new System.Windows.Forms.GroupBox();
  2125. this.numericUpDown5 = new System.Windows.Forms.NumericUpDown();
  2126. this.numericUpDown4 = new System.Windows.Forms.NumericUpDown();
  2127. this.panel2 = new System.Windows.Forms.Panel();
  2128. this.groupBox9 = new System.Windows.Forms.GroupBox();
  2129. this.label3 = new System.Windows.Forms.Label();
  2130. this.rb_RightNoFill = new System.Windows.Forms.RadioButton();
  2131. this.rb_RightFill = new System.Windows.Forms.RadioButton();
  2132. this.label7 = new System.Windows.Forms.Label();
  2133. this.txt_RightLineWeight = new System.Windows.Forms.TextBox();
  2134. this.label8 = new System.Windows.Forms.Label();
  2135. this.txt_RightSize = new System.Windows.Forms.TextBox();
  2136. this.label9 = new System.Windows.Forms.Label();
  2137. this.rb_RightSquare = new System.Windows.Forms.RadioButton();
  2138. this.rb_RightCircle = new System.Windows.Forms.RadioButton();
  2139. this.label11 = new System.Windows.Forms.Label();
  2140. this.groupBox4.SuspendLayout();
  2141. this.groupBox1.SuspendLayout();
  2142. this.groupBox2.SuspendLayout();
  2143. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown3)).BeginInit();
  2144. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit();
  2145. this.groupBox10.SuspendLayout();
  2146. this.groupBox5.SuspendLayout();
  2147. this.groupBox6.SuspendLayout();
  2148. ((System.ComponentModel.ISupportInitialize)(this.dataGridView_results)).BeginInit();
  2149. this.groupBox7.SuspendLayout();
  2150. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
  2151. this.groupBox3.SuspendLayout();
  2152. ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
  2153. this.groupBox8.SuspendLayout();
  2154. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown5)).BeginInit();
  2155. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown4)).BeginInit();
  2156. this.groupBox9.SuspendLayout();
  2157. this.SuspendLayout();
  2158. //
  2159. // groupBox4
  2160. //
  2161. this.groupBox4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  2162. | System.Windows.Forms.AnchorStyles.Left)));
  2163. this.groupBox4.Controls.Add(this.listView1);
  2164. this.groupBox4.Location = new System.Drawing.Point(13, 72);
  2165. this.groupBox4.Margin = new System.Windows.Forms.Padding(4);
  2166. this.groupBox4.Name = "groupBox4";
  2167. this.groupBox4.Padding = new System.Windows.Forms.Padding(4);
  2168. this.groupBox4.Size = new System.Drawing.Size(158, 445);
  2169. this.groupBox4.TabIndex = 9;
  2170. this.groupBox4.TabStop = false;
  2171. this.groupBox4.Text = "图像索引";
  2172. //
  2173. // listView1
  2174. //
  2175. this.listView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  2176. | System.Windows.Forms.AnchorStyles.Left)
  2177. | System.Windows.Forms.AnchorStyles.Right)));
  2178. this.listView1.HideSelection = false;
  2179. this.listView1.LargeImageList = this.imageList1;
  2180. this.listView1.Location = new System.Drawing.Point(8, 26);
  2181. this.listView1.Margin = new System.Windows.Forms.Padding(4);
  2182. this.listView1.Name = "listView1";
  2183. this.listView1.Size = new System.Drawing.Size(140, 411);
  2184. this.listView1.TabIndex = 0;
  2185. this.listView1.UseCompatibleStateImageBehavior = false;
  2186. this.listView1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.listView1_MouseUp);
  2187. //
  2188. // imageList1
  2189. //
  2190. this.imageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
  2191. this.imageList1.ImageSize = new System.Drawing.Size(64, 64);
  2192. this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
  2193. //
  2194. // groupBox1
  2195. //
  2196. this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  2197. | System.Windows.Forms.AnchorStyles.Right)));
  2198. this.groupBox1.Controls.Add(this.button5);
  2199. this.groupBox1.Controls.Add(this.button2);
  2200. this.groupBox1.Controls.Add(this.checkBox1);
  2201. this.groupBox1.Controls.Add(this.button1);
  2202. this.groupBox1.Location = new System.Drawing.Point(20, 12);
  2203. this.groupBox1.Name = "groupBox1";
  2204. this.groupBox1.Size = new System.Drawing.Size(1145, 53);
  2205. this.groupBox1.TabIndex = 10;
  2206. this.groupBox1.TabStop = false;
  2207. this.groupBox1.Text = "操作";
  2208. //
  2209. // button5
  2210. //
  2211. this.button5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  2212. this.button5.Location = new System.Drawing.Point(956, 21);
  2213. this.button5.Name = "button5";
  2214. this.button5.Size = new System.Drawing.Size(75, 23);
  2215. this.button5.TabIndex = 3;
  2216. this.button5.Text = "关闭";
  2217. this.button5.UseVisualStyleBackColor = true;
  2218. this.button5.Click += new System.EventHandler(this.button5_Click);
  2219. //
  2220. // button2
  2221. //
  2222. this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  2223. this.button2.Location = new System.Drawing.Point(1053, 21);
  2224. this.button2.Name = "button2";
  2225. this.button2.Size = new System.Drawing.Size(75, 23);
  2226. this.button2.TabIndex = 2;
  2227. this.button2.Text = "保存结果";
  2228. this.button2.UseVisualStyleBackColor = true;
  2229. this.button2.Click += new System.EventHandler(this.button2_Click);
  2230. //
  2231. // checkBox1
  2232. //
  2233. this.checkBox1.AutoSize = true;
  2234. this.checkBox1.Location = new System.Drawing.Point(110, 28);
  2235. this.checkBox1.Name = "checkBox1";
  2236. this.checkBox1.Size = new System.Drawing.Size(132, 16);
  2237. this.checkBox1.TabIndex = 1;
  2238. this.checkBox1.Text = "生成报告时打开设置";
  2239. this.checkBox1.UseVisualStyleBackColor = true;
  2240. this.checkBox1.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged);
  2241. //
  2242. // button1
  2243. //
  2244. this.button1.Location = new System.Drawing.Point(6, 24);
  2245. this.button1.Name = "button1";
  2246. this.button1.Size = new System.Drawing.Size(75, 23);
  2247. this.button1.TabIndex = 0;
  2248. this.button1.Text = "设置";
  2249. this.button1.UseVisualStyleBackColor = true;
  2250. this.button1.Click += new System.EventHandler(this.button1_Click);
  2251. //
  2252. // groupBox2
  2253. //
  2254. this.groupBox2.Controls.Add(this.numericUpDown3);
  2255. this.groupBox2.Controls.Add(this.numericUpDown2);
  2256. this.groupBox2.Controls.Add(this.groupBox10);
  2257. this.groupBox2.Controls.Add(this.panel1);
  2258. this.groupBox2.Controls.Add(this.label6);
  2259. this.groupBox2.Controls.Add(this.txt_LeftLineWeight);
  2260. this.groupBox2.Controls.Add(this.label5);
  2261. this.groupBox2.Controls.Add(this.txt_LeftSize);
  2262. this.groupBox2.Controls.Add(this.label4);
  2263. this.groupBox2.Controls.Add(this.rb_LeftSquare);
  2264. this.groupBox2.Controls.Add(this.rb_LeftCircle);
  2265. this.groupBox2.Controls.Add(this.label2);
  2266. this.groupBox2.Location = new System.Drawing.Point(178, 72);
  2267. this.groupBox2.Name = "groupBox2";
  2268. this.groupBox2.Size = new System.Drawing.Size(406, 93);
  2269. this.groupBox2.TabIndex = 11;
  2270. this.groupBox2.TabStop = false;
  2271. this.groupBox2.Text = "1点设置";
  2272. //
  2273. // numericUpDown3
  2274. //
  2275. this.numericUpDown3.Location = new System.Drawing.Point(166, 54);
  2276. this.numericUpDown3.Maximum = new decimal(new int[] {
  2277. 9999,
  2278. 0,
  2279. 0,
  2280. 0});
  2281. this.numericUpDown3.Minimum = new decimal(new int[] {
  2282. 1,
  2283. 0,
  2284. 0,
  2285. 0});
  2286. this.numericUpDown3.Name = "numericUpDown3";
  2287. this.numericUpDown3.Size = new System.Drawing.Size(63, 21);
  2288. this.numericUpDown3.TabIndex = 27;
  2289. this.numericUpDown3.Value = new decimal(new int[] {
  2290. 2,
  2291. 0,
  2292. 0,
  2293. 0});
  2294. this.numericUpDown3.ValueChanged += new System.EventHandler(this.numericUpDown3_ValueChanged);
  2295. //
  2296. // numericUpDown2
  2297. //
  2298. this.numericUpDown2.Location = new System.Drawing.Point(62, 54);
  2299. this.numericUpDown2.Maximum = new decimal(new int[] {
  2300. 9999,
  2301. 0,
  2302. 0,
  2303. 0});
  2304. this.numericUpDown2.Minimum = new decimal(new int[] {
  2305. 1,
  2306. 0,
  2307. 0,
  2308. 0});
  2309. this.numericUpDown2.Name = "numericUpDown2";
  2310. this.numericUpDown2.Size = new System.Drawing.Size(63, 21);
  2311. this.numericUpDown2.TabIndex = 26;
  2312. this.numericUpDown2.Value = new decimal(new int[] {
  2313. 30,
  2314. 0,
  2315. 0,
  2316. 0});
  2317. this.numericUpDown2.ValueChanged += new System.EventHandler(this.numericUpDown2_ValueChanged);
  2318. //
  2319. // groupBox10
  2320. //
  2321. this.groupBox10.Controls.Add(this.label10);
  2322. this.groupBox10.Controls.Add(this.rb_leftNoFill);
  2323. this.groupBox10.Controls.Add(this.rb_leftFill);
  2324. this.groupBox10.Location = new System.Drawing.Point(227, 10);
  2325. this.groupBox10.Name = "groupBox10";
  2326. this.groupBox10.Size = new System.Drawing.Size(173, 38);
  2327. this.groupBox10.TabIndex = 25;
  2328. this.groupBox10.TabStop = false;
  2329. this.groupBox10.Paint += new System.Windows.Forms.PaintEventHandler(this.groupBox10_Paint);
  2330. //
  2331. // label10
  2332. //
  2333. this.label10.AutoSize = true;
  2334. this.label10.Location = new System.Drawing.Point(12, 16);
  2335. this.label10.Name = "label10";
  2336. this.label10.Size = new System.Drawing.Size(41, 12);
  2337. this.label10.TabIndex = 22;
  2338. this.label10.Text = "样式:";
  2339. //
  2340. // rb_leftNoFill
  2341. //
  2342. this.rb_leftNoFill.AutoSize = true;
  2343. this.rb_leftNoFill.Checked = true;
  2344. this.rb_leftNoFill.Location = new System.Drawing.Point(108, 14);
  2345. this.rb_leftNoFill.Name = "rb_leftNoFill";
  2346. this.rb_leftNoFill.Size = new System.Drawing.Size(47, 16);
  2347. this.rb_leftNoFill.TabIndex = 20;
  2348. this.rb_leftNoFill.TabStop = true;
  2349. this.rb_leftNoFill.Text = "空心";
  2350. this.rb_leftNoFill.UseVisualStyleBackColor = true;
  2351. this.rb_leftNoFill.CheckedChanged += new System.EventHandler(this.rb_leftNoFill_CheckedChanged);
  2352. //
  2353. // rb_leftFill
  2354. //
  2355. this.rb_leftFill.AutoSize = true;
  2356. this.rb_leftFill.Location = new System.Drawing.Point(53, 14);
  2357. this.rb_leftFill.Name = "rb_leftFill";
  2358. this.rb_leftFill.Size = new System.Drawing.Size(47, 16);
  2359. this.rb_leftFill.TabIndex = 19;
  2360. this.rb_leftFill.Text = "实心";
  2361. this.rb_leftFill.UseVisualStyleBackColor = true;
  2362. this.rb_leftFill.CheckedChanged += new System.EventHandler(this.rb_leftFill_CheckedChanged);
  2363. //
  2364. // panel1
  2365. //
  2366. this.panel1.BackColor = System.Drawing.Color.Blue;
  2367. this.panel1.Location = new System.Drawing.Point(274, 57);
  2368. this.panel1.Name = "panel1";
  2369. this.panel1.Size = new System.Drawing.Size(98, 17);
  2370. this.panel1.TabIndex = 25;
  2371. this.panel1.Click += new System.EventHandler(this.panel1_Click);
  2372. //
  2373. // label6
  2374. //
  2375. this.label6.AutoSize = true;
  2376. this.label6.Location = new System.Drawing.Point(239, 57);
  2377. this.label6.Name = "label6";
  2378. this.label6.Size = new System.Drawing.Size(41, 12);
  2379. this.label6.TabIndex = 10;
  2380. this.label6.Text = "颜色:";
  2381. //
  2382. // txt_LeftLineWeight
  2383. //
  2384. this.txt_LeftLineWeight.Location = new System.Drawing.Point(166, 54);
  2385. this.txt_LeftLineWeight.Name = "txt_LeftLineWeight";
  2386. this.txt_LeftLineWeight.Size = new System.Drawing.Size(45, 21);
  2387. this.txt_LeftLineWeight.TabIndex = 9;
  2388. this.txt_LeftLineWeight.Text = "2";
  2389. this.txt_LeftLineWeight.TextChanged += new System.EventHandler(this.txt_LeftLineWeight_TextChanged);
  2390. //
  2391. // label5
  2392. //
  2393. this.label5.AutoSize = true;
  2394. this.label5.Location = new System.Drawing.Point(131, 57);
  2395. this.label5.Name = "label5";
  2396. this.label5.Size = new System.Drawing.Size(29, 12);
  2397. this.label5.TabIndex = 8;
  2398. this.label5.Text = "线宽";
  2399. //
  2400. // txt_LeftSize
  2401. //
  2402. this.txt_LeftSize.Location = new System.Drawing.Point(62, 54);
  2403. this.txt_LeftSize.Name = "txt_LeftSize";
  2404. this.txt_LeftSize.Size = new System.Drawing.Size(45, 21);
  2405. this.txt_LeftSize.TabIndex = 7;
  2406. this.txt_LeftSize.Text = "30";
  2407. this.txt_LeftSize.TextChanged += new System.EventHandler(this.txt_LeftSize_TextChanged);
  2408. //
  2409. // label4
  2410. //
  2411. this.label4.AutoSize = true;
  2412. this.label4.Location = new System.Drawing.Point(27, 57);
  2413. this.label4.Name = "label4";
  2414. this.label4.Size = new System.Drawing.Size(41, 12);
  2415. this.label4.TabIndex = 6;
  2416. this.label4.Text = "尺寸:";
  2417. //
  2418. // rb_LeftSquare
  2419. //
  2420. this.rb_LeftSquare.AutoSize = true;
  2421. this.rb_LeftSquare.Location = new System.Drawing.Point(115, 25);
  2422. this.rb_LeftSquare.Name = "rb_LeftSquare";
  2423. this.rb_LeftSquare.Size = new System.Drawing.Size(47, 16);
  2424. this.rb_LeftSquare.TabIndex = 2;
  2425. this.rb_LeftSquare.Text = "方形";
  2426. this.rb_LeftSquare.UseVisualStyleBackColor = true;
  2427. this.rb_LeftSquare.CheckedChanged += new System.EventHandler(this.rb_LeftSquare_CheckedChanged);
  2428. //
  2429. // rb_LeftCircle
  2430. //
  2431. this.rb_LeftCircle.AutoSize = true;
  2432. this.rb_LeftCircle.Checked = true;
  2433. this.rb_LeftCircle.Location = new System.Drawing.Point(62, 25);
  2434. this.rb_LeftCircle.Name = "rb_LeftCircle";
  2435. this.rb_LeftCircle.Size = new System.Drawing.Size(47, 16);
  2436. this.rb_LeftCircle.TabIndex = 1;
  2437. this.rb_LeftCircle.TabStop = true;
  2438. this.rb_LeftCircle.Text = "圆形";
  2439. this.rb_LeftCircle.UseVisualStyleBackColor = true;
  2440. this.rb_LeftCircle.CheckedChanged += new System.EventHandler(this.rb_LeftCircle_CheckedChanged);
  2441. //
  2442. // label2
  2443. //
  2444. this.label2.AutoSize = true;
  2445. this.label2.Location = new System.Drawing.Point(25, 27);
  2446. this.label2.Name = "label2";
  2447. this.label2.Size = new System.Drawing.Size(41, 12);
  2448. this.label2.TabIndex = 0;
  2449. this.label2.Text = "形状:";
  2450. //
  2451. // groupBox_review
  2452. //
  2453. this.groupBox_review.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  2454. | System.Windows.Forms.AnchorStyles.Left)
  2455. | System.Windows.Forms.AnchorStyles.Right)));
  2456. this.groupBox_review.Location = new System.Drawing.Point(590, 72);
  2457. this.groupBox_review.Name = "groupBox_review";
  2458. this.groupBox_review.Size = new System.Drawing.Size(575, 445);
  2459. this.groupBox_review.TabIndex = 12;
  2460. this.groupBox_review.TabStop = false;
  2461. this.groupBox_review.Text = "预览";
  2462. //
  2463. // groupBox5
  2464. //
  2465. this.groupBox5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
  2466. this.groupBox5.Controls.Add(this.button12);
  2467. this.groupBox5.Controls.Add(this.button16);
  2468. this.groupBox5.Controls.Add(this.button11);
  2469. this.groupBox5.Controls.Add(this.listView2);
  2470. this.groupBox5.Location = new System.Drawing.Point(12, 524);
  2471. this.groupBox5.Name = "groupBox5";
  2472. this.groupBox5.Size = new System.Drawing.Size(224, 203);
  2473. this.groupBox5.TabIndex = 13;
  2474. this.groupBox5.TabStop = false;
  2475. this.groupBox5.Text = "分析结果";
  2476. //
  2477. // button12
  2478. //
  2479. this.button12.BackColor = System.Drawing.SystemColors.Control;
  2480. this.button12.Location = new System.Drawing.Point(153, 20);
  2481. this.button12.Name = "button12";
  2482. this.button12.Size = new System.Drawing.Size(52, 26);
  2483. this.button12.TabIndex = 26;
  2484. this.button12.Text = "删除";
  2485. this.button12.UseVisualStyleBackColor = false;
  2486. this.button12.Click += new System.EventHandler(this.button12_Click);
  2487. //
  2488. // button16
  2489. //
  2490. this.button16.BackColor = System.Drawing.SystemColors.Control;
  2491. this.button16.Location = new System.Drawing.Point(14, 20);
  2492. this.button16.Name = "button16";
  2493. this.button16.Size = new System.Drawing.Size(93, 26);
  2494. this.button16.TabIndex = 25;
  2495. this.button16.Text = "取消全部显示";
  2496. this.button16.UseVisualStyleBackColor = false;
  2497. this.button16.Click += new System.EventHandler(this.button16_Click);
  2498. //
  2499. // button11
  2500. //
  2501. this.button11.BackColor = System.Drawing.SystemColors.Control;
  2502. this.button11.Location = new System.Drawing.Point(14, 20);
  2503. this.button11.Name = "button11";
  2504. this.button11.Size = new System.Drawing.Size(63, 26);
  2505. this.button11.TabIndex = 24;
  2506. this.button11.Text = "全部显示";
  2507. this.button11.UseVisualStyleBackColor = false;
  2508. this.button11.Click += new System.EventHandler(this.button11_Click);
  2509. //
  2510. // listView2
  2511. //
  2512. this.listView2.FullRowSelect = true;
  2513. this.listView2.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
  2514. this.listView2.HideSelection = false;
  2515. this.listView2.Location = new System.Drawing.Point(14, 53);
  2516. this.listView2.Name = "listView2";
  2517. this.listView2.Size = new System.Drawing.Size(191, 144);
  2518. this.listView2.TabIndex = 23;
  2519. this.listView2.UseCompatibleStateImageBehavior = false;
  2520. this.listView2.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.listView2_ItemSelectionChanged);
  2521. this.listView2.SelectedIndexChanged += new System.EventHandler(this.listView2_SelectedIndexChanged);
  2522. //
  2523. // groupBox6
  2524. //
  2525. this.groupBox6.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
  2526. | System.Windows.Forms.AnchorStyles.Right)));
  2527. this.groupBox6.Controls.Add(this.dataGridView_results);
  2528. this.groupBox6.Location = new System.Drawing.Point(257, 524);
  2529. this.groupBox6.Name = "groupBox6";
  2530. this.groupBox6.Size = new System.Drawing.Size(678, 203);
  2531. this.groupBox6.TabIndex = 14;
  2532. this.groupBox6.TabStop = false;
  2533. //
  2534. // dataGridView_results
  2535. //
  2536. this.dataGridView_results.AllowUserToAddRows = false;
  2537. this.dataGridView_results.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  2538. | System.Windows.Forms.AnchorStyles.Left)
  2539. | System.Windows.Forms.AnchorStyles.Right)));
  2540. this.dataGridView_results.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
  2541. this.dataGridView_results.BorderStyle = System.Windows.Forms.BorderStyle.None;
  2542. this.dataGridView_results.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
  2543. this.dataGridView_results.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
  2544. this.Column5,
  2545. this.Column1,
  2546. this.Column8,
  2547. this.Column9,
  2548. this.Column10,
  2549. this.Column11});
  2550. this.dataGridView_results.Location = new System.Drawing.Point(16, 29);
  2551. this.dataGridView_results.Name = "dataGridView_results";
  2552. this.dataGridView_results.RowHeadersVisible = false;
  2553. this.dataGridView_results.RowHeadersWidth = 51;
  2554. this.dataGridView_results.RowTemplate.Height = 27;
  2555. this.dataGridView_results.Size = new System.Drawing.Size(645, 168);
  2556. this.dataGridView_results.TabIndex = 1;
  2557. //
  2558. // Column5
  2559. //
  2560. this.Column5.Name = "Column5";
  2561. //
  2562. // Column1
  2563. //
  2564. this.Column1.Name = "Column1";
  2565. //
  2566. // Column8
  2567. //
  2568. this.Column8.HeaderText = "1";
  2569. this.Column8.Name = "Column8";
  2570. //
  2571. // Column9
  2572. //
  2573. this.Column9.HeaderText = ".5";
  2574. this.Column9.Name = "Column9";
  2575. //
  2576. // Column10
  2577. //
  2578. this.Column10.Name = "Column10";
  2579. //
  2580. // Column11
  2581. //
  2582. this.Column11.Name = "Column11";
  2583. //
  2584. // groupBox7
  2585. //
  2586. this.groupBox7.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
  2587. this.groupBox7.Controls.Add(this.button6);
  2588. this.groupBox7.Controls.Add(this.numericUpDown1);
  2589. this.groupBox7.Controls.Add(this.label1);
  2590. this.groupBox7.Controls.Add(this.button4);
  2591. this.groupBox7.Controls.Add(this.button3);
  2592. this.groupBox7.Location = new System.Drawing.Point(941, 524);
  2593. this.groupBox7.Name = "groupBox7";
  2594. this.groupBox7.Size = new System.Drawing.Size(224, 203);
  2595. this.groupBox7.TabIndex = 15;
  2596. this.groupBox7.TabStop = false;
  2597. //
  2598. // button6
  2599. //
  2600. this.button6.Location = new System.Drawing.Point(48, 123);
  2601. this.button6.Name = "button6";
  2602. this.button6.Size = new System.Drawing.Size(123, 23);
  2603. this.button6.TabIndex = 5;
  2604. this.button6.Text = "导出项目";
  2605. this.button6.UseVisualStyleBackColor = true;
  2606. this.button6.Click += new System.EventHandler(this.button6_Click);
  2607. //
  2608. // numericUpDown1
  2609. //
  2610. this.numericUpDown1.Location = new System.Drawing.Point(81, 170);
  2611. this.numericUpDown1.Maximum = new decimal(new int[] {
  2612. 10,
  2613. 0,
  2614. 0,
  2615. 0});
  2616. this.numericUpDown1.Name = "numericUpDown1";
  2617. this.numericUpDown1.Size = new System.Drawing.Size(90, 21);
  2618. this.numericUpDown1.TabIndex = 4;
  2619. this.numericUpDown1.Value = new decimal(new int[] {
  2620. 2,
  2621. 0,
  2622. 0,
  2623. 0});
  2624. this.numericUpDown1.ValueChanged += new System.EventHandler(this.numericUpDown1_ValueChanged);
  2625. //
  2626. // label1
  2627. //
  2628. this.label1.AutoSize = true;
  2629. this.label1.Location = new System.Drawing.Point(46, 173);
  2630. this.label1.Name = "label1";
  2631. this.label1.Size = new System.Drawing.Size(41, 12);
  2632. this.label1.TabIndex = 3;
  2633. this.label1.Text = "小数:";
  2634. //
  2635. // button4
  2636. //
  2637. this.button4.Location = new System.Drawing.Point(48, 94);
  2638. this.button4.Name = "button4";
  2639. this.button4.Size = new System.Drawing.Size(123, 23);
  2640. this.button4.TabIndex = 1;
  2641. this.button4.Text = "导出结果";
  2642. this.button4.UseVisualStyleBackColor = true;
  2643. this.button4.Click += new System.EventHandler(this.button4_Click);
  2644. //
  2645. // button3
  2646. //
  2647. this.button3.Location = new System.Drawing.Point(48, 65);
  2648. this.button3.Name = "button3";
  2649. this.button3.Size = new System.Drawing.Size(123, 23);
  2650. this.button3.TabIndex = 0;
  2651. this.button3.Text = "生成报告";
  2652. this.button3.UseVisualStyleBackColor = true;
  2653. this.button3.Click += new System.EventHandler(this.button3_Click);
  2654. //
  2655. // groupBox3
  2656. //
  2657. this.groupBox3.Controls.Add(this.But_DelPhase);
  2658. this.groupBox3.Controls.Add(this.but_AddPhase);
  2659. this.groupBox3.Controls.Add(this.but_Clear);
  2660. this.groupBox3.Controls.Add(this.dataGridView1);
  2661. this.groupBox3.Location = new System.Drawing.Point(178, 271);
  2662. this.groupBox3.Name = "groupBox3";
  2663. this.groupBox3.Size = new System.Drawing.Size(406, 246);
  2664. this.groupBox3.TabIndex = 16;
  2665. this.groupBox3.TabStop = false;
  2666. this.groupBox3.Text = "结果预览";
  2667. //
  2668. // But_DelPhase
  2669. //
  2670. this.But_DelPhase.Location = new System.Drawing.Point(335, 20);
  2671. this.But_DelPhase.Name = "But_DelPhase";
  2672. this.But_DelPhase.Size = new System.Drawing.Size(63, 23);
  2673. this.But_DelPhase.TabIndex = 3;
  2674. this.But_DelPhase.Text = "删除相";
  2675. this.But_DelPhase.UseVisualStyleBackColor = true;
  2676. this.But_DelPhase.Click += new System.EventHandler(this.But_DelPhase_Click);
  2677. //
  2678. // but_AddPhase
  2679. //
  2680. this.but_AddPhase.Location = new System.Drawing.Point(252, 20);
  2681. this.but_AddPhase.Name = "but_AddPhase";
  2682. this.but_AddPhase.Size = new System.Drawing.Size(61, 23);
  2683. this.but_AddPhase.TabIndex = 2;
  2684. this.but_AddPhase.Text = "添加相";
  2685. this.but_AddPhase.UseVisualStyleBackColor = true;
  2686. this.but_AddPhase.Click += new System.EventHandler(this.but_AddPhase_Click);
  2687. //
  2688. // but_Clear
  2689. //
  2690. this.but_Clear.Location = new System.Drawing.Point(168, 20);
  2691. this.but_Clear.Name = "but_Clear";
  2692. this.but_Clear.Size = new System.Drawing.Size(61, 23);
  2693. this.but_Clear.TabIndex = 1;
  2694. this.but_Clear.Text = "清空";
  2695. this.but_Clear.UseVisualStyleBackColor = true;
  2696. this.but_Clear.Click += new System.EventHandler(this.but_Clear_Click);
  2697. //
  2698. // dataGridView1
  2699. //
  2700. this.dataGridView1.AllowUserToAddRows = false;
  2701. this.dataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
  2702. this.dataGridView1.BorderStyle = System.Windows.Forms.BorderStyle.None;
  2703. this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
  2704. this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
  2705. this.Column2,
  2706. this.Column3,
  2707. this.Column4,
  2708. this.Column6,
  2709. this.Column7});
  2710. this.dataGridView1.Location = new System.Drawing.Point(6, 54);
  2711. this.dataGridView1.MultiSelect = false;
  2712. this.dataGridView1.Name = "dataGridView1";
  2713. this.dataGridView1.ReadOnly = true;
  2714. this.dataGridView1.RowHeadersVisible = false;
  2715. this.dataGridView1.RowTemplate.Height = 23;
  2716. this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
  2717. this.dataGridView1.Size = new System.Drawing.Size(394, 186);
  2718. this.dataGridView1.TabIndex = 0;
  2719. //
  2720. // Column2
  2721. //
  2722. this.Column2.HeaderText = "Column2";
  2723. this.Column2.Name = "Column2";
  2724. this.Column2.ReadOnly = true;
  2725. //
  2726. // Column3
  2727. //
  2728. dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
  2729. this.Column3.DefaultCellStyle = dataGridViewCellStyle1;
  2730. this.Column3.HeaderText = "1";
  2731. this.Column3.Name = "Column3";
  2732. this.Column3.ReadOnly = true;
  2733. //
  2734. // Column4
  2735. //
  2736. dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
  2737. this.Column4.DefaultCellStyle = dataGridViewCellStyle2;
  2738. this.Column4.HeaderText = ".5";
  2739. this.Column4.Name = "Column4";
  2740. this.Column4.ReadOnly = true;
  2741. //
  2742. // Column6
  2743. //
  2744. dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
  2745. this.Column6.DefaultCellStyle = dataGridViewCellStyle3;
  2746. this.Column6.HeaderText = "Column6";
  2747. this.Column6.Name = "Column6";
  2748. this.Column6.ReadOnly = true;
  2749. //
  2750. // Column7
  2751. //
  2752. dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
  2753. this.Column7.DefaultCellStyle = dataGridViewCellStyle4;
  2754. this.Column7.HeaderText = "Column7";
  2755. this.Column7.Name = "Column7";
  2756. this.Column7.ReadOnly = true;
  2757. //
  2758. // groupBox8
  2759. //
  2760. this.groupBox8.Controls.Add(this.numericUpDown5);
  2761. this.groupBox8.Controls.Add(this.numericUpDown4);
  2762. this.groupBox8.Controls.Add(this.panel2);
  2763. this.groupBox8.Controls.Add(this.groupBox9);
  2764. this.groupBox8.Controls.Add(this.label7);
  2765. this.groupBox8.Controls.Add(this.txt_RightLineWeight);
  2766. this.groupBox8.Controls.Add(this.label8);
  2767. this.groupBox8.Controls.Add(this.txt_RightSize);
  2768. this.groupBox8.Controls.Add(this.label9);
  2769. this.groupBox8.Controls.Add(this.rb_RightSquare);
  2770. this.groupBox8.Controls.Add(this.rb_RightCircle);
  2771. this.groupBox8.Controls.Add(this.label11);
  2772. this.groupBox8.Location = new System.Drawing.Point(178, 171);
  2773. this.groupBox8.Name = "groupBox8";
  2774. this.groupBox8.Size = new System.Drawing.Size(406, 94);
  2775. this.groupBox8.TabIndex = 17;
  2776. this.groupBox8.TabStop = false;
  2777. this.groupBox8.Text = "0.5点设置";
  2778. //
  2779. // numericUpDown5
  2780. //
  2781. this.numericUpDown5.Location = new System.Drawing.Point(162, 59);
  2782. this.numericUpDown5.Maximum = new decimal(new int[] {
  2783. 9999,
  2784. 0,
  2785. 0,
  2786. 0});
  2787. this.numericUpDown5.Minimum = new decimal(new int[] {
  2788. 1,
  2789. 0,
  2790. 0,
  2791. 0});
  2792. this.numericUpDown5.Name = "numericUpDown5";
  2793. this.numericUpDown5.Size = new System.Drawing.Size(63, 21);
  2794. this.numericUpDown5.TabIndex = 28;
  2795. this.numericUpDown5.Value = new decimal(new int[] {
  2796. 5,
  2797. 0,
  2798. 0,
  2799. 0});
  2800. this.numericUpDown5.ValueChanged += new System.EventHandler(this.numericUpDown5_ValueChanged);
  2801. //
  2802. // numericUpDown4
  2803. //
  2804. this.numericUpDown4.Location = new System.Drawing.Point(56, 59);
  2805. this.numericUpDown4.Maximum = new decimal(new int[] {
  2806. 9999,
  2807. 0,
  2808. 0,
  2809. 0});
  2810. this.numericUpDown4.Minimum = new decimal(new int[] {
  2811. 1,
  2812. 0,
  2813. 0,
  2814. 0});
  2815. this.numericUpDown4.Name = "numericUpDown4";
  2816. this.numericUpDown4.Size = new System.Drawing.Size(63, 21);
  2817. this.numericUpDown4.TabIndex = 27;
  2818. this.numericUpDown4.Value = new decimal(new int[] {
  2819. 30,
  2820. 0,
  2821. 0,
  2822. 0});
  2823. this.numericUpDown4.ValueChanged += new System.EventHandler(this.numericUpDown4_ValueChanged);
  2824. //
  2825. // panel2
  2826. //
  2827. this.panel2.BackColor = System.Drawing.Color.Yellow;
  2828. this.panel2.Location = new System.Drawing.Point(268, 62);
  2829. this.panel2.Name = "panel2";
  2830. this.panel2.Size = new System.Drawing.Size(98, 17);
  2831. this.panel2.TabIndex = 26;
  2832. this.panel2.Click += new System.EventHandler(this.panel2_Click);
  2833. //
  2834. // groupBox9
  2835. //
  2836. this.groupBox9.Controls.Add(this.label3);
  2837. this.groupBox9.Controls.Add(this.rb_RightNoFill);
  2838. this.groupBox9.Controls.Add(this.rb_RightFill);
  2839. this.groupBox9.Location = new System.Drawing.Point(221, 14);
  2840. this.groupBox9.Name = "groupBox9";
  2841. this.groupBox9.Size = new System.Drawing.Size(173, 42);
  2842. this.groupBox9.TabIndex = 24;
  2843. this.groupBox9.TabStop = false;
  2844. this.groupBox9.Paint += new System.Windows.Forms.PaintEventHandler(this.groupBox9_Paint);
  2845. //
  2846. // label3
  2847. //
  2848. this.label3.AutoSize = true;
  2849. this.label3.Location = new System.Drawing.Point(12, 18);
  2850. this.label3.Name = "label3";
  2851. this.label3.Size = new System.Drawing.Size(41, 12);
  2852. this.label3.TabIndex = 21;
  2853. this.label3.Text = "样式:";
  2854. //
  2855. // rb_RightNoFill
  2856. //
  2857. this.rb_RightNoFill.AutoSize = true;
  2858. this.rb_RightNoFill.Checked = true;
  2859. this.rb_RightNoFill.Location = new System.Drawing.Point(108, 16);
  2860. this.rb_RightNoFill.Name = "rb_RightNoFill";
  2861. this.rb_RightNoFill.Size = new System.Drawing.Size(47, 16);
  2862. this.rb_RightNoFill.TabIndex = 20;
  2863. this.rb_RightNoFill.TabStop = true;
  2864. this.rb_RightNoFill.Text = "空心";
  2865. this.rb_RightNoFill.UseVisualStyleBackColor = true;
  2866. this.rb_RightNoFill.CheckedChanged += new System.EventHandler(this.rb_RightNoFill_CheckedChanged);
  2867. //
  2868. // rb_RightFill
  2869. //
  2870. this.rb_RightFill.AutoSize = true;
  2871. this.rb_RightFill.Location = new System.Drawing.Point(53, 16);
  2872. this.rb_RightFill.Name = "rb_RightFill";
  2873. this.rb_RightFill.Size = new System.Drawing.Size(47, 16);
  2874. this.rb_RightFill.TabIndex = 19;
  2875. this.rb_RightFill.Text = "实心";
  2876. this.rb_RightFill.UseVisualStyleBackColor = true;
  2877. this.rb_RightFill.CheckedChanged += new System.EventHandler(this.rb_RightFill_CheckedChanged);
  2878. //
  2879. // label7
  2880. //
  2881. this.label7.AutoSize = true;
  2882. this.label7.Location = new System.Drawing.Point(233, 62);
  2883. this.label7.Name = "label7";
  2884. this.label7.Size = new System.Drawing.Size(41, 12);
  2885. this.label7.TabIndex = 22;
  2886. this.label7.Text = "颜色:";
  2887. //
  2888. // txt_RightLineWeight
  2889. //
  2890. this.txt_RightLineWeight.Location = new System.Drawing.Point(162, 59);
  2891. this.txt_RightLineWeight.Name = "txt_RightLineWeight";
  2892. this.txt_RightLineWeight.Size = new System.Drawing.Size(45, 21);
  2893. this.txt_RightLineWeight.TabIndex = 21;
  2894. this.txt_RightLineWeight.Text = "5";
  2895. this.txt_RightLineWeight.TextChanged += new System.EventHandler(this.txt_RightLineWeight_TextChanged);
  2896. //
  2897. // label8
  2898. //
  2899. this.label8.AutoSize = true;
  2900. this.label8.Location = new System.Drawing.Point(127, 62);
  2901. this.label8.Name = "label8";
  2902. this.label8.Size = new System.Drawing.Size(29, 12);
  2903. this.label8.TabIndex = 20;
  2904. this.label8.Text = "线宽";
  2905. //
  2906. // txt_RightSize
  2907. //
  2908. this.txt_RightSize.Location = new System.Drawing.Point(58, 59);
  2909. this.txt_RightSize.Name = "txt_RightSize";
  2910. this.txt_RightSize.Size = new System.Drawing.Size(45, 21);
  2911. this.txt_RightSize.TabIndex = 19;
  2912. this.txt_RightSize.Text = "30";
  2913. this.txt_RightSize.TextChanged += new System.EventHandler(this.txt_RightSize_TextChanged);
  2914. //
  2915. // label9
  2916. //
  2917. this.label9.AutoSize = true;
  2918. this.label9.Location = new System.Drawing.Point(23, 62);
  2919. this.label9.Name = "label9";
  2920. this.label9.Size = new System.Drawing.Size(41, 12);
  2921. this.label9.TabIndex = 18;
  2922. this.label9.Text = "尺寸:";
  2923. //
  2924. // rb_RightSquare
  2925. //
  2926. this.rb_RightSquare.AutoSize = true;
  2927. this.rb_RightSquare.Location = new System.Drawing.Point(109, 30);
  2928. this.rb_RightSquare.Name = "rb_RightSquare";
  2929. this.rb_RightSquare.Size = new System.Drawing.Size(47, 16);
  2930. this.rb_RightSquare.TabIndex = 14;
  2931. this.rb_RightSquare.TabStop = true;
  2932. this.rb_RightSquare.Text = "方形";
  2933. this.rb_RightSquare.UseVisualStyleBackColor = true;
  2934. this.rb_RightSquare.CheckedChanged += new System.EventHandler(this.rb_RightSquare_CheckedChanged);
  2935. //
  2936. // rb_RightCircle
  2937. //
  2938. this.rb_RightCircle.AutoSize = true;
  2939. this.rb_RightCircle.Checked = true;
  2940. this.rb_RightCircle.Location = new System.Drawing.Point(56, 30);
  2941. this.rb_RightCircle.Name = "rb_RightCircle";
  2942. this.rb_RightCircle.Size = new System.Drawing.Size(47, 16);
  2943. this.rb_RightCircle.TabIndex = 13;
  2944. this.rb_RightCircle.TabStop = true;
  2945. this.rb_RightCircle.Text = "圆形";
  2946. this.rb_RightCircle.UseVisualStyleBackColor = true;
  2947. this.rb_RightCircle.CheckedChanged += new System.EventHandler(this.rb_RightCircle_CheckedChanged);
  2948. //
  2949. // label11
  2950. //
  2951. this.label11.AutoSize = true;
  2952. this.label11.Location = new System.Drawing.Point(21, 32);
  2953. this.label11.Name = "label11";
  2954. this.label11.Size = new System.Drawing.Size(41, 12);
  2955. this.label11.TabIndex = 12;
  2956. this.label11.Text = "形状:";
  2957. //
  2958. // CountNumberAnalysisDialog
  2959. //
  2960. this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
  2961. this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
  2962. this.ClientSize = new System.Drawing.Size(1177, 744);
  2963. this.Controls.Add(this.groupBox8);
  2964. this.Controls.Add(this.groupBox3);
  2965. this.Controls.Add(this.groupBox7);
  2966. this.Controls.Add(this.groupBox6);
  2967. this.Controls.Add(this.groupBox5);
  2968. this.Controls.Add(this.groupBox_review);
  2969. this.Controls.Add(this.groupBox2);
  2970. this.Controls.Add(this.groupBox1);
  2971. this.Controls.Add(this.groupBox4);
  2972. this.Name = "CountNumberAnalysisDialog";
  2973. this.Text = "计数统计";
  2974. this.Controls.SetChildIndex(this.groupBox4, 0);
  2975. this.Controls.SetChildIndex(this.groupBox1, 0);
  2976. this.Controls.SetChildIndex(this.groupBox2, 0);
  2977. this.Controls.SetChildIndex(this.groupBox_review, 0);
  2978. this.Controls.SetChildIndex(this.groupBox5, 0);
  2979. this.Controls.SetChildIndex(this.groupBox6, 0);
  2980. this.Controls.SetChildIndex(this.groupBox7, 0);
  2981. this.Controls.SetChildIndex(this.groupBox3, 0);
  2982. this.Controls.SetChildIndex(this.groupBox8, 0);
  2983. this.groupBox4.ResumeLayout(false);
  2984. this.groupBox1.ResumeLayout(false);
  2985. this.groupBox1.PerformLayout();
  2986. this.groupBox2.ResumeLayout(false);
  2987. this.groupBox2.PerformLayout();
  2988. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown3)).EndInit();
  2989. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit();
  2990. this.groupBox10.ResumeLayout(false);
  2991. this.groupBox10.PerformLayout();
  2992. this.groupBox5.ResumeLayout(false);
  2993. this.groupBox6.ResumeLayout(false);
  2994. ((System.ComponentModel.ISupportInitialize)(this.dataGridView_results)).EndInit();
  2995. this.groupBox7.ResumeLayout(false);
  2996. this.groupBox7.PerformLayout();
  2997. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
  2998. this.groupBox3.ResumeLayout(false);
  2999. ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
  3000. this.groupBox8.ResumeLayout(false);
  3001. this.groupBox8.PerformLayout();
  3002. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown5)).EndInit();
  3003. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown4)).EndInit();
  3004. this.groupBox9.ResumeLayout(false);
  3005. this.groupBox9.PerformLayout();
  3006. this.ResumeLayout(false);
  3007. }
  3008. #endregion
  3009. /// <summary>
  3010. /// 画布绘制
  3011. /// </summary>
  3012. /// <param name="sender"></param>
  3013. /// <param name="e"></param>
  3014. private void Panel_Paint(object sender, PaintEventArgs e)
  3015. {
  3016. if (this.documentWorkspace.CompositionSurface != null)
  3017. {
  3018. //
  3019. // 以下是计算绘制图片的位置和大小并绘制图片
  3020. //
  3021. Rectangle rc = this.documentWorkspace.panel.ClientRectangle;
  3022. int width = (int)(this.documentWorkspace.CompositionSurface.Width * this.documentWorkspace.ScaleFactor.Ratio);
  3023. int height = (int)(this.documentWorkspace.CompositionSurface.Height * this.documentWorkspace.ScaleFactor.Ratio);
  3024. int x = (rc.Width < width) ? this.documentWorkspace.panel.AutoScrollPosition.X : (rc.Width - width) / 2;
  3025. int y = (rc.Height < height) ? this.documentWorkspace.panel.AutoScrollPosition.Y : (rc.Height - height) / 2;
  3026. //
  3027. // 以下是绘制网格、标注、测量、视场等开始
  3028. //
  3029. e.Graphics.TranslateTransform(x, y);
  3030. e.Graphics.ScaleTransform((float)this.documentWorkspace.ScaleFactor.Ratio, (float)this.documentWorkspace.ScaleFactor.Ratio);
  3031. Draw(e.Graphics);
  3032. if (this.dataGridView1.SelectedRows.Count == 0)
  3033. return;
  3034. string tag = this.imageList1.Images.Keys[this.listView1.SelectedItems[0].Index] + "|" + this.dataGridView1.SelectedRows[0].Cells[0].Value.ToString().Replace("相", string.Empty);
  3035. //保存处理后的图片
  3036. double pantographRatio = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetRulerMultiple(MeasurementUnit.Micron);//标尺*放大倍数
  3037. List<Bitmap> tempBit = new List<Bitmap>();
  3038. Bitmap originalBit = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].CompositionSurface.CreateAliasedBitmap();
  3039. originalBit.Tag = pantographRatio;
  3040. tempBit.Add(originalBit);
  3041. Graphics graphics;
  3042. Bitmap newBit;
  3043. Bitmap processedBit;
  3044. if (this.documentItems[this.listView1.FocusedItem.Index].phaseModels.Count != 0
  3045. && this.documentItems[this.listView1.FocusedItem.Index].phaseModels[0].mat != null)
  3046. {
  3047. processedBit = BitmapConverter.ToBitmap(this.documentWorkspace.PhaseModels[0].mat);
  3048. newBit = originalBit.Clone(new Rectangle(0, 0, originalBit.Width, originalBit.Height), originalBit.PixelFormat);
  3049. graphics = Graphics.FromImage(newBit);
  3050. graphics.DrawImage(processedBit, new PointF(0, 0));
  3051. Draw(graphics);
  3052. newBit.Tag = pantographRatio;
  3053. tempBit.Add(newBit);
  3054. }
  3055. else
  3056. {
  3057. newBit = originalBit.Clone(new Rectangle(0, 0, originalBit.Width, originalBit.Height), originalBit.PixelFormat);
  3058. graphics = Graphics.FromImage(newBit);
  3059. Draw(graphics);
  3060. newBit.Tag = pantographRatio;
  3061. tempBit.Add(newBit);
  3062. }
  3063. if (bitDic1.ContainsKey(tag))
  3064. bitDic1[tag] = tempBit;
  3065. e.Graphics.ScaleTransform(1 / (float)this.documentWorkspace.ScaleFactor.Ratio, 1 / (float)this.documentWorkspace.ScaleFactor.Ratio);
  3066. e.Graphics.TranslateTransform(-x, -y);
  3067. }
  3068. }
  3069. private void getValue(string key, Object value)
  3070. {
  3071. switch (key)
  3072. {
  3073. case "parameter1":
  3074. rb_LeftCircle.Checked = (int)value == 1 ? true : false;
  3075. rb_LeftSquare.Checked = (int)value == 1 ? false : true;
  3076. break;
  3077. case "parameter2":
  3078. rb_leftFill.Checked = (int)value == 1 ? true : false;
  3079. rb_leftNoFill.Checked = (int)value == 1 ? false : true;
  3080. break;
  3081. case "parameter3":
  3082. numericUpDown2.Value = Convert.ToDecimal(value);
  3083. break;
  3084. case "parameter4":
  3085. numericUpDown3.Value = Convert.ToDecimal(value);
  3086. break;
  3087. case "parameter5":
  3088. panel1.BackColor = Color.FromArgb((int)value);
  3089. break;
  3090. case "parameter6":
  3091. numericUpDown4.Value = Convert.ToDecimal(value);
  3092. break;
  3093. case "parameter7":
  3094. numericUpDown5.Value = Convert.ToDecimal(value);
  3095. break;
  3096. case "parameter8":
  3097. panel2.BackColor = Color.FromArgb((int)value);
  3098. break;
  3099. case "parameter10":
  3100. rb_RightCircle.Checked = (int)value == 1 ? true : false;
  3101. rb_RightSquare.Checked = (int)value == 1 ? false : true;
  3102. break;
  3103. case "parameter11":
  3104. rb_RightFill.Checked = (int)value == 1 ? true : false;
  3105. rb_RightNoFill.Checked = (int)value == 1 ? false : true;
  3106. break;
  3107. case "OpenWhileExportReport":
  3108. checkBox1.Checked = Convert.ToBoolean(value);
  3109. break;
  3110. case "CalculatorDecimalDigits":
  3111. numericUpDown1.Value = Convert.ToDecimal(value);
  3112. break;
  3113. }
  3114. }
  3115. #region [脚本录制]
  3116. private void getScriptRecording()
  3117. {
  3118. string className = InvariantData.path_Action + ".Action" + menuId;
  3119. ParamObject param = (ParamObject)System.Reflection.Assembly.Load(InvariantData.assembly_Data).CreateInstance(className);
  3120. List<Args> args = param.Lists;
  3121. foreach (var item in args)
  3122. {
  3123. item.value = setScriptRecording(item.key);
  3124. }
  3125. appWorkspace.SetScriptStartRecording(this.menuId, menuName, args);
  3126. }
  3127. private object setScriptRecording(string key)
  3128. {
  3129. object value = null;
  3130. switch (key)
  3131. {
  3132. case "parameter1":
  3133. value = rb_LeftCircle.Checked ? 1 : 2;
  3134. break;
  3135. case "parameter2":
  3136. value = rb_leftFill.Checked ? 1 : 2;
  3137. break;
  3138. case "parameter3":
  3139. value = numericUpDown2.Value;
  3140. break;
  3141. case "parameter4":
  3142. value = numericUpDown3.Value;
  3143. break;
  3144. case "parameter5":
  3145. value = panel1.BackColor.ToArgb();
  3146. break;
  3147. case "parameter6":
  3148. value = numericUpDown4.Value;
  3149. break;
  3150. case "parameter7":
  3151. value = numericUpDown5.Value;
  3152. break;
  3153. case "parameter8":
  3154. value = panel2.BackColor.ToArgb();
  3155. break;
  3156. case "parameter10":
  3157. value = rb_RightCircle.Checked ? 1 : 2;
  3158. break;
  3159. case "parameter11":
  3160. value = rb_RightFill.Checked ? 1 : 2;
  3161. break;
  3162. case "OpenWhileExportReport":
  3163. value = checkBox1.Checked;
  3164. break;
  3165. case "CalculatorDecimalDigits":
  3166. value = numericUpDown1.Value;
  3167. break;
  3168. }
  3169. return value;
  3170. }
  3171. #endregion
  3172. }
  3173. }