CountNumberAnalysisDialog.cs 157 KB

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