protected override bool CutLineHull( double centerOffset, double r2, double tolerance, out double tMin, out double tMax, out NearSegment hullStartNear, out NearSegment hullEndNear, out bool coincident) { coincident = IsCoincident(tolerance, out hullStartNear, out hullEndNear); if (!coincident) { Pnt offset = P0s; if (centerOffset != 0) { offset = P0s + centerOffset * L0Normal; } bool cut = CutLineHull2D(offset, L0, P1s, L1, r2, out tMin, out tMax, out hullStartNear, out hullEndNear); return(cut); } tMin = -Math.Sqrt(r2 / L0.OrigDist2()); tMax = 1 - tMin; return(true); }
private void button4_Click(object sender, EventArgs e) { if ((textBox7.Text == "") || (textBox8.Text == "")) { MessageBox.Show("必需数据不足!"); } else { dPoint dp = new dPoint(); kPoint kp = new kPoint(); dp.L = double.Parse(textBox1.Text); dp.B = double.Parse(textBox8.Text); int what = comboBox1.SelectedIndex; kp = Gauss.Forsol(dp, what); textBox10.Text = kp.X.ToString("F6"); textBox11.Text = kp.Y.ToString("F6"); double L0; L0 = 6 * ((int)(dp.L / 6) + 1) - 3; textBox12.Text = L0.ToString(); } }
protected override bool CutLineHull( double centerOffset, double r2, double tolerance, out double tMin, out double tMax, out NearSegment hullStartNear, out NearSegment hullEndNear, out bool coincident) { if (centerOffset != 0) { throw new NotImplementedException("Not yet implemented for centerOffset > 0"); } if (GeomUtils.Equals3D((Pnt3D)P0s, (Pnt3D)P1s, tolerance) && GeomUtils.Equals3D((Pnt3D)P0e, (Pnt3D)P1e, tolerance)) { hullStartNear = NearSegment.NearStart; hullEndNear = NearSegment.NearEnd; } else if (GeomUtils.Equals3D((Pnt3D)P0s, (Pnt3D)P1e, tolerance) && GeomUtils.Equals3D((Pnt3D)P0e, (Pnt3D)P1s, tolerance)) { hullStartNear = NearSegment.NearEnd; hullEndNear = NearSegment.NearStart; } else { coincident = false; bool cut = CutLineHull3D((Pnt3D)P0s, (Pnt3D)L0, (Pnt3D)P1s, (Pnt3D)L1, r2, out tMin, out tMax, out hullStartNear, out hullEndNear); return(cut); } coincident = true; tMin = -Math.Sqrt(r2 / L0.OrigDist2()); tMax = 1 - tMin; return(true); }
public IEnumerator GetTable(string Id, string TabName) { TabName = WWW.EscapeURL(TabName); WWW www = new WWW(URL + "?Id=" + Id + "&Name=" + TabName); yield return(www); if (www.error == null) //一切正常完全沒任何錯誤 { StringDate = www.text; } string[] _mDate = StringDate.Split("\"" [0]); List <string> L0 = new List <string> (); for (int i = 0; i < _mDate.Length; i++) { if (_mDate [i] != "" && _mDate [i] != ",") { if (_mDate [i] == "\n") { mDate.Add(L0); L0 = new List <string> (); } else { L0.Add(_mDate [i]); } } } mDate.Add(L0); // string[] _StringDate = StringDate.Split ("\n" [0]); // Date = new string[_StringDate.Length][]; // for (int i = 0; i < _StringDate.Length; i++) { // Date[i] = _StringDate[i].Split(','); // } }
/// <summary> /// Builds freight invoice. /// Original from https://ps.extra.chrysler.com/sites/itb-ebus/Documents/210FreightPaymentInvoice.pdf /// </summary> static TS210 BuildFreightInvoice(string controlNumber) { var result = new TS210(); // Transaction Set Identifier Code = “210” // (Motor Carrier Freight Details and Invoice) // Transaction Set Control Number = 00000001 result.ST = new ST(); result.ST.TransactionSetIdentifierCode_01 = "210"; result.ST.TransactionSetControlNumber_02 = controlNumber.PadLeft(9, '0'); // Invoice Number = 3410889 // Shipment Identification Number = 545930791T // Shipment Method of Payment // = “TP” (Third Party) // Weight Unit Code = “L” (Pounds) // Date = 10 / 31 / 2007 // Net Amount Due = 51.65 // Delivery Date = 10 / 29 / 2007 // Date / Time Qualifier = “035” (Delivered) // Standard Carrier Alpha Code = NLMI result.B3 = new B3(); result.B3.InvoiceNumber_02 = "3410889"; result.B3.ShipmentIdentificationNumber_03 = "545930791T"; result.B3.ShipmentMethodofPayment_04 = "TP"; result.B3.WeightUnitCode_05 = "L"; result.B3.Date_06 = "20071031"; result.B3.NetAmountDue_07 = "5165"; result.B3.DeliveryDate_09 = "20071029"; result.B3.DateTimeQualifier_10 = "035"; result.B3.StandardCarrierAlphaCode_11 = "NLMI"; // Currency Code = USD (U.S.) result.C3 = new C3(); result.C3.CurrencyCode_01 = "USD"; // Repeating N9 result.N9 = new List <N9>(); // Reference Identification Qualifier = “AE” // (Authorization for Expense<AFE> Number) // Reference Identification = 260451 var n91 = new N9(); n91.ReferenceIdentificationQualifier_01 = "AE"; n91.ReferenceIdentification_02 = "260451"; result.N9.Add(n91); // Reference Identification Qualifier // = “OP” (Original Purchase Order) // Reference Identification = 3410889 var n92 = new N9(); n92.ReferenceIdentificationQualifier_01 = "OP"; n92.ReferenceIdentification_02 = "3410889"; result.N9.Add(n92); // Repeating G62 result.G62 = new List <G62>(); // Date Qualifier = “86” (Actual Pickup Date) // Date = 10 / 31 / 2007 var g62 = new G62(); g62.DateQualifier_01 = "86"; g62.Date_02 = "20071031"; result.G62.Add(g62); // Repeating R3 result.R3 = new List <R3>(); // Standard Carrier Alpha Code = EXEM // Routing Sequence Code // = “B” (Origin / Delivery Carrier < Any Mode >) // Transportation Method/ Type Code // = “AE” (Air Express) // Date = 10 / 31 / 2007 // Amount = 379.05 var r3 = new R3(); r3.StandardCarrierAlphaCode_01 = "EXEM"; r3.RoutingSequenceCode_02 = "B"; r3.TransportationMethodTypeCode_04 = "AE"; r3.Date_07 = "20071031"; r3.Amount_08 = "37905"; result.R3.Add(r3); // Repeating N1 Loops result.N1Loop = new List <Loop_N1_210>(); // Begin N1 Loop 1 var n1Loop1 = new Loop_N1_210(); // Entity Identifier Code = “SH” (Shipper) // Name = SIEMENS VDO S A DE C V – // SIEMENS AUTOMOTIVE // Identification Code Qualifier // = “94” (Code assigned by the organization that is // the ultimate destination of the transaction set) // Identification Code = 99999 n1Loop1.N1 = new N1(); n1Loop1.N1.EntityIdentifierCode_01 = "SH"; n1Loop1.N1.Name_02 = "SIEMENS VDO S A DE C V - SIEMENS AUTOMOTIVE"; n1Loop1.N1.IdentificationCodeQualifier_03 = "94"; n1Loop1.N1.IdentificationCode_04 = "99999"; // Repeating N3 n1Loop1.N3 = new List <N3>(); // Address Information // = PERIFERICO SUR 7999D COMPLEJO IND var n31 = new N3(); n31.AddressInformation_01 = "PERIFERICO SUR 7999D COMPLEJO IND"; n1Loop1.N3.Add(n31); // City Name = TLAQUEPAQUE // State or Province Code = MX // Postal Code = 99999 // Country Code = MX n1Loop1.N4 = new N4(); n1Loop1.N4.CityName_01 = "TLAQUEPAQUE"; n1Loop1.N4.StateorProvinceCode_02 = "MX"; n1Loop1.N4.PostalCode_03 = "99999"; n1Loop1.N4.CountryCode_04 = "MX"; // End N1 Loop 1 result.N1Loop.Add(n1Loop1); // Begin N1 Loop 2 var n1Loop2 = new Loop_N1_210(); // Entity Identifier Code = “CN” (Consignee) // Name = BRAMPTON ASSEMBLY – COLLINS // AND AIKMAN // Identification Code Qualifier // = “94” (Code assigned by the organization that is // the ultimate destination of the transaction set) // Identification Code = 09126B n1Loop2.N1 = new N1(); n1Loop2.N1.EntityIdentifierCode_01 = "CN"; n1Loop2.N1.Name_02 = "BRAMPTON ASSEMBLY - COLLINS AND AIKMAN"; n1Loop2.N1.IdentificationCodeQualifier_03 = "94"; n1Loop2.N1.IdentificationCode_04 = "09126B"; // Repeating N3 n1Loop2.N3 = new List <N3>(); // Address Information // = 500 LAIRD ROAD~GUELPH PRODUCTS var n32 = new N3(); n32.AddressInformation_01 = "500 LAIRD ROAD"; n32.AddressInformation_02 = "GUELPH PRODUCTS"; n1Loop2.N3.Add(n32); // City Name = GUELPH // State or Province Code = ON // Postal Code = 99999 // Country Code = CA n1Loop2.N4 = new N4(); n1Loop2.N4.CityName_01 = "GUELPH"; n1Loop2.N4.StateorProvinceCode_02 = "ON"; n1Loop2.N4.PostalCode_03 = "99999"; n1Loop2.N4.CountryCode_04 = "CA"; // End N1 Loop 2 result.N1Loop.Add(n1Loop2); // Begin N1 Loop 3 var n1Loop3 = new Loop_N1_210(); // Entity Identifier Code = “BT” (Bill-to-Party) // Name = BRAMPTON ASSEMBLY - MAIN // Identification Code Qualifier // = “94” (Code assigned by the organization that is // the ultimate destination of the transaction set) // Identification Code = 09126 n1Loop3.N1 = new N1(); n1Loop3.N1.EntityIdentifierCode_01 = "BT"; n1Loop3.N1.Name_02 = "BRAMPTON ASSEMBLY - MAIN"; n1Loop3.N1.IdentificationCodeQualifier_03 = "94"; n1Loop3.N1.IdentificationCode_04 = "09126"; // Repeating N3 n1Loop3.N3 = new List <N3>(); // Address Information // = 2000 WILLIAMS PARKWAY EAST var n33 = new N3(); n33.AddressInformation_01 = "2000 WILLIAMS PARKWAY EAST"; n1Loop3.N3.Add(n33); // City Name = BRAMPTON // State or Province Code = ON // Postal Code = 99999 // Country Code = CA n1Loop3.N4 = new N4(); n1Loop3.N4.CityName_01 = "BRAMPTON"; n1Loop3.N4.StateorProvinceCode_02 = "ON"; n1Loop3.N4.PostalCode_03 = "99999"; n1Loop3.N4.CountryCode_04 = "CA"; // End N1 Loop 3 result.N1Loop.Add(n1Loop3); // Begin N1 Loop 4 var n1Loop4 = new Loop_N1_210(); // Entity Identifier Code = “CA” (Carrier) // Name // = NATIONAL LOGISTICS MANAGEMENT // Identification Code Qualifier // = “94” (Code assigned by the organization that is // the ultimate destination of the transaction set) // Identification Code = 45795 n1Loop4.N1 = new N1(); n1Loop4.N1.EntityIdentifierCode_01 = "CA"; n1Loop4.N1.Name_02 = "NATIONAL LOGISTICS MANAGEMENT"; n1Loop4.N1.IdentificationCodeQualifier_03 = "94"; n1Loop4.N1.IdentificationCode_04 = "45795"; // Repeating N3 n1Loop4.N3 = new List <N3>(); // Address Information = 14320 JOY RD. var n34 = new N3(); n34.AddressInformation_01 = "14320 JOY RD."; n1Loop4.N3.Add(n34); // City Name = DETROIT // State or Province Code = MI // Postal Code = 48228 // Country Code = US n1Loop4.N4 = new N4(); n1Loop4.N4.CityName_01 = "DETROIT"; n1Loop4.N4.StateorProvinceCode_02 = "MI"; n1Loop4.N4.PostalCode_03 = "48228"; n1Loop4.N4.CountryCode_04 = "US"; // End N1 Loop 4 result.N1Loop.Add(n1Loop4); // Begin N1 Loop 5 var n1Loop5 = new Loop_N1_210(); // Entity Identifier Code = “ZZ” (Mutually Defined) // Name = EXPEDITORS / EMERY WORLDWIDE // Identification Code Qualifier // = “94” (Code assigned by the organization that is // the ultimate destination of the transaction set) // Identification Code = 37905 n1Loop5.N1 = new N1(); n1Loop5.N1.EntityIdentifierCode_01 = "ZZ"; n1Loop5.N1.Name_02 = "EXPEDITORS/EMERY WORLDWIDE"; n1Loop5.N1.IdentificationCodeQualifier_03 = "94"; n1Loop5.N1.IdentificationCode_04 = "37905"; // Repeating N3 n1Loop5.N3 = new List <N3>(); // Address Information = 10881 LOWELL AVENUE var n35 = new N3(); n35.AddressInformation_01 = "10881 LOWELL AVENUE"; n1Loop5.N3.Add(n35); // City Name = OVERLANDPARK // State or Province Code = KS // Postal Code = 66201 // Country Code = US n1Loop5.N4 = new N4(); n1Loop5.N4.CityName_01 = "OVERLANDPARK"; n1Loop5.N4.StateorProvinceCode_02 = "KS"; n1Loop5.N4.PostalCode_03 = "66201"; n1Loop5.N4.CountryCode_04 = "US"; // Repeating N9 n1Loop5.N9 = new List <N9>(); // Reference Identification Qualifier // = “IK” (Invoice Number) // Reference Identification = 545930791T var n9 = new N9(); n9.ReferenceIdentificationQualifier_01 = "IK"; n9.ReferenceIdentification_02 = "545930791T"; n1Loop5.N9.Add(n9); // End N1 Loop 5 result.N1Loop.Add(n1Loop5); // Repeating N7 Loops result.N7Loop = new List <Loop_N7_210>(); // Begin N7 Loop var n7Loop1 = new Loop_N7_210(); // Equipment Number = 53456 // Equipment Description Code // = “TL” (Trailer < not otherwise specified>) // Equipment Length = 53 Feet // Equipment Type // = “53ST” (53 Foot Standard Trailer) n7Loop1.N7 = new N7(); n7Loop1.N7.EquipmentNumber_02 = "53456"; n7Loop1.N7.EquipmentDescriptionCode_11 = "TL"; n7Loop1.N7.EquipmentLength_15 = "5300"; n7Loop1.N7.EquipmentType_22 = "53ST"; // End N7 Loop result.N7Loop.Add(n7Loop1); // Repeating LX Loops result.LXLoop = new List <Loop_LX_210>(); // Begin LX Loop var lxLoop1 = new Loop_LX_210(); // Assigned Number = 1 lxLoop1.LX = new LX(); lxLoop1.LX.AssignedNumber_01 = "1"; // Repeating L5 lxLoop1.L5 = new List <L5>(); // Lading Line Item Number= 1 // Commodity Code = “2” (Auto Parts) // Commodity Code Qualifier // = “Z” (Mutually defined) var l5 = new L5(); l5.LadingLineItemNumber_01 = "1"; l5.CommodityCode_03 = "2"; l5.CommodityCodeQualifier_04 = "Z"; lxLoop1.L5.Add(l5); // Repeating L0 lxLoop1.L0 = new List <L0>(); // Lading Line Item Number = 1 // Billed / Rated -as Quantity = 1499 // Billed / Rated -as Qualifier = “FR” (Flat Rate) // Weight = 1499 // Weight Qualifier = “G” (Gross) // Weight Unit Code = “L” (Pounds) var l0 = new L0(); l0.LadingLineItemNumber_01 = "1"; l0.BilledRatedasQuantity_02 = "1499"; l0.BilledRatedasQualifier_03 = "FR"; l0.Weight_04 = "1499"; l0.WeightQualifier_05 = "G"; l0.WeightUnitCode_11 = "L"; lxLoop1.L0.Add(l0); // Repeating L0 lxLoop1.L1 = new List <L1>(); // Lading Line Item Number = 1 // Freight Rate = 51.65 // Rate / Value Qualifier = “FR” (Flat Rate) // Charge = 51.65 // Special Charge or Allowance Code // = “400” (Freight) var l1 = new L1(); l1.LadingLineItemNumber_01 = "1"; l1.FreightRate_02 = "51.65"; l1.RateValueQualifier_03 = "FR"; l1.Charge_04 = "5165"; l1.SpecialChargeorAllowanceCode_08 = "400"; lxLoop1.L1.Add(l1); // End LX Loop result.LXLoop.Add(lxLoop1); // Weight = 2619 // Weight Qualifier = “G” (Gross Weight) // Charge = 51.65 result.L3 = new L3(); result.L3.Weight_01 = "2619"; result.L3.WeightQualifier_02 = "G"; result.L3.Charge_05 = "5165"; return(result); }
private void button1_Click(object sender, EventArgs e) { //(L,B)->(x,y) //c#的sin,cos采用弧度制,asin,acos返回也是弧度 //先度分秒转换 double degreeL = 0, degreeB = 0; string dmsTextL, dmsTextB; if (radioButtonD.Checked)//若以°形式输入,显示即可 { if (BB.Text == "") { MessageBox.Show("请输入B的值"); } if (LL.Text == "") { MessageBox.Show("请输入L的值"); } degreeL = Convert.ToDouble(LL.Text); degreeB = Convert.ToDouble(BB.Text); dmsTextL = D2DMS(degreeL); dmsTextB = D2DMS(degreeB); LL2.Text = dmsTextL; BB2.Text = dmsTextB; } else//若以度分秒形式输入,转换为° { if (BB2.Text == "") { MessageBox.Show("请输入B的值"); } if (LL2.Text == "") { MessageBox.Show("请输入L的值"); } dmsTextB = BB2.Text; dmsTextL = LL2.Text; string[] PrimiryStrB = new String[100]; PrimiryStrB = dmsTextB.Split(','); string[] PrimiryStrL = new String[100]; PrimiryStrL = dmsTextL.Split(','); degreeB = DMS2D(Convert.ToDouble(PrimiryStrB[0]), Convert.ToDouble(PrimiryStrB[1]), Convert.ToDouble(PrimiryStrB[2])); degreeL = DMS2D(Convert.ToDouble(PrimiryStrL[0]), Convert.ToDouble(PrimiryStrL[1]), Convert.ToDouble(PrimiryStrL[2])); LL.Text = degreeL.ToString(); BB.Text = degreeB.ToString(); } double a = Convert.ToDouble(longtextBox.Text); double aa = Convert.ToDouble(denominatorTextBox.Text); double b = a * (1 - 1 / aa); double E = Math.Sqrt(a * a - b * b) / a; double EE = Math.Sqrt(a * a - b * b) / b;//初始化各种数据 double L = degreeL; double B = degreeB; //单位为° B = B * Math.PI / 180; //化为弧度 double t = Math.Tan(B); double n = Math.Sqrt(EE * EE * Math.Cos(B) * Math.Cos(B)); double W = Math.Sqrt(1 - E * E * Math.Sin(B) * Math.Sin(B)); double V = Math.Sqrt(1 + n * n); double N = a / W; double X;//由赤道开始到此点的子午线弧长 double m0, m2, m4, m6, m8; m0 = a * (1 - E * E); m2 = 1.5 * E * E * m0; m4 = 1.25 * E * E * m2; m6 = 7 * E * E * m4 / 6; m8 = 9 * E * E * m6 / 8; double a0, a2, a4, a6, a8; a0 = m0 + m2 / 2 + 3 * m4 / 8 + 5 * m6 / 16 + 35 * m8 / 128; a2 = m2 / 2 + m4 / 2 + 15 * m6 / 32 + 7 * m8 / 16; a4 = m4 / 8 + 3 * m6 / 16 + 7 * m8 / 32; a6 = m6 / 32 + m8 / 16; a8 = m8 / 128; X = a0 * B - a2 * Math.Sin(2 * B) / 2 + a4 * Math.Sin(4 * B) / 4 - a6 * Math.Sin(6 * B) / 6 + a8 * Math.Sin(8 * B) / 8; //这里B单位为弧度 double l; //此点经度与中央子午线的经度之差,在东为正,在西为负,单位″ double L0; if (middleLongitude.Text != "") { L0 = Convert.ToDouble(middleLongitude.Text); } else { L0 = ComputeMid(L); middleLongitude.Text = L0.ToString();//输入至窗体 } //中央子午线经度,单位° l = (L - L0) * 60 * 60;//单位″ double x, y; double SB = Math.Sin(B); double CB = Math.Cos(B); x = X + N * SB * CB * l * l / (2 * p * p) + N * SB * Math.Pow(CB, 3) * (5 - t * t + 9 * n * n + 4 * Math.Pow(n, 4)) * Math.Pow(l, 4) / (24 * Math.Pow(p, 4)) + N * SB * Math.Pow(CB, 5) * (61 - 58 * t * t + Math.Pow(t, 4)) * Math.Pow(l, 6) / (720 * Math.Pow(p, 6)); y = N * CB * l / p + N * Math.Pow(CB, 3) * (1 - t * t + n * n) * Math.Pow(l, 3) / (6 * Math.Pow(p, 3)) + N * Math.Pow(CB, 5) * (5 - 18 * t * t + Math.Pow(t, 4) + 14 * n * n - 58 * n * n * t * t) * Math.Pow(l, 5) / (120 * Math.Pow(p, 5)); /*//电算公式,书p175 * double a0, a3, a4, a5, a6, NN; * NN = 6399698.902 - (21562.267 - (108.973 - 0.612 * CB * CB) * CB * CB) * CB * CB; * a0 = 32140.404 - (135.3302 - (0.7092 - 0.004 * CB * CB) * CB * CB) * CB * CB; * a4 = (0.25 + 0.00252 * CB * CB) * CB * CB - 0.04166; * a6 = (0.166 * CB * CB - 0.084) * CB * CB; * a3 = (0.3333333 + 0.001123 * CB * CB) * CB * CB - 0.16666667; * a5 = 0.0083 - (0.1667 - (0.1968 + 0.004 * CB * CB) * CB * CB) * CB * CB; * //下面的l单位为° * l = l / p; * x = 6367558.4969 * B - (a0 - (0.5 + (a4 + a6 * l * l) * l * l) * l * l * NN) * SB * CB; * y = (1 + (a3 + a5 * l * l) * l * l) * l * NN * CB;*/ xx.Text = x.ToString(); yy.Text = y.ToString(); }
public When_comparing_nested_changes_with_display_string_attributes() { var item1 = new L0 { Version = N.One, MinorVersion = null, L1Property = new L1 { NameProperty = "test name", L2Property = new L2 { ValueProperty = 10, Collection1Property = new[] { new V { XProperty = "x1" }, new V { XProperty = "x2" }, }, Collection2Property = new[] { 1, 2, }, Collection3Property = new[] { N.One, N.Two, }, } } }; var item2 = new L0 { Version = N.Two, MinorVersion = N.One, L1Property = new L1 { NameProperty = "new test name", L2Property = new L2 { ValueProperty = 20, Collection1Property = new[] { new V { XProperty = "x1" }, new V { XProperty = "x3" }, }, Collection2Property = new[] { 1, 3, }, Collection3Property = new[] { N.One, N.Three, }, } } }; result = new GraphComparer().Compare(item1, item2); }