1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942 |
- using Metis.ParameterSet;
- using PaintDotNet.Base.CommTool;
- using PaintDotNet.Base.Functionodel;
- using PaintDotNet.Base.XmlSaveModel;
- using PaintDotNet.DbOpreate.DbBll;
- using PaintDotNet.DbOpreate.DbModel;
- using PaintDotNet.GeneralAnalysis.CustomInterface;
- using PaintDotNet.Processing;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Drawing;
- using System.IO;
- using System.Threading;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using System.Xml;
- namespace PaintDotNet.GeneralAnalysis
- {
- /// <summary>
- /// 图谱比照
- /// </summary>
- internal class AtlasComparisonDialog : PdnBaseForm
- {
- #region 控件
- private Label label6;
- private GroupBox groupBox2;
- private TreeView treeView1;
- private GroupBox groupBox3;
- private ListView listView1;
- private GroupBox groupBox4;
- private GroupBox groupBox5;
- private Button button1;
- private Button button2;
- private Button button3;
- private Button button4;
- private Button button5;
- private CheckBox checkBox1;
- private RadioButton radioButton2;
- private RadioButton radioButton1;
- private Panel panel1;
- private Label label1;
- private Label label2;
- private GroupBox groupBox1;
- private ImageList imageList1;
- private IContainer components;
- private Panel panel2;
- private RadioButton radioButton3;
- private RadioButton radioButton6;
- private RadioButton radioButton5;
- private RadioButton radioButton4;
- private PictureUserControl pictureUserControl1, pictureUserControl2,
- pictureUserControl3, pictureUserControl4, pictureUserControl5,
- pictureUserControl7, pictureUserControl8, pictureUserControl9, pictureUserControl10, pictureUserControl11,
- pictureUserControl20, pictureUserControl21, pictureUserControl22,
- pictureUserControl23, pictureUserControl24, pictureUserControl25,
- pictureUserControl26, pictureUserControl27, pictureUserControl28;
- #region 对比对照控件
- private Panel panel3;
- private Label label3;
- private NumericUpDown numericUpDown2;
- private NumericUpDown numericUpDown1;
- private Label label4;
- private Panel panel4;
- private Label label5;
- private TrackBar trackBar1;
- private NumericUpDown numericUpDown3;
- private Button button6;
- #endregion
- private ComboBox comboBox1;
- #endregion
- /// <summary>
- /// 组织的图谱数据集合
- /// </summary>
- public List<AtlasModel> atlasModels = new List<AtlasModel>();
- /// <summary>
- /// 1/2/4/8
- /// </summary>
- private int num = 1;
- /// <summary>
- /// 待比照的图片
- /// </summary>
- private Bitmap bitmap;
- /// <summary>
- /// 图片选择窗口
- /// </summary>
- private InterImagePickerDialog imagePickerDialog;
- /// <summary>
- /// 主空间
- /// </summary>
- private AppWorkspace appWorkspace;
- /// <summary>
- /// 关联图片
- /// </summary>
- public bool RelatedPic = false;
- /// <summary>
- /// 1平铺 2对比
- /// </summary>
- private int mode = 1;
- /// <summary>
- /// 步长 初始值1,依次增加
- /// </summary>
- private string stepLength = "00" + Startup.instance.step_length;
- private GeneralAnalysisModel generalAnalysisModel = new GeneralAnalysisModel();
- public AtlasComparisonDialog(AppWorkspace appWorkspace)
- {
- this.appWorkspace = appWorkspace;
- InitializeComponent();
- InitializeLanguageText();
- this.panel3.Visible = false;
- this.panel2.Visible = true;
- this.pictureUserControl1 = new PictureUserControl(1, this);
- this.pictureUserControl2 = new PictureUserControl(2, this);
- InitializeRules();
- InitializeAtlasFile();
- InitializeTreeView();
- InitializeCompareControls();
-
- SetStyle(ControlStyles.UserPaint, true);
- SetStyle(ControlStyles.AllPaintingInWmPaint, true); // 禁止擦除背景.
- SetStyle(ControlStyles.DoubleBuffer, true); // 双缓冲
- this.label6.Text = "";
- SetAnalyzeModelFromXml("Template.Manager.item2.AtlasComparison");
- this.FormClosing += new FormClosingEventHandler(this.ClosingEvent);
- //用来处理对比对照切换图片的时候,生成右边的二值图层
- this.pictureUserControl2.pictureBox1.Paint += this.pictureBox1_Paint;
- }
-
- private void pictureBox1_Paint(object sender, PaintEventArgs e)
- {
- if(this.pictureUserControl2.bitmap!=null)
- {
- if (this.mode == 2)
- {
- IninializeBinaryCompare();
- }
- }
- }
- private void ClosingEvent(object sender, FormClosingEventArgs e)
- {
- this.saveLastData(sender,e);
- if (imagePickerDialog != null)
- {
- if (!imagePickerDialog.IsDisposed)
- {
- imagePickerDialog.Close();
- }
- }
- }
- /// <summary>
- /// 窗口加载
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void AtlasComparisonDialog_Load(object sender, EventArgs e)
- {
- pictureUserControl20 = new PictureUserControl(2, this); pictureUserControl21 = new PictureUserControl(2, this); pictureUserControl22 = new PictureUserControl(2, this);
- pictureUserControl23 = new PictureUserControl(2, this); pictureUserControl24 = new PictureUserControl(1, this); pictureUserControl25 = new PictureUserControl(2, this);
- pictureUserControl26 = new PictureUserControl(2, this); pictureUserControl27 = new PictureUserControl(2, this); pictureUserControl28 = new PictureUserControl(2, this);
- getLastData();
- }
- List<mic_rulers> list;
- /// <summary>
- /// 初始化标尺
- /// </summary>
- private void InitializeRules()
- {
- //List<mic_rulers> list = mic_rulers_BLL.FindAll();
- list = Startup.instance.mic_rulersAll;
- this.comboBox1.DisplayMember = "ruler_name";
- this.comboBox1.ValueMember = "id";
- this.comboBox1.DataSource = list;
- }
- /// <summary>
- /// 标尺乘以放大倍数
- /// </summary>
- /// <returns></returns>
- private double GetRulerMultiple()
- {
- DocumentWorkspace dw = this.appWorkspace.AddNewDocumentWorkspace();
- Document document = Document.FromImageMat(Camera.Tools.ToMat(bitmap));
- dw.Document = document;
- if (list != null && list.Count > 0)
- {
- for (int i = 0; i < list.Count; i++)
- {
- if (list[i].ruler_name == this.comboBox1.Text)
- {
- dw.xmlSaveModel = list[i];
- }
- }
- }
- dw.InitRulerInfo();
- double pantographRatio = dw.GetRulerMultiple(MeasurementUnit.Micron);
- this.appWorkspace.RemoveDocumentWorkspace(dw);
- return pantographRatio;
- }
- /// <summary>
- /// 生成报告
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button1_Click(object sender, EventArgs e)
- {
- if (this.checkBox1.Checked)
- this.button5.PerformClick();
- if (this.analyzeSettingModel != null && !string.IsNullOrEmpty(this.analyzeSettingModel.analyzeClassify))
- {
- List<Bitmap> bitList = new List<Bitmap>();
- if (bitmap == null)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Noanalysineratereport.text") + "!");
- return;
- }
-
- double pantographRatio = GetRulerMultiple();
- //平铺
- if (this.radioButton1.Checked)
- {
- switch (this.num)
- {
- case 1:
- if (this.pictureUserControl2.Bitmap != null)
- {
- this.pictureUserControl2.Bitmap.Tag = pantographRatio;
- bitList.Add(this.pictureUserControl2.Bitmap);
- }
- if (this.pictureUserControl1.Bitmap != null)
- {
- this.pictureUserControl1.Bitmap.Tag = pantographRatio;
- bitList.Add(this.pictureUserControl1.Bitmap);
- }
- break;
- case 2:
- if (this.pictureUserControl5.Bitmap != null)
- {
- this.pictureUserControl5.Bitmap.Tag = pantographRatio;
- bitList.Add(this.pictureUserControl5.Bitmap);
- }
- if (this.pictureUserControl4.Bitmap != null)
- {
- this.pictureUserControl4.Bitmap.Tag = pantographRatio;
- bitList.Add(this.pictureUserControl4.Bitmap);
- }
- if (this.pictureUserControl3.Bitmap != null)
- {
- this.pictureUserControl3.Bitmap.Tag = pantographRatio;
- bitList.Add(this.pictureUserControl3.Bitmap);
- }
- break;
- case 4:
- if (this.pictureUserControl8.Bitmap != null)
- {
- this.pictureUserControl8.Bitmap.Tag = pantographRatio;
- bitList.Add(this.pictureUserControl8.Bitmap);
- }
- if (this.pictureUserControl11.Bitmap != null)
- {
- this.pictureUserControl11.Bitmap.Tag = pantographRatio;
- bitList.Add(this.pictureUserControl11.Bitmap);
- }
- if (this.pictureUserControl7.Bitmap != null)
- {
- this.pictureUserControl7.Bitmap.Tag = pantographRatio;
- bitList.Add(this.pictureUserControl7.Bitmap);
- }
- if (this.pictureUserControl9.Bitmap != null)
- {
- this.pictureUserControl9.Bitmap.Tag = pantographRatio;
- bitList.Add(this.pictureUserControl9.Bitmap);
- }
- if (this.pictureUserControl10.Bitmap != null)
- {
- this.pictureUserControl10.Bitmap.Tag = pantographRatio;
- bitList.Add(this.pictureUserControl10.Bitmap);
- }
- break;
- case 8:
- if (this.pictureUserControl20.Bitmap != null)
- {
- this.pictureUserControl20.Bitmap.Tag = pantographRatio;
- bitList.Add(this.pictureUserControl20.Bitmap);
- }
- if (this.pictureUserControl21.Bitmap != null)
- {
- this.pictureUserControl21.Bitmap.Tag = pantographRatio;
- bitList.Add(this.pictureUserControl21.Bitmap);
- }
- if (this.pictureUserControl22.Bitmap != null)
- {
- this.pictureUserControl22.Bitmap.Tag = pantographRatio;
- bitList.Add(this.pictureUserControl22.Bitmap);
- }
- if (this.pictureUserControl23.Bitmap != null)
- {
- this.pictureUserControl23.Bitmap.Tag = pantographRatio;
- bitList.Add(this.pictureUserControl23.Bitmap);
- }
- if (this.pictureUserControl24.Bitmap != null)
- {
- this.pictureUserControl24.Bitmap.Tag = pantographRatio;
- bitList.Add(this.pictureUserControl24.Bitmap);
- }
- if (this.pictureUserControl25.Bitmap != null)
- {
- this.pictureUserControl25.Bitmap.Tag = pantographRatio;
- bitList.Add(this.pictureUserControl25.Bitmap);
- }
- if (this.pictureUserControl26.Bitmap != null)
- {
- this.pictureUserControl26.Bitmap.Tag = pantographRatio;
- bitList.Add(this.pictureUserControl26.Bitmap);
- }
- if (this.pictureUserControl27.Bitmap != null)
- {
- this.pictureUserControl27.Bitmap.Tag = pantographRatio;
- bitList.Add(this.pictureUserControl27.Bitmap);
- }
- if (this.pictureUserControl28.Bitmap != null)
- {
- this.pictureUserControl28.Bitmap.Tag = pantographRatio;
- bitList.Add(this.pictureUserControl28.Bitmap);
- }
- break;
- }
- }
- //对比
- else if (this.radioButton2.Checked)
- {
- if (this.pictureUserControl2.Bitmap != null)
- {
- this.pictureUserControl2.Bitmap.Tag = pantographRatio;
- bitList.Add(this.pictureUserControl2.Bitmap);
- }
-
- if (this.pictureUserControl1.ComBitmap != null && this.pictureUserControl1.Bitmap != null)
- {
- Bitmap comBit = GetCombineBit();
- if (comBit != null)
- {
- comBit.Tag = pantographRatio;
- bitList.Add(comBit);
- }
- }
- else if (this.pictureUserControl1.ComBitmap != null && this.pictureUserControl1.Bitmap == null)
- {
- this.pictureUserControl1.ComBitmap.Tag = pantographRatio;
- bitList.Add(this.pictureUserControl1.ComBitmap);
- }
-
- else if (this.pictureUserControl1.ComBitmap == null && this.pictureUserControl1.Bitmap != null)
- {
- this.pictureUserControl1.Bitmap.Tag = pantographRatio;
- bitList.Add(this.pictureUserControl1.Bitmap);
- }
-
- }
- this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, null, bitList, null);
- }
- else
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text") + "!");
- }
- }
- private Bitmap GetCombineBit()
- {
- if (this.pictureUserControl1.Bitmap != null && this.pictureUserControl1.ComBitmap != null)
- {
- Bitmap bitmap = null;
- try
- {
- int aw = this.pictureUserControl1.Bitmap.Width;
- int ah = this.pictureUserControl1.Bitmap.Height;
- int bw = this.pictureUserControl1.ComBitmap.Width;
- int bh = this.pictureUserControl1.ComBitmap.Height;
- int width = aw > bw ? aw : bw;
- int height = ah > bh ? ah : bh;
- bitmap = new Bitmap(width, height);
- Graphics graphics = Graphics.FromImage(bitmap);
- graphics.DrawImage(this.pictureUserControl1.Bitmap, (width - aw) / 2, (height - ah) / 2, aw, ah);
- graphics.DrawImage(this.pictureUserControl1.ComBitmap, (width - bw) / 2, (height - bh) / 2, bw, bh);
- return bitmap;
- }
- catch (Exception)
- {
- return null;
- }
- }
- else
- return null;
- }
- /// <summary>
- /// 关联图片,同步放大缩小平移旋转...
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button2_Click(object sender, EventArgs e)
- {
- this.RelatedPic = !this.RelatedPic;
- }
- /// <summary>
- /// 浏览已经打开的所有图片
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button4_Click(object sender, EventArgs e)
- {
- if (imagePickerDialog == null)
- {
- imagePickerDialog = new InterImagePickerDialog(this.appWorkspace);
- imagePickerDialog.StartPosition = FormStartPosition.Manual;
- if (this.Right >= System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width-150)
- {
- imagePickerDialog.Left = Screen.PrimaryScreen.Bounds.Width - 500;
- }
- else
- {
- imagePickerDialog.Left = ((Button)sender).Left + 12 + this.Left;
- }
- imagePickerDialog.Top = ((Button)sender).Bottom + 46 + this.Top;
- imagePickerDialog.ValueChanged += new System.EventHandler(this.inputMat_ValueChanged);
- imagePickerDialog.Show();
- }
- else
- {
- if (!imagePickerDialog.IsDisposed)
- {
- imagePickerDialog.WindowState = FormWindowState.Normal;
- }
- else
- {
- imagePickerDialog = new InterImagePickerDialog(this.appWorkspace);
- imagePickerDialog.StartPosition = FormStartPosition.Manual;
- if (this.Right >= System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width - 150)
- {
- imagePickerDialog.Left = Screen.PrimaryScreen.Bounds.Width - 500;
- }
- else
- {
- imagePickerDialog.Left = ((Button)sender).Left + 12 + this.Left;
- }
- imagePickerDialog.Top = ((Button)sender).Bottom + 46 + this.Top;
- imagePickerDialog.ValueChanged += new System.EventHandler(this.inputMat_ValueChanged);
- imagePickerDialog.Show();
- }
- }
- }
- /// <summary>
- /// 从图库选择待对照图片
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void inputMat_ValueChanged(object sender, EventArgs e)
- {
- if (sender is DocumentWorkspace)
- {
- this.bitmap = ((DocumentWorkspace)sender).CompositionSurface.CreateAliasedBitmap();
- //如果存在相,则绘制相
- if (((DocumentWorkspace)sender).phaseModels!=null && ((DocumentWorkspace)sender).phaseModels.Count>0)
- {
- Graphics graphics = Graphics.FromImage(this.bitmap);
- foreach (PhaseModel model in ((DocumentWorkspace)sender).phaseModels)
- {
- if(model.mat!=null)
- {
- graphics.DrawImage(OpenCvSharp.Extensions.BitmapConverter.ToBitmap(model.mat), new PointF(0,0));
- }
- }
- }
- switch (num)
- {
- case 1:
- this.pictureUserControl1.Bitmap = this.bitmap;
- break;
- case 2:
- this.pictureUserControl4.Bitmap = this.bitmap;
- break;
- case 4:
- this.pictureUserControl7.Bitmap = this.bitmap;
- break;
- case 8:
- this.pictureUserControl24.Bitmap = this.bitmap;
- break;
- }
- }
- }
- /// <summary>
- /// 打开文件浏览
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button3_Click(object sender, EventArgs e)
- {
- OpenFileDialog dialog = new OpenFileDialog();
- dialog.Filter = PdnResources.GetString("Menu.Theimagefile.Text")+"|*.jpg;*.png;*.bmp;";
- dialog.InitialDirectory = Environment.CurrentDirectory;
- dialog.ShowDialog();
- if (dialog.FileName != String.Empty)
- {
- this.bitmap = new Bitmap(dialog.FileName);
- switch (num)
- {
- case 1:
- this.pictureUserControl1.Bitmap = this.bitmap;
- break;
- case 2:
- this.pictureUserControl4.Bitmap = this.bitmap;
- break;
- case 4:
- this.pictureUserControl7.Bitmap = this.bitmap;
- break;
- case 8:
- this.pictureUserControl24.Bitmap = this.bitmap;
- break;
- }
- }
- }
- /// <summary>
- /// 初始化对比控件
- /// </summary>
- private void InitializeCompareControls()
- {
- this.panel1.Controls.Clear();
- switch (this.num)
- {
- case 1:
- this.pictureUserControl2.Dock = DockStyle.Left;
- this.pictureUserControl2.Width = this.panel1.Width / 2;
- this.pictureUserControl1.Dock = DockStyle.Left;
- this.pictureUserControl1.Width = this.panel1.Width / 2;
- this.panel1.Controls.Add(this.pictureUserControl1);
- this.panel1.Controls.Add(this.pictureUserControl2);
- this.pictureUserControl1.Bitmap = this.bitmap;
- break;
- case 2:
- if(pictureUserControl3 == null) pictureUserControl3 = new PictureUserControl(2, this);
- pictureUserControl3.Dock = DockStyle.Left;
- pictureUserControl3.Width = this.panel1.Width / 3;
- if(pictureUserControl4==null) pictureUserControl4 = new PictureUserControl(1, this);
- pictureUserControl4.Dock = DockStyle.Left;
- pictureUserControl4.Width = this.panel1.Width / 3;
- if (pictureUserControl5 == null) pictureUserControl5 = new PictureUserControl(2, this);
- pictureUserControl5.Dock = DockStyle.Left;
- pictureUserControl5.Width = this.panel1.Width / 3;
- this.panel1.Controls.Add(pictureUserControl3);
- this.panel1.Controls.Add(pictureUserControl4);
- this.panel1.Controls.Add(pictureUserControl5);
- this.pictureUserControl4.Bitmap = this.bitmap;
- break;
- case 4:
- if (pictureUserControl7 == null) pictureUserControl7 = new PictureUserControl(1, this);
- pictureUserControl7.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom;
- pictureUserControl7.Width = this.panel1.Width / 3;
- pictureUserControl7.Height = this.panel1.Height / 3;
- pictureUserControl7.Location = new Point(this.panel1.Width / 3, this.panel1.Height / 3);
- if (pictureUserControl8 == null) pictureUserControl8 = new PictureUserControl(2, this);
- pictureUserControl8.Anchor = AnchorStyles.Top;
- pictureUserControl8.Width = this.panel1.Width / 3;
- pictureUserControl8.Height = this.panel1.Height / 3;
- pictureUserControl8.Location = new Point(this.panel1.Width / 3, 0);
- if (pictureUserControl9 == null) pictureUserControl9 = new PictureUserControl(2, this);
- pictureUserControl9.Anchor = AnchorStyles.Right;
- pictureUserControl9.Width = this.panel1.Width / 3;
- pictureUserControl9.Height = this.panel1.Height / 3;
- pictureUserControl9.Location = new Point((this.panel1.Width / 3)*2, this.panel1.Height / 3);
- if (pictureUserControl10 == null) pictureUserControl10 = new PictureUserControl(2, this);
- pictureUserControl10.Anchor = AnchorStyles.Bottom;
- pictureUserControl10.Width = this.panel1.Width / 3;
- pictureUserControl10.Height = this.panel1.Height / 3;
- pictureUserControl10.Location = new Point(this.panel1.Width / 3, (this.panel1.Height / 3)*2);
- if (pictureUserControl11 == null) pictureUserControl11 = new PictureUserControl(2, this);
- pictureUserControl11.Anchor = AnchorStyles.Left;
- pictureUserControl11.Width = this.panel1.Width / 3;
- pictureUserControl11.Height = this.panel1.Height / 3;
- pictureUserControl11.Location = new Point(0, this.panel1.Height / 3);
- this.panel1.Controls.Add(pictureUserControl8);
- this.panel1.Controls.Add(pictureUserControl9);
- this.panel1.Controls.Add(pictureUserControl10);
- this.panel1.Controls.Add(pictureUserControl11);
- this.panel1.Controls.Add(pictureUserControl7);
- this.pictureUserControl7.Bitmap = this.bitmap;
- break;
- case 8:
- pictureUserControl20.Anchor = AnchorStyles.Top | AnchorStyles.Left;
- pictureUserControl20.Width = this.panel1.Width / 3;
- pictureUserControl20.Height = this.panel1.Height / 3;
- pictureUserControl20.Location = new Point(0, 0);
- pictureUserControl21.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
- pictureUserControl21.Width = this.panel1.Width / 3;
- pictureUserControl21.Height = this.panel1.Height / 3;
- pictureUserControl21.Location = new Point(this.panel1.Width / 3, 0);
- pictureUserControl22.Anchor = AnchorStyles.Top | AnchorStyles.Right;
- pictureUserControl22.Width = this.panel1.Width / 3;
- pictureUserControl22.Height = this.panel1.Height / 3;
- pictureUserControl22.Location = new Point((this.panel1.Width / 3) * 2, 0);
- pictureUserControl23.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Bottom;
- pictureUserControl23.Width = this.panel1.Width / 3;
- pictureUserControl23.Height = this.panel1.Height / 3;
- pictureUserControl23.Location = new Point(0, this.panel1.Height / 3);
- pictureUserControl24.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Right;
- pictureUserControl24.Width = this.panel1.Width / 3;
- pictureUserControl24.Height = this.panel1.Height / 3;
- pictureUserControl24.Location = new Point(this.panel1.Width / 3, this.panel1.Height / 3);
- pictureUserControl25.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right;
- pictureUserControl25.Width = this.panel1.Width / 3;
- pictureUserControl25.Height = this.panel1.Height / 3;
- pictureUserControl25.Location = new Point((this.panel1.Width / 3) * 2, this.panel1.Height / 3);
- pictureUserControl26.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Bottom;
- pictureUserControl26.Width = this.panel1.Width / 3;
- pictureUserControl26.Height = this.panel1.Height / 3;
- pictureUserControl26.Location = new Point(0, (this.panel1.Height / 3)*2);
- pictureUserControl27.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Right;
- pictureUserControl27.Width = this.panel1.Width / 3;
- pictureUserControl27.Height = this.panel1.Height / 3;
- pictureUserControl27.Location = new Point(this.panel1.Width / 3, (this.panel1.Height / 3) * 2);
- pictureUserControl28.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right;
- pictureUserControl28.Width = this.panel1.Width / 3;
- pictureUserControl28.Height = this.panel1.Height / 3;
- pictureUserControl28.Location = new Point((this.panel1.Width / 3) * 2, (this.panel1.Height / 3)*2);
- this.panel1.Controls.Add(pictureUserControl20);
- this.panel1.Controls.Add(pictureUserControl21);
- this.panel1.Controls.Add(pictureUserControl22);
- this.panel1.Controls.Add(pictureUserControl23);
- this.panel1.Controls.Add(pictureUserControl24);
- this.panel1.Controls.Add(pictureUserControl25);
- this.panel1.Controls.Add(pictureUserControl26);
- this.panel1.Controls.Add(pictureUserControl27);
- this.panel1.Controls.Add(pictureUserControl28);
- this.pictureUserControl24.Bitmap = this.bitmap;
- break;
- }
- }
- /// <summary>
- /// 初始化图谱数据
- /// 读取图谱文件夹(Atlas文件夹)的xml文件并解析
- /// </summary>
- private void InitializeAtlasFile()
- {
- atlasModels.Clear();
- List<string> fileNames = FileOperationHelper.GetFileList(Application.StartupPath + "\\Atlas\\");
- XmlDocument xml = new XmlDocument();
- foreach (string fileName in fileNames)
- {
- //Load Xml
- xml.Load(Application.StartupPath + "\\Atlas\\" + fileName);
- //读取根元素
- XmlElement root = xml.DocumentElement;
- //递归解析xml
- ParsingXml(root, 1, "");
- }
- }
- /// <summary>
- /// 初始化treeview
- /// </summary>
- private void InitializeTreeView()
- {
- this.treeView1.ImageList = new ImageList();
- this.treeView1.ImageList.Images.Add("Top", PdnResources.GetImageResource("Icons.SettingsIcon.png").Reference);
- this.treeView1.ImageList.Images.Add("Catalog", PdnResources.GetImageResource("Icons.ImageFromDiskIcon.png").Reference);
- this.treeView1.ImageList.Images.Add("Atlas", PdnResources.GetImageResource("Icons.AddNoiseEffect.png").Reference);
- if (this.atlasModels.Count > 0)
- {
- for (int i = 0; i < this.atlasModels.Count; i++)
- {
- if (this.atlasModels[i].parentId.Equals(""))
- {
- TreeNode anime = new TreeNode();
- anime.Tag = this.atlasModels[i].id;
- anime.Text = this.atlasModels[i].name;
- anime.ImageKey = "Top";
- this.treeView1.Nodes.Add(anime);
- RecursiveData(anime);
- }
- }
- }
- }
- /// <summary>
- /// 递归处理treeview数据
- /// </summary>
- private void RecursiveData(TreeNode anime)
- {
- List<AtlasModel> models = this.atlasModels.FindAll(a => a.parentId.Equals(anime.Tag));
- if (models != null && models.Count > 0)
- {
- for (int i = 0; i < models.Count; i++)
- {
- if (models[i].type == 1)
- {
- TreeNode animeC = new TreeNode();
- animeC.Tag = models[i].id;
- animeC.Text = models[i].name;
- animeC.ImageKey = "Catalog";
- animeC.SelectedImageKey = "Catalog";
- RecursiveData(animeC);
- anime.Nodes.Add(animeC);
- }
- }
- }
- }
- /// <summary>
- /// 递归解析xml
- /// </summary>
- /// <param name="element">节点</param>
- /// <param name="level">1根节点 2分类 3图铺</param>
- private void ParsingXml(XmlElement element, int level, string parentId)
- {
- if (level == 1)
- {
- AtlasModel model = new AtlasModel();
- model.name = element.GetAttribute("Name");
- model.id = Guid.NewGuid().ToString();
- model.parentId = parentId;
- model.path = model.name;
- model.type = 0;
- this.atlasModels.Add(model);
- XmlNodeList list = element.FirstChild.ChildNodes;
- if (list != null && list.Count > 0)
- {
- foreach (XmlNode node in list)
- {
- ParsingXml((XmlElement)node, 2, model.id);
- }
- }
- }
- else if (level == 2)
- {
- AtlasModel model = new AtlasModel();
- model.name = element.GetAttribute("Name");
- model.id = Guid.NewGuid().ToString();
- model.parentId = parentId;
- model.path = model.name;
- model.type = 1;
- this.atlasModels.Add(model);
- XmlNodeList list = element.FirstChild.ChildNodes;
- if (list != null && list.Count > 0)
- {
- foreach (XmlNode node in list)
- {
- if (node.FirstChild.Name.Equals("MapImage"))
- {
- ParsingXml((XmlElement)node, 3, model.id);
- }
- else
- {
- ParsingXml((XmlElement)node, 2, model.id);
- }
- }
- }
- }
- else if (level == 3)
- {
- AtlasModel model = new AtlasModel();
- model.name = element.GetAttribute("Name");
- model.id = Guid.NewGuid().ToString();
- model.parentId = parentId;
- model.path = model.name;
- model.type = 2;
- model.bitmap = DrawRulerHelper.Base64StringToImage(element.InnerText);
- this.atlasModels.Add(model);
- }
- }
- private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
- {
- if (e.Node != null)
- {
- if (this.treeView1.SelectedNode != e.Node)
- {
- this.imageList1.Images.Clear();
- this.listView1.Items.Clear();
- this.treeView1.SelectedNode = e.Node;
- this.InitListViewData(this.treeView1.SelectedNode);
- this.InitializePlayUserControl();
- }
- }
- }
- private void InitializePlayUserControl()
- {
- switch(this.num)
- {
- case 1:
- this.pictureUserControl2.ImageCollection = this.imageList1.Images;
- this.pictureUserControl2.CurrentPosition = 1;
- break;
- case 2:
- this.pictureUserControl3.ImageCollection = this.imageList1.Images;
- this.pictureUserControl3.CurrentPosition = 2;
- this.pictureUserControl5.ImageCollection = this.imageList1.Images;
- this.pictureUserControl5.CurrentPosition = 1;
- break;
- case 4:
- this.pictureUserControl8.ImageCollection = this.imageList1.Images;
- this.pictureUserControl8.CurrentPosition = 1;
- this.pictureUserControl9.ImageCollection = this.imageList1.Images;
- this.pictureUserControl9.CurrentPosition = 2;
- this.pictureUserControl10.ImageCollection = this.imageList1.Images;
- this.pictureUserControl10.CurrentPosition = 3;
- this.pictureUserControl11.ImageCollection = this.imageList1.Images;
- this.pictureUserControl11.CurrentPosition = 4;
- break;
- case 8:
- this.pictureUserControl20.ImageCollection = this.imageList1.Images;
- this.pictureUserControl20.CurrentPosition = 1;
- this.pictureUserControl21.ImageCollection = this.imageList1.Images;
- this.pictureUserControl21.CurrentPosition = 2;
- this.pictureUserControl22.ImageCollection = this.imageList1.Images;
- this.pictureUserControl22.CurrentPosition = 3;
- this.pictureUserControl23.ImageCollection = this.imageList1.Images;
- this.pictureUserControl23.CurrentPosition = 4;
- this.pictureUserControl25.ImageCollection = this.imageList1.Images;
- this.pictureUserControl25.CurrentPosition = 5;
- this.pictureUserControl26.ImageCollection = this.imageList1.Images;
- this.pictureUserControl26.CurrentPosition = 6;
- this.pictureUserControl27.ImageCollection = this.imageList1.Images;
- this.pictureUserControl27.CurrentPosition = 7;
- this.pictureUserControl28.ImageCollection = this.imageList1.Images;
- this.pictureUserControl28.CurrentPosition = 8;
- break;
- }
- }
- /// <summary>
- /// 使用标尺的切换
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
- {
- // TODO ZYH 标尺切换改变图像大小
- if (this.comboBox1.SelectedIndex >= 0)
- {
- }
- }
- private void InitListViewData(TreeNode node)
- {
- this.imageList1.Images.Clear();
- this.listView1.Items.Clear();
- if (node == null)
- {
- List<AtlasModel> lists = this.atlasModels.FindAll(a => a.bitmap != null);
- for (int i = 0; i < lists.Count; i++)
- {
- this.imageList1.ImageSize = new System.Drawing.Size(72, 72);
- this.imageList1.Images.Add("img" + i, lists[i].bitmap);
- this.imageList1.Images.SetKeyName(i, lists[i].id);
- this.listView1.Items.Add("", i);
- this.listView1.Items[i].Tag = lists[i].id;
- this.listView1.Items[i].ImageIndex = i;
- this.listView1.Items[i].Text = lists[i].name;
- }
- }
- else
- {
- AtlasModel model = this.atlasModels.Find(a => a.id.Equals(node.Tag.ToString()));
- if (model != null)
- {
- if (model.type == 0 || model.type == 1)
- {
- List<AtlasModel> lists = this.atlasModels.FindAll(a => a.bitmap != null && a.parentId.Equals(model.id));
- for (int i = 0; i < lists.Count; i++)
- {
- this.imageList1.ImageSize = new System.Drawing.Size(72, 72);
- this.imageList1.Images.Add("img" + i, lists[i].bitmap);
- this.imageList1.Images.SetKeyName(i, lists[i].id);
- this.listView1.Items.Add("", i);
- this.listView1.Items[i].Tag = lists[i].id;
- this.listView1.Items[i].ImageIndex = i;
- this.listView1.Items[i].Text = lists[i].name;
- }
- }
- else if (model.type == 2)
- {
- this.imageList1.ImageSize = new System.Drawing.Size(72, 72);
- this.imageList1.Images.Add("img", model.bitmap);
- this.imageList1.Images.SetKeyName(0, model.id);
- this.listView1.Items.Add("", 0);
- this.listView1.Items[0].Tag = model.id;
- this.listView1.Items[0].ImageIndex = 0;
- this.listView1.Items[0].Text = model.name;
- }
- }
- }
- }
- /// <summary>
- /// 设置
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button5_Click(object sender, EventArgs e)
- {
- AnalyzeSettingDialog recombinationRateSetDialog = new AnalyzeSettingDialog(this, "Template.Manager.item2.AtlasComparison");
- if (recombinationRateSetDialog.hasModule)
- {
- recombinationRateSetDialog.StartPosition = FormStartPosition.CenterScreen;
- recombinationRateSetDialog.ShowDialog();
- }
- else
- {
- recombinationRateSetDialog = null;
- }
- /*using (AtlasSettingDialog atlasSettingDialog = new AtlasSettingDialog())
- {
- atlasSettingDialog.StartPosition = FormStartPosition.CenterScreen;
- atlasSettingDialog.ShowDialog();
- }*/
- }
- private void panel1_SizeChanged(object sender, EventArgs e)
- {
- switch (this.num)
- {
- case 1:
- this.pictureUserControl1.Width = this.panel1.Width / 2;
- this.pictureUserControl2.Width = this.panel1.Width / 2;
- break;
- case 2:
- this.pictureUserControl3.Width = this.panel1.Width / 3;
- this.pictureUserControl4.Width = this.panel1.Width / 3;
- this.pictureUserControl5.Width = this.panel1.Width / 3;
- break;
- case 4:
- foreach (Control control in this.panel1.Controls)
- {
- control.Width = this.panel1.Width / 3;
- control.Height = this.panel1.Height / 3;
- }
- this.pictureUserControl7.Location = new Point(this.panel1.Width / 3, this.panel1.Height / 3);
- this.pictureUserControl8.Location = new Point(this.panel1.Width / 3, 0);
- this.pictureUserControl9.Location = new Point((this.panel1.Width / 3) * 2, this.panel1.Height / 3);
- this.pictureUserControl10.Location = new Point(this.panel1.Width / 3, (this.panel1.Height / 3) * 2);
- this.pictureUserControl11.Location = new Point(0, this.panel1.Height / 3);
- break;
- case 8:
- foreach (Control control in this.panel1.Controls)
- {
- control.Width = this.panel1.Width / 3;
- control.Height = this.panel1.Height / 3;
- }
- pictureUserControl20.Location = new Point(0, 0);
- pictureUserControl21.Location = new Point(this.panel1.Width / 3, 0);
- pictureUserControl22.Location = new Point((this.panel1.Width / 3) * 2, 0);
- pictureUserControl23.Location = new Point(0, this.panel1.Height / 3);
- pictureUserControl24.Location = new Point(this.panel1.Width / 3, this.panel1.Height / 3);
- pictureUserControl25.Location = new Point((this.panel1.Width / 3) * 2, this.panel1.Height / 3);
- pictureUserControl26.Location = new Point(0, (this.panel1.Height / 3) * 2);
- pictureUserControl27.Location = new Point(this.panel1.Width / 3, (this.panel1.Height / 3) * 2);
- pictureUserControl28.Location = new Point((this.panel1.Width / 3) * 2, (this.panel1.Height / 3) * 2);
- break;
- }
- }
- /// <summary>
- /// 对照模式切换事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void radioButton_CheckedChanged(object sender, EventArgs e)
- {
- if(this.radioButton1.Checked)
- {
- this.mode = 1;
- this.panel3.Visible = false;
- this.panel2.Visible = true;
- }
- else if (this.radioButton2.Checked)
- {
- this.mode = 2;
- this.panel2.Visible = false;
- this.panel3.Visible = true;
- this.num = 1;
- this.radioButton3.Checked = true;
- this.IninializeBinaryCompare();
- }
- }
- #region 对比对照
-
- /// <summary>
- /// 对比对照
- /// </summary>
- private unsafe void IninializeBinaryCompare()
- {
- if(this.pictureUserControl2.Bitmap!=null)
- {
- OpenCvSharp.Mat source = PaintDotNet.Camera.Tools.ToMat(this.pictureUserControl2.Bitmap);
- OpenCvSharp.Mat srcGray;
- if (source.Type() == OpenCvSharp.MatType.CV_8UC1)
- {
- srcGray = source;
- }
- else
- {
- srcGray = source.CvtColor(OpenCvSharp.ColorConversionCodes.BGR2GRAY);
- }
- OpenCvSharp.Mat src = new OpenCvSharp.Mat(source.Rows, source.Cols, OpenCvSharp.MatType.CV_8UC4, new OpenCvSharp.Scalar(0, 0, 0, 0));
- int index1 = 0;
- byte* ptr1 = (byte*)srcGray.Data;
- int index2 = 0;
- byte* ptr2 = (byte*)src.Data;
- for (int o = 0; o < srcGray.Height; o++)
- {
- for (int p = 0; p < srcGray.Width; p++)
- {
- index1 = (int)((srcGray.Step() * o) + (p * 1));
- index2 = (int)((src.Step() * o) + (p * 4));
- if (ptr1[index1] >= this.numericUpDown1.Value && ptr1[index1] <= this.numericUpDown2.Value)
- {
- ptr2[index2] = this.panel4.BackColor.B;
- ptr2[index2 + 1] = this.panel4.BackColor.G;
- ptr2[index2 + 2] = this.panel4.BackColor.R;
- ptr2[index2 + 3] = (byte)this.numericUpDown3.Value;
- }
- }
- }
- this.pictureUserControl1.ComBitmap = OpenCvSharp.Extensions.BitmapConverter.ToBitmap(src);
- this.pictureUserControl1.pictureBox1.Refresh();
- }
- }
- /// <summary>
- /// 对比对照 二值初始值
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void numericUpDown1_ValueChanged(object sender, EventArgs e)
- {
- IninializeBinaryCompare();
- }
- /// <summary>
- /// 对比对照 二值结束值
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void numericUpDown2_ValueChanged(object sender, EventArgs e)
- {
- IninializeBinaryCompare();
- }
- /// <summary>
- /// 对比对照 颜色panel点击事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void panel4_Click(object sender, EventArgs e)
- {
- IninializeBinaryCompare();
- }
- /// <summary>
- /// 透明度值改变事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void trackBar1_ValueChanged(object sender, EventArgs e)
- {
- this.numericUpDown3.Value = this.trackBar1.Value;
- }
- /// <summary>
- /// 透明度值改变事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void numericUpDown3_ValueChanged(object sender, EventArgs e)
- {
- this.trackBar1.Value = (int)this.numericUpDown3.Value;
- IninializeBinaryCompare();
- }
- /// <summary>
- /// 创建图片,合成图片
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button6_Click(object sender, EventArgs e)
- {
- if (this.pictureUserControl1.Bitmap!=null && this.pictureUserControl1.ComBitmap!=null)
- {
- Bitmap bitmap = null;
- try
- {
- int aw = this.pictureUserControl1.Bitmap.Width;
- int ah = this.pictureUserControl1.Bitmap.Height;
- int bw = this.pictureUserControl1.ComBitmap.Width;
- int bh = this.pictureUserControl1.ComBitmap.Height;
- int width = aw > bw ? aw : bw;
- int height = ah > bh ? ah : bh;
- bitmap = new Bitmap(width, height);
- Graphics graphics = Graphics.FromImage(bitmap);
- graphics.DrawImage(this.pictureUserControl1.Bitmap, (width - aw)/2, (height - ah)/2, aw, ah);
- graphics.DrawImage(this.pictureUserControl1.ComBitmap, (width - bw)/2, (height - bh)/2, bw, bh);
- //OpenCvSharp.Cv2.ImShow("123", PaintDotNet.Camera.Tools.ToMat(bitmap));
- DocumentWorkspace dw = this.appWorkspace.AddNewDocumentWorkspace();
- Document document = Document.FromImageMat(Camera.Tools.ToMat(bitmap));
- dw.Document = document;
-
- if (list != null && list.Count >0)
- {
- for (int i = 0; i < list.Count; i++)
- {
- if (list[i].ruler_name == this.comboBox1.Text)
- {
- dw.xmlSaveModel = list[i];
- }
- }
- }
- dw.InitRulerInfo();
- dw.fileText = this.Text + "-" + stepLength;
- this.appWorkspace.ActiveDocumentWorkspace = dw;
- Startup.instance.step_length += 1;
- stepLength = "00" + Startup.instance.step_length;
- }
- catch(Exception)
- {
- }
- finally
- {
- if (bitmap != null) bitmap.Dispose();
- }
- }
- }
- #endregion
- private void pp_radioButton_CheckedChanged(object sender, EventArgs e)
- {
- if (this.radioButton3.Checked)
- {
- this.num = 1;
- }
- else if(this.radioButton4.Checked)
- {
- this.num = 2;
- }
- else if (this.radioButton5.Checked)
- {
- this.num = 4;
- }
- else if (this.radioButton6.Checked)
- {
- this.num = 8;
- }
- if (((RadioButton)sender).Checked)
- {
- InitializeCompareControls();
- InitializePlayUserControl();
- }
- }
- /// <summary>
- /// 关联放大
- /// </summary>
- public void ZoomInButton_click()
- {
- foreach (Control control in this.panel1.Controls)
- {
- if(control.GetType() == typeof(PictureUserControl))
- {
- ((PictureUserControl)control).ZoomIn();
- }
- }
- }
- /// <summary>
- /// 关联缩小
- /// </summary>
- public void ZoomOutButton_click()
- {
- foreach (Control control in this.panel1.Controls)
- {
- if (control.GetType() == typeof(PictureUserControl))
- {
- ((PictureUserControl)control).ZoomOut();
- }
- }
- }
- /// <summary>
- /// 关联顺时针旋转90
- /// </summary>
- public void Rotate90Button_click()
- {
- foreach (Control control in this.panel1.Controls)
- {
- if (control.GetType() == typeof(PictureUserControl))
- {
- ((PictureUserControl)control).Rotate90();
- }
- }
- }
- /// <summary>
- /// 关联逆时针旋转90
- /// </summary>
- public void Rotate_90Button_click()
- {
- foreach (Control control in this.panel1.Controls)
- {
- if (control.GetType() == typeof(PictureUserControl))
- {
- ((PictureUserControl)control).Rotate_90();
- }
- }
- }
- public void SetSelectFlag()
- {
- foreach (Control control in this.panel1.Controls)
- {
- if (control.GetType() == typeof(PictureUserControl))
- {
- ((PictureUserControl)control).selectFlag = false;
- }
- }
- this.panel1.Refresh();
- }
- #region Windows Form Designer generated code
- private void InitializeLanguageText()
- {
- this.radioButton2.Text = PdnResources.GetString("Menu.Generalanalysis.Atlascomparison.Contrast.text");
- this.radioButton1.Text = PdnResources.GetString("Menu.Generalanalysis.Atlascomparison.Tilecontrast.text");
- this.groupBox5.Text = PdnResources.GetString("Menu.Setting.Text");
- this.label2.Text = PdnResources.GetString("Menu.Generalanalysis.Atlascomparison.Currentlevel.text") + ":";
- this.label1.Text = PdnResources.GetString("Menu.Generalanalysis.Atlascomparison.Useruler.text") + ":";
- this.Text = PdnResources.GetString("Menu.GeneralAnalysis.MapComparison.Text");
- this.groupBox2.Text = PdnResources.GetString("Menu.Generalanalysis.Atlascomparison.Atlasselection.text");
- this.groupBox3.Text = PdnResources.GetString("Menu.Generalanalysis.Atlascomparison.Atlascatalog.text");
- this.groupBox4.Text = PdnResources.GetString("Menu.Generalanalysis.Atlascomparison.Controlmode.text");
- this.button6.Text = PdnResources.GetString("Menu.Createpicture.text");
- this.label5.Text = PdnResources.GetString("Menu.transparency.text") + ":";
- this.label4.Text = PdnResources.GetString("Menu.color.text") + ":";
- this.label3.Text = PdnResources.GetString("Menu.Binarization.text") + ":";
- this.groupBox1.Text = PdnResources.GetString("Menu.operation.text");
- this.checkBox1.Text = PdnResources.GetString("Menu.Opensettingsatingreport.text");
- this.button5.Text = PdnResources.GetString("Menu.Setting.Text");
- this.button4.Text = PdnResources.GetString("Menu.Gallery.text");
- this.button3.Text = PdnResources.GetString("Menu.harddisk.text");
- this.button2.Text = PdnResources.GetString("Menu.Generalanalysis.Atlascomparison.Associatedpicture.text");
- this.button1.Text = PdnResources.GetString("Menu.Tools.CreateReport.Text");
- }
- private void InitializeComponent()
- {
- this.components = new System.ComponentModel.Container();
- this.groupBox1 = new System.Windows.Forms.GroupBox();
- this.checkBox1 = new System.Windows.Forms.CheckBox();
- this.button5 = new System.Windows.Forms.Button();
- this.button4 = new System.Windows.Forms.Button();
- this.button3 = new System.Windows.Forms.Button();
- this.button2 = new System.Windows.Forms.Button();
- this.button1 = new System.Windows.Forms.Button();
- this.groupBox2 = new System.Windows.Forms.GroupBox();
- this.treeView1 = new System.Windows.Forms.TreeView();
- this.groupBox3 = new System.Windows.Forms.GroupBox();
- this.listView1 = new System.Windows.Forms.ListView();
- this.imageList1 = new System.Windows.Forms.ImageList(this.components);
- this.groupBox4 = new System.Windows.Forms.GroupBox();
- this.panel2 = new System.Windows.Forms.Panel();
- this.radioButton6 = new System.Windows.Forms.RadioButton();
- this.radioButton5 = new System.Windows.Forms.RadioButton();
- this.radioButton4 = new System.Windows.Forms.RadioButton();
- this.radioButton3 = new System.Windows.Forms.RadioButton();
- this.panel3 = new System.Windows.Forms.Panel();
- this.button6 = new System.Windows.Forms.Button();
- this.numericUpDown3 = new System.Windows.Forms.NumericUpDown();
- this.trackBar1 = new System.Windows.Forms.TrackBar();
- this.label5 = new System.Windows.Forms.Label();
- this.panel4 = new System.Windows.Forms.Panel();
- this.label4 = new System.Windows.Forms.Label();
- this.numericUpDown2 = new System.Windows.Forms.NumericUpDown();
- this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
- this.label3 = new System.Windows.Forms.Label();
- this.radioButton2 = new System.Windows.Forms.RadioButton();
- this.radioButton1 = new System.Windows.Forms.RadioButton();
- this.groupBox5 = new System.Windows.Forms.GroupBox();
- this.label6 = new System.Windows.Forms.Label();
- this.comboBox1 = new System.Windows.Forms.ComboBox();
- this.label2 = new System.Windows.Forms.Label();
- this.label1 = new System.Windows.Forms.Label();
- this.panel1 = new System.Windows.Forms.Panel();
- this.groupBox1.SuspendLayout();
- this.groupBox2.SuspendLayout();
- this.groupBox3.SuspendLayout();
- this.groupBox4.SuspendLayout();
- this.panel2.SuspendLayout();
- this.panel3.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown3)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.trackBar1)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
- this.groupBox5.SuspendLayout();
- this.SuspendLayout();
- //
- // groupBox1
- //
- this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.groupBox1.Controls.Add(this.checkBox1);
- this.groupBox1.Controls.Add(this.button5);
- this.groupBox1.Controls.Add(this.button4);
- this.groupBox1.Controls.Add(this.button3);
- this.groupBox1.Controls.Add(this.button2);
- this.groupBox1.Controls.Add(this.button1);
- this.groupBox1.Location = new System.Drawing.Point(13, 13);
- this.groupBox1.Name = "groupBox1";
- this.groupBox1.Size = new System.Drawing.Size(1229, 52);
- this.groupBox1.TabIndex = 0;
- this.groupBox1.TabStop = false;
- this.groupBox1.Text = "操作";
- //
- // checkBox1
- //
- this.checkBox1.AutoSize = true;
- this.checkBox1.Location = new System.Drawing.Point(89, 23);
- this.checkBox1.Name = "checkBox1";
- this.checkBox1.Size = new System.Drawing.Size(132, 16);
- this.checkBox1.TabIndex = 5;
- this.checkBox1.Text = "生成报告时打开设置";
- this.checkBox1.UseVisualStyleBackColor = true;
- //
- // button5
- //
- this.button5.Location = new System.Drawing.Point(7, 20);
- this.button5.Name = "button5";
- this.button5.Size = new System.Drawing.Size(75, 23);
- this.button5.TabIndex = 4;
- this.button5.Text = "设置";
- this.button5.UseVisualStyleBackColor = true;
- this.button5.Click += new System.EventHandler(this.button5_Click);
- //
- // button4
- //
- this.button4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.button4.Location = new System.Drawing.Point(905, 20);
- this.button4.Name = "button4";
- this.button4.Size = new System.Drawing.Size(75, 23);
- this.button4.TabIndex = 3;
- this.button4.Text = "图库";
- this.button4.UseVisualStyleBackColor = true;
- this.button4.Click += new System.EventHandler(this.button4_Click);
- //
- // button3
- //
- this.button3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.button3.Location = new System.Drawing.Point(986, 20);
- this.button3.Name = "button3";
- this.button3.Size = new System.Drawing.Size(75, 23);
- this.button3.TabIndex = 2;
- this.button3.Text = "硬盘";
- this.button3.UseVisualStyleBackColor = true;
- this.button3.Click += new System.EventHandler(this.button3_Click);
- //
- // button2
- //
- this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.button2.Location = new System.Drawing.Point(1067, 20);
- this.button2.Name = "button2";
- this.button2.Size = new System.Drawing.Size(75, 23);
- this.button2.TabIndex = 1;
- this.button2.Text = "关联图片";
- this.button2.UseVisualStyleBackColor = true;
- this.button2.Click += new System.EventHandler(this.button2_Click);
- //
- // button1
- //
- this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.button1.Location = new System.Drawing.Point(1148, 20);
- this.button1.Name = "button1";
- this.button1.Size = new System.Drawing.Size(75, 23);
- this.button1.TabIndex = 0;
- this.button1.Text = "生成报告";
- this.button1.UseVisualStyleBackColor = true;
- this.button1.Click += new System.EventHandler(this.button1_Click);
- //
- // groupBox2
- //
- this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)));
- this.groupBox2.Controls.Add(this.treeView1);
- this.groupBox2.Location = new System.Drawing.Point(13, 72);
- this.groupBox2.Name = "groupBox2";
- this.groupBox2.Size = new System.Drawing.Size(186, 484);
- this.groupBox2.TabIndex = 1;
- this.groupBox2.TabStop = false;
- this.groupBox2.Text = "图谱选择";
- //
- // treeView1
- //
- this.treeView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.treeView1.Location = new System.Drawing.Point(7, 21);
- this.treeView1.Name = "treeView1";
- this.treeView1.Size = new System.Drawing.Size(173, 457);
- this.treeView1.TabIndex = 0;
- this.treeView1.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.treeView1_NodeMouseClick);
- //
- // groupBox3
- //
- this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)));
- this.groupBox3.Controls.Add(this.listView1);
- this.groupBox3.Location = new System.Drawing.Point(205, 72);
- this.groupBox3.Name = "groupBox3";
- this.groupBox3.Size = new System.Drawing.Size(133, 385);
- this.groupBox3.TabIndex = 2;
- this.groupBox3.TabStop = false;
- this.groupBox3.Text = "图谱目录";
- //
- // listView1
- //
- this.listView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.listView1.HideSelection = false;
- this.listView1.LargeImageList = this.imageList1;
- this.listView1.Location = new System.Drawing.Point(7, 21);
- this.listView1.Name = "listView1";
- this.listView1.Size = new System.Drawing.Size(120, 358);
- this.listView1.TabIndex = 0;
- this.listView1.UseCompatibleStateImageBehavior = false;
- //
- // imageList1
- //
- this.imageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
- this.imageList1.ImageSize = new System.Drawing.Size(16, 16);
- this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
- //
- // groupBox4
- //
- this.groupBox4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.groupBox4.Controls.Add(this.panel2);
- this.groupBox4.Controls.Add(this.panel3);
- this.groupBox4.Controls.Add(this.radioButton2);
- this.groupBox4.Controls.Add(this.radioButton1);
- this.groupBox4.Location = new System.Drawing.Point(205, 463);
- this.groupBox4.Name = "groupBox4";
- this.groupBox4.Size = new System.Drawing.Size(690, 93);
- this.groupBox4.TabIndex = 3;
- this.groupBox4.TabStop = false;
- this.groupBox4.Text = "对照模式";
- //
- // panel2
- //
- this.panel2.Controls.Add(this.radioButton6);
- this.panel2.Controls.Add(this.radioButton5);
- this.panel2.Controls.Add(this.radioButton4);
- this.panel2.Controls.Add(this.radioButton3);
- this.panel2.Location = new System.Drawing.Point(87, 12);
- this.panel2.Name = "panel2";
- this.panel2.Size = new System.Drawing.Size(320, 75);
- this.panel2.TabIndex = 2;
- //
- // radioButton6
- //
- this.radioButton6.AutoSize = true;
- this.radioButton6.Location = new System.Drawing.Point(118, 14);
- this.radioButton6.Name = "radioButton6";
- this.radioButton6.Size = new System.Drawing.Size(29, 16);
- this.radioButton6.TabIndex = 3;
- this.radioButton6.TabStop = true;
- this.radioButton6.Text = "8";
- this.radioButton6.UseVisualStyleBackColor = true;
- this.radioButton6.CheckedChanged += new System.EventHandler(this.pp_radioButton_CheckedChanged);
- //
- // radioButton5
- //
- this.radioButton5.AutoSize = true;
- this.radioButton5.Location = new System.Drawing.Point(83, 14);
- this.radioButton5.Name = "radioButton5";
- this.radioButton5.Size = new System.Drawing.Size(29, 16);
- this.radioButton5.TabIndex = 2;
- this.radioButton5.TabStop = true;
- this.radioButton5.Text = "4";
- this.radioButton5.UseVisualStyleBackColor = true;
- this.radioButton5.CheckedChanged += new System.EventHandler(this.pp_radioButton_CheckedChanged);
- //
- // radioButton4
- //
- this.radioButton4.AutoSize = true;
- this.radioButton4.Location = new System.Drawing.Point(48, 14);
- this.radioButton4.Name = "radioButton4";
- this.radioButton4.Size = new System.Drawing.Size(29, 16);
- this.radioButton4.TabIndex = 1;
- this.radioButton4.TabStop = true;
- this.radioButton4.Text = "2";
- this.radioButton4.UseVisualStyleBackColor = true;
- this.radioButton4.CheckedChanged += new System.EventHandler(this.pp_radioButton_CheckedChanged);
- //
- // radioButton3
- //
- this.radioButton3.AutoSize = true;
- this.radioButton3.Checked = true;
- this.radioButton3.Location = new System.Drawing.Point(13, 14);
- this.radioButton3.Name = "radioButton3";
- this.radioButton3.Size = new System.Drawing.Size(29, 16);
- this.radioButton3.TabIndex = 0;
- this.radioButton3.TabStop = true;
- this.radioButton3.Text = "1";
- this.radioButton3.UseVisualStyleBackColor = true;
- this.radioButton3.CheckedChanged += new System.EventHandler(this.pp_radioButton_CheckedChanged);
- //
- // panel3
- //
- this.panel3.Controls.Add(this.button6);
- this.panel3.Controls.Add(this.numericUpDown3);
- this.panel3.Controls.Add(this.trackBar1);
- this.panel3.Controls.Add(this.label5);
- this.panel3.Controls.Add(this.panel4);
- this.panel3.Controls.Add(this.label4);
- this.panel3.Controls.Add(this.numericUpDown2);
- this.panel3.Controls.Add(this.numericUpDown1);
- this.panel3.Controls.Add(this.label3);
- this.panel3.Location = new System.Drawing.Point(87, 12);
- this.panel3.Name = "panel3";
- this.panel3.Size = new System.Drawing.Size(320, 75);
- this.panel3.TabIndex = 4;
- //
- // button6
- //
- this.button6.Location = new System.Drawing.Point(223, 38);
- this.button6.Name = "button6";
- this.button6.Size = new System.Drawing.Size(75, 23);
- this.button6.TabIndex = 8;
- this.button6.UseVisualStyleBackColor = true;
- this.button6.Click += new System.EventHandler(this.button6_Click);
- //
- // numericUpDown3
- //
- this.numericUpDown3.Location = new System.Drawing.Point(169, 39);
- this.numericUpDown3.Maximum = new decimal(new int[] {
- 255,
- 0,
- 0,
- 0});
- this.numericUpDown3.Name = "numericUpDown3";
- this.numericUpDown3.Size = new System.Drawing.Size(48, 21);
- this.numericUpDown3.TabIndex = 7;
- this.numericUpDown3.ValueChanged += new System.EventHandler(this.numericUpDown3_ValueChanged);
- //
- // trackBar1
- //
- this.trackBar1.Location = new System.Drawing.Point(59, 41);
- this.trackBar1.Maximum = 255;
- this.trackBar1.Name = "trackBar1";
- this.trackBar1.Size = new System.Drawing.Size(104, 45);
- this.trackBar1.TabIndex = 6;
- this.trackBar1.TickStyle = System.Windows.Forms.TickStyle.None;
- this.trackBar1.ValueChanged += new System.EventHandler(this.trackBar1_ValueChanged);
- //
- // label5
- //
- this.label5.AutoSize = true;
- this.label5.Location = new System.Drawing.Point(11, 43);
- this.label5.Name = "label5";
- this.label5.Size = new System.Drawing.Size(0, 12);
- this.label5.TabIndex = 5;
- //
- // panel4
- //
- this.panel4.BackColor = System.Drawing.Color.Red;
- this.panel4.Location = new System.Drawing.Point(211, 10);
- this.panel4.Name = "panel4";
- this.panel4.Size = new System.Drawing.Size(48, 21);
- this.panel4.TabIndex = 4;
- this.panel4.Click += new System.EventHandler(this.panel4_Click);
- //
- // label4
- //
- this.label4.AutoSize = true;
- this.label4.Location = new System.Drawing.Point(171, 14);
- this.label4.Name = "label4";
- this.label4.Size = new System.Drawing.Size(0, 12);
- this.label4.TabIndex = 3;
- //
- // numericUpDown2
- //
- this.numericUpDown2.Location = new System.Drawing.Point(118, 10);
- this.numericUpDown2.Maximum = new decimal(new int[] {
- 255,
- 0,
- 0,
- 0});
- this.numericUpDown2.Name = "numericUpDown2";
- this.numericUpDown2.Size = new System.Drawing.Size(48, 21);
- this.numericUpDown2.TabIndex = 2;
- this.numericUpDown2.ValueChanged += new System.EventHandler(this.numericUpDown2_ValueChanged);
- //
- // numericUpDown1
- //
- this.numericUpDown1.Location = new System.Drawing.Point(65, 10);
- this.numericUpDown1.Maximum = new decimal(new int[] {
- 255,
- 0,
- 0,
- 0});
- this.numericUpDown1.Name = "numericUpDown1";
- this.numericUpDown1.Size = new System.Drawing.Size(48, 21);
- this.numericUpDown1.TabIndex = 1;
- this.numericUpDown1.ValueChanged += new System.EventHandler(this.numericUpDown1_ValueChanged);
- //
- // label3
- //
- this.label3.AutoSize = true;
- this.label3.Location = new System.Drawing.Point(11, 14);
- this.label3.Name = "label3";
- this.label3.Size = new System.Drawing.Size(0, 12);
- this.label3.TabIndex = 0;
- //
- // radioButton2
- //
- this.radioButton2.AutoSize = true;
- this.radioButton2.Location = new System.Drawing.Point(10, 49);
- this.radioButton2.Name = "radioButton2";
- this.radioButton2.Size = new System.Drawing.Size(71, 16);
- this.radioButton2.TabIndex = 1;
- this.radioButton2.Text = "对比对照";
- this.radioButton2.UseVisualStyleBackColor = true;
- this.radioButton2.CheckedChanged += new System.EventHandler(this.radioButton_CheckedChanged);
- //
- // radioButton1
- //
- this.radioButton1.AutoSize = true;
- this.radioButton1.Checked = true;
- this.radioButton1.Location = new System.Drawing.Point(10, 26);
- this.radioButton1.Name = "radioButton1";
- this.radioButton1.Size = new System.Drawing.Size(71, 16);
- this.radioButton1.TabIndex = 0;
- this.radioButton1.TabStop = true;
- this.radioButton1.Text = "平铺对照";
- this.radioButton1.UseVisualStyleBackColor = true;
- this.radioButton1.CheckedChanged += new System.EventHandler(this.radioButton_CheckedChanged);
- //
- // groupBox5
- //
- this.groupBox5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.groupBox5.Controls.Add(this.label6);
- this.groupBox5.Controls.Add(this.comboBox1);
- this.groupBox5.Controls.Add(this.label2);
- this.groupBox5.Controls.Add(this.label1);
- this.groupBox5.Location = new System.Drawing.Point(901, 463);
- this.groupBox5.Name = "groupBox5";
- this.groupBox5.Size = new System.Drawing.Size(341, 93);
- this.groupBox5.TabIndex = 4;
- this.groupBox5.TabStop = false;
- this.groupBox5.Text = "设置";
- //
- // label6
- //
- this.label6.AutoSize = true;
- this.label6.Location = new System.Drawing.Point(86, 54);
- this.label6.Name = "label6";
- this.label6.Size = new System.Drawing.Size(65, 12);
- this.label6.TabIndex = 3;
- this.label6.Text = "当前级别:";
- //
- // comboBox1
- //
- this.comboBox1.FormattingEnabled = true;
- this.comboBox1.Location = new System.Drawing.Point(87, 22);
- this.comboBox1.Name = "comboBox1";
- this.comboBox1.Size = new System.Drawing.Size(248, 20);
- this.comboBox1.TabIndex = 2;
- this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
- //
- // label2
- //
- this.label2.AutoSize = true;
- this.label2.Location = new System.Drawing.Point(15, 54);
- this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(65, 12);
- this.label2.TabIndex = 1;
- this.label2.Text = "当前级别:";
- //
- // label1
- //
- this.label1.AutoSize = true;
- this.label1.Location = new System.Drawing.Point(15, 26);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(65, 12);
- this.label1.TabIndex = 0;
- this.label1.Text = "使用标尺:";
- //
- // panel1
- //
- this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.panel1.Location = new System.Drawing.Point(344, 72);
- this.panel1.Name = "panel1";
- this.panel1.Size = new System.Drawing.Size(898, 385);
- this.panel1.TabIndex = 5;
- this.panel1.SizeChanged += new System.EventHandler(this.panel1_SizeChanged);
- //
- // AtlasComparisonDialog
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
- this.ClientSize = new System.Drawing.Size(1254, 568);
- this.Controls.Add(this.panel1);
- this.Controls.Add(this.groupBox5);
- this.Controls.Add(this.groupBox4);
- this.Controls.Add(this.groupBox3);
- this.Controls.Add(this.groupBox2);
- this.Controls.Add(this.groupBox1);
- this.Name = "AtlasComparisonDialog";
- this.Text = "图谱比照";
- this.Load += new System.EventHandler(this.AtlasComparisonDialog_Load);
- this.Controls.SetChildIndex(this.groupBox1, 0);
- this.Controls.SetChildIndex(this.groupBox2, 0);
- this.Controls.SetChildIndex(this.groupBox3, 0);
- this.Controls.SetChildIndex(this.groupBox4, 0);
- this.Controls.SetChildIndex(this.groupBox5, 0);
- this.Controls.SetChildIndex(this.panel1, 0);
- this.groupBox1.ResumeLayout(false);
- this.groupBox1.PerformLayout();
- this.groupBox2.ResumeLayout(false);
- this.groupBox3.ResumeLayout(false);
- this.groupBox4.ResumeLayout(false);
- this.groupBox4.PerformLayout();
- this.panel2.ResumeLayout(false);
- this.panel2.PerformLayout();
- this.panel3.ResumeLayout(false);
- this.panel3.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown3)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.trackBar1)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
- this.groupBox5.ResumeLayout(false);
- this.groupBox5.PerformLayout();
- this.ResumeLayout(false);
- }
- #endregion
- /// <summary>
- /// 获取上次操作参数
- /// </summary>
- private void getLastData()
- {
- string filePath = Application.StartupPath + "\\Config\\Default\\ParameterSaving\\ParameterGeneralAnalysis.xml";
- if (!System.IO.File.Exists(filePath))
- {
- generalAnalysisModel = new GeneralAnalysisModel();
- generalAnalysisModel.PolyphaseMutiAreaContentModels = new GeneralAnalysisModel.PolyphaseMutiAreaContentModel();
- generalAnalysisModel.PolyphaseCounterAnalysisModels = new GeneralAnalysisModel.PolyphaseCounterAnalysisModel();
- generalAnalysisModel.TwoPhaseScaleModels = new GeneralAnalysisModel.TwoPhaseScaleModel();
- generalAnalysisModel.PolyphaseContentModels = new GeneralAnalysisModel.PolyphaseContentModel();
- generalAnalysisModel.PolyphaseDistanceModels = new GeneralAnalysisModel.PolyphaseDistanceModel();
- generalAnalysisModel.DebrisSelectionModels = new GeneralAnalysisModel.DebrisSelectionModel();
- generalAnalysisModel.CountNumberAnalysisModels = new GeneralAnalysisModel.CountNumberAnalysisModel();
- generalAnalysisModel.AtlasComparisonModels = new GeneralAnalysisModel.AtlasComparisonModel();
- generalAnalysisModel.PolyphaseMutiAreaContentModels.hasUsed = false;
- generalAnalysisModel.PolyphaseCounterAnalysisModels.hasUsed = false;
- generalAnalysisModel.TwoPhaseScaleModels.hasUsed = false;
- generalAnalysisModel.PolyphaseContentModels.hasUsed = false;
- generalAnalysisModel.PolyphaseDistanceModels.hasUsed = false;
- generalAnalysisModel.DebrisSelectionModels.hasUsed = false;
- generalAnalysisModel.CountNumberAnalysisModels.hasUsed = false;
- generalAnalysisModel.AtlasComparisonModels.hasUsed = false;
- string porosityInfoXml = XmlSerializeHelper.XmlSerialize<GeneralAnalysisModel>(generalAnalysisModel);
- Directory.CreateDirectory(Application.StartupPath + "\\Config\\Default\\ParameterSaving\\");
- FileOperationHelper.WriteStringToFile(porosityInfoXml, filePath, FileMode.CreateNew);
- }
- else
- {
- generalAnalysisModel = XmlSerializeHelper.DESerializer<GeneralAnalysisModel>(FileOperationHelper.ReadStringFromFile(filePath, FileMode.Open));
- if (generalAnalysisModel.AtlasComparisonModels == null)
- {
- generalAnalysisModel.AtlasComparisonModels = new GeneralAnalysisModel.AtlasComparisonModel();
- }
- if (generalAnalysisModel.AtlasComparisonModels.hasUsed)
- {
- checkBox1.Checked = generalAnalysisModel.AtlasComparisonModels.parameter1;
- radioButton1.Checked = generalAnalysisModel.AtlasComparisonModels.parameter2 == 1 ? true:false;
- radioButton2.Checked = generalAnalysisModel.AtlasComparisonModels.parameter2 == 2 ? true:false;
- switch (generalAnalysisModel.AtlasComparisonModels.parameter3) {
- case 0:
- radioButton3.Checked = true;
- radioButton4.Checked = false;
- radioButton5.Checked = false;
- radioButton6.Checked = false;
- break;
- case 1:
- radioButton3.Checked = true;
- radioButton4.Checked = false;
- radioButton5.Checked = false;
- radioButton6.Checked = false;
- break;
- case 2:
- radioButton3.Checked = false;
- radioButton4.Checked = true;
- radioButton5.Checked = false;
- radioButton6.Checked = false;
- break;
- case 3:
- radioButton3.Checked = false;
- radioButton4.Checked = false;
- radioButton5.Checked = true;
- radioButton6.Checked = false;
- break;
- case 4:
- radioButton3.Checked = false;
- radioButton4.Checked = false;
- radioButton5.Checked = false;
- radioButton6.Checked = true;
- break;
- }
- numericUpDown1.Value = generalAnalysisModel.AtlasComparisonModels.parameter4;
- numericUpDown2.Value = generalAnalysisModel.AtlasComparisonModels.parameter5;
- panel4.BackColor = Color.FromArgb(generalAnalysisModel.AtlasComparisonModels.parameter6);
- trackBar1.Value = generalAnalysisModel.AtlasComparisonModels.parameter7;
- numericUpDown3.Value = generalAnalysisModel.AtlasComparisonModels.parameter7;
- }
- }
- }
- /// <summary>
- /// 保存上次操作参数
- /// </summary>
- private void saveLastData(object sender, EventArgs e)
- {
- if (generalAnalysisModel.AtlasComparisonModels == null)
- {
- generalAnalysisModel.AtlasComparisonModels = new GeneralAnalysisModel.AtlasComparisonModel();
- }
- generalAnalysisModel.AtlasComparisonModels.hasUsed = true;
- generalAnalysisModel.AtlasComparisonModels.parameter1 = checkBox1.Checked;
- generalAnalysisModel.AtlasComparisonModels.parameter2 = radioButton1.Checked ? 1 : 2;
- if (radioButton3.Checked) {
- generalAnalysisModel.AtlasComparisonModels.parameter3 = 1;
- }
- else if (radioButton4.Checked)
- {
- generalAnalysisModel.AtlasComparisonModels.parameter3 = 2;
- }
- else if (radioButton5.Checked)
- {
- generalAnalysisModel.AtlasComparisonModels.parameter3 = 3;
- }
- else if (radioButton6.Checked)
- {
- generalAnalysisModel.AtlasComparisonModels.parameter3 = 4;
- }
- generalAnalysisModel.AtlasComparisonModels.parameter4 = (int)numericUpDown1.Value;
- generalAnalysisModel.AtlasComparisonModels.parameter5 = (int)numericUpDown2.Value;
- generalAnalysisModel.AtlasComparisonModels.parameter6 = panel4.BackColor.ToArgb();
- generalAnalysisModel.AtlasComparisonModels.parameter7 = trackBar1.Value;
- string filePath = Application.StartupPath + "\\Config\\Default\\ParameterSaving\\ParameterGeneralAnalysis.xml";
- string porosityInfoXml = XmlSerializeHelper.XmlSerialize<GeneralAnalysisModel>(generalAnalysisModel);
- FileOperationHelper.WriteStringToFile(porosityInfoXml, filePath, FileMode.Create);
- }
- }
- }
|