GrainSizeAnalysisMethodOfClasticRockDialog.cs 239 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742
  1. using OpenCvSharp;
  2. using PaintDotNet.Base.CommTool;
  3. using PaintDotNet.Base.SettingModel;
  4. using System;
  5. using System.Collections;
  6. using System.Collections.Generic;
  7. using System.ComponentModel;
  8. using System.Drawing;
  9. using System.Drawing.Drawing2D;
  10. using System.IO;
  11. using System.Windows.Forms;
  12. using Point = System.Drawing.Point;
  13. using PaintDotNet.Base.Functionodel;
  14. using PaintDotNet.Base.Enum;
  15. using PaintDotNet.Annotation.Enum;
  16. using PaintDotNet.CustomControl;
  17. using Application = System.Windows.Forms.Application;
  18. using GroupBox = System.Windows.Forms.GroupBox;
  19. using CheckBox = System.Windows.Forms.CheckBox;
  20. using Button = System.Windows.Forms.Button;
  21. using Label = System.Windows.Forms.Label;
  22. using PaintDotNet.DedicatedAnalysis.DuctileIron.Common;
  23. using System.Data;
  24. using Microsoft.Office.Interop.Excel;
  25. using Font = System.Drawing.Font;
  26. using DataTable = System.Data.DataTable;
  27. using PaintDotNet.DbOpreate.DbBll;
  28. using PaintDotNet.DbOpreate.DbModel;
  29. using PaintDotNet.Data.Param;
  30. using PaintDotNet.Instrument;
  31. using Metis.ParameterSet;
  32. using PaintDotNet.Base;
  33. using System.Linq;
  34. namespace PaintDotNet.DedicatedAnalysis.PetroleumGeology.SYT5434_1999
  35. {
  36. internal class GrainSizeAnalysisMethodOfClasticRockDialog : PdnBaseForm
  37. {
  38. #region 控件
  39. private GroupBox groupBox1;
  40. private Button button2;
  41. private CheckBox checkBox2;
  42. private GroupBox groupBox2;
  43. private ListView listView1;
  44. private ImageList imageList1;
  45. private IContainer components;
  46. private PaintDotNet.CustomControl.BinaryControl bc;
  47. private GroupBox groupBox7;
  48. private GroupBox groupBox3;
  49. private CheckBox checkBox1;
  50. private CheckBox checkBox4;
  51. private CheckBox checkBox3;
  52. private GroupBox groupBox4;
  53. private CheckBox checkBox5;
  54. private CheckBox checkBox6;
  55. private Label label4;
  56. private Label label3;
  57. private Label label2;
  58. private Label label1;
  59. private GroupBox groupBox5;
  60. private DataGridView dataGridView1;
  61. private GroupBox groupBox8;
  62. private Button button4;
  63. private ListView listView2;
  64. private NumericUpDown numericUpDown1;
  65. private Button button16;
  66. private Label label5;
  67. private Button button14;
  68. private Button button13;
  69. private DataGridView dataGridView4;
  70. private Button button12;
  71. private Button button11;
  72. private DataGridView dataGridView2;
  73. private Button button1;
  74. #endregion
  75. /// <summary>
  76. /// 主控件
  77. /// </summary>
  78. private AppWorkspace appWorkspace;
  79. //二值化集成1
  80. BinaryClass binaryClass;
  81. private int menuId;
  82. private string menuName;
  83. /// <summary>
  84. /// 选中图片的mat
  85. /// </summary>
  86. private Mat imageMat;
  87. private DocumentWorkspaceWindow documentWorkspace;
  88. /// <summary>
  89. /// 公共按钮
  90. /// </summary>
  91. private CommonControlButtons commonControlButtons;
  92. /// <summary>
  93. /// 储存点击保存结果后的所有原图与分析图
  94. /// </summary>
  95. private Dictionary<string, List<Bitmap>> bitDic = new Dictionary<string, List<Bitmap>>();
  96. /// <summary>
  97. /// 处理程序
  98. /// </summary>
  99. private ParamObject action = new Data.Action.Action1010();
  100. /// <summary>
  101. /// 存在视场标记
  102. /// </summary>
  103. private bool existViewFlag = false;
  104. private NumericUpDown numericUpDown3;
  105. private NumericUpDown numericUpDown2;
  106. private Panel panel2;
  107. private Panel panel1;
  108. /// <summary>
  109. /// 调色板
  110. /// </summary>
  111. private ColorsForm colorsForm1;
  112. private ColorsForm colorsForm2;
  113. /// <summary>
  114. /// 全部显示
  115. /// </summary>
  116. private bool allShow = false;
  117. /// <summary>
  118. /// 当前选择的图片
  119. /// </summary>
  120. private Mat matOrg;
  121. /// <summary>
  122. /// 标尺
  123. /// </summary>
  124. private double unitLength = 1.0;
  125. /// <summary>
  126. /// 轮廓质点
  127. /// </summary>
  128. private List<Dictionary<Point2d, double[]>> keyValuePairs = new List<Dictionary<Point2d, double[]>>();
  129. /// <summary>
  130. /// 轮廓质点(所有分析结果)
  131. /// </summary>
  132. private Dictionary<string, List<Dictionary<Point2d, double[]>>> keyValuePairsAll = new Dictionary<string, List<Dictionary<Point2d, double[]>>>();
  133. /// <summary>
  134. /// 分析结果暂存
  135. /// </summary>
  136. private List<System.Data.DataTable> dataTables = new List<System.Data.DataTable>();
  137. /// <summary>
  138. /// 保存用于生成报告的图片
  139. /// </summary>
  140. private List<Bitmap> bitList;
  141. /// <summary>
  142. /// 中间数据
  143. /// </summary>
  144. private List<ExportProjectModel> tempDataModel = new List<ExportProjectModel>();
  145. /// <summary>
  146. /// 图解法统计数据
  147. /// </summary>
  148. private List<DataGridViewRow> dataGridViewRowsGraphic = new List<DataGridViewRow>();
  149. /// <summary>
  150. /// 矩阵法统计数据
  151. /// </summary>
  152. private List<DataGridViewRow> dataGridViewRowsMatrix = new List<DataGridViewRow>();
  153. /// <summary>
  154. /// 图解法统计数据
  155. /// </summary>
  156. private Dictionary<string, List<DataGridViewRow>> graphicMethods = new Dictionary<string, List<DataGridViewRow>>();
  157. /// <summary>
  158. /// 矩阵法统计数据
  159. /// </summary>
  160. private Dictionary<string, List<DataGridViewRow>> matrixMethods = new Dictionary<string, List<DataGridViewRow>>();
  161. /// <summary>
  162. /// 图解法统计数据(多视场Φ值)
  163. /// </summary>
  164. private List<DataTable> dataTablesFai = new List<DataTable>();
  165. private DataGridViewTextBoxColumn Column11;
  166. private DataGridViewTextBoxColumn dataGridViewTextBoxColumn3;
  167. private DataGridViewTextBoxColumn dataGridViewTextBoxColumn4;
  168. private DataGridViewTextBoxColumn dataGridViewTextBoxColumn5;
  169. private DataGridViewTextBoxColumn Column1;
  170. private DataGridViewTextBoxColumn Column2;
  171. private DataGridViewTextBoxColumn Column5;
  172. private DataGridViewTextBoxColumn Column6;
  173. private DataGridViewTextBoxColumn Column7;
  174. private DataGridViewTextBoxColumn Column3;
  175. private DataGridView dataGridView3;
  176. private DataGridViewTextBoxColumn dataGridViewTextBoxColumn9;
  177. private DataGridViewTextBoxColumn dataGridViewTextBoxColumn10;
  178. private DataGridViewTextBoxColumn dataGridViewTextBoxColumn11;
  179. private DataGridViewTextBoxColumn dataGridViewTextBoxColumn12;
  180. private DataGridViewTextBoxColumn dataGridViewTextBoxColumn1;
  181. private DataGridViewTextBoxColumn dataGridViewTextBoxColumn2;
  182. private DataGridViewTextBoxColumn dataGridViewTextBoxColumn6;
  183. private DataGridViewTextBoxColumn dataGridViewTextBoxColumn7;
  184. private DataGridViewTextBoxColumn dataGridViewTextBoxColumn8;
  185. private DataGridViewTextBoxColumn Column4;
  186. private DataGridViewTextBoxColumn Column9;
  187. private DataGridViewTextBoxColumn Column10;
  188. private DataGridViewTextBoxColumn Column8;
  189. private DataGridViewTextBoxColumn Column12;
  190. private DataGridViewTextBoxColumn Column13;
  191. private DataGridViewTextBoxColumn Column14;
  192. private DataGridViewTextBoxColumn Column15;
  193. private AppCommon appCommon;
  194. private int defaultIndex = -1;
  195. private bool isExportResults = false;
  196. private bool isExportReports = false;
  197. private bool isExportProjects = false;
  198. /// <summary>
  199. /// 是否脚本运行
  200. /// </summary>
  201. private Boolean initScriptValues = false;
  202. // <summary>
  203. /// 保存窗口参数 range
  204. /// </summary>
  205. /// <summary>
  206. /// 各个图片对应数据
  207. /// </summary>
  208. private Dictionary<string, GrainSizeAnalysisModel> eachData = new Dictionary<string, GrainSizeAnalysisModel>();
  209. private const string ParamKey_Report = "report";//报告设置
  210. private const string ParamKey_Correct = "correct";//筛析矫正
  211. private const string ParamKey_Graphic = "graphic";//图解法
  212. private const string ParamKey_Matrix = "matrix";//矩阵法
  213. private const string ParamKey_Number = "number";//显示颗粒编号
  214. private const string ParamKey_NumberFontSize = "numberFontSize";//编号字体大小
  215. private const string ParamKey_NumberColour = "numberColour";//编号颜色
  216. private const string ParamKey_Diameter = "diameter";//显示颗粒直径
  217. private const string ParamKey_DiameterFontSize = "diameterFontSize";//直径字体大小
  218. private const string ParamKey_DiameterColour = "diameterColour";//直径颜色
  219. private Button button3;
  220. private Button button5;
  221. private const string ParamKey_DecimalPlace = "decimalPlace";//保留小数位数
  222. public GrainSizeAnalysisMethodOfClasticRockDialog(AppWorkspace appWorkspace, PdnMenuItem menuItem)
  223. {
  224. this.menuId = menuItem.MenuId;
  225. this.menuName = menuItem.Text;
  226. binaryClass = new BinaryClass(menuId);
  227. this.appWorkspace = appWorkspace;
  228. NullKey();
  229. InitializeComponent();
  230. InitializeLanguageText();
  231. // 标尺
  232. //this.appWorkspace.getMeasureInfo().TryGetValue(MeasurementUnit.Millimeter, out unitLength);
  233. //
  234. //初始化色板
  235. //
  236. //调色板
  237. this.colorsForm1 = new ColorsForm();
  238. this.colorsForm1.StartPosition = FormStartPosition.CenterScreen;
  239. this.colorsForm1.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
  240. //调色板
  241. this.colorsForm2 = new ColorsForm();
  242. this.colorsForm2.StartPosition = FormStartPosition.CenterScreen;
  243. this.colorsForm2.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
  244. //
  245. //初始化图像控件
  246. //
  247. this.documentWorkspace = new DocumentWorkspaceWindow(appWorkspace);
  248. this.documentWorkspace.Dock = DockStyle.Fill;
  249. this.documentWorkspace.HookMouseEvents();
  250. this.documentWorkspace.AuxiliaryLineEnabled = false;
  251. this.documentWorkspace.Visible = false;
  252. //this.documentWorkspace.panel.MouseDown += OnMouseDown;
  253. this.documentWorkspace.panel.Paint += Panel_Paint;
  254. //this.documentWorkspace.panel.MouseMove += onMouseMove;
  255. //this.documentWorkspace.panel.MouseUp += onMouseUp;
  256. //this.documentWorkspace.panel.Click += new EventHandler(this.pictureBox1_Click);
  257. this.groupBox7.Controls.Add(documentWorkspace);
  258. //
  259. //初始化操作按钮
  260. //
  261. this.commonControlButtons = new CommonControlButtons();
  262. this.commonControlButtons.Dock = DockStyle.Top;
  263. this.commonControlButtons.Height = 30;
  264. this.commonControlButtons.HideZoomToWindowAndActualSize();
  265. this.groupBox7.Controls.Add(commonControlButtons);
  266. //初始化头
  267. this.listView2.View = View.Details;
  268. ColumnHeader header0 = new ColumnHeader();
  269. header0.Text = "";
  270. header0.Width = 180;
  271. this.listView2.Columns.Add(header0);
  272. InitCommonButtonEvent();
  273. Init();
  274. InitPicList();
  275. SetAnalyzeModelFromXml("Template.Manager.item3.GrainSizeAnalysis");
  276. //二值化集成2
  277. bc.OriginCheckedChangedAction += new EventHandler(this.bcOriginCheckedChanged);//初始化原图勾选改变事件
  278. binaryClass.createDocumentItems(new string[] { PdnResources.GetString("Menu.BinaryAction.BinaryExtraction.Text"), PdnResources.GetString("Menu.Grainboundarytoreproduce.text") }
  279. , this.bc, this.appWorkspace, this.documentWorkspace, this.listView1);//初始化相的工作结构
  280. binaryClass.BinaryImplFinishAction += new EventHandler(this.bClassBinaryImplFinishAction);//二值化后续处理事件
  281. for (int i = 0; i < this.dataGridView1.Columns.Count; i++)
  282. {
  283. this.dataGridView1.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;
  284. }
  285. for (int i = 0; i < this.dataGridView2.Columns.Count; i++)
  286. {
  287. this.dataGridView2.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;
  288. }
  289. for (int i = 0; i < this.dataGridView3.Columns.Count; i++)
  290. {
  291. this.dataGridView3.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;
  292. }
  293. for (int i = 0; i < this.dataGridView4.Columns.Count; i++)
  294. {
  295. this.dataGridView4.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;
  296. }
  297. }
  298. /// <summary>
  299. /// 初始化参数
  300. /// </summary>
  301. private void Init()
  302. {
  303. this.button11.Visible = true;
  304. this.button16.Visible = false;
  305. this.numericUpDown2.Value = 10;
  306. this.numericUpDown3.Value = 10;
  307. this.checkBox3.Checked = true;
  308. }
  309. private void ShowImgEvent(object sender, EventArgs e)
  310. {
  311. listView1.Focus();
  312. if (this.defaultIndex != -1)
  313. {
  314. this.listView1.Items[defaultIndex].Focused = true;
  315. this.listView1.Items[defaultIndex].Selected = true;
  316. //如果是脚本执行,将参数带入
  317. if (appWorkspace.ScriptRunning && appWorkspace.ScriptCurrentParam != null)
  318. {
  319. this.initScriptValues = true;//ScriptAutomatic
  320. //Boolean initScriptValues = true;
  321. ////在这里反射出对应功能的参数类
  322. string className = InvariantData.path_Action + ".Action" + menuId;
  323. ParamObject param = (ParamObject)System.Reflection.Assembly.Load(InvariantData.assembly_Data).CreateInstance(className);
  324. foreach (Args arg in param.Lists)
  325. {
  326. Args param1 = appWorkspace.ScriptCurrentParam.Lists.Find(m => m.Key.Equals(arg.Key));
  327. if (param1.value != null)
  328. arg.Value = param1.value;
  329. getValue(arg.key, arg.Value);
  330. }
  331. appWorkspace.ScriptCurrentParam = null;//阻止第二次进入仍然被赋值参数
  332. }
  333. else
  334. {//读取上次关闭窗口时保存的参数
  335. GetXmlParameter();
  336. }
  337. if (this.initScriptValues && this.appWorkspace.ScriptAutomatic)
  338. this.startScriptAutomaticAction();
  339. }
  340. }
  341. /// <summary>
  342. /// 初始化图片列表数据
  343. /// </summary>
  344. public void InitPicList()
  345. {
  346. //初始化图片列表
  347. for (int i = 0; i < this.appWorkspace.DocumentWorkspaces.Length; i++)
  348. {
  349. this.imageList1.Images.Add("img" + i, this.appWorkspace.DocumentWorkspaces[i].BinarizationThumbnail);
  350. this.listView1.Items.Add("", i);
  351. this.listView1.Items[i].ImageIndex = i;
  352. this.listView1.Items[i].Text = this.appWorkspace.DocumentWorkspaces[i].GetFriendlyName();
  353. this.listView1.Items[i].Name = this.appWorkspace.DocumentWorkspaces[i].GetFriendlyName();
  354. if (this.appWorkspace.DocumentWorkspaces[i].Equals(this.appWorkspace.ActiveDocumentWorkspace))
  355. {
  356. defaultIndex = i;
  357. }
  358. }
  359. this.Shown += ShowImgEvent;
  360. }
  361. //二值化集成3
  362. #region 二值化相关方法
  363. private void InclusionsStandardDialog_FormClosing(object sender, FormClosingEventArgs e)
  364. {
  365. #region [开启脚本录制]
  366. if (appWorkspace.startScriptRecording)
  367. {
  368. getScriptRecording();
  369. }
  370. #endregion
  371. binaryClass.saveParams();
  372. this.saveDialogParamValues();
  373. //xml保存路径
  374. string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\GrainSizeAnalyze\\GrainSizeAnalysisModel.xml";
  375. GrainSizeAnalysisModel analysisModelXml = XmlSerializeHelper.DESerializer<GrainSizeAnalysisModel>(FileOperationHelper.ReadStringFromFile(filePath, System.IO.FileMode.Open));
  376. foreach (var analysisItem in this.eachData[GetImgKey()].ListParam)
  377. {
  378. bool foundItem = false;
  379. foreach (var item in analysisModelXml.ListParam)
  380. {
  381. if (item.param_key.Equals(analysisItem.param_key) && item.menuId == analysisItem.menuId)
  382. {
  383. item.param_value = analysisItem.param_value;
  384. foundItem = true;
  385. break;
  386. }
  387. }
  388. if (!foundItem)
  389. analysisModelXml.ListParam.Add(analysisItem.cloneModel());
  390. }
  391. //按路径和名称保存xml文件
  392. string userInfoXml = XmlSerializeHelper.XmlSerialize<GrainSizeAnalysisModel>(analysisModelXml);
  393. //保存xml
  394. FileOperationHelper.WriteStringToFile(userInfoXml, filePath, System.IO.FileMode.Create);
  395. }
  396. private void ShownChoiseItemAndInitData(object sender, EventArgs e)
  397. {
  398. binaryClass.RefreshHistogramControl1Values();
  399. }
  400. /// <summary>
  401. /// 添加参数改变的监听
  402. /// </summary>
  403. /// <param name="sender"></param>
  404. /// <param name="e"></param>
  405. private void GrainSizeAnalysisMethodOfClasticRockDialog_Load(object sender, EventArgs e)
  406. {
  407. this.binaryClass.loadParams();
  408. if (this.initScriptValues && this.appWorkspace.ScriptAutomatic)
  409. this.startScriptAutomaticAction();
  410. }
  411. private bool bcBinaryChecked()
  412. {
  413. return bc != null && bc.BinaryChecked;
  414. }
  415. private bool bcOriginChecked()
  416. {
  417. return bc != null && bc.OriginChecked;
  418. }
  419. /// <summary>
  420. /// 参数改变时,重新处理图像
  421. /// </summary>
  422. /// <param name="sender"></param>
  423. /// <param name="e"></param>
  424. private void bClassBinaryImplFinishAction(object sender, EventArgs e)
  425. {
  426. ScreeningSpheroidizedTissue();
  427. RefrashResultData();
  428. this.documentWorkspace.Refresh();
  429. }
  430. /// <summary>
  431. /// 显示原图/原图+二值图
  432. /// </summary>
  433. /// <param name="sender"></param>
  434. /// <param name="e"></param>
  435. private void bcOriginCheckedChanged(object sender, EventArgs e)
  436. {
  437. if (!bcOriginChecked())
  438. {
  439. if (bcBinaryChecked())
  440. this.documentWorkspace.PhaseModels[0].choise = true;
  441. }
  442. else
  443. {
  444. this.documentWorkspace.PhaseModels[0].choise = false;
  445. this.documentWorkspace.PhaseModels[1].choise = false;
  446. }
  447. this.documentWorkspace.Refresh();
  448. }
  449. #endregion
  450. #region 公共控件
  451. private void InitCommonButtonEvent()
  452. {
  453. this.commonControlButtons.zoomInButton.Click += new EventHandler(zoomInButton_Click);
  454. this.commonControlButtons.zoomOutButton.Click += new EventHandler(zoomOutButton_Click);
  455. this.commonControlButtons.zoomToWindowButton.Click += new EventHandler(zoomToWindowButton_Click);
  456. this.commonControlButtons.actualSizeButton.Click += new EventHandler(actualSizeButton_Click);
  457. this.commonControlButtons.pointerButton.Click += new EventHandler(pointerButton_Click);
  458. this.commonControlButtons.mobileModeButton.Click += new EventHandler(mobileModeButton_Click);
  459. }
  460. private void zoomInButton_Click(object sender, EventArgs e)
  461. {
  462. this.documentWorkspace.ZoomIn();
  463. }
  464. private void zoomOutButton_Click(object sender, EventArgs e)
  465. {
  466. this.documentWorkspace.ZoomOut();
  467. }
  468. private void zoomToWindowButton_Click(object sender, EventArgs e)
  469. {
  470. this.documentWorkspace.ZoomBasis = ZoomBasis.FitToWindow;
  471. }
  472. private void actualSizeButton_Click(object sender, EventArgs e)
  473. {
  474. this.documentWorkspace.ZoomBasis = ZoomBasis.ScaleFactor;
  475. this.documentWorkspace.ScaleFactor = ScaleFactor.OneToOne;
  476. }
  477. private void pointerButton_Click(object sender, EventArgs e)
  478. {
  479. this.documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.Pointer;
  480. }
  481. private void mobileModeButton_Click(object sender, EventArgs e)
  482. {
  483. this.documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.MoveMode;
  484. }
  485. #endregion
  486. /// <summary>
  487. /// 计算颗粒直径
  488. /// </summary>
  489. private void ScreeningSpheroidizedTissue()
  490. {
  491. appCommon = new AppCommon();
  492. // 计算所有轮廓质点
  493. keyValuePairs = new List<Dictionary<Point2d, double[]>>();
  494. if (this.documentWorkspace.phaseModels.Count == 0 || this.documentWorkspace.phaseModels[0].mat == null)
  495. return;
  496. if (this.documentWorkspace.GraphicsList.IsExsitView())
  497. {
  498. // 原始轮廓信息
  499. Mat temp = new Mat();
  500. this.documentWorkspace.phaseModels[0].mat.CopyTo(temp);
  501. List<OpenCvSharp.Point[][]> points = new List<OpenCvSharp.Point[][]>();//各石墨轮廓集合
  502. List<List<int>> lstAttribute = new List<List<int>>();//各个视场属性集合,索引0-横坐标,1-纵坐标,2-视场宽度,3-视场高度,4-视场面积
  503. int sumFieldl = 0; //视场个数
  504. //调用处理视场方法
  505. appCommon.MultiFieldView(appWorkspace, temp, listView1, documentWorkspace, out points, out lstAttribute, out sumFieldl);
  506. int viewCount = 0;
  507. int h = 0;
  508. foreach (OpenCvSharp.Point[][] contours in points)
  509. {
  510. h++;
  511. keyValuePairs.Add(new Dictionary<Point2d, double[]>());
  512. double[] thisAspectRatio;
  513. for (int i = 0; i < contours.Length; i++)
  514. {
  515. double area = Math.Abs(Cv2.ContourArea(contours[i]));
  516. for (int f = 0; f < contours[i].Length; f++)
  517. {
  518. contours[i][f].X = contours[i][f].X + lstAttribute[h - 1][0];
  519. contours[i][f].Y = contours[i][f].Y + lstAttribute[h - 1][1];
  520. }
  521. thisAspectRatio = new double[3];
  522. if (contours[i].Length < 5)
  523. continue;
  524. else
  525. {
  526. OpenCvSharp.RotatedRect rect = OpenCvSharp.Cv2.FitEllipse(contours[i]);
  527. thisAspectRatio[0] = Convert.ToDouble(rect.Size.Width * this.unitLength);
  528. thisAspectRatio[2] = area;
  529. // 取得所有轮廓质点
  530. OpenCvSharp.Moments moments = new OpenCvSharp.Moments(contours[i], false);
  531. if (!double.IsNaN(moments.M10 / moments.M00) && !double.IsNaN(moments.M01 / moments.M00))
  532. keyValuePairs[viewCount].Add(new Point2d(moments.M10 / moments.M00, moments.M01 / moments.M00), thisAspectRatio);
  533. }
  534. }
  535. int count;
  536. if(keyValuePairs.Count > 0)
  537. {
  538. foreach (var item1 in keyValuePairs[viewCount])
  539. {
  540. count = 0;
  541. foreach (var item2 in keyValuePairs[viewCount])
  542. {
  543. if (item2.Value[0] < item1.Value[0])
  544. count++;
  545. }
  546. foreach (var item3 in keyValuePairs[0])
  547. {
  548. if (item3.Value[1] == count + 1)
  549. count++;
  550. }
  551. item1.Value[1] = count + 1;
  552. }
  553. }
  554. viewCount++;
  555. }
  556. }
  557. else
  558. {
  559. // 原始轮廓信息
  560. OpenCvSharp.Point[][] contours;
  561. HierarchyIndex[] hierachy;
  562. Mat temp = new Mat();
  563. this.documentWorkspace.phaseModels[0].mat.CopyTo(temp);
  564. List<List<OpenCvSharp.Point>> globularPoint = new List<List<OpenCvSharp.Point>>();
  565. List<List<OpenCvSharp.Point>> flakyPoint = new List<List<OpenCvSharp.Point>>();
  566. Cv2.FindContours(BinaryClass.BGRA2GRAY(temp), out contours, out hierachy, RetrievalModes.External, ContourApproximationModes.ApproxNone);
  567. if (hierachy.Length > 0)
  568. {
  569. keyValuePairs.Add(new Dictionary<Point2d, double[]>());
  570. double[] thisAspectRatio;
  571. for (int i = 0; i < hierachy.Length; i++)
  572. {
  573. thisAspectRatio = new double[3];
  574. double area = Math.Abs(Cv2.ContourArea(contours[i]));
  575. if (contours[i].Length < 5)
  576. continue;
  577. else
  578. {
  579. OpenCvSharp.RotatedRect rect = OpenCvSharp.Cv2.FitEllipse(contours[i]);
  580. thisAspectRatio[0] = Convert.ToDouble(rect.Size.Width * this.unitLength);
  581. thisAspectRatio[2] = area;
  582. // 取得所有轮廓质点
  583. OpenCvSharp.Moments moments = new OpenCvSharp.Moments(contours[i], false);
  584. if (!double.IsNaN(moments.M10 / moments.M00) && !double.IsNaN(moments.M01 / moments.M00))
  585. keyValuePairs[0].Add(new Point2d(moments.M10 / moments.M00, moments.M01 / moments.M00), thisAspectRatio);
  586. }
  587. }
  588. }
  589. int count;
  590. if (keyValuePairs.Count > 0)
  591. {
  592. foreach (var item1 in keyValuePairs[0])
  593. {
  594. count = 0;
  595. foreach (var item2 in keyValuePairs[0])
  596. {
  597. if (item2.Value[0] < item1.Value[0])
  598. count++;
  599. }
  600. foreach (var item3 in keyValuePairs[0])
  601. {
  602. if (item3.Value[1] == count + 1)
  603. count++;
  604. }
  605. item1.Value[1] = count + 1;
  606. }
  607. }
  608. }
  609. }
  610. /// <summary>
  611. /// 刷新结果数据
  612. /// </summary>
  613. private void RefrashResultData()
  614. {
  615. this.dataGridView1.Rows.Clear();
  616. this.dataGridView3.Rows.Clear();
  617. int viewCount = 0;
  618. this.dataGridViewRowsGraphic = new List<DataGridViewRow>();
  619. this.dataGridViewRowsMatrix = new List<DataGridViewRow>();
  620. // 巨砾
  621. double bouldersArea = 0;
  622. // 粗砾
  623. double coarseGravelArea = 0;
  624. // 中砾
  625. double mediuGravelArea = 0;
  626. // 细砾
  627. double fineGravelArea = 0;
  628. // 巨砂
  629. double giantSandArea = 0;
  630. // 粗砂
  631. double coarseSandArea = 0;
  632. // 中砂
  633. double mediumSandArea = 0;
  634. // 细砂
  635. double fineSandArea = 0;
  636. // 极细砂
  637. double superfineSandArea = 0;
  638. // 粗粉砂
  639. double coarseSiltArea = 0;
  640. // 细粉砂
  641. double fineSiltArea = 0;
  642. // 粘土
  643. double clayArea = 0;
  644. // 总和
  645. double allArea = 0;
  646. // 巨砾
  647. List<double> bouldersFais;
  648. // 粗砾
  649. List<double> coarseGravelFais;
  650. // 中砾
  651. List<double> mediuGravelFais;
  652. // 细砾
  653. List<double> fineGravelFais;
  654. // 巨砂
  655. List<double> giantSandFais;
  656. // 粗砂
  657. List<double> coarseSandFais;
  658. // 中砂
  659. List<double> mediumSandFais;
  660. // 细砂
  661. List<double> fineSandFais;
  662. // 极细砂
  663. List<double> superfineSandFais;
  664. // 粗粉砂
  665. List<double> coarseSiltFais;
  666. // 细粉砂
  667. List<double> fineSiltFais;
  668. // 粘土
  669. List<double> clayFais;
  670. foreach (var keyValuePair in keyValuePairs)
  671. {
  672. // 巨砾
  673. bouldersArea = 0;
  674. // 粗砾
  675. coarseGravelArea = 0;
  676. // 中砾
  677. mediuGravelArea = 0;
  678. // 细砾
  679. fineGravelArea = 0;
  680. // 巨砂
  681. giantSandArea = 0;
  682. // 粗砂
  683. coarseSandArea = 0;
  684. // 中砂
  685. mediumSandArea = 0;
  686. // 细砂
  687. fineSandArea = 0;
  688. // 极细砂
  689. superfineSandArea = 0;
  690. // 粗粉砂
  691. coarseSiltArea = 0;
  692. // 细粉砂
  693. fineSiltArea = 0;
  694. // 粘土
  695. clayArea = 0;
  696. // 总和
  697. allArea = 0;
  698. // 巨砾
  699. bouldersFais = new List<double>();
  700. // 粗砾
  701. coarseGravelFais = new List<double>();
  702. // 中砾
  703. mediuGravelFais = new List<double>();
  704. // 细砾
  705. fineGravelFais = new List<double>();
  706. // 巨砂
  707. giantSandFais = new List<double>();
  708. // 粗砂
  709. coarseSandFais = new List<double>();
  710. // 中砂
  711. mediumSandFais = new List<double>();
  712. // 细砂
  713. fineSandFais = new List<double>();
  714. // 极细砂
  715. superfineSandFais = new List<double>();
  716. // 粗粉砂
  717. coarseSiltFais = new List<double>();
  718. // 细粉砂
  719. fineSiltFais = new List<double>();
  720. // 粘土
  721. clayFais = new List<double>();
  722. foreach (var item in keyValuePair)
  723. {
  724. DataGridViewRow dgvr = new DataGridViewRow();
  725. foreach (DataGridViewColumn Column in this.dataGridView1.Columns)
  726. {
  727. dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
  728. }
  729. dgvr.Cells[0].Value = PdnResources.GetString("Menu.view.text") + viewCount;
  730. dgvr.Cells[1].Value = item.Value[1];
  731. dgvr.Cells[2].Value = Math.Round(item.Value[0], Convert.ToInt32(this.numericUpDown1.Value));
  732. if(item.Value[0] == 0)
  733. dgvr.Cells[3].Value = 0;
  734. else
  735. if(this.checkBox1.Checked)
  736. dgvr.Cells[3].Value = Math.Round(0.3815 + 0.9027 * -Math.Log((double)item.Value[0], 2), Convert.ToInt32(this.numericUpDown1.Value));
  737. else
  738. dgvr.Cells[3].Value = Math.Round(-Math.Log((double)item.Value[0], 2), Convert.ToInt32(this.numericUpDown1.Value));
  739. this.dataGridView1.Rows.Add(dgvr);
  740. dgvr = new DataGridViewRow();
  741. foreach (DataGridViewColumn Column in dataGridView3.Columns)
  742. {
  743. dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
  744. }
  745. dgvr.Cells[0].Value = PdnResources.GetString("Menu.view.text") + viewCount;
  746. dgvr.Cells[1].Value = item.Value[1];
  747. dgvr.Cells[2].Value = item.Value[0];
  748. if (item.Value[0] == 0)
  749. dgvr.Cells[3].Value = 0;
  750. else
  751. {
  752. if(this.checkBox1.Checked)
  753. dgvr.Cells[3].Value = 0.3815 + 0.9027 * -Math.Log((double)item.Value[0], 2);
  754. else
  755. dgvr.Cells[3].Value = -Math.Log((double)item.Value[0], 2);
  756. }
  757. dataGridView3.Rows.Add(dgvr);
  758. allArea += item.Value[2];
  759. // 巨砾
  760. if (item.Value[0] > 256)
  761. {
  762. bouldersArea += item.Value[2];
  763. if (this.checkBox1.Checked)
  764. bouldersFais.Add(0.3815 + 0.9027 * -Math.Log((double)item.Value[0], 2));
  765. else
  766. bouldersFais.Add(-Math.Log((double)item.Value[0], 2));
  767. }
  768. // 粗砾
  769. if (item.Value[0] > 64 && item.Value[0] <= 256)
  770. {
  771. coarseGravelArea += item.Value[2];
  772. if (this.checkBox1.Checked)
  773. coarseGravelFais.Add(0.3815 + 0.9027 * -Math.Log((double)item.Value[0], 2));
  774. else
  775. coarseGravelFais.Add(-Math.Log((double)item.Value[0], 2));
  776. }
  777. // 中砾
  778. if (item.Value[0] > 4 && item.Value[0] <= 64)
  779. {
  780. mediuGravelArea += item.Value[2];
  781. if (this.checkBox1.Checked)
  782. mediuGravelFais.Add(0.3815 + 0.9027 * -Math.Log((double)item.Value[0], 2));
  783. else
  784. mediuGravelFais.Add(-Math.Log((double)item.Value[0], 2));
  785. }
  786. // 细砾
  787. if (item.Value[0] > 2 && item.Value[0] <= 4)
  788. {
  789. fineGravelArea += item.Value[2];
  790. if (this.checkBox1.Checked)
  791. fineGravelFais.Add(0.3815 + 0.9027 * -Math.Log((double)item.Value[0], 2));
  792. else
  793. fineGravelFais.Add(-Math.Log((double)item.Value[0], 2));
  794. }
  795. // 巨砂
  796. if (item.Value[0] > 1 && item.Value[0] <= 2)
  797. {
  798. giantSandArea += item.Value[2];
  799. if (this.checkBox1.Checked)
  800. giantSandFais.Add(0.3815 + 0.9027 * -Math.Log((double)item.Value[0], 2));
  801. else
  802. giantSandFais.Add(-Math.Log((double)item.Value[0], 2));
  803. }
  804. // 粗砂
  805. if (Convert.ToDouble(item.Value[0]) > 0.5 && item.Value[0] <= 1)
  806. {
  807. coarseSandArea += item.Value[2];
  808. if (this.checkBox1.Checked)
  809. coarseSandFais.Add(0.3815 + 0.9027 * -Math.Log((double)item.Value[0], 2));
  810. else
  811. coarseSandFais.Add(-Math.Log((double)item.Value[0], 2));
  812. }
  813. // 中砂
  814. if (Convert.ToDouble(item.Value[0]) > 0.25 && Convert.ToDouble(item.Value[0]) <= 0.5)
  815. {
  816. mediumSandArea += item.Value[2];
  817. if (this.checkBox1.Checked)
  818. mediumSandFais.Add(0.3815 + 0.9027 * -Math.Log((double)item.Value[0], 2));
  819. else
  820. mediumSandFais.Add(-Math.Log((double)item.Value[0], 2));
  821. }
  822. // 细砂
  823. if (Convert.ToDouble(item.Value[0]) > 0.125 && Convert.ToDouble(item.Value[0]) <= 0.25)
  824. {
  825. fineSandArea += item.Value[2];
  826. if (this.checkBox1.Checked)
  827. fineSandFais.Add(0.3815 + 0.9027 * -Math.Log((double)item.Value[0], 2));
  828. else
  829. fineSandFais.Add(-Math.Log((double)item.Value[0], 2));
  830. }
  831. // 极细砂
  832. if (Convert.ToDouble(item.Value[0]) > 0.0625 && Convert.ToDouble(item.Value[0]) <= 0.125)
  833. {
  834. superfineSandArea += item.Value[2];
  835. if (this.checkBox1.Checked)
  836. superfineSandFais.Add(0.3815 + 0.9027 * -Math.Log((double)item.Value[0], 2));
  837. else
  838. superfineSandFais.Add(-Math.Log((double)item.Value[0], 2));
  839. }
  840. // 粗粉砂
  841. if (Convert.ToDouble(item.Value[0]) > 0.0312 && Convert.ToDouble(item.Value[0]) <= 0.0625)
  842. {
  843. coarseSiltArea += item.Value[2];
  844. if (this.checkBox1.Checked)
  845. coarseSiltFais.Add(0.3815 + 0.9027 * -Math.Log((double)item.Value[0], 2));
  846. else
  847. coarseSiltFais.Add(-Math.Log((double)item.Value[0], 2));
  848. }
  849. // 细粉砂
  850. if (Convert.ToDouble(item.Value[0]) > 0.0039 && Convert.ToDouble(item.Value[0]) <= 0.0312)
  851. {
  852. fineSiltArea += item.Value[2];
  853. if (this.checkBox1.Checked)
  854. fineSiltFais.Add(0.3815 + 0.9027 * -Math.Log((double)item.Value[0], 2));
  855. else
  856. fineSiltFais.Add(-Math.Log((double)item.Value[0], 2));
  857. }
  858. // 粘土
  859. if (Convert.ToDouble(item.Value[0]) <= 0.0039)
  860. {
  861. clayArea += item.Value[2];
  862. if (this.checkBox1.Checked)
  863. clayFais.Add(0.3815 + 0.9027 * -Math.Log((double)item.Value[0], 2));
  864. else
  865. clayFais.Add(-Math.Log((double)item.Value[0], 2));
  866. }
  867. }
  868. //
  869. // 图解法
  870. //
  871. dataGridView3.Sort(dataGridView3.Columns[1], ListSortDirection.Descending);
  872. int count = dataGridView3.Rows.Count;
  873. double count5 = count * 0.05;
  874. double count16 = count * 0.16;
  875. double count25 = count * 0.25;
  876. double count50 = count * 0.5;
  877. double count75 = count * 0.75;
  878. double count84 = count * 0.84;
  879. double count95 = count * 0.95;
  880. double fai5 = 0;
  881. double fai16 = 0;
  882. double fai25 = 0;
  883. double fai50 = 0;
  884. double fai75 = 0;
  885. double fai84 = 0;
  886. double fai95 = 0;
  887. foreach (DataGridViewRow dataGridViewRow in dataGridView3.Rows)
  888. {
  889. if (Convert.ToDouble(dataGridViewRow.Index + 1)== Convert.ToInt32(count5))
  890. {
  891. if(dataGridViewRow.Cells[3].Value.ToString().Equals("0"))
  892. fai5 = 0;
  893. else
  894. fai5 = Convert.ToDouble(dataGridViewRow.Cells[3].Value);
  895. }
  896. if (Convert.ToDouble(dataGridViewRow.Index + 1) == Convert.ToInt32(count16))
  897. {
  898. if (dataGridViewRow.Cells[3].Value.ToString().Equals("0"))
  899. fai16 = 0;
  900. else
  901. fai16 = Convert.ToDouble(dataGridViewRow.Cells[3].Value);
  902. }
  903. if (Convert.ToDouble(dataGridViewRow.Index + 1) == Convert.ToInt32(count25))
  904. {
  905. if (dataGridViewRow.Cells[3].Value.ToString().Equals("0"))
  906. fai25 = 0;
  907. else
  908. fai25 = Convert.ToDouble(dataGridViewRow.Cells[3].Value);
  909. }
  910. if (Convert.ToDouble(dataGridViewRow.Index + 1) == Convert.ToInt32(count50))
  911. {
  912. if (dataGridViewRow.Cells[3].Value.ToString().Equals("0"))
  913. fai50 = 0;
  914. else
  915. fai50 = Convert.ToDouble(dataGridViewRow.Cells[3].Value);
  916. }
  917. if (Convert.ToDouble(dataGridViewRow.Index + 1) == Convert.ToInt32(count75))
  918. {
  919. if (dataGridViewRow.Cells[3].Value.ToString().Equals("0"))
  920. fai75 = 0;
  921. else
  922. fai75 = Convert.ToDouble(dataGridViewRow.Cells[3].Value);
  923. }
  924. if (Convert.ToDouble(dataGridViewRow.Index + 1) == Convert.ToInt32(count84))
  925. {
  926. if (dataGridViewRow.Cells[3].Value.ToString().Equals("0"))
  927. fai84 = 0;
  928. else
  929. fai84 = Convert.ToDouble(dataGridViewRow.Cells[3].Value);
  930. }
  931. if (Convert.ToDouble(dataGridViewRow.Index + 1) == Convert.ToInt32(count95))
  932. {
  933. if (dataGridViewRow.Cells[3].Value.ToString().Equals("0"))
  934. fai95 = 0;
  935. else
  936. fai95 = Convert.ToDouble(dataGridViewRow.Cells[3].Value);
  937. }
  938. }
  939. DataGridViewRow dataGridViewRow1 = new DataGridViewRow();
  940. foreach (DataGridViewColumn c in this.dataGridView2.Columns)
  941. {
  942. dataGridViewRow1.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  943. }
  944. dataGridViewRow1.Cells[0].Value = PdnResources.GetString("Menu.Graphicalmethod.text");
  945. dataGridViewRow1.Cells[1].Value = (fai16 + fai50 + fai84) / 3;
  946. dataGridViewRow1.Cells[2].Value = (fai84 - fai16) / 4 + (fai95 - fai5) / 6.6;
  947. dataGridViewRow1.Cells[3].Value = (fai16 + fai84 - 2 * fai50) / (2 * (fai84 - fai16)) + (fai5 + fai95 - 2 * fai50) / (2 * (fai95 - fai5));
  948. dataGridViewRow1.Cells[4].Value = (fai95 - fai5) / (2.44 * (fai75 - fai25));
  949. dataGridViewRow1.Cells[5].Value = PdnResources.GetString("Menu.Rocknamed.text");
  950. dataGridViewRow1.Cells[6].Value = fai5;
  951. dataGridViewRow1.Cells[7].Value = fai16;
  952. dataGridViewRow1.Cells[8].Value = fai25;
  953. dataGridViewRow1.Cells[9].Value = fai50;
  954. dataGridViewRow1.Cells[10].Value = fai75;
  955. dataGridViewRow1.Cells[11].Value = fai84;
  956. dataGridViewRow1.Cells[12].Value = fai95;
  957. this.dataGridViewRowsGraphic.Add(dataGridViewRow1);
  958. //
  959. // 矩阵法
  960. //
  961. //组值排序
  962. bouldersFais.Sort();
  963. coarseGravelFais.Sort();
  964. mediuGravelFais.Sort();
  965. fineGravelFais.Sort();
  966. giantSandFais.Sort();
  967. coarseSandFais.Sort();
  968. mediumSandFais.Sort();
  969. fineSandFais.Sort();
  970. superfineSandFais.Sort();
  971. coarseSiltFais.Sort();
  972. fineSiltFais.Sort();
  973. clayFais.Sort();
  974. // 组中值
  975. // 巨砾
  976. double medianBoulders = 0;
  977. // 粗砾
  978. double medianCoarseGravel = 0;
  979. // 中砾
  980. double medianMediuGravel = 0;
  981. // 细砾
  982. double medianFineGravel = 0;
  983. // 巨砂
  984. double medianGiantSand = 0;
  985. // 粗砂
  986. double medianCoarseSand = 0;
  987. // 中砂
  988. double medianMediumSand = 0;
  989. // 细砂
  990. double medianFineSand = 0;
  991. // 极细砂
  992. double medianSuperfineSand = 0;
  993. // 粗粉砂
  994. double medianCoarseSilt = 0;
  995. // 细粉砂
  996. double medianFineSilt = 0;
  997. // 粘土
  998. double medianClay = 0;
  999. if(bouldersFais.Count > 0)
  1000. {
  1001. if (bouldersFais.Count % 2 == 0)
  1002. medianBoulders = (bouldersFais[bouldersFais.Count / 2 - 1] + bouldersFais[bouldersFais.Count / 2]) / 2;
  1003. else
  1004. medianBoulders = bouldersFais[(bouldersFais.Count - 1) / 2];
  1005. }
  1006. if (coarseGravelFais.Count > 0)
  1007. {
  1008. if (coarseGravelFais.Count % 2 == 0)
  1009. medianCoarseGravel = (coarseGravelFais[coarseGravelFais.Count / 2 - 1] + coarseGravelFais[coarseGravelFais.Count / 2]) / 2;
  1010. else
  1011. medianCoarseGravel = coarseGravelFais[(coarseGravelFais.Count - 1) / 2];
  1012. }
  1013. if (mediuGravelFais.Count > 0)
  1014. {
  1015. if (mediuGravelFais.Count % 2 == 0)
  1016. medianMediuGravel = (mediuGravelFais[mediuGravelFais.Count / 2 - 1] + mediuGravelFais[mediuGravelFais.Count / 2]) / 2;
  1017. else
  1018. medianMediuGravel = mediuGravelFais[(mediuGravelFais.Count - 1) / 2];
  1019. }
  1020. if (fineGravelFais.Count > 0)
  1021. {
  1022. if (fineGravelFais.Count % 2 == 0)
  1023. medianFineGravel = (fineGravelFais[fineGravelFais.Count / 2 - 1] + fineGravelFais[fineGravelFais.Count / 2]) / 2;
  1024. else
  1025. medianFineGravel = fineGravelFais[(fineGravelFais.Count - 1) / 2];
  1026. }
  1027. if (giantSandFais.Count > 0)
  1028. {
  1029. if (giantSandFais.Count % 2 == 0)
  1030. medianGiantSand = (giantSandFais[giantSandFais.Count / 2 - 1] + giantSandFais[giantSandFais.Count / 2]) / 2;
  1031. else
  1032. medianGiantSand = giantSandFais[(giantSandFais.Count - 1) / 2];
  1033. }
  1034. if (coarseSandFais.Count > 0)
  1035. {
  1036. if (coarseSandFais.Count % 2 == 0)
  1037. medianCoarseSand = (coarseSandFais[coarseSandFais.Count / 2 - 1] + coarseSandFais[coarseSandFais.Count / 2]) / 2;
  1038. else
  1039. medianCoarseSand = coarseSandFais[(coarseSandFais.Count - 1) / 2];
  1040. }
  1041. if (mediumSandFais.Count > 0)
  1042. {
  1043. if (mediumSandFais.Count % 2 == 0)
  1044. medianMediumSand = (mediumSandFais[mediumSandFais.Count / 2 - 1] + mediumSandFais[mediumSandFais.Count / 2]) / 2;
  1045. else
  1046. medianMediumSand = mediumSandFais[(mediumSandFais.Count - 1) / 2];
  1047. }
  1048. if (fineSandFais.Count > 0)
  1049. {
  1050. if (fineSandFais.Count % 2 == 0)
  1051. medianFineSand = (fineSandFais[fineSandFais.Count / 2 - 1] + fineSandFais[fineSandFais.Count / 2]) / 2;
  1052. else
  1053. medianFineSand = fineSandFais[(fineSandFais.Count - 1) / 2];
  1054. }
  1055. if (superfineSandFais.Count > 0)
  1056. {
  1057. if (superfineSandFais.Count % 2 == 0)
  1058. medianSuperfineSand = (superfineSandFais[superfineSandFais.Count / 2 - 1] + superfineSandFais[superfineSandFais.Count / 2]) / 2;
  1059. else
  1060. medianSuperfineSand = superfineSandFais[(superfineSandFais.Count - 1) / 2];
  1061. }
  1062. if (coarseSiltFais.Count > 0)
  1063. {
  1064. if (coarseSiltFais.Count % 2 == 0)
  1065. medianCoarseSilt = (coarseSiltFais[coarseSiltFais.Count / 2 - 1] + coarseSiltFais[coarseSiltFais.Count / 2]) / 2;
  1066. else
  1067. medianCoarseSilt = coarseSiltFais[(coarseSiltFais.Count - 1) / 2];
  1068. }
  1069. if (fineSiltFais.Count > 0)
  1070. {
  1071. if (fineSiltFais.Count % 2 == 0)
  1072. medianFineSilt = (fineSiltFais[fineSiltFais.Count / 2 - 1] + fineSiltFais[fineSiltFais.Count / 2]) / 2;
  1073. else
  1074. medianFineSilt = fineSiltFais[(fineSiltFais.Count - 1) / 2];
  1075. }
  1076. if (clayFais.Count > 0)
  1077. {
  1078. if (clayFais.Count % 2 == 0)
  1079. medianClay = (clayFais[clayFais.Count / 2 - 1] + clayFais[clayFais.Count / 2]) / 2;
  1080. else
  1081. medianClay = clayFais[(clayFais.Count - 1) / 2];
  1082. }
  1083. // 组面积频率
  1084. // 巨砾
  1085. double fiBoulders = bouldersArea / allArea;
  1086. // 粗砾
  1087. double fiCoarseGravel = coarseGravelArea / allArea;
  1088. // 中砾
  1089. double fiMediuGravel = mediuGravelArea / allArea;
  1090. // 细砾
  1091. double fiFineGravel = fineGravelArea / allArea;
  1092. // 巨砂
  1093. double fiGiantSand = giantSandArea / allArea;
  1094. // 粗砂
  1095. double fiCoarseSand = coarseSandArea / allArea;
  1096. // 中砂
  1097. double fiMediumSand = mediumSandArea / allArea;
  1098. // 细砂
  1099. double fiFineSand = fineSandArea / allArea;
  1100. // 极细砂
  1101. double fiSuperfineSand = superfineSandArea / allArea;
  1102. // 粗粉砂
  1103. double fiCoarseSilt = coarseSiltArea / allArea;
  1104. // 细粉砂
  1105. double fiFineSilt = fineSiltArea / allArea;
  1106. // 粘土
  1107. double fiClay = clayArea / allArea;
  1108. // 平均值
  1109. double mz = (fiBoulders * medianBoulders + fiCoarseGravel * medianCoarseGravel + fiMediuGravel * medianCoarseGravel
  1110. + fiFineGravel * medianFineGravel + fiGiantSand * medianGiantSand + fiCoarseSand * medianCoarseSand + fiMediumSand * medianMediumSand
  1111. + fiFineSand * medianFineSand + fiSuperfineSand * medianSuperfineSand + fiCoarseSilt * medianCoarseSilt + fiFineSilt * medianFineSilt
  1112. + fiClay * medianClay) / 100;
  1113. // 标准偏差
  1114. double a1 = Math.Sqrt((fiBoulders * Math.Pow((medianBoulders - mz), 2) + fiCoarseGravel * Math.Pow((medianCoarseGravel - mz), 2)
  1115. + fiMediuGravel * Math.Pow((medianMediuGravel - mz), 2) + fiFineGravel * Math.Pow((medianFineGravel - mz), 2)
  1116. + fiGiantSand * Math.Pow((medianGiantSand - mz), 2) + fiCoarseSand * Math.Pow((medianCoarseSand - mz), 2)
  1117. + fiMediumSand * Math.Pow((medianMediumSand - mz), 2) + fiFineSand * Math.Pow((medianFineSand - mz), 2)
  1118. + fiSuperfineSand * Math.Pow((medianSuperfineSand - mz), 2) + fiCoarseSilt * Math.Pow((medianCoarseSilt - mz), 2)
  1119. + fiFineSilt * Math.Pow((medianFineSilt - mz), 2) + fiClay * Math.Pow((medianClay - mz), 2)) / 100);
  1120. // 偏度
  1121. double sk1 = (fiBoulders * Math.Pow((medianBoulders - mz), 3) + fiCoarseGravel * Math.Pow((medianCoarseGravel - mz), 3)
  1122. + fiMediuGravel * Math.Pow((medianMediuGravel - mz), 3) + fiFineGravel * Math.Pow((medianFineGravel - mz), 3)
  1123. + fiGiantSand * Math.Pow((medianGiantSand - mz), 3) + fiCoarseSand * Math.Pow((medianCoarseSand - mz), 3)
  1124. + fiMediumSand * Math.Pow((medianMediumSand - mz), 3) + fiFineSand * Math.Pow((medianFineSand - mz), 3)
  1125. + fiSuperfineSand * Math.Pow((medianSuperfineSand - mz), 3) + fiCoarseSilt * Math.Pow((medianCoarseSilt - mz), 3)
  1126. + fiFineSilt * Math.Pow((medianFineSilt - mz), 3) + fiClay * Math.Pow((medianClay - mz), 3)) / (100 * Math.Pow(a1, 3));
  1127. // 峰度
  1128. double kg = (fiBoulders * Math.Pow((medianBoulders - mz), 4) + fiCoarseGravel * Math.Pow((medianCoarseGravel - mz), 4)
  1129. + fiMediuGravel * Math.Pow((medianMediuGravel - mz), 4) + fiFineGravel * Math.Pow((medianFineGravel - mz), 4)
  1130. + fiGiantSand * Math.Pow((medianGiantSand - mz), 4) + fiCoarseSand * Math.Pow((medianCoarseSand - mz), 4)
  1131. + fiMediumSand * Math.Pow((medianMediumSand - mz), 4) + fiFineSand * Math.Pow((medianFineSand - mz), 4)
  1132. + fiSuperfineSand * Math.Pow((medianSuperfineSand - mz), 4) + fiCoarseSilt * Math.Pow((medianCoarseSilt - mz), 4)
  1133. + fiFineSilt * Math.Pow((medianFineSilt - mz), 4) + fiClay * Math.Pow((medianClay - mz), 4)) / (100 * Math.Pow(a1, 4));
  1134. DataGridViewRow dataGridViewRow2 = new DataGridViewRow();
  1135. foreach (DataGridViewColumn c in this.dataGridView2.Columns)
  1136. {
  1137. dataGridViewRow2.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  1138. }
  1139. dataGridViewRow2.Cells[0].Value = PdnResources.GetString("Menu.Matrixmethod.text");
  1140. dataGridViewRow2.Cells[1].Value = mz;
  1141. dataGridViewRow2.Cells[2].Value = a1;
  1142. dataGridViewRow2.Cells[3].Value = sk1;
  1143. dataGridViewRow2.Cells[4].Value = kg;
  1144. dataGridViewRow2.Cells[5].Value = PdnResources.GetString("Menu.Rocknamed.text");
  1145. dataGridViewRow2.Cells[6].Value = "-";
  1146. dataGridViewRow2.Cells[7].Value = "-";
  1147. dataGridViewRow2.Cells[8].Value = "-";
  1148. dataGridViewRow2.Cells[9].Value = "-";
  1149. dataGridViewRow2.Cells[10].Value = "-";
  1150. dataGridViewRow2.Cells[11].Value = "-";
  1151. dataGridViewRow2.Cells[12].Value = "-";
  1152. this.dataGridViewRowsMatrix.Add(dataGridViewRow2);
  1153. viewCount++;
  1154. }
  1155. this.dataGridView1.Sort(this.dataGridView1.Columns[1], ListSortDirection.Ascending);
  1156. }
  1157. #region 初始化
  1158. private void InitializeLanguageText()
  1159. {
  1160. this.bc = new PaintDotNet.CustomControl.BinaryControl();
  1161. //
  1162. // bc
  1163. //
  1164. this.bc.BinaryBackColor = System.Drawing.Color.Red;
  1165. this.bc.BinaryChecked = false;
  1166. this.bc.BinaryStyle = 1;
  1167. this.bc.Location = new System.Drawing.Point(155, 68);
  1168. this.bc.Name = "bc";
  1169. this.bc.OriginChecked = false;
  1170. this.bc.scope1End = 0D;
  1171. this.bc.scope1Start = 0D;
  1172. this.bc.scope2End = 0D;
  1173. this.bc.scope2Start = 0D;
  1174. this.bc.scope3End = 0D;
  1175. this.bc.scope3Start = 0D;
  1176. this.bc.Size = new System.Drawing.Size(360, 292);
  1177. this.bc.TabIndex = 19;
  1178. this.Controls.Add(this.bc);
  1179. this.Controls.SetChildIndex(this.bc, 0);
  1180. this.groupBox1.Text = PdnResources.GetString("Menu.operation.text");
  1181. this.button2.Text = PdnResources.GetString("Menu.Saveresult.text");
  1182. this.checkBox2.Text = PdnResources.GetString("Menu.Opensettingsatingreport.text");
  1183. this.button1.Text = PdnResources.GetString("Menu.Setting.Text");
  1184. this.groupBox2.Text = PdnResources.GetString("Menu.Tools.ImageIndex.Text");
  1185. this.groupBox7.Text = PdnResources.GetString("Menu.Preview.text");
  1186. this.groupBox3.Text = PdnResources.GetString("Menu.paramssettings.text");
  1187. this.checkBox4.Text = PdnResources.GetString("Menu.Matrixmethod.text");
  1188. this.checkBox3.Text = PdnResources.GetString("Menu.Graphicalmethod.text");
  1189. this.checkBox1.Text = PdnResources.GetString("Menu.Sieveanalysiscorrection.text");
  1190. this.groupBox4.Text = PdnResources.GetString("Menu.displaysetting.text");
  1191. this.label4.Text = PdnResources.GetString("Menu.color.text") + ":";
  1192. this.label3.Text = PdnResources.GetString("Menu.color.text") + ":";
  1193. this.label2.Text = PdnResources.GetString("Menu.Fontsize.text") + ":";
  1194. this.label1.Text = PdnResources.GetString("Menu.Fontsize.text") + ":";
  1195. this.checkBox6.Text = PdnResources.GetString("Menu.Displayparticlediameter.text");
  1196. this.checkBox5.Text = PdnResources.GetString("Menu.Displayparticlenumber.text");
  1197. this.groupBox5.Text = PdnResources.GetString("Menu.Theesultshow.text");
  1198. this.dataGridViewTextBoxColumn9.HeaderText = PdnResources.GetString("Menu.view.text");
  1199. this.dataGridViewTextBoxColumn10.HeaderText = PdnResources.GetString("Menu.Dedicatedanalysis.Non-ferrousmetals.serialnumber.text");
  1200. this.dataGridViewTextBoxColumn11.HeaderText = PdnResources.GetString("Menu.diameter.text");
  1201. this.dataGridViewTextBoxColumn12.HeaderText = "Φ" + PdnResources.GetString("Menu.Imagement.Measurementlist.value.text");
  1202. this.dataGridViewTextBoxColumn3.HeaderText = PdnResources.GetString("Menu.Dedicatedanalysis.Non-ferrousmetals.serialnumber.text");
  1203. this.Column11.HeaderText = PdnResources.GetString("Menu.view.text");
  1204. this.dataGridViewTextBoxColumn4.HeaderText = PdnResources.GetString("Menu.diameter.text");
  1205. this.dataGridViewTextBoxColumn5.HeaderText = "Φ" + PdnResources.GetString("Menu.Imagement.Measurementlist.value.text");
  1206. this.groupBox8.Text = PdnResources.GetString("Menu.Analysisresult.text");
  1207. this.dataGridViewTextBoxColumn1.HeaderText = PdnResources.GetString("Menu.Methodnames.text");
  1208. this.dataGridViewTextBoxColumn2.HeaderText = PdnResources.GetString("Menu.averagevalue.text");
  1209. this.dataGridViewTextBoxColumn6.HeaderText = PdnResources.GetString("Menu.standarddeviation.text");
  1210. this.dataGridViewTextBoxColumn7.HeaderText = PdnResources.GetString("Menu.Partialdegrees.text");
  1211. this.dataGridViewTextBoxColumn8.HeaderText = PdnResources.GetString("Menu.kurtosis.text");
  1212. this.Column4.HeaderText = PdnResources.GetString("Menu.Rocknamed.text");
  1213. this.button4.Text = PdnResources.GetString("Menu.Exportproject.text");
  1214. this.button16.Text = PdnResources.GetString("Menu.Cancelshowall.text");
  1215. this.label5.Text = PdnResources.GetString("Menu.Decimal.text") + ":";
  1216. this.button14.Text = PdnResources.GetString("Menu.Exportresults.text");
  1217. this.button13.Text = PdnResources.GetString("Menu.Tools.CreateReport.Text");
  1218. this.Column1.HeaderText = PdnResources.GetString("Menu.picture.Text");
  1219. this.Column2.HeaderText = PdnResources.GetString("Menu.view.text");
  1220. this.Column5.HeaderText = PdnResources.GetString("Menu.Categories.text");
  1221. this.Column6.HeaderText = PdnResources.GetString("Menu.Smallclass.text");
  1222. this.Column7.HeaderText = PdnResources.GetString("Menu.Number.text");
  1223. this.Column3.HeaderText = PdnResources.GetString("Menu.percent.text");
  1224. this.button12.Text = PdnResources.GetString("Menu.Edit.Delete.Text");
  1225. this.button11.Text = PdnResources.GetString("Menu.Showall.text");
  1226. this.Text = PdnResources.GetString("Menu.Clastiparticlesizeanalysismethod.text");
  1227. this.button3.Text = PdnResources.GetString("Menu.File.SaveAll.Text");
  1228. this.button5.Text = PdnResources.GetString("Menu.Applyall.text");
  1229. }
  1230. private void InitializeComponent()
  1231. {
  1232. this.components = new System.ComponentModel.Container();
  1233. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
  1234. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
  1235. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
  1236. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
  1237. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
  1238. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
  1239. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
  1240. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
  1241. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle();
  1242. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle();
  1243. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle();
  1244. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle();
  1245. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle();
  1246. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle();
  1247. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle();
  1248. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle16 = new System.Windows.Forms.DataGridViewCellStyle();
  1249. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle17 = new System.Windows.Forms.DataGridViewCellStyle();
  1250. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle18 = new System.Windows.Forms.DataGridViewCellStyle();
  1251. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle19 = new System.Windows.Forms.DataGridViewCellStyle();
  1252. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle20 = new System.Windows.Forms.DataGridViewCellStyle();
  1253. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle21 = new System.Windows.Forms.DataGridViewCellStyle();
  1254. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle22 = new System.Windows.Forms.DataGridViewCellStyle();
  1255. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle23 = new System.Windows.Forms.DataGridViewCellStyle();
  1256. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle24 = new System.Windows.Forms.DataGridViewCellStyle();
  1257. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle25 = new System.Windows.Forms.DataGridViewCellStyle();
  1258. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle26 = new System.Windows.Forms.DataGridViewCellStyle();
  1259. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle27 = new System.Windows.Forms.DataGridViewCellStyle();
  1260. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle28 = new System.Windows.Forms.DataGridViewCellStyle();
  1261. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle29 = new System.Windows.Forms.DataGridViewCellStyle();
  1262. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle30 = new System.Windows.Forms.DataGridViewCellStyle();
  1263. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle31 = new System.Windows.Forms.DataGridViewCellStyle();
  1264. this.groupBox1 = new System.Windows.Forms.GroupBox();
  1265. this.button3 = new System.Windows.Forms.Button();
  1266. this.button5 = new System.Windows.Forms.Button();
  1267. this.button2 = new System.Windows.Forms.Button();
  1268. this.checkBox2 = new System.Windows.Forms.CheckBox();
  1269. this.button1 = new System.Windows.Forms.Button();
  1270. this.groupBox2 = new System.Windows.Forms.GroupBox();
  1271. this.listView1 = new System.Windows.Forms.ListView();
  1272. this.imageList1 = new System.Windows.Forms.ImageList(this.components);
  1273. this.groupBox7 = new System.Windows.Forms.GroupBox();
  1274. this.groupBox3 = new System.Windows.Forms.GroupBox();
  1275. this.checkBox4 = new System.Windows.Forms.CheckBox();
  1276. this.checkBox3 = new System.Windows.Forms.CheckBox();
  1277. this.checkBox1 = new System.Windows.Forms.CheckBox();
  1278. this.groupBox4 = new System.Windows.Forms.GroupBox();
  1279. this.panel2 = new System.Windows.Forms.Panel();
  1280. this.panel1 = new System.Windows.Forms.Panel();
  1281. this.numericUpDown3 = new System.Windows.Forms.NumericUpDown();
  1282. this.numericUpDown2 = new System.Windows.Forms.NumericUpDown();
  1283. this.label4 = new System.Windows.Forms.Label();
  1284. this.label3 = new System.Windows.Forms.Label();
  1285. this.label2 = new System.Windows.Forms.Label();
  1286. this.label1 = new System.Windows.Forms.Label();
  1287. this.checkBox6 = new System.Windows.Forms.CheckBox();
  1288. this.checkBox5 = new System.Windows.Forms.CheckBox();
  1289. this.groupBox5 = new System.Windows.Forms.GroupBox();
  1290. this.dataGridView3 = new System.Windows.Forms.DataGridView();
  1291. this.dataGridViewTextBoxColumn9 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  1292. this.dataGridViewTextBoxColumn10 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  1293. this.dataGridViewTextBoxColumn11 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  1294. this.dataGridViewTextBoxColumn12 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  1295. this.dataGridView1 = new System.Windows.Forms.DataGridView();
  1296. this.Column11 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  1297. this.dataGridViewTextBoxColumn3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  1298. this.dataGridViewTextBoxColumn4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  1299. this.dataGridViewTextBoxColumn5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  1300. this.groupBox8 = new System.Windows.Forms.GroupBox();
  1301. this.dataGridView2 = new System.Windows.Forms.DataGridView();
  1302. this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  1303. this.dataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  1304. this.dataGridViewTextBoxColumn6 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  1305. this.dataGridViewTextBoxColumn7 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  1306. this.dataGridViewTextBoxColumn8 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  1307. this.Column4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  1308. this.Column9 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  1309. this.Column10 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  1310. this.Column8 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  1311. this.Column12 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  1312. this.Column13 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  1313. this.Column14 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  1314. this.Column15 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  1315. this.button4 = new System.Windows.Forms.Button();
  1316. this.listView2 = new System.Windows.Forms.ListView();
  1317. this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
  1318. this.button16 = new System.Windows.Forms.Button();
  1319. this.label5 = new System.Windows.Forms.Label();
  1320. this.button14 = new System.Windows.Forms.Button();
  1321. this.button13 = new System.Windows.Forms.Button();
  1322. this.dataGridView4 = new System.Windows.Forms.DataGridView();
  1323. this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  1324. this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  1325. this.Column5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  1326. this.Column6 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  1327. this.Column7 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  1328. this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  1329. this.button12 = new System.Windows.Forms.Button();
  1330. this.button11 = new System.Windows.Forms.Button();
  1331. this.groupBox1.SuspendLayout();
  1332. this.groupBox2.SuspendLayout();
  1333. this.groupBox3.SuspendLayout();
  1334. this.groupBox4.SuspendLayout();
  1335. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown3)).BeginInit();
  1336. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit();
  1337. this.groupBox5.SuspendLayout();
  1338. ((System.ComponentModel.ISupportInitialize)(this.dataGridView3)).BeginInit();
  1339. ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
  1340. this.groupBox8.SuspendLayout();
  1341. ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).BeginInit();
  1342. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
  1343. ((System.ComponentModel.ISupportInitialize)(this.dataGridView4)).BeginInit();
  1344. this.SuspendLayout();
  1345. //
  1346. // groupBox1
  1347. //
  1348. this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  1349. | System.Windows.Forms.AnchorStyles.Right)));
  1350. this.groupBox1.Controls.Add(this.button3);
  1351. this.groupBox1.Controls.Add(this.button5);
  1352. this.groupBox1.Controls.Add(this.button2);
  1353. this.groupBox1.Controls.Add(this.checkBox2);
  1354. this.groupBox1.Controls.Add(this.button1);
  1355. this.groupBox1.Location = new System.Drawing.Point(14, 12);
  1356. this.groupBox1.Name = "groupBox1";
  1357. this.groupBox1.Size = new System.Drawing.Size(1081, 50);
  1358. this.groupBox1.TabIndex = 6;
  1359. this.groupBox1.TabStop = false;
  1360. //
  1361. // button3
  1362. //
  1363. this.button3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  1364. this.button3.Location = new System.Drawing.Point(991, 12);
  1365. this.button3.Name = "button3";
  1366. this.button3.Size = new System.Drawing.Size(84, 30);
  1367. this.button3.TabIndex = 19;
  1368. this.button3.Text = "保存全部";
  1369. this.button3.UseVisualStyleBackColor = false;
  1370. this.button3.Click += new System.EventHandler(this.button3_Click);
  1371. //
  1372. // button5
  1373. //
  1374. this.button5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  1375. this.button5.Location = new System.Drawing.Point(811, 12);
  1376. this.button5.Name = "button5";
  1377. this.button5.Size = new System.Drawing.Size(84, 30);
  1378. this.button5.TabIndex = 18;
  1379. this.button5.Text = "应用全部";
  1380. this.button5.UseVisualStyleBackColor = false;
  1381. this.button5.Click += new System.EventHandler(this.button5_Click);
  1382. //
  1383. // button2
  1384. //
  1385. this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  1386. this.button2.BackColor = System.Drawing.SystemColors.Control;
  1387. this.button2.Location = new System.Drawing.Point(901, 12);
  1388. this.button2.Name = "button2";
  1389. this.button2.Size = new System.Drawing.Size(84, 30);
  1390. this.button2.TabIndex = 3;
  1391. this.button2.UseVisualStyleBackColor = false;
  1392. this.button2.Click += new System.EventHandler(this.button2_Click);
  1393. //
  1394. // checkBox2
  1395. //
  1396. this.checkBox2.AutoSize = true;
  1397. this.checkBox2.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
  1398. this.checkBox2.Location = new System.Drawing.Point(105, 20);
  1399. this.checkBox2.Name = "checkBox2";
  1400. this.checkBox2.Size = new System.Drawing.Size(15, 14);
  1401. this.checkBox2.TabIndex = 2;
  1402. this.checkBox2.UseVisualStyleBackColor = true;
  1403. //
  1404. // button1
  1405. //
  1406. this.button1.BackColor = System.Drawing.SystemColors.Control;
  1407. this.button1.Location = new System.Drawing.Point(15, 14);
  1408. this.button1.Name = "button1";
  1409. this.button1.Size = new System.Drawing.Size(84, 30);
  1410. this.button1.TabIndex = 0;
  1411. this.button1.UseVisualStyleBackColor = false;
  1412. this.button1.Click += new System.EventHandler(this.button1_Click);
  1413. //
  1414. // groupBox2
  1415. //
  1416. this.groupBox2.Controls.Add(this.listView1);
  1417. this.groupBox2.Location = new System.Drawing.Point(14, 68);
  1418. this.groupBox2.Name = "groupBox2";
  1419. this.groupBox2.Size = new System.Drawing.Size(135, 574);
  1420. this.groupBox2.TabIndex = 7;
  1421. this.groupBox2.TabStop = false;
  1422. //
  1423. // listView1
  1424. //
  1425. this.listView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  1426. | System.Windows.Forms.AnchorStyles.Left)
  1427. | System.Windows.Forms.AnchorStyles.Right)));
  1428. this.listView1.HideSelection = false;
  1429. this.listView1.LargeImageList = this.imageList1;
  1430. this.listView1.Location = new System.Drawing.Point(5, 17);
  1431. this.listView1.MultiSelect = false;
  1432. this.listView1.Name = "listView1";
  1433. this.listView1.Size = new System.Drawing.Size(124, 551);
  1434. this.listView1.TabIndex = 0;
  1435. this.listView1.UseCompatibleStateImageBehavior = false;
  1436. this.listView1.SelectedIndexChanged += new System.EventHandler(this.listView1_SelectedIndexChanged);
  1437. this.listView1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.listView1_MouseDown);
  1438. this.listView1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.listView1_MouseUp);
  1439. //
  1440. // imageList1
  1441. //
  1442. this.imageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
  1443. this.imageList1.ImageSize = new System.Drawing.Size(64, 64);
  1444. this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
  1445. //
  1446. // groupBox7
  1447. //
  1448. this.groupBox7.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  1449. | System.Windows.Forms.AnchorStyles.Right)));
  1450. this.groupBox7.Location = new System.Drawing.Point(521, 68);
  1451. this.groupBox7.Name = "groupBox7";
  1452. this.groupBox7.Size = new System.Drawing.Size(580, 574);
  1453. this.groupBox7.TabIndex = 20;
  1454. this.groupBox7.TabStop = false;
  1455. //
  1456. // groupBox3
  1457. //
  1458. this.groupBox3.Controls.Add(this.checkBox4);
  1459. this.groupBox3.Controls.Add(this.checkBox3);
  1460. this.groupBox3.Controls.Add(this.checkBox1);
  1461. this.groupBox3.Location = new System.Drawing.Point(155, 366);
  1462. this.groupBox3.Name = "groupBox3";
  1463. this.groupBox3.Size = new System.Drawing.Size(360, 62);
  1464. this.groupBox3.TabIndex = 21;
  1465. this.groupBox3.TabStop = false;
  1466. //
  1467. // checkBox4
  1468. //
  1469. this.checkBox4.AutoSize = true;
  1470. this.checkBox4.Location = new System.Drawing.Point(102, 42);
  1471. this.checkBox4.Name = "checkBox4";
  1472. this.checkBox4.Size = new System.Drawing.Size(15, 14);
  1473. this.checkBox4.TabIndex = 2;
  1474. this.checkBox4.UseVisualStyleBackColor = true;
  1475. this.checkBox4.CheckedChanged += new System.EventHandler(this.checkBox4_CheckedChanged);
  1476. this.checkBox4.Click += new System.EventHandler(this.checkBox4_Click);
  1477. //
  1478. // checkBox3
  1479. //
  1480. this.checkBox3.AutoSize = true;
  1481. this.checkBox3.Location = new System.Drawing.Point(18, 42);
  1482. this.checkBox3.Name = "checkBox3";
  1483. this.checkBox3.Size = new System.Drawing.Size(15, 14);
  1484. this.checkBox3.TabIndex = 1;
  1485. this.checkBox3.UseVisualStyleBackColor = true;
  1486. this.checkBox3.CheckedChanged += new System.EventHandler(this.checkBox3_CheckedChanged);
  1487. this.checkBox3.Click += new System.EventHandler(this.checkBox3_Click);
  1488. //
  1489. // checkBox1
  1490. //
  1491. this.checkBox1.AutoSize = true;
  1492. this.checkBox1.Location = new System.Drawing.Point(18, 20);
  1493. this.checkBox1.Name = "checkBox1";
  1494. this.checkBox1.Size = new System.Drawing.Size(15, 14);
  1495. this.checkBox1.TabIndex = 0;
  1496. this.checkBox1.UseVisualStyleBackColor = true;
  1497. this.checkBox1.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged);
  1498. //
  1499. // groupBox4
  1500. //
  1501. this.groupBox4.Controls.Add(this.panel2);
  1502. this.groupBox4.Controls.Add(this.panel1);
  1503. this.groupBox4.Controls.Add(this.numericUpDown3);
  1504. this.groupBox4.Controls.Add(this.numericUpDown2);
  1505. this.groupBox4.Controls.Add(this.label4);
  1506. this.groupBox4.Controls.Add(this.label3);
  1507. this.groupBox4.Controls.Add(this.label2);
  1508. this.groupBox4.Controls.Add(this.label1);
  1509. this.groupBox4.Controls.Add(this.checkBox6);
  1510. this.groupBox4.Controls.Add(this.checkBox5);
  1511. this.groupBox4.Location = new System.Drawing.Point(155, 434);
  1512. this.groupBox4.Name = "groupBox4";
  1513. this.groupBox4.Size = new System.Drawing.Size(360, 62);
  1514. this.groupBox4.TabIndex = 22;
  1515. this.groupBox4.TabStop = false;
  1516. //
  1517. // panel2
  1518. //
  1519. this.panel2.BackColor = System.Drawing.Color.Yellow;
  1520. this.panel2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  1521. this.panel2.Location = new System.Drawing.Point(266, 38);
  1522. this.panel2.Name = "panel2";
  1523. this.panel2.Size = new System.Drawing.Size(74, 21);
  1524. this.panel2.TabIndex = 12;
  1525. this.panel2.BackColorChanged += new System.EventHandler(this.panel2_BackColorChanged);
  1526. this.panel2.Click += new System.EventHandler(this.panel2_Click);
  1527. //
  1528. // panel1
  1529. //
  1530. this.panel1.BackColor = System.Drawing.Color.Blue;
  1531. this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  1532. this.panel1.Location = new System.Drawing.Point(266, 14);
  1533. this.panel1.Name = "panel1";
  1534. this.panel1.Size = new System.Drawing.Size(74, 21);
  1535. this.panel1.TabIndex = 11;
  1536. this.panel1.BackColorChanged += new System.EventHandler(this.panel1_BackColorChanged);
  1537. this.panel1.Click += new System.EventHandler(this.panel1_Click);
  1538. //
  1539. // numericUpDown3
  1540. //
  1541. this.numericUpDown3.Location = new System.Drawing.Point(165, 40);
  1542. this.numericUpDown3.Maximum = new decimal(new int[] {
  1543. 49000,
  1544. 0,
  1545. 0,
  1546. 0});
  1547. this.numericUpDown3.Minimum = new decimal(new int[] {
  1548. 1,
  1549. 0,
  1550. 0,
  1551. 0});
  1552. this.numericUpDown3.Name = "numericUpDown3";
  1553. this.numericUpDown3.Size = new System.Drawing.Size(54, 21);
  1554. this.numericUpDown3.TabIndex = 10;
  1555. this.numericUpDown3.Value = new decimal(new int[] {
  1556. 1,
  1557. 0,
  1558. 0,
  1559. 0});
  1560. this.numericUpDown3.ValueChanged += new System.EventHandler(this.numericUpDown3_ValueChanged);
  1561. //
  1562. // numericUpDown2
  1563. //
  1564. this.numericUpDown2.Location = new System.Drawing.Point(165, 15);
  1565. this.numericUpDown2.Maximum = new decimal(new int[] {
  1566. 49000,
  1567. 0,
  1568. 0,
  1569. 0});
  1570. this.numericUpDown2.Minimum = new decimal(new int[] {
  1571. 1,
  1572. 0,
  1573. 0,
  1574. 0});
  1575. this.numericUpDown2.Name = "numericUpDown2";
  1576. this.numericUpDown2.Size = new System.Drawing.Size(54, 21);
  1577. this.numericUpDown2.TabIndex = 9;
  1578. this.numericUpDown2.Value = new decimal(new int[] {
  1579. 1,
  1580. 0,
  1581. 0,
  1582. 0});
  1583. this.numericUpDown2.ValueChanged += new System.EventHandler(this.numericUpDown2_ValueChanged);
  1584. //
  1585. // label4
  1586. //
  1587. this.label4.AutoSize = true;
  1588. this.label4.Location = new System.Drawing.Point(226, 43);
  1589. this.label4.Name = "label4";
  1590. this.label4.Size = new System.Drawing.Size(0, 12);
  1591. this.label4.TabIndex = 8;
  1592. //
  1593. // label3
  1594. //
  1595. this.label3.AutoSize = true;
  1596. this.label3.Location = new System.Drawing.Point(226, 18);
  1597. this.label3.Name = "label3";
  1598. this.label3.Size = new System.Drawing.Size(0, 12);
  1599. this.label3.TabIndex = 7;
  1600. //
  1601. // label2
  1602. //
  1603. this.label2.AutoSize = true;
  1604. this.label2.Location = new System.Drawing.Point(128, 43);
  1605. this.label2.Name = "label2";
  1606. this.label2.Size = new System.Drawing.Size(0, 12);
  1607. this.label2.TabIndex = 6;
  1608. //
  1609. // label1
  1610. //
  1611. this.label1.AutoSize = true;
  1612. this.label1.Location = new System.Drawing.Point(128, 19);
  1613. this.label1.Name = "label1";
  1614. this.label1.Size = new System.Drawing.Size(0, 12);
  1615. this.label1.TabIndex = 5;
  1616. //
  1617. // checkBox6
  1618. //
  1619. this.checkBox6.AutoSize = true;
  1620. this.checkBox6.Location = new System.Drawing.Point(18, 42);
  1621. this.checkBox6.Name = "checkBox6";
  1622. this.checkBox6.Size = new System.Drawing.Size(15, 14);
  1623. this.checkBox6.TabIndex = 4;
  1624. this.checkBox6.UseVisualStyleBackColor = true;
  1625. this.checkBox6.CheckedChanged += new System.EventHandler(this.checkBox6_CheckedChanged);
  1626. //
  1627. // checkBox5
  1628. //
  1629. this.checkBox5.AutoSize = true;
  1630. this.checkBox5.Location = new System.Drawing.Point(18, 18);
  1631. this.checkBox5.Name = "checkBox5";
  1632. this.checkBox5.Size = new System.Drawing.Size(15, 14);
  1633. this.checkBox5.TabIndex = 3;
  1634. this.checkBox5.UseVisualStyleBackColor = true;
  1635. this.checkBox5.CheckedChanged += new System.EventHandler(this.checkBox5_CheckedChanged);
  1636. //
  1637. // groupBox5
  1638. //
  1639. this.groupBox5.Controls.Add(this.dataGridView3);
  1640. this.groupBox5.Controls.Add(this.dataGridView1);
  1641. this.groupBox5.Location = new System.Drawing.Point(155, 502);
  1642. this.groupBox5.Name = "groupBox5";
  1643. this.groupBox5.Size = new System.Drawing.Size(360, 140);
  1644. this.groupBox5.TabIndex = 23;
  1645. this.groupBox5.TabStop = false;
  1646. //
  1647. // dataGridView3
  1648. //
  1649. this.dataGridView3.AllowUserToAddRows = false;
  1650. this.dataGridView3.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
  1651. this.dataGridView3.BackgroundColor = System.Drawing.SystemColors.ControlLightLight;
  1652. dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1653. dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control;
  1654. dataGridViewCellStyle1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
  1655. dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText;
  1656. dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
  1657. dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
  1658. dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
  1659. this.dataGridView3.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
  1660. this.dataGridView3.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
  1661. this.dataGridView3.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
  1662. this.dataGridViewTextBoxColumn9,
  1663. this.dataGridViewTextBoxColumn10,
  1664. this.dataGridViewTextBoxColumn11,
  1665. this.dataGridViewTextBoxColumn12});
  1666. this.dataGridView3.Location = new System.Drawing.Point(6, 16);
  1667. this.dataGridView3.MultiSelect = false;
  1668. this.dataGridView3.Name = "dataGridView3";
  1669. this.dataGridView3.ReadOnly = true;
  1670. this.dataGridView3.RowHeadersVisible = false;
  1671. this.dataGridView3.RowTemplate.Height = 23;
  1672. this.dataGridView3.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
  1673. this.dataGridView3.Size = new System.Drawing.Size(348, 118);
  1674. this.dataGridView3.TabIndex = 3;
  1675. this.dataGridView3.Visible = false;
  1676. //
  1677. // dataGridViewTextBoxColumn9
  1678. //
  1679. dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
  1680. this.dataGridViewTextBoxColumn9.DefaultCellStyle = dataGridViewCellStyle2;
  1681. this.dataGridViewTextBoxColumn9.Name = "dataGridViewTextBoxColumn9";
  1682. this.dataGridViewTextBoxColumn9.ReadOnly = true;
  1683. //
  1684. // dataGridViewTextBoxColumn10
  1685. //
  1686. dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
  1687. this.dataGridViewTextBoxColumn10.DefaultCellStyle = dataGridViewCellStyle3;
  1688. this.dataGridViewTextBoxColumn10.Name = "dataGridViewTextBoxColumn10";
  1689. this.dataGridViewTextBoxColumn10.ReadOnly = true;
  1690. //
  1691. // dataGridViewTextBoxColumn11
  1692. //
  1693. dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
  1694. this.dataGridViewTextBoxColumn11.DefaultCellStyle = dataGridViewCellStyle4;
  1695. this.dataGridViewTextBoxColumn11.Name = "dataGridViewTextBoxColumn11";
  1696. this.dataGridViewTextBoxColumn11.ReadOnly = true;
  1697. //
  1698. // dataGridViewTextBoxColumn12
  1699. //
  1700. dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
  1701. this.dataGridViewTextBoxColumn12.DefaultCellStyle = dataGridViewCellStyle5;
  1702. this.dataGridViewTextBoxColumn12.Name = "dataGridViewTextBoxColumn12";
  1703. this.dataGridViewTextBoxColumn12.ReadOnly = true;
  1704. //
  1705. // dataGridView1
  1706. //
  1707. this.dataGridView1.AllowUserToAddRows = false;
  1708. this.dataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
  1709. this.dataGridView1.BackgroundColor = System.Drawing.SystemColors.ControlLightLight;
  1710. dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1711. dataGridViewCellStyle6.BackColor = System.Drawing.SystemColors.Control;
  1712. dataGridViewCellStyle6.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
  1713. dataGridViewCellStyle6.ForeColor = System.Drawing.SystemColors.WindowText;
  1714. dataGridViewCellStyle6.SelectionBackColor = System.Drawing.SystemColors.Highlight;
  1715. dataGridViewCellStyle6.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
  1716. dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
  1717. this.dataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle6;
  1718. this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
  1719. this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
  1720. this.Column11,
  1721. this.dataGridViewTextBoxColumn3,
  1722. this.dataGridViewTextBoxColumn4,
  1723. this.dataGridViewTextBoxColumn5});
  1724. this.dataGridView1.Location = new System.Drawing.Point(6, 16);
  1725. this.dataGridView1.MultiSelect = false;
  1726. this.dataGridView1.Name = "dataGridView1";
  1727. this.dataGridView1.ReadOnly = true;
  1728. this.dataGridView1.RowHeadersVisible = false;
  1729. this.dataGridView1.RowTemplate.Height = 23;
  1730. this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
  1731. this.dataGridView1.Size = new System.Drawing.Size(348, 118);
  1732. this.dataGridView1.TabIndex = 2;
  1733. //
  1734. // Column11
  1735. //
  1736. dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
  1737. this.Column11.DefaultCellStyle = dataGridViewCellStyle7;
  1738. this.Column11.Name = "Column11";
  1739. this.Column11.ReadOnly = true;
  1740. //
  1741. // dataGridViewTextBoxColumn3
  1742. //
  1743. dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
  1744. this.dataGridViewTextBoxColumn3.DefaultCellStyle = dataGridViewCellStyle8;
  1745. this.dataGridViewTextBoxColumn3.Name = "dataGridViewTextBoxColumn3";
  1746. this.dataGridViewTextBoxColumn3.ReadOnly = true;
  1747. //
  1748. // dataGridViewTextBoxColumn4
  1749. //
  1750. dataGridViewCellStyle9.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
  1751. this.dataGridViewTextBoxColumn4.DefaultCellStyle = dataGridViewCellStyle9;
  1752. this.dataGridViewTextBoxColumn4.Name = "dataGridViewTextBoxColumn4";
  1753. this.dataGridViewTextBoxColumn4.ReadOnly = true;
  1754. //
  1755. // dataGridViewTextBoxColumn5
  1756. //
  1757. dataGridViewCellStyle10.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
  1758. this.dataGridViewTextBoxColumn5.DefaultCellStyle = dataGridViewCellStyle10;
  1759. this.dataGridViewTextBoxColumn5.Name = "dataGridViewTextBoxColumn5";
  1760. this.dataGridViewTextBoxColumn5.ReadOnly = true;
  1761. //
  1762. // groupBox8
  1763. //
  1764. this.groupBox8.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  1765. | System.Windows.Forms.AnchorStyles.Left)
  1766. | System.Windows.Forms.AnchorStyles.Right)));
  1767. this.groupBox8.Controls.Add(this.dataGridView2);
  1768. this.groupBox8.Controls.Add(this.button4);
  1769. this.groupBox8.Controls.Add(this.listView2);
  1770. this.groupBox8.Controls.Add(this.numericUpDown1);
  1771. this.groupBox8.Controls.Add(this.button16);
  1772. this.groupBox8.Controls.Add(this.label5);
  1773. this.groupBox8.Controls.Add(this.button14);
  1774. this.groupBox8.Controls.Add(this.button13);
  1775. this.groupBox8.Controls.Add(this.dataGridView4);
  1776. this.groupBox8.Controls.Add(this.button12);
  1777. this.groupBox8.Controls.Add(this.button11);
  1778. this.groupBox8.Location = new System.Drawing.Point(14, 648);
  1779. this.groupBox8.Name = "groupBox8";
  1780. this.groupBox8.Size = new System.Drawing.Size(1087, 273);
  1781. this.groupBox8.TabIndex = 24;
  1782. this.groupBox8.TabStop = false;
  1783. //
  1784. // dataGridView2
  1785. //
  1786. this.dataGridView2.AllowUserToAddRows = false;
  1787. this.dataGridView2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  1788. | System.Windows.Forms.AnchorStyles.Left)
  1789. | System.Windows.Forms.AnchorStyles.Right)));
  1790. this.dataGridView2.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
  1791. this.dataGridView2.BackgroundColor = System.Drawing.SystemColors.ControlLightLight;
  1792. dataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1793. dataGridViewCellStyle11.BackColor = System.Drawing.SystemColors.Control;
  1794. dataGridViewCellStyle11.Font = new System.Drawing.Font("宋体", 9F);
  1795. dataGridViewCellStyle11.ForeColor = System.Drawing.SystemColors.WindowText;
  1796. dataGridViewCellStyle11.SelectionBackColor = System.Drawing.SystemColors.Highlight;
  1797. dataGridViewCellStyle11.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
  1798. dataGridViewCellStyle11.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
  1799. this.dataGridView2.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle11;
  1800. this.dataGridView2.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
  1801. this.dataGridView2.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
  1802. this.dataGridViewTextBoxColumn1,
  1803. this.dataGridViewTextBoxColumn2,
  1804. this.dataGridViewTextBoxColumn6,
  1805. this.dataGridViewTextBoxColumn7,
  1806. this.dataGridViewTextBoxColumn8,
  1807. this.Column4,
  1808. this.Column9,
  1809. this.Column10,
  1810. this.Column8,
  1811. this.Column12,
  1812. this.Column13,
  1813. this.Column14,
  1814. this.Column15});
  1815. this.dataGridView2.Location = new System.Drawing.Point(228, 159);
  1816. this.dataGridView2.Name = "dataGridView2";
  1817. this.dataGridView2.ReadOnly = true;
  1818. this.dataGridView2.RowHeadersVisible = false;
  1819. this.dataGridView2.RowTemplate.Height = 23;
  1820. this.dataGridView2.Size = new System.Drawing.Size(693, 108);
  1821. this.dataGridView2.TabIndex = 24;
  1822. //
  1823. // dataGridViewTextBoxColumn1
  1824. //
  1825. dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
  1826. this.dataGridViewTextBoxColumn1.DefaultCellStyle = dataGridViewCellStyle12;
  1827. this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1";
  1828. this.dataGridViewTextBoxColumn1.ReadOnly = true;
  1829. //
  1830. // dataGridViewTextBoxColumn2
  1831. //
  1832. dataGridViewCellStyle13.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
  1833. this.dataGridViewTextBoxColumn2.DefaultCellStyle = dataGridViewCellStyle13;
  1834. this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2";
  1835. this.dataGridViewTextBoxColumn2.ReadOnly = true;
  1836. //
  1837. // dataGridViewTextBoxColumn6
  1838. //
  1839. dataGridViewCellStyle14.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
  1840. this.dataGridViewTextBoxColumn6.DefaultCellStyle = dataGridViewCellStyle14;
  1841. this.dataGridViewTextBoxColumn6.Name = "dataGridViewTextBoxColumn6";
  1842. this.dataGridViewTextBoxColumn6.ReadOnly = true;
  1843. //
  1844. // dataGridViewTextBoxColumn7
  1845. //
  1846. dataGridViewCellStyle15.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
  1847. this.dataGridViewTextBoxColumn7.DefaultCellStyle = dataGridViewCellStyle15;
  1848. this.dataGridViewTextBoxColumn7.Name = "dataGridViewTextBoxColumn7";
  1849. this.dataGridViewTextBoxColumn7.ReadOnly = true;
  1850. //
  1851. // dataGridViewTextBoxColumn8
  1852. //
  1853. dataGridViewCellStyle16.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
  1854. this.dataGridViewTextBoxColumn8.DefaultCellStyle = dataGridViewCellStyle16;
  1855. this.dataGridViewTextBoxColumn8.Name = "dataGridViewTextBoxColumn8";
  1856. this.dataGridViewTextBoxColumn8.ReadOnly = true;
  1857. //
  1858. // Column4
  1859. //
  1860. dataGridViewCellStyle17.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
  1861. this.Column4.DefaultCellStyle = dataGridViewCellStyle17;
  1862. this.Column4.Name = "Column4";
  1863. this.Column4.ReadOnly = true;
  1864. //
  1865. // Column9
  1866. //
  1867. dataGridViewCellStyle18.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
  1868. this.Column9.DefaultCellStyle = dataGridViewCellStyle18;
  1869. this.Column9.HeaderText = "Φ5";
  1870. this.Column9.Name = "Column9";
  1871. this.Column9.ReadOnly = true;
  1872. //
  1873. // Column10
  1874. //
  1875. dataGridViewCellStyle19.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
  1876. this.Column10.DefaultCellStyle = dataGridViewCellStyle19;
  1877. this.Column10.HeaderText = "Φ16";
  1878. this.Column10.Name = "Column10";
  1879. this.Column10.ReadOnly = true;
  1880. //
  1881. // Column8
  1882. //
  1883. dataGridViewCellStyle20.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
  1884. this.Column8.DefaultCellStyle = dataGridViewCellStyle20;
  1885. this.Column8.HeaderText = "Φ25";
  1886. this.Column8.Name = "Column8";
  1887. this.Column8.ReadOnly = true;
  1888. //
  1889. // Column12
  1890. //
  1891. dataGridViewCellStyle21.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
  1892. this.Column12.DefaultCellStyle = dataGridViewCellStyle21;
  1893. this.Column12.HeaderText = "Φ50";
  1894. this.Column12.Name = "Column12";
  1895. this.Column12.ReadOnly = true;
  1896. //
  1897. // Column13
  1898. //
  1899. dataGridViewCellStyle22.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
  1900. this.Column13.DefaultCellStyle = dataGridViewCellStyle22;
  1901. this.Column13.HeaderText = "Φ75";
  1902. this.Column13.Name = "Column13";
  1903. this.Column13.ReadOnly = true;
  1904. //
  1905. // Column14
  1906. //
  1907. dataGridViewCellStyle23.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
  1908. this.Column14.DefaultCellStyle = dataGridViewCellStyle23;
  1909. this.Column14.HeaderText = "Φ84";
  1910. this.Column14.Name = "Column14";
  1911. this.Column14.ReadOnly = true;
  1912. //
  1913. // Column15
  1914. //
  1915. dataGridViewCellStyle24.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
  1916. this.Column15.DefaultCellStyle = dataGridViewCellStyle24;
  1917. this.Column15.HeaderText = "Φ95";
  1918. this.Column15.Name = "Column15";
  1919. this.Column15.ReadOnly = true;
  1920. //
  1921. // button4
  1922. //
  1923. this.button4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  1924. this.button4.BackColor = System.Drawing.SystemColors.Control;
  1925. this.button4.Location = new System.Drawing.Point(941, 102);
  1926. this.button4.Name = "button4";
  1927. this.button4.Size = new System.Drawing.Size(128, 26);
  1928. this.button4.TabIndex = 23;
  1929. this.button4.UseVisualStyleBackColor = false;
  1930. this.button4.Click += new System.EventHandler(this.button4_Click);
  1931. //
  1932. // listView2
  1933. //
  1934. this.listView2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  1935. | System.Windows.Forms.AnchorStyles.Left)));
  1936. this.listView2.FullRowSelect = true;
  1937. this.listView2.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
  1938. this.listView2.HideSelection = false;
  1939. this.listView2.Location = new System.Drawing.Point(16, 56);
  1940. this.listView2.Name = "listView2";
  1941. this.listView2.Size = new System.Drawing.Size(180, 210);
  1942. this.listView2.TabIndex = 22;
  1943. this.listView2.UseCompatibleStateImageBehavior = false;
  1944. this.listView2.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.listView2_ItemSelectionChanged);
  1945. this.listView2.SelectedIndexChanged += new System.EventHandler(this.listView2_SelectedIndexChanged);
  1946. //
  1947. // numericUpDown1
  1948. //
  1949. this.numericUpDown1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  1950. this.numericUpDown1.Location = new System.Drawing.Point(997, 163);
  1951. this.numericUpDown1.Maximum = new decimal(new int[] {
  1952. 10,
  1953. 0,
  1954. 0,
  1955. 0});
  1956. this.numericUpDown1.Name = "numericUpDown1";
  1957. this.numericUpDown1.Size = new System.Drawing.Size(56, 21);
  1958. this.numericUpDown1.TabIndex = 21;
  1959. this.numericUpDown1.ValueChanged += new System.EventHandler(this.numericUpDown1_ValueChanged);
  1960. //
  1961. // button16
  1962. //
  1963. this.button16.BackColor = System.Drawing.SystemColors.Control;
  1964. this.button16.Location = new System.Drawing.Point(15, 20);
  1965. this.button16.Name = "button16";
  1966. this.button16.Size = new System.Drawing.Size(93, 26);
  1967. this.button16.TabIndex = 20;
  1968. this.button16.UseVisualStyleBackColor = false;
  1969. this.button16.Click += new System.EventHandler(this.button16_Click);
  1970. //
  1971. // label5
  1972. //
  1973. this.label5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  1974. this.label5.AutoSize = true;
  1975. this.label5.Location = new System.Drawing.Point(958, 169);
  1976. this.label5.Name = "label5";
  1977. this.label5.Size = new System.Drawing.Size(0, 12);
  1978. this.label5.TabIndex = 18;
  1979. //
  1980. // button14
  1981. //
  1982. this.button14.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  1983. this.button14.BackColor = System.Drawing.SystemColors.Control;
  1984. this.button14.Location = new System.Drawing.Point(941, 68);
  1985. this.button14.Name = "button14";
  1986. this.button14.Size = new System.Drawing.Size(128, 26);
  1987. this.button14.TabIndex = 16;
  1988. this.button14.UseVisualStyleBackColor = false;
  1989. this.button14.Click += new System.EventHandler(this.button14_Click);
  1990. //
  1991. // button13
  1992. //
  1993. this.button13.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  1994. this.button13.BackColor = System.Drawing.SystemColors.Control;
  1995. this.button13.Location = new System.Drawing.Point(941, 34);
  1996. this.button13.Name = "button13";
  1997. this.button13.Size = new System.Drawing.Size(128, 26);
  1998. this.button13.TabIndex = 12;
  1999. this.button13.UseVisualStyleBackColor = false;
  2000. this.button13.Click += new System.EventHandler(this.button13_Click);
  2001. //
  2002. // dataGridView4
  2003. //
  2004. this.dataGridView4.AllowUserToAddRows = false;
  2005. this.dataGridView4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  2006. | System.Windows.Forms.AnchorStyles.Right)));
  2007. this.dataGridView4.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
  2008. this.dataGridView4.BackgroundColor = System.Drawing.SystemColors.ControlLightLight;
  2009. dataGridViewCellStyle25.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  2010. dataGridViewCellStyle25.BackColor = System.Drawing.SystemColors.Control;
  2011. dataGridViewCellStyle25.Font = new System.Drawing.Font("宋体", 9F);
  2012. dataGridViewCellStyle25.ForeColor = System.Drawing.SystemColors.WindowText;
  2013. dataGridViewCellStyle25.SelectionBackColor = System.Drawing.SystemColors.Highlight;
  2014. dataGridViewCellStyle25.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
  2015. dataGridViewCellStyle25.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
  2016. this.dataGridView4.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle25;
  2017. this.dataGridView4.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
  2018. this.dataGridView4.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
  2019. this.Column1,
  2020. this.Column2,
  2021. this.Column5,
  2022. this.Column6,
  2023. this.Column7,
  2024. this.Column3});
  2025. this.dataGridView4.Location = new System.Drawing.Point(228, 20);
  2026. this.dataGridView4.Name = "dataGridView4";
  2027. this.dataGridView4.ReadOnly = true;
  2028. this.dataGridView4.RowHeadersVisible = false;
  2029. this.dataGridView4.RowTemplate.Height = 23;
  2030. this.dataGridView4.Size = new System.Drawing.Size(693, 133);
  2031. this.dataGridView4.TabIndex = 15;
  2032. //
  2033. // Column1
  2034. //
  2035. dataGridViewCellStyle26.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
  2036. this.Column1.DefaultCellStyle = dataGridViewCellStyle26;
  2037. this.Column1.Name = "Column1";
  2038. this.Column1.ReadOnly = true;
  2039. //
  2040. // Column2
  2041. //
  2042. dataGridViewCellStyle27.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
  2043. this.Column2.DefaultCellStyle = dataGridViewCellStyle27;
  2044. this.Column2.Name = "Column2";
  2045. this.Column2.ReadOnly = true;
  2046. //
  2047. // Column5
  2048. //
  2049. dataGridViewCellStyle28.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
  2050. this.Column5.DefaultCellStyle = dataGridViewCellStyle28;
  2051. this.Column5.Name = "Column5";
  2052. this.Column5.ReadOnly = true;
  2053. //
  2054. // Column6
  2055. //
  2056. dataGridViewCellStyle29.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
  2057. this.Column6.DefaultCellStyle = dataGridViewCellStyle29;
  2058. this.Column6.Name = "Column6";
  2059. this.Column6.ReadOnly = true;
  2060. //
  2061. // Column7
  2062. //
  2063. dataGridViewCellStyle30.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
  2064. this.Column7.DefaultCellStyle = dataGridViewCellStyle30;
  2065. this.Column7.Name = "Column7";
  2066. this.Column7.ReadOnly = true;
  2067. //
  2068. // Column3
  2069. //
  2070. dataGridViewCellStyle31.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
  2071. this.Column3.DefaultCellStyle = dataGridViewCellStyle31;
  2072. this.Column3.Name = "Column3";
  2073. this.Column3.ReadOnly = true;
  2074. //
  2075. // button12
  2076. //
  2077. this.button12.BackColor = System.Drawing.SystemColors.Control;
  2078. this.button12.Location = new System.Drawing.Point(145, 20);
  2079. this.button12.Name = "button12";
  2080. this.button12.Size = new System.Drawing.Size(52, 26);
  2081. this.button12.TabIndex = 13;
  2082. this.button12.UseVisualStyleBackColor = false;
  2083. this.button12.Click += new System.EventHandler(this.button12_Click);
  2084. //
  2085. // button11
  2086. //
  2087. this.button11.BackColor = System.Drawing.SystemColors.Control;
  2088. this.button11.Location = new System.Drawing.Point(15, 20);
  2089. this.button11.Name = "button11";
  2090. this.button11.Size = new System.Drawing.Size(63, 26);
  2091. this.button11.TabIndex = 12;
  2092. this.button11.UseVisualStyleBackColor = false;
  2093. this.button11.Click += new System.EventHandler(this.button11_Click);
  2094. //
  2095. // GrainSizeAnalysisMethodOfClasticRockDialog
  2096. //
  2097. this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
  2098. this.ClientSize = new System.Drawing.Size(1107, 933);
  2099. this.Controls.Add(this.groupBox8);
  2100. this.Controls.Add(this.groupBox5);
  2101. this.Controls.Add(this.groupBox4);
  2102. this.Controls.Add(this.groupBox3);
  2103. this.Controls.Add(this.groupBox7);
  2104. this.Controls.Add(this.groupBox2);
  2105. this.Controls.Add(this.groupBox1);
  2106. this.Name = "GrainSizeAnalysisMethodOfClasticRockDialog";
  2107. this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.InclusionsStandardDialog_FormClosing);
  2108. this.Load += new System.EventHandler(this.GrainSizeAnalysisMethodOfClasticRockDialog_Load);
  2109. this.Shown += new System.EventHandler(this.ShownChoiseItemAndInitData);
  2110. this.Controls.SetChildIndex(this.groupBox1, 0);
  2111. this.Controls.SetChildIndex(this.groupBox2, 0);
  2112. this.Controls.SetChildIndex(this.groupBox7, 0);
  2113. this.Controls.SetChildIndex(this.groupBox3, 0);
  2114. this.Controls.SetChildIndex(this.groupBox4, 0);
  2115. this.Controls.SetChildIndex(this.groupBox5, 0);
  2116. this.Controls.SetChildIndex(this.groupBox8, 0);
  2117. this.groupBox1.ResumeLayout(false);
  2118. this.groupBox1.PerformLayout();
  2119. this.groupBox2.ResumeLayout(false);
  2120. this.groupBox3.ResumeLayout(false);
  2121. this.groupBox3.PerformLayout();
  2122. this.groupBox4.ResumeLayout(false);
  2123. this.groupBox4.PerformLayout();
  2124. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown3)).EndInit();
  2125. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit();
  2126. this.groupBox5.ResumeLayout(false);
  2127. ((System.ComponentModel.ISupportInitialize)(this.dataGridView3)).EndInit();
  2128. ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
  2129. this.groupBox8.ResumeLayout(false);
  2130. this.groupBox8.PerformLayout();
  2131. ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).EndInit();
  2132. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
  2133. ((System.ComponentModel.ISupportInitialize)(this.dataGridView4)).EndInit();
  2134. this.ResumeLayout(false);
  2135. }
  2136. #endregion
  2137. private void colorsFormUserPrimaryColorChanged(object sender, ColorEventArgs ce)
  2138. {
  2139. }
  2140. private void panel1_Click(object sender, EventArgs e)
  2141. {
  2142. this.colorsForm1.UserPrimaryColor = ColorBgra.FromColor(this.panel1.BackColor);
  2143. this.colorsForm1.setSaveBtn_Click(new System.EventHandler(this.panel1Changed));
  2144. this.colorsForm1.ShowDialog();
  2145. }
  2146. private void panel1Changed(object sender, EventArgs e)
  2147. {
  2148. this.panel1.BackColor = this.colorsForm1.UserPrimaryColor.ToColor();
  2149. this.colorsForm1.Close();
  2150. }
  2151. private void panel2_Click(object sender, EventArgs e)
  2152. {
  2153. this.colorsForm2.UserPrimaryColor = ColorBgra.FromColor(this.panel2.BackColor);
  2154. this.colorsForm2.setSaveBtn_Click(new System.EventHandler(this.panel2Changed));
  2155. this.colorsForm2.ShowDialog();
  2156. }
  2157. private void panel2Changed(object sender, EventArgs e)
  2158. {
  2159. this.panel2.BackColor = this.colorsForm2.UserPrimaryColor.ToColor();
  2160. this.colorsForm2.Close();
  2161. }
  2162. /// <summary>
  2163. /// ListView图片选择改变事件
  2164. /// </summary>
  2165. /// <param name="sender"></param>
  2166. /// <param name="e"></param>
  2167. private void listView1_SelectedIndexChanged(object sender, EventArgs e)
  2168. {
  2169. if (this.listView1.FocusedItem != null && this.listView1.FocusedItem.Selected)
  2170. {
  2171. this.unitLength = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetRuler(MeasurementUnit.Millimeter);
  2172. GetListParamModel();
  2173. //double physical_area_length_Micron = getCurrentWorkspace().GetRuler(MeasurementUnit.Micron);
  2174. existViewFlag = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GraphicsList.IsExsitView();
  2175. this.imageMat = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].CompositionSurface.CreatedAliasedMat();
  2176. if (!existViewFlag)
  2177. matOrg = imageMat.Clone();
  2178. else
  2179. matOrg = PaintDotNet.Camera.Tools.ToMat(this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetFullSizeWithRegion());
  2180. //二值化集成4
  2181. binaryClass.listView1_SelectedIndexChangedNoCheckedChanged(this.imageMat.Clone(), this.imageList1.Images.Keys[this.listView1.FocusedItem.Index]);
  2182. if (bcOriginChecked())
  2183. {
  2184. this.documentWorkspace.PhaseModels[0].choise = false;
  2185. this.documentWorkspace.PhaseModels[1].choise = false;
  2186. this.documentWorkspace.Refresh();
  2187. }
  2188. ScreeningSpheroidizedTissue();
  2189. RefrashResultData();
  2190. //if (this.grainBoundryCheckBox.Checked)
  2191. //{
  2192. // this.documentWorkspace.PhaseModels[1].choise = true;
  2193. // this.applyDect();
  2194. //}
  2195. }
  2196. }
  2197. /// <summary>
  2198. /// 颗粒编号改变
  2199. /// </summary>
  2200. /// <param name="sender"></param>
  2201. /// <param name="e"></param>
  2202. private void numericUpDown2_ValueChanged(object sender, EventArgs e)
  2203. {
  2204. this.documentWorkspace.Refresh();
  2205. }
  2206. /// <summary>
  2207. /// 颗粒直径改变
  2208. /// </summary>
  2209. /// <param name="sender"></param>
  2210. /// <param name="e"></param>
  2211. private void numericUpDown3_ValueChanged(object sender, EventArgs e)
  2212. {
  2213. this.documentWorkspace.Refresh();
  2214. }
  2215. /// <summary>
  2216. /// 字体颜色改变
  2217. /// </summary>
  2218. /// <param name="sender"></param>
  2219. /// <param name="e"></param>
  2220. private void panel1_BackColorChanged(object sender, EventArgs e)
  2221. {
  2222. this.documentWorkspace.Refresh();
  2223. }
  2224. /// <summary>
  2225. /// 字体颜色改变
  2226. /// </summary>
  2227. /// <param name="sender"></param>
  2228. /// <param name="e"></param>
  2229. private void panel2_BackColorChanged(object sender, EventArgs e)
  2230. {
  2231. this.documentWorkspace.Refresh();
  2232. }
  2233. /// <summary>
  2234. /// 画布绘制
  2235. /// </summary>
  2236. /// <param name="sender"></param>
  2237. /// <param name="e"></param>
  2238. private void Panel_Paint(object sender, PaintEventArgs e)
  2239. {
  2240. if (this.documentWorkspace.CompositionSurface != null)
  2241. {
  2242. //
  2243. // 以下是计算绘制图片的位置和大小并绘制图片
  2244. //
  2245. System.Drawing.Rectangle rc = this.documentWorkspace.panel.ClientRectangle;
  2246. int width = (int)(this.documentWorkspace.CompositionSurface.Width * this.documentWorkspace.ScaleFactor.Ratio);
  2247. int height = (int)(this.documentWorkspace.CompositionSurface.Height * this.documentWorkspace.ScaleFactor.Ratio);
  2248. int x = (rc.Width < width) ? this.documentWorkspace.panel.AutoScrollPosition.X : (rc.Width - width) / 2;
  2249. int y = (rc.Height < height) ? this.documentWorkspace.panel.AutoScrollPosition.Y : (rc.Height - height) / 2;
  2250. //
  2251. // 以下是绘制网格、标注、测量、视场等开始
  2252. //
  2253. e.Graphics.TranslateTransform(x, y);
  2254. e.Graphics.ScaleTransform((float)this.documentWorkspace.ScaleFactor.Ratio, (float)this.documentWorkspace.ScaleFactor.Ratio);
  2255. Draw(e.Graphics);
  2256. e.Graphics.ScaleTransform(1 / (float)this.documentWorkspace.ScaleFactor.Ratio, 1 / (float)this.documentWorkspace.ScaleFactor.Ratio);
  2257. e.Graphics.TranslateTransform(-x, -y);
  2258. }
  2259. }
  2260. private void Draw(Graphics graphics)
  2261. {
  2262. foreach (var keyValuePair in keyValuePairs)
  2263. {
  2264. if (keyValuePair.Count > 0)
  2265. {
  2266. if (this.checkBox5.Checked && this.checkBox6.Checked)
  2267. {
  2268. foreach (var item in keyValuePair)
  2269. {
  2270. graphics.DrawString("(" + item.Value[1] + "): ", new Font("宋体", (float)this.numericUpDown2.Value), new SolidBrush(this.panel1.BackColor), new PointF((float)item.Key.X, (float)item.Key.Y));
  2271. SizeF sizeF = graphics.MeasureString("(" + item.Value[1] + ")", new Font("宋体", (float)this.numericUpDown2.Value));
  2272. graphics.DrawString("" + Math.Round(item.Value[0], Convert.ToInt32(this.numericUpDown1.Value)), new Font("宋体", (float)this.numericUpDown3.Value), new SolidBrush(this.panel2.BackColor), new PointF((float)item.Key.X + sizeF.Width, (float)item.Key.Y));
  2273. }
  2274. }
  2275. else if (!this.checkBox5.Checked && this.checkBox6.Checked)
  2276. {
  2277. foreach (var item in keyValuePair)
  2278. {
  2279. graphics.DrawString("" + Math.Round(item.Value[0], Convert.ToInt32(this.numericUpDown1.Value)), new Font("宋体", (float)this.numericUpDown3.Value), new SolidBrush(this.panel2.BackColor), new PointF((float)item.Key.X, (float)item.Key.Y));
  2280. }
  2281. }
  2282. else if (this.checkBox5.Checked && !this.checkBox6.Checked)
  2283. {
  2284. foreach (var item in keyValuePair)
  2285. {
  2286. graphics.DrawString("(" + item.Value[1] + ")", new Font("宋体", (float)this.numericUpDown2.Value), new SolidBrush(this.panel1.BackColor), new PointF((float)item.Key.X, (float)item.Key.Y));
  2287. }
  2288. }
  2289. }
  2290. }
  2291. }
  2292. /// <summary>
  2293. /// 是否显示编号
  2294. /// </summary>
  2295. /// <param name="sender"></param>
  2296. /// <param name="e"></param>
  2297. private void checkBox5_CheckedChanged(object sender, EventArgs e)
  2298. {
  2299. this.documentWorkspace.Refresh();
  2300. }
  2301. /// <summary>
  2302. /// 是否显示直径
  2303. /// </summary>
  2304. /// <param name="sender"></param>
  2305. /// <param name="e"></param>
  2306. private void checkBox6_CheckedChanged(object sender, EventArgs e)
  2307. {
  2308. this.documentWorkspace.Refresh();
  2309. }
  2310. /// <summary>
  2311. /// 图解法
  2312. /// </summary>
  2313. /// <param name="sender"></param>
  2314. /// <param name="e"></param>
  2315. private void checkBox3_CheckedChanged(object sender, EventArgs e)
  2316. {
  2317. if(this.checkBox3.Checked)
  2318. {
  2319. this.checkBox4.Checked = false;
  2320. this.dataGridView2.Columns[6].Visible = true;
  2321. this.dataGridView2.Columns[7].Visible = true;
  2322. this.dataGridView2.Columns[8].Visible = true;
  2323. this.dataGridView2.Columns[9].Visible = true;
  2324. this.dataGridView2.Columns[10].Visible = true;
  2325. this.dataGridView2.Columns[11].Visible = true;
  2326. this.dataGridView2.Columns[12].Visible = true;
  2327. }
  2328. else
  2329. {
  2330. this.dataGridView2.Columns[6].Visible = false;
  2331. this.dataGridView2.Columns[7].Visible = false;
  2332. this.dataGridView2.Columns[8].Visible = false;
  2333. this.dataGridView2.Columns[9].Visible = false;
  2334. this.dataGridView2.Columns[10].Visible = false;
  2335. this.dataGridView2.Columns[11].Visible = false;
  2336. this.dataGridView2.Columns[12].Visible = false;
  2337. }
  2338. RefreshStatistics();
  2339. }
  2340. /// <summary>
  2341. /// 矩阵法
  2342. /// </summary>
  2343. /// <param name="sender"></param>
  2344. /// <param name="e"></param>
  2345. private void checkBox4_CheckedChanged(object sender, EventArgs e)
  2346. {
  2347. if (this.checkBox4.Checked)
  2348. {
  2349. this.checkBox3.Checked = false;
  2350. }
  2351. RefreshStatistics();
  2352. }
  2353. /// <summary>
  2354. /// 筛析校正
  2355. /// </summary>
  2356. /// <param name="sender"></param>
  2357. /// <param name="e"></param>
  2358. private void checkBox1_CheckedChanged(object sender, EventArgs e)
  2359. {
  2360. RefrashResultData();
  2361. }
  2362. /// <summary>
  2363. /// 图解法
  2364. /// </summary>
  2365. /// <param name="sender"></param>
  2366. /// <param name="e"></param>
  2367. private void checkBox3_Click(object sender, EventArgs e)
  2368. {
  2369. if (!this.checkBox4.Checked)
  2370. checkBox3.Checked = true;
  2371. }
  2372. /// <summary>
  2373. /// 矩阵法
  2374. /// </summary>
  2375. /// <param name="sender"></param>
  2376. /// <param name="e"></param>
  2377. private void checkBox4_Click(object sender, EventArgs e)
  2378. {
  2379. if (!this.checkBox3.Checked)
  2380. checkBox4.Checked = true;
  2381. }
  2382. /// <summary>
  2383. /// 小数变化
  2384. /// </summary>
  2385. /// <param name="sender"></param>
  2386. /// <param name="e"></param>
  2387. private void numericUpDown1_ValueChanged(object sender, EventArgs e)
  2388. {
  2389. RefrashResultData();
  2390. RefreshDataGridView4();
  2391. RefreshStatistics();
  2392. this.documentWorkspace.Refresh();
  2393. }
  2394. /// <summary>
  2395. /// 保存结果
  2396. /// </summary>
  2397. /// <param name="sender"></param>
  2398. /// <param name="e"></param>
  2399. private void button2_Click(object sender, EventArgs e)
  2400. {
  2401. if (this.listView1.SelectedItems.Count == 0)
  2402. {
  2403. MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectapicture.text")+"!");
  2404. return;
  2405. }
  2406. if (this.dataGridView1.Rows.Count == 0)
  2407. {
  2408. MessageBox.Show(PdnResources.GetString("Menu.Noresultdata.text")+"!");
  2409. return;
  2410. }
  2411. string imgName = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetFriendlyName();
  2412. string tag = this.imageList1.Images.Keys[this.listView1.SelectedItems[0].Index];
  2413. DataTable dataTable = new DataTable();
  2414. bool replace = false;
  2415. int add = 0;
  2416. foreach (ListViewItem item in this.listView2.Items)
  2417. {
  2418. if (item.Tag.Equals(tag))
  2419. {
  2420. add++;
  2421. DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Theresuethertoreplace.text")+"?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
  2422. if (dr == DialogResult.OK)
  2423. {
  2424. replace = true;
  2425. this.listView2.Items.Remove(item);
  2426. foreach (var keyValuePairs in keyValuePairsAll)
  2427. {
  2428. if (keyValuePairs.Key.Equals(tag))
  2429. {
  2430. this.keyValuePairsAll.Remove(tag);
  2431. break;
  2432. }
  2433. }
  2434. foreach (var graphicMethod in graphicMethods)
  2435. {
  2436. if (graphicMethod.Key.Equals(tag))
  2437. {
  2438. this.graphicMethods.Remove(tag);
  2439. break;
  2440. }
  2441. }
  2442. foreach (var matrixMethod in matrixMethods)
  2443. {
  2444. if (matrixMethod.Key.Equals(tag))
  2445. {
  2446. this.matrixMethods.Remove(tag);
  2447. break;
  2448. }
  2449. }
  2450. }
  2451. break;
  2452. }
  2453. }
  2454. if (replace || this.listView2.Items.Count == 0 || add == 0)
  2455. {
  2456. this.keyValuePairsAll.Add(tag, this.keyValuePairs);
  2457. this.graphicMethods.Add(tag, this.dataGridViewRowsGraphic);
  2458. this.matrixMethods.Add(tag, this.dataGridViewRowsMatrix);
  2459. ListViewItem listViewItem = new ListViewItem();
  2460. listViewItem.SubItems[0].Text = imgName;
  2461. listViewItem.Tag = "" + tag;
  2462. if (this.listView2.Items.Count == 0)
  2463. this.listView2.Items.Add(listViewItem);
  2464. else
  2465. this.listView2.Items.Insert(0, listViewItem);
  2466. this.dataGridView4.Rows.Clear();
  2467. for (int i = 0; i < keyValuePairs.Count; i++)
  2468. {
  2469. DataGridViewRow dgvr = new DataGridViewRow();
  2470. dgvr.Tag = tag;
  2471. foreach (DataGridViewColumn c in this.dataGridView4.Columns)
  2472. {
  2473. dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2474. }
  2475. dgvr.Cells[0].Value = imgName;
  2476. dgvr.Cells[1].Value = PdnResources.GetString("Menu.view.text") + i;
  2477. dgvr.Cells[2].Value = PdnResources.GetString("Menu.gravel.text");
  2478. dgvr.Cells[3].Value = PdnResources.GetString("Menu.boulder.text");
  2479. dgvr.Cells[4].Value = 0;
  2480. dgvr.Cells[5].Value = 0;
  2481. this.dataGridView4.Rows.Add(dgvr);
  2482. dgvr = new DataGridViewRow();
  2483. dgvr.Tag = tag;
  2484. foreach (DataGridViewColumn c in this.dataGridView4.Columns)
  2485. {
  2486. dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2487. }
  2488. dgvr.Cells[0].Value = imgName;
  2489. dgvr.Cells[1].Value = PdnResources.GetString("Menu.view.text") + i;
  2490. dgvr.Cells[2].Value = PdnResources.GetString("Menu.gravel.text");
  2491. dgvr.Cells[3].Value = PdnResources.GetString("Menu.boulwder.text");
  2492. dgvr.Cells[4].Value = 0;
  2493. dgvr.Cells[5].Value = 0;
  2494. this.dataGridView4.Rows.Add(dgvr);
  2495. dgvr = new DataGridViewRow();
  2496. dgvr.Tag = tag;
  2497. foreach (DataGridViewColumn c in this.dataGridView4.Columns)
  2498. {
  2499. dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2500. }
  2501. dgvr.Cells[0].Value = imgName;
  2502. dgvr.Cells[1].Value = PdnResources.GetString("Menu.view.text") + i;
  2503. dgvr.Cells[2].Value = PdnResources.GetString("Menu.gravel.text");
  2504. dgvr.Cells[3].Value = PdnResources.GetString("Menu.Thegravel.text");
  2505. dgvr.Cells[4].Value = 0;
  2506. dgvr.Cells[5].Value = 0;
  2507. this.dataGridView4.Rows.Add(dgvr);
  2508. dgvr = new DataGridViewRow();
  2509. dgvr.Tag = tag;
  2510. foreach (DataGridViewColumn c in this.dataGridView4.Columns)
  2511. {
  2512. dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2513. }
  2514. dgvr.Cells[0].Value = imgName;
  2515. dgvr.Cells[1].Value = PdnResources.GetString("Menu.view.text") + i;
  2516. dgvr.Cells[2].Value = PdnResources.GetString("Menu.gravel.text");
  2517. dgvr.Cells[3].Value = PdnResources.GetString("Menu.Finegravel.text");
  2518. dgvr.Cells[4].Value = 0;
  2519. dgvr.Cells[5].Value = 0;
  2520. this.dataGridView4.Rows.Add(dgvr);
  2521. dgvr = new DataGridViewRow();
  2522. dgvr.Tag = tag;
  2523. foreach (DataGridViewColumn c in this.dataGridView4.Columns)
  2524. {
  2525. dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2526. }
  2527. dgvr.Cells[0].Value = imgName;
  2528. dgvr.Cells[1].Value = PdnResources.GetString("Menu.view.text") + i;
  2529. dgvr.Cells[2].Value = PdnResources.GetString("Menu.sand.text");
  2530. dgvr.Cells[3].Value = PdnResources.GetString("Menu.bigsand.text");
  2531. dgvr.Cells[4].Value = 0;
  2532. dgvr.Cells[5].Value = 0;
  2533. this.dataGridView4.Rows.Add(dgvr);
  2534. dgvr = new DataGridViewRow();
  2535. dgvr.Tag = tag;
  2536. foreach (DataGridViewColumn c in this.dataGridView4.Columns)
  2537. {
  2538. dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2539. }
  2540. dgvr.Cells[0].Value = imgName;
  2541. dgvr.Cells[1].Value = PdnResources.GetString("Menu.view.text") + i;
  2542. dgvr.Cells[2].Value = PdnResources.GetString("Menu.sand.text");
  2543. dgvr.Cells[3].Value = PdnResources.GetString("Menu.Coarsesand.text");
  2544. dgvr.Cells[4].Value = 0;
  2545. dgvr.Cells[5].Value = 0;
  2546. this.dataGridView4.Rows.Add(dgvr);
  2547. dgvr = new DataGridViewRow();
  2548. dgvr.Tag = tag;
  2549. foreach (DataGridViewColumn c in this.dataGridView4.Columns)
  2550. {
  2551. dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2552. }
  2553. dgvr.Cells[0].Value = imgName;
  2554. dgvr.Cells[1].Value = PdnResources.GetString("Menu.view.text") + i;
  2555. dgvr.Cells[2].Value = PdnResources.GetString("Menu.sand.text");
  2556. dgvr.Cells[3].Value = PdnResources.GetString("Menu.Mediumsand.text");
  2557. dgvr.Cells[4].Value = 0;
  2558. dgvr.Cells[5].Value = 0;
  2559. this.dataGridView4.Rows.Add(dgvr);
  2560. dgvr = new DataGridViewRow();
  2561. dgvr.Tag = tag;
  2562. foreach (DataGridViewColumn c in this.dataGridView4.Columns)
  2563. {
  2564. dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2565. }
  2566. dgvr.Cells[0].Value = imgName;
  2567. dgvr.Cells[1].Value = PdnResources.GetString("Menu.view.text") + i;
  2568. dgvr.Cells[2].Value = PdnResources.GetString("Menu.sand.text");
  2569. dgvr.Cells[3].Value = PdnResources.GetString("Menu.Finesand.text");
  2570. dgvr.Cells[4].Value = 0;
  2571. dgvr.Cells[5].Value = 0;
  2572. this.dataGridView4.Rows.Add(dgvr);
  2573. dgvr = new DataGridViewRow();
  2574. dgvr.Tag = tag;
  2575. foreach (DataGridViewColumn c in this.dataGridView4.Columns)
  2576. {
  2577. dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2578. }
  2579. dgvr.Cells[0].Value = imgName;
  2580. dgvr.Cells[1].Value = PdnResources.GetString("Menu.view.text") + i;
  2581. dgvr.Cells[2].Value = PdnResources.GetString("Menu.sand.text");
  2582. dgvr.Cells[3].Value = PdnResources.GetString("Menu.Veryfinesand.text");
  2583. dgvr.Cells[4].Value = 0;
  2584. dgvr.Cells[5].Value = 0;
  2585. this.dataGridView4.Rows.Add(dgvr);
  2586. dgvr = new DataGridViewRow();
  2587. dgvr.Tag = tag;
  2588. foreach (DataGridViewColumn c in this.dataGridView4.Columns)
  2589. {
  2590. dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2591. }
  2592. dgvr.Cells[0].Value = imgName;
  2593. dgvr.Cells[1].Value = PdnResources.GetString("Menu.view.text") + i;
  2594. dgvr.Cells[2].Value = PdnResources.GetString("Menu.silt.text");
  2595. dgvr.Cells[3].Value = PdnResources.GetString("Menu.Coarsesilt.text");
  2596. dgvr.Cells[4].Value = 0;
  2597. dgvr.Cells[5].Value = 0;
  2598. this.dataGridView4.Rows.Add(dgvr);
  2599. dgvr = new DataGridViewRow();
  2600. dgvr.Tag = tag;
  2601. foreach (DataGridViewColumn c in this.dataGridView4.Columns)
  2602. {
  2603. dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2604. }
  2605. dgvr.Cells[0].Value = imgName;
  2606. dgvr.Cells[1].Value = PdnResources.GetString("Menu.view.text") + i;
  2607. dgvr.Cells[2].Value = PdnResources.GetString("Menu.silt.text");
  2608. dgvr.Cells[3].Value = PdnResources.GetString("Menu.Fineowdersand.text");
  2609. dgvr.Cells[4].Value = 0;
  2610. dgvr.Cells[5].Value = 0;
  2611. this.dataGridView4.Rows.Add(dgvr);
  2612. dgvr = new DataGridViewRow();
  2613. dgvr.Tag = tag;
  2614. foreach (DataGridViewColumn c in this.dataGridView4.Columns)
  2615. {
  2616. dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2617. }
  2618. dgvr.Cells[0].Value = imgName;
  2619. dgvr.Cells[1].Value = PdnResources.GetString("Menu.view.text") + i;
  2620. dgvr.Cells[2].Value = PdnResources.GetString("Menu.clay.text");
  2621. dgvr.Cells[3].Value = "-";
  2622. dgvr.Cells[4].Value = 0;
  2623. dgvr.Cells[5].Value = 0;
  2624. this.dataGridView4.Rows.Add(dgvr);
  2625. }
  2626. double index = 0;
  2627. // 巨砾
  2628. double boulders = 0;
  2629. // 粗砾
  2630. double coarseGravel = 0;
  2631. // 中砾
  2632. double mediuGravel = 0;
  2633. // 细砾
  2634. double fineGravel = 0;
  2635. // 巨砂
  2636. double giantSand = 0;
  2637. // 粗砂
  2638. double coarseSand = 0;
  2639. // 中砂
  2640. double mediumSand = 0;
  2641. // 细砂
  2642. double fineSand = 0;
  2643. // 极细砂
  2644. double superfineSand = 0;
  2645. // 粗粉砂
  2646. double coarseSilt = 0;
  2647. // 细粉砂
  2648. double fineSilt = 0;
  2649. // 粘土
  2650. double clay = 0;
  2651. // 总和
  2652. double all = 0;
  2653. foreach (var keyValuePair in keyValuePairs)
  2654. {
  2655. // 巨砾
  2656. boulders = 0;
  2657. // 粗砾
  2658. coarseGravel = 0;
  2659. // 中砾
  2660. mediuGravel = 0;
  2661. // 细砾
  2662. fineGravel = 0;
  2663. // 巨砂
  2664. giantSand = 0;
  2665. // 粗砂
  2666. coarseSand = 0;
  2667. // 中砂
  2668. mediumSand = 0;
  2669. // 细砂
  2670. fineSand = 0;
  2671. // 极细砂
  2672. superfineSand = 0;
  2673. // 粗粉砂
  2674. coarseSilt = 0;
  2675. // 细粉砂
  2676. fineSilt = 0;
  2677. // 粘土
  2678. clay = 0;
  2679. foreach (var item in keyValuePair)
  2680. {
  2681. // 巨砾
  2682. if (item.Value[0] > 256) boulders++;
  2683. // 粗砾
  2684. if (item.Value[0] > 64 && item.Value[0] <= 256) coarseGravel++;
  2685. // 中砾
  2686. if (item.Value[0] > 4 && item.Value[0] <= 64) mediuGravel++;
  2687. // 细砾
  2688. if (item.Value[0] > 2 && item.Value[0] <= 4) fineGravel++;
  2689. // 巨砂
  2690. if (item.Value[0] > 1 && item.Value[0] <= 2) giantSand++;
  2691. // 粗砂
  2692. if (Convert.ToDouble( item.Value[0]) > 0.5 && item.Value[0] <= 1) coarseSand++;
  2693. // 中砂
  2694. if (Convert.ToDouble(item.Value[0]) > 0.25 && Convert.ToDouble(item.Value[0]) <= 0.5) mediumSand++;
  2695. // 细砂
  2696. if (Convert.ToDouble(item.Value[0]) > 0.125 && Convert.ToDouble(item.Value[0]) <= 0.25) fineSand++;
  2697. // 极细砂
  2698. if (Convert.ToDouble(item.Value[0]) > 0.0625 && Convert.ToDouble(item.Value[0]) <= 0.125) superfineSand++;
  2699. // 粗粉砂
  2700. if (Convert.ToDouble(item.Value[0]) > 0.0312 && Convert.ToDouble(item.Value[0]) <= 0.0625) coarseSilt++;
  2701. // 细粉砂
  2702. if (Convert.ToDouble(item.Value[0]) > 0.0039 && Convert.ToDouble(item.Value[0]) <= 0.0312) fineSilt++;
  2703. // 粘土
  2704. if (Convert.ToDouble(item.Value[0]) <= 0.0039) clay++;
  2705. }
  2706. all = boulders + coarseGravel + mediuGravel + fineGravel + giantSand
  2707. + coarseSand + mediumSand + fineSand + superfineSand + coarseSilt + fineSilt + clay;
  2708. foreach (DataGridViewRow dataGridViewRow in this.dataGridView4.Rows)
  2709. {
  2710. if(dataGridViewRow.Cells[1].Value.Equals(PdnResources.GetString("Menu.view.text") + index))
  2711. {
  2712. if (dataGridViewRow.Cells[3].Value.Equals(PdnResources.GetString("Menu.boulder.text")))
  2713. {
  2714. dataGridViewRow.Cells[4].Value = boulders;
  2715. dataGridViewRow.Cells[5].Value = Math.Round(boulders / all, Convert.ToInt32(this.numericUpDown1.Value)) * 100 + "%";
  2716. }
  2717. else if (dataGridViewRow.Cells[3].Value.Equals(PdnResources.GetString("Menu.boulwder.text")))
  2718. {
  2719. dataGridViewRow.Cells[4].Value = coarseGravel;
  2720. dataGridViewRow.Cells[5].Value = Math.Round(coarseGravel / all, Convert.ToInt32(this.numericUpDown1.Value)) * 100 + "%";
  2721. }
  2722. else if(dataGridViewRow.Cells[3].Value.Equals(PdnResources.GetString("Menu.Thegravel.text")))
  2723. {
  2724. dataGridViewRow.Cells[4].Value = mediuGravel;
  2725. dataGridViewRow.Cells[5].Value = Math.Round(mediuGravel / all, Convert.ToInt32(this.numericUpDown1.Value)) * 100 + "%";
  2726. }
  2727. else if (dataGridViewRow.Cells[3].Value.Equals(PdnResources.GetString("Menu.Finegravel.text")))
  2728. {
  2729. dataGridViewRow.Cells[4].Value = fineGravel;
  2730. dataGridViewRow.Cells[5].Value = Math.Round(fineGravel / all, Convert.ToInt32(this.numericUpDown1.Value)) * 100 + "%";
  2731. }
  2732. else if (dataGridViewRow.Cells[3].Value.Equals(PdnResources.GetString("Menu.bigsand.text")))
  2733. {
  2734. dataGridViewRow.Cells[4].Value = giantSand;
  2735. dataGridViewRow.Cells[5].Value = Math.Round(giantSand / all, Convert.ToInt32(this.numericUpDown1.Value)) * 100 + "%";
  2736. }
  2737. else if (dataGridViewRow.Cells[3].Value.Equals(PdnResources.GetString("Menu.Coarsesand.text")))
  2738. {
  2739. dataGridViewRow.Cells[4].Value = coarseSand;
  2740. dataGridViewRow.Cells[5].Value = Math.Round(coarseSand / all, Convert.ToInt32(this.numericUpDown1.Value)) * 100 + "%";
  2741. }
  2742. else if (dataGridViewRow.Cells[3].Value.Equals(PdnResources.GetString("Menu.Mediumsand.text")))
  2743. {
  2744. dataGridViewRow.Cells[4].Value = mediumSand;
  2745. dataGridViewRow.Cells[5].Value = Math.Round(mediumSand / all, Convert.ToInt32(this.numericUpDown1.Value)) * 100 + "%";
  2746. }
  2747. else if (dataGridViewRow.Cells[3].Value.Equals(PdnResources.GetString("Menu.Finesand.text")))
  2748. {
  2749. dataGridViewRow.Cells[4].Value = fineSand;
  2750. dataGridViewRow.Cells[5].Value = Math.Round(fineSand / all, Convert.ToInt32(this.numericUpDown1.Value)) * 100 + "%";
  2751. }
  2752. else if (dataGridViewRow.Cells[3].Value.Equals(PdnResources.GetString("Menu.Veryfinesand.text")))
  2753. {
  2754. dataGridViewRow.Cells[4].Value = superfineSand;
  2755. dataGridViewRow.Cells[5].Value = Math.Round(superfineSand / all, Convert.ToInt32(this.numericUpDown1.Value)) * 100 + "%";
  2756. }
  2757. else if (dataGridViewRow.Cells[3].Value.Equals(PdnResources.GetString("Menu.Coarsesilt.text")))
  2758. {
  2759. dataGridViewRow.Cells[4].Value = coarseSilt;
  2760. dataGridViewRow.Cells[5].Value = Math.Round(coarseSilt / all, Convert.ToInt32(this.numericUpDown1.Value)) * 100 + "%";
  2761. }
  2762. else if (dataGridViewRow.Cells[3].Value.Equals(PdnResources.GetString("Menu.Fineowdersand.text")))
  2763. {
  2764. dataGridViewRow.Cells[4].Value = fineSilt;
  2765. dataGridViewRow.Cells[5].Value = Math.Round(fineSilt / all, Convert.ToInt32(this.numericUpDown1.Value)) * 100 + "%";
  2766. }
  2767. else if (dataGridViewRow.Cells[2].Value.Equals(PdnResources.GetString("Menu.clay.text")))
  2768. {
  2769. dataGridViewRow.Cells[4].Value = clay;
  2770. dataGridViewRow.Cells[5].Value = Math.Round(clay / all, Convert.ToInt32(this.numericUpDown1.Value)) * 100 + "%";
  2771. }
  2772. }
  2773. }
  2774. index++;
  2775. }
  2776. dataTable.TableName = tag;
  2777. foreach (System.Data.DataTable dataTable1 in dataTables)
  2778. {
  2779. if (dataTable1.TableName.Equals(dataTable.TableName))
  2780. {
  2781. dataTables.Remove(dataTable1);
  2782. break;
  2783. }
  2784. }
  2785. foreach (DataGridViewColumn c in this.dataGridView4.Columns)
  2786. {
  2787. dataTable.Columns.Add(c.HeaderText);
  2788. }
  2789. for (int i = 0; i < keyValuePairs.Count; i++)
  2790. {
  2791. DataRow dataRow = dataTable.NewRow();
  2792. dataRow[0] = imgName;
  2793. dataRow[1] = PdnResources.GetString("Menu.view.text") + i;
  2794. dataRow[2] = PdnResources.GetString("Menu.gravel.text");
  2795. dataRow[3] = PdnResources.GetString("Menu.boulder.text");
  2796. dataRow[4] = boulders;
  2797. dataRow[5] = boulders / all * 100;
  2798. dataTable.Rows.Add(dataRow);
  2799. dataRow = dataTable.NewRow();
  2800. dataRow[0] = imgName;
  2801. dataRow[1] = PdnResources.GetString("Menu.view.text") + i;
  2802. dataRow[2] = PdnResources.GetString("Menu.gravel.text");
  2803. dataRow[3] = PdnResources.GetString("Menu.boulwder.text");
  2804. dataRow[4] = coarseGravel;
  2805. dataRow[5] = coarseGravel / all * 100;
  2806. dataTable.Rows.Add(dataRow);
  2807. dataRow = dataTable.NewRow();
  2808. dataRow[0] = imgName;
  2809. dataRow[1] = PdnResources.GetString("Menu.view.text") + i;
  2810. dataRow[2] = PdnResources.GetString("Menu.gravel.text");
  2811. dataRow[3] = PdnResources.GetString("Menu.Thegravel.text");
  2812. dataRow[4] = mediuGravel;
  2813. dataRow[5] = mediuGravel / all * 100;
  2814. dataTable.Rows.Add(dataRow);
  2815. dataRow = dataTable.NewRow();
  2816. dataRow[0] = imgName;
  2817. dataRow[1] = PdnResources.GetString("Menu.view.text") + i;
  2818. dataRow[2] = PdnResources.GetString("Menu.gravel.text");
  2819. dataRow[3] = PdnResources.GetString("Menu.Finegravel.text");
  2820. dataRow[4] = fineGravel;
  2821. dataRow[5] = fineGravel / all * 100;
  2822. dataTable.Rows.Add(dataRow);
  2823. dataRow = dataTable.NewRow();
  2824. dataRow[0] = imgName;
  2825. dataRow[1] = PdnResources.GetString("Menu.view.text") + i;
  2826. dataRow[2] = PdnResources.GetString("Menu.sand.text");
  2827. dataRow[3] = PdnResources.GetString("Menu.bigsand.text");
  2828. dataRow[4] = giantSand;
  2829. dataRow[5] = giantSand / all * 100;
  2830. dataTable.Rows.Add(dataRow);
  2831. dataRow = dataTable.NewRow();
  2832. dataRow[0] = imgName;
  2833. dataRow[1] = PdnResources.GetString("Menu.view.text") + i;
  2834. dataRow[2] = PdnResources.GetString("Menu.sand.text");
  2835. dataRow[3] = PdnResources.GetString("Menu.Coarsesand.text");
  2836. dataRow[4] = coarseSand;
  2837. dataRow[5] = coarseSand / all * 100;
  2838. dataTable.Rows.Add(dataRow);
  2839. dataRow = dataTable.NewRow();
  2840. dataRow[0] = imgName;
  2841. dataRow[1] = PdnResources.GetString("Menu.view.text") + i;
  2842. dataRow[2] = PdnResources.GetString("Menu.sand.text");
  2843. dataRow[3] = PdnResources.GetString("Menu.Mediumsand.text");
  2844. dataRow[4] = mediumSand;
  2845. dataRow[5] = mediumSand / all * 100;
  2846. dataTable.Rows.Add(dataRow);
  2847. dataRow = dataTable.NewRow();
  2848. dataRow[0] = imgName;
  2849. dataRow[1] = PdnResources.GetString("Menu.view.text") + i;
  2850. dataRow[2] = PdnResources.GetString("Menu.sand.text");
  2851. dataRow[3] = PdnResources.GetString("Menu.Finesand.text");
  2852. dataRow[4] = fineSand;
  2853. dataRow[5] = fineSand / all * 100;
  2854. dataTable.Rows.Add(dataRow);
  2855. dataRow = dataTable.NewRow();
  2856. dataRow[0] = imgName;
  2857. dataRow[1] = PdnResources.GetString("Menu.view.text") + i;
  2858. dataRow[2] = PdnResources.GetString("Menu.sand.text");
  2859. dataRow[3] = PdnResources.GetString("Menu.Veryfinesand.text");
  2860. dataRow[4] = superfineSand;
  2861. dataRow[5] = superfineSand / all * 100;
  2862. dataTable.Rows.Add(dataRow);
  2863. dataRow = dataTable.NewRow();
  2864. dataRow[0] = imgName;
  2865. dataRow[1] = PdnResources.GetString("Menu.view.text") + i;
  2866. dataRow[2] = PdnResources.GetString("Menu.silt.text");
  2867. dataRow[3] = PdnResources.GetString("Menu.Coarsesilt.text");
  2868. dataRow[4] = coarseSilt;
  2869. dataRow[5] = coarseSilt / all * 100;
  2870. dataTable.Rows.Add(dataRow);
  2871. dataRow = dataTable.NewRow();
  2872. dataRow[0] = imgName;
  2873. dataRow[1] = PdnResources.GetString("Menu.view.text") + i;
  2874. dataRow[2] = PdnResources.GetString("Menu.silt.text");
  2875. dataRow[3] = PdnResources.GetString("Menu.Fineowdersand.text");
  2876. dataRow[4] = fineSilt;
  2877. dataRow[5] = fineSilt / all * 100;
  2878. dataTable.Rows.Add(dataRow);
  2879. dataRow = dataTable.NewRow();
  2880. dataRow[0] = imgName;
  2881. dataRow[1] = PdnResources.GetString("Menu.view.text") + i;
  2882. dataRow[2] = PdnResources.GetString("Menu.Theclay.text");
  2883. dataRow[3] = "-";
  2884. dataRow[4] = clay;
  2885. dataRow[5] = clay / all * 100;
  2886. dataTable.Rows.Add(dataRow);
  2887. }
  2888. this.dataTables.Add(dataTable);
  2889. if (this.allShow)
  2890. AllShow();
  2891. this.listView2.Items[0].Selected = true;
  2892. //保存处理后的图片
  2893. double pantographRatio = (double)this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetRulerMultiple(MeasurementUnit.Micron);//标尺*放大倍数
  2894. List<Bitmap> tempBit = new List<Bitmap>();
  2895. Bitmap originalBit = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].CompositionSurface.CreateAliasedBitmap();
  2896. originalBit.Tag = pantographRatio;
  2897. tempBit.Add(originalBit);
  2898. //Mat mat = new Mat();
  2899. //this.documentWorkspace.PhaseModels[0].mat.CopyTo(mat);
  2900. Bitmap processedBit = OpenCvSharp.Extensions.BitmapConverter.ToBitmap(this.documentWorkspace.PhaseModels[0].mat.Clone());
  2901. Bitmap newBit = originalBit.Clone(new System.Drawing.Rectangle(0, 0, originalBit.Width, originalBit.Height), originalBit.PixelFormat);
  2902. this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].FieldBitmap(newBit);
  2903. //Mat mat = new Mat();
  2904. //this.documentWorkspace.PhaseModels[0].mat.CopyTo(mat);
  2905. //Bitmap newBit = OpenCvSharp.Extensions.BitmapConverter.ToBitmap(mat);
  2906. Graphics graphics = Graphics.FromImage(newBit);
  2907. graphics.DrawImage(processedBit, new PointF(0, 0));
  2908. Draw(graphics);
  2909. newBit.Tag = pantographRatio;
  2910. tempBit.Add(newBit);
  2911. if (bitDic.ContainsKey(tag))
  2912. bitDic[tag] = tempBit;
  2913. else
  2914. bitDic.Add(tag, tempBit);
  2915. //拼接中间数据
  2916. List<List<string>> dataList = new List<List<string>>();
  2917. List<string> columnName = new List<string>();
  2918. columnName.Add(PdnResources.GetString("Menu.Imagement.Measurementlist.ordernumber.text"));
  2919. columnName.Add(PdnResources.GetString("Menu.diameter.text"));
  2920. columnName.Add("Φ"+ PdnResources.GetString("Menu.Imagement.Measurementlist.value.text"));
  2921. dataList.Add(columnName);
  2922. int no = 0;
  2923. foreach (var keyValuePairs in keyValuePairsAll)
  2924. {
  2925. foreach (var item in keyValuePairs.Value)
  2926. {
  2927. foreach (var value in item)
  2928. {
  2929. no++;
  2930. List<string> strList = new List<string>();
  2931. strList.Add("" + no);
  2932. strList.Add("" + value.Value[0]);
  2933. strList.Add("" + value.Value[1]);
  2934. dataList.Add(strList);
  2935. }
  2936. }
  2937. }
  2938. bool isExist = false;//是否已存在进行替换
  2939. int modelIndex = -1;//要替换的下标
  2940. for (int j = 0; j < tempDataModel.Count; j++)
  2941. {
  2942. if (tempDataModel[j].tagName.Equals(tag))
  2943. {
  2944. isExist = true;
  2945. modelIndex = j;
  2946. break;
  2947. }
  2948. }
  2949. if (isExist && modelIndex > -1)
  2950. tempDataModel[modelIndex].dataList = dataList;
  2951. else
  2952. {
  2953. ExportProjectModel newModel = new ExportProjectModel();
  2954. newModel.tagName = tag;
  2955. newModel.picName = imgName;
  2956. newModel.dataList = dataList;
  2957. tempDataModel.Add(newModel);
  2958. }
  2959. }
  2960. }
  2961. /// <summary>
  2962. /// 取消全部显示
  2963. /// </summary>
  2964. /// <param name="sender"></param>
  2965. /// <param name="e"></param>
  2966. private void button16_Click(object sender, EventArgs e)
  2967. {
  2968. this.allShow = false;
  2969. this.button11.Visible = true;
  2970. this.button16.Visible = false;
  2971. if (this.listView2.Items.Count > 0)
  2972. {
  2973. if (this.listView2.SelectedItems.Count > 0)
  2974. {
  2975. List<int> dataTableIndex = new List<int>();
  2976. if (this.dataTables.Count == 0)
  2977. return;
  2978. for (int i = 0; i < this.dataTables.Count; i++)
  2979. {
  2980. foreach (ListViewItem item in this.listView2.SelectedItems)
  2981. {
  2982. if (this.dataTables[i].TableName.Equals(item.Tag))
  2983. dataTableIndex.Add(i);
  2984. }
  2985. }
  2986. this.dataGridView4.Rows.Clear();
  2987. foreach (var item in dataTableIndex)
  2988. {
  2989. if (this.dataTables[item].Rows.Count > 0)
  2990. {
  2991. for (int r = 0; r < this.dataTables[item].Rows.Count; r++)
  2992. {
  2993. DataGridViewRow dgvr = new DataGridViewRow();
  2994. dgvr.Tag = this.dataTables[item].TableName;
  2995. foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
  2996. {
  2997. dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
  2998. }
  2999. for (int c = 0; c < this.dataTables[item].Columns.Count; c++)
  3000. {
  3001. if (c == this.dataTables[item].Columns.Count - 1)
  3002. dgvr.Cells[c].Value = Math.Round((double)Convert.ToDecimal(this.dataTables[item].Rows[r][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString() + "%";
  3003. else
  3004. dgvr.Cells[c].Value = this.dataTables[item].Rows[r][c].ToString();
  3005. }
  3006. this.dataGridView4.Rows.Add(dgvr);
  3007. }
  3008. }
  3009. }
  3010. }
  3011. else
  3012. {
  3013. this.listView2.Items[0].Selected = true;
  3014. if (this.dataTables.Count > 0
  3015. && this.dataTables[this.dataTables.Count - 1].Rows.Count > 0)
  3016. {
  3017. this.dataGridView4.Rows.Clear();
  3018. for (int r = 0; r < this.dataTables[this.dataTables.Count - 1].Rows.Count; r++)
  3019. {
  3020. DataGridViewRow dgvr = new DataGridViewRow();
  3021. dgvr.Tag = this.dataTables[this.dataTables.Count - 1].TableName;
  3022. foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
  3023. {
  3024. dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
  3025. }
  3026. for (int c = 0; c < this.dataTables[this.dataTables.Count - 1].Columns.Count; c++)
  3027. {
  3028. if (c == this.dataTables[this.dataTables.Count - 1].Columns.Count - 1)
  3029. dgvr.Cells[c].Value = Math.Round((double)Convert.ToDecimal(this.dataTables[this.dataTables.Count - 1].Rows[r][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString() + "%";
  3030. else
  3031. dgvr.Cells[c].Value = this.dataTables[this.dataTables.Count - 1].Rows[r][c].ToString();
  3032. }
  3033. this.dataGridView4.Rows.Add(dgvr);
  3034. }
  3035. }
  3036. }
  3037. }
  3038. }
  3039. /// <summary>
  3040. /// 分析结果删除
  3041. /// </summary>
  3042. /// <param name="sender"></param>
  3043. /// <param name="e"></param>
  3044. private void button12_Click(object sender, EventArgs e)
  3045. {
  3046. if (this.listView2.Items.Count > 0)
  3047. {
  3048. if (this.listView2.SelectedItems.Count > 0)
  3049. {
  3050. DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Areyousuretodeletethisanalysisresult.text")+"?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
  3051. if (dr == DialogResult.OK)
  3052. {
  3053. List<string> detaleName = new List<string>();
  3054. int selectIndex = this.listView2.SelectedItems[0].Index;
  3055. foreach (ListViewItem item in this.listView2.SelectedItems)
  3056. {
  3057. detaleName.Add(item.Tag.ToString());
  3058. this.listView2.Items.Remove(item);
  3059. }
  3060. foreach (string tag in detaleName)
  3061. {
  3062. foreach (DataTable dataTable in this.dataTables)
  3063. {
  3064. if (dataTable.TableName.Equals(tag))
  3065. {
  3066. this.dataTables.Remove(dataTable);
  3067. break;
  3068. }
  3069. }
  3070. if (bitDic.ContainsKey(tag))
  3071. bitDic.Remove(tag);
  3072. foreach (ExportProjectModel model in this.tempDataModel)
  3073. {
  3074. if (model.tagName.Equals(tag))
  3075. {
  3076. this.tempDataModel.Remove(model);
  3077. break;
  3078. }
  3079. }
  3080. this.keyValuePairsAll.Remove(tag);
  3081. this.graphicMethods.Remove(tag);
  3082. this.matrixMethods.Remove(tag);
  3083. }
  3084. if (this.listView2.Items.Count > 0)
  3085. {
  3086. if (selectIndex == 0)
  3087. this.listView2.Items[0].Selected = true;
  3088. else
  3089. this.listView2.Items[selectIndex - 1].Selected = true;
  3090. RefreshDataGridView4();
  3091. }
  3092. else
  3093. {
  3094. this.dataGridView4.Rows.Clear();
  3095. }
  3096. }
  3097. }
  3098. else
  3099. {
  3100. MessageBox.Show(PdnResources.GetString("Menu.Pleaseselecttheanalysisresulttodelete.text")+"!");
  3101. }
  3102. }
  3103. else
  3104. {
  3105. MessageBox.Show(PdnResources.GetString("Menu.Nodataintheanalysisresults.text")+"!");
  3106. }
  3107. }
  3108. /// <summary>
  3109. /// 刷新分析结果数据
  3110. /// </summary>
  3111. private void RefreshDataGridView4()
  3112. {
  3113. if (!this.allShow)
  3114. {
  3115. if (this.listView2.SelectedItems.Count > 0)
  3116. {
  3117. List<int> dataTableIndex = new List<int>();
  3118. for (int i = 0; i < this.dataTables.Count; i++)
  3119. {
  3120. foreach (ListViewItem item in this.listView2.SelectedItems)
  3121. {
  3122. if (this.dataTables[i].TableName.Equals(item.Tag))
  3123. dataTableIndex.Add(i);
  3124. }
  3125. }
  3126. if (this.dataTables.Count == 0)
  3127. return;
  3128. this.dataGridView4.Rows.Clear();
  3129. foreach (var item in dataTableIndex)
  3130. {
  3131. if (this.dataTables[item].Rows.Count > 0)
  3132. {
  3133. for (int r = 0; r < this.dataTables[item].Rows.Count; r++)
  3134. {
  3135. DataGridViewRow dgvr = new DataGridViewRow();
  3136. dgvr.Tag = this.dataTables[item].TableName;
  3137. foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
  3138. {
  3139. dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
  3140. }
  3141. for (int c = 0; c < this.dataTables[item].Columns.Count; c++)
  3142. {
  3143. if (c != this.dataTables[item].Columns.Count - 1)
  3144. dgvr.Cells[c].Value = this.dataTables[item].Rows[r][c].ToString();
  3145. else
  3146. dgvr.Cells[c].Value = Math.Round((double)Convert.ToDecimal(this.dataTables[item].Rows[r][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString() + "%";
  3147. }
  3148. this.dataGridView4.Rows.Add(dgvr);
  3149. }
  3150. }
  3151. }
  3152. }
  3153. }
  3154. else
  3155. {
  3156. this.dataGridView4.Rows.Clear();
  3157. DataTable dataTable = new DataTable();
  3158. for (int i = this.dataTables.Count - 1; i >= 0; i--)
  3159. {
  3160. dataTable = this.dataTables[i];
  3161. for (int r = 0; r < dataTable.Rows.Count; r++)
  3162. {
  3163. DataGridViewRow dgvr = new DataGridViewRow();
  3164. dgvr.Tag = dataTable.TableName;
  3165. foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
  3166. {
  3167. dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
  3168. }
  3169. for (int c = 0; c < dataTable.Columns.Count; c++)
  3170. {
  3171. if (c != dataTable.Columns.Count - 1)
  3172. dgvr.Cells[c].Value = dataTable.Rows[r][c].ToString();
  3173. else
  3174. dgvr.Cells[c].Value = Math.Round((double)Convert.ToDecimal(dataTable.Rows[r][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString() + "%";
  3175. }
  3176. this.dataGridView4.Rows.Add(dgvr);
  3177. }
  3178. }
  3179. }
  3180. }
  3181. /// <summary>
  3182. /// 未选择分析结果
  3183. /// </summary>
  3184. /// <param name="sender"></param>
  3185. /// <param name="e"></param>
  3186. private void listView2_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
  3187. {
  3188. if (!this.allShow)
  3189. {
  3190. if (this.listView2.SelectedItems.Count == 0)
  3191. {
  3192. this.dataGridView4.Rows.Clear();
  3193. this.dataGridView2.Rows.Clear();
  3194. }
  3195. }
  3196. }
  3197. /// <summary>
  3198. /// 切换分析结果
  3199. /// </summary>
  3200. /// <param name="sender"></param>
  3201. /// <param name="e"></param>
  3202. private void listView2_SelectedIndexChanged(object sender, EventArgs e)
  3203. {
  3204. if (!this.allShow)
  3205. {
  3206. if (this.listView2.SelectedItems.Count > 0)
  3207. {
  3208. List<int> dataTableIndex = new List<int>();
  3209. if (this.dataTables.Count == 0)
  3210. return;
  3211. for (int i = 0; i < this.dataTables.Count; i++)
  3212. {
  3213. foreach (ListViewItem item in this.listView2.SelectedItems)
  3214. {
  3215. if (this.dataTables[i].TableName.Equals(item.Tag))
  3216. dataTableIndex.Add(i);
  3217. }
  3218. }
  3219. this.dataGridView4.Rows.Clear();
  3220. foreach (var item in dataTableIndex)
  3221. {
  3222. if (this.dataTables[item].Rows.Count > 0)
  3223. {
  3224. for (int r = 0; r < this.dataTables[item].Rows.Count; r++)
  3225. {
  3226. DataGridViewRow dgvr = new DataGridViewRow();
  3227. dgvr.Tag = this.dataTables[item].TableName;
  3228. foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
  3229. {
  3230. dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
  3231. }
  3232. for (int c = 0; c < this.dataTables[item].Columns.Count; c++)
  3233. {
  3234. if (c == this.dataTables[item].Columns.Count - 1)
  3235. dgvr.Cells[c].Value = Math.Round((double)Convert.ToDecimal(this.dataTables[item].Rows[r][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString() + "%";
  3236. else
  3237. dgvr.Cells[c].Value = this.dataTables[item].Rows[r][c].ToString();
  3238. }
  3239. this.dataGridView4.Rows.Add(dgvr);
  3240. }
  3241. }
  3242. }
  3243. }
  3244. }
  3245. RefreshStatistics();
  3246. }
  3247. /// <summary>
  3248. /// 刷新结果数据
  3249. /// </summary>
  3250. private void RefreshStatistics()
  3251. {
  3252. if (this.listView2.SelectedItems.Count == 0 && !this.allShow)
  3253. return;
  3254. this.dataGridView2.Rows.Clear();
  3255. //
  3256. // 岩石定名
  3257. //
  3258. // 大类
  3259. // 砾百分比
  3260. double percentageGravel = 0;
  3261. // 砂百分比
  3262. double percentageSand = 0;
  3263. // 粉砂百分比
  3264. double percentageSilt = 0;
  3265. // 粘土百分比
  3266. double percentageClay = 0;
  3267. // 小类
  3268. // 巨砾百分比
  3269. double percentageBoulders = 0;
  3270. // 粗砾百分比
  3271. double percentageCoarseGravel = 0;
  3272. // 中砾百分比
  3273. double percentageMediuGravel = 0;
  3274. // 细砾百分比
  3275. double percentageFineGravel = 0;
  3276. // 巨砂百分比
  3277. double percentageGiantSand = 0;
  3278. // 粗砂百分比
  3279. double percentageCoarseSand = 0;
  3280. // 中砂百分比
  3281. double percentageMediumSand = 0;
  3282. // 细砂百分比
  3283. double percentageFineSand = 0;
  3284. // 极细砂百分比
  3285. double percentageSuperfineSand = 0;
  3286. // 粗粉砂百分比
  3287. double percentageCoarseSilt = 0;
  3288. // 细粉砂百分比
  3289. double percentageFineSilt = 0;
  3290. foreach (DataTable dataTable in dataTables)
  3291. {
  3292. foreach (ListViewItem listViewItem in this.listView2.SelectedItems)
  3293. {
  3294. if(dataTable.TableName.Equals(listViewItem.Tag))
  3295. {
  3296. for (int r = 0; r < dataTable.Rows.Count; r++)
  3297. {
  3298. if (dataTable.Rows[r][2].Equals(PdnResources.GetString("Menu.gravel.text")))
  3299. {
  3300. percentageGravel += Convert.ToDouble(dataTable.Rows[r][5]);
  3301. }
  3302. else if (dataTable.Rows[r][2].Equals(PdnResources.GetString("Menu.sand.text")))
  3303. {
  3304. percentageSand += Convert.ToDouble(dataTable.Rows[r][5]);
  3305. }
  3306. else if (dataTable.Rows[r][2].Equals(PdnResources.GetString("Menu.silt.text")))
  3307. {
  3308. percentageSilt += Convert.ToDouble(dataTable.Rows[r][5]);
  3309. }
  3310. else if (dataTable.Rows[r][2].Equals(PdnResources.GetString("Menu.clay.text")))
  3311. {
  3312. percentageClay += Convert.ToDouble(dataTable.Rows[r][5]);
  3313. }
  3314. if (dataTable.Rows[r][3].Equals(PdnResources.GetString("Menu.boulder.text")))
  3315. {
  3316. percentageBoulders += Convert.ToDouble(dataTable.Rows[r][5]);
  3317. }
  3318. else if (dataTable.Rows[r][3].Equals(PdnResources.GetString("Menu.boulwder.text")))
  3319. {
  3320. percentageCoarseGravel += Convert.ToDouble(dataTable.Rows[r][5]);
  3321. }
  3322. else if (dataTable.Rows[r][3].Equals(PdnResources.GetString("Menu.Thegravel.text")))
  3323. {
  3324. percentageMediuGravel += Convert.ToDouble(dataTable.Rows[r][5]);
  3325. }
  3326. else if (dataTable.Rows[r][3].Equals(PdnResources.GetString("Menu.Finegravel.text")))
  3327. {
  3328. percentageFineGravel += Convert.ToDouble(dataTable.Rows[r][5]);
  3329. }
  3330. if (dataTable.Rows[r][3].Equals(PdnResources.GetString("Menu.bigsand.text")))
  3331. {
  3332. percentageGiantSand += Convert.ToDouble(dataTable.Rows[r][5]);
  3333. }
  3334. else if (dataTable.Rows[r][3].Equals(PdnResources.GetString("Menu.Coarsesand.text")))
  3335. {
  3336. percentageCoarseSand += Convert.ToDouble(dataTable.Rows[r][5]);
  3337. }
  3338. else if (dataTable.Rows[r][3].Equals(PdnResources.GetString("Menu.Mediumsand.text")))
  3339. {
  3340. percentageMediumSand += Convert.ToDouble(dataTable.Rows[r][5]);
  3341. }
  3342. else if (dataTable.Rows[r][3].Equals(PdnResources.GetString("Menu.Finesand.text")))
  3343. {
  3344. percentageFineSand += Convert.ToDouble(dataTable.Rows[r][5]);
  3345. }
  3346. else if (dataTable.Rows[r][3].Equals(PdnResources.GetString("Menu.Veryfinesand.text")))
  3347. {
  3348. percentageSuperfineSand += Convert.ToDouble(dataTable.Rows[r][5]);
  3349. }
  3350. else if (dataTable.Rows[r][3].Equals(PdnResources.GetString("Menu.Coarsesilt.text")))
  3351. {
  3352. percentageCoarseSilt += Convert.ToDouble(dataTable.Rows[r][5]);
  3353. }
  3354. else if (dataTable.Rows[r][3].Equals(PdnResources.GetString("Menu.Fineowdersand.text")))
  3355. {
  3356. percentageFineSilt += Convert.ToDouble(dataTable.Rows[r][5]);
  3357. }
  3358. }
  3359. }
  3360. }
  3361. }
  3362. // 岩石定名(主)
  3363. string rockNamingFirst = string.Empty;
  3364. if(percentageGravel >= 50 || percentageSand >= 50 || percentageSilt >= 50 || percentageClay >= 50)
  3365. {
  3366. // 砾
  3367. if (percentageGravel >= 50)
  3368. {
  3369. rockNamingFirst = PdnResources.GetString("Menu.conglomerate.text");
  3370. // 其中小类大于等于50%
  3371. if (percentageBoulders >= 50)
  3372. rockNamingFirst = PdnResources.GetString("Menu.Thegiantconglomerate.text");
  3373. else if (percentageCoarseGravel >= 50)
  3374. rockNamingFirst = PdnResources.GetString("Menu.Coarseconglomerate.text");
  3375. else if (percentageMediuGravel >= 50)
  3376. rockNamingFirst = PdnResources.GetString("Menu.Theconglomerate.text");
  3377. else if (percentageFineGravel >= 50)
  3378. rockNamingFirst = PdnResources.GetString("Menu.Fineconglomerate.text");
  3379. // 另有小类大于等于50%小于25%
  3380. if (percentageBoulders >= 25 && percentageBoulders < 50)
  3381. rockNamingFirst = PdnResources.GetString("Menu.Bouldemass.text") + rockNamingFirst;
  3382. else if (percentageCoarseGravel >= 25 && percentageCoarseGravel < 50)
  3383. rockNamingFirst = PdnResources.GetString("Menu.cobbly.text") + rockNamingFirst;
  3384. else if (percentageMediuGravel >= 25 && percentageMediuGravel < 50)
  3385. rockNamingFirst = PdnResources.GetString("Menu.Thegraveql.text") + rockNamingFirst;
  3386. else if (percentageFineGravel >= 25 && percentageFineGravel < 50)
  3387. rockNamingFirst = PdnResources.GetString("Menu.Finegraveql.text") + rockNamingFirst;
  3388. // 砂
  3389. if (percentageSand >= 25 && percentageSand < 50)
  3390. rockNamingFirst = PdnResources.GetString("Menu.sandyq.text") + rockNamingFirst;
  3391. // 粉砂
  3392. else if (percentageSilt >= 25 && percentageSilt < 50)
  3393. rockNamingFirst = PdnResources.GetString("Menu.siltyq.text") + rockNamingFirst;
  3394. // 粘土
  3395. else if (percentageClay >= 25 && percentageClay < 50)
  3396. rockNamingFirst = PdnResources.GetString("Menu.clayq.text") + rockNamingFirst;
  3397. // 砂
  3398. if (percentageSand >= 10 && percentageSand < 25)
  3399. rockNamingFirst = PdnResources.GetString("Menu.sandqa.text") + rockNamingFirst;
  3400. // 粉砂
  3401. else if (percentageSilt >= 10 && percentageSilt < 25)
  3402. rockNamingFirst = PdnResources.GetString("Menu.Containingsilty.text") + rockNamingFirst;
  3403. // 粘土
  3404. else if (percentageClay >= 10 && percentageClay < 25)
  3405. rockNamingFirst = PdnResources.GetString("Menu.Containclay.text") + rockNamingFirst;
  3406. }
  3407. // 砂
  3408. else if (percentageSand >= 50)
  3409. {
  3410. rockNamingFirst = PdnResources.GetString("Menu.sandstone.text");
  3411. if (percentageGiantSand >= 50 || percentageCoarseSand >= 50 || percentageMediumSand >= 50
  3412. || percentageFineSand >= 50 || percentageSuperfineSand >= 50)
  3413. {
  3414. // 其中小类大于等于50%
  3415. if (percentageGiantSand >= 50)
  3416. rockNamingFirst = PdnResources.GetString("Menu.Thegiantsandstone.text");
  3417. else if (percentageCoarseSand >= 50)
  3418. rockNamingFirst = PdnResources.GetString("Menu.grit.text");
  3419. else if (percentageMediumSand >= 50)
  3420. rockNamingFirst = PdnResources.GetString("Menu.Sandstoneinthe.text");
  3421. else if (percentageFineSand >= 50)
  3422. rockNamingFirst = PdnResources.GetString("Menu.Finesandstone.text");
  3423. else if (percentageSuperfineSand >= 50)
  3424. rockNamingFirst = PdnResources.GetString("Menu.Veryfinesandstone.text");
  3425. // 另有小类大于等于25%小于50%
  3426. if (percentageGiantSand >= 25 && percentageGiantSand < 50)
  3427. rockNamingFirst = PdnResources.GetString("Menu.Thegiantsand.text") + rockNamingFirst;
  3428. else if (percentageCoarseSand >= 25 && percentageCoarseSand < 50)
  3429. rockNamingFirst = PdnResources.GetString("Menu.Coqarsesand.text") + rockNamingFirst;
  3430. else if (percentageMediumSand >= 25 && percentageMediumSand < 50)
  3431. rockNamingFirst = PdnResources.GetString("Menu.Mediumsandmass.text") + rockNamingFirst;
  3432. else if (percentageFineSand >= 25 && percentageFineSand < 50)
  3433. rockNamingFirst = PdnResources.GetString("Menu.Fineqsandy.text") + rockNamingFirst;
  3434. else if (percentageSuperfineSand >= 25 && percentageSuperfineSand < 50)
  3435. rockNamingFirst = PdnResources.GetString("Menu.Fineqsandy.text") + rockNamingFirst;
  3436. }
  3437. // 各小类均低于50%
  3438. else
  3439. {
  3440. if (percentageGiantSand >= 25 && percentageCoarseSand >= 25 && percentageMediumSand < 25 && percentageFineSand < 25 && percentageSuperfineSand < 25)
  3441. {
  3442. if (percentageGiantSand > percentageCoarseSand) rockNamingFirst = PdnResources.GetString("Menu.Coarsesandgiantsandstone.text");
  3443. else if (percentageGiantSand < percentageCoarseSand) rockNamingFirst = PdnResources.GetString("Menu.Giantgritsandstone.text");
  3444. else rockNamingFirst = PdnResources.GetString("Menu.Coarsesandgiantsandstone.text");
  3445. }
  3446. else if (percentageGiantSand >= 25 && percentageMediumSand >= 25 && percentageCoarseSand < 25 && percentageFineSand < 25 && percentageSuperfineSand < 25)
  3447. {
  3448. if (percentageGiantSand > percentageMediumSand) rockNamingFirst = PdnResources.GetString("Menu.Middlesandgiantsandstone.text");
  3449. else if (percentageGiantSand < percentageMediumSand) rockNamingFirst = PdnResources.GetString("Menu.Giantsandstone.text");
  3450. else rockNamingFirst = PdnResources.GetString("Menu.Middlesandgiantsandstone.text");
  3451. }
  3452. else if (percentageGiantSand >= 25 && percentageFineSand >= 25 && percentageCoarseSand < 25 && percentageMediumSand < 25 && percentageSuperfineSand < 25)
  3453. {
  3454. if (percentageGiantSand > percentageFineSand) rockNamingFirst = PdnResources.GetString("Menu.Finegiantsandstone.text");
  3455. else if (percentageGiantSand < percentageFineSand) rockNamingFirst = PdnResources.GetString("Menu.Giantfinesandstone.text");
  3456. else rockNamingFirst = PdnResources.GetString("Menu.Finegiantsandstone.text");
  3457. }
  3458. else if (percentageGiantSand >= 25 && percentageSuperfineSand >= 25 && percentageCoarseSand < 25 && percentageMediumSand < 25 && percentageFineSand < 25)
  3459. {
  3460. if (percentageGiantSand > percentageSuperfineSand) rockNamingFirst = PdnResources.GetString("Menu.Extremelyfinegiansandstone.text");
  3461. else if (percentageGiantSand < percentageSuperfineSand) rockNamingFirst = PdnResources.GetString("Menu.Megareniteveryfinesandstone.text");
  3462. else rockNamingFirst = PdnResources.GetString("Menu.Extremelyfinegiansandstone.text");
  3463. }
  3464. else if (percentageCoarseSand >= 25 && percentageMediumSand >= 25 && percentageGiantSand < 25 && percentageFineSand < 25 && percentageSuperfineSand < 25)
  3465. {
  3466. if (percentageCoarseSand > percentageMediumSand) rockNamingFirst = PdnResources.GetString("Menu.Mediumsandcoarsesandstone.text");
  3467. else if (percentageCoarseSand < percentageMediumSand) rockNamingFirst = PdnResources.GetString("Menu.Sandstoneincoarsesand.text");
  3468. else rockNamingFirst = PdnResources.GetString("Menu.Mediumsandcoarsesandstone.text");
  3469. }
  3470. else if (percentageCoarseSand >= 25 && percentageFineSand >= 25 && percentageGiantSand < 25 && percentageMediumSand < 25 && percentageSuperfineSand < 25)
  3471. {
  3472. if (percentageCoarseSand > percentageFineSand) rockNamingFirst = PdnResources.GetString("Menu.Finesandandcoarsesandstone.text");
  3473. else if (percentageCoarseSand < percentageFineSand) rockNamingFirst = PdnResources.GetString("Menu.Coarssandandfineandstone.text");
  3474. else rockNamingFirst = PdnResources.GetString("Menu.Finesandandcoarsesandstone.text");
  3475. }
  3476. else if (percentageCoarseSand >= 25 && percentageSuperfineSand >= 25 && percentageGiantSand < 25 && percentageMediumSand < 25 && percentageFineSand < 25)
  3477. {
  3478. if (percentageCoarseSand > percentageSuperfineSand) rockNamingFirst = PdnResources.GetString("Menu.Veryfinesandcoarsesandstone.text");
  3479. else if (percentageCoarseSand < percentageSuperfineSand) rockNamingFirst = PdnResources.GetString("Menu.Coarsesandveryfinesandstone.text");
  3480. else rockNamingFirst = PdnResources.GetString("Menu.Veryfinesandcoarsesandstone.text");
  3481. }
  3482. else if (percentageMediumSand >= 25 && percentageFineSand >= 25 && percentageGiantSand < 25 && percentageCoarseSand < 25 && percentageSuperfineSand < 25)
  3483. {
  3484. if (percentageMediumSand > percentageFineSand) rockNamingFirst = PdnResources.GetString("Menu.Finesanmediumsandstone.text");
  3485. else if (percentageMediumSand < percentageFineSand) rockNamingFirst = PdnResources.GetString("Menu.Mediumsandfinesandstone.text");
  3486. else rockNamingFirst = PdnResources.GetString("Menu.Finesanmediumsandstone.text");
  3487. }
  3488. else if (percentageMediumSand >= 25 && percentageSuperfineSand >= 25 && percentageGiantSand < 25 && percentageCoarseSand < 25 && percentageFineSand < 25)
  3489. {
  3490. if (percentageMediumSand > percentageSuperfineSand) rockNamingFirst = PdnResources.GetString("Menu.Mediumsandstoneofveryfinesand.text");
  3491. else if (percentageMediumSand < percentageSuperfineSand) rockNamingFirst = PdnResources.GetString("Menu.Mediumsandveryfinesandstone.text");
  3492. else rockNamingFirst = PdnResources.GetString("Menu.Mediumsandstoneofveryfinesand.text");
  3493. }
  3494. else if (percentageFineSand >= 25 && percentageSuperfineSand >= 25 && percentageGiantSand < 25 && percentageCoarseSand < 25 && percentageMediumSand < 25)
  3495. {
  3496. if (percentageFineSand > percentageSuperfineSand) rockNamingFirst = PdnResources.GetString("Menu.Veryfinesandfinesandstone.text");
  3497. else if (percentageFineSand < percentageSuperfineSand) rockNamingFirst = PdnResources.GetString("Menu.Finesandveryfinesandstone.text");
  3498. else rockNamingFirst = PdnResources.GetString("Menu.Veryfinesandfinesandstone.text");
  3499. }
  3500. else
  3501. {
  3502. rockNamingFirst = PdnResources.GetString("Menu.Unequalsandstone.text");
  3503. }
  3504. }
  3505. // 砾
  3506. if (percentageGravel >= 25 && percentageGravel < 50)
  3507. rockNamingFirst = PdnResources.GetString("Menu.graveal.text") + rockNamingFirst;
  3508. // 粉砂
  3509. else if (percentageSilt >= 25 && percentageSilt < 50)
  3510. rockNamingFirst = PdnResources.GetString("Menu.siltyq.text") + rockNamingFirst;
  3511. // 粘土
  3512. else if (percentageClay >= 25 && percentageClay < 50)
  3513. rockNamingFirst = PdnResources.GetString("Menu.clayq.text") + rockNamingFirst;
  3514. // 砾
  3515. if (percentageGravel >= 10 && percentageGravel < 25)
  3516. rockNamingFirst = PdnResources.GetString("Menu.conglomerati.text") + rockNamingFirst;
  3517. // 粉砂
  3518. else if (percentageSilt >= 10 && percentageSilt < 25)
  3519. rockNamingFirst = PdnResources.GetString("Menu.Containingsilty.text") + rockNamingFirst;
  3520. // 粘土
  3521. else if (percentageClay >= 10 && percentageClay < 25)
  3522. rockNamingFirst = PdnResources.GetString("Menu.Containclay.text") + rockNamingFirst;
  3523. }
  3524. // 粉砂
  3525. else if (percentageSilt >= 50)
  3526. {
  3527. rockNamingFirst = PdnResources.GetString("Menu.siltstone.text");
  3528. // 其中小类大于等于50%
  3529. if (percentageCoarseSilt >= 50)
  3530. rockNamingFirst = PdnResources.GetString("Menu.Coarsesiltstone.text");
  3531. else if (percentageFineSilt >= 50)
  3532. rockNamingFirst = PdnResources.GetString("Menu.Finesiltstone.text");
  3533. // 另有小类大于等于50%小于25%
  3534. if (percentageCoarseSilt >= 25 && percentageCoarseSilt < 50)
  3535. rockNamingFirst = PdnResources.GetString("Menu.Thicksilty.text") + rockNamingFirst;
  3536. else if (percentageFineSilt >= 25 && percentageFineSilt < 50)
  3537. rockNamingFirst = PdnResources.GetString("Menu.Finesilty.text") + rockNamingFirst;
  3538. // 砾
  3539. if (percentageGravel >= 25 && percentageGravel < 50)
  3540. rockNamingFirst = PdnResources.GetString("Menu.graveal.text") + rockNamingFirst;
  3541. // 砂
  3542. else if (percentageSand >= 25 && percentageSand < 50)
  3543. rockNamingFirst = PdnResources.GetString("Menu.sandyq.text") + rockNamingFirst;
  3544. // 粘土
  3545. else if (percentageClay >= 25 && percentageClay < 50)
  3546. rockNamingFirst = PdnResources.GetString("Menu.clayq.text") + rockNamingFirst;
  3547. // 砾
  3548. if (percentageGravel >= 10 && percentageGravel < 25)
  3549. rockNamingFirst = PdnResources.GetString("Menu.conglomerati.text") + rockNamingFirst;
  3550. // 砂
  3551. else if (percentageSand >= 10 && percentageSand < 25)
  3552. rockNamingFirst = PdnResources.GetString("Menu.sandqa.text") + rockNamingFirst;
  3553. // 粘土
  3554. else if (percentageClay >= 10 && percentageClay < 25)
  3555. rockNamingFirst = PdnResources.GetString("Menu.Containclay.text") + rockNamingFirst;
  3556. }
  3557. // 粘土
  3558. else if (percentageClay >= 50)
  3559. {
  3560. rockNamingFirst = PdnResources.GetString("Menu.Clayrock.text");
  3561. // 砾
  3562. if (percentageGravel >= 25 && percentageGravel < 50)
  3563. rockNamingFirst = PdnResources.GetString("Menu.graveal.text") + rockNamingFirst;
  3564. // 砂
  3565. else if (percentageSand >= 25 && percentageSand < 50)
  3566. rockNamingFirst = PdnResources.GetString("Menu.sandyq.text") + rockNamingFirst;
  3567. // 粉砂
  3568. else if (percentageSilt >= 25 && percentageSilt < 50)
  3569. rockNamingFirst = PdnResources.GetString("Menu.siltyq.text") + rockNamingFirst;
  3570. // 砾
  3571. if (percentageGravel >= 25 && percentageGravel < 50)
  3572. rockNamingFirst = PdnResources.GetString("Menu.conglomerati.text") + rockNamingFirst;
  3573. // 砂
  3574. else if (percentageSand >= 25 && percentageSand < 50)
  3575. rockNamingFirst = PdnResources.GetString("Menu.sandqa.text") + rockNamingFirst;
  3576. // 粉砂
  3577. else if (percentageSilt >= 25 && percentageSilt < 50)
  3578. rockNamingFirst = PdnResources.GetString("Menu.Containingsilty.text") + rockNamingFirst;
  3579. }
  3580. }
  3581. // 均低于50%
  3582. else
  3583. {
  3584. if(percentageGravel >= 25 && percentageSand >= 25 && percentageSilt < 25 && percentageClay < 25)
  3585. {
  3586. if (percentageGravel > percentageSand) rockNamingFirst = PdnResources.GetString("Menu.glutenite.text");
  3587. else if (percentageGravel < percentageSand) rockNamingFirst = PdnResources.GetString("Menu.Gravelsandstone.text");
  3588. else rockNamingFirst = PdnResources.GetString("Menu.glutenite.text");
  3589. }
  3590. else if (percentageGravel >= 25 && percentageSilt >= 25 && percentageSand < 25 && percentageClay < 25)
  3591. {
  3592. if (percentageGravel > percentageSilt) rockNamingFirst = PdnResources.GetString("Menu.Powderglutenite.text");
  3593. else if (percentageGravel < percentageSilt) rockNamingFirst = PdnResources.GetString("Menu.Gravelsiltston.text");
  3594. else rockNamingFirst = PdnResources.GetString("Menu.Powderglutenite.text");
  3595. }
  3596. else if(percentageGravel >= 25 && percentageClay >= 25 && percentageSand < 25 && percentageSilt < 25)
  3597. {
  3598. if (percentageGravel > percentageClay) rockNamingFirst = PdnResources.GetString("Menu.Clayconglomerate.text");
  3599. else if (percentageGravel < percentageClay) rockNamingFirst = PdnResources.GetString("Menu.Boulderclayrock.text");
  3600. else rockNamingFirst = PdnResources.GetString("Menu.Clayconglomerate.text");
  3601. }
  3602. else if (percentageSand >= 25 && percentageSilt >= 25 && percentageGravel < 25 && percentageClay < 25)
  3603. {
  3604. if (percentageSand > percentageSilt) rockNamingFirst = PdnResources.GetString("Menu.Siltysandstone.text");
  3605. else if (percentageSand < percentageSilt) rockNamingFirst = PdnResources.GetString("Menu.Sandsiltstone.text");
  3606. else rockNamingFirst = PdnResources.GetString("Menu.Siltysandstone.text");
  3607. }
  3608. else if (percentageSand >= 25 && percentageClay >= 25 && percentageGravel < 25 && percentageSilt < 25)
  3609. {
  3610. if (percentageSand > percentageClay) rockNamingFirst = PdnResources.GetString("Menu.Clasand.text");
  3611. else if (percentageSand < percentageClay) rockNamingFirst = PdnResources.GetString("Menu.Sandclayrock.text");
  3612. else rockNamingFirst = PdnResources.GetString("Menu.Clasand.text");
  3613. }
  3614. else if (percentageSilt >= 25 && percentageClay >= 25 && percentageGravel < 25 && percentageSand < 25)
  3615. {
  3616. if (percentageSilt > percentageClay) rockNamingFirst = PdnResources.GetString("Menu.Claysiltstone.text");
  3617. else if (percentageSilt < percentageClay) rockNamingFirst = PdnResources.GetString("Menu.Siltyclaystone.text");
  3618. else rockNamingFirst = PdnResources.GetString("Menu.Claysiltstone.text");
  3619. }
  3620. else
  3621. {
  3622. rockNamingFirst = PdnResources.GetString("Menu.Mixedclasticrock.text");
  3623. }
  3624. }
  3625. // 图解法
  3626. if (this.checkBox3.Checked)
  3627. {
  3628. //平均值
  3629. double sumMz = 0;
  3630. // 标准偏差
  3631. double sumA = 0;
  3632. // 偏度
  3633. double sumSK1 = 0;
  3634. // 峰度
  3635. double sumKg = 0;
  3636. // Φ5
  3637. double sumF5 = 0;
  3638. // Φ16
  3639. double sumF16 = 0;
  3640. // Φ25
  3641. double sumF25 = 0;
  3642. // Φ50
  3643. double sumF50 = 0;
  3644. // Φ75
  3645. double sumF75 = 0;
  3646. // Φ84
  3647. double sumF84 = 0;
  3648. // Φ95
  3649. double sumF95 = 0;
  3650. int count = 0;
  3651. foreach (ListViewItem listViewItem in this.listView2.SelectedItems)
  3652. {
  3653. foreach (var item in this.graphicMethods)
  3654. {
  3655. if (item.Key.Equals(listViewItem.Tag))
  3656. {
  3657. foreach (DataGridViewRow dataGridViewRow in item.Value)
  3658. {
  3659. count++;
  3660. sumMz +=Convert.ToDouble( dataGridViewRow.Cells[1].Value);
  3661. sumA += Convert.ToDouble(dataGridViewRow.Cells[2].Value);
  3662. sumSK1 += Convert.ToDouble(dataGridViewRow.Cells[3].Value);
  3663. sumKg += Convert.ToDouble(dataGridViewRow.Cells[4].Value);
  3664. sumF5 += Convert.ToDouble(dataGridViewRow.Cells[6].Value);
  3665. sumF16 += Convert.ToDouble(dataGridViewRow.Cells[7].Value);
  3666. sumF25 += Convert.ToDouble(dataGridViewRow.Cells[8].Value);
  3667. sumF50 += Convert.ToDouble(dataGridViewRow.Cells[9].Value);
  3668. sumF75 += Convert.ToDouble(dataGridViewRow.Cells[10].Value);
  3669. sumF84 += Convert.ToDouble(dataGridViewRow.Cells[11].Value);
  3670. sumF95 += Convert.ToDouble(dataGridViewRow.Cells[12].Value);
  3671. }
  3672. }
  3673. }
  3674. }
  3675. DataGridViewRow dgvr = new DataGridViewRow();
  3676. foreach (DataGridViewColumn c in this.dataGridView2.Columns)
  3677. {
  3678. dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  3679. }
  3680. dgvr.Cells[0].Value = PdnResources.GetString("Menu.Graphicalmethod.text");
  3681. dgvr.Cells[1].Value = Math.Round(sumMz / count, Convert.ToInt32(this.numericUpDown1.Value));
  3682. dgvr.Cells[2].Value = Math.Round(sumA / count, Convert.ToInt32(this.numericUpDown1.Value));
  3683. dgvr.Cells[3].Value = Math.Round(sumSK1 / count, Convert.ToInt32(this.numericUpDown1.Value));
  3684. dgvr.Cells[4].Value = Math.Round(sumKg / count, Convert.ToInt32(this.numericUpDown1.Value));
  3685. dgvr.Cells[5].Value = rockNamingFirst;
  3686. dgvr.Cells[6].Value = Math.Round(sumF5 / count, Convert.ToInt32(this.numericUpDown1.Value));
  3687. dgvr.Cells[7].Value = Math.Round(sumF16 / count, Convert.ToInt32(this.numericUpDown1.Value));
  3688. dgvr.Cells[8].Value = Math.Round(sumF25 / count, Convert.ToInt32(this.numericUpDown1.Value));
  3689. dgvr.Cells[9].Value = Math.Round(sumF50 / count, Convert.ToInt32(this.numericUpDown1.Value));
  3690. dgvr.Cells[10].Value = Math.Round(sumF75 / count, Convert.ToInt32(this.numericUpDown1.Value));
  3691. dgvr.Cells[11].Value = Math.Round(sumF84 / count, Convert.ToInt32(this.numericUpDown1.Value));
  3692. dgvr.Cells[12].Value = Math.Round(sumF95 / count, Convert.ToInt32(this.numericUpDown1.Value));
  3693. this.dataGridView2.Rows.Add(dgvr);
  3694. }
  3695. // 矩阵法
  3696. if (this.checkBox4.Checked)
  3697. {
  3698. //平均值
  3699. double sumMz = 0;
  3700. // 标准偏差
  3701. double sumA = 0;
  3702. // 偏度
  3703. double sumSK1 = 0;
  3704. // 峰度
  3705. double sumKg = 0;
  3706. int count = 0;
  3707. foreach (ListViewItem listViewItem in this.listView2.SelectedItems)
  3708. {
  3709. foreach (var item in this.matrixMethods)
  3710. {
  3711. if (item.Key.Equals(listViewItem.Tag))
  3712. {
  3713. foreach (DataGridViewRow dataGridViewRow in item.Value)
  3714. {
  3715. count++;
  3716. sumMz += Convert.ToDouble(dataGridViewRow.Cells[1].Value);
  3717. sumA += Convert.ToDouble(dataGridViewRow.Cells[2].Value);
  3718. sumSK1 += Convert.ToDouble(dataGridViewRow.Cells[3].Value);
  3719. sumKg += Convert.ToDouble(dataGridViewRow.Cells[4].Value);
  3720. }
  3721. }
  3722. }
  3723. }
  3724. DataGridViewRow dgvr = new DataGridViewRow();
  3725. foreach (DataGridViewColumn c in this.dataGridView2.Columns)
  3726. {
  3727. dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  3728. }
  3729. dgvr.Cells[0].Value = PdnResources.GetString("Menu.Matrixmethod.text");
  3730. dgvr.Cells[1].Value = Math.Round(sumMz / count, Convert.ToInt32(this.numericUpDown1.Value));
  3731. dgvr.Cells[2].Value = Math.Round(sumA / count, Convert.ToInt32(this.numericUpDown1.Value));
  3732. dgvr.Cells[3].Value = Math.Round(sumSK1 / count, Convert.ToInt32(this.numericUpDown1.Value));
  3733. dgvr.Cells[4].Value = Math.Round(sumKg / count, Convert.ToInt32(this.numericUpDown1.Value));
  3734. dgvr.Cells[5].Value = rockNamingFirst;
  3735. dgvr.Cells[6].Value = "-";
  3736. dgvr.Cells[7].Value = "-";
  3737. dgvr.Cells[8].Value = "-";
  3738. dgvr.Cells[9].Value = "-";
  3739. dgvr.Cells[10].Value = "-";
  3740. dgvr.Cells[11].Value = "-";
  3741. dgvr.Cells[12].Value = "-";
  3742. this.dataGridView2.Rows.Add(dgvr);
  3743. }
  3744. }
  3745. /// <summary>
  3746. /// 全部显示
  3747. /// </summary>
  3748. /// <param name="sender"></param>
  3749. /// <param name="e"></param>
  3750. private void button11_Click(object sender, EventArgs e)
  3751. {
  3752. if (this.listView2.Items.Count > 0)
  3753. {
  3754. this.button11.Visible = false;
  3755. this.button16.Visible = true;
  3756. this.button16.Focus();
  3757. this.allShow = true;
  3758. AllShow();
  3759. }
  3760. else
  3761. {
  3762. MessageBox.Show(PdnResources.GetString("Menu.nodata.text")+"!");
  3763. }
  3764. }
  3765. private void AllShow()
  3766. {
  3767. this.dataGridView4.Rows.Clear();
  3768. DataTable dataTable = new DataTable();
  3769. for (int i = this.dataTables.Count - 1; i >= 0; i--)
  3770. {
  3771. dataTable = this.dataTables[i];
  3772. for (int r = 0; r < dataTable.Rows.Count; r++)
  3773. {
  3774. DataGridViewRow dgvr = new DataGridViewRow();
  3775. dgvr.Tag = dataTable.TableName;
  3776. foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
  3777. {
  3778. dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
  3779. }
  3780. for (int c = 0; c < dataTable.Columns.Count; c++)
  3781. {
  3782. if (c == dataTable.Columns.Count - 1)
  3783. dgvr.Cells[c].Value = Math.Round(Convert.ToDouble( dataTable.Rows[r][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString() + "%";
  3784. else
  3785. dgvr.Cells[c].Value = dataTable.Rows[r][c].ToString();
  3786. }
  3787. this.dataGridView4.Rows.Add(dgvr);
  3788. }
  3789. }
  3790. }
  3791. /// <summary>
  3792. /// 导出结果
  3793. /// </summary>
  3794. /// <param name="sender"></param>
  3795. /// <param name="e"></param>
  3796. private void button14_Click(object sender, EventArgs e)
  3797. {
  3798. if (this.listView2.Items.Count > 0)
  3799. {
  3800. System.Data.DataSet ds = new DataSet();
  3801. DataTable table1 = new DataTable();
  3802. table1.TableName = PdnResources.GetString("Menu.breakdown.text");
  3803. foreach (DataGridViewColumn c in this.dataGridView4.Columns)
  3804. {
  3805. table1.Columns.Add(c.HeaderText);
  3806. }
  3807. for (int r = 0; r < this.dataGridView4.Rows.Count; r++)
  3808. {
  3809. DataRow dataRow = table1.NewRow();
  3810. if (r == 0)
  3811. {
  3812. for (int c = 0; c < this.dataGridView4.Rows[r].Cells.Count; c++)
  3813. {
  3814. dataRow[this.dataGridView4.Columns[c].HeaderText] = this.dataGridView4.Columns[c].HeaderText;
  3815. }
  3816. table1.Rows.Add(dataRow);
  3817. }
  3818. dataRow = table1.NewRow();
  3819. for (int c = 0; c < this.dataGridView4.Rows[r].Cells.Count; c++)
  3820. {
  3821. dataRow[this.dataGridView4.Columns[c].HeaderText] = this.dataGridView4.Rows[r].Cells[c].Value;
  3822. }
  3823. table1.Rows.Add(dataRow);
  3824. }
  3825. DataTable table2 = new DataTable();
  3826. table2.TableName = PdnResources.GetString("Menu.statisaatics.text");
  3827. foreach (DataGridViewColumn c in this.dataGridView2.Columns)
  3828. {
  3829. table2.Columns.Add(c.HeaderText);
  3830. }
  3831. for (int r = 0; r < this.dataGridView2.Rows.Count; r++)
  3832. {
  3833. DataRow dataRow = table2.NewRow();
  3834. if (r == 0)
  3835. {
  3836. for (int c = 0; c < this.dataGridView2.Rows[r].Cells.Count; c++)
  3837. {
  3838. dataRow[this.dataGridView2.Columns[c].HeaderText] = this.dataGridView2.Columns[c].HeaderText;
  3839. }
  3840. table2.Rows.Add(dataRow);
  3841. }
  3842. dataRow = table2.NewRow();
  3843. for (int c = 0; c < this.dataGridView2.Rows[r].Cells.Count; c++)
  3844. {
  3845. dataRow[this.dataGridView2.Columns[c].HeaderText] = this.dataGridView2.Rows[r].Cells[c].Value;
  3846. }
  3847. table2.Rows.Add(dataRow);
  3848. }
  3849. if (table1.Rows.Count > 0) ds.Tables.Add(table1);
  3850. if (table2.Rows.Count > 0) ds.Tables.Add(table2);
  3851. if (ds.Tables.Count > 0)
  3852. DataToExcle(ds);
  3853. }
  3854. else
  3855. {
  3856. MessageBox.Show(PdnResources.GetString("Menu.Noanalysisresults.text")+"!");
  3857. }
  3858. }
  3859. /// <summary>
  3860. /// 导出多 Sheet 报表
  3861. /// </summary>
  3862. /// <param name="ds">要导出的数据</param>
  3863. public void DataToExcle(System.Data.DataSet ds)
  3864. {
  3865. try
  3866. {
  3867. if (ds.Tables == null || ds.Tables.Count == 0)
  3868. {
  3869. MessageBox.Show(PdnResources.GetString("Menu.Nonedata.Text")+"!");
  3870. return;
  3871. }
  3872. SaveFileDialog saveFileDialog = new SaveFileDialog();
  3873. saveFileDialog.DefaultExt = "xlsx";
  3874. saveFileDialog.Title = PdnResources.GetString("Menu.ExportdatatoEXECLtable.Text");
  3875. saveFileDialog.FileName = PdnResources.GetString("Menu.nalysimethodforlasticrocks.text") + DateTime.Now.ToString("yyyyMMddhhmmss");
  3876. saveFileDialog.Filter = "microsoft office execl files (*.xlsx)|*.xlsx";
  3877. saveFileDialog.RestoreDirectory = true;
  3878. if (saveFileDialog.ShowDialog() == DialogResult.OK)
  3879. {
  3880. List<DataTable> list = new List<DataTable>();
  3881. foreach (DataTable itemTable in ds.Tables)
  3882. {
  3883. list.Add(itemTable);
  3884. }
  3885. this.appWorkspace.ExportDataToExcelWithProgress(list, saveFileDialog.FileName, true, false, true);
  3886. }
  3887. }
  3888. catch (Exception e)
  3889. {
  3890. throw e;
  3891. }
  3892. }
  3893. /// <summary>
  3894. /// 生成报告
  3895. /// </summary>
  3896. /// <param name="sender"></param>
  3897. /// <param name="e"></param>
  3898. private void button13_Click(object sender, EventArgs e)
  3899. {
  3900. if (this.checkBox2.Checked)
  3901. {
  3902. AnalyzeSettingDialog recombinationRateSetDialog = new AnalyzeSettingDialog(this, "Template.Manager.item3.GrainSizeAnalysis");
  3903. if (recombinationRateSetDialog.hasModule)
  3904. {
  3905. recombinationRateSetDialog.StartPosition = FormStartPosition.CenterScreen;
  3906. recombinationRateSetDialog.ShowDialog();
  3907. }
  3908. else
  3909. {
  3910. recombinationRateSetDialog = null;
  3911. }
  3912. }
  3913. if (this.analyzeSettingModel != null && !string.IsNullOrEmpty(this.analyzeSettingModel.analyzeClassify))
  3914. {
  3915. //获取word书签与excel单元格的关系,以字典方式存储
  3916. List<mic_module_infos> mic_module_infos = mic_module_infos_BLL.FindAll().FindAll(a => a.analyze_classify == this.analyzeSettingModel.analyzeClassify);
  3917. Dictionary<string, string> tagInfos = new Dictionary<string, string>();
  3918. if (mic_module_infos != null && mic_module_infos.Count > 0)
  3919. {
  3920. foreach (mic_module_infos info in mic_module_infos)
  3921. {
  3922. tagInfos.Add(info.tag_name, info.cell_position);
  3923. }
  3924. }
  3925. List<List<string>> analysisContent = new List<List<string>>();
  3926. for (int i = 0; i < this.dataGridView4.Rows.Count; i++)
  3927. {
  3928. List<string> content1 = new List<string>();
  3929. if (i == 0)
  3930. {
  3931. content1.Add(this.dataGridView4.Columns[0].HeaderText);
  3932. content1.Add(this.dataGridView4.Columns[1].HeaderText);
  3933. content1.Add(this.dataGridView4.Columns[2].HeaderText);
  3934. content1.Add(this.dataGridView4.Columns[3].HeaderText);
  3935. content1.Add(this.dataGridView4.Columns[4].HeaderText);
  3936. content1.Add(this.dataGridView4.Columns[5].HeaderText);
  3937. analysisContent.Add(content1);
  3938. }
  3939. content1 = new List<string>();
  3940. content1.Add(this.dataGridView4.Rows[i].Cells[0].Value.ToString());
  3941. content1.Add(this.dataGridView4.Rows[i].Cells[1].Value.ToString());
  3942. content1.Add(this.dataGridView4.Rows[i].Cells[2].Value.ToString());
  3943. content1.Add(this.dataGridView4.Rows[i].Cells[3].Value.ToString());
  3944. content1.Add(this.dataGridView4.Rows[i].Cells[4].Value.ToString());
  3945. content1.Add(this.dataGridView4.Rows[i].Cells[5].Value.ToString());
  3946. analysisContent.Add(content1);
  3947. }
  3948. List<string> content2 = new List<string>();
  3949. analysisContent.Add(content2);
  3950. for (int i = 0; i < this.dataGridView2.Rows.Count; i++)
  3951. {
  3952. List<string> content1 = new List<string>();
  3953. if (i == 0)
  3954. {
  3955. content1.Add(this.dataGridView2.Columns[0].HeaderText);
  3956. content1.Add(this.dataGridView2.Columns[1].HeaderText);
  3957. content1.Add(this.dataGridView2.Columns[2].HeaderText);
  3958. content1.Add(this.dataGridView2.Columns[3].HeaderText);
  3959. content1.Add(this.dataGridView2.Columns[4].HeaderText);
  3960. content1.Add(this.dataGridView2.Columns[5].HeaderText);
  3961. content1.Add(this.dataGridView2.Columns[6].HeaderText);
  3962. content1.Add(this.dataGridView2.Columns[7].HeaderText);
  3963. content1.Add(this.dataGridView2.Columns[8].HeaderText);
  3964. content1.Add(this.dataGridView2.Columns[9].HeaderText);
  3965. content1.Add(this.dataGridView2.Columns[10].HeaderText);
  3966. content1.Add(this.dataGridView2.Columns[11].HeaderText);
  3967. content1.Add(this.dataGridView2.Columns[12].HeaderText);
  3968. analysisContent.Add(content1);
  3969. }
  3970. content1 = new List<string>();
  3971. content1.Add(this.dataGridView2.Rows[i].Cells[0].Value.ToString());
  3972. content1.Add(this.dataGridView2.Rows[i].Cells[1].Value.ToString());
  3973. content1.Add(this.dataGridView2.Rows[i].Cells[2].Value.ToString());
  3974. content1.Add(this.dataGridView2.Rows[i].Cells[3].Value.ToString());
  3975. content1.Add(this.dataGridView2.Rows[i].Cells[4].Value.ToString());
  3976. content1.Add(this.dataGridView2.Rows[i].Cells[5].Value.ToString());
  3977. content1.Add(this.dataGridView2.Rows[i].Cells[6].Value.ToString());
  3978. content1.Add(this.dataGridView2.Rows[i].Cells[7].Value.ToString());
  3979. content1.Add(this.dataGridView2.Rows[i].Cells[8].Value.ToString());
  3980. content1.Add(this.dataGridView2.Rows[i].Cells[9].Value.ToString());
  3981. content1.Add(this.dataGridView2.Rows[i].Cells[10].Value.ToString());
  3982. content1.Add(this.dataGridView2.Rows[i].Cells[11].Value.ToString());
  3983. content1.Add(this.dataGridView2.Rows[i].Cells[12].Value.ToString());
  3984. analysisContent.Add(content1);
  3985. }
  3986. bitList = new List<Bitmap>();
  3987. if (this.allShow)
  3988. {
  3989. foreach (KeyValuePair<string, List<Bitmap>> kv in this.bitDic)
  3990. {
  3991. bitList.Add(kv.Value[0]);
  3992. bitList.Add(kv.Value[1]);
  3993. }
  3994. }
  3995. else
  3996. {
  3997. if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)
  3998. {
  3999. foreach (ListViewItem item in this.listView2.SelectedItems)
  4000. {
  4001. if (bitDic.ContainsKey(item.Tag.ToString()))
  4002. {
  4003. bitList.Add(bitDic[item.Tag.ToString()][0]);
  4004. bitList.Add(bitDic[item.Tag.ToString()][1]);
  4005. }
  4006. }
  4007. }
  4008. }
  4009. this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, bitList, tagInfos);
  4010. }
  4011. else
  4012. MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text")+"!");
  4013. }
  4014. /// <summary>
  4015. /// 设置
  4016. /// </summary>
  4017. /// <param name="sender"></param>
  4018. /// <param name="e"></param>
  4019. private void button1_Click(object sender, EventArgs e)
  4020. {
  4021. AnalyzeSettingDialog recombinationRateSetDialog = new AnalyzeSettingDialog(this, "Template.Manager.item3.GrainSizeAnalysis");
  4022. if (recombinationRateSetDialog.hasModule)
  4023. {
  4024. recombinationRateSetDialog.StartPosition = FormStartPosition.CenterScreen;
  4025. recombinationRateSetDialog.ShowDialog();
  4026. }
  4027. else
  4028. {
  4029. recombinationRateSetDialog = null;
  4030. }
  4031. }
  4032. /// <summary>
  4033. /// 导出项目
  4034. /// </summary>
  4035. /// <param name="sender"></param>
  4036. /// <param name="e"></param>
  4037. private void button4_Click(object sender, EventArgs e)
  4038. {
  4039. try
  4040. {
  4041. if (this.analyzeSettingModel == null)
  4042. {
  4043. MessageBox.Show(PdnResources.GetString("Menu.Settheexporteitemfirst.Text"));
  4044. return;
  4045. }
  4046. //获取项目工程内的文件夹路径
  4047. ProjectEngineering.NodeItem item = this.appWorkspace.GetInsertProjectPath(2, "Menu.DedicatedAnalysis.PetroleumGeology.PetroleumGeologySon.Text", this.analyzeSettingModel.savePath);
  4048. if (item != null)
  4049. {
  4050. //向文件夹内保存图片和报告
  4051. if (!string.IsNullOrEmpty(this.analyzeSettingModel.analyzeClassify))
  4052. {
  4053. //获取word书签与excel单元格的关系,以字典方式存储
  4054. List<mic_module_infos> mic_module_infos = mic_module_infos_BLL.FindAll().FindAll(a => a.analyze_classify == this.analyzeSettingModel.analyzeClassify);
  4055. Dictionary<string, string> tagInfos = new Dictionary<string, string>();
  4056. if (mic_module_infos != null && mic_module_infos.Count > 0)
  4057. {
  4058. foreach (mic_module_infos info in mic_module_infos)
  4059. {
  4060. tagInfos.Add(info.tag_name, info.cell_position);
  4061. }
  4062. }
  4063. //分析结果
  4064. List<List<string>> analysisContent = new List<List<string>>();
  4065. for (int i = 0; i < this.dataGridView4.Rows.Count; i++)
  4066. {
  4067. List<string> content1 = new List<string>();
  4068. if (i == 0)
  4069. {
  4070. content1.Add(this.dataGridView4.Columns[0].HeaderText);
  4071. content1.Add(this.dataGridView4.Columns[1].HeaderText);
  4072. content1.Add(this.dataGridView4.Columns[2].HeaderText);
  4073. content1.Add(this.dataGridView4.Columns[3].HeaderText);
  4074. content1.Add(this.dataGridView4.Columns[4].HeaderText);
  4075. content1.Add(this.dataGridView4.Columns[5].HeaderText);
  4076. analysisContent.Add(content1);
  4077. }
  4078. content1 = new List<string>();
  4079. content1.Add(this.dataGridView4.Rows[i].Cells[0].Value.ToString());
  4080. content1.Add(this.dataGridView4.Rows[i].Cells[1].Value.ToString());
  4081. content1.Add(this.dataGridView4.Rows[i].Cells[2].Value.ToString());
  4082. content1.Add(this.dataGridView4.Rows[i].Cells[3].Value.ToString());
  4083. content1.Add(this.dataGridView4.Rows[i].Cells[4].Value.ToString());
  4084. content1.Add(this.dataGridView4.Rows[i].Cells[5].Value.ToString());
  4085. analysisContent.Add(content1);
  4086. }
  4087. List<string> content2 = new List<string>();
  4088. analysisContent.Add(content2);
  4089. for (int i = 0; i < this.dataGridView2.Rows.Count; i++)
  4090. {
  4091. List<string> content1 = new List<string>();
  4092. if (i == 0)
  4093. {
  4094. content1.Add(this.dataGridView2.Columns[0].HeaderText);
  4095. content1.Add(this.dataGridView2.Columns[1].HeaderText);
  4096. content1.Add(this.dataGridView2.Columns[2].HeaderText);
  4097. content1.Add(this.dataGridView2.Columns[3].HeaderText);
  4098. content1.Add(this.dataGridView2.Columns[4].HeaderText);
  4099. content1.Add(this.dataGridView2.Columns[5].HeaderText);
  4100. content1.Add(this.dataGridView2.Columns[6].HeaderText);
  4101. content1.Add(this.dataGridView2.Columns[7].HeaderText);
  4102. content1.Add(this.dataGridView2.Columns[8].HeaderText);
  4103. content1.Add(this.dataGridView2.Columns[9].HeaderText);
  4104. content1.Add(this.dataGridView2.Columns[10].HeaderText);
  4105. content1.Add(this.dataGridView2.Columns[11].HeaderText);
  4106. content1.Add(this.dataGridView2.Columns[12].HeaderText);
  4107. analysisContent.Add(content1);
  4108. }
  4109. content1 = new List<string>();
  4110. content1.Add(this.dataGridView2.Rows[i].Cells[0].Value.ToString());
  4111. content1.Add(this.dataGridView2.Rows[i].Cells[1].Value.ToString());
  4112. content1.Add(this.dataGridView2.Rows[i].Cells[2].Value.ToString());
  4113. content1.Add(this.dataGridView2.Rows[i].Cells[3].Value.ToString());
  4114. content1.Add(this.dataGridView2.Rows[i].Cells[4].Value.ToString());
  4115. content1.Add(this.dataGridView2.Rows[i].Cells[5].Value.ToString());
  4116. content1.Add(this.dataGridView2.Rows[i].Cells[6].Value.ToString());
  4117. content1.Add(this.dataGridView2.Rows[i].Cells[7].Value.ToString());
  4118. content1.Add(this.dataGridView2.Rows[i].Cells[8].Value.ToString());
  4119. content1.Add(this.dataGridView2.Rows[i].Cells[9].Value.ToString());
  4120. content1.Add(this.dataGridView2.Rows[i].Cells[10].Value.ToString());
  4121. content1.Add(this.dataGridView2.Rows[i].Cells[11].Value.ToString());
  4122. content1.Add(this.dataGridView2.Rows[i].Cells[12].Value.ToString());
  4123. analysisContent.Add(content1);
  4124. }
  4125. bitList = new List<Bitmap>();
  4126. if (this.allShow)
  4127. {
  4128. foreach (KeyValuePair<string, List<Bitmap>> kv in this.bitDic)
  4129. {
  4130. bitList.Add(kv.Value[0]);
  4131. bitList.Add(kv.Value[1]);
  4132. }
  4133. }
  4134. else
  4135. {
  4136. if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)
  4137. {
  4138. foreach (ListViewItem itemL2 in this.listView2.SelectedItems)
  4139. {
  4140. if (bitDic.ContainsKey(itemL2.Tag.ToString()))
  4141. {
  4142. bitList.Add(bitDic[itemL2.Tag.ToString()][0]);
  4143. bitList.Add(bitDic[itemL2.Tag.ToString()][1]);
  4144. }
  4145. }
  4146. }
  4147. }
  4148. //中间数据
  4149. if (!this.allShow)
  4150. {
  4151. if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)
  4152. {
  4153. List<ExportProjectModel> exportModel = new List<ExportProjectModel>();
  4154. foreach (ListViewItem rowItem in this.listView2.SelectedItems)
  4155. {
  4156. foreach (ExportProjectModel model in this.tempDataModel)
  4157. {
  4158. if (model.tagName.Equals(rowItem.Tag))
  4159. {
  4160. ExportProjectModel tempModel = new ExportProjectModel();
  4161. tempModel.tagName = model.tagName;
  4162. tempModel.picName = model.picName;
  4163. tempModel.dataList = model.dataList;
  4164. exportModel.Add(tempModel);
  4165. break;
  4166. }
  4167. }
  4168. }
  4169. this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, exportModel, bitList, tagInfos, item.path, item.code);
  4170. }
  4171. }
  4172. else
  4173. this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, tempDataModel, bitList, tagInfos, item.path, item.code);
  4174. }
  4175. else
  4176. {
  4177. MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text")+"!");
  4178. return;
  4179. }
  4180. //保存项目信息到数据库
  4181. this.appWorkspace.InsertIntoDB(this.analyzeSettingModel, item);
  4182. }
  4183. }
  4184. catch (Exception)
  4185. {
  4186. }
  4187. }
  4188. /// <summary>
  4189. /// 不可点击空白区域
  4190. /// </summary>
  4191. /// <param name="sender"></param>
  4192. /// <param name="e"></param>
  4193. private void listView1_MouseUp(object sender, MouseEventArgs e)
  4194. {
  4195. if (e.Button == MouseButtons.Left)
  4196. {
  4197. if (listView1.SelectedItems.Count > 0)
  4198. {
  4199. }
  4200. else if (listView1.SelectedItems.Count <= 0)//点击空白区
  4201. {
  4202. if (this.listView1.FocusedItem != null)
  4203. {
  4204. ListViewItem item = this.listView1.GetItemAt(e.X, e.Y);
  4205. if (item == null)
  4206. {
  4207. this.listView1.FocusedItem.Selected = true;
  4208. }
  4209. }
  4210. }
  4211. }
  4212. }
  4213. #region 参数保存及提取
  4214. /// <summary>
  4215. /// 保存参数的key,value和type
  4216. /// </summary>
  4217. /// <param name="param_key"></param>
  4218. /// <param name="param_value"></param>
  4219. /// <param name="param_type"></param>
  4220. private void saveParamValue(string param_key, string param_value, int param_type)
  4221. {
  4222. bool foundItem = false;
  4223. if (!this.eachData.ContainsKey(GetImgKey()))
  4224. {
  4225. GrainSizeAnalysisModel analysisItem = new GrainSizeAnalysisModel();
  4226. analysisItem.menuId = this.menuId;
  4227. analysisItem.param_key = param_key;
  4228. analysisItem.param_type = param_type;
  4229. analysisItem.param_value = param_value;
  4230. analysisItem.setValue();
  4231. analysisItem.ListParam = new List<GrainSizeAnalysisModel>();
  4232. analysisItem.ListParam.Add(analysisItem);
  4233. this.eachData.Add(GetImgKey(), analysisItem);
  4234. }
  4235. foreach (var item in this.eachData[GetImgKey()].ListParam)
  4236. {
  4237. if (item.param_key.Equals(param_key) && item.menuId == this.menuId)
  4238. {
  4239. item.param_value = param_value;
  4240. item.setValue();
  4241. foundItem = true;
  4242. break;
  4243. }
  4244. }
  4245. if (!foundItem)
  4246. {
  4247. GrainSizeAnalysisModel analysisItem = new GrainSizeAnalysisModel();
  4248. analysisItem.menuId = this.menuId;
  4249. analysisItem.param_key = param_key;
  4250. analysisItem.param_type = param_type;
  4251. analysisItem.param_value = param_value;
  4252. analysisItem.setValue();
  4253. this.eachData[GetImgKey()].ListParam.Add(analysisItem);
  4254. }
  4255. }
  4256. /// <summary>
  4257. /// 保存界面中的参数到model
  4258. /// </summary>
  4259. private void saveDialogParamValues()
  4260. {
  4261. saveParamValue(ParamKey_Report, checkBox2.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//报告设置
  4262. saveParamValue(ParamKey_Correct, checkBox1.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//筛析矫正
  4263. saveParamValue(ParamKey_Graphic, checkBox3.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//图解法
  4264. saveParamValue(ParamKey_Matrix, checkBox4.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//矩阵法
  4265. saveParamValue(ParamKey_Number, checkBox5.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//显示颗粒编号
  4266. saveParamValue(ParamKey_NumberFontSize, numericUpDown2.Value.ToString(), (int)Base.Dtryt.Decimal);//编号字体大小
  4267. saveParamValue(ParamKey_NumberColour, panel1.BackColor.ToArgb().ToString(), (int)Base.Dtryt.Color);//编号颜色
  4268. saveParamValue(ParamKey_Diameter, checkBox6.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//显示颗粒直径
  4269. saveParamValue(ParamKey_DiameterFontSize, numericUpDown3.Value.ToString(), (int)Base.Dtryt.Decimal);//直径字体大小
  4270. saveParamValue(ParamKey_DiameterColour, panel2.BackColor.ToArgb().ToString(), (int)Base.Dtryt.Color);//直径颜色
  4271. saveParamValue(ParamKey_DecimalPlace, numericUpDown1.Value.ToString(), (int)Base.Dtryt.Decimal);//保留小数位数
  4272. }
  4273. /// <summary>
  4274. /// 获取保存的参数
  4275. /// </summary>
  4276. private void GetListParamModel()
  4277. {
  4278. if (this.eachData.ContainsKey(GetImgKey()) && this.eachData[GetImgKey()] != null)
  4279. {
  4280. for (int i = 0; i < this.eachData[GetImgKey()].ListParam.Count; i++)
  4281. {
  4282. switch (this.eachData[GetImgKey()].ListParam[i].param_key)
  4283. {
  4284. case ParamKey_Report:
  4285. checkBox2.Checked = (Boolean)this.eachData[GetImgKey()].ListParam[i].value;
  4286. break;
  4287. case ParamKey_Correct:
  4288. checkBox1.Checked = (Boolean)this.eachData[GetImgKey()].ListParam[i].value;
  4289. break;
  4290. case ParamKey_Graphic:
  4291. checkBox3.Checked = (Boolean)this.eachData[GetImgKey()].ListParam[i].value;
  4292. break;
  4293. case ParamKey_Matrix:
  4294. checkBox4.Checked = (Boolean)this.eachData[GetImgKey()].ListParam[i].value;
  4295. break;
  4296. case ParamKey_Number:
  4297. checkBox5.Checked = (Boolean)this.eachData[GetImgKey()].ListParam[i].value;
  4298. break;
  4299. case ParamKey_NumberFontSize:
  4300. numericUpDown2.Value = decimal.Parse(this.eachData[GetImgKey()].ListParam[i].param_value);
  4301. break;
  4302. case ParamKey_NumberColour:
  4303. panel1.BackColor = Color.FromArgb((int)this.eachData[GetImgKey()].ListParam[i].value);
  4304. break;
  4305. case ParamKey_Diameter:
  4306. checkBox6.Checked = (Boolean)this.eachData[GetImgKey()].ListParam[i].value;
  4307. break;
  4308. case ParamKey_DiameterFontSize:
  4309. numericUpDown3.Value = decimal.Parse(this.eachData[GetImgKey()].ListParam[i].param_value);
  4310. break;
  4311. case ParamKey_DiameterColour:
  4312. panel2.BackColor = Color.FromArgb((int)this.eachData[GetImgKey()].ListParam[i].value);
  4313. break;
  4314. case ParamKey_DecimalPlace:
  4315. numericUpDown1.Value = decimal.Parse(this.eachData[GetImgKey()].ListParam[i].param_value);
  4316. break;
  4317. }
  4318. }
  4319. }
  4320. }
  4321. /// <summary>
  4322. /// 获取XML保存的参数
  4323. /// </summary>
  4324. private void GetXmlParameter()
  4325. {
  4326. string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\GrainSizeAnalyze\\GrainSizeAnalysisModel.xml";
  4327. GrainSizeAnalysisModel analysisModelXml = XmlSerializeHelper.DESerializer<GrainSizeAnalysisModel>(FileOperationHelper.ReadStringFromFile(filePath, System.IO.FileMode.Open));
  4328. for (int i = 0; i < listView1.Items.Count; i++)
  4329. {
  4330. if (this.eachData.ContainsKey(listView1.Items[i].Index.ToString()))
  4331. {
  4332. this.eachData[listView1.Items[i].Index.ToString()] = analysisModelXml.cloneListParamModel(this.menuId);
  4333. }
  4334. else
  4335. {
  4336. this.eachData.Add(listView1.Items[i].Index.ToString(), analysisModelXml.cloneListParamModel(this.menuId));
  4337. }
  4338. }
  4339. foreach (var item in this.eachData[GetImgKey()].ListParam)
  4340. item.setValue();
  4341. }
  4342. /// <summary>
  4343. /// 保存参数,防止没有图片
  4344. /// </summary>
  4345. private void NullKey()
  4346. {
  4347. GrainSizeAnalysisModel grainsizeanalysismodel = new GrainSizeAnalysisModel();
  4348. grainsizeanalysismodel.ListParam = new List<GrainSizeAnalysisModel>();
  4349. this.eachData.Add("null", grainsizeanalysismodel);
  4350. }
  4351. private string GetImgKey()
  4352. {
  4353. string key = this.listView1.FocusedItem != null ? this.listView1.FocusedItem.Index.ToString() : "null";
  4354. return key;
  4355. }
  4356. #endregion
  4357. private void button5_Click(object sender, EventArgs e)
  4358. {
  4359. if (this.listView1.FocusedItem == null)
  4360. {
  4361. return;
  4362. }
  4363. binaryClass.saveParams();
  4364. binaryClass.applyToAll(this.imageList1.Images.Keys, this.imageList1.Images.Keys[int.Parse(GetImgKey())]);
  4365. saveDialogParamValues();
  4366. GrainSizeAnalysisModel data = new GrainSizeAnalysisModel();
  4367. if (eachData.ContainsKey(GetImgKey()))
  4368. {
  4369. data = eachData[GetImgKey()];
  4370. }
  4371. for (int i = 0; i < listView1.Items.Count; i++)
  4372. {
  4373. eachData[i.ToString()] = data.cloneListParamModel(this.menuId);
  4374. this.listView1.EnsureVisible(i);
  4375. this.listView1.Items[i].Focused = true;
  4376. this.listView1.Items[i].Selected = true;
  4377. }
  4378. }
  4379. private void button3_Click(object sender, EventArgs e)
  4380. {
  4381. if (this.listView1.FocusedItem == null)
  4382. {
  4383. return;
  4384. }
  4385. if (eachData.Count - 1 != listView1.Items.Count)
  4386. {
  4387. MessageBox.Show("请先点击应用全部!");
  4388. return;
  4389. }
  4390. saveDialogParamValues();
  4391. int current = int.Parse(GetImgKey());
  4392. for (int i = 0; i < listView1.Items.Count; i++)
  4393. {
  4394. this.listView1.EnsureVisible(i);
  4395. this.listView1.Items[i].Focused = true;
  4396. this.listView1.Items[i].Selected = true;
  4397. this.button2.PerformClick();
  4398. }
  4399. this.listView1.EnsureVisible(current);
  4400. this.listView1.Items[current].Focused = true;
  4401. this.listView1.Items[current].Selected = true;
  4402. }
  4403. private void listView1_MouseDown(object sender, MouseEventArgs e)
  4404. {
  4405. if (this.listView1.FocusedItem != null)
  4406. saveDialogParamValues();
  4407. }
  4408. #region [脚本相关]
  4409. private void getValue(string key, object value)
  4410. {
  4411. switch (key)
  4412. {
  4413. case "parameter1":
  4414. checkBox1.Checked = Convert.ToBoolean(value);
  4415. break;
  4416. case "parameter2":
  4417. checkBox3.Checked = Convert.ToBoolean(value);
  4418. break;
  4419. case "parameter3":
  4420. checkBox4.Checked = Convert.ToBoolean(value);
  4421. break;
  4422. case "parameter4":
  4423. checkBox5.Checked = Convert.ToBoolean(value);
  4424. break;
  4425. case "parameter5":
  4426. numericUpDown2.Value = Convert.ToDecimal(value);
  4427. break;
  4428. case "parameter6":
  4429. panel1.BackColor = Color.FromArgb((int)value);
  4430. break;
  4431. case "parameter7":
  4432. checkBox6.Checked = Convert.ToBoolean(value);
  4433. break;
  4434. case "parameter8":
  4435. numericUpDown3.Value = Convert.ToDecimal(value);
  4436. break;
  4437. case "parameter9":
  4438. panel2.BackColor = Color.FromArgb((int)value);
  4439. break;
  4440. case "OpenWhileExportReport":
  4441. checkBox2.Checked = Convert.ToBoolean(value);
  4442. break;
  4443. case "CalculatorDecimalDigits":
  4444. numericUpDown1.Value = Convert.ToDecimal(value);
  4445. break;
  4446. case "ExportResults":
  4447. isExportResults = Convert.ToBoolean(value);
  4448. break;
  4449. case "ExportReports":
  4450. isExportReports = Convert.ToBoolean(value);
  4451. break;
  4452. case "ExportProjects":
  4453. isExportProjects = Convert.ToBoolean(value);
  4454. break;
  4455. }
  4456. }
  4457. private void startScriptAutomaticAction()
  4458. {
  4459. this.button5.PerformClick();
  4460. this.button3.PerformClick();
  4461. if (this.listView2.Items.Count > 0)
  4462. {
  4463. this.button11.Visible = false;
  4464. this.button16.Visible = true;
  4465. this.button16.Focus();
  4466. this.allShow = true;
  4467. AllShow();
  4468. }
  4469. if (isExportResults)//导出结果
  4470. this.button14.PerformClick();
  4471. if (isExportReports)//生成报告
  4472. this.button13.PerformClick();
  4473. if (isExportProjects)//导出项目
  4474. this.button4.PerformClick();
  4475. this.appWorkspace.ScriptAutomatic = false;
  4476. this.Close();
  4477. }
  4478. #endregion
  4479. #region [脚本录制]
  4480. private void getScriptRecording()
  4481. {
  4482. string className = InvariantData.path_Action + ".Action" + menuId;
  4483. ParamObject param = (ParamObject)System.Reflection.Assembly.Load(InvariantData.assembly_Data).CreateInstance(className);
  4484. List<Args> args = param.Lists;
  4485. foreach (var item in args)
  4486. {
  4487. item.value = setScriptRecording(item.key);
  4488. }
  4489. //找出二值相关参数 进行赋值
  4490. List<Args> isNullList = args.Where(m => m.value == null).ToList();
  4491. foreach (var item in isNullList)
  4492. {
  4493. item.value = binaryClass.setScriptRecording(item.key);
  4494. }
  4495. appWorkspace.SetScriptStartRecording(this.menuId, menuName, args);
  4496. }
  4497. private object setScriptRecording(string key)
  4498. {
  4499. object value = null;
  4500. switch (key)
  4501. {
  4502. case "parameter1":
  4503. value = checkBox1.Checked;
  4504. break;
  4505. case "parameter2":
  4506. value = checkBox3.Checked;
  4507. break;
  4508. case "parameter3":
  4509. value = checkBox4.Checked;
  4510. break;
  4511. case "parameter4":
  4512. value = checkBox5.Checked;
  4513. break;
  4514. case "parameter5":
  4515. value = numericUpDown2.Value;
  4516. break;
  4517. case "parameter6":
  4518. value = panel1.BackColor.ToArgb();
  4519. break;
  4520. case "parameter7":
  4521. value = checkBox6.Checked;
  4522. break;
  4523. case "parameter8":
  4524. value = numericUpDown3.Value;
  4525. break;
  4526. case "parameter9":
  4527. value = panel2.BackColor.ToArgb();
  4528. break;
  4529. case "OpenWhileExportReport":
  4530. value = checkBox2.Checked;
  4531. break;
  4532. case "CalculatorDecimalDigits":
  4533. value = numericUpDown1.Value;
  4534. break;
  4535. case "ExportResults":
  4536. value = isExportResults;
  4537. break;
  4538. case "ExportReports":
  4539. value = isExportReports;
  4540. break;
  4541. case "ExportProjects":
  4542. value = isExportProjects;
  4543. break;
  4544. }
  4545. return value;
  4546. }
  4547. #endregion
  4548. }
  4549. }