BatteryPrimaryDialog.cs 67 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773
  1. using OpenCvSharp;
  2. using PaintDotNet.Annotation;
  3. using PaintDotNet.Annotation.Enum;
  4. using PaintDotNet.Base.CommTool;
  5. using PaintDotNet.Base.Functionodel;
  6. using PaintDotNet.Base.SettingModel;
  7. using PaintDotNet.CustomControl;
  8. using PaintDotNet.DbOpreate.DbBll;
  9. using PaintDotNet.DbOpreate.DbModel;
  10. using System;
  11. using System.Collections;
  12. using System.Collections.Generic;
  13. using System.ComponentModel;
  14. using System.Configuration;
  15. using System.Data;
  16. using System.Drawing;
  17. using System.Drawing.Drawing2D;
  18. using System.IO;
  19. using System.Linq;
  20. using System.Text;
  21. using System.Windows.Forms;
  22. namespace PaintDotNet.DedicatedAnalysis.Battery
  23. {
  24. internal partial class BatteryPrimaryDialog : PdnBaseForm
  25. {
  26. #region 属性
  27. //二值化集成1
  28. BinaryClassForB binaryClass;
  29. private int menuId;
  30. /// <summary>
  31. /// 选中图片的bitmap
  32. /// </summary>
  33. private Bitmap bitmap;
  34. /// <summary>
  35. /// 存在视场标记
  36. /// </summary>
  37. private bool existViewFlag = false;
  38. private int changeCount;
  39. /// <summary>
  40. /// 主空间
  41. /// </summary>
  42. private AppWorkspace appWorkspace;
  43. /// <summary>
  44. /// 图像面板
  45. /// </summary>
  46. private DocumentWorkspaceWindow documentWorkspace;
  47. /// <summary>
  48. /// 公共控件
  49. /// </summary>
  50. private GeneralAnalysisCommonControlButtons commonControlButtons;
  51. /// <summary>
  52. /// 图片测量记录
  53. /// </summary>
  54. private List<DataTable> pictureDataTables = new List<DataTable>();
  55. /// <summary>
  56. /// 网格Xml
  57. /// </summary>
  58. private GrainSizePointCountingMethodModel grainSizePointCountingMethodModel;
  59. /// <summary>
  60. /// 数据变化
  61. /// </summary>
  62. private bool saveSuccess = false;
  63. private BinaryControlSmaller bc;
  64. #endregion 属性
  65. #region 数据属性
  66. /// <summary>
  67. /// 折线点的集合
  68. /// </summary>
  69. public List<System.Drawing.Point> pointArray = new List<System.Drawing.Point>();
  70. /// <summary>
  71. /// 存储所有轮廓线的点集合
  72. /// </summary>
  73. private List<PointF> pointList = new List<PointF>();
  74. /// <summary>
  75. /// 存储所有轮廓线集合
  76. /// </summary>
  77. private List<List<PointF>> lineList = new List<List<PointF>>();
  78. /// <summary>
  79. /// 存储所有增加颗粒的点集合
  80. /// </summary>
  81. private List<PointF> kongPointList = new List<PointF>();
  82. /// <summary>
  83. /// 存储所有孔隙线集合
  84. /// </summary>
  85. private List<List<PointF>> kongLineList = new List<List<PointF>>();
  86. /// <summary>
  87. /// 存储所有删除孔隙线的点集合
  88. /// </summary>
  89. private List<PointF> delPointList = new List<PointF>();
  90. /// <summary>
  91. /// 存储所有删除孔隙线集合
  92. /// </summary>
  93. private List<List<PointF>> delLineList = new List<List<PointF>>();
  94. //轮廓修改状态
  95. bool isLunKuo = false;
  96. //添加孔隙状态
  97. bool isAddKong = false;
  98. //删除孔隙状态
  99. bool isDelKong = false;
  100. /// <summary>
  101. /// 0:添加 1:选择 2:删除
  102. /// </summary>
  103. private int operationK = -1;
  104. /// <summary>
  105. /// 被选择的线
  106. /// </summary>
  107. private int selected = -1;
  108. /// <summary>
  109. /// 起止点
  110. /// </summary>
  111. private System.Drawing.PointF startPoint, endPoint;
  112. /// <summary>
  113. /// 存储所有线的点集合
  114. /// </summary>
  115. private List<PointF[]> pointList1 = new List<PointF[]>();
  116. /// <summary>
  117. /// 存储当前线的点集合
  118. /// </summary>
  119. private PointF[] nowLine;
  120. /// <summary>
  121. /// 辅助计算偏移量-移动线两端的点
  122. /// </summary>
  123. private PointF lastPoint = new PointF(0, 0);
  124. /// <summary>
  125. /// 辅助计算偏移量-移动线中间的点
  126. /// </summary>
  127. private PointF tempPoint = new PointF(0, 0);
  128. /// <summary>
  129. /// 判断图形是否可移动
  130. /// </summary>
  131. private bool canMove = false;
  132. /// <summary>
  133. /// 测量点
  134. /// </summary>
  135. public List<RectangleF> rectangleFList = new List<RectangleF>();
  136. /// <summary>
  137. /// 移动线上的哪一个点
  138. /// </summary>
  139. private int movePointIndex = -1;
  140. /// <summary>
  141. /// 线的总数
  142. /// </summary>
  143. private int lineCount = 0;
  144. /// <summary>
  145. /// 单位标尺
  146. /// </summary>
  147. private double unitLength = 1;
  148. #endregion
  149. System.Windows.Forms.DataVisualization.Charting.Chart chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart();
  150. /// <summary>
  151. ///
  152. /// </summary>
  153. /// <param name="appWorkspace"></param>
  154. public BatteryPrimaryDialog(AppWorkspace appWorkspace, int menuId)
  155. {
  156. this.KeyPreview = true;
  157. this.KeyDown += OnKeyDown;
  158. this.menuId = menuId;
  159. binaryClass = new BinaryClassForB(menuId);
  160. InitializeComponent();
  161. InitializeLanguageText();
  162. ColumnHeader header0 = new ColumnHeader();
  163. header0.Text = "";
  164. header0.Width = 180;
  165. this.appWorkspace = appWorkspace;
  166. this.documentWorkspace = new DocumentWorkspaceWindow(appWorkspace);
  167. this.documentWorkspace.Dock = DockStyle.Fill;
  168. this.documentWorkspace.HookMouseEvents();
  169. this.documentWorkspace.AuxiliaryLineEnabled = false;
  170. this.documentWorkspace.Visible = false;
  171. this.documentWorkspace.panel.Paint += Panel_Paint;
  172. this.documentWorkspace.panel.MouseDown += OnMouseDown;
  173. this.documentWorkspace.panel.MouseUp += OnMouseUp;
  174. this.documentWorkspace.panel.Paint += Panel_Paint;
  175. this.documentWorkspace.panel.MouseMove += onMouseMove;
  176. this.documentWorkspace.activeTool = DrawToolType.Pointer;
  177. this.groupBox7.Controls.Add(this.documentWorkspace);
  178. this.commonControlButtons = new GeneralAnalysisCommonControlButtons();
  179. this.commonControlButtons.Dock = DockStyle.Top;
  180. this.commonControlButtons.Height = 30;
  181. this.commonControlButtons.HideZoomToWindowAndActualSize();
  182. this.commonControlButtons.trackLabel.Text = "单击开始画线,右键停止。";
  183. this.commonControlButtons.trackLabel.Visible = true;
  184. this.commonControlButtons.trackLabel.Width = 300;
  185. this.commonControlButtons.Visible = false;
  186. this.groupBox7.Controls.Add(commonControlButtons);
  187. //获取
  188. //Startup.instance.rules.TryGetValue(MeasurementUnit.Micron, out ruleValue);
  189. //double ruleValue = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetRuler(MeasurementUnit.Micron);
  190. ////double physical_area_length_Micron = getCurrentWorkspace().GetRuler(MeasurementUnit.Micron);
  191. chart1.Size = new System.Drawing.Size(1150, 180);
  192. chart1.Location = new System.Drawing.Point(5, 15);
  193. //二值化集成2
  194. bc.OriginCheckedChangedAction += new EventHandler(this.bcOriginCheckedChanged);//初始化原图勾选改变事件
  195. binaryClass.imageType = 6;
  196. binaryClass.createDocumentItemsSmaller(new string[] { "bp1" }, this.bc, this.appWorkspace, this.documentWorkspace, this.listView1);//初始化相的工作结构
  197. //binaryClass.BinaryImplFinishAction += new EventHandler(this.bClassBinaryImplFinishAction);//二值化后续处理事件(参数改变时,重新处理图像)
  198. binaryClass.parentPrimary = this;
  199. this.ckChanged.CheckedChanged += new EventHandler(this.CheckedChanged);
  200. InitCommonButtonEvent();
  201. InitGridStyle();
  202. InitPicList();
  203. // SetAnalyzeModelFromXml(getModelName());
  204. }
  205. private void ShowImgEvent(object sender, EventArgs e)
  206. {
  207. if (this.listView1.Items.Count == 0)
  208. {
  209. return;
  210. }
  211. listView1.Focus();
  212. this.listView1.Items[0].Focused = true;
  213. this.listView1.Items[0].Selected = true;
  214. }
  215. #region 二值化相关方法
  216. private void InclusionsStandardDialog_FormClosing(object sender, FormClosingEventArgs e)
  217. {
  218. //binaryClass.saveParams();
  219. }
  220. private void ShownChoiseItemAndInitData(object sender, EventArgs e)
  221. {
  222. binaryClass.RefreshHistogramControl1Values();
  223. }
  224. /// <summary>
  225. /// 添加参数改变的监听
  226. /// </summary>
  227. /// <param name="sender"></param>
  228. /// <param name="e"></param>
  229. private void GrainSizePointCountingMethodDialog_Load(object sender, EventArgs e)
  230. {
  231. this.dataGridView1.SortCompare += DataGridView4_SortCompare;
  232. this.binaryClass.loadParams();
  233. }
  234. private bool bcBinaryChecked()
  235. {
  236. return bc != null && bc.BinaryChecked;
  237. }
  238. private bool bcOriginChecked()
  239. {
  240. return bc != null && bc.OriginChecked;
  241. }
  242. /// <summary>
  243. /// 显示原图/原图+二值图
  244. /// </summary>
  245. /// <param name="sender"></param>
  246. /// <param name="e"></param>
  247. private void bcOriginCheckedChanged(object sender, EventArgs e)
  248. {
  249. if (!bcOriginChecked())
  250. {
  251. if (bcBinaryChecked())
  252. this.documentWorkspace.PhaseModels[0].choise = true;
  253. }
  254. else
  255. this.documentWorkspace.PhaseModels[0].choise = false;
  256. this.documentWorkspace.Refresh();
  257. }
  258. /// <summary>
  259. /// 显示原图/原图+二值图
  260. /// </summary>
  261. /// <param name="sender"></param>
  262. /// <param name="e"></param>
  263. private void CheckedChanged(object sender, EventArgs e)
  264. {
  265. if (!ckChanged.Checked)
  266. {
  267. this.documentWorkspace.PhaseModels[0].choise = true;
  268. }
  269. else
  270. this.documentWorkspace.PhaseModels[0].choise = false;
  271. this.documentWorkspace.Refresh();
  272. }
  273. #endregion
  274. /// <summary>
  275. /// 初始化画面数据
  276. /// </summary>
  277. private void InitGridStyle()
  278. {
  279. grainSizePointCountingMethodModel = XmlSerializeHelper.DESerializer<GrainSizePointCountingMethodModel>(FileOperationHelper.ReadStringFromFile(Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\GrainSizePointCountingMethodModel.xml", FileMode.Open));
  280. if (grainSizePointCountingMethodModel.GridStyleList != null)
  281. {
  282. ArrayList arrayList = new ArrayList();
  283. foreach (var GridStyle in grainSizePointCountingMethodModel.GridStyleList)
  284. {
  285. arrayList.Add(GridStyle.gridName);
  286. }
  287. if (grainSizePointCountingMethodModel.GridStyleList.Count == 0)
  288. {
  289. }
  290. }
  291. }
  292. /// <summary>
  293. /// 初始化图片列表数据
  294. /// </summary>
  295. public void InitPicList()
  296. {
  297. //初始化图片列表
  298. for (int i = 0; i < this.appWorkspace.DocumentWorkspaces.Length; i++)
  299. {
  300. this.imageList1.Images.Add("img" + i, this.appWorkspace.DocumentWorkspaces[i].BinarizationThumbnail);
  301. this.listView1.Items.Add("", i);
  302. this.listView1.Items[i].ImageIndex = i;
  303. this.listView1.Items[i].Text = this.appWorkspace.DocumentWorkspaces[i].GetFriendlyName();
  304. this.listView1.Items[i].Name = this.appWorkspace.DocumentWorkspaces[i].GetFriendlyName();
  305. }
  306. this.Shown += ShowImgEvent;
  307. }
  308. #region 初始化
  309. private void InitializeLanguageText()
  310. {
  311. this.bc = new PaintDotNet.CustomControl.BinaryControlSmaller();
  312. //
  313. // bc
  314. //
  315. this.bc.BinaryBackColor = System.Drawing.Color.Red;
  316. this.bc.BinaryChecked = false;
  317. this.bc.BinaryStyle = 1;
  318. this.bc.Location = new System.Drawing.Point(152, 7);
  319. this.bc.Name = "bc";
  320. this.bc.OriginChecked = false;
  321. this.bc.scope1End = 170D;
  322. this.bc.scope1Start = 80D;
  323. this.bc.scope2End = 0D;
  324. this.bc.scope2Start = 0D;
  325. this.bc.scope3End = 0D;
  326. this.bc.scope3Start = 0D;
  327. this.bc.Size = new System.Drawing.Size(360, 247);
  328. this.bc.TabIndex = 3;
  329. // this.Controls.Add(this.bc);
  330. // this.Controls.SetChildIndex(this.bc, 0);
  331. //this.groupBox9.Controls.Add(chart1);
  332. this.groupBox8.Controls.Add(chart1);
  333. chart1.Visible = false;
  334. //this.label10.Visible = true;
  335. //this.label10.Text = "【" + tn.Name + "】图";
  336. chart1.Titles.Add("单晶尺寸分布图");
  337. }
  338. #endregion
  339. #region 公共按钮
  340. private void InitCommonButtonEvent()
  341. {
  342. this.commonControlButtons.zoomInButton.Click += new EventHandler(zoomInButton_Click);
  343. this.commonControlButtons.zoomOutButton.Click += new EventHandler(zoomOutButton_Click);
  344. this.commonControlButtons.zoomToWindowButton.Click += new EventHandler(zoomToWindowButton_Click);
  345. this.commonControlButtons.actualSizeButton.Click += new EventHandler(actualSizeButton_Click);
  346. this.commonControlButtons.pointerButton.Click += new EventHandler(pointerButton_Click);
  347. this.commonControlButtons.mobileModeButton.Click += new EventHandler(mobileModeButton_Click);
  348. }
  349. private void zoomInButton_Click(object sender, EventArgs e)
  350. {
  351. this.documentWorkspace.ZoomIn();
  352. }
  353. private void zoomOutButton_Click(object sender, EventArgs e)
  354. {
  355. this.documentWorkspace.ZoomOut();
  356. }
  357. private void zoomToWindowButton_Click(object sender, EventArgs e)
  358. {
  359. this.documentWorkspace.ZoomBasis = ZoomBasis.FitToWindow;
  360. }
  361. private void actualSizeButton_Click(object sender, EventArgs e)
  362. {
  363. this.documentWorkspace.ZoomBasis = ZoomBasis.ScaleFactor;
  364. this.documentWorkspace.ScaleFactor = ScaleFactor.OneToOne;
  365. }
  366. private void pointerButton_Click(object sender, EventArgs e)
  367. {
  368. this.documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.Pointer;
  369. }
  370. private void mobileModeButton_Click(object sender, EventArgs e)
  371. {
  372. this.documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.MoveMode;
  373. }
  374. #endregion
  375. private void listView1_MouseDown(object sender, MouseEventArgs e)
  376. {
  377. this.changeCount = 0;
  378. }
  379. private void DataGridView4_SortCompare(object sender, DataGridViewSortCompareEventArgs e)
  380. {
  381. // 如果是数据的列,则按浮点数处理
  382. if (e.Column.Index > 1)//###20186
  383. {
  384. e.SortResult = (Convert.ToDouble(e.CellValue1) - Convert.ToDouble(e.CellValue2) > 0) ? 1 : (Convert.ToDouble(e.CellValue1) - Convert.ToDouble(e.CellValue2) < 0) ? -1 : 0;
  385. }
  386. //否则,按字符串比较
  387. else
  388. {
  389. e.SortResult = System.String.Compare(Convert.ToString(e.CellValue1), Convert.ToString(e.CellValue2));
  390. }
  391. e.Handled = true;//不能省掉,不然没效果
  392. }
  393. private void listView1_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
  394. {
  395. if (unitLength == 1)
  396. unitLength = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetRuler(MeasurementUnit.Micron);
  397. this.changeCount++;
  398. }
  399. /// <summary>
  400. /// 切换图片
  401. /// </summary>
  402. /// <param name="sender"></param>
  403. /// <param name="e"></param>
  404. private void listView1_SelectedIndexChanged(object sender, EventArgs e)
  405. {
  406. SelectedIndexChanged();
  407. }
  408. List<PointF> list = new List<PointF>();
  409. /// <summary>
  410. /// 切换图片
  411. /// </summary>
  412. private void SelectedIndexChanged()
  413. {
  414. if (this.listView1.FocusedItem != null && this.listView1.FocusedItem.Selected)
  415. {
  416. existViewFlag = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GraphicsList.IsExsitView();
  417. this.bitmap = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].CompositionSurface.CreateAliasedBitmap();
  418. lineList.Clear();
  419. pointList.Clear();
  420. kongLineList.Clear();
  421. kongPointList.Clear();
  422. delLineList.Clear();
  423. delPointList.Clear();
  424. isLunKuo = false;
  425. isAddKong = false;
  426. isDelKong = false;
  427. this.documentWorkspace.Refresh();
  428. this.dataGridView1.Rows.Clear();
  429. this.dataGridView2.Rows.Clear();
  430. Init();
  431. this.documentWorkspace.GridRectangleEnabled = false;
  432. //getimage();
  433. //getbian(bitmap);
  434. double minpoint = Convert.ToDouble(numericUpDown11.Value);
  435. if (!ckMin.Checked)
  436. minpoint = 0.01;
  437. binaryClass.pointsize = Convert.ToDouble(minpoint);
  438. int border = Convert.ToInt32(numericMax.Value);
  439. if (!ckMax.Checked)
  440. border = 0;
  441. binaryClass.border = border;
  442. double HW = Convert.ToDouble(numericHW.Value);
  443. if (!ckHW.Checked)
  444. HW = 100;
  445. binaryClass.HW = HW;
  446. double AreaRatio = Convert.ToDouble(numericArea.Value);
  447. if (!ckArea.Checked)
  448. AreaRatio = 0.01;
  449. binaryClass.AreaRatio = AreaRatio;
  450. //二值化集成4
  451. binaryClass.listView1_SelectedIndexChanged(this.bitmap);
  452. // binaryClass.bcDefault();
  453. this.documentWorkspace.Refresh();
  454. }
  455. }
  456. #region 原始事件
  457. private void Init()
  458. {
  459. this.commonControlButtons.Visible = true;
  460. this.dataGridView1.Rows.Clear();
  461. this.documentWorkspace.phaseModels.Clear();
  462. }
  463. /// <summary>
  464. /// 画布绘制
  465. /// </summary>
  466. /// <param name="sender"></param>
  467. /// <param name="e"></param>
  468. private void Panel_Paint(object sender, PaintEventArgs e)
  469. {
  470. if (this.documentWorkspace.CompositionSurface != null)
  471. {
  472. //
  473. // 以下是计算绘制图片的位置和大小并绘制图片
  474. //
  475. Rectangle rc = this.documentWorkspace.panel.ClientRectangle;
  476. int width = (int)(this.documentWorkspace.CompositionSurface.Width * this.documentWorkspace.ScaleFactor.Ratio);
  477. int height = (int)(this.documentWorkspace.CompositionSurface.Height * this.documentWorkspace.ScaleFactor.Ratio);
  478. int x = (rc.Width < width) ? this.documentWorkspace.panel.AutoScrollPosition.X : (rc.Width - width) / 2;
  479. int y = (rc.Height < height) ? this.documentWorkspace.panel.AutoScrollPosition.Y : (rc.Height - height) / 2;
  480. //if (pointArray.Count > 1)
  481. //{
  482. // e.Graphics.DrawLines(new Pen(Color.FromArgb(0, 0, 0), 2), pointArray.ToArray());
  483. //}
  484. //
  485. // 以下是绘制网格、标注、测量、视场等开始
  486. //
  487. e.Graphics.TranslateTransform(x, y);
  488. e.Graphics.ScaleTransform((float)this.documentWorkspace.ScaleFactor.Ratio, (float)this.documentWorkspace.ScaleFactor.Ratio);
  489. Draw(e.Graphics);
  490. //e.Graphics.DrawLines(new Pen(this.panel1.BackColor, Convert.ToInt32(this.txt_LeftLineWeight.Text)), list.ToArray());
  491. e.Graphics.ScaleTransform(1 / (float)this.documentWorkspace.ScaleFactor.Ratio, 1 / (float)this.documentWorkspace.ScaleFactor.Ratio);
  492. e.Graphics.TranslateTransform(-x, -y);
  493. }
  494. if (bc.isedit)
  495. {
  496. bc.isedit = false;
  497. List<List<int>> CircleDate = bc.data;
  498. bindGrid(CircleDate);
  499. }
  500. }
  501. // <summary>
  502. /// 存储字号与颜色字典
  503. /// </summary>
  504. public Dictionary<string, Color> colourFont = new Dictionary<string, Color>() { { "20", Color.White } };
  505. /// <summary>
  506. /// 绘制
  507. /// </summary>
  508. private void Draw(Graphics graphics)
  509. {
  510. //轮廓手动干预线
  511. if (lineList.Count > 0)
  512. {
  513. for (int i = 0; i < lineList.Count; i++)
  514. {
  515. graphics.DrawLines(new Pen(Color.FromArgb(255, 0, 255), 2), lineList[i].ToArray());
  516. }
  517. }
  518. if (pointList.Count > 1)
  519. {
  520. graphics.DrawLines(new Pen(Color.FromArgb(255, 0, 255), 2), pointList.ToArray());
  521. }
  522. //添加颗粒
  523. Color color = bc.BinaryBackColor;
  524. if (kongLineList.Count > 0)
  525. {
  526. for (int i = 0; i < kongLineList.Count; i++)
  527. {
  528. if (kongLineList[i].Count > 1)
  529. {
  530. graphics.DrawLines(new Pen(color, 2), kongLineList[i].ToArray());
  531. }
  532. }
  533. }
  534. graphics.SmoothingMode = SmoothingMode.AntiAlias;
  535. Pen standardPen = new Pen(Color.FromArgb(0, 255, 0), 4);//基准线画笔
  536. Pen surfacePen = new Pen(Color.FromArgb(255, 0, 0), 4);//钢样表面画笔
  537. Pen completePen = new Pen(Color.FromArgb(0, 0, 255), 4);//完全脱碳层画笔
  538. Pen validPen = new Pen(Color.FromArgb(255, 255, 255), 4);//有效脱碳层画笔
  539. Pen partPen = new Pen(Color.FromArgb(0, 0, 0), 2);//部分脱碳层画笔
  540. Pen borderPen = new Pen(Color.Black);//填充点外圈
  541. SolidBrush insideBrush = new SolidBrush(Color.White);//填充点内圈
  542. Pen rectPen = new Pen(Color.Black);
  543. rectPen.DashStyle = DashStyle.Custom;
  544. float[] dashArray = { 2.0f, 3.0f };
  545. rectPen.DashPattern = dashArray;
  546. if (pointList1.Count > 0)
  547. {
  548. foreach (PointF[] pointFs in pointList1)
  549. {
  550. PointF[] pf = pointFs;
  551. if (pointFs.Count() > 1 && pointFs[0] != pointFs[1])
  552. {
  553. float lineLength = 12;
  554. double angle = Math.Round(BasicCalculationHelper.AngleText(pointFs[0], pointFs[1], new PointF(pointFs[0].X + lineLength, pointFs[0].Y)), 10);
  555. //判断第二个点相对于第一个点的象限
  556. int x2 = (int)(pointFs[1].X - pointFs[0].X);
  557. if (x2 == 0)
  558. x2 = 1;
  559. int y2 = (int)(pointFs[1].Y - pointFs[0].Y);
  560. if (y2 == 0)
  561. y2 = 1;
  562. int i2 = 0;
  563. if (x2 > 0 && y2 > 0) //第4象限
  564. {
  565. i2 = 4;
  566. }
  567. else if (x2 > 0 && y2 < 0) //第1象限
  568. {
  569. i2 = 1;
  570. }
  571. else if (x2 < 0 && y2 < 0) //第2象限
  572. {
  573. i2 = 2;
  574. }
  575. else if (x2 < 0 && y2 > 0) //第3象限
  576. {
  577. i2 = 3;
  578. }
  579. double sAngle1;
  580. double eAngle1;
  581. double sAngle2;
  582. double eAngle2;
  583. if (i2 == 1 || i2 == 2)
  584. {
  585. sAngle1 = 360 - angle;
  586. eAngle1 = 180 - angle;
  587. sAngle2 = 270 - angle;
  588. eAngle2 = 90 - angle;
  589. }
  590. else
  591. {
  592. sAngle1 = angle;
  593. eAngle1 = 180 + angle;
  594. sAngle2 = 270 + angle;
  595. eAngle2 = 90 + angle;
  596. }
  597. graphics.DrawLine(standardPen, pointFs[0], pointFs[1]);
  598. if (!double.IsNaN(sAngle1) && !double.IsNaN(eAngle1) && !double.IsNaN(sAngle2) && !double.IsNaN(eAngle2))
  599. {
  600. PointF assistPoint1 = BasicCalculationHelper.GetAnglePoint(new PointF((pointFs[0].X + lineLength), pointFs[0].Y), pointFs[0], sAngle2);
  601. PointF assistPoint2 = BasicCalculationHelper.GetAnglePoint(new PointF((pointFs[0].X + lineLength), pointFs[0].Y), pointFs[0], eAngle2);
  602. PointF assistPoint3 = BasicCalculationHelper.GetAnglePoint(new PointF((pointFs[1].X + lineLength), pointFs[1].Y), pointFs[1], sAngle2);
  603. PointF assistPoint4 = BasicCalculationHelper.GetAnglePoint(new PointF((pointFs[1].X + lineLength), pointFs[1].Y), pointFs[1], eAngle2);
  604. graphics.DrawLine(surfacePen, assistPoint1, assistPoint2);
  605. graphics.DrawLine(partPen, assistPoint3, assistPoint4);
  606. //PointF[] pf = pointFs;
  607. if (i2 == 1 || i2 == 2)
  608. {
  609. graphics.DrawString(Math.Round((BasicCalculationHelper.GetDistance(pf[1], pf[0], 4) * unitLength), 2).ToString(), new Font("宋体", float.Parse(colourFont.Keys.First()), System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))), new SolidBrush(colourFont.Values.First()), assistPoint4.X, assistPoint4.Y - 10);
  610. }
  611. else
  612. {
  613. graphics.DrawString(Math.Round((BasicCalculationHelper.GetDistance(pf[1], pf[0], 4) * unitLength), 2).ToString(), new Font("宋体", float.Parse(colourFont.Keys.First()), System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))), new SolidBrush(colourFont.Values.First()), assistPoint3.X, assistPoint3.Y - 10);
  614. }
  615. }
  616. }
  617. }
  618. if (selected > -1)
  619. {
  620. int tempLess = (int)(InvariantData.rectless * (this.documentWorkspace.ScaleFactor.Ratio < 1 ? 1 / this.documentWorkspace.ScaleFactor.Ratio : 1));
  621. int tempPlus = (int)(InvariantData.rectplus * (this.documentWorkspace.ScaleFactor.Ratio < 1 ? 1 / this.documentWorkspace.ScaleFactor.Ratio : 1));
  622. graphics.DrawRectangle(borderPen, new Rectangle((int)(pointList1[selected][0].X - tempLess), (int)(pointList1[selected][0].Y - tempLess), tempPlus, tempPlus));
  623. graphics.FillRectangle(insideBrush, new RectangleF(pointList1[selected][0].X - tempLess, pointList1[selected][0].Y - tempLess, tempPlus, tempPlus));
  624. graphics.DrawRectangle(borderPen, new Rectangle((int)(pointList1[selected][1].X - tempLess), (int)(pointList1[selected][1].Y - tempLess), tempPlus, tempPlus));
  625. graphics.FillRectangle(insideBrush, new RectangleF(pointList1[selected][1].X - tempLess, pointList1[selected][1].Y - tempLess, tempPlus, tempPlus));
  626. graphics.DrawRectangle(rectPen, rectangleFList[selected].X, rectangleFList[selected].Y, rectangleFList[selected].Width, rectangleFList[selected].Height);
  627. }
  628. }
  629. standardPen.Dispose();
  630. surfacePen.Dispose();
  631. completePen.Dispose();
  632. validPen.Dispose();
  633. partPen.Dispose();
  634. borderPen.Dispose();
  635. insideBrush.Dispose();
  636. rectPen.Dispose();
  637. }
  638. //最长直径
  639. double MaxM = 0;
  640. double MinM = 0;
  641. double MeanM = 0;
  642. private void bindGrid(List<List<int>> dataList)
  643. {
  644. if (dataList.Count < 1)
  645. {
  646. return;
  647. }
  648. chart1.Visible = true;
  649. List<int> CircleDate = dataList[0];
  650. //标尺 微米/像素
  651. double d = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetRuler(MeasurementUnit.Micron);
  652. dataGridView1.Rows.Clear();
  653. dataGridView2.Rows.Clear();
  654. chart1.Series.Clear();
  655. chart1.ChartAreas.Clear();
  656. List<Color> colorList = new List<Color>() { Color.FromArgb(255, 0, 0), Color.FromArgb(0, 255, 0), Color.FromArgb(139, 0, 0), Color.FromArgb(128, 0, 128), Color.FromArgb(122, 160, 255) };
  657. List<double> diameterPI = new List<double>() { };
  658. List<double> diameter = new List<double>() { };
  659. List<double> diameterMax = new List<double>() { };
  660. for (int i = 0; i < dataList.Count; i++)
  661. {
  662. int newPo = dataGridView1.Rows.Add();
  663. //序号
  664. dataGridView1.Rows[newPo].Cells[0].Value = (newPo + 1).ToString();
  665. //XY
  666. dataGridView1.Rows[newPo].Cells[1].Value = "X:" + dataList[i][0].ToString() + ",Y:" + dataList[i][1].ToString();
  667. //直径
  668. double w = Convert.ToDouble(dataList[i][2]);
  669. double h = Convert.ToDouble(dataList[i][3]);
  670. double dd = (w + h) * 0.5 * d;
  671. double area = Convert.ToDouble(dataList[i][4]) * d * d;
  672. double r = Math.Sqrt(area / Math.PI) * 2;
  673. diameterPI.Add(r);
  674. diameter.Add(dd);
  675. double maxD = w > h ? w : h;
  676. double minD = w < h ? w : h;
  677. diameterMax.Add(maxD * d);
  678. dataGridView1.Rows[newPo].Cells[2].Value = Math.Round(dd, 2).ToString();
  679. dataGridView1.Rows[newPo].Cells[3].Value = dataList[i][5];
  680. dataGridView1.Rows[newPo].Cells[4].Value = Math.Round(maxD * d, 2).ToString();
  681. dataGridView1.Rows[newPo].Cells[5].Value = Math.Round(minD * d, 2).ToString();
  682. }
  683. diameterMax.Sort();
  684. MinM = diameterMax[0];
  685. MaxM = diameterMax[diameterMax.Count - 1];
  686. foreach (var item in diameterMax)
  687. {
  688. MeanM += Math.Round(item, 1);
  689. }
  690. MeanM = MeanM / diameterMax.Count;
  691. DataTable dt = new DataTable();
  692. dt = CreatTable(diameter, diameterPI);
  693. CreatChart(dt);
  694. diameter.Sort();
  695. double total = 0;
  696. foreach (var item in diameter)
  697. {
  698. total += item;
  699. }
  700. total = total / diameter.Count;
  701. int newRow = dataGridView2.Rows.Add();
  702. dataGridView2.Rows[newRow].Cells[0].Value = (1).ToString();
  703. dataGridView2.Rows[newRow].Cells[1].Value = "平均值";
  704. dataGridView2.Rows[newRow].Cells[2].Value = Math.Round(total, 2).ToString();
  705. int newRow1 = dataGridView2.Rows.Add();
  706. dataGridView2.Rows[newRow1].Cells[0].Value = (2).ToString();
  707. dataGridView2.Rows[newRow1].Cells[1].Value = "最大值";
  708. dataGridView2.Rows[newRow1].Cells[2].Value = Math.Round(diameter[diameter.Count - 1], 2).ToString();
  709. int newRow2 = dataGridView2.Rows.Add();
  710. dataGridView2.Rows[newRow2].Cells[0].Value = (3).ToString();
  711. dataGridView2.Rows[newRow2].Cells[1].Value = "最小值";
  712. dataGridView2.Rows[newRow2].Cells[2].Value = Math.Round(diameter[0], 2).ToString();
  713. int count = diameter.Count;
  714. int d10 = Convert.ToInt32(count * 0.1);
  715. int d50 = Convert.ToInt32(count * 0.5);
  716. int d90 = Convert.ToInt32(count * 0.9);
  717. int newRow3 = dataGridView2.Rows.Add();
  718. dataGridView2.Rows[newRow3].Cells[0].Value = (4).ToString();
  719. dataGridView2.Rows[newRow3].Cells[1].Value = "D10";
  720. dataGridView2.Rows[newRow3].Cells[2].Value = Math.Round(diameter[d10], 2).ToString();
  721. int newRow4 = dataGridView2.Rows.Add();
  722. dataGridView2.Rows[newRow4].Cells[0].Value = (5).ToString();
  723. dataGridView2.Rows[newRow4].Cells[1].Value = "D50";
  724. dataGridView2.Rows[newRow4].Cells[2].Value = Math.Round(diameter[d50], 2).ToString();
  725. int newRow5 = dataGridView2.Rows.Add();
  726. dataGridView2.Rows[newRow5].Cells[0].Value = (5).ToString();
  727. dataGridView2.Rows[newRow5].Cells[1].Value = "D90";
  728. dataGridView2.Rows[newRow5].Cells[2].Value = Math.Round(diameter[d90], 2).ToString();
  729. }
  730. /// <summary>
  731. /// 准备用来处理单个颗粒的选中事件
  732. /// </summary>
  733. /// <param name="sender"></param>
  734. /// <param name="e"></param>
  735. private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
  736. {
  737. //当点击表头部的列时,e.RowIndex==-1
  738. if (e.RowIndex > -1)
  739. {
  740. string selectrow = dataGridView1.Rows[e.RowIndex].Cells[3].Value.ToString();
  741. int x = Convert.ToInt32(selectrow);
  742. binaryClass.DrwCrystalSelected(x);
  743. this.documentWorkspace.Refresh();
  744. }
  745. }
  746. //外接矩形
  747. double MaxP = 0;
  748. double Minp = 0;
  749. double MeanP = 0;
  750. //拟圆直径
  751. double MaxP2 = 0;
  752. double Minp2 = 0;
  753. double MeanP2 = 0;
  754. private DataTable CreatTable(List<double> diameter, List<double> diameterPI)
  755. {
  756. diameter.Sort();
  757. double max = diameter[diameter.Count - 1];
  758. double total = max * 2;
  759. double min = 0;
  760. Minp = diameter[0];
  761. MaxP = diameter[diameter.Count - 1];
  762. diameterPI.Sort();
  763. Minp2 = diameterPI[0];
  764. MaxP2 = diameterPI[diameterPI.Count - 1];
  765. foreach (var item in diameter)
  766. {
  767. MeanP += Math.Round(item, 2);
  768. }
  769. foreach (var item in diameterPI)
  770. {
  771. MeanP2 += Math.Round(item, 2);
  772. }
  773. MeanP = MeanP / diameter.Count;
  774. MeanP2 = MeanP2 / diameterPI.Count;
  775. //int eval =Convert.ToInt32( (max - min) / 20);
  776. double eval = 0.2;
  777. List<double[]> vs = new List<double[]>();
  778. double rightmax = 0;
  779. for (int i = 0; eval * i < max; i++)
  780. {
  781. vs.Add(new double[] { eval * i, eval * (i + 1) });
  782. rightmax = eval * (i + 1);
  783. }
  784. DataTable dt = new DataTable();
  785. dt.Columns.Add("diameter");
  786. dt.Columns.Add("sum");
  787. dt.Columns.Add("sum1");
  788. for (int i = 0; i < vs.Count; i++)
  789. {
  790. DataRow dr;
  791. dr = dt.NewRow();
  792. double low = eval * i;
  793. double hight = eval * (i + 1);
  794. dr["diameter"] = string.Format("{0}", hight);
  795. var emp = diameter.FindAll(e => e > low && e <= hight);
  796. dr["sum"] = emp.Count;
  797. var emp1 = diameterPI.FindAll(e => e > low && e <= hight);
  798. dr["sum1"] = emp1.Count;
  799. dt.Rows.Add(dr);
  800. }
  801. return dt;
  802. }
  803. private void CreatChart(DataTable dt)
  804. {
  805. if (dt == null || dt.Rows.Count == 0)
  806. {
  807. return;
  808. }
  809. chart1.Series.Clear();
  810. chart1.ChartAreas.Clear();
  811. chart1.Legends.Clear();
  812. //定义一个chart
  813. System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
  814. //定义一个绘图区域
  815. System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series();
  816. System.Windows.Forms.DataVisualization.Charting.Legend legend1 = new System.Windows.Forms.DataVisualization.Charting.Legend();
  817. //定义一个绘图区域
  818. System.Windows.Forms.DataVisualization.Charting.Series series2 = new System.Windows.Forms.DataVisualization.Charting.Series();
  819. chartArea1.Name = "ChartArea1";
  820. chart1.Series.Add(series1);
  821. //chart1.Series.Add(series2);
  822. chart1.ChartAreas.Add(chartArea1);
  823. chart1.Legends.Add(legend1);
  824. series1.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Spline;
  825. chart1.Series[0].LegendText = "";
  826. chart1.Series[0].Label = "#VALY";
  827. chart1.Series[0].LabelBackColor = Color.Transparent;
  828. chart1.Series[0].ToolTip = "#VALY";
  829. chart1.Series[0]["PointWidth"] = "0.5";
  830. chart1.Series[0].XValueMember = "diameter";
  831. chart1.Series[0].YValueMembers = "sum";
  832. chart1.Series[0].LegendText = "卡规直径";
  833. //chart1.Series[1].LegendText = "";
  834. //chart1.Series[1].Label = "#VALY";
  835. //chart1.Series[1].LabelBackColor = Color.Transparent;
  836. //chart1.Series[1].ToolTip = "#VALY";
  837. //chart1.Series[1]["PointWidth"] = "0.5";
  838. //chart1.Series[1].XValueMember = "diameter";
  839. //chart1.Series[1].YValueMembers = "sum1";
  840. //chart1.Series[1].LegendText = "拟圆直径";
  841. chart1.ChartAreas[0].AxisX.Interval = 1;
  842. chart1.ChartAreas[0].AxisX.Title = "尺寸(μm)";
  843. chart1.ChartAreas[0].Axes[0].MajorGrid.Enabled = false; //X轴上网格
  844. chart1.ChartAreas[0].Axes[1].MajorGrid.Enabled = false; //y轴上网格
  845. series1.Color = Color.DarkSeaGreen;
  846. series2.Color = Color.PaleTurquoise;
  847. chart1.DataSource = dt;
  848. chart1.DataBind();
  849. }
  850. #region 手动干预
  851. /// <summary>
  852. /// 修改轮廓
  853. /// </summary>
  854. /// <param name="sender"></param>
  855. /// <param name="e"></param>
  856. private void btnLunkuo_Click(object sender, EventArgs e)
  857. {
  858. isLunKuo = true;
  859. isAddKong = false;
  860. isDelKong = false;
  861. operationK = -1;
  862. }
  863. /// <summary>
  864. /// 添加孔隙
  865. /// </summary>
  866. /// <param name="sender"></param>
  867. /// <param name="e"></param>
  868. private void btnAddKong_Click(object sender, EventArgs e)
  869. {
  870. isLunKuo = false;
  871. isAddKong = true;
  872. isDelKong = false;
  873. operationK = -1;
  874. }
  875. /// <summary>
  876. /// 删除孔隙
  877. /// </summary>
  878. /// <param name="sender"></param>
  879. /// <param name="e"></param>
  880. private void btnDelKong_Click(object sender, EventArgs e)
  881. {
  882. isLunKuo = false;
  883. isAddKong = false;
  884. isDelKong = true;
  885. operationK = -1;
  886. }
  887. /// <summary>
  888. /// 重新统计
  889. /// </summary>
  890. /// <param name="sender"></param>
  891. /// <param name="e"></param>
  892. private void btnReDrw_Click(object sender, EventArgs e)
  893. {
  894. double minpoint = Convert.ToDouble(numericUpDown11.Value);
  895. if (!ckMin.Checked)
  896. minpoint = 0.01;
  897. binaryClass.pointsize = minpoint;
  898. int border = Convert.ToInt32(numericMax.Value);
  899. if (!ckMax.Checked)
  900. border = 0;
  901. binaryClass.border = border;
  902. double HW = Convert.ToDouble(numericHW.Value);
  903. if (!ckHW.Checked)
  904. HW = 100;
  905. binaryClass.HW = HW;
  906. double AreaRatio = Convert.ToDouble(numericArea.Value);
  907. if (!ckArea.Checked)
  908. AreaRatio = 0.01;
  909. binaryClass.AreaRatio = AreaRatio;
  910. if (lineList.Count > 0)
  911. {
  912. List<OpenCvSharp.Point> contour = new List<OpenCvSharp.Point>();
  913. for (int i = 0; i < lineList.Count; i++)
  914. {
  915. if (lineList[i].Count > 0)
  916. {
  917. for (int j = 0; j < lineList[i].Count; j++)
  918. {
  919. contour.Add(new OpenCvSharp.Point(lineList[i][j].X, lineList[i][j].Y));
  920. }
  921. }
  922. }
  923. if (contour.Count > 0)
  924. binaryClass.Contour = contour;
  925. }
  926. else
  927. {
  928. binaryClass.Contour = null;
  929. }
  930. List<List<int>> CircleDate = binaryClass.ForgetPrimary(minpoint);
  931. bindGrid(CircleDate);
  932. }
  933. /// <summary>
  934. /// 计算外接矩形
  935. /// </summary>
  936. private RectangleF CalcOtherRectangle(PointF p1, PointF p2)
  937. {
  938. RectangleF rectangleF = new RectangleF();
  939. if (p1.X > p2.X)
  940. rectangleF.X = p2.X;
  941. else
  942. rectangleF.X = p1.X;
  943. if (p1.Y > p2.Y)
  944. rectangleF.Y = p2.Y;
  945. else
  946. rectangleF.Y = p1.Y;
  947. rectangleF.Width = Math.Abs(p2.X - p1.X);
  948. rectangleF.Height = Math.Abs(p2.Y - p1.Y);
  949. int tempLess = (int)(InvariantData.rectless * (this.documentWorkspace.ScaleFactor.Ratio < 1 ? 1 / this.documentWorkspace.ScaleFactor.Ratio : 1)) * 5;
  950. int tempPlus = (int)(InvariantData.rectplus * (this.documentWorkspace.ScaleFactor.Ratio < 1 ? 1 / this.documentWorkspace.ScaleFactor.Ratio : 1)) * 5;
  951. return new RectangleF(rectangleF.X - tempLess, rectangleF.Y - tempLess, rectangleF.Width + tempPlus, rectangleF.Height + tempPlus);
  952. }
  953. /// <summary>
  954. /// 移动
  955. /// </summary>
  956. /// <param name="sender"></param>
  957. /// <param name="e"></param>
  958. private void onMouseMove(object sender, MouseEventArgs e)
  959. {
  960. //if (e.Button == MouseButtons.Left)
  961. //{
  962. if (isLunKuo)
  963. {
  964. int cou = pointList.Count;
  965. if (cou > 0)
  966. { // 换算后的点
  967. PointF movePoint = this.documentWorkspace.GetScalePoint(e.Location);
  968. pointList[cou - 1] = movePoint;
  969. }
  970. }
  971. if (isAddKong && e.Button == MouseButtons.Left)
  972. {
  973. if (kongLineList.Count > 0)
  974. { // 换算后的点
  975. PointF movePoint = this.documentWorkspace.GetScalePoint(e.Location);
  976. //kongPointList[kongPointList.Count - 1] = movePoint;
  977. kongLineList[kongLineList.Count - 1].Add(movePoint);
  978. }
  979. }
  980. if (isDelKong)
  981. {
  982. //if (delPointList.Count > 0)
  983. //{ // 换算后的点
  984. // PointF movePoint = this.documentWorkspace.GetScalePoint(e.Location);
  985. // delPointList[delPointList.Count - 1] = movePoint;
  986. //}
  987. }
  988. if (operationK >= 0 && e.Button == MouseButtons.Left)
  989. {
  990. PointF movePoint = this.documentWorkspace.GetScalePoint(e.Location);
  991. if (operationK == 0)
  992. {
  993. this.endPoint = movePoint;
  994. pointList1[lineCount][1] = endPoint;
  995. }
  996. else if (operationK == 1 && selected > -1 && canMove)
  997. {
  998. float dx = movePoint.X - lastPoint.X;
  999. float dy = movePoint.Y - lastPoint.Y;
  1000. float dxTemp = movePoint.X - tempPoint.X;
  1001. float dyTemp = movePoint.Y - tempPoint.Y;
  1002. lastPoint.X = movePoint.X;
  1003. lastPoint.Y = movePoint.Y;
  1004. if (movePointIndex == -1)
  1005. {
  1006. RectangleF rectangleF = new RectangleF();
  1007. rectangleF = rectangleFList[selected];
  1008. if (rectangleF.Contains(movePoint))
  1009. this.documentWorkspace.panel.Cursor = Cursors.SizeAll;
  1010. rectangleF.X += dx;
  1011. rectangleF.Y += dy;
  1012. rectangleFList[selected] = rectangleF;
  1013. for (int i = 0; i < pointList1[selected].Count(); i++)
  1014. {
  1015. if (pointList1[selected][i] == PointF.Empty)
  1016. continue;
  1017. pointList1[selected][i].X += dx;
  1018. pointList1[selected][i].Y += dy;
  1019. }
  1020. }
  1021. else if (movePointIndex == 0)
  1022. {
  1023. pointList1[selected][0].X += dx;
  1024. pointList1[selected][0].Y += dy;
  1025. rectangleFList[selected] = CalcOtherRectangle(pointList1[selected][0], pointList1[selected][1]);
  1026. }
  1027. else if (movePointIndex == 1)
  1028. {
  1029. pointList1[selected][1].X += dx;
  1030. pointList1[selected][1].Y += dy;
  1031. rectangleFList[selected] = CalcOtherRectangle(pointList1[selected][0], pointList1[selected][1]);
  1032. }
  1033. }
  1034. this.documentWorkspace.Refresh();
  1035. }
  1036. this.documentWorkspace.Refresh();
  1037. // }
  1038. }
  1039. /// <summary>
  1040. /// 鼠标抬起
  1041. /// </summary>
  1042. /// <param name="sender"></param>
  1043. /// <param name="e"></param>
  1044. private void OnMouseUp(object sender, MouseEventArgs e)
  1045. {
  1046. if (e.Button == MouseButtons.Left)
  1047. {
  1048. if (operationK == 0)
  1049. {
  1050. if (startPoint != null && endPoint != null && startPoint != endPoint)
  1051. {
  1052. RectangleF rectangleF = CalcOtherRectangle(pointList1[lineCount][0], pointList1[lineCount][1]);
  1053. rectangleFList.Add(rectangleF);
  1054. lineCount++;
  1055. // AddContentToDataGridView();
  1056. }
  1057. else
  1058. {
  1059. if (pointList.Count > 0)
  1060. pointList.RemoveAt(pointList.Count - 1);
  1061. }
  1062. this.documentWorkspace.Refresh();
  1063. }
  1064. else if (operationK == 1)
  1065. {
  1066. canMove = false;
  1067. movePointIndex = -1;
  1068. // RefreshDataGridView1();
  1069. }
  1070. else if (isAddKong)
  1071. {
  1072. if (kongLineList[kongLineList.Count - 1].Count > 3)
  1073. {
  1074. isAddKong = false;
  1075. List<List<int>> CircleDate = binaryClass.DeletePrimary(delPointList, kongLineList);
  1076. bindGrid(CircleDate);
  1077. }
  1078. else
  1079. {
  1080. kongLineList.RemoveAt(kongLineList.Count - 1);
  1081. }
  1082. }
  1083. }
  1084. if (operationK >= 0 && e.Button == MouseButtons.Left)
  1085. {
  1086. PointF downPoint = this.documentWorkspace.GetScalePoint(e.Location);
  1087. if (operationK == 0)
  1088. {
  1089. startPoint = endPoint = downPoint;
  1090. pointList1[lineCount - 1][1] = endPoint;
  1091. }
  1092. else if (operationK == 1)
  1093. {
  1094. lastPoint.X = downPoint.X;
  1095. lastPoint.Y = downPoint.Y;
  1096. tempPoint.X = downPoint.X;
  1097. tempPoint.Y = downPoint.Y;
  1098. for (int i = rectangleFList.Count - 1; i >= 0; i--)
  1099. {
  1100. if (rectangleFList[i].Contains(downPoint))
  1101. {
  1102. selected = i;
  1103. canMove = true;
  1104. }
  1105. }
  1106. if (selected > -1 && pointList1 != null && pointList1.Count > 0)
  1107. {
  1108. int tempLess = (int)(InvariantData.rectless * (this.documentWorkspace.ScaleFactor.Ratio < 1 ? 1 / this.documentWorkspace.ScaleFactor.Ratio : 1)) * 5;
  1109. int tempPlus = (int)(InvariantData.rectplus * (this.documentWorkspace.ScaleFactor.Ratio < 1 ? 1 / this.documentWorkspace.ScaleFactor.Ratio : 1)) * 5;
  1110. if (new RectangleF(pointList1[selected][0].X - tempLess, pointList1[selected][0].Y - tempLess, tempPlus, tempPlus).Contains(downPoint))
  1111. movePointIndex = 0;
  1112. else if (new RectangleF(pointList1[selected][1].X - tempLess, pointList1[selected][1].Y - tempLess, tempPlus, tempPlus).Contains(downPoint))
  1113. movePointIndex = 1;
  1114. else
  1115. movePointIndex = -1;
  1116. this.documentWorkspace.Refresh();
  1117. }
  1118. if (canMove)
  1119. return;
  1120. selected = -1;
  1121. }
  1122. }
  1123. }
  1124. /// <summary>
  1125. /// 鼠标按下
  1126. /// </summary>
  1127. /// <param name="drawArea"></param>
  1128. /// <param name="e"></param>
  1129. private void OnMouseDown(object sender, MouseEventArgs e)
  1130. {
  1131. PointF downPoint = this.documentWorkspace.GetScalePoint(e.Location);
  1132. if (operationK >= 0 && e.Button == MouseButtons.Left)
  1133. {
  1134. if (operationK == 0)
  1135. {
  1136. startPoint = endPoint = downPoint;
  1137. nowLine = new PointF[4];
  1138. nowLine[0] = startPoint;
  1139. nowLine[1] = endPoint;
  1140. pointList1.Add(nowLine);
  1141. }
  1142. else if (operationK == 1)
  1143. {
  1144. lastPoint.X = downPoint.X;
  1145. lastPoint.Y = downPoint.Y;
  1146. tempPoint.X = downPoint.X;
  1147. tempPoint.Y = downPoint.Y;
  1148. for (int i = rectangleFList.Count - 1; i >= 0; i--)
  1149. {
  1150. if (rectangleFList[i].Contains(downPoint))
  1151. {
  1152. selected = i;
  1153. canMove = true;
  1154. }
  1155. }
  1156. if (selected > -1 && pointList1 != null && pointList1.Count > 0)
  1157. {
  1158. int tempLess = (int)(InvariantData.rectless * (this.documentWorkspace.ScaleFactor.Ratio < 1 ? 1 / this.documentWorkspace.ScaleFactor.Ratio : 1)) * 5;
  1159. int tempPlus = (int)(InvariantData.rectplus * (this.documentWorkspace.ScaleFactor.Ratio < 1 ? 1 / this.documentWorkspace.ScaleFactor.Ratio : 1)) * 5;
  1160. if (new RectangleF(pointList1[selected][0].X - tempLess, pointList1[selected][0].Y - tempLess, tempPlus, tempPlus).Contains(downPoint))
  1161. movePointIndex = 0;
  1162. else if (new RectangleF(pointList1[selected][1].X - tempLess, pointList1[selected][1].Y - tempLess, tempPlus, tempPlus).Contains(downPoint))
  1163. movePointIndex = 1;
  1164. else
  1165. movePointIndex = -1;
  1166. this.documentWorkspace.Refresh();
  1167. }
  1168. if (canMove)
  1169. return;
  1170. selected = -1;
  1171. }
  1172. }
  1173. else if (e.Button == MouseButtons.Left)
  1174. {
  1175. if (isLunKuo)
  1176. {
  1177. if (pointList.Count == 0)
  1178. {
  1179. pointList.Add(downPoint);
  1180. pointList.Add(downPoint);
  1181. }
  1182. else
  1183. {
  1184. pointList.Add(downPoint);
  1185. }
  1186. }
  1187. if (isAddKong)
  1188. {
  1189. List<PointF> pl = new List<PointF>();
  1190. pl.Add(downPoint);
  1191. kongLineList.Add(pl);
  1192. //if (kongPointList.Count == 0)
  1193. //{
  1194. // kongPointList.Add(downPoint);
  1195. // kongPointList.Add(downPoint);
  1196. //}
  1197. //else
  1198. //{
  1199. // kongPointList.Add(downPoint);
  1200. //}
  1201. }
  1202. if (isDelKong)
  1203. {
  1204. delPointList.Add(downPoint);
  1205. List<List<int>> CircleDate = binaryClass.DeletePrimary(delPointList, kongLineList);
  1206. bindGrid(CircleDate);
  1207. }
  1208. }
  1209. if (e.Button == MouseButtons.Right)
  1210. {
  1211. if (isLunKuo)
  1212. {
  1213. if (pointList.Count > 2)
  1214. {
  1215. pointList.RemoveAt(pointList.Count - 1);
  1216. List<PointF> pointFs = new List<PointF>(pointList.ToArray());
  1217. lineList.Add(pointFs);
  1218. }
  1219. pointList.Clear();
  1220. }
  1221. if (isAddKong)
  1222. {
  1223. if (kongPointList.Count > 2)
  1224. {
  1225. kongPointList.RemoveAt(kongPointList.Count - 1);
  1226. List<PointF> pointFs = new List<PointF>(kongPointList.ToArray());
  1227. kongLineList.Add(pointFs);
  1228. List<List<int>> CircleDate = binaryClass.DeletePrimary(delPointList, kongLineList);
  1229. bindGrid(CircleDate);
  1230. }
  1231. kongPointList.Clear();
  1232. }
  1233. if (isDelKong)
  1234. {
  1235. //if (delPointList.Count > 2)
  1236. //{
  1237. // delPointList.RemoveAt(delPointList.Count - 1);
  1238. // List<PointF> pointFs = new List<PointF>(delPointList.ToArray());
  1239. // delLineList.Add(pointFs);
  1240. //}
  1241. //delPointList.Clear();
  1242. }
  1243. isLunKuo = false;
  1244. isAddKong = false;
  1245. isDelKong = false;
  1246. }
  1247. }
  1248. /// <summary>
  1249. /// Ctrl+z
  1250. /// </summary>
  1251. private void OnKeyDown(object sender, KeyEventArgs e)
  1252. {
  1253. if (e.Control && e.KeyCode == Keys.Z)
  1254. {
  1255. if (isLunKuo)
  1256. {
  1257. int cou = pointList.Count;
  1258. if (cou > 1)
  1259. {
  1260. if (cou == 2)
  1261. {
  1262. pointList.Clear();
  1263. }
  1264. else
  1265. {
  1266. pointList.RemoveAt(cou - 1);
  1267. }
  1268. }
  1269. else if (lineList.Count > 0)
  1270. {
  1271. pointList = lineList[lineList.Count - 1];
  1272. lineList.RemoveAt(lineList.Count - 1);
  1273. pointList.RemoveAt(pointList.Count - 1);
  1274. }
  1275. }
  1276. if (isAddKong)
  1277. {
  1278. if (kongLineList.Count > 0)
  1279. {
  1280. kongLineList.RemoveAt(kongLineList.Count - 1);
  1281. List<List<int>> CircleDate = binaryClass.DeletePrimary(delPointList, kongLineList);
  1282. bindGrid(CircleDate);
  1283. }
  1284. }
  1285. if (isDelKong)
  1286. {
  1287. int cou = delPointList.Count;
  1288. if (cou > 0)
  1289. {
  1290. delPointList.RemoveAt(cou - 1);
  1291. List<List<int>> CircleDate = binaryClass.DeletePrimary(delPointList, kongLineList);
  1292. bindGrid(CircleDate);
  1293. }
  1294. }
  1295. this.documentWorkspace.Refresh();
  1296. }
  1297. }
  1298. #endregion
  1299. /// <summary>
  1300. /// 导出孔隙信息
  1301. /// </summary>
  1302. /// <param name="sender"></param>
  1303. /// <param name="e"></param>
  1304. private void button14_Click(object sender, EventArgs e)
  1305. {
  1306. SaveFileDialog exe = new SaveFileDialog();
  1307. exe.Filter = "Image Files (*.jpg)|*.jpg";
  1308. exe.FilterIndex = 0;
  1309. exe.RestoreDirectory = true;
  1310. //exe.CreatePrompt = true;
  1311. exe.Title = "Image Files";
  1312. exe.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
  1313. exe.FileName = DateTime.Now.ToString("yyyyMMddhhmmss") + "单晶";
  1314. DialogResult dr = exe.ShowDialog();
  1315. if (dr != DialogResult.OK)
  1316. {
  1317. return;
  1318. }
  1319. string GR_Path = exe.FileName + ".jpg";
  1320. chart1.SaveImage(GR_Path, System.Windows.Forms.DataVisualization.Charting.ChartImageFormat.Jpeg);
  1321. }
  1322. /// <summary>
  1323. /// 不可点击空白区域
  1324. /// </summary>
  1325. /// <param name="sender"></param>
  1326. /// <param name="e"></param>
  1327. private void listView1_MouseUp(object sender, MouseEventArgs e)
  1328. {
  1329. if (e.Button == MouseButtons.Left)
  1330. {
  1331. if (listView1.SelectedItems.Count > 0)
  1332. {
  1333. }
  1334. else if (listView1.SelectedItems.Count <= 0)//点击空白区
  1335. {
  1336. if (this.listView1.FocusedItem != null)
  1337. {
  1338. ListViewItem item = this.listView1.GetItemAt(e.X, e.Y);
  1339. if (item == null)
  1340. {
  1341. this.listView1.FocusedItem.Selected = true;
  1342. }
  1343. }
  1344. }
  1345. }
  1346. }
  1347. /// <summary>
  1348. /// 生成孔隙率
  1349. /// </summary>
  1350. /// <param name="sender"></param>
  1351. /// <param name="e"></param>
  1352. private void button13_Click(object sender, EventArgs e)
  1353. {
  1354. string name = this.listView1.FocusedItem.Name.Split('.')[0] + "-";
  1355. SaveFileDialog exe = new SaveFileDialog();
  1356. exe.Filter = "Execl files (*.xlsx)|*.xlsx";
  1357. exe.FilterIndex = 0;
  1358. exe.RestoreDirectory = true;
  1359. //exe.CreatePrompt = true;
  1360. exe.Title = "Export Excel File";
  1361. // exe.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
  1362. exe.FileName = name;
  1363. String str = System.Configuration.ConfigurationManager.AppSettings["FolderSelectedPath"];
  1364. DialogResult dr = exe.ShowDialog();
  1365. if (dr != DialogResult.OK)
  1366. {
  1367. return;
  1368. }
  1369. DataTable dtb = new DataTable();
  1370. dtb.Columns.Add("序号");
  1371. dtb.Columns.Add("位置");
  1372. dtb.Columns.Add("卡规直径/微米");
  1373. dtb.Columns.Add("长径/微米");
  1374. dtb.Columns.Add("短径/微米");
  1375. for (int r = 0; r < this.dataGridView1.Rows.Count; r++)
  1376. {
  1377. DataRow dataRow = dtb.NewRow();
  1378. dataRow[0] = dataGridView1.Rows[r].Cells[0].Value.ToString();
  1379. dataRow[1] = dataGridView1.Rows[r].Cells[1].Value.ToString();
  1380. dataRow[2] = dataGridView1.Rows[r].Cells[2].Value.ToString();
  1381. dataRow[3] = dataGridView1.Rows[r].Cells[4].Value.ToString();
  1382. dataRow[4] = dataGridView1.Rows[r].Cells[5].Value.ToString();
  1383. dtb.Rows.Add(dataRow);
  1384. }
  1385. DataTable dtb1 = new DataTable();
  1386. dtb1.Columns.Add("序号");
  1387. dtb1.Columns.Add("名称");
  1388. dtb1.Columns.Add("值/微米");
  1389. for (int r = 0; r < this.dataGridView2.Rows.Count; r++)
  1390. {
  1391. DataRow dataRow = dtb1.NewRow();
  1392. dataRow[0] = dataGridView2.Rows[r].Cells[0].Value.ToString();
  1393. dataRow[1] = dataGridView2.Rows[r].Cells[1].Value.ToString();
  1394. dataRow[2] = dataGridView2.Rows[r].Cells[2].Value.ToString();
  1395. dtb1.Rows.Add(dataRow);
  1396. }
  1397. //DataRow dataRow2 = dtb1.NewRow();
  1398. //dataRow2[0] = "1";
  1399. //dataRow2[1] = "卡规直径";
  1400. //dataRow2[2] = Math.Round(MaxP, 2).ToString();
  1401. //dataRow2[3] = Math.Round(Minp, 2).ToString();
  1402. //dataRow2[4] = Math.Round(MeanP, 2).ToString();
  1403. //dtb1.Rows.Add(dataRow2);
  1404. //DataRow dataRow3 = dtb1.NewRow();
  1405. //dataRow3[0] = "2";
  1406. //dataRow3[1] = "长径";
  1407. //dataRow3[2] = Math.Round(MaxP2, 2).ToString();
  1408. //dataRow3[3] = Math.Round(Minp2, 2).ToString();
  1409. //dataRow3[4] = Math.Round(MeanP2, 2).ToString();
  1410. ////dtb1.Rows.Add(dataRow3);
  1411. //DataRow dataRow4 = dtb1.NewRow();
  1412. //dataRow4[0] = "3";
  1413. //dataRow4[1] = "短径";
  1414. //dataRow4[2] = Math.Round(MaxM, 2).ToString();
  1415. //dataRow4[3] = Math.Round(MinM, 2).ToString();
  1416. //dataRow4[4] = Math.Round(MeanM, 2).ToString();
  1417. //dtb1.Rows.Add(dataRow4);
  1418. int index = exe.FileName.LastIndexOf('\\');
  1419. string GR_Path = exe.FileName.Remove(index) + "\\" + name + ".jpg";
  1420. chart1.SaveImage(GR_Path, System.Windows.Forms.DataVisualization.Charting.ChartImageFormat.Jpeg);
  1421. //保存处理后的图片
  1422. double pantographRatio = (double)this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetRulerMultiple(MeasurementUnit.Micron);//标尺*放大倍数
  1423. List<Bitmap> tempBit = new List<Bitmap>();
  1424. Bitmap originalBit = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].CompositionSurface.CreateAliasedBitmap();
  1425. originalBit.Tag = pantographRatio;
  1426. tempBit.Add(originalBit);
  1427. Bitmap processedBit = OpenCvSharp.Extensions.BitmapConverter.ToBitmap(this.documentWorkspace.PhaseModels[0].mat);
  1428. Bitmap newBit = originalBit.Clone(new Rectangle(0, 0, originalBit.Width, originalBit.Height), originalBit.PixelFormat);
  1429. Graphics graphics = Graphics.FromImage(newBit);
  1430. graphics.DrawImage(processedBit, new PointF(0, 0));
  1431. Draw(graphics);
  1432. newBit.Tag = pantographRatio;
  1433. tempBit.Add(newBit);
  1434. string GR_Path1 = exe.FileName.Remove(index) + "\\" + name + "1.jpg";
  1435. newBit.Save(GR_Path1);
  1436. List<DataTable> list = new List<DataTable>();
  1437. list.Add(dtb1);
  1438. list.Add(dtb);
  1439. List<string> pics = new List<string>() { GR_Path+",400,200,"+ chart1.Width+","+ chart1.Height, GR_Path1 + ",400,420," + newBit.Width + "," + newBit.Height };
  1440. this.appWorkspace.ExportDataToExcelWithProgress(list, exe.FileName, true, false, true, null,null,pics);
  1441. }
  1442. #region 辅助测量
  1443. /// <summary>
  1444. /// 添加测量线
  1445. /// </summary>
  1446. /// <param name="sender"></param>
  1447. /// <param name="e"></param>
  1448. private void btnAddCeliang_Click(object sender, EventArgs e)
  1449. {
  1450. operationK = 0;
  1451. selected = -1;
  1452. this.documentWorkspace.Refresh();
  1453. }
  1454. /// <summary>
  1455. /// 选择测量线
  1456. /// </summary>
  1457. /// <param name="sender"></param>
  1458. /// <param name="e"></param>
  1459. private void btnSelCeliang_Click(object sender, EventArgs e)
  1460. {
  1461. operationK = 1;
  1462. }
  1463. /// <summary>
  1464. /// 删除测量线
  1465. /// </summary>
  1466. /// <param name="sender"></param>
  1467. /// <param name="e"></param>
  1468. private void btnDelCeliang_Click(object sender, EventArgs e)
  1469. {
  1470. if (selected > -1)
  1471. {
  1472. DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Areyousuretodmeasurementline.text") + "?", PdnResources.GetString("Menu.alert.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
  1473. if (dr == DialogResult.OK)
  1474. {
  1475. this.pointList1.Remove(this.pointList1[selected]);
  1476. this.rectangleFList.Remove(this.rectangleFList[selected]);
  1477. selected = -1;
  1478. lineCount--;
  1479. this.documentWorkspace.Refresh();
  1480. }
  1481. }
  1482. else
  1483. MessageBox.Show("请先选择测量线");
  1484. }
  1485. /// <summary>
  1486. /// 添加测量线按钮失去焦点
  1487. /// </summary>
  1488. /// <param name="sender"></param>
  1489. /// <param name="e"></param>
  1490. private void btnAddCeliang_LostFocus(object sender, EventArgs e)
  1491. {
  1492. operationK = -1;
  1493. selected = -1;
  1494. this.documentWorkspace.Refresh();
  1495. }
  1496. #endregion
  1497. #region 内部类
  1498. internal class LocalListViewItem
  1499. {
  1500. public DocumentWorkspace Value { get; }
  1501. public string Display { get; }
  1502. public LocalListViewItem(DocumentWorkspace Value, string Display)
  1503. {
  1504. this.Value = Value;
  1505. this.Display = Display;
  1506. }
  1507. }
  1508. internal class DocumentItem
  1509. {
  1510. public Bitmap bitmap;
  1511. public GraphicsList graphicsList;
  1512. public List<PhaseModel> phaseModels;
  1513. //public AnalysisResult analysisResult;
  1514. public DocumentItem(Bitmap bitmap, GraphicsList graphicsList, List<PhaseModel> phaseModels)
  1515. {
  1516. this.bitmap = bitmap;
  1517. this.graphicsList = graphicsList;
  1518. this.phaseModels = phaseModels;
  1519. }
  1520. }
  1521. #endregion
  1522. #endregion
  1523. }
  1524. }