12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Data.SQLite;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using PaintDotNet.Annotation.Enum;
- using PaintDotNet.Annotation.Measure;
- using PaintDotNet.Base.CommTool;
- using PaintDotNet.Base.SettingModel;
- using PaintDotNet.CustomControl;
- using PaintDotNet.GeneralAnalysis.Special;
- using PaintDotNet.DbOpreate.DbModel;
- using PaintDotNet.DbOpreate.DbBll;
- using System.IO;
- using PaintDotNet.Base.Functionodel;
- using PaintDotNet.Annotation;
- using PaintDotNet.Instrument;
- using Metis.ParameterSet;
- namespace PaintDotNet.GeneralAnalysis
- {
- /// <summary>
- /// 专项测量 - 长度
- /// </summary>
- internal class SpecialMeasureLengthDialog : PdnBaseForm
- {
- #region
- /// <summary>
- /// Required designer variable.
- /// </summary>
- private System.ComponentModel.IContainer components = null;
- /// <summary>
- /// Clean up any resources being used.
- /// </summary>
- /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
- #region Windows Form Designer generated code
- private void InitializeLanguageText()
- {
- this.groupBox1.Text = PdnResources.GetString("Menu.operation.text");
- this.btnSave.Text = PdnResources.GetString("Menu.Saveresult.text");
- this.btnSetting.Text = PdnResources.GetString("Menu.Setting.Text");
- this.chkOpenSetting.Text = PdnResources.GetString("Menu.Opensettingsatingreport.text");
- this.btnMeasure.Text = PdnResources.GetString("Menu.Startmeasuring.text");
- this.groupBox2.Text = PdnResources.GetString("Menu.Tools.ImageIndex.Text");
- this.groupBox3.Text = PdnResources.GetString("Menu.LabelAction.DrawLine.Text");
- this.btnStraightLineMeasure.Text = PdnResources.GetString("Menu.measuring.text");
- this.label3.Text = PdnResources.GetString("Menu.Linewidth.text") + ":";
- this.label2.Text = PdnResources.GetString("Menu.style.text") + ":";
- this.label1.Text = PdnResources.GetString("Menu.color.text") + ":";
- this.groupBox4.Text = PdnResources.GetString("Menu.Preview.text");
- this.btnDelete.Text = PdnResources.GetString("Menu.Edit.Delete.Text");
- this.groupBox5.Text = PdnResources.GetString("Menu.MeasureAction.MeasureLength.Text");
- this.btnLengthLineMeasure.Text = PdnResources.GetString("Menu.measuring.text");
- this.label4.Text = PdnResources.GetString("Menu.Linewidth.text") + ":";
- this.label5.Text = PdnResources.GetString("Menu.style.text") + ":";
- this.label6.Text = PdnResources.GetString("Menu.color.text") + ":";
- this.groupBox6.Text = PdnResources.GetString("Menu.MeasureAction.MeasureParallelLine.Text");
- this.btnParallelLineMeasure.Text = PdnResources.GetString("Menu.measuring.text");
- this.label7.Text = PdnResources.GetString("Menu.Linewidth.text") + ":";
- this.label8.Text = PdnResources.GetString("Menu.style.text") + ":";
- this.label9.Text = PdnResources.GetString("Menu.color.text") + ":";
- this.groupBox7.Text = PdnResources.GetString("Menu.Resultspreview.text");
- this.label12.Text = PdnResources.GetString("Menu.Correspondinglevel.text") + ":";
- this.label10.Text = PdnResources.GetString("Menu.averagevalue.text") + ":";
- this.name.HeaderText = PdnResources.GetString("Menu.Levelname.text");
- this.minValue.HeaderText = PdnResources.GetString("Menu.Begintovalue.Text");
- this.maxValue.HeaderText = PdnResources.GetString("Menu.Theendvalu.Text");
- this.groupBox8.Text = PdnResources.GetString("Menu.Analysisresult.text");
- this.btnResultDel.Text = PdnResources.GetString("Menu.Edit.Delete.Text");
- this.btnAllShow.Text = PdnResources.GetString("Menu.Showall.text");
- this.picName.HeaderText = PdnResources.GetString("Menu.picture.Text");
- this.level.HeaderText = PdnResources.GetString("Menu.Levelname.text");
- this.avg.HeaderText = PdnResources.GetString("Menu.averagevalue.text");
- this.label11.Text = PdnResources.GetString("Menu.Decimal.text");
- this.btnExport.Text = PdnResources.GetString("Menu.Exportresults.text");
- this.btnCreate.Text = PdnResources.GetString("Menu.Tools.CreateReport.Text");
- this.btnExportProject.Text = PdnResources.GetString("Menu.Exportproject.text");
- this.Text = PdnResources.GetString("Menu.Generalanalysis.Specialmeasurement.Specialmeth.text");
- }
- /// <summary>
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- /// </summary>
- private void InitializeComponent()
- {
- this.components = new System.ComponentModel.Container();
- this.groupBox1 = new System.Windows.Forms.GroupBox();
- this.btnSave = new System.Windows.Forms.Button();
- this.btnSetting = new System.Windows.Forms.Button();
- this.chkOpenSetting = new System.Windows.Forms.CheckBox();
- this.btnMeasure = new System.Windows.Forms.Button();
- this.cmbSpecial = new System.Windows.Forms.ComboBox();
- this.groupBox2 = new System.Windows.Forms.GroupBox();
- this.lstPic = new System.Windows.Forms.ListView();
- this.imageList1 = new System.Windows.Forms.ImageList(this.components);
- this.groupBox3 = new System.Windows.Forms.GroupBox();
- this.btnStraightLineMeasure = new System.Windows.Forms.Button();
- this.cmbStraightLine = new System.Windows.Forms.ComboBox();
- this.pnlStraightLineColor = new System.Windows.Forms.Panel();
- this.nudStraightLineWidth = new System.Windows.Forms.NumericUpDown();
- this.label3 = new System.Windows.Forms.Label();
- this.label2 = new System.Windows.Forms.Label();
- this.label1 = new System.Windows.Forms.Label();
- this.groupBox4 = new System.Windows.Forms.GroupBox();
- this.pnlTools = new System.Windows.Forms.Panel();
- this.btnDelete = new System.Windows.Forms.Button();
- this.pnlShow = new System.Windows.Forms.Panel();
- this.groupBox5 = new System.Windows.Forms.GroupBox();
- this.btnLengthLineMeasure = new System.Windows.Forms.Button();
- this.cmbLengthLine = new System.Windows.Forms.ComboBox();
- this.pnlLengthLineColor = new System.Windows.Forms.Panel();
- this.nudLengthLineWidth = new System.Windows.Forms.NumericUpDown();
- this.label4 = new System.Windows.Forms.Label();
- this.label5 = new System.Windows.Forms.Label();
- this.label6 = new System.Windows.Forms.Label();
- this.groupBox6 = new System.Windows.Forms.GroupBox();
- this.btnParallelLineMeasure = new System.Windows.Forms.Button();
- this.cmbParallelLine = new System.Windows.Forms.ComboBox();
- this.pnlParallelLineColor = new System.Windows.Forms.Panel();
- this.nudParallelLineWidth = new System.Windows.Forms.NumericUpDown();
- this.label7 = new System.Windows.Forms.Label();
- this.label8 = new System.Windows.Forms.Label();
- this.label9 = new System.Windows.Forms.Label();
- this.groupBox7 = new System.Windows.Forms.GroupBox();
- this.lblLevel = new System.Windows.Forms.Label();
- this.label12 = new System.Windows.Forms.Label();
- this.lblAvg = new System.Windows.Forms.Label();
- this.label10 = new System.Windows.Forms.Label();
- this.dgvLevelList = new System.Windows.Forms.DataGridView();
- this.name = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.minValue = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.maxValue = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.groupBox8 = new System.Windows.Forms.GroupBox();
- this.lstResult = new System.Windows.Forms.ListView();
- this.btnResultDel = new System.Windows.Forms.Button();
- this.btnAllShow = new System.Windows.Forms.Button();
- this.groupBox9 = new System.Windows.Forms.GroupBox();
- this.dgvResult = new System.Windows.Forms.DataGridView();
- this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.picName = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.level = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.avg = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.groupBox10 = new System.Windows.Forms.GroupBox();
- this.btnExportProject = new System.Windows.Forms.Button();
- this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
- this.label11 = new System.Windows.Forms.Label();
- this.btnExport = new System.Windows.Forms.Button();
- this.btnCreate = new System.Windows.Forms.Button();
- this.groupBox1.SuspendLayout();
- this.groupBox2.SuspendLayout();
- this.groupBox3.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.nudStraightLineWidth)).BeginInit();
- this.groupBox4.SuspendLayout();
- this.groupBox5.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.nudLengthLineWidth)).BeginInit();
- this.groupBox6.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.nudParallelLineWidth)).BeginInit();
- this.groupBox7.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.dgvLevelList)).BeginInit();
- this.groupBox8.SuspendLayout();
- this.groupBox9.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.dgvResult)).BeginInit();
- this.groupBox10.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
- 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.btnSave);
- this.groupBox1.Controls.Add(this.btnSetting);
- this.groupBox1.Controls.Add(this.chkOpenSetting);
- this.groupBox1.Controls.Add(this.btnMeasure);
- this.groupBox1.Controls.Add(this.cmbSpecial);
- this.groupBox1.Location = new System.Drawing.Point(12, 12);
- this.groupBox1.Name = "groupBox1";
- this.groupBox1.Size = new System.Drawing.Size(1210, 73);
- this.groupBox1.TabIndex = 0;
- this.groupBox1.TabStop = false;
- this.groupBox1.Text = "操作";
- //
- // btnSave
- //
- this.btnSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.btnSave.Location = new System.Drawing.Point(1091, 24);
- this.btnSave.Name = "btnSave";
- this.btnSave.Size = new System.Drawing.Size(101, 35);
- this.btnSave.TabIndex = 4;
- this.btnSave.Text = "保存结果";
- this.btnSave.UseVisualStyleBackColor = true;
- this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
- //
- // btnSetting
- //
- this.btnSetting.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.btnSetting.Location = new System.Drawing.Point(987, 24);
- this.btnSetting.Name = "btnSetting";
- this.btnSetting.Size = new System.Drawing.Size(85, 35);
- this.btnSetting.TabIndex = 3;
- this.btnSetting.Text = "设置";
- this.btnSetting.UseVisualStyleBackColor = true;
- this.btnSetting.Click += new System.EventHandler(this.btnSetting_Click);
- //
- // chkOpenSetting
- //
- this.chkOpenSetting.AutoSize = true;
- this.chkOpenSetting.Checked = true;
- this.chkOpenSetting.CheckState = System.Windows.Forms.CheckState.Checked;
- this.chkOpenSetting.Location = new System.Drawing.Point(433, 31);
- this.chkOpenSetting.Name = "chkOpenSetting";
- this.chkOpenSetting.Size = new System.Drawing.Size(15, 14);
- this.chkOpenSetting.TabIndex = 2;
- this.chkOpenSetting.UseVisualStyleBackColor = true;
- this.chkOpenSetting.CheckedChanged += new System.EventHandler(this.chkOpenSetting_CheckedChanged);
- //
- // btnMeasure
- //
- this.btnMeasure.Location = new System.Drawing.Point(268, 24);
- this.btnMeasure.Name = "btnMeasure";
- this.btnMeasure.Size = new System.Drawing.Size(137, 35);
- this.btnMeasure.TabIndex = 1;
- this.btnMeasure.UseVisualStyleBackColor = true;
- this.btnMeasure.Click += new System.EventHandler(this.btnMeasure_Click);
- //
- // cmbSpecial
- //
- this.cmbSpecial.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
- this.cmbSpecial.FormattingEnabled = true;
- this.cmbSpecial.Location = new System.Drawing.Point(17, 29);
- this.cmbSpecial.Name = "cmbSpecial";
- this.cmbSpecial.Size = new System.Drawing.Size(231, 20);
- this.cmbSpecial.TabIndex = 0;
- this.cmbSpecial.SelectedIndexChanged += new System.EventHandler(this.cmbSpecial_SelectedIndexChanged);
- //
- // 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.lstPic);
- this.groupBox2.Location = new System.Drawing.Point(12, 88);
- this.groupBox2.Name = "groupBox2";
- this.groupBox2.Size = new System.Drawing.Size(200, 500);
- this.groupBox2.TabIndex = 1;
- this.groupBox2.TabStop = false;
- this.groupBox2.Text = "图像索引";
- //
- // lstPic
- //
- this.lstPic.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)));
- this.lstPic.HideSelection = false;
- this.lstPic.LargeImageList = this.imageList1;
- this.lstPic.Location = new System.Drawing.Point(17, 27);
- this.lstPic.MultiSelect = false;
- this.lstPic.Name = "lstPic";
- this.lstPic.Size = new System.Drawing.Size(166, 460);
- this.lstPic.TabIndex = 0;
- this.lstPic.UseCompatibleStateImageBehavior = false;
- this.lstPic.SelectedIndexChanged += new System.EventHandler(this.lstPic_SelectedIndexChanged);
- //
- // imageList1
- //
- this.imageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
- this.imageList1.ImageSize = new System.Drawing.Size(64, 64);
- this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
- //
- // groupBox3
- //
- this.groupBox3.Controls.Add(this.btnStraightLineMeasure);
- this.groupBox3.Controls.Add(this.cmbStraightLine);
- this.groupBox3.Controls.Add(this.pnlStraightLineColor);
- this.groupBox3.Controls.Add(this.nudStraightLineWidth);
- this.groupBox3.Controls.Add(this.label3);
- this.groupBox3.Controls.Add(this.label2);
- this.groupBox3.Controls.Add(this.label1);
- this.groupBox3.Location = new System.Drawing.Point(218, 91);
- this.groupBox3.Name = "groupBox3";
- this.groupBox3.Size = new System.Drawing.Size(360, 100);
- this.groupBox3.TabIndex = 2;
- this.groupBox3.TabStop = false;
- this.groupBox3.Text = "直线";
- //
- // btnStraightLineMeasure
- //
- this.btnStraightLineMeasure.Enabled = false;
- this.btnStraightLineMeasure.Location = new System.Drawing.Point(263, 60);
- this.btnStraightLineMeasure.Name = "btnStraightLineMeasure";
- this.btnStraightLineMeasure.Size = new System.Drawing.Size(75, 25);
- this.btnStraightLineMeasure.TabIndex = 6;
- this.btnStraightLineMeasure.Text = "测量";
- this.btnStraightLineMeasure.UseVisualStyleBackColor = true;
- this.btnStraightLineMeasure.Click += new System.EventHandler(this.btnStraightLineMeasure_Click);
- //
- // cmbStraightLine
- //
- this.cmbStraightLine.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
- this.cmbStraightLine.FormattingEnabled = true;
- this.cmbStraightLine.Location = new System.Drawing.Point(62, 60);
- this.cmbStraightLine.Name = "cmbStraightLine";
- this.cmbStraightLine.Size = new System.Drawing.Size(190, 20);
- this.cmbStraightLine.TabIndex = 5;
- this.cmbStraightLine.SelectedIndexChanged += new System.EventHandler(this.cmbStraightLine_SelectedIndexChanged);
- //
- // pnlStraightLineColor
- //
- this.pnlStraightLineColor.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(128)))), ((int)(((byte)(255)))));
- this.pnlStraightLineColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.pnlStraightLineColor.Location = new System.Drawing.Point(62, 24);
- this.pnlStraightLineColor.Name = "pnlStraightLineColor";
- this.pnlStraightLineColor.Size = new System.Drawing.Size(91, 25);
- this.pnlStraightLineColor.TabIndex = 4;
- this.pnlStraightLineColor.BackColorChanged += new System.EventHandler(this.pnlStraightLineColor_BackColorChanged);
- this.pnlStraightLineColor.Click += new System.EventHandler(this.pnlStraightLineColor_Click);
- //
- // nudStraightLineWidth
- //
- this.nudStraightLineWidth.Location = new System.Drawing.Point(263, 24);
- this.nudStraightLineWidth.Maximum = new decimal(new int[] {
- 5,
- 0,
- 0,
- 0});
- this.nudStraightLineWidth.Minimum = new decimal(new int[] {
- 1,
- 0,
- 0,
- 0});
- this.nudStraightLineWidth.Name = "nudStraightLineWidth";
- this.nudStraightLineWidth.Size = new System.Drawing.Size(78, 21);
- this.nudStraightLineWidth.TabIndex = 3;
- this.nudStraightLineWidth.Value = new decimal(new int[] {
- 1,
- 0,
- 0,
- 0});
- this.nudStraightLineWidth.ValueChanged += new System.EventHandler(this.nudStraightLineWidth_ValueChanged);
- this.nudStraightLineWidth.KeyUp += new System.Windows.Forms.KeyEventHandler(this.nudStraightLineWidth_KeyUp);
- //
- // label3
- //
- this.label3.AutoSize = true;
- this.label3.Location = new System.Drawing.Point(205, 30);
- this.label3.Name = "label3";
- this.label3.Size = new System.Drawing.Size(41, 12);
- this.label3.TabIndex = 2;
- this.label3.Text = "线宽:";
- //
- // label2
- //
- this.label2.AutoSize = true;
- this.label2.Location = new System.Drawing.Point(16, 68);
- this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(41, 12);
- this.label2.TabIndex = 1;
- this.label2.Text = "样式:";
- //
- // label1
- //
- this.label1.AutoSize = true;
- this.label1.Location = new System.Drawing.Point(16, 30);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(41, 12);
- this.label1.TabIndex = 0;
- this.label1.Text = "颜色:";
- //
- // groupBox4
- //
- this.groupBox4.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.groupBox4.Controls.Add(this.pnlTools);
- this.groupBox4.Controls.Add(this.btnDelete);
- this.groupBox4.Controls.Add(this.pnlShow);
- this.groupBox4.Location = new System.Drawing.Point(584, 91);
- this.groupBox4.Name = "groupBox4";
- this.groupBox4.Size = new System.Drawing.Size(638, 497);
- this.groupBox4.TabIndex = 3;
- this.groupBox4.TabStop = false;
- this.groupBox4.Text = "预览";
- //
- // pnlTools
- //
- this.pnlTools.Location = new System.Drawing.Point(6, 22);
- this.pnlTools.Name = "pnlTools";
- this.pnlTools.Size = new System.Drawing.Size(305, 32);
- this.pnlTools.TabIndex = 2;
- //
- // btnDelete
- //
- this.btnDelete.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.btnDelete.Location = new System.Drawing.Point(519, 22);
- this.btnDelete.Name = "btnDelete";
- this.btnDelete.Size = new System.Drawing.Size(101, 32);
- this.btnDelete.TabIndex = 1;
- this.btnDelete.Text = "删除";
- this.btnDelete.UseVisualStyleBackColor = true;
- this.btnDelete.Click += new System.EventHandler(this.btnDelete_Click);
- //
- // pnlShow
- //
- this.pnlShow.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.pnlShow.Location = new System.Drawing.Point(6, 60);
- this.pnlShow.Name = "pnlShow";
- this.pnlShow.Size = new System.Drawing.Size(626, 431);
- this.pnlShow.TabIndex = 0;
- //
- // groupBox5
- //
- this.groupBox5.Controls.Add(this.btnLengthLineMeasure);
- this.groupBox5.Controls.Add(this.cmbLengthLine);
- this.groupBox5.Controls.Add(this.pnlLengthLineColor);
- this.groupBox5.Controls.Add(this.nudLengthLineWidth);
- this.groupBox5.Controls.Add(this.label4);
- this.groupBox5.Controls.Add(this.label5);
- this.groupBox5.Controls.Add(this.label6);
- this.groupBox5.Location = new System.Drawing.Point(218, 197);
- this.groupBox5.Name = "groupBox5";
- this.groupBox5.Size = new System.Drawing.Size(360, 100);
- this.groupBox5.TabIndex = 4;
- this.groupBox5.TabStop = false;
- this.groupBox5.Text = "长度";
- //
- // btnLengthLineMeasure
- //
- this.btnLengthLineMeasure.Enabled = false;
- this.btnLengthLineMeasure.Location = new System.Drawing.Point(263, 60);
- this.btnLengthLineMeasure.Name = "btnLengthLineMeasure";
- this.btnLengthLineMeasure.Size = new System.Drawing.Size(75, 25);
- this.btnLengthLineMeasure.TabIndex = 6;
- this.btnLengthLineMeasure.Text = "测量";
- this.btnLengthLineMeasure.UseVisualStyleBackColor = true;
- this.btnLengthLineMeasure.Click += new System.EventHandler(this.btnLengthLineMeasure_Click);
- //
- // cmbLengthLine
- //
- this.cmbLengthLine.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
- this.cmbLengthLine.FormattingEnabled = true;
- this.cmbLengthLine.Location = new System.Drawing.Point(62, 60);
- this.cmbLengthLine.Name = "cmbLengthLine";
- this.cmbLengthLine.Size = new System.Drawing.Size(190, 20);
- this.cmbLengthLine.TabIndex = 5;
- this.cmbLengthLine.SelectedIndexChanged += new System.EventHandler(this.cmbLengthLine_SelectedIndexChanged);
- //
- // pnlLengthLineColor
- //
- this.pnlLengthLineColor.BackColor = System.Drawing.Color.Red;
- this.pnlLengthLineColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.pnlLengthLineColor.Location = new System.Drawing.Point(62, 24);
- this.pnlLengthLineColor.Name = "pnlLengthLineColor";
- this.pnlLengthLineColor.Size = new System.Drawing.Size(91, 25);
- this.pnlLengthLineColor.TabIndex = 4;
- this.pnlLengthLineColor.BackColorChanged += new System.EventHandler(this.pnlLengthLineColor_BackColorChanged);
- this.pnlLengthLineColor.Click += new System.EventHandler(this.pnlLengthLineColor_Click);
- //
- // nudLengthLineWidth
- //
- this.nudLengthLineWidth.Location = new System.Drawing.Point(263, 28);
- this.nudLengthLineWidth.Maximum = new decimal(new int[] {
- 5,
- 0,
- 0,
- 0});
- this.nudLengthLineWidth.Minimum = new decimal(new int[] {
- 1,
- 0,
- 0,
- 0});
- this.nudLengthLineWidth.Name = "nudLengthLineWidth";
- this.nudLengthLineWidth.Size = new System.Drawing.Size(78, 21);
- this.nudLengthLineWidth.TabIndex = 3;
- this.nudLengthLineWidth.Value = new decimal(new int[] {
- 1,
- 0,
- 0,
- 0});
- this.nudLengthLineWidth.ValueChanged += new System.EventHandler(this.nudLengthLineWidth_ValueChanged);
- this.nudLengthLineWidth.KeyUp += new System.Windows.Forms.KeyEventHandler(this.nudLengthLineWidth_KeyUp);
- //
- // label4
- //
- this.label4.AutoSize = true;
- this.label4.Location = new System.Drawing.Point(205, 30);
- this.label4.Name = "label4";
- this.label4.Size = new System.Drawing.Size(41, 12);
- this.label4.TabIndex = 2;
- this.label4.Text = "线宽:";
- //
- // label5
- //
- this.label5.AutoSize = true;
- this.label5.Location = new System.Drawing.Point(16, 68);
- this.label5.Name = "label5";
- this.label5.Size = new System.Drawing.Size(41, 12);
- this.label5.TabIndex = 1;
- this.label5.Text = "样式:";
- //
- // label6
- //
- this.label6.AutoSize = true;
- this.label6.Location = new System.Drawing.Point(16, 30);
- this.label6.Name = "label6";
- this.label6.Size = new System.Drawing.Size(41, 12);
- this.label6.TabIndex = 0;
- this.label6.Text = "颜色:";
- //
- // groupBox6
- //
- this.groupBox6.Controls.Add(this.btnParallelLineMeasure);
- this.groupBox6.Controls.Add(this.cmbParallelLine);
- this.groupBox6.Controls.Add(this.pnlParallelLineColor);
- this.groupBox6.Controls.Add(this.nudParallelLineWidth);
- this.groupBox6.Controls.Add(this.label7);
- this.groupBox6.Controls.Add(this.label8);
- this.groupBox6.Controls.Add(this.label9);
- this.groupBox6.Location = new System.Drawing.Point(218, 303);
- this.groupBox6.Name = "groupBox6";
- this.groupBox6.Size = new System.Drawing.Size(360, 100);
- this.groupBox6.TabIndex = 5;
- this.groupBox6.TabStop = false;
- this.groupBox6.Text = "平行线";
- //
- // btnParallelLineMeasure
- //
- this.btnParallelLineMeasure.Enabled = false;
- this.btnParallelLineMeasure.Location = new System.Drawing.Point(263, 60);
- this.btnParallelLineMeasure.Name = "btnParallelLineMeasure";
- this.btnParallelLineMeasure.Size = new System.Drawing.Size(75, 25);
- this.btnParallelLineMeasure.TabIndex = 6;
- this.btnParallelLineMeasure.Text = "测量";
- this.btnParallelLineMeasure.UseVisualStyleBackColor = true;
- this.btnParallelLineMeasure.Click += new System.EventHandler(this.btnParallelLineMeasure_Click);
- //
- // cmbParallelLine
- //
- this.cmbParallelLine.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
- this.cmbParallelLine.FormattingEnabled = true;
- this.cmbParallelLine.Location = new System.Drawing.Point(62, 60);
- this.cmbParallelLine.Name = "cmbParallelLine";
- this.cmbParallelLine.Size = new System.Drawing.Size(190, 20);
- this.cmbParallelLine.TabIndex = 5;
- this.cmbParallelLine.SelectedIndexChanged += new System.EventHandler(this.cmbParallelLine_SelectedIndexChanged);
- //
- // pnlParallelLineColor
- //
- this.pnlParallelLineColor.BackColor = System.Drawing.Color.Green;
- this.pnlParallelLineColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.pnlParallelLineColor.Location = new System.Drawing.Point(62, 24);
- this.pnlParallelLineColor.Name = "pnlParallelLineColor";
- this.pnlParallelLineColor.Size = new System.Drawing.Size(91, 25);
- this.pnlParallelLineColor.TabIndex = 4;
- this.pnlParallelLineColor.BackColorChanged += new System.EventHandler(this.pnlParallelLineColor_BackColorChanged);
- this.pnlParallelLineColor.Click += new System.EventHandler(this.pnlParallelLineColor_Click);
- //
- // nudParallelLineWidth
- //
- this.nudParallelLineWidth.Location = new System.Drawing.Point(263, 24);
- this.nudParallelLineWidth.Maximum = new decimal(new int[] {
- 5,
- 0,
- 0,
- 0});
- this.nudParallelLineWidth.Minimum = new decimal(new int[] {
- 1,
- 0,
- 0,
- 0});
- this.nudParallelLineWidth.Name = "nudParallelLineWidth";
- this.nudParallelLineWidth.Size = new System.Drawing.Size(78, 21);
- this.nudParallelLineWidth.TabIndex = 3;
- this.nudParallelLineWidth.Value = new decimal(new int[] {
- 1,
- 0,
- 0,
- 0});
- this.nudParallelLineWidth.ValueChanged += new System.EventHandler(this.nudParallelLineWidth_ValueChanged);
- this.nudParallelLineWidth.KeyUp += new System.Windows.Forms.KeyEventHandler(this.nudParallelLineWidth_KeyUp);
- //
- // label7
- //
- this.label7.AutoSize = true;
- this.label7.Location = new System.Drawing.Point(205, 30);
- this.label7.Name = "label7";
- this.label7.Size = new System.Drawing.Size(41, 12);
- this.label7.TabIndex = 2;
- this.label7.Text = "线宽:";
- //
- // label8
- //
- this.label8.AutoSize = true;
- this.label8.Location = new System.Drawing.Point(16, 68);
- this.label8.Name = "label8";
- this.label8.Size = new System.Drawing.Size(41, 12);
- this.label8.TabIndex = 1;
- this.label8.Text = "样式:";
- //
- // label9
- //
- this.label9.AutoSize = true;
- this.label9.Location = new System.Drawing.Point(16, 30);
- this.label9.Name = "label9";
- this.label9.Size = new System.Drawing.Size(41, 12);
- this.label9.TabIndex = 0;
- this.label9.Text = "颜色:";
- //
- // groupBox7
- //
- this.groupBox7.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)));
- this.groupBox7.Controls.Add(this.lblLevel);
- this.groupBox7.Controls.Add(this.label12);
- this.groupBox7.Controls.Add(this.lblAvg);
- this.groupBox7.Controls.Add(this.label10);
- this.groupBox7.Controls.Add(this.dgvLevelList);
- this.groupBox7.Location = new System.Drawing.Point(218, 406);
- this.groupBox7.Name = "groupBox7";
- this.groupBox7.Size = new System.Drawing.Size(360, 182);
- this.groupBox7.TabIndex = 6;
- this.groupBox7.TabStop = false;
- this.groupBox7.Text = "结果预览";
- //
- // lblLevel
- //
- this.lblLevel.AutoSize = true;
- this.lblLevel.Location = new System.Drawing.Point(255, 25);
- this.lblLevel.Name = "lblLevel";
- this.lblLevel.Size = new System.Drawing.Size(11, 12);
- this.lblLevel.TabIndex = 4;
- this.lblLevel.Text = "0";
- //
- // label12
- //
- this.label12.AutoSize = true;
- this.label12.Location = new System.Drawing.Point(170, 25);
- this.label12.Name = "label12";
- this.label12.Size = new System.Drawing.Size(65, 12);
- this.label12.TabIndex = 3;
- this.label12.Text = "对应级别:";
- //
- // lblAvg
- //
- this.lblAvg.AutoSize = true;
- this.lblAvg.Location = new System.Drawing.Point(75, 25);
- this.lblAvg.Name = "lblAvg";
- this.lblAvg.Size = new System.Drawing.Size(11, 12);
- this.lblAvg.TabIndex = 2;
- this.lblAvg.Text = "0";
- //
- // label10
- //
- this.label10.AutoSize = true;
- this.label10.Location = new System.Drawing.Point(6, 25);
- this.label10.Name = "label10";
- this.label10.Size = new System.Drawing.Size(53, 12);
- this.label10.TabIndex = 1;
- this.label10.Text = "平均值:";
- //
- // dgvLevelList
- //
- this.dgvLevelList.AllowUserToAddRows = false;
- this.dgvLevelList.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)));
- this.dgvLevelList.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
- this.dgvLevelList.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
- this.dgvLevelList.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
- this.name,
- this.minValue,
- this.maxValue});
- this.dgvLevelList.Location = new System.Drawing.Point(6, 51);
- this.dgvLevelList.Name = "dgvLevelList";
- this.dgvLevelList.ReadOnly = true;
- this.dgvLevelList.RowHeadersVisible = false;
- this.dgvLevelList.RowHeadersWidth = 51;
- this.dgvLevelList.RowTemplate.Height = 27;
- this.dgvLevelList.Size = new System.Drawing.Size(348, 125);
- this.dgvLevelList.TabIndex = 0;
- //
- // name
- //
- this.name.MinimumWidth = 6;
- this.name.Name = "name";
- this.name.ReadOnly = true;
- //
- // minValue
- //
- this.minValue.MinimumWidth = 6;
- this.minValue.Name = "minValue";
- this.minValue.ReadOnly = true;
- //
- // maxValue
- //
- this.maxValue.MinimumWidth = 6;
- this.maxValue.Name = "maxValue";
- this.maxValue.ReadOnly = true;
- //
- // groupBox8
- //
- this.groupBox8.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.groupBox8.Controls.Add(this.lstResult);
- this.groupBox8.Controls.Add(this.btnResultDel);
- this.groupBox8.Controls.Add(this.btnAllShow);
- this.groupBox8.Location = new System.Drawing.Point(12, 594);
- this.groupBox8.Name = "groupBox8";
- this.groupBox8.Size = new System.Drawing.Size(200, 220);
- this.groupBox8.TabIndex = 7;
- this.groupBox8.TabStop = false;
- this.groupBox8.Text = "分析结果";
- //
- // lstResult
- //
- this.lstResult.HideSelection = false;
- this.lstResult.Location = new System.Drawing.Point(17, 55);
- this.lstResult.Name = "lstResult";
- this.lstResult.Size = new System.Drawing.Size(166, 145);
- this.lstResult.TabIndex = 11;
- this.lstResult.UseCompatibleStateImageBehavior = false;
- this.lstResult.View = System.Windows.Forms.View.Tile;
- this.lstResult.SelectedIndexChanged += new System.EventHandler(this.lstResult_SelectedIndexChanged);
- //
- // btnResultDel
- //
- this.btnResultDel.Location = new System.Drawing.Point(108, 26);
- this.btnResultDel.Name = "btnResultDel";
- this.btnResultDel.Size = new System.Drawing.Size(75, 23);
- this.btnResultDel.TabIndex = 10;
- this.btnResultDel.Text = "删除";
- this.btnResultDel.UseVisualStyleBackColor = true;
- this.btnResultDel.Click += new System.EventHandler(this.btnResultDel_Click);
- //
- // btnAllShow
- //
- this.btnAllShow.Location = new System.Drawing.Point(19, 26);
- this.btnAllShow.Name = "btnAllShow";
- this.btnAllShow.Size = new System.Drawing.Size(75, 23);
- this.btnAllShow.TabIndex = 9;
- this.btnAllShow.Text = "全部显示";
- this.btnAllShow.UseVisualStyleBackColor = true;
- this.btnAllShow.Click += new System.EventHandler(this.btnAllShow_Click);
- //
- // groupBox9
- //
- this.groupBox9.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.groupBox9.Controls.Add(this.dgvResult);
- this.groupBox9.Location = new System.Drawing.Point(218, 594);
- this.groupBox9.Name = "groupBox9";
- this.groupBox9.Size = new System.Drawing.Size(816, 220);
- this.groupBox9.TabIndex = 8;
- this.groupBox9.TabStop = false;
- //
- // dgvResult
- //
- this.dgvResult.AllowUserToAddRows = false;
- this.dgvResult.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.dgvResult.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
- this.dgvResult.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
- this.dgvResult.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
- this.Column1,
- this.picName,
- this.level,
- this.avg});
- this.dgvResult.Location = new System.Drawing.Point(8, 16);
- this.dgvResult.Name = "dgvResult";
- this.dgvResult.ReadOnly = true;
- this.dgvResult.RowHeadersVisible = false;
- this.dgvResult.RowHeadersWidth = 51;
- this.dgvResult.RowTemplate.Height = 27;
- this.dgvResult.Size = new System.Drawing.Size(801, 197);
- this.dgvResult.TabIndex = 0;
- //
- // Column1
- //
- this.Column1.HeaderText = "tag";
- this.Column1.MinimumWidth = 6;
- this.Column1.Name = "Column1";
- this.Column1.ReadOnly = true;
- this.Column1.Visible = false;
- //
- // picName
- //
- this.picName.MinimumWidth = 6;
- this.picName.Name = "picName";
- this.picName.ReadOnly = true;
- //
- // level
- //
- this.level.MinimumWidth = 6;
- this.level.Name = "level";
- this.level.ReadOnly = true;
- //
- // avg
- //
- this.avg.MinimumWidth = 6;
- this.avg.Name = "avg";
- this.avg.ReadOnly = true;
- //
- // groupBox10
- //
- this.groupBox10.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.groupBox10.Controls.Add(this.btnExportProject);
- this.groupBox10.Controls.Add(this.numericUpDown1);
- this.groupBox10.Controls.Add(this.label11);
- this.groupBox10.Controls.Add(this.btnExport);
- this.groupBox10.Controls.Add(this.btnCreate);
- this.groupBox10.Location = new System.Drawing.Point(1040, 594);
- this.groupBox10.Name = "groupBox10";
- this.groupBox10.Size = new System.Drawing.Size(182, 220);
- this.groupBox10.TabIndex = 9;
- this.groupBox10.TabStop = false;
- //
- // btnExportProject
- //
- this.btnExportProject.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.btnExportProject.Location = new System.Drawing.Point(28, 100);
- this.btnExportProject.Name = "btnExportProject";
- this.btnExportProject.Size = new System.Drawing.Size(136, 32);
- this.btnExportProject.TabIndex = 10;
- this.btnExportProject.Text = "导出项目";
- this.btnExportProject.UseVisualStyleBackColor = true;
- this.btnExportProject.Click += new System.EventHandler(this.btnExportProject_Click);
- //
- // numericUpDown1
- //
- this.numericUpDown1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.numericUpDown1.Location = new System.Drawing.Point(81, 161);
- this.numericUpDown1.Maximum = new decimal(new int[] {
- 10,
- 0,
- 0,
- 0});
- this.numericUpDown1.Name = "numericUpDown1";
- this.numericUpDown1.Size = new System.Drawing.Size(62, 21);
- this.numericUpDown1.TabIndex = 8;
- this.numericUpDown1.Value = new decimal(new int[] {
- 2,
- 0,
- 0,
- 0});
- this.numericUpDown1.ValueChanged += new System.EventHandler(this.numericUpDown1_ValueChanged);
- //
- // label11
- //
- this.label11.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.label11.AutoSize = true;
- this.label11.Location = new System.Drawing.Point(38, 166);
- this.label11.Name = "label11";
- this.label11.Size = new System.Drawing.Size(41, 12);
- this.label11.TabIndex = 7;
- this.label11.Text = "小数:";
- //
- // btnExport
- //
- this.btnExport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.btnExport.Location = new System.Drawing.Point(28, 62);
- this.btnExport.Name = "btnExport";
- this.btnExport.Size = new System.Drawing.Size(137, 32);
- this.btnExport.TabIndex = 1;
- this.btnExport.Text = "导出结果";
- this.btnExport.UseVisualStyleBackColor = true;
- this.btnExport.Click += new System.EventHandler(this.btnExport_Click);
- //
- // btnCreate
- //
- this.btnCreate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.btnCreate.Location = new System.Drawing.Point(28, 24);
- this.btnCreate.Name = "btnCreate";
- this.btnCreate.Size = new System.Drawing.Size(137, 32);
- this.btnCreate.TabIndex = 0;
- this.btnCreate.Text = "生成报告";
- this.btnCreate.UseVisualStyleBackColor = true;
- this.btnCreate.Click += new System.EventHandler(this.btnCreate_Click);
- //
- // SpecialMeasureLengthDialog
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(1234, 823);
- this.Controls.Add(this.groupBox10);
- this.Controls.Add(this.groupBox9);
- this.Controls.Add(this.groupBox8);
- this.Controls.Add(this.groupBox7);
- this.Controls.Add(this.groupBox6);
- 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 = "SpecialMeasureLengthDialog";
- this.Text = "专项测量 - 长度";
- this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.SpecialMeasureLengthDialog_FormClosing);
- 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.groupBox6, 0);
- this.Controls.SetChildIndex(this.groupBox7, 0);
- this.Controls.SetChildIndex(this.groupBox8, 0);
- this.Controls.SetChildIndex(this.groupBox9, 0);
- this.Controls.SetChildIndex(this.groupBox10, 0);
- this.groupBox1.ResumeLayout(false);
- this.groupBox1.PerformLayout();
- this.groupBox2.ResumeLayout(false);
- this.groupBox3.ResumeLayout(false);
- this.groupBox3.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)(this.nudStraightLineWidth)).EndInit();
- this.groupBox4.ResumeLayout(false);
- this.groupBox5.ResumeLayout(false);
- this.groupBox5.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)(this.nudLengthLineWidth)).EndInit();
- this.groupBox6.ResumeLayout(false);
- this.groupBox6.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)(this.nudParallelLineWidth)).EndInit();
- this.groupBox7.ResumeLayout(false);
- this.groupBox7.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)(this.dgvLevelList)).EndInit();
- this.groupBox8.ResumeLayout(false);
- this.groupBox9.ResumeLayout(false);
- ((System.ComponentModel.ISupportInitialize)(this.dgvResult)).EndInit();
- this.groupBox10.ResumeLayout(false);
- this.groupBox10.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
- this.ResumeLayout(false);
- }
- #endregion
- private System.Windows.Forms.GroupBox groupBox1;
- private System.Windows.Forms.CheckBox chkOpenSetting;
- private System.Windows.Forms.Button btnMeasure;
- private System.Windows.Forms.ComboBox cmbSpecial;
- private System.Windows.Forms.Button btnSave;
- private System.Windows.Forms.Button btnSetting;
- private System.Windows.Forms.GroupBox groupBox2;
- private System.Windows.Forms.GroupBox groupBox3;
- private System.Windows.Forms.GroupBox groupBox4;
- private System.Windows.Forms.Button btnStraightLineMeasure;
- private System.Windows.Forms.ComboBox cmbStraightLine;
- private System.Windows.Forms.Panel pnlStraightLineColor;
- private System.Windows.Forms.NumericUpDown nudStraightLineWidth;
- private System.Windows.Forms.Label label3;
- private System.Windows.Forms.Label label2;
- private System.Windows.Forms.Label label1;
- private System.Windows.Forms.GroupBox groupBox5;
- private System.Windows.Forms.Button btnLengthLineMeasure;
- private System.Windows.Forms.ComboBox cmbLengthLine;
- private System.Windows.Forms.Panel pnlLengthLineColor;
- private System.Windows.Forms.NumericUpDown nudLengthLineWidth;
- private System.Windows.Forms.Label label4;
- private System.Windows.Forms.Label label5;
- private System.Windows.Forms.Label label6;
- private System.Windows.Forms.GroupBox groupBox6;
- private System.Windows.Forms.Button btnParallelLineMeasure;
- private System.Windows.Forms.ComboBox cmbParallelLine;
- private System.Windows.Forms.Panel pnlParallelLineColor;
- private System.Windows.Forms.NumericUpDown nudParallelLineWidth;
- private System.Windows.Forms.Label label7;
- private System.Windows.Forms.Label label8;
- private System.Windows.Forms.Label label9;
- private System.Windows.Forms.GroupBox groupBox7;
- private System.Windows.Forms.DataGridView dgvLevelList;
- private System.Windows.Forms.DataGridViewTextBoxColumn name;
- private System.Windows.Forms.DataGridViewTextBoxColumn minValue;
- private System.Windows.Forms.DataGridViewTextBoxColumn maxValue;
- private System.Windows.Forms.Label lblAvg;
- private System.Windows.Forms.Label label10;
- private System.Windows.Forms.Label lblLevel;
- private System.Windows.Forms.Label label12;
- private System.Windows.Forms.GroupBox groupBox8;
- private System.Windows.Forms.GroupBox groupBox9;
- private System.Windows.Forms.DataGridView dgvResult;
- private System.Windows.Forms.GroupBox groupBox10;
- private System.Windows.Forms.Button btnExport;
- private System.Windows.Forms.Button btnCreate;
- private System.Windows.Forms.Panel pnlShow;
- private System.Windows.Forms.Button btnDelete;
- private System.Windows.Forms.Panel pnlTools;
- private System.Windows.Forms.ListView lstPic;
- private System.Windows.Forms.ImageList imageList1;
- private System.Windows.Forms.NumericUpDown numericUpDown1;
- private System.Windows.Forms.Label label11;
- private System.Windows.Forms.Button btnResultDel;
- private System.Windows.Forms.Button btnAllShow;
- private System.Windows.Forms.DataGridViewTextBoxColumn Column1;
- private System.Windows.Forms.DataGridViewTextBoxColumn picName;
- private System.Windows.Forms.DataGridViewTextBoxColumn level;
- private System.Windows.Forms.DataGridViewTextBoxColumn avg;
- private System.Windows.Forms.ListView lstResult;
- private System.Windows.Forms.Button btnExportProject;
- #endregion
- /// <summary>
- /// 网格调色板
- /// </summary>
- private ColorsForm colorsFormGrid;
- private AppWorkspace appWorkspace;
- private DocumentWorkspaceWindow m_documentWorkspace;
- private SQLiteHelper m_sqlHelper;
- private DataTable m_specialList;
- private DataTable m_levelList;
- private SpecialItem m_specialItem = SpecialItem.LENGTH;
- private int m_specialSelectedIndex = 0;
- private string m_specialId;
- /// <summary>
- /// 原图
- /// </summary>
- private Bitmap m_bitmap;
- /// <summary>
- /// 原图带原相测量等
- /// </summary>
- private Bitmap m_originalBit;
- private ArtworkControlButtons m_controlButtons;
- private object m_currentColorPanel;
- private bool m_isMeasure;
- private bool m_isOpenSetting;
- private bool m_isMeasureByStraightLine;
- private bool m_isMeasureByLengthLine;
- private bool m_isMeasureByParallelLine;
- private MeasureStyleModel m_measureStyleModel;
- private List<MeasureLengthResult> m_measureResults = new List<MeasureLengthResult>();
- private MeasureLengthResult m_measureCurrent;
- /// <summary>
- /// 图片名称
- /// </summary>
- private string m_graphName;
- private List<DrawObject> m_oldDrawList = new List<DrawObject>();
- private bool m_showAll;
- /// <summary>
- /// 中间数据
- /// </summary>
- private List<ExportProjectModel> tempDataModel = new List<ExportProjectModel>();
- // 小数位
- private int decnum = 2;
- /// <summary>
- /// 保存用于生成报告的图片
- /// </summary>
- private List<Bitmap> bitList = new List<Bitmap>();
- /// <summary>
- /// 储存点击保存结果后的所有原图与分析图
- /// </summary>
- private Dictionary<string, List<Bitmap>> bitDic = new Dictionary<string, List<Bitmap>>();
- // 统一全局设置的线颜色、线宽、样式
- private int m_straightLineColor;
- private int m_straightLineWidth;
- private int m_straightLineStyle;
- private int m_lengthLineColor;
- private int m_lengthLineWidth;
- private int m_lengthLineStyle;
- private int m_parallelLineColor;
- private int m_parallelLineWidth;
- private int m_parallelLineStyle;
- private int defaultIndex = -1;
- private GeneralAnalysisModel generalAnalysisModel = new GeneralAnalysisModel();
- public SpecialMeasureLengthDialog(AppWorkspace workspace)
- {
- appWorkspace = workspace;
- m_measureStyleModel = appWorkspace.GetMeasureStyleModel();
- m_sqlHelper = new SQLiteHelper(); //连接数据库
- m_sqlHelper.Connect();
- this.colorsFormGrid = new ColorsForm();
- this.colorsFormGrid.StartPosition = FormStartPosition.CenterScreen;
- InitializeComponent();
- InitializeLanguageText();
- InitPicList();
- InitSpecialCmb();
- InitDocumentView();
- InitDocumentViewTools();
- InitLineStyles();
- InitCurrentMeasure();
- GetAttributeFromConfigurationFile();
- SetAnalyzeModelFromXml("Template.Manager.item2.SpecialLength");
- }
- private void ShowImgEvent(object sender, EventArgs e)
- {
- lstPic.Focus();
- if (this.defaultIndex != -1)
- {
- this.lstPic.Items[defaultIndex].Focused = true;
- this.lstPic.Items[defaultIndex].Selected = true;
- getLastData();
- }
- }
- /// <summary>
- /// 初始化专项数据
- /// </summary>
- public void InitSpecialCmb()
- {
- cmbSpecial.Items.Clear();
- string select_sql = "select * from mic_special_definition where delete_flag = 0 and special_type = ? "; //查询的SQL语句
- SQLiteParameter[] para = new SQLiteParameter[1];
- para[0] = new SQLiteParameter("special_type", m_specialItem);
- m_specialList = m_sqlHelper.ExecuteDataTable(select_sql, para); //执行查询操作,结果存放在dt中
- this.cmbSpecial.Items.Clear();
- if (m_specialList.Rows.Count > 0)
- {
- for (int i = 0; i < m_specialList.Rows.Count; ++i)
- {
- this.cmbSpecial.Items.Add(m_specialList.Rows[i]["special_name"].ToString());
- }
- this.cmbSpecial.SelectedIndex = m_specialSelectedIndex;
- m_specialId = m_specialList.Rows[m_specialSelectedIndex]["id"].ToString();
- }
- }
- /// <summary>
- /// 初始化当前测量数据
- /// </summary>
- public void InitCurrentMeasure()
- {
- m_measureCurrent = new MeasureLengthResult();
- m_measureCurrent.GraphName = m_graphName;
- m_measureCurrent.LevelName = "";
- m_measureCurrent.MeasureAvg = 0;
- lblLevel.Text = "";
- lblAvg.Text = "0";
- }
- /// <summary>
- /// 初始化图片列表数据
- /// </summary>
- public void InitPicList()
- {
- //初始化图片列表
- for (int i = 0; i < this.appWorkspace.DocumentWorkspaces.Length; i++)
- {
- this.imageList1.Images.Add("img" + i, this.appWorkspace.DocumentWorkspaces[i].BinarizationThumbnail);
- this.lstPic.Items.Add("", i);
- this.lstPic.Items[i].ImageIndex = i;
- this.lstPic.Items[i].Text = this.appWorkspace.DocumentWorkspaces[i].GetFriendlyName();
- this.lstPic.Items[i].Name = this.appWorkspace.DocumentWorkspaces[i].GetFriendlyName();
- if (this.appWorkspace.DocumentWorkspaces[i].Equals(this.appWorkspace.ActiveDocumentWorkspace))
- {
- defaultIndex = i;
- }
- }
- this.Shown += ShowImgEvent;
- }
- /// <summary>
- /// 初始化DocumentView
- /// </summary>
- public void InitDocumentView()
- {
- this.pnlShow.Controls.Clear();
- this.m_documentWorkspace = new DocumentWorkspaceWindow(appWorkspace);
- this.m_documentWorkspace.AppWorkspaceTop = appWorkspace;
- this.m_documentWorkspace.Visible = true;
- this.m_documentWorkspace.Dock = DockStyle.Fill;
- this.m_documentWorkspace.Units = MeasurementUnit.Micron;
- if (this.lstPic.FocusedItem != null)
- {
- this.m_documentWorkspace.xmlSaveModel = this.appWorkspace.DocumentWorkspaces[this.lstPic.FocusedItem.Index].xmlSaveModel;
- this.m_documentWorkspace.rules = this.appWorkspace.DocumentWorkspaces[this.lstPic.FocusedItem.Index].rules;
- }
- this.pnlShow.Controls.Add(this.m_documentWorkspace);
- this.m_documentWorkspace.ContinuousDrawingMeasure = true;
- }
- private void GraphicsList_SelectChanged(object sender, EventArgs e)
- {
- this.GetDataAndAvg();
- }
- #region 初始化DocumentView工具
- public void InitDocumentViewTools()
- {
- this.m_controlButtons = new ArtworkControlButtons();
- this.m_controlButtons.Dock = DockStyle.Top;
- this.m_controlButtons.Height = 30;
- this.m_controlButtons.HideZoomToWindowAndActualSize();
- this.m_controlButtons.HideMovingDirection();
- this.pnlTools.Controls.Add(m_controlButtons);
- this.m_controlButtons.zoomInButton.Click += new EventHandler(zoomInButton_Click);
- this.m_controlButtons.zoomOutButton.Click += new EventHandler(zoomOutButton_Click);
- this.m_controlButtons.pointerButton.Click += new EventHandler(pointerButton_Click);
- this.m_controlButtons.mobileModeButton.Click += new EventHandler(mobileModeButton_Click);
- }
- private void mobileModeButton_Click(object sender, EventArgs e)
- {
- this.m_documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.MoveMode;
- }
- private void pointerButton_Click(object sender, EventArgs e)
- {
- this.m_documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.Pointer;
- }
- private void zoomOutButton_Click(object sender, EventArgs e)
- {
- if (this.m_documentWorkspace.CompositionSurface != null)
- this.m_documentWorkspace.ZoomOut();
- }
- private void zoomInButton_Click(object sender, EventArgs e)
- {
- if (this.m_documentWorkspace.CompositionSurface != null)
- this.m_documentWorkspace.ZoomIn();
- }
- #endregion
- /// <summary>
- /// 初始化线样式
- /// </summary>
- public void InitLineStyles()
- {
- m_straightLineColor = m_measureStyleModel.measureLine.lineColor;
- m_straightLineWidth = m_measureStyleModel.measureLine.lineWidth;
- m_straightLineStyle = m_measureStyleModel.measureLine.lineStyle;
- m_lengthLineColor = m_measureStyleModel.measureLength.lineColor;
- m_lengthLineWidth = m_measureStyleModel.measureLength.lineWidth;
- m_lengthLineStyle = m_measureStyleModel.measureLength.lineStyle;
- m_parallelLineColor = m_measureStyleModel.measureParallelLine.lineColor;
- m_parallelLineWidth = m_measureStyleModel.measureParallelLine.lineWidth;
- m_parallelLineStyle = m_measureStyleModel.measureParallelLine.lineStyle;
- //绑定线样式数据
- this.cmbStraightLine.Items.AddRange(InvariantData.dashStyles);
- this.cmbStraightLine.SelectedIndex = 0;
- this.cmbLengthLine.Items.AddRange(InvariantData.dashStyles);
- this.cmbLengthLine.SelectedIndex = 0;
- this.cmbParallelLine.Items.AddRange(InvariantData.dashStyles);
- this.cmbParallelLine.SelectedIndex = 0;
- }
-
- private void btnSetting_Click(object sender, EventArgs e)
- {
- OpenSettingDialog();
- }
- private void OpenSettingDialog()
- {
- AnalyzeSettingDialog recombinationRateSetDialog = new AnalyzeSettingDialog(this, "Template.Manager.item2.SpecialLength");
- if (recombinationRateSetDialog.hasModule)
- {
- recombinationRateSetDialog.StartPosition = FormStartPosition.CenterScreen;
- recombinationRateSetDialog.ShowDialog();
- }
- else
- {
- recombinationRateSetDialog = null;
- }
- }
- private void cmbSpecial_SelectedIndexChanged(object sender, EventArgs e)
- {
- //m_specialSelectedIndex = this.cmbSpecial.SelectedIndex;
- this.InitSpecialLevelList();
- }
- /// <summary>
- /// 初始化专项级别列表
- /// </summary>
- public void InitSpecialLevelList()
- {
- m_specialId = m_specialList.Rows[this.cmbSpecial.SelectedIndex]["id"].ToString();
- dgvLevelList.AutoGenerateColumns = false;
- dgvLevelList.AllowUserToAddRows = false;
- dgvLevelList.ReadOnly = true;
- this.dgvLevelList.Rows.Clear();
- string select_sql = "select * from mic_special_definition_info where special_id = '" + m_specialId + "'"; //查询的SQL语句
- m_levelList = m_sqlHelper.ExecuteDataTable(select_sql, null); //执行查询操作,结果存放在dt中
- if (m_levelList.Rows.Count > 0)
- {
- dgvLevelList.Rows.Add(m_levelList.Rows.Count);
- for (int i = 0; i < m_levelList.Rows.Count; ++i)
- {
- dgvLevelList.Rows[i].Cells["name"].Value = m_levelList.Rows[i]["name"].ToString();
- dgvLevelList.Rows[i].Cells["minValue"].Value = m_levelList.Rows[i]["minValue"];
- dgvLevelList.Rows[i].Cells["maxValue"].Value = m_levelList.Rows[i]["maxValue"];
- }
- }
- }
- /// <summary>
- /// 图像索引切换
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void lstPic_SelectedIndexChanged(object sender, EventArgs e)
- {
- this.NewGraphicsListClear();
- if (this.lstPic.FocusedItem != null && this.lstPic.FocusedItem.Selected)
- {
-
- InitDocumentView();
- m_graphName = this.lstPic.FocusedItem.Text;
- InitCurrentMeasure();
- this.m_bitmap = this.appWorkspace.DocumentWorkspaces[this.lstPic.FocusedItem.Index].CompositionSurface.CreateAliasedBitmap();
- Document document = Document.FromImage(m_bitmap);
- this.m_documentWorkspace.Document = document;
- this.m_documentWorkspace.Units = MeasurementUnit.Micron;
- this.m_documentWorkspace.GraphicsList = new GraphicsList(this.m_documentWorkspace);
- //this.appWorkspace.DocumentWorkspaces[this.lstPic.FocusedItem.Index].GraphicsList.GetDrawClassList(DrawClass.Measure).ForEach(i => m_oldDrawList.Add(i));
- //this.m_documentWorkspace.GraphicsList = this.appWorkspace.DocumentWorkspaces[this.lstPic.FocusedItem.Index].GraphicsList;
- this.m_documentWorkspace.phaseModels = this.appWorkspace.DocumentWorkspaces[this.lstPic.FocusedItem.Index].phaseModels;
- this.m_documentWorkspace.GraphicsList.SelectChanged += GraphicsList_SelectChanged;
- // 选择了图片
- m_originalBit = m_bitmap.Clone(new Rectangle(0, 0, m_bitmap.Width, m_bitmap.Height), m_bitmap.PixelFormat);
- Graphics graphics = Graphics.FromImage(m_originalBit);
- Draw(graphics);
- ExistenceMeasure();
- //this.selectPicture = true;
- }
- }
- #region 线颜色选择
- private void ShowColorsForm(object sender)
- {
- Panel panel = (Panel)sender;
- this.colorsFormGrid.UserPrimaryColor = ColorBgra.FromColor(panel.BackColor);
- this.colorsFormGrid.setSaveBtn_Click(new System.EventHandler(this.gridColorChanged));
- this.colorsFormGrid.ShowDialog();
- }
- /// <summary>
- /// 网格Panel的调色板颜色改变
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void gridColorChanged(object sender, EventArgs e)
- {
- Panel panel = (Panel)m_currentColorPanel;
- Color color = this.colorsFormGrid.UserPrimaryColor.ToColor();
- panel.BackColor = color;
- this.colorsFormGrid.Close();
- }
- private void pnlStraightLineColor_Click(object sender, EventArgs e)
- {
- m_currentColorPanel = sender;
- ShowColorsForm(sender);
- }
- private void pnlLengthLineColor_Click(object sender, EventArgs e)
- {
- m_currentColorPanel = sender;
- ShowColorsForm(sender);
- }
- private void pnlParallelLineColor_Click(object sender, EventArgs e)
- {
- m_currentColorPanel = sender;
- ShowColorsForm(sender);
- }
- #endregion
- private void nudStraightLineWidth_KeyUp(object sender, KeyEventArgs e)
- {
- try
- {
- nudStraightLineWidth.Value = Convert.ToInt32(this.nudStraightLineWidth.Text);
- }
- catch (Exception)
- { }
- }
- private void nudLengthLineWidth_KeyUp(object sender, KeyEventArgs e)
- {
- try
- {
- nudLengthLineWidth.Value = Convert.ToInt32(this.nudLengthLineWidth.Text);
- }
- catch (Exception)
- { }
- }
- private void nudParallelLineWidth_KeyUp(object sender, KeyEventArgs e)
- {
- try
- {
- nudParallelLineWidth.Value = Convert.ToInt32(this.nudParallelLineWidth.Text);
- }
- catch (Exception)
- { }
- }
- /// <summary>
- /// 开启/结束测量
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnMeasure_Click(object sender, EventArgs e)
- {
- if (cmbSpecial.SelectedItem == null || m_levelList == null || m_levelList.Rows.Count <= 0)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleasefirstsetthespecialdefinitionlength.Text"));
- return;
- }
- m_isMeasure = !m_isMeasure;
- UpdateMeasureUIAndState();
- }
- private void UpdateMeasureUIAndState()
- {
- if (m_isMeasure)
- {
- this.NewGraphicsListClear();
- this.InitCurrentMeasure();
- if (m_measureResults.Count > 0)
- {
- if (m_specialSelectedIndex != this.cmbSpecial.SelectedIndex)
- {
- DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.learthelastmeasuremen.Text")+"?", PdnResources.GetString("Menu.alert.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
- if (dr == DialogResult.OK)
- {
- this.lstResult.Items.Clear();
- this.m_measureResults.Clear();
- this.bitDic.Clear();
- this.dgvResult.Rows.Clear();
- }
- else
- {
- m_isMeasure = false;
- return;
- }
- }
- }
- btnMeasure.Text = PdnResources.GetString("Menu.Stopmeasure.text");
- btnStraightLineMeasure.Enabled = true;
- btnLengthLineMeasure.Enabled = true;
- btnParallelLineMeasure.Enabled = true;
- cmbSpecial.Enabled = false;
- }
- else
- {
- btnMeasure.Text = PdnResources.GetString("Menu.Pleasestartmeasuring.text");
- cmbSpecial.Enabled = true;
- btnStraightLineMeasure.Enabled = false;
- btnLengthLineMeasure.Enabled = false;
- btnParallelLineMeasure.Enabled = false;
- if (m_isMeasureByStraightLine)
- {
- btnStraightLineMeasure.Text = PdnResources.GetString("Menu.measuring.text");
- m_isMeasureByStraightLine = false;
- }
- if (m_isMeasureByLengthLine)
- {
- btnLengthLineMeasure.Text = PdnResources.GetString("Menu.measuring.text");
- m_isMeasureByLengthLine = false;
- }
- if (m_isMeasureByParallelLine)
- {
- btnParallelLineMeasure.Text = PdnResources.GetString("Menu.measuring.text");
- m_isMeasureByParallelLine = false;
- }
- this.m_documentWorkspace.ActiveTool = DrawToolType.Pointer;
- }
- }
- private void chkOpenSetting_CheckedChanged(object sender, EventArgs e)
- {
- m_isOpenSetting = chkOpenSetting.Checked;
- }
- private void btnStraightLineMeasure_Click(object sender, EventArgs e)
- {
- if (m_bitmap == null)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleaseselecttheimagefirst.Text"));
- return;
- }
- m_isMeasureByStraightLine = !m_isMeasureByStraightLine;
- if (m_isMeasureByStraightLine)
- {
- btnStraightLineMeasure.Text = PdnResources.GetString("Menu.stop.text");
- m_isMeasureByLengthLine = false;
- btnLengthLineMeasure.Text = PdnResources.GetString("Menu.measuring.text");
- m_isMeasureByParallelLine = false;
- btnParallelLineMeasure.Text = PdnResources.GetString("Menu.measuring.text");
- m_measureStyleModel.measureLine.lineColor = pnlStraightLineColor.BackColor.ToArgb();
- m_measureStyleModel.measureLine.lineWidth = (int)nudStraightLineWidth.Value;
- m_measureStyleModel.measureLine.lineStyle = cmbStraightLine.SelectedIndex;
- this.m_documentWorkspace.ActiveTool = DrawToolType.MeasureLine;
- }
- else
- {
- btnStraightLineMeasure.Text = PdnResources.GetString("Menu.measuring.text");
- this.m_documentWorkspace.ActiveTool = DrawToolType.Pointer;
- this.GetDataAndAvg();
- }
- UpdateMeasureDecimalPlaces((int)numericUpDown1.Value);
- }
- /// <summary>
- /// 是否存在测量,有则选择工具
- /// </summary>
- /// <returns></returns>
- public void ExistenceMeasure()
- {
- if (PdnResources.GetString("Menu.stop.text").Equals(btnStraightLineMeasure.Text))
- this.m_documentWorkspace.ActiveTool = DrawToolType.MeasureLine;
- if (PdnResources.GetString("Menu.stop.text").Equals(btnLengthLineMeasure.Text))
- this.m_documentWorkspace.ActiveTool = DrawToolType.MeasureLength;
- if (PdnResources.GetString("Menu.stop.text").Equals(btnParallelLineMeasure.Text))
- this.m_documentWorkspace.ActiveTool = DrawToolType.MeasureParallelLine;
- }
- private void btnLengthLineMeasure_Click(object sender, EventArgs e)
- {
- if (m_bitmap == null)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleaseselecttheimagefirst.Text"));
- return;
- }
- m_isMeasureByLengthLine = !m_isMeasureByLengthLine;
- if (m_isMeasureByLengthLine)
- {
- btnLengthLineMeasure.Text = PdnResources.GetString("Menu.stop.text");
- m_isMeasureByStraightLine = false;
- btnStraightLineMeasure.Text = PdnResources.GetString("Menu.measuring.text");
- m_isMeasureByParallelLine = false;
- btnParallelLineMeasure.Text = PdnResources.GetString("Menu.measuring.text");
- m_measureStyleModel.measureLength.lineColor = pnlLengthLineColor.BackColor.ToArgb();
- m_measureStyleModel.measureLength.lineWidth = (int)nudLengthLineWidth.Value;
- m_measureStyleModel.measureLength.lineStyle = cmbLengthLine.SelectedIndex;
- this.m_documentWorkspace.ActiveTool = DrawToolType.MeasureLength;
- }
- else
- {
- btnLengthLineMeasure.Text = PdnResources.GetString("Menu.measuring.text");
- this.m_documentWorkspace.ActiveTool = DrawToolType.Pointer;
- this.GetDataAndAvg();
- }
- UpdateMeasureDecimalPlaces((int)numericUpDown1.Value);
- }
- private void btnParallelLineMeasure_Click(object sender, EventArgs e)
- {
- if (m_bitmap == null)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleaseselecttheimagefirst.Text"));
- return;
- }
- m_isMeasureByParallelLine = !m_isMeasureByParallelLine;
- if (m_isMeasureByParallelLine)
- {
- btnParallelLineMeasure.Text = PdnResources.GetString("Menu.stop.text");
- m_isMeasureByStraightLine = false;
- btnStraightLineMeasure.Text = PdnResources.GetString("Menu.measuring.text");
- m_isMeasureByLengthLine = false;
- btnLengthLineMeasure.Text = PdnResources.GetString("Menu.measuring.text");
- m_measureStyleModel.measureParallelLine.lineColor = pnlParallelLineColor.BackColor.ToArgb();
- m_measureStyleModel.measureParallelLine.lineWidth = (int)nudParallelLineWidth.Value;
- m_measureStyleModel.measureParallelLine.lineStyle = cmbParallelLine.SelectedIndex;
- this.m_documentWorkspace.ActiveTool = DrawToolType.MeasureParallelLine;
-
- }
- else
- {
- btnParallelLineMeasure.Text = PdnResources.GetString("Menu.measuring.text");
- this.m_documentWorkspace.ActiveTool = DrawToolType.Pointer;
- this.GetDataAndAvg();
- }
- UpdateMeasureDecimalPlaces((int)numericUpDown1.Value);
- }
- private TreeView drawTreeView;
- /// <summary>
- /// 从配置文件中读取设置信息
- /// </summary>
- private void GetAttributeFromConfigurationFile()
- {
- MeasureListSetModel measureListSetModel = XmlSerializeHelper.DESerializer<MeasureListSetModel>(FileOperationHelper.ReadStringFromFile(System.Windows.Forms.Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\MeasureListSetModel.xml", FileMode.Open));
- drawTreeView = new TreeView();
- if (measureListSetModel != null && measureListSetModel.AttributeMapDrawNodes != null)
- {
- for (int i = 0; i < measureListSetModel.AttributeMapDrawNodes.Count; i++)
- {
- TreeNode firstNode = new TreeNode();
- firstNode.Text = measureListSetModel.AttributeMapDrawNodes[i].Name;
- for (int j = 0; j < measureListSetModel.AttributeMapDrawNodes[i].Attribute.Count; j++)
- {
- TreeNode scondNode = new TreeNode();
- scondNode.Text = measureListSetModel.AttributeMapDrawNodes[i].Attribute[j].Text;
- scondNode.Name = measureListSetModel.AttributeMapDrawNodes[i].Attribute[j].Name;
- for (int k = 0; k < measureListSetModel.AttributeMapDrawNodes[i].Attribute[j].Attribute.Count; k++)
- {
- if (measureListSetModel.AttributeMapDrawNodes[i].Attribute[j].Attribute.Count > 0)
- {
- TreeNode thirdNode = new TreeNode();
- thirdNode.Text = measureListSetModel.AttributeMapDrawNodes[i].Attribute[j].Attribute[k].Text;
- thirdNode.Name = measureListSetModel.AttributeMapDrawNodes[i].Attribute[j].Attribute[k].Name;
- scondNode.Nodes.Add(thirdNode);
- }
- }
- firstNode.Nodes.Add(scondNode);
- }
- drawTreeView.Nodes.Add(firstNode);
- }
- }
- }
- /// <summary>
- /// 获取计算测量结果
- /// </summary>
- private void GetDataAndAvg()
- {
-
- string level = "";
- double avg = 0;
- double sum = 0;
- int count = this.m_documentWorkspace.GraphicsList.Count;
- int no = 0;
- for (int i = 0; i < count; i++)
- {
- if (this.m_documentWorkspace.GraphicsList[i].objectType == DrawClass.Measure)
- {
- no++;
- Dictionary<System.Enum, object> data = ((MeasureDrawObject)this.m_documentWorkspace.GraphicsList[i]).GetData();
- foreach (var keys in data)
- {
- /// <summary>
- /// 像素长度
- /// </summary>
- //PixelLength
- /// <summary>
- /// 物理长度
- /// </summary>
- //PhysicalLength
- object v;
- InvariantData.measureAttributes.TryGetValue((MeasureAttributes)keys.Key, out v);
- if (((MeasureAttributes)keys.Key).ToString() == "PhysicalLength")
- {
- double length = double.Parse(keys.Value.ToString());
- if (length > 0)
- {
- sum += length;
- this.ShowMeasureInfo(i);
-
- }
- else
- {
- no--;
- }
- break;
- }
- }
- }
- }
- if(no > 0)
- {
- avg = sum / no;
- }
- if (m_levelList != null && m_levelList.Rows.Count > 0)
- {
- for (int i = 0; i < m_levelList.Rows.Count; ++i)
- {
- double minValue = double.Parse(m_levelList.Rows[i]["minValue"].ToString());
- double maxValue = double.Parse(m_levelList.Rows[i]["maxValue"].ToString());
- if (avg >= minValue && avg < maxValue)
- {
- level = m_levelList.Rows[i]["name"].ToString();
- break;
- }
- }
- }
- lblLevel.Text = level;
- lblAvg.Text = AnalysisTools.GetDecNum(avg, decnum); ;
- m_measureCurrent.LevelName = level;
- m_measureCurrent.MeasureAvg = avg;
- }
- private void ShowMeasureInfo(int index)
- {
- int i = index;
- int count1 = drawTreeView.Nodes.Count;
- ((MeasureDrawObject)(this.m_documentWorkspace.GraphicsList[i])).drawingProperties.Clear();
- ((MeasureDrawObject)(this.m_documentWorkspace.GraphicsList[i])).pointChangeObject.Clear();
- for (int k = 0; k < count1; k++)
- {
- int count2 = drawTreeView.Nodes[k].Nodes.Count;
- for (int j = 0; j < count2; j++)
- {
- if (this.m_documentWorkspace.GraphicsList[i].drawToolType == (DrawToolType)Enum.Parse(typeof(DrawToolType), drawTreeView.Nodes[k].Nodes[j].Name))
- {
- bool drawb = false;
- if (drawTreeView.Nodes[k].Nodes[j].Nodes.Count == 0)
- {
- ((MeasureDrawObject)(this.m_documentWorkspace.GraphicsList[i])).drawingProperties.Add((DrawToolType)Enum.Parse(typeof(DrawToolType), drawTreeView.Nodes[k].Nodes[j].Name), new string[] { "nothing" });
- if (this.m_documentWorkspace.oldDrawTreeView != null)
- {
- if (this.m_documentWorkspace.oldDrawTreeView.Nodes[k].Nodes[j].Nodes.Count != 0)
- ((MeasureDrawObject)(this.m_documentWorkspace.GraphicsList[i])).pointChangeObject.Add((DrawToolType)Enum.Parse(typeof(DrawToolType), drawTreeView.Nodes[k].Nodes[j].Name), true);
- }
- else
- {
- ((MeasureDrawObject)(this.m_documentWorkspace.GraphicsList[i])).pointChangeObject.Add((DrawToolType)Enum.Parse(typeof(DrawToolType), drawTreeView.Nodes[k].Nodes[j].Name), true);
- }
- }
- else
- {
- int a = 0;
- string[] arr = new string[drawTreeView.Nodes[k].Nodes[j].Nodes.Count];
- foreach (TreeNode node2 in drawTreeView.Nodes[k].Nodes[j].Nodes)
- {
- arr[a] = node2.Name;
- a++;
- }
- ((MeasureDrawObject)(this.m_documentWorkspace.GraphicsList[i])).drawingProperties.Add((DrawToolType)Enum.Parse(typeof(DrawToolType), drawTreeView.Nodes[k].Nodes[j].Name), arr);
- if (this.m_documentWorkspace.oldDrawTreeView != null)
- {
- if (drawTreeView.Nodes[k].Nodes[j].Nodes.Count != this.m_documentWorkspace.oldDrawTreeView.Nodes[k].Nodes[j].Nodes.Count)
- {
- ((MeasureDrawObject)(this.m_documentWorkspace.GraphicsList[i])).pointChangeObject.Add((DrawToolType)Enum.Parse(typeof(DrawToolType), drawTreeView.Nodes[k].Nodes[j].Name), true);
- }
- else
- {
- foreach (TreeNode oldNode in this.m_documentWorkspace.oldDrawTreeView.Nodes[k].Nodes[j].Nodes)
- {
- if (!arr.Contains(oldNode.Name))
- {
- drawb = true;
- }
- }
- if (drawb)
- ((MeasureDrawObject)(this.m_documentWorkspace.GraphicsList[i])).pointChangeObject.Add((DrawToolType)Enum.Parse(typeof(DrawToolType), drawTreeView.Nodes[k].Nodes[j].Name), drawb);
- }
- }
- else
- {
- ((MeasureDrawObject)(this.m_documentWorkspace.GraphicsList[i])).pointChangeObject.Add((DrawToolType)Enum.Parse(typeof(DrawToolType), drawTreeView.Nodes[k].Nodes[j].Name), true);
- }
- }
- this.Refresh();
- }
- }
- }
- }
- /// <summary>
- /// 删除测量
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnDelete_Click(object sender, EventArgs e)
- {
- NewGraphicsListClear();
- this.GetDataAndAvg();
- }
- private void SpecialMeasureLengthDialog_FormClosing(object sender, FormClosingEventArgs e)
- {
- m_measureStyleModel.measureLine.lineColor = m_straightLineColor;
- m_measureStyleModel.measureLine.lineWidth = m_straightLineWidth;
- m_measureStyleModel.measureLine.lineStyle = m_straightLineStyle;
- m_measureStyleModel.measureLength.lineColor = m_lengthLineColor;
- m_measureStyleModel.measureLength.lineWidth = m_lengthLineWidth;
- m_measureStyleModel.measureLength.lineStyle = m_lengthLineStyle;
- m_measureStyleModel.measureParallelLine.lineColor = m_parallelLineColor;
- m_measureStyleModel.measureParallelLine.lineWidth = m_parallelLineWidth;
- m_measureStyleModel.measureParallelLine.lineStyle = m_parallelLineStyle;
- Startup.instance.measureStyleModel = m_measureStyleModel;
- saveLastData();
- m_sqlHelper.DisConnect();
- }
- private void numericUpDown1_ValueChanged(object sender, EventArgs e)
- {
- this.decnum = (int)numericUpDown1.Value;
- this.UpdateMeasureDecimalPlaces((int)numericUpDown1.Value);
- this.RefreshDgvResult();
- this.GetDataAndAvg();
- }
- /// <summary>
- /// 更新小数位数
- /// </summary>
- /// <param name="decimalPlaces"></param>
- public void UpdateMeasureDecimalPlaces(int praDecimalPlaces)
- {
- MeasureDrawObject.decimalPlaces = praDecimalPlaces;
- this.m_documentWorkspace.Refresh();
- }
- /// <summary>
- /// 全部显示
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnAllShow_Click(object sender, EventArgs e)
- {
- m_showAll = true;
- this.RefreshDgvResult();
- }
- /// <summary>
- /// 删除测量结果
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnResultDel_Click(object sender, EventArgs e)
- {
- if (this.lstResult.SelectedItems != null && this.lstResult.SelectedItems.Count > 0)
- {
- DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Determineallmeasurementsimage.Text")+"?", PdnResources.GetString("Menu.alert.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
- if (dr == DialogResult.OK)
- {
- foreach (ListViewItem item in this.lstResult.Items)
- {
- if (item.Selected)
- {
- this.lstResult.Items.Remove(item);
- this.m_measureResults.RemoveAll(u => u.Tag == item.Name.ToString());
- if (bitDic.ContainsKey(item.Name.ToString()))
- {
- bitDic[item.Name.ToString()].Clear();
- }
- }
- }
- RefreshDgvResult();
- }
- }
- }
- private void RefreshDgvResult()
- {
- dgvResult.Rows.Clear();
- if (m_showAll)
- {
- for (int i = 0; i < m_measureResults.Count; i++)
- {
- MeasureLengthResult aResult = m_measureResults[i];
- dgvResult.Rows.Add(aResult.Tag, aResult.GraphName, aResult.LevelName, AnalysisTools.GetDecNum(aResult.MeasureAvg, decnum));
- }
- }
- else
- {
- if (this.lstResult.SelectedItems != null && this.lstResult.SelectedItems.Count > 0)
- {
- for (int i = 0; i < this.lstResult.SelectedItems.Count; i++)
- {
- string tag = this.lstResult.SelectedItems[i].Name.ToString();
- List<MeasureLengthResult> findResults = m_measureResults.FindAll(item => item.Tag.Equals(tag));
- for (int j = 0; j < findResults.Count; j++)
- {
- MeasureLengthResult aResult = findResults[j];
- dgvResult.Rows.Add(aResult.Tag, aResult.GraphName, aResult.LevelName, AnalysisTools.GetDecNum(aResult.MeasureAvg, decnum));
- }
- }
- }
- }
- }
- /// <summary>
- /// 保存测量结果
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnSave_Click(object sender, EventArgs e)
- {
- if (!m_isMeasure)
- {
- MessageBox.Show(PdnResources.GetString("Menu.tyetmeasured.Text"));
- return;
- }
- if (lstPic.SelectedItems.Count == 0)
- {
- MessageBox.Show(PdnResources.GetString("Menu.selectthepictureyoanttomeasure.Text"));
- return;
- }
- // 重新计算一下
- this.GetDataAndAvg();
- if (lstPic.FocusedItem != null && this.lstPic.SelectedItems.Count > 0)
- {
- string imgName = this.appWorkspace.DocumentWorkspaces[this.lstPic.FocusedItem.Index].GetFriendlyName();
- string tag = this.imageList1.Images.Keys[this.lstPic.SelectedItems[0].Index];
- if (m_measureResults.FindAll(item => item.Tag.Equals(tag)).Count == 0)
- {
- ListViewItem listViewItem = new ListViewItem();
- listViewItem.Name = tag;
- listViewItem.SubItems[0].Text = imgName;
- this.lstResult.Items.Add(listViewItem);
- this.lstResult.SelectedItems.Clear();
- this.lstResult.Items[this.lstResult.Items.Count - 1].Selected = true;
- MeasureLengthResult aResult = m_measureCurrent;
- aResult.Tag = tag;
- dgvResult.Rows.Add(tag, aResult.GraphName, aResult.LevelName, AnalysisTools.GetDecNum(aResult.MeasureAvg, decnum));
- m_measureResults.Add(aResult);
- }
- else
- {
- DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Theanalysisreertoreplaceit.text") + "?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
- if (dr == DialogResult.Cancel)
- {
- return;
- }
- m_measureCurrent.Tag = tag;
- m_measureResults.RemoveAll(u => u.Tag == tag);
- m_measureResults.Add(m_measureCurrent);
- dgvResult.Rows.Clear();
- for (int i = 0; i < m_measureResults.Count; i++)
- {
- MeasureLengthResult aResult = m_measureResults[i];
- dgvResult.Rows.Add(aResult.Tag, aResult.GraphName, aResult.LevelName, AnalysisTools.GetDecNum(aResult.MeasureAvg, decnum));
- }
- }
- //保存处理后的图片
- double pantographRatio = (double)this.appWorkspace.DocumentWorkspaces[this.lstPic.FocusedItem.Index].GetRulerMultiple(MeasurementUnit.Micron);//标尺*放大倍数
- List<Bitmap> tempBit = new List<Bitmap>();
- //Bitmap originalBit = this.appWorkspace.DocumentWorkspaces[this.lstPic.FocusedItem.Index].CompositionSurface.CreateAliasedBitmap();
- m_originalBit.Tag = pantographRatio;
- tempBit.Add(m_originalBit);
- Bitmap newBit = m_originalBit.Clone(new Rectangle(0, 0, m_originalBit.Width, m_originalBit.Height), m_originalBit.PixelFormat);
- Graphics graphics = Graphics.FromImage(newBit);
- Draw(graphics);
- newBit.Tag = pantographRatio;
- tempBit.Add(newBit);
- if (bitDic.ContainsKey(tag))
- {
- bitDic[tag].Clear();
- bitDic[tag] = tempBit;
- }
- else
- {
- bitDic.Add(tag, tempBit);
- }
- //拼接中间数据
- List<List<string>> dataList = new List<List<string>>();
- List<string> columnName = new List<string>();
- columnName.Add(PdnResources.GetString("Menu.Imagement.Measurementlist.ordernumber.text"));
- columnName.Add(PdnResources.GetString("Menu.hectuallength.Text"));
- dataList.Add(columnName);
- int count = this.m_documentWorkspace.GraphicsList.Count;
- int no = 0;
- for (int i = 0; i < count; i++)
- {
- if (this.m_documentWorkspace.GraphicsList[i].objectType == DrawClass.Measure)
- {
- Dictionary<System.Enum, object> data = ((MeasureDrawObject)this.m_documentWorkspace.GraphicsList[i]).GetData();
- foreach (var keys in data)
- {
- object v;
- InvariantData.measureAttributes.TryGetValue((MeasureAttributes)keys.Key, out v);
- if (((MeasureAttributes)keys.Key).ToString() == "PhysicalLength")
- {
- double length = double.Parse(keys.Value.ToString());
- if (length > 0)
- {
- no++;
- List<string> strList = new List<string>();
- strList.Add(no.ToString());
- strList.Add(length.ToString());
- dataList.Add(strList);
- }
- }
- }
- }
- }
- bool isExist = false;//是否已存在进行替换
- int modelIndex = -1;//要替换的下标
- for (int j = 0; j < tempDataModel.Count; j++)
- {
- if (tempDataModel[j].tagName.Equals(tag))
- {
- isExist = true;
- modelIndex = j;
- break;
- }
- }
- if (isExist && modelIndex > -1)
- tempDataModel[modelIndex].dataList = dataList;
- else
- {
- ExportProjectModel newModel = new ExportProjectModel();
- newModel.tagName = tag;
- newModel.picName = imgName;
- newModel.dataList = dataList;
- tempDataModel.Add(newModel);
- }
- //if (m_measureCurrent.LevelName.Equals(""))
- //{
- // MessageBox.Show(PdnResources.GetString("Menu.tnocorrespondinglevel.Text"));
- //}
- //else
- //{
- // MessageBox.Show(PdnResources.GetString("Menu.Successfullysaved.text"));
- //}
- }
- }
- private void Draw(Graphics graphics)
- {
- if (this.m_documentWorkspace.GraphicsList.Count > 0)
- {
- this.m_documentWorkspace.GraphicsList.Draw(graphics);
- }
- if (this.m_documentWorkspace.phaseModels.Count > 0)
- {
- foreach (PhaseModel model in this.m_documentWorkspace.phaseModels)
- {
- if (model.choise && model.mat != null)
- {
- Bitmap map = OpenCvSharp.Extensions.BitmapConverter.ToBitmap(model.mat);
- graphics.DrawImage(map, 0, 0, map.Width, map.Height);
- }
- }
- }
- }
- private void NewGraphicsListClear()
- {
- if (this.m_documentWorkspace != null && this.m_documentWorkspace.GraphicsList.Count > 0)
- {
- this.m_documentWorkspace.GraphicsList.Clear();
- this.m_documentWorkspace.Refresh();
- //List<DrawObject> drawList = this.m_documentWorkspace.GraphicsList.GetDrawClassList(DrawClass.Measure);
- //List<DrawObject> lstInfo = drawList.FindAll(delegate (DrawObject lst) { return !m_oldDrawList.Contains(lst); });
- //lstInfo.ForEach(i => this.m_documentWorkspace.GraphicsList.RemoveObj(i));
- }
- }
- private void lstResult_SelectedIndexChanged(object sender, EventArgs e)
- {
- this.m_showAll = false;
- this.RefreshDgvResult();
- }
- /// <summary>
- /// 生成报告
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnCreate_Click(object sender, EventArgs e)
- {
- if(this.dgvResult.Rows.Count <= 0)
- {
- MessageBox.Show(PdnResources.GetString("Menu.nodata.text"));
- return;
- }
- if (chkOpenSetting.Checked)
- {
- OpenSettingDialog();
- }
- bitList.Clear();
- if (this.analyzeSettingModel != null && !string.IsNullOrEmpty(this.analyzeSettingModel.analyzeClassify))
- {
- //获取word书签与excel单元格的关系,以字典方式存储
- List<mic_module_infos> mic_module_infos = mic_module_infos_BLL.FindAll().FindAll(a => a.analyze_classify == this.analyzeSettingModel.analyzeClassify);
- Dictionary<string, string> tagInfos = new Dictionary<string, string>();
- if (mic_module_infos != null && mic_module_infos.Count > 0)
- {
- foreach (mic_module_infos info in mic_module_infos)
- {
- tagInfos.Add(info.tag_name, info.cell_position);
- }
- }
- List<List<string>> analysisContent = new List<List<string>>();
- for (int i = 0; i < this.dgvResult.Rows.Count; i++)
- {
- List<string> content1 = new List<string>();
- if (i == 0)
- {
- content1.Add(this.dgvResult.Columns[1].HeaderText);
- content1.Add(this.dgvResult.Columns[2].HeaderText);
- content1.Add(this.dgvResult.Columns[3].HeaderText);
- analysisContent.Add(content1);
- }
- content1 = new List<string>();
- content1.Add(this.dgvResult.Rows[i].Cells[1].Value.ToString());
- content1.Add(this.dgvResult.Rows[i].Cells[2].Value.ToString());
- content1.Add(this.dgvResult.Rows[i].Cells[3].Value.ToString());
- analysisContent.Add(content1);
- //图片
- string tag = this.dgvResult.Rows[i].Cells[0].Value.ToString();
- if (bitDic.ContainsKey(tag))
- {
- bitList.Add(bitDic[tag][0]);
- bitList.Add(bitDic[tag][1]);
- }
- }
- appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, bitList, tagInfos);
- }
- else
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleasesetiirst.Text")+"!");
- }
-
- }
- /// <summary>
- /// 导出结果
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnExport_Click(object sender, EventArgs e)
- {
- if (this.dgvResult.Rows.Count > 0)
- {
- SaveFileDialog exe = new SaveFileDialog();
- exe.Filter = "Execl files (*.xlsx)|*.xlsx";
- exe.FilterIndex = 0;
- exe.RestoreDirectory = true;
- exe.Title = "Export Excel File";
- exe.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
- exe.FileName = PdnResources.GetString("Menu.Speciasurveyresultsoflengthsurvey.Text") + DateTime.Now.ToString("yyyyMMddhhmmss");
- DialogResult dr = exe.ShowDialog();
- if (dr == DialogResult.OK)
- {
- DataTable dtb = new DataTable();
- for(int i = 1; i< this.dgvResult.Columns.Count; i++)
- {
- dtb.Columns.Add(this.dgvResult.Columns[i].HeaderText);
- }
- for (int r = 0; r < this.dgvResult.Rows.Count; r++)
- {
- DataRow dataRow = dtb.NewRow();
- for (int c = 1; c < this.dgvResult.Rows[r].Cells.Count; c++)
- {
- dataRow[this.dgvResult.Columns[c].HeaderText] = this.dgvResult.Rows[r].Cells[c].Value;
- }
- dtb.Rows.Add(dataRow);
- }
- List<DataTable> list = new List<DataTable>();
- list.Add(dtb);
- this.appWorkspace.ExportDataToExcelWithProgress(list, exe.FileName, true, false, true);
- }
- }
- else
- {
- MessageBox.Show(PdnResources.GetString("Menu.Noanalysisresults.text")+"!");
- }
- }
- private void nudStraightLineWidth_ValueChanged(object sender, EventArgs e)
- {
- m_measureStyleModel.measureLine.lineWidth = (int)nudStraightLineWidth.Value;
- m_documentWorkspace.Refresh();
- }
- private void cmbStraightLine_SelectedIndexChanged(object sender, EventArgs e)
- {
- m_measureStyleModel.measureLine.lineStyle = cmbStraightLine.SelectedIndex;
- m_documentWorkspace.Refresh();
- }
- private void pnlStraightLineColor_BackColorChanged(object sender, EventArgs e)
- {
- m_measureStyleModel.measureLine.lineColor = pnlStraightLineColor.BackColor.ToArgb();
- m_documentWorkspace.Refresh();
- }
- private void nudLengthLineWidth_ValueChanged(object sender, EventArgs e)
- {
- m_measureStyleModel.measureLength.lineWidth = (int)nudLengthLineWidth.Value;
- m_documentWorkspace.Refresh();
- }
- private void cmbLengthLine_SelectedIndexChanged(object sender, EventArgs e)
- {
- m_measureStyleModel.measureLength.lineStyle = cmbLengthLine.SelectedIndex;
- m_documentWorkspace.Refresh();
- }
- private void pnlLengthLineColor_BackColorChanged(object sender, EventArgs e)
- {
- m_measureStyleModel.measureLength.lineColor = pnlLengthLineColor.BackColor.ToArgb();
- m_documentWorkspace.Refresh();
- }
- private void nudParallelLineWidth_ValueChanged(object sender, EventArgs e)
- {
- m_measureStyleModel.measureParallelLine.lineWidth = (int)nudParallelLineWidth.Value;
- m_documentWorkspace.Refresh();
- }
- private void pnlParallelLineColor_BackColorChanged(object sender, EventArgs e)
- {
- m_measureStyleModel.measureParallelLine.lineColor = pnlParallelLineColor.BackColor.ToArgb();
- m_documentWorkspace.Refresh();
- }
- private void cmbParallelLine_SelectedIndexChanged(object sender, EventArgs e)
- {
- m_measureStyleModel.measureParallelLine.lineStyle = cmbParallelLine.SelectedIndex;
- m_documentWorkspace.Refresh();
- }
- /// <summary>
- /// 导出项目
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnExportProject_Click(object sender, EventArgs e)
- {
- try
- {
- if (this.analyzeSettingModel == null)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Settheexporteitemfirst.Text"));
- return;
- }
- //获取项目工程内的文件夹路径
- ProjectEngineering.NodeItem item = this.appWorkspace.GetInsertProjectPath(2, "Menu.GeneralAnalysis.SpecialMeasure.Text", this.analyzeSettingModel.savePath);
- bitList.Clear();
- if (item != null)
- {
- //向文件夹内保存图片和报告
- if (!string.IsNullOrEmpty(this.analyzeSettingModel.analyzeClassify))
- {
- //获取word书签与excel单元格的关系,以字典方式存储
- List<mic_module_infos> mic_module_infos = mic_module_infos_BLL.FindAll().FindAll(a => a.analyze_classify == this.analyzeSettingModel.analyzeClassify);
- Dictionary<string, string> tagInfos = new Dictionary<string, string>();
- if (mic_module_infos != null && mic_module_infos.Count > 0)
- {
- foreach (mic_module_infos info in mic_module_infos)
- {
- tagInfos.Add(info.tag_name, info.cell_position);
- }
- }
- List<ExportProjectModel> dataModel = new List<ExportProjectModel>();
- List<List<string>> analysisContent = new List<List<string>>();
- for (int i = 0; i < this.dgvResult.Rows.Count; i++)
- {
- List<string> content1 = new List<string>();
- if (i == 0)
- {
- content1.Add(this.dgvResult.Columns[1].HeaderText);
- content1.Add(this.dgvResult.Columns[2].HeaderText);
- content1.Add(this.dgvResult.Columns[3].HeaderText);
- analysisContent.Add(content1);
- }
- content1 = new List<string>();
- content1.Add(this.dgvResult.Rows[i].Cells[1].Value.ToString());
- content1.Add(this.dgvResult.Rows[i].Cells[2].Value.ToString());
- content1.Add(this.dgvResult.Rows[i].Cells[3].Value.ToString());
- analysisContent.Add(content1);
- //图片
- string tag = this.dgvResult.Rows[i].Cells[0].Value.ToString();
- if (bitDic.ContainsKey(tag))
- {
- bitList.Add(bitDic[tag][0]);
- bitList.Add(bitDic[tag][1]);
- }
- // 中间数据
- foreach(ExportProjectModel data in tempDataModel)
- {
- if (data.tagName.Equals(tag))
- {
- dataModel.Add(data);
- }
- }
- }
- this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, dataModel, bitList, tagInfos, item.path, item.code);
- }
- else
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text")+"!");
- return;
- }
- //保存项目信息到数据库
- this.appWorkspace.InsertIntoDB(this.analyzeSettingModel, item);
- }
- }
- catch (Exception)
- {
- }
- }
- /// <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.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;
- 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.SpecialMeasureLengthModels == null)
- {
- generalAnalysisModel.SpecialMeasureLengthModels = new GeneralAnalysisModel.SpecialMeasureLengthModel();
- }
- if (generalAnalysisModel.SpecialMeasureLengthModels.hasUsed)
- {
- if (cmbSpecial.Items.Count >= (generalAnalysisModel.SpecialMeasureLengthModels.parameter1 - 1))
- {
- cmbSpecial.SelectedIndex = generalAnalysisModel.SpecialMeasureLengthModels.parameter1;
- }
- else
- {
- cmbSpecial.SelectedIndex = 0;
- }
- pnlStraightLineColor.BackColor = Color.FromArgb(generalAnalysisModel.SpecialMeasureLengthModels.parameter2);
- nudStraightLineWidth.Value = generalAnalysisModel.SpecialMeasureLengthModels.parameter3;
- cmbStraightLine.SelectedIndex = generalAnalysisModel.SpecialMeasureLengthModels.parameter4;
- pnlLengthLineColor.BackColor = Color.FromArgb(generalAnalysisModel.SpecialMeasureLengthModels.parameter5);
- nudLengthLineWidth.Value = generalAnalysisModel.SpecialMeasureLengthModels.parameter6;
- cmbLengthLine.SelectedIndex = generalAnalysisModel.SpecialMeasureLengthModels.parameter7;
- pnlParallelLineColor.BackColor = Color.FromArgb(generalAnalysisModel.SpecialMeasureLengthModels.parameter8);
- nudParallelLineWidth.Value = generalAnalysisModel.SpecialMeasureLengthModels.parameter9;
- cmbParallelLine.SelectedIndex = generalAnalysisModel.SpecialMeasureLengthModels.parameter10;
- chkOpenSetting.Checked = generalAnalysisModel.SpecialMeasureLengthModels.parameter11;
- numericUpDown1.Value = generalAnalysisModel.SpecialMeasureLengthModels.parameter12;
- }
- }
- }
- /// <summary>
- /// 保存上次操作参数
- /// </summary>
- private void saveLastData()
- {
- if (generalAnalysisModel.SpecialMeasureLengthModels == null)
- {
- generalAnalysisModel.SpecialMeasureLengthModels = new GeneralAnalysisModel.SpecialMeasureLengthModel();
- }
- generalAnalysisModel.SpecialMeasureLengthModels.hasUsed = true;
- generalAnalysisModel.SpecialMeasureLengthModels.parameter1 = cmbSpecial.SelectedIndex;
- generalAnalysisModel.SpecialMeasureLengthModels.parameter2 = pnlStraightLineColor.BackColor.ToArgb();
- generalAnalysisModel.SpecialMeasureLengthModels.parameter3 = (int)nudStraightLineWidth.Value;
- generalAnalysisModel.SpecialMeasureLengthModels.parameter4 = cmbStraightLine.SelectedIndex;
- generalAnalysisModel.SpecialMeasureLengthModels.parameter5 = pnlLengthLineColor.BackColor.ToArgb();
- generalAnalysisModel.SpecialMeasureLengthModels.parameter6 = (int)nudLengthLineWidth.Value;
- generalAnalysisModel.SpecialMeasureLengthModels.parameter7 = cmbLengthLine.SelectedIndex;
- generalAnalysisModel.SpecialMeasureLengthModels.parameter8 = pnlParallelLineColor.BackColor.ToArgb();
- generalAnalysisModel.SpecialMeasureLengthModels.parameter9 = (int)nudParallelLineWidth.Value;
- generalAnalysisModel.SpecialMeasureLengthModels.parameter10 = cmbParallelLine.SelectedIndex;
- generalAnalysisModel.SpecialMeasureLengthModels.parameter11 = chkOpenSetting.Checked;
- generalAnalysisModel.SpecialMeasureLengthModels.parameter12 = (int)numericUpDown1.Value;
- string filePath = Application.StartupPath + "\\Config\\Default\\ParameterSaving\\ParameterGeneralAnalysis.xml";
- string porosityInfoXml = XmlSerializeHelper.XmlSerialize<GeneralAnalysisModel>(generalAnalysisModel);
- FileOperationHelper.WriteStringToFile(porosityInfoXml, filePath, FileMode.Create);
- }
- }
- }
|