1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082 |
- using Metis.ParameterSet;
- using PaintDotNet;
- using PaintDotNet.Annotation;
- using PaintDotNet.Annotation.Enum;
- using PaintDotNet.Annotation.Measure;
- using PaintDotNet.Base.CommTool;
- using PaintDotNet.Base.SettingModel;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace Metis.Measuring
- {
- internal partial class GeometryMeasureDialog : FloatingToolForm
- {
- /// <summary>
- /// 展开前宽度
- /// </summary>
- private int smallHeight = 339;
- /// <summary>
- /// 展开后宽度
- /// </summary>
- private int bigHelght = 996;
- /// <summary>
- /// 是否展开
- /// </summary>
- private bool isEnlarge = false;
- /// <summary>
- /// 测量属性实体
- /// </summary>
- private MeasureListSetModel measureListSetModel;
- private ImageList imageList1 = new ImageList();
- /// <summary>
- /// 工具集合
- /// </summary>
- private List<string> toolNameList = new List<string>();
- /// <summary>
- /// 工具别名集合
- /// </summary>
- private List<string> toolNickNameList = new List<string>();
- private Dictionary<int, List<ListViewItem>> filterDict = new Dictionary<int, List<ListViewItem>>();
- private AppWorkspace appWorkspace;
- private MeasureListInteractiveDataModel measureListInteractiveDataModel;
- /// <summary>
- /// 多值类型
- /// </summary>
- private List<string> moreTypeList = new List<string>() { "MeasureMulLine", "MeasureMulHVLine", "MeasureMulSegment", "MeasureMulVLine",
- "MeasureMulPLine", "MeasureHMulPLine","MeasureVMulPLine","MeasureMulParallelLine","MeasureVMulParallelLine","MeasureHMulParallelLine", };
- private GroupBox groupBox2;
- private GroupBox groupBox3;
- private Label label1;
- private ComboBox comboBox1;
- private Label label6;
- private Label label5;
- private Label label4;
- private Label label3;
- private Label label2;
- public NumericUpDown numericUpDown5;
- private Button button3;
- private Button button2;
- private Button button1;
- private GroupBox groupBox4;
- private GroupBox groupBox5;
- private GroupBox groupBox6;
- private GroupBox groupBox7;
- private GroupBox groupBox8;
- private Button button4;
- private PaintDotNet.CustomControl.TreeViewEnhanced treeView1;
- private PaintDotNet.CustomControl.TreeViewEnhanced treeView2;
- private Button button8;
- private Button button7;
- private Button button6;
- private Button button5;
- private Button button12;
- private Button button11;
- private Button button10;
- private Button button9;
- private ListView listView2;
- private RadioButton radioButton8;
- private RadioButton radioButton7;
- private RadioButton radioButton6;
- private RadioButton radioButton5;
- private RadioButton radioButton4;
- private RadioButton radioButton3;
- private RadioButton radioButton2;
- private RadioButton radioButton1;
- private TextBox textBox2;
- private TextBox textBox1;
- private TextBox textBox4;
- private TextBox textBox3;
- private TextBox textBox8;
- private TextBox textBox7;
- private TextBox textBox6;
- private TextBox textBox5;
- private ListView listView1;
- private GroupBox groupBox1;
- public GeometryMeasureDialog(AppWorkspace appWorkspace)
- {
- InitializeComponent();
-
- this.Width = this.smallHeight;
- this.textBox1.Focus();
- this.appWorkspace = appWorkspace;
- this.comboBox1.SelectedIndex = 0;
- #region [初始化listView1]
- this.listView1.View = View.Details;
- ColumnHeader header1 = new ColumnHeader();
- header1.Text = "参数";
- header1.TextAlign = HorizontalAlignment.Center;
- header1.Width = 0;
- this.listView1.Columns.Add(header1);
- ColumnHeader header5 = new ColumnHeader();
- header5.Text = "参数";
- header5.TextAlign = HorizontalAlignment.Center;
- header5.Width = 73;
- this.listView1.Columns.Add(header5);
- ColumnHeader header2 = new ColumnHeader();
- header2.Text = "长度";
- header2.TextAlign = HorizontalAlignment.Center;
- header2.Width = 73;
- this.listView1.Columns.Add(header2);
- ColumnHeader header3 = new ColumnHeader();
- header3.Text = "角度";
- header3.TextAlign = HorizontalAlignment.Center;
- header3.Width = 73;
- this.listView1.Columns.Add(header3);
- ColumnHeader header4 = new ColumnHeader();
- header4.Text = "面积";
- header4.TextAlign = HorizontalAlignment.Center;
- header4.Width = 73;
- this.listView1.Columns.Add(header4);
- this.imageList1.ImageSize = new System.Drawing.Size(2, 30);
- this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
- this.listView1.SmallImageList = this.imageList1;
- #endregion
- #region [初始化listView2]
- this.listView2.View = View.Details;
- ColumnHeader header = new ColumnHeader();
- header.Text = "类型";
- header.TextAlign = HorizontalAlignment.Center;
- header.Width = 70;
- this.listView2.Columns.Add(header);
- this.imageList1.ImageSize = new System.Drawing.Size(2, 30);
- this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
- this.listView2.SmallImageList = this.imageList1;
- #endregion
- #region [获取测量属性实体]
- measureListSetModel = XmlSerializeHelper.DESerializer<MeasureListSetModel>(FileOperationHelper.ReadStringFromFile(System.Windows.Forms.Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\MeasureListInteractiveModel.xml", FileMode.Open));
- #endregion
- #region [数据属性初始化]
- this.treeView1.ItemHeight = 18;
- this.treeView2.ItemHeight = 18;
- this.allDataTree();
- #endregion
- #region [元素属性初始化]
- this.allToolTree();
- #endregion
- #region [默认展示长度及角度]
- if (this.appWorkspace.Units == null)
- {
- label3.Text = "µm";
- }
- else
- {
- switch (this.appWorkspace.Units)
- {
- case MeasurementUnit.Inch://英寸
- label3.Text = "in";
- break;
- case MeasurementUnit.Mil://米尔
- label3.Text = "mil";
- break;
- case MeasurementUnit.Centimeter://厘米
- label3.Text = "cm";
- break;
- case MeasurementUnit.Millimeter://毫米
- label3.Text = "mm";
- break;
- case MeasurementUnit.Micron://微米
- label3.Text = "µm";
- break;
- case MeasurementUnit.Nano://纳米
- label3.Text = "nm";
- break;
- default:
- label3.Text = "µm";
- break;
- }
- }
- MeasureStyleModel model = XmlSerializeHelper.DESerializer<MeasureStyleModel>(FileOperationHelper.ReadStringFromFile(Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\Measure\\" + Startup.instance.configModel.MeasurementStyle, FileMode.Open));
- label5.Text = model.measureThreePointAngle.isAngle ? "密位" : "度";
- #endregion
- #region [获取参数]
- this.getLastData();
- #endregion
- this.appWorkspace.ActiveDocumentWorkspaceChanged += new EventHandler(RefreshListView);
- this.FormClosing += new FormClosingEventHandler(this.saveLastData);
- }
- private void InitializeComponent()
- {
- this.groupBox1 = new System.Windows.Forms.GroupBox();
- this.textBox8 = new System.Windows.Forms.TextBox();
- this.textBox7 = new System.Windows.Forms.TextBox();
- this.textBox6 = new System.Windows.Forms.TextBox();
- this.textBox5 = new System.Windows.Forms.TextBox();
- this.textBox2 = new System.Windows.Forms.TextBox();
- this.textBox1 = new System.Windows.Forms.TextBox();
- this.textBox4 = new System.Windows.Forms.TextBox();
- this.textBox3 = new System.Windows.Forms.TextBox();
- this.radioButton8 = new System.Windows.Forms.RadioButton();
- this.radioButton7 = new System.Windows.Forms.RadioButton();
- this.radioButton6 = new System.Windows.Forms.RadioButton();
- this.radioButton5 = new System.Windows.Forms.RadioButton();
- this.radioButton4 = new System.Windows.Forms.RadioButton();
- this.radioButton3 = new System.Windows.Forms.RadioButton();
- this.radioButton2 = new System.Windows.Forms.RadioButton();
- this.radioButton1 = new System.Windows.Forms.RadioButton();
- this.groupBox2 = new System.Windows.Forms.GroupBox();
- this.listView1 = new System.Windows.Forms.ListView();
- this.comboBox1 = new System.Windows.Forms.ComboBox();
- this.label1 = new System.Windows.Forms.Label();
- this.groupBox3 = new System.Windows.Forms.GroupBox();
- this.button4 = new System.Windows.Forms.Button();
- this.button3 = new System.Windows.Forms.Button();
- this.button2 = new System.Windows.Forms.Button();
- this.button1 = new System.Windows.Forms.Button();
- this.numericUpDown5 = new System.Windows.Forms.NumericUpDown();
- this.label6 = new System.Windows.Forms.Label();
- this.label5 = new System.Windows.Forms.Label();
- this.label4 = new System.Windows.Forms.Label();
- this.label3 = new System.Windows.Forms.Label();
- this.label2 = new System.Windows.Forms.Label();
- this.groupBox4 = new System.Windows.Forms.GroupBox();
- this.listView2 = new System.Windows.Forms.ListView();
- this.groupBox5 = new System.Windows.Forms.GroupBox();
- this.treeView1 = new PaintDotNet.CustomControl.TreeViewEnhanced();
- this.groupBox6 = new System.Windows.Forms.GroupBox();
- this.button8 = new System.Windows.Forms.Button();
- this.button7 = new System.Windows.Forms.Button();
- this.button6 = new System.Windows.Forms.Button();
- this.button5 = new System.Windows.Forms.Button();
- this.groupBox7 = new System.Windows.Forms.GroupBox();
- this.button12 = new System.Windows.Forms.Button();
- this.button11 = new System.Windows.Forms.Button();
- this.button10 = new System.Windows.Forms.Button();
- this.button9 = new System.Windows.Forms.Button();
- this.groupBox8 = new System.Windows.Forms.GroupBox();
- this.treeView2 = new PaintDotNet.CustomControl.TreeViewEnhanced();
- this.groupBox1.SuspendLayout();
- this.groupBox2.SuspendLayout();
- this.groupBox3.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown5)).BeginInit();
- this.groupBox4.SuspendLayout();
- this.groupBox5.SuspendLayout();
- this.groupBox6.SuspendLayout();
- this.groupBox7.SuspendLayout();
- this.groupBox8.SuspendLayout();
- this.SuspendLayout();
- //
- // groupBox1
- //
- this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)));
- this.groupBox1.Controls.Add(this.textBox8);
- this.groupBox1.Controls.Add(this.textBox7);
- this.groupBox1.Controls.Add(this.textBox6);
- this.groupBox1.Controls.Add(this.textBox5);
- this.groupBox1.Controls.Add(this.textBox2);
- this.groupBox1.Controls.Add(this.textBox1);
- this.groupBox1.Controls.Add(this.textBox4);
- this.groupBox1.Controls.Add(this.textBox3);
- this.groupBox1.Controls.Add(this.radioButton8);
- this.groupBox1.Controls.Add(this.radioButton7);
- this.groupBox1.Controls.Add(this.radioButton6);
- this.groupBox1.Controls.Add(this.radioButton5);
- this.groupBox1.Controls.Add(this.radioButton4);
- this.groupBox1.Controls.Add(this.radioButton3);
- this.groupBox1.Controls.Add(this.radioButton2);
- this.groupBox1.Controls.Add(this.radioButton1);
- this.groupBox1.Location = new System.Drawing.Point(8, 3);
- this.groupBox1.Name = "groupBox1";
- this.groupBox1.Size = new System.Drawing.Size(310, 181);
- this.groupBox1.TabIndex = 3;
- this.groupBox1.TabStop = false;
- this.groupBox1.Text = "快捷工具";
- //
- // textBox8
- //
- this.textBox8.Location = new System.Drawing.Point(238, 130);
- this.textBox8.Name = "textBox8";
- this.textBox8.Size = new System.Drawing.Size(61, 21);
- this.textBox8.TabIndex = 15;
- this.textBox8.Leave += new System.EventHandler(this.textBox1_TextChanged);
- //
- // textBox7
- //
- this.textBox7.Location = new System.Drawing.Point(83, 130);
- this.textBox7.Name = "textBox7";
- this.textBox7.Size = new System.Drawing.Size(70, 21);
- this.textBox7.TabIndex = 14;
- this.textBox7.Leave += new System.EventHandler(this.textBox1_TextChanged);
- //
- // textBox6
- //
- this.textBox6.Location = new System.Drawing.Point(238, 96);
- this.textBox6.Name = "textBox6";
- this.textBox6.Size = new System.Drawing.Size(61, 21);
- this.textBox6.TabIndex = 13;
- this.textBox6.Leave += new System.EventHandler(this.textBox1_TextChanged);
- //
- // textBox5
- //
- this.textBox5.Location = new System.Drawing.Point(84, 96);
- this.textBox5.Name = "textBox5";
- this.textBox5.Size = new System.Drawing.Size(69, 21);
- this.textBox5.TabIndex = 12;
- this.textBox5.Leave += new System.EventHandler(this.textBox1_TextChanged);
- //
- // textBox2
- //
- this.textBox2.Location = new System.Drawing.Point(238, 26);
- this.textBox2.Name = "textBox2";
- this.textBox2.Size = new System.Drawing.Size(61, 21);
- this.textBox2.TabIndex = 11;
- this.textBox2.Leave += new System.EventHandler(this.textBox1_TextChanged);
- //
- // textBox1
- //
- this.textBox1.Location = new System.Drawing.Point(84, 26);
- this.textBox1.Name = "textBox1";
- this.textBox1.Size = new System.Drawing.Size(69, 21);
- this.textBox1.TabIndex = 10;
- this.textBox1.Leave += new System.EventHandler(this.textBox1_TextChanged);
- //
- // textBox4
- //
- this.textBox4.Location = new System.Drawing.Point(238, 61);
- this.textBox4.Name = "textBox4";
- this.textBox4.Size = new System.Drawing.Size(61, 21);
- this.textBox4.TabIndex = 9;
- this.textBox4.Leave += new System.EventHandler(this.textBox1_TextChanged);
- //
- // textBox3
- //
- this.textBox3.Location = new System.Drawing.Point(84, 62);
- this.textBox3.Name = "textBox3";
- this.textBox3.Size = new System.Drawing.Size(69, 21);
- this.textBox3.TabIndex = 8;
- this.textBox3.Leave += new System.EventHandler(this.textBox1_TextChanged);
- //
- // radioButton8
- //
- this.radioButton8.AutoSize = true;
- this.radioButton8.Location = new System.Drawing.Point(165, 132);
- this.radioButton8.Name = "radioButton8";
- this.radioButton8.Size = new System.Drawing.Size(59, 16);
- this.radioButton8.TabIndex = 7;
- this.radioButton8.TabStop = true;
- this.radioButton8.Text = "未设置";
- this.radioButton8.UseVisualStyleBackColor = true;
- this.radioButton8.Click += new System.EventHandler(this.radioButton_SelectedChanged);
- //
- // radioButton7
- //
- this.radioButton7.AutoSize = true;
- this.radioButton7.Location = new System.Drawing.Point(11, 132);
- this.radioButton7.Name = "radioButton7";
- this.radioButton7.Size = new System.Drawing.Size(59, 16);
- this.radioButton7.TabIndex = 6;
- this.radioButton7.TabStop = true;
- this.radioButton7.Text = "未设置";
- this.radioButton7.UseVisualStyleBackColor = true;
- this.radioButton7.Click += new System.EventHandler(this.radioButton_SelectedChanged);
- //
- // radioButton6
- //
- this.radioButton6.AutoSize = true;
- this.radioButton6.Location = new System.Drawing.Point(165, 97);
- this.radioButton6.Name = "radioButton6";
- this.radioButton6.Size = new System.Drawing.Size(59, 16);
- this.radioButton6.TabIndex = 5;
- this.radioButton6.TabStop = true;
- this.radioButton6.Text = "未设置";
- this.radioButton6.UseVisualStyleBackColor = true;
- this.radioButton6.Click += new System.EventHandler(this.radioButton_SelectedChanged);
- //
- // radioButton5
- //
- this.radioButton5.AutoSize = true;
- this.radioButton5.Location = new System.Drawing.Point(11, 97);
- this.radioButton5.Name = "radioButton5";
- this.radioButton5.Size = new System.Drawing.Size(59, 16);
- this.radioButton5.TabIndex = 4;
- this.radioButton5.TabStop = true;
- this.radioButton5.Text = "未设置";
- this.radioButton5.UseVisualStyleBackColor = true;
- this.radioButton5.Click += new System.EventHandler(this.radioButton_SelectedChanged);
- //
- // radioButton4
- //
- this.radioButton4.AutoSize = true;
- this.radioButton4.Location = new System.Drawing.Point(163, 62);
- this.radioButton4.Name = "radioButton4";
- this.radioButton4.Size = new System.Drawing.Size(59, 16);
- this.radioButton4.TabIndex = 3;
- this.radioButton4.TabStop = true;
- this.radioButton4.Text = "未设置";
- this.radioButton4.UseVisualStyleBackColor = true;
- this.radioButton4.Click += new System.EventHandler(this.radioButton_SelectedChanged);
- //
- // radioButton3
- //
- this.radioButton3.AutoSize = true;
- this.radioButton3.Location = new System.Drawing.Point(11, 62);
- this.radioButton3.Name = "radioButton3";
- this.radioButton3.Size = new System.Drawing.Size(59, 16);
- this.radioButton3.TabIndex = 2;
- this.radioButton3.TabStop = true;
- this.radioButton3.Text = "未设置";
- this.radioButton3.UseVisualStyleBackColor = true;
- this.radioButton3.Click += new System.EventHandler(this.radioButton_SelectedChanged);
- //
- // radioButton2
- //
- this.radioButton2.AutoSize = true;
- this.radioButton2.Location = new System.Drawing.Point(163, 27);
- this.radioButton2.Name = "radioButton2";
- this.radioButton2.Size = new System.Drawing.Size(59, 16);
- this.radioButton2.TabIndex = 1;
- this.radioButton2.TabStop = true;
- this.radioButton2.Text = "未设置";
- this.radioButton2.UseVisualStyleBackColor = true;
- this.radioButton2.Click += new System.EventHandler(this.radioButton_SelectedChanged);
- //
- // radioButton1
- //
- this.radioButton1.AutoSize = true;
- this.radioButton1.Location = new System.Drawing.Point(11, 27);
- this.radioButton1.Name = "radioButton1";
- this.radioButton1.Size = new System.Drawing.Size(59, 16);
- this.radioButton1.TabIndex = 0;
- this.radioButton1.TabStop = true;
- this.radioButton1.Text = "未设置";
- this.radioButton1.UseVisualStyleBackColor = true;
- this.radioButton1.Click += new System.EventHandler(this.radioButton_SelectedChanged);
- //
- // 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.listView1);
- this.groupBox2.Controls.Add(this.comboBox1);
- this.groupBox2.Controls.Add(this.label1);
- this.groupBox2.Location = new System.Drawing.Point(8, 190);
- this.groupBox2.Name = "groupBox2";
- this.groupBox2.Size = new System.Drawing.Size(310, 305);
- this.groupBox2.TabIndex = 4;
- this.groupBox2.TabStop = false;
- this.groupBox2.Text = "数据表";
- //
- // listView1
- //
- this.listView1.FullRowSelect = true;
- this.listView1.GridLines = true;
- this.listView1.HideSelection = false;
- this.listView1.Location = new System.Drawing.Point(6, 56);
- this.listView1.Name = "listView1";
- this.listView1.Size = new System.Drawing.Size(293, 243);
- this.listView1.TabIndex = 2;
- this.listView1.UseCompatibleStateImageBehavior = false;
- //
- // comboBox1
- //
- this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
- this.comboBox1.FormattingEnabled = true;
- this.comboBox1.Items.AddRange(new object[] {
- "全部",
- "单值",
- "多值"});
- this.comboBox1.Location = new System.Drawing.Point(45, 30);
- this.comboBox1.Name = "comboBox1";
- this.comboBox1.Size = new System.Drawing.Size(254, 20);
- this.comboBox1.TabIndex = 1;
- this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
- //
- // label1
- //
- this.label1.AutoSize = true;
- this.label1.Location = new System.Drawing.Point(6, 33);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(41, 12);
- this.label1.TabIndex = 0;
- this.label1.Text = "筛选:";
- //
- // groupBox3
- //
- this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)));
- this.groupBox3.Controls.Add(this.button4);
- this.groupBox3.Controls.Add(this.button3);
- this.groupBox3.Controls.Add(this.button2);
- this.groupBox3.Controls.Add(this.button1);
- this.groupBox3.Controls.Add(this.numericUpDown5);
- this.groupBox3.Controls.Add(this.label6);
- this.groupBox3.Controls.Add(this.label5);
- this.groupBox3.Controls.Add(this.label4);
- this.groupBox3.Controls.Add(this.label3);
- this.groupBox3.Controls.Add(this.label2);
- this.groupBox3.Location = new System.Drawing.Point(8, 501);
- this.groupBox3.Name = "groupBox3";
- this.groupBox3.Size = new System.Drawing.Size(310, 110);
- this.groupBox3.TabIndex = 5;
- this.groupBox3.TabStop = false;
- this.groupBox3.Text = "操作";
- //
- // button4
- //
- this.button4.Location = new System.Drawing.Point(259, 18);
- this.button4.Name = "button4";
- this.button4.Size = new System.Drawing.Size(40, 23);
- this.button4.TabIndex = 10;
- this.button4.Text = ">>";
- this.button4.UseVisualStyleBackColor = true;
- this.button4.Click += new System.EventHandler(this.button4_Click);
- //
- // button3
- //
- this.button3.Location = new System.Drawing.Point(165, 18);
- this.button3.Name = "button3";
- this.button3.Size = new System.Drawing.Size(38, 23);
- this.button3.TabIndex = 9;
- this.button3.Text = "删除";
- this.button3.UseVisualStyleBackColor = true;
- this.button3.Click += new System.EventHandler(this.button3_Click);
- //
- // button2
- //
- this.button2.Location = new System.Drawing.Point(211, 18);
- this.button2.Name = "button2";
- this.button2.Size = new System.Drawing.Size(40, 23);
- this.button2.TabIndex = 8;
- this.button2.Text = "清空";
- this.button2.UseVisualStyleBackColor = true;
- this.button2.Click += new System.EventHandler(this.button2_Click);
- //
- // button1
- //
- this.button1.Location = new System.Drawing.Point(259, 63);
- this.button1.Name = "button1";
- this.button1.Size = new System.Drawing.Size(40, 23);
- this.button1.TabIndex = 7;
- this.button1.Text = "输出";
- this.button1.UseVisualStyleBackColor = true;
- this.button1.Click += new System.EventHandler(this.button1_Click);
- //
- // numericUpDown5
- //
- this.numericUpDown5.Location = new System.Drawing.Point(165, 64);
- this.numericUpDown5.Maximum = new decimal(new int[] {
- 10,
- 0,
- 0,
- 0});
- this.numericUpDown5.Minimum = new decimal(new int[] {
- 2,
- 0,
- 0,
- 0});
- this.numericUpDown5.Name = "numericUpDown5";
- this.numericUpDown5.Size = new System.Drawing.Size(86, 21);
- this.numericUpDown5.TabIndex = 6;
- this.numericUpDown5.Value = new decimal(new int[] {
- 2,
- 0,
- 0,
- 0});
- this.numericUpDown5.ValueChanged += new System.EventHandler(this.numericUpDown5_ValueChanged);
- //
- // label6
- //
- this.label6.AutoSize = true;
- this.label6.Location = new System.Drawing.Point(82, 68);
- this.label6.Name = "label6";
- this.label6.Size = new System.Drawing.Size(77, 12);
- this.label6.TabIndex = 4;
- this.label6.Text = "小数点位数:";
- //
- // label5
- //
- this.label5.AutoSize = true;
- this.label5.Location = new System.Drawing.Point(113, 23);
- this.label5.Name = "label5";
- this.label5.Size = new System.Drawing.Size(17, 12);
- this.label5.TabIndex = 3;
- this.label5.Text = "度";
- //
- // label4
- //
- this.label4.AutoSize = true;
- this.label4.Location = new System.Drawing.Point(76, 23);
- this.label4.Name = "label4";
- this.label4.Size = new System.Drawing.Size(41, 12);
- this.label4.TabIndex = 2;
- this.label4.Text = "角度:";
- //
- // label3
- //
- this.label3.AutoSize = true;
- this.label3.Location = new System.Drawing.Point(43, 23);
- this.label3.Name = "label3";
- this.label3.Size = new System.Drawing.Size(17, 12);
- this.label3.TabIndex = 1;
- this.label3.Text = "mm";
- //
- // label2
- //
- this.label2.AutoSize = true;
- this.label2.Location = new System.Drawing.Point(6, 23);
- this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(41, 12);
- this.label2.TabIndex = 0;
- this.label2.Text = "长度:";
- //
- // groupBox4
- //
- this.groupBox4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)));
- this.groupBox4.Controls.Add(this.listView2);
- this.groupBox4.Location = new System.Drawing.Point(324, 3);
- this.groupBox4.Name = "groupBox4";
- this.groupBox4.Size = new System.Drawing.Size(83, 608);
- this.groupBox4.TabIndex = 6;
- this.groupBox4.TabStop = false;
- this.groupBox4.Text = "快捷工具";
- //
- // listView2
- //
- this.listView2.FullRowSelect = true;
- this.listView2.GridLines = true;
- this.listView2.HideSelection = false;
- this.listView2.Location = new System.Drawing.Point(6, 20);
- this.listView2.Name = "listView2";
- this.listView2.Size = new System.Drawing.Size(71, 578);
- this.listView2.TabIndex = 0;
- this.listView2.UseCompatibleStateImageBehavior = false;
- //
- // groupBox5
- //
- this.groupBox5.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)));
- this.groupBox5.Controls.Add(this.treeView1);
- this.groupBox5.Location = new System.Drawing.Point(413, 3);
- this.groupBox5.Name = "groupBox5";
- this.groupBox5.Size = new System.Drawing.Size(220, 608);
- this.groupBox5.TabIndex = 7;
- this.groupBox5.TabStop = false;
- this.groupBox5.Text = "数据属性";
- //
- // treeView1
- //
- this.treeView1.Location = new System.Drawing.Point(6, 20);
- this.treeView1.Name = "treeView1";
- this.treeView1.Size = new System.Drawing.Size(208, 578);
- this.treeView1.TabIndex = 17;
- //
- // groupBox6
- //
- this.groupBox6.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)));
- this.groupBox6.Controls.Add(this.button8);
- this.groupBox6.Controls.Add(this.button7);
- this.groupBox6.Controls.Add(this.button6);
- this.groupBox6.Controls.Add(this.button5);
- this.groupBox6.Location = new System.Drawing.Point(639, 3);
- this.groupBox6.Name = "groupBox6";
- this.groupBox6.Size = new System.Drawing.Size(107, 301);
- this.groupBox6.TabIndex = 8;
- this.groupBox6.TabStop = false;
- this.groupBox6.Text = "工具";
- //
- // button8
- //
- this.button8.Location = new System.Drawing.Point(16, 219);
- this.button8.Name = "button8";
- this.button8.Size = new System.Drawing.Size(75, 23);
- this.button8.TabIndex = 3;
- this.button8.Text = "向下";
- this.button8.UseVisualStyleBackColor = true;
- this.button8.Click += new System.EventHandler(this.button8_Click);
- //
- // button7
- //
- this.button7.Location = new System.Drawing.Point(16, 164);
- this.button7.Name = "button7";
- this.button7.Size = new System.Drawing.Size(75, 23);
- this.button7.TabIndex = 2;
- this.button7.Text = "向上";
- this.button7.UseVisualStyleBackColor = true;
- this.button7.Click += new System.EventHandler(this.button7_Click);
- //
- // button6
- //
- this.button6.Location = new System.Drawing.Point(16, 109);
- this.button6.Name = "button6";
- this.button6.Size = new System.Drawing.Size(75, 23);
- this.button6.TabIndex = 1;
- this.button6.Text = ">移除";
- this.button6.UseVisualStyleBackColor = true;
- this.button6.Click += new System.EventHandler(this.button6_Click);
- //
- // button5
- //
- this.button5.Location = new System.Drawing.Point(16, 54);
- this.button5.Name = "button5";
- this.button5.Size = new System.Drawing.Size(75, 23);
- this.button5.TabIndex = 0;
- this.button5.Text = "<添加";
- this.button5.UseVisualStyleBackColor = true;
- this.button5.Click += new System.EventHandler(this.button5_Click);
- //
- // 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.button12);
- this.groupBox7.Controls.Add(this.button11);
- this.groupBox7.Controls.Add(this.button10);
- this.groupBox7.Controls.Add(this.button9);
- this.groupBox7.Location = new System.Drawing.Point(639, 310);
- this.groupBox7.Name = "groupBox7";
- this.groupBox7.Size = new System.Drawing.Size(107, 301);
- this.groupBox7.TabIndex = 9;
- this.groupBox7.TabStop = false;
- this.groupBox7.Text = "数据";
- //
- // button12
- //
- this.button12.Location = new System.Drawing.Point(16, 214);
- this.button12.Name = "button12";
- this.button12.Size = new System.Drawing.Size(75, 23);
- this.button12.TabIndex = 3;
- this.button12.Text = "向下";
- this.button12.UseVisualStyleBackColor = true;
- this.button12.Click += new System.EventHandler(this.button12_Click);
- //
- // button11
- //
- this.button11.Location = new System.Drawing.Point(16, 159);
- this.button11.Name = "button11";
- this.button11.Size = new System.Drawing.Size(75, 23);
- this.button11.TabIndex = 2;
- this.button11.Text = "向上";
- this.button11.UseVisualStyleBackColor = true;
- this.button11.Click += new System.EventHandler(this.button11_Click);
- //
- // button10
- //
- this.button10.Location = new System.Drawing.Point(16, 104);
- this.button10.Name = "button10";
- this.button10.Size = new System.Drawing.Size(75, 23);
- this.button10.TabIndex = 1;
- this.button10.Text = ">移除";
- this.button10.UseVisualStyleBackColor = true;
- this.button10.Click += new System.EventHandler(this.button10_Click);
- //
- // button9
- //
- this.button9.Location = new System.Drawing.Point(16, 49);
- this.button9.Name = "button9";
- this.button9.Size = new System.Drawing.Size(75, 23);
- this.button9.TabIndex = 0;
- this.button9.Text = "<添加";
- this.button9.UseVisualStyleBackColor = true;
- this.button9.Click += new System.EventHandler(this.button9_Click);
- //
- // groupBox8
- //
- this.groupBox8.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)));
- this.groupBox8.Controls.Add(this.treeView2);
- this.groupBox8.Location = new System.Drawing.Point(752, 3);
- this.groupBox8.Name = "groupBox8";
- this.groupBox8.Size = new System.Drawing.Size(220, 608);
- this.groupBox8.TabIndex = 10;
- this.groupBox8.TabStop = false;
- this.groupBox8.Text = "元素属性";
- //
- // treeView2
- //
- this.treeView2.Location = new System.Drawing.Point(6, 20);
- this.treeView2.Name = "treeView2";
- this.treeView2.Size = new System.Drawing.Size(208, 578);
- this.treeView2.TabIndex = 18;
- //
- // GeometryMeasureDialog
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
- this.BackColor = System.Drawing.SystemColors.Control;
- this.ClientSize = new System.Drawing.Size(980, 621);
- 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.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
- this.Name = "GeometryMeasureDialog";
- this.Text = "交互测量";
- this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.GeometryMeasureDialog_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.groupBox1.ResumeLayout(false);
- this.groupBox1.PerformLayout();
- this.groupBox2.ResumeLayout(false);
- this.groupBox2.PerformLayout();
- this.groupBox3.ResumeLayout(false);
- this.groupBox3.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown5)).EndInit();
- this.groupBox4.ResumeLayout(false);
- this.groupBox5.ResumeLayout(false);
- this.groupBox6.ResumeLayout(false);
- this.groupBox7.ResumeLayout(false);
- this.groupBox8.ResumeLayout(false);
- this.ResumeLayout(false);
- }
- /// <summary>
- /// 获取参数保存
- /// </summary>
- private void getLastData()
- {
- string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\ParameterSaving\\MeasureListInteractiveDataModel.xml";
- if (!File.Exists(filePath))
- {
- measureListInteractiveDataModel = new MeasureListInteractiveDataModel();
- }
- else {
- measureListInteractiveDataModel = XmlSerializeHelper.DESerializer<MeasureListInteractiveDataModel>(FileOperationHelper.ReadStringFromFile(filePath, FileMode.Open));
- if (measureListInteractiveDataModel != null) {
- this.numericUpDown5.Value = measureListInteractiveDataModel.num;
- this.comboBox1.SelectedIndex = measureListInteractiveDataModel.selectIndex;
- foreach (var item in measureListInteractiveDataModel.FastToolList)
- {
- var index = measureListInteractiveDataModel.FastToolList.IndexOf(item) + 1;
- string name = item.name;
- if (name.Length >= 5)
- {
- name = $"{name.Substring(0, 4)}\r\n{name.Substring(4, name.Length - 4)}";
- }
- switch (index) {
- case 1:
- radioButton1.Text = name;
- textBox1.Text = item.nickName;
- break;
- case 2:
- radioButton2.Text = name;
- textBox2.Text = item.nickName;
- break;
- case 3:
- radioButton3.Text = name;
- textBox3.Text = item.nickName;
- break;
- case 4:
- radioButton4.Text = name;
- textBox4.Text = item.nickName;
- break;
- case 5:
- radioButton5.Text = name;
- textBox5.Text = item.nickName;
- break;
- case 6:
- radioButton6.Text = name;
- textBox6.Text = item.nickName;
- break;
- case 7:
- radioButton7.Text = name;
- textBox7.Text = item.nickName;
- break;
- case 8:
- radioButton8.Text = name;
- textBox8.Text = item.nickName;
- break;
- }
- toolNameList.Add(item.name);
- toolNickNameList.Add(item.nickName);
- ListViewItem lvi = new ListViewItem();
- lvi.Text = item.name;
- this.listView2.Items.Add(lvi);
- }
- if (measureListInteractiveDataModel.FastToolList.Count > 0) {
- radioButton_SelectedChanged(radioButton1, null);
- }
- }
- }
- }
- /// <summary>
- /// 数据属性初始化
- /// </summary>
- private void allDataTree()
- {
- if (measureListSetModel != null && measureListSetModel.AttributeMapAllDataNodes != null)
- {
- for (int i = 0; i < measureListSetModel.AttributeMapAllDataNodes.Count; i++)
- {
- TreeNode firstNode = new TreeNode();
- firstNode.Text = measureListSetModel.AttributeMapAllDataNodes[i].Name;
- for (int j = 0; j < measureListSetModel.AttributeMapAllDataNodes[i].Attribute.Count; j++)
- {
- TreeNode scondNode = new TreeNode();
- scondNode.Text = measureListSetModel.AttributeMapAllDataNodes[i].Attribute[j].Text;
- scondNode.Name = measureListSetModel.AttributeMapAllDataNodes[i].Attribute[j].Name;
- for (int k = 0; k < measureListSetModel.AttributeMapAllDataNodes[i].Attribute[j].Attribute.Count; k++)
- {
- if (measureListSetModel.AttributeMapAllDataNodes[i].Attribute[j].Attribute.Count > 0)
- {
- TreeNode thirdNode = new TreeNode();
- thirdNode.Text = measureListSetModel.AttributeMapAllDataNodes[i].Attribute[j].Attribute[k].Text;
- thirdNode.Name = measureListSetModel.AttributeMapAllDataNodes[i].Attribute[j].Attribute[k].Name;
- scondNode.Nodes.Add(thirdNode);
- }
- }
- firstNode.Nodes.Add(scondNode);
- }
- this.treeView2.Nodes.Add(firstNode);
- }
- }
- }
- /// <summary>
- /// 元素属性初始化
- /// </summary>
- private void allToolTree()
- {
- if (measureListSetModel != null && measureListSetModel.AttributeMapDataNodes != null)
- {
- for (int i = 0; i < measureListSetModel.AttributeMapDataNodes.Count; i++)
- {
- TreeNode firstNode = new TreeNode();
- firstNode.Text = measureListSetModel.AttributeMapDataNodes[i].Name;
- for (int j = 0; j < measureListSetModel.AttributeMapDataNodes[i].Attribute.Count; j++)
- {
- TreeNode scondNode = new TreeNode();
- scondNode.Text = measureListSetModel.AttributeMapDataNodes[i].Attribute[j].Text;
- scondNode.Name = measureListSetModel.AttributeMapDataNodes[i].Attribute[j].Name;
- for (int k = 0; k < measureListSetModel.AttributeMapDataNodes[i].Attribute[j].Attribute.Count; k++)
- {
- if (measureListSetModel.AttributeMapDataNodes[i].Attribute[j].Attribute.Count > 0)
- {
- TreeNode thirdNode = new TreeNode();
- thirdNode.Text = measureListSetModel.AttributeMapDataNodes[i].Attribute[j].Attribute[k].Text;
- thirdNode.Name = measureListSetModel.AttributeMapDataNodes[i].Attribute[j].Attribute[k].Name;
- scondNode.Nodes.Add(thirdNode);
- }
- }
- firstNode.Nodes.Add(scondNode);
- }
- this.treeView1.Nodes.Add(firstNode);
- }
- }
- }
- /// <summary>
- /// 面板伸缩事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button4_Click(object sender, EventArgs e)
- {
- if (isEnlarge)
- {
- this.Width = this.smallHeight;
- this.button4.Text = ">>";
- }
- else {
- this.Width = this.bigHelght;
- this.button4.Text = "<<";
- }
- this.isEnlarge = !isEnlarge;
- }
- #region [数据面板操作]
- /// <summary>
- /// 数据添加
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button9_Click(object sender, EventArgs e)
- {
- if (this.treeView2.SelectedNode != null && this.treeView2.SelectedNode.Level == 2)
- {
- string name = string.Empty;
- string orName = this.treeView2.SelectedNode.Name;
- if (this.treeView2.SelectedNode.Parent != null)
- name = this.treeView2.SelectedNode.Parent.Name;
- TreeNode treeNode = this.treeView2.SelectedNode;
- int count = treeView1.Nodes.Count;
- for (int i = 0; i < count; i++)
- {
- foreach (TreeNode node in this.treeView1.Nodes[i].Nodes)
- {
- if (node.Name == name)
- {
- this.treeView2.SelectedNode.Remove();
- node.Nodes.Add(treeNode);
- }
- }
- }
- MeasureListSetModel.FirstNode.SecondNode.Item hasAttr = null;
- foreach (var item in measureListSetModel.AttributeMapAllDataNodes)
- {
- var tool = item.Attribute.Where(m => m.Name.Equals(name)).FirstOrDefault();
- if (tool != null)
- {
- hasAttr = tool.Attribute.Where(m => m.Name.Equals(orName)).FirstOrDefault();
- if (hasAttr != null) {
- tool.Attribute.Remove(hasAttr);
- }
- }
- }
- foreach (var item in measureListSetModel.AttributeMapDataNodes)
- {
- var tool = item.Attribute.Where(m => m.Name.Equals(name)).FirstOrDefault();
- if (tool != null)
- {
- if (hasAttr != null) {
- tool.Attribute.Add(hasAttr);
- }
- }
- }
- RefreshListView(null, null);
- }
- }
- /// <summary>
- /// 数据移除
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button10_Click(object sender, EventArgs e)
- {
- if (this.treeView1.SelectedNode != null && this.treeView1.SelectedNode.Level == 2)
- {
- string name = string.Empty;
- string orName = this.treeView1.SelectedNode.Name;
- if (this.treeView1.SelectedNode.Parent != null)
- name = this.treeView1.SelectedNode.Parent.Name;
- TreeNode treeNode = this.treeView1.SelectedNode;
- int count = treeView2.Nodes.Count;
- for (int i = 0; i < count; i++)
- {
- foreach (TreeNode node in this.treeView2.Nodes[i].Nodes)
- {
- if (node.Name == name)
- {
- this.treeView1.SelectedNode.Remove();
- node.Nodes.Add(treeNode);
- }
- }
- }
- MeasureListSetModel.FirstNode.SecondNode.Item hasAttr = null;
- foreach (var item in measureListSetModel.AttributeMapDataNodes)
- {
- var tool = item.Attribute.Where(m => m.Name.Equals(name)).FirstOrDefault();
- if (tool != null)
- {
- hasAttr = tool.Attribute.Where(m => m.Name.Equals(orName)).FirstOrDefault();
- if (hasAttr != null)
- {
- tool.Attribute.Remove(hasAttr);
- }
- }
- }
- foreach (var item in measureListSetModel.AttributeMapAllDataNodes)
- {
- var tool = item.Attribute.Where(m => m.Name.Equals(name)).FirstOrDefault();
- if (tool != null)
- {
- if (hasAttr != null)
- {
- tool.Attribute.Add(hasAttr);
- }
- }
- }
- RefreshListView(null, null);
- }
- }
- /// <summary>
- /// 数据向上
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button11_Click(object sender, EventArgs e)
- {
- if (this.treeView1.SelectedNode == null || this.treeView1.SelectedNode.Level != 2)
- {
- return;
- }
- #region [树状图信息向上]
- string name = string.Empty;
- if (this.treeView1.SelectedNode.Parent != null)
- {
- name = this.treeView1.SelectedNode.Parent.Name;
- }
- TreeNode treeNode = this.treeView1.SelectedNode;
- int count = treeView1.Nodes.Count;
- for (int i = 0; i < count; i++)
- {
- foreach (TreeNode node in this.treeView1.Nodes[i].Nodes)
- {
- if (node.Name != name)
- {
- continue;
- }
- int index = node.Nodes.IndexOf(treeNode);
- if (index != 0)
- {
- TreeNode lastNode = node.Nodes[index - 1];
- node.Nodes.RemoveAt(index);
- node.Nodes.RemoveAt(index - 1);
- node.Nodes.Insert(index, lastNode);
- node.Nodes.Insert(index - 1, treeNode);
- treeView1.Focus();
- treeView1.SelectedNode = treeNode;
- }
- }
- }
- #endregion
- #region [表格信息向上]
- #endregion
- }
- /// <summary>
- /// 数据向下
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button12_Click(object sender, EventArgs e)
- {
- if (this.treeView1.SelectedNode == null || this.treeView1.SelectedNode.Level != 2)
- {
- return;
- }
- #region [树状图信息向下]
- string name = string.Empty;
- if (this.treeView1.SelectedNode.Parent != null)
- {
- name = this.treeView1.SelectedNode.Parent.Name;
- }
- TreeNode treeNode = this.treeView1.SelectedNode;
- int count = treeView1.Nodes.Count;
- for (int i = 0; i < count; i++)
- {
- foreach (TreeNode node in this.treeView1.Nodes[i].Nodes)
- {
- if (node.Name != name)
- {
- continue;
- }
- int index = node.Nodes.IndexOf(treeNode);
- if (index != node.Nodes.Count - 1)
- {
- TreeNode lastNode = node.Nodes[index + 1];
- node.Nodes.RemoveAt(index + 1);
- node.Nodes.RemoveAt(index);
- node.Nodes.Insert(index, lastNode);
- node.Nodes.Insert(index + 1, treeNode);
- treeView1.Focus();
- treeView1.SelectedNode = treeNode;
- }
- }
- }
- #endregion
- #region [表格信息向下]
- #endregion
- }
- #endregion
- #region [工具面板操作]
- /// <summary>
- /// 工具添加
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button5_Click(object sender, EventArgs e)
- {
- if (this.treeView2.SelectedNode == null || this.treeView2.SelectedNode.Level != 1)
- {
- return;
- }
- if (this.listView2.Items.Count >= 8)
- {
- MessageBox.Show("最多只能添加8个快捷工具!");
- return;
- }
- if (this.toolNameList.Contains(this.treeView2.SelectedNode.Text)) {
- MessageBox.Show("不可添加重复的快捷工具!");
- return;
- }
- #region [快捷工具列表中添加]
- ListViewItem lvi = new ListViewItem();
- lvi.Text = this.treeView2.SelectedNode.Text;
- this.listView2.Items.Add(lvi);
- #endregion
- #region [快捷工具中添加]
- this.addToolName(this.listView2.Items.Count, this.treeView2.SelectedNode.Text);
- this.toolNameList.Add(this.treeView2.SelectedNode.Text);
- this.toolNickNameList.Add("");
- if (toolNameList.Count == 1) {
- radioButton_SelectedChanged(radioButton1, e);
- }
- #endregion
- }
- /// <summary>
- /// 工具移除
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button6_Click(object sender, EventArgs e)
- {
- if (this.listView2.FocusedItem != null && this.listView2.FocusedItem.Selected)
- {
- int index = this.listView2.FocusedItem.Index;
- this.removeToolName(index, this.listView2.FocusedItem.Text);
- this.listView2.Items.RemoveAt(index);
- }
- }
- /// <summary>
- /// 工具向上
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button7_Click(object sender, EventArgs e)
- {
- if (this.treeView2.SelectedNode == null || this.treeView2.SelectedNode.Level != 1)
- {
- return;
- }
- #region [快捷工具列表中向上]
- if (this.listView2.FocusedItem != null && this.listView2.FocusedItem.Selected)
- {
- int index = this.listView2.FocusedItem.Index;
- if (index != 0)
- {
- ListViewItem item = this.listView2.FocusedItem;
- ListViewItem lastItem = this.listView2.Items[index - 1];
- this.listView2.Items.RemoveAt(index);
- this.listView2.Items.RemoveAt(index - 1);
- this.listView2.Items.Insert(index - 1, item);
- this.listView2.Items.Insert(index, lastItem);
- moveToolName(index, 1);
- }
- }
- #endregion
- }
- /// <summary>
- /// 工具向下
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button8_Click(object sender, EventArgs e)
- {
- if (this.treeView2.SelectedNode == null || this.treeView2.SelectedNode.Level != 1)
- {
- return;
- }
- #region [快捷工具列表中向下]
- if (this.listView2.FocusedItem != null && this.listView2.FocusedItem.Selected)
- {
- int index = this.listView2.FocusedItem.Index;
- if (index != this.listView2.Items.Count - 1)
- {
- ListViewItem item = this.listView2.FocusedItem;
- ListViewItem lastItem = this.listView2.Items[index + 1];
- this.listView2.Items.RemoveAt(index + 1);
- this.listView2.Items.RemoveAt(index);
- this.listView2.Items.Insert(index, lastItem);
- this.listView2.Items.Insert(index + 1, item);
- moveToolName(index, 2);
- }
- }
- #endregion
- }
- /// <summary>
- /// 添加快捷工具面板
- /// </summary>
- private void addToolName(int index, string name,string textName = "")
- {
- if (name.Length >= 5) {
- name = $"{name.Substring(0, 4)}\r\n{name.Substring(4, name.Length - 4)}";
- }
- switch (index)
- {
- case 1:
- this.radioButton1.Text = name;
- if (!string.IsNullOrEmpty(textName))
- textBox1.Text = textName;
- break;
- case 2:
- this.radioButton2.Text = name;
- if (!string.IsNullOrEmpty(textName))
- textBox2.Text = textName;
- break;
- case 3:
- this.radioButton3.Text = name;
- if (!string.IsNullOrEmpty(textName))
- textBox3.Text = textName;
- break;
- case 4:
- this.radioButton4.Text = name;
- if (!string.IsNullOrEmpty(textName))
- textBox4.Text = textName;
- break;
- case 5:
- this.radioButton5.Text = name;
- if (!string.IsNullOrEmpty(textName))
- textBox5.Text = textName;
- break;
- case 6:
- this.radioButton6.Text = name;
- if (!string.IsNullOrEmpty(textName))
- textBox6.Text = textName;
- break;
- case 7:
- this.radioButton7.Text = name;
- if (!string.IsNullOrEmpty(textName))
- textBox7.Text = textName;
- break;
- case 8:
- this.radioButton8.Text = name;
- if (!string.IsNullOrEmpty(textName))
- textBox8.Text = textName;
- break;
- }
- }
- /// <summary>
- /// 移除快捷工具面板
- /// </summary>
- private void removeToolName(int index, string name)
- {
- this.toolNameList.RemoveAt(index);
- this.toolNickNameList.RemoveAt(index);
- this.resetButton();
- for (int i = 0; i < toolNameList.Count; i++)
- {
- addToolName(i + 1, toolNameList[i], toolNickNameList[i]);
- }
- }
- /// <summary>
- /// 重置状态
- /// </summary>
- private void resetButton()
- {
- this.radioButton1.Text = "未设置";
- this.radioButton2.Text = "未设置";
- this.radioButton3.Text = "未设置";
- this.radioButton4.Text = "未设置";
- this.radioButton5.Text = "未设置";
- this.radioButton6.Text = "未设置";
- this.radioButton7.Text = "未设置";
- this.radioButton8.Text = "未设置";
- this.textBox1.Text = "";
- this.textBox2.Text = "";
- this.textBox3.Text = "";
- this.textBox4.Text = "";
- this.textBox5.Text = "";
- this.textBox6.Text = "";
- this.textBox7.Text = "";
- this.textBox8.Text = "";
- #region [取消选中状态]
- if (radioButton1.Checked)
- {
- radioButton1.Checked = false;
- }
- else if (radioButton2.Checked)
- {
- radioButton2.Checked = false;
- }
- else if (radioButton3.Checked)
- {
- radioButton3.Checked = false;
- }
- else if (radioButton4.Checked)
- {
- radioButton4.Checked = false;
- }
- else if (radioButton5.Checked)
- {
- radioButton5.Checked = false;
- }
- else if (radioButton6.Checked)
- {
- radioButton6.Checked = false;
- }
- else if (radioButton7.Checked)
- {
- radioButton7.Checked = false;
- }
- else if (radioButton8.Checked)
- {
- radioButton8.Checked = false;
- }
- #endregion
- if (this.appWorkspace.ActiveDocumentWorkspace != null)
- {
- this.appWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.Pointer;
- }
- }
- /// <summary>
- /// 向上/向下移动快捷工具面板
- /// </summary>
- private void moveToolName(int index,int type)
- {
- switch (type)
- {
- case 1:
- string toolName = this.toolNameList[index];
- string lastToolName = this.toolNameList[index - 1];
- string toolNickName = this.toolNickNameList[index];
- string lastNickName = this.toolNickNameList[index - 1];
- this.toolNameList.RemoveAt(index);
- this.toolNameList.RemoveAt(index - 1);
- this.toolNickNameList.RemoveAt(index);
- this.toolNickNameList.RemoveAt(index - 1);
- this.toolNameList.Insert(index - 1, toolName);
- this.toolNameList.Insert(index, lastToolName);
- this.toolNickNameList.Insert(index - 1, toolNickName);
- this.toolNickNameList.Insert(index, lastNickName);
- break;
- case 2:
- string toolName1 = this.toolNameList[index];
- string lastToolName1 = this.toolNameList[index + 1];
- string toolNickName1 = this.toolNickNameList[index];
- string lastNickName1 = this.toolNickNameList[index + 1];
- this.toolNameList.RemoveAt(index + 1);
- this.toolNameList.RemoveAt(index);
- this.toolNickNameList.RemoveAt(index + 1);
- this.toolNickNameList.RemoveAt(index);
- this.toolNameList.Insert(index, lastToolName1);
- this.toolNameList.Insert(index + 1, toolName1);
- this.toolNickNameList.Insert(index, lastNickName1);
- this.toolNickNameList.Insert(index + 1, toolNickName1);
- break;
- }
- for (int i = 0; i < toolNameList.Count; i++)
- {
- addToolName(i + 1, toolNameList[i], toolNickNameList[i]);
- }
- }
- #endregion
- /// <summary>
- /// 修改别名
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void textBox1_TextChanged(object sender, EventArgs e)
- {
- var textbox = (TextBox)sender;
- int type = Convert.ToInt32(textbox.Name.Substring(textbox.Name.Length - 1, 1));
- if (toolNickNameList.Count > 0 && toolNickNameList.Count >= type)
- {
- toolNickNameList[type - 1] = textbox.Text;
- RefreshListView(null, null);
- }
- }
- /// <summary>
- /// 选择快捷工具
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void radioButton_SelectedChanged(object sender, EventArgs e)
- {
- if (this.appWorkspace.ActiveDocumentWorkspace == null)
- {
- return;
- }
- var radioButto = (RadioButton)sender;
- if (!radioButto.Checked) {
- return;
- }
- int type = Convert.ToInt32(radioButto.Name.Substring(radioButto.Name.Length - 1, 1));
- if (toolNameList.Count < type) {
- this.appWorkspace.ActiveDocumentWorkspace.ActiveTool = new DrawToolType();
- return;
- }
-
- var toolName = toolNameList[type - 1];
- //获取工具英文
- string enName = string.Empty;
- foreach (var item in measureListSetModel.AttributeMapAllDataNodes)
- {
- var tool = item.Attribute.Where(m => m.Text.Equals(toolName)).FirstOrDefault();
- if (tool == null) {
- continue;
- }
- enName = tool.Name;
- }
- if (!string.IsNullOrEmpty(enName)) {
- if (this.appWorkspace.ActiveDocumentWorkspace != null)
- {
- this.appWorkspace.ActiveDocumentWorkspace.ToolNumber = -1;
- this.appWorkspace.ActiveDocumentWorkspace.ActiveTool = (DrawToolType)Enum.Parse(typeof(DrawToolType), enName);
- if (this.appWorkspace.Widgets != null && this.appWorkspace.Widgets.GeometryMeasureDialog.Visible)
- {
- ContinuousDrawingAction();
- }
- }
- }
- }
- /// <summary>
- /// 连续绘制
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void ContinuousDrawingAction()
- {
- if ( this.appWorkspace.ActiveDocumentWorkspace != null)
- {
- this.appWorkspace.ActiveDocumentWorkspace.ContinuousDrawingMeasure = true;
- this.appWorkspace.continuousDrawingMeasure = true;
- for (int i = 0; i < this.appWorkspace.DocumentWorkspaces.Length; i++)
- {
- this.appWorkspace.DocumentWorkspaces[i].ContinuousDrawingMeasure = true;
- }
- this.appWorkspace.toolBar.RefreshBtnSelect(this.appWorkspace.ActiveDocumentWorkspace.ContinuousDrawingMeasure, "ContinuousDrawingMeasure");
- this.appWorkspace.toolsPanel.RefreshBtnSelect(this.appWorkspace.ActiveDocumentWorkspace.ContinuousDrawingMeasure, "ContinuousDrawingMeasure");
- if (! this.appWorkspace.ActiveDocumentWorkspace.ContinuousDrawingMeasure
- && this.appWorkspace.ActiveDocumentWorkspace.activeTool >= DrawToolType.MeasureLine && this.appWorkspace.ActiveDocumentWorkspace.activeTool <= DrawToolType.MeasureThreePointArc)
- {
- this.appWorkspace.ActiveDocumentWorkspace.ToolNumber = -1;
- this.appWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.Pointer;
- }
- this.appWorkspace.ActiveDocumentWorkspace.ContinuousDrawingMeasure = true;
- }
- if ( this.appWorkspace.cameraPreviewDialog != null && ! this.appWorkspace.cameraPreviewDialog.IsDisposed)
- {
- this.appWorkspace.cameraPreviewDialog.documentWorkspace.ContinuousDrawingMeasure = true;
- if ( this.appWorkspace.ActiveDocumentWorkspace != null) this.appWorkspace.continuousDrawingMeasure = true;
- for (int i = 0; i < this.appWorkspace.DocumentWorkspaces.Length; i++)
- {
- this.appWorkspace.DocumentWorkspaces[i].ContinuousDrawingMeasure = true;
- }
- this.appWorkspace.toolBar.RefreshBtnSelect(this.appWorkspace.cameraPreviewDialog.documentWorkspace.ContinuousDrawingMeasure, "ContinuousDrawingMeasure");
- this.appWorkspace.toolsPanel.RefreshBtnSelect(this.appWorkspace.cameraPreviewDialog.documentWorkspace.ContinuousDrawingMeasure, "ContinuousDrawingMeasure");
- if (! this.appWorkspace.cameraPreviewDialog.documentWorkspace.ContinuousDrawingMeasure)
- {
- this.appWorkspace.cameraPreviewDialog.documentWorkspace.ActiveTool = DrawToolType.Pointer;
- }
- if ( this.appWorkspace.ActiveDocumentWorkspace != null
- && this.appWorkspace.ActiveDocumentWorkspace.activeTool >= DrawToolType.MeasureLine
- && this.appWorkspace.ActiveDocumentWorkspace.activeTool <= DrawToolType.MeasureThreePointArc)
- {
- this.appWorkspace.ActiveDocumentWorkspace.ToolNumber = -1;
- }
- this.appWorkspace.ActiveDocumentWorkspace.ContinuousDrawingMeasure = true;
- }
- }
- /// <summary>
- /// 删除一条数据
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button3_Click(object sender, EventArgs e)
- {
- if (this.listView1.FocusedItem != null && this.listView1.FocusedItem.Selected)
- {
- var index = this.listView1.FocusedItem.Index;
- DrawObject drawObject = (DrawObject)this.listView1.Items[index].Tag;
- this.listView1.Items.RemoveAt(index);
- if (this.appWorkspace.DocumentWorkspaces != null && this.appWorkspace.DocumentWorkspaces.Length > 0)
- {
- for (int k = 0; k <= this.appWorkspace.DocumentWorkspaces.Length - 1; k++)
- {
- for (int i = 0; i < this.appWorkspace.DocumentWorkspaces[k].GraphicsList.Count; i++)
- {
- if (!this.appWorkspace.DocumentWorkspaces[k].GraphicsList[i].Equals(drawObject))
- {
- continue;
- }
- this.appWorkspace.DocumentWorkspaces[k].GraphicsList.RemoveObj(drawObject);
- this.appWorkspace.DocumentWorkspaces[k].Refresh();
- }
- }
- }
- }
- }
- /// <summary>
- /// 清空数据
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button2_Click(object sender, EventArgs e)
- {
- this.listView1.Items.Clear();
- //this.appWorkspace.ActiveDocumentWorkspace.GraphicsList.Clear();
- //this.appWorkspace.ActiveDocumentWorkspace.Refresh();
- if (this.appWorkspace.DocumentWorkspaces != null && this.appWorkspace.DocumentWorkspaces.Length > 0)
- {
- for (int k = 0; k <= this.appWorkspace.DocumentWorkspaces.Length - 1; k++)
- {
- this.appWorkspace.DocumentWorkspaces[k].GraphicsList.Clear();
- this.appWorkspace.DocumentWorkspaces[k].Refresh();
- }
- }
- }
- /// <summary>
- /// 获取别名
- /// </summary>
- /// <returns></returns>
- private string getNickName(DrawObject measureDrawObject)
- {
- try
- {
- var enName = measureDrawObject.drawToolType.ToString();
- foreach (var item in measureListSetModel.AttributeMapAllDataNodes)
- {
- var tool = item.Attribute.Where(m => m.Name.Equals(enName)).FirstOrDefault();
- if (tool == null)
- {
- continue;
- }
- if (toolNameList.Contains(tool.Text)) {
- var index = toolNameList.IndexOf(tool.Text);
- return string.IsNullOrEmpty(toolNickNameList[index]) ? toolNameList[index] : toolNickNameList[index];
- }
- return tool.Text;
- }
- return "";
- }
- catch (Exception)
- {
- return "默认";
- }
- }
- /// <summary>
- /// 获取数据
- /// </summary>
- /// <param name="drawToolType"></param>
- /// <returns></returns>
- private void getLstViewItem(DrawObject measureDrawObject)
- {
- double length;
- double area;
- double angle;
- string name = getNickName(measureDrawObject);
- MeasureDrawObject measureData = (MeasureDrawObject)measureDrawObject;
- Dictionary<System.Enum, object> data = measureData.GetData();
- switch (measureDrawObject.drawToolType)
- {
- case DrawToolType.MeasureLine:
- if (data.ContainsKey(MeasureAttributes.PhysicalLength))
- {
- object val;
- data.TryGetValue(MeasureAttributes.PhysicalLength, out val);
- length = Convert.ToDouble(val);
- }
- else
- {
- length = 0;
- }
- area = 0;
- angle = 0;
- addListViewData(name, length, area, angle, measureDrawObject,1);
- break;
- case DrawToolType.MeasureDistanceLine:
- if (data.ContainsKey(MeasureAttributes.PhysicalLength))
- {
- object val;
- data.TryGetValue(MeasureAttributes.PhysicalLength, out val);
- length = Convert.ToDouble(val);
- }
- else
- {
- length = 0;
- }
- area = 0;
- angle = 0;
- addListViewData(name, length, area, angle, measureDrawObject, 1);
- break;
- case DrawToolType.MeasureLength:
- if (data.ContainsKey(MeasureAttributes.PhysicalLength))
- {
- object val;
- data.TryGetValue(MeasureAttributes.PhysicalLength, out val);
- length = Convert.ToDouble(val);
- }
- else
- {
- length = 0;
- }
- area = 0;
- angle = 0;
- addListViewData(name, length, area, angle, measureDrawObject, 1);
- break;
- case DrawToolType.MeasureHLine:
- if (data.ContainsKey(MeasureAttributes.PhysicalLength))
- {
- object val;
- data.TryGetValue(MeasureAttributes.PhysicalLength, out val);
- length = Convert.ToDouble(val);
- }
- else
- {
- length = 0;
- }
- area = 0;
- angle = 0;
- addListViewData(name, length, area, angle, measureDrawObject, 1);
- break;
- case DrawToolType.MeasureVLine:
- if (data.ContainsKey(MeasureAttributes.PhysicalLength))
- {
- object val;
- data.TryGetValue(MeasureAttributes.PhysicalLength, out val);
- length = Convert.ToDouble(val);
- }
- else
- {
- length = 0;
- }
- area = 0;
- angle = 0;
- addListViewData(name, length, area, angle, measureDrawObject, 1);
- break;
- case DrawToolType.MeasureMulLine:
- MeasureMulLine line = (MeasureMulLine)measureDrawObject;
- area = 0;
- angle = 0;
-
- if (data.ContainsKey(MeasureAttributes.PhysicalLength))
- {
- for (int i = 0; i <= line.lengthParagraphs.Count - 1; i++)
- {
- addListViewData(name, Convert.ToDouble(line.lengthParagraphs[i]), area, angle, measureDrawObject);
- }
- }
- else
- {
- for (int i = 0; i <= line.lengthParagraphs.Count - 1; i++)
- {
- addListViewData(name, 0, area, angle, measureDrawObject);
- }
- }
- break;
- case DrawToolType.MeasureMulHVLine:
- MeasureMulHVLine measureMulHVLine = (MeasureMulHVLine)measureDrawObject;
- area = 0;
- angle = 0;
- if (data.ContainsKey(MeasureAttributes.PhysicalLength))
- {
- for (int i = 0; i <= measureMulHVLine.lengthParagraphs.Count - 1; i++)
- {
- addListViewData(name, Convert.ToDouble(measureMulHVLine.lengthParagraphs[i]), area, angle, measureDrawObject);
- }
- }
- else
- {
- for (int i = 0; i <= measureMulHVLine.lengthParagraphs.Count - 1; i++)
- {
- addListViewData(name, 0, area, angle, measureDrawObject);
- }
- }
- break;
- case DrawToolType.MeasureMulSegment:
- MeasureMulSegment measureMulSegment = (MeasureMulSegment)measureDrawObject;
- area = 0;
- angle = 0;
- if (data.ContainsKey(MeasureAttributes.PhysicalLength))
- {
- for (int i = 0; i <= measureMulSegment.lengthParagraphs.Count - 1; i++)
- {
- addListViewData(name, Convert.ToDouble(measureMulSegment.lengthParagraphs[i]), area, angle, measureDrawObject);
- }
- }
- else
- {
- for (int i = 0; i <= measureMulSegment.lengthParagraphs.Count - 1; i++)
- {
- addListViewData(name, 0, area, angle, measureDrawObject);
- }
- }
- break;
- case DrawToolType.MeasureMulVLine:
- MeasureMulVLine measureMulVLine = (MeasureMulVLine)measureDrawObject;
- area = 0;
- angle = 0;
- if (data.ContainsKey(MeasureAttributes.PhysicalLength))
- {
- for (int i = 0; i <= measureMulVLine.lengthParagraphs.Count - 1; i++)
- {
- addListViewData(name, Convert.ToDouble(measureMulVLine.lengthParagraphs[i]), area, angle, measureDrawObject);
- }
- }
- else
- {
- for (int i = 0; i <= measureMulVLine.lengthParagraphs.Count - 1; i++)
- {
- addListViewData(name, 0, area, angle, measureDrawObject);
- }
- }
- break;
- case DrawToolType.MeasureBrokenLine:
- if (data.ContainsKey(MeasureAttributes.PhysicalLength))
- {
- object val;
- data.TryGetValue(MeasureAttributes.PhysicalLength, out val);
- length = Convert.ToDouble(val);
- }
- else
- {
- length = 0;
- }
- area = 0;
- angle = 0;
- addListViewData(name, length, area, angle, measureDrawObject, 1);
- break;
- case DrawToolType.MeasureTraceCurve:
- if (data.ContainsKey(MeasureAttributes.PhysicalLength))
- {
- object val;
- data.TryGetValue(MeasureAttributes.PhysicalLength, out val);
- length = Convert.ToDouble(val);
- }
- else
- {
- length = 0;
- }
- area = 0;
- angle = 0;
- addListViewData(name, length, area, angle, measureDrawObject, 1);
- break;
- case DrawToolType.MeasureCurveLine:
- if (data.ContainsKey(MeasureAttributes.PhysicalLength))
- {
- object val;
- data.TryGetValue(MeasureAttributes.PhysicalLength, out val);
- length = Convert.ToDouble(val);
- }
- else
- {
- length = 0;
- }
- area = 0;
- angle = 0;
- addListViewData(name, length, area, angle, measureDrawObject, 1);
- break;
- case DrawToolType.MeasurePLine:
- if (data.ContainsKey(MeasureAttributes.PhysicalLength))
- {
- object val;
- data.TryGetValue(MeasureAttributes.PhysicalLength, out val);
- length = Convert.ToDouble(val);
- }
- else
- {
- length = 0;
- }
- area = 0;
- angle = 0;
- addListViewData(name, length, area, angle, measureDrawObject, 1);
- break;
- case DrawToolType.MeasureMulPLine:
- MeasureMulPLine measureMulPLine = (MeasureMulPLine)measureDrawObject;
- area = 0;
- angle = 0;
-
- if (data.ContainsKey(MeasureAttributes.PhysicalLength))
- {
- for (int i = 0; i <= measureMulPLine.lengthParagraphs.Count - 1; i++)
- {
- addListViewData(name, Convert.ToDouble(measureMulPLine.lengthParagraphs[i]), area, angle, measureDrawObject);
- }
- }
- else
- {
- for (int i = 0; i <= measureMulPLine.lengthParagraphs.Count - 1; i++)
- {
- addListViewData(name, 0, area, angle, measureDrawObject);
- }
- }
- break;
- case DrawToolType.MeasureHMulPLine:
- MeasureHMulPLine measureHMulPLine = (MeasureHMulPLine)measureDrawObject;
- area = 0;
- angle = 0;
-
- if (data.ContainsKey(MeasureAttributes.PhysicalLength))
- {
- for (int i = 0; i <= measureHMulPLine.lengthParagraphs.Count - 1; i++)
- {
- addListViewData(name, Convert.ToDouble(measureHMulPLine.lengthParagraphs[i]), area, angle, measureDrawObject);
- }
- }
- else
- {
- for (int i = 0; i <= measureHMulPLine.lengthParagraphs.Count - 1; i++)
- {
- addListViewData(name, 0, area, angle, measureDrawObject);
- }
- }
- break;
- case DrawToolType.MeasureVMulPLine:
- MeasureVMulPLine measureVMulPLine = (MeasureVMulPLine)measureDrawObject;
- area = 0;
- angle = 0;
- if (data.ContainsKey(MeasureAttributes.PhysicalLength))
- {
- for (int i = 0; i <= measureVMulPLine.lengthParagraphs.Count - 1; i++)
- {
- addListViewData(name, Convert.ToDouble(measureVMulPLine.lengthParagraphs[i]), area, angle, measureDrawObject);
- }
- }
- else
- {
- for (int i = 0; i <= measureVMulPLine.lengthParagraphs.Count - 1; i++)
- {
- addListViewData(name, 0, area, angle, measureDrawObject);
- }
- }
- break;
- case DrawToolType.MeasurePointHLine:
- if (data.ContainsKey(MeasureAttributes.PhysicalLength))
- {
- object val;
- data.TryGetValue(MeasureAttributes.PhysicalLength, out val);
- length = Convert.ToDouble(val);
- }
- else
- {
- length = 0;
- }
- area = 0;
- angle = 0;
- addListViewData(name, length, area, angle, measureDrawObject, 1);
- break;
- case DrawToolType.MeasureParallelLine:
- if (data.ContainsKey(MeasureAttributes.PhysicalLength))
- {
- object val;
- data.TryGetValue(MeasureAttributes.PhysicalLength, out val);
- length = Convert.ToDouble(val);
- }
- else
- {
- length = 0;
- }
- area = 0;
- angle = 0;
- addListViewData(name, length, area, angle, measureDrawObject, 1);
- break;
- case DrawToolType.MeasureMulParallelLine:
- MeasureMulParallelLine measureVMulPLine1 = (MeasureMulParallelLine)measureDrawObject;
- area = 0;
- angle = 0;
-
- if (data.ContainsKey(MeasureAttributes.PhysicalLength))
- {
- for (int i = 0; i <= measureVMulPLine1.lengthParagraphs.Count - 1; i++)
- {
- addListViewData(name, Convert.ToDouble(measureVMulPLine1.lengthParagraphs[i]), area, angle, measureDrawObject);
- }
- }
- else
- {
- for (int i = 0; i <= measureVMulPLine1.lengthParagraphs.Count - 1; i++)
- {
- addListViewData(name, 0, area, angle, measureDrawObject);
- }
- }
- break;
- case DrawToolType.MeasureVMulParallelLine:
- MeasureVMulParallelLine measureVMulParallelLine = (MeasureVMulParallelLine)measureDrawObject;
- area = 0;
- angle = 0;
-
- if (data.ContainsKey(MeasureAttributes.PhysicalLength))
- {
- for (int i = 0; i <= measureVMulParallelLine.lengthParagraphs.Count - 1; i++)
- {
- addListViewData(name, Convert.ToDouble(measureVMulParallelLine.lengthParagraphs[i]), area, angle, measureDrawObject);
- }
- }
- else
- {
- for (int i = 0; i <= measureVMulParallelLine.lengthParagraphs.Count - 1; i++)
- {
- addListViewData(name, 0, area, angle, measureDrawObject);
- }
- }
- break;
- case DrawToolType.MeasureHMulParallelLine:
- MeasureHMulParallelLine measureHMulParallelLine = (MeasureHMulParallelLine)measureDrawObject;
- area = 0;
- angle = 0;
-
- if (data.ContainsKey(MeasureAttributes.PhysicalLength))
- {
- for (int i = 0; i <= measureHMulParallelLine.lengthParagraphs.Count - 1; i++)
- {
- addListViewData(name, Convert.ToDouble(measureHMulParallelLine.lengthParagraphs[i]), area, angle, measureDrawObject);
- }
- }
- else
- {
- for (int i = 0; i <= measureHMulParallelLine.lengthParagraphs.Count - 1; i++)
- {
- addListViewData(name, 0, area, angle, measureDrawObject);
- }
- }
- break;
- case DrawToolType.MeasureClosedCurve:
- if (data.ContainsKey(MeasureAttributes.PhysicalLength))
- {
- object val;
- data.TryGetValue(MeasureAttributes.PhysicalLength, out val);
- length = Convert.ToDouble(val);
- }
- else
- {
- length = 0;
- }
- if (data.ContainsKey(MeasureAttributes.PhysicalArea))
- {
- object val;
- data.TryGetValue(MeasureAttributes.PhysicalArea, out val);
- area = Convert.ToDouble(val);
- }
- else {
- area = 0;
- }
- angle = 0;
- addListViewData(name, length, area, angle, measureDrawObject, 1);
- break;
- case DrawToolType.MeasurePolygon:
- if (data.ContainsKey(MeasureAttributes.PhysicalLength))
- {
- object val;
- data.TryGetValue(MeasureAttributes.PhysicalLength, out val);
- length = Convert.ToDouble(val);
- }
- else
- {
- length = 0;
- }
- if (data.ContainsKey(MeasureAttributes.PhysicalArea))
- {
- object val;
- data.TryGetValue(MeasureAttributes.PhysicalArea, out val);
- area = Convert.ToDouble(val);
- }
- else
- {
- area = 0;
- }
- angle = 0;
- addListViewData(name, length, area, angle, measureDrawObject, 1);
- break;
- case DrawToolType.MeasureRectangle:
- if (data.ContainsKey(MeasureAttributes.PhysicalLength))
- {
- object val;
- data.TryGetValue(MeasureAttributes.PhysicalLength, out val);
- length = Convert.ToDouble(val);
- }
- else
- {
- length = 0;
- }
- if (data.ContainsKey(MeasureAttributes.PhysicalArea))
- {
- object val;
- data.TryGetValue(MeasureAttributes.PhysicalArea, out val);
- area = Convert.ToDouble(val);
- }
- else
- {
- area = 0;
- }
- angle = 0;
- addListViewData(name, length, area, angle, measureDrawObject, 1);
- break;
- case DrawToolType.MeasureRandRectangle:
- if (data.ContainsKey(MeasureAttributes.PhysicalLength))
- {
- object val;
- data.TryGetValue(MeasureAttributes.PhysicalLength, out val);
- length = Convert.ToDouble(val);
- }
- else
- {
- length = 0;
- }
- if (data.ContainsKey(MeasureAttributes.PhysicalArea))
- {
- object val;
- data.TryGetValue(MeasureAttributes.PhysicalArea, out val);
- area = Convert.ToDouble(val);
- }
- else
- {
- area = 0;
- }
- angle = 0;
- addListViewData(name, length, area, angle, measureDrawObject, 1);
- break;
- case DrawToolType.MeasureSquare:
- if (data.ContainsKey(MeasureAttributes.PhysicalLength))
- {
- object val;
- data.TryGetValue(MeasureAttributes.PhysicalLength, out val);
- length = Convert.ToDouble(val);
- }
- else
- {
- length = 0;
- }
- if (data.ContainsKey(MeasureAttributes.PhysicalArea))
- {
- object val;
- data.TryGetValue(MeasureAttributes.PhysicalArea, out val);
- area = Convert.ToDouble(val);
- }
- else
- {
- area = 0;
- }
- angle = 0;
- addListViewData(name, length, area, angle, measureDrawObject, 1);
- break;
- case DrawToolType.MeasureRandSquare:
- MeasureDrawObject measureRandSquare = (MeasureDrawObject)measureDrawObject;
- if (data.ContainsKey(MeasureAttributes.PhysicalLength))
- {
- object val;
- data.TryGetValue(MeasureAttributes.PhysicalLength, out val);
- length = Convert.ToDouble(val);
- }
- else
- {
- length = 0;
- }
- if (data.ContainsKey(MeasureAttributes.PhysicalArea))
- {
- object val;
- data.TryGetValue(MeasureAttributes.PhysicalArea, out val);
- area = Convert.ToDouble(val);
- }
- else
- {
- area = 0;
- }
- angle = 0;
- addListViewData(name, length, area, angle, measureDrawObject, 1);
- break;
- case DrawToolType.MeasureTracePolygon:
- if (data.ContainsKey(MeasureAttributes.PhysicalLength))
- {
- object val;
- data.TryGetValue(MeasureAttributes.PhysicalLength, out val);
- length = Convert.ToDouble(val);
- }
- else
- {
- length = 0;
- }
- if (data.ContainsKey(MeasureAttributes.PhysicalArea))
- {
- object val;
- data.TryGetValue(MeasureAttributes.PhysicalArea, out val);
- area = Convert.ToDouble(val);
- }
- else
- {
- area = 0;
- }
- angle = 0;
- addListViewData(name, length, area, angle, measureDrawObject, 1);
- break;
- case DrawToolType.MeasureCircle:
- if (data.ContainsKey(MeasureAttributes.PhysicalRadius))
- {
- object val;
- data.TryGetValue(MeasureAttributes.PhysicalRadius, out val);
- length = Convert.ToDouble(val);
- }
- else
- {
- length = 0;
- }
- if (data.ContainsKey(MeasureAttributes.PhysicalArea))
- {
- object val;
- data.TryGetValue(MeasureAttributes.PhysicalArea, out val);
- area = Convert.ToDouble(val);
- }
- else
- {
- area = 0;
- }
- angle = 0;
- addListViewData(name, length, area, angle, measureDrawObject, 1);
- break;
- case DrawToolType.MeasureInnerCircle:
- if (data.ContainsKey(MeasureAttributes.PhysicalRadius))
- {
- object val;
- data.TryGetValue(MeasureAttributes.PhysicalRadius, out val);
- length = Convert.ToDouble(val);
- }
- else
- {
- length = 0;
- }
- if (data.ContainsKey(MeasureAttributes.PhysicalArea))
- {
- object val;
- data.TryGetValue(MeasureAttributes.PhysicalArea, out val);
- area = Convert.ToDouble(val);
- }
- else
- {
- area = 0;
- }
- angle = 0;
- addListViewData(name, length, area, angle, measureDrawObject, 1);
- break;
- case DrawToolType.MeasureOuterCircle:
- if (data.ContainsKey(MeasureAttributes.PhysicalRadius))
- {
- object val;
- data.TryGetValue(MeasureAttributes.PhysicalRadius, out val);
- length = Convert.ToDouble(val);
- }
- else
- {
- length = 0;
- }
- if (data.ContainsKey(MeasureAttributes.PhysicalArea))
- {
- object val;
- data.TryGetValue(MeasureAttributes.PhysicalArea, out val);
- area = Convert.ToDouble(val);
- }
- else
- {
- area = 0;
- }
- angle = 0;
- addListViewData(name, length, area, angle, measureDrawObject, 1);
- break;
- case DrawToolType.MeasureDiameterCircle:
- if (data.ContainsKey(MeasureAttributes.PhysicalRadius))
- {
- object val;
- data.TryGetValue(MeasureAttributes.PhysicalRadius, out val);
- length = Convert.ToDouble(val);
- }
- else
- {
- length = 0;
- }
- if (data.ContainsKey(MeasureAttributes.PhysicalArea))
- {
- object val;
- data.TryGetValue(MeasureAttributes.PhysicalArea, out val);
- area = Convert.ToDouble(val);
- }
- else
- {
- area = 0;
- }
- angle = 0;
- addListViewData(name, length, area, angle, measureDrawObject, 1);
- break;
- case DrawToolType.MeasurePointCenterSize:
- if (data.ContainsKey(MeasureAttributes.PhysicalDistance))
- {
- object val;
- data.TryGetValue(MeasureAttributes.PhysicalDistance, out val);
- length = Convert.ToDouble(val);
- }
- else
- {
- length = 0;
- }
- if (data.ContainsKey(MeasureAttributes.PhysicalArea))
- {
- object val;
- data.TryGetValue(MeasureAttributes.PhysicalArea, out val);
- area = Convert.ToDouble(val);
- }
- else
- {
- area = 0;
- }
- angle = 0;
- addListViewData(name, length, area, angle, measureDrawObject, 1);
- break;
- case DrawToolType.MeasureCenterCenterSize:
- if (data.ContainsKey(MeasureAttributes.PhysicalDistance))
- {
- object val;
- data.TryGetValue(MeasureAttributes.PhysicalDistance, out val);
- length = Convert.ToDouble(val);
- }
- else
- {
- length = 0;
- }
- if (data.ContainsKey(MeasureAttributes.PhysicalArea))
- {
- object val;
- data.TryGetValue(MeasureAttributes.PhysicalArea, out val);
- area = Convert.ToDouble(val);
- }
- else
- {
- area = 0;
- }
- angle = 0;
- addListViewData(name, length, area, angle, measureDrawObject, 1);
- break;
- case DrawToolType.MeasurePointArcSize:
- if (data.ContainsKey(MeasureAttributes.PhysicalDistance))
- {
- object val;
- data.TryGetValue(MeasureAttributes.PhysicalDistance, out val);
- length = Convert.ToDouble(val);
- }
- else
- {
- length = 0;
- }
- if (data.ContainsKey(MeasureAttributes.PhysicalArea))
- {
- object val;
- data.TryGetValue(MeasureAttributes.PhysicalArea, out val);
- area = Convert.ToDouble(val);
- }
- else
- {
- area = 0;
- }
- angle = 0;
- addListViewData(name, length, area, angle, measureDrawObject, 1);
- break;
- case DrawToolType.MeasureTwoLineVLDistance:
- if (data.ContainsKey(MeasureAttributes.PhysicalLength))
- {
- object val;
- data.TryGetValue(MeasureAttributes.PhysicalLength, out val);
- length = Convert.ToDouble(val);
- }
- else
- {
- length = 0;
- }
- area = 0;
- angle = 0;
- addListViewData(name, length, area, angle, measureDrawObject, 1);
- break;
- case DrawToolType.MeasurePointEdgeSize:
- if (data.ContainsKey(MeasureAttributes.PhysicalDistance))
- {
- object val;
- data.TryGetValue(MeasureAttributes.PhysicalDistance, out val);
- length = Convert.ToDouble(val);
- }
- else
- {
- length = 0;
- }
- if (data.ContainsKey(MeasureAttributes.PhysicalArea))
- {
- object val;
- data.TryGetValue(MeasureAttributes.PhysicalArea, out val);
- area = Convert.ToDouble(val);
- }
- else
- {
- area = 0;
- }
- angle = 0;
- addListViewData(name, length, area, angle, measureDrawObject, 1);
- break;
- case DrawToolType.MeasureThreePointAngle:
- length = 0;
- area = 0;
- if (data.ContainsKey(MeasureAttributes.Angle))
- {
- object val;
- data.TryGetValue(MeasureAttributes.Angle, out val);
- angle = Convert.ToDouble(val);
- }
- else
- {
- angle = 0;
- }
- addListViewData(name, length, area, angle, measureDrawObject, 1);
- break;
- case DrawToolType.MeasureFourPointAngle:
- length = 0;
- area = 0;
- if (data.ContainsKey(MeasureAttributes.Angle))
- {
- object val;
- data.TryGetValue(MeasureAttributes.Angle, out val);
- angle = Convert.ToDouble(val);
- }
- else
- {
- angle = 0;
- }
- addListViewData(name, length, area, angle, measureDrawObject, 1);
- break;
- case DrawToolType.MeasureThreePointArc:
- if (data.ContainsKey(MeasureAttributes.PhysicalRadius))
- {
- object val;
- data.TryGetValue(MeasureAttributes.PhysicalRadius, out val);
- length = Convert.ToDouble(val);
- }
- else
- {
- length = 0;
- }
- if (data.ContainsKey(MeasureAttributes.PhysicalArea))
- {
- object val;
- data.TryGetValue(MeasureAttributes.PhysicalArea, out val);
- area = Convert.ToDouble(val);
- }
- else
- {
- area = 0;
- }
- if (data.ContainsKey(MeasureAttributes.Angle))
- {
- object val;
- data.TryGetValue(MeasureAttributes.Angle, out val);
- angle = Convert.ToDouble(val);
- }
- else
- {
- angle = 0;
- }
- addListViewData(name, length, area, angle, measureDrawObject, 1);
- break;
- }
- }
- /// <summary>
- /// 添加数据
- /// </summary>
- /// <param name="name"></param>
- /// <param name="length"></param>
- /// <param name="area"></param>
- /// <param name="angle"></param>
- /// <param name="drawObject"></param>
- /// <param name="type"></param>
- private void addListViewData(string name, double length, double area, double angle,DrawObject drawObject,int type = 2)
- {
- if (!hasAttributes(drawObject.drawToolType.ToString(), "PhysicalLength") && !hasAttributes(drawObject.drawToolType.ToString(), "PhysicalRadius") && !hasAttributes(drawObject.drawToolType.ToString(), "PhysicalDistance") && !hasAttributes(drawObject.drawToolType.ToString(), "PhysicalCircumference"))
- {
- length = 0;
- }
- if (!hasAttributes(drawObject.drawToolType.ToString(), "PhysicalArea"))
- {
- area = 0;
- }
- if (!hasAttributes(drawObject.drawToolType.ToString(), "Angle"))
- {
- angle = 0;
- }
- int round = Convert.ToInt32(this.numericUpDown5.Value);
- length = Math.Round(length, round);
- area = Math.Round(area, round);
- angle = Math.Round(angle, round);
- ListViewItem lvi = new ListViewItem();
- lvi.Text = name;
- lvi.SubItems.Add(name);
- lvi.SubItems.Add(length.ToString());
- lvi.SubItems.Add(angle.ToString());
- lvi.SubItems.Add(area.ToString());
- lvi.Tag = drawObject;
- if (comboBox1.SelectedIndex == 0 || comboBox1.SelectedIndex == type)
- {
- this.listView1.Items.Add(lvi);
- }
- if (this.filterDict.ContainsKey(type))
- {
- this.filterDict[type].Add(lvi);
- }
- else
- {
- this.filterDict.Add(type, new List<ListViewItem>() { lvi });
- }
- }
- /// <summary>
- /// 刷新列表数据
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- public void RefreshListView(object sender, EventArgs e)
- {
- this.listView1.Items.Clear();
- this.filterDict.Clear();
- if (this.appWorkspace.DocumentWorkspaces != null && this.appWorkspace.DocumentWorkspaces.Length > 0)
- {
- for (int k = 0; k <= this.appWorkspace.DocumentWorkspaces.Length - 1; k++)
- {
- for (int i = 0; i < this.appWorkspace.DocumentWorkspaces[k].GraphicsList.Count; i++)
- {
- if (this.appWorkspace.DocumentWorkspaces[k].GraphicsList[i].objectType == DrawClass.Measure)
- {
- var drawTool = (MeasureDrawObject)this.appWorkspace.DocumentWorkspaces[k].GraphicsList[i];
- getLstViewItem(drawTool);
- }
- }
- }
- }
- }
- /// <summary>
- /// 小数位数修改
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void numericUpDown5_ValueChanged(object sender, EventArgs e)
- {
- if (this.appWorkspace.Widgets != null)
- this.appWorkspace.Widgets.MeasureListDialog.numericUpDown1.Value = numericUpDown5.Value;
- RefreshListView(null, null);
- }
- /// <summary>
- /// 输出
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button1_Click(object sender, EventArgs e)
- {
- if (this.listView1.Items.Count > 0)
- {
- this.InitialDataExcel();
- }
- else
- MessageBox.Show("暂无数据可导出");
- }
- /// <summary>
- /// 导出Excel
- /// </summary>
- private void InitialDataExcel()
- {
- DataTable dtb = new DataTable();
- for (int c = 0; c < 5; c++)
- {
- dtb.Columns.Add(c.ToString());
- }
- // 单位
- DataRow dataRow = dtb.NewRow();
- dataRow[0] = "单位";
- dataRow[1] = this.appWorkspace.GetPxPerUnit()[2];
- dtb.Rows.Add(dataRow);
- // 标题
- dataRow = dtb.NewRow();
- dataRow[0] = "图片名称";
- dataRow[1] = "分组";
- dataRow[2] = "测量工具名称";
- dataRow[3] = "测量属性名称";
- dataRow[4] = "值";
- dtb.Rows.Add(dataRow);
- // 所有图片
- for (int i = 0; i < this.appWorkspace.DocumentWorkspaces.Length; i++)
- {
- // 图片名称
- string imgName = this.appWorkspace.DocumentWorkspaces[i].GetFriendlyName();
- List<string> measures = new List<string>();
- // 所有测量工具
- for (int g = this.appWorkspace.DocumentWorkspaces[i].GraphicsList.Count - 1; g >= 0; g--)
- {
- if (this.appWorkspace.DocumentWorkspaces[i].GraphicsList[g].objectType == DrawClass.Measure)
- {
- if (comboBox1.SelectedIndex != 0) {
- //判断是单值还是多值,能否通过
- if (!isOddOrven(this.appWorkspace.DocumentWorkspaces[i].GraphicsList[g])) {
- continue;
- }
- }
- measures.Add(this.appWorkspace.DocumentWorkspaces[i].GraphicsList[g].drawToolType.ToString());
- // 测量数据
- Dictionary<System.Enum, object> data = ((MeasureDrawObject)this.appWorkspace.DocumentWorkspaces[i].GraphicsList[g]).GetData();
- // 测量工具名称
- string drawName = PdnResources.GetString("Menu.MeasureAction." + this.appWorkspace.DocumentWorkspaces[i].GraphicsList[g].drawToolType.ToString() + ".Text");
- List<string> drawingPropertiesList = new List<string>();
- var name = this.appWorkspace.DocumentWorkspaces[i].GraphicsList[g].drawToolType.ToString();
- foreach (var item in measureListSetModel.AttributeMapDataNodes)
- {
- var tool = item.Attribute.Where(m => m.Name.Equals(name)).FirstOrDefault();
- if (tool != null)
- {
- foreach (var str in tool.Attribute)
- {
- drawingPropertiesList.Add(str.Name);
- }
- }
- }
- //((MeasureDrawObject)this.appWorkspace.DocumentWorkspaces[i].GraphicsList[g]).drawingProperties.TryGetValue(this.appWorkspace.DocumentWorkspaces[i].GraphicsList[g].drawToolType, out drawingPropertiesList);
- int addCount = 0;
- foreach (var measure in measures)
- {
- if (measure.Equals(this.appWorkspace.DocumentWorkspaces[i].GraphicsList[g].drawToolType.ToString()))
- addCount++;
- }
- int round = Convert.ToInt32(this.numericUpDown5.Value);
- // 所有可见的属性
- foreach (var item in drawingPropertiesList)
- {
- dataRow = dtb.NewRow();
- string itemFirst = item.Substring(0, 1);
- string itemToLower = item.Substring(1, item.Length - 1).ToLower();
- string itemAll = itemFirst + itemToLower;
- // 测量属性名称
- string attributeName = PdnResources.GetString("Menu." + itemAll + ".text");
- // 属性值
- object value;
- MeasureAttributes type = (MeasureAttributes)System.Enum.Parse(typeof(MeasureAttributes), item);
- data.TryGetValue(type, out value);
- dataRow[0] = imgName;
- dataRow[1] = addCount;
- dataRow[2] = drawName;
- dataRow[3] = attributeName;
- dataRow[4] = Math.Round(Convert.ToDouble(value), round);
- dtb.Rows.Add(dataRow);
- }
- if (((MeasureDrawObject)this.appWorkspace.DocumentWorkspaces[i].GraphicsList[g]).lengthParagraphs != null
- && ((MeasureDrawObject)this.appWorkspace.DocumentWorkspaces[i].GraphicsList[g]).lengthParagraphs.Count > 0)
- {
- int length = 0;
- foreach (var lengthParagraph in ((MeasureDrawObject)this.appWorkspace.DocumentWorkspaces[i].GraphicsList[g]).lengthParagraphs)
- {
- length++;
- dataRow = dtb.NewRow();
- dataRow[0] = imgName;
- dataRow[1] = addCount;
- dataRow[2] = drawName;
- dataRow[3] = "物理长度(段" + length + ")";
- dataRow[4] = Math.Round(Convert.ToDouble(lengthParagraph), round);
- dtb.Rows.Add(dataRow);
- }
- }
- }
- }
- }
- MeasureListSettingDialog measureListSettingDialog = new MeasureListSettingDialog(this, "Template.Manager.item1.MeasureListAll", this.appWorkspace, dtb);
- if (measureListSettingDialog.hasModule)
- {
- measureListSettingDialog.StartPosition = FormStartPosition.CenterScreen;
- measureListSettingDialog.ShowDialog();
- }
- else
- {
- measureListSettingDialog = null;
- }
- }
- /// <summary>
- /// 判断是单值还是多值
- /// </summary>
- /// <param name="drawObject"></param>
- /// <returns></returns>
- private bool isOddOrven(DrawObject drawObject)
- {
- int index = this.comboBox1.SelectedIndex;
- switch (index) {
- case 1:
- if (moreTypeList.Contains(drawObject.drawToolType.ToString())) {
- return false;
- }
- break;
- case 2:
- if (!moreTypeList.Contains(drawObject.drawToolType.ToString()))
- {
- return false;
- }
- break;
- }
- return true;
- }
- /// <summary>
- /// 判断是否含有属性
- /// </summary>
- /// <returns></returns>
- private bool hasAttributes(string enMapName,string AttributesName)
- {
- foreach (var item in measureListSetModel.AttributeMapDataNodes)
- {
- var tool = item.Attribute.Where(m => m.Name.Equals(enMapName)).FirstOrDefault();
- if (tool != null)
- {
- var hasAttr = tool.Attribute.Where(m => m.Name.Equals(AttributesName)).FirstOrDefault();
- if (hasAttr != null)
- {
- return true;
- }
- }
- }
- return false;
- }
- /// <summary>
- /// 筛选
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
- {
- this.listView1.Items.Clear();
- switch (comboBox1.SelectedIndex) {
- case 0:
- foreach (var item in filterDict) {
- listView1.Items.AddRange(item.Value.ToArray());
- }
- break;
- case 1:
- List<ListViewItem> list;
- filterDict.TryGetValue(1, out list);
- if (list != null) {
- listView1.Items.AddRange(list.ToArray());
- }
- break;
- case 2:
- List<ListViewItem> list2;
- filterDict.TryGetValue(2, out list2);
- if (list2 != null)
- {
- listView1.Items.AddRange(list2.ToArray());
- }
- break;
- }
- }
- private void saveLastData(object sender, EventArgs e)
- {
- #region [树状信息保存]
- // 数据属性树状图保存
- measureListSetModel.AttributeMapDataNodes = new List<MeasureListSetModel.FirstNode>();
- for (int i = 0; i < this.treeView1.Nodes.Count; i++)
- {
- MeasureListSetModel.FirstNode firstNode = new MeasureListSetModel.FirstNode();
- firstNode.Attribute = new List<MeasureListSetModel.FirstNode.SecondNode>();
- firstNode.Name = this.treeView1.Nodes[i].Text;
- if (this.treeView1.Nodes[i].Nodes.Count > 0)
- {
- for (int j = 0; j < this.treeView1.Nodes[i].Nodes.Count; j++)
- {
- MeasureListSetModel.FirstNode.SecondNode second = new MeasureListSetModel.FirstNode.SecondNode();
- second.Attribute = new List<MeasureListSetModel.FirstNode.SecondNode.Item>();
- second.Text = this.treeView1.Nodes[i].Nodes[j].Text;
- second.Name = this.treeView1.Nodes[i].Nodes[j].Name;
- foreach (TreeNode Node in this.treeView1.Nodes[i].Nodes[j].Nodes)
- {
- MeasureListSetModel.FirstNode.SecondNode.Item item = new MeasureListSetModel.FirstNode.SecondNode.Item();
- item.Text = Node.Text;
- item.Name = Node.Name;
- second.Attribute.Add(item);
- }
- firstNode.Attribute.Add(second);
- }
- }
- measureListSetModel.AttributeMapDataNodes.Add(firstNode);
- }
- // 数据属性(元素)树状图保存
- measureListSetModel.AttributeMapAllDataNodes = new List<MeasureListSetModel.FirstNode>();
- for (int i = 0; i < this.treeView2.Nodes.Count; i++)
- {
- MeasureListSetModel.FirstNode firstNode = new MeasureListSetModel.FirstNode();
- firstNode.Attribute = new List<MeasureListSetModel.FirstNode.SecondNode>();
- firstNode.Name = this.treeView2.Nodes[i].Text;
- if (this.treeView2.Nodes[i].Nodes.Count > 0)
- {
- for (int j = 0; j < this.treeView2.Nodes[i].Nodes.Count; j++)
- {
- MeasureListSetModel.FirstNode.SecondNode second = new MeasureListSetModel.FirstNode.SecondNode();
- second.Attribute = new List<MeasureListSetModel.FirstNode.SecondNode.Item>();
- second.Text = this.treeView2.Nodes[i].Nodes[j].Text;
- second.Name = this.treeView2.Nodes[i].Nodes[j].Name;
- foreach (TreeNode Node in this.treeView2.Nodes[i].Nodes[j].Nodes)
- {
- MeasureListSetModel.FirstNode.SecondNode.Item item = new MeasureListSetModel.FirstNode.SecondNode.Item();
- item.Text = Node.Text;
- item.Name = Node.Name;
- second.Attribute.Add(item);
- }
- firstNode.Attribute.Add(second);
- }
- }
- measureListSetModel.AttributeMapAllDataNodes.Add(firstNode);
- }
- string configXml = XmlSerializeHelper.XmlSerialize(measureListSetModel);
- string filePath = System.Windows.Forms.Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\MeasureListInteractiveModel.xml";
- FileOperationHelper.WriteStringToFile(configXml, filePath, FileMode.Create);
- #endregion
- #region [保存参数]
- if (measureListInteractiveDataModel == null)
- {
- measureListInteractiveDataModel = new MeasureListInteractiveDataModel();
- }
- measureListInteractiveDataModel.FastToolList = new List<FastTool>();
- foreach (var item in toolNameList)
- {
- var index = toolNameList.IndexOf(item);
- string enName = string.Empty;
- foreach (var item1 in measureListSetModel.AttributeMapAllDataNodes)
- {
- var tool = item1.Attribute.Where(m => m.Text.Equals(item)).FirstOrDefault();
- if (tool == null)
- {
- continue;
- }
- enName = tool.Name;
- }
- var fastTool = new FastTool();
- fastTool.name = item;
- fastTool.enName = enName;
- fastTool.nickName = toolNickNameList[index];
- measureListInteractiveDataModel.FastToolList.Add(fastTool);
- }
- measureListInteractiveDataModel.hasUsed = true;
- measureListInteractiveDataModel.num = Convert.ToInt32(this.numericUpDown5.Value);
- measureListInteractiveDataModel.selectIndex = comboBox1.SelectedIndex;
- filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\ParameterSaving\\MeasureListInteractiveDataModel.xml";
- string porosityInfoXml = XmlSerializeHelper.XmlSerialize<MeasureListInteractiveDataModel>(measureListInteractiveDataModel);
- FileOperationHelper.WriteStringToFile(porosityInfoXml, filePath, FileMode.Create);
- #endregion
- }
- private void GeometryMeasureDialog_FormClosing(object sender, FormClosingEventArgs e)
- {
- this.appWorkspace.toolBar.RefreshBtnSelect(false, "Geometry");
- this.appWorkspace.toolsPanel.RefreshBtnSelect(false, "Geometry");
- }
- }
- }
|